diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d196fe..a4ec500 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,30 +60,27 @@ jobs: with: name: m64p-win64-${{ steps.slug.outputs.sha7 }}.zip path: m64p-*.zip - build-mac: - runs-on: macos-10.15 - steps: - - uses: actions/checkout@v2 - - name: Get short SHA - id: slug - run: echo "::set-output name=sha7::$(git rev-parse --short HEAD)" - #- name: Workaround for failing build - # run: | - # rm -rf /usr/local/bin/2to3 - - name: brew update - run: | - brew update - brew install libsamplerate hidapi sdl2_net sdl2 qt@5 - - name: Run build script - run: | - export qt_version=$(ls /usr/local/Cellar/qt@5) - sudo ln -s /usr/local/Cellar/qt@5/$qt_version/plugins /usr/local/plugins - sudo ln -s /usr/local/Cellar/qt@5/$qt_version/mkspecs /usr/local/mkspecs - sudo ln -s /usr/local/Cellar/qt@5/$qt_version/bin/qmake /usr/local/bin/qmake - export PATH=$PATH:/usr/local/Cellar/qt@5/$qt_version/bin - sudo sh ./build.sh - - name: Upload dmg - uses: actions/upload-artifact@v2 - with: - name: m64p-osx-${{ steps.slug.outputs.sha7 }}.dmg - path: mupen64plus/m64p-*.dmg +# build-mac: +# runs-on: macos-10.15 +# steps: +# - uses: actions/checkout@v2 +# - name: Get short SHA +# id: slug +# run: echo "::set-output name=sha7::$(git rev-parse --short HEAD)" +# - name: brew update +# run: | +# brew update +# brew install libsamplerate hidapi sdl2_net sdl2 qt@5 +# - name: Run build script +# run: | +# export qt_version=$(ls /usr/local/Cellar/qt@5) +# sudo ln -s /usr/local/Cellar/qt@5/$qt_version/plugins /usr/local/plugins +# sudo ln -s /usr/local/Cellar/qt@5/$qt_version/mkspecs /usr/local/mkspecs +# sudo ln -s /usr/local/Cellar/qt@5/$qt_version/bin/qmake /usr/local/bin/qmake +# export PATH=$PATH:/usr/local/Cellar/qt@5/$qt_version/bin +# sudo sh ./build.sh +# - name: Upload dmg +# uses: actions/upload-artifact@v2 +# with: +# name: m64p-osx-${{ steps.slug.outputs.sha7 }}.dmg +# path: mupen64plus/m64p-*.dmg diff --git a/GLideN64/.gitignore b/GLideN64/.gitignore deleted file mode 100644 index 9b4052e..0000000 --- a/GLideN64/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -backup/ -Debug*/ -Release*/ -build*/ -Roms/ -*.aps -*.ncb -*.suo -*.sdf -*.user -src/Revision.h -/projects/msvc/.vs -/projects/msvc/GLideN64.VC.VC.opendb -/projects/msvc/GLideN64.VC.db -/projects/msvc/GeneratedFiles -/projects/cmake/CMakeCache.txt -/projects/cmake/CMakeFiles/ -/projects/cmake/GLideNHQ/ -/projects/cmake/Makefile -/projects/cmake/cmake_install.cmake -/projects/cmake/osal/ -/projects/cmake/mupen64plus-video-GLideN64_autogen/ -.vs -/translations/wtl diff --git a/GLideN64/.travis.yml b/GLideN64/.travis.yml deleted file mode 100644 index ee5ecb6..0000000 --- a/GLideN64/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -dist: xenial - -addons: - apt: - packages: - - libgl1-mesa-dev - - qt5-default - -language: cpp - -os: - - linux - - osx - -compiler: - - gcc - - clang - -env: - - TARGET_CPU=amd64 BUILD_CONFIGURATION=Debug GLIDENUI=On - - TARGET_CPU=amd64 BUILD_CONFIGURATION=Release GLIDENUI=On - # - TARGET_CPU=x86 BUILD_CONFIGURATION=Debug - # - TARGET_CPU=x86 BUILD_CONFIGURATION=Release - -jobs: - exclude: - - os: osx - compiler: gcc - - - os: osx - env: TARGET_CPU=x86 BUILD_CONFIGURATION=Debug - - - os: osx - env: TARGET_CPU=x86 BUILD_CONFIGURATION=Release - -script: - - src/getRevision.sh - - cd projects/cmake - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then export GLIDENUI=Off; fi - - cmake -DCMAKE_BUILD_TYPE=$BUILD_CONFIGURATION -DTARGET_CPU=$TARGET_CPU -DVEC4_OPT=On -DMUPENPLUSAPI=On -DMUPENPLUSAPI_GLIDENUI=$GLIDENUI ../../src/ - - cmake --build . - - cd ../../ diff --git a/GLideN64/LICENSE b/GLideN64/LICENSE deleted file mode 100644 index 4e2c150..0000000 --- a/GLideN64/LICENSE +++ /dev/null @@ -1,359 +0,0 @@ -GLideN64 LICENSE ------------------------------------- - -GLideN64 is licensed under the GNU General Public License version 2. - -The author of GLideN64 is Sergey Lipskiy (c) 2014-2015 - -Credits: -* The project started from sources of glN64 project, author Orkin. -* The project contains source code fragments of glN64 ported to Android - by yongzh (freeman.yong@gmail.com). The original source code of gles2n64 is available at: - http://code.google.com/p/gles2n64/ -* Some ucodes ported from sources of Glide64 project, author Sergey Lipskiy -* LLE code ported from z64 OpenGL LLE plugin, author ziggy. -* Bloom is based on shaders by Nathaniel Meyer, Copyright:Nutty Software, www.nutty.ca. -* GLideNHQ hi-res textures library is OpenGL port of GlideHQ library. - Author of GlideHQ is Hiroshi Morii aka KoolSmoky, Copyright (C) 2007. - Author of the GLideNHQ port is Sergey Lipskiy. - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -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 give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to -this License. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 Program -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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. 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. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/GLideN64/README.md b/GLideN64/README.md deleted file mode 100644 index 7a3e7fa..0000000 --- a/GLideN64/README.md +++ /dev/null @@ -1,16 +0,0 @@ -GLideN64 -======== - -A new generation, open-source graphics plugin for N64 emulators. - -Windows latest build status for master branch: -[![Build status](https://ci.appveyor.com/api/projects/status/vx18fie77cgq23i8/branch/master?svg=true)](https://ci.appveyor.com/project/gonetz/gliden64/branch/master) - -Linux and MacOsX latest build status for master branch: -[![Build Status](https://travis-ci.org/gonetz/GLideN64.svg?branch=master)](https://travis-ci.org/gonetz/GLideN64) - -To get Continuous Integration (CI) builds for mupen64plus and zilmar-spec emulators for Windows: click the build status icon, then select "Artifacts". -You will get a zip containing both builds. Choose the between the 32-bit and 64-bit version depending on your emulator version. -If you want to download an earlier build, go to "History" and select the build you want. - -CI builds have the latest features and fixes, and are generally stable, but may introduce bugs and have incomplete translations. diff --git a/GLideN64/appveyor.yml b/GLideN64/appveyor.yml deleted file mode 100644 index 347dfff..0000000 --- a/GLideN64/appveyor.yml +++ /dev/null @@ -1,76 +0,0 @@ -image: Visual Studio 2017 - -version: 1.0.{build} -pull_requests: - do_not_increment_build_number: true - -environment: - BUILD_PATH: $(APPVEYOR_BUILD_FOLDER)\build - QTDIR_x86: C:\Static_Qt_x86 - QTDIR_x64: C:\Static_Qt_x64 - QT_BUILD_BASE_URL: https://github.com/gonetz/GLideN64/releases/download/qt_build/ - QT_BUILD_x86: qt-5_7_1-x86-msvc2017-static - QT_BUILD_x64: qt-5_7_1-x64-msvc2017-static - # Builds - PJ64PluginsDirQT: $(BUILD_PATH)\QT_for_Project64\ - PJ64PluginsDirQT_x64: $(BUILD_PATH)\QT_for_Project64_x64\ - PJ64PluginsDirWTL: $(BUILD_PATH)\WTL_for_Project64\ - PJ64PluginsDirWTL_x64: $(BUILD_PATH)\WTL_for_Project64_x64\ - Mupen64PluginsDir: $(BUILD_PATH)\for_Mupen64Plus\ - Mupen64PluginsDir_x64: $(BUILD_PATH)\for_Mupen64Plus_x64\ - -before_build: - - curl -L -o %QT_BUILD_x86%.7z %QT_BUILD_BASE_URL%/%QT_BUILD_x86%.7z - - curl -L -o %QT_BUILD_x64%.7z %QT_BUILD_BASE_URL%/%QT_BUILD_x64%.7z - - 7z x -o%QTDIR_x86% %QT_BUILD_x86%.7z - - 7z x -o%QTDIR_x64% %QT_BUILD_x64%.7z - -build_script: - - cd %APPVEYOR_BUILD_FOLDER% - # Zilmar-spec (Qt) - - set QTDIR=%QTDIR_x64%\%QT_BUILD_x64% - - msbuild projects/msvc/GLideNUI.vcxproj /m /p:Configuration=Release;Platform=x64 - - msbuild projects/msvc/GLideN64.sln /m /p:Configuration=Release_qt;Platform=x64 - - set QTDIR=%QTDIR_x86%\%QT_BUILD_x86% - - msbuild projects/msvc/GLideNUI.vcxproj /m /p:Configuration=Release;Platform=Win32 - - msbuild projects/msvc/GLideN64.sln /m /p:Configuration=Release_qt;Platform=Win32 - # Zilmar-spec (WTL) - - msbuild projects/msvc/GLideNUI-wtl.vcxproj /m /p:Configuration=Release;Platform=x64 - - msbuild projects/msvc/GLideN64.sln /m /p:Configuration=Release_wtl;Platform=x64 - - msbuild projects/msvc/GLideNUI-wtl.vcxproj /m /p:Configuration=Release;Platform=Win32 - - msbuild projects/msvc/GLideN64.sln /m /p:Configuration=Release_wtl;Platform=Win32 - # Mupen64Plus (nogui) - - msbuild projects/msvc/GLideN64.sln /m /p:Configuration=Release_mupenplus;Platform=x64 - - msbuild projects/msvc/GLideN64.sln /m /p:Configuration=Release_mupenplus;Platform=Win32 - -after_build: - # Zilmar-spec (Qt) - - copy ini\GLideN64.custom.ini %PJ64PluginsDirQT_x64% - - copy ini\GLideN64.custom.ini %PJ64PluginsDirQT% - - copy translations\release\*.qm %PJ64PluginsDirQT_x64% - - copy translations\release\*.qm %PJ64PluginsDirQT% - # Zilmar-spec (WTL) - - copy ini\GLideN64.custom.ini %PJ64PluginsDirWTL_x64% - - copy ini\GLideN64.custom.ini %PJ64PluginsDirWTL% - - mkdir %PJ64PluginsDirWTL_x64%\translations - - mkdir %PJ64PluginsDirWTL%\translations - - copy translations\wtl\*.Lang %PJ64PluginsDirWTL_x64%\translations - - copy translations\wtl\*.Lang %PJ64PluginsDirWTL%\translations - # Mupen64Plus (nogui) - - copy ini\GLideN64.custom.ini %Mupen64PluginsDir_x64%\ - - copy ini\GLideN64.custom.ini %Mupen64PluginsDir%\ - # Cleanup - - del /Q %PJ64PluginsDirQT_x64%\*.lib %PJ64PluginsDirQT_x64%\*.exp - - del /Q %PJ64PluginsDirQT%\*.lib %PJ64PluginsDirQT%\*.exp - - del /Q %PJ64PluginsDirWTL_x64%\*.lib %PJ64PluginsDirWTL_x64%\*.exp - - del /Q %PJ64PluginsDirWTL%\*.lib %PJ64PluginsDirWTL%\*.exp - - del /Q %Mupen64PluginsDir_x64%\*.lib %Mupen64PluginsDir_x64%\*.exp - - del /Q %Mupen64PluginsDir%\*.lib %Mupen64PluginsDir%\*.exp - - cd %BUILD_PATH% - - ps: $env:revision = git rev-parse --short HEAD - - set archive_name=GLideN64-%revision%-@fname.7z - - forfiles /p %BUILD_PATH% /c "cmd /c 7z a %archive_name% @path\*" - -artifacts: - - path: build\*.7z - name: GLideN64 plugin diff --git a/GLideN64/ini/GLideN64.custom.ini b/GLideN64/ini/GLideN64.custom.ini deleted file mode 100644 index 68ecd32..0000000 --- a/GLideN64/ini/GLideN64.custom.ini +++ /dev/null @@ -1,315 +0,0 @@ -; Custom game settings -[General] -version=13 - -[TWINE] -Good_Name=007 - The World Is Not Enough (E)(U) -frameBufferEmulation\N64DepthCompare=1 - -[40%20WINKS] -Good_Name=40 Winks (E) (M3) (Prototype) -graphics2D\enableNativeResTexrects=1 - -[BIOFREAKS] -Good_Name=Bio F.R.E.A.K.S. (E)(U) -frameBufferEmulation\copyToRDRAM=1 - -[BioHazard%20II] -frameBufferEmulation\copyFromRDRAM=1 -frameBufferEmulation\copyToRDRAM=0 -frameBufferEmulation\copyDepthToRDRAM=0 - -[52150A67] -Good_Name=Bokujou Monogatari 2 (J) -frameBufferEmulation\N64DepthCompare=1 - -[67000C2B] -Good_Name=Eikou no Saint Andrews (J) -frameBufferEmulation\forceDepthBufferClear=1 - -[CAL%20SPEED] -frameBufferEmulation\bufferSwapMode=1 - -[CASTLEVANIA2] -Good_Name=Castlevania - Legacy Of Darkness (E)(U) -frameBufferEmulation\copyToRDRAM=1 - -[DMPJ] -Good_Name=Mario Artist Paint Studio (J) (64DD) -frameBufferEmulation\copyAuxToRDRAM=1 -frameBufferEmulation\copyFromRDRAM=1 -frameBufferEmulation\nativeResFactor=1 -generalEmulation\rdramImageDitheringMode=0 - -[DMTJ] -Good_Name=Mario Artist Talent Studio (J) (64DD) -frameBufferEmulation\copyAuxToRDRAM=1 - -[DINO%20PLANET] -frameBufferEmulation\copyToRDRAM=1 -frameBufferEmulation\copyAuxToRDRAM=1 - -[DONKEY%20KONG%2064] -Good_Name=Donkey Kong 64 (E)(J)(U) -frameBufferEmulation\copyDepthToRDRAM=1 -frameBufferEmulation\N64DepthCompare=0 - -[DR.MARIO%2064] -Good_Name=Dr. Mario 64 (U) -frameBufferEmulation\fbInfoDisabled=0 -frameBufferEmulation\copyFromRDRAM=1 -frameBufferEmulation\copyToRDRAM=0 - -[EXTREME_G] -Good_Name=Extreme-G (E) -frameBufferEmulation\N64DepthCompare=1 - -[EXTREME-G] -Good_Name=Extreme-G (J) -frameBufferEmulation\N64DepthCompare=1 - -[EXTREMEG] -Good_Name=Extreme-G (U) -frameBufferEmulation\N64DepthCompare=1 - -[EXTREME%20G%202] -Good_Name=Extreme-G XG2 (E) (U) -frameBufferEmulation\N64DepthCompare=1 - -[208E05CD] -Good_Name=Extreme-G XG2 (J) -frameBufferEmulation\N64DepthCompare=1 - -[F1%20POLE%20POSITION%2064] -Good_Name=F-1 Pole Position 64 (E)(U) -frameBufferEmulation\copyToRDRAM=1 - -[FLAPPYBIRD64] -Good_Name=FlappyBird64 -frameBufferEmulation\fbInfoDisabled=0 -frameBufferEmulation\copyFromRDRAM=1 -frameBufferEmulation\copyToRDRAM=0 - -[GOEMON2%20DERODERO] -Good_Name=Ganbare Goemon - Dero Dero Douchuu Obake Tenkomori (J) -graphics2D\enableNativeResTexrects=1 - -[GOEMONS%20GREAT%20ADV] -Good_Name=Goemons Great Adventure (U) -graphics2D\enableNativeResTexrects=1 - -[HARVESTMOON64] -Good_Name=Harvest Moon 64 (U) -frameBufferEmulation\N64DepthCompare=1 - -[5CFA0A2E] -Good_Name=Heiwa Pachinko World 64 (J) -frameBufferEmulation\copyToRDRAM=1 - -[HEXEN] -Good_Name=Hexen (E)(F)(G)(J)(U) -frameBufferEmulation\copyToRDRAM=1 - -[HUMAN%20GRAND%20PRIX] -frameBufferEmulation\copyToRDRAM=1 - -[I%20S%20S%2064] -Good_Name=International Superstar Soccer 64 (E) (U) -frameBufferEmulation\N64DepthCompare=1 - -[JET%20FORCE%20GEMINI] -Good_Name=Jet Force Gemini (E)(U) -frameBufferEmulation\fbInfoDisabled=0 -frameBufferEmulation\copyAuxToRDRAM=1 - -[J%20F%20G%20DISPLAY] -; See Jet Force Gemini for notes -Good_Name=Jet Force Gemini Kiosk Demo (U) -frameBufferEmulation\fbInfoDisabled=0 -frameBufferEmulation\copyAuxToRDRAM=1 - -[J%20WORLD%20SOCCER3] -frameBufferEmulation\N64DepthCompare=1 - -[301E07CC] -Good_Name=Mahjong Master (J) -frameBufferEmulation\N64DepthCompare=1 - -[DMGJ] -Good_Name=Mario Artist Polygon Studio (J) -frameBufferEmulation\copyAuxToRDRAM=1 - -[KEN%20GRIFFEY%20SLUGFEST] -Good_Name=Ken Griffey Jr.'s Slugfest -frameBufferEmulation\fbInfoDisabled=0 - -[KIRBY64] -Good_Name=Kirby 64 - The Crystal Shards (E)(J)(U) -graphics2D\enableNativeResTexrects=1 - -[MARIOGOLF64] -Good_Name=Mario Golf (E)(J)(U) -frameBufferEmulation\copyDepthToRDRAM=0 - -[MARIOKART64] -Good_Name=Mario Kart 64 (E)(J)(U) -graphics2D\enableNativeResTexrects=1 -graphics2D\enableTexCoordBounds=1 - -[MARIO%20STORY] -Good_Name=Mario Story (J) -frameBufferEmulation\copyToRDRAM=1 - -[MEGA%20MAN%2064] -Good_Name=Mega Man 64 (U) -graphics2D\correctTexrectCoords=2 - -[MEGAMAN%2064] -Good_Name=Mega Man 64 (Proto) -graphics2D\correctTexrectCoords=2 - -[MLB%20FEATURING%20K%20G%20JR] -Good_Name=Major League Baseball Featuring Ken Griffey Jr. -frameBufferEmulation\fbInfoDisabled=0 - -[MYSTICAL%20NINJA2%20SG] -Good_Name=Mystical Ninja 2 Starring Goemon (E) -graphics2D\enableNativeResTexrects=1 - -[NASCAR%202000] -Good_Name=NASCAR 2000 (U) -frameBufferEmulation\copyToRDRAM=1 - -[NASCAR%2099] -Good_Name=NASCAR 99 (U) -frameBufferEmulation\copyToRDRAM=1 - -[NUD-DMPJ-JPN_convert] -Good_Name=Mario Paint Studio (cart hack) -frameBufferEmulation\copyFromRDRAM=1 - -[NUD-DMTJ-JPN_convert] -Good_Name=Mario Artist Talent Studio (cart hack) -frameBufferEmulation\copyAuxToRDRAM=1 - -[OGREBATTLE64] -Good_Name=Ogre Battle 64 - Person of Lordly Caliber (U) -graphics2D\enableTexCoordBounds=1 - -[OLYMPIC%20HOCKEY] -frameBufferEmulation\bufferSwapMode=1 - -[PAPER%20MARIO] -Good_Name=Paper Mario (E)(U) -frameBufferEmulation\copyToRDRAM=1 -graphics2D\enableTexCoordBounds=1 - -[PENNY%20RACERS] -Good_Name=Penny Racers (E)(U) -frameBufferEmulation\copyToRDRAM=0 - -[PERFECT%20STRIKER] -Good_Name=Jikkyou J.League Perfect Striker (J) -frameBufferEmulation\N64DepthCompare=1 - -[POKEMON%20SNAP] -Good_Name=Pokemon Snap (U) -generalEmulation\rdramImageDitheringMode=1 -frameBufferEmulation\copyAuxToRDRAM=1 -frameBufferEmulation\copyToRDRAM=1 -frameBufferEmulation\fbInfoDisabled=0 - -[POKEMON%20STADIUM] -Good_Name=Pokemon Stadium (U) -frameBufferEmulation\copyDepthToRDRAM=0 - -[POKEMON%20STADIUM%202] -Good_Name=Pokemon Stadium 2 (E)(F)(G)(I)(J)(S)(U) -frameBufferEmulation\copyToRDRAM=0 -frameBufferEmulation\copyDepthToRDRAM=0 - -[POKEMON%20STADIUM%20G%26S] -Good_Name=Pokemon Stadium Kin Gin (J) -frameBufferEmulation\copyToRDRAM=0 -frameBufferEmulation\copyDepthToRDRAM=0 - -[PUZZLE%20LEAGUE%20N64] -Good_Name=Pokemon Puzzle League (E)(F)(G)(U) -texture\enableHalosRemoval=1 - -[RAT%20ATTACK] -Good_Name=Rat Attack -frameBufferEmulation\fbInfoDisabled=0 - -[RESIDENT%20EVIL%20II] -frameBufferEmulation\copyFromRDRAM=1 -frameBufferEmulation\copyToRDRAM=0 -frameBufferEmulation\copyDepthToRDRAM=0 - -[ROCKMAN%20DASH] -Good_Name=Rockman Dash - Hagane no Boukenshin (J) -graphics2D\correctTexrectCoords=2 - -[RUSH%202] -frameBufferEmulation\bufferSwapMode=1 -graphics2D\correctTexrectCoords=2 - -[SAN%20FRANCISCO%20RUSH] -Good_Name=San Francisco Rush Extreme Racing (U) -frameBufferEmulation\bufferSwapMode=1 -graphics2D\enableNativeResTexrects=2 - -[S.F.RUSH] -Good_Name=San Francisco Rush Extreme Racing (E) -frameBufferEmulation\bufferSwapMode=1 -graphics2D\enableNativeResTexrects=2 - -[S.F.%20RUSH] -Good_Name=San Francisco Rush Extreme Racing (U) -frameBufferEmulation\bufferSwapMode=1 -graphics2D\enableNativeResTexrects=2 - -[SHADOWMAN] -Good_Name=Shadow Man (B)(E)(F)(G)(U) -frameBufferEmulation\copyDepthToRDRAM=0 - -[SPACE%20INVADERS] -Good_Name=Space Invaders (U) -frameBufferEmulation\copyToRDRAM=0 - -[STAR%20TWINS] -; See Jet Force Gemini for notes -Good_Name=Star Twins (J) -frameBufferEmulation\fbInfoDisabled=0 -frameBufferEmulation\copyAuxToRDRAM=1 - -[TEST] -Good_Name=Mario Artist Paint Studio (J) (1999-02-11 Prototype) (64DD) -frameBufferEmulation\copyAuxToRDRAM=1 -frameBufferEmulation\copyFromRDRAM=1 -generalEmulation\rdramImageDitheringMode=0 - -[TETRISPHERE] -Good_Name=Tetrisphere (U) -generalEmulation\correctTexrectCoords=2 - -[TIGGER%27S%20HONEY%20HUNT] -Good_Name=Tiggers Honey Hunt (E)(U) -frameBufferEmulation\N64DepthCompare=1 - -[TONIC%20TROUBLE] -Good_Name=Tonic Trouble (E)(U) -frameBufferEmulation\copyToRDRAM=1 - -[TG%20RALLY%202] -frameBufferEmulation\copyToRDRAM=1 - -[TOP%20GEAR%20RALLY%202] -frameBufferEmulation\copyToRDRAM=1 - -[TUROK_DINOSAUR_HUNTE] -Good_Name=Turok - Dinosaur Hunter (E)(G)(U)(J) -frameBufferEmulation\copyDepthToRDRAM=1 - -[W.G.%203DHOCKEY] -frameBufferEmulation\bufferSwapMode=1 diff --git a/GLideN64/ini/GLideN64.ini b/GLideN64/ini/GLideN64.ini deleted file mode 100644 index f538cb5..0000000 --- a/GLideN64/ini/GLideN64.ini +++ /dev/null @@ -1,50 +0,0 @@ -[General] -version=7 - -[video] -fullscreenWidth=640 -fullscreenHeight=480 -windowedWidth=640 -windowedHeight=480 -fullscreenRefresh=60 -multisampling=0 - -[texture] -maxAnisotropy=0 -bilinearMode=1 -maxBytes=524288000 -screenShotFormat=0 - -[generalEmulation] -enableFog=1 -enableNoise=1 -enableLOD=1 -enableHWLighting=0 -enableCustomSettings=1 - -[frameBufferEmulation] -enable=1 -copyToRDRAM=2 -copyDepthToRDRAM=0 -copyFromRDRAM=0 -detectCFB=0 -N64DepthCompare=0 -aspect=1 - -[textureFilter] -txFilterMode=0 -txEnhancementMode=0 -txFilterIgnoreBG=0 -txCacheSize=104857600 -txHiresEnable=0 -txHiresFullAlphaChannel=0 -txHresAltCRC=0 -txDump=0 -txForce16bpp=0 -txCacheCompression=1 -txSaveCache=1 - -[font] -name=arial.ttf -size=18 -color=@Variant(\0\0\0\x43\x1\xff\xff\xb5\xb5\xe6\xe6\x1d\x1d\0\0) diff --git a/GLideN64/licenses/GLSL-FXAA/LICENSE.md b/GLideN64/licenses/GLSL-FXAA/LICENSE.md deleted file mode 100644 index 927a999..0000000 --- a/GLideN64/licenses/GLSL-FXAA/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2014 Matt DesLauriers - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/GLideN64/licenses/GlideHQ/gpl-2.0.txt b/GLideN64/licenses/GlideHQ/gpl-2.0.txt deleted file mode 100644 index d511905..0000000 --- a/GLideN64/licenses/GlideHQ/gpl-2.0.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 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. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -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 give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to -this License. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 Program -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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), 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 Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. 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. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; 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. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/GLideN64/licenses/Glow/LICENSE b/GLideN64/licenses/Glow/LICENSE deleted file mode 100644 index 08fa1fd..0000000 --- a/GLideN64/licenses/Glow/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Nutty Software Open WebGL Framework - -Copyright (C) 2012 Nathaniel Meyer -Nutty Software, http://www.nutty.ca -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - 1. The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - 2. Redistributions in binary or minimized form must reproduce the above copyright - notice and this list of conditions in the documentation and/or other materials - provided with the distribution. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/GLideN64/licenses/gles2n64/LICENSE b/GLideN64/licenses/gles2n64/LICENSE deleted file mode 100644 index cca7fc2..0000000 --- a/GLideN64/licenses/gles2n64/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - 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 that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU 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 as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/GLideN64/licenses/readerwriterqueue/LICENSE.md b/GLideN64/licenses/readerwriterqueue/LICENSE.md deleted file mode 100644 index 76d802e..0000000 --- a/GLideN64/licenses/readerwriterqueue/LICENSE.md +++ /dev/null @@ -1,28 +0,0 @@ -This license applies to all the code in this repository except that written by third -parties, namely the files in benchmarks/ext, which have their own licenses, and Jeff -Preshing's semaphore implementation (used in the blocking queue) which has a zlib -license (embedded in atomicops.h). - -Simplified BSD License: - -Copyright (c) 2013-2015, Cameron Desrochers -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -- Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials -provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/GLideN64/projects/cmake/Readme.txt b/GLideN64/projects/cmake/Readme.txt deleted file mode 100644 index 421c0d5..0000000 --- a/GLideN64/projects/cmake/Readme.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake project files located inside src folder. To build the project with cmake, run - -cmake [-DCMAKE_BUILD_TYPE=Debug] [-DVEC4_OPT=On] [-DCRC_OPT=On] [-DX86_OPT=On] [-DNEON_OPT=On] [DCRC_ARMV8=On] [-DNOHQ=On] [-DUSE_SYSTEM_LIBS=On] -DMUPENPLUSAPI=On ../../src/ - --DCMAKE_BUILD_TYPE=Debug - optional parameter, if you want debug build. Default buid type is Release --DVEC4_OPT=On - optional parameter. set it if you want to enable additional VEC4 optimization (can cause additional bugs). --DCRC_OPT=On - optional parameter. set it to use xxHash to calculate texture CRC. --DX86_OPT=On - optional parameter. set it if you want to enable additional X86 ASM optimization (can cause additional bugs). --DNEON_OPT=On - optional parameter. set it if you want to enable additional ARM NEON optimization (can cause additional bugs). --DCRC_ARMV8=On - optional parameter. set it if you want to enable armv8 hardware CRC. --DNOHQ=On - optional parameter. set to build without realtime texture enhancer library (GLideNHQ). --DUSE_SYSTEM_LIBS=On - optional parameter. set to use system provided libraries for libpng and zlib. --DMUPENPLUSAPI=On - required parameter. currently cmake build works only for mupen64plus version of the plugin. --DODROID=On - set if you need to build on an Odroid board. --DVERO4K=On - set if you need to build on the OSMC Vero4k. diff --git a/GLideN64/projects/msvc/GLideN64.sln b/GLideN64/projects/msvc/GLideN64.sln deleted file mode 100644 index dee7297..0000000 --- a/GLideN64/projects/msvc/GLideN64.sln +++ /dev/null @@ -1,183 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideN64", "GLideN64.vcxproj", "{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}" - ProjectSection(ProjectDependencies) = postProject - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C} = {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C} - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756} = {DA965BCF-2219-47AF-ACE7-EAF76D5D4756} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLideNHQ", "libGLideNHQ.vcxproj", "{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osal", "osal.vcxproj", "{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideNUI", "GLideNUI.vcxproj", "{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideNUI-wtl", "GLideNUI-wtl.vcxproj", "{9E05B70F-A294-44A9-A151-B2CC95AA884E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ticpp", "ticpp.vcxproj", "{4F28B56B-F4B0-41B0-A785-597F6EF0163A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ts2lang", "ts2lang.vcxproj", "{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug_mupenplus|Win32 = Debug_mupenplus|Win32 - Debug_mupenplus|x64 = Debug_mupenplus|x64 - Debug_qt|Win32 = Debug_qt|Win32 - Debug_qt|x64 = Debug_qt|x64 - Debug_wtl|Win32 = Debug_wtl|Win32 - Debug_wtl|x64 = Debug_wtl|x64 - Release_mupenplus|Win32 = Release_mupenplus|Win32 - Release_mupenplus|x64 = Release_mupenplus|x64 - Release_qt|Win32 = Release_qt|Win32 - Release_qt|x64 = Release_qt|x64 - Release_wtl|Win32 = Release_wtl|Win32 - Release_wtl|x64 = Release_wtl|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|Win32.ActiveCfg = Debug_mupenplus|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|Win32.Build.0 = Debug_mupenplus|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|x64.ActiveCfg = Debug_mupenplus|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|x64.Build.0 = Debug_mupenplus|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|Win32.ActiveCfg = Debug_qt|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|Win32.Build.0 = Debug_qt|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|x64.ActiveCfg = Debug_qt|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|x64.Build.0 = Debug_qt|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|Win32.ActiveCfg = Debug_wtl|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|Win32.Build.0 = Debug_wtl|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|x64.ActiveCfg = Debug_wtl|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|x64.Build.0 = Debug_wtl|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|Win32.ActiveCfg = Release_mupenplus|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|Win32.Build.0 = Release_mupenplus|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|x64.ActiveCfg = Release_mupenplus|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|x64.Build.0 = Release_mupenplus|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|Win32.ActiveCfg = Release_qt|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|Win32.Build.0 = Release_qt|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|x64.ActiveCfg = Release_qt|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|x64.Build.0 = Release_qt|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|Win32.ActiveCfg = Release_wtl|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|Win32.Build.0 = Release_wtl|Win32 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|x64.ActiveCfg = Release_wtl|x64 - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|x64.Build.0 = Release_wtl|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|Win32.Build.0 = Debug|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|x64.ActiveCfg = Debug|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|x64.Build.0 = Debug|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|Win32.ActiveCfg = Debug|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|Win32.Build.0 = Debug|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|x64.ActiveCfg = Debug|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|x64.Build.0 = Debug|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|Win32.ActiveCfg = Debug|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|Win32.Build.0 = Debug|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|x64.ActiveCfg = Debug|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|x64.Build.0 = Debug|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|Win32.ActiveCfg = Release|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|Win32.Build.0 = Release|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|x64.ActiveCfg = Release|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|x64.Build.0 = Release|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|Win32.ActiveCfg = Release|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|Win32.Build.0 = Release|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|x64.ActiveCfg = Release|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|x64.Build.0 = Release|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|Win32.ActiveCfg = Release|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|Win32.Build.0 = Release|Win32 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|x64.ActiveCfg = Release|x64 - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|x64.Build.0 = Release|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|Win32.Build.0 = Debug|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|x64.ActiveCfg = Debug|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|x64.Build.0 = Debug|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|Win32.ActiveCfg = Debug|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|Win32.Build.0 = Debug|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|x64.ActiveCfg = Debug|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|x64.Build.0 = Debug|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|Win32.ActiveCfg = Debug|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|Win32.Build.0 = Debug|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|x64.ActiveCfg = Debug|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|x64.Build.0 = Debug|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|Win32.ActiveCfg = Release|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|Win32.Build.0 = Release|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|x64.ActiveCfg = Release|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|x64.Build.0 = Release|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|Win32.ActiveCfg = Release|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|Win32.Build.0 = Release|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|x64.ActiveCfg = Release|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|x64.Build.0 = Release|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|Win32.ActiveCfg = Release|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|Win32.Build.0 = Release|Win32 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|x64.ActiveCfg = Release|x64 - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|x64.Build.0 = Release|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_mupenplus|x64.ActiveCfg = Debug|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|Win32.ActiveCfg = Debug|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|Win32.Build.0 = Debug|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|x64.ActiveCfg = Debug|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|x64.Build.0 = Debug|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_wtl|Win32.ActiveCfg = Debug|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_wtl|x64.ActiveCfg = Debug|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_mupenplus|Win32.ActiveCfg = Release|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_mupenplus|x64.ActiveCfg = Release|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|Win32.ActiveCfg = Release|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|Win32.Build.0 = Release|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|x64.ActiveCfg = Release|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|x64.Build.0 = Release|x64 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_wtl|Win32.ActiveCfg = Release|Win32 - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_wtl|x64.ActiveCfg = Release|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_mupenplus|x64.ActiveCfg = Debug|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_qt|Win32.ActiveCfg = Debug|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_qt|x64.ActiveCfg = Debug|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|Win32.ActiveCfg = Debug|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|Win32.Build.0 = Debug|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|x64.ActiveCfg = Debug|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|x64.Build.0 = Debug|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_mupenplus|Win32.ActiveCfg = Release|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_mupenplus|x64.ActiveCfg = Release|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_qt|Win32.ActiveCfg = Release|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_qt|x64.ActiveCfg = Release|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|Win32.ActiveCfg = Release|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|Win32.Build.0 = Release|Win32 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|x64.ActiveCfg = Release|x64 - {9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|x64.Build.0 = Release|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_mupenplus|x64.ActiveCfg = Debug|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_qt|Win32.ActiveCfg = Debug|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_qt|x64.ActiveCfg = Debug|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|Win32.ActiveCfg = Debug|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|Win32.Build.0 = Debug|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|x64.ActiveCfg = Debug|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|x64.Build.0 = Debug|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_mupenplus|Win32.ActiveCfg = Release|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_mupenplus|x64.ActiveCfg = Release|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_qt|Win32.ActiveCfg = Release|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_qt|x64.ActiveCfg = Release|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|Win32.ActiveCfg = Release|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|Win32.Build.0 = Release|Win32 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|x64.ActiveCfg = Release|x64 - {4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|x64.Build.0 = Release|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_mupenplus|x64.ActiveCfg = Debug|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_qt|Win32.ActiveCfg = Debug|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_qt|x64.ActiveCfg = Debug|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|Win32.ActiveCfg = Debug|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|Win32.Build.0 = Debug|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|x64.ActiveCfg = Debug|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|x64.Build.0 = Debug|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_mupenplus|Win32.ActiveCfg = Release|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_mupenplus|x64.ActiveCfg = Release|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_qt|Win32.ActiveCfg = Release|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_qt|x64.ActiveCfg = Release|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|Win32.ActiveCfg = Release|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|Win32.Build.0 = Release|Win32 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|x64.ActiveCfg = Release|x64 - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - Qt5Version = $(DefaultQtVersion) - SolutionGuid = {D7155823-2893-4425-94B4-BA469E774A27} - EndGlobalSection -EndGlobal diff --git a/GLideN64/projects/msvc/GLideN64.vcxproj b/GLideN64/projects/msvc/GLideN64.vcxproj deleted file mode 100644 index 4a8898a..0000000 --- a/GLideN64/projects/msvc/GLideN64.vcxproj +++ /dev/null @@ -1,558 +0,0 @@ - - - - - Debug_mupenplus - Win32 - - - Debug_mupenplus - x64 - - - Debug_qt - Win32 - - - Debug_qt - x64 - - - Debug_wtl - Win32 - - - Debug_wtl - x64 - - - Release_mupenplus - Win32 - - - Release_mupenplus - x64 - - - Release_qt - Win32 - - - Release_qt - x64 - - - Release_wtl - Win32 - - - Release_wtl - x64 - - - - {37D31D7F-C4E7-45B0-AEF6-D6824A243CF7} - GLideN64 - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - - - true - - - false - - - mupen64plus-video-GLideN64 - - - - ../../src;../../src/inc;../../src/osal;%(AdditionalIncludeDirectories) - UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;TXFILTER_LIB;OS_WINDOWS;%(PreprocessorDefinitions) - false - Level3 - - - Async - true - - - opengl32.lib;glu32.lib;winmm.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName).pdb - $(OutDir)$(TargetName).lib - Windows - - - call ..\..\src\getRevision.bat - - - - - GL_DEBUG;DEBUG_DUMP;%(PreprocessorDefinitions) - Disabled - EnableFastChecks - EditAndContinue - MultiThreadedDebug - - - true - freetype253MT_D.lib;%(AdditionalDependencies) - - - - - Full - ProgramDatabase - MultiThreaded - __VEC4_OPT;%(PreprocessorDefinitions) - AnySuitable - true - Speed - true - NDEBUG;%(PreprocessorDefinitions) - true - true - false - - - false - freetype253MT.lib;%(AdditionalDependencies) - true - true - UseLinkTimeCodeGeneration - - - - - WIN32_ASM;WIN32;%(PreprocessorDefinitions) - - - MachineX86 - - - - - WIN64;%(PreprocessorDefinitions) - - - legacy_stdio_definitions.lib;%(AdditionalDependencies) - - - - - WTL_UI;%(PreprocessorDefinitions) - - - WTL_UI;%(PreprocessorDefinitions) - - - - - lib/msvc12/dbg - lib/dbg - - - - - lib/x64/dbg - - - - - lib/msvc12/rel - lib/rel - - - - - lib/x64/rel - - - - - GL_USE_UNIFORMBLOCK;%(PreprocessorDefinitions) - - - ZILMAR_API;%(PreprocessorDefinitions) - - - Copy result to plugins folder - if NOT "$(PJ64PluginsDirQT)" == "" (if not exist "$(PJ64PluginsDirQT)" mkdir "$(PJ64PluginsDirQT)" -copy /Y "$(OutDir)$(TargetName).*" "$(PJ64PluginsDirQT)") - if NOT "$(PJ64PluginsDirQT_x64)" == "" (if not exist "$(PJ64PluginsDirQT_x64)" mkdir "$(PJ64PluginsDirQT_x64)" -copy /Y "$(OutDir)$(TargetName).*" "$(PJ64PluginsDirQT_x64)") - - - Copy result to plugins folder - if NOT "$(PJ64PluginsDirWTL)" == "" (if not exist "$(PJ64PluginsDirWTL)" mkdir "$(PJ64PluginsDirWTL)" -copy /Y "$(OutDir)$(TargetName).*" "$(PJ64PluginsDirWTL)") - if NOT "$(PJ64PluginsDirWTL_x64)" == "" (if not exist "$(PJ64PluginsDirWTL_x64)" mkdir "$(PJ64PluginsDirWTL_x64)" -copy /Y "$(OutDir)$(TargetName).*" "$(PJ64PluginsDirWTL_x64)") - - - - - MUPENPLUSAPI;%(PreprocessorDefinitions) - - - Copy result to plugins folder - if NOT "$(Mupen64PluginsDir)" == "" (if not exist "$(Mupen64PluginsDir)" mkdir "$(Mupen64PluginsDir)" -copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir)") - if NOT "$(Mupen64PluginsDir_x64)" == "" (if not exist "$(Mupen64PluginsDir_x64)" mkdir "$(Mupen64PluginsDir_x64)" -copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)") - - - - - bin\$(Platform)\Debug\lib\GLideNUI.lib;%(AdditionalDependencies) - - - - - bin\$(Platform)\Debug\lib\GLideNUI-wtl.lib;%(AdditionalDependencies) - - - - - bin\$(Platform)\Release\lib\GLideNUI.lib;%(AdditionalDependencies) - /LTCG %(AdditionalOptions) - - - - - bin\$(Platform)\Release\lib\GLideNUI-wtl.lib;%(AdditionalDependencies) - - - - - ../../src/inc/freetype/include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - true - - - - true - - - true - - - true - - - true - - - true - - - - - - - - - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - true - - - true - - - true - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - {37cab375-a7a6-3cab-bd56-0e954d3fd2fe} - - - - - {9e05b70f-a294-44a9-a151-b2cc95aa884e} - - - - - {da965bcf-2219-47af-ace7-eaf76d5d4756} - - - {7bf6f100-31db-44ae-a2a5-5ddeed9a909c} - - - - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/GLideN64.vcxproj.filters b/GLideN64/projects/msvc/GLideN64.vcxproj.filters deleted file mode 100644 index e94f737..0000000 --- a/GLideN64/projects/msvc/GLideN64.vcxproj.filters +++ /dev/null @@ -1,793 +0,0 @@ - - - - - {315ddc50-16f7-4058-b6e4-05afaad9c0b3} - cpp;c;cxx;def;odl;idl;hpj;bat;asm - - - {23e5405e-5c26-4dcf-8c37-426901e33c55} - - - {94476478-6142-414d-8301-45122ec74f2c} - h;hpp;hxx;hm;inl;inc - - - {80c1d464-fcae-461c-91c8-4c25b4f93055} - - - {384c65a8-5096-4ef9-bdec-3256fcd337f2} - - - {7c6de76c-0fca-47cf-99b1-0ee0fd845d7e} - - - {cad4dfbc-6dba-4d7c-805b-b2ba719da383} - - - {5481df48-dd50-42c8-89e5-670b337403e2} - - - {b10a85f0-0fbb-4f8e-b6d8-78ee2a6394bf} - - - {e9bcfc4d-06e5-496a-a069-3d28e2fcd559} - - - {03c90b24-47cf-4a72-8652-837470d2a641} - - - {763fe27e-e0ab-4884-9794-727c47a9dd24} - - - {ac6b6e3c-c470-4a66-ad6c-d4ad388ec793} - - - {ed46d297-e09c-4187-870c-1f03bc54905f} - - - {abdc978d-26cb-4c32-9b72-4c92b05f9e24} - - - {ac45d108-eb77-4831-b7aa-5efa9e48d4ec} - - - {207de069-1088-4913-84f5-3cf0804928dc} - - - {f6f08b9a-17ba-4e14-a73b-bb0c3878811f} - - - {e67eafa1-5cea-4267-bc12-715e06c744db} - - - {dfff6885-c7e7-4b77-863e-7eeea6753d5a} - - - {e8b5c80f-51ec-45c2-bcdb-5e18868073df} - - - {77259791-9942-4601-a63f-5a0468e69e49} - - - {09919f83-2933-4b48-a4c7-f7bf6e790304} - - - {32e9be50-cb55-445a-9562-bbe05085bbe1} - - - {afe20b4b-eb13-4282-bf72-47335887c770} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\common - - - Source Files\mupenplus - - - Source Files\mupenplus - - - Source Files\windows - - - Source Files\windows - - - Source Files\windows - - - Source Files\windows - - - Source Files\mupenplus - - - Source Files - - - Source Files - - - Source Files - - - Source Files\BufferCopy - - - Source Files\BufferCopy - - - Source Files\BufferCopy - - - Source Files - - - Source Files - - - Source Files\DepthBufferRender - - - Source Files\DepthBufferRender - - - Source Files - - - Source Files - - - Source Files - - - Source Files\Graphics - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files - - - Source Files - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics - - - Source Files\Graphics - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files - - - Source Files\Graphics\OpenGL\windows - - - Source Files\Graphics\OpenGL\windows - - - Source Files\Graphics\OpenGL\mupen64plus - - - Source Files\Graphics\OpenGL - - - Source Files - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files\Graphics\OpenGL - - - Source Files - - - Source Files\Graphics\OpenGL - - - Source Files - - - Source Files\Graphics - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files - - - Source Files - - - Source Files - - - Source Files\uCodes - - - Source Files\uCodes - - - Source Files\Graphics\OpenGL\GLSL - - - Source Files\windows - - - Source Files\mupenplus - - - Source Files\Graphics\OpenGL\ThreadedOpenGL - - - Source Files\Graphics\OpenGL\ThreadedOpenGL - - - Source Files\Graphics\OpenGL\ThreadedOpenGL - - - Source Files\Graphics\OpenGL\ThreadedOpenGL - - - Source Files\Graphics\OpenGL\ThreadedOpenGL - - - Source Files\BufferCopy - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\mupenplus - - - Header Files\windows - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\BufferCopy - - - Header Files\BufferCopy - - - Header Files\BufferCopy - - - Header Files\BufferCopy - - - Header Files - - - Header Files - - - Header Files\DepthBufferRender - - - Header Files\DepthBufferRender - - - Header Files - - - Header Files - - - Header Files\Graphics - - - Header Files\Graphics - - - Header Files\Graphics - - - Header Files\Graphics - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics - - - Header Files - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files - - - Header Files\Graphics - - - Header Files\Graphics - - - Header Files - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files - - - Header Files\Graphics\OpenGL - - - Header Files - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics - - - Header Files - - - Header Files\Graphics - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL - - - Header Files - - - Header Files\Graphics\OpenGL - - - Header Files\Graphics\OpenGL\windows - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files - - - Header Files\uCodes - - - Header Files\uCodes - - - Header Files\Graphics\OpenGL\GLSL - - - Header Files - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\Graphics\OpenGL\ThreadedOpenGL - - - Header Files\BufferCopy - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/GLideN64_builder.cmd b/GLideN64/projects/msvc/GLideN64_builder.cmd deleted file mode 100644 index a81cb9c..0000000 --- a/GLideN64/projects/msvc/GLideN64_builder.cmd +++ /dev/null @@ -1,296 +0,0 @@ -@echo off -setlocal enableextensions disabledelayedexpansion -cls -set DPROJ=GLideN64.sln -set DMN=REM -set ERR=if errorlevel 1 goto err -set MSG=%DPROJ% does not exist in the same directory -if not exist "%~dp0%DPROJ%" goto err - -set ARCH= -set BOTH=0 -set CONF=Release -set KAP=7z -set NO7=0 -set DQTD=1 -set REB= -set NOQT=0 -set NOWTL=0 -set NOM64=0 -set ESIM=0 -set EBQ=start "" explorer . -taskkill /im msbuild.exe /f 2>nul -taskkill /im vctip.exe /f 2>nul -taskkill /im mspdbsrv.exe /f 2>nul -if "%*"=="" goto help -for %%P in (%*) do ( - if /i "%%P"=="--clean" goto clean - if /i "%%P"=="--x86" set ARCH=x86 - if /i "%%P"=="--x64" set ARCH=x64& set BOTH=0 - if /i "%%P"=="--all" set ARCH=x64& set BOTH=1 - if /i "%%P"=="--debug" set CONF=Debug - if /i "%%P"=="--zip" set KAP=zip - if /i "%%P"=="--nopak" set NO7=1 - if /i "%%P"=="--rebuild" set REB=/t:Rebuild - if /i "%%P"=="--noqt" set NOQT=1 - if /i "%%P"=="--nowtl" set NOWTL=1 - if /i "%%P"=="--nom64" set NOM64=1 - if /i "%%P"=="--dlqt" set DQTD=0 - if /i "%%P"=="--sim" set ESIM=1 - if /i "%%P"=="--q" set EBQ=REM -) - -if not defined ARCH goto help -set /a MOD=%NOQT%+%NOWTL%+%NOM64% -set MSG=All compilation tasks were disabled on request -if %MOD%==3 goto err -set MSG=7z was not found in the environment -set /a MOD=%NO7%+%DQTD% -if %MOD% NEQ 2 7z >nul 2>&1 -%ERR% - -set tVSPF=%ProgramFiles(x86)% -if "%PROCESSOR_ARCHITECTURE%"=="x86" set tVSPF=%ProgramFiles% -set "tVSPF=%tVSPF%\Microsoft Visual Studio" -set tVSDS=Common7\Tools\VsDevCmd.bat -set MOD=\Community\ \Enterprise\ \Professional\ -goto vsbeg -:vsenv - for %%V in (%MOD%) do ( - if exist "%tVSPF%%~1%%V%tVSDS%" set "tVSDS=%tVSPF%%~1%%V%tVSDS%" - ) - goto:eof - -:vsbeg -call :vsenv "\2019" -call :vsenv "\2017" -set MOD=\ -call :vsenv " 14.0" -call :vsenv " 12.0" - -set MSG=Visual Studio developer environment was not loaded -msbuild -version >nul 2>&1 -if errorlevel 1 call "%tVSDS%" -%ERR% -set MSG=Git was not found in the environment -git --version >nul 2>&1 -%ERR% - -set "TARCH=%ARCH%" -:X86 -pushd "%~dp0..\..\" -if "%ARCH%"=="x86" set TARCH=Win32 - -if %NOQT%==1 goto noqt -if defined QTDIR_%ARCH% goto nodl -set "QTVER=qt-5_7_1-%ARCH%-msvc2017-static" -if exist "..\Qt\%QTVER%\include\QtCore" goto nodl - -set MSG=Path to Qt %ARCH% was not specified or detected -if %DQTD%==1 goto err -set MSG=cURL was not found in the environment -curl --version >nul 2>&1 -%ERR% -del /f /q "..\%QTVER%.7z" 2>nul -set errorlevel=0 -set QTURL=https://github.com/gonetz/GLideN64/releases/download/qt_build -set MSG=cURL failed to download:^& echo %QTURL%/%QTVER%.7z -curl -L -o "..\%QTVER%.7z" "%QTURL%/%QTVER%.7z" -%ERR% -set MSG=7z failed to extract:^& echo %QTVER%.7z -7z x -y "..\%QTVER%.7z" -o"..\Qt" -%ERR% - -:nodl -set "QTDIR=%~dp0..\..\..\Qt\%QTVER%" -if "%ARCH%"=="x64" ( - if defined QTDIR_x64 set "QTDIR="%QTDIR_x64%"" -) else ( - if defined QTDIR_x86 set "QTDIR="%QTDIR_x86%"" -) -set QTDIR=%QTDIR:"=% -set MSG=Something went wrong when detecting Qt:^& echo %QTDIR% -if not exist "%QTDIR%\include\QtCore" goto err -:noqt - -if not defined BUILDROUTE set "BUILDROUTE="%~dp0..\..\build"" -set BUILDROUTE=%BUILDROUTE:"=% -set "PJ64QT=%BUILDROUTE%\QT_for_Project64_%ARCH%" -set "PJ64WTL=%BUILDROUTE%\WTL_for_Project64_%ARCH%" -set "M64CL=%BUILDROUTE%\for_Mupen64Plus_%ARCH%" -set JACK= -if "%ARCH%"=="x64" set JACK=_x64 -set "PJ64PluginsDirQT%JACK%=%PJ64QT%" -set "PJ64PluginsDirWTL%JACK%=%PJ64WTL%" -set "Mupen64PluginsDir%JACK%=%M64CL%" - -set MOD=%random:~0,1% -if %MOD% LEQ 4 (set MOD=Lylat) else ( -if %MOD% GEQ 8 (set MOD=Kildean) else set MOD=Caryll) - -set MBQT=msbuild -if %ESIM%==1 ( - set "MBQT=echo %MBQT%" - md "translations\wtl" 2>nul - cd.>"translations\wtl\%MOD%.Lang" - del /f /q "%BUILDROUTE%\*_%ARCH%.%KAP%" 2>nul - set errorlevel=0 -) -set "MBWTL=%MBQT%" -set "MBM64=%MBQT%" -if %NOQT%==1 set MBQT=REM -if %NOWTL%==1 set MBWTL=REM -if %NOM64%==1 set MBM64=REM - -set "PTS=Platform=%TARCH%" -if defined TOOLSET set "PTS="%PTS%;PlatformToolset=%TOOLSET%"" -set PTS=%PTS:"=% - -goto mbbeg -:mbcl - %~1 "%~dp0%~2" /m /p:Configuration=%CONF%%~3;%PTS% %REB% - %ERR% - echo. - goto:eof - -:mbbeg -set MSG=Qt version, architecture and path are really correct?^& echo %QTDIR% -call :mbcl "%MBQT%" "GLideNUI.vcxproj" "" -%DMN% -call :mbcl "%MBQT%" "%DPROJ%" "_qt" -%DMN% - -set MSG=ERROR! -call :mbcl "%MBWTL%" "GLideNUI-wtl.vcxproj" "" -%DMN% -call :mbcl "%MBWTL%" "%DPROJ%" "_wtl" -%DMN% - -call :mbcl "%MBM64%" "%DPROJ%" "_mupenplus" -%DMN% - -goto pjqt -:cini - set MSG=Failed to copy some project files to:^& echo %~1 - if %ESIM%==1 md "%~1" 2>nul - set errorlevel=0 - copy /y ini\GLideN64.custom.ini "%~1\" - %ERR% - del /f /q "%~1\*.lib" "%~1\*.exp" 2>nul - set errorlevel=0 - goto:eof - -:pjqt -if %NOQT%==1 goto pjwtl -call :cini "%PJ64QT%" -%DMN% -copy /y translations\release\*.qm "%PJ64QT%\" -%ERR% - -:pjwtl -if %NOWTL%==1 goto mpcl -call :cini "%PJ64WTL%" -%DMN% -md "%PJ64WTL%\translations" 2>nul -set errorlevel=0 -copy /y translations\wtl\*.Lang "%PJ64WTL%\translations\" -%ERR% - -:mpcl -if %NOM64%==1 goto pkg -call :cini "%M64CL%" -%DMN% - -:pkg -for /f "tokens=1" %%R in ('git rev-parse --short HEAD') do set "REV=%%R" -set MSG=The route could not be accessed:^& echo %BUILDROUTE% -pushd "%BUILDROUTE%" -%ERR% -set MOD=the plugins -if %NO7%==0 ( - set MOD=the compressed files - for /f "tokens=*" %%Z in ('dir /ad /b *_%ARCH%') do 7z a -t%KAP% "GLideN64-%REV%-%%Z.%KAP%" ".\%%Z\*" -) - -if "%ARCH%"=="x64" ( - if %BOTH%==1 set ARCH=x86& goto X86 -) - -set MSG=DONE!^& echo Path to %MOD%:^& echo %CD% -%EBQ% -:err -set WTF=%errorlevel% -set DMN=exit /b %WTF% -echo. -echo %MSG% -exit /b %WTF% - -:clean -pushd "%~dp0" -for /f "tokens=*" %%E in ('dir /ad /b') do ( - if /i "%%E" NEQ "lib" rd /s /q "%%E" -) -cd ..\.. -del /f /q "src\Revision.h" 2>nul -rd /s /q "build" 2>nul -rd /s /q "translations\wtl" 2>nul -exit /b 0 - -:help -echo. -echo GLideN64's simplified build and packaging script -echo. -echo Usage: -echo set ^ -echo %~nx0 ^ ^ -echo. -echo ^ -echo set BUILDROUTE=^ -echo e.g. "Z:\My share folder" -echo set QTDIR_x86=^ -echo e.g. "D:\Static Qt\qt-5.7.1-x86-msvc2013" -echo set QTDIR_x64=^ -echo e.g. F:\Qt\qt-5_7_1-x64-msvc2015-static -echo set TOOLSET=^ -echo e.g. v141_xp -echo. -echo ^ -echo --x86 To compile x86 -echo --x64 To compile x64 -echo --all To compile x86 and x64 -echo n.b. If more than one of these is used, only the last one will -echo take effect -echo. -echo ^ -echo --clean Clean ALL auto-generated build files within the project -echo --debug For debug builds -echo --dlqt Auto download and configure Qt for VS2017-2019, it -echo would have no effect if QTDIR_x* is used or if the -echo same version has already been extracted -echo --noqt To build without Qt support, it will ignore the -echo effects of QTDIR_x* and "--dlqt" -echo --nowtl To skip WTL builds -echo --nom64 To skip mupen64plus builds -echo --nopak To skip packing the plugins, "--zip" will be ineffective -echo It will disable 7-Zip completely if "--dlqt" isn't used -echo --rebuild To rebuild without cleaning -echo --sim Simulated build, quick environment check without compiling -echo It's destructive to the final product by creating -echo dummy files, make sure to use "--clean" afterwards -echo --q Don't interact with Windows Explorer at the end -echo --zip Pack to ZIP files instead of 7Z files -echo. -echo Usage examples: -echo. -echo %~nx0 --all --dlqt -echo. -echo %~nx0 --x86 --debug --rebuild -echo. -echo set BUILDROUTE=H:\%USERNAME%\experiment -echo set TOOLSET=ClangCL -echo %~nx0 --noqt --x64 -echo. -echo set QTDIR_x86="G:\Static Qt\qt-5.7.1-x86-msvc2015" -echo set QTDIR_x64=G:\Static Qt\qt-5.7.1-x64-msvc2015 -echo %~nx0 --nowtl --nom64 --all -exit /b 0 diff --git a/GLideN64/projects/msvc/GLideNUI-wtl.vcxproj b/GLideN64/projects/msvc/GLideNUI-wtl.vcxproj deleted file mode 100644 index 6a03411..0000000 --- a/GLideN64/projects/msvc/GLideNUI-wtl.vcxproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - Release - x64 - - - - {9E05B70F-A294-44A9-A151-B2CC95AA884E} - GLideNUIwtl - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - $(DefaultPlatformToolset) - false - NotSet - StaticLibrary - GLideNUI-wtl - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\lib\ - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - $(ProjectName) - true - - - - _WINDOWS;UNICODE;WIN32;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - -Zm200 -w34100 -w34189 %(AdditionalOptions) - $(IntDir) - false - Sync - $(IntDir) - false - $(IntDir)vc$(VisualStudioVersion).pdb - true - true - true - Level3 - $(OutDir)\GLideNUI-wtl.lib - - - imm32.lib;Ws2_32.lib;%(AdditionalDependencies) - - - - - DEBUG_DUMP;_DEBUG;%(PreprocessorDefinitions) - ProgramDatabase - Disabled - MultiThreadedDebug - true - - - - - None - MaxSpeed - MultiThreaded - false - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/GLideNUI-wtl.vcxproj.filters b/GLideN64/projects/msvc/GLideNUI-wtl.vcxproj.filters deleted file mode 100644 index 986b2f3..0000000 --- a/GLideN64/projects/msvc/GLideNUI-wtl.vcxproj.filters +++ /dev/null @@ -1,298 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {b0c2b4e8-31f7-46e5-9b96-cfe8b94db5cf} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files\WTL - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/GLideNUI.pro b/GLideN64/projects/msvc/GLideNUI.pro deleted file mode 100644 index 8329544..0000000 --- a/GLideN64/projects/msvc/GLideNUI.pro +++ /dev/null @@ -1,48 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2015-01-26T21:59:49 -# -#------------------------------------------------- - -QT += core gui -QTPLUGIN += qico - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = GLideNUI -TEMPLATE = lib -CONFIG += staticlib -CONFIG += c++11 - -VPATH += ./../../src/GLideNUI/ -SOURCES += \ - ConfigDialog.cpp \ - GLideNUI.cpp \ - FullscreenResolutions_windows.cpp \ - Settings.cpp \ - ScreenShot.cpp \ - AboutDialog.cpp - -HEADERS += \ - ConfigDialog.h \ - GLideNUI.h \ - FullscreenResolutions.h \ - Settings.h \ - AboutDialog.h - -RESOURCES += \ - icon.qrc - -FORMS += \ - configDialog.ui \ - AboutDialog.ui - -TRANSLATIONS = gliden64_fr.ts \ - gliden64_de.ts \ - gliden64_it.ts \ - gliden64_es.ts \ - gliden64_pl.ts \ - gliden64_pt_BR.ts \ - gliden64_ja.ts - -DISTFILES += diff --git a/GLideN64/projects/msvc/GLideNUI.vcxproj b/GLideN64/projects/msvc/GLideNUI.vcxproj deleted file mode 100644 index edc6217..0000000 --- a/GLideN64/projects/msvc/GLideNUI.vcxproj +++ /dev/null @@ -1,194 +0,0 @@ - - - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - Release - x64 - - - - {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE} - GLideNUI - Qt4VSv1.0 - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - $(DefaultPlatformToolset) - false - NotSet - StaticLibrary - GLideNUI - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\lib\ - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - $(ProjectName) - true - - - - _WINDOWS;UNICODE;WIN32;QT_STATICPLUGIN;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_UITOOLS_LIB;QT_WINEXTRAS_LIB;%(PreprocessorDefinitions) - $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;release;.;$(QTDIR)\mkspecs\win32-msvc2013;.\GeneratedFiles;$(QTDIR)\include\QtUiTools;$(QTDIR)\include\QtWinExtras;$(ProjectDir)..\..\src\osal;%(AdditionalIncludeDirectories) - -Zm200 -w34100 -w34189 %(AdditionalOptions) - $(IntDir) - false - Sync - $(IntDir) - OS_WINDOWS;%(PreprocessorDefinitions) - false - $(IntDir)vc$(VisualStudioVersion).pdb - true - true - true - Level3 - $(OutDir)\GLideNUI.lib - - - $(QTDIR)\lib;$(QTDIR)\plugins\platforms;$(QTDIR)\plugins\imageformats - imm32.lib;Ws2_32.lib;%(AdditionalDependencies) - - - - - DEBUG_DUMP;_DEBUG;%(PreprocessorDefinitions) - ProgramDatabase - Disabled - MultiThreadedDebug - true - - - qtpcred.lib;qtmaind.lib;qwindowsd.lib;qicod.lib;qtharfbuzzngd.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;Qt5PlatformSupportd.lib;%(AdditionalDependencies) - - - Qt5UiToolsd.lib;Qt5WinExtrasd.lib;%(AdditionalDependencies) - - - - - QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - None - MaxSpeed - MultiThreaded - false - - - qtpcre.lib;qtmain.lib;qwindows.lib;qico.lib;qtharfbuzzng.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5PlatformSupport.lib;%(AdditionalDependencies) - - - Qt5UiTools.lib;Qt5WinExtras.lib;%(AdditionalDependencies) - - - true - - - - - - - - true - - - true - - - - - - - - - true - - - true - - - - - - - setlocal -if errorlevel 1 goto VCEnd -if errorlevel 1 goto VCEnd -endlocal -"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o "$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DQT_STATICPLUGIN -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_UITOOLS_LIB -DQT_WINEXTRAS_LIB "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I." "-I$(QTDIR)\mkspecs\win32-msvc2013" "-I.\GeneratedFiles" "-I$(QTDIR)\include\QtUiTools" "-I$(QTDIR)\include\QtWinExtras" - Moc%27ing AboutDialog.h... - $(ConfigurationName)\moc_%(Filename).cpp - $(QTDIR)\bin\moc.exe;%(FullPath) - - - setlocal -if errorlevel 1 goto VCEnd -if errorlevel 1 goto VCEnd -endlocal -"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o "$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DQT_STATICPLUGIN -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_UITOOLS_LIB -DQT_WINEXTRAS_LIB "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I." "-I$(QTDIR)\mkspecs\win32-msvc2013" "-I.\GeneratedFiles" "-I$(QTDIR)\include\QtUiTools" "-I$(QTDIR)\include\QtWinExtras" - Moc%27ing ConfigDialog.h... - $(ConfigurationName)\moc_%(Filename).cpp - $(QTDIR)\bin\moc.exe;%(FullPath) - - - - - - - - - - Document - $(QTDIR)\bin\uic.exe;%(AdditionalInputs) - "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" - Uic%27ing %(Identity)... - .\GeneratedFiles\ui_%(Filename).h;%(Outputs) - - - Document - $(QTDIR)\bin\uic.exe;%(AdditionalInputs) - "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" - Uic%27ing %(Identity)... - .\GeneratedFiles\ui_%(Filename).h;%(Outputs) - - - - - true - - - Document - %(FullPath);.\Icon.ico;%(AdditionalInputs) - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp - Rcc%27ing %(Identity)... - .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - - - - - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/GLideNUI.vcxproj.filters b/GLideN64/projects/msvc/GLideNUI.vcxproj.filters deleted file mode 100644 index 614be9e..0000000 --- a/GLideN64/projects/msvc/GLideNUI.vcxproj.filters +++ /dev/null @@ -1,138 +0,0 @@ - - - - - {99349809-55BA-4b9d-BF79-8FDBB0286EB3} - ui - false - - - {99349809-55BA-4b9d-BF79-8FDBB0286EB3} - ui - false - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - qrc;* - false - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - qrc;* - false - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {81db5148-64bc-4cdf-b666-47488b3cb857} - cpp;moc - False - - - {2d0855ca-d6fc-413c-8d8f-93865ecb277b} - cpp;moc - False - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Generated Files\Debug - - - Generated Files\Release - - - Generated Files\Debug - - - Generated Files\Release - - - Generated Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Form Files - - - Form Files - - - - - Resource Files - - - Resource Files - - - - - Generated Files - - - Generated Files - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/lib/dbg/freetype253MT_D.lib b/GLideN64/projects/msvc/lib/dbg/freetype253MT_D.lib deleted file mode 100644 index 87acf98..0000000 Binary files a/GLideN64/projects/msvc/lib/dbg/freetype253MT_D.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/dbg/libpngd.lib b/GLideN64/projects/msvc/lib/dbg/libpngd.lib deleted file mode 100644 index 0a73efa..0000000 Binary files a/GLideN64/projects/msvc/lib/dbg/libpngd.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/dbg/zlibd.lib b/GLideN64/projects/msvc/lib/dbg/zlibd.lib deleted file mode 100644 index f37736f..0000000 Binary files a/GLideN64/projects/msvc/lib/dbg/zlibd.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/msvc12/dbg/freetype253MT_D.lib b/GLideN64/projects/msvc/lib/msvc12/dbg/freetype253MT_D.lib deleted file mode 100644 index c7ce87c..0000000 Binary files a/GLideN64/projects/msvc/lib/msvc12/dbg/freetype253MT_D.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/msvc12/dbg/libpngd.lib b/GLideN64/projects/msvc/lib/msvc12/dbg/libpngd.lib deleted file mode 100644 index 0bfbf12..0000000 Binary files a/GLideN64/projects/msvc/lib/msvc12/dbg/libpngd.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/msvc12/dbg/zlibd.lib b/GLideN64/projects/msvc/lib/msvc12/dbg/zlibd.lib deleted file mode 100644 index eb54aa8..0000000 Binary files a/GLideN64/projects/msvc/lib/msvc12/dbg/zlibd.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/msvc12/rel/freetype253MT.lib b/GLideN64/projects/msvc/lib/msvc12/rel/freetype253MT.lib deleted file mode 100644 index 35b1458..0000000 Binary files a/GLideN64/projects/msvc/lib/msvc12/rel/freetype253MT.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/msvc12/rel/libpng.lib b/GLideN64/projects/msvc/lib/msvc12/rel/libpng.lib deleted file mode 100644 index a042a98..0000000 Binary files a/GLideN64/projects/msvc/lib/msvc12/rel/libpng.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/msvc12/rel/zlib.lib b/GLideN64/projects/msvc/lib/msvc12/rel/zlib.lib deleted file mode 100644 index b0f328e..0000000 Binary files a/GLideN64/projects/msvc/lib/msvc12/rel/zlib.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/rel/freetype253MT.lib b/GLideN64/projects/msvc/lib/rel/freetype253MT.lib deleted file mode 100644 index 6bccc5f..0000000 Binary files a/GLideN64/projects/msvc/lib/rel/freetype253MT.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/rel/libpng.lib b/GLideN64/projects/msvc/lib/rel/libpng.lib deleted file mode 100644 index a9a0698..0000000 Binary files a/GLideN64/projects/msvc/lib/rel/libpng.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/rel/zlib.lib b/GLideN64/projects/msvc/lib/rel/zlib.lib deleted file mode 100644 index 02555d6..0000000 Binary files a/GLideN64/projects/msvc/lib/rel/zlib.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/x64/dbg/freetype253MT_D.lib b/GLideN64/projects/msvc/lib/x64/dbg/freetype253MT_D.lib deleted file mode 100644 index 5fac6f6..0000000 Binary files a/GLideN64/projects/msvc/lib/x64/dbg/freetype253MT_D.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/x64/dbg/libpngd.lib b/GLideN64/projects/msvc/lib/x64/dbg/libpngd.lib deleted file mode 100644 index 0746dba..0000000 Binary files a/GLideN64/projects/msvc/lib/x64/dbg/libpngd.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/x64/dbg/zlibd.lib b/GLideN64/projects/msvc/lib/x64/dbg/zlibd.lib deleted file mode 100644 index 11f63f4..0000000 Binary files a/GLideN64/projects/msvc/lib/x64/dbg/zlibd.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/x64/rel/freetype253MT.lib b/GLideN64/projects/msvc/lib/x64/rel/freetype253MT.lib deleted file mode 100644 index e52d1b2..0000000 Binary files a/GLideN64/projects/msvc/lib/x64/rel/freetype253MT.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/x64/rel/libpng.lib b/GLideN64/projects/msvc/lib/x64/rel/libpng.lib deleted file mode 100644 index a9d926c..0000000 Binary files a/GLideN64/projects/msvc/lib/x64/rel/libpng.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/lib/x64/rel/zlib.lib b/GLideN64/projects/msvc/lib/x64/rel/zlib.lib deleted file mode 100644 index 17b9bb6..0000000 Binary files a/GLideN64/projects/msvc/lib/x64/rel/zlib.lib and /dev/null differ diff --git a/GLideN64/projects/msvc/libGLideNHQ.vcxproj b/GLideN64/projects/msvc/libGLideNHQ.vcxproj deleted file mode 100644 index 2166cb0..0000000 --- a/GLideN64/projects/msvc/libGLideNHQ.vcxproj +++ /dev/null @@ -1,139 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DA965BCF-2219-47AF-ACE7-EAF76D5D4756} - libGLideNHQ - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - StaticLibrary - false - MultiByte - $(DefaultPlatformToolset) - - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - libGLideNHQ - .lib - $(SolutionDir)bin\$(Platform)\$(Configuration)\lib\ - - - - $(ProjectDir)..\..\src;$(ProjectDir)..\..\src\inc;$(ProjectDir)..\..\src\osal;$(ProjectDir)..\..\src\GLideNHQ\inc;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - NotUsing - true - Level3 - UNICODE;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;OS_WINDOWS;__MSC__;%(PreprocessorDefinitions) - true - $(IntDir) - - - - - WIN32_ASM;%(PreprocessorDefinitions) - - - - - Debug/ - EnableFastChecks - ProgramDatabase - Disabled - Disabled - MultiThreadedDebug - _DEBUG;DEBUG;%(PreprocessorDefinitions) - - - libpngd.lib;zlibd.lib; - - - - - lib/msvc12/dbg - lib/dbg - - - - - lib/x64/dbg - - - - - Release/ - - - AnySuitable - MaxSpeed - MultiThreaded - NDEBUG;%(PreprocessorDefinitions) - - - libpng.lib;zlib.lib; - - - - - lib/msvc12/rel - lib/rel - - - - - lib/x64/rel - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/libGLideNHQ.vcxproj.filters b/GLideN64/projects/msvc/libGLideNHQ.vcxproj.filters deleted file mode 100644 index c8484e3..0000000 --- a/GLideN64/projects/msvc/libGLideNHQ.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - {33102939-F957-4BA3-A93C-F47F30765004} - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/osal.vcxproj b/GLideN64/projects/msvc/osal.vcxproj deleted file mode 100644 index b14e49c..0000000 --- a/GLideN64/projects/msvc/osal.vcxproj +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C} - osal - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - StaticLibrary - $(DefaultPlatformToolset) - MultiByte - - - true - - - false - - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\lib\ - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - - - - Level3 - true - _CRT_SECURE_NO_WARNINGS;UNICODE;OS_WINDOWS;_MBCS;%(PreprocessorDefinitions) - - - true - - - - - Disabled - MultiThreadedDebug - - - - - MaxSpeed - true - true - MultiThreaded - - - true - true - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/osal.vcxproj.filters b/GLideN64/projects/msvc/osal.vcxproj.filters deleted file mode 100644 index 2555193..0000000 --- a/GLideN64/projects/msvc/osal.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/ticpp.vcxproj b/GLideN64/projects/msvc/ticpp.vcxproj deleted file mode 100644 index f5a5604..0000000 --- a/GLideN64/projects/msvc/ticpp.vcxproj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - {4F28B56B-F4B0-41B0-A785-597F6EF0163A} - ticpp - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - StaticLibrary - $(DefaultPlatformToolset) - MultiByte - - - true - - - false - - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\lib\ - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - - - - Level3 - Disabled - TIXML_USE_TICPP;_WINDOWS;WIN32;_DEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions) - - - Windows - - - - - Level3 - Disabled - TIXML_USE_TICPP;_WINDOWS;WIN32;_DEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions) - - - Windows - - - - - Level3 - MaxSpeed - true - true - TIXML_USE_TICPP;_WINDOWS;WIN32;NDEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions) - - - Windows - true - true - - - - - Level3 - MaxSpeed - true - true - TIXML_USE_TICPP;_WINDOWS;WIN32;NDEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions) - - - Windows - true - true - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/ticpp.vcxproj.filters b/GLideN64/projects/msvc/ticpp.vcxproj.filters deleted file mode 100644 index e0dab5f..0000000 --- a/GLideN64/projects/msvc/ticpp.vcxproj.filters +++ /dev/null @@ -1,51 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/ts2lang.vcxproj b/GLideN64/projects/msvc/ts2lang.vcxproj deleted file mode 100644 index 0107fe3..0000000 --- a/GLideN64/projects/msvc/ts2lang.vcxproj +++ /dev/null @@ -1,129 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {5480BC17-9C40-4E41-8AD4-AE12316D4CA4} - ts2lang - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - Application - $(DefaultPlatformToolset) - MultiByte - - - true - - - true - - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\ - true - - - - if not exist "../../translations/wtl" mkdir "../../translations/wtl" -"$(TargetDir)ts2lang.exe" "../../translations" "../../translations/wtl" - Converting .ts translations to .Lang... - - - - - Level3 - Disabled - _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;%(PreprocessorDefinitions) - - - true - - - - - Level3 - Disabled - _CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) - - - true - - - - - Level3 - MaxSpeed - true - true - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;%(PreprocessorDefinitions) - - - true - true - - - - - Level3 - MaxSpeed - true - true - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) - - - true - true - - - - - - - - - - - - {4f28b56b-f4b0-41b0-a785-597f6ef0163a} - true - - - - - - - - - - - - \ No newline at end of file diff --git a/GLideN64/projects/msvc/ts2lang.vcxproj.filters b/GLideN64/projects/msvc/ts2lang.vcxproj.filters deleted file mode 100644 index 80221d6..0000000 --- a/GLideN64/projects/msvc/ts2lang.vcxproj.filters +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - {3f27dc7e-8d4f-4179-815f-f9af8ff8d7c3} - - - {243e9857-b78f-490f-8b77-f3a387040f09} - - - \ No newline at end of file diff --git a/GLideN64/src/3DMath.cpp b/GLideN64/src/3DMath.cpp deleted file mode 100644 index fb12ba5..0000000 --- a/GLideN64/src/3DMath.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include "3DMath.h" - -void MultMatrix(float m0[4][4], float m1[4][4], float dest[4][4]) -{ - int i; - for (i = 0; i < 4; i++) - { - dest[0][i] = m0[0][i]*m1[0][0] + m0[1][i]*m1[0][1] + m0[2][i]*m1[0][2] + m0[3][i]*m1[0][3]; - dest[1][i] = m0[0][i]*m1[1][0] + m0[1][i]*m1[1][1] + m0[2][i]*m1[1][2] + m0[3][i]*m1[1][3]; - dest[2][i] = m0[0][i]*m1[2][0] + m0[1][i]*m1[2][1] + m0[2][i]*m1[2][2] + m0[3][i]*m1[2][3]; - dest[3][i] = m0[3][i]*m1[3][3] + m0[2][i]*m1[3][2] + m0[1][i]*m1[3][1] + m0[0][i]*m1[3][0]; - } -} - -void MultMatrix2(float m0[4][4], float m1[4][4]) -{ - float dst[4][4]; - MultMatrix(m0, m1, dst); - memcpy( m0, dst, sizeof(float) * 16 ); -} - -void TransformVectorNormalize(float vec[3], float mtx[4][4]) -{ - float vres[3]; - vres[0] = mtx[0][0] * vec[0] + mtx[1][0] * vec[1] + mtx[2][0] * vec[2]; - vres[1] = mtx[0][1] * vec[0] + mtx[1][1] * vec[1] + mtx[2][1] * vec[2]; - vres[2] = mtx[0][2] * vec[0] + mtx[1][2] * vec[1] + mtx[2][2] * vec[2]; - vec[0] = vres[0]; - vec[1] = vres[1]; - vec[2] = vres[2]; - - Normalize(vec); -} - -void InverseTransformVectorNormalize(float src[3], float dst[3], float mtx[4][4]) -{ - dst[0] = mtx[0][0] * src[0] + mtx[0][1] * src[1] + mtx[0][2] * src[2]; - dst[1] = mtx[1][0] * src[0] + mtx[1][1] * src[1] + mtx[1][2] * src[2]; - dst[2] = mtx[2][0] * src[0] + mtx[2][1] * src[1] + mtx[2][2] * src[2]; - - Normalize(dst); -} - -void Normalize(float v[3]) -{ -#ifdef WIN32_ASM - __asm { - mov esi, dword ptr [v] - // ST(6) ST(5) ST(4) ST(3) ST(2) ST(1) ST - fld dword ptr [esi+08h] // v2 - fld dword ptr [esi+04h] // v2 v1 - fld dword ptr [esi] // v2 v1 v0 - fld1 // v2 v1 v0 1.0 - fld ST(3) // v2 v1 v0 1.0 v2 - fmul ST, ST // v2 v1 v0 1.0 v2*v2 - fld ST(3) // v2 v1 v0 1.0 v2*v2 v1 - fmul ST, ST // v2 v1 v0 1.0 v2*v2 v1*v1 - fld ST(3) // v2 v1 v0 1.0 v2*v2 v1*v1 v0 - fmul ST, ST // v2 v1 v0 1.0 v2*v2 v1*v1 v0*v0 - fadd // v2 v1 v0 1.0 v2*v2 v1*v1+v0*v0 - fadd // v2 v1 v0 1.0 v2*v2+v1*v1+v0*v0 - ftst // Compare ST to 0 - fstsw ax // Store FPU status word in ax - sahf // Transfer ax to flags register - jz End // Skip if length is zero - fsqrt // v2 v1 v0 1.0 len - fdiv // v2 v1 v0 1.0/len - fmul ST(3), ST // v2*(1.0/len) v1 v0 1.0/len - fmul ST(2), ST // v2*(1.0/len) v1*(1.0/len) v0 1.0/len - fmul // v2*(1.0/len) v1*(1.0/len) v0*(1.0/len) - fstp dword ptr [esi] // v2*(1.0/len) v1*(1.0/len) - fstp dword ptr [esi+04h] // v2*(1.0/len) - fstp dword ptr [esi+08h] // -End: - finit - } -#else // WIN32_ASM - float len; - - len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - if (len != 0.0f) { - len = sqrtf( len ); - v[0] /= len; - v[1] /= len; - v[2] /= len; - } -#endif // WIN32_ASM -} - -void InverseTransformVectorNormalizeN(float src[][3], float dst[][3], float mtx[4][4], u32 count) -{ - for (u32 i = 0; i < count; i++) - { - InverseTransformVectorNormalize(static_cast(src[i]), static_cast(dst[i]), mtx); - } -} - -void CopyMatrix( float m0[4][4], float m1[4][4] ) -{ -#ifdef WIN32_ASM - __asm { - mov esi, [m1] - mov edi, [m0] - - mov eax, dword ptr [esi+00h] - mov dword ptr [edi+00h], eax - mov eax, dword ptr [esi+04h] - mov dword ptr [edi+04h], eax - mov eax, dword ptr [esi+08h] - mov dword ptr [edi+08h], eax - mov eax, dword ptr [esi+0Ch] - mov dword ptr [edi+0Ch], eax - - mov eax, dword ptr [esi+10h] - mov dword ptr [edi+10h], eax - mov eax, dword ptr [esi+14h] - mov dword ptr [edi+14h], eax - mov eax, dword ptr [esi+18h] - mov dword ptr [edi+18h], eax - mov eax, dword ptr [esi+1Ch] - mov dword ptr [edi+1Ch], eax - - mov eax, dword ptr [esi+20h] - mov dword ptr [edi+20h], eax - mov eax, dword ptr [esi+24h] - mov dword ptr [edi+24h], eax - mov eax, dword ptr [esi+28h] - mov dword ptr [edi+28h], eax - mov eax, dword ptr [esi+2Ch] - mov dword ptr [edi+2Ch], eax - - mov eax, dword ptr [esi+30h] - mov dword ptr [edi+30h], eax - mov eax, dword ptr [esi+34h] - mov dword ptr [edi+34h], eax - mov eax, dword ptr [esi+38h] - mov dword ptr [edi+38h], eax - mov eax, dword ptr [esi+3Ch] - mov dword ptr [edi+3Ch], eax - } -#else - memcpy( m0, m1, 16 * sizeof( float ) ); -#endif // WIN32_ASM -} diff --git a/GLideN64/src/3DMath.h b/GLideN64/src/3DMath.h deleted file mode 100644 index da191a1..0000000 --- a/GLideN64/src/3DMath.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _3DMATH_H -#define _3DMATH_H -#include -#include -#include -#include -#include "GBI.h" - -void MultMatrix(float m0[4][4], float m1[4][4], float dest[4][4]); -void MultMatrix2(float m0[4][4], float m1[4][4]); -void TransformVectorNormalize(float vec[3], float mtx[4][4]); -void InverseTransformVectorNormalize(float src[3], float dst[3], float mtx[4][4]); -void InverseTransformVectorNormalizeN(float src[][3], float dst[][3], float mtx[4][4], u32 count); -void Normalize(float v[3]); -float DotProduct(const float v0[3], const float v1[3]); -void CopyMatrix( float m0[4][4], float m1[4][4]); - -inline float DotProduct(const float v0[3], const float v1[3]) -{ - float dot; -#ifdef WIN32_ASM - __asm { - mov esi, dword ptr [v0] - mov edi, dword ptr [v1] - lea ebx, [dot] - - fld dword ptr [esi] - fmul dword ptr [edi] - fld dword ptr [esi+04h] - fmul dword ptr [edi+04h] - fld dword ptr [esi+08h] - fmul dword ptr [edi+08h] - fadd - fadd - fstp dword ptr [ebx] - } -#else // WIN32_ASM - dot = v0[0]*v1[0] + v0[1]*v1[1] + v0[2]*v1[2]; -#endif // WIN32_ASM - return dot; -} - -inline float GetFloatMatrixElement(s16 _int, u16 _fract) -{ - const s32 element = static_cast((static_cast(_int) << 16) | _fract); - return _FIXED2FLOAT(element, 16); -} - -inline std::pair GetIntMatrixElement(f32 _elem) -{ - const s32 value = static_cast(_elem * 65536.0f); - return std::pair(static_cast(value >> 16), static_cast(value & 0xFFFF)); -} - -#endif diff --git a/GLideN64/src/BufferCopy/BlueNoiseTexture.cpp b/GLideN64/src/BufferCopy/BlueNoiseTexture.cpp deleted file mode 100644 index ac8b848..0000000 --- a/GLideN64/src/BufferCopy/BlueNoiseTexture.cpp +++ /dev/null @@ -1,533 +0,0 @@ -#include "BlueNoiseTexture.h" - -const BlueNoiseItem blueNoiseTex[8][64][64] = -{ - { - { { -1, -3, 2 },{ 1, -4, -1 },{ -4, -4, 2 },{ 0, -1, -2 },{ 1, 3, 1 },{ -3, 0, 0 },{ -2, 2, -1 },{ 0, -2, 3 },{ -3, 2, -1 },{ 3, -2, 0 },{ 3, 2, -4 },{ 1, -2, 3 },{ 0, -4, 0 },{ -2, -1, -3 },{ -1, 0, 1 },{ 3, -4, 1 },{ 0, 3, 2 },{ -1, 2, -1 },{ -4, -2, -4 },{ 1, 1, 1 },{ -1, -2, -4 },{ -3, 2, 3 },{ 3, 2, -3 },{ 1, -4, 0 },{ -3, 1, -2 },{ 3, -3, 3 },{ -1, 1, 1 },{ 0, -2, 3 },{ 2, -3, -1 },{ -4, 3, -3 },{ -2, -2, 0 },{ 2, -4, -1 },{ -2, 1, 2 },{ 1, 0, -2 },{ 2, 3, 1 },{ -1, 1, -1 },{ -4, 0, -2 },{ 1, -2, 3 },{ -3, 2, -4 },{ 2, -3, 0 },{ 0, 1, 1 },{ -2, 3, -3 },{ -4, -3, -1 },{ 1, 2, -2 },{ -1, 0, 3 },{ -2, 2, 2 },{ -3, 0, -1 },{ 0, -2, 2 },{ -2, -2, 3 },{ -3, 3, -4 },{ 2, 0, 0 },{ -1, -1, 2 },{ -3, 3, -1 },{ 1, 2, 3 },{ 2, 3, -1 },{ -2, -2, 2 },{ -4, -1, -3 },{ -2, 3, 3 },{ 0, 1, -3 },{ 1, -3, 0 },{ -1, -2, -2 },{ 3, -1, 2 },{ -2, -4, 0 },{ 2, 3, 3 } }, - { { 0, 0, -2 },{ 2, 2, 1 },{ 3, 2, -4 },{ -3, -1, 0 },{ -1, -4, -4 },{ 1, -3, -3 },{ 3, 0, 1 },{ -1, -3, -3 },{ 1, 1, 2 },{ -4, -3, -4 },{ -2, 3, 3 },{ -4, -1, -2 },{ 2, 1, 2 },{ 1, 3, -4 },{ -4, -3, -1 },{ -3, -1, -4 },{ 1, 1, 3 },{ -3, -4, -3 },{ 3, -1, 2 },{ -2, 3, -2 },{ 2, -1, 1 },{ 0, -3, 0 },{ -4, 0, -2 },{ -1, -2, 1 },{ 0, -1, -4 },{ 2, -4, -4 },{ -2, 0, 1 },{ -3, 1, 0 },{ -2, -4, -4 },{ 3, 0, 2 },{ 1, 1, -3 },{ -1, -3, 1 },{ -4, -1, -1 },{ 3, -3, 0 },{ -3, 0, 3 },{ -3, -4, 1 },{ 2, -1, -3 },{ -2, -3, 1 },{ 0, -4, 2 },{ 3, -1, -2 },{ -1, -1, -2 },{ -1, 0, 3 },{ 2, 1, 1 },{ 0, 3, 0 },{ -4, -2, -4 },{ -1, -4, -3 },{ 3, 1, 1 },{ -4, -1, -4 },{ 2, 1, -1 },{ 0, -4, 0 },{ -4, 1, -2 },{ 0, -4, -3 },{ -4, -2, -4 },{ 3, 1, -3 },{ 0, -1, -2 },{ -1, -4, -4 },{ 2, 1, 0 },{ 3, -1, 1 },{ -2, -4, -4 },{ -4, 0, -1 },{ 2, 2, 3 },{ -3, 3, -2 },{ 1, -3, -3 },{ -3, 1, -3 } }, - { { -4, -2, 2 },{ -2, 1, 3 },{ 0, -3, -2 },{ -4, -2, 1 },{ -2, 1, 3 },{ 2, 2, 2 },{ -4, 3, -2 },{ 0, -1, -4 },{ -2, 3, -1 },{ 0, -4, 1 },{ -1, 0, -3 },{ -3, 1, -1 },{ 3, -3, -3 },{ 0, 0, 0 },{ -2, 2, 3 },{ 2, -2, -3 },{ 2, 3, -2 },{ 0, -1, 1 },{ -4, 0, -3 },{ -3, -3, -1 },{ 1, 1, 3 },{ -1, -2, -3 },{ -2, 0, 2 },{ 3, 3, -1 },{ -1, -3, -1 },{ -4, 3, 2 },{ 1, 2, -3 },{ 1, -1, -1 },{ 2, 2, 3 },{ 0, -2, -2 },{ -3, 3, 3 },{ 2, 0, -4 },{ -2, 2, 3 },{ -1, -2, 2 },{ 3, 2, -3 },{ 1, 3, -4 },{ -1, -2, 0 },{ -4, 1, 3 },{ 3, 3, -1 },{ -3, 2, -4 },{ -4, -2, 2 },{ 2, -4, -3 },{ -3, -3, -1 },{ -2, -2, 3 },{ 3, 1, 1 },{ 2, -4, -2 },{ 1, 3, 3 },{ -2, 3, 0 },{ 2, -1, -3 },{ -2, -2, 2 },{ 1, 3, 3 },{ 3, 0, 0 },{ -1, -2, 1 },{ -3, -3, 2 },{ -1, 0, 0 },{ -4, 2, 1 },{ 0, -2, -2 },{ -3, 0, 2 },{ 1, -2, -2 },{ 3, -3, 2 },{ -1, 1, 1 },{ -2, -1, -4 },{ 3, -4, 1 },{ 0, -1, -1 } }, - { { 3, 3, -4 },{ -1, 0, 0 },{ -3, 3, -3 },{ 3, 3, -2 },{ 2, -4, -1 },{ -1, -1, 1 },{ -3, -2, 0 },{ 2, -4, 3 },{ 3, 0, 0 },{ 2, 2, 0 },{ 1, -1, 2 },{ 2, -4, -2 },{ -1, -2, 1 },{ -3, 3, 3 },{ 3, -4, 1 },{ -2, 1, -1 },{ -1, 0, 0 },{ -2, -2, 0 },{ 2, -4, 3 },{ 0, 2, -4 },{ 3, 2, 0 },{ -4, -4, -4 },{ 2, -1, 1 },{ -3, 2, 3 },{ 1, 1, 0 },{ 3, -2, 2 },{ -3, -4, -2 },{ -4, 3, -3 },{ -1, -3, 1 },{ -1, -1, 1 },{ -3, 1, -1 },{ 1, -4, 0 },{ 0, 3, -4 },{ -4, -4, -2 },{ -2, -1, -1 },{ 0, -3, 2 },{ -2, 2, -2 },{ 1, 1, -3 },{ -2, -3, -3 },{ 1, 0, 3 },{ -1, 3, 1 },{ 3, 2, 0 },{ 1, 1, -3 },{ 0, 3, -4 },{ -1, -1, -2 },{ -3, -2, -1 },{ 0, 0, 2 },{ -4, -3, -3 },{ -1, -4, -1 },{ 3, -1, 1 },{ -3, 2, -4 },{ 0, -3, -1 },{ -2, -1, 1 },{ 3, 2, -2 },{ 1, 3, -3 },{ 2, -4, 3 },{ 3, -3, -1 },{ -1, 2, 3 },{ -4, 3, -1 },{ 0, -1, -3 },{ -3, 2, -2 },{ 1, -2, 0 },{ -4, 2, 3 },{ 1, -3, -1 } }, - { { -3, -1, -4 },{ 2, -4, 1 },{ 1, -1, 3 },{ -2, -2, 0 },{ 0, 0, -4 },{ -3, 2, -3 },{ 0, -3, -2 },{ -1, 1, 2 },{ -4, -2, -4 },{ -3, -3, -2 },{ -2, -1, 3 },{ -4, 2, 2 },{ 1, 1, -4 },{ 0, -2, -3 },{ -4, -1, -2 },{ 1, 2, 2 },{ -4, -3, -4 },{ 1, 3, 2 },{ 3, 1, -2 },{ -3, -3, 2 },{ -1, 0, -1 },{ -2, 3, 2 },{ 2, 1, -2 },{ 0, -4, -3 },{ -3, -3, -3 },{ 0, -1, 1 },{ -1, 0, 3 },{ 2, 0, -2 },{ 3, -4, -4 },{ -4, 3, 0 },{ 1, -3, -3 },{ 3, -2, -2 },{ -4, 2, 2 },{ 1, 1, 0 },{ 0, -3, -4 },{ 3, 0, 3 },{ -4, -2, 1 },{ 2, -4, 1 },{ -3, 0, 0 },{ 0, -2, -1 },{ 1, -3, -2 },{ -4, -1, 0 },{ -2, -4, 2 },{ 2, 0, 3 },{ -4, -3, 1 },{ 1, 2, 2 },{ -2, -3, -4 },{ 2, 0, -2 },{ 1, 2, 3 },{ -3, 1, -2 },{ -1, 0, -3 },{ 2, 3, 2 },{ -4, -4, 3 },{ 0, 1, -4 },{ -3, -2, 1 },{ -2, -1, -1 },{ -3, -1, -4 },{ 1, 3, -3 },{ -1, 0, 1 },{ 2, -3, 2 },{ -2, -4, -4 },{ 2, 1, 3 },{ -1, 0, 1 },{ -2, 2, -2 } }, - { { -4, 1, 2 },{ 0, 2, -1 },{ -1, -3, -2 },{ 2, 1, 1 },{ -4, 1, 3 },{ 3, -1, 2 },{ 1, 3, -1 },{ -2, 0, 3 },{ 1, 3, -3 },{ 3, 1, -1 },{ -1, -3, -4 },{ 3, 3, 0 },{ -2, 0, 1 },{ 0, -4, -1 },{ 3, -3, -4 },{ 2, 0, 3 },{ -2, -3, -2 },{ -1, -1, 0 },{ -4, 2, -3 },{ 1, -1, -3 },{ 2, -4, 1 },{ -3, -2, -2 },{ 0, -2, 3 },{ 3, 2, -4 },{ -2, 0, 1 },{ -4, 2, -4 },{ 2, 1, 0 },{ -2, -2, -1 },{ 0, 2, 2 },{ 0, -1, 3 },{ -2, 1, -1 },{ -1, -2, 1 },{ 3, 0, 3 },{ -2, -1, 1 },{ 2, 3, -1 },{ -3, 1, -2 },{ -1, 3, 0 },{ 3, -1, 2 },{ -1, 2, -1 },{ 2, 0, -4 },{ -1, -2, 2 },{ -2, 2, -2 },{ -3, 0, -4 },{ 0, -2, 0 },{ 2, 2, -3 },{ -3, -1, -1 },{ 3, 1, 0 },{ 0, 3, 2 },{ -2, -3, 0 },{ -4, -2, 2 },{ 1, -4, -4 },{ 2, 0, 0 },{ -2, -2, -2 },{ 2, 2, -3 },{ 0, 0, 0 },{ 1, 1, 2 },{ -4, -3, 0 },{ 3, 1, -4 },{ -2, -4, 0 },{ -4, 1, -1 },{ 3, -1, 0 },{ 0, 3, -1 },{ -3, -3, -3 },{ 3, -4, 2 } }, - { { 0, -2, 0 },{ -3, -3, 1 },{ -4, 0, -4 },{ 1, 3, 2 },{ -2, -4, -1 },{ -3, -3, -3 },{ 2, -3, 0 },{ 0, 0, -2 },{ -4, -4, 1 },{ -2, 2, 2 },{ 0, -4, 1 },{ 1, 0, -1 },{ -4, -2, -3 },{ -3, 2, 2 },{ -1, 3, -1 },{ -3, 0, 1 },{ 3, 3, -3 },{ -1, -2, 3 },{ 0, -4, 1 },{ -3, 0, -1 },{ -2, 1, -4 },{ 1, 3, 1 },{ -4, -3, 0 },{ -2, -1, -1 },{ 1, 3, 0 },{ -1, -3, 3 },{ 1, -4, -1 },{ -3, -3, -2 },{ -3, 2, -4 },{ -2, -1, 2 },{ 2, 2, -3 },{ -3, -4, -4 },{ -1, 0, -1 },{ -3, -3, -3 },{ -1, -4, 3 },{ -4, 1, -3 },{ 1, -4, -2 },{ -2, -1, -4 },{ -3, 2, -3 },{ -4, -4, 3 },{ 2, 3, -3 },{ 3, 1, 1 },{ 1, -3, -1 },{ -1, 3, 3 },{ 3, -4, -2 },{ -2, 1, -3 },{ -4, -4, 1 },{ -1, -2, -4 },{ -1, -1, -1 },{ 3, 1, 0 },{ 0, 3, 1 },{ -4, -3, -1 },{ 3, 1, 2 },{ -3, -3, -3 },{ -1, -4, 3 },{ 3, 2, -2 },{ 1, -2, 2 },{ 0, 0, -2 },{ -3, -2, 3 },{ 1, 2, 3 },{ -3, -3, -3 },{ -1, 0, 2 },{ 2, -2, -3 },{ 1, 1, -2 } }, - { { 3, -1, -4 },{ 1, 0, -3 },{ 3, 2, 3 },{ 2, -2, 0 },{ -1, -1, -4 },{ -3, 2, 1 },{ 3, -2, -4 },{ -1, 1, 3 },{ 2, -1, -3 },{ 2, -2, -1 },{ -3, 1, -3 },{ -1, -1, -2 },{ 3, -3, 3 },{ 2, 1, 0 },{ 1, -1, 3 },{ -2, -4, -4 },{ 1, 1, 1 },{ -4, 2, -2 },{ 3, -2, 0 },{ 2, 3, 2 },{ -1, -3, 3 },{ 3, 0, -2 },{ 0, 2, 2 },{ -1, -4, -1 },{ 3, -2, -3 },{ -4, 1, -2 },{ 3, -1, -3 },{ 0, 3, 3 },{ 1, 0, 1 },{ 3, -4, 0 },{ 2, -3, -2 },{ -4, 1, 3 },{ 1, 3, 0 },{ 1, 2, -4 },{ 3, -2, 2 },{ 2, 2, 0 },{ 0, -2, 2 },{ 3, -3, 3 },{ 1, 0, 1 },{ 0, 1, 0 },{ -2, -4, 2 },{ -4, -1, 1 },{ 1, -1, -2 },{ -4, 1, -4 },{ 0, -2, 0 },{ -1, 0, 2 },{ 1, 3, 3 },{ 2, 2, -3 },{ -3, -2, 3 },{ 2, 0, -2 },{ 0, -1, -4 },{ -2, 2, 3 },{ -1, -1, 1 },{ 1, 3, 0 },{ -4, 1, -1 },{ -3, -1, -4 },{ -2, 3, 1 },{ 2, -4, -3 },{ 0, -2, -1 },{ 3, 3, -2 },{ 1, -1, -4 },{ -4, 2, 1 },{ -1, -4, 3 },{ -2, 3, 0 } }, - { { -3, -4, -1 },{ -1, 3, 2 },{ -4, -1, -2 },{ -2, -4, -3 },{ 0, 1, -1 },{ 1, 2, 3 },{ -4, -2, 0 },{ -2, 3, -2 },{ -3, -3, 1 },{ 0, 2, 0 },{ 2, 1, 3 },{ -4, 3, -4 },{ -2, 0, 2 },{ 0, 2, -3 },{ -4, -2, -2 },{ 2, -4, 0 },{ 0, -1, -3 },{ 1, 0, 2 },{ -2, -3, -4 },{ 0, 2, -2 },{ -4, -4, -3 },{ 1, -1, -1 },{ -3, 1, -4 },{ -3, -2, 3 },{ 0, 3, 1 },{ -2, 0, 2 },{ 2, 2, 2 },{ -2, -3, 1 },{ -4, 1, -2 },{ -1, -2, -1 },{ 0, 3, 1 },{ -2, -1, 2 },{ 0, 1, -2 },{ 2, -3, -1 },{ -3, -1, 1 },{ -2, 0, -4 },{ -1, 3, 0 },{ -3, -3, -1 },{ -4, 3, -4 },{ 3, -2, -2 },{ -1, -3, -1 },{ 0, 0, -4 },{ -2, 2, 3 },{ 2, -4, 2 },{ -3, 1, 0 },{ 2, -3, 1 },{ -2, -3, -1 },{ -3, 0, -4 },{ 1, -4, 2 },{ -4, 2, 0 },{ -2, -3, -2 },{ -3, -4, -3 },{ 1, 0, -2 },{ 2, -1, -4 },{ 3, -4, 3 },{ -2, -3, -1 },{ -1, 1, 0 },{ -4, 2, 1 },{ -2, 0, 2 },{ -1, 1, -4 },{ 0, -4, 1 },{ -3, 0, 0 },{ 3, -1, -2 },{ -2, 1, 3 } }, - { { 2, -2, -4 },{ 0, -3, 1 },{ -3, 1, 1 },{ 2, -3, -1 },{ 3, 3, 2 },{ 2, 0, 0 },{ -3, -4, -2 },{ 1, 0, 2 },{ 3, -1, -4 },{ -1, -4, -1 },{ -2, -3, 3 },{ 1, -2, 1 },{ 1, -4, -1 },{ 2, -3, -4 },{ -3, 1, 1 },{ -2, 3, 3 },{ -1, -3, -1 },{ -4, -1, -1 },{ -3, 1, 2 },{ 3, -1, 0 },{ -2, 0, 0 },{ 2, 2, 2 },{ -1, -2, 1 },{ 3, 0, -4 },{ 2, -4, 0 },{ -4, 1, -4 },{ 0, -2, -1 },{ -1, -4, -3 },{ 1, -1, -4 },{ 2, 0, -3 },{ -4, 0, 3 },{ -3, -4, -4 },{ 1, -2, 1 },{ -4, 0, 2 },{ -2, -4, -2 },{ -4, 1, 3 },{ 2, -2, -2 },{ -1, -1, -3 },{ 1, 2, 1 },{ -3, 1, 2 },{ 2, -1, -1 },{ 3, -3, -3 },{ -3, 3, 1 },{ 0, 0, -3 },{ 1, 2, -2 },{ 3, -1, -4 },{ -4, 3, -2 },{ 0, 2, -2 },{ 3, 1, 1 },{ -1, -2, -1 },{ 2, 3, 3 },{ 3, 1, 2 },{ -4, 2, 0 },{ -2, -2, 2 },{ 0, 3, -3 },{ 1, -2, 2 },{ 2, 0, -3 },{ 3, -3, -4 },{ -3, -1, -1 },{ -2, -3, 0 },{ 2, -2, 3 },{ -4, 3, -3 },{ 2, -3, -1 },{ 0, 2, 1 } }, - { { -2, 2, -3 },{ 1, 0, 0 },{ -4, -2, -2 },{ 0, 2, 3 },{ -1, 0, -4 },{ -4, -3, -3 },{ -2, -2, -2 },{ 0, 2, 1 },{ 1, 1, -3 },{ -3, 3, 2 },{ -4, 0, -2 },{ 3, 3, -3 },{ -3, -1, 0 },{ -2, 2, -1 },{ 0, -1, 2 },{ 3, 2, 0 },{ 1, 2, -3 },{ 3, -4, -4 },{ -1, 3, 1 },{ 2, 1, 3 },{ -3, -4, -4 },{ 0, 3, 0 },{ 2, 1, -2 },{ -4, -3, 3 },{ 1, -1, -2 },{ -1, 2, 0 },{ -3, -1, -1 },{ 3, 3, 2 },{ 2, 2, 3 },{ -3, 3, 0 },{ -1, -3, -1 },{ 3, -3, -3 },{ -1, 2, 0 },{ 3, -2, -3 },{ 0, 3, 2 },{ 1, 2, 0 },{ 3, -4, -1 },{ 0, 0, 2 },{ -1, -2, 3 },{ -2, -4, -4 },{ -4, 2, 0 },{ 1, 1, 2 },{ -1, -4, -2 },{ -4, -2, -1 },{ -1, -2, 3 },{ -2, -4, 1 },{ 0, 1, 3 },{ -4, -1, 0 },{ 0, -4, 2 },{ -2, -1, -4 },{ 1, -3, -3 },{ 2, 0, 1 },{ -1, -3, -1 },{ 0, -4, 1 },{ -3, 2, -2 },{ -4, 1, 0 },{ -1, 3, 1 },{ 0, -2, 3 },{ 2, 2, -2 },{ 1, 1, 2 },{ 3, 3, 0 },{ 0, -4, -4 },{ -1, 0, -2 },{ -4, -1, 2 } }, - { { -1, 3, 0 },{ 2, -4, 3 },{ 3, 1, -4 },{ -3, -1, -2 },{ 1, -2, 1 },{ -1, 3, 2 },{ 2, 1, 0 },{ 3, -3, 3 },{ -4, -2, -1 },{ 2, -4, 0 },{ -1, -2, -2 },{ 0, -1, 1 },{ 3, 1, 3 },{ -1, -4, 2 },{ 1, -2, -4 },{ -3, 0, -2 },{ -4, -3, 3 },{ 2, -2, 0 },{ 0, 1, -3 },{ -2, -3, -2 },{ 1, -2, 3 },{ -4, -3, -3 },{ -1, -1, -1 },{ -3, 3, 2 },{ -2, -4, -3 },{ 3, 1, 3 },{ 0, -3, 1 },{ -4, 0, -4 },{ 0, -4, 2 },{ -2, -2, 0 },{ 3, 2, -2 },{ 0, 1, 1 },{ -2, 1, 3 },{ 2, 3, -1 },{ -1, -1, -4 },{ -3, -3, -4 },{ -2, -1, 1 },{ -3, 3, -3 },{ 1, -3, -2 },{ 3, 0, -2 },{ 0, 3, 3 },{ -2, -2, 1 },{ 2, 0, -4 },{ 3, 2, 0 },{ -3, 3, 2 },{ -2, 0, -3 },{ 2, -3, -4 },{ 3, -2, 0 },{ -1, 0, 3 },{ -3, 3, -3 },{ -4, 1, 1 },{ -3, -2, -1 },{ 0, 3, -4 },{ -3, -1, -4 },{ 2, 0, 3 },{ 3, -3, -2 },{ -3, -2, -4 },{ 1, 0, 3 },{ -3, -4, -3 },{ -1, -1, -3 },{ -4, -2, -1 },{ -2, 0, 1 },{ 1, 1, 3 },{ 3, -3, -2 } }, - { { -4, 1, -3 },{ -2, -1, -1 },{ 0, 3, 2 },{ -2, -4, -1 },{ 1, 1, 0 },{ -3, -4, -3 },{ 0, 0, -4 },{ -1, -1, -1 },{ 2, 0, -4 },{ -3, 2, 2 },{ 0, 1, -4 },{ 2, 3, 1 },{ -4, -3, -3 },{ -2, 0, 0 },{ 2, 3, -2 },{ -1, -1, -3 },{ 0, -4, 1 },{ -2, 0, 1 },{ -4, 2, -1 },{ 2, -1, -2 },{ -3, 0, 2 },{ 1, 2, -1 },{ 3, -2, 1 },{ -1, 1, -3 },{ 2, 0, 1 },{ 1, 3, -1 },{ -3, -3, -3 },{ 2, 0, -2 },{ -2, 2, -1 },{ -1, -3, 3 },{ -3, -1, -4 },{ 1, -1, 2 },{ -4, -4, -2 },{ -3, -3, 1 },{ 1, 0, 3 },{ -4, -4, -1 },{ 2, 1, 3 },{ 3, 2, 0 },{ 0, -2, 1 },{ -4, -4, -3 },{ 1, -1, -1 },{ 0, 2, -4 },{ -3, -3, 2 },{ 1, 1, -2 },{ 2, -4, 0 },{ 1, -1, 2 },{ -3, 2, -1 },{ 1, 3, -3 },{ 2, -3, -2 },{ 3, 2, -1 },{ 0, -1, 2 },{ 1, -4, -2 },{ 3, 2, 0 },{ 1, 1, 3 },{ -1, -4, 0 },{ 2, -1, -3 },{ -2, 2, 2 },{ 0, -4, 0 },{ -4, 1, 1 },{ 3, 3, -1 },{ -2, 2, 2 },{ 2, -3, 0 },{ 0, -1, -4 },{ -3, -4, 1 } }, - { { -1, -2, 1 },{ 1, 0, -3 },{ 2, -3, 2 },{ -4, 2, 0 },{ 3, -2, 1 },{ -2, -1, 3 },{ 3, 2, 2 },{ -3, 3, 1 },{ -2, -4, -2 },{ 1, -2, 0 },{ -1, 1, 3 },{ -2, -4, -1 },{ 1, -2, -4 },{ -4, 2, -1 },{ 0, -3, 2 },{ -3, 1, 3 },{ 1, 2, -1 },{ 3, 3, -4 },{ -2, 0, 2 },{ -1, -4, -4 },{ 3, 3, 1 },{ -2, 1, -4 },{ 0, -3, 3 },{ -4, -4, 0 },{ 0, -2, -4 },{ -4, 2, 2 },{ -2, -2, 3 },{ 0, -1, 0 },{ 1, 1, -3 },{ -4, -2, 1 },{ 1, 3, -4 },{ 2, 0, -1 },{ -2, -2, -3 },{ 0, 2, 1 },{ 3, 0, -2 },{ -1, 3, 0 },{ 0, -2, -3 },{ -3, 0, 1 },{ 2, 3, 3 },{ -3, 1, 2 },{ -2, 0, 0 },{ -4, -4, -1 },{ 3, -2, 3 },{ -2, 3, -3 },{ 0, -1, -1 },{ -4, -3, -3 },{ -1, -2, 1 },{ -2, 1, 3 },{ -4, -4, 2 },{ -3, 0, -4 },{ -1, -2, 1 },{ -2, 1, 3 },{ -4, -3, 2 },{ -2, 0, -3 },{ -2, -3, -1 },{ -4, 3, 2 },{ 0, 2, -2 },{ 3, 1, -1 },{ -2, -1, -4 },{ 0, -2, 3 },{ 1, -4, -4 },{ -3, 3, -2 },{ 3, 0, 2 },{ 2, 2, -1 } }, - { { 0, 1, -4 },{ 3, -3, 3 },{ -3, 2, -2 },{ -1, 0, -3 },{ 0, 3, -4 },{ 0, 0, -2 },{ -4, -3, -2 },{ 1, -3, -3 },{ -1, 2, 3 },{ -4, -1, 1 },{ 3, -3, -2 },{ 2, 0, -3 },{ -3, -1, 3 },{ 3, 3, 1 },{ -1, 0, -1 },{ 3, -4, -4 },{ -3, -1, 2 },{ 1, -2, 0 },{ 0, -2, -2 },{ -3, -3, 3 },{ 1, -1, 0 },{ -4, -4, 1 },{ 2, 3, -2 },{ -3, 2, -2 },{ 1, -1, 0 },{ 3, 0, 1 },{ -1, 3, -2 },{ -3, -4, -4 },{ 3, 1, 2 },{ 3, -4, -1 },{ -3, 2, 2 },{ -1, -4, 0 },{ 3, 3, 0 },{ -2, 1, -4 },{ 1, -1, -3 },{ 2, -3, 2 },{ -2, 2, -2 },{ -4, -4, -4 },{ -1, -1, -4 },{ -1, -3, -2 },{ 3, 2, -3 },{ 2, -1, 2 },{ -1, 2, 1 },{ -4, -3, -2 },{ -1, 0, 1 },{ 3, 3, 3 },{ 0, 0, -4 },{ 3, 2, -1 },{ 0, -4, 0 },{ 1, 3, -3 },{ 0, 1, -1 },{ 2, -2, -2 },{ 3, 3, -3 },{ 1, 2, -1 },{ 0, -1, -4 },{ 2, -2, 1 },{ -3, 0, 0 },{ 2, -3, 3 },{ -1, -3, -2 },{ 2, 0, 1 },{ -4, -2, -1 },{ -1, 2, -3 },{ -2, -2, 3 },{ -4, -1, -2 } }, - { { -2, -4, 2 },{ -3, 3, 0 },{ 1, -1, 1 },{ 3, -1, 3 },{ -3, -3, -1 },{ 2, -4, 1 },{ -1, 1, 2 },{ 2, 1, -1 },{ 3, -2, -1 },{ -3, 3, -4 },{ 0, 1, 2 },{ -4, 2, -2 },{ -2, -2, 0 },{ 0, -4, 1 },{ 2, 0, -3 },{ -2, 3, 0 },{ -1, -3, -2 },{ 2, -1, 1 },{ -4, 3, -1 },{ 3, 1, -3 },{ -1, 2, 0 },{ -2, -1, -3 },{ 2, 0, 2 },{ -1, -3, 3 },{ -2, 0, -4 },{ 3, -4, 2 },{ -2, -3, -3 },{ 1, 3, 0 },{ 0, 0, 3 },{ -2, -2, 1 },{ 0, 0, -3 },{ -1, -1, -2 },{ -4, -3, 3 },{ 2, -4, 2 },{ -3, -1, 0 },{ -3, -2, 3 },{ 0, 1, -1 },{ 3, 0, 2 },{ 2, -4, -1 },{ 1, 3, 3 },{ -2, -3, 0 },{ 0, 0, -4 },{ -3, 3, 0 },{ 2, -1, -4 },{ 1, 1, -2 },{ -3, -4, 0 },{ 2, -3, -2 },{ -4, -1, -2 },{ -2, 2, 2 },{ 3, -1, 3 },{ -1, -3, 0 },{ -3, 0, -4 },{ -4, -4, 1 },{ -3, -1, 2 },{ 3, -4, 3 },{ -1, 1, -2 },{ -3, -2, -4 },{ 1, 3, -3 },{ -3, 0, 2 },{ 0, 3, 0 },{ 2, 1, 3 },{ -2, -4, 1 },{ 1, -3, -1 },{ 1, 3, 1 } }, - { { 0, -3, -3 },{ -4, 1, -2 },{ -1, -2, -4 },{ -2, -4, -1 },{ -4, 3, 2 },{ 1, 2, -4 },{ -2, -2, 0 },{ -4, -1, 3 },{ 0, -4, -3 },{ -1, 0, 0 },{ 1, -4, 3 },{ 0, -1, -1 },{ 2, 2, -4 },{ -4, -2, 2 },{ -3, 1, -2 },{ 0, -2, 2 },{ -4, 2, 3 },{ -2, 1, -3 },{ 2, -4, -4 },{ 0, 0, 1 },{ -1, -4, 3 },{ 3, 1, -1 },{ 1, -2, -4 },{ 0, 1, -1 },{ -4, 3, -1 },{ 1, 2, 3 },{ -4, -1, -2 },{ 2, 1, -1 },{ -1, -2, -3 },{ -4, 2, -1 },{ -3, -3, -3 },{ 2, 0, 3 },{ 3, 2, -1 },{ -1, 1, -1 },{ -4, 2, -4 },{ 3, 3, 1 },{ 1, -3, -3 },{ -2, 1, 0 },{ -4, 2, 1 },{ 0, -2, -1 },{ -4, -1, -3 },{ 3, 1, 2 },{ -2, -4, -1 },{ 0, -2, 3 },{ 2, 1, 2 },{ -2, -2, 2 },{ -3, 3, 1 },{ 0, 0, -3 },{ 2, -2, -4 },{ -3, -2, 1 },{ -4, 2, -3 },{ 0, 1, 1 },{ -1, -1, 3 },{ 1, 3, -3 },{ -1, 3, -2 },{ -4, 0, 1 },{ 2, -4, 0 },{ -2, 2, 2 },{ -4, -4, -3 },{ 3, -2, -2 },{ -2, 0, -3 },{ 0, 3, -4 },{ -4, -1, 0 },{ 3, 0, -3 } }, - { { -1, -2, -1 },{ 2, 2, 3 },{ 2, 0, 0 },{ 0, 1, -3 },{ 1, -2, 1 },{ -2, 0, -2 },{ 3, 3, -3 },{ -3, 0, 1 },{ -2, 3, -2 },{ 2, -3, -4 },{ -2, -2, 2 },{ -3, 3, 0 },{ 2, -3, -3 },{ -1, 0, 3 },{ 1, -4, -4 },{ 3, 2, -1 },{ 0, -3, -2 },{ 3, 0, 1 },{ -3, 3, 2 },{ -2, -2, -1 },{ -3, 2, -2 },{ -4, -3, 1 },{ -3, 2, 2 },{ 2, -2, -3 },{ -2, -4, 1 },{ 0, -2, 1 },{ -3, 0, -4 },{ -1, -3, 3 },{ 3, -1, 0 },{ 2, -4, 1 },{ -3, 3, -4 },{ 1, 3, 1 },{ -2, -3, -4 },{ 0, -2, 1 },{ 1, -4, -3 },{ -1, 0, -2 },{ -1, -1, 2 },{ -3, -2, -4 },{ 2, 2, 3 },{ 0, 0, -2 },{ -2, 3, 1 },{ 1, -3, 3 },{ -3, -2, -2 },{ 0, 2, 0 },{ -4, 0, -4 },{ 3, 2, -3 },{ -1, -4, 2 },{ 1, 1, 3 },{ -1, 0, -1 },{ 1, -4, -1 },{ 2, 3, 3 },{ 3, -3, -2 },{ 2, -4, -1 },{ -2, -1, -1 },{ 1, -3, 0 },{ 0, 2, 3 },{ 3, -3, -4 },{ -1, -1, -1 },{ 1, 2, 1 },{ 0, -1, 3 },{ -3, 2, -4 },{ 3, -3, -1 },{ 2, 1, 2 },{ -3, 2, 2 } }, - { { -2, 0, -4 },{ -3, -3, 3 },{ 3, -4, 0 },{ -4, -1, -2 },{ -1, 1, 1 },{ 3, -3, 3 },{ 0, -4, 0 },{ 2, -2, -1 },{ 1, 1, 3 },{ 3, 2, 1 },{ -4, 0, -3 },{ 1, 1, -2 },{ 3, 1, -1 },{ -2, 3, 1 },{ -3, 0, 0 },{ 2, -2, 1 },{ -4, -1, -4 },{ 1, -4, 0 },{ -1, -1, 3 },{ 2, -2, -3 },{ 1, 3, -4 },{ 3, -1, -2 },{ -1, -3, 3 },{ -3, 3, 0 },{ 3, 1, -3 },{ 1, -1, 0 },{ 2, 1, -2 },{ -3, 3, -1 },{ 0, 2, 2 },{ 1, -3, -2 },{ 0, 1, 2 },{ 3, -2, 0 },{ -3, 0, -2 },{ -4, -1, 2 },{ -2, 3, 3 },{ 2, 1, 0 },{ 1, -4, -2 },{ -1, 3, -4 },{ -3, -3, 2 },{ 3, -4, -1 },{ -3, -1, -4 },{ 2, 1, 0 },{ -1, -4, -3 },{ 3, 3, 1 },{ -2, -3, -1 },{ -3, -1, -1 },{ 2, -3, -2 },{ -4, -1, 1 },{ 3, 2, 0 },{ -2, -3, -4 },{ -3, 1, 2 },{ -1, -2, -4 },{ 0, 0, 0 },{ -4, 1, -4 },{ -3, -2, 2 },{ -3, 0, -3 },{ 2, 3, 1 },{ -2, -1, -1 },{ -4, -3, 0 },{ 1, 1, -2 },{ -3, -3, 1 },{ 1, 0, 0 },{ -1, -2, 3 },{ 0, -4, -2 } }, - { { 1, 2, 1 },{ -2, -1, 1 },{ 1, 3, -4 },{ -2, 0, 2 },{ -3, 3, -3 },{ 0, 2, -2 },{ -4, -3, 2 },{ -3, 2, -4 },{ -1, -1, -3 },{ -4, -4, 0 },{ -2, -3, 3 },{ -1, -1, 2 },{ 0, -3, -4 },{ -4, -4, 3 },{ 1, -1, -3 },{ -1, 2, -2 },{ -2, 3, 3 },{ -3, 1, -1 },{ 0, 2, -3 },{ -4, -3, 2 },{ 1, 1, 1 },{ 0, -4, 2 },{ 2, 0, 0 },{ -2, 0, -2 },{ 1, 2, -4 },{ -4, -4, 3 },{ 3, -2, 2 },{ -1, 0, -3 },{ -2, -4, -4 },{ -4, -1, -2 },{ -1, 1, 3 },{ -2, -4, 0 },{ 1, 2, -3 },{ 3, -1, 2 },{ 2, -3, -3 },{ -2, 2, -1 },{ -4, -2, 3 },{ 3, 1, 1 },{ 1, 0, -1 },{ 1, -3, -3 },{ -1, 3, 1 },{ 3, 0, -2 },{ -4, 2, 2 },{ 1, -1, 3 },{ -1, 0, -3 },{ 1, 2, 0 },{ 0, 3, -4 },{ -2, -3, -3 },{ -3, 2, -1 },{ 0, -1, -3 },{ -4, -4, 1 },{ 1, 0, 0 },{ -2, 2, 3 },{ 3, 2, 2 },{ 2, -4, -3 },{ 1, -2, -2 },{ -1, 1, 3 },{ -1, -4, -4 },{ 3, 0, 2 },{ 2, 3, -3 },{ -2, -4, 3 },{ -4, -1, -1 },{ 3, 3, -3 },{ -4, 1, -2 } }, - { { 1, -2, -1 },{ 3, -3, -3 },{ -1, 2, -1 },{ 0, -4, 2 },{ 3, -2, -1 },{ 1, -1, -4 },{ -2, -1, 0 },{ 1, 1, 1 },{ 3, -2, -1 },{ 0, 1, 2 },{ 1, 3, -2 },{ 3, -2, -4 },{ 0, 3, 0 },{ -3, -1, -1 },{ 3, 1, 2 },{ 0, -3, -1 },{ 1, -2, -4 },{ 3, -3, 1 },{ 2, 1, -2 },{ -1, 0, 0 },{ -2, -1, -1 },{ -2, 3, -4 },{ -4, -2, -3 },{ 0, -3, 2 },{ -1, -3, 1 },{ -2, 3, -1 },{ -4, 1, 1 },{ 2, -3, 2 },{ -2, 0, 0 },{ 2, 3, 2 },{ -3, 0, -1 },{ 2, -2, -4 },{ -4, 3, 3 },{ -1, -4, -1 },{ 0, 1, -4 },{ -3, -3, 0 },{ 0, -1, 1 },{ -4, 2, -3 },{ -2, -1, 2 },{ 0, 2, 0 },{ -4, -2, 3 },{ -2, 0, 0 },{ -1, -3, -4 },{ -3, -2, -2 },{ 3, 1, 1 },{ 0, -4, 2 },{ -3, -2, 3 },{ 3, 0, 2 },{ -1, 0, 3 },{ 2, 3, 1 },{ 3, 1, -2 },{ -3, -2, -2 },{ -2, 3, -3 },{ -1, -3, -1 },{ -4, -1, 1 },{ 0, -4, -1 },{ -4, 2, 0 },{ 1, 1, -3 },{ -3, -2, 2 },{ -1, -2, -4 },{ 2, 3, -1 },{ 0, 1, 2 },{ -1, -1, -4 },{ 2, -4, 0 } }, - { { -4, 0, 3 },{ -3, 3, -3 },{ -1, 1, 3 },{ -4, -2, -2 },{ 2, 1, -1 },{ -4, -4, 3 },{ -1, 3, 2 },{ -2, 2, -2 },{ 2, 0, -3 },{ -3, -3, 0 },{ -1, 0, 1 },{ 2, 2, -1 },{ -3, -2, 1 },{ 2, 0, -2 },{ -2, -4, -3 },{ 2, 3, 2 },{ -4, 0, 0 },{ -1, 0, 2 },{ -2, -4, -3 },{ -3, 3, 2 },{ 2, -2, -1 },{ 3, 1, 3 },{ -3, 2, 1 },{ 2, 2, -1 },{ 3, -2, -3 },{ -1, -1, -2 },{ 0, 3, -4 },{ 3, -2, -3 },{ 0, 2, -1 },{ -4, -3, -3 },{ 3, -1, 1 },{ 1, -3, -1 },{ -2, 1, 1 },{ -1, 2, 0 },{ 2, -1, -2 },{ -3, 0, 3 },{ 1, 3, -2 },{ 2, -4, -4 },{ 2, 1, -1 },{ -3, -3, -2 },{ 0, -4, -3 },{ 2, 2, -1 },{ 2, -1, 2 },{ 0, -3, -1 },{ -4, 3, -1 },{ 2, -1, 1 },{ -1, 1, -2 },{ 2, -2, -4 },{ -4, -3, 0 },{ 1, -2, -4 },{ -1, -4, -1 },{ 2, -1, 2 },{ 0, -3, 0 },{ 1, 0, -4 },{ 2, 1, 1 },{ 3, 3, 3 },{ -2, -3, -2 },{ 2, 2, 2 },{ 0, -1, 0 },{ -4, -4, -2 },{ 3, 0, 0 },{ -3, -2, -3 },{ -2, -3, 3 },{ -3, 3, 1 } }, - { { 2, -1, -2 },{ 3, -4, 0 },{ 1, -1, 2 },{ -2, -1, 1 },{ 2, 2, 0 },{ -1, 0, -4 },{ 1, -3, -3 },{ 3, -4, 2 },{ -4, -2, -1 },{ 0, 3, -4 },{ -4, -4, 3 },{ -2, 1, -3 },{ 1, -4, 3 },{ -3, 2, -3 },{ -1, -3, 0 },{ -4, 1, 3 },{ -3, 2, -4 },{ 0, -2, -1 },{ 2, -2, 3 },{ -4, 2, -2 },{ 1, -3, -4 },{ 0, -4, 0 },{ 0, -4, -3 },{ -4, 0, 1 },{ 2, 1, 3 },{ -3, -4, 0 },{ 1, 0, 0 },{ -3, -2, 3 },{ -1, -4, -2 },{ 1, 2, 0 },{ -3, -2, 3 },{ 0, 1, -3 },{ 3, -4, -4 },{ -4, 0, 2 },{ 1, -2, -3 },{ 3, -4, 2 },{ -2, 0, 1 },{ -1, -2, -1 },{ -2, 2, 3 },{ 1, 3, 1 },{ 3, -1, -4 },{ -2, 1, 3 },{ -3, 3, 0 },{ 1, -4, -3 },{ -2, 2, -4 },{ -4, -1, -1 },{ 1, -4, -3 },{ -3, 3, 0 },{ 0, 2, -2 },{ -2, 0, 2 },{ -4, 1, 3 },{ 1, 3, -3 },{ 3, -4, 1 },{ -3, 2, 3 },{ -3, -1, -4 },{ -1, -2, -1 },{ -3, 0, -4 },{ 3, -3, -3 },{ -2, 0, 1 },{ -1, 2, 1 },{ 1, 1, 3 },{ -2, -1, -2 },{ 3, 2, 2 },{ 0, 0, -1 } }, - { { -1, 1, -4 },{ 0, -3, -2 },{ -4, 2, -4 },{ 0, -4, -3 },{ -3, 3, -2 },{ 3, -3, 1 },{ -3, 1, 0 },{ 0, -2, -1 },{ -1, 2, 3 },{ 2, -1, 1 },{ 3, -1, -2 },{ -1, -3, 0 },{ 2, 0, -4 },{ 0, 3, 2 },{ 3, -1, 1 },{ 1, -2, -1 },{ 1, -1, -2 },{ 3, -4, -3 },{ -1, 0, 1 },{ 0, 3, -4 },{ -3, 1, 3 },{ -1, -1, 2 },{ 3, 3, -2 },{ -2, -1, -4 },{ -3, 0, 3 },{ 1, -3, -1 },{ -2, 3, 2 },{ -4, 2, -4 },{ 3, 0, 2 },{ 0, 1, 1 },{ -2, 3, -4 },{ -1, -1, -2 },{ 1, 3, 2 },{ -4, -2, 0 },{ 0, 2, -1 },{ -2, 3, 0 },{ -4, 1, -4 },{ 3, -3, 2 },{ -4, -1, 0 },{ 0, -4, -3 },{ -1, 0, 2 },{ -4, -2, -2 },{ 3, -2, 1 },{ -1, 0, 3 },{ 3, 1, 2 },{ -2, 3, 3 },{ 1, -1, 2 },{ -2, 2, -3 },{ 3, -4, -1 },{ 2, -1, 1 },{ -2, -2, -4 },{ -1, 2, -2 },{ -4, 0, -1 },{ -2, -2, -2 },{ 1, 3, 0 },{ -1, 1, 1 },{ -4, -4, 3 },{ 0, -1, -1 },{ 1, 3, 3 },{ -4, -4, -4 },{ 0, -3, -2 },{ 2, 3, -1 },{ 1, -4, -4 },{ -4, -2, 1 } }, - { { -2, 0, 2 },{ -2, 3, -1 },{ 2, -2, 3 },{ 3, 1, 1 },{ -1, 0, 3 },{ -4, -1, -4 },{ -2, 3, 3 },{ 2, 2, -3 },{ -3, 0, -4 },{ -2, -4, 2 },{ 1, 1, -3 },{ -4, 3, -1 },{ -1, -2, 2 },{ -4, 1, -1 },{ -2, -4, -4 },{ 0, 1, -2 },{ -3, 0, 1 },{ -2, 3, 2 },{ -4, -3, 0 },{ 1, -1, -1 },{ 3, 0, 1 },{ -2, -2, -3 },{ -4, -2, -1 },{ 0, 3, 2 },{ 1, -3, -3 },{ -1, 2, 1 },{ 3, -2, -2 },{ -2, -1, -1 },{ 1, -4, 1 },{ 2, -1, -3 },{ -3, -3, 0 },{ 2, 0, 3 },{ -2, -4, -1 },{ -3, 1, -4 },{ 2, -1, 3 },{ 1, -3, -2 },{ -1, -3, -3 },{ 0, 1, -2 },{ 1, 0, 2 },{ -2, 2, -1 },{ -4, -3, 0 },{ 0, 3, -3 },{ 1, 1, -2 },{ -3, -4, 0 },{ 2, -3, -4 },{ 0, -3, -2 },{ -1, -2, 0 },{ 3, 0, 1 },{ -3, -3, 3 },{ 0, -1, -3 },{ 3, 2, 2 },{ -3, -4, 0 },{ 2, 0, 3 },{ 0, -3, 2 },{ 3, 2, -3 },{ 1, -4, 2 },{ 0, 1, -1 },{ 3, 3, -4 },{ -2, -1, 0 },{ 2, -2, -3 },{ -4, 1, 2 },{ -1, -1, 0 },{ -3, -2, -3 },{ 1, 2, 1 } }, - { { -3, -4, -3 },{ 1, -1, 2 },{ 0, 1, -2 },{ -3, -4, -1 },{ 1, -2, 2 },{ -2, -1, -1 },{ 1, -4, 0 },{ -4, -3, -2 },{ 1, -2, 1 },{ 3, 3, 0 },{ -3, -3, 1 },{ 1, 2, 3 },{ -2, -3, 0 },{ 3, -1, -3 },{ 2, 2, 3 },{ 2, -3, 3 },{ -1, -3, -3 },{ 0, 2, -4 },{ 3, 1, 3 },{ -1, -4, -2 },{ -3, 1, 0 },{ 2, 2, -2 },{ 1, -3, 2 },{ 3, 1, 0 },{ -4, -1, -4 },{ 2, -1, -1 },{ -3, 3, -3 },{ 0, 1, 3 },{ -4, -3, -4 },{ -1, -2, 3 },{ 0, 2, -1 },{ 3, 2, 0 },{ 1, -3, 1 },{ -1, -2, -3 },{ 3, 0, 1 },{ 0, 2, 1 },{ -3, -1, 3 },{ 3, 3, 0 },{ -3, -2, -3 },{ 2, 3, -4 },{ 3, -3, 3 },{ 1, 1, 1 },{ -2, -1, 2 },{ -3, 0, -3 },{ -1, 2, -1 },{ -4, 3, 1 },{ 1, 1, -2 },{ -4, -4, -4 },{ -1, 3, 2 },{ -4, 1, -2 },{ 1, -3, 0 },{ -1, 3, -4 },{ 2, -2, 1 },{ -3, 1, -4 },{ -2, -1, 0 },{ 2, -3, -2 },{ -4, 2, 1 },{ -3, -2, 2 },{ -1, 0, -2 },{ 2, 2, -2 },{ -3, -4, 1 },{ -1, 0, 3 },{ 3, 3, -1 },{ 3, -3, 3 } }, - { { 2, -1, -2 },{ -2, -3, 0 },{ -4, 0, -4 },{ -1, 3, 0 },{ 2, 2, -3 },{ 0, 1, -3 },{ 0, 1, 1 },{ 2, 0, 2 },{ -1, 2, -4 },{ -4, 0, -1 },{ 0, -2, -2 },{ 2, 0, -4 },{ -1, -4, 1 },{ 0, 2, -2 },{ -4, 0, 0 },{ -3, 3, -1 },{ -4, -2, 1 },{ 2, -1, -1 },{ 1, 2, 2 },{ -2, -2, -4 },{ -4, -4, -3 },{ 0, 0, 3 },{ -1, 3, -4 },{ -3, -4, -2 },{ -1, 1, 3 },{ -2, -4, 1 },{ 0, -3, 2 },{ 1, 0, 0 },{ 3, 2, -2 },{ -3, 3, -2 },{ -2, -4, 2 },{ -4, -1, -4 },{ 2, 3, -2 },{ -4, 1, -2 },{ -2, -2, 2 },{ -2, 3, -3 },{ -4, -4, -1 },{ 0, 1, 2 },{ 2, -2, 1 },{ -1, 0, -2 },{ -3, -4, 0 },{ 1, -1, -4 },{ 3, 2, -1 },{ 0, -4, -4 },{ 2, 1, 3 },{ 3, -1, 2 },{ -3, -2, 0 },{ 2, 0, -4 },{ -2, 2, -1 },{ 1, -2, 1 },{ 0, 0, -3 },{ -4, -4, 3 },{ 1, 1, -1 },{ -1, -2, -2 },{ -4, 3, 3 },{ 1, 0, -3 },{ -2, -2, -3 },{ 0, 0, 1 },{ 1, -3, 0 },{ -2, 3, 3 },{ 3, 0, 0 },{ 0, 2, -4 },{ -4, -3, -2 },{ 0, 1, 0 } }, - { { -3, 1, -4 },{ 1, 2, 3 },{ 3, -2, -1 },{ 2, -4, 2 },{ -4, -3, -4 },{ 3, -2, 3 },{ -2, 3, 1 },{ -1, -3, -3 },{ -3, -1, 3 },{ -2, -4, -1 },{ 3, 3, 2 },{ -1, 1, -3 },{ -3, -1, -1 },{ 3, -2, 2 },{ 1, -2, -3 },{ -2, 1, 1 },{ -1, -4, -4 },{ 3, -1, 0 },{ -4, -3, 0 },{ 0, 3, 2 },{ 2, -1, 1 },{ 2, -3, -1 },{ -3, -1, 0 },{ 0, 2, 1 },{ 3, -2, -1 },{ 2, 0, -2 },{ -2, 3, 0 },{ -4, -4, -3 },{ 2, 1, 1 },{ -1, 0, 2 },{ 1, -2, -3 },{ 0, 1, 1 },{ -3, 0, 3 },{ -1, -3, 0 },{ 0, -4, 3 },{ 2, 0, -4 },{ 3, -1, -1 },{ -2, -4, -4 },{ 0, 2, -1 },{ -4, -2, 3 },{ -1, 1, -1 },{ -3, 3, 3 },{ -4, -2, 0 },{ 0, -2, 1 },{ -2, -3, -3 },{ -2, 0, -1 },{ 0, -4, -3 },{ 1, 1, 1 },{ -2, -3, 3 },{ 3, -1, -1 },{ 2, 2, -3 },{ -2, -1, 2 },{ -2, -3, -2 },{ 3, 2, 0 },{ -3, -1, 2 },{ 0, -4, -4 },{ 3, 3, -1 },{ 2, 1, 3 },{ -4, -4, -4 },{ 0, -1, -3 },{ -3, -3, -1 },{ 1, -2, -3 },{ -2, -1, 1 },{ -1, 3, -1 } }, - { { -4, -2, 2 },{ 0, 0, -3 },{ -2, 3, 1 },{ 0, -1, 2 },{ -3, 2, -2 },{ -2, 0, -1 },{ -3, -4, 0 },{ 3, 3, -2 },{ 0, -1, -4 },{ 2, 1, 0 },{ 1, -4, 1 },{ -4, -2, -3 },{ -2, 3, 3 },{ -2, 1, -2 },{ 0, -3, -4 },{ 2, 0, 3 },{ 3, 3, -2 },{ -2, 2, 3 },{ -3, 0, -2 },{ -2, 0, -3 },{ 3, 1, 2 },{ -1, 3, -3 },{ -2, 0, 2 },{ 1, -3, 3 },{ -1, -1, -3 },{ -4, 2, 1 },{ 3, 1, -4 },{ 0, -1, 3 },{ -3, -1, -4 },{ -1, -4, -1 },{ 1, -2, 0 },{ 3, 2, -3 },{ -2, -4, -1 },{ 3, 3, -4 },{ 1, 2, -2 },{ -4, -2, 0 },{ -1, 2, 3 },{ 1, -3, 2 },{ -3, 3, -3 },{ 3, -3, -3 },{ 2, 0, 1 },{ 0, -4, -3 },{ -1, 0, 2 },{ 2, 3, -2 },{ 1, 2, 3 },{ -4, 3, 0 },{ 3, -2, 2 },{ -1, 3, 1 },{ 0, 2, -2 },{ -4, -2, 0 },{ -3, -4, -4 },{ 1, 3, 3 },{ 0, 0, 1 },{ 3, 1, -4 },{ 2, -4, 1 },{ -1, -3, 0 },{ -3, 2, 2 },{ -1, -2, 0 },{ -4, 3, -2 },{ 3, -1, 2 },{ -2, 1, 2 },{ 1, 2, -2 },{ -1, -4, 2 },{ 2, -4, 3 } }, - { { 3, 0, 0 },{ -1, -3, -1 },{ -4, -4, -3 },{ 3, 2, 1 },{ -1, -1, 0 },{ 0, 1, -4 },{ 1, -2, 3 },{ 2, 2, -2 },{ -4, -3, 2 },{ -2, 2, 0 },{ -3, 0, -2 },{ 3, -3, 2 },{ 2, -1, 0 },{ 1, 2, 1 },{ -3, -4, -1 },{ -4, -2, 1 },{ -1, 1, -3 },{ 1, -4, 2 },{ 0, -2, -2 },{ -1, -4, -1 },{ 1, -2, -4 },{ -4, 2, 0 },{ -4, -4, -2 },{ 3, 1, -4 },{ -3, 3, -3 },{ -3, -4, 2 },{ -1, -2, -1 },{ 1, -3, 3 },{ 2, 2, 0 },{ -2, 3, 2 },{ -4, 1, -2 },{ 2, -3, 2 },{ -1, -1, 1 },{ -4, 0, 2 },{ -1, -3, 1 },{ 3, -1, -3 },{ -3, 1, 1 },{ 2, 0, -2 },{ 1, -1, 2 },{ -2, 2, 0 },{ 1, 1, -4 },{ -2, -3, -2 },{ -3, 1, -1 },{ 3, -4, -4 },{ -3, -1, 1 },{ -1, 1, -2 },{ 2, -4, -4 },{ -4, -1, -1 },{ -1, -3, -4 },{ -3, 0, 3 },{ 2, 3, 2 },{ 0, 1, -1 },{ -4, -3, -3 },{ -3, 2, 1 },{ -1, -2, 3 },{ -2, 0, -2 },{ 1, -1, -2 },{ 2, 1, -1 },{ 0, -3, 3 },{ -1, 1, -4 },{ 2, -3, 1 },{ -3, 3, 0 },{ -4, -1, -2 },{ 3, 2, -4 } }, - { { -2, 3, 2 },{ -2, -2, 0 },{ 1, 1, -4 },{ -3, -2, -2 },{ 1, -3, 3 },{ 2, -1, -3 },{ -4, -4, 1 },{ -1, 0, 1 },{ 0, 1, -3 },{ 1, -2, 3 },{ -1, -1, -3 },{ -4, 3, -4 },{ 0, -4, 3 },{ -1, 0, -3 },{ 3, 2, -4 },{ -3, 3, 2 },{ 1, -1, 0 },{ -4, 1, -4 },{ 2, 2, 0 },{ -3, 3, 3 },{ 3, -1, 1 },{ -2, -4, -3 },{ 2, -2, 3 },{ 1, 0, 0 },{ 0, -2, -1 },{ 2, 3, 2 },{ 0, 1, -2 },{ -2, -2, -3 },{ 3, -1, -2 },{ -4, 0, -4 },{ -2, 3, -1 },{ 1, -2, 3 },{ -3, 1, -4 },{ 0, 3, -2 },{ 1, 1, -1 },{ -2, -3, 3 },{ -3, 3, -2 },{ 0, -2, -1 },{ -4, -4, 0 },{ -2, -1, 1 },{ 2, 3, 3 },{ -4, -2, 2 },{ 0, -1, 0 },{ 2, 0, 3 },{ -1, -3, -1 },{ -2, -1, -3 },{ 3, 0, 3 },{ -3, 2, 2 },{ 1, 1, -2 },{ 3, 0, 1 },{ -1, -4, -3 },{ -1, -1, 0 },{ 2, -2, -2 },{ 1, -3, -1 },{ -4, 3, -3 },{ 3, 1, 2 },{ -4, 3, -4 },{ -3, -4, -3 },{ 1, 2, 1 },{ -2, 0, -3 },{ 3, -2, 0 },{ -1, -2, -1 },{ 1, 0, -3 },{ 0, 1, 1 } }, - { { -3, -1, -3 },{ 1, -1, -1 },{ 2, 2, 3 },{ -1, 0, 0 },{ -3, 3, 2 },{ 3, 2, -3 },{ -2, 2, -1 },{ -3, -3, -4 },{ 3, 3, 2 },{ -2, -2, -1 },{ 3, 2, 0 },{ 0, -3, -1 },{ 1, 1, -2 },{ -4, -2, 2 },{ 2, -3, -1 },{ 0, -1, -2 },{ 3, -4, 1 },{ -1, -2, -1 },{ 0, 0, 2 },{ 2, -3, -2 },{ -1, 1, 1 },{ 0, 1, 0 },{ -3, 3, -1 },{ -1, 0, 1 },{ 3, -3, -2 },{ -4, -4, 3 },{ 2, 0, 0 },{ -3, 3, 1 },{ 1, -4, -1 },{ 0, -3, 1 },{ 3, -4, 1 },{ 2, -1, -3 },{ 0, 0, -1 },{ -3, -4, 3 },{ 2, -2, 0 },{ 0, -4, -4 },{ -1, 2, -4 },{ 3, -4, 1 },{ -1, 0, -3 },{ 0, -2, -4 },{ -3, 2, -1 },{ 3, -4, -3 },{ 1, 3, -2 },{ -4, 2, 2 },{ 1, -2, -3 },{ 0, 3, 1 },{ 0, -4, 0 },{ 2, 1, -3 },{ -2, -2, -1 },{ 1, -3, -4 },{ -4, 3, 1 },{ -2, 1, 0 },{ 3, 2, 3 },{ 0, 0, -4 },{ 0, -1, -1 },{ 2, -4, 1 },{ -2, -2, 3 },{ 2, 0, 0 },{ 0, -4, -1 },{ -4, -2, 3 },{ -4, 3, 2 },{ 2, 1, -4 },{ -2, -4, 3 },{ 2, -3, 1 } }, - { { -1, -4, -4 },{ 0, 3, -2 },{ 3, -4, 2 },{ -4, -3, -4 },{ 0, 0, -1 },{ 2, -2, 0 },{ -1, -1, 3 },{ 0, 1, 0 },{ 2, -4, -1 },{ -3, -1, -4 },{ -4, 1, 3 },{ 1, 3, 1 },{ -3, 0, 0 },{ -2, -2, 3 },{ -1, 1, -2 },{ -3, -3, 0 },{ -2, 3, 3 },{ -3, 2, -4 },{ 3, -3, -3 },{ -3, -1, 3 },{ -4, 3, -4 },{ -2, -1, -4 },{ 1, -3, 2 },{ 0, 2, -3 },{ -4, 1, -4 },{ -2, -1, 1 },{ -1, 1, -4 },{ -3, 2, -3 },{ -1, -1, 2 },{ 0, 0, 3 },{ -3, 2, -2 },{ -1, 2, 0 },{ 3, -2, 1 },{ -4, 3, -2 },{ 3, 2, -3 },{ -2, -1, 2 },{ 1, 0, 3 },{ -4, 2, 0 },{ 2, 3, 3 },{ 1, -1, -2 },{ 3, -3, 2 },{ -1, 1, 1 },{ -1, -4, 0 },{ -2, 0, -4 },{ 3, -3, -1 },{ -4, 1, 3 },{ -3, 2, -2 },{ -1, -1, 0 },{ 3, -4, 2 },{ -3, 2, 3 },{ 0, -3, -3 },{ 2, -1, -4 },{ -3, -4, 2 },{ -2, 2, 0 },{ -3, -2, 2 },{ 1, 1, -2 },{ 0, 2, -4 },{ -2, -1, 1 },{ 3, 0, 2 },{ -1, 2, -2 },{ -3, -3, -3 },{ 1, -1, 0 },{ -2, 3, 2 },{ -4, 2, -2 } }, - { { 1, 1, 3 },{ -3, 1, 1 },{ -4, -1, -1 },{ -1, 2, -3 },{ 0, -4, 1 },{ -3, 0, 2 },{ -4, -3, -3 },{ 1, 3, -2 },{ -1, 0, 1 },{ -2, -4, -3 },{ 2, -1, 2 },{ -1, -3, -4 },{ 3, -4, -3 },{ 1, 2, -4 },{ -1, 3, 1 },{ 3, 0, -3 },{ 2, 1, -2 },{ 1, 0, 0 },{ -4, 3, -3 },{ 1, -4, 0 },{ 2, -2, -1 },{ 0, 0, 2 },{ 3, -4, -2 },{ -1, -1, 0 },{ 2, 2, 3 },{ 1, -4, -1 },{ 2, -3, -2 },{ 3, -2, 2 },{ -1, 1, -1 },{ 2, 3, -3 },{ -4, -2, -4 },{ -2, -4, 2 },{ -3, 1, -4 },{ 1, -3, 2 },{ -1, 0, 0 },{ -4, -2, -1 },{ 1, -1, 1 },{ -3, -3, -3 },{ 2, 1, 2 },{ -2, -2, -3 },{ -4, 0, -1 },{ -3, 2, 3 },{ 0, -1, -2 },{ -2, -1, 3 },{ 2, 3, 2 },{ 1, -3, -2 },{ 1, -2, 1 },{ -4, 3, -4 },{ -2, -2, -1 },{ 0, 2, -2 },{ -1, 0, 2 },{ 1, -1, -1 },{ -4, 3, -2 },{ -1, -4, 3 },{ 3, -3, -3 },{ -3, -1, -1 },{ -4, 1, 0 },{ -1, -3, -1 },{ 2, 3, -4 },{ 1, -1, -2 },{ 0, 1, 1 },{ 3, -4, -1 },{ -3, -1, -3 },{ 3, -2, 0 } }, - { { 0, 0, -4 },{ 3, -3, -3 },{ 2, -2, 0 },{ -2, -2, 3 },{ 3, 1, -4 },{ -2, 3, -2 },{ 2, -2, -1 },{ -4, 1, 1 },{ 3, -2, 3 },{ 1, 2, 0 },{ 0, 3, -2 },{ 2, 0, -1 },{ -3, -2, 0 },{ 2, 0, 3 },{ -4, -1, -1 },{ 0, -4, 2 },{ -2, -2, 1 },{ 0, -4, 3 },{ -1, -2, 1 },{ -1, 1, -2 },{ -2, 2, 3 },{ 3, 1, 1 },{ -3, -2, -3 },{ -3, 3, -1 },{ -2, -3, 2 },{ 0, -2, -3 },{ -3, 3, 0 },{ 1, -1, 3 },{ -4, -4, 0 },{ -2, -3, -1 },{ 3, 1, 0 },{ 1, -1, -2 },{ 2, -1, 3 },{ -1, 3, -1 },{ 0, -4, -2 },{ 3, 1, -3 },{ -1, 3, -2 },{ -3, -3, -4 },{ 0, -1, -1 },{ -1, 2, 0 },{ 1, -4, 1 },{ 2, 3, -3 },{ 2, -3, -4 },{ -3, 1, 1 },{ -1, -2, 0 },{ -3, 2, -3 },{ 0, 0, -4 },{ 2, -3, 3 },{ -2, 0, 0 },{ 3, 1, 0 },{ -3, -3, 3 },{ 1, -2, -2 },{ 3, 1, 0 },{ 0, 2, -3 },{ 2, 0, -4 },{ 0, 3, 2 },{ 1, -4, 3 },{ -2, -2, -3 },{ -3, -3, 3 },{ -3, 2, 0 },{ 0, 0, 2 },{ 2, -3, -4 },{ -1, 2, 3 },{ -1, 0, 1 } }, - { { -2, -4, 2 },{ -4, -1, -1 },{ 1, 3, 2 },{ -1, 2, -2 },{ 1, 0, 1 },{ 3, -3, 2 },{ 0, -1, -3 },{ -1, 2, -4 },{ -3, -3, 3 },{ -4, 0, -3 },{ -1, -2, 1 },{ -4, 2, 2 },{ -2, -1, 1 },{ 0, 2, -3 },{ -3, 1, 0 },{ 3, -3, -4 },{ -4, 2, -1 },{ 2, 2, -4 },{ -3, -1, 2 },{ 2, 0, 0 },{ -4, 2, -2 },{ 1, -4, -4 },{ -4, -1, 2 },{ 1, 2, -1 },{ 3, 0, -4 },{ -2, 1, 1 },{ -4, 0, -2 },{ 3, 2, -3 },{ -1, 0, -4 },{ 1, -3, 2 },{ -2, 3, 3 },{ 0, 2, -3 },{ -4, -3, 1 },{ -3, 1, -4 },{ 3, -2, 3 },{ -2, 3, 0 },{ 0, -4, 2 },{ 2, 1, 1 },{ 3, 2, -2 },{ -3, -4, 3 },{ -4, 0, -4 },{ 0, -2, 2 },{ 3, 2, -1 },{ -4, -4, 0 },{ 1, 0, -3 },{ 3, -4, -1 },{ -1, 1, 1 },{ 2, -1, 2 },{ 0, 3, -3 },{ -4, -4, -4 },{ 2, 3, 1 },{ -1, 1, -4 },{ -2, -3, 3 },{ -4, -1, 1 },{ -3, -2, 1 },{ -1, -1, 0 },{ 3, 2, -2 },{ -4, 3, -4 },{ 2, 0, 0 },{ 3, -2, -3 },{ -2, -4, 3 },{ -4, 2, -1 },{ 1, -2, -2 },{ -3, 3, -1 } }, - { { 2, 1, -3 },{ -2, 2, 3 },{ 2, -2, -2 },{ -3, -4, -3 },{ -3, 1, -1 },{ -4, -4, 3 },{ -2, 3, 0 },{ 2, -1, -1 },{ 0, -4, -1 },{ 3, 1, -2 },{ -2, -3, -4 },{ 1, 1, 3 },{ 1, -4, -2 },{ -1, -3, -3 },{ 2, 3, 3 },{ 1, -2, -2 },{ -2, 0, 1 },{ 1, -1, -3 },{ 3, 3, -1 },{ -2, -3, -4 },{ 0, -3, -3 },{ -1, -2, 0 },{ -1, 3, 3 },{ 2, -3, 1 },{ 0, -4, -3 },{ 3, 2, 3 },{ 1, -4, 1 },{ -3, 3, 2 },{ 0, 0, -2 },{ 2, -1, 1 },{ -3, -2, -4 },{ 2, 0, 0 },{ -1, -4, -3 },{ 1, 0, 1 },{ -4, -1, 2 },{ -2, 2, -4 },{ 1, 0, 1 },{ -4, 0, 3 },{ -1, -2, -1 },{ 1, 1, 2 },{ 3, -1, -3 },{ -1, -3, 0 },{ -2, 0, 3 },{ 0, 3, -2 },{ 1, -3, 3 },{ -3, 1, 2 },{ -2, 2, -2 },{ -4, -2, 0 },{ 3, -3, 3 },{ -2, -1, -2 },{ 0, -2, -3 },{ -4, -4, -1 },{ 1, 3, 2 },{ -1, 0, -2 },{ 2, 1, -1 },{ 3, -4, -2 },{ 0, 0, 2 },{ -1, -3, 1 },{ 0, -1, 2 },{ 1, 1, -1 },{ -4, 3, -3 },{ -2, 0, 1 },{ 3, -4, 2 },{ 1, -3, -4 } }, - { { -4, -1, 0 },{ -3, -4, 1 },{ 0, 1, -4 },{ 3, 0, 2 },{ 0, -3, 0 },{ 1, -1, -3 },{ -1, 1, 3 },{ 1, 0, -2 },{ -3, -4, 1 },{ 2, 3, 2 },{ -3, -1, 0 },{ 3, -2, -1 },{ 0, 3, -4 },{ -2, -3, 0 },{ -4, -1, 2 },{ -3, 2, 0 },{ -1, 0, 3 },{ -2, -4, -2 },{ -4, -3, 3 },{ 0, 2, 2 },{ 2, 0, 1 },{ 3, 3, 1 },{ -2, 1, -2 },{ 0, -3, -2 },{ -4, 1, 0 },{ -1, -1, 2 },{ -2, -2, -4 },{ -4, -3, -1 },{ 2, 1, -1 },{ -4, -4, 1 },{ -1, 2, -2 },{ -3, -3, 3 },{ 3, 3, -1 },{ 0, 2, -1 },{ 2, -3, 0 },{ 1, -3, -3 },{ -3, -2, -2 },{ 3, -4, -3 },{ -2, -1, -4 },{ -4, 3, 1 },{ 0, 3, -2 },{ -3, 1, -1 },{ 2, -2, 2 },{ -2, 2, -4 },{ 3, -1, 1 },{ -4, -2, -1 },{ 0, 3, -4 },{ 1, -4, -2 },{ -3, 0, 2 },{ 1, 2, 1 },{ 2, 1, 0 },{ -3, 0, -1 },{ 3, -1, 2 },{ 1, -3, -3 },{ -4, 3, -4 },{ -2, 1, 3 },{ -3, -2, -3 },{ 2, 2, -1 },{ -2, -4, -2 },{ 2, -1, 3 },{ -1, -3, -4 },{ 0, 1, 0 },{ -1, -1, -2 },{ 0, 1, 1 } }, - { { 1, -2, -3 },{ 1, 3, 3 },{ -1, -3, 0 },{ -4, -1, -2 },{ 2, 3, 1 },{ -2, 2, -4 },{ 3, -2, -4 },{ -4, 2, 2 },{ 0, 1, 0 },{ -2, -2, -4 },{ -1, 2, -2 },{ 2, -1, 1 },{ -3, 0, 2 },{ 3, 1, -1 },{ 2, -2, -1 },{ 0, -4, -4 },{ 3, -3, 1 },{ 2, 3, -3 },{ -1, 1, 0 },{ 0, -1, -2 },{ -3, -4, -1 },{ -4, -2, -3 },{ 2, -1, -4 },{ -3, 0, 2 },{ -3, -1, -3 },{ 2, 3, -1 },{ -1, 0, -3 },{ 0, -4, 0 },{ 3, 2, 3 },{ -2, -2, -4 },{ 1, 1, -1 },{ 1, -1, 2 },{ -2, 1, -4 },{ -3, -2, -2 },{ -2, -4, 3 },{ -1, 2, 3 },{ 0, 3, -1 },{ -1, 1, 0 },{ 2, 2, -1 },{ 2, -3, -2 },{ -2, -3, 3 },{ 3, 0, 0 },{ -4, -4, -4 },{ -1, 2, 1 },{ 1, -1, -3 },{ -1, -3, 0 },{ 2, 1, 3 },{ -1, -1, -3 },{ 0, 2, -1 },{ -2, -3, -4 },{ -1, 3, 3 },{ 3, -1, -2 },{ 0, -2, -4 },{ -1, 2, 3 },{ -2, -4, 1 },{ 0, -2, 0 },{ 1, -1, 2 },{ -4, -3, -4 },{ -2, 3, 0 },{ 3, 1, -3 },{ -3, 3, 1 },{ 2, -2, 3 },{ -3, 2, -3 },{ 3, 3, -1 } }, - { { -2, -1, -4 },{ 2, 0, -2 },{ -3, 2, 2 },{ -1, 2, -3 },{ 3, -4, 0 },{ -2, -1, 3 },{ -3, -4, -1 },{ 0, -3, 1 },{ 3, 0, -3 },{ -2, -2, 3 },{ 0, 2, -3 },{ -4, -4, 3 },{ 1, -3, -4 },{ -4, 1, -3 },{ 0, 3, 3 },{ -2, 2, 2 },{ 1, -1, -3 },{ -3, 1, 0 },{ -4, -2, 2 },{ 3, 0, -4 },{ 1, 1, 3 },{ -2, 2, 2 },{ 1, -4, -1 },{ 0, 2, 3 },{ 2, -3, 1 },{ 3, 2, 3 },{ 1, -2, -2 },{ -3, 1, 2 },{ 0, -1, -3 },{ -1, 3, 0 },{ 3, -2, -3 },{ -4, -3, 2 },{ 0, 0, 0 },{ 2, 3, -3 },{ 3, 0, 1 },{ -4, 1, -4 },{ 3, -1, 2 },{ -2, -2, 1 },{ -4, -4, 2 },{ -3, 0, 3 },{ 1, -2, -4 },{ -1, 1, 1 },{ 1, -3, -2 },{ -3, 3, 3 },{ -3, -4, -2 },{ 2, 1, -1 },{ 3, 0, 2 },{ -3, 2, 1 },{ 3, -4, 0 },{ -4, -1, -2 },{ 2, -2, 2 },{ -3, -4, 0 },{ -4, 2, 0 },{ -2, 0, -1 },{ 2, -3, 2 },{ 2, 3, -1 },{ 3, 2, -2 },{ -1, 0, 3 },{ -3, -1, 2 },{ 0, -2, 0 },{ -4, -4, -1 },{ 1, 0, -2 },{ -2, -3, 2 },{ -4, -4, 2 } }, - { { -1, -2, 0 },{ 3, 1, -1 },{ 0, -3, 3 },{ 1, -2, -1 },{ -4, 0, 2 },{ 0, 3, -2 },{ 2, -2, -2 },{ -1, 3, -1 },{ 2, -1, 2 },{ -4, -4, 1 },{ 3, 1, -1 },{ -1, 0, -2 },{ -1, 2, 0 },{ -2, -4, 1 },{ 2, -2, -2 },{ -1, -2, -1 },{ -4, 0, -4 },{ 2, 3, 3 },{ 1, -4, -1 },{ 0, 2, 1 },{ -2, -3, -3 },{ 3, 0, 0 },{ -1, -2, -3 },{ -4, 3, 0 },{ -1, 0, -4 },{ -2, -4, 0 },{ -4, -1, -4 },{ 2, 3, 3 },{ -4, -3, 1 },{ -2, 0, -2 },{ -3, 1, 1 },{ 1, -4, 3 },{ -1, 2, -2 },{ -3, -2, 2 },{ 1, -4, -1 },{ -3, -3, -2 },{ 0, 0, -3 },{ 1, 3, -3 },{ 0, 1, 0 },{ 3, 2, -4 },{ 0, -1, -1 },{ -4, 3, 2 },{ 3, -2, -3 },{ 2, 1, 0 },{ 0, 0, 2 },{ -2, -2, -4 },{ -1, 3, -2 },{ -4, -3, 3 },{ -2, 0, -3 },{ 0, 1, -4 },{ -1, -3, 2 },{ 1, 3, -3 },{ 3, 0, -3 },{ -3, 1, 1 },{ 0, -1, -4 },{ -4, -2, -3 },{ -3, 0, 0 },{ 1, -4, -2 },{ 1, 2, -4 },{ 3, 1, 3 },{ 2, -2, -4 },{ -2, 2, 1 },{ 0, 1, -1 },{ 2, -3, 0 } }, - { { -4, 1, 2 },{ -3, 3, 1 },{ -2, -4, -4 },{ 2, -1, -3 },{ -2, -3, -4 },{ 1, 1, 1 },{ -3, 0, 2 },{ -4, 1, -3 },{ 1, 2, -4 },{ -2, 3, -2 },{ 1, -3, 0 },{ -3, -2, 3 },{ 2, 3, 2 },{ 3, 0, -4 },{ 1, -1, 3 },{ -3, 1, 0 },{ -2, -4, 1 },{ 3, -3, -2 },{ -2, -2, -4 },{ -4, -1, 3 },{ -1, 3, -2 },{ 2, -4, 1 },{ -4, -1, -1 },{ 3, -3, -2 },{ 1, 1, 2 },{ 0, -2, -1 },{ -2, 2, -2 },{ -1, -1, -1 },{ 3, -4, 1 },{ 1, 2, -1 },{ -1, 0, -4 },{ 3, -2, -1 },{ -4, 1, -4 },{ 0, 2, 0 },{ 2, -1, -3 },{ -2, 3, 2 },{ -4, -4, 0 },{ 2, -3, 3 },{ -1, -2, -2 },{ -2, -2, 0 },{ -3, -4, -2 },{ 1, 2, 1 },{ -1, -1, -3 },{ -3, -4, 3 },{ 0, -1, -1 },{ -4, -3, -4 },{ 1, 2, 2 },{ 1, -2, 0 },{ 2, -3, -1 },{ 2, 3, 1 },{ -4, 1, 3 },{ -2, -4, -1 },{ 1, -2, 1 },{ 2, 2, -2 },{ -1, -4, 3 },{ 3, 1, 0 },{ -2, 3, 1 },{ 0, -3, -3 },{ -2, -2, 1 },{ -1, 3, 1 },{ -3, -4, -2 },{ -1, 0, -3 },{ 3, -1, 3 },{ -1, 3, -4 } }, - { { 1, -4, -2 },{ 3, -1, -3 },{ 1, 0, 0 },{ -4, 3, 1 },{ -1, 2, 0 },{ 3, -3, -3 },{ 0, -4, 0 },{ 1, -2, 3 },{ 3, -4, -1 },{ -3, 0, 2 },{ 0, -1, -4 },{ 3, -1, -3 },{ -3, -3, -1 },{ -1, 2, -1 },{ -4, -3, 2 },{ 1, 3, -3 },{ 0, 2, 0 },{ -1, 0, 1 },{ 2, 3, 2 },{ 0, 1, -1 },{ -3, 0, 0 },{ 1, -2, -4 },{ -3, 1, 3 },{ -2, 2, 2 },{ 1, -1, -3 },{ 2, 3, 3 },{ -4, -3, 0 },{ 2, 1, -3 },{ 0, -2, -4 },{ 2, -3, 3 },{ -2, 3, 0 },{ 2, -4, 2 },{ -2, -1, -2 },{ 3, -3, 1 },{ -3, 1, 3 },{ 0, -1, -1 },{ 3, 2, -4 },{ 1, 0, 1 },{ -4, 2, 2 },{ 2, -1, -3 },{ 2, 1, 3 },{ -2, -3, 0 },{ 0, 0, -4 },{ -2, 2, 0 },{ 2, 3, 1 },{ 3, -4, -3 },{ 1, 1, -1 },{ -3, -1, -3 },{ -2, -1, 3 },{ 0, 0, 0 },{ -1, 2, -2 },{ 3, -1, -4 },{ -3, 3, 2 },{ -1, -1, 0 },{ 1, -3, -4 },{ -4, 1, 2 },{ 0, -1, 3 },{ 2, -4, -4 },{ 3, 1, -1 },{ -4, -1, -1 },{ 1, -3, 2 },{ 2, 0, 0 },{ -3, 2, 1 },{ -4, -3, -3 } }, - { { -2, 0, 0 },{ 0, 2, 3 },{ 2, -2, -1 },{ -3, -2, 2 },{ -2, 1, 3 },{ 3, -1, -2 },{ -4, 2, 1 },{ -2, -1, -4 },{ -1, 1, 0 },{ -1, -3, 1 },{ 2, 2, 3 },{ -4, 1, -2 },{ 0, 0, 1 },{ 2, -4, -2 },{ -3, 1, -4 },{ 1, -2, -2 },{ 3, -1, 3 },{ -3, -4, -2 },{ -3, 1, -3 },{ 2, -3, -3 },{ 3, -4, 3 },{ 0, 3, 1 },{ 0, 2, -3 },{ -1, -4, -1 },{ -3, 0, 1 },{ 3, -4, -4 },{ -3, 0, 2 },{ 1, -1, 2 },{ -3, 3, 0 },{ -3, 0, 2 },{ -4, 2, -3 },{ 0, -1, 1 },{ -3, 3, -3 },{ -1, 0, 2 },{ 1, -3, -4 },{ -1, 1, -2 },{ -2, -4, 1 },{ -3, -1, -2 },{ -1, 1, 3 },{ 3, 3, -1 },{ -1, -4, -2 },{ -4, 0, 2 },{ 1, 3, -1 },{ 3, -3, -2 },{ -1, 0, 2 },{ -4, 1, 3 },{ -1, 2, -2 },{ -2, -4, 1 },{ 3, 3, -4 },{ -3, -3, -2 },{ -1, -2, 1 },{ 1, 0, -1 },{ -4, -4, 3 },{ -2, -3, -3 },{ 2, 2, -2 },{ -3, -2, -1 },{ -3, 3, -2 },{ -1, -1, 2 },{ -4, 2, 0 },{ -2, 2, -3 },{ 0, -2, 3 },{ -3, 3, -4 },{ 0, -4, -1 },{ 2, -2, 3 } }, - { { -2, 2, -4 },{ -4, -3, 2 },{ 0, 1, -2 },{ 2, -4, -2 },{ -1, 0, -3 },{ 0, -4, 2 },{ -3, 3, -1 },{ 2, -2, 3 },{ 0, 3, -2 },{ -4, 0, -1 },{ -2, -4, -3 },{ -2, 3, 0 },{ 1, -2, 2 },{ -1, 2, 3 },{ -2, 3, 0 },{ -4, -2, 2 },{ -1, 1, -1 },{ 1, -3, -4 },{ -4, -1, 0 },{ -1, 2, 2 },{ -2, 0, -1 },{ -4, -2, -2 },{ 3, 0, 2 },{ 2, -3, -4 },{ -2, -2, -2 },{ -1, 3, 1 },{ 0, 2, -2 },{ -1, -4, -1 },{ -2, 1, -2 },{ 1, -3, -4 },{ -1, 1, -1 },{ 3, -3, 3 },{ 1, -4, -4 },{ -4, 2, -1 },{ 3, -2, 0 },{ 0, 3, 2 },{ -4, 2, -3 },{ 2, -2, -1 },{ 0, -3, -4 },{ -3, -3, -3 },{ -2, 2, 2 },{ 3, -1, -4 },{ 0, -2, 3 },{ -4, -4, -3 },{ -2, -1, 0 },{ -3, -2, -4 },{ 2, 3, 1 },{ 0, -2, 3 },{ -4, 2, 0 },{ 2, -4, 2 },{ 2, 1, -3 },{ -3, -1, 3 },{ 0, 3, -4 },{ 3, 1, 1 },{ 0, 0, 0 },{ 2, 0, -3 },{ 1, -4, 2 },{ 3, -2, -4 },{ 1, 0, 1 },{ 2, -4, -3 },{ 3, -1, 2 },{ -2, 1, -2 },{ 1, -1, -1 },{ -1, 1, 0 } }, - { { 3, -1, -3 },{ 3, 3, 1 },{ -3, 0, -4 },{ -2, -3, 0 },{ 1, 3, -4 },{ -4, -2, -1 },{ 2, 0, -3 },{ -1, 1, -4 },{ 1, -3, 2 },{ 3, 2, -3 },{ 2, -3, 2 },{ 1, -2, -4 },{ -3, 1, -1 },{ 2, -4, -3 },{ 0, -3, 1 },{ 3, -1, -3 },{ 2, 0, 2 },{ -2, 3, -1 },{ 0, -2, 3 },{ 3, 1, 1 },{ 1, -4, -4 },{ -2, 2, 0 },{ -4, -2, 3 },{ -1, -1, 0 },{ 1, 1, -1 },{ -4, -3, 3 },{ 3, 0, -3 },{ -4, -2, 1 },{ 2, -2, 3 },{ 3, 3, 0 },{ 2, -1, -2 },{ -2, -2, 1 },{ 0, 2, 2 },{ 1, 0, 0 },{ -3, -4, -2 },{ 2, -1, 3 },{ -2, -3, 1 },{ 3, 1, 0 },{ -1, -1, 3 },{ 1, 3, 1 },{ -4, -2, 0 },{ 1, 1, 1 },{ -3, 2, -1 },{ 2, 1, 2 },{ 1, 2, -3 },{ 0, -3, -1 },{ 3, 0, -2 },{ -1, -1, -3 },{ 1, 0, -4 },{ 1, 1, 2 },{ -2, -2, -2 },{ 0, 2, 1 },{ -4, -3, 0 },{ -2, -2, -2 },{ -1, 2, 1 },{ -4, -3, 3 },{ -2, 3, -1 },{ 0, 1, 1 },{ -4, 3, -2 },{ -2, -3, 3 },{ -1, 0, 1 },{ -3, 3, -4 },{ -4, -3, 2 },{ 0, -4, 1 } }, - { { -3, 2, 3 },{ 1, -2, -1 },{ -4, -1, 2 },{ 2, 1, 1 },{ 1, 2, 3 },{ 3, -1, 1 },{ -2, -3, 2 },{ -2, -4, 0 },{ -3, 0, 0 },{ -4, -1, -2 },{ 0, 2, 1 },{ -2, 0, 3 },{ -4, -1, -2 },{ 3, -1, 1 },{ -4, 2, -1 },{ -3, 0, 1 },{ 1, 2, -4 },{ 0, -4, -2 },{ 2, 3, 0 },{ -3, -3, -2 },{ 1, -1, -3 },{ 0, 3, -1 },{ 2, -4, -3 },{ 3, 3, 1 },{ 0, 1, 2 },{ -2, 2, 0 },{ 1, -1, -4 },{ -1, -3, 0 },{ 0, 2, -3 },{ -4, -4, 2 },{ -1, 1, -4 },{ -3, 0, 0 },{ 3, 3, -1 },{ -4, 1, -3 },{ -2, -3, -4 },{ 1, -2, -1 },{ -1, 0, -3 },{ 1, 3, -2 },{ -4, 2, -1 },{ 0, -4, 0 },{ 3, 0, -2 },{ -1, -3, -4 },{ -2, -4, 1 },{ 2, 3, -2 },{ -4, -1, 3 },{ -3, 0, 2 },{ -2, 3, -1 },{ 0, -3, 2 },{ -3, -4, -1 },{ -4, -3, 0 },{ -1, 3, -4 },{ 2, 0, 3 },{ 3, -4, -1 },{ 1, -1, -4 },{ -3, 0, 2 },{ 2, -4, -3 },{ 0, 2, -4 },{ -3, -1, 0 },{ -1, -2, -3 },{ 2, -3, 0 },{ 0, 1, -1 },{ 3, -4, 0 },{ 2, 3, -3 },{ 1, 0, -2 } }, - { { -1, -3, -3 },{ 0, -4, -2 },{ -1, 2, 0 },{ -2, -4, -2 },{ 0, 0, -3 },{ -4, 1, -1 },{ -1, 3, -2 },{ 3, 2, -4 },{ 2, -4, 2 },{ -1, -1, 3 },{ 0, 3, -4 },{ 3, -3, 0 },{ 1, 1, -3 },{ -1, 3, 0 },{ 0, -3, -4 },{ -1, 1, 3 },{ -2, -4, 2 },{ -3, -1, -1 },{ -4, -2, -3 },{ -1, 0, 3 },{ -3, 1, 2 },{ -4, -2, 1 },{ -1, 1, 3 },{ -3, 0, -4 },{ -3, -3, -3 },{ 3, -4, -2 },{ -2, 3, -1 },{ 2, -1, -2 },{ -3, 0, 1 },{ 1, 2, 0 },{ 0, -3, 3 },{ 1, -3, -3 },{ -2, -1, 1 },{ -1, -1, 3 },{ 2, -2, 1 },{ -3, 3, 2 },{ -4, 1, 3 },{ 3, -4, 1 },{ -2, 0, -4 },{ -3, -2, 2 },{ 2, 2, -3 },{ -2, 0, 3 },{ -1, -1, -2 },{ 0, -3, 0 },{ -1, -2, -4 },{ 3, -4, 1 },{ 2, 1, 0 },{ -4, 2, -3 },{ 3, -1, 3 },{ 3, 3, 1 },{ -2, 0, -3 },{ 0, -3, -1 },{ -3, 1, -3 },{ 1, 3, 2 },{ -1, -2, -2 },{ 3, 1, 0 },{ -1, -3, 1 },{ 2, -2, 3 },{ 3, 2, 2 },{ -4, 2, -4 },{ 1, -1, -2 },{ -4, 2, 3 },{ -2, -2, 2 },{ -2, 1, 0 } }, - { { 2, 0, 2 },{ -4, 1, 1 },{ 3, 3, -4 },{ -3, -2, 3 },{ 3, -2, 2 },{ -4, -3, 0 },{ 2, -1, 3 },{ 0, -2, 1 },{ -3, 2, -3 },{ 1, 0, -1 },{ -3, -2, -2 },{ -1, -4, 1 },{ -4, -3, 3 },{ 2, 0, 2 },{ -2, -2, -1 },{ 3, -2, -2 },{ 3, -3, 0 },{ 1, 1, 3 },{ 2, 3, 1 },{ 0, 0, -4 },{ 3, -4, 0 },{ -2, -1, -1 },{ 2, -3, -3 },{ 0, 2, -2 },{ 1, -2, 1 },{ -4, -1, 3 },{ 0, 3, 2 },{ -3, 1, 3 },{ 3, -2, -3 },{ -2, -4, -4 },{ -4, 0, -1 },{ 2, 3, -2 },{ 0, -4, 2 },{ 3, 2, -4 },{ 2, 2, -1 },{ 0, 0, -3 },{ -1, -3, 0 },{ -3, -2, -2 },{ 0, -1, -1 },{ 2, 1, 2 },{ 1, -3, 1 },{ -4, 3, -3 },{ 3, 0, -1 },{ 2, 2, 2 },{ -2, 1, -3 },{ 1, 3, -2 },{ -1, -2, 2 },{ -1, -4, -4 },{ 0, 1, 1 },{ -3, -2, -2 },{ 1, -4, 2 },{ -4, 2, 1 },{ 3, 2, 0 },{ -1, -2, 3 },{ -3, 1, -1 },{ 0, 3, -4 },{ -4, -1, 2 },{ -3, 3, -2 },{ 1, 0, -1 },{ -2, -4, -3 },{ -1, -1, 2 },{ -1, -2, 1 },{ 3, -3, -4 },{ 0, 2, -3 } }, - { { -2, -1, -1 },{ 2, -3, 0 },{ 0, -1, -2 },{ -2, 1, -3 },{ 1, -4, -1 },{ 1, 2, -4 },{ -1, 1, -2 },{ -2, 0, -3 },{ 1, -3, -1 },{ -4, 3, 2 },{ 3, 1, 0 },{ 2, 1, -2 },{ -3, 2, -4 },{ 2, -4, -3 },{ 0, 2, 2 },{ -3, 3, -3 },{ -4, 0, -2 },{ -1, 2, -4 },{ -2, -2, -1 },{ 0, -3, -3 },{ 3, 2, 0 },{ -4, 3, 2 },{ 2, -2, 2 },{ -1, 2, 0 },{ -2, 0, -1 },{ 2, 1, 1 },{ -1, -4, -4 },{ -1, -3, -2 },{ 3, 2, -1 },{ -1, -1, 2 },{ -3, 2, 1 },{ 1, 1, -2 },{ -1, -2, 0 },{ -4, -4, 2 },{ -3, 0, -3 },{ 1, -3, 0 },{ 2, 2, 1 },{ 3, -4, -4 },{ -1, 1, 3 },{ -2, 3, -1 },{ 0, -2, -4 },{ -3, -1, 3 },{ 0, -4, 1 },{ -3, 2, -4 },{ -4, -3, -1 },{ -3, -1, 3 },{ -4, -2, -2 },{ 2, 0, -1 },{ 1, 2, -4 },{ 2, -1, 3 },{ -3, 1, -3 },{ -1, -3, -4 },{ 1, -1, -2 },{ -2, -4, 1 },{ 2, -3, -3 },{ -4, -3, 1 },{ 2, 0, -3 },{ -2, -4, -1 },{ 0, 1, 0 },{ 2, -3, 3 },{ -3, 3, -2 },{ 1, 1, -2 },{ -3, -1, -1 },{ -4, 3, 1 } }, - { { 1, -4, -4 },{ 3, 3, 3 },{ -4, -2, 2 },{ -1, 2, 1 },{ 2, 3, 1 },{ -3, -1, 3 },{ -2, -2, 0 },{ 3, 1, 2 },{ -3, -4, -2 },{ 2, -3, 3 },{ -2, -1, -4 },{ 0, 3, 1 },{ -1, -1, -1 },{ 1, -1, 0 },{ -4, 3, -1 },{ -1, -3, 1 },{ 1, 0, 0 },{ 2, -1, 2 },{ -4, -4, 1 },{ -1, 2, 3 },{ -3, -1, -2 },{ 1, 1, -4 },{ 0, 0, -4 },{ -4, -4, 3 },{ 1, -1, 2 },{ 3, -3, -4 },{ -4, 2, 0 },{ 0, 0, -3 },{ 1, -2, 1 },{ -4, 3, 0 },{ 2, -1, -3 },{ 3, -3, 3 },{ -3, 1, 0 },{ -2, -2, -4 },{ 0, -1, -2 },{ -2, 3, 3 },{ -4, 1, -2 },{ 1, 3, 0 },{ -3, 0, -3 },{ -4, -3, -2 },{ 3, 2, 0 },{ 1, 1, -2 },{ 2, -2, 0 },{ -1, 0, 2 },{ 1, -2, -3 },{ 2, 0, 1 },{ 0, 3, 0 },{ -2, 2, 2 },{ -3, -3, -2 },{ 0, 0, -1 },{ -1, 3, 1 },{ 2, -2, 0 },{ -3, 0, 3 },{ -4, 0, -4 },{ 3, 2, 2 },{ 1, 1, -1 },{ -1, -1, 3 },{ 3, -2, 1 },{ 1, 2, -4 },{ -2, 0, 2 },{ 0, -4, 1 },{ 3, 0, -3 },{ 2, -2, 0 },{ -1, -4, 3 } }, - { { 1, 1, -2 },{ -3, 0, -3 },{ 0, -3, -1 },{ 3, 0, -2 },{ -3, -3, -4 },{ 2, 0, 0 },{ -4, -4, -3 },{ 0, 3, 3 },{ 2, -1, -4 },{ -1, 2, 0 },{ 1, -2, -3 },{ -4, -4, 2 },{ -2, 0, 3 },{ 3, -3, -4 },{ -2, 1, 3 },{ 3, -2, -4 },{ 0, -4, 3 },{ -2, 3, -3 },{ 3, 1, -4 },{ -1, 0, -1 },{ 1, -2, 2 },{ -3, -4, 1 },{ -2, -3, -1 },{ 3, 1, -2 },{ -3, 3, -1 },{ -1, 1, -3 },{ -3, -1, 3 },{ -2, -4, 0 },{ 2, 3, 3 },{ -2, -3, -4 },{ 0, -4, 2 },{ -1, 0, -1 },{ 2, 3, -3 },{ 1, 2, 1 },{ 3, -1, 2 },{ 2, -4, -1 },{ -4, -2, -4 },{ 3, -2, 2 },{ 0, -4, 3 },{ 2, -1, 1 },{ -2, -1, 2 },{ -3, -4, -4 },{ 1, 3, -1 },{ -2, -1, 0 },{ 0, 2, -2 },{ 3, -4, 2 },{ 1, -4, -4 },{ 3, 1, 3 },{ -4, -3, -3 },{ 3, -4, 0 },{ -2, -2, 2 },{ 1, 3, -1 },{ 0, -1, -2 },{ 3, 2, 0 },{ -2, -2, -2 },{ -2, 3, 1 },{ 0, -4, -4 },{ -4, 2, -3 },{ -3, -1, 0 },{ -1, -3, -1 },{ -4, -2, -4 },{ -2, 3, 0 },{ 0, 1, 2 },{ -3, 2, -4 } }, - { { 2, -2, 1 },{ -1, 3, 0 },{ -4, -1, 2 },{ -2, -4, -4 },{ 0, 2, 3 },{ -1, 3, -2 },{ 3, -3, 2 },{ -2, 2, -1 },{ -3, 0, 1 },{ -1, 0, 1 },{ 3, -2, -2 },{ 0, 2, -1 },{ -3, 2, -2 },{ 0, -4, 0 },{ 2, 1, 1 },{ -3, -1, -2 },{ 1, 2, -1 },{ -3, 1, 2 },{ 1, -3, -2 },{ -4, -2, 0 },{ 3, 1, -3 },{ 0, 3, 3 },{ -2, 2, 0 },{ 2, -3, -3 },{ 1, -2, 1 },{ 0, -4, 0 },{ 2, 3, -2 },{ 3, 0, 2 },{ -2, 1, -1 },{ -4, 1, -3 },{ 0, -1, -2 },{ -3, 1, 1 },{ -4, -3, 3 },{ -2, -4, -1 },{ 0, 0, 1 },{ -1, -3, -4 },{ -1, 0, 2 },{ 0, 2, -3 },{ -2, 2, 1 },{ 2, -3, -4 },{ -1, 1, -1 },{ -4, 3, 3 },{ 3, -4, -3 },{ -4, 1, 1 },{ -1, -3, 3 },{ -3, 1, -3 },{ -3, 0, -1 },{ -2, -1, 1 },{ -1, 3, -2 },{ 2, 1, -4 },{ -4, 0, 3 },{ 1, 1, -4 },{ -4, -4, 2 },{ 0, -4, -3 },{ 1, 1, -1 },{ -3, -1, -2 },{ 0, -3, 3 },{ 2, 0, 2 },{ -4, 3, -2 },{ 3, 1, 2 },{ 2, 2, -2 },{ 1, 0, 3 },{ -4, -3, -1 },{ -2, -3, -2 } }, - { { -1, 1, 3 },{ 1, 2, 1 },{ 2, 1, -3 },{ 3, -2, -1 },{ 0, -1, 2 },{ -4, 1, 0 },{ 1, -4, -4 },{ 0, -2, -3 },{ 2, -3, -1 },{ -4, 3, -2 },{ -3, -4, 3 },{ 1, 1, -4 },{ 2, -2, 2 },{ -4, 0, -3 },{ -1, 3, 2 },{ -1, -2, -1 },{ -2, -3, -3 },{ 2, -1, 0 },{ 0, 0, 3 },{ -2, -4, 1 },{ 2, 3, -4 },{ -1, 0, -2 },{ -4, -1, -1 },{ 0, 0, 2 },{ -3, -1, 3 },{ -2, 2, -4 },{ 0, -2, 1 },{ -4, -3, -2 },{ 1, -1, -3 },{ 3, -2, 3 },{ 2, 2, 0 },{ -1, -2, -1 },{ 3, 3, -4 },{ 2, -2, -2 },{ -3, 2, -3 },{ -3, 3, 0 },{ 3, 1, -1 },{ -2, -4, -2 },{ 1, 0, -1 },{ -3, 3, -3 },{ 1, -2, 1 },{ -2, 0, -2 },{ 2, -1, 3 },{ 0, -2, -4 },{ -1, 0, -1 },{ 2, 3, -4 },{ 1, -2, 0 },{ -1, -2, 0 },{ 0, -1, 1 },{ -3, -4, 2 },{ -1, 2, -2 },{ 3, -3, -1 },{ -2, 3, 1 },{ -1, -3, 3 },{ -3, 0, 2 },{ 2, -2, 0 },{ 3, 3, -4 },{ -1, 1, 0 },{ 1, -4, -3 },{ 0, -2, 3 },{ -2, -3, -3 },{ -1, -4, 1 },{ 3, 3, -3 },{ 3, -1, -1 } }, - { { 0, -4, 0 },{ -4, -4, -4 },{ -2, -3, 2 },{ -3, 3, 1 },{ 1, 0, -3 },{ -2, -1, 0 },{ 3, 1, 1 },{ -1, 3, 2 },{ 1, -1, -3 },{ -2, 0, 2 },{ 3, 1, 0 },{ -1, -3, -1 },{ -3, -1, 1 },{ 1, -3, -2 },{ 3, 2, -4 },{ -3, -3, 2 },{ -4, 0, -2 },{ 3, -4, 1 },{ -1, 3, -4 },{ -4, 2, -2 },{ 1, -1, 2 },{ -3, -2, -3 },{ 3, -4, 0 },{ -1, 3, -4 },{ 1, 1, -2 },{ -4, -4, -1 },{ 2, 3, 3 },{ -1, 2, -4 },{ -1, -3, -1 },{ -3, 2, 1 },{ -3, -4, 2 },{ -2, -1, -4 },{ 1, 0, 2 },{ -4, 1, 1 },{ 0, -3, 3 },{ 1, 1, 1 },{ -4, -1, 3 },{ 2, -3, 2 },{ -4, -1, 0 },{ -1, 1, 3 },{ 3, -3, -2 },{ 0, 2, 0 },{ -3, -3, 1 },{ 1, 1, -2 },{ -2, 2, 2 },{ 2, -4, 2 },{ -4, -3, -2 },{ -4, 3, 3 },{ 3, 2, -3 },{ 2, 0, -3 },{ 0, -2, 1 },{ -3, -1, -3 },{ 2, 0, 3 },{ 3, 1, -3 },{ -2, 3, -2 },{ 0, -4, -4 },{ -4, -3, 1 },{ -2, 1, -1 },{ 2, -2, 1 },{ 0, -1, 0 },{ -3, 1, -4 },{ 2, 3, 1 },{ -3, -1, 3 },{ -4, 0, -4 } }, - { { -2, 2, -2 },{ -1, -1, 0 },{ 1, 1, -3 },{ 2, -2, -2 },{ -1, -4, 3 },{ -4, -3, -2 },{ -3, 2, -2 },{ -3, 0, 3 },{ 2, -4, -4 },{ -4, 2, 1 },{ 0, -3, -4 },{ 1, 3, 3 },{ -2, 3, -3 },{ 2, -4, 0 },{ -2, 0, 3 },{ 2, 1, 0 },{ 1, 3, -4 },{ 0, 2, 3 },{ 2, -2, -1 },{ -3, -3, 0 },{ 2, 1, 1 },{ 0, -4, 3 },{ -2, 2, 2 },{ -3, -1, 1 },{ 2, -3, -1 },{ 3, -2, 2 },{ -3, 0, -3 },{ -2, 1, 2 },{ 1, -4, 0 },{ 3, 0, 3 },{ 1, 3, -3 },{ 0, 1, -2 },{ -1, -4, 3 },{ 2, -1, 0 },{ -2, -3, -4 },{ 2, -2, -2 },{ 0, -4, -3 },{ -1, 2, -4 },{ 3, -2, 0 },{ 1, 3, -4 },{ -3, -4, 2 },{ 3, -2, -1 },{ -1, 1, -4 },{ -4, 3, 0 },{ 3, -1, 3 },{ -2, -3, -3 },{ 0, 2, 0 },{ 1, 0, -4 },{ -2, -3, -1 },{ -3, -4, 0 },{ 1, 3, 1 },{ -4, 0, -1 },{ 1, -3, -4 },{ -1, -1, 0 },{ -4, -2, -1 },{ 2, 2, 2 },{ -1, -1, 3 },{ -3, 2, -3 },{ -2, 0, -1 },{ -4, 3, 3 },{ 3, 0, -2 },{ -1, -3, -1 },{ 0, 1, 0 },{ 1, -2, 2 } }, - { { 3, 3, -3 },{ 3, -1, 3 },{ -3, 2, -1 },{ -1, 0, 1 },{ 0, 3, -4 },{ 3, 2, -1 },{ 2, -3, 2 },{ 0, -1, 0 },{ 3, -2, 0 },{ -3, 1, -2 },{ -1, -2, 2 },{ 3, 0, -2 },{ -4, -1, -3 },{ 0, 2, 2 },{ 0, -1, -1 },{ -3, -2, -2 },{ -1, -1, 2 },{ -4, -4, -3 },{ -2, 0, 2 },{ -1, -1, -3 },{ 1, 1, -1 },{ -4, 0, -4 },{ 3, 3, -2 },{ 1, -2, -3 },{ -1, 0, 1 },{ -1, 2, -4 },{ 0, -4, 0 },{ 2, -1, 1 },{ -3, 0, -2 },{ -4, 1, -4 },{ 0, -2, 0 },{ -4, -3, -1 },{ 3, 2, -2 },{ -3, 3, -3 },{ -2, 0, 0 },{ 3, 3, -1 },{ -1, 2, 2 },{ -3, 1, 1 },{ -2, 0, -2 },{ 0, -1, 0 },{ -2, 0, 1 },{ -4, -1, -3 },{ 2, 2, 2 },{ -1, -2, -3 },{ 1, -4, -1 },{ -3, 0, 1 },{ 3, 1, -2 },{ 2, 1, 2 },{ -2, -2, 2 },{ -1, 2, 3 },{ 2, -2, -2 },{ -1, 1, 3 },{ -2, 3, 2 },{ 3, -4, 0 },{ 0, 2, 1 },{ 1, 0, -2 },{ 2, 1, 0 },{ 1, -4, -3 },{ 3, -3, 1 },{ 0, -1, -4 },{ 1, -4, 2 },{ -2, 2, -2 },{ -4, 0, -3 },{ 2, -3, 2 } }, - { { -3, 1, 1 },{ 0, -4, 0 },{ -4, -3, -2 },{ 1, -1, 2 },{ 2, -2, 3 },{ -2, 0, -4 },{ 0, 1, -1 },{ -1, -4, -3 },{ 1, 3, -1 },{ -2, -3, 3 },{ 0, 0, -1 },{ 2, 2, 0 },{ -3, -2, 1 },{ -4, -4, -4 },{ 3, 3, -1 },{ -2, -3, 1 },{ -3, 1, -2 },{ 3, -1, 0 },{ 2, 3, -1 },{ 0, -3, 3 },{ 3, 2, 2 },{ -1, -2, 0 },{ -4, -3, -1 },{ 0, 1, 3 },{ -2, 2, -2 },{ -4, -1, 3 },{ 1, 3, -1 },{ 0, 2, -2 },{ -2, -3, 1 },{ 3, -3, -3 },{ -1, 3, 2 },{ 2, -2, 2 },{ -3, 0, -3 },{ 1, -1, 1 },{ 0, -4, 2 },{ -4, 2, -4 },{ -3, -1, -2 },{ 1, -3, 3 },{ 2, -3, -3 },{ -4, 3, 3 },{ 0, -4, -2 },{ 1, 2, 3 },{ -2, -3, 1 },{ 2, -4, -4 },{ 0, 3, 3 },{ -3, -1, -2 },{ -1, -2, -4 },{ -4, -1, -1 },{ 0, -4, -1 },{ 3, 2, -4 },{ -4, -1, -3 },{ 1, -4, -1 },{ 2, 2, -4 },{ -3, -2, 1 },{ -3, -3, -3 },{ -2, 0, -4 },{ -1, -4, 3 },{ -4, 3, -1 },{ 2, -2, 2 },{ -1, 1, -2 },{ -4, -1, 1 },{ 2, -4, 3 },{ 1, 2, -1 },{ -2, -2, -4 } }, - { { -1, -1, 3 },{ 2, 2, -1 },{ 0, 0, -4 },{ -2, 1, 0 },{ -4, -4, -2 },{ -3, 2, 1 },{ -2, -2, 2 },{ -4, 3, -3 },{ 3, 1, 2 },{ -4, -1, -4 },{ -3, -4, -3 },{ 2, -4, 1 },{ -1, 1, 3 },{ 1, -2, -4 },{ 3, 1, 3 },{ 1, 2, -3 },{ 2, -2, 3 },{ 0, -3, -4 },{ 1, 0, 1 },{ -4, 2, -2 },{ -3, -4, -3 },{ 2, -1, -4 },{ -2, 0, 2 },{ 2, -4, 1 },{ 2, -3, -4 },{ -3, -4, -1 },{ 3, -2, 2 },{ -4, 0, -4 },{ -1, 3, -3 },{ 2, -1, 3 },{ 0, 0, 0 },{ -2, -1, -4 },{ -1, -4, 1 },{ 2, 2, 3 },{ 0, -3, 0 },{ 3, -1, -1 },{ 1, 0, 2 },{ -4, -4, -1 },{ 3, 1, -3 },{ -1, 3, 1 },{ 0, -1, -4 },{ 3, 1, -1 },{ -3, 0, -2 },{ -2, -1, 1 },{ -4, 2, 0 },{ 3, 3, 0 },{ 1, -4, 2 },{ -2, -3, 1 },{ 2, 3, 1 },{ -3, 0, -3 },{ -2, -1, 0 },{ -1, -3, 2 },{ -4, 1, -2 },{ 3, 0, -1 },{ 0, -3, 3 },{ -4, 3, -2 },{ 3, -1, -1 },{ -2, -2, 0 },{ -3, 2, -3 },{ 0, 3, -1 },{ -3, 1, 0 },{ 3, -3, -4 },{ -3, 3, -2 },{ -1, -4, 1 } }, - { { -4, -2, 0 },{ 3, 0, -4 },{ 1, -3, 2 },{ -1, 3, -3 },{ 3, -3, 0 },{ -1, -1, -3 },{ 2, 1, 3 },{ 1, -3, 1 },{ 0, 0, 0 },{ 2, 3, 1 },{ -1, -1, 3 },{ 1, 2, -2 },{ -2, 3, -2 },{ -1, 0, 0 },{ -4, 0, 0 },{ -2, -4, -2 },{ -1, 3, 2 },{ -4, 0, 0 },{ -2, -4, -4 },{ 0, 1, 3 },{ -3, -1, 1 },{ 1, 3, -1 },{ 3, 0, 3 },{ -3, 2, 0 },{ 0, 3, -3 },{ -2, -1, 2 },{ 1, 1, 0 },{ -1, -3, -1 },{ 1, -4, 2 },{ -3, 1, 1 },{ -4, -4, -1 },{ 3, 2, -1 },{ 1, 1, -2 },{ -4, -2, -2 },{ -3, 1, -3 },{ -2, -2, 1 },{ 0, 3, -4 },{ -1, -2, 1 },{ 1, 0, 0 },{ -3, -3, -1 },{ 3, -2, 2 },{ -3, 2, 0 },{ -1, -3, -2 },{ 1, -2, 2 },{ 2, 1, -4 },{ -1, -3, 3 },{ -1, 2, -3 },{ 1, 0, -3 },{ -4, 1, 3 },{ 0, -3, -2 },{ 3, 3, 1 },{ 0, -2, 2 },{ -2, 2, -4 },{ 2, 3, 1 },{ 1, -1, -3 },{ 1, 2, 2 },{ 2, 1, 1 },{ 0, -3, 3 },{ 1, 0, -4 },{ 3, -3, -3 },{ -1, -1, 1 },{ 1, 0, 2 },{ 0, 0, 0 },{ 3, 3, -2 } }, - { { -3, 1, -1 },{ -4, -4, -3 },{ -2, 2, 2 },{ -3, -2, 3 },{ 0, 3, 1 },{ 3, 1, -4 },{ -2, -1, -1 },{ -3, -4, -2 },{ -1, -2, -2 },{ -2, 2, -4 },{ 3, -2, -1 },{ -4, -2, 2 },{ 1, -3, -4 },{ -3, -1, 2 },{ 0, 3, 1 },{ 2, -3, -3 },{ -4, 2, -1 },{ -1, -2, 1 },{ 3, 2, -2 },{ 2, -2, -1 },{ -2, -3, 0 },{ 0, 2, -2 },{ -1, -2, -4 },{ -4, -2, -2 },{ 1, 0, 0 },{ -1, 1, 3 },{ 2, -1, -2 },{ -3, 3, -3 },{ 3, -2, 3 },{ 0, 2, -2 },{ -3, -1, -4 },{ 0, -3, 2 },{ -2, 3, 3 },{ -1, 0, -4 },{ 2, 2, 0 },{ 3, -4, 3 },{ -4, 3, -2 },{ 2, -2, 2 },{ -2, 2, -4 },{ 2, 1, -3 },{ -4, -4, 1 },{ 0, 0, -4 },{ 2, 3, 3 },{ 3, 2, -3 },{ -4, -1, -1 },{ -3, -2, -2 },{ 2, 1, 0 },{ 3, 3, -1 },{ -2, -2, -4 },{ 1, -1, 2 },{ 2, 1, 0 },{ -4, -4, -3 },{ 1, 0, 3 },{ -1, -2, -2 },{ -1, -4, -1 },{ -2, -2, 0 },{ -4, -4, -4 },{ -1, 0, -2 },{ -2, 3, 2 },{ 2, -4, 3 },{ -4, -2, -1 },{ -2, 1, 1 },{ -2, -3, -4 },{ 2, -1, 3 } }, - { { -1, 3, -2 },{ 0, -3, 1 },{ 2, 1, 0 },{ 2, -1, -2 },{ -4, -4, -1 },{ 1, 0, 2 },{ 1, 2, 0 },{ -3, -2, -4 },{ 3, 0, 0 },{ 0, -4, 3 },{ -4, 1, -3 },{ 0, 3, 0 },{ 3, -3, -1 },{ -2, 1, -2 },{ 2, -4, 3 },{ 0, -1, -3 },{ 3, -2, 1 },{ 1, 1, 2 },{ -3, -1, -4 },{ -1, 3, 3 },{ 2, -3, -3 },{ -4, 1, 2 },{ 3, -4, 1 },{ -3, 3, -1 },{ -1, -3, 2 },{ 3, -4, -4 },{ -2, 2, -4 },{ -4, -2, 1 },{ 2, 0, -1 },{ -2, 3, -3 },{ 1, 1, 3 },{ 2, -3, -3 },{ 3, -1, 0 },{ -2, -4, 1 },{ -1, 0, -1 },{ 1, -1, -3 },{ -3, 1, 0 },{ -2, 1, -2 },{ -1, -4, 3 },{ 0, -1, 2 },{ -2, 3, -2 },{ -1, -2, 0 },{ -4, -3, 3 },{ 0, -4, 1 },{ 0, 0, -1 },{ -2, -3, 1 },{ 0, -4, 2 },{ -4, -1, 2 },{ -1, -4, -2 },{ 0, 0, 3 },{ -3, -3, -4 },{ -2, 3, -1 },{ 3, -3, 0 },{ -3, -1, 1 },{ -4, 1, 2 },{ 3, 3, 3 },{ -3, 2, -3 },{ 2, 1, 0 },{ -4, -1, 0 },{ 0, 1, -2 },{ -3, 2, -3 },{ 1, 3, -1 },{ -4, 0, -3 },{ 1, -4, 2 } }, - { { -3, -2, -1 },{ 1, 0, 3 },{ 3, 2, -4 },{ -1, -3, -1 },{ -2, -2, -3 },{ -4, 2, 2 },{ -1, -3, -2 },{ 2, 3, 3 },{ -2, 1, 2 },{ 1, 3, -1 },{ -3, -3, 2 },{ 2, -1, -4 },{ 0, 0, 3 },{ -1, 1, -3 },{ -3, -2, 0 },{ -2, 2, -4 },{ -3, 0, 3 },{ -2, -4, -1 },{ 0, 3, -3 },{ -4, 0, 1 },{ 3, 0, -2 },{ -1, -1, 0 },{ 0, -1, -4 },{ 1, 1, -3 },{ 2, -2, 1 },{ -4, 2, -1 },{ -2, -4, 2 },{ 0, 0, 0 },{ 1, -3, 2 },{ -1, -4, 1 },{ -1, -2, -2 },{ -3, 0, 1 },{ -4, 2, -1 },{ 1, -2, 2 },{ 3, 2, 3 },{ -3, -3, 2 },{ 2, -1, -4 },{ 1, -3, -1 },{ -4, -1, 1 },{ 3, -3, -1 },{ 1, 0, -4 },{ 2, 2, 0 },{ -3, 1, -1 },{ -1, 0, -3 },{ -2, 3, -4 },{ 2, 1, 3 },{ 1, 3, -4 },{ -4, 1, -2 },{ -3, 0, 0 },{ 2, 2, -1 },{ -1, 2, -3 },{ -4, -1, 2 },{ 3, 2, -4 },{ 0, 1, -2 },{ 0, 0, -4 },{ 1, -2, -3 },{ 2, -3, -1 },{ 0, -2, 2 },{ -1, -1, -4 },{ 3, -3, 3 },{ 2, -4, 2 },{ -1, -2, -2 },{ 3, -3, 3 },{ 0, 2, 1 } }, - { { 3, 1, -3 },{ -2, -2, 0 },{ -3, 3, -3 },{ -1, 0, 2 },{ 2, 1, 3 },{ 3, -2, -2 },{ 0, -4, -4 },{ -4, 0, 1 },{ 2, -1, -3 },{ -1, -4, -2 },{ -1, 0, 1 },{ -3, 2, -2 },{ -4, -4, 1 },{ 3, 3, -1 },{ 1, 2, 2 },{ -4, -2, -2 },{ 2, 0, -2 },{ 1, -3, 0 },{ 3, -3, 0 },{ -2, 1, 3 },{ 1, -4, -2 },{ -3, 3, -1 },{ 2, -3, 2 },{ -2, 0, 3 },{ -4, 3, 0 },{ 0, -1, -3 },{ 1, 3, -2 },{ -3, -1, -2 },{ 3, 2, -4 },{ -4, 1, 0 },{ 0, -1, 3 },{ 3, 3, -4 },{ 0, -3, -2 },{ -4, 2, -3 },{ 0, -2, -4 },{ -2, -4, 0 },{ 0, 3, 2 },{ 3, 2, -3 },{ -1, 0, 0 },{ -4, 3, -3 },{ -3, -2, 3 },{ 1, -4, 2 },{ 3, -1, -4 },{ 3, -2, 2 },{ -3, -4, 0 },{ 1, -1, -2 },{ 3, -3, 0 },{ -1, 2, -3 },{ 1, -3, 1 },{ 3, -4, -2 },{ -2, 1, 1 },{ 1, -3, 3 },{ 2, -2, -2 },{ -2, -4, 0 },{ -3, -3, 1 },{ -1, 0, 3 },{ 3, 2, -2 },{ -3, -4, -1 },{ 1, 2, 1 },{ -3, 3, 1 },{ -4, 0, -4 },{ 0, 1, -1 },{ -2, 2, 0 },{ -4, -1, -4 } } - }, - { - { { 2, 3, -3 },{ -1, 0, 3 },{ 1, -1, -1 },{ -3, 0, 1 },{ 2, -4, -4 },{ -1, -3, -1 },{ -4, 2, -4 },{ 1, -1, -2 },{ -2, 0, -3 },{ -4, 3, -4 },{ 3, 1, 2 },{ 2, 2, -4 },{ -2, 0, 0 },{ -4, -2, 3 },{ 3, -1, 1 },{ -1, -2, -3 },{ -4, 0, -1 },{ 0, 0, -3 },{ -1, 1, 3 },{ -2, -3, -4 },{ 3, 0, -1 },{ -3, 3, 2 },{ -4, -4, 1 },{ 3, 1, -4 },{ -3, 0, 1 },{ 3, -2, -3 },{ -4, 0, -4 },{ 2, -2, -2 },{ -3, -4, 2 },{ -4, 2, -1 },{ 3, -1, 2 },{ -3, 1, 0 },{ 1, -2, 3 },{ 0, 0, -3 },{ -2, -4, 2 },{ -1, -1, -4 },{ 3, 2, 0 },{ 1, -4, 3 },{ -4, -2, 1 },{ -1, 1, -4 },{ -3, -2, 0 },{ 0, 2, -1 },{ -4, 3, -3 },{ 2, -2, 0 },{ -2, 1, -4 },{ -3, 0, 3 },{ -2, 2, -2 },{ 1, 2, 1 },{ 0, -3, -1 },{ 2, -2, -2 },{ -2, -1, -3 },{ -1, -4, -2 },{ -4, -2, 3 },{ 0, -1, -3 },{ 3, 1, -1 },{ 2, -4, 1 },{ -4, 3, -1 },{ 3, 0, 3 },{ 3, 1, -4 },{ -4, -4, 1 },{ 2, 1, -2 },{ 3, -2, -2 },{ -2, -4, 2 },{ -1, 3, -3 } }, - { { -3, -2, -1 },{ -2, -4, 0 },{ -4, 2, 2 },{ 3, -3, -3 },{ 0, 1, 1 },{ 1, 3, -1 },{ -1, 0, 3 },{ 3, -4, 3 },{ -3, -2, 2 },{ 0, -3, -1 },{ -3, 0, 1 },{ -1, 3, -2 },{ 1, -1, -1 },{ -2, 1, -3 },{ 2, -3, 0 },{ -1, 3, -4 },{ -3, -3, 2 },{ 2, 3, -2 },{ -3, -2, 1 },{ 1, -4, -4 },{ -1, 2, 1 },{ 2, -2, 3 },{ 0, -1, -2 },{ -2, -4, -3 },{ 1, -1, -1 },{ -3, -3, -2 },{ -1, 3, 0 },{ 3, 1, -3 },{ 1, -1, 0 },{ 0, 0, 1 },{ 1, -3, -3 },{ -1, -3, 3 },{ 2, 1, -4 },{ -3, -1, -1 },{ -4, 3, 0 },{ 2, 2, -2 },{ -3, -2, 2 },{ 0, 1, -3 },{ 3, 0, -1 },{ 1, -3, 3 },{ -2, -1, -2 },{ 2, -1, -4 },{ 1, -4, 1 },{ -1, 1, -2 },{ 1, 0, -1 },{ 2, -1, 2 },{ -4, -4, 1 },{ 2, 0, -4 },{ -4, -4, 3 },{ -4, 1, 2 },{ -2, 0, 2 },{ 2, 3, 0 },{ 3, 1, -4 },{ -3, 2, 1 },{ -1, -2, -3 },{ 0, 2, -2 },{ -3, -2, 0 },{ 1, 3, -3 },{ 0, -2, 0 },{ -1, -3, 2 },{ -1, 3, -4 },{ 1, -1, 0 },{ -4, 2, -4 },{ 1, 0, 3 } }, - { { 3, 2, -2 },{ -4, 1, 2 },{ 2, -3, -4 },{ -1, 3, -3 },{ -4, -2, 2 },{ -2, 0, -2 },{ 3, -2, -4 },{ -2, 2, -1 },{ 0, 1, 0 },{ 1, -1, -3 },{ -1, -2, 3 },{ -4, -4, -3 },{ 2, -2, 2 },{ 0, -4, 1 },{ -3, 2, 0 },{ 1, 1, 3 },{ 3, -1, -1 },{ -2, -4, 0 },{ 3, 2, 2 },{ -3, 0, -3 },{ -4, 1, -1 },{ 1, -3, -2 },{ -4, 3, 3 },{ 0, 2, 0 },{ 2, 1, 2 },{ -1, 2, 3 },{ -2, -1, 2 },{ 1, -4, 3 },{ -3, -3, 0 },{ 3, 3, 2 },{ -2, 0, -4 },{ -4, 2, -1 },{ -1, 3, -2 },{ 3, -3, 2 },{ 1, -3, -3 },{ 0, 1, 1 },{ -1, -4, -1 },{ -2, -1, 0 },{ -4, 2, -2 },{ 0, 3, 2 },{ -3, 0, 1 },{ 3, 2, 3 },{ -3, 3, 2 },{ -4, -2, -3 },{ 3, -3, 3 },{ 1, 3, -3 },{ -1, -2, -2 },{ -1, 1, 2 },{ 3, 3, -1 },{ 1, 2, -1 },{ 0, -2, -4 },{ -3, -4, 1 },{ 1, 0, -1 },{ 1, -1, 2 },{ -3, -3, 3 },{ 0, 1, -2 },{ -2, 0, 2 },{ -1, -3, -4 },{ -4, -1, -2 },{ 2, 2, 3 },{ -3, -2, -3 },{ -2, 0, 2 },{ 0, -3, -1 },{ 2, -3, 1 } }, - { { 0, 3, -4 },{ 1, -4, 0 },{ 0, -1, 3 },{ 0, -1, -1 },{ 2, -4, 3 },{ -3, 2, 0 },{ 2, -3, 2 },{ -4, -3, -3 },{ -3, 3, -2 },{ 2, 1, 1 },{ 0, 2, 0 },{ 3, 0, 3 },{ 0, 3, -1 },{ -3, 0, -4 },{ 3, -1, -2 },{ -2, -4, 2 },{ 0, -2, -2 },{ -4, 1, -4 },{ 0, -1, 0 },{ 1, 3, 3 },{ 3, -3, 0 },{ -1, -1, -4 },{ -2, 0, 0 },{ 3, -3, -4 },{ -4, -2, 1 },{ 0, 3, -4 },{ 2, -4, -3 },{ -4, 0, -1 },{ -1, 1, -4 },{ 2, 2, -2 },{ -4, -2, -3 },{ 1, -4, 1 },{ 2, -2, 1 },{ -2, 1, 0 },{ -1, -1, 3 },{ -4, 0, -3 },{ 2, -2, -4 },{ 3, 3, 3 },{ -2, -4, -4 },{ 2, -3, -1 },{ 0, -2, -3 },{ -2, -4, 0 },{ -1, 0, -4 },{ -2, -3, 0 },{ 0, 1, -1 },{ -4, 2, 1 },{ -3, -3, -3 },{ 0, -2, 0 },{ -2, -1, -3 },{ 2, -3, 0 },{ 3, -3, -3 },{ -2, 2, 3 },{ -4, 1, -2 },{ -1, -3, 0 },{ 3, 3, -4 },{ 2, -4, 0 },{ 1, -1, 3 },{ 3, 1, 1 },{ -3, -3, -1 },{ 0, 2, -1 },{ 3, -4, 0 },{ 2, 1, 3 },{ -4, 1, -2 },{ -1, -1, 1 } }, - { { -2, 0, -3 },{ -3, -2, 0 },{ -3, 1, -2 },{ 3, 1, 1 },{ -1, 2, -3 },{ -4, -1, -2 },{ 0, 1, 1 },{ -1, 0, 1 },{ 1, -4, 3 },{ 3, -1, -4 },{ -2, -3, -4 },{ -4, -3, -2 },{ -3, 3, 1 },{ 2, -3, -1 },{ -1, 0, 0 },{ -4, 2, -3 },{ -1, 3, 1 },{ 2, 0, 3 },{ 1, -3, -3 },{ -2, 1, -2 },{ 0, -2, -2 },{ -2, 2, 1 },{ 2, 1, 2 },{ -3, -4, -1 },{ 0, 0, -2 },{ 3, -2, -1 },{ -3, -3, 0 },{ 2, 2, -2 },{ -2, -1, 1 },{ 0, -3, 2 },{ -1, -1, 3 },{ -3, 1, -1 },{ 0, 0, 2 },{ -2, -4, -4 },{ 3, 3, -1 },{ -3, 2, 1 },{ 1, 1, 0 },{ 0, -3, 2 },{ 1, 0, 1 },{ -1, 1, 2 },{ -4, 3, -3 },{ 1, -1, -2 },{ 3, 1, 2 },{ 0, 3, -2 },{ 2, -4, 3 },{ -2, 0, -4 },{ 3, 2, -1 },{ 2, -4, 3 },{ -3, 0, 2 },{ -1, 3, 1 },{ -3, -1, -4 },{ 0, 3, 3 },{ 2, -4, -3 },{ -1, -1, 2 },{ -2, 2, -1 },{ -4, -2, -3 },{ -2, 2, 1 },{ 2, 3, -4 },{ -4, -4, 2 },{ 0, 0, -3 },{ 1, -1, 1 },{ -2, 3, -3 },{ -3, -4, -1 },{ 3, -1, 2 } }, - { { -1, 2, 3 },{ 3, 0, -2 },{ -2, -3, -4 },{ 1, 3, 2 },{ -2, -2, -1 },{ 1, -3, -4 },{ 3, 3, 0 },{ 1, 0, -3 },{ -3, -2, -1 },{ -4, 2, 2 },{ -1, 2, 0 },{ 1, -2, 2 },{ -1, 1, -3 },{ -2, -1, 3 },{ 1, 2, 3 },{ 0, -3, -3 },{ 3, -2, 1 },{ -3, -4, -1 },{ -4, 2, 2 },{ -1, -4, 1 },{ -3, -2, 3 },{ 3, 0, -3 },{ 1, -4, 1 },{ -4, 1, -3 },{ -1, 3, 3 },{ -2, 0, 1 },{ 1, 1, 2 },{ -1, 0, 3 },{ -4, -2, -4 },{ 1, 2, -1 },{ 3, -4, 0 },{ 3, 3, -3 },{ -4, -2, -2 },{ 2, 2, -3 },{ -3, -2, 3 },{ 3, -4, -1 },{ -1, -3, -3 },{ -4, -1, -2 },{ -3, 2, -1 },{ 3, -1, -2 },{ 0, -4, 1 },{ 2, -1, 3 },{ -3, -3, -1 },{ -4, -1, -3 },{ 1, 0, 1 },{ -3, -2, 0 },{ 3, -1, 1 },{ 0, 3, -4 },{ -4, 1, -2 },{ -1, -4, -2 },{ 1, 0, 0 },{ -4, 1, -1 },{ 3, -2, 1 },{ 1, 0, 1 },{ -3, 3, -3 },{ 2, -3, 3 },{ -1, 0, -1 },{ -3, -2, -2 },{ 3, 1, 1 },{ -2, -3, -4 },{ -1, 0, -2 },{ -4, -2, 3 },{ 1, 2, -4 },{ 2, -3, -1 } }, - { { 0, -4, 2 },{ 2, 3, -1 },{ -4, -2, 0 },{ 0, -4, 1 },{ -4, 0, -1 },{ 3, 2, 3 },{ -2, -1, 2 },{ -1, -4, -2 },{ -2, 3, 3 },{ 2, -1, -2 },{ 0, -4, -1 },{ 2, 0, 1 },{ 3, -2, 0 },{ -4, -4, -2 },{ 3, 2, -4 },{ -3, -2, 2 },{ -2, 1, -2 },{ 1, 0, -4 },{ 2, -1, 0 },{ 3, 3, -4 },{ 0, 0, -1 },{ -4, 3, -1 },{ -1, -2, 2 },{ 2, -1, 0 },{ 3, -2, -3 },{ 1, 2, -4 },{ -3, -4, 0 },{ 3, 3, -2 },{ 2, -4, -3 },{ -3, 0, 3 },{ -2, 3, -2 },{ 1, 0, 1 },{ -1, -1, -4 },{ 0, -3, 2 },{ -4, 0, 1 },{ 1, 0, -2 },{ -2, 2, 2 },{ -2, 3, -4 },{ 2, -4, 0 },{ -3, -2, 3 },{ -2, 1, -4 },{ -4, 2, 0 },{ -1, 2, 1 },{ 3, -2, -4 },{ 0, 2, 3 },{ -1, 3, -2 },{ -2, -3, 2 },{ -1, 1, -1 },{ 1, -2, 1 },{ 3, -3, 3 },{ 0, 2, 2 },{ 2, -2, -3 },{ -3, -4, -2 },{ 0, -1, -4 },{ 1, 1, -1 },{ 3, -4, 1 },{ -1, -3, -4 },{ 1, -1, 0 },{ 0, 2, 3 },{ -3, -2, 0 },{ 2, 3, 2 },{ 0, -3, 0 },{ -1, 1, -3 },{ -4, 3, 1 } }, - { { -4, -1, -4 },{ 0, -3, 3 },{ -1, 1, -3 },{ 2, -1, -3 },{ -3, 1, 2 },{ 0, -4, -2 },{ -3, -2, -4 },{ -4, 1, 0 },{ 2, 0, -4 },{ 3, -3, 1 },{ -2, 1, -3 },{ -3, 3, 3 },{ 1, 1, -4 },{ 0, -1, -1 },{ -1, -4, 1 },{ 2, 0, -1 },{ -2, 3, 2 },{ 0, -1, 0 },{ -1, -3, -2 },{ -4, 1, -3 },{ 2, -3, 2 },{ -1, 2, -2 },{ -2, -3, -4 },{ 1, 3, -2 },{ -3, -3, 3 },{ -2, -1, -1 },{ 0, -3, -3 },{ -4, -1, 2 },{ -1, 1, 1 },{ 0, -3, -1 },{ 0, -2, -3 },{ -4, 1, 0 },{ -2, -3, 3 },{ 2, 3, -1 },{ -1, 1, 0 },{ 0, -2, -4 },{ 2, -1, 3 },{ 3, -2, 1 },{ 0, 3, 0 },{ 1, 0, -3 },{ -1, -3, 2 },{ 2, 3, -2 },{ -2, -4, 2 },{ -1, 0, 0 },{ -4, -4, -3 },{ 2, -3, 0 },{ -4, -1, -4 },{ -3, -4, -3 },{ 2, 2, -3 },{ -3, -1, 0 },{ -2, 0, -4 },{ -2, 2, 2 },{ -4, -3, 0 },{ -1, 3, 3 },{ -2, -1, 2 },{ -4, 0, -2 },{ 0, 2, 2 },{ -4, 3, -3 },{ -2, 1, -1 },{ 3, -4, -2 },{ 2, 2, 3 },{ 1, -1, -1 },{ -2, -2, -2 },{ 3, 0, 0 } }, - { { -2, 0, -2 },{ 3, 2, 1 },{ -3, -2, -1 },{ 1, 2, 1 },{ -1, 3, -4 },{ 2, -3, 0 },{ -2, 2, 1 },{ 1, 2, -1 },{ 0, 0, 2 },{ -1, -3, 2 },{ -4, -2, -2 },{ -2, 0, -1 },{ 3, -3, 2 },{ -4, 2, -3 },{ -2, 3, 3 },{ 1, -1, 0 },{ -4, -3, -3 },{ 3, -4, 3 },{ -2, 3, 2 },{ -3, -2, 1 },{ 1, -4, 3 },{ 2, -1, 0 },{ 3, 0, 0 },{ -3, 2, 2 },{ 0, 1, 1 },{ -4, -2, -2 },{ 2, 0, 0 },{ -1, -2, -4 },{ -3, 3, 3 },{ 3, 0, -4 },{ -2, 2, 1 },{ 2, -4, 0 },{ 3, -1, 2 },{ -3, 2, -3 },{ 3, -4, -1 },{ -3, 3, 1 },{ -4, -3, -3 },{ 0, 1, -1 },{ -2, 1, 3 },{ -4, -3, -2 },{ 2, -2, -4 },{ 1, 1, -1 },{ 3, 0, 3 },{ -3, -2, -2 },{ 2, 2, -1 },{ 1, 1, -1 },{ 3, 1, 3 },{ 0, 0, 2 },{ -1, 3, -1 },{ -4, -1, 3 },{ 2, -4, -4 },{ 0, 3, -1 },{ 1, 0, -1 },{ 3, 2, 1 },{ 2, -2, -4 },{ -3, 1, -3 },{ 3, -2, 0 },{ 2, -4, 2 },{ -1, -1, -4 },{ -3, -3, 1 },{ -4, 1, -4 },{ -2, 0, -3 },{ -3, -2, 1 },{ 2, -4, 2 } }, - { { 1, 2, -2 },{ -3, -3, -4 },{ 2, 0, 3 },{ -4, -4, -2 },{ 1, -1, 3 },{ 3, 0, -1 },{ 0, -1, -3 },{ -4, -2, 3 },{ 3, -4, 0 },{ -3, 3, -3 },{ 1, 2, 1 },{ -1, -2, -4 },{ 2, -4, 0 },{ -3, 0, -2 },{ 0, -2, 1 },{ 2, 1, -4 },{ -3, 1, -1 },{ 1, 2, -3 },{ 2, 0, -2 },{ -4, 2, 0 },{ 0, 1, -4 },{ -2, -2, -3 },{ -4, -4, 3 },{ -1, 0, -3 },{ 1, -4, -4 },{ 3, 3, 3 },{ -2, 1, 2 },{ 2, 2, 0 },{ 0, -4, -1 },{ 2, -1, -2 },{ -4, -3, 3 },{ 1, 3, -4 },{ -3, -2, -2 },{ -1, 0, -2 },{ 1, -2, 3 },{ 1, 0, -4 },{ -1, -3, 2 },{ -3, 0, -2 },{ 2, -4, -3 },{ 3, 2, 0 },{ -3, -1, 1 },{ -4, -4, 2 },{ 0, 3, -3 },{ 1, -3, -4 },{ -2, 3, 2 },{ 0, -1, 1 },{ -3, -2, -3 },{ 3, 3, 1 },{ 1, -3, 0 },{ 0, -2, -2 },{ 3, 1, 1 },{ -3, -1, 2 },{ 2, -3, -2 },{ -4, -4, -3 },{ -1, 1, 0 },{ 0, -3, 1 },{ -2, 0, -1 },{ 1, 2, 3 },{ 1, 0, 1 },{ 0, -2, -1 },{ 1, 3, 0 },{ 3, -4, 2 },{ -1, 1, 3 },{ 0, 3, -3 } }, - { { -1, -4, 0 },{ 0, -2, 2 },{ -2, 1, -3 },{ -1, 3, 1 },{ -2, -3, 2 },{ -4, 0, -2 },{ -1, 3, 1 },{ 2, -3, -4 },{ -1, 1, -2 },{ 1, -1, -4 },{ -2, -1, 2 },{ 3, 1, -1 },{ 1, 3, 3 },{ -3, -1, 0 },{ 3, 2, -2 },{ -1, -3, 3 },{ -4, -4, 1 },{ 0, -1, -4 },{ -1, -3, 1 },{ 3, 0, -3 },{ -3, -1, -1 },{ 0, 3, 1 },{ 2, 1, -2 },{ -1, 3, -1 },{ 2, -1, 0 },{ -2, -3, -1 },{ -3, 0, -4 },{ 1, -4, -2 },{ -4, 3, 1 },{ -2, 0, -3 },{ 1, 1, 2 },{ -1, 2, -1 },{ 0, -4, 0 },{ -4, -1, 2 },{ -2, 1, 1 },{ 3, 2, 0 },{ -2, 3, 0 },{ 0, -1, -1 },{ 1, -1, 2 },{ -2, 3, 3 },{ -1, 0, -3 },{ -1, 2, -1 },{ 2, -1, 0 },{ -2, -2, 1 },{ -3, 0, 3 },{ -1, -4, -1 },{ -4, -4, -2 },{ -2, 2, -4 },{ -4, -1, 2 },{ -1, -4, -2 },{ -1, 3, -3 },{ -2, 1, 1 },{ 1, -3, 3 },{ 0, -1, -1 },{ -3, 2, 3 },{ 2, -2, -2 },{ -1, -4, -4 },{ -4, 3, -2 },{ -3, 1, -3 },{ -1, -2, 2 },{ -4, 2, -2 },{ -2, -3, -4 },{ 1, -1, 1 },{ -4, 2, -1 } }, - { { 3, 3, 3 },{ -4, -1, 0 },{ 3, 1, -1 },{ -3, -3, -4 },{ 3, -2, -1 },{ 1, 2, -3 },{ -3, -4, 0 },{ -2, -2, 2 },{ 2, 2, -1 },{ -3, 3, 3 },{ 0, -4, 1 },{ -4, 0, -1 },{ -1, -4, -3 },{ -2, -2, 2 },{ -1, -3, -4 },{ 1, 3, 2 },{ 3, 2, -1 },{ -2, -2, 3 },{ -2, -2, 0 },{ 1, 3, 2 },{ 3, -3, 3 },{ 1, 1, 1 },{ -3, -2, -4 },{ -4, -3, 2 },{ 3, 2, 1 },{ 1, 2, -3 },{ 0, -2, 2 },{ -1, 2, 1 },{ 3, -2, 3 },{ -1, -3, 0 },{ -3, -1, -3 },{ 3, -2, 1 },{ 2, 3, -1 },{ -4, 0, -3 },{ 1, -3, -4 },{ -3, -2, -2 },{ 2, -4, 3 },{ -4, 2, -4 },{ 3, -2, -3 },{ 0, 1, 1 },{ -3, -3, -2 },{ 1, -4, 2 },{ -4, 3, 0 },{ 3, -3, -2 },{ 2, 1, -4 },{ 3, 2, 0 },{ 1, -3, -3 },{ 0, -2, 3 },{ 2, 1, 0 },{ 3, 2, -4 },{ -4, 0, 3 },{ 0, -2, -1 },{ -2, 3, -4 },{ 3, 0, -3 },{ -1, 2, 0 },{ -4, 3, 2 },{ 3, -1, -1 },{ -2, -3, 3 },{ 2, 0, 1 },{ 3, -4, -3 },{ 2, 3, 3 },{ 0, 0, -2 },{ 3, -1, -1 },{ -3, -2, -3 } }, - { { 1, 0, -4 },{ 0, -4, 1 },{ 2, 2, -2 },{ -2, -1, 2 },{ 0, 1, 3 },{ 0, 3, 0 },{ 3, -1, 1 },{ -4, 1, -2 },{ 0, -1, -3 },{ 3, 0, 0 },{ 1, -3, -2 },{ -3, 2, 1 },{ 2, -2, -4 },{ 0, 2, -1 },{ -4, 0, -3 },{ -3, -1, -2 },{ 1, 0, 0 },{ 2, 1, -3 },{ -3, 0, -2 },{ -1, -4, -2 },{ -4, 2, -1 },{ -2, -4, -3 },{ -1, -1, 0 },{ 1, -3, -2 },{ -3, 0, 3 },{ -1, -4, 0 },{ -4, -1, -3 },{ 3, -1, -1 },{ 1, 1, -4 },{ -3, 3, -2 },{ 0, 0, 3 },{ 0, 2, 0 },{ -2, 1, -4 },{ 3, -4, 3 },{ -1, 3, 1 },{ 0, -1, -3 },{ 2, 2, -1 },{ -3, -4, 2 },{ -1, 0, 1 },{ 2, -3, 0 },{ -2, 0, -4 },{ 3, -2, -4 },{ 0, 1, 3 },{ -2, 2, -3 },{ 0, -1, 2 },{ -1, 0, -2 },{ -3, 1, 2 },{ 2, 3, 2 },{ -2, 0, -1 },{ -3, -2, -3 },{ 1, -4, 1 },{ 2, -3, 0 },{ -4, 1, 2 },{ -3, -2, -2 },{ 2, -4, 1 },{ 1, -2, 3 },{ -2, 1, -4 },{ 0, -3, -1 },{ 1, 2, 0 },{ -2, -1, 2 },{ -4, -3, 0 },{ -1, 0, -4 },{ -2, 1, 3 },{ -3, -3, 1 } }, - { { 2, 2, -1 },{ -2, -2, 3 },{ -1, 0, -3 },{ 1, -4, 0 },{ -4, -3, -3 },{ -1, 0, -4 },{ 1, -4, 3 },{ -2, -3, -1 },{ -4, 2, 2 },{ 0, -3, -4 },{ -1, -2, 3 },{ -4, 1, -2 },{ 3, 1, 2 },{ 1, 3, 3 },{ 3, -4, 0 },{ 0, -3, 3 },{ -2, 2, 1 },{ -4, -4, -4 },{ 3, 3, 2 },{ 0, -1, 1 },{ -1, 0, -4 },{ 2, 2, 2 },{ 3, 3, 3 },{ 0, 1, -2 },{ -2, 1, -4 },{ 0, 3, 0 },{ 2, -4, 3 },{ -3, 1, -2 },{ 0, 0, 1 },{ -2, -4, -1 },{ 2, -2, -3 },{ -4, -4, 2 },{ -1, -3, -2 },{ 2, -1, 2 },{ -3, 2, 0 },{ -4, 0, 1 },{ 1, -2, -4 },{ -2, 1, 2 },{ -4, 3, -2 },{ -1, 2, -1 },{ -4, -4, 3 },{ 0, 2, 2 },{ -1, -1, -1 },{ -4, -2, 0 },{ -3, -4, 1 },{ 3, -2, 0 },{ -4, 2, -4 },{ -1, -4, 1 },{ 0, -3, -2 },{ 2, 2, 3 },{ -3, 0, -1 },{ 3, 3, -2 },{ 1, -1, -4 },{ 0, 2, -1 },{ -1, -4, 1 },{ 2, -1, -3 },{ -3, 0, -3 },{ -3, 2, 2 },{ -1, -2, -4 },{ 0, 3, -2 },{ 1, 1, -1 },{ -3, -3, 1 },{ 2, 2, 2 },{ 0, -4, -3 } }, - { { -1, 3, 0 },{ -3, -1, -2 },{ -4, 2, 2 },{ 3, 3, -1 },{ -3, 1, 1 },{ -2, -2, -2 },{ 2, 2, 2 },{ 1, -1, -3 },{ 3, 1, 0 },{ -2, 3, -1 },{ 2, -4, 1 },{ -1, 0, -3 },{ -2, -1, -1 },{ -2, -3, -2 },{ -3, 0, 1 },{ 2, -2, -4 },{ -1, 1, -1 },{ 3, -1, 2 },{ 0, -2, 0 },{ -3, 1, 3 },{ 2, -3, -3 },{ -4, -2, -1 },{ -3, -4, 1 },{ -2, -1, -4 },{ 3, -2, -3 },{ -4, 3, -1 },{ 2, -3, 2 },{ -2, -1, -4 },{ -4, 3, 2 },{ 1, -3, 3 },{ 3, 2, -3 },{ -2, 1, -4 },{ 1, -1, -1 },{ 0, 3, -2 },{ 3, -2, 2 },{ -2, -4, -3 },{ 0, 1, -1 },{ 3, -3, 3 },{ 2, -1, -3 },{ 1, -2, 0 },{ 3, 1, 1 },{ 1, 0, -3 },{ 2, -3, -2 },{ 1, 3, -2 },{ -1, 1, -4 },{ 1, 3, 3 },{ 0, -3, -3 },{ 3, -1, -2 },{ -4, -1, -1 },{ -1, 3, -4 },{ -1, -1, 1 },{ -2, 1, 2 },{ -1, -3, 3 },{ -2, 1, -2 },{ -4, 3, 0 },{ 0, 0, 3 },{ 2, 3, -2 },{ 3, -4, 1 },{ -4, -1, -1 },{ 3, -2, 3 },{ -2, 2, -3 },{ 3, -4, 0 },{ 1, -2, -2 },{ -4, 1, -1 } }, - { { 3, -3, 2 },{ -1, 1, -4 },{ 1, -3, 0 },{ 2, -4, 3 },{ 0, -1, -4 },{ -3, -2, 0 },{ -4, 3, -2 },{ 0, -4, 3 },{ -1, 0, 1 },{ -3, 2, -4 },{ 1, -1, 3 },{ 3, -3, 0 },{ -4, 3, 1 },{ 1, -4, -4 },{ 2, 2, 2 },{ 0, 3, -3 },{ -4, -4, -2 },{ -2, 2, -3 },{ 1, -3, -3 },{ 0, 3, -1 },{ -2, 1, 1 },{ 1, 0, -2 },{ -1, -3, 0 },{ 2, 0, 2 },{ 1, 2, 3 },{ -3, -3, 1 },{ -1, 0, 0 },{ 3, -2, -3 },{ -1, 2, -1 },{ 1, -2, 0 },{ -1, -1, 0 },{ -3, 0, 1 },{ 2, 2, 3 },{ -4, -3, -4 },{ -1, 1, -3 },{ 1, 0, 3 },{ -2, -1, 0 },{ 3, 2, -2 },{ -3, -4, 2 },{ -3, -1, -4 },{ -2, 3, -1 },{ -4, -4, 1 },{ -3, -1, 2 },{ 3, 1, 0 },{ -3, -4, 2 },{ -2, 0, -1 },{ 1, -2, 2 },{ 2, 1, 1 },{ -2, 1, 3 },{ 1, -4, 0 },{ 3, -2, -3 },{ -4, -4, 0 },{ 2, 0, -4 },{ -3, -1, 2 },{ 3, -3, -3 },{ -1, -3, -1 },{ 1, 2, 0 },{ -2, -4, 2 },{ 0, 1, -2 },{ 2, -3, 2 },{ -4, 0, -4 },{ -1, 3, 3 },{ -3, -1, 1 },{ 2, -1, -4 } }, - { { 0, 0, 1 },{ -4, -2, 0 },{ -2, 3, -2 },{ 2, -1, -3 },{ 0, 0, -1 },{ 3, 2, 2 },{ 2, -3, -4 },{ -2, 1, -1 },{ 2, -3, -3 },{ -4, -2, -2 },{ -3, 2, 0 },{ 0, 1, -3 },{ 2, 0, 2 },{ -3, 2, -2 },{ -1, -1, -1 },{ 1, -1, 3 },{ -3, 0, 1 },{ 2, -3, 2 },{ -3, 0, 3 },{ -4, -4, 0 },{ 3, -1, -4 },{ 3, 3, 3 },{ 0, -3, 2 },{ -4, 2, -3 },{ -1, -2, -1 },{ 0, -4, -2 },{ 1, 1, -4 },{ 2, -1, 3 },{ -3, 2, -2 },{ -4, -4, -4 },{ 3, 1, 2 },{ -2, 3, -2 },{ -3, -4, 1 },{ 0, -3, 0 },{ 3, 3, -1 },{ -3, -4, -2 },{ -4, 2, 1 },{ -1, 3, -4 },{ 0, 0, 3 },{ 1, 1, -3 },{ -1, -3, 3 },{ 3, 2, -2 },{ -1, -2, -4 },{ 0, -1, 3 },{ 2, 0, -1 },{ -2, -3, -3 },{ -4, 2, -3 },{ -3, 3, 0 },{ 0, -2, -4 },{ -3, 1, 2 },{ -4, 0, -3 },{ 2, 3, -1 },{ 0, -2, -2 },{ 1, 2, 3 },{ 3, 3, -1 },{ -4, -2, -4 },{ -3, 0, 1 },{ 1, -1, -4 },{ -3, 3, -3 },{ -1, -2, 1 },{ 2, -4, -1 },{ 0, 2, -3 },{ -3, -3, -2 },{ 1, 1, 3 } }, - { { 2, -4, -3 },{ -2, 2, -1 },{ 3, -4, 2 },{ -3, 2, 2 },{ -2, 1, 1 },{ -4, -3, 3 },{ -1, -1, 0 },{ -3, 2, 2 },{ 0, -1, 1 },{ 3, -4, 2 },{ 1, 3, -1 },{ -2, -2, 3 },{ 3, -3, -4 },{ -1, -4, 0 },{ -4, 1, 2 },{ 3, -2, -1 },{ -2, 3, 0 },{ 0, 1, -4 },{ 2, -1, -1 },{ -2, 2, 2 },{ -1, -2, -2 },{ -3, -2, -3 },{ -3, 3, -1 },{ 1, 1, -4 },{ 3, -1, 0 },{ -2, 2, 1 },{ -4, 3, 3 },{ -2, -4, -1 },{ 1, 0, 2 },{ -2, -3, -1 },{ 0, -2, 3 },{ 1, 0, -3 },{ 1, 2, -2 },{ -2, -1, 3 },{ 2, 0, 2 },{ 1, -2, -1 },{ 0, -1, -4 },{ 2, -3, 1 },{ -4, -2, 0 },{ -2, -3, -1 },{ 2, 0, 1 },{ 0, 1, -4 },{ -4, -3, -1 },{ -2, 2, -3 },{ 1, 3, 1 },{ 3, -2, -2 },{ 0, -1, 3 },{ 2, -3, 1 },{ -1, -4, -1 },{ 1, 2, -2 },{ 0, -1, 1 },{ -2, -3, 3 },{ -3, 2, 0 },{ -1, -4, -2 },{ -2, -4, 1 },{ 2, 1, 2 },{ -1, -1, -2 },{ 0, -2, 3 },{ 2, 2, 0 },{ -2, 1, -2 },{ 3, 1, 3 },{ 0, -1, 0 },{ -2, 3, -1 },{ -2, -2, 2 } }, - { { -4, 3, 0 },{ 1, 1, 3 },{ -1, -1, -4 },{ 0, -3, -3 },{ -1, 0, -1 },{ 1, -4, -3 },{ 1, 3, -2 },{ 3, 1, -4 },{ -3, 0, -3 },{ -1, 3, 0 },{ 0, 0, -4 },{ -4, -4, -2 },{ -2, -1, 2 },{ 0, 1, 1 },{ 2, -3, -3 },{ 0, 2, -3 },{ -4, -3, 1 },{ 3, 3, -2 },{ -1, -2, -3 },{ 1, -4, 0 },{ 1, 1, 1 },{ 0, 0, -2 },{ 2, -4, 1 },{ -2, 0, 3 },{ 2, -4, -2 },{ -4, -2, -4 },{ 3, 1, 1 },{ 0, 1, -3 },{ 2, -3, 1 },{ 0, 3, 0 },{ -4, 0, -3 },{ 2, -2, 1 },{ 3, -4, -1 },{ -1, 1, -4 },{ -3, 3, -3 },{ -4, -3, 2 },{ -1, 2, 3 },{ 3, 0, -2 },{ -2, 3, -3 },{ 2, -2, 2 },{ -3, 2, 0 },{ -4, 3, 0 },{ 1, 0, 2 },{ 2, -3, 1 },{ -3, 2, 0 },{ -1, -4, 3 },{ -4, 1, -4 },{ -1, 0, -3 },{ 3, -3, -1 },{ -3, 0, 3 },{ 3, 2, 0 },{ 1, 1, -4 },{ 3, 0, 1 },{ -4, -1, -4 },{ 1, 0, -3 },{ 0, 3, 3 },{ 3, -3, -1 },{ -4, 1, 0 },{ -1, -4, -3 },{ 1, -3, -1 },{ -4, 0, 1 },{ 1, -4, 2 },{ -1, 0, -3 },{ 3, -3, -4 } }, - { { 0, 0, -2 },{ 3, -2, -1 },{ -3, 1, 1 },{ 2, -2, -2 },{ 0, 3, 0 },{ -4, 0, 2 },{ -2, -2, 1 },{ 2, -4, -2 },{ -2, -3, 0 },{ -1, -2, 3 },{ 2, -1, 1 },{ -3, 2, -1 },{ 3, 2, -2 },{ -3, 3, 3 },{ 1, -1, -4 },{ -2, -2, -1 },{ 2, -4, 3 },{ -1, 0, 1 },{ -3, -2, -4 },{ -4, 2, 3 },{ 3, -3, -1 },{ -4, 1, 0 },{ -3, -1, 2 },{ -1, -3, -1 },{ 0, 3, 2 },{ -1, -2, 0 },{ 1, -3, -3 },{ -3, -1, -2 },{ -1, -1, 2 },{ 3, 2, -4 },{ -3, 1, -2 },{ -1, -3, 3 },{ -3, 3, -1 },{ -4, -2, 2 },{ 0, 0, 0 },{ 3, -4, -3 },{ 1, 1, 0 },{ 0, -4, 2 },{ -3, -1, -2 },{ 0, 2, 3 },{ 3, -4, -4 },{ -1, -2, -2 },{ 2, -4, 3 },{ -1, -1, -2 },{ -3, -2, -4 },{ 3, 2, -1 },{ 1, -1, 2 },{ -2, 3, 2 },{ -4, -1, 0 },{ 0, 3, -4 },{ -2, -4, -2 },{ -4, -2, 2 },{ -1, -2, -2 },{ 0, 3, 2 },{ -3, 1, 0 },{ -3, -3, -1 },{ 1, 2, -4 },{ -2, 0, 2 },{ -4, 3, 2 },{ 0, -1, -4 },{ -3, -2, -4 },{ 3, 2, 3 },{ -4, 1, -1 },{ -3, -1, 1 } }, - { { 2, 2, -4 },{ -2, -4, 2 },{ -4, 3, -2 },{ 1, -3, 3 },{ 3, -4, 0 },{ -3, 1, -4 },{ 3, 3, 3 },{ 0, -1, -1 },{ -4, 1, 3 },{ 1, 1, -3 },{ -2, -2, -4 },{ 2, -3, 1 },{ 1, 0, -3 },{ -1, -2, 2 },{ -3, 0, 0 },{ 0, 1, -2 },{ -4, 2, 2 },{ 1, 0, 2 },{ -2, 2, 0 },{ 0, -1, -3 },{ 2, 3, 3 },{ -1, -1, -4 },{ 1, 3, -3 },{ 3, 2, -4 },{ -3, 0, -1 },{ -2, 2, 2 },{ 1, 0, 3 },{ -4, 3, -4 },{ -2, -4, 3 },{ -3, 2, -1 },{ 2, -4, 0 },{ -2, -1, 2 },{ 1, 1, -4 },{ 0, -3, 0 },{ 2, -1, -2 },{ -2, -1, 1 },{ -3, 3, -3 },{ -4, -2, -1 },{ 1, 0, -4 },{ -1, -3, 1 },{ -4, 1, -3 },{ -2, -1, -1 },{ 0, 3, -3 },{ 3, 1, 2 },{ -4, 1, 1 },{ 1, 0, -2 },{ -2, -4, -2 },{ 0, -2, 0 },{ 2, 1, -3 },{ 1, -2, 3 },{ -2, -4, 1 },{ 2, 3, -3 },{ 3, -3, -1 },{ -1, 0, -1 },{ -2, -4, 2 },{ 2, -2, -3 },{ -2, 0, -2 },{ 2, -4, 3 },{ 3, -1, 1 },{ 2, 2, 0 },{ -2, -3, -2 },{ -1, 3, -2 },{ 2, -4, 0 },{ 0, -3, 3 } }, - { { -2, 3, -3 },{ 3, -3, 0 },{ 0, 0, -3 },{ -3, 2, 1 },{ -2, -1, -4 },{ 1, -1, 2 },{ -1, 2, -2 },{ -3, -3, -3 },{ 0, 2, 0 },{ 3, 3, 2 },{ -4, -4, -2 },{ -3, 1, 0 },{ 0, -1, 2 },{ 3, -4, -2 },{ -2, -3, 0 },{ 3, 3, 1 },{ 2, -4, -4 },{ 0, -1, -3 },{ 3, -3, -1 },{ -3, -2, -2 },{ -2, -4, 2 },{ 0, 1, 0 },{ 2, -3, -2 },{ -4, -4, 1 },{ 3, 1, 3 },{ 0, -4, -3 },{ 2, -3, 0 },{ 0, 2, -1 },{ 3, -2, 1 },{ 1, 0, -2 },{ 0, -2, -4 },{ 3, 0, 3 },{ -4, 3, -3 },{ -1, 2, 1 },{ -2, 1, 3 },{ 1, 2, -4 },{ -1, -3, 3 },{ 3, 3, 1 },{ 0, 1, -1 },{ 2, -4, 2 },{ 1, 3, 1 },{ -2, -1, 3 },{ 0, 0, -1 },{ 2, -4, -4 },{ -4, -3, 0 },{ -1, 2, 2 },{ 2, 3, -3 },{ 0, -4, 1 },{ -3, 0, -4 },{ 2, 2, -1 },{ -4, 0, 2 },{ 0, 1, 0 },{ -3, -1, 3 },{ 2, 2, -4 },{ 3, 2, 3 },{ 1, -1, 1 },{ -4, -2, 0 },{ 0, 3, -3 },{ -3, -2, -2 },{ -1, 1, -1 },{ 0, 1, 3 },{ 1, -2, -3 },{ -2, 0, 0 },{ 1, 1, 2 } }, - { { -4, -2, -4 },{ -1, -1, 2 },{ -3, 1, -1 },{ -1, -2, 3 },{ 2, 1, -3 },{ -4, -3, -2 },{ 1, -2, 0 },{ -1, -4, 1 },{ 2, 0, -4 },{ -2, -2, 2 },{ 2, -1, -3 },{ -1, 3, 3 },{ -4, 2, -1 },{ 1, 1, -4 },{ -4, 2, 3 },{ -1, 0, -3 },{ -3, -2, -1 },{ 1, -3, 0 },{ -3, 3, 3 },{ 2, 1, 1 },{ -1, 0, -4 },{ 3, 2, -1 },{ -3, -2, 3 },{ -2, -1, 0 },{ -1, -2, -4 },{ -3, 3, -2 },{ 2, -1, 1 },{ -2, 1, -1 },{ -4, -3, -3 },{ 1, 3, 2 },{ -1, 1, -2 },{ -3, -1, 0 },{ 2, -3, -1 },{ 3, -4, -2 },{ -4, -2, 1 },{ 2, -4, -1 },{ -3, -3, -3 },{ 2, -1, 0 },{ -2, 0, -2 },{ -4, 2, 0 },{ 3, -3, -4 },{ -3, -2, -2 },{ -3, 2, 1 },{ 1, 3, 0 },{ -2, -2, 3 },{ 3, -1, -3 },{ -3, -3, 3 },{ -4, 1, -1 },{ -1, -2, 2 },{ 3, -1, 3 },{ -1, -3, -2 },{ -3, 3, -4 },{ 1, 1, 0 },{ -2, -4, -2 },{ -4, -3, 1 },{ 0, 3, -2 },{ -1, 1, -1 },{ 3, -4, -4 },{ -3, -3, 3 },{ 2, 3, 2 },{ -4, -4, 1 },{ -4, 0, -4 },{ 3, 2, 2 },{ -3, -2, -1 } }, - { { 2, -1, 1 },{ 1, 0, 1 },{ 3, 3, -2 },{ 2, -4, -1 },{ 0, 0, 0 },{ -2, 3, 1 },{ 3, 0, 2 },{ -4, 2, 3 },{ 0, 0, -1 },{ -3, -3, -1 },{ 1, 1, 0 },{ -1, -3, -4 },{ 2, 0, 1 },{ -2, -4, -2 },{ 2, -1, 1 },{ 0, -2, 3 },{ -1, 3, -2 },{ -4, 2, -4 },{ -1, 1, 0 },{ 1, -1, 2 },{ -4, -4, -2 },{ 0, -3, 1 },{ -2, 2, 2 },{ 1, 0, -3 },{ 1, 3, 0 },{ -4, -1, 2 },{ 0, 1, -4 },{ -3, -3, 3 },{ 3, 0, 0 },{ -2, 2, -3 },{ -4, -3, 3 },{ -2, -4, 1 },{ 0, -1, -3 },{ -1, 1, 2 },{ -3, 0, -4 },{ 0, 3, -1 },{ 1, 1, 2 },{ -1, -1, 2 },{ -3, -4, -4 },{ 0, -2, 3 },{ 1, 2, 0 },{ -1, 0, -2 },{ 2, -3, 2 },{ 1, -4, -2 },{ -1, 1, -4 },{ 0, 0, 1 },{ 2, 3, -1 },{ 3, -3, -2 },{ -2, 2, 0 },{ 1, 2, -4 },{ -2, -4, -1 },{ 3, 0, 1 },{ 0, -2, 2 },{ -4, -1, -3 },{ -1, 3, -4 },{ 2, -3, 2 },{ 1, 0, 0 },{ -4, 2, 1 },{ 1, 0, -4 },{ 3, -1, -2 },{ -2, -3, -3 },{ 0, -1, -1 },{ 2, -4, 0 },{ -1, 3, -2 } }, - { { -2, 1, -1 },{ -3, -4, 3 },{ 1, -2, -4 },{ -4, -3, -4 },{ -2, 2, 2 },{ 0, -4, -2 },{ -3, -1, -3 },{ 1, 3, -4 },{ 2, -2, -2 },{ -4, 1, 1 },{ 3, 2, -3 },{ 0, -2, 3 },{ -3, -2, 0 },{ 1, 3, -1 },{ 0, -3, 2 },{ -3, 1, -3 },{ 2, -2, 1 },{ 3, 0, 2 },{ -2, -4, -3 },{ 1, -2, -4 },{ -3, 3, 3 },{ 3, 1, -3 },{ 0, 0, -4 },{ 2, -4, -1 },{ -4, 2, 2 },{ 3, -4, 1 },{ -2, 0, -2 },{ 1, -4, -3 },{ 2, -2, 2 },{ -1, -1, 0 },{ 2, 2, -2 },{ 2, 3, -4 },{ 1, 2, 2 },{ -2, -1, 3 },{ 3, 2, 0 },{ -2, -2, -2 },{ 3, -2, 3 },{ -1, 3, -3 },{ -4, 1, -2 },{ 3, -3, -3 },{ -1, -1, 2 },{ -4, 3, -4 },{ -2, 0, 1 },{ 3, -1, 0 },{ -3, 1, -3 },{ -4, -4, 2 },{ 1, -1, -4 },{ 0, 1, 2 },{ -4, -4, -3 },{ 1, 0, 1 },{ -4, 1, -3 },{ 2, -2, 3 },{ -2, -3, -2 },{ 2, 2, 1 },{ -3, 1, -1 },{ 0, -4, 3 },{ -2, -1, -3 },{ -2, -2, 3 },{ -1, 2, -1 },{ 0, 1, 0 },{ -1, 3, 0 },{ 3, 1, 3 },{ -3, 2, 1 },{ 0, -3, -4 } }, - { { 3, 0, -3 },{ 0, 3, 0 },{ -1, 2, 2 },{ -3, -1, 1 },{ 3, 1, 3 },{ 2, -2, -1 },{ -1, 1, 0 },{ 0, -3, 1 },{ -2, -4, 2 },{ -1, -1, 3 },{ -2, 3, -2 },{ 0, -4, -2 },{ 3, 2, 1 },{ -4, -1, -4 },{ -2, 0, -3 },{ 1, 2, 0 },{ 0, -4, -2 },{ -3, 0, 3 },{ 2, 2, -1 },{ -2, -2, -1 },{ -4, 2, -2 },{ 1, -1, 0 },{ -3, -3, 1 },{ -1, -2, -1 },{ 2, -1, -3 },{ 0, -3, 3 },{ -1, 3, -1 },{ -1, 2, 1 },{ -3, 3, -1 },{ 0, -2, -4 },{ 0, -4, 1 },{ -4, 1, 0 },{ 3, -2, -1 },{ -4, -3, -2 },{ 1, -3, -4 },{ 0, 0, 0 },{ -4, -4, -1 },{ 2, 1, 1 },{ 1, 0, 2 },{ 0, 3, -1 },{ -2, -4, 1 },{ 3, 1, -1 },{ 0, -4, -3 },{ -4, 3, 3 },{ 0, -2, -1 },{ 2, 2, 1 },{ -2, 3, -2 },{ -3, -2, 0 },{ 3, -2, 3 },{ -1, 3, 0 },{ -3, -3, -2 },{ 0, 3, -4 },{ 3, 2, 3 },{ -1, -2, -1 },{ 1, 0, 2 },{ 3, 1, -4 },{ -3, -2, -2 },{ 2, 3, -1 },{ 2, -4, 1 },{ -4, -3, -4 },{ -3, -1, 3 },{ 1, -4, -2 },{ -1, 0, -3 },{ -4, -3, 3 } }, - { { -2, 1, 2 },{ -4, -3, -2 },{ 2, -1, -3 },{ 0, 3, -2 },{ -1, 0, -1 },{ -4, -3, -4 },{ 1, -1, 3 },{ -3, 3, -1 },{ 3, 1, -3 },{ 2, -3, -1 },{ -4, -1, 0 },{ 2, 0, 2 },{ -3, 1, -3 },{ -1, 3, 3 },{ 3, -4, 2 },{ -4, -1, -1 },{ -2, -3, -4 },{ -1, 3, 0 },{ 0, -3, 1 },{ 3, 0, 2 },{ 2, -4, 3 },{ -1, 0, 0 },{ -2, 1, 3 },{ 2, 3, -2 },{ -3, 1, 1 },{ -2, 2, -4 },{ 3, -2, -2 },{ -4, 1, 3 },{ -3, -4, -4 },{ 3, 0, -1 },{ -2, 1, 3 },{ -3, -1, -2 },{ -1, 0, 2 },{ -3, 3, -3 },{ 2, -4, 2 },{ -2, 1, 1 },{ 0, 2, -2 },{ -3, -3, -4 },{ -2, -3, 3 },{ 2, 2, 0 },{ -4, -2, -2 },{ 1, -1, 3 },{ 2, 2, -3 },{ -1, 0, -2 },{ -2, -3, 2 },{ 3, -1, -4 },{ -1, -4, 3 },{ -3, 0, -1 },{ 2, 2, -4 },{ -2, -1, 2 },{ -1, -1, 1 },{ 1, 1, -1 },{ -4, -4, 0 },{ 0, 0, -3 },{ -4, -3, -2 },{ -1, 3, 0 },{ -2, -4, 1 },{ 1, 0, -3 },{ -1, -1, 2 },{ 3, 1, -2 },{ 2, -2, -4 },{ -2, 3, 2 },{ 1, -2, -1 },{ 3, -1, 1 } }, - { { -3, 2, -1 },{ -1, -2, 0 },{ 3, -4, 3 },{ -3, 1, -3 },{ 1, -2, 0 },{ 3, 2, 1 },{ -2, -4, -3 },{ -1, 1, -2 },{ 2, -1, 2 },{ -4, 2, -4 },{ 0, 3, -4 },{ -2, -3, 2 },{ 1, -4, -1 },{ -1, -2, -2 },{ 2, -2, 1 },{ 1, 3, -1 },{ 3, 1, 2 },{ 1, -1, -4 },{ -3, 1, -3 },{ -4, -1, -2 },{ 0, -3, -4 },{ -2, 2, -4 },{ 3, -2, 2 },{ 0, 3, -3 },{ -4, -2, 3 },{ 0, -4, -2 },{ 1, -1, 0 },{ 2, -1, 1 },{ 0, 0, 0 },{ 1, -3, 2 },{ 2, 2, -3 },{ -2, -3, 1 },{ 0, -4, -4 },{ 2, 2, 1 },{ -1, 3, -1 },{ -4, -1, -4 },{ 1, -1, 3 },{ 2, 3, 0 },{ -1, -2, -3 },{ 3, 0, -4 },{ -3, 2, -1 },{ 1, -3, 1 },{ -2, -2, 2 },{ -3, 1, 0 },{ 1, -1, 0 },{ 2, 2, -1 },{ -4, 3, 1 },{ 1, -3, -2 },{ 2, 1, 0 },{ 0, -4, -3 },{ 3, 2, -4 },{ -3, -3, 2 },{ -1, -1, -3 },{ -2, 3, 1 },{ 1, -2, 3 },{ 3, 2, -4 },{ -3, -1, 2 },{ 0, 1, -2 },{ -4, 3, 3 },{ -2, -3, 0 },{ 0, 0, -1 },{ -4, 1, 1 },{ -1, -4, -2 },{ 2, 3, -4 } }, - { { 1, -1, -2 },{ 2, -3, -4 },{ 1, 0, 2 },{ -2, 0, -1 },{ -2, -4, 3 },{ 0, 3, -2 },{ -4, -2, 2 },{ 0, 0, 3 },{ -2, -2, 1 },{ 1, -4, -1 },{ -1, -2, 3 },{ -3, 1, -2 },{ 2, -1, 0 },{ -4, 0, -3 },{ -3, 2, -4 },{ -2, 0, 1 },{ -1, -3, -3 },{ -4, -2, 3 },{ -2, 3, -1 },{ 1, -4, 2 },{ 2, 3, -2 },{ -1, -1, -1 },{ -4, -3, 1 },{ 1, -4, -1 },{ 2, 0, 0 },{ -1, -3, 2 },{ -3, 3, -4 },{ -2, -3, -3 },{ -4, 2, -2 },{ -1, -2, 2 },{ -3, 3, -2 },{ 1, -1, 0 },{ 3, 1, 3 },{ -1, -2, -2 },{ 3, -2, 0 },{ -3, 1, 3 },{ 3, -3, -3 },{ -2, 0, -1 },{ -4, -4, 1 },{ 0, -1, 2 },{ -1, 3, -4 },{ -4, 0, 2 },{ 3, 3, -2 },{ 0, -4, -4 },{ -4, -2, -3 },{ 0, -4, 3 },{ -1, 0, -4 },{ -2, -2, -3 },{ -4, 2, 1 },{ 0, 0, 3 },{ -3, -3, -1 },{ 1, 3, -2 },{ 3, 0, 1 },{ 2, -4, 2 },{ -3, 1, -1 },{ 2, -3, -2 },{ -4, -3, 0 },{ 3, 0, 1 },{ 1, 2, -4 },{ -3, -4, -1 },{ 0, -1, 2 },{ 3, 2, -3 },{ 0, -2, 3 },{ -4, 1, 1 } }, - { { -1, 0, 3 },{ -2, 2, 1 },{ -4, 3, 2 },{ -1, -1, -4 },{ -3, 2, -2 },{ 3, -2, 0 },{ 2, 2, -4 },{ -1, -3, 0 },{ -3, 3, -3 },{ 3, 2, 0 },{ 0, 0, 1 },{ 3, 2, -1 },{ -2, -4, 3 },{ 3, 1, 2 },{ 0, -3, 0 },{ -1, 2, 3 },{ 1, -4, -2 },{ 2, 0, 1 },{ 3, 1, 0 },{ -2, -2, 1 },{ 2, 1, 2 },{ -3, -1, 0 },{ 1, 2, -4 },{ 3, 1, -2 },{ -3, 2, -3 },{ -1, 0, -1 },{ 3, 1, 2 },{ 2, 3, 3 },{ 1, -2, -1 },{ -1, -4, -4 },{ 3, 1, 3 },{ -4, -4, -1 },{ -4, 2, -4 },{ 1, -1, 2 },{ -3, 0, -1 },{ -1, 0, -2 },{ 0, -4, 1 },{ -2, 2, -1 },{ 1, 1, 2 },{ 3, -3, -2 },{ -2, 1, 3 },{ 2, -4, 0 },{ -1, -2, -1 },{ 2, 1, 3 },{ -3, 3, 1 },{ 1, 1, -1 },{ 3, -1, 2 },{ -3, 1, 2 },{ 1, -4, 0 },{ -1, -1, 1 },{ -4, -2, 3 },{ -2, 1, -4 },{ 0, -2, 0 },{ -3, -1, -3 },{ -1, 1, -4 },{ 0, 2, 0 },{ -2, -1, 3 },{ 1, -2, -3 },{ -1, -4, -1 },{ 2, 2, 2 },{ -3, 3, -3 },{ -2, 0, -2 },{ 2, -3, 0 },{ -3, -4, 0 } }, - { { 3, 2, -4 },{ 0, -2, -1 },{ 2, -3, -2 },{ 3, 1, -3 },{ 1, -3, 2 },{ 1, 0, 1 },{ -4, -1, -3 },{ 3, 1, -1 },{ 1, -3, -2 },{ -3, -1, 2 },{ -4, -2, -4 },{ 1, -3, -3 },{ -3, 3, -4 },{ 0, 1, 1 },{ 1, -2, -3 },{ -4, -1, 0 },{ 3, 3, -2 },{ -3, -3, -4 },{ 0, 2, 3 },{ -4, 0, -3 },{ 0, -4, -2 },{ -3, 2, 3 },{ -1, -2, 2 },{ -2, -2, 2 },{ 0, -3, -4 },{ -2, -1, 1 },{ 0, -4, 1 },{ -4, 1, -1 },{ -3, -1, -3 },{ 0, 0, 1 },{ 2, 2, -3 },{ 0, -1, 1 },{ -2, -3, -3 },{ 1, 3, 0 },{ -2, -4, 2 },{ 2, 2, -4 },{ 2, 3, 1 },{ -4, -2, -3 },{ 1, -1, 0 },{ -3, 3, -3 },{ -3, -2, 0 },{ 0, -1, -3 },{ -4, 2, -2 },{ 3, 0, -1 },{ -2, -3, 1 },{ 0, 2, -3 },{ 2, -3, -2 },{ -1, 3, -1 },{ 3, -2, -4 },{ 1, 3, -3 },{ 2, 2, -2 },{ 3, 0, -1 },{ 1, -3, 2 },{ -4, 3, 3 },{ 1, -1, 1 },{ -2, -4, -2 },{ -4, 3, 2 },{ 3, 1, -4 },{ -1, -3, 1 },{ -4, -1, 3 },{ 1, -2, 0 },{ -2, -3, -4 },{ 2, 2, 2 },{ -4, -1, -3 } }, - { { 0, -1, -1 },{ -3, -4, 3 },{ -4, -2, 1 },{ 0, 3, 0 },{ -1, -4, -1 },{ -3, 2, 3 },{ -2, -4, 1 },{ 0, 0, -4 },{ -2, 1, 3 },{ 0, -4, 2 },{ 2, 0, 0 },{ -1, -1, -1 },{ -2, -2, 3 },{ 3, -4, -2 },{ -1, -1, -1 },{ -2, 3, 2 },{ 0, 1, -4 },{ -3, -1, 0 },{ -1, -4, -1 },{ 1, -2, -3 },{ 3, 3, -4 },{ 2, -3, -1 },{ -1, 0, -3 },{ -4, 3, 0 },{ 2, -1, 3 },{ 1, 2, -2 },{ 3, -4, -2 },{ 1, 2, -3 },{ 3, -2, 2 },{ -2, -3, 0 },{ -3, 3, 2 },{ 2, 0, -2 },{ 0, -2, 3 },{ 3, 1, -1 },{ -1, -3, -3 },{ -4, -2, 1 },{ -2, 1, 3 },{ 3, -4, -2 },{ -1, -1, 2 },{ 2, 2, -4 },{ -1, 1, 1 },{ 1, -4, 3 },{ 1, 3, 2 },{ -1, -3, -4 },{ -3, -2, 3 },{ -2, -1, -3 },{ -4, -4, 0 },{ -2, -1, 3 },{ -4, 1, -2 },{ 0, 0, 2 },{ -2, -4, 1 },{ -1, -4, 0 },{ -3, 1, -4 },{ 2, 2, -2 },{ 3, -3, -3 },{ 2, 2, 0 },{ 0, 0, -1 },{ -3, -2, -2 },{ 2, 3, -4 },{ 0, 0, 0 },{ 3, 1, -2 },{ 1, -2, 3 },{ -1, 1, -1 },{ 1, 3, 1 } }, - { { 3, 0, 2 },{ 1, 1, 0 },{ -3, 2, -3 },{ -2, -1, -4 },{ 2, 1, 3 },{ -4, -1, -3 },{ 2, -3, 0 },{ 1, 3, -2 },{ -3, -2, 1 },{ 3, 3, -4 },{ -4, 1, -2 },{ -2, 3, 2 },{ 2, 2, 0 },{ -3, 2, -4 },{ -4, -2, 1 },{ 2, -4, -3 },{ 0, -3, 3 },{ 2, 0, 2 },{ 3, 2, 1 },{ -2, -3, 2 },{ -4, 1, 1 },{ 0, -1, 1 },{ 3, 0, -1 },{ 2, -4, -3 },{ -3, 2, 1 },{ -4, -2, -4 },{ -2, 0, 3 },{ -1, 3, 0 },{ -4, -3, 1 },{ -1, 2, -4 },{ 1, 0, -1 },{ -3, -4, 0 },{ -1, 2, -4 },{ -3, 3, 0 },{ 1, -4, 2 },{ 3, 3, -2 },{ 0, -1, -4 },{ -3, 0, 0 },{ 0, -3, 3 },{ -4, -4, -2 },{ 3, 0, -1 },{ -2, -2, -4 },{ -3, 1, 0 },{ 3, -1, 1 },{ 2, 0, 0 },{ 0, 3, -2 },{ 3, 2, 2 },{ 2, 0, -4 },{ -1, -2, 1 },{ -3, -3, -3 },{ 3, -1, 0 },{ -4, 3, 3 },{ 0, 0, -2 },{ -1, -2, 1 },{ -4, -4, -1 },{ -2, 0, 3 },{ 0, -3, 1 },{ -1, -1, 3 },{ -2, 2, -1 },{ -4, -3, 2 },{ -3, -4, -3 },{ -1, 2, 1 },{ -4, 0, -4 },{ -2, -3, -2 } }, - { { -1, 3, -4 },{ -2, -4, -2 },{ 3, 0, 2 },{ 1, -3, 1 },{ -2, -2, -2 },{ 3, 3, -2 },{ -1, 1, -1 },{ 1, 2, 2 },{ -4, -3, -3 },{ 2, 0, -1 },{ -1, -4, 1 },{ 3, -2, -3 },{ 1, -3, 3 },{ 0, 0, -2 },{ 1, 0, 0 },{ 3, 1, 1 },{ -2, 3, -3 },{ -1, -2, -2 },{ -4, 1, -1 },{ 1, 0, -2 },{ -2, 3, 3 },{ -3, -2, -4 },{ -1, -4, 2 },{ 1, 1, 3 },{ 0, 1, -1 },{ 3, -3, 0 },{ -3, -1, 2 },{ 0, 0, -4 },{ 2, -2, -1 },{ 3, 1, -2 },{ -2, -2, 3 },{ -4, -1, -3 },{ 2, 1, 1 },{ 2, 0, 3 },{ -4, -1, -3 },{ -2, 1, -1 },{ -3, -2, 3 },{ 2, 2, -1 },{ 1, 3, 1 },{ -2, 1, -3 },{ 2, -1, 0 },{ -4, -3, 2 },{ 0, 0, -2 },{ -2, 3, -3 },{ -4, -4, 3 },{ 1, 1, -4 },{ 1, -2, 1 },{ -2, -4, -1 },{ 1, 3, 3 },{ -1, 2, -2 },{ 1, -1, -4 },{ 2, 1, 2 },{ -2, -2, -3 },{ 1, -1, 0 },{ -2, 2, 2 },{ 1, 1, -4 },{ -4, -1, -3 },{ 3, 3, 1 },{ 2, -4, -3 },{ 2, 0, 3 },{ 0, -1, -1 },{ 3, 3, 2 },{ -3, -4, -1 },{ 2, -2, 3 } }, - { { 0, 2, 0 },{ -1, -1, -3 },{ 2, -3, -1 },{ -3, 2, 2 },{ 0, 0, -4 },{ 0, -4, 3 },{ -3, -1, 1 },{ -2, -2, -3 },{ 3, -4, 3 },{ -1, 2, 0 },{ -2, 1, -2 },{ -4, -3, 3 },{ 0, -1, -3 },{ -3, 3, -1 },{ -2, -4, 2 },{ -4, -3, -1 },{ 1, -2, -4 },{ -3, 2, 3 },{ 2, -4, -4 },{ -1, -4, -3 },{ 0, -1, 0 },{ 3, 2, -2 },{ -4, 3, 0 },{ -2, -2, -4 },{ 1, -4, -2 },{ -1, 3, 1 },{ 2, 1, -3 },{ -2, -3, -2 },{ 0, -4, 3 },{ -4, 2, 1 },{ 1, -1, 2 },{ 3, -4, -4 },{ 0, -3, -1 },{ -2, -2, -2 },{ 0, 0, 2 },{ 1, -3, -3 },{ -1, -4, 1 },{ 1, 1, -3 },{ -4, -2, -4 },{ -1, -3, 2 },{ 1, 2, -2 },{ -1, 3, 3 },{ 2, 2, -3 },{ 1, -3, -1 },{ 0, 1, 2 },{ -1, -2, -1 },{ -3, -3, 2 },{ -3, 1, -3 },{ 3, -1, 1 },{ -4, -4, 0 },{ -2, 1, -1 },{ 0, -3, -3 },{ -4, 3, 3 },{ 2, -4, -1 },{ 3, 1, -4 },{ 0, 3, -2 },{ -3, -2, -1 },{ 1, -4, 0 },{ -3, 1, -4 },{ -1, 2, -2 },{ -2, -3, -4 },{ 1, -1, 0 },{ 1, 1, -3 },{ -4, -3, 3 } }, - { { -3, 1, 1 },{ 1, 0, 0 },{ -4, -4, 3 },{ -1, 3, 0 },{ -4, 2, 0 },{ 2, -3, -1 },{ 2, 1, -4 },{ -1, 0, 2 },{ 0, 3, -2 },{ 1, 0, 2 },{ -3, -1, -4 },{ 1, 3, 0 },{ 2, 1, 1 },{ 3, -2, 0 },{ -1, 2, -4 },{ -1, 0, 3 },{ 2, -1, 1 },{ 0, 1, -1 },{ 3, 3, 2 },{ -3, 1, 0 },{ 1, -2, -1 },{ 2, 0, 2 },{ -2, -3, 3 },{ 0, 0, -3 },{ 3, -1, -1 },{ -4, -3, 2 },{ -1, 2, -4 },{ 2, 0, 0 },{ -3, 3, -3 },{ 0, -2, -2 },{ -2, 2, 0 },{ -3, 3, -1 },{ -1, 2, 2 },{ -4, -3, -4 },{ 3, 3, 1 },{ 2, 2, 0 },{ -4, 0, 0 },{ -1, 3, -2 },{ 3, -1, 3 },{ 0, -4, 0 },{ -3, 1, -4 },{ 3, -4, -1 },{ -3, -2, 1 },{ -2, -1, 0 },{ 3, -4, -4 },{ -4, -1, -2 },{ 2, 3, 0 },{ -2, 0, -3 },{ 0, 2, -4 },{ 2, -2, 3 },{ -3, 3, 1 },{ 3, 0, 2 },{ -1, -2, -2 },{ -3, 0, 0 },{ -3, -3, 2 },{ -1, -3, 1 },{ 3, 1, 3 },{ -1, -2, 2 },{ -2, 0, 1 },{ 1, -2, 3 },{ -4, 3, 0 },{ -3, 1, 2 },{ -1, 0, -3 },{ 3, -2, -2 } }, - { { -4, 3, -2 },{ 3, -2, -4 },{ 1, -2, -2 },{ -2, 1, -3 },{ 3, -1, -3 },{ -1, -2, 2 },{ -3, 3, -1 },{ -4, -3, 0 },{ 2, -4, -4 },{ -3, -1, 0 },{ 3, -2, 2 },{ -1, -3, -2 },{ -4, 2, -4 },{ -3, -1, 2 },{ 1, -4, -3 },{ 3, 3, -2 },{ -4, -3, 0 },{ -1, -3, 1 },{ -3, -1, -3 },{ 1, 0, 2 },{ -1, -4, -4 },{ -3, 2, 1 },{ -4, -3, -2 },{ 3, 3, 1 },{ -3, 1, 1 },{ -4, -1, 3 },{ 1, -2, 0 },{ 3, 0, 2 },{ -4, -4, 3 },{ -1, -1, -4 },{ 2, 1, 2 },{ 1, 0, -3 },{ 2, -4, 3 },{ 0, -1, -1 },{ -3, 1, 3 },{ -2, -2, -4 },{ 3, -3, 2 },{ -3, -1, -3 },{ -2, -3, -1 },{ 2, 3, 1 },{ -4, 0, 2 },{ -1, -2, -1 },{ 0, 0, -3 },{ 3, 2, 3 },{ -3, 3, 1 },{ 1, 0, 3 },{ 0, 2, 1 },{ -1, -4, -1 },{ 3, 0, 2 },{ 1, -3, -2 },{ -3, -4, -1 },{ -1, 1, -4 },{ 3, 2, 1 },{ 0, -4, 0 },{ 2, 2, -3 },{ 0, -1, -2 },{ -4, 0, -1 },{ 2, 3, -3 },{ 0, -3, -1 },{ 2, -1, -2 },{ 3, -2, 1 },{ 0, -4, -4 },{ 2, 3, -1 },{ -2, -1, 2 } }, - { { -1, -1, 3 },{ 2, -4, 1 },{ 0, 0, 2 },{ -3, 3, -4 },{ 1, -4, 3 },{ -2, -1, 1 },{ 1, 2, -3 },{ 3, -2, 1 },{ -2, 1, -3 },{ 0, 3, 3 },{ -4, 2, -2 },{ 2, 0, -1 },{ -1, -4, 3 },{ 0, 1, 1 },{ 0, -1, -2 },{ -3, 0, 2 },{ -2, 1, -4 },{ 2, 2, 0 },{ -2, -2, -2 },{ -4, -2, 3 },{ 3, 3, -1 },{ 1, 1, -3 },{ 0, -1, -4 },{ 1, 2, 0 },{ 2, -2, -3 },{ -2, -4, -4 },{ 0, 3, -2 },{ -2, -3, -1 },{ 1, 2, -1 },{ 3, -2, 1 },{ -3, -3, -4 },{ -1, -2, 0 },{ -2, 1, 1 },{ 0, 0, -3 },{ -4, 2, 0 },{ 1, -4, -2 },{ 0, 0, 3 },{ -2, 2, -1 },{ 1, 1, 1 },{ 1, 1, -3 },{ 2, -1, -2 },{ -4, 3, 3 },{ 0, -3, -4 },{ -1, -1, -1 },{ -4, 1, -2 },{ -1, -2, -3 },{ 2, -3, -4 },{ -2, -1, 2 },{ -4, 1, 0 },{ -4, -2, -3 },{ 1, 2, -2 },{ -2, -1, 2 },{ 1, -1, -2 },{ -4, -2, 3 },{ 1, 1, -4 },{ -2, 3, 2 },{ 3, -4, 1 },{ -2, 0, -4 },{ -4, 2, -3 },{ -3, -3, 2 },{ 0, 1, -2 },{ -3, 2, 3 },{ -2, -4, 1 },{ 0, -3, -4 } }, - { { -4, 1, 0 },{ -2, 2, -1 },{ 0, -3, 1 },{ -3, 1, 0 },{ 3, -3, -1 },{ 0, 0, -2 },{ -4, 0, -2 },{ 1, 1, 2 },{ -1, -3, 0 },{ -2, -1, -1 },{ 1, -4, -3 },{ 1, 1, 1 },{ -2, -2, -3 },{ 3, 3, 0 },{ -3, -2, -1 },{ 2, 3, 1 },{ 1, -4, 3 },{ 0, 0, -3 },{ 2, -3, -1 },{ 0, 2, -4 },{ -2, 1, 3 },{ 2, -4, 0 },{ -1, -2, 3 },{ -3, -4, 2 },{ -1, 3, -1 },{ 2, 1, 3 },{ -1, 2, 1 },{ -3, -1, -2 },{ -2, 1, -3 },{ 2, 3, 2 },{ 0, 0, 0 },{ -4, 3, -2 },{ 2, -3, -3 },{ 3, -4, 2 },{ -1, 3, -1 },{ 1, -1, -4 },{ 3, -4, 1 },{ -1, 3, -3 },{ -4, -2, 2 },{ 0, -4, 0 },{ -2, -3, -4 },{ -2, 2, 0 },{ 2, -3, 2 },{ 2, 2, 0 },{ -3, -4, 2 },{ 1, -3, 0 },{ -3, 1, -2 },{ 3, 2, 3 },{ -2, -1, 0 },{ 0, 3, -4 },{ 2, -4, 3 },{ -1, 0, 0 },{ -4, -3, -3 },{ -2, 3, -1 },{ 3, 0, -4 },{ -3, -3, 3 },{ -1, -2, -1 },{ -3, 1, 2 },{ 1, -4, 3 },{ -1, 3, 0 },{ 3, -1, -4 },{ -4, 0, -1 },{ 3, -2, 0 },{ 1, 2, -2 } }, - { { 2, -3, -3 },{ -1, 3, -3 },{ 3, -2, 2 },{ -4, 0, -2 },{ 2, 3, -4 },{ -2, 2, 3 },{ -3, -4, 1 },{ 3, 3, -4 },{ 0, -3, 3 },{ 2, 0, -4 },{ -1, 2, 1 },{ -3, -2, 2 },{ -4, -3, -2 },{ 2, 2, 3 },{ -1, -3, -4 },{ -4, -1, -3 },{ -2, -2, -1 },{ 3, 2, 2 },{ -3, -4, -2 },{ 1, -1, 0 },{ -3, -3, -2 },{ -4, 2, 1 },{ 3, -1, -3 },{ -2, 0, -2 },{ 3, 0, 0 },{ -3, -3, 2 },{ 1, -1, -3 },{ 3, -4, -4 },{ -4, -3, 3 },{ 0, -1, 1 },{ -3, -4, -2 },{ 3, 2, 3 },{ 1, -2, 1 },{ -4, 0, -2 },{ -2, 1, 1 },{ 2, -2, 3 },{ -4, 2, 0 },{ -1, -2, -2 },{ 2, 0, -4 },{ -3, -1, -1 },{ 3, 2, 3 },{ -1, 0, 1 },{ 1, -1, -2 },{ 3, 0, -3 },{ -2, 3, 3 },{ 0, -1, 1 },{ -1, 3, -2 },{ 1, -3, -3 },{ 2, -4, 2 },{ -1, 0, 1 },{ 3, 2, 3 },{ 0, -2, -1 },{ 2, 3, 1 },{ 0, -4, 2 },{ -1, -2, 1 },{ 1, 1, -2 },{ 2, -1, -3 },{ 0, 2, 0 },{ 3, -2, -2 },{ 1, 0, -1 },{ -2, -3, -3 },{ -1, 3, 2 },{ 1, -2, 3 },{ -3, 0, 1 } }, - { { 1, -1, -1 },{ -1, 1, 3 },{ 0, -4, -1 },{ -3, -1, -4 },{ -1, -4, 2 },{ 2, -2, 0 },{ -1, -2, -3 },{ -4, 0, -2 },{ -3, 2, -1 },{ -4, -1, 0 },{ 3, 1, 3 },{ 0, -1, -4 },{ 1, 3, 0 },{ -2, 0, -1 },{ 2, 0, 2 },{ 0, 2, -2 },{ 1, 1, 1 },{ -3, 3, 1 },{ -4, -1, 3 },{ 0, 3, -4 },{ -1, 0, 2 },{ -1, -2, 1 },{ 0, 1, -4 },{ 1, 2, -1 },{ -4, -3, -4 },{ 0, 3, 1 },{ -4, -2, 0 },{ -1, 2, 3 },{ 3, 0, 0 },{ 1, 2, 2 },{ -1, -1, -4 },{ -2, 1, -1 },{ -1, 3, -4 },{ 1, -1, 3 },{ -3, -3, -1 },{ 0, 0, -4 },{ 0, -3, 2 },{ -3, 2, 0 },{ 3, -4, 3 },{ 1, 3, -2 },{ 0, -2, -3 },{ -4, -4, 1 },{ -3, -2, -3 },{ -1, 1, -4 },{ -4, -4, -1 },{ 2, -2, -4 },{ 3, 1, 1 },{ -3, 0, -4 },{ 0, -2, -1 },{ -4, 1, -3 },{ -2, -1, -2 },{ -3, -3, -4 },{ -3, 1, -3 },{ 3, 2, 0 },{ 0, -1, 0 },{ -4, 3, -3 },{ -3, -3, 2 },{ 0, 1, 1 },{ -4, -1, -4 },{ -2, 0, 1 },{ 0, -3, 3 },{ 2, 2, -3 },{ -3, 1, -2 },{ -2, -4, -4 } }, - { { 3, -2, -2 },{ -4, 2, 0 },{ 1, 2, 2 },{ -2, -2, 1 },{ 3, 1, -1 },{ 1, 3, 3 },{ -2, -1, 1 },{ 1, -4, 2 },{ 2, -3, 2 },{ -1, 3, -2 },{ 1, -4, 2 },{ -4, 2, -2 },{ 3, -4, -3 },{ -1, -1, 2 },{ -3, -3, -4 },{ -2, -4, 3 },{ 3, -2, -3 },{ -1, -1, -4 },{ -1, -3, -2 },{ 3, 1, 0 },{ 2, -2, -3 },{ 2, -4, -1 },{ -3, 3, 2 },{ 2, -3, 3 },{ -2, -1, -2 },{ 1, 1, 2 },{ 2, 0, -2 },{ -2, -2, -1 },{ 0, 3, -2 },{ -3, -4, -3 },{ 2, -2, -1 },{ 3, 0, 2 },{ -3, -3, 0 },{ 0, -4, -3 },{ -2, 2, 0 },{ 3, 2, -2 },{ -3, -1, -3 },{ 2, 1, -1 },{ -2, -1, 1 },{ -1, 1, 2 },{ 2, -3, -1 },{ -3, 3, 0 },{ 3, 1, 2 },{ 1, 2, 2 },{ 0, -1, 3 },{ -3, -4, 0 },{ -4, 2, 3 },{ -2, -1, -1 },{ -1, -4, 2 },{ -3, 3, 0 },{ 3, 2, 1 },{ 0, 0, -1 },{ 1, -2, 3 },{ -2, 0, -4 },{ 2, -4, -2 },{ -2, 0, 3 },{ 3, 2, -1 },{ -1, -4, -4 },{ 2, 3, 3 },{ -3, -4, -2 },{ -4, 2, 0 },{ 0, -4, -1 },{ 3, -1, 1 },{ -4, 3, 2 } }, - { { -1, -3, -4 },{ -2, 3, 0 },{ 2, 0, -3 },{ -3, 0, -3 },{ 0, -3, 0 },{ -4, 1, -3 },{ 2, 1, -2 },{ 3, 2, -4 },{ 0, -2, 0 },{ -2, 0, -3 },{ 3, -2, -3 },{ -2, -3, 1 },{ -1, 1, 0 },{ 1, 2, 1 },{ -3, 1, -1 },{ 1, 3, 0 },{ -4, 0, 0 },{ 2, 2, -1 },{ 1, -3, 1 },{ -2, 1, 2 },{ -4, 3, 0 },{ -2, -1, -2 },{ 0, 0, 0 },{ -4, 2, 1 },{ -1, -4, -4 },{ 3, -4, -3 },{ -3, 1, 3 },{ -1, -1, 1 },{ 2, -3, -4 },{ -4, 1, 1 },{ -2, 3, 0 },{ -4, -2, 1 },{ 1, 0, -3 },{ 2, 3, 2 },{ -4, -4, 3 },{ -1, -2, -1 },{ 3, 3, 2 },{ 1, -4, 1 },{ -4, -2, -4 },{ -1, 2, -3 },{ -4, 0, -2 },{ -2, -1, -4 },{ 2, -2, -1 },{ -2, -3, 0 },{ 3, 0, -2 },{ 1, 2, -3 },{ 1, -2, 0 },{ 2, 3, 2 },{ 3, -3, -2 },{ 1, 0, 3 },{ 2, -3, -3 },{ -1, -1, 2 },{ -4, 3, -1 },{ 2, -3, 3 },{ -4, 2, 1 },{ 1, -3, -3 },{ -3, -1, 0 },{ -1, -2, -1 },{ 1, 2, -3 },{ 3, 0, 1 },{ 1, -1, 2 },{ -1, 3, -4 },{ 2, -3, 0 },{ 0, 1, 3 } }, - { { 0, -1, 2 },{ 1, -4, 1 },{ 3, -2, -2 },{ 1, -4, 3 },{ -3, 3, -4 },{ -2, -1, 2 },{ -3, -3, -1 },{ -1, -1, 0 },{ -4, 2, 1 },{ -3, 1, 3 },{ 1, 0, -1 },{ -3, 3, -4 },{ 2, -2, 3 },{ -4, -3, -2 },{ 3, -1, -3 },{ 0, -2, 2 },{ 0, 0, 3 },{ -2, -4, -2 },{ -3, 0, -4 },{ 0, 2, 3 },{ 1, -4, -3 },{ -3, -3, -4 },{ 3, 0, 3 },{ 2, -2, -2 },{ -3, -1, 1 },{ 0, 3, 0 },{ 1, 2, -1 },{ -3, -3, -3 },{ 2, 0, 3 },{ 0, -1, -1 },{ -2, -4, -3 },{ 1, 2, 3 },{ 0, 1, -2 },{ -3, -1, -2 },{ 2, 1, 1 },{ 1, 0, -4 },{ -4, -3, -2 },{ -2, 1, 3 },{ 1, -1, 0 },{ 0, -3, 0 },{ 3, -4, 3 },{ 1, 3, 3 },{ 0, -4, 1 },{ -4, 0, -4 },{ -3, 3, -2 },{ -1, -3, 1 },{ 0, 0, -4 },{ -4, -1, -2 },{ -2, 2, -4 },{ 0, -2, 0 },{ -4, -4, -2 },{ 3, 2, -4 },{ -1, -4, 1 },{ -2, 1, -3 },{ 3, 3, -2 },{ -1, 0, 2 },{ 1, -2, 1 },{ -4, 3, 2 },{ 2, -2, 3 },{ -2, 1, -2 },{ -1, -2, -3 },{ -3, 1, 2 },{ -4, -2, -3 },{ -2, 0, -2 } }, - { { -3, 0, -1 },{ -2, 2, -4 },{ -4, 1, -1 },{ -1, 3, 1 },{ 2, 0, 2 },{ 0, -2, -1 },{ 3, -4, -2 },{ 0, 3, 3 },{ 1, -3, -3 },{ 2, -4, -1 },{ 0, -1, 2 },{ -2, 2, 1 },{ -1, 0, -2 },{ 0, -4, 3 },{ 2, 3, -1 },{ -1, 2, -4 },{ -4, -3, -3 },{ 3, -1, 1 },{ -1, 3, -1 },{ 2, -2, 2 },{ 3, -1, -2 },{ 0, 2, 1 },{ -1, 3, 2 },{ 1, 1, -3 },{ -2, -1, -1 },{ 3, -2, 2 },{ -4, 1, -2 },{ -1, -4, 0 },{ -2, 2, 2 },{ 3, 2, -2 },{ 1, 0, -4 },{ 3, -2, 3 },{ -1, -3, -1 },{ -2, 3, -4 },{ 3, -2, 2 },{ -1, -1, 0 },{ -3, -3, -1 },{ 2, 0, -3 },{ -1, 3, -3 },{ -3, 1, 2 },{ 2, 2, -1 },{ -2, -1, -3 },{ 0, 1, 1 },{ -4, 1, -3 },{ 2, -4, 2 },{ -2, -1, 3 },{ 3, 1, -1 },{ -3, -4, 2 },{ -2, 1, 1 },{ -1, 3, 3 },{ -3, 0, 1 },{ -2, 1, -2 },{ 1, -2, 2 },{ 0, -2, 0 },{ -3, -1, -1 },{ 2, -4, -4 },{ 0, 1, -2 },{ -2, -4, -2 },{ -3, 0, -4 },{ 0, -3, -1 },{ -2, -3, 0 },{ 3, 2, 3 },{ 1, -4, -2 },{ 2, 3, 0 } }, - { { 1, -1, 1 },{ 3, -3, -3 },{ 0, -3, 3 },{ -3, -1, -2 },{ -1, -2, -4 },{ -4, 2, 1 },{ 2, 1, 3 },{ -2, 0, -4 },{ -4, -2, -2 },{ -1, 1, -1 },{ 3, -4, -4 },{ 2, 3, 3 },{ 0, -2, 0 },{ -4, 1, -4 },{ -2, -4, 2 },{ -3, -1, 1 },{ 3, 3, -2 },{ 1, 1, -3 },{ -4, -3, 3 },{ -2, 0, 0 },{ -4, 1, -1 },{ -3, -2, -1 },{ 1, -3, 3 },{ -1, -4, 0 },{ -4, 2, -4 },{ 2, 3, 3 },{ 0, -3, -4 },{ 1, -2, -2 },{ -3, 3, 1 },{ -1, -2, -3 },{ -4, -4, 2 },{ -1, -1, 0 },{ -3, 1, -3 },{ -4, -4, 0 },{ 0, 0, 2 },{ -2, 2, -3 },{ -2, 2, 1 },{ 0, 3, 2 },{ 3, -4, -1 },{ -4, -2, -4 },{ 2, 0, -1 },{ -3, -3, -2 },{ -1, 2, 0 },{ 3, -3, 2 },{ 2, 2, -1 },{ 1, 3, -4 },{ -1, -2, 0 },{ 2, 2, -3 },{ 0, -4, -1 },{ 2, -1, -3 },{ 1, -3, -4 },{ 3, 3, -1 },{ -4, 1, 3 },{ 2, -3, -3 },{ -1, 0, 1 },{ -4, 1, 3 },{ 1, 2, 0 },{ -1, 3, 1 },{ 3, -1, 0 },{ 3, 1, 2 },{ -4, 3, -1 },{ 0, -1, 1 },{ 2, 2, -4 },{ -4, -4, 2 } }, - { { -2, 1, 3 },{ -4, 3, 0 },{ 1, 2, 1 },{ 2, -4, -1 },{ 1, 2, 0 },{ -2, 1, -3 },{ -1, -3, -1 },{ 3, -1, 2 },{ -1, 2, 1 },{ -2, 3, 0 },{ -4, -1, 2 },{ -3, -3, -3 },{ -3, 2, -3 },{ 3, -1, -1 },{ 1, 1, -1 },{ -1, -3, 3 },{ 2, -2, 1 },{ -3, -4, 2 },{ 1, 1, -4 },{ -2, -3, -4 },{ -1, -4, 1 },{ 3, 3, -3 },{ -3, 1, -4 },{ 2, -4, 0 },{ -2, 0, 1 },{ -3, -3, -3 },{ 3, 2, 3 },{ -1, 0, -1 },{ 2, -1, 0 },{ 2, 1, 3 },{ -2, 3, -2 },{ 2, -3, 1 },{ 3, 3, 1 },{ 1, 2, -3 },{ 1, -4, 3 },{ 2, -1, -4 },{ 3, 0, -2 },{ -3, -3, 0 },{ 1, 1, 3 },{ -2, -2, 2 },{ 0, 3, -4 },{ -1, -4, 1 },{ 1, -1, 3 },{ 0, -2, -4 },{ -2, 0, 0 },{ -4, -1, -2 },{ -3, -3, 2 },{ 1, 0, -2 },{ 3, -2, 3 },{ -4, 2, 0 },{ 0, -3, 2 },{ -3, 0, -1 },{ 0, -4, 0 },{ 1, 2, -4 },{ -2, 3, -2 },{ 3, -2, -3 },{ -3, -3, 3 },{ 2, -1, -3 },{ 0, -4, -4 },{ -3, 2, 3 },{ 1, -3, -3 },{ -1, -1, -2 },{ -3, 0, 1 },{ -1, -2, -3 } }, - { { 2, 3, -2 },{ -1, 0, -4 },{ -3, -2, 2 },{ -2, 0, -3 },{ 3, -3, 3 },{ -3, -4, 0 },{ 2, 3, -2 },{ -3, -1, -4 },{ 1, -4, 1 },{ 2, -2, 3 },{ 1, 0, -4 },{ 3, 1, -2 },{ 1, -4, 2 },{ -1, 0, 1 },{ 2, 2, -2 },{ -4, 0, -4 },{ 0, 1, 0 },{ -1, -1, -1 },{ 3, 2, 0 },{ 0, 3, -2 },{ 2, 0, 3 },{ 1, -1, 2 },{ -4, 0, -2 },{ 0, -2, 3 },{ 3, -1, -2 },{ 0, 1, 0 },{ -4, -4, 2 },{ 0, 0, -3 },{ -4, -4, 1 },{ -3, -3, -4 },{ 0, 1, -1 },{ -3, 0, -4 },{ 0, -1, 3 },{ -3, -2, -1 },{ -2, 3, -1 },{ -4, -3, 3 },{ 0, -2, 1 },{ 1, -4, -3 },{ -1, -1, -2 },{ 2, -1, 1 },{ -4, 1, 3 },{ 3, 0, -1 },{ -3, 3, -3 },{ -4, 1, -2 },{ 0, -3, 3 },{ 3, -4, -1 },{ -3, 2, 1 },{ -1, 3, -3 },{ -4, -1, 2 },{ 1, 1, -4 },{ -2, 3, 1 },{ -1, -1, -2 },{ 3, -2, 3 },{ -1, 1, 2 },{ -3, -4, 1 },{ 0, 0, 0 },{ -1, -3, -1 },{ -4, 1, 2 },{ -2, -2, -2 },{ 1, 0, 0 },{ -1, 1, -4 },{ -4, -4, 2 },{ 1, 2, -2 },{ 3, -3, 0 } }, - { { -1, -3, -1 },{ 3, -4, -1 },{ 0, -1, -2 },{ -4, 3, 1 },{ 0, 1, -4 },{ 1, -1, 2 },{ -4, -2, 3 },{ 0, 3, -1 },{ 3, 2, -3 },{ 0, -3, 2 },{ -4, 1, -1 },{ -1, -2, 0 },{ -2, 3, 1 },{ 0, -2, -4 },{ -4, -3, 0 },{ -2, 3, 3 },{ 2, -2, -3 },{ -2, -4, -2 },{ -4, 2, 2 },{ 1, -1, 1 },{ -3, -3, -1 },{ -2, -2, -3 },{ -1, 2, 1 },{ 1, 3, -1 },{ -4, -1, -3 },{ 1, 3, 2 },{ -2, -2, -4 },{ 2, 3, -1 },{ -2, 2, 3 },{ 3, -2, -3 },{ 1, -1, 0 },{ -4, -4, 2 },{ 3, 2, 1 },{ -1, -3, -2 },{ -1, 1, -4 },{ 2, 1, 0 },{ -4, 3, 2 },{ -3, 2, -1 },{ -2, 1, -4 },{ -1, 3, 0 },{ 3, -4, -3 },{ 0, -2, 2 },{ -2, -3, 0 },{ 2, 2, 1 },{ 2, 0, -3 },{ -1, 3, 1 },{ 0, -1, 0 },{ 2, 1, -4 },{ -2, -4, -1 },{ 2, -2, -2 },{ -3, -4, 2 },{ 2, 0, -3 },{ -4, 2, 0 },{ -2, -1, -4 },{ 3, 2, -2 },{ 2, -2, 2 },{ -2, 3, -4 },{ 3, 2, 1 },{ 1, 3, -1 },{ 2, -4, 1 },{ -2, 0, 2 },{ 3, 2, -1 },{ -3, -2, 3 },{ 0, -1, 2 } }, - { { -3, 1, -4 },{ -4, 0, 1 },{ 2, 2, 2 },{ -1, -3, -1 },{ -2, -1, -3 },{ 2, 2, 0 },{ -1, 1, 1 },{ -3, -4, -4 },{ -1, 0, -1 },{ -2, 3, -2 },{ -3, -1, -3 },{ 2, 2, -1 },{ 0, -4, 3 },{ 3, -1, 2 },{ 1, 2, -3 },{ -3, -4, 1 },{ 3, 0, 2 },{ 0, -1, -4 },{ -3, 0, -1 },{ 2, -2, -3 },{ -1, 1, 3 },{ 2, 3, 0 },{ -3, -4, -4 },{ 3, 0, 2 },{ -3, -4, 0 },{ 2, 1, -2 },{ -3, -3, 1 },{ -1, 2, -1 },{ 1, -1, 2 },{ -2, 1, -2 },{ -1, 3, -1 },{ 0, -2, -3 },{ 1, 0, -3 },{ 3, -4, 0 },{ -3, 0, 1 },{ 0, -1, -4 },{ 3, -4, -3 },{ 3, -3, 3 },{ -3, 0, -1 },{ 2, -3, 2 },{ -4, -2, -2 },{ 1, 2, 0 },{ -1, 1, -4 },{ -3, -4, 2 },{ -2, -2, -1 },{ 1, 1, -4 },{ -4, -3, 3 },{ 3, -3, 2 },{ 0, 1, 1 },{ -1, 2, 0 },{ 3, -3, -4 },{ 1, 3, -1 },{ 0, -3, 2 },{ 1, -4, -1 },{ -3, -1, 0 },{ -1, 0, -4 },{ 0, 1, -1 },{ -4, -2, 2 },{ -1, -3, -3 },{ -3, -1, 3 },{ 0, 3, 0 },{ 2, -3, -3 },{ -4, 3, -4 },{ 1, 1, 1 } }, - { { -2, 3, 3 },{ 3, -3, -3 },{ 1, 1, 3 },{ -3, -2, -4 },{ 2, -4, 3 },{ 3, 0, -3 },{ -2, -3, -2 },{ 2, 0, 2 },{ -4, -2, 0 },{ 3, 1, 3 },{ 0, -3, 2 },{ 3, -4, -4 },{ -4, 2, -2 },{ -3, 1, -3 },{ 2, -1, -1 },{ -1, -2, -2 },{ 1, 3, 0 },{ 1, 2, 3 },{ -1, -3, 1 },{ 3, -4, -4 },{ -4, 2, -2 },{ 0, 0, 1 },{ 3, -3, -3 },{ -2, -3, 3 },{ 0, 2, -4 },{ -1, -1, 1 },{ 2, -3, 3 },{ 3, 0, -4 },{ -4, -4, 0 },{ 0, 0, 2 },{ 2, -4, 3 },{ -3, 2, 1 },{ -2, 3, -1 },{ -4, -2, 3 },{ 2, 3, 2 },{ -2, 1, -2 },{ -1, -2, 0 },{ 0, 2, 1 },{ 1, -1, 2 },{ -2, 1, -3 },{ -3, 3, -4 },{ 2, -1, 3 },{ 0, -1, -2 },{ 3, 3, 1 },{ -4, 0, 3 },{ 0, -2, -2 },{ -3, 2, -3 },{ 2, -1, -1 },{ -4, 0, -2 },{ -3, -2, 3 },{ -2, 1, 3 },{ -2, 0, 1 },{ -4, 2, -3 },{ 2, 1, 3 },{ 0, -3, -2 },{ -4, 3, 3 },{ 1, -4, -3 },{ 2, -4, 1 },{ -3, 0, -3 },{ 3, 2, -4 },{ -1, -2, -1 },{ 0, -4, 2 },{ 2, -1, -3 },{ -2, -2, 0 } }, - { { 0, -4, -2 },{ -1, -1, 0 },{ 0, -2, 0 },{ -3, 3, -1 },{ -4, 3, 1 },{ 1, -2, -1 },{ -4, 2, 0 },{ 0, -1, 3 },{ 1, -4, -4 },{ 1, 3, 1 },{ -2, -1, 0 },{ -2, 0, 1 },{ 1, -2, 2 },{ -1, 3, -1 },{ -2, 0, 1 },{ 0, -3, -4 },{ -3, -3, 0 },{ -4, 1, -3 },{ -2, 3, -1 },{ 2, -2, 0 },{ -2, 1, 2 },{ -3, -1, -2 },{ 1, 2, 1 },{ -1, 1, -1 },{ -4, -2, -2 },{ -2, 3, 0 },{ 0, 1, -3 },{ -4, -2, -2 },{ -3, 3, -3 },{ 2, 0, -4 },{ -3, -3, -2 },{ -2, -1, -2 },{ 2, 1, -4 },{ 0, -3, 2 },{ 1, -2, -2 },{ -2, 0, -3 },{ 2, -4, 3 },{ -4, 3, -4 },{ 1, 0, -2 },{ 0, -2, -1 },{ -1, -4, 1 },{ -4, 0, 1 },{ -2, -3, -1 },{ 1, -4, -2 },{ -1, 3, -3 },{ 2, 0, 0 },{ -2, -4, 0 },{ 1, 3, 2 },{ -1, -4, -4 },{ 1, 3, -3 },{ 0, -1, -2 },{ 2, -3, 1 },{ 3, -2, -4 },{ -2, 0, 0 },{ 0, -2, 1 },{ 3, 1, 2 },{ -2, -1, -1 },{ 1, 1, 0 },{ 0, 0, -2 },{ 1, -2, 3 },{ -4, 1, -2 },{ -2, 0, -1 },{ 1, 1, 1 },{ 3, 2, -2 } }, - { { 2, -1, 2 },{ -3, 2, -3 },{ 1, 1, -2 },{ 3, 0, -4 },{ -2, -4, 2 },{ 0, 1, 2 },{ -1, -1, -3 },{ 3, 3, -1 },{ -1, 2, -3 },{ -4, -3, -2 },{ -1, 1, -3 },{ 2, 1, 3 },{ -4, -3, -2 },{ 3, -3, 0 },{ -1, 0, 3 },{ 2, 2, -3 },{ -4, -1, 1 },{ 3, -4, 2 },{ 1, 0, -3 },{ 0, 3, 2 },{ -4, -1, -4 },{ 2, -4, 3 },{ 0, -2, -3 },{ -4, -1, 2 },{ 2, 3, -4 },{ 3, -4, 3 },{ 1, 0, 1 },{ -1, -2, 2 },{ 3, 2, -1 },{ -1, -3, 0 },{ 1, 2, 3 },{ 3, -2, 0 },{ 0, 0, 2 },{ -4, 2, -1 },{ -1, -4, -4 },{ -3, -1, 0 },{ 1, 2, 1 },{ -4, -3, -2 },{ -2, 0, 2 },{ 3, -4, 3 },{ 2, 3, -3 },{ 3, 1, 0 },{ 0, 2, 3 },{ -3, -2, -4 },{ -2, 1, 1 },{ 3, -1, 3 },{ -1, -2, -4 },{ -3, 2, 2 },{ 3, 0, -1 },{ 2, 1, 0 },{ -4, -4, -1 },{ -1, 2, -1 },{ -3, 1, 2 },{ -3, -4, -2 },{ -1, 3, -4 },{ 2, 2, -3 },{ -3, -3, -2 },{ -2, 3, 3 },{ -4, -3, 0 },{ -2, 3, 1 },{ 3, 2, 1 },{ -3, -3, -4 },{ -1, -4, 3 },{ -4, 0, -4 } }, - { { 1, 0, 2 },{ -2, -3, 1 },{ -4, -4, 3 },{ 2, 0, 1 },{ -1, -1, -2 },{ -3, -3, 0 },{ 2, 1, -4 },{ -2, -2, 2 },{ -3, -4, 1 },{ 3, 0, -1 },{ 2, -3, 3 },{ -3, 3, -4 },{ 0, -1, -2 },{ 1, 3, -4 },{ -3, -4, 3 },{ 3, 1, 2 },{ -2, 2, -2 },{ 0, -2, -1 },{ 2, 0, 3 },{ -1, -3, -2 },{ -1, 2, 0 },{ 3, -3, -1 },{ -2, 3, 0 },{ -1, 1, 3 },{ -3, -4, -2 },{ 1, -3, -1 },{ -2, -1, -3 },{ 1, 1, 0 },{ -2, -4, 3 },{ 0, -1, 1 },{ -4, 1, 1 },{ -1, -4, -3 },{ -2, -3, -3 },{ 2, 2, 1 },{ 3, 3, 1 },{ -3, 1, 3 },{ -1, -2, -1 },{ 3, 1, 0 },{ -1, -1, -4 },{ -3, 2, -1 },{ -3, -2, 0 },{ -1, 2, 2 },{ -4, 0, -3 },{ 1, -3, 2 },{ 3, -4, -1 },{ -4, 1, 2 },{ 1, -3, -2 },{ -2, -3, -3 },{ 0, -2, 1 },{ -3, -3, 3 },{ 0, -1, -4 },{ -2, 3, 3 },{ 1, -2, -3 },{ 3, -1, 3 },{ 2, 0, 0 },{ -4, -4, 1 },{ -1, -2, 2 },{ 3, -1, -4 },{ 2, 0, -4 },{ 0, -4, 2 },{ 1, -1, -3 },{ 2, -2, 2 },{ 0, 3, 0 },{ -3, 2, -1 } }, - { { 3, 3, -3 },{ -1, -2, -1 },{ 2, 2, -4 },{ 0, 2, -1 },{ 1, -2, -3 },{ -4, -4, 3 },{ 2, 3, -2 },{ 1, 0, -1 },{ -4, 1, 1 },{ -1, -1, -4 },{ 0, -2, 2 },{ -2, 2, 0 },{ 2, 1, 0 },{ -3, -1, 1 },{ -2, -2, -1 },{ 1, -2, -4 },{ -1, 3, 0 },{ -2, -3, -4 },{ -3, 1, 0 },{ -4, -4, 2 },{ 2, -1, -3 },{ -3, 1, 1 },{ 1, 2, -4 },{ 2, -2, -3 },{ 0, 0, 0 },{ -3, 2, 1 },{ 0, 3, 2 },{ -4, 2, -2 },{ 2, -1, -4 },{ -3, 3, -2 },{ 3, 0, -4 },{ 0, 3, -1 },{ -3, -1, 3 },{ -2, 0, -2 },{ 3, -3, -1 },{ 0, -2, -4 },{ -2, -4, -3 },{ 2, 2, 3 },{ 0, 3, 1 },{ -4, -3, 2 },{ 2, -2, -4 },{ 0, -3, -2 },{ 2, -1, -3 },{ -2, -1, 0 },{ 0, 2, -1 },{ -3, 3, -2 },{ 0, 0, -4 },{ 2, 1, 1 },{ -4, 3, -1 },{ -1, 2, 2 },{ 3, 0, -3 },{ 1, -3, 1 },{ -1, -2, 0 },{ -4, 2, -1 },{ 0, 0, -2 },{ 1, -3, 3 },{ -3, 2, -3 },{ 0, 1, -1 },{ -1, -1, 3 },{ -3, -3, -2 },{ -2, 2, -1 },{ -1, 1, -3 },{ -2, -3, -2 },{ 2, -3, 1 } }, - { { -1, 1, 1 },{ -3, -4, 3 },{ -2, 1, -2 },{ -3, -2, 2 },{ 3, 3, 1 },{ -1, 1, -3 },{ -2, 2, 1 },{ 3, -3, 3 },{ 0, -4, 0 },{ 1, 3, -3 },{ 3, 0, -2 },{ -4, -4, 2 },{ -1, -4, 1 },{ 2, 2, -2 },{ -4, 0, -3 },{ 0, -4, -1 },{ 2, 0, 3 },{ 1, -1, 1 },{ -3, 1, -4 },{ 3, 3, -1 },{ 1, -2, 3 },{ -4, 0, -2 },{ -1, -1, 2 },{ -4, -4, -1 },{ 3, 1, 2 },{ -2, -2, -4 },{ 3, -3, 3 },{ 2, 0, -1 },{ -1, -4, -3 },{ -2, -2, 0 },{ 1, -3, 2 },{ 2, 2, 3 },{ 1, 1, -4 },{ -4, -2, 0 },{ 0, 0, 2 },{ 1, 3, 2 },{ -1, 0, -2 },{ 2, -1, -1 },{ 1, -4, -3 },{ -2, 0, -2 },{ 1, 0, -1 },{ -1, 1, 3 },{ -4, 3, 3 },{ 3, -4, 1 },{ -1, 1, -3 },{ -2, -2, 3 },{ 2, 2, 3 },{ -1, -4, 0 },{ 1, -1, -4 },{ -3, -2, -2 },{ 3, 0, 0 },{ -4, -4, -2 },{ -2, 1, -3 },{ 2, 3, 2 },{ -2, -3, -4 },{ 1, 3, 1 },{ -4, 0, 0 },{ 3, -4, 1 },{ -3, 3, 0 },{ 2, 2, -1 },{ 3, 0, 1 },{ -4, -2, 0 },{ 1, 1, 3 },{ -4, -1, -4 } }, - { { 0, -2, 0 },{ 1, 3, -3 },{ 2, -1, 0 },{ 0, -3, -4 },{ -2, 0, 2 },{ -4, -1, -1 },{ 0, -2, -4 },{ -2, -1, 0 },{ -4, 0, -3 },{ 2, 3, 3 },{ -3, -3, -1 },{ 1, 1, -3 },{ -2, -2, -4 },{ 1, 3, 3 },{ 3, 1, 0 },{ -3, -3, 2 },{ -4, 3, -2 },{ 0, -4, 3 },{ 2, -2, -1 },{ -2, 0, -3 },{ 1, 2, 1 },{ 0, -4, -4 },{ 3, -3, -1 },{ -1, 3, 1 },{ -2, -2, -3 },{ 1, -1, -2 },{ -4, 1, 0 },{ 0, -2, 1 },{ -3, 0, 2 },{ 1, 1, 0 },{ -2, -3, -2 },{ -4, -4, -1 },{ -1, 3, 0 },{ 2, -1, 1 },{ -2, -4, -3 },{ -4, 2, 1 },{ -3, -3, -4 },{ -4, -2, 2 },{ -1, 1, 3 },{ -3, 2, 1 },{ 3, -4, 0 },{ -3, 3, -4 },{ 1, -3, 1 },{ 1, 0, -2 },{ -3, -2, -4 },{ 3, -4, 0 },{ -4, -1, -1 },{ -3, -2, 2 },{ 3, 1, -3 },{ 0, -4, 2 },{ -2, 2, 3 },{ 2, 2, -4 },{ 0, -1, 1 },{ -3, -2, 0 },{ -1, -2, 2 },{ 3, 1, -1 },{ -2, -1, -3 },{ 0, -2, -3 },{ 2, -2, -2 },{ -4, 0, -4 },{ -2, -4, 3 },{ 0, 3, -4 },{ 3, -4, 2 },{ -3, 0, -2 } }, - { { 2, -3, -4 },{ -4, -4, 2 },{ -1, 3, 1 },{ -4, 2, -2 },{ 3, -4, 3 },{ 2, -3, 0 },{ 1, 2, -2 },{ 3, -4, 2 },{ -3, 2, 1 },{ -1, -2, -2 },{ -1, 2, 1 },{ 3, -1, 0 },{ -3, 2, 3 },{ 0, -3, -1 },{ -1, -1, -4 },{ -2, 0, -3 },{ -1, 2, 2 },{ 1, 2, -3 },{ -1, -1, 0 },{ -2, -4, -2 },{ -1, 3, 2 },{ -3, -1, 0 },{ -3, 1, 3 },{ 2, 0, 1 },{ 1, -4, -3 },{ -3, 3, 3 },{ -1, 2, -4 },{ 0, -3, -1 },{ 3, 2, 3 },{ -4, 3, -3 },{ 2, -1, 2 },{ 0, 0, -3 },{ -3, 1, -4 },{ 1, -3, -2 },{ 3, 1, 3 },{ -2, 2, -2 },{ 3, -1, -1 },{ 1, 3, 0 },{ 3, -1, -4 },{ 0, 0, -1 },{ 2, -2, 2 },{ -2, -2, -3 },{ -2, 1, -2 },{ 0, 2, 0 },{ -4, 2, 2 },{ 1, 3, 1 },{ 1, 0, -3 },{ -2, -3, 1 },{ 2, 3, -2 },{ -1, 1, 0 },{ -4, -2, -1 },{ -1, -3, 3 },{ 1, 3, -1 },{ 2, 0, -4 },{ -4, -4, -2 },{ 1, -1, 3 },{ 2, 3, -1 },{ -3, -3, 2 },{ 0, 2, 3 },{ 1, 1, 1 },{ -1, -3, 0 },{ 1, -1, -3 },{ -3, 3, -1 },{ 3, 2, 0 } }, - { { 0, -1, 3 },{ 3, 1, -1 },{ -2, 0, -3 },{ 1, -2, -1 },{ -3, 1, -4 },{ 0, 3, 2 },{ -2, -1, -3 },{ -3, 1, 3 },{ 0, 0, -4 },{ 2, -4, -4 },{ -2, -1, 2 },{ 1, 0, -3 },{ -4, -3, -2 },{ 2, 3, 2 },{ -3, -2, 1 },{ 2, -4, -1 },{ 3, -2, 0 },{ -4, 2, -4 },{ 3, -3, 2 },{ -4, 1, 3 },{ 2, -3, 0 },{ 3, -2, -3 },{ 1, 2, -4 },{ 0, -2, -2 },{ -4, 2, -1 },{ 2, -1, 2 },{ 3, -4, 0 },{ 1, 0, -3 },{ -2, -1, -2 },{ -3, -4, -4 },{ -1, -2, 1 },{ 3, -2, 3 },{ -2, 3, 1 },{ -1, -4, -1 },{ 2, -1, -3 },{ 0, -3, 3 },{ 0, 1, 0 },{ -1, -4, 2 },{ -4, -3, -3 },{ -1, 2, -2 },{ -4, -4, 2 },{ 3, -1, 1 },{ 2, -1, -1 },{ -1, -3, 3 },{ 3, -4, -4 },{ 0, -1, -2 },{ -1, 1, -1 },{ -3, 2, -4 },{ -4, 0, 3 },{ 1, -1, -4 },{ 2, -3, -2 },{ -3, 1, -3 },{ 0, -1, 2 },{ 3, -4, 1 },{ -3, 2, -3 },{ -1, 1, 2 },{ -4, -3, -4 },{ -1, 2, 0 },{ -2, -4, -2 },{ 3, 3, 2 },{ -3, -1, -3 },{ 2, 1, 3 },{ -1, -2, -2 },{ -2, 0, 1 } }, - { { -1, 0, -4 },{ -3, 2, 2 },{ 1, -4, 0 },{ 0, -1, 3 },{ 3, -2, -3 },{ -1, 1, -1 },{ -4, -3, 0 },{ 1, 0, -2 },{ -1, -3, 1 },{ 3, 3, -1 },{ -4, 1, 3 },{ 0, -4, 0 },{ 1, -1, -4 },{ -1, 1, 0 },{ 3, 1, 3 },{ -4, 0, -2 },{ 0, -4, 1 },{ -1, -1, -2 },{ -3, 1, -4 },{ 0, 0, 1 },{ -2, 3, -1 },{ -4, -1, -2 },{ -1, -4, 0 },{ -2, 0, 2 },{ -3, -3, 0 },{ -1, 1, -1 },{ -2, -2, -4 },{ -4, -3, 1 },{ 0, 1, 1 },{ 2, 3, -1 },{ 1, 1, 0 },{ -2, 0, -3 },{ -4, 2, 2 },{ 1, -1, -1 },{ -4, 3, 1 },{ -3, 0, -4 },{ -3, -2, -2 },{ 2, 2, 1 },{ -2, 1, 3 },{ 1, -2, -4 },{ 0, 3, -1 },{ -3, 1, -3 },{ 0, 2, 0 },{ -4, 3, 2 },{ -2, 0, -3 },{ -3, -2, 3 },{ 2, -3, 0 },{ 0, -2, 1 },{ 3, -4, 2 },{ 0, -1, -1 },{ -2, 3, 0 },{ 3, 0, 1 },{ -2, 1, -2 },{ -4, -3, 3 },{ 1, 2, -1 },{ 0, -1, 0 },{ 3, 0, 1 },{ 1, 0, -4 },{ -2, -1, -1 },{ -4, -2, -3 },{ 0, 2, -1 },{ -4, -3, 1 },{ 1, -4, 2 },{ -4, 2, -3 } }, - { { 0, -4, -2 },{ 2, -3, 0 },{ -4, -1, -3 },{ -2, 3, 2 },{ -3, -3, 1 },{ 1, 2, 1 },{ 2, -4, 3 },{ 3, 2, 2 },{ -4, -2, -1 },{ 0, 3, -2 },{ -2, -2, 0 },{ 3, 2, -3 },{ -3, -4, 1 },{ -2, -3, 3 },{ 1, 2, -4 },{ 2, 3, -3 },{ -2, 0, 2 },{ 1, -3, 3 },{ 3, 3, -1 },{ 2, -2, -3 },{ 0, -4, 3 },{ 1, 0, -2 },{ 0, 3, 3 },{ 2, -3, 1 },{ 3, 3, -3 },{ 0, 0, 2 },{ 2, 2, 3 },{ -1, 3, -2 },{ 3, -3, 2 },{ -1, -1, 3 },{ -4, -4, -2 },{ 0, -3, -4 },{ 3, -2, 0 },{ 2, 1, -2 },{ -1, -4, 0 },{ 3, -2, 2 },{ -2, 3, -3 },{ 3, -3, 1 },{ -4, 0, -3 },{ 2, -3, 0 },{ -2, 0, 1 },{ -1, -4, 3 },{ 3, -3, -4 },{ 2, -2, -2 },{ -2, -4, -1 },{ 1, 2, 2 },{ 3, 1, -2 },{ -2, 2, -4 },{ -4, 3, 0 },{ -1, 0, 2 },{ -3, -2, -3 },{ 0, -4, 3 },{ 2, 2, -4 },{ -1, -1, 0 },{ 3, -3, -3 },{ -2, -2, -1 },{ -3, 3, -2 },{ 2, -3, 3 },{ 3, -4, 3 },{ 0, 1, 0 },{ 2, -2, 1 },{ -2, 0, -4 },{ 2, 3, 0 },{ 3, -2, -1 } }, - { { -3, 3, 3 },{ -1, 1, -4 },{ 3, 2, 1 },{ 2, 0, -1 },{ -1, -4, -4 },{ -2, 0, -2 },{ 0, 1, -1 },{ -3, -1, -4 },{ -2, 0, -3 },{ 2, -3, 3 },{ 1, 0, 2 },{ -4, 1, -4 },{ 2, 3, -1 },{ -1, -1, -1 },{ -3, -2, -3 },{ -4, -2, 0 },{ 0, -1, 2 },{ -1, 1, 0 },{ -3, 2, -2 },{ -1, -4, 1 },{ -3, 0, -4 },{ 3, 1, 1 },{ -4, 2, 0 },{ -2, -1, -4 },{ 1, 1, -4 },{ -3, -4, -2 },{ 1, 0, 0 },{ -4, -1, -3 },{ -3, -2, -1 },{ 1, 2, -3 },{ -2, 2, -2 },{ 2, 0, 2 },{ -3, -3, 3 },{ 0, 0, -3 },{ -2, 2, 2 },{ 0, -4, 3 },{ 1, 1, -4 },{ -3, -1, -1 },{ 0, 2, 3 },{ -1, -1, -2 },{ 2, 3, 2 },{ -3, -2, -2 },{ 1, 1, -1 },{ -3, 0, 1 },{ -1, -1, 1 },{ 0, 0, -3 },{ -4, -3, 3 },{ -1, -1, -1 },{ 2, -4, -2 },{ 3, 2, -3 },{ -4, -3, 1 },{ 1, 3, -2 },{ -4, -2, 0 },{ -1, 1, 2 },{ 1, 3, 3 },{ -3, -4, -3 },{ 0, 1, 2 },{ -4, 0, -3 },{ -1, 2, 1 },{ -3, 3, -4 },{ 1, -4, -2 },{ -3, 1, 3 },{ -1, -1, 2 },{ 1, 1, -2 } }, - { { -4, 0, 2 },{ 1, -2, 1 },{ 0, -4, -2 },{ -4, -2, 3 },{ 3, 1, -3 },{ 1, 3, 0 },{ -4, -2, -3 },{ 0, -4, 2 },{ 3, 2, 0 },{ -3, -1, -2 },{ -3, -3, -3 },{ -1, 2, 0 },{ 0, -1, 2 },{ 3, 0, 2 },{ -2, -4, 1 },{ 2, 1, -1 },{ 2, 3, -4 },{ -2, -3, -3 },{ 1, -2, -2 },{ -4, 2, 2 },{ -2, -1, 2 },{ 2, -3, -3 },{ -3, -3, -1 },{ 3, -2, 3 },{ -2, -1, -1 },{ -4, -4, -2 },{ 2, 2, 1 },{ 0, -3, -4 },{ 3, 0, 0 },{ 2, -1, 1 },{ -3, -3, 3 },{ 3, 1, 0 },{ -1, 3, -1 },{ 1, -1, -4 },{ -4, -2, -2 },{ 2, 0, -1 },{ -4, 3, 0 },{ 1, -3, -2 },{ 0, -2, 2 },{ 3, -4, -1 },{ -2, 2, -4 },{ -4, -1, -3 },{ 1, 1, 0 },{ -1, 3, 3 },{ 2, 2, -4 },{ -4, 3, -1 },{ 2, -4, 0 },{ -1, -2, 2 },{ 1, 0, 3 },{ -2, -1, 1 },{ -1, 1, -1 },{ 2, -2, -4 },{ -3, 0, -3 },{ 3, -3, 1 },{ 1, 0, -4 },{ -2, -1, -2 },{ 2, 2, 1 },{ -1, -2, 0 },{ 2, -3, -3 },{ 1, 0, 2 },{ -1, -3, -1 },{ 3, 2, -3 },{ -2, -2, -4 },{ -3, -3, -1 } }, - { { 3, -1, 0 },{ -2, -3, -4 },{ 0, 2, -2 },{ -2, 3, 0 },{ -3, -1, 3 },{ 2, -1, 2 },{ -2, -3, 1 },{ 2, 1, 0 },{ -1, 3, 1 },{ 1, -4, -1 },{ 2, -2, 3 },{ 0, -3, 1 },{ -4, -4, -2 },{ 1, 3, -4 },{ 0, 2, -2 },{ -3, -3, 3 },{ 1, 2, 1 },{ 3, -4, 0 },{ -4, -1, 3 },{ 2, 3, -1 },{ 1, -2, 0 },{ 0, 1, -3 },{ -1, 0, -2 },{ -1, 3, 2 },{ 1, 2, 3 },{ 0, -3, 0 },{ -1, 3, 2 },{ -2, 1, 3 },{ 0, 2, -1 },{ -2, -4, -3 },{ -1, 3, -4 },{ 0, -2, -2 },{ -4, -4, 1 },{ 3, 2, 1 },{ -3, 1, -2 },{ 2, -3, 3 },{ -1, -1, 1 },{ -2, 0, -4 },{ -3, 3, -3 },{ 2, 1, 0 },{ 3, -4, 3 },{ 0, 0, 1 },{ -2, -3, 2 },{ 3, -4, -2 },{ -3, -2, 2 },{ 0, -3, -3 },{ 3, -1, 0 },{ -3, 1, -3 },{ 0, 3, -4 },{ -3, -3, 0 },{ 3, 2, 3 },{ 1, 3, 0 },{ 0, -4, 2 },{ -2, 0, -1 },{ -4, 3, 0 },{ -1, -3, 3 },{ 1, -1, -4 },{ -2, -4, 2 },{ -3, 2, -2 },{ -2, -1, -1 },{ 0, 3, 3 },{ -4, 0, 1 },{ 0, -4, 0 },{ 2, 1, 1 } } - }, - { - { { 3, -4, 2 },{ -4, 0, -3 },{ 1, 3, 0 },{ 2, -2, -1 },{ -4, 3, -4 },{ 1, 0, -2 },{ -1, -3, 3 },{ -2, 2, 1 },{ 1, 0, 0 },{ -4, -2, -3 },{ 3, 1, 2 },{ 2, -3, -1 },{ -3, -4, 1 },{ 3, 1, -3 },{ -2, -2, 1 },{ 0, 2, -4 },{ -4, 0, 2 },{ -1, -3, 1 },{ 2, -1, 0 },{ -3, -3, -3 },{ 3, -4, 2 },{ 0, -1, 3 },{ 1, 0, 0 },{ -4, -4, 1 },{ -1, 1, 2 },{ -4, -1, 3 },{ 3, 2, 0 },{ 0, 1, 3 },{ -4, -2, -3 },{ 1, 2, -3 },{ 3, 0, 3 },{ -4, -4, 1 },{ -1, 0, -1 },{ -2, -3, -3 },{ -1, 3, -2 },{ -1, -2, -2 },{ 1, 2, 0 },{ -1, 0, -1 },{ -2, -4, -4 },{ -2, -2, -2 },{ -3, -4, 0 },{ -1, 1, 3 },{ 3, -4, -3 },{ -2, -3, -4 },{ 2, -4, -2 },{ -3, 1, 2 },{ -1, 2, -1 },{ -4, -2, 2 },{ 1, 2, 0 },{ -3, -1, -2 },{ 1, -4, 2 },{ 3, -2, -2 },{ 1, 1, 3 },{ -1, -3, 1 },{ -3, -1, -1 },{ 1, -3, -4 },{ -4, 1, -1 },{ 0, -2, 2 },{ 3, -4, 1 },{ -3, 3, -3 },{ -2, 2, 0 },{ 0, -2, 3 },{ -3, 3, -3 },{ 2, -3, 1 } }, - { { -1, 2, -1 },{ 0, -1, -2 },{ -2, 1, 2 },{ -3, -4, 0 },{ 1, -3, 2 },{ 3, 2, 0 },{ -2, 1, 1 },{ 0, -1, 3 },{ 3, -4, -2 },{ -3, 3, 0 },{ 0, -3, -2 },{ 1, -1, -4 },{ -4, 2, 3 },{ 0, -2, -3 },{ -1, -1, -1 },{ -3, -4, -1 },{ 1, 1, -3 },{ 3, -2, -2 },{ -1, 1, -1 },{ 1, 3, 3 },{ -4, 3, -1 },{ 3, -3, 1 },{ 0, 1, -3 },{ -1, -2, -1 },{ 1, 2, -4 },{ 2, -1, 0 },{ -2, -4, -2 },{ -3, -3, -1 },{ 1, 3, 1 },{ -1, -4, 0 },{ -3, -1, -2 },{ 0, -1, 0 },{ 3, 3, 2 },{ 1, 0, 3 },{ -4, -4, 1 },{ 2, 2, 1 },{ -3, -1, -4 },{ 0, -3, 3 },{ 2, 3, -1 },{ 3, 2, 2 },{ 0, 0, 1 },{ 1, -2, -2 },{ -4, 3, -1 },{ -2, -1, 1 },{ 0, -2, 3 },{ 1, -1, 0 },{ -2, -4, -3 },{ 3, 0, -3 },{ 2, -3, 0 },{ 3, 1, -3 },{ -4, 0, 1 },{ -2, 2, -1 },{ -3, -1, 1 },{ 2, 3, -3 },{ -1, -4, 2 },{ 0, 0, 3 },{ 3, 3, -2 },{ -2, -3, -3 },{ 1, -1, -1 },{ -1, 0, -1 },{ 2, -3, -2 },{ 3, 1, 2 },{ -4, -1, -4 },{ -3, -2, 0 } }, - { { 1, 2, 3 },{ 3, -3, -4 },{ -4, -2, 3 },{ 0, -1, -3 },{ -1, 0, -3 },{ 2, -2, -2 },{ -3, 3, -4 },{ 2, -4, -4 },{ -4, 1, -1 },{ 1, -2, 2 },{ -2, 2, 3 },{ -1, 0, -2 },{ 3, 3, 1 },{ -2, 1, 2 },{ 2, -3, 3 },{ 3, 3, -2 },{ -2, 2, 3 },{ -4, -4, 1 },{ -2, 2, -3 },{ -3, -2, -4 },{ -1, 1, -2 },{ -2, -2, -4 },{ 2, 3, 2 },{ -2, -1, 3 },{ 3, -3, 0 },{ -3, -2, -3 },{ 2, 3, 2 },{ 0, 0, -4 },{ 3, 1, -2 },{ -2, -3, 1 },{ 1, 1, 3 },{ -3, 2, -4 },{ 2, -2, -1 },{ 0, -2, -3 },{ -2, 1, 0 },{ 3, -3, -3 },{ -4, -1, 2 },{ 2, -2, -2 },{ -4, 1, 1 },{ -3, -3, -3 },{ 2, 1, -3 },{ -4, -3, 3 },{ 0, 2, -4 },{ 2, 0, 2 },{ 1, 2, -3 },{ -3, 3, 0 },{ 2, -1, -1 },{ 0, 1, 3 },{ -2, 3, -4 },{ 0, -3, 3 },{ -1, 0, 0 },{ 2, -2, -4 },{ -4, 2, -2 },{ 3, -3, -4 },{ -1, 3, 2 },{ -4, -2, -1 },{ 2, 2, -4 },{ -3, -4, 3 },{ -4, 3, 0 },{ 0, 2, 2 },{ -2, -4, -4 },{ -1, 0, 3 },{ 1, 1, -2 },{ -1, -4, 1 } }, - { { 0, -1, 1 },{ 2, 0, 0 },{ -3, 2, -1 },{ 2, 3, 1 },{ 0, -3, 3 },{ -4, 0, -1 },{ -1, -3, 2 },{ 1, 2, 3 },{ -1, -1, 0 },{ -3, 0, -3 },{ 3, 1, -4 },{ -4, -4, 0 },{ 1, -1, -1 },{ -1, -2, -3 },{ -4, 2, 0 },{ 2, 0, -4 },{ 1, -1, -1 },{ 0, -1, 2 },{ 2, -2, 0 },{ 0, 0, 2 },{ 2, -4, 1 },{ 1, 2, -2 },{ -4, 0, 1 },{ -3, -4, -4 },{ -1, 2, -2 },{ 0, 0, 2 },{ -2, -2, 1 },{ -3, 2, -1 },{ -4, -2, 3 },{ 2, -1, -4 },{ 3, 3, 2 },{ -2, -3, -2 },{ -4, -4, 0 },{ -3, 1, -4 },{ 0, 0, -1 },{ 1, 3, 3 },{ -2, 1, -4 },{ 1, 3, 0 },{ -1, -4, 3 },{ -1, 0, -4 },{ 1, -1, 0 },{ -2, -4, 0 },{ 3, 0, -1 },{ -1, -2, 2 },{ -4, 1, -2 },{ 3, -4, -4 },{ -4, -3, 1 },{ -1, -2, -2 },{ -3, -2, 1 },{ -4, 3, -1 },{ 2, -1, -2 },{ 0, -4, 2 },{ 0, -2, 3 },{ -2, 1, 0 },{ 1, 0, 0 },{ -3, -1, -2 },{ 1, 1, -3 },{ -1, -3, 0 },{ 1, 0, 1 },{ 3, -1, -3 },{ -4, -2, 1 },{ -2, 3, -1 },{ 3, -1, -3 },{ -4, 3, -3 } }, - { { -2, -3, -3 },{ 3, 1, -2 },{ -2, 0, -4 },{ -2, -4, 1 },{ 3, 1, -2 },{ 1, 2, 0 },{ -2, -2, -2 },{ 3, 0, -3 },{ -3, -3, 1 },{ 2, 3, -1 },{ 0, -3, 1 },{ -1, -2, 3 },{ -3, -4, -4 },{ 1, 3, -2 },{ 0, -3, 2 },{ -3, -2, 1 },{ -1, -4, -3 },{ -3, 1, 3 },{ -2, 3, -4 },{ 3, -3, -1 },{ -4, -1, 2 },{ -1, -3, 0 },{ 3, 1, -1 },{ 0, -1, 1 },{ 3, 3, -1 },{ -4, 1, -4 },{ 1, -4, 3 },{ 3, -1, -3 },{ -1, 2, 2 },{ -4, -4, -3 },{ 0, 1, -1 },{ -1, 0, 1 },{ -1, -1, 3 },{ 1, 3, 2 },{ 3, -2, -2 },{ -1, -3, 1 },{ -3, -4, -3 },{ 0, 2, -1 },{ -2, -1, -2 },{ 3, -2, 2 },{ -3, 3, -1 },{ 0, 2, 3 },{ -3, 1, -2 },{ 2, -4, -4 },{ -2, -3, 3 },{ 1, 3, 1 },{ -1, 0, 2 },{ 0, 2, -4 },{ 1, 1, 2 },{ 3, -4, -1 },{ 1, 1, -3 },{ -2, 3, 1 },{ -3, -3, -2 },{ 3, 2, -3 },{ 0, -4, 3 },{ -4, 1, 1 },{ 0, -2, 2 },{ 3, 0, 2 },{ 0, 2, -2 },{ -3, 1, -4 },{ 2, -4, 3 },{ 1, 2, -1 },{ 2, -2, 2 },{ -3, -3, 0 } }, - { { 1, 0, 3 },{ -4, -4, 2 },{ 1, -2, 2 },{ -1, 3, -1 },{ -4, -1, -4 },{ -3, -4, 2 },{ 0, 0, 0 },{ 1, 3, -1 },{ 0, -4, 3 },{ -4, -1, -4 },{ 3, 2, -2 },{ -2, 0, 0 },{ 2, 2, 2 },{ -4, 1, -1 },{ 3, -3, 3 },{ -2, 0, -4 },{ -1, 2, 0 },{ 3, 1, -1 },{ -1, -3, -3 },{ 1, 2, -2 },{ -2, 0, 3 },{ -3, 3, -3 },{ 1, -2, -3 },{ -2, -3, 3 },{ -1, -1, 0 },{ 2, -3, -2 },{ -3, 2, 1 },{ 0, -4, -1 },{ 1, 0, 0 },{ -2, -2, -2 },{ -3, 3, 0 },{ 1, -3, 2 },{ 3, 2, -3 },{ 2, -4, -1 },{ -3, 2, 1 },{ -4, -1, 2 },{ 3, 0, 0 },{ 1, -2, -2 },{ -4, 2, 1 },{ 0, -3, 2 },{ 2, -3, -3 },{ -4, -2, -3 },{ -1, 3, 1 },{ 0, -1, 0 },{ -2, 2, -3 },{ 0, -1, -2 },{ 3, 2, -1 },{ 2, -4, 0 },{ -2, -3, -3 },{ -3, -1, 3 },{ -3, 2, 0 },{ -1, 1, 2 },{ -4, 0, -4 },{ 1, -1, 1 },{ 2, -3, -2 },{ -2, 3, -1 },{ 2, -4, -4 },{ -2, -2, -1 },{ -4, 3, -3 },{ -1, -3, 0 },{ -2, -3, 1 },{ -4, 1, -2 },{ 0, 0, -4 },{ -1, 2, 1 } }, - { { -1, -1, -2 },{ 0, 3, -3 },{ 1, -2, 0 },{ 2, 1, 0 },{ -1, -3, 3 },{ 1, 2, -3 },{ 3, -1, -4 },{ -4, 1, 1 },{ -1, 2, -1 },{ -2, -2, -2 },{ 1, 1, 2 },{ -3, -2, -3 },{ 0, 0, -1 },{ -1, -1, 1 },{ 2, 3, -3 },{ -3, 0, -2 },{ 2, -1, 2 },{ 1, -4, 1 },{ -4, -2, 3 },{ 2, 3, 0 },{ 0, -1, 1 },{ 1, -4, 2 },{ 2, 1, -4 },{ -4, 2, 0 },{ 1, -2, 3 },{ -1, 3, -3 },{ -2, 0, -4 },{ 2, 1, 0 },{ 0, 3, 2 },{ 2, -2, -4 },{ 3, -3, 3 },{ -4, 1, -3 },{ -2, -1, -2 },{ -3, -2, -2 },{ 0, 3, -4 },{ -1, -4, -1 },{ 2, 1, 3 },{ -1, -2, 3 },{ -4, 3, -4 },{ 2, 0, 0 },{ -2, 1, 2 },{ 1, -1, -2 },{ 3, 0, 2 },{ -4, -3, -1 },{ 3, 0, -1 },{ -3, -2, 2 },{ -4, -2, 0 },{ -3, 3, 3 },{ 1, 0, -2 },{ 0, -1, -4 },{ 3, -3, -2 },{ 2, -2, 3 },{ 3, -2, -1 },{ -1, 3, 2 },{ -3, -1, 0 },{ -4, 2, -4 },{ 2, 0, 3 },{ -3, -3, -2 },{ 3, 1, 3 },{ 1, -1, -1 },{ 0, 3, 0 },{ 3, -1, -3 },{ -3, -4, 2 },{ 2, 3, -1 } }, - { { 3, -3, -4 },{ -4, 1, 2 },{ -3, -3, -3 },{ 3, -1, -2 },{ -3, 2, 1 },{ 0, -4, -2 },{ -2, -2, 2 },{ 2, -3, 2 },{ 2, -2, -4 },{ -1, 0, 3 },{ -4, -4, 0 },{ 2, 3, 1 },{ -2, -4, -4 },{ 1, -3, 0 },{ -4, 2, 3 },{ 0, -4, 0 },{ 1, 3, -1 },{ -4, -2, -4 },{ -3, 0, -2 },{ 3, -4, -4 },{ 0, 1, -1 },{ -3, -2, -3 },{ -2, 0, -1 },{ -4, 1, -2 },{ 2, -4, 2 },{ 3, -2, 1 },{ -3, -3, -1 },{ -4, -1, 3 },{ -3, -4, -2 },{ -1, 2, -4 },{ -1, 0, 1 },{ 0, -2, 1 },{ -4, 2, 0 },{ 1, -3, 3 },{ 2, 0, -4 },{ -2, 1, 0 },{ 1, 3, -3 },{ 2, -3, -3 },{ -3, -1, 1 },{ 3, -4, -1 },{ -2, 3, -4 },{ -3, -4, 1 },{ 2, -2, 0 },{ -1, 3, 3 },{ 1, 1, -4 },{ 2, 0, 1 },{ -2, -4, -3 },{ -1, 1, -4 },{ 3, -3, -1 },{ -1, 3, 1 },{ -4, 2, 0 },{ -2, -4, -3 },{ 0, 1, -2 },{ -2, 0, -4 },{ 1, -4, -1 },{ -1, 1, 2 },{ 0, -2, 0 },{ -1, 3, 1 },{ 2, 1, 2 },{ -4, -4, -4 },{ 2, 0, 2 },{ -2, 2, -2 },{ 1, -2, 3 },{ -3, 1, 0 } }, - { { 2, 2, 1 },{ 0, -2, 3 },{ -2, 2, -1 },{ -1, 0, -4 },{ 2, 3, -1 },{ -2, -2, 3 },{ -4, 1, -3 },{ 1, 3, 0 },{ -3, 2, -2 },{ 3, -3, -1 },{ 0, 2, -3 },{ 3, 1, 2 },{ -1, -1, -3 },{ 0, 0, 3 },{ -2, -3, -2 },{ 3, -2, -3 },{ 0, 1, 2 },{ -2, 3, 2 },{ -1, 0, 0 },{ -2, 2, 1 },{ -4, -3, 3 },{ -1, 2, 1 },{ 3, -3, 3 },{ 0, 3, -1 },{ 0, -1, -4 },{ -2, 1, -3 },{ -1, 2, 0 },{ 1, -3, -3 },{ 3, -1, 2 },{ 1, 1, -1 },{ -3, 3, 3 },{ 2, -4, -1 },{ 3, -1, -3 },{ -1, 1, 2 },{ 0, -4, 1 },{ -4, -2, 2 },{ -3, -1, -2 },{ -2, 2, 0 },{ 0, 0, -2 },{ -1, 1, 3 },{ 1, -1, -2 },{ 0, 2, 3 },{ -2, 2, -4 },{ 0, -3, -3 },{ -4, -4, -2 },{ -1, 3, 3 },{ 0, 2, -2 },{ 1, -1, 2 },{ -4, -2, 3 },{ 2, 0, 2 },{ 1, 2, -3 },{ 0, -1, 1 },{ -3, -4, 3 },{ 3, 2, 1 },{ -4, -3, 3 },{ 3, -1, -3 },{ 1, 0, -2 },{ -2, -1, -3 },{ 0, -3, -4 },{ -2, -2, 0 },{ -3, 2, 1 },{ -1, -3, -3 },{ 1, -1, -1 },{ -4, -4, -4 } }, - { { -1, 3, -2 },{ 0, 0, 2 },{ 2, -4, 0 },{ -4, -4, 2 },{ 1, 1, 1 },{ 3, -1, 0 },{ 0, 0, -4 },{ -3, -1, -1 },{ -1, -4, 1 },{ 1, 0, 1 },{ -2, -1, 3 },{ -3, -3, -2 },{ -4, 2, -1 },{ 2, 3, 1 },{ -4, 1, 0 },{ -3, -1, -4 },{ -2, 2, -1 },{ 2, -3, 0 },{ 1, -1, -3 },{ 3, -4, -2 },{ 2, 3, 2 },{ -3, -1, -2 },{ 1, -3, -4 },{ -2, 0, 2 },{ -3, -4, 1 },{ 2, 3, 0 },{ 3, 0, 3 },{ 0, 0, 1 },{ 0, 3, -3 },{ -2, -2, 0 },{ -3, -4, -2 },{ 3, 0, -4 },{ -2, 3, 3 },{ -3, 0, -2 },{ 1, -2, 0 },{ 3, 3, -1 },{ 3, -3, 3 },{ -1, 0, -1 },{ 1, -4, 2 },{ -4, -2, 0 },{ 3, -3, -3 },{ 2, 0, 1 },{ -4, -1, 2 },{ -3, 1, -1 },{ 1, -2, 1 },{ 2, 0, 0 },{ -2, -3, -3 },{ 3, 2, 0 },{ -3, 1, -1 },{ -1, -4, 0 },{ -2, -2, -4 },{ -4, 3, -2 },{ 1, -1, 0 },{ 2, 0, -1 },{ 0, 2, -4 },{ -3, 3, -2 },{ -2, -3, 3 },{ 2, 2, 0 },{ -4, -4, -1 },{ 3, 0, 3 },{ -1, 3, -2 },{ 3, 0, -1 },{ 0, 1, 3 },{ -2, -1, 1 } }, - { { -3, -1, -3 },{ 3, -3, -1 },{ -2, -1, -3 },{ 1, 3, -4 },{ -3, -2, 1 },{ -1, -3, -2 },{ 3, -3, 2 },{ -1, 3, -3 },{ 2, -2, 3 },{ -4, 3, -3 },{ 1, 1, 0 },{ 0, -3, -4 },{ 3, -2, 2 },{ -1, -4, -4 },{ 1, 0, -1 },{ 3, -4, 3 },{ 2, 0, 1 },{ -4, -3, -3 },{ 0, 1, 3 },{ -4, 2, -4 },{ 0, 0, -1 },{ 2, -2, -3 },{ 0, 1, 0 },{ -4, 2, 1 },{ 2, -1, -1 },{ -1, -2, -2 },{ -4, -4, -4 },{ -2, 2, -1 },{ -4, -3, 2 },{ 2, 1, -3 },{ 0, -1, 1 },{ -4, -3, 2 },{ 0, -3, 0 },{ -1, 1, -4 },{ 2, -1, -3 },{ -3, 2, -3 },{ -4, -4, 1 },{ 2, 1, -4 },{ -2, 2, -4 },{ -4, 3, 2 },{ -3, 1, -1 },{ 2, -3, -3 },{ -1, -4, -1 },{ 3, 3, 1 },{ 2, -1, 3 },{ -3, -1, -4 },{ -4, -4, 2 },{ 0, -1, -2 },{ -3, 3, -4 },{ 2, -4, -2 },{ 0, 1, 3 },{ 3, -3, 0 },{ -1, 1, 2 },{ -3, -2, -3 },{ -1, -2, 2 },{ -2, -4, 1 },{ 3, 1, 2 },{ -3, 1, 0 },{ 1, 3, -3 },{ 0, -1, 2 },{ -4, -2, -4 },{ 2, -4, 0 },{ -4, 3, 2 },{ 1, -3, -4 } }, - { { 1, 0, 0 },{ -4, 2, 3 },{ 3, -2, -2 },{ 0, 1, 3 },{ -1, 2, -2 },{ -4, -4, -4 },{ -2, 1, 3 },{ 2, 2, -2 },{ -4, -4, 1 },{ 3, -2, -4 },{ -2, 1, -2 },{ -1, 0, 3 },{ -3, 2, 1 },{ 2, -2, -2 },{ -2, 3, 2 },{ -1, -2, -3 },{ -1, -1, -2 },{ -3, 3, 1 },{ 3, -2, 2 },{ -1, -1, 0 },{ -2, -4, 1 },{ -2, -2, 0 },{ 3, 3, 3 },{ -1, -3, -3 },{ 1, 1, -4 },{ 0, 2, 3 },{ -3, -1, 2 },{ -2, -2, -2 },{ 2, -4, 0 },{ 3, 0, 3 },{ -1, 3, -4 },{ 1, 2, -1 },{ 2, -2, -1 },{ -4, 2, 3 },{ -1, -4, 1 },{ 0, -1, 2 },{ -1, 0, -1 },{ 1, 2, 3 },{ 3, -2, -3 },{ -1, -3, -2 },{ 0, -1, 3 },{ 0, 2, 0 },{ -2, 0, -2 },{ 1, -2, 0 },{ -1, 2, -4 },{ -3, 1, -1 },{ 3, 3, 1 },{ 2, -2, 2 },{ 1, 0, -3 },{ -2, -2, 1 },{ -1, 3, 3 },{ -3, -3, -4 },{ 2, 2, -1 },{ 1, -4, 1 },{ -4, 3, -2 },{ 0, -1, -1 },{ 2, -2, -4 },{ -4, 0, -3 },{ -1, -1, -2 },{ 2, -4, 1 },{ -2, 1, 3 },{ -1, -2, -3 },{ -3, -3, -2 },{ 3, 2, 0 } }, - { { 0, -4, -4 },{ -1, 1, 1 },{ -2, 3, -1 },{ -3, -3, 0 },{ 3, 0, 2 },{ 1, 2, -1 },{ -3, 0, 0 },{ 1, -1, 0 },{ -1, 1, -1 },{ 0, -1, 2 },{ -3, -4, 0 },{ 3, 3, -1 },{ 1, 1, -3 },{ -4, -3, 1 },{ 0, 1, 3 },{ 0, 2, 0 },{ -3, 1, -4 },{ 2, -3, -1 },{ 1, 2, -2 },{ -4, 1, -2 },{ 0, 2, 3 },{ -3, 1, -4 },{ 2, -4, -2 },{ -4, 0, 2 },{ -2, 2, -1 },{ 3, -3, 0 },{ 2, 0, -3 },{ -1, 3, 2 },{ 1, 1, -4 },{ -1, -1, -1 },{ -3, -3, 2 },{ 0, 2, 1 },{ -2, -2, -3 },{ 3, 0, -2 },{ -3, -3, 1 },{ 1, 3, 0 },{ -2, -2, -3 },{ -3, -3, 0 },{ 0, 0, 1 },{ 2, -4, 0 },{ 3, 3, 2 },{ -3, 1, -4 },{ -2, -2, 3 },{ -4, 2, -3 },{ 0, -4, 2 },{ -1, -3, -2 },{ -2, 1, -1 },{ -1, -4, 3 },{ -4, 2, 0 },{ 3, 0, 1 },{ 2, -1, -1 },{ -4, -2, -3 },{ 1, 1, 0 },{ -2, -1, 3 },{ 3, 0, -2 },{ 1, 3, 0 },{ 2, 2, 1 },{ 0, -4, 3 },{ -2, -2, 2 },{ 0, 3, -1 },{ 1, 2, -4 },{ 3, -1, -2 },{ 0, 1, 3 },{ -2, 3, 2 } }, - { { 2, -1, -4 },{ -4, 0, 3 },{ 2, -4, -3 },{ 0, -2, -3 },{ 2, -3, 1 },{ -2, -1, -4 },{ 3, -2, 3 },{ 0, 3, -3 },{ -3, -3, -4 },{ 2, -3, -2 },{ -1, 3, 2 },{ 1, -2, 3 },{ -2, -1, -3 },{ -4, -3, -1 },{ 1, -1, -4 },{ 3, -4, -2 },{ -4, -2, 3 },{ 0, -4, 2 },{ -2, 0, -4 },{ 3, -3, 1 },{ 1, -3, -3 },{ -1, -1, -1 },{ 1, 3, 3 },{ 0, -4, 1 },{ -3, -2, -2 },{ 1, 0, -4 },{ -4, -4, 0 },{ 3, -2, 1 },{ -3, 2, -1 },{ -4, 0, -2 },{ 1, -4, -3 },{ -4, 1, 3 },{ 2, -4, 0 },{ 1, -1, -4 },{ -2, 1, 3 },{ 3, 2, -4 },{ -4, -2, -1 },{ 2, 3, -2 },{ -2, -1, 3 },{ -4, 1, -4 },{ -1, -2, 1 },{ 1, -1, -2 },{ 2, -4, 1 },{ -4, 3, -3 },{ 2, -1, 3 },{ 3, 0, 1 },{ 1, -3, -4 },{ 1, -1, -2 },{ -1, 1, -3 },{ 0, -3, -1 },{ -2, 3, 2 },{ -3, 2, -2 },{ 0, 0, -4 },{ -1, -4, 3 },{ -2, -3, -3 },{ -4, -2, -4 },{ -3, -3, 0 },{ -1, 2, -1 },{ 3, 0, -3 },{ -4, -3, 1 },{ -3, 2, 0 },{ 2, 0, 1 },{ -4, -4, -3 },{ -1, -2, -1 } }, - { { 3, 3, 2 },{ -3, -3, -2 },{ 1, 2, 0 },{ -3, 3, 2 },{ -2, 1, -2 },{ -4, 3, 1 },{ 0, -4, -2 },{ -4, 2, 2 },{ -2, 0, 3 },{ 2, 2, -3 },{ -4, 0, 1 },{ 0, -4, -4 },{ -3, 0, -1 },{ 2, 3, 0 },{ -2, 2, 2 },{ 2, 0, 1 },{ -2, 3, -1 },{ 1, -1, 0 },{ 3, 0, -2 },{ -3, 2, 3 },{ -2, 3, 2 },{ 2, -1, 0 },{ -4, 0, -4 },{ 3, 2, -2 },{ 2, -1, 2 },{ -1, 3, 3 },{ -2, 2, -1 },{ 0, 1, 3 },{ -2, -3, -3 },{ 2, -2, 3 },{ 3, 0, 0 },{ -2, 3, -2 },{ -1, 3, 1 },{ -3, 0, 2 },{ 0, -4, -2 },{ 2, 1, -1 },{ 1, -4, 2 },{ 0, -1, 1 },{ 1, 3, -3 },{ -2, 0, -1 },{ -3, -4, -3 },{ 0, 2, 2 },{ 3, 0, -1 },{ -2, -3, 0 },{ 0, 1, -4 },{ -3, 2, -1 },{ -4, 3, 2 },{ -3, -2, 2 },{ 2, 2, -3 },{ -4, -4, -4 },{ 3, -2, 3 },{ 0, -4, 0 },{ 2, 3, 2 },{ -4, -2, -1 },{ 3, 2, 1 },{ -1, 1, 2 },{ 1, -1, 3 },{ 3, 3, -2 },{ -3, 1, -1 },{ 1, -4, -4 },{ -2, -1, 2 },{ -1, -3, -1 },{ 1, 2, 3 },{ -3, -2, 0 } }, - { { -1, 1, 1 },{ 2, -1, -4 },{ 0, -1, -1 },{ -1, 0, 3 },{ 0, -3, -4 },{ 2, 1, 0 },{ 2, -2, -3 },{ -1, -4, 1 },{ 1, -2, -1 },{ 3, -1, 0 },{ -2, 2, -2 },{ -1, 1, 2 },{ 3, 2, 3 },{ -1, -2, -3 },{ -1, -4, -2 },{ -3, 0, -3 },{ 0, -2, 3 },{ -4, 3, -3 },{ -1, 1, -4 },{ 1, -4, 1 },{ -4, -2, -1 },{ -1, -2, -3 },{ 0, 1, 1 },{ -2, 1, 0 },{ -3, -3, -1 },{ 1, -3, -3 },{ -4, -1, -2 },{ 2, -1, -4 },{ 1, 3, 1 },{ 0, -2, 2 },{ -2, 1, -4 },{ 2, -3, -1 },{ 0, -1, -3 },{ 1, -2, 0 },{ -1, 2, -2 },{ -3, 0, 3 },{ -4, -2, -4 },{ -1, 2, 0 },{ 3, -3, 2 },{ 2, 1, -1 },{ -4, -3, 3 },{ -1, 3, -4 },{ 1, 0, -2 },{ -3, 1, 3 },{ -1, -2, 1 },{ 1, -4, -3 },{ 3, 2, 0 },{ -1, -1, 3 },{ -2, -4, -1 },{ 1, 0, 1 },{ 1, 0, 1 },{ -1, -1, -2 },{ -3, -3, -3 },{ 2, 2, -1 },{ 1, 0, -3 },{ 0, -4, 1 },{ -2, 0, -4 },{ -3, -3, 1 },{ 2, -2, -2 },{ 0, 1, 3 },{ -1, 0, 1 },{ 3, 3, -3 },{ -4, 0, -2 },{ 1, 1, -3 } }, - { { -2, -4, 3 },{ -4, 2, 2 },{ 3, -4, 1 },{ -4, -2, -3 },{ 3, 0, 0 },{ -1, -1, 3 },{ -3, 0, -1 },{ 3, 1, -4 },{ -3, 3, 1 },{ -4, -2, 3 },{ 2, -4, -2 },{ 1, -3, -4 },{ 2, -1, 0 },{ -3, -1, 3 },{ 1, -3, -1 },{ 3, 2, 2 },{ 2, -3, 1 },{ -3, -3, -1 },{ -1, -1, -2 },{ 2, 2, 2 },{ 0, 0, -3 },{ 3, -3, 0 },{ 1, -4, 3 },{ -3, 3, -3 },{ 0, -2, 1 },{ 3, 1, 1 },{ -2, -4, 0 },{ -1, 1, 2 },{ -3, -3, -2 },{ 3, 2, 0 },{ -1, -1, 1 },{ -4, -4, -3 },{ -4, 2, 2 },{ 3, -3, 2 },{ -4, -2, -3 },{ 2, 3, 1 },{ -1, -3, -2 },{ -2, 1, 3 },{ -3, -4, -2 },{ 2, -2, -2 },{ 0, -1, 1 },{ 3, -2, 0 },{ -2, -4, 2 },{ 2, 2, -4 },{ -4, -1, -1 },{ -2, -3, 2 },{ 0, 0, -4 },{ 3, -3, 0 },{ -2, 3, -2 },{ 0, 1, 0 },{ -4, 2, -4 },{ -3, 3, 2 },{ 1, 1, 3 },{ -2, -3, 1 },{ -4, 1, -4 },{ 2, -2, -2 },{ -1, 3, -1 },{ 1, -4, 2 },{ -4, -1, -3 },{ 0, 3, 0 },{ 3, -2, -2 },{ -2, -4, -4 },{ 2, -2, 2 },{ 0, -3, -1 } }, - { { -1, 3, -4 },{ 0, -2, -1 },{ 1, 2, -2 },{ -2, 3, -4 },{ 1, -4, 1 },{ -4, 2, 2 },{ 0, 3, -2 },{ -2, -3, 2 },{ 1, -1, -3 },{ -1, -3, 0 },{ 0, 3, -3 },{ -3, 1, -1 },{ -4, -3, 1 },{ -2, 1, -4 },{ 0, 3, 1 },{ -4, 1, -3 },{ -2, -1, -4 },{ -2, 1, 0 },{ 3, -4, 3 },{ 1, -2, 2 },{ -3, 2, -4 },{ -2, 3, -2 },{ -1, -1, 3 },{ -4, -2, -4 },{ 2, 2, -1 },{ 0, 0, 3 },{ 1, 3, -3 },{ -4, 0, -3 },{ 0, -1, 3 },{ -3, -4, -4 },{ 1, 1, -1 },{ -1, 3, 1 },{ 3, -1, 3 },{ -2, 1, -4 },{ 0, 2, -1 },{ 1, -4, 0 },{ 3, -1, -3 },{ 2, 3, -4 },{ 1, 0, 1 },{ -1, 2, -4 },{ -4, 1, 3 },{ 0, 2, -3 },{ -3, -3, -1 },{ 3, 3, 1 },{ 2, -1, -2 },{ 0, 2, -2 },{ -3, 1, -1 },{ 2, -2, 1 },{ -4, -1, -3 },{ 3, -2, 3 },{ 2, -1, -3 },{ -1, -4, -1 },{ 3, -2, 0 },{ -2, -1, -2 },{ 0, 3, 3 },{ -3, -1, 0 },{ 3, 0, 2 },{ -1, 2, -3 },{ 3, -3, 0 },{ -2, 2, 3 },{ -4, -3, -1 },{ -3, 1, 1 },{ 1, 2, 1 },{ -3, 0, -2 } }, - { { 2, -1, -3 },{ -3, 0, 0 },{ 1, 1, 3 },{ -3, -3, -3 },{ -2, 1, 0 },{ 0, -2, -3 },{ 2, -3, -1 },{ -4, 2, 3 },{ 0, 1, -4 },{ 3, 0, -1 },{ -2, 0, 2 },{ 1, 2, 1 },{ 3, -1, 2 },{ 2, 3, -2 },{ -1, -4, 0 },{ 0, -2, -1 },{ 3, 2, 2 },{ 1, -3, 1 },{ -1, 3, -3 },{ -4, 1, -1 },{ -2, -3, 0 },{ 2, -1, 1 },{ 3, 0, -1 },{ 1, -3, -2 },{ -2, 1, 2 },{ -1, -4, -4 },{ 2, -2, -1 },{ 3, -3, 0 },{ -2, 3, 1 },{ 2, 0, -1 },{ 0, -2, 3 },{ -3, 0, -3 },{ 2, -4, -1 },{ 0, 0, -2 },{ -2, 3, 1 },{ -3, -1, 2 },{ -4, 1, 3 },{ -2, -2, 0 },{ 0, -1, -1 },{ -3, -4, 0 },{ 3, 3, 2 },{ -4, -4, -1 },{ 1, -1, -3 },{ -1, 0, 1 },{ -4, -4, 3 },{ -1, -2, 3 },{ -2, 3, -4 },{ 1, -4, 2 },{ -3, 2, -2 },{ 0, -3, 3 },{ -2, 1, 2 },{ -3, -3, -1 },{ 1, 2, -4 },{ 3, 0, -3 },{ 0, -4, 2 },{ -4, -3, -2 },{ 2, 2, -4 },{ -3, 1, 1 },{ -3, -1, -1 },{ 1, -4, -4 },{ 2, 0, 3 },{ -1, -1, 2 },{ 0, 3, -1 },{ 3, -3, 0 } }, - { { -4, -2, 2 },{ 3, 3, 1 },{ -1, -2, -1 },{ 2, -1, 3 },{ 3, 2, 2 },{ -1, 0, -2 },{ 2, -4, 1 },{ -2, -1, -4 },{ 3, 2, 0 },{ -3, -4, 3 },{ -4, -2, -2 },{ -1, -4, -4 },{ 0, 0, -3 },{ -3, -2, 3 },{ -3, 0, -3 },{ 2, -2, 3 },{ -4, 3, -4 },{ 0, 0, -2 },{ -3, 0, 1 },{ 1, -2, -4 },{ 0, 2, -3 },{ -3, 3, 2 },{ 0, -4, 1 },{ 0, -2, -4 },{ -4, 3, 1 },{ -3, -1, -2 },{ -3, 2, 2 },{ 0, -4, 2 },{ -4, 2, -4 },{ -2, -3, -2 },{ 3, -2, 2 },{ -3, 3, -4 },{ -1, 1, 0 },{ 2, -3, 2 },{ -1, -4, -3 },{ 3, -2, -4 },{ 0, 2, -1 },{ -4, -3, -2 },{ 3, 2, 2 },{ -1, 0, -3 },{ 1, -2, -2 },{ -2, 0, 1 },{ 0, 1, -4 },{ -3, -3, 0 },{ 0, 2, -3 },{ 2, 0, 0 },{ 1, 1, -3 },{ 3, -1, -1 },{ -1, 0, 1 },{ 1, 3, -4 },{ 0, -1, 0 },{ 2, 2, 1 },{ -4, 0, 3 },{ -1, -2, 2 },{ 2, 3, 1 },{ -2, 1, -1 },{ 0, -4, 3 },{ 1, -2, 2 },{ -1, 3, 1 },{ 0, 1, -2 },{ -1, 1, -1 },{ 2, -2, -3 },{ -4, -4, -4 },{ -2, 1, 3 } }, - { { -2, -3, -3 },{ 0, -4, -2 },{ -4, 1, -4 },{ -2, -4, -1 },{ -4, -3, -2 },{ 1, 3, -3 },{ -3, 1, 2 },{ -3, -1, 0 },{ 0, -2, -2 },{ 1, 3, -1 },{ -4, -3, 1 },{ 2, 2, -1 },{ -2, 1, 0 },{ 1, -3, -2 },{ 3, -1, 0 },{ -1, -4, 2 },{ -3, 1, -2 },{ 0, -4, -1 },{ 3, -1, 3 },{ 2, -3, 2 },{ -1, -4, -1 },{ 3, 1, 3 },{ -4, 0, -3 },{ -1, 2, 0 },{ 3, -3, 3 },{ 2, 1, -1 },{ -1, -1, -3 },{ 1, 1, 1 },{ 1, 0, -2 },{ -1, -1, 2 },{ 2, 2, 0 },{ -4, -4, -2 },{ 1, -1, 1 },{ -4, -1, 3 },{ -3, 2, -2 },{ 2, -3, 0 },{ -1, 1, 2 },{ 2, 3, -3 },{ 1, -1, 3 },{ -3, -3, 1 },{ 2, 1, -2 },{ -1, 2, 3 },{ 3, -2, 2 },{ 2, 3, -1 },{ -2, 1, 2 },{ -4, -2, -1 },{ -3, -3, 1 },{ -1, -4, 3 },{ -4, 2, -1 },{ -3, -2, -3 },{ -2, -4, -2 },{ 2, 3, -4 },{ -1, -1, -2 },{ -3, -4, -1 },{ -3, 2, -3 },{ 3, -1, -4 },{ -1, -2, -2 },{ -4, 0, -3 },{ 3, -3, -4 },{ -4, 2, 2 },{ -2, -1, -3 },{ 3, -3, 1 },{ 0, 3, -2 },{ 1, 2, 0 } }, - { { -1, -1, 2 },{ 1, 0, 1 },{ 2, 3, 0 },{ 0, 0, -4 },{ 3, -2, 1 },{ -1, 2, 3 },{ -2, 0, -1 },{ 3, -4, 2 },{ 0, 2, -3 },{ -1, 0, 2 },{ 1, 1, -4 },{ 3, -2, 3 },{ -2, -1, 1 },{ -4, 3, -4 },{ 1, 2, -1 },{ -2, 2, 1 },{ 2, -3, 0 },{ -2, 3, -3 },{ -4, 2, 0 },{ -2, 1, -2 },{ -4, -1, 0 },{ -2, -2, -2 },{ 2, -1, -4 },{ -2, 2, -2 },{ 1, 0, 3 },{ -2, -2, -3 },{ 3, -3, -4 },{ -4, 3, 3 },{ 2, -4, -1 },{ -2, -2, -3 },{ -1, 1, 1 },{ 0, -3, -4 },{ 3, 2, -1 },{ 0, 3, -3 },{ 1, 0, 3 },{ -2, -1, -2 },{ -3, 0, 1 },{ -1, -4, -1 },{ -2, -2, -4 },{ -4, 3, 0 },{ 3, -4, -4 },{ -4, -1, 0 },{ 1, -4, -2 },{ -3, -3, -4 },{ 1, -1, -3 },{ 3, -4, 3 },{ 0, 3, -2 },{ -2, 0, -4 },{ 2, 0, 0 },{ 3, -2, 2 },{ -2, 1, 1 },{ -4, -3, 3 },{ 0, 0, 0 },{ 3, -2, 0 },{ 1, 1, 1 },{ -2, 3, 3 },{ 0, -3, 0 },{ 2, 3, -1 },{ -3, 0, 3 },{ 2, -2, 0 },{ 1, -4, 0 },{ -3, 0, 3 },{ -3, 0, 1 },{ 2, 1, -4 } }, - { { -4, 2, -1 },{ -3, -3, -3 },{ 3, -1, 3 },{ -3, 2, 1 },{ -4, -1, 2 },{ 1, -3, -4 },{ 2, 0, 0 },{ -4, -2, -4 },{ 2, 3, 3 },{ -2, -3, -3 },{ -3, -1, 0 },{ 3, 2, -3 },{ 0, 0, 3 },{ 0, -4, 2 },{ -4, 1, -3 },{ 1, -2, -4 },{ 3, -1, 2 },{ -1, 1, -3 },{ 3, -2, 2 },{ -1, 0, -4 },{ 1, 3, 1 },{ 1, -3, 2 },{ 2, 1, 2 },{ -3, -3, -1 },{ 0, -4, 1 },{ -1, 3, 0 },{ -4, 0, 2 },{ 0, 1, -2 },{ -3, -2, 0 },{ 3, 3, -4 },{ -4, 2, 3 },{ 1, -4, 0 },{ -3, 0, 2 },{ -2, -2, 1 },{ 3, -4, -4 },{ 0, 1, -1 },{ -4, 3, -4 },{ 3, -2, 2 },{ 0, 2, 3 },{ 0, 1, -2 },{ 0, -1, 1 },{ -2, 3, -3 },{ -1, 0, 2 },{ -2, 2, 1 },{ -1, 0, 0 },{ 2, 2, 1 },{ -4, 1, -4 },{ 0, -3, 0 },{ 1, 2, 2 },{ -1, 3, -3 },{ 1, -4, -1 },{ 3, 1, -4 },{ -1, 3, 2 },{ -2, -4, -3 },{ 2, -3, -2 },{ -4, 0, 2 },{ 1, 1, 0 },{ -1, -4, -3 },{ -2, 1, 1 },{ -2, -1, -2 },{ 3, 3, -4 },{ -4, 2, -2 },{ 0, -2, 3 },{ 1, -4, -1 } }, - { { 3, 0, 3 },{ -1, -3, 0 },{ 0, -2, -2 },{ -1, 1, -1 },{ -2, -4, -2 },{ 1, 3, -3 },{ 0, 2, 0 },{ -3, -3, -2 },{ 1, 1, 1 },{ -1, -1, 1 },{ -4, -4, -1 },{ 1, 3, -2 },{ -3, -4, -1 },{ -1, -3, -2 },{ 2, 0, 0 },{ -1, 3, 3 },{ -3, -4, 1 },{ -3, 0, -1 },{ 0, -2, 3 },{ 2, -4, -1 },{ -3, 3, -4 },{ -2, -4, 0 },{ -1, 0, -3 },{ 3, 3, -2 },{ -4, -1, -4 },{ 2, 2, 1 },{ -2, -2, -3 },{ -1, 0, -1 },{ 1, -4, 1 },{ 0, 0, 3 },{ -2, -2, -1 },{ 3, 1, -3 },{ -3, 3, -1 },{ -1, -2, -3 },{ 1, -3, 2 },{ -4, 2, 3 },{ 3, -1, 0 },{ 2, -4, -2 },{ -2, 0, 0 },{ 1, -3, 2 },{ -3, -3, -1 },{ 3, 2, -1 },{ 1, 1, 3 },{ -4, -2, 0 },{ 3, -3, -3 },{ -3, -1, 3 },{ -2, -1, -1 },{ 2, -3, -2 },{ 3, -2, 3 },{ -3, -1, -2 },{ 0, -3, 1 },{ 1, -1, -1 },{ -4, 2, 3 },{ -3, -1, -2 },{ 0, 2, -4 },{ -1, -1, 3 },{ 2, -4, -4 },{ -4, 2, -2 },{ 1, -2, 2 },{ 0, -3, -3 },{ -1, 2, 2 },{ 1, -1, -1 },{ 3, -3, -3 },{ -2, 1, 0 } }, - { { 2, 3, 2 },{ -2, 2, -4 },{ -4, -4, 2 },{ 2, 3, -3 },{ -3, -3, -1 },{ 3, -1, 1 },{ -1, 1, 3 },{ -3, -4, 2 },{ 0, 0, -1 },{ 3, 3, -4 },{ 2, -3, 3 },{ -2, 1, 2 },{ -3, 2, 1 },{ 3, -1, -4 },{ 2, -2, -1 },{ -4, -3, -2 },{ 0, 2, -2 },{ 1, -3, -4 },{ -4, -1, 1 },{ -3, 2, -3 },{ 3, 0, 3 },{ 0, -2, -1 },{ -4, 2, 2 },{ -3, 1, 1 },{ 1, -2, 3 },{ 2, -4, -1 },{ 0, 1, 2 },{ 3, -3, -4 },{ 2, 2, 1 },{ -3, -1, -4 },{ -1, -1, -2 },{ 1, -3, 1 },{ 2, 1, 2 },{ -4, -1, 3 },{ -1, 0, -2 },{ 2, 3, -1 },{ -3, -3, 1 },{ -1, -1, -3 },{ -4, 3, -3 },{ 2, 2, 1 },{ -1, -3, 3 },{ -2, -1, -4 },{ 2, -2, -3 },{ 0, -4, -1 },{ 0, 1, -2 },{ 1, 3, -4 },{ -2, -4, 2 },{ -1, 2, -3 },{ -4, 3, 0 },{ -3, -4, -4 },{ -2, 2, -2 },{ 2, 0, 1 },{ 2, -2, -4 },{ 1, 1, 1 },{ 0, 3, -1 },{ 3, -2, 1 },{ -3, -1, -1 },{ -3, -2, 3 },{ 3, 3, 0 },{ 2, 0, -1 },{ -4, -4, 1 },{ -2, 1, 2 },{ -1, 3, -4 },{ -3, -2, -2 } }, - { { 1, -1, -3 },{ 0, 1, 1 },{ 3, -1, 0 },{ 1, 0, 3 },{ -1, 0, 2 },{ -4, 1, -4 },{ 2, -2, -2 },{ 3, -2, -3 },{ -2, 2, 2 },{ -4, 0, -4 },{ 0, -1, 0 },{ 1, -2, -3 },{ 2, 0, -2 },{ -2, 2, 2 },{ -1, 3, 3 },{ -2, -1, 0 },{ 3, 1, -3 },{ 2, 3, 2 },{ -1, 1, 0 },{ 1, -4, -2 },{ 0, 2, 2 },{ 3, -1, 0 },{ -1, -3, -4 },{ 2, -2, -2 },{ -1, 0, 0 },{ -3, 3, -3 },{ 1, -1, -2 },{ -3, -3, 3 },{ -4, 3, -1 },{ -1, 2, 2 },{ 2, -4, 3 },{ -4, 0, -2 },{ 0, 3, -4 },{ 3, -4, 0 },{ 0, -2, -3 },{ -2, 1, -4 },{ 1, 2, -1 },{ 0, -2, 3 },{ -3, 1, -4 },{ 2, -1, -2 },{ -4, 1, 2 },{ 1, -4, -2 },{ -4, 3, 1 },{ -3, 2, 2 },{ 2, 0, 3 },{ -4, 1, 1 },{ 3, -2, -1 },{ 1, 0, 1 },{ 0, 0, 0 },{ 2, 1, 2 },{ -1, 1, 2 },{ -4, -2, -1 },{ -2, -4, -3 },{ -3, 0, 0 },{ -4, -4, 2 },{ 3, 0, -3 },{ -2, 3, -3 },{ 2, 1, 0 },{ 0, -3, -4 },{ -4, -1, -2 },{ -1, 1, -3 },{ 2, -3, 0 },{ 0, -2, 3 },{ -3, -4, 1 } }, - { { -1, -3, -4 },{ -4, 2, -2 },{ -2, -4, -1 },{ 0, -2, 1 },{ -3, -3, -4 },{ 1, 3, 3 },{ -1, 2, 0 },{ -2, -4, -2 },{ 1, 1, 0 },{ -3, 3, -2 },{ 3, -3, 3 },{ -1, 0, 1 },{ -4, -4, -4 },{ 0, -3, 2 },{ 1, -2, -3 },{ -4, -4, 0 },{ -1, 0, 1 },{ -2, -2, -4 },{ 3, -3, -1 },{ -2, -1, 1 },{ -1, 1, -3 },{ -4, -3, -2 },{ -2, 3, 3 },{ 1, 1, 1 },{ 0, -4, -4 },{ -2, 2, 2 },{ -4, 2, -3 },{ 1, 0, 0 },{ 0, -2, -3 },{ 3, 1, 0 },{ -2, 0, -3 },{ -2, -3, -1 },{ -1, 2, 0 },{ -3, -1, 1 },{ 1, 0, 0 },{ -2, -4, 2 },{ 3, -3, 2 },{ 0, 0, 1 },{ -2, -4, -1 },{ 3, 2, 2 },{ 0, -2, 0 },{ -2, 0, -3 },{ -1, 0, 0 },{ 3, -3, -4 },{ -1, -1, 0 },{ -2, -4, -3 },{ 2, -2, 2 },{ -3, 1, -4 },{ -2, -3, 3 },{ 3, -1, -3 },{ 1, -4, -4 },{ 0, 3, 0 },{ 3, -3, 3 },{ -1, -1, -2 },{ 0, 2, 2 },{ -1, -3, 0 },{ 1, -2, -2 },{ -1, 2, 1 },{ -2, -4, 2 },{ -3, 0, 2 },{ 1, 3, 3 },{ 3, 0, -4 },{ -4, 2, -1 },{ 3, 0, -1 } }, - { { 0, -3, 2 },{ 1, -2, 3 },{ -3, 3, -3 },{ 3, 2, -2 },{ -2, 0, -3 },{ 2, -4, 1 },{ -4, -1, -1 },{ 0, -3, 3 },{ -1, -1, 2 },{ 1, -4, -3 },{ -1, -2, -1 },{ -2, 1, -2 },{ 3, 3, 0 },{ 0, 1, -1 },{ -3, -1, -3 },{ 3, 0, 3 },{ 0, 2, 2 },{ -3, -4, -2 },{ -4, 3, 3 },{ 1, 0, 3 },{ -3, 3, -4 },{ 2, -4, 0 },{ 1, 2, -1 },{ 3, -1, -3 },{ -3, -3, -1 },{ 3, -2, 1 },{ -1, -3, 3 },{ 3, 1, -1 },{ -2, -4, -4 },{ -3, -2, 2 },{ 1, -4, 1 },{ 1, 2, 2 },{ 3, -2, -4 },{ -3, -3, 3 },{ 2, 2, -2 },{ -4, 3, -3 },{ -4, -2, 1 },{ 3, 3, -2 },{ -3, 0, -2 },{ 1, -4, -4 },{ -3, 3, 1 },{ 1, -1, -3 },{ 3, 2, 2 },{ 0, -3, -1 },{ -4, 1, 3 },{ 0, 2, -2 },{ 1, 3, 0 },{ -3, -3, -3 },{ -1, 3, -2 },{ -4, -2, -1 },{ 0, 0, 1 },{ -3, 2, 3 },{ -3, 0, -3 },{ 2, 3, -1 },{ 2, 1, -4 },{ -4, -4, 3 },{ 1, -1, -4 },{ -4, 0, 3 },{ 3, 3, -3 },{ 2, -2, -3 },{ -2, 2, -1 },{ 0, -4, -2 },{ -2, -1, 1 },{ 2, 1, 3 } }, - { { -3, 3, -2 },{ 2, 1, 0 },{ -3, -1, 2 },{ -1, -3, 2 },{ 3, 1, 0 },{ 0, -1, -2 },{ -3, 2, -4 },{ 2, 0, 1 },{ -3, 3, -4 },{ 3, 2, 1 },{ -4, -1, 2 },{ 1, 2, -4 },{ -3, -4, 3 },{ 2, 0, 1 },{ -2, 1, -2 },{ -4, 3, -4 },{ 1, -3, -1 },{ 2, -1, -3 },{ 2, 1, -1 },{ 0, -3, 1 },{ -3, 0, -2 },{ 2, -2, 2 },{ -4, -1, 2 },{ -1, 0, 3 },{ -3, 1, 0 },{ 0, -1, -2 },{ 2, 3, -2 },{ -2, -1, 1 },{ -4, 2, 3 },{ 0, 3, -2 },{ 2, 0, -1 },{ -4, 1, -4 },{ -1, 3, -3 },{ -2, -4, -2 },{ 1, -1, 2 },{ 0, 1, -1 },{ -1, 1, 0 },{ -2, -1, -4 },{ 2, -1, 3 },{ -1, 1, 1 },{ 0, -2, -1 },{ -4, -3, 3 },{ -2, -4, -2 },{ -3, 3, 2 },{ 2, -2, -4 },{ -1, -1, -3 },{ -4, -4, 0 },{ 1, 0, 3 },{ 3, -1, 1 },{ -2, 2, -2 },{ 2, -4, 2 },{ 3, 1, -2 },{ -2, -3, 0 },{ 1, -1, 1 },{ -2, -2, -3 },{ -3, 2, 1 },{ 3, 3, -1 },{ 0, -3, 0 },{ -2, -4, -1 },{ 1, -2, 1 },{ -4, -1, 0 },{ 1, -3, 2 },{ -3, 3, -4 },{ -2, 0, -3 } }, - { { 3, -1, -1 },{ 0, -2, 1 },{ 1, 0, -4 },{ -4, -4, -1 },{ -2, 3, 3 },{ 1, -2, 0 },{ -1, 0, 2 },{ 3, -3, -3 },{ -4, -2, -1 },{ -2, 1, 3 },{ 2, -3, -2 },{ 0, 0, 0 },{ -3, -2, -3 },{ -1, -3, 2 },{ 3, 3, 0 },{ -1, -3, 1 },{ 1, -2, 3 },{ -3, 0, 0 },{ -1, -4, -4 },{ -1, 2, -2 },{ 3, -2, 0 },{ -1, 3, -4 },{ 0, -4, -1 },{ -2, -3, -3 },{ 2, 3, -4 },{ -4, -4, 2 },{ 0, 0, -4 },{ 1, -3, 0 },{ 2, 3, -3 },{ -1, -1, -1 },{ 3, -3, 1 },{ -3, -1, 1 },{ 2, 0, 0 },{ -4, 1, 3 },{ 3, -1, 1 },{ 1, -3, -4 },{ -3, -2, 3 },{ 2, -4, -2 },{ -3, 2, 0 },{ -4, -3, -3 },{ 3, 2, 0 },{ 2, 1, -4 },{ 0, -1, 0 },{ 3, 1, -1 },{ -2, 0, 1 },{ 1, -3, 1 },{ 3, 2, -1 },{ -1, 0, 2 },{ 2, -4, -4 },{ -4, 3, -1 },{ 1, 1, -3 },{ -1, -2, -4 },{ -4, 3, 1 },{ 0, -3, 2 },{ 3, 0, -2 },{ -2, -4, 3 },{ -3, -1, -4 },{ -1, 1, -2 },{ 2, 0, 3 },{ -1, 1, -4 },{ 0, 2, 0 },{ 3, 1, 1 },{ 1, -3, -2 },{ -4, -4, 0 } }, - { { -1, 1, 3 },{ -1, -4, -4 },{ 2, 1, -3 },{ 0, -1, 1 },{ 2, 3, -3 },{ -4, -3, -1 },{ -2, 2, -2 },{ 0, -4, 2 },{ -1, 3, 0 },{ 2, -4, -4 },{ 0, 0, 2 },{ -1, -3, -1 },{ -4, 2, -1 },{ 1, -1, 3 },{ 2, -4, -4 },{ -2, 2, -2 },{ 0, 1, 2 },{ 3, 2, 1 },{ -2, -1, -3 },{ -4, -2, 2 },{ 1, 1, 3 },{ -2, 0, -3 },{ 3, 2, 1 },{ -3, -1, -1 },{ 3, 2, 0 },{ -1, 0, 2 },{ -2, 1, -2 },{ -3, -3, 3 },{ 3, 1, 2 },{ -4, -4, -4 },{ 0, -2, 3 },{ -2, 2, 0 },{ 1, -4, 2 },{ 0, -3, -3 },{ -2, 3, -1 },{ -1, 0, -4 },{ 3, 3, 2 },{ 0, 2, -3 },{ 1, -3, 2 },{ 3, 0, 3 },{ -2, -4, -2 },{ -3, 3, 2 },{ 1, 0, 1 },{ -2, -4, -3 },{ 0, 3, -3 },{ -3, -2, 3 },{ -4, 3, -4 },{ 0, 1, -2 },{ -2, -2, 3 },{ 0, -3, 1 },{ -3, -2, 0 },{ -1, -1, 3 },{ 1, -4, -1 },{ 2, 2, -3 },{ -4, 1, 0 },{ 0, 0, 2 },{ 1, -2, -1 },{ 3, 3, 1 },{ -3, -1, 2 },{ -4, -4, -2 },{ 2, -1, 3 },{ -3, -2, -3 },{ -1, 3, -4 },{ 1, 2, 2 } }, - { { -3, -2, -1 },{ -2, 3, 3 },{ -4, -3, -1 },{ -3, 2, 2 },{ 1, 0, 2 },{ 3, -2, -4 },{ -1, 1, 3 },{ 2, 0, -2 },{ 1, 1, 1 },{ -3, -1, -3 },{ -2, 3, 0 },{ 3, 1, -4 },{ 3, 2, 1 },{ 0, -2, -3 },{ -4, 1, 1 },{ -3, -1, -3 },{ 0, -3, 0 },{ -4, 3, -1 },{ 2, -2, -2 },{ 1, 1, 1 },{ -3, -4, 0 },{ -4, 3, -4 },{ 2, -3, 3 },{ 1, 1, -2 },{ 0, -2, 3 },{ 1, -4, -1 },{ 2, 2, 0 },{ -1, -2, -3 },{ -2, -1, 0 },{ 1, 0, -2 },{ -3, 2, -2 },{ 0, 0, -4 },{ 3, -2, -3 },{ -4, 1, -2 },{ -1, 2, 2 },{ -3, -2, 0 },{ -4, -4, 1 },{ -2, 1, 0 },{ 0, -1, -1 },{ -1, 3, -4 },{ -1, -2, -1 },{ -4, -1, -3 },{ 1, 2, 3 },{ -4, -3, -1 },{ 2, 1, 3 },{ 2, -1, -1 },{ -2, -4, 0 },{ 2, -1, 1 },{ -3, 2, -3 },{ 3, 0, -1 },{ 2, 2, 2 },{ -3, 3, -2 },{ 3, 0, 1 },{ -3, -4, -4 },{ -1, 3, 0 },{ 2, 2, -4 },{ 2, -3, 0 },{ -2, 2, -3 },{ 0, -3, 0 },{ -1, 3, -4 },{ -2, -4, -1 },{ 2, 0, 2 },{ -4, 0, 1 },{ 2, -3, 0 } }, - { { 0, -1, -3 },{ 2, 2, -2 },{ 3, 0, 1 },{ -1, -1, -3 },{ 0, -4, -2 },{ -3, -2, 0 },{ -2, -1, 1 },{ -4, 3, -4 },{ 2, -2, -1 },{ -4, -3, 3 },{ -1, -1, 1 },{ -3, -4, 3 },{ 1, -3, -2 },{ -1, 3, 0 },{ -2, 0, -1 },{ 2, -4, -2 },{ 3, -2, 3 },{ -3, 0, -4 },{ 0, -4, 3 },{ -1, 3, -2 },{ 3, -3, -1 },{ 1, -2, 2 },{ -1, 0, 0 },{ -3, -4, 1 },{ -4, 3, -4 },{ -2, -2, -3 },{ -4, 0, 1 },{ 0, -3, -1 },{ 3, 3, 3 },{ -4, -4, 1 },{ 1, 3, 0 },{ -2, -3, 3 },{ 2, 3, -1 },{ 2, -4, 0 },{ 1, 0, 3 },{ 3, -1, -4 },{ 2, -3, -1 },{ 1, 0, -2 },{ -3, -2, 3 },{ -2, 1, -3 },{ 1, -4, 1 },{ 2, 0, 0 },{ 3, -2, -4 },{ -1, -2, -2 },{ -3, 2, 0 },{ -1, 0, -2 },{ 3, -3, 2 },{ 1, 3, -3 },{ -4, -4, -2 },{ -1, -1, -4 },{ 1, -3, 2 },{ -2, 1, -4 },{ 0, -1, -1 },{ 1, -3, 2 },{ -3, -2, 3 },{ -2, -1, -2 },{ -4, -4, 2 },{ -3, 1, -3 },{ 3, 0, 3 },{ 1, -1, 1 },{ -3, 1, -3 },{ 3, -3, 0 },{ 0, 2, -3 },{ -2, -1, -2 } }, - { { 3, -4, 2 },{ 1, -2, -4 },{ -2, 1, 0 },{ -4, -4, -1 },{ 2, 2, 3 },{ 3, 3, -3 },{ 0, -3, 2 },{ -1, 2, -1 },{ 3, -4, -3 },{ -2, 0, 0 },{ 1, 2, -4 },{ 2, 1, -2 },{ -3, 0, 2 },{ -4, -1, 1 },{ 1, 1, 3 },{ 2, 3, 2 },{ -1, 2, -3 },{ -1, 1, 1 },{ 1, -1, 0 },{ -3, 2, -4 },{ 0, 0, 1 },{ -2, -1, -3 },{ -2, 2, -3 },{ -1, 1, -2 },{ 3, -1, 1 },{ 1, -3, 2 },{ 2, 3, 3 },{ -3, -1, -2 },{ 1, 2, -4 },{ 2, 1, -3 },{ -1, -2, -1 },{ -1, -1, 2 },{ -4, -1, 1 },{ -3, 2, -3 },{ -2, -3, 2 },{ 0, 1, -1 },{ -2, 2, -3 },{ -4, 3, 3 },{ 2, -4, -4 },{ 3, 2, 1 },{ -4, -3, 0 },{ 0, 2, 2 },{ -3, 3, 2 },{ 0, -1, -3 },{ 1, -4, 2 },{ -2, 1, -4 },{ -1, 0, 0 },{ 0, 2, 2 },{ -3, 0, 3 },{ 1, 1, 0 },{ -2, -4, 1 },{ 3, -2, -2 },{ -4, 1, 0 },{ -1, 2, -2 },{ 3, 1, -3 },{ 1, -3, 1 },{ -1, 1, -1 },{ -4, -2, 3 },{ 0, 2, -4 },{ 1, -2, -1 },{ -1, 3, -2 },{ -2, -2, 3 },{ 1, -4, 0 },{ -3, 3, 3 } }, - { { -1, 1, 1 },{ -3, -3, 1 },{ 0, 3, 3 },{ -1, 0, -4 },{ -2, -2, 0 },{ -4, 1, -1 },{ 1, 0, 1 },{ -3, -4, 3 },{ 2, 1, -2 },{ -1, 3, 2 },{ 1, -2, -3 },{ 0, 2, -1 },{ -2, -4, -1 },{ -1, -2, -4 },{ 3, -3, -4 },{ -3, -1, -2 },{ -2, -2, -1 },{ -4, -4, -3 },{ 3, 2, 2 },{ -2, -1, -1 },{ 2, -3, 2 },{ 2, 3, 3 },{ -4, -2, -1 },{ 3, -3, 3 },{ -3, 1, -3 },{ 2, 2, 0 },{ -1, 0, -4 },{ -2, -4, 2 },{ 0, -3, 0 },{ -3, 0, 2 },{ 3, -4, 1 },{ -3, 1, -4 },{ 1, 0, -2 },{ -1, -3, -4 },{ 3, 3, 0 },{ -4, -1, -2 },{ 1, 3, 1 },{ -1, -3, 2 },{ 0, 0, 0 },{ 2, -1, -2 },{ -2, 3, -3 },{ -2, 0, -1 },{ 2, -3, -4 },{ -2, 1, -1 },{ 3, 3, 1 },{ -4, -3, 3 },{ 1, -2, -1 },{ -4, -4, -4 },{ 3, -2, 1 },{ 0, 2, -2 },{ -4, 3, 3 },{ -3, -1, -3 },{ 2, 3, 3 },{ -1, -4, 1 },{ -4, 0, -4 },{ 0, 0, 0 },{ 3, 3, -3 },{ 2, -1, -2 },{ -1, -4, 0 },{ -3, 1, 2 },{ -4, -3, 1 },{ 0, 2, -4 },{ 3, 0, -2 },{ -4, 1, -1 } }, - { { 2, -3, -2 },{ -4, 0, -3 },{ 1, 2, 0 },{ 2, -4, -2 },{ 1, -1, 3 },{ -1, -1, -3 },{ 0, -3, -2 },{ 1, 2, -4 },{ -4, -1, 0 },{ -3, -3, 2 },{ 3, -3, 1 },{ -4, -1, 3 },{ 3, 3, 2 },{ 0, 1, -3 },{ 2, 3, 0 },{ 0, -3, 3 },{ 1, 0, 0 },{ 0, 3, 1 },{ 2, -3, 3 },{ -3, -4, -2 },{ -4, -2, -3 },{ 0, 1, 0 },{ 0, -4, -4 },{ 1, -1, -1 },{ -2, 0, 1 },{ 0, -2, -3 },{ -4, -3, -2 },{ 3, 2, -1 },{ -2, -1, -2 },{ -4, 0, -3 },{ 0, 3, 3 },{ 3, -4, -2 },{ 0, 2, 0 },{ 1, -2, 2 },{ -2, 1, 1 },{ 2, -4, 3 },{ 3, -2, -4 },{ -3, -4, -1 },{ -1, 1, 2 },{ -3, -2, -2 },{ 0, -1, 3 },{ 3, -4, 1 },{ 1, -2, 3 },{ -4, -4, -2 },{ 2, -1, 0 },{ -3, -1, -3 },{ 0, 2, -2 },{ 2, 3, -1 },{ -1, -2, 1 },{ -2, 0, -3 },{ 2, -3, -1 },{ 0, 0, -4 },{ 1, -3, 2 },{ -2, -2, -1 },{ 2, 3, 2 },{ -3, -4, 3 },{ 0, 2, 1 },{ -2, -3, -1 },{ 2, -1, 2 },{ 3, 3, -3 },{ -1, 0, -2 },{ 2, -1, 3 },{ 1, -2, 2 },{ -1, 2, -4 } }, - { { 3, -1, -3 },{ -2, -2, 3 },{ -3, -1, -4 },{ 3, -3, -1 },{ -4, 3, 2 },{ -2, 2, 2 },{ 3, -2, 0 },{ 2, 1, -1 },{ -3, 3, 1 },{ 0, 0, -4 },{ -1, -2, -3 },{ -3, -4, -1 },{ 2, 0, -2 },{ -4, -1, 1 },{ -2, 2, 2 },{ -3, -4, -2 },{ -4, 1, -4 },{ 3, -1, -3 },{ -1, 1, -1 },{ -2, 3, 0 },{ -1, 0, -4 },{ 3, 2, 1 },{ -2, 3, 3 },{ -4, 0, -2 },{ 2, 3, 2 },{ 0, -4, 2 },{ -3, 1, 0 },{ 3, 3, 3 },{ 2, 1, 1 },{ 1, -2, -1 },{ -2, 2, 0 },{ 2, -3, -3 },{ -4, 1, 3 },{ -2, -4, -1 },{ -1, 0, -3 },{ -4, 2, -2 },{ 0, -1, 0 },{ 1, 1, -1 },{ -2, 0, -4 },{ 3, 3, -3 },{ -4, 1, 2 },{ 0, 1, -4 },{ -3, 2, -1 },{ -1, 2, 2 },{ 0, 0, 1 },{ -1, -4, -4 },{ 3, 1, 3 },{ -3, 0, 2 },{ -2, -1, -4 },{ 3, -4, 2 },{ 1, 1, 0 },{ -1, 2, 0 },{ 3, 2, 1 },{ -2, -1, -3 },{ 3, 0, -1 },{ -4, -2, -2 },{ -1, -3, -4 },{ 1, 1, 2 },{ -4, 2, 0 },{ 1, -2, -4 },{ -2, -4, -1 },{ -3, -3, 1 },{ -3, 3, 0 },{ 0, -4, 2 } }, - { { 0, 0, 0 },{ 2, 3, 1 },{ 0, -4, 2 },{ -2, 1, 1 },{ 2, 2, -2 },{ -3, -4, -4 },{ 0, -2, -1 },{ -2, -1, 3 },{ -1, -4, 2 },{ 3, 1, -2 },{ 2, 2, 3 },{ 1, 3, 0 },{ -1, -2, -4 },{ -2, 1, 1 },{ 3, -2, 3 },{ -1, 0, -1 },{ 2, -3, -2 },{ -2, -2, 1 },{ 0, 0, 3 },{ 3, -3, -2 },{ 1, -1, 1 },{ 1, -1, 2 },{ -3, -3, -1 },{ -1, -3, -3 },{ 3, -2, 0 },{ -4, 2, -4 },{ -1, -1, -3 },{ 1, -2, 1 },{ -3, -4, -4 },{ -1, -1, 2 },{ -3, -3, -2 },{ -1, -1, 1 },{ 1, 3, 1 },{ -3, -1, -4 },{ 3, -3, -1 },{ 0, 3, 1 },{ -4, 0, 3 },{ 2, 2, -3 },{ -3, -3, 3 },{ 1, -4, 0 },{ 2, -3, 1 },{ -1, -1, -4 },{ -3, -2, -2 },{ 3, 0, -1 },{ 2, 3, -3 },{ -2, -2, 0 },{ 1, -3, 1 },{ -4, 2, 0 },{ 0, -3, -3 },{ -4, 3, -2 },{ -3, -2, 3 },{ -3, -1, -2 },{ -4, -2, -3 },{ -1, -3, -4 },{ 1, 3, 3 },{ 1, 1, -3 },{ -3, -4, 0 },{ -2, 3, 3 },{ 3, 0, -3 },{ -3, -2, -1 },{ 0, 3, 3 },{ 2, 1, -3 },{ -2, 0, -3 },{ -4, 2, -1 } }, - { { -3, -1, -1 },{ -1, 3, -2 },{ -4, 1, -4 },{ 0, -2, 0 },{ -1, 0, -3 },{ -4, 0, 1 },{ 1, 3, -3 },{ 3, 0, -2 },{ -4, -2, -3 },{ -2, -3, -4 },{ 1, 1, 0 },{ -4, 0, 2 },{ -2, -3, -3 },{ 0, -3, -2 },{ 1, -4, -3 },{ 0, 3, 0 },{ 1, 2, 3 },{ -4, 2, 0 },{ -2, 1, -4 },{ -3, 3, 2 },{ -4, -4, -3 },{ 2, 2, -4 },{ -1, 0, -2 },{ 0, 1, 1 },{ -3, -4, 3 },{ 1, 0, -2 },{ 2, 3, -1 },{ -2, -3, 3 },{ -4, 2, -3 },{ 1, 1, 0 },{ 3, 0, 2 },{ -4, -2, -4 },{ 2, 2, -1 },{ 0, -2, 3 },{ 2, 1, -3 },{ -2, -2, 0 },{ -2, -3, 2 },{ 3, -1, -4 },{ 0, -2, 1 },{ -4, 2, -1 },{ -2, 3, 3 },{ 1, 0, -2 },{ 2, -3, 0 },{ -4, 3, 2 },{ -2, 1, 3 },{ -3, -4, -3 },{ 3, 3, -2 },{ 0, 0, 2 },{ 1, -4, 1 },{ -1, 0, -1 },{ 2, 2, -4 },{ 2, -4, 1 },{ 0, 1, 3 },{ 3, -4, 0 },{ -2, 2, 1 },{ 0, 0, -1 },{ 2, -2, 1 },{ 3, -1, -3 },{ -1, -4, 2 },{ -4, -1, -2 },{ 1, 1, 0 },{ 3, -2, 2 },{ 1, -4, -2 },{ 3, -2, 3 } }, - { { 1, -4, -4 },{ 2, -3, 3 },{ -3, -3, -2 },{ 3, -1, -1 },{ 1, 3, 3 },{ 2, -4, 3 },{ -3, -3, 0 },{ 0, 2, 2 },{ 2, 3, 3 },{ -1, -3, 1 },{ -3, -1, 1 },{ 0, -4, -1 },{ 3, 2, 3 },{ 2, 0, 0 },{ -4, 2, -4 },{ -3, -1, 2 },{ -3, -1, -4 },{ 2, -4, 1 },{ 1, -2, -1 },{ 0, -3, 2 },{ 3, 1, -1 },{ -2, -2, 0 },{ -4, -2, 3 },{ 2, 3, -4 },{ 1, 1, 1 },{ -1, -3, -2 },{ -3, 0, 0 },{ 0, -1, 1 },{ 3, -4, -2 },{ 0, 3, -4 },{ -1, 2, 3 },{ 2, -4, -3 },{ -2, 3, 2 },{ -3, -4, -2 },{ 3, 1, 2 },{ -1, 0, -4 },{ 1, -4, -2 },{ 2, 3, 0 },{ -1, 1, -2 },{ -1, 0, 2 },{ 3, -1, -2 },{ -2, 2, 0 },{ 0, -4, -3 },{ 1, -1, 3 },{ -1, -3, -4 },{ -3, -1, -1 },{ 2, -1, -2 },{ -1, 2, -4 },{ -2, -2, 3 },{ 3, 1, 0 },{ 0, -1, 2 },{ -2, 1, -2 },{ 1, 3, 0 },{ -3, 0, -2 },{ -3, -1, 2 },{ -4, -2, -2 },{ 1, 2, -4 },{ -2, 1, -1 },{ 0, 0, 2 },{ 0, 2, -4 },{ -4, -3, 1 },{ -1, 1, -1 },{ -3, -1, -4 },{ -1, 2, 2 } }, - { { -2, -2, 0 },{ 3, 0, 1 },{ -2, 2, -3 },{ 1, 2, 2 },{ -3, -2, -1 },{ -2, -3, -2 },{ -1, 1, -4 },{ -4, -1, 0 },{ 1, 0, -1 },{ -3, 2, -4 },{ 2, 3, -2 },{ -2, -1, -3 },{ -4, 1, -1 },{ 2, -2, 2 },{ -1, 0, 1 },{ -1, 1, -2 },{ 3, -4, 3 },{ 3, 3, -2 },{ -1, 0, -3 },{ -3, -1, -3 },{ 1, 2, 3 },{ 0, 3, -2 },{ -2, -4, 2 },{ 3, -1, -3 },{ -2, 1, 0 },{ -2, 3, 2 },{ -4, -2, -4 },{ 2, 2, 2 },{ -1, 1, -1 },{ -4, -2, 0 },{ -3, -3, 1 },{ -2, 1, -2 },{ 0, 0, -1 },{ 1, -3, 1 },{ -3, -2, 0 },{ -4, 2, 3 },{ -3, 3, 1 },{ -2, -2, -3 },{ -4, 1, 2 },{ -3, -3, -3 },{ 1, -4, -4 },{ -3, -2, 1 },{ 3, 2, 2 },{ -4, 1, -1 },{ 0, -2, 0 },{ 2, 1, 1 },{ 0, 0, 2 },{ -4, -2, 0 },{ 2, 3, -3 },{ -3, -3, -3 },{ -2, 3, -1 },{ -4, -2, 2 },{ 2, -3, -3 },{ 2, 2, -4 },{ -1, -3, -1 },{ 3, 1, 3 },{ -4, -4, 0 },{ -1, -3, 1 },{ -3, 3, 3 },{ 2, -4, -2 },{ 2, -2, 0 },{ -2, 3, -3 },{ -4, 0, 3 },{ 2, 3, -2 } }, - { { -4, 1, -3 },{ -1, -1, -1 },{ -4, 0, 2 },{ -1, -4, 1 },{ 2, 1, -4 },{ 0, -1, -2 },{ 2, 3, 1 },{ 3, -4, -3 },{ -2, -4, 2 },{ 3, -2, 0 },{ 0, -3, 3 },{ 3, 0, 2 },{ -1, -4, -4 },{ -3, 3, 0 },{ 2, -3, -3 },{ -2, -3, -3 },{ 0, -2, -1 },{ -4, 0, 2 },{ -2, 2, 0 },{ -4, -1, 1 },{ 2, -3, -4 },{ -1, 1, -1 },{ -3, 0, 1 },{ 2, -3, -4 },{ -4, -1, -1 },{ 0, -4, 3 },{ 3, -3, 1 },{ 1, 0, -4 },{ -2, -4, 3 },{ 2, -1, -3 },{ 1, -2, 0 },{ 3, -1, -4 },{ -4, 0, 3 },{ 1, 2, -3 },{ -1, -1, -4 },{ 0, -3, -1 },{ 3, 0, -1 },{ 0, -1, 0 },{ 1, -4, 3 },{ 2, 3, -1 },{ 2, 0, 0 },{ -1, -1, 3 },{ -3, 1, -3 },{ -2, -3, -4 },{ 3, 3, -2 },{ -2, -3, 3 },{ -1, 1, -3 },{ 3, -4, 2 },{ -4, -1, 1 },{ 0, 0, -2 },{ 1, -3, 3 },{ -1, 0, -4 },{ -4, -4, 3 },{ 0, -1, 0 },{ -1, 3, 2 },{ 2, -1, -3 },{ 0, 2, 1 },{ 2, -2, -3 },{ 3, 0, -1 },{ -2, -3, -4 },{ 1, -1, -1 },{ 3, 2, 2 },{ 0, -4, 1 },{ 0, -3, 0 } }, - { { 2, 1, 3 },{ 0, 3, -2 },{ 1, -4, -4 },{ 3, 3, 0 },{ -2, 1, 3 },{ -4, -2, -3 },{ -3, 2, 1 },{ -1, 0, -1 },{ -2, 0, -3 },{ -4, 1, -2 },{ 1, 3, 1 },{ -4, 2, -1 },{ 1, -2, -2 },{ -2, -1, 1 },{ 1, 3, 3 },{ -4, 1, 2 },{ 1, -1, -1 },{ 0, 3, -4 },{ 1, -4, 2 },{ 3, -2, 0 },{ -1, 3, -2 },{ 3, -4, 3 },{ 0, 0, 0 },{ 1, 2, 2 },{ -1, 2, -1 },{ 2, -1, -3 },{ -3, 3, 0 },{ -1, 2, -2 },{ 0, 3, -1 },{ -4, 0, 1 },{ 0, 2, 3 },{ -2, -3, -1 },{ 3, 2, 2 },{ 2, -4, -2 },{ -1, 3, 2 },{ 2, 1, -2 },{ 3, 2, 3 },{ -3, -2, -4 },{ 1, -3, -3 },{ -2, 2, 1 },{ -4, 3, 2 },{ 0, -4, -2 },{ 2, 2, -1 },{ -1, 0, 1 },{ 1, 3, 2 },{ -3, -4, -1 },{ 1, 2, -4 },{ -3, 3, -2 },{ 0, -4, 2 },{ 3, 2, -1 },{ 2, -1, 1 },{ 3, 2, 0 },{ 1, -2, -1 },{ -2, 1, 1 },{ -3, 2, -3 },{ -2, -2, 0 },{ 1, 0, -2 },{ -3, 3, 2 },{ -1, 2, 0 },{ -4, -1, 2 },{ -1, 1, 3 },{ -3, 1, -3 },{ -2, -4, -2 },{ 3, -1, -4 } }, - { { 1, 0, 2 },{ -3, -3, 1 },{ -3, -2, -1 },{ 1, 0, 2 },{ 0, -3, -2 },{ 3, -3, 3 },{ 1, -1, 0 },{ 2, 3, 2 },{ 0, -2, 3 },{ -1, -3, -4 },{ -3, -1, -3 },{ -2, -4, 3 },{ 0, -2, -4 },{ 3, 2, 0 },{ -1, -4, -3 },{ 3, -2, 0 },{ -3, 2, 1 },{ 2, -3, -4 },{ -2, 1, 3 },{ -3, -3, -1 },{ 0, 0, -2 },{ -4, -2, -4 },{ -3, 3, -3 },{ -4, -2, -2 },{ 3, -4, 3 },{ -3, 1, -3 },{ 0, -3, 2 },{ 2, -2, -2 },{ -3, -3, 2 },{ 3, -4, -3 },{ 2, 1, -4 },{ -1, 3, -2 },{ -2, 1, 1 },{ -3, -2, 0 },{ -4, -1, -3 },{ -2, -3, 0 },{ -3, -4, 1 },{ -1, 2, 1 },{ -4, 0, -2 },{ 3, 1, -1 },{ -2, -2, -4 },{ 0, -3, -3 },{ 3, 0, 0 },{ -4, -4, 3 },{ 3, -1, -3 },{ 0, -2, 0 },{ -4, -1, 3 },{ 1, 0, -3 },{ -2, -2, -1 },{ -1, 1, -4 },{ -3, 1, 1 },{ -3, 3, -3 },{ 0, -4, -2 },{ 3, 0, 2 },{ -2, -3, -1 },{ 2, -4, -4 },{ -4, -1, 3 },{ 1, -4, -2 },{ 3, 1, -4 },{ -3, -4, 0 },{ 1, 3, -2 },{ 1, -2, 1 },{ -4, -2, 1 },{ -3, 3, 0 } }, - { { -1, 2, 3 },{ 3, -2, -4 },{ 0, 1, -1 },{ -3, -1, -3 },{ -1, 2, -3 },{ -4, 0, -1 },{ -2, 1, -4 },{ 1, -4, -2 },{ -4, -2, -1 },{ 3, 2, 2 },{ 2, 1, 0 },{ 2, 0, 2 },{ 0, 1, -1 },{ -3, 0, -2 },{ -4, -1, -4 },{ 2, 1, -2 },{ -1, -4, 2 },{ -4, 0, -2 },{ -1, 3, -3 },{ 1, 2, 1 },{ 2, 1, 3 },{ -2, -3, 2 },{ -1, 1, 0 },{ 2, -1, 1 },{ -2, -2, -4 },{ -1, 1, -1 },{ 1, -1, 1 },{ -4, 0, -4 },{ -2, 1, 0 },{ 0, -1, 3 },{ -3, -2, 1 },{ -4, -3, 0 },{ 1, 0, -4 },{ 0, -4, 3 },{ -1, -1, 2 },{ 1, 2, -2 },{ 2, 0, -3 },{ 0, -2, 2 },{ 0, 3, -4 },{ -3, -4, 3 },{ 2, -1, 2 },{ -3, -2, -1 },{ 1, 2, 1 },{ -2, -3, -4 },{ -1, 1, -2 },{ -3, 0, 1 },{ 2, 1, 0 },{ 3, -3, 1 },{ -4, 2, -4 },{ 1, -2, 2 },{ -2, -3, 3 },{ -4, -3, -3 },{ -1, -1, 2 },{ 2, -2, -4 },{ -3, 3, 1 },{ 0, 1, -1 },{ 3, -3, 3 },{ -2, 3, -3 },{ 0, -2, 1 },{ -1, -3, -3 },{ 2, 0, 3 },{ 0, -3, -4 },{ 3, 2, -1 },{ -2, -1, -3 } }, - { { 2, -4, -2 },{ -4, 3, 0 },{ -2, 2, 3 },{ 2, -2, 2 },{ 2, -4, 1 },{ -1, 1, 1 },{ 3, 2, 2 },{ -3, -3, 1 },{ -1, -1, -4 },{ 2, 3, 1 },{ -3, -4, 0 },{ -4, -2, -3 },{ -1, 3, 3 },{ 2, -3, 1 },{ -2, 2, 2 },{ 0, 3, 0 },{ 0, 0, 3 },{ 3, -2, -1 },{ -2, -4, -3 },{ 3, -1, 1 },{ -3, -4, -4 },{ 1, 0, -1 },{ 3, 3, -1 },{ 0, -4, 3 },{ 1, 2, 1 },{ -4, 3, 0 },{ 3, -4, 3 },{ 1, 2, -3 },{ -1, -4, 0 },{ 3, 3, -3 },{ 1, 0, -1 },{ 0, -1, 2 },{ 2, 2, -2 },{ 3, -3, -1 },{ 0, 3, -4 },{ 3, 1, 1 },{ -3, 0, -2 },{ -2, -1, 0 },{ 3, -3, -1 },{ -1, 1, 1 },{ 1, 0, -2 },{ -4, 3, 0 },{ 2, 1, 2 },{ -4, 3, -2 },{ 0, -2, 2 },{ 2, 3, -1 },{ -1, -3, -3 },{ -1, 0, 3 },{ -2, 3, -2 },{ 2, -4, 0 },{ 3, -1, -1 },{ 0, 3, 0 },{ 2, 2, -2 },{ 1, 0, 3 },{ -4, 2, 0 },{ 0, 1, -2 },{ -1, -2, 1 },{ -4, 0, 0 },{ -2, 2, 2 },{ 3, -1, -1 },{ -4, 3, 0 },{ -2, 0, 3 },{ -1, 2, 0 },{ 0, -4, -2 } }, - { { -4, -3, 1 },{ 1, -1, -4 },{ -1, 0, -1 },{ 1, -4, -3 },{ -4, 3, 0 },{ 0, -1, -4 },{ 1, -3, -2 },{ -2, 3, -1 },{ 0, 0, 3 },{ -2, 1, -2 },{ 1, -1, -2 },{ -1, -3, -4 },{ 1, 2, -2 },{ 3, -4, 3 },{ 1, -1, -1 },{ -3, -3, -3 },{ -2, -2, 0 },{ 1, 2, 1 },{ -4, -1, 2 },{ 0, 1, 0 },{ -1, -2, 2 },{ -4, 2, -2 },{ -2, -1, -4 },{ -4, 0, -3 },{ 2, -3, -3 },{ -1, 0, 2 },{ 0, 0, -2 },{ -3, -2, 2 },{ -2, 1, -1 },{ -4, -3, 3 },{ -1, 2, -2 },{ -3, -4, -3 },{ -2, 3, 3 },{ -2, 1, -3 },{ -4, -1, 1 },{ 1, -4, -1 },{ -4, -2, 3 },{ 2, 3, 3 },{ -1, -3, -3 },{ -4, 2, -2 },{ 3, -2, 3 },{ -1, -4, -3 },{ 0, -1, -1 },{ -2, -4, -4 },{ 3, -1, 3 },{ -2, 2, 1 },{ -4, -4, -4 },{ 1, -1, -2 },{ -3, 2, 2 },{ 0, -1, -4 },{ 1, 1, -2 },{ -2, 0, 2 },{ -4, -4, 0 },{ -2, -3, -4 },{ 3, -3, 2 },{ -1, -1, -3 },{ 2, -4, -1 },{ 2, 0, -4 },{ 1, 1, 3 },{ -3, -4, -2 },{ 1, 1, -3 },{ 2, -3, -4 },{ -3, -1, 2 },{ 3, 1, -1 } }, - { { 0, 0, 3 },{ -2, -3, 2 },{ -3, 1, -2 },{ 3, 0, 0 },{ -2, -3, 3 },{ -3, 2, -2 },{ -1, -2, 2 },{ 2, -1, 0 },{ 3, -4, -3 },{ -4, -3, 3 },{ 0, 3, 2 },{ 3, 1, 1 },{ -3, -1, 0 },{ -4, -2, -3 },{ 0, 1, -4 },{ -1, -4, 1 },{ 2, 1, -3 },{ -4, 3, -4 },{ 1, -3, -1 },{ -1, 3, -4 },{ 2, 2, -2 },{ 3, -3, 3 },{ 0, -4, 1 },{ -3, 3, 3 },{ 1, -2, -2 },{ -3, 1, -1 },{ -2, -3, -4 },{ 2, 2, 1 },{ 2, -1, -4 },{ 3, 0, 0 },{ 0, -3, 1 },{ 2, 1, 2 },{ 3, -2, 0 },{ -3, 0, -4 },{ -1, -3, 2 },{ 2, 3, 0 },{ 3, -4, -4 },{ -2, 1, -3 },{ 1, 1, 1 },{ 0, 0, 2 },{ -2, -3, -4 },{ -3, 2, 1 },{ 1, 0, 0 },{ 3, -2, 0 },{ -3, -3, -3 },{ 1, 2, -1 },{ 0, -2, 3 },{ 3, -3, 0 },{ -4, 1, 1 },{ 2, -2, -1 },{ -3, -4, 3 },{ -1, 2, -4 },{ 0, 1, 1 },{ 2, -1, -1 },{ -2, 3, -3 },{ -3, 1, -1 },{ -3, 3, 1 },{ 0, 2, -2 },{ -2, -2, -4 },{ -1, -1, 2 },{ 3, 3, 0 },{ -3, -2, -1 },{ -2, 2, 2 },{ 1, 1, -3 } }, - { { -1, 2, 0 },{ 0, 3, -4 },{ 2, -2, 3 },{ -1, -1, -4 },{ 2, 3, -3 },{ -4, 1, 2 },{ 3, 0, -3 },{ -4, 2, -4 },{ -3, 2, 1 },{ 2, -2, -1 },{ -3, -2, -4 },{ -1, 0, -1 },{ -2, -4, 2 },{ -4, 0, 1 },{ 2, 3, -2 },{ -2, 0, 3 },{ 3, -2, 2 },{ -3, -3, -2 },{ 3, 0, 3 },{ -2, -4, 1 },{ -3, -2, -3 },{ 0, 1, 0 },{ -2, -1, -1 },{ -1, 2, 1 },{ 2, -4, -3 },{ 0, -1, 0 },{ 3, 3, -2 },{ 0, -4, 1 },{ -4, 0, 2 },{ -1, 3, -3 },{ -3, -1, -4 },{ -4, -2, 0 },{ 1, -4, -1 },{ 1, 2, 1 },{ 0, -1, -2 },{ -1, -3, -3 },{ -3, 2, 2 },{ -1, -2, -1 },{ -4, -1, 0 },{ 3, -4, -2 },{ 2, 3, -4 },{ -2, -3, 2 },{ 2, 2, 3 },{ -4, 0, -3 },{ 0, 1, 2 },{ -1, -2, 0 },{ -2, 1, -4 },{ 3, 0, -3 },{ -1, 2, 2 },{ -2, 3, -1 },{ 0, -1, -3 },{ 3, -3, 1 },{ -3, -2, 3 },{ 1, 2, -2 },{ 1, -1, 1 },{ 0, -2, 3 },{ 3, -3, 2 },{ -4, -4, 0 },{ 2, -2, 3 },{ -4, -3, 1 },{ -1, 0, -2 },{ 0, -4, 1 },{ 2, -2, 1 },{ -3, -1, -3 } }, - { { 3, -4, -1 },{ -4, -2, -1 },{ 3, -4, 0 },{ -2, 1, 1 },{ 0, -3, -1 },{ 1, -4, 1 },{ -1, -2, 3 },{ 0, -4, -1 },{ 1, 1, 0 },{ -1, 3, -2 },{ 3, -1, 2 },{ 0, 2, -3 },{ 1, 3, 0 },{ 2, -3, -1 },{ 0, 2, -3 },{ 1, -1, 0 },{ -4, 0, 1 },{ 0, 2, -1 },{ -2, 1, 0 },{ 2, -1, 2 },{ 1, 0, -2 },{ -4, 3, 2 },{ 1, -3, -4 },{ 3, 1, -2 },{ -2, 1, 2 },{ -1, -2, 3 },{ -4, -1, 0 },{ 1, 1, 3 },{ -2, -2, -1 },{ 0, -4, -2 },{ 1, 2, 3 },{ -2, 3, -2 },{ -1, 0, -4 },{ -3, 1, 3 },{ 3, -1, 2 },{ -2, 2, -1 },{ 1, 0, -2 },{ -2, -2, 3 },{ 2, 3, 1 },{ 0, 0, 3 },{ -4, 1, -1 },{ 1, -2, 0 },{ -1, -1, -2 },{ -3, -4, -2 },{ 1, 3, 2 },{ 2, 1, -2 },{ -4, -4, -1 },{ -3, 3, -2 },{ 2, -4, 2 },{ -2, -2, -4 },{ 1, 1, 1 },{ -4, 0, -1 },{ 2, 1, -3 },{ -1, -4, 2 },{ -4, 0, 0 },{ 3, 2, -3 },{ -2, 0, -4 },{ -1, 1, -1 },{ 0, 1, -3 },{ 3, 3, -1 },{ 0, 2, -4 },{ -4, 0, 3 },{ 2, 3, -4 },{ -1, -3, -2 } }, - { { 2, 2, 1 },{ -3, 1, 2 },{ 1, 0, -3 },{ -3, 2, 3 },{ -3, -1, -2 },{ 2, 2, -4 },{ 3, 1, 0 },{ -2, -1, 3 },{ -2, 0, -3 },{ -4, -3, 1 },{ 2, -4, 3 },{ -2, 0, -2 },{ -3, -2, 3 },{ 3, -3, -4 },{ -1, 1, 2 },{ -3, -4, 3 },{ 2, -1, -1 },{ 0, 3, -4 },{ -1, -4, -3 },{ 3, -2, 3 },{ -4, 2, -4 },{ -2, -4, -1 },{ 3, -2, 3 },{ -3, 0, 1 },{ -4, 3, -4 },{ 1, -4, -1 },{ -3, 2, -4 },{ 3, 3, -2 },{ -3, -3, -3 },{ 2, 1, 1 },{ 3, -1, -1 },{ -4, -2, 2 },{ 2, -3, 0 },{ -2, -4, -2 },{ -4, -2, -4 },{ 1, 3, 0 },{ 3, -4, 1 },{ 0, -3, -3 },{ -3, 2, -4 },{ -1, -4, -1 },{ -3, -2, -3 },{ -2, 1, 1 },{ 3, 3, -3 },{ -4, -4, 0 },{ -1, 0, -4 },{ 3, -3, 3 },{ 0, -1, 1 },{ 1, -3, 1 },{ -4, -1, 0 },{ 2, 0, -2 },{ 0, -4, 3 },{ -3, 3, -2 },{ -2, -3, 0 },{ 0, 3, -4 },{ -4, -4, -1 },{ -1, -1, 2 },{ 2, -2, -2 },{ 1, 2, 1 },{ -3, -1, 2 },{ 2, -1, -3 },{ -2, -4, 0 },{ 1, 1, -1 },{ -4, -1, 2 },{ -2, -2, 3 } }, - { { 1, 2, -4 },{ -4, 0, -2 },{ -1, -3, 0 },{ 0, 3, 2 },{ 2, -2, -3 },{ -4, 0, 0 },{ -1, 3, -2 },{ 1, -3, 2 },{ -3, 2, -4 },{ 3, 1, 0 },{ 1, 3, -2 },{ -4, -4, -3 },{ 1, 2, 0 },{ -4, -1, 1 },{ -1, -4, -2 },{ -2, 3, -4 },{ 3, -2, -3 },{ -4, -3, 1 },{ -3, 1, 1 },{ -2, 0, 0 },{ 0, 3, -1 },{ 0, -1, 1 },{ 2, 2, -3 },{ -1, -3, 0 },{ 0, -1, -3 },{ 2, -4, 1 },{ 0, 0, 0 },{ -1, -2, 3 },{ 2, -3, -4 },{ -3, 0, 1 },{ -2, -4, 3 },{ 0, 1, -3 },{ 3, 2, -3 },{ 2, 3, 1 },{ -3, 0, -1 },{ 0, -1, 3 },{ -4, 1, 0 },{ -3, 0, -2 },{ 2, 1, 2 },{ 3, -1, 0 },{ 1, -3, 3 },{ 0, 2, -4 },{ 0, 0, 3 },{ 2, -2, 1 },{ -3, 2, -1 },{ -2, -1, -4 },{ 2, 1, 2 },{ -2, 3, -3 },{ 0, 2, 3 },{ 3, -3, -4 },{ -4, -1, 2 },{ -1, 2, 0 },{ 3, -1, -4 },{ 2, -2, 3 },{ 1, 2, 1 },{ -3, -3, -3 },{ -2, 3, -4 },{ 3, -4, 3 },{ -4, -2, 1 },{ -2, -3, -2 },{ -3, -3, 2 },{ 3, 3, 0 },{ -1, 0, -3 },{ 0, -3, 0 } }, - { { 3, 3, 3 },{ 2, -1, -4 },{ -1, -4, -1 },{ 3, -3, 1 },{ 0, -1, -4 },{ -2, -4, 1 },{ -4, -2, 2 },{ 0, 0, -3 },{ 2, -1, -1 },{ -1, -2, 3 },{ -2, -2, -4 },{ 0, 0, 1 },{ 2, 1, -1 },{ -2, -1, 2 },{ 2, 3, -1 },{ 0, 0, 0 },{ -1, 1, 3 },{ 2, 2, -2 },{ 1, -2, 2 },{ 3, -4, -2 },{ -1, 1, -3 },{ 2, -3, 3 },{ -2, 0, -1 },{ 1, -2, -2 },{ -4, 1, 3 },{ 3, 3, 2 },{ -2, -1, -3 },{ -4, 1, -1 },{ -1, 3, 2 },{ 0, 2, 0 },{ 1, -1, -4 },{ -1, 3, -1 },{ -3, -2, 3 },{ 0, 0, 1 },{ -1, -4, -3 },{ 2, -3, -4 },{ -1, -2, -3 },{ 1, 3, -2 },{ -2, -2, 2 },{ -1, 1, -3 },{ -4, 3, -2 },{ -2, -4, 1 },{ 2, -1, -1 },{ -1, 1, -2 },{ 0, -2, 2 },{ 1, 2, 0 },{ -4, -2, -3 },{ -1, -4, -1 },{ -3, 1, -1 },{ -1, 3, 0 },{ 2, 1, -3 },{ 1, -3, 1 },{ -3, -4, 2 },{ -2, 1, -1 },{ 0, 1, -2 },{ 3, -3, 3 },{ 0, 1, -1 },{ -1, 0, -2 },{ 1, 1, 0 },{ 0, 3, -3 },{ -1, 1, 3 },{ 1, -2, -4 },{ -3, 1, -2 },{ -2, -4, 1 } }, - { { 0, -1, 2 },{ -3, -2, 1 },{ -2, 3, -2 },{ 1, 2, 3 },{ -3, 1, 0 },{ -1, 2, -1 },{ 3, -3, 3 },{ 1, 2, -2 },{ -4, -4, 2 },{ -3, 2, 0 },{ -1, 3, -1 },{ 3, -3, 2 },{ -1, 2, -3 },{ 3, -3, -4 },{ 1, 1, 3 },{ -4, -2, -2 },{ -3, -3, 2 },{ -2, -1, 0 },{ -3, 0, -4 },{ 1, 3, 0 },{ -4, -2, 2 },{ -3, 1, -4 },{ -4, 3, 1 },{ 3, 2, 0 },{ -2, 0, 2 },{ -3, -2, -4 },{ 0, -3, -1 },{ 1, -1, 2 },{ 3, -4, -2 },{ -4, -2, 0 },{ -2, -3, -2 },{ 2, 0, 1 },{ -4, -4, 2 },{ 1, -2, -2 },{ -2, 1, 0 },{ 3, 2, 2 },{ -3, 2, 3 },{ -1, -3, 1 },{ 0, -4, -1 },{ 1, 2, 3 },{ 3, 0, -4 },{ -1, -3, -1 },{ -4, 3, 2 },{ -3, 0, -3 },{ 3, -4, -2 },{ -1, 3, 3 },{ 1, -3, 0 },{ 3, 0, -2 },{ 0, -2, -4 },{ 1, -1, 3 },{ -2, -2, -1 },{ 0, 0, -3 },{ -4, 3, 1 },{ 2, -2, -2 },{ -1, 0, 2 },{ -4, -1, 0 },{ 1, 3, 1 },{ -4, -4, 2 },{ -2, -1, -4 },{ 2, 2, -1 },{ -4, -3, 0 },{ 2, 0, 2 },{ 3, -4, -1 },{ -4, 2, -2 } }, - { { 1, -3, -3 },{ 3, 1, -1 },{ -1, 0, -3 },{ -4, -3, 2 },{ 1, -1, -3 },{ -3, 3, -4 },{ -1, -2, -1 },{ 3, 0, -3 },{ 0, -4, 1 },{ 1, -1, -4 },{ 2, -2, -2 },{ -4, 0, 3 },{ -3, -1, -2 },{ -2, -4, 0 },{ -4, -2, -3 },{ 0, 2, 1 },{ 2, -4, -3 },{ 3, 3, -1 },{ -1, -3, -4 },{ 0, 0, 1 },{ 2, -3, -1 },{ 1, -1, 2 },{ 0, -4, -3 },{ -1, -4, 0 },{ 2, -1, -4 },{ 1, -3, 0 },{ -2, 2, -2 },{ 3, 1, 1 },{ -3, 0, -4 },{ 2, 1, 3 },{ 0, 2, -3 },{ -3, -1, -4 },{ 2, 2, 0 },{ -3, 3, -4 },{ -2, -1, 3 },{ -4, -4, 0 },{ 2, 0, -1 },{ 3, -1, -4 },{ -4, -4, 1 },{ -3, -1, 0 },{ 2, -2, -3 },{ -2, 0, 0 },{ 1, -3, -2 },{ 2, 1, 1 },{ -2, -1, 1 },{ -4, -3, -4 },{ -3, 0, 2 },{ -2, 2, 1 },{ -4, -4, 1 },{ 2, 2, 2 },{ -3, -4, -2 },{ -1, 2, 3 },{ 3, 0, -4 },{ 0, -4, 0 },{ -2, 3, -4 },{ 3, 2, -3 },{ 2, -2, -1 },{ -3, -2, -3 },{ -1, 0, 3 },{ 3, -2, 1 },{ -3, 2, -3 },{ 0, -1, 2 },{ -1, -2, -3 },{ -3, 0, 0 } }, - { { -3, 0, 1 },{ 0, -4, 2 },{ -2, -2, -2 },{ 2, 1, -1 },{ 3, -2, 1 },{ 2, -4, 2 },{ -4, 1, 0 },{ -2, 3, 1 },{ -2, 2, -2 },{ -3, 1, 3 },{ 3, 1, 1 },{ 0, -4, -3 },{ 1, 2, 0 },{ 0, 1, 2 },{ 3, 3, 1 },{ -2, 0, -2 },{ 0, 1, 0 },{ 1, -1, 2 },{ -4, -4, 3 },{ -2, 2, -2 },{ 3, -1, 3 },{ -1, 1, -3 },{ -3, 0, -2 },{ 2, -3, 3 },{ -1, 1, -1 },{ -4, 2, -3 },{ 1, 3, 3 },{ -3, -2, 2 },{ -1, -3, -3 },{ -2, 3, -1 },{ 1, -4, 3 },{ 3, 0, -1 },{ 0, -2, 2 },{ 3, 1, -1 },{ 1, -3, -3 },{ 0, -1, -2 },{ 1, 2, -3 },{ -3, 1, 3 },{ -2, 3, -2 },{ 0, 1, 2 },{ 2, 3, 3 },{ -3, 2, -4 },{ 0, -4, 2 },{ -3, -2, 3 },{ 1, 3, -4 },{ 0, 1, -1 },{ 3, -1, -2 },{ 2, 2, -3 },{ 0, 0, 0 },{ -1, -2, -4 },{ 3, -1, 0 },{ -4, 1, -2 },{ 1, -1, 1 },{ -3, -2, -1 },{ -2, -4, 2 },{ -3, -1, 3 },{ 0, -3, -2 },{ 3, 2, 1 },{ 1, -4, -1 },{ 0, 0, -2 },{ -2, -4, 0 },{ -1, 1, 3 },{ 2, 3, -4 },{ 1, 2, 3 } }, - { { -1, -3, -4 },{ 3, 3, 3 },{ -4, 2, -4 },{ -1, -1, 0 },{ 0, 3, -3 },{ -3, 0, 3 },{ 1, -3, -4 },{ 0, -2, -2 },{ -1, 0, 3 },{ 2, -3, -4 },{ -4, -3, 0 },{ -2, 3, -1 },{ -3, 0, 3 },{ 1, -1, -4 },{ 2, -4, -1 },{ -3, -1, 3 },{ -1, -2, -4 },{ -3, 3, 0 },{ 0, 0, -3 },{ 3, 2, -2 },{ -2, -2, 0 },{ -4, 3, -3 },{ 0, 2, 1 },{ -3, 3, 2 },{ 2, -2, -2 },{ -4, -4, 2 },{ 0, 0, -4 },{ 2, -4, -1 },{ -3, -1, 1 },{ 1, 3, 0 },{ -4, -2, 2 },{ -1, -3, 0 },{ -1, 3, -4 },{ -2, 0, 3 },{ 2, -3, 1 },{ -4, 3, 1 },{ -1, -2, 2 },{ 3, -3, -1 },{ -1, -1, -2 },{ 1, -2, -4 },{ 0, -3, 1 },{ -4, 1, -1 },{ 3, -1, 0 },{ 1, 2, -3 },{ -2, 0, -1 },{ 3, -4, 0 },{ -1, -2, 3 },{ -3, 3, 3 },{ 1, -3, -1 },{ -4, 3, 1 },{ -2, -4, -4 },{ 1, 3, 2 },{ -2, -3, 3 },{ 0, 2, -1 },{ 2, 1, -3 },{ 1, 0, 1 },{ -1, 3, 0 },{ -3, 1, -4 },{ -4, 1, 2 },{ 2, 3, -4 },{ -3, -3, -3 },{ 3, 1, -1 },{ -4, -3, 1 },{ 2, -1, -2 } }, - { { -1, -1, -1 },{ -4, 1, 0 },{ 1, -4, 1 },{ 0, 0, 3 },{ -3, -3, -2 },{ -1, 1, -1 },{ 2, 2, 2 },{ -3, -4, 0 },{ 3, -1, -1 },{ 1, 3, -3 },{ 0, -1, 2 },{ -1, -2, 1 },{ 3, 3, -2 },{ -1, -2, -3 },{ -4, -3, -1 },{ -1, 3, 2 },{ 3, -3, -2 },{ 2, -2, -1 },{ -4, -4, 2 },{ 1, 1, 1 },{ -1, -4, -1 },{ 2, -3, -4 },{ 1, -3, 1 },{ 3, 0, 0 },{ -2, -2, -3 },{ 3, 2, 1 },{ -2, -1, 0 },{ 3, 1, -1 },{ -1, -3, -2 },{ 3, 0, -4 },{ 0, 1, -3 },{ -4, -4, -2 },{ 2, -1, -2 },{ -3, 2, 2 },{ 1, -4, -1 },{ -3, 1, -3 },{ -1, 0, -4 },{ -3, -4, 0 },{ 3, 2, 2 },{ -4, 0, -3 },{ -2, -4, -1 },{ -1, -1, -2 },{ 3, 3, 3 },{ -1, -2, -3 },{ -4, -3, 1 },{ 1, 2, -1 },{ -1, -1, 2 },{ -3, 1, -3 },{ 2, -1, -2 },{ 0, -3, -3 },{ 3, 0, 3 },{ -1, 1, -1 },{ 2, -1, -3 },{ -4, -3, -2 },{ 3, 3, 3 },{ -2, -3, -4 },{ 1, -1, 0 },{ -2, -2, -3 },{ 1, -3, 3 },{ 0, -2, 0 },{ -2, -1, 2 },{ 1, 0, 0 },{ -4, -2, -2 },{ -2, 3, 0 } }, - { { 2, 0, 2 },{ -3, -3, -1 },{ 3, 2, -4 },{ 2, -2, -3 },{ -2, -4, 1 },{ 3, 1, 0 },{ -4, 3, -4 },{ 0, -1, 1 },{ -4, -4, -2 },{ -3, 2, 2 },{ -1, 1, -2 },{ 2, -4, -4 },{ -4, 0, 3 },{ 2, -4, 0 },{ -2, 2, 2 },{ 1, 1, -4 },{ -2, 1, 1 },{ 0, 2, 3 },{ -1, -3, -3 },{ -3, 0, -4 },{ 2, 3, 3 },{ -2, -1, 3 },{ -4, -1, -1 },{ -1, 1, -4 },{ 0, 1, -1 },{ -3, -3, 3 },{ 1, 3, -4 },{ -1, 2, -2 },{ -4, -3, 2 },{ 2, -1, 3 },{ -2, 2, 1 },{ -3, 0, -3 },{ 3, 1, 3 },{ 0, -2, 0 },{ -2, 2, -4 },{ 2, -3, 0 },{ 0, -1, 3 },{ 1, 3, -2 },{ 2, 1, 3 },{ -3, 0, 1 },{ 1, 3, 0 },{ -1, -3, 2 },{ -3, 1, -4 },{ 2, -4, 2 },{ 0, 0, 1 },{ -4, 3, -2 },{ -2, -2, -4 },{ 1, -4, 0 },{ 3, 0, 1 },{ -2, 2, 2 },{ -3, -2, -1 },{ -3, 2, 1 },{ 1, -4, -4 },{ -4, 2, 0 },{ 0, -2, 2 },{ -1, 0, -1 },{ -4, -4, 2 },{ 3, 3, 1 },{ 2, 0, -1 },{ -3, 2, -2 },{ 3, 3, -4 },{ 0, -4, 2 },{ 3, 2, 3 },{ 0, -4, -3 } }, - { { -2, 3, -3 },{ 1, -2, 2 },{ -2, -1, -2 },{ -4, 2, 1 },{ 1, 3, 3 },{ -2, -1, -1 },{ 2, -2, -3 },{ -1, 0, 3 },{ 2, 2, 0 },{ -2, -2, -4 },{ 3, -3, 0 },{ -4, 0, 1 },{ 1, 2, -3 },{ -3, 1, 2 },{ 0, -1, -2 },{ 2, -2, 0 },{ -4, -4, -3 },{ 2, 0, -2 },{ -2, -1, 0 },{ 1, 1, -1 },{ 0, -2, -2 },{ -3, 2, 1 },{ 3, -4, -2 },{ 1, 3, 2 },{ 2, -3, -2 },{ -3, -4, 0 },{ 1, 0, 3 },{ -4, -2, -1 },{ -2, 0, 1 },{ 1, 3, 0 },{ -1, -4, 2 },{ 2, -2, -1 },{ 1, -3, 0 },{ 0, 3, 1 },{ -4, 0, -3 },{ 3, -1, 2 },{ -2, 3, -1 },{ -4, -4, -3 },{ -2, -3, -4 },{ 0, -2, -1 },{ 3, 0, -2 },{ 1, 2, -4 },{ -2, -2, 1 },{ -3, 0, -1 },{ 0, -3, -4 },{ 2, 1, 3 },{ 3, -1, -3 },{ -1, 1, -1 },{ -4, -4, 3 },{ -2, 3, -4 },{ 2, -2, 0 },{ 0, -4, -2 },{ 3, 0, 2 },{ -1, 0, 0 },{ -3, 1, -4 },{ 2, -1, -2 },{ -2, 2, -2 },{ 0, 1, -3 },{ -4, -4, 1 },{ -1, 2, 3 },{ -4, -2, 1 },{ -1, -3, -1 },{ -1, 1, -3 },{ 1, 0, 1 } }, - { { 0, -1, 3 },{ 3, -4, -1 },{ -1, 1, 0 },{ 0, 0, -4 },{ 3, -2, 2 },{ -3, -4, 0 },{ 1, 0, -2 },{ -2, -3, 1 },{ 3, 3, -3 },{ 1, 0, 2 },{ -3, 1, 3 },{ 0, 3, -4 },{ -2, -1, -1 },{ 3, -3, -3 },{ 0, -4, 1 },{ -3, 3, -4 },{ 3, 0, 3 },{ 1, 3, 2 },{ -3, -4, 1 },{ -1, 3, 2 },{ 3, -3, -3 },{ -2, 0, 0 },{ -1, -2, -4 },{ -4, 2, 2 },{ -2, 0, -3 },{ 0, -1, 1 },{ -1, 3, -3 },{ 2, -1, 2 },{ 0, -3, -3 },{ 3, -2, -4 },{ -3, 1, -3 },{ -1, 3, 3 },{ -2, 0, -4 },{ -1, -4, -2 },{ -3, -3, 3 },{ -1, -1, 1 },{ 2, 1, -1 },{ 1, -2, 2 },{ -1, 0, 0 },{ -3, -1, 1 },{ -4, -4, 3 },{ 2, 2, -3 },{ -4, 3, 2 },{ 3, -1, 0 },{ -2, 2, 0 },{ 1, -3, -2 },{ -3, 3, 2 },{ -1, 2, 0 },{ 1, -3, -2 },{ 0, -1, -4 },{ 3, 1, -2 },{ 1, -1, 3 },{ -2, 2, -3 },{ -3, -3, -1 },{ 2, 3, 1 },{ 1, -3, 3 },{ 3, 0, 2 },{ -3, -3, -4 },{ 2, -2, -1 },{ 1, 0, -3 },{ 2, -1, -4 },{ -3, 1, -2 },{ -3, -2, 0 },{ -4, 2, -4 } }, - { { -4, -4, 1 },{ 2, 3, 0 },{ -3, 2, -3 },{ -4, -3, -2 },{ 2, -3, 3 },{ -2, 1, -4 },{ 0, 2, -3 },{ -4, 1, 3 },{ 0, -3, -1 },{ -3, -4, -1 },{ -1, -1, -2 },{ 3, -2, 1 },{ 2, -3, 2 },{ -1, 2, 3 },{ -4, 1, -1 },{ -1, -1, 1 },{ -2, -2, 0 },{ 2, 1, -1 },{ -4, -3, -4 },{ 3, -1, 3 },{ -4, 1, -3 },{ 0, -4, 0 },{ 2, 1, 3 },{ 1, -1, 1 },{ -4, 1, -1 },{ 3, 2, -4 },{ 2, -4, 0 },{ -2, 1, -2 },{ -3, 2, 3 },{ 1, -4, -2 },{ -4, 1, -1 },{ 2, -1, 1 },{ -4, 2, -2 },{ 3, -2, 2 },{ 1, 3, -4 },{ 0, 2, -2 },{ 2, -4, 1 },{ -3, 2, -2 },{ 3, 1, -4 },{ 2, 3, 2 },{ -1, -3, -1 },{ 0, 1, -2 },{ 2, -4, 3 },{ -1, -2, -2 },{ -4, 1, -3 },{ -2, -4, 3 },{ 1, -1, 1 },{ -3, 0, -3 },{ 2, 2, 2 },{ -4, -4, 2 },{ -3, 3, 1 },{ -1, -3, -1 },{ -4, 1, 2 },{ 3, -2, 3 },{ 0, -4, -3 },{ -1, -1, -1 },{ -3, 3, 0 },{ -1, -1, 3 },{ 0, 1, 1 },{ -2, -4, 0 },{ 0, 3, 2 },{ 2, -3, 3 },{ 3, 3, 2 },{ 1, -3, -2 } }, - { { -1, 1, -4 },{ 2, 0, 2 },{ 0, -1, 1 },{ -1, -4, -1 },{ 1, 2, -1 },{ -1, -1, 2 },{ 3, 3, 0 },{ 2, -1, 2 },{ -3, -3, -4 },{ 1, 3, 1 },{ 2, 1, -3 },{ -4, -4, 0 },{ 0, 0, -2 },{ -3, 2, -4 },{ 2, -1, -2 },{ 1, -3, -3 },{ -2, 1, -1 },{ 0, -4, -4 },{ -1, 2, -2 },{ -2, -2, 1 },{ 1, 2, -1 },{ 2, 3, 2 },{ -1, -2, -4 },{ 3, -4, 3 },{ -2, -3, -1 },{ 0, -2, 1 },{ -3, 3, 2 },{ -4, -3, -2 },{ 3, 0, 1 },{ -1, 3, 0 },{ 0, -1, 2 },{ 0, -3, -3 },{ 3, -4, 0 },{ -2, 0, 0 },{ 0, -2, -1 },{ -4, 1, -4 },{ -3, -3, 0 },{ -2, -2, 3 },{ 0, -3, -3 },{ -4, 2, -1 },{ 0, -2, 1 },{ -2, -1, -4 },{ -3, -1, 1 },{ 0, -3, -3 },{ 2, 3, 2 },{ 3, 0, -4 },{ 0, -3, -1 },{ -2, -2, -2 },{ 2, 1, 0 },{ 3, -2, -3 },{ -2, 0, -1 },{ 1, -3, 0 },{ 2, 0, -4 },{ 0, 3, -2 },{ -2, 2, 1 },{ -4, -2, -4 },{ 1, -4, -2 },{ 3, 3, -3 },{ 1, -3, -1 },{ -4, 2, -2 },{ -2, 0, -2 },{ 3, 1, -4 },{ -1, -1, 1 },{ -2, -2, -1 } }, - { { -2, 2, 3 },{ -3, -3, -2 },{ 3, -2, -4 },{ -2, 1, 3 },{ 0, 0, 1 },{ -3, -2, -3 },{ -4, -4, -1 },{ 2, -2, -4 },{ -1, 2, -2 },{ 0, -1, 2 },{ -2, 2, 3 },{ -2, -2, -4 },{ -1, 3, 0 },{ 1, 0, 2 },{ -4, -4, 0 },{ 3, 3, 3 },{ 1, -2, 2 },{ -3, 3, -2 },{ 2, 0, 3 },{ 0, 0, 0 },{ -4, 2, -4 },{ -2, -3, -2 },{ -3, 0, -1 },{ -3, 2, -3 },{ 2, 3, -2 },{ 1, 0, -3 },{ -1, -4, -4 },{ 1, -1, 2 },{ -2, 1, -1 },{ 2, -3, -4 },{ -2, -2, 2 },{ -3, 2, -2 },{ 1, 3, -4 },{ 2, 1, 3 },{ -3, -1, 2 },{ 3, -4, 2 },{ 1, 0, -3 },{ 3, 3, 2 },{ -4, 0, 0 },{ 2, -1, 3 },{ 1, 1, -4 },{ 3, 3, -1 },{ -3, 0, 2 },{ 1, 2, 0 },{ -1, 2, -1 },{ -4, -2, 1 },{ 3, 0, -4 },{ 0, 3, 3 },{ -3, -4, 1 },{ -1, -1, -4 },{ -1, 3, 3 },{ 0, 2, -3 },{ -4, -4, 0 },{ -2, -1, -3 },{ 3, 1, 2 },{ 2, 2, 0 },{ -2, 0, 1 },{ -1, -1, 3 },{ -3, 1, -4 },{ 2, -2, 2 },{ 1, -1, 1 },{ -4, -4, 0 },{ 0, 0, -1 },{ 1, 2, -3 } } - }, - { - { { -3, -1, -1 },{ 0, 1, 1 },{ -1, 2, -4 },{ -3, 3, 0 },{ 0, -2, -2 },{ 1, -1, 2 },{ -3, 0, -1 },{ 0, 1, 0 },{ 0, -2, -4 },{ -4, 3, -2 },{ -1, -1, 0 },{ -4, 0, -4 },{ 3, 2, 3 },{ -1, -3, 1 },{ -3, 0, -3 },{ 0, -3, 3 },{ 2, 1, -2 },{ -1, 2, 1 },{ -3, 1, -3 },{ -2, -3, -2 },{ 0, -1, 0 },{ -3, -4, 2 },{ 3, 2, 3 },{ -2, 3, -2 },{ 3, -4, -3 },{ 0, -1, 3 },{ 1, 0, -1 },{ -3, -4, 1 },{ 0, 2, -4 },{ 1, 1, -2 },{ 3, -3, 1 },{ -2, 2, -1 },{ 0, -2, -4 },{ 2, -4, 0 },{ 1, 0, 1 },{ -2, -3, 1 },{ 0, -1, -4 },{ -4, -4, -2 },{ 2, 1, -1 },{ 3, -3, 3 },{ -1, 1, -1 },{ 1, 2, -2 },{ -3, 0, -3 },{ 3, -2, 1 },{ -1, -4, -1 },{ -4, -1, -1 },{ 1, -3, -3 },{ -3, 1, 3 },{ -4, 0, 0 },{ -1, -3, 3 },{ 3, 3, -1 },{ -1, -2, 2 },{ 2, -2, -2 },{ 0, -1, 2 },{ -1, -4, 0 },{ -1, -1, 1 },{ -4, 3, 2 },{ 1, -4, 0 },{ 3, 1, 0 },{ -2, -2, -2 },{ -3, 3, 2 },{ 3, -1, -2 },{ -2, -3, 1 },{ 2, -3, -1 } }, - { { -4, 3, 2 },{ 3, -2, 1 },{ -2, -3, -1 },{ 2, -1, 3 },{ 3, -4, -4 },{ -2, 2, -3 },{ 3, -4, -3 },{ -1, -2, 2 },{ 2, -4, -3 },{ -2, 0, 2 },{ 1, 1, 0 },{ 2, -3, 1 },{ -2, -2, 2 },{ -3, -4, -3 },{ 2, 3, -1 },{ -4, 3, 2 },{ -2, -2, -4 },{ 0, -1, 0 },{ 2, -3, -1 },{ -4, 3, 3 },{ 2, 0, -4 },{ -1, 1, -3 },{ 2, -3, -1 },{ -3, -2, 1 },{ 0, 2, -1 },{ -1, -2, 0 },{ -4, 3, -4 },{ -2, -3, -2 },{ -1, -1, 3 },{ -4, -2, -1 },{ 1, 1, 3 },{ 3, -4, 2 },{ -1, -1, -2 },{ -4, 2, 3 },{ 3, 3, -4 },{ -3, 0, 3 },{ -1, 2, -3 },{ -1, -2, 2 },{ -3, -3, 0 },{ -2, 3, -2 },{ -4, -1, -4 },{ 1, 0, 0 },{ 2, 1, 2 },{ -1, -3, -4 },{ 0, 1, 1 },{ -2, 0, 2 },{ 2, 3, -2 },{ -2, -2, -1 },{ 0, 0, 1 },{ 1, -1, -4 },{ -2, -4, -2 },{ 1, 1, 0 },{ -4, 2, 0 },{ -2, -3, -3 },{ -3, 3, 3 },{ 2, -3, -3 },{ 3, 0, -1 },{ -2, -1, -3 },{ 0, 3, -1 },{ 2, -2, 1 },{ -1, 2, -3 },{ -4, 0, 1 },{ 0, 1, -3 },{ 1, -1, -4 } }, - { { -2, -2, -4 },{ 1, 0, -2 },{ 1, -4, -3 },{ -4, 1, 2 },{ -3, 1, -1 },{ -1, -3, 1 },{ -4, 3, 0 },{ 1, -1, 3 },{ -4, 2, -2 },{ 3, -3, -1 },{ 0, 2, 3 },{ -4, 3, -2 },{ 1, -1, 0 },{ 0, 0, -4 },{ 3, 1, 2 },{ 1, -2, 1 },{ -4, 2, 0 },{ 0, -4, -3 },{ 3, 0, 1 },{ -3, 3, 2 },{ 1, -1, 0 },{ -1, -4, -2 },{ -4, 0, -4 },{ 1, 1, 2 },{ -3, -4, -4 },{ 3, -1, 3 },{ 1, 2, 2 },{ 3, 0, 0 },{ 2, 3, 2 },{ -3, -4, -3 },{ -2, 0, 1 },{ -4, 3, -4 },{ 0, -3, -3 },{ 2, -2, 2 },{ -3, 1, -1 },{ 0, -2, -2 },{ 2, 3, 0 },{ 1, 1, -1 },{ -3, 0, 2 },{ 0, 3, -4 },{ 3, -2, 1 },{ -3, -4, 3 },{ -4, -2, -1 },{ 0, 3, -2 },{ -4, 2, 3 },{ 3, -4, -4 },{ 1, 2, -3 },{ -1, -3, 2 },{ 3, 2, 0 },{ -4, 3, -2 },{ 0, -1, -3 },{ -3, -3, 3 },{ 3, 0, 2 },{ 0, 0, -4 },{ 1, 1, -2 },{ -2, -2, 1 },{ -4, 2, -4 },{ -1, -3, 2 },{ 1, -4, 3 },{ -4, 0, -4 },{ 3, -3, 0 },{ 1, -2, 3 },{ -3, 3, 2 },{ -1, -4, 0 } }, - { { -3, 1, 3 },{ 3, 2, -3 },{ -1, 3, 1 },{ -1, 0, 0 },{ 2, -1, -4 },{ 1, 2, 2 },{ -2, 0, -1 },{ 0, -3, -4 },{ -3, 3, 2 },{ -1, -2, 1 },{ 1, -4, -4 },{ -3, 0, -3 },{ -2, 2, -2 },{ 0, -3, -1 },{ -1, -4, 3 },{ -2, -1, -2 },{ 1, -3, -2 },{ 3, 1, 2 },{ -1, -4, -4 },{ 0, -2, -3 },{ -4, 2, 2 },{ -2, -2, -1 },{ 3, 3, 3 },{ 1, -1, 1 },{ -1, 1, -2 },{ -2, 3, 1 },{ -4, -3, -2 },{ 2, 1, -4 },{ -2, -2, -1 },{ 0, 1, -1 },{ 2, -1, -4 },{ 0, 2, 2 },{ 1, 0, 0 },{ -3, 1, -2 },{ 3, -4, -1 },{ -2, -3, 2 },{ -4, -4, -4 },{ 3, 2, 3 },{ 1, -3, -3 },{ -1, -4, 1 },{ 2, -1, -1 },{ -2, 2, -2 },{ 1, -3, 2 },{ -1, 0, 0 },{ 2, -1, 0 },{ -3, -1, -2 },{ -2, -2, 1 },{ 0, -3, 3 },{ 2, 0, -3 },{ -3, -4, 3 },{ 1, 1, 1 },{ -1, 3, -1 },{ 2, -4, -4 },{ -3, -2, 0 },{ 1, 2, -1 },{ 2, -4, 3 },{ -3, -1, -2 },{ 0, 2, 0 },{ -3, 1, 3 },{ -2, -1, -2 },{ -3, 2, -4 },{ -1, -4, -1 },{ 2, 2, -2 },{ 3, 1, -1 } }, - { { -2, -1, 2 },{ -3, -2, 0 },{ 0, -3, -1 },{ -4, 2, 3 },{ 3, -2, -2 },{ 0, -4, 1 },{ 3, -2, -2 },{ 2, 1, 0 },{ -2, -1, -3 },{ 3, 0, -1 },{ 2, 1, 0 },{ -1, -2, 2 },{ 3, -3, 1 },{ -4, 1, 1 },{ 2, 0, -4 },{ -4, 3, -3 },{ -1, -2, -1 },{ -3, 3, 3 },{ -3, 1, 0 },{ 1, 0, -1 },{ 3, -3, 1 },{ 2, -1, -3 },{ 0, 3, 2 },{ -3, -3, 0 },{ 2, 0, -3 },{ 1, 0, -1 },{ -1, -4, 3 },{ 0, -1, -3 },{ -3, -4, 2 },{ -1, 0, 1 },{ 3, -3, 0 },{ -3, 3, -2 },{ -1, -3, 0 },{ -2, -2, 1 },{ -1, 3, 3 },{ 1, 0, -3 },{ 0, -1, 1 },{ -2, -1, -1 },{ 2, 0, -2 },{ -4, 1, 3 },{ -1, 3, -3 },{ 3, -1, 0 },{ -2, 1, -4 },{ 3, 3, -3 },{ -3, -4, -3 },{ 1, 2, 2 },{ -4, 0, 0 },{ -4, 3, -2 },{ -1, -2, -4 },{ 2, 1, 0 },{ -3, -2, 1 },{ 3, 2, -2 },{ -1, 0, 2 },{ -4, -1, -2 },{ -2, 3, 1 },{ 3, 0, 2 },{ 0, 1, -3 },{ 3, -4, -1 },{ 0, 0, 1 },{ 1, -3, -3 },{ 3, 3, 0 },{ 0, -1, 1 },{ -4, 0, -3 },{ 1, -3, 1 } }, - { { 2, -2, -2 },{ 0, -4, -4 },{ 2, 0, 2 },{ -2, -4, -3 },{ -2, 3, -4 },{ -3, 2, -1 },{ -4, 1, 3 },{ -1, 0, 2 },{ -4, -4, 1 },{ 0, 3, -4 },{ -3, -1, 3 },{ -4, 1, -2 },{ 1, 3, -1 },{ -3, -4, 3 },{ 2, -1, 2 },{ 0, 2, 0 },{ -2, 0, 3 },{ 2, -1, 1 },{ 2, -3, -4 },{ -1, 2, -2 },{ -3, 2, 3 },{ 0, -4, -4 },{ -2, 1, -2 },{ -4, -2, -1 },{ -1, -4, -4 },{ 3, -2, -1 },{ -2, 3, 1 },{ -3, -2, 0 },{ 1, 2, -2 },{ -4, 3, 3 },{ 2, -4, -3 },{ 1, -2, 3 },{ 3, 0, -1 },{ 0, -1, -4 },{ 2, 2, 1 },{ -4, 3, -3 },{ -3, 1, 0 },{ -2, -2, 2 },{ 0, 2, -4 },{ 1, -2, 0 },{ -3, -3, 1 },{ -4, -4, 3 },{ 1, 0, 1 },{ -2, -2, 1 },{ -1, -3, 3 },{ 0, 1, -1 },{ 3, 3, -3 },{ 0, -4, 2 },{ 1, -1, -1 },{ -2, -3, -1 },{ -4, 0, -3 },{ -2, -2, -4 },{ 1, -4, 3 },{ 0, 3, -1 },{ -2, -3, -3 },{ -1, -3, 0 },{ -4, 3, -4 },{ 2, -2, -4 },{ -2, 3, 2 },{ -3, 1, 0 },{ 2, -2, 2 },{ -4, 0, 3 },{ 0, -3, -4 },{ -2, 3, -2 } }, - { { 3, 2, 3 },{ -4, 3, -1 },{ -3, 1, 1 },{ 1, 1, 3 },{ 2, -1, 0 },{ -1, -1, 1 },{ 0, -3, -4 },{ 2, 3, -3 },{ 1, -2, -2 },{ -1, 2, 0 },{ 2, -4, 2 },{ -2, -3, -3 },{ 3, 0, -3 },{ -2, 2, 0 },{ -1, -2, -4 },{ 1, -4, -2 },{ 3, -3, -2 },{ 0, 3, -3 },{ -2, -1, 1 },{ -4, -4, -3 },{ 1, 0, 2 },{ -3, 0, -1 },{ 3, -2, 1 },{ 2, 2, 3 },{ 0, 3, 2 },{ -4, 2, 3 },{ 0, 1, -4 },{ 2, -1, -2 },{ 3, 2, 1 },{ -2, 0, -4 },{ -1, -3, 2 },{ -4, 1, -4 },{ -3, 2, 2 },{ -4, -4, -3 },{ 2, -1, 0 },{ -1, -3, 3 },{ 3, -4, -2 },{ 2, 3, -2 },{ -1, -4, 3 },{ -3, 0, 2 },{ 0, 1, -1 },{ 2, 3, -2 },{ 0, 1, -4 },{ -4, 2, -2 },{ 2, -2, 3 },{ 1, -3, -4 },{ -1, 0, 1 },{ -2, -1, 3 },{ 3, 1, -4 },{ 0, 2, 3 },{ 1, 3, 2 },{ 3, 1, 0 },{ -4, -2, 0 },{ 2, 1, 2 },{ -3, -1, -2 },{ 2, 1, 3 },{ -1, -2, 0 },{ -4, 0, 3 },{ 1, -4, -1 },{ -1, -1, -3 },{ 0, 2, -4 },{ -2, -4, -1 },{ 3, 2, 0 },{ -1, 0, 2 } }, - { { 1, -1, 1 },{ -1, -1, -4 },{ 3, -3, -2 },{ -3, -2, -3 },{ 1, -3, 2 },{ 3, -4, -2 },{ -3, 0, -1 },{ -2, 2, 1 },{ 3, -3, 3 },{ -3, -1, -1 },{ 1, 0, -4 },{ 0, -2, 1 },{ 0, 3, -1 },{ -4, -2, 2 },{ 1, 0, -3 },{ -3, 2, 1 },{ -3, -4, 2 },{ -4, 1, -1 },{ 0, -2, 1 },{ 2, 3, 3 },{ 2, -2, 0 },{ -1, 3, 0 },{ 1, -3, -3 },{ -2, 0, 0 },{ -3, -1, -3 },{ 3, -3, 0 },{ -1, 0, 1 },{ -4, -4, 2 },{ -2, -3, -1 },{ 2, 0, -3 },{ 0, -1, 0 },{ -2, 2, -1 },{ 2, -2, 1 },{ 0, 1, -2 },{ -2, -3, 3 },{ 1, 1, -1 },{ 0, 0, -4 },{ -4, -2, 1 },{ 3, 2, -3 },{ 1, -1, -4 },{ 3, -4, -3 },{ -2, -1, -1 },{ 2, -2, 2 },{ 3, -4, 0 },{ -3, 3, -1 },{ -2, 0, -4 },{ 2, -3, 0 },{ -3, 2, 1 },{ -4, -2, -3 },{ -1, -4, -2 },{ -1, -1, 1 },{ -2, -4, -4 },{ 0, -3, -3 },{ -1, 2, 1 },{ 3, -4, -4 },{ 0, -1, -1 },{ 1, 2, 1 },{ -3, -2, -2 },{ 2, 3, 2 },{ 3, 2, 0 },{ -4, -3, -2 },{ 1, -2, 1 },{ -3, 1, -3 },{ -3, -4, -3 } }, - { { -4, 2, 2 },{ -2, -2, 0 },{ 0, 0, -1 },{ -1, 3, 3 },{ -4, 2, -4 },{ 0, 1, 0 },{ -4, -2, 2 },{ 2, 3, -3 },{ -2, -2, 3 },{ -4, 1, 0 },{ 3, 3, -2 },{ -3, 1, 3 },{ -1, -3, 1 },{ 2, 1, -2 },{ 0, -1, 3 },{ 3, 3, -1 },{ -1, -1, 3 },{ 1, 1, -4 },{ 3, 2, -2 },{ -2, 0, -1 },{ -1, -3, -4 },{ -4, -1, -2 },{ 2, 1, 1 },{ 0, 1, -2 },{ 1, -4, -1 },{ -3, 2, -3 },{ 1, -2, -2 },{ -1, 3, -4 },{ 1, 1, 3 },{ -3, -2, 2 },{ 0, -4, -1 },{ 1, 3, -2 },{ 3, -3, 3 },{ -1, 3, 1 },{ 1, 0, -4 },{ -3, 2, -1 },{ -3, -3, 2 },{ -1, 1, 1 },{ 2, 3, -1 },{ -2, 0, 0 },{ -4, -3, 1 },{ -1, 3, 3 },{ -1, 1, -3 },{ -3, 0, 1 },{ 1, -1, -2 },{ -1, 2, 2 },{ -4, -4, -2 },{ 1, 1, 0 },{ 2, 3, -2 },{ 3, -3, 3 },{ -3, -1, -1 },{ 2, 1, 2 },{ -3, 0, -2 },{ 1, 3, 3 },{ -4, -2, 2 },{ -2, 2, -3 },{ 3, 0, 1 },{ 0, -4, -3 },{ -3, -3, -4 },{ -2, 0, 3 },{ -1, -1, 1 },{ 3, 1, 3 },{ 0, 3, -1 },{ 2, -3, 0 } }, - { { 2, -2, 3 },{ 1, 1, -3 },{ -3, -4, 1 },{ 3, 0, 1 },{ -1, 2, -3 },{ -2, -4, 3 },{ 3, 1, -2 },{ 0, -1, -1 },{ 0, -3, -4 },{ -3, 2, 2 },{ -1, -4, 0 },{ 2, -2, -3 },{ -4, -1, -4 },{ -3, -4, 0 },{ -2, 1, -4 },{ 2, -3, 0 },{ -4, -2, -3 },{ -1, -3, -2 },{ 1, -4, 0 },{ -3, -1, 3 },{ -2, 3, -3 },{ 3, -4, 2 },{ -3, -2, 3 },{ -1, -3, -4 },{ -4, 3, 2 },{ 2, -2, 3 },{ -2, -3, 2 },{ 2, 0, -2 },{ 3, -2, -1 },{ -3, 3, 1 },{ -4, 1, 3 },{ 3, -1, -4 },{ -3, 2, 0 },{ -4, -4, -3 },{ 2, -1, 0 },{ 3, -2, 2 },{ -2, 3, -2 },{ 0, -4, -3 },{ -4, -1, 3 },{ -2, -3, -2 },{ 0, 2, 2 },{ 1, -2, -4 },{ -4, 1, 0 },{ 0, -4, 3 },{ 0, 2, 1 },{ 3, -2, -3 },{ -1, 1, 3 },{ 2, -2, 2 },{ 0, 0, 1 },{ -2, 0, -4 },{ -4, 2, -3 },{ 1, 3, 0 },{ 3, -1, -1 },{ -2, -3, -4 },{ -4, 0, 0 },{ 2, -4, -3 },{ -1, 3, -1 },{ -4, 0, 3 },{ 3, 1, -1 },{ 0, -3, -2 },{ 1, 3, -4 },{ -4, -2, 2 },{ -1, 0, -4 },{ -2, -4, -2 } }, - { { 1, 3, 1 },{ 0, 2, -4 },{ -2, 1, -1 },{ 2, -2, -1 },{ 1, -3, -2 },{ 2, -1, 0 },{ -3, -2, 2 },{ 1, 3, -4 },{ 3, -4, 1 },{ 1, -1, -2 },{ -2, 0, -1 },{ 3, 2, 3 },{ 0, 2, 0 },{ 1, 3, -2 },{ 1, -2, 2 },{ -2, 0, -3 },{ 0, 2, 1 },{ -3, 3, 2 },{ 3, -3, 1 },{ 0, 1, -4 },{ 0, 1, 2 },{ 2, 2, -1 },{ -3, 0, -3 },{ 0, 2, 1 },{ 3, -1, -1 },{ -2, 1, -4 },{ 0, 2, 0 },{ -4, -1, 0 },{ -1, 2, -4 },{ 2, -4, -3 },{ -2, 0, -2 },{ -1, -2, -3 },{ 1, -3, 2 },{ 0, -1, -1 },{ -1, 0, -2 },{ -2, -4, -4 },{ 3, 2, 0 },{ 1, -2, 3 },{ -1, -1, -1 },{ 3, 2, -2 },{ 2, -4, 1 },{ -3, 3, -3 },{ 3, 0, -2 },{ 2, -3, -1 },{ -3, -1, -4 },{ 2, -4, 0 },{ -2, 3, -4 },{ -4, -3, -1 },{ 1, -1, -3 },{ -3, -4, 2 },{ 0, -2, 0 },{ -1, -4, 3 },{ -2, -2, 1 },{ 0, 2, 2 },{ 2, 1, 1 },{ 1, -2, -2 },{ -3, -3, 2 },{ -1, 1, 0 },{ 1, -2, 1 },{ 2, 3, -2 },{ -2, 2, -1 },{ -3, -4, 0 },{ 3, 1, 2 },{ -1, 0, -2 } }, - { { -3, 0, 2 },{ -4, -4, -3 },{ 3, -3, 2 },{ -4, -1, 3 },{ -3, 3, -4 },{ -2, 2, 1 },{ -1, 1, -2 },{ -4, -3, 1 },{ -1, 0, 3 },{ -3, 2, -3 },{ -2, -2, 2 },{ 1, -3, -3 },{ -4, -3, 2 },{ -1, -1, -1 },{ 3, -4, 3 },{ 2, 0, -4 },{ -4, -4, 0 },{ 2, 0, 3 },{ -1, 2, -1 },{ -4, -1, -2 },{ -2, -2, 0 },{ 3, -4, 1 },{ 1, 3, -4 },{ -2, -3, -1 },{ 2, -1, 0 },{ -1, -4, 1 },{ 1, 0, -2 },{ -3, -3, 2 },{ 0, -1, 1 },{ 2, 2, 2 },{ 1, -3, 0 },{ -1, 0, 1 },{ -3, 2, -1 },{ -4, 1, 1 },{ 3, 1, 3 },{ -4, 3, 2 },{ 0, -3, 1 },{ -3, 0, -3 },{ 2, 1, -4 },{ -4, -4, -1 },{ 0, 0, 3 },{ 1, -1, 0 },{ -2, -2, -1 },{ -2, 2, 2 },{ -4, 3, 3 },{ -3, 0, -1 },{ 0, 1, -3 },{ -2, -2, 2 },{ 3, 3, -1 },{ -1, 2, 1 },{ 2, 1, -2 },{ 3, 3, -4 },{ -4, 0, -3 },{ -1, -4, -2 },{ -3, 3, -1 },{ 0, -1, 3 },{ -2, 2, -4 },{ 2, -4, -4 },{ -4, -1, 2 },{ -3, -4, -3 },{ 1, 0, 3 },{ -1, -1, -3 },{ 2, -3, -3 },{ 0, -2, 0 } }, - { { 3, -1, -1 },{ -1, -2, -4 },{ -1, 1, -2 },{ 0, -1, 0 },{ 0, 0, -3 },{ 3, -4, 2 },{ 1, 0, -1 },{ 1, 2, -3 },{ -4, -1, 0 },{ 2, 3, -1 },{ 2, 1, -2 },{ -1, 0, -4 },{ 3, 1, 1 },{ -3, 3, -1 },{ -3, 1, 1 },{ -1, -2, -1 },{ 0, 3, 0 },{ -2, -2, -3 },{ 2, -1, -3 },{ -1, 3, -1 },{ -4, -3, 3 },{ 1, 0, 0 },{ -1, -1, -3 },{ -4, 1, 3 },{ -3, -2, 3 },{ 2, 2, -3 },{ -4, 3, -4 },{ 3, -4, 3 },{ -2, -2, -3 },{ -3, 3, -1 },{ -4, -2, 3 },{ 3, -4, -4 },{ 2, 3, 2 },{ 2, -4, -2 },{ -2, -2, -4 },{ 1, 2, -1 },{ -3, -2, -2 },{ -2, 3, 0 },{ 1, 1, 2 },{ -1, -3, 2 },{ -3, 3, 0 },{ -1, -1, -3 },{ 3, -4, 2 },{ -1, 0, -3 },{ 1, -3, 1 },{ 1, 1, -2 },{ 3, -1, 1 },{ 2, 2, 3 },{ -4, -3, -2 },{ -3, 0, 0 },{ 1, -2, -3 },{ -3, -3, 3 },{ 0, 0, -1 },{ 3, -1, 2 },{ 2, 2, 0 },{ -2, -2, -3 },{ 3, 0, -2 },{ 1, 3, 1 },{ -1, -1, 0 },{ 0, 1, -2 },{ 3, 2, 2 },{ -3, -3, 1 },{ 1, 3, 3 },{ -4, 2, 1 } }, - { { -2, -4, -3 },{ 1, 3, 3 },{ 2, 1, 1 },{ -3, 2, -1 },{ -2, 3, 3 },{ 2, -3, 0 },{ -2, -2, -4 },{ 0, -2, 3 },{ 3, -4, -2 },{ 0, -3, 2 },{ -2, -4, 1 },{ -4, -2, 3 },{ 0, -4, -4 },{ 0, 2, -3 },{ 2, -1, 2 },{ -4, -3, -4 },{ 3, 2, -2 },{ -3, 1, 3 },{ 1, -4, 2 },{ 3, -3, -4 },{ -2, 2, 2 },{ -3, 2, -4 },{ 2, -2, -2 },{ 0, -4, 2 },{ 3, 3, -2 },{ 0, 0, -1 },{ -1, -2, 1 },{ 1, 1, -2 },{ 3, 0, 0 },{ 0, 1, -2 },{ -2, 2, -1 },{ 0, -1, -3 },{ -1, 1, 3 },{ -3, 0, 0 },{ 0, -3, -3 },{ 2, -1, 3 },{ 3, 0, 2 },{ 0, -3, 1 },{ 2, -1, -3 },{ -2, -2, -4 },{ 3, 2, 1 },{ -4, 1, -4 },{ 2, 3, 0 },{ -4, 2, -2 },{ 0, -2, 1 },{ -1, -4, -4 },{ -3, -1, 0 },{ 0, 3, -3 },{ -1, -4, -4 },{ -2, -1, 0 },{ 3, -3, 2 },{ -2, 3, -1 },{ -3, 1, 1 },{ 1, -4, -4 },{ -1, -3, 3 },{ -4, 1, 1 },{ -4, -4, 2 },{ -1, -3, -1 },{ 3, 2, 3 },{ -2, -2, -4 },{ 0, -4, -2 },{ -4, -1, -1 },{ -2, 1, -4 },{ 2, -1, -1 } }, - { { 0, 3, 2 },{ -3, 0, 1 },{ 3, -4, 0 },{ 1, -2, -4 },{ -4, -4, -3 },{ 2, 0, -2 },{ -4, 3, -1 },{ -3, 1, 2 },{ -2, 0, -1 },{ -3, 2, -4 },{ 1, 0, 0 },{ 3, 3, -2 },{ -3, -1, 2 },{ 1, -2, -2 },{ -2, 0, 0 },{ 1, -3, 3 },{ 0, -1, 1 },{ -1, 0, 0 },{ -3, 1, -2 },{ 2, 0, 1 },{ 0, 1, -2 },{ 3, -3, -1 },{ -1, 0, 2 },{ -2, 2, 0 },{ 1, -1, -4 },{ -2, -4, -1 },{ -4, -1, 3 },{ -2, 1, -4 },{ -3, -3, 2 },{ -1, -4, 1 },{ 2, -3, -4 },{ -3, 0, 0 },{ 1, -2, -3 },{ -4, -2, 1 },{ -1, 3, 0 },{ -2, -4, -3 },{ -1, 3, -4 },{ -1, -4, -2 },{ -4, 2, 3 },{ 2, -4, -1 },{ 0, 0, -2 },{ -3, -3, 2 },{ 0, -3, -1 },{ 2, -1, 3 },{ 2, 3, -4 },{ -2, -3, 3 },{ -4, 2, -1 },{ 2, -2, 2 },{ -2, 0, 3 },{ 0, 1, -4 },{ 2, 2, -1 },{ 1, -1, 3 },{ -4, -2, -3 },{ 2, 3, -2 },{ -3, 0, -2 },{ 3, -2, -4 },{ 0, 3, -1 },{ 1, 1, -3 },{ -3, -1, 0 },{ -4, 3, 2 },{ 2, 0, 0 },{ 1, 1, 2 },{ -3, -3, 0 },{ 2, -2, -2 } }, - { { -4, -3, 0 },{ -4, 2, -4 },{ -1, -1, -2 },{ -3, -3, 2 },{ -1, 2, 3 },{ 0, -1, 0 },{ -1, 1, 1 },{ 3, -4, -4 },{ 1, -3, 3 },{ -1, 3, -3 },{ 2, -2, 0 },{ -2, 1, -1 },{ -1, -3, 3 },{ 3, 2, -1 },{ -2, 2, -3 },{ -4, -4, -4 },{ 2, 3, -1 },{ -2, -2, -3 },{ 0, -3, 3 },{ -4, 3, 0 },{ -1, -2, 1 },{ -4, -4, -1 },{ 1, 3, 3 },{ -4, 1, 1 },{ -3, -3, -3 },{ -1, 3, 2 },{ 2, -3, 1 },{ 3, 2, -2 },{ 1, 3, -3 },{ -4, -1, 3 },{ 3, 3, 2 },{ -2, 1, -1 },{ 3, -4, 3 },{ -4, 2, -2 },{ 2, 0, 1 },{ 3, 1, 2 },{ -3, -2, -1 },{ -4, 0, 0 },{ 1, 1, 1 },{ -3, -1, -3 },{ -1, 1, 3 },{ 1, -2, 1 },{ -2, -4, -3 },{ -2, -1, 2 },{ -3, 0, 0 },{ 3, 1, -3 },{ -1, -4, -1 },{ 3, 3, 2 },{ -4, 0, 1 },{ 1, -4, -2 },{ -4, 2, -3 },{ -1, -2, 1 },{ 0, 1, 0 },{ -2, -4, 2 },{ 2, 2, 1 },{ -1, 0, 0 },{ -2, -2, 3 },{ 2, 2, -3 },{ 0, -4, 1 },{ 2, -3, -2 },{ 1, -2, -4 },{ -1, 3, 1 },{ -1, 0, 3 },{ 3, 2, -3 } }, - { { 0, -4, 3 },{ 1, -2, -1 },{ 3, 2, 1 },{ 0, -2, -1 },{ -2, 1, 1 },{ 1, 0, -3 },{ 2, 3, -1 },{ -3, -3, 1 },{ 1, -1, -2 },{ -4, -1, 1 },{ 3, 2, 3 },{ -4, -4, -3 },{ 1, 0, -4 },{ -3, -2, 1 },{ 0, 3, 1 },{ -1, 1, 2 },{ 3, -1, -2 },{ -4, 2, 1 },{ 1, -4, -4 },{ -1, 2, 2 },{ 3, -1, -3 },{ -2, -1, -3 },{ 2, -2, -4 },{ 3, -3, -2 },{ 1, 0, 0 },{ 2, 2, -3 },{ -1, 0, 2 },{ -3, -1, 0 },{ 0, -2, -4 },{ -1, -2, 0 },{ 2, 2, -2 },{ 0, -3, -3 },{ 1, 3, 0 },{ -1, -3, -4 },{ 0, 2, -1 },{ -3, -1, -4 },{ 0, -3, -1 },{ 2, 2, 3 },{ 0, -2, -4 },{ 3, 3, -1 },{ -2, -3, 0 },{ 2, 3, -4 },{ 3, 2, -1 },{ -1, 1, -2 },{ -4, 2, 1 },{ 1, -3, 1 },{ 0, -1, -3 },{ 2, 1, -2 },{ -1, -2, -1 },{ 3, -3, 1 },{ -3, 3, 0 },{ -1, -3, -4 },{ 3, 0, -1 },{ -3, -1, -3 },{ 0, 2, -2 },{ -2, -1, 2 },{ 3, -4, 0 },{ -4, -1, -4 },{ -1, 1, 3 },{ -3, 0, -1 },{ -2, 2, -3 },{ 3, -4, 2 },{ -2, -1, -2 },{ 0, -1, -1 } }, - { { 2, 0, -4 },{ -1, 1, 2 },{ -2, 0, -3 },{ 3, 3, -2 },{ -4, -4, -4 },{ 3, -3, 2 },{ -4, -1, -3 },{ -2, -2, 3 },{ 0, 2, -2 },{ -1, 1, -4 },{ -2, 0, 2 },{ 2, -4, -1 },{ 0, 1, 0 },{ -1, -1, 3 },{ 2, -4, -4 },{ -3, -3, -1 },{ 2, 1, 2 },{ 0, -2, 3 },{ -3, -3, -3 },{ 2, 0, -1 },{ 1, 1, 0 },{ -3, 3, 3 },{ 0, 1, 0 },{ -1, 2, 2 },{ -4, -2, -1 },{ 0, -4, 3 },{ 0, 1, -4 },{ 2, -4, -1 },{ -4, 3, 3 },{ 1, -4, 1 },{ -2, 0, -1 },{ -4, -1, 3 },{ -3, -1, 2 },{ 3, -4, 2 },{ 1, 1, -2 },{ -2, -2, 3 },{ -4, 1, -3 },{ 2, 3, 1 },{ -2, -1, 2 },{ 0, -4, -3 },{ -4, -1, 2 },{ -4, 0, 0 },{ 1, 0, 3 },{ -1, -2, -4 },{ 3, -4, 3 },{ 1, -2, 0 },{ -3, 2, -4 },{ -3, -3, 0 },{ -2, 1, -4 },{ 0, -1, 3 },{ 1, -1, 2 },{ -3, -4, -2 },{ 2, 2, 2 },{ 1, 3, 0 },{ -4, -3, 3 },{ 1, -3, -4 },{ -3, 3, -2 },{ 0, 0, 2 },{ 2, 2, -1 },{ 3, 1, 0 },{ -3, -3, 3 },{ -4, 3, -4 },{ 1, -3, -3 },{ -3, 2, 1 } }, - { { -3, 3, -2 },{ -4, -3, 0 },{ 2, -4, 3 },{ -3, -1, 0 },{ 0, -1, 3 },{ -1, 2, 0 },{ -2, 0, -1 },{ 2, 2, 0 },{ 3, -4, 2 },{ -3, -2, 0 },{ -1, -3, 1 },{ 1, 3, -2 },{ -3, -1, -3 },{ -2, 2, -2 },{ 3, 0, 0 },{ -4, -2, -3 },{ 1, 3, 0 },{ -2, -1, -1 },{ 3, 0, -4 },{ -2, 2, 3 },{ -4, -4, 1 },{ 0, -3, -2 },{ -3, -4, 2 },{ 3, 0, -4 },{ -2, 3, -1 },{ -4, -2, 1 },{ -2, 1, 1 },{ 3, -1, -2 },{ -3, 0, -3 },{ -1, 2, 2 },{ 3, -3, -4 },{ 2, 1, -2 },{ -2, 2, -3 },{ -4, -2, 1 },{ 2, 3, 0 },{ -1, 0, 1 },{ 3, -4, -2 },{ 1, -3, 0 },{ -1, 0, -2 },{ -3, 1, -3 },{ 2, 2, 2 },{ 0, -3, -2 },{ -2, -2, 1 },{ -3, -4, -3 },{ 0, 3, -1 },{ -4, 0, -2 },{ 2, 3, 3 },{ 0, -2, 2 },{ -4, 3, -3 },{ 3, 1, -1 },{ 1, 2, -3 },{ -2, 0, 1 },{ -2, -2, 3 },{ 2, -3, -4 },{ -1, -1, -1 },{ 3, 1, 1 },{ 0, 1, -1 },{ -2, -2, -3 },{ 1, -3, 1 },{ -1, -4, -2 },{ 0, -1, 2 },{ 2, 0, -1 },{ 1, -2, 3 },{ -1, 1, 1 } }, - { { 3, -2, -1 },{ -2, -3, 3 },{ 0, 1, -3 },{ 1, 3, 1 },{ 2, -2, -4 },{ -1, 1, -2 },{ 3, -4, 2 },{ 0, 3, -3 },{ -4, 0, -4 },{ 2, 1, -1 },{ 0, 3, 3 },{ -4, -2, -3 },{ 3, -3, 2 },{ -1, 3, 2 },{ 1, 1, 3 },{ -1, -3, -2 },{ -2, 2, -4 },{ 0, -4, 1 },{ -4, 3, 1 },{ 2, -2, -2 },{ -1, -1, 0 },{ 2, 3, -4 },{ -2, -1, -1 },{ 1, 1, -3 },{ 2, -1, 3 },{ -3, -3, -4 },{ 1, 2, -3 },{ 1, -3, 0 },{ -2, -1, 2 },{ 2, 3, -2 },{ -2, 1, 0 },{ 0, -4, 1 },{ 1, -2, -3 },{ 0, 0, -1 },{ -4, -4, -4 },{ -1, 2, 0 },{ 0, -1, 2 },{ -4, 3, -4 },{ -3, -2, 3 },{ 3, 2, -1 },{ 1, -4, 1 },{ 3, 0, -4 },{ -3, 2, -1 },{ 2, 1, 2 },{ 1, -1, 0 },{ -2, 1, 1 },{ -1, -4, 2 },{ 3, 0, -2 },{ 1, -4, 0 },{ -2, -2, 3 },{ -4, -4, -4 },{ 2, 3, -2 },{ -4, -1, -1 },{ 0, 1, -3 },{ -3, 3, 1 },{ -4, -4, -2 },{ 2, 0, 3 },{ -3, -2, 2 },{ 3, 3, -4 },{ -4, -1, 1 },{ -1, 2, -3 },{ -3, 3, -2 },{ 0, 1, 0 },{ 3, -4, -4 } }, - { { -1, 2, 2 },{ 2, -1, -2 },{ -1, 1, 1 },{ -3, 2, -2 },{ -3, -3, -3 },{ -4, -3, 2 },{ 1, 0, 3 },{ -2, -3, -1 },{ -3, -1, 1 },{ 0, -4, 1 },{ 1, -1, -2 },{ -2, 1, -4 },{ 2, 0, 0 },{ 0, -4, -1 },{ -4, -2, -4 },{ 2, 1, 1 },{ -3, 0, 3 },{ 3, -2, -2 },{ -1, -4, -1 },{ -3, 1, 2 },{ 1, 0, -3 },{ 3, -2, 3 },{ -4, 2, 2 },{ 0, -4, -2 },{ -1, -3, 0 },{ 3, 3, 2 },{ -1, 0, 1 },{ 0, 2, -1 },{ -4, -4, 3 },{ 0, -2, -4 },{ -4, -3, 0 },{ -3, 2, 3 },{ 3, 3, -2 },{ 1, 1, 2 },{ -3, -2, 3 },{ 3, 2, -3 },{ -2, 0, 2 },{ 2, 1, -3 },{ 0, -4, 1 },{ -4, -2, 0 },{ -2, -1, -4 },{ 0, 3, -1 },{ -1, -3, 3 },{ 3, 3, -2 },{ -2, -2, -4 },{ -4, -3, 1 },{ -2, -1, -4 },{ 2, 2, -2 },{ -3, 1, 1 },{ -1, -1, 0 },{ -1, 0, 1 },{ 0, -3, 2 },{ 3, -4, 0 },{ 0, -2, -4 },{ -2, 2, 2 },{ 3, -3, 0 },{ -1, 3, -4 },{ -2, -1, 0 },{ -3, 2, -1 },{ 1, -4, 0 },{ 3, -3, -2 },{ 2, -2, 1 },{ -2, -4, 2 },{ -4, 0, -3 } }, - { { 0, 3, 1 },{ -4, 0, -4 },{ 1, -3, 0 },{ 3, -2, -1 },{ 2, 0, 0 },{ -2, 3, 1 },{ 1, -1, -2 },{ 2, -2, -4 },{ -1, 3, -3 },{ 3, 2, 3 },{ -3, -3, -3 },{ -1, 2, 1 },{ -4, -4, 2 },{ 3, 3, -1 },{ -2, -1, -3 },{ 1, -1, 1 },{ 0, -3, 0 },{ 2, 3, -3 },{ -1, -1, 2 },{ -4, 2, -4 },{ 1, 1, 0 },{ -2, -3, 1 },{ -1, 0, -2 },{ -4, 1, 1 },{ 1, -1, 0 },{ -3, 0, -3 },{ -4, -4, -2 },{ 2, -2, -4 },{ 3, 1, 1 },{ -3, 0, -1 },{ 3, -1, 2 },{ -1, 0, -4 },{ -1, -1, 0 },{ -2, -4, 2 },{ 1, -3, -2 },{ 2, -1, -1 },{ -3, -3, -1 },{ -1, -3, 3 },{ 3, 1, -2 },{ 1, 3, 3 },{ -2, -2, 1 },{ -1, 1, 2 },{ -4, -1, 0 },{ 1, -3, -3 },{ 0, 0, 3 },{ 3, 2, -1 },{ 0, -2, -3 },{ 0, 3, -1 },{ -4, -3, 3 },{ 2, -2, -4 },{ 3, 3, -3 },{ -3, 2, 3 },{ 1, 1, -1 },{ -4, 1, 3 },{ 1, 0, 0 },{ -3, -1, -3 },{ 0, -4, -2 },{ 1, -3, 3 },{ 2, 2, -3 },{ -4, 1, 3 },{ 0, 0, 2 },{ -2, 0, -4 },{ -3, 2, 0 },{ 1, -2, -1 } }, - { { -1, 1, 3 },{ -3, -4, -2 },{ -2, 3, 2 },{ -2, -4, 3 },{ 0, 1, -3 },{ -1, 2, -4 },{ -3, -4, 2 },{ 0, 1, -1 },{ -4, 1, 0 },{ -2, -2, 2 },{ 2, 0, -1 },{ -3, -2, 3 },{ 1, 2, -2 },{ 0, -2, -2 },{ -3, 0, 3 },{ -1, 3, -1 },{ -4, 2, 3 },{ -2, 1, -4 },{ 1, -3, -2 },{ 3, -1, 3 },{ 0, -4, -1 },{ -3, 3, -3 },{ 2, -2, 3 },{ 0, -3, -4 },{ 3, 3, 2 },{ -2, 2, -1 },{ 1, -2, 3 },{ -1, 3, 1 },{ -2, 2, -2 },{ -1, -4, 2 },{ 1, 3, -3 },{ 2, 2, -1 },{ -4, -3, 1 },{ 2, 2, -4 },{ -2, 0, 0 },{ 0, 1, -3 },{ -1, 3, 1 },{ 1, 0, -2 },{ -2, 2, 0 },{ 1, 0, -4 },{ 2, -3, -3 },{ -3, 1, -2 },{ 3, -4, -3 },{ -3, 2, 1 },{ -4, -4, -4 },{ 1, -1, 2 },{ -3, 2, 0 },{ -1, -4, 2 },{ 3, 1, -3 },{ 1, 2, -1 },{ -2, -3, 2 },{ -3, -2, -3 },{ -1, -1, -2 },{ 2, -4, -4 },{ -1, 2, 2 },{ 2, -2, -1 },{ 3, 0, 1 },{ -4, 1, 2 },{ 0, 0, -4 },{ -2, -4, -1 },{ 1, -2, -3 },{ -1, 3, -2 },{ 3, -3, 3 },{ 0, -1, -3 } }, - { { 3, 0, -2 },{ 2, -2, 0 },{ 0, 2, -4 },{ 1, -2, 2 },{ -4, 0, -2 },{ 3, -3, 0 },{ -2, -2, 3 },{ 3, 2, 1 },{ 2, -3, -3 },{ 1, -4, -2 },{ 0, 3, -4 },{ -4, 1, 0 },{ 3, -1, -4 },{ -1, -3, 2 },{ 2, 2, 0 },{ 1, -4, -4 },{ 3, -4, 2 },{ 0, -2, 1 },{ -2, 1, -1 },{ -4, -3, 1 },{ 2, -1, -4 },{ -1, 2, 1 },{ 3, 1, -1 },{ -2, -1, -4 },{ -3, -4, 0 },{ 0, -1, -2 },{ 3, -3, 2 },{ -3, 1, -3 },{ 0, -3, -1 },{ 2, -1, 0 },{ -4, -3, 3 },{ -2, 1, -3 },{ 0, -4, -2 },{ 3, 1, 3 },{ -4, 3, -2 },{ 3, -2, 2 },{ -4, -4, 1 },{ 3, -1, -4 },{ -3, -2, 2 },{ -4, -4, -1 },{ -1, 0, -1 },{ 0, 3, 3 },{ 2, -2, 0 },{ 0, 0, -1 },{ -1, 3, 3 },{ 3, -1, -2 },{ 2, -3, 0 },{ -2, 0, 1 },{ -4, -1, -2 },{ 2, -4, 3 },{ -4, 1, 0 },{ -2, 0, 0 },{ 3, -2, 1 },{ 0, 3, 1 },{ -4, -3, -2 },{ -2, 2, 3 },{ -3, 3, -3 },{ 1, -2, -2 },{ -1, -3, 1 },{ -3, 3, 0 },{ 3, -1, 1 },{ -4, 1, 2 },{ -3, 2, -1 },{ 2, -4, 1 } }, - { { -4, 2, 2 },{ 1, -1, -1 },{ -1, 3, -3 },{ 2, -1, -1 },{ -4, 1, 1 },{ -1, -1, -1 },{ 1, 3, -4 },{ -3, -1, -1 },{ -4, 0, 3 },{ -1, 0, 1 },{ -2, -4, 2 },{ 2, -1, 1 },{ 1, 3, -1 },{ -2, 0, 1 },{ -3, 1, -3 },{ -4, -2, -2 },{ 2, 0, -1 },{ -3, -1, -3 },{ -1, 2, 0 },{ 2, 3, 2 },{ -3, 0, 0 },{ -4, -2, -3 },{ 1, -4, 2 },{ -3, 2, -2 },{ 2, 1, 1 },{ -4, 0, 3 },{ 2, -1, 0 },{ -1, 2, -4 },{ 2, -1, 3 },{ -3, 0, -4 },{ -2, 3, -2 },{ 1, -2, 1 },{ 0, -2, 2 },{ -3, -1, -1 },{ -1, -3, -3 },{ 1, 1, 3 },{ -3, -1, -4 },{ 0, 2, 0 },{ 0, -3, 3 },{ 3, 3, -2 },{ -4, -2, 2 },{ 2, 2, 1 },{ -2, -1, -4 },{ -2, 1, 2 },{ 1, -3, -1 },{ -4, 1, -3 },{ -1, 1, 3 },{ -3, 3, -4 },{ 0, -2, -3 },{ 0, 0, 1 },{ 1, 3, -2 },{ 0, -4, -4 },{ 1, 1, -1 },{ -4, 0, 3 },{ 2, -3, -4 },{ -1, -1, -1 },{ 0, 1, -1 },{ -3, -4, 0 },{ 3, 0, -4 },{ 2, 2, 3 },{ 0, -3, -2 },{ 1, -2, -4 },{ -1, -1, 0 },{ -2, -3, -4 } }, - { { -2, 1, 3 },{ -3, -3, 1 },{ -3, -4, -4 },{ 3, 0, 3 },{ -2, -3, -2 },{ 2, -4, 3 },{ 0, 2, -3 },{ -2, -4, -2 },{ 3, 1, 0 },{ 0, -2, -4 },{ 3, 3, -2 },{ -4, -3, -3 },{ -3, -1, -3 },{ 0, -4, 3 },{ 2, 3, 2 },{ -1, -3, 0 },{ -2, 1, 3 },{ 0, 3, -3 },{ 3, -4, -4 },{ 1, -2, -2 },{ -1, -3, -2 },{ 3, 0, 3 },{ -2, 3, -1 },{ 0, -3, 0 },{ -1, -2, -3 },{ 1, 3, -4 },{ -3, -3, -1 },{ 0, 1, 1 },{ -4, -4, -2 },{ 3, -4, 1 },{ -1, 2, 0 },{ 2, 0, -3 },{ -3, 2, 3 },{ 3, 3, -4 },{ -1, -3, 1 },{ -2, 2, 0 },{ 2, -4, -1 },{ -1, 1, -3 },{ 2, -2, -3 },{ -2, 1, 1 },{ 1, 0, -4 },{ 3, -4, -3 },{ -4, -3, -2 },{ -3, 3, 3 },{ 3, -2, -4 },{ -2, 2, -3 },{ 1, -4, -1 },{ 3, -2, 2 },{ 1, 2, 0 },{ -1, -3, -4 },{ -3, -1, -1 },{ 2, 2, 3 },{ -1, 2, 2 },{ -3, -2, -3 },{ 3, -1, 0 },{ 1, 3, 2 },{ 3, -4, 2 },{ -1, 2, 3 },{ -4, -2, -3 },{ 1, -1, -1 },{ -2, 1, 2 },{ -4, -4, 3 },{ 3, 0, -1 },{ 0, 3, -3 } }, - { { -1, -4, -3 },{ 1, -1, -2 },{ 2, 2, 2 },{ 0, 1, 0 },{ -3, 3, 1 },{ 1, -2, -4 },{ -1, 0, 2 },{ -4, -2, 1 },{ 2, 3, -3 },{ -3, -3, 2 },{ 1, 1, -1 },{ -1, 2, 3 },{ -1, -3, 0 },{ 3, -2, -1 },{ 0, 2, -2 },{ 1, -1, -4 },{ -3, 0, 1 },{ 3, -3, 3 },{ -4, 0, -1 },{ -2, 1, 3 },{ -3, 2, 2 },{ 0, -1, -4 },{ 2, 1, 1 },{ -3, -1, 3 },{ -1, 0, 2 },{ 3, -4, -2 },{ -2, 2, 2 },{ -2, -2, 3 },{ 0, 3, -3 },{ 3, -2, 2 },{ -2, 1, -1 },{ -4, -3, -4 },{ 1, -4, 0 },{ 2, -1, -1 },{ -4, 0, -2 },{ 1, -2, 3 },{ 2, 0, 1 },{ -4, 3, -2 },{ -2, -1, 2 },{ 1, -3, 0 },{ -1, 2, 3 },{ -1, -1, -2 },{ 0, -3, 2 },{ 2, 0, -1 },{ 0, -4, 0 },{ -3, -1, 1 },{ 2, -2, 0 },{ -4, 0, 2 },{ -3, 3, -1 },{ 3, -4, 3 },{ -2, -1, 1 },{ -4, -2, -3 },{ -1, -3, -2 },{ 0, 2, 0 },{ -2, -4, -2 },{ -2, 1, -4 },{ 1, -2, -3 },{ -4, -1, 1 },{ -2, 0, 0 },{ 2, 2, -4 },{ -2, 3, -2 },{ -3, 2, -3 },{ 2, -2, 1 },{ 2, 0, 1 } }, - { { -4, -2, 3 },{ 3, 3, 0 },{ -1, -2, -2 },{ -3, -4, -1 },{ 0, 2, -3 },{ -4, 1, 3 },{ 3, -1, 0 },{ 1, 3, -1 },{ -1, -4, 2 },{ 2, -1, -2 },{ -2, -2, 0 },{ 1, 2, -4 },{ -4, 0, 2 },{ -3, 1, -2 },{ -4, -1, -4 },{ -2, -4, 1 },{ 2, 2, -1 },{ -4, -2, 1 },{ 0, -2, 0 },{ 1, 2, -3 },{ 3, -3, 1 },{ -1, -4, 0 },{ 1, 3, -3 },{ -4, -3, -2 },{ 3, 2, -4 },{ -4, -2, 0 },{ 2, 0, 0 },{ 1, 1, -1 },{ -4, -1, -3 },{ 1, -1, 0 },{ -1, 3, -2 },{ 0, -2, 3 },{ -2, 0, 1 },{ -1, 2, 2 },{ 0, 1, -2 },{ -3, -3, -4 },{ 3, 2, 2 },{ 0, -1, 3 },{ -3, -4, -1 },{ 3, 0, -4 },{ -3, 3, -1 },{ -4, -2, 0 },{ -1, 3, 1 },{ 2, 1, -3 },{ -3, 2, 2 },{ 0, 1, 3 },{ -1, 3, -2 },{ 3, -3, -4 },{ -2, 1, -3 },{ 0, 1, -2 },{ 2, 0, -1 },{ 3, 3, 2 },{ 1, -4, -4 },{ 3, 0, 1 },{ -3, 3, -1 },{ -4, -2, 3 },{ -1, 1, -2 },{ 2, 3, 2 },{ 0, -3, -3 },{ 3, -3, 1 },{ -1, -4, 2 },{ 1, -1, 0 },{ 0, -3, -4 },{ -3, 2, -1 } }, - { { 0, -3, 2 },{ 2, 0, -4 },{ -4, 1, 2 },{ -2, -1, 1 },{ -1, -3, -4 },{ 2, -4, -2 },{ -2, -2, -1 },{ -3, 2, -4 },{ 0, 1, -3 },{ -4, 0, 3 },{ -3, 0, 1 },{ 3, -4, -2 },{ 2, -2, -3 },{ 0, 3, 3 },{ 1, -3, 0 },{ 3, 1, 2 },{ -1, -2, -2 },{ 0, 3, -4 },{ 2, -4, 0 },{ -2, -1, -2 },{ -4, 3, -4 },{ -3, -1, -1 },{ 2, -2, -2 },{ -2, 2, 1 },{ 0, -1, 3 },{ 0, -4, -1 },{ -3, 3, -4 },{ -1, -3, -3 },{ 2, 0, 2 },{ -3, -4, 1 },{ 2, 1, -4 },{ 3, -1, 2 },{ -3, 3, -3 },{ 3, -4, -3 },{ -4, -2, 2 },{ 1, 3, 0 },{ -2, -4, -3 },{ -1, 2, -4 },{ -4, -3, -1 },{ 2, 1, 2 },{ 0, -2, 2 },{ 3, -4, -4 },{ -2, 0, 1 },{ -4, -1, -3 },{ 3, -3, -1 },{ 1, -2, -4 },{ -2, -4, -2 },{ 0, 0, 1 },{ -1, -1, 3 },{ -4, -3, 1 },{ 1, -2, 0 },{ -3, 1, -3 },{ -4, -1, 0 },{ 0, -2, 3 },{ 2, 0, 1 },{ 1, -3, -4 },{ 3, -4, 0 },{ -3, 2, -2 },{ -3, 0, -1 },{ 1, 1, 3 },{ -1, -2, 1 },{ -4, 0, -1 },{ 3, 3, 2 },{ -2, 1, -2 } }, - { { -3, 3, -1 },{ 0, 0, -3 },{ 1, -3, 0 },{ 3, 3, 3 },{ 1, 0, -2 },{ -4, 0, 2 },{ -1, -3, 1 },{ 0, 2, 3 },{ 3, -3, 1 },{ 1, -4, -1 },{ 0, 3, -4 },{ 1, -1, 1 },{ -2, -3, 2 },{ -1, 3, -1 },{ -2, -4, -3 },{ -4, 0, 3 },{ -2, 0, -1 },{ -3, 2, -3 },{ -1, -1, 3 },{ -1, 1, 2 },{ 2, 1, 3 },{ 0, 0, -1 },{ 1, -4, 3 },{ -1, 1, 2 },{ -2, -3, -3 },{ 1, 0, -1 },{ 3, -4, 3 },{ 0, 1, 2 },{ -1, 3, 1 },{ -3, -3, -2 },{ -2, 2, -1 },{ -4, -3, 3 },{ 1, -2, -2 },{ -2, 1, 0 },{ 2, 0, -1 },{ 0, -1, 1 },{ -3, -1, -1 },{ 1, -2, 0 },{ 2, 0, 1 },{ -2, 1, -3 },{ 0, -1, -3 },{ 1, 2, 3 },{ 1, 1, -2 },{ 2, -3, 3 },{ -2, 3, 0 },{ -4, 0, 1 },{ 2, 2, 3 },{ -4, 3, -1 },{ 1, -3, 0 },{ -1, 2, -4 },{ 3, 3, 2 },{ -1, -4, -4 },{ -2, 1, 2 },{ 2, 3, -2 },{ -2, 1, -3 },{ -1, 2, -1 },{ 0, -1, 3 },{ 0, -4, 2 },{ 2, -2, -4 },{ -4, 3, -3 },{ 2, 2, -2 },{ 0, -1, -4 },{ -3, -3, -3 },{ 1, -4, 1 } }, - { { -1, -2, 0 },{ -2, 2, -2 },{ -1, -4, -4 },{ -3, -1, -1 },{ 3, 2, 0 },{ 2, 1, -3 },{ -2, 3, 0 },{ 3, -1, -3 },{ -4, -1, -2 },{ -2, 3, 2 },{ -1, 2, -3 },{ -4, -3, 3 },{ -3, 1, 0 },{ 3, -1, -3 },{ 2, 2, 1 },{ 1, -2, 0 },{ 2, -3, -4 },{ 3, 1, 2 },{ -3, -4, -2 },{ 1, -3, 0 },{ 3, -3, -4 },{ -4, -2, 1 },{ -3, 1, -2 },{ 3, 3, 0 },{ 2, 0, -4 },{ -3, 2, -2 },{ -4, -2, 1 },{ -2, -1, -3 },{ 1, 2, 0 },{ 3, -2, 3 },{ 0, -1, -4 },{ 0, 3, 0 },{ 2, 0, 1 },{ -1, -4, -2 },{ 2, 3, 3 },{ -4, -3, -3 },{ -2, 1, 3 },{ 3, 2, -2 },{ -1, 3, 3 },{ 3, -4, -2 },{ -2, -3, 1 },{ -4, 3, -1 },{ -3, -4, 0 },{ -1, 1, -4 },{ -3, -1, -2 },{ 0, 0, -3 },{ 3, -2, -3 },{ -3, -4, 2 },{ 2, -1, -3 },{ 2, -1, -2 },{ -3, 2, 3 },{ -2, -3, -1 },{ 1, -2, 0 },{ -4, -1, -2 },{ 1, -3, 3 },{ -4, 3, -4 },{ -3, -1, 1 },{ -1, 2, 0 },{ 3, 1, 2 },{ -2, -2, 0 },{ -2, -4, -1 },{ 2, 0, 3 },{ -1, -1, 0 },{ 3, 2, 3 } }, - { { 2, -1, 2 },{ 2, 1, 3 },{ -4, -3, 1 },{ 0, 0, 2 },{ -4, -4, -3 },{ -3, -2, 3 },{ 0, -2, -4 },{ 1, 0, -1 },{ -3, -4, 0 },{ 2, 1, 0 },{ 2, -2, -3 },{ 0, 0, -2 },{ 3, 1, 3 },{ -2, -4, -4 },{ 0, 0, -2 },{ -4, 3, 2 },{ 0, 2, 1 },{ 1, -3, -1 },{ -4, -1, -2 },{ 0, 3, 1 },{ -2, 2, -3 },{ 2, 2, 2 },{ -2, -4, -4 },{ 0, -3, 0 },{ -4, -2, 1 },{ -1, 2, 2 },{ 1, -3, -2 },{ -2, 1, -4 },{ 2, -1, -1 },{ -4, 0, -3 },{ -2, -4, -1 },{ -3, 1, -3 },{ 3, 2, -4 },{ -3, -1, 2 },{ 0, 2, -4 },{ -1, -3, -3 },{ 1, -2, 1 },{ -4, -4, -4 },{ 1, 0, 2 },{ -3, -2, -4 },{ -4, 0, 0 },{ 0, -1, -3 },{ 3, -2, 2 },{ 0, 2, 1 },{ 2, -4, 2 },{ 1, 2, 3 },{ -2, 3, -1 },{ 0, -3, 2 },{ -2, 1, -4 },{ -4, 0, 0 },{ 1, -4, -2 },{ 0, 0, 1 },{ 3, 2, -4 },{ 0, -1, 1 },{ -3, -4, 0 },{ 3, -3, -1 },{ 2, 0, -2 },{ -4, -2, -2 },{ 1, -3, -3 },{ -3, -1, -4 },{ 1, 1, 2 },{ -4, 3, 1 },{ 1, -4, -3 },{ -4, 1, -4 } }, - { { 3, -4, -4 },{ -3, -2, -1 },{ 1, 3, -2 },{ -1, 2, -3 },{ 3, -1, 3 },{ -2, 3, -1 },{ -1, -4, 1 },{ -4, -1, 2 },{ 1, 2, 3 },{ -1, -3, -4 },{ -3, -2, 1 },{ 0, 3, -1 },{ -3, 0, 2 },{ 1, -3, 0 },{ -1, -2, 3 },{ -3, -1, -2 },{ -1, -4, -3 },{ 2, 0, 3 },{ -2, 3, -4 },{ 3, 0, 0 },{ -1, -2, -3 },{ -3, 0, -1 },{ 1, -1, -2 },{ 1, 3, 3 },{ -2, 0, -3 },{ 3, -4, -1 },{ 2, 3, 2 },{ 0, -2, 0 },{ -3, -4, 3 },{ 3, 3, 2 },{ 0, -3, 1 },{ 1, 0, 2 },{ -4, -4, 3 },{ 1, -3, -1 },{ -3, 0, 2 },{ -1, 2, 0 },{ 3, 1, -1 },{ -3, -3, 2 },{ 2, -1, -1 },{ 0, 3, 0 },{ 2, -3, 3 },{ 3, 2, 3 },{ -1, -2, -2 },{ -4, 0, -3 },{ -2, -2, -4 },{ 1, -4, 0 },{ -4, 1, 0 },{ -1, -1, -2 },{ 3, 2, 1 },{ 0, -2, 3 },{ -2, 3, -3 },{ -4, -3, 3 },{ -1, 0, -1 },{ 2, 3, -3 },{ -2, 1, 3 },{ 1, 1, -3 },{ -1, 3, 2 },{ 0, 2, 1 },{ 2, -4, 0 },{ -1, 3, 3 },{ 0, 0, -1 },{ 3, -3, 1 },{ -2, -2, -2 },{ -1, 0, -1 } }, - { { 0, 0, 3 },{ -2, 3, 1 },{ 3, -1, 0 },{ 0, 1, -2 },{ 1, -3, 1 },{ 0, 1, -4 },{ 2, 1, -1 },{ 3, 3, -2 },{ 0, 1, -4 },{ -2, 0, 2 },{ 3, -4, 1 },{ -4, 2, -2 },{ 2, -4, -4 },{ 2, 3, -3 },{ -4, -1, -1 },{ 3, 3, 1 },{ 0, -2, -3 },{ -3, 2, 1 },{ -2, -2, -1 },{ -4, 1, 3 },{ 0, -4, 2 },{ -1, -3, 1 },{ -3, -1, 3 },{ 2, 1, -4 },{ -4, -2, -1 },{ -1, 1, 3 },{ 0, 2, -4 },{ -4, -1, -1 },{ -1, 0, -2 },{ 1, 1, -3 },{ -1, 2, -2 },{ 2, -1, 0 },{ -1, -2, -3 },{ -2, 3, -2 },{ 2, -1, 0 },{ 3, -4, 3 },{ 0, 0, -2 },{ -4, 3, 1 },{ -1, 2, -3 },{ -2, -1, -3 },{ -1, 1, -2 },{ -3, 2, -4 },{ 1, -3, -1 },{ 2, 3, 1 },{ -3, 1, 3 },{ 3, -1, -2 },{ -1, 0, -4 },{ 1, 2, 2 },{ -3, -4, 0 },{ 2, -2, -3 },{ 2, 1, -1 },{ -1, -1, 2 },{ 3, 2, -4 },{ -4, -2, 0 },{ 1, -4, 2 },{ -3, -2, -1 },{ 3, -3, -4 },{ -2, -1, 3 },{ -3, 0, -1 },{ 3, -3, -2 },{ -3, 1, -3 },{ -2, -1, -4 },{ 1, 3, 2 },{ -3, 2, 0 } }, - { { 1, 1, -3 },{ -4, -3, 0 },{ 2, -4, -4 },{ -4, -2, 2 },{ -3, 0, 0 },{ -2, -4, -2 },{ -4, -1, 2 },{ -3, -2, 0 },{ 2, -3, -3 },{ -4, 3, -1 },{ 1, -1, 3 },{ -1, -1, -2 },{ 0, 1, 0 },{ -2, -3, 1 },{ -1, 2, 2 },{ 3, 1, -1 },{ -2, 0, -4 },{ 1, -4, 3 },{ 2, -3, 0 },{ 3, 2, -1 },{ 2, 1, -4 },{ -4, 3, -2 },{ 3, -3, 0 },{ 0, 1, 1 },{ -1, -4, -3 },{ -3, -3, 0 },{ 3, 0, -2 },{ -3, 3, 3 },{ 2, -3, 2 },{ -4, -4, 1 },{ -2, -2, -4 },{ -3, 3, 1 },{ 3, 0, -1 },{ -4, 1, -4 },{ 0, -2, 1 },{ -2, -2, -4 },{ -3, 1, -3 },{ 2, -4, 0 },{ 1, 0, 3 },{ 3, -2, 2 },{ 2, -4, 1 },{ -2, 0, 1 },{ -4, -4, 0 },{ -1, -1, 2 },{ 0, -3, -1 },{ 0, 3, 1 },{ 2, -2, -3 },{ -4, -3, 3 },{ 3, 3, -1 },{ -2, -4, -4 },{ -3, 2, 2 },{ 1, -3, -2 },{ -3, -4, 0 },{ -2, 0, 1 },{ 0, -1, -2 },{ 0, 2, -2 },{ -4, 0, 1 },{ -1, 1, 0 },{ 0, 2, -4 },{ 2, -2, 1 },{ -4, 3, 3 },{ 0, -4, 0 },{ 2, -1, 1 },{ -1, -3, -3 } }, - { { 3, 2, 3 },{ -1, -2, -2 },{ -3, 0, -1 },{ -2, 2, 3 },{ 2, 3, 1 },{ 3, -3, -4 },{ -1, 2, 3 },{ 0, 0, -2 },{ 1, -2, 2 },{ -2, 1, -3 },{ 3, -3, 0 },{ -3, 2, 2 },{ -4, -2, -3 },{ 1, 0, 3 },{ -3, -3, -4 },{ 1, -4, 3 },{ -4, -1, -3 },{ 2, 3, 1 },{ -1, -2, -2 },{ 0, -1, -3 },{ -2, 0, 0 },{ 1, 2, 1 },{ -2, -2, -3 },{ 3, 2, 2 },{ 0, 3, 2 },{ 2, -1, -2 },{ -2, -2, 1 },{ 1, 1, -4 },{ 2, -2, 0 },{ 0, -1, -3 },{ 3, 1, 2 },{ 0, -3, -1 },{ 2, 2, 3 },{ 0, -4, 2 },{ -4, 3, -2 },{ 1, 2, -1 },{ -1, -3, 3 },{ 0, 0, -4 },{ -3, -2, -1 },{ -4, 3, -2 },{ -3, -3, -4 },{ 0, 3, -1 },{ 1, -1, -3 },{ 3, 1, -2 },{ -3, 0, -4 },{ -2, -4, -1 },{ -4, 2, 2 },{ -1, -1, -2 },{ 0, 0, -3 },{ -1, 0, 1 },{ 0, -1, -1 },{ 3, 3, 1 },{ 1, -1, -3 },{ -2, 1, 3 },{ 2, 3, -4 },{ 3, -3, 3 },{ -3, -2, -3 },{ 1, -4, 1 },{ 2, -1, 2 },{ -1, -4, -3 },{ -4, 2, 0 },{ 3, 0, -2 },{ -2, 1, 2 },{ -3, -4, -1 } }, - { { 1, 1, 1 },{ 1, -1, -4 },{ 2, 3, 2 },{ 0, -2, -3 },{ -1, -1, -3 },{ 1, 1, -2 },{ 3, 2, 0 },{ -1, -1, 1 },{ -3, -4, -1 },{ -1, 2, -4 },{ 0, 0, 1 },{ 2, -4, -4 },{ 2, 3, -1 },{ 3, 2, -2 },{ -2, -2, 0 },{ 0, 2, -2 },{ -1, -1, 0 },{ -3, 1, 2 },{ -4, 2, -4 },{ -2, -4, 2 },{ -3, -3, 3 },{ 1, -1, -3 },{ -4, -4, -1 },{ -2, 0, -4 },{ -3, -3, -1 },{ -4, 0, 3 },{ -1, 2, 1 },{ 0, -4, -3 },{ -2, 2, -1 },{ -4, 2, 3 },{ 1, -1, 0 },{ -1, -4, -4 },{ -3, 0, -3 },{ -2, -3, 1 },{ 3, -1, 0 },{ 1, 1, 2 },{ -2, -1, 2 },{ 2, 3, -2 },{ 3, -4, 1 },{ 0, 1, 0 },{ 1, -2, 2 },{ -2, 2, 3 },{ 3, -2, -3 },{ 1, 3, 3 },{ -3, -2, 0 },{ 3, 2, 0 },{ 1, 1, 3 },{ -2, -4, 1 },{ 2, 3, 0 },{ -2, -2, 3 },{ -4, 1, -2 },{ 2, -4, 3 },{ 0, 1, -4 },{ -3, 2, -1 },{ -4, -3, 2 },{ -1, 0, 0 },{ 2, 3, -3 },{ -2, 3, -2 },{ -3, 1, -1 },{ -2, -2, 3 },{ -1, 0, -1 },{ 1, -3, -4 },{ 0, 3, -4 },{ -4, -2, 2 } }, - { { -3, 0, -1 },{ -2, -3, -2 },{ -4, 2, 1 },{ 3, -4, 0 },{ -4, -2, -1 },{ -2, -4, 2 },{ -3, 1, -3 },{ -4, -3, 3 },{ 2, 3, -4 },{ 1, 0, 2 },{ -4, -3, 3 },{ -2, -1, -1 },{ -1, 1, 2 },{ -4, -2, 1 },{ 2, 0, -3 },{ -1, 1, 2 },{ 3, -3, -1 },{ 1, -3, -2 },{ 2, 0, -1 },{ 0, 1, 1 },{ 3, 3, 1 },{ -1, 1, -2 },{ -1, -1, 3 },{ 2, 2, 2 },{ 1, -2, 0 },{ 3, 3, -4 },{ -1, -3, -1 },{ 3, -4, 2 },{ -3, 0, -2 },{ 2, 3, 1 },{ -2, -2, -2 },{ -4, 0, -1 },{ 3, 3, 3 },{ -1, -1, -2 },{ 2, 1, -3 },{ -4, -4, -1 },{ -3, -2, -4 },{ -4, 2, 0 },{ -2, 2, 3 },{ -1, 0, -3 },{ 2, -1, -4 },{ -2, 1, 0 },{ -4, -4, 2 },{ -1, 1, 1 },{ 0, -3, -4 },{ -4, -3, -3 },{ 0, 0, -3 },{ 2, -1, -2 },{ -3, -3, -4 },{ 1, -2, 2 },{ -4, 2, -3 },{ -1, -3, 0 },{ -2, -2, -2 },{ 3, -4, 0 },{ 2, -1, 2 },{ 1, -2, -1 },{ 0, 1, 1 },{ -4, -1, 2 },{ 3, -3, -4 },{ 0, 2, -3 },{ 3, 3, 1 },{ 2, -1, 3 },{ -2, -3, 0 },{ 3, 3, -2 } }, - { { -1, -4, 3 },{ 2, -3, -4 },{ -1, 1, 0 },{ 1, -1, 3 },{ -3, 0, 2 },{ 2, 3, 1 },{ 0, -2, -1 },{ -1, -1, -2 },{ 2, 1, 1 },{ 3, -4, -2 },{ -3, -2, 0 },{ 1, 3, -2 },{ 0, -1, 0 },{ -2, -4, 3 },{ 1, -4, -4 },{ -4, 3, 1 },{ -2, -2, -4 },{ 2, 3, 3 },{ -4, -4, 3 },{ -3, -1, -4 },{ 3, -2, -2 },{ -4, -3, 0 },{ 2, 1, -3 },{ 0, -4, 0 },{ -3, -1, -2 },{ 2, 1, -3 },{ -4, -1, 3 },{ 1, 1, 0 },{ -3, -1, -3 },{ -1, -2, -4 },{ 3, -3, 0 },{ 1, 1, 2 },{ 0, -2, 0 },{ -3, 3, -4 },{ -1, -3, 3 },{ 0, 2, 1 },{ 3, 0, -3 },{ 1, -3, -1 },{ 0, -1, -3 },{ -1, -4, 1 },{ -3, -3, -1 },{ 3, 3, -1 },{ -1, -3, -2 },{ -4, 0, -1 },{ 2, -1, 3 },{ -1, 1, 2 },{ -2, 3, -1 },{ 3, 2, 1 },{ -3, 0, -1 },{ 1, 2, 0 },{ 3, -1, -1 },{ 2, 3, 2 },{ -3, 0, 1 },{ 1, 2, -3 },{ -1, -1, -4 },{ -3, 2, 3 },{ -4, -4, -2 },{ 2, 0, 0 },{ 1, -1, 1 },{ -1, -4, 2 },{ -3, 1, -2 },{ -3, -4, 0 },{ -4, -1, -1 },{ 0, 1, -3 } }, - { { 2, 2, 2 },{ -4, -1, 2 },{ 0, 1, -2 },{ -2, -3, -3 },{ 0, 2, -4 },{ 3, 0, -4 },{ -3, -3, 3 },{ 0, 3, -1 },{ -2, -1, 0 },{ -2, 2, -3 },{ -1, 1, 3 },{ 3, -3, -3 },{ -3, 0, -4 },{ -3, 2, 2 },{ 3, 1, -2 },{ -3, -1, -1 },{ 0, -3, 1 },{ -2, 2, -3 },{ 1, 0, -1 },{ -1, -1, 0 },{ 2, 3, 2 },{ -2, 2, -1 },{ 0, -2, 1 },{ -3, 3, -4 },{ -2, 0, 2 },{ 0, -4, 1 },{ -2, 2, -4 },{ 1, 3, 3 },{ 2, -3, -1 },{ -2, 1, 2 },{ 0, 3, 3 },{ -3, -4, -3 },{ -2, -1, -1 },{ 2, -2, 2 },{ -1, 0, -1 },{ 1, 1, 0 },{ -3, -3, 3 },{ 2, 3, 2 },{ 3, 0, -2 },{ -4, 1, 3 },{ 2, -2, 2 },{ 0, 2, 1 },{ 1, 2, -4 },{ -2, -1, -3 },{ 3, 2, -2 },{ 2, -4, 0 },{ -2, -2, 1 },{ -4, -3, 3 },{ 0, 1, -4 },{ 0, -4, -3 },{ -1, -1, -2 },{ -2, 1, 3 },{ 0, -3, -4 },{ -4, 0, 1 },{ 0, -3, -2 },{ -2, 3, 0 },{ 2, -3, -4 },{ 0, 1, 3 },{ -2, 3, -2 },{ -4, -2, -1 },{ 1, 0, -4 },{ 2, 0, 2 },{ 0, 2, 1 },{ 1, -2, 1 } }, - { { -3, 0, -2 },{ -2, 3, -3 },{ 3, 2, -1 },{ 1, -2, 1 },{ -4, 3, 0 },{ 1, -4, -2 },{ -1, 0, 1 },{ 3, 2, -3 },{ 1, -4, 2 },{ -4, -2, -1 },{ 2, 0, 1 },{ 0, 3, 1 },{ 0, -3, 2 },{ 2, -2, -2 },{ -1, -1, 0 },{ 1, 3, -3 },{ 3, 0, 0 },{ -1, -1, 2 },{ -3, -4, -2 },{ 0, 2, -3 },{ -3, -2, -4 },{ -1, -4, 1 },{ -4, 1, 3 },{ 1, -3, -2 },{ 3, 2, 0 },{ 3, -3, -1 },{ -1, -2, 0 },{ 0, 0, -2 },{ -4, -3, 1 },{ 3, 2, 1 },{ -1, 0, -3 },{ 1, 1, -4 },{ 2, -4, -2 },{ -4, 2, 2 },{ 3, -2, -3 },{ -2, 2, -2 },{ -2, -1, -4 },{ -1, -4, 1 },{ -3, -2, -4 },{ 1, 3, 0 },{ -3, -1, -2 },{ -2, -3, -3 },{ 2, -4, 3 },{ -3, 0, 0 },{ 0, 3, 2 },{ -3, 1, -2 },{ 1, -1, -4 },{ -1, -2, -2 },{ 3, 0, 2 },{ -2, -4, 1 },{ 1, 3, 2 },{ -4, -2, -4 },{ 2, 2, -1 },{ -1, -4, 0 },{ 3, 1, 2 },{ -3, 0, -3 },{ 3, -2, -1 },{ -1, -4, 1 },{ 1, 2, -3 },{ 3, -3, -2 },{ -1, 3, 3 },{ -1, -3, -1 },{ -2, 1, -4 },{ 3, -3, -3 } }, - { { -4, 0, 0 },{ 1, -4, -1 },{ -3, -1, 3 },{ -1, -3, 2 },{ 3, -1, -2 },{ -2, 1, 3 },{ -2, -2, 2 },{ -4, -3, -4 },{ 0, 1, 3 },{ -3, -1, -2 },{ 1, 3, -4 },{ -4, -4, 0 },{ -2, -2, -1 },{ 1, 0, -3 },{ -4, 1, 2 },{ -2, -3, 3 },{ 0, -4, -4 },{ -4, 3, 3 },{ 3, 1, 1 },{ 3, -3, 2 },{ 1, 0, 0 },{ 2, -1, 3 },{ 3, 3, -3 },{ -1, 0, -3 },{ -3, -2, 3 },{ -4, 3, 2 },{ -2, -1, -3 },{ 2, 2, -2 },{ -3, -4, -4 },{ 1, -2, 0 },{ -4, -2, -1 },{ 0, 3, 3 },{ -2, 0, 1 },{ 0, -3, 0 },{ -4, 3, -3 },{ 1, -4, 1 },{ 2, -1, -1 },{ -4, 1, 2 },{ -1, 2, -3 },{ 2, -4, 0 },{ -2, -1, -1 },{ 3, 2, 2 },{ -1, 1, 1 },{ -4, -2, -1 },{ 1, -3, -4 },{ -2, -4, 3 },{ 2, 1, 0 },{ 1, 3, -3 },{ -4, 2, -1 },{ -3, 0, 0 },{ 0, -2, -2 },{ 3, 1, 0 },{ -2, -3, -3 },{ 2, 3, -1 },{ -4, -2, 3 },{ 1, 2, -2 },{ -3, -1, 0 },{ 0, 0, 2 },{ -3, 1, -4 },{ -2, -1, 0 },{ -4, -1, 2 },{ 3, -4, -3 },{ 0, 3, 3 },{ -2, -1, 0 } }, - { { 3, -4, 3 },{ -1, -2, -4 },{ 2, 2, 0 },{ -4, 2, -3 },{ 0, -4, -3 },{ -3, 0, 0 },{ 2, 1, -1 },{ 2, 3, -4 },{ -1, 0, 0 },{ 3, -3, -3 },{ 1, 1, 2 },{ -1, -1, -2 },{ 3, 2, 3 },{ 2, 3, 1 },{ -3, -2, -4 },{ 3, 1, -1 },{ -3, -1, -2 },{ 2, -2, 0 },{ -1, 1, -1 },{ -2, -3, -4 },{ -4, 2, -2 },{ 0, 0, -2 },{ -2, -4, -1 },{ 2, -3, -1 },{ 0, -1, 1 },{ 1, 1, -4 },{ -3, -4, 2 },{ 0, 1, 3 },{ 3, -1, 0 },{ -2, 0, -3 },{ 2, 3, 2 },{ -3, -4, 0 },{ 3, -1, -2 },{ 1, -1, -4 },{ -1, 1, 3 },{ -3, -2, 2 },{ 0, 0, 0 },{ 3, 0, 3 },{ 0, 3, -2 },{ 1, -3, 2 },{ -1, 1, -4 },{ 2, 0, -2 },{ -4, -3, -3 },{ 0, -1, 3 },{ 3, 3, -1 },{ -1, 0, -1 },{ -3, -3, 1 },{ -1, -4, 2 },{ 3, -1, 3 },{ 2, 2, -4 },{ -3, -3, 2 },{ 1, -1, 3 },{ -3, 0, 2 },{ -1, -1, 1 },{ 0, -4, -4 },{ 1, 1, 1 },{ -1, 3, 3 },{ -4, -4, -1 },{ 2, -3, 0 },{ 2, 3, 3 },{ 1, 1, -3 },{ -4, -2, 1 },{ -3, 2, -1 },{ 1, -2, 2 } }, - { { -1, 3, -3 },{ 0, 1, 1 },{ -3, 0, -4 },{ -2, -2, 3 },{ 3, 3, 1 },{ 1, -3, 2 },{ -3, 2, -2 },{ 1, -4, 0 },{ -3, -1, 2 },{ -2, -4, -1 },{ -2, 2, 1 },{ -4, -2, -4 },{ -3, -3, 0 },{ -1, -4, -3 },{ 0, 2, -1 },{ 0, -4, 1 },{ 1, 2, 2 },{ -2, 3, -3 },{ -4, -1, -3 },{ 1, -4, 1 },{ 2, 3, 3 },{ -2, -2, 0 },{ -4, 2, 2 },{ -1, 1, -4 },{ 1, 0, 1 },{ -4, 2, -3 },{ 3, -3, 0 },{ 1, 3, -1 },{ -3, 2, 3 },{ -1, -3, -2 },{ 1, 1, -4 },{ 0, -3, 2 },{ -3, 2, 1 },{ -2, 2, -1 },{ 3, -3, 1 },{ 2, 3, -2 },{ 1, 1, -3 },{ -4, -4, -4 },{ -2, -2, 1 },{ -2, -3, -1 },{ -3, 0, 3 },{ 0, -2, 1 },{ 3, 3, 0 },{ 1, 2, -3 },{ -2, -1, -2 },{ 2, -2, 1 },{ -4, 3, -4 },{ 0, 1, -2 },{ -2, -3, -3 },{ -2, -2, -1 },{ -1, 1, -1 },{ 1, -4, -4 },{ 2, 3, -3 },{ -2, 1, -2 },{ -4, -2, 0 },{ 2, -3, -4 },{ -2, -2, -3 },{ 3, 2, -3 },{ 0, -1, 1 },{ -2, -4, -4 },{ 0, 0, -2 },{ 2, -3, 0 },{ -1, 1, -4 },{ 2, 3, -2 } }, - { { 0, 0, -2 },{ -4, -3, 2 },{ 2, -1, 1 },{ 1, -4, -2 },{ 2, 0, -1 },{ -1, -1, -4 },{ -1, -2, 1 },{ -4, 2, 3 },{ 3, -2, -1 },{ 0, 3, -3 },{ 2, 0, 3 },{ 2, 1, -2 },{ 1, 0, 1 },{ 3, -1, 3 },{ -2, -1, -2 },{ -4, 1, 2 },{ -1, -2, 0 },{ 2, 0, -2 },{ -1, -3, 3 },{ 0, 3, 1 },{ -3, -2, -2 },{ 3, 1, -4 },{ 1, -3, 1 },{ -2, -2, 3 },{ 3, 3, -2 },{ -3, -2, 2 },{ -2, -4, -2 },{ -1, -1, -4 },{ 2, 0, 1 },{ -4, -4, 2 },{ -1, 2, -3 },{ 3, -2, -1 },{ -1, -4, 3 },{ 2, 0, -3 },{ -4, -2, 0 },{ -1, -4, -1 },{ -3, 2, 0 },{ -3, -1, -3 },{ 2, 1, 2 },{ 3, 3, -2 },{ -4, -4, -3 },{ -1, 2, 2 },{ -4, -4, -4 },{ 1, -3, 1 },{ -2, 1, 2 },{ 3, 2, 3 },{ -4, 0, -3 },{ 1, -4, 0 },{ 3, 0, 3 },{ 2, 2, -3 },{ -4, 3, 1 },{ 0, -1, 1 },{ -3, 2, -1 },{ 3, -3, 2 },{ 1, 2, 2 },{ 3, 1, 0 },{ -3, 0, -2 },{ -1, 1, 2 },{ 1, 3, 2 },{ -4, 2, -1 },{ -2, -2, 3 },{ 3, 1, 2 },{ -2, -1, -1 },{ -4, -3, 3 } }, - { { -2, 2, 0 },{ 3, -3, -2 },{ -2, 2, -1 },{ -1, 3, 0 },{ -4, 1, -4 },{ -3, -2, 2 },{ 0, -3, -3 },{ 3, 0, -2 },{ -3, -1, -4 },{ 1, 1, 1 },{ -4, -3, 0 },{ 0, -4, -4 },{ -1, 2, 2 },{ -4, 3, -1 },{ 1, -2, 0 },{ 3, 0, -4 },{ 2, -3, 2 },{ -3, -4, -3 },{ 0, 2, 0 },{ 3, 0, -1 },{ -3, 0, 2 },{ -1, -4, -3 },{ 0, -1, -2 },{ -3, 1, 0 },{ 0, -4, -3 },{ 2, -1, 3 },{ 1, 2, 0 },{ -2, 1, -4 },{ 0, -2, -1 },{ 3, 3, -3 },{ -3, 0, 1 },{ -2, -1, 0 },{ -4, 3, -4 },{ 2, 0, -2 },{ -1, -2, 2 },{ 0, 2, -4 },{ 3, -3, 3 },{ -1, 0, 2 },{ 0, -2, 0 },{ 1, 2, -4 },{ 1, -1, 0 },{ 2, 1, 3 },{ -3, -2, -2 },{ -1, 1, -1 },{ -3, -4, 0 },{ 0, -3, -4 },{ 0, -2, -1 },{ -1, 2, 2 },{ -3, -1, 1 },{ -3, -4, 2 },{ 0, 0, -2 },{ 3, -3, 0 },{ -4, -1, -4 },{ -1, -2, 3 },{ -2, 0, -3 },{ 0, -1, 0 },{ 1, -4, 3 },{ -4, -3, -1 },{ -1, -3, -2 },{ 3, 0, -3 },{ -3, 0, 0 },{ 0, 3, -3 },{ 1, -4, -4 },{ 2, -2, 1 } }, - { { -3, 1, 3 },{ 1, -1, -4 },{ 0, -2, -3 },{ -4, -4, 3 },{ 0, 0, -1 },{ 2, 1, 3 },{ -2, 2, 1 },{ 1, 3, 0 },{ -1, -4, 3 },{ -1, -3, -1 },{ -3, -1, -3 },{ -2, 3, 1 },{ 1, -3, -2 },{ -3, -2, -4 },{ 2, -4, -3 },{ -2, 1, 3 },{ -3, 3, -1 },{ -2, -1, -4 },{ 3, 1, 2 },{ -2, -1, -4 },{ 1, -3, -1 },{ -4, 2, 0 },{ 3, 3, 2 },{ 2, -1, -1 },{ -1, 2, -4 },{ -1, 0, -1 },{ -4, -3, 2 },{ 3, 0, 2 },{ -4, 2, 0 },{ 1, -3, 3 },{ 2, -2, 1 },{ 0, 1, -2 },{ 1, -3, 2 },{ 1, 3, 1 },{ -3, -1, 3 },{ -2, -1, -2 },{ 1, 1, 1 },{ 3, 3, -1 },{ -4, -4, -2 },{ -2, -3, 3 },{ -1, 0, 1 },{ 0, -1, -1 },{ 2, 0, -1 },{ 1, 3, -3 },{ 2, 0, 3 },{ -3, 2, 0 },{ 3, -2, -2 },{ 2, 1, -4 },{ -2, 3, -1 },{ 1, -2, -3 },{ 2, 1, 2 },{ -2, -4, 3 },{ -1, 1, -2 },{ 2, 3, 1 },{ -3, -4, -2 },{ -4, 3, -1 },{ -2, 0, -4 },{ 2, 3, 1 },{ 3, -2, 0 },{ 1, -1, -4 },{ -3, -4, 3 },{ 2, -3, 1 },{ -4, 2, -1 },{ -1, 0, -3 } }, - { { -1, -4, 1 },{ 2, 3, 0 },{ -2, -3, 2 },{ 3, -1, 1 },{ -3, 2, -3 },{ 3, -4, -2 },{ 2, -3, -1 },{ -4, -2, 0 },{ -2, 1, -4 },{ 3, 2, 3 },{ 2, 0, 2 },{ 3, -1, -2 },{ -2, 1, 2 },{ -1, 0, 3 },{ 0, 1, 0 },{ 0, 3, -2 },{ 1, -3, -1 },{ 2, 2, 1 },{ -4, -2, 3 },{ 1, 3, -2 },{ 2, -4, 1 },{ -1, 1, 3 },{ -3, -2, -4 },{ 1, -3, 1 },{ -4, 1, 1 },{ 1, -4, -3 },{ -3, 3, -3 },{ 2, -1, -2 },{ 0, -4, -1 },{ -2, -1, -4 },{ -1, 3, -2 },{ 3, -3, 0 },{ -4, -4, -3 },{ -2, 1, -1 },{ 3, -4, -1 },{ -3, 2, -4 },{ 1, -4, 0 },{ -4, -1, -4 },{ -2, 0, -3 },{ 0, 3, 0 },{ -3, -3, -4 },{ 3, 2, -2 },{ -4, -4, 2 },{ -2, -1, -4 },{ 3, -2, 1 },{ -1, 3, 2 },{ -4, -4, -2 },{ 1, 0, 3 },{ -4, -3, 0 },{ -1, -2, -4 },{ 3, 2, -2 },{ -4, 3, -1 },{ 1, -3, -4 },{ 3, 1, -3 },{ 1, -2, 2 },{ -1, -3, 3 },{ 3, 2, -3 },{ 0, -1, -3 },{ -4, 1, 2 },{ 0, 1, 2 },{ -2, 3, -2 },{ 1, -1, -1 },{ 0, 1, 2 },{ 3, -2, -2 } }, - { { 1, -1, 3 },{ -4, 1, -1 },{ 3, 2, -4 },{ -1, 1, 2 },{ 1, 3, -2 },{ -2, -1, -4 },{ -3, 3, 2 },{ -1, 0, -3 },{ 0, -1, -3 },{ 2, -4, 1 },{ -4, 3, 0 },{ 0, -2, -4 },{ 1, -4, -1 },{ 3, 2, 1 },{ -4, -3, -3 },{ -2, -1, 2 },{ 3, -4, 1 },{ -4, -2, -3 },{ -1, 1, 0 },{ -2, -4, 2 },{ 0, 0, -3 },{ -2, -1, -2 },{ -4, 0, -2 },{ 2, 3, 0 },{ -2, -2, 3 },{ 3, 2, -1 },{ -1, -3, 1 },{ 0, -2, 3 },{ -3, 1, 0 },{ -3, 0, -3 },{ 1, 2, 2 },{ -1, -1, 3 },{ -3, 2, -3 },{ 2, 0, 1 },{ -1, -2, 2 },{ 2, 3, -3 },{ -3, -2, 3 },{ -1, -3, 2 },{ 2, -1, 3 },{ 2, 1, 1 },{ 1, -4, -3 },{ -3, 2, 2 },{ -2, 3, 1 },{ 0, -3, 3 },{ -4, 1, -3 },{ 0, -1, -3 },{ -1, -1, 1 },{ -2, 2, 2 },{ 3, 1, 0 },{ 1, -3, 1 },{ -3, -1, 3 },{ 0, 0, 1 },{ -2, -2, 0 },{ 0, -1, 3 },{ -3, 2, 0 },{ 1, 0, -2 },{ -1, -4, 1 },{ -2, -3, 3 },{ -3, 2, -2 },{ -1, -4, 0 },{ 2, 0, 0 },{ -4, 2, -4 },{ -1, -3, -3 },{ -3, 3, 2 } }, - { { 0, -4, -3 },{ -2, -3, -2 },{ -3, 0, 0 },{ -4, -2, -1 },{ 1, -3, 0 },{ 0, -2, 3 },{ -4, 0, 1 },{ 3, -4, 2 },{ 1, -2, -1 },{ -3, 1, -2 },{ -2, 2, 3 },{ 1, 1, -3 },{ -4, -3, 1 },{ -3, 3, -1 },{ 2, -2, -4 },{ 1, 0, 0 },{ 0, 0, 2 },{ -1, 1, -2 },{ 3, -1, -4 },{ -3, 2, -1 },{ 2, 3, 3 },{ 3, 1, 0 },{ 1, -4, -3 },{ -1, -3, 2 },{ 0, -1, -2 },{ -2, 1, -4 },{ 2, 0, 2 },{ -2, 3, -2 },{ 2, -3, -4 },{ 3, 2, 1 },{ -4, -4, -1 },{ 0, -2, -4 },{ 3, 0, 0 },{ -4, 3, 2 },{ 0, -2, -2 },{ 0, 0, 1 },{ 3, 1, -1 },{ 0, 2, 0 },{ -1, 3, -2 },{ -4, -2, -1 },{ 3, -1, -2 },{ 1, -2, 0 },{ -1, 0, -2 },{ 3, -4, -1 },{ -2, 3, 0 },{ 2, 2, -1 },{ 2, -3, -2 },{ -3, -4, -4 },{ -3, 0, -3 },{ 0, 3, -2 },{ -1, -1, -1 },{ 3, 2, -3 },{ -4, -4, 2 },{ -2, 1, -1 },{ 2, -3, -4 },{ 3, 3, 2 },{ -4, 0, 0 },{ 2, -2, -1 },{ 1, 3, -4 },{ 3, -2, -3 },{ -2, -1, 3 },{ 1, -3, 1 },{ 3, -2, 0 },{ -2, 0, -4 } }, - { { 2, 1, -1 },{ 2, -1, 2 },{ -1, 3, 3 },{ 0, -4, -3 },{ 2, 0, 1 },{ -2, 1, -2 },{ -1, 2, -4 },{ 2, 3, 0 },{ -3, -3, 2 },{ 1, 0, -2 },{ -1, -2, -1 },{ -3, -4, -4 },{ -1, -1, 2 },{ 2, 1, -2 },{ -2, 2, 3 },{ -3, -4, -4 },{ -1, 3, -1 },{ -3, 2, 3 },{ 1, -3, -2 },{ 1, -3, 1 },{ 0, -2, -4 },{ -4, -3, 1 },{ -3, 2, -1 },{ 3, 2, 3 },{ -3, -1, 1 },{ 3, -4, -1 },{ -4, 2, 0 },{ -4, -4, 0 },{ 0, -1, 3 },{ 1, -2, 2 },{ -1, 0, -2 },{ -3, 2, 1 },{ 1, -4, 3 },{ -2, -3, -4 },{ 1, -1, -1 },{ -4, -4, -4 },{ -2, 1, -3 },{ 3, -4, 0 },{ -3, 0, -4 },{ 0, 2, 1 },{ -3, -3, 3 },{ -2, 3, 2 },{ 1, 0, -4 },{ 2, 1, 2 },{ -3, -2, -4 },{ -1, -3, 3 },{ 1, 1, 2 },{ 0, 3, 2 },{ 2, -2, 0 },{ -1, -3, 3 },{ -4, -4, -2 },{ 1, 2, -4 },{ 2, -2, 1 },{ -1, 0, -3 },{ -4, 2, -1 },{ 0, -2, -3 },{ -3, 1, 1 },{ -1, -1, -2 },{ 2, 0, 2 },{ -4, -4, 1 },{ -1, 1, -3 },{ -3, 3, 2 },{ 2, 0, -1 },{ -4, 2, 1 } }, - { { -3, -2, 1 },{ 3, 2, -4 },{ 1, -3, 0 },{ -4, 1, -3 },{ 3, 3, 2 },{ -3, -4, -1 },{ 2, -1, -3 },{ -4, -1, 3 },{ -2, 1, -4 },{ 3, 3, 1 },{ 0, -3, 3 },{ 2, 2, 0 },{ 3, 0, 0 },{ 0, -3, -3 },{ -2, -2, 2 },{ 2, -3, 0 },{ -4, 1, -3 },{ 3, -2, 1 },{ -2, 0, 0 },{ -4, -1, 2 },{ -2, 3, 2 },{ -1, -4, -3 },{ 1, 0, -1 },{ -2, -2, -4 },{ 0, 3, -3 },{ 1, -3, 3 },{ -1, 0, -4 },{ 1, -1, -3 },{ -1, 1, -1 },{ 2, -3, 0 },{ -2, 3, -2 },{ 0, -1, -3 },{ 3, 1, 0 },{ -3, 1, -2 },{ 2, 2, 2 },{ -2, 3, 3 },{ -3, -3, 1 },{ 1, -1, 2 },{ 1, -4, 2 },{ -2, 0, -4 },{ 0, 1, -3 },{ -4, -3, -1 },{ 3, -1, 1 },{ -4, -4, -3 },{ 0, 0, 1 },{ -4, -2, -2 },{ 3, 0, -1 },{ -2, -1, -3 },{ -4, 2, 1 },{ 1, 1, -4 },{ 2, 0, 0 },{ -2, -3, 2 },{ -1, 3, 3 },{ 3, -1, -2 },{ 1, -4, 1 },{ -3, -3, 3 },{ 2, 3, -4 },{ 1, -4, 0 },{ -4, 2, 3 },{ 0, 2, -2 },{ 0, -2, -1 },{ 3, -3, -4 },{ 0, 3, 3 },{ -1, -4, -2 } }, - { { -2, 2, -2 },{ 0, -1, 3 },{ -2, 0, -1 },{ -3, -2, -2 },{ -1, 2, -4 },{ 0, -3, 3 },{ 0, 2, 1 },{ 1, -4, 0 },{ -1, -2, -1 },{ 2, 0, -3 },{ -4, -4, 2 },{ -2, 3, -4 },{ 1, -1, -2 },{ -4, 3, 2 },{ 1, -1, -3 },{ 3, 1, -1 },{ 0, -2, 2 },{ 2, -4, -4 },{ 0, 2, -1 },{ 0, 1, -3 },{ 2, 0, -2 },{ 3, -1, 1 },{ 0, 3, 3 },{ -4, 0, 0 },{ -3, -3, 2 },{ 2, 1, -2 },{ -2, 3, 1 },{ 3, -2, 1 },{ -3, 3, -3 },{ -4, 1, 2 },{ -2, -4, -4 },{ 2, -2, 1 },{ 1, 3, 2 },{ -1, -2, -1 },{ -1, -3, 0 },{ 2, -2, -2 },{ 0, 0, -3 },{ -4, 3, 0 },{ -1, -2, -1 },{ 3, 2, -2 },{ 2, -2, 3 },{ -3, 3, -2 },{ -1, 1, 0 },{ 1, 2, -3 },{ 3, 2, 0 },{ -2, 1, 1 },{ -1, 3, -4 },{ -3, -4, -3 },{ 3, -3, -1 },{ 1, 0, 2 },{ -3, 3, 1 },{ -3, -4, -3 },{ 0, 1, 0 },{ -3, 0, 0 },{ -2, 3, -4 },{ 0, -1, 3 },{ -2, 1, -2 },{ -1, -3, -1 },{ -2, 0, 0 },{ 3, -2, -4 },{ -3, 1, 2 },{ -4, 0, -2 },{ -2, -1, 0 },{ 1, -4, -3 } }, - { { -4, -2, 1 },{ 2, 3, -4 },{ 0, -3, 1 },{ 3, -1, 2 },{ 2, 1, 1 },{ -2, -1, -1 },{ 3, 0, -2 },{ -3, -3, 2 },{ -4, 2, -3 },{ 0, -1, -2 },{ -3, 0, 3 },{ 3, 1, 1 },{ -3, -2, -1 },{ -1, -4, 3 },{ -1, 2, 1 },{ -2, 0, -2 },{ -3, -1, -2 },{ -1, 3, 1 },{ -3, -2, 3 },{ 3, -3, 0 },{ -4, -4, -1 },{ -1, 2, -4 },{ -2, -2, 2 },{ 2, -4, -2 },{ 1, 1, -3 },{ -4, -1, 3 },{ 0, -4, -1 },{ -3, 0, 2 },{ 0, 2, -2 },{ 3, -4, 3 },{ -1, 2, 0 },{ -4, 0, 3 },{ 0, 0, -4 },{ -4, -4, -3 },{ -3, 2, 1 },{ 1, -1, -1 },{ 3, 1, -4 },{ 2, -3, 3 },{ -1, 1, -2 },{ -4, -4, 0 },{ 3, 0, 1 },{ 1, -4, 3 },{ -2, -3, -1 },{ 0, -1, 3 },{ -3, -3, 2 },{ 2, -4, 2 },{ 1, -3, 0 },{ -4, 2, 3 },{ 0, -2, 3 },{ -1, -1, -2 },{ 0, 2, -1 },{ 3, -1, -4 },{ 2, -2, 2 },{ -4, -3, -3 },{ -1, 2, -1 },{ 3, -4, 2 },{ 3, -2, 0 },{ -3, 1, -3 },{ 2, 3, 2 },{ 1, -4, 3 },{ -1, -1, -3 },{ 1, 2, 0 },{ -2, 1, 2 },{ 3, -1, 2 } }, - { { -1, 0, -1 },{ -3, 1, 0 },{ -1, -4, -2 },{ -4, 2, -3 },{ 1, -4, 0 },{ -4, -3, -4 },{ -1, 3, 1 },{ -2, 2, -2 },{ 3, 1, 3 },{ -1, -3, 0 },{ 0, 3, -4 },{ 1, -3, 1 },{ -2, -2, -3 },{ 2, 1, -4 },{ -3, 3, 0 },{ 2, -3, 3 },{ 1, -4, -4 },{ -4, 2, 2 },{ 1, 1, -3 },{ -2, -1, -4 },{ -3, 3, 3 },{ 1, -3, -2 },{ -3, 1, -1 },{ 3, -2, 0 },{ -1, 0, 1 },{ -1, 3, -2 },{ 3, -2, -1 },{ 2, -3, -4 },{ -1, -1, 0 },{ 1, -1, -2 },{ 2, -2, -1 },{ -3, 1, 1 },{ 3, -3, -1 },{ 0, -1, 3 },{ 3, 2, -4 },{ -4, -4, 1 },{ -2, 0, 3 },{ -3, -1, -3 },{ 0, 2, 2 },{ -3, -2, 0 },{ 1, 2, -4 },{ -1, -1, -4 },{ -3, 0, -1 },{ 2, 3, -3 },{ -4, -2, -4 },{ -2, 1, -2 },{ 0, -1, -2 },{ 2, 3, 1 },{ 3, -1, -3 },{ -4, 1, -2 },{ -2, -4, 2 },{ -4, 3, -1 },{ 1, 1, 3 },{ -2, 0, -2 },{ 2, -2, 0 },{ -4, 2, -3 },{ 1, 1, 2 },{ -4, -1, -4 },{ 0, -3, -1 },{ -3, 0, -3 },{ 3, -3, 1 },{ -4, -4, -1 },{ 2, -3, -4 },{ 1, 3, -3 } }, - { { 3, -4, 3 },{ 1, -2, 2 },{ 2, 2, 3 },{ -2, -2, -3 },{ 0, 3, 2 },{ 3, 1, 3 },{ -2, 0, -1 },{ 2, -2, -4 },{ 1, -4, 0 },{ 2, -1, 2 },{ -3, 2, -1 },{ 3, 0, -2 },{ 1, -4, -1 },{ -4, 2, 2 },{ 3, -1, -3 },{ 0, -3, -1 },{ -4, 0, 1 },{ -1, 2, 0 },{ 2, -1, -1 },{ 0, -4, 2 },{ 3, 0, 1 },{ 2, 1, -3 },{ -2, 2, 1 },{ 1, -3, -4 },{ -3, 2, 3 },{ -2, 2, -4 },{ -4, -3, 0 },{ 0, 2, 3 },{ -2, 3, -3 },{ -4, 1, 1 },{ 0, -4, -4 },{ -3, 3, -3 },{ -2, 0, -2 },{ 2, 3, 2 },{ -2, 0, 0 },{ 1, -2, -2 },{ -1, 3, -2 },{ -3, -4, -1 },{ 2, 3, -4 },{ 1, -1, 1 },{ -2, 1, -1 },{ -4, 3, -2 },{ -1, -2, 2 },{ 1, -4, 0 },{ 3, 2, 1 },{ -1, 3, -3 },{ -3, 0, -1 },{ -2, 1, 1 },{ 1, -4, -4 },{ 2, 2, 0 },{ -1, -3, 1 },{ 1, -2, -3 },{ 0, -4, 1 },{ 3, 3, 3 },{ -3, -3, -2 },{ 0, 0, 1 },{ -1, 3, 3 },{ 2, -2, -1 },{ -1, 0, 1 },{ -2, 2, 3 },{ 0, 3, -2 },{ -1, 1, 3 },{ -3, -2, 1 },{ 0, 2, -1 } }, - { { -3, 0, -2 },{ -2, -3, -4 },{ 1, 3, 0 },{ -3, 0, -1 },{ -1, -1, -4 },{ 1, -2, 1 },{ -3, -4, -1 },{ -4, 3, -3 },{ 0, 0, 2 },{ -2, -2, -3 },{ -4, 2, -2 },{ -2, -1, 3 },{ -1, -2, 2 },{ 0, 0, 0 },{ -2, 3, 1 },{ -2, -2, -4 },{ 2, -2, -2 },{ 3, 3, -3 },{ -2, -3, -1 },{ -4, -2, -4 },{ 0, 3, 3 },{ -1, -1, -2 },{ -4, -4, 2 },{ 0, -1, 0 },{ 2, -4, -3 },{ 3, -2, 1 },{ 1, 1, 2 },{ -3, -4, -2 },{ 3, 0, 0 },{ 2, -3, 2 },{ 1, -1, 3 },{ -1, 2, 0 },{ 1, -3, -1 },{ 2, -4, 2 },{ -3, -1, -3 },{ 0, 1, 1 },{ 1, -3, 0 },{ 3, 1, 2 },{ 0, -4, 3 },{ -2, -2, -3 },{ 3, -3, 3 },{ 0, -3, 2 },{ 2, 1, -3 },{ -2, 0, 3 },{ 0, -1, 0 },{ 3, -3, 3 },{ -4, -4, -1 },{ 0, -2, 2 },{ -1, -2, -3 },{ -3, 2, 0 },{ 3, -1, 3 },{ -4, 1, -4 },{ -3, -1, 0 },{ -1, 2, -4 },{ 2, -3, 1 },{ -3, -1, -4 },{ -2, -4, -3 },{ 1, 1, -2 },{ 1, -4, 0 },{ -4, 3, -2 },{ 2, -2, -3 },{ 2, -1, 0 },{ -2, 1, -4 },{ -4, -1, 2 } }, - { { 2, 0, -3 },{ 0, 2, -2 },{ -4, -1, 2 },{ 3, -3, 1 },{ 2, 1, -2 },{ 1, 0, -2 },{ -3, 2, 3 },{ 3, -1, 1 },{ 1, 1, 0 },{ -1, -3, -4 },{ 0, 1, 1 },{ 2, 3, -3 },{ 2, -4, -4 },{ -4, 2, -1 },{ 1, 1, -2 },{ -1, 0, 3 },{ 0, -4, 2 },{ -3, 1, 1 },{ -2, 2, 3 },{ 1, 1, 0 },{ -3, -3, -2 },{ 1, 2, 0 },{ 3, -2, -3 },{ -1, 0, -1 },{ -4, 3, 3 },{ 0, -1, -1 },{ -2, 1, -4 },{ 1, -1, 3 },{ -1, 2, -2 },{ -3, -2, -4 },{ -2, 0, -1 },{ 3, -2, -3 },{ -4, 1, 3 },{ -1, -2, -4 },{ -4, 3, -1 },{ 3, 2, -4 },{ -1, -2, 2 },{ -4, 0, -4 },{ -3, -1, -2 },{ -1, 1, -1 },{ -4, 2, -2 },{ 2, -4, 1 },{ 3, 2, 0 },{ -4, -2, -2 },{ -3, -3, -4 },{ 1, 1, 2 },{ 2, 2, -4 },{ -2, 0, 3 },{ -4, 3, -2 },{ 3, 0, 2 },{ 0, -3, -1 },{ 2, 2, -2 },{ -2, -2, -2 },{ 0, 0, -1 },{ 1, 1, 2 },{ 2, 3, -3 },{ -3, -3, 3 },{ 0, 2, 0 },{ 3, -1, 2 },{ -3, -1, -4 },{ 1, -3, 1 },{ -1, -4, 2 },{ 3, 3, -2 },{ 0, -3, 0 } }, - { { -1, -2, 0 },{ 2, 1, 1 },{ -2, -4, -4 },{ 0, 2, 0 },{ -4, -4, 3 },{ -2, 3, 2 },{ 0, -3, -4 },{ -1, -2, -2 },{ 3, 2, 3 },{ -4, -4, -1 },{ 3, -3, 3 },{ -3, 0, 0 },{ -1, -2, 2 },{ -3, -3, 1 },{ 1, -4, -1 },{ 3, -1, -3 },{ -4, 3, 2 },{ 2, -3, 0 },{ 2, -1, -3 },{ -1, -2, -2 },{ 3, 0, 2 },{ -3, -3, -4 },{ -2, 1, 1 },{ 2, 3, 0 },{ 1, -3, 2 },{ -1, -4, -2 },{ -3, 0, -3 },{ 2, 3, 1 },{ -1, -3, -1 },{ 0, 1, 1 },{ -4, -4, 2 },{ 2, 3, -2 },{ -2, -1, 1 },{ 0, 0, 1 },{ 2, -2, -2 },{ -2, -4, 3 },{ -2, -3, -1 },{ 2, 2, -2 },{ 1, 3, 0 },{ 3, -2, 1 },{ 0, 0, 2 },{ -3, 1, -4 },{ -2, -1, -3 },{ 1, 3, -1 },{ -1, 2, 1 },{ -2, -4, -2 },{ 1, -1, 1 },{ 3, -1, 0 },{ 0, -3, -3 },{ -2, -4, -1 },{ 1, 0, 1 },{ -2, 3, 2 },{ 1, -4, 0 },{ -4, -1, 3 },{ 3, -4, -1 },{ -4, -2, 0 },{ -2, 1, 1 },{ 3, 0, -1 },{ -4, -2, -4 },{ 0, 2, 2 },{ -2, 1, -1 },{ -4, 2, -1 },{ -3, -4, -3 },{ 1, 1, 3 } }, - { { -4, -4, -1 },{ 3, 3, -3 },{ -3, -2, 3 },{ 1, 0, -3 },{ -1, -1, -4 },{ 3, -2, 0 },{ -2, -4, 0 },{ 2, 1, -3 },{ -3, -1, -3 },{ -2, 3, 2 },{ 0, 0, -2 },{ 1, -1, -1 },{ 0, 2, -3 },{ 3, 1, 3 },{ -2, -1, -4 },{ -1, 2, 0 },{ -3, 0, -2 },{ 0, -4, -4 },{ -1, 0, 1 },{ -4, -4, -4 },{ 2, 3, 2 },{ 0, 2, -1 },{ -1, -4, 3 },{ -3, -1, -3 },{ 3, 0, -4 },{ -4, 2, 1 },{ 0, 2, 0 },{ 3, -3, 3 },{ -4, -2, -4 },{ 2, 1, -3 },{ 0, 3, 3 },{ 3, -3, 0 },{ -1, -4, -3 },{ 1, 2, 3 },{ -3, 1, -3 },{ 1, 3, 0 },{ -4, 0, 1 },{ -1, -1, 3 },{ -4, -4, -3 },{ -2, -3, 0 },{ 1, 3, -4 },{ -3, -1, -1 },{ 0, -4, 3 },{ -1, -2, 2 },{ 3, 0, 0 },{ -4, 2, -3 },{ -1, -2, -2 },{ -3, 1, 1 },{ 1, 3, 3 },{ -4, 2, -4 },{ -1, -2, -4 },{ -3, 1, 2 },{ 3, -3, -3 },{ -3, 2, -3 },{ 1, 0, -4 },{ -1, 3, -2 },{ 0, -1, 3 },{ 2, -4, -3 },{ -3, 3, 0 },{ 2, -3, 3 },{ -1, 0, -2 },{ 3, -1, 1 },{ 1, 0, -4 },{ -2, 2, 3 } }, - { { 0, -1, 2 },{ 2, 0, 1 },{ -1, -3, -2 },{ -2, 2, 2 },{ 0, 3, -1 },{ -4, -2, 1 },{ 2, 1, 3 },{ -4, 2, -1 },{ 0, -3, 1 },{ 2, -1, -2 },{ -2, 2, 0 },{ -4, -4, -4 },{ -1, -2, 0 },{ 2, 0, -2 },{ -3, 3, 1 },{ 2, -3, 0 },{ 3, -2, -1 },{ -4, 3, 3 },{ 1, 2, 0 },{ 0, 1, -1 },{ -3, -3, 1 },{ 1, 0, 3 },{ -4, -1, -2 },{ -2, 1, 1 },{ 0, -2, -1 },{ 2, -3, -2 },{ -2, -1, 0 },{ 1, 0, 2 },{ -2, -4, -3 },{ 1, 0, 0 },{ -3, -1, -2 },{ -2, 2, -4 },{ -4, -1, 2 },{ 3, 3, -1 },{ 0, -3, -1 },{ 3, -1, -4 },{ 0, -4, 2 },{ 3, 2, -3 },{ 0, 1, -1 },{ 1, 0, 3 },{ 3, -3, 2 },{ -1, 0, -2 },{ -4, 1, 1 },{ 2, -3, -3 },{ 2, 1, 3 },{ -3, 3, 2 },{ 0, -3, -1 },{ -1, 1, -3 },{ 2, -4, 1 },{ 3, -2, -2 },{ -2, 0, 3 },{ 2, -2, -1 },{ 0, 3, 0 },{ -1, 0, 3 },{ -2, -3, 1 },{ 2, 2, 2 },{ -4, -3, -1 },{ -2, 2, -4 },{ -1, 1, -2 },{ -2, -4, 0 },{ 1, -2, -3 },{ 0, -3, 2 },{ -3, 3, -1 },{ -1, -2, -4 } }, - { { -2, 2, 2 },{ 1, 3, -4 },{ -4, -1, -1 },{ 2, -3, 3 },{ -3, 1, -1 },{ 3, -1, -2 },{ 0, 3, -3 },{ 1, 0, 2 },{ -1, -4, 2 },{ 1, 1, -4 },{ -3, -2, 1 },{ 3, 3, 3 },{ 2, 1, 2 },{ 0, -4, -3 },{ -4, 0, 3 },{ -2, -2, -3 },{ 0, 1, 2 },{ -2, -3, -3 },{ 3, -1, 3 },{ -2, 1, -2 },{ -2, -2, -3 },{ 2, -4, -3 },{ 3, 1, -4 },{ 1, 3, -1 },{ -3, 3, 2 },{ 2, -4, 3 },{ -1, 1, -4 },{ -4, 3, -2 },{ -3, 3, -1 },{ 3, -2, 2 },{ -1, 1, -1 },{ 0, 0, 2 },{ 2, -2, -4 },{ -4, -4, 0 },{ -2, 0, 1 },{ -3, 1, -2 },{ -1, -2, -4 },{ 2, -2, 2 },{ -3, 0, -1 },{ -1, 3, -2 },{ -4, -4, 1 },{ 1, 2, -4 },{ 3, 3, -1 },{ -3, -2, 0 },{ 0, -4, -2 },{ -2, -1, -4 },{ 3, -3, 0 },{ 1, 0, 3 },{ -3, -1, -1 },{ -4, 3, 0 },{ -1, -1, 0 },{ 3, -4, -2 },{ -4, 2, -3 },{ 1, -1, 1 },{ -3, 1, -2 },{ 3, -2, -3 },{ 0, -4, 0 },{ 1, 0, 2 },{ 3, -1, 1 },{ 2, 3, 3 },{ -4, 2, -2 },{ -3, 1, 2 },{ 3, -4, 0 },{ 2, -3, -2 } }, - { { -4, 0, 0 },{ -3, -3, -3 },{ 3, 1, 0 },{ -2, -4, 1 },{ 1, 0, -4 },{ -1, -4, 1 },{ -3, -3, -4 },{ -4, -1, -2 },{ -2, -3, -1 },{ 3, 3, 0 },{ 0, 0, -1 },{ -3, -3, -3 },{ -2, -1, 1 },{ -4, 3, -4 },{ 1, -4, 2 },{ -1, 2, -1 },{ 1, 3, -4 },{ -4, -1, 1 },{ -1, -4, -4 },{ 2, 0, 1 },{ -4, 3, 0 },{ -1, 2, 3 },{ -2, -3, 1 },{ 1, -3, -2 },{ -3, -2, 0 },{ -1, 1, -3 },{ 3, -2, -1 },{ 1, -1, 2 },{ 0, -4, 1 },{ -3, 2, -4 },{ -1, -3, 1 },{ 3, -4, 3 },{ 1, 1, -2 },{ -1, 3, -3 },{ 2, -3, 3 },{ 0, 1, 3 },{ -2, 3, 0 },{ -4, -4, 1 },{ -2, 2, -4 },{ 2, -2, 0 },{ -3, -2, -3 },{ 2, -1, 0 },{ -2, 0, 2 },{ 0, 1, -2 },{ 1, -1, 1 },{ -2, 2, -4 },{ -4, 0, 1 },{ -1, 3, 2 },{ -2, -2, -3 },{ 1, 2, -4 },{ 0, -3, 2 },{ 1, 1, 3 },{ -2, -3, -4 },{ -1, -4, 2 },{ 2, -2, -1 },{ -2, 3, 3 },{ -4, 0, -4 },{ 0, -2, 1 },{ -1, -1, -3 },{ -4, -3, -1 },{ 2, -1, -4 },{ 0, 0, 0 },{ -4, 2, -3 },{ 1, -2, 1 } }, - { { 3, 2, -2 },{ 0, -4, 3 },{ 2, 0, -3 },{ -1, -2, 2 },{ -4, 2, -2 },{ 2, 3, 3 },{ 2, -2, 0 },{ -2, 1, 3 },{ 3, 2, 1 },{ -3, -1, -3 },{ 2, -4, 3 },{ -1, -2, -2 },{ 1, 2, -1 },{ 0, 1, -2 },{ 3, -1, 0 },{ -2, -2, 0 },{ 3, 0, -2 },{ -3, -4, 3 },{ 1, 2, -1 },{ 3, -2, 2 },{ 0, -2, -4 },{ 1, 1, -1 },{ -4, -1, 0 },{ 0, 0, -4 },{ 2, 0, 2 },{ -4, 2, 1 },{ -2, -3, -3 },{ 2, 1, 0 },{ -1, 0, 3 },{ 2, -2, -3 },{ -4, 3, 0 },{ -2, -1, -3 },{ -3, 0, 2 },{ -1, 2, 0 },{ -4, -1, -3 },{ 3, -3, -1 },{ 1, 2, -2 },{ 3, 0, 2 },{ 1, -1, 3 },{ -2, 2, -3 },{ 0, -3, 1 },{ -1, -4, 3 },{ -4, 3, -4 },{ 2, -3, 3 },{ -3, 3, -3 },{ 3, 1, 3 },{ 2, -2, 0 },{ 0, -4, -2 },{ 3, 2, -4 },{ 2, -4, 1 },{ -3, 1, -1 },{ -3, 0, -3 },{ 2, 3, 1 },{ -4, 0, -4 },{ 3, 2, -1 },{ 1, 1, -2 },{ -3, -3, -2 },{ 2, 1, 3 },{ -3, 2, -4 },{ -1, -4, 2 },{ 0, 1, -1 },{ 1, -4, 3 },{ -2, 3, -4 },{ -1, 0, 3 } } - }, - { - { { -1, 3, 1 },{ 2, -1, -1 },{ 1, -3, -4 },{ -1, 3, -2 },{ -4, 2, -3 },{ -2, -2, -2 },{ 1, 3, -4 },{ 0, 1, 3 },{ -2, 2, -2 },{ -4, -4, -3 },{ 1, -1, 3 },{ -3, -4, -1 },{ 0, 2, 1 },{ 2, 0, 2 },{ -4, 3, -1 },{ -1, -3, 3 },{ 2, -4, 0 },{ 1, 0, -3 },{ 2, 2, 3 },{ -2, -1, 1 },{ 2, -3, -3 },{ -4, 3, -1 },{ 2, -2, -2 },{ 0, -4, 1 },{ -3, -2, 3 },{ 3, -3, -2 },{ 1, -3, 2 },{ -2, 2, -3 },{ 0, -1, 1 },{ 3, -3, -2 },{ -2, -4, 3 },{ 0, -3, 2 },{ -4, 1, 1 },{ -1, -3, 3 },{ -3, 2, 0 },{ 1, 0, -4 },{ -2, -1, 2 },{ -3, 2, -4 },{ -1, -3, -1 },{ 0, -1, 1 },{ 1, 2, 3 },{ -2, 0, -2 },{ -4, -2, 1 },{ 2, 3, -4 },{ 0, 0, 1 },{ -2, 2, -4 },{ -3, -2, -3 },{ 3, 0, 0 },{ -4, -1, -3 },{ 1, -3, 0 },{ 3, 3, -2 },{ 1, 1, 1 },{ -1, -2, 0 },{ 0, 2, -3 },{ 2, -1, 1 },{ -3, 3, 3 },{ 1, -4, -4 },{ 3, -3, -2 },{ -3, 1, 2 },{ -2, -3, -3 },{ 2, -1, -2 },{ 3, 3, 1 },{ 1, 1, 0 },{ -4, -3, 2 } }, - { { -1, 0, -4 },{ -4, 2, -2 },{ 2, 1, -3 },{ 0, -1, 2 },{ -3, -4, 2 },{ 2, -1, 3 },{ -1, -3, -1 },{ -3, 0, -4 },{ -1, -3, 2 },{ 0, -1, 0 },{ 1, 2, -1 },{ 3, 1, -2 },{ 2, -3, -4 },{ -1, -2, 0 },{ 3, 1, -3 },{ -2, 0, -4 },{ 3, -1, 1 },{ -3, -2, -2 },{ -4, 3, 2 },{ 0, 1, 0 },{ 0, 0, -4 },{ -2, -4, 3 },{ -3, 1, 2 },{ -1, -1, -4 },{ -3, 1, 0 },{ -2, 3, -1 },{ 2, 0, 2 },{ -1, -2, -2 },{ -4, 3, 3 },{ -1, -1, -1 },{ -3, 0, -4 },{ 2, 2, 0 },{ 1, 1, -1 },{ 0, -1, -3 },{ -1, -4, -2 },{ 3, 0, 0 },{ -4, -4, 3 },{ 1, 1, -3 },{ 3, -2, 2 },{ 2, -3, 0 },{ -4, -4, -4 },{ 3, 1, 1 },{ 0, -3, -3 },{ -3, 2, 2 },{ -1, -4, 0 },{ -4, -1, 3 },{ 1, 1, 2 },{ 2, 3, -1 },{ -2, -4, 1 },{ 0, -1, -4 },{ -1, -2, -1 },{ -2, -4, 0 },{ 3, -1, 2 },{ -4, 2, -1 },{ -2, -4, -2 },{ 0, -2, -1 },{ -4, 0, 0 },{ 2, 2, -3 },{ 0, -2, 0 },{ -4, -4, -1 },{ 0, -2, 3 },{ -3, 2, -1 },{ -2, -1, -4 },{ 3, -4, 3 } }, - { { -3, -2, 0 },{ 3, -3, 1 },{ 0, -4, 3 },{ -2, -2, 0 },{ 3, 1, 1 },{ 3, 3, -3 },{ -4, 0, 0 },{ 0, -2, -1 },{ 3, 2, 2 },{ 2, 3, -4 },{ -4, 0, 1 },{ -2, -3, 3 },{ -3, 3, 2 },{ 0, -1, -2 },{ -3, -4, 0 },{ 1, -1, 1 },{ -4, 2, 3 },{ 0, -4, -1 },{ 3, -2, -4 },{ -2, -3, -2 },{ 2, 2, -1 },{ 3, 2, -3 },{ -4, 0, 0 },{ 1, -3, -2 },{ 0, 2, 2 },{ 3, -1, 1 },{ 0, -4, -3 },{ -3, 1, 0 },{ 2, 2, -4 },{ 1, -3, 0 },{ 3, 3, 2 },{ -3, -2, 1 },{ -2, -1, -3 },{ 3, -3, 3 },{ -4, 3, 2 },{ -1, 2, -1 },{ 0, -3, 1 },{ 2, 3, 1 },{ -4, 0, -2 },{ -2, 3, -1 },{ -3, 1, -2 },{ -1, 3, 2 },{ 1, -1, 0 },{ -2, 2, -1 },{ 3, -3, -2 },{ 2, -1, 0 },{ -1, 0, -2 },{ -3, -3, -4 },{ -3, 1, 2 },{ 3, 2, -2 },{ -3, 1, 3 },{ 2, 0, -4 },{ 0, -3, -2 },{ 2, 3, -4 },{ -3, 0, 2 },{ 3, 2, -3 },{ -1, 1, 3 },{ -3, -1, 1 },{ -1, 3, 2 },{ -1, 0, -4 },{ 3, -4, 2 },{ -4, 2, -3 },{ 0, -3, -3 },{ -2, 1, 0 } }, - { { 1, 3, 2 },{ -4, 0, -2 },{ -2, 2, -1 },{ -4, 0, -4 },{ -1, -3, -2 },{ 1, -3, -1 },{ -2, 2, 1 },{ 2, -4, 3 },{ -4, -2, -3 },{ -2, 0, -2 },{ -1, -4, 0 },{ 0, -2, -3 },{ -4, 2, -1 },{ 1, 1, 2 },{ 2, 2, -3 },{ -1, -3, -1 },{ -2, 3, -3 },{ 1, 0, 3 },{ -1, 1, 0 },{ -3, -1, 2 },{ -3, -1, 3 },{ 1, -3, 1 },{ 3, 3, -1 },{ -2, -2, 3 },{ -2, -4, -3 },{ 0, 0, -4 },{ -4, -2, 3 },{ 1, 2, -1 },{ -2, -4, 2 },{ -4, 0, -2 },{ 0, 1, -3 },{ -1, -4, -2 },{ 2, 1, -4 },{ -3, 3, 1 },{ 1, -2, -2 },{ 2, 0, -4 },{ -2, -2, 0 },{ -3, -1, -4 },{ -1, -4, 3 },{ 1, 0, -3 },{ 2, -1, 3 },{ 0, -2, -2 },{ -2, -4, -4 },{ 3, 0, 3 },{ -4, 1, -3 },{ 0, 3, 1 },{ 1, -4, -4 },{ 3, -2, 3 },{ 0, 0, 1 },{ 1, -2, 0 },{ -4, 3, 2 },{ -1, -4, -3 },{ -4, 1, 3 },{ 1, -3, 1 },{ -2, -2, 3 },{ 1, -1, 0 },{ -4, -3, -1 },{ 1, -3, -4 },{ 3, 1, 3 },{ -2, -1, -2 },{ 1, 3, 0 },{ 2, 0, 1 },{ 1, -1, 3 },{ 2, -2, -2 } }, - { { -1, 1, -4 },{ 2, -3, 3 },{ 0, -1, -3 },{ 1, 3, 2 },{ 2, 1, 3 },{ -3, 2, -4 },{ -1, -1, -3 },{ 1, 1, -2 },{ 1, 1, 0 },{ -3, -3, 3 },{ 3, 1, 2 },{ 2, -1, -4 },{ 0, -4, -3 },{ -4, 0, 1 },{ -1, -3, 3 },{ 3, 1, -2 },{ -3, -1, 0 },{ 0, -3, -4 },{ 2, 3, -3 },{ 1, -4, 1 },{ -4, 2, -3 },{ -1, -2, -4 },{ -1, -4, 0 },{ 2, 1, -2 },{ 2, 3, -1 },{ -4, 2, 1 },{ 3, -2, -2 },{ -3, 1, 1 },{ 0, -1, -4 },{ 2, -3, 1 },{ -4, 0, 3 },{ -1, -2, -1 },{ 0, -4, 0 },{ -4, 2, 2 },{ 2, 0, -3 },{ -2, -3, 2 },{ 3, 2, -1 },{ 0, 1, -3 },{ 3, -3, 1 },{ -2, 2, 0 },{ -4, -3, -1 },{ 2, 2, 2 },{ -4, 0, 0 },{ -1, -3, -1 },{ 1, -2, 2 },{ -3, -3, -3 },{ -2, 2, 0 },{ -4, 2, -1 },{ -1, -3, -2 },{ 1, -4, -3 },{ -2, 2, 1 },{ 2, -2, -1 },{ -2, -1, 0 },{ 3, 2, 1 },{ -1, 3, -4 },{ 3, -4, -2 },{ -2, 3, 1 },{ 2, -4, -2 },{ -3, 2, -3 },{ 0, -3, 0 },{ -1, -2, -4 },{ -3, 1, -2 },{ -1, -4, -1 },{ -3, 3, 1 } }, - { { 3, -4, 0 },{ -3, -1, -2 },{ -1, 3, 1 },{ 3, -2, 0 },{ -3, -4, -1 },{ 0, -2, 2 },{ -4, -4, 1 },{ -1, -1, 2 },{ -2, 3, 0 },{ 0, -4, -4 },{ 1, 3, 1 },{ -3, 0, -1 },{ 3, 3, 3 },{ -2, -3, -1 },{ 2, 3, -4 },{ -3, -2, 1 },{ 2, -4, 1 },{ -4, 0, 2 },{ -2, 1, -2 },{ 3, -3, 0 },{ 0, 0, -1 },{ 2, 1, 2 },{ -4, 3, 2 },{ -3, -1, -4 },{ -1, -1, 0 },{ 1, -3, 3 },{ -1, -4, 0 },{ 2, 3, -2 },{ -1, 2, -3 },{ 3, -2, 0 },{ -2, 3, 2 },{ 1, 2, -4 },{ 1, -1, 2 },{ -2, -2, -1 },{ -1, -1, 0 },{ -4, -4, 3 },{ -1, 1, -2 },{ -4, -2, 2 },{ 1, 3, -1 },{ 1, -2, 2 },{ -3, -1, -4 },{ -1, 1, -3 },{ 3, 3, 1 },{ 1, 1, -4 },{ -3, 3, 3 },{ -1, 0, -1 },{ 3, -1, 1 },{ 2, 1, 3 },{ 0, -1, -4 },{ -3, 0, 0 },{ 3, -1, 3 },{ 0, 3, -3 },{ -1, 1, -2 },{ -3, -1, -1 },{ -4, -2, -3 },{ 2, 0, 0 },{ 0, 0, 2 },{ 0, -2, 2 },{ -2, 1, -1 },{ -4, 0, 3 },{ 2, -3, 1 },{ -4, 2, 2 },{ 3, -1, -4 },{ 0, 1, -3 } }, - { { -2, -2, 2 },{ -2, 1, -1 },{ 2, -4, 2 },{ -1, 2, -3 },{ -2, -1, -1 },{ 0, 0, -3 },{ 3, 3, 0 },{ 2, 2, -2 },{ 3, -2, -3 },{ -1, -1, -1 },{ -4, -2, -2 },{ -2, 2, 3 },{ 1, -2, 0 },{ -1, -1, -2 },{ -2, 1, 2 },{ 0, 0, -3 },{ 1, 2, -1 },{ -2, 2, -1 },{ 2, -1, 2 },{ -1, -2, 3 },{ -3, 2, -4 },{ -2, 0, -2 },{ 3, -3, -3 },{ 0, -2, 3 },{ -3, 2, 1 },{ 3, 0, -4 },{ -2, -1, -1 },{ 0, 0, 2 },{ -3, -2, 3 },{ 1, -3, -3 },{ -3, 0, -1 },{ 3, 3, -2 },{ 2, -3, 3 },{ 0, 1, -3 },{ 3, 2, 1 },{ 1, 3, -4 },{ 0, -1, 0 },{ 3, -4, 3 },{ -3, 0, -4 },{ -1, 3, 0 },{ 3, 1, -2 },{ 0, -4, -1 },{ -2, -2, 3 },{ 0, -1, -2 },{ -4, -4, -2 },{ -2, -4, -4 },{ 2, 3, -3 },{ -4, -2, -1 },{ -1, -4, 2 },{ -3, 3, -1 },{ 2, -2, -2 },{ -4, -3, -4 },{ 1, -4, 1 },{ 1, 1, 2 },{ 0, -3, 3 },{ -3, 1, -2 },{ -4, 2, -4 },{ -1, -1, 0 },{ 3, -2, -4 },{ 1, 3, -3 },{ 2, 2, -1 },{ -2, -4, 0 },{ 0, -3, 3 },{ -4, 0, 1 } }, - { { 1, -3, -2 },{ -4, 2, -4 },{ 3, 0, -4 },{ -4, -3, 1 },{ 1, 3, -2 },{ -3, 1, 3 },{ 2, -3, 2 },{ -4, -3, -4 },{ -2, 0, 3 },{ 0, 1, 2 },{ -3, 0, 1 },{ 0, -4, -3 },{ 3, 2, -3 },{ -4, -2, 2 },{ -3, -4, -4 },{ 0, 0, 0 },{ 3, -2, 3 },{ -4, -4, -4 },{ 0, -1, -3 },{ -3, 3, 1 },{ 2, -3, -2 },{ 0, -4, 3 },{ 1, 1, 0 },{ -2, -2, -1 },{ 2, -4, -3 },{ -4, 2, -2 },{ 0, -3, 0 },{ -4, 1, 2 },{ 3, 3, -4 },{ -2, 1, 1 },{ -4, -4, 0 },{ -1, -1, -3 },{ -4, 1, 1 },{ -3, -4, -4 },{ -2, -2, -2 },{ -3, 0, 2 },{ 2, -3, -2 },{ -3, 2, -1 },{ -2, 0, -3 },{ 2, -2, 2 },{ -4, -4, 1 },{ 1, -1, 3 },{ -3, -3, -3 },{ 2, 2, 0 },{ 3, 1, 2 },{ 0, -2, 1 },{ 1, 0, 0 },{ -2, 2, 2 },{ 1, -3, -3 },{ -1, 2, 1 },{ 3, 1, 3 },{ 0, 0, 2 },{ -2, 2, 2 },{ 2, -3, 0 },{ 3, -1, -4 },{ -3, 3, 1 },{ 1, -4, -1 },{ 3, -3, 2 },{ -4, 3, 1 },{ 0, -4, 3 },{ -2, -1, -2 },{ -1, 0, -3 },{ 3, 3, -2 },{ 1, 3, -1 } }, - { { 2, 1, 3 },{ 0, 2, 0 },{ -1, -1, 1 },{ -3, -2, 3 },{ 2, -1, -4 },{ -2, 1, 1 },{ -1, -2, -2 },{ -3, 2, -1 },{ 1, -2, -3 },{ 3, 3, 0 },{ 1, -3, -4 },{ 2, -3, 2 },{ -1, 0, 0 },{ 2, 3, 0 },{ 1, 1, -2 },{ 2, -3, 3 },{ -2, 3, -2 },{ -1, 2, 1 },{ 3, -4, -1 },{ -2, 1, -4 },{ 1, -1, 2 },{ -4, 2, 0 },{ -1, 3, -4 },{ 1, 0, 1 },{ -1, 1, 2 },{ 1, 3, 2 },{ 2, -2, -4 },{ -3, -1, -3 },{ 1, -4, -2 },{ 0, -3, 1 },{ 2, 1, 3 },{ 0, 0, -1 },{ -2, -2, 2 },{ 0, 3, 0 },{ 2, -3, -1 },{ 1, 1, 1 },{ -1, -4, -3 },{ 0, 1, 0 },{ -2, -3, 1 },{ 2, 2, -2 },{ -4, 1, 0 },{ -1, 0, -4 },{ 1, 3, -1 },{ -2, -3, 1 },{ -1, 0, -2 },{ -3, -1, 3 },{ 3, -3, -4 },{ -3, 1, 1 },{ 2, -1, -4 },{ -2, 0, -2 },{ -4, -4, 0 },{ 1, -2, -3 },{ -3, 3, -1 },{ -2, 2, -3 },{ -1, 0, -2 },{ 0, -2, 3 },{ 2, 0, -3 },{ -2, -1, 3 },{ -3, 1, -2 },{ 1, 0, -4 },{ 2, 1, 1 },{ -3, -2, 2 },{ -1, -1, -4 },{ -3, -4, 1 } }, - { { -1, -3, 2 },{ -3, -1, -3 },{ 3, -4, -2 },{ 1, 3, -1 },{ 0, 2, 0 },{ 3, -4, 2 },{ 0, 0, -4 },{ -4, -1, 1 },{ -1, -4, 1 },{ 2, 1, 3 },{ -4, 3, -1 },{ -2, -1, -2 },{ -3, 2, 3 },{ -2, -4, -4 },{ 0, -2, 2 },{ -4, 3, -1 },{ -3, -1, -3 },{ 2, 0, 1 },{ 1, -2, 3 },{ -2, 3, -1 },{ 2, 0, 0 },{ 3, -4, 3 },{ -4, -2, -2 },{ 3, -1, -3 },{ -3, -3, -1 },{ -2, -4, 3 },{ 0, 2, 0 },{ -1, 0, 1 },{ 3, 2, -2 },{ -2, 3, 2 },{ -1, -1, -4 },{ 3, -3, -2 },{ 1, 2, -3 },{ 3, 0, 3 },{ -2, -1, -1 },{ -4, 2, 3 },{ -4, -2, -4 },{ 3, 3, 2 },{ 1, -1, 3 },{ 0, -3, -4 },{ 3, 3, 0 },{ -1, -1, -3 },{ 2, 1, -1 },{ -4, 2, 2 },{ 0, -2, -3 },{ -2, 3, -1 },{ 1, -4, -2 },{ -4, 3, 3 },{ 0, -3, -1 },{ 3, -1, 0 },{ 1, 1, -4 },{ -3, -2, -1 },{ 2, -1, 1 },{ -1, -4, -4 },{ -4, 1, 0 },{ 2, -2, 2 },{ -2, 3, -2 },{ 0, 2, -1 },{ -1, -3, -1 },{ 3, -4, 2 },{ -2, -2, 0 },{ 1, -3, -1 },{ -4, 2, 3 },{ 3, -1, -3 } }, - { { -2, -4, -4 },{ 1, 3, 0 },{ -4, 1, 3 },{ -2, 0, -3 },{ -3, -2, 0 },{ -4, -4, -2 },{ 1, 3, 3 },{ -2, 1, -1 },{ 3, 2, -3 },{ -3, -4, 0 },{ -2, -2, -2 },{ 1, 1, 1 },{ 3, -3, -1 },{ -4, 1, 1 },{ 1, 0, -3 },{ 3, -1, 0 },{ 1, -3, 1 },{ -1, 1, -2 },{ -4, -3, 2 },{ -3, 0, -4 },{ 0, -2, -3 },{ -1, -3, 1 },{ -3, 0, -3 },{ 0, 3, 1 },{ 0, 1, 0 },{ -3, 0, -4 },{ 3, -2, -1 },{ -4, -1, 3 },{ -2, -3, 0 },{ 2, -2, -1 },{ -3, 2, -3 },{ -4, 3, 2 },{ -3, 0, 1 },{ -1, -4, -4 },{ 0, 3, -3 },{ 2, -2, -2 },{ 3, 0, 1 },{ -3, 3, -2 },{ -1, -2, -1 },{ -3, 0, -2 },{ -2, -3, 3 },{ 1, -4, 1 },{ -3, -2, 3 },{ 3, -4, -4 },{ 0, 1, 1 },{ 2, -1, 0 },{ -1, -2, 0 },{ 0, 2, -3 },{ -1, 0, 3 },{ -3, 2, 2 },{ 0, 3, 2 },{ -1, -3, -2 },{ 1, 1, 3 },{ 3, -1, 3 },{ 1, 3, 1 },{ -4, -4, -1 },{ -1, -3, -4 },{ 1, -1, 1 },{ -4, 0, 0 },{ -4, 3, -3 },{ 3, 2, 3 },{ 0, 3, -3 },{ -4, 1, 0 },{ -2, 0, -1 } }, - { { 1, -2, 2 },{ 2, -2, -1 },{ 0, 1, -3 },{ 2, -3, 2 },{ -1, 2, 2 },{ 2, 2, -4 },{ 3, -3, -1 },{ 0, -1, 2 },{ 1, 0, -2 },{ -1, -2, -4 },{ 0, 0, 3 },{ 0, 3, -4 },{ 2, -1, -3 },{ -3, -3, 3 },{ -1, 2, -2 },{ -1, -4, 2 },{ -3, 1, -4 },{ 0, 2, 0 },{ 3, -4, -3 },{ 1, 2, 0 },{ -2, 1, -2 },{ 1, 3, 3 },{ 2, 2, -1 },{ -2, -3, 2 },{ 2, -1, 3 },{ -3, -4, -3 },{ 2, 3, -2 },{ -1, 1, 2 },{ 1, -4, -4 },{ -4, 0, 1 },{ 0, -2, -1 },{ 3, -4, 3 },{ 1, -3, -2 },{ -4, -1, 0 },{ 2, -2, 3 },{ -1, -4, 0 },{ -2, 1, 2 },{ 0, -4, -3 },{ 3, 1, 1 },{ -4, -4, -4 },{ 2, 2, 2 },{ 0, 2, 0 },{ -2, -2, -2 },{ 1, 0, -3 },{ -4, -3, 3 },{ 3, 2, -1 },{ -3, 0, 2 },{ 2, -4, -3 },{ -4, -2, 1 },{ -2, -3, -1 },{ 3, -4, -4 },{ -4, 2, 0 },{ -2, 2, 0 },{ -3, -3, -2 },{ 0, 0, -4 },{ -3, 2, 2 },{ 3, 1, 0 },{ 2, 2, -3 },{ 1, 1, 3 },{ -3, -4, -4 },{ -2, -1, -2 },{ 2, -2, 1 },{ 2, -4, -2 },{ 0, 2, -2 } }, - { { -4, 3, 3 },{ -1, 0, 1 },{ -3, -3, -4 },{ 3, -1, 0 },{ -2, 0, -2 },{ -1, -1, 1 },{ -3, 1, -3 },{ -2, -3, 2 },{ -4, 3, 0 },{ 2, -3, 2 },{ -4, 2, 1 },{ 3, -4, 2 },{ -1, 2, 0 },{ -2, -2, -2 },{ 2, 3, -4 },{ 3, 0, 2 },{ -4, -2, -3 },{ -2, -1, -1 },{ 2, 3, 3 },{ -1, -2, 2 },{ -4, -1, 1 },{ 3, -4, -4 },{ -4, -1, -1 },{ -1, -2, -4 },{ 3, 2, -2 },{ 1, 0, 0 },{ -4, 2, 1 },{ 1, -1, -3 },{ 0, 2, -3 },{ -1, 3, 3 },{ 1, 1, 0 },{ -1, -1, -4 },{ -2, 3, -1 },{ 0, 1, 2 },{ -3, 1, -2 },{ 1, 2, -4 },{ -3, -3, -1 },{ 1, 0, 3 },{ 0, -1, -3 },{ -1, 1, 2 },{ 3, -1, -1 },{ -4, 0, -3 },{ 2, 3, 2 },{ -1, 1, 0 },{ -2, 3, -2 },{ -4, -3, -4 },{ -1, 2, 1 },{ 3, 1, -4 },{ 1, -1, -2 },{ 2, 1, 3 },{ -1, -2, -3 },{ 2, 0, -2 },{ 0, -2, 2 },{ 3, -4, -3 },{ -2, -1, -1 },{ 1, -2, -2 },{ 0, -2, 3 },{ -3, -3, -2 },{ -1, -2, 2 },{ 0, 2, 0 },{ 1, 0, -1 },{ -1, 0, 3 },{ -3, -3, -4 },{ 3, 2, 1 } }, - { { 2, 0, -2 },{ -2, -4, -3 },{ -4, 3, -1 },{ 1, -2, 3 },{ 0, -4, -2 },{ -4, 3, -1 },{ 1, -4, 1 },{ 3, -2, 3 },{ -1, 1, -4 },{ 1, 3, -3 },{ -3, -1, -1 },{ 1, -3, -3 },{ -4, 0, -1 },{ -2, 0, 1 },{ 2, -3, 0 },{ 0, 2, 0 },{ 1, -4, 3 },{ -4, 0, 1 },{ -1, -3, -4 },{ 2, 3, -2 },{ -3, 0, 0 },{ 0, -3, -3 },{ -1, 1, 3 },{ -4, 3, 2 },{ 0, -1, 0 },{ -2, -3, -2 },{ -1, -3, 3 },{ -2, -2, -1 },{ -3, -4, 1 },{ 3, -1, -2 },{ -3, -3, -2 },{ 2, 0, 2 },{ 2, 2, 1 },{ -4, -1, -4 },{ 3, -4, 2 },{ -1, 3, 1 },{ -2, -1, -3 },{ 2, 2, -1 },{ -4, 3, 0 },{ -2, -2, 0 },{ 1, -4, -2 },{ -1, -3, 1 },{ -3, -1, -4 },{ 3, -4, -1 },{ 0, -1, 2 },{ 1, -2, 0 },{ -3, -1, 3 },{ -2, 3, 2 },{ -2, -3, -2 },{ 0, 0, 0 },{ -3, 3, -1 },{ 1, -1, 2 },{ -4, 3, -3 },{ -1, 1, 3 },{ 2, 3, 1 },{ -4, 2, -4 },{ 1, -4, 1 },{ -2, 3, -1 },{ 3, -1, -3 },{ 2, -4, 1 },{ -4, 3, -1 },{ -1, -2, 2 },{ 0, 1, -4 },{ -2, -1, 0 } }, - { { 1, -3, -3 },{ 0, 2, 0 },{ 3, 0, 2 },{ -2, 2, 0 },{ -1, -1, 3 },{ 3, 1, -4 },{ -3, -2, -3 },{ 0, 0, -2 },{ -2, -1, 0 },{ 2, 0, -1 },{ -2, 1, 3 },{ 0, -2, 1 },{ 3, 3, -4 },{ 0, -4, 3 },{ -4, -1, -1 },{ -3, -2, -2 },{ -1, 3, -4 },{ 3, 0, 2 },{ 0, -4, -1 },{ -3, -2, -3 },{ 3, 1, 1 },{ -2, -4, 0 },{ 2, 2, -2 },{ 3, -4, -3 },{ -2, 0, 1 },{ -3, 1, 3 },{ 2, 3, -4 },{ 3, 0, 2 },{ 2, -3, -1 },{ -3, 1, 3 },{ 1, 2, -4 },{ -4, -4, -3 },{ -2, -2, 3 },{ -1, -3, -1 },{ 2, 0, -3 },{ 0, -2, 0 },{ -4, -2, 3 },{ 2, -3, 1 },{ 0, 0, -4 },{ -3, -3, 3 },{ 2, 3, -2 },{ 1, 1, -1 },{ -3, 2, 3 },{ 2, 0, 1 },{ -1, 2, -3 },{ 1, -4, -3 },{ 0, 1, -1 },{ 3, -1, -1 },{ 0, -4, -3 },{ -4, 2, 1 },{ 1, -3, 2 },{ 3, -4, 1 },{ -2, 0, -4 },{ -3, -3, -1 },{ 2, 1, 0 },{ -3, -1, 2 },{ -2, 0, -3 },{ 0, 1, 1 },{ -4, 0, -4 },{ -3, -3, 2 },{ 3, 1, -3 },{ -3, -3, -3 },{ 3, 3, 1 },{ -4, -4, 2 } }, - { { -1, -1, 3 },{ -3, 1, 1 },{ 0, -2, -4 },{ -4, 1, -2 },{ 1, -3, -3 },{ 2, 0, 1 },{ -2, 2, 0 },{ -4, 2, 2 },{ 1, -4, -4 },{ 3, -3, 2 },{ -4, -4, -2 },{ -1, 1, -3 },{ 1, 2, 2 },{ -3, -2, -3 },{ 1, 3, -3 },{ 3, 1, 1 },{ 2, -3, -2 },{ -2, 1, 2 },{ 1, 2, 0 },{ -4, 1, -1 },{ 0, -1, 2 },{ 1, 3, 3 },{ -3, 0, -4 },{ 0, -2, 0 },{ 0, -2, -1 },{ 3, -1, -4 },{ -4, -4, -3 },{ 0, 2, 0 },{ -2, -1, -3 },{ 0, 3, 2 },{ 3, -2, 0 },{ -2, 1, 1 },{ 0, 2, -2 },{ 1, 3, 0 },{ -3, -4, -1 },{ -1, 1, -2 },{ 3, 2, -4 },{ 1, 0, -2 },{ -2, -4, 2 },{ 3, 2, -3 },{ -4, -1, 2 },{ -1, -2, 1 },{ 0, -4, -4 },{ -4, -2, -1 },{ -3, 3, 3 },{ 3, 0, -2 },{ -2, 3, 1 },{ -4, -3, 0 },{ 2, -2, -4 },{ -3, -1, 3 },{ -1, 1, -4 },{ 0, -2, -2 },{ 2, 2, 0 },{ -1, -2, 3 },{ 1, -4, -2 },{ -1, -3, -4 },{ 3, -2, -1 },{ 2, 3, 3 },{ 1, -4, -2 },{ -1, -1, 0 },{ 1, 2, 3 },{ -2, -1, -1 },{ 2, -2, 0 },{ -2, 2, -1 } }, - { { 1, 3, -2 },{ 3, -3, -4 },{ 2, -4, -1 },{ -3, 3, 3 },{ 3, -4, 2 },{ 0, 0, -1 },{ -2, -3, 3 },{ 2, 3, -2 },{ -1, -3, 1 },{ 0, -1, -2 },{ -3, 2, 1 },{ 3, -1, 0 },{ -1, -3, 0 },{ -4, 0, 3 },{ -1, 1, -1 },{ -2, -4, 2 },{ 0, -1, 0 },{ -3, 3, -3 },{ -2, -4, 3 },{ 3, -2, -2 },{ -1, -3, -4 },{ -2, 0, -3 },{ 2, -3, 1 },{ -4, 2, 3 },{ 1, 1, -2 },{ -1, 2, 2 },{ 1, -4, -1 },{ 1, 1, 1 },{ -4, 0, -2 },{ -1, -3, -4 },{ -4, -3, 1 },{ 1, 0, -1 },{ -3, -1, 2 },{ 3, 1, -4 },{ -4, -3, 2 },{ 1, 0, 3 },{ -2, 3, -1 },{ -1, -4, 1 },{ -3, 3, 0 },{ 1, -2, -1 },{ 0, 0, -4 },{ -2, 2, -2 },{ 3, -3, 2 },{ -2, 0, -3 },{ 0, -3, 1 },{ -4, -2, -4 },{ 2, 1, 2 },{ -1, 2, 2 },{ 1, 0, 3 },{ 3, 3, -3 },{ -2, 2, -1 },{ 1, 0, -2 },{ -3, -3, 2 },{ -4, -1, -3 },{ 3, 2, 1 },{ 0, 3, 0 },{ -3, 1, 3 },{ -1, -2, 0 },{ 2, 2, 2 },{ -2, -1, -4 },{ 0, 3, 1 },{ 3, 1, -4 },{ 0, -4, -2 },{ -1, 0, 3 } }, - { { 2, 0, 0 },{ -3, -2, 2 },{ -2, -1, -2 },{ 1, 2, -3 },{ -4, 1, 0 },{ -3, -2, -4 },{ 0, -1, -3 },{ 3, 1, 1 },{ -3, 0, -1 },{ 2, 2, -3 },{ 1, 0, 3 },{ -2, 3, -4 },{ 2, -2, -2 },{ 0, 0, -2 },{ 2, 2, 1 },{ -4, -3, -4 },{ 2, -1, 1 },{ 1, 0, -1 },{ 3, -2, -4 },{ 0, 0, 1 },{ -4, 2, 2 },{ 2, -1, -1 },{ -1, 3, -2 },{ 3, -2, 2 },{ -2, -3, -3 },{ -4, 3, 1 },{ -1, -1, 0 },{ -3, -2, 3 },{ 2, 3, 2 },{ 0, 2, -2 },{ 3, 1, 3 },{ 2, -4, -3 },{ -1, 3, -2 },{ -2, -1, 2 },{ 2, -4, 1 },{ 0, -1, -4 },{ -3, -2, -3 },{ 3, 1, 2 },{ -4, -1, -3 },{ 2, 1, 1 },{ -1, -4, 3 },{ -3, 3, -2 },{ 2, 1, 0 },{ 3, 1, 2 },{ 1, 3, 0 },{ 1, -1, 0 },{ -3, -4, -4 },{ -3, -4, -2 },{ 0, -1, -1 },{ -1, -2, 0 },{ 1, -4, 1 },{ -4, 1, -4 },{ 2, 3, 1 },{ -2, 1, -2 },{ 0, 0, 2 },{ -3, -4, -3 },{ -4, -1, -4 },{ 1, 0, -2 },{ -4, -3, -3 },{ -3, -4, -1 },{ 1, 0, 3 },{ -4, -3, 2 },{ -3, -2, -1 },{ -4, 1, -4 } }, - { { 1, -4, 3 },{ -2, 2, 0 },{ 0, 0, 2 },{ -1, -1, 1 },{ 1, -3, -2 },{ -1, 3, 1 },{ 1, -4, -1 },{ -4, -1, 3 },{ -2, -2, -3 },{ -3, 3, 0 },{ 1, -4, 1 },{ -4, -3, 2 },{ -2, -1, -1 },{ 3, -4, 2 },{ -3, 2, 3 },{ 0, -3, -4 },{ -1, 3, -2 },{ -4, 2, 0 },{ -3, -4, 3 },{ 2, 3, -3 },{ -2, -3, 0 },{ -4, 1, 1 },{ 1, -4, -4 },{ -3, -1, 0 },{ 0, 0, -1 },{ 2, 0, -4 },{ 3, -3, -2 },{ -3, 2, -4 },{ 3, -4, -1 },{ -2, -1, 0 },{ -3, 0, -4 },{ 1, -2, 3 },{ -2, -2, -3 },{ -4, 3, -1 },{ 0, 0, -1 },{ -3, -3, 3 },{ 0, 2, 0 },{ 1, 2, 0 },{ -2, -2, -2 },{ 3, -3, -1 },{ 0, 0, 3 },{ -3, -1, 1 },{ 1, -4, -4 },{ -4, -1, -1 },{ -1, 2, -2 },{ -1, -3, 3 },{ 3, 2, -3 },{ 2, 1, 1 },{ -2, 3, -1 },{ -4, -3, -4 },{ 3, 2, 2 },{ -1, -1, 0 },{ -2, -4, 3 },{ 3, -2, -1 },{ 1, -3, -1 },{ 2, -1, 1 },{ -2, 2, 3 },{ 0, -2, 0 },{ 3, 3, 2 },{ -1, 1, 1 },{ 0, 2, -2 },{ 3, -3, -3 },{ 2, -1, 1 },{ 0, 3, -3 } }, - { { -3, -3, -2 },{ 3, -2, -3 },{ -4, 3, -4 },{ 3, -4, -1 },{ -2, 2, 3 },{ 2, -2, 2 },{ 3, 2, 0 },{ 0, 2, 2 },{ -1, -4, -4 },{ 3, -2, 2 },{ 0, 0, -1 },{ 2, 1, -3 },{ -1, -2, -4 },{ -3, 3, 0 },{ 1, 1, -3 },{ 2, -2, 0 },{ 3, -2, 3 },{ -1, -1, 2 },{ -3, 1, -2 },{ 1, 2, 1 },{ 0, -4, 2 },{ 3, 0, -3 },{ -3, 3, 3 },{ 1, 2, -3 },{ 0, -4, 2 },{ -3, 2, 3 },{ -2, 1, 1 },{ 1, -3, -3 },{ -1, -1, 2 },{ -4, -2, -2 },{ -1, 2, 1 },{ 0, 2, 0 },{ 1, -3, 0 },{ 3, 1, 1 },{ 3, 2, -4 },{ -1, 3, -3 },{ 2, -1, -2 },{ -2, -4, 2 },{ 1, 0, 1 },{ -1, 2, -4 },{ -4, 3, -3 },{ 3, 0, 0 },{ -2, -2, -3 },{ 0, -3, 3 },{ -3, 0, -2 },{ -2, 0, 2 },{ 0, -2, -1 },{ 3, 0, -3 },{ 1, -1, 3 },{ -3, -2, 0 },{ 2, 0, -2 },{ 0, 1, -3 },{ 1, -1, 2 },{ -4, 2, -4 },{ -1, 3, 3 },{ -3, 1, 0 },{ 0, -4, -2 },{ 3, 3, -3 },{ -2, -2, -1 },{ 2, 0, -4 },{ -4, -4, -1 },{ -1, 2, 0 },{ -2, 3, 2 },{ 1, 1, -1 } }, - { { -1, -3, 0 },{ -1, -1, 3 },{ 1, 0, 1 },{ 2, 1, -2 },{ -4, -4, -3 },{ -3, 0, -4 },{ -1, 0, -3 },{ -2, -3, -2 },{ 1, 3, 0 },{ -3, 1, -4 },{ -1, 1, -2 },{ -4, -3, 1 },{ 1, 2, 3 },{ 0, 0, 2 },{ -2, 0, -2 },{ -4, -4, 1 },{ -2, 3, -3 },{ 1, -3, -4 },{ -1, 0, -1 },{ 0, -3, -4 },{ 3, -2, -2 },{ -2, -1, -1 },{ -1, -2, -2 },{ 2, 1, 1 },{ -2, -3, -2 },{ 3, -1, -1 },{ -1, 3, 1 },{ 1, 0, -3 },{ 0, 1, 3 },{ 2, -3, -1 },{ 2, 3, 2 },{ -4, -4, -3 },{ -3, 0, 3 },{ -2, -2, 2 },{ 1, -4, -2 },{ -4, -3, 1 },{ 2, -1, 2 },{ -4, 1, -4 },{ 0, -4, 3 },{ -3, -2, -2 },{ 1, -3, 2 },{ -1, 2, 1 },{ 2, -2, 0 },{ 2, 1, 2 },{ 3, 3, -4 },{ -4, -3, 1 },{ 1, -4, 0 },{ -4, 3, 3 },{ -2, 2, 2 },{ 0, -3, -4 },{ -2, 3, 1 },{ -3, -4, -1 },{ 0, 2, -3 },{ -3, -3, 0 },{ 3, 0, -2 },{ 2, -3, -4 },{ -3, 1, 1 },{ 1, -3, -1 },{ 0, -1, 3 },{ -2, 1, 2 },{ 1, -1, 0 },{ -2, -4, 3 },{ -4, -1, -4 },{ 3, 0, 1 } }, - { { -4, 3, 2 },{ 0, 2, -4 },{ -3, 1, 3 },{ -1, -3, 0 },{ 1, -2, 0 },{ -3, 3, 2 },{ 0, -3, 1 },{ 2, -1, 3 },{ -4, -2, -1 },{ 3, 0, 3 },{ 2, -4, 2 },{ -2, 2, -3 },{ 2, -1, 0 },{ 3, -4, -4 },{ -2, -2, -1 },{ 0, -1, -1 },{ 2, 2, 2 },{ 3, 1, 3 },{ -4, -1, 0 },{ -2, 2, 1 },{ -4, 0, 3 },{ 2, 2, -4 },{ -4, 3, 2 },{ -1, -4, 0 },{ -4, -2, -4 },{ 2, 2, -1 },{ -4, -4, 0 },{ -3, -2, -2 },{ -4, -4, 0 },{ -2, 3, -4 },{ 3, 1, -2 },{ 0, -3, -4 },{ 2, -1, -1 },{ -1, 1, -4 },{ -2, 0, 0 },{ -3, -2, 3 },{ -1, 2, -1 },{ 3, -2, -3 },{ -1, 3, 0 },{ 3, 3, -1 },{ 2, -1, 3 },{ -3, -1, -1 },{ -4, 2, -3 },{ -2, -4, -2 },{ 0, 3, 3 },{ 0, -1, -1 },{ 2, 1, -4 },{ -3, -2, -2 },{ -1, -4, -2 },{ 3, 1, -3 },{ 1, 2, 1 },{ -1, -2, 3 },{ 2, 0, -1 },{ -2, -2, 2 },{ 0, 3, -3 },{ -2, -1, 3 },{ -1, 0, -2 },{ -4, 2, 2 },{ -4, -4, -3 },{ -3, 0, -2 },{ 3, 3, -3 },{ 2, -2, -4 },{ 0, 1, -2 },{ 1, -4, -1 } }, - { { 3, -1, -3 },{ 2, -4, -1 },{ -3, -2, 1 },{ -2, 3, -3 },{ 3, -1, 2 },{ 0, 1, -4 },{ 3, 1, -1 },{ -1, 3, -3 },{ -4, -4, -2 },{ 0, -1, 0 },{ -1, 3, 1 },{ -3, -3, -1 },{ 3, -1, -2 },{ -4, 3, 1 },{ 1, 1, 3 },{ -3, -3, -4 },{ -1, 3, 0 },{ -3, -4, -2 },{ 2, -2, -3 },{ 2, 3, 1 },{ 1, -4, -1 },{ -3, -1, 3 },{ 0, -3, 0 },{ 3, 1, -3 },{ 0, 0, 3 },{ 0, 0, 2 },{ 3, 1, -4 },{ 1, -1, 3 },{ -1, 2, -1 },{ 1, 0, 1 },{ -2, -2, 3 },{ -1, -1, 0 },{ -3, 2, -1 },{ 3, 3, 2 },{ 2, 3, -2 },{ 0, -4, 0 },{ -3, 1, -4 },{ 0, 1, 2 },{ -4, 0, 1 },{ -2, -3, -3 },{ 0, 1, -4 },{ -3, -4, -1 },{ 1, 0, 1 },{ -1, -3, -4 },{ -3, 1, 0 },{ -2, -1, -3 },{ 3, -3, 0 },{ -1, 0, 1 },{ -4, 0, 2 },{ 2, -1, 0 },{ -4, -4, -4 },{ 3, -1, 3 },{ 2, 1, -2 },{ -4, -4, 1 },{ 1, 1, -1 },{ 3, -2, 1 },{ -1, 2, 0 },{ 2, -1, -4 },{ 3, -3, 0 },{ 1, 2, 1 },{ -1, -3, 3 },{ -3, 1, 1 },{ 0, 2, 2 },{ -2, -2, -2 } }, - { { 1, 1, 0 },{ -4, 0, -3 },{ 3, 2, -1 },{ 1, -4, 2 },{ -1, -1, -2 },{ -4, -3, -2 },{ 1, -4, 1 },{ -2, -2, 3 },{ 2, 2, -3 },{ 1, 2, 1 },{ -2, 0, -4 },{ -3, -2, -2 },{ -1, 1, 3 },{ 0, -4, 0 },{ -3, 2, -3 },{ 2, -1, 1 },{ 0, -2, -2 },{ -2, 1, -4 },{ 0, 0, 3 },{ -3, 1, 0 },{ -1, -4, -3 },{ 3, 1, -3 },{ 1, -1, 1 },{ -2, 2, -2 },{ -3, 3, 1 },{ 1, -3, -2 },{ -2, -2, -3 },{ -1, -3, 2 },{ 2, -1, -4 },{ -3, 2, -2 },{ 3, -4, 2 },{ -4, 1, 1 },{ 1, -3, -3 },{ -1, -4, 1 },{ -4, -2, -3 },{ 3, 0, 3 },{ 1, -3, -3 },{ 2, -1, -1 },{ -2, -4, -2 },{ 1, -2, 2 },{ 2, 1, -3 },{ 0, 3, 2 },{ 3, -1, 3 },{ 3, -2, 0 },{ 1, 2, 2 },{ -4, 2, 3 },{ 0, -2, 2 },{ 1, 1, -4 },{ 3, 3, -1 },{ 0, 2, 0 },{ -2, -2, -3 },{ -1, -3, -1 },{ 1, 3, 0 },{ -3, -1, -4 },{ -1, 2, 3 },{ -4, -3, -3 },{ 1, -4, -3 },{ 0, 3, 3 },{ -2, 1, 1 },{ 0, -2, -1 },{ -1, 0, -4 },{ -4, -1, 0 },{ 2, -3, 0 },{ -3, 3, 3 } }, - { { -1, 0, 2 },{ -1, -2, 3 },{ -2, -3, 1 },{ 0, 1, -4 },{ -4, 3, 3 },{ 2, 2, 0 },{ -3, 0, -1 },{ -2, 0, -4 },{ 1, 1, 2 },{ -4, -3, -1 },{ 3, -3, 3 },{ 1, 2, -4 },{ 2, -1, 0 },{ -2, 0, 2 },{ 1, -2, -2 },{ -1, 0, 3 },{ 3, -3, 1 },{ -4, 3, 2 },{ 3, -3, -2 },{ -2, -2, -4 },{ 0, 0, 1 },{ -4, 3, 2 },{ 2, -3, -4 },{ -3, -2, -1 },{ 3, -4, 3 },{ -2, 1, -4 },{ 2, 3, 0 },{ -4, 2, 1 },{ 0, 1, 3 },{ 2, -4, -3 },{ 0, -2, -1 },{ -2, 3, -3 },{ 1, 0, 3 },{ 0, -1, -4 },{ -4, 1, 0 },{ -2, 2, -1 },{ 0, 3, 1 },{ -2, 2, 2 },{ 3, 0, 0 },{ -4, -1, 3 },{ -3, 2, 0 },{ -1, -3, 1 },{ -4, 0, -2 },{ -2, 3, -3 },{ 2, -4, -1 },{ -3, -1, -2 },{ 2, 3, -3 },{ -2, -3, -1 },{ -2, -4, -2 },{ -3, 2, 3 },{ 0, 0, 2 },{ -4, 1, 1 },{ -3, -4, -4 },{ 2, 0, -2 },{ 3, 3, 1 },{ -2, 0, -1 },{ -3, -1, 2 },{ 3, 1, -2 },{ -4, -4, -4 },{ -2, 2, 3 },{ 1, -4, -1 },{ 3, 3, -3 },{ -2, -1, -2 },{ 2, -4, -4 } }, - { { 0, 3, 1 },{ 2, -3, -2 },{ 1, 1, -1 },{ -2, 0, -3 },{ 3, -4, 0 },{ -1, -2, -3 },{ 2, 2, 3 },{ 0, -2, 1 },{ -3, -4, 0 },{ -1, -1, -2 },{ 2, 3, 2 },{ -3, -4, -3 },{ 0, 1, 1 },{ -4, -3, -4 },{ 3, 3, -3 },{ -2, 2, -1 },{ -1, -4, -1 },{ -4, 2, 0 },{ 1, -1, 2 },{ 1, 2, -1 },{ -2, -3, 0 },{ 3, 2, -2 },{ -3, 0, 3 },{ -1, -1, 2 },{ -1, 2, 0 },{ -4, -2, -3 },{ 0, -4, 1 },{ -2, 0, -1 },{ 3, 3, -2 },{ -3, -3, 0 },{ -4, 1, -4 },{ 2, 0, 0 },{ 3, -2, -2 },{ -3, 3, 2 },{ 2, -4, 3 },{ 2, -3, -2 },{ -1, -1, -4 },{ -4, -4, 1 },{ 0, -2, -3 },{ -1, 3, -1 },{ 1, -4, -4 },{ 3, -2, -2 },{ -1, -1, 2 },{ -2, 1, -4 },{ 0, -3, 1 },{ -1, -4, 2 },{ 3, 0, -4 },{ -4, -2, 1 },{ -1, -1, 3 },{ 1, -2, -4 },{ 2, -3, -2 },{ 3, 3, -1 },{ -1, -2, 2 },{ 0, -1, 2 },{ -2, -3, 0 },{ 2, -2, -3 },{ 1, -2, -2 },{ -3, 3, 2 },{ 2, -2, -1 },{ 2, -1, -3 },{ -3, 1, 2 },{ -1, -3, 3 },{ 1, 1, 1 },{ -4, -2, -1 } }, - { { 3, -3, -4 },{ -4, 2, -3 },{ -3, -1, 3 },{ 2, 2, 2 },{ -3, -3, -4 },{ 0, -1, 1 },{ -2, 1, -2 },{ 1, -3, -2 },{ 3, 3, -4 },{ 0, 1, 1 },{ -1, 0, -1 },{ -4, -3, 0 },{ 3, 2, 3 },{ 0, -2, -2 },{ -4, -4, 0 },{ 1, -1, 3 },{ 2, 1, -4 },{ 0, -1, -3 },{ -3, 3, -3 },{ 2, -2, 3 },{ -4, 0, 1 },{ 0, 1, -3 },{ 0, -4, -1 },{ 2, 3, -4 },{ 1, -3, -2 },{ 1, 1, -1 },{ 3, 0, 3 },{ -4, -2, -4 },{ 1, -1, 2 },{ -1, -3, 1 },{ -1, 2, 3 },{ 0, -1, 1 },{ -3, -4, -2 },{ -2, 2, -1 },{ -1, 0, -4 },{ 1, 1, 1 },{ -3, -2, -2 },{ 2, -3, 3 },{ 3, 2, -4 },{ -2, 1, 3 },{ 2, 0, 1 },{ -3, 3, -1 },{ 1, -3, 0 },{ -4, 0, 3 },{ 2, 3, -1 },{ 0, -1, 0 },{ -3, 2, -2 },{ 3, 1, 0 },{ 1, 3, -3 },{ -4, 0, 0 },{ -2, -4, 1 },{ 1, -1, 3 },{ 2, 1, -3 },{ -4, 1, 0 },{ 1, 2, -4 },{ -4, 2, 3 },{ -1, -4, 1 },{ 0, 0, 0 },{ -1, -3, -4 },{ -1, 0, 1 },{ 0, 3, 0 },{ -4, -4, -4 },{ 2, 2, -2 },{ -3, 0, 0 } }, - { { -2, -1, 3 },{ 1, -4, 0 },{ -1, 3, -1 },{ 0, -1, -2 },{ 2, 3, 1 },{ -3, -4, 2 },{ -4, 3, -1 },{ 3, -1, -3 },{ -4, 0, 3 },{ -2, -2, 0 },{ -3, -1, -3 },{ 2, -2, -4 },{ -2, -1, -1 },{ -1, 0, 3 },{ -1, 3, 2 },{ -3, -2, -3 },{ 1, 1, 2 },{ -3, -4, 1 },{ -1, 0, 0 },{ 3, -4, -4 },{ -3, -2, -2 },{ -1, -3, 0 },{ -2, -1, -2 },{ -4, 0, 3 },{ 3, 2, 1 },{ -3, -3, 2 },{ -3, 3, -2 },{ 2, -4, -3 },{ -2, -1, 0 },{ 1, 3, -2 },{ -2, 0, 2 },{ 3, 1, -4 },{ -1, -2, 3 },{ 1, -3, 1 },{ 3, -1, -3 },{ 0, 3, -1 },{ -3, 1, 2 },{ -1, 0, 0 },{ 1, 3, 0 },{ -3, -3, -2 },{ -4, -1, -3 },{ 0, -4, 3 },{ -1, 1, -3 },{ 3, 2, 1 },{ 1, -2, -4 },{ -2, 1, 2 },{ -3, 0, 3 },{ -1, -2, -1 },{ 2, -4, 2 },{ 3, 1, -2 },{ -3, 2, -4 },{ -3, -2, 0 },{ -1, 3, -2 },{ 0, -3, -1 },{ -3, -4, 1 },{ 0, 0, -2 },{ 3, 3, -3 },{ -2, 1, 3 },{ 3, 2, 2 },{ -4, -1, -2 },{ 1, 1, 0 },{ -2, -2, -2 },{ 3, -2, 2 },{ 0, 3, -3 } }, - { { -1, 1, 0 },{ 2, 1, -3 },{ 3, -4, 2 },{ -4, -2, -1 },{ -1, -2, -4 },{ 1, 0, 3 },{ -2, 1, 0 },{ -1, -3, 2 },{ 2, 2, -1 },{ 0, -4, 2 },{ 1, 3, -2 },{ 3, 2, 2 },{ 1, 1, 1 },{ -3, -3, -4 },{ 2, 1, -2 },{ 3, -2, -1 },{ -2, 3, 1 },{ 2, -3, 3 },{ -2, 0, -2 },{ 0, 1, 2 },{ 1, 2, 1 },{ 3, 3, 2 },{ 1, 1, -3 },{ -3, -4, 0 },{ -1, -2, -1 },{ 0, -1, -4 },{ 0, 2, 1 },{ -1, 1, 0 },{ 3, 1, 2 },{ -4, -2, -4 },{ 2, -3, -1 },{ -3, -4, -1 },{ 0, 3, -3 },{ -4, 2, 2 },{ -4, -1, 0 },{ -2, -3, 1 },{ 2, -4, -1 },{ 3, 2, -4 },{ -4, -1, -2 },{ -1, -2, 2 },{ 3, 0, 1 },{ 2, 2, -4 },{ -2, 0, -1 },{ -3, -4, 2 },{ -2, -2, -3 },{ -4, -3, 0 },{ 2, -4, -2 },{ 0, 3, -4 },{ -2, -3, 1 },{ -1, 0, -1 },{ 0, -1, 2 },{ -2, -4, -3 },{ 3, 0, 2 },{ -2, -1, 3 },{ 3, -2, -4 },{ -1, -1, -1 },{ 1, 1, 1 },{ -4, -2, -3 },{ 2, -3, -1 },{ -3, -4, -3 },{ 3, 2, 3 },{ 1, -1, -1 },{ -1, -3, 1 },{ -4, 0, 2 } }, - { { -3, -3, -2 },{ -3, -2, 1 },{ 0, 0, 3 },{ -2, 1, -3 },{ 2, -3, -2 },{ 3, 2, 1 },{ -3, -4, -3 },{ 1, 0, 0 },{ -1, -2, -4 },{ -3, 1, -3 },{ -3, -4, 3 },{ -1, -3, -2 },{ -4, 0, 1 },{ 2, 3, 0 },{ -2, -4, -3 },{ 0, -1, -4 },{ -4, 2, -1 },{ 1, -1, -2 },{ -4, 3, -3 },{ 2, -4, -1 },{ -4, -1, -4 },{ -1, -1, -1 },{ -2, -2, 3 },{ 3, 2, -3 },{ 2, 3, 2 },{ -4, -3, 3 },{ -2, 0, -1 },{ 2, -4, -3 },{ -4, -3, 3 },{ 0, 3, -2 },{ 1, -1, 1 },{ -2, 0, 0 },{ 2, 1, -4 },{ 3, -3, -2 },{ 0, 0, 3 },{ 1, 2, -4 },{ -1, -2, -3 },{ 0, 3, 3 },{ 0, -4, 2 },{ -2, 1, -1 },{ 1, 3, -2 },{ -4, -3, 2 },{ 0, -2, 0 },{ 1, -1, -2 },{ 2, 1, 1 },{ 3, 3, -4 },{ 0, -1, 3 },{ 1, 2, -3 },{ -3, -2, 1 },{ -4, 2, -2 },{ 2, 3, 3 },{ 2, -2, 0 },{ 1, 1, 1 },{ -4, 2, -3 },{ 2, 3, 2 },{ -3, -3, 3 },{ 1, -4, 0 },{ -2, -1, -2 },{ 0, 3, 2 },{ -1, -3, -4 },{ -2, 1, 2 },{ -3, 3, -4 },{ 0, -4, -1 },{ 2, 2, -4 } }, - { { 1, 3, -3 },{ 3, -1, 2 },{ -1, 2, -4 },{ -4, 3, 0 },{ 0, 0, 2 },{ -3, -1, -4 },{ 0, 2, -2 },{ 2, 3, 2 },{ -4, -3, -2 },{ 1, -1, 1 },{ 3, 0, 0 },{ 0, 2, -4 },{ 0, -2, -1 },{ -1, -4, 2 },{ -4, -1, 2 },{ 2, 0, 3 },{ -1, -3, 0 },{ 3, 1, -4 },{ 0, -2, 2 },{ -2, 2, 3 },{ -3, -3, 0 },{ 2, -3, -3 },{ 0, 1, 1 },{ -1, -4, 0 },{ 1, 0, -4 },{ 3, -3, -2 },{ 1, -1, 2 },{ -3, 3, -4 },{ 0, -2, 1 },{ -1, 2, -3 },{ 3, 2, 3 },{ -3, -1, 2 },{ -1, 1, 0 },{ 1, -4, 2 },{ -2, -1, -2 },{ -3, -3, 2 },{ 2, 1, -1 },{ -4, -1, 1 },{ -3, 0, -3 },{ 2, -2, -4 },{ -2, 1, 3 },{ -1, -4, 0 },{ 3, 0, -4 },{ -3, 3, 3 },{ -1, 2, -1 },{ 0, 0, 2 },{ -4, -3, -1 },{ -2, 0, 3 },{ 3, -4, 0 },{ 0, -1, 2 },{ 0, -3, -3 },{ -2, -4, -4 },{ -4, 2, -2 },{ 0, -3, -1 },{ -2, 0, 0 },{ -1, 1, -2 },{ 2, 3, -4 },{ -4, 0, 3 },{ -1, 2, 0 },{ 3, 0, 1 },{ -4, -1, 0 },{ 1, 2, -2 },{ 3, 0, 3 },{ -2, -2, 1 } }, - { { 3, -4, -1 },{ -1, -1, -1 },{ -2, -3, -2 },{ 1, -4, 3 },{ 3, -2, -1 },{ 1, -2, 3 },{ -2, -4, 1 },{ -2, 0, 3 },{ 3, 3, -1 },{ -1, 2, 2 },{ -2, -1, -3 },{ 2, 3, 3 },{ -3, -3, -2 },{ 1, 1, -3 },{ 1, 2, -1 },{ -3, 3, 0 },{ -1, -3, -2 },{ -2, -4, 1 },{ -3, -1, 0 },{ 3, 1, -2 },{ 1, 0, 1 },{ -2, 3, -4 },{ -4, 0, -1 },{ -4, -2, 2 },{ -3, 2, 0 },{ -2, 1, -2 },{ -1, 3, 1 },{ 2, 0, 0 },{ -3, -4, 0 },{ 1, 0, -1 },{ -4, -3, -2 },{ 2, -3, -4 },{ 0, -2, -1 },{ -4, 2, -3 },{ 3, 2, -3 },{ -3, 3, 0 },{ 3, 0, -4 },{ -2, -3, 1 },{ 2, -4, 0 },{ 3, 2, -1 },{ -1, -1, 1 },{ -4, 2, -3 },{ 2, -4, -2 },{ 2, -1, 2 },{ -2, -3, -3 },{ -3, -4, 1 },{ 2, -1, 0 },{ -2, 1, -3 },{ 2, 3, -4 },{ -4, 2, -1 },{ 3, 0, -2 },{ -3, 1, 2 },{ -1, -3, 3 },{ 3, -2, -4 },{ 3, 0, 1 },{ 0, -4, -3 },{ -3, -1, 1 },{ 3, -2, -2 },{ 0, -4, -1 },{ 2, -2, -3 },{ -3, -3, 1 },{ 2, -4, -2 },{ -2, -2, 0 },{ -4, 1, 3 } }, - { { 0, -3, 0 },{ -4, 2, -3 },{ 2, 1, 1 },{ -3, 1, 1 },{ -4, 2, -3 },{ -1, 3, -2 },{ -4, 1, -4 },{ 1, -1, -1 },{ 0, -2, -4 },{ -4, -4, 0 },{ -3, -2, -2 },{ 3, -4, 1 },{ -4, 0, -4 },{ 3, 1, 1 },{ -2, -2, 1 },{ 3, -1, -4 },{ 1, 0, 3 },{ 1, 2, 2 },{ 2, -2, -3 },{ -1, 2, -4 },{ 0, -3, 3 },{ 3, -4, -2 },{ 1, -1, 3 },{ 2, 3, -3 },{ 3, -2, -3 },{ 0, -4, 3 },{ -4, -1, -4 },{ 3, -2, 2 },{ 1, 1, -1 },{ -2, -1, -4 },{ -1, 1, 2 },{ -4, -4, 1 },{ -2, 3, 0 },{ 2, 0, 3 },{ -1, -4, 1 },{ -1, -2, 3 },{ 0, -1, -2 },{ 1, 2, 3 },{ -1, 3, -2 },{ -3, -3, 2 },{ 1, -2, -3 },{ 0, 3, 1 },{ -3, 1, 3 },{ -2, -2, 0 },{ -4, -2, -4 },{ 3, 3, -3 },{ 1, 2, 2 },{ -1, 1, -2 },{ -1, -3, 3 },{ 1, -2, 1 },{ -2, 0, 0 },{ 2, 1, -1 },{ -3, 3, 1 },{ 1, -1, -3 },{ -2, -4, 3 },{ -4, 2, 0 },{ 1, -1, 2 },{ -2, 1, -4 },{ -3, 3, 3 },{ 1, 2, -2 },{ -2, -1, 3 },{ 0, 3, -4 },{ -1, 0, -3 },{ 1, 3, -4 } }, - { { -2, -1, 3 },{ 0, 3, -3 },{ -3, -2, 2 },{ 2, 0, -4 },{ -1, -1, -1 },{ 3, -3, 0 },{ 2, -4, 1 },{ -3, 1, -3 },{ 2, -1, 2 },{ 0, 1, -3 },{ 1, 1, 2 },{ -1, 3, 3 },{ 1, -1, 0 },{ -2, -3, -1 },{ -3, -4, 3 },{ 0, 3, -3 },{ -4, 1, -2 },{ 0, 0, -1 },{ -4, -4, -3 },{ -2, 3, 0 },{ -4, -1, 2 },{ -3, 2, 0 },{ -1, -2, -1 },{ -1, 1, 1 },{ -2, -3, 1 },{ 1, 0, -1 },{ 0, 2, -3 },{ -4, -3, 2 },{ 0, 2, -3 },{ 2, 0, 3 },{ 3, 3, 1 },{ 1, -2, -2 },{ 0, 2, -4 },{ -3, 1, -3 },{ 1, -2, 0 },{ -3, 1, -1 },{ 1, -4, 2 },{ -4, 1, -3 },{ 0, -2, -4 },{ -4, 1, 3 },{ 1, 0, -1 },{ 3, -3, -4 },{ -1, -1, 0 },{ 0, 1, -2 },{ 1, 3, -1 },{ 0, 0, 3 },{ 2, -3, -2 },{ -4, -2, 0 },{ 0, -4, -1 },{ -3, 3, -3 },{ 1, -2, -4 },{ -1, -4, 3 },{ 0, -1, -2 },{ 2, 2, -1 },{ -3, 1, 2 },{ 0, 3, -2 },{ 2, -3, -1 },{ -2, 2, 2 },{ 3, -3, 0 },{ -1, 1, -4 },{ -4, 1, 0 },{ 3, -4, 2 },{ -3, 2, 1 },{ -3, -3, 2 } }, - { { 1, 1, -2 },{ -1, -4, 0 },{ 3, -2, -1 },{ 0, -4, 2 },{ 1, 3, -3 },{ 0, 2, 2 },{ -2, 0, 2 },{ -3, -3, 3 },{ -1, 3, -1 },{ 3, -3, 1 },{ -2, 0, -4 },{ 0, -4, -2 },{ -4, 2, 2 },{ 2, 3, -3 },{ 0, 1, 0 },{ -3, -1, -2 },{ 2, -2, 1 },{ -2, -3, 3 },{ 3, 1, 1 },{ -1, -2, -1 },{ 1, 0, 2 },{ 3, 0, -3 },{ 0, 1, -4 },{ 2, -4, 0 },{ -3, -1, 3 },{ 3, 3, -2 },{ -2, 1, -1 },{ -3, -2, 0 },{ -1, -4, -2 },{ -3, -2, 1 },{ -3, -4, -3 },{ -2, 0, 0 },{ -1, -1, 2 },{ 3, -3, 2 },{ 0, 3, -4 },{ -4, -1, -1 },{ 2, -3, -2 },{ 3, 2, 1 },{ -2, 0, 0 },{ 2, -4, 1 },{ -2, 1, -2 },{ -3, -4, 2 },{ -4, 2, -3 },{ 2, -3, 3 },{ -1, 0, -1 },{ -3, -4, 1 },{ -3, -1, -4 },{ -2, 2, 0 },{ 3, 1, 3 },{ 2, -1, 2 },{ -4, -3, -3 },{ 3, 3, 1 },{ -4, -3, -2 },{ -1, -2, -4 },{ -2, 0, 0 },{ 3, -3, -4 },{ 1, -1, -2 },{ -1, -2, 0 },{ -4, -4, -3 },{ 2, 0, 1 },{ 1, -2, -1 },{ -1, -1, -1 },{ 3, -2, -3 },{ 2, 0, -2 } }, - { { -2, 2, 1 },{ 2, -1, -4 },{ -3, 3, 0 },{ -4, -3, 3 },{ -2, -1, -2 },{ -4, 0, 0 },{ 3, -2, -3 },{ 1, 3, -4 },{ 0, -1, -2 },{ -2, 2, 0 },{ -4, 0, -1 },{ -3, -1, -2 },{ 3, -3, 1 },{ -1, -2, -4 },{ 1, 0, 2 },{ 2, -4, -1 },{ -1, 3, 2 },{ 1, 2, -4 },{ -3, -1, 0 },{ 2, -4, -2 },{ 1, 3, -4 },{ -2, -3, 3 },{ -4, -2, -1 },{ -1, 3, -2 },{ -4, 0, -4 },{ -1, -4, 2 },{ 2, -1, -4 },{ -1, 1, 1 },{ 2, 3, 3 },{ 1, -1, -1 },{ 2, 3, -4 },{ 3, -3, -1 },{ -4, 1, 3 },{ 2, -4, -2 },{ -2, 0, 1 },{ -1, 2, -4 },{ -3, 3, 2 },{ -2, -1, -1 },{ 2, 0, -1 },{ -1, -2, -3 },{ 0, 3, 3 },{ 1, 3, 0 },{ 3, -1, -4 },{ -1, -2, 1 },{ -2, 2, -4 },{ 3, 1, 1 },{ 2, -2, 2 },{ 0, 3, -3 },{ -1, 0, -4 },{ -2, 2, 2 },{ 0, 0, -1 },{ -2, 2, 0 },{ -3, 1, 3 },{ 3, -4, 1 },{ 2, 2, 2 },{ -4, -4, -3 },{ 0, 0, 3 },{ -3, 3, 1 },{ 3, -2, 3 },{ -2, 3, -3 },{ 1, 0, 2 },{ -3, 2, 0 },{ 0, 1, 3 },{ -4, -4, -1 } }, - { { 1, -3, 3 },{ -3, 0, 2 },{ 0, 1, -3 },{ 2, 0, -1 },{ 3, 2, -4 },{ -1, -4, 1 },{ -2, 1, -2 },{ 2, -3, 0 },{ -4, -2, 1 },{ 1, -4, 3 },{ 3, -2, -3 },{ 2, 1, 3 },{ 0, -3, -1 },{ -3, 2, 0 },{ -2, 0, 3 },{ -4, 1, -3 },{ 3, -3, -4 },{ -3, -2, 0 },{ -1, -1, -2 },{ -4, 3, 3 },{ 2, 0, -1 },{ -2, -3, 0 },{ 3, 1, 2 },{ 1, 2, 1 },{ 2, -3, 3 },{ -3, 3, 0 },{ 1, 0, 2 },{ 3, -3, -3 },{ -4, 2, -4 },{ -1, -1, 0 },{ -4, 1, 3 },{ 0, -2, -3 },{ 0, 2, 0 },{ -4, 3, -1 },{ 1, -2, 0 },{ 3, -3, 3 },{ 0, -2, -3 },{ 1, -4, 1 },{ -3, 2, 3 },{ 3, -3, -4 },{ -4, 1, -2 },{ -3, -1, 2 },{ 2, 0, -1 },{ -3, -3, 0 },{ 0, -4, 3 },{ 0, 0, -2 },{ -4, -3, -1 },{ 1, -3, 0 },{ -3, -4, 1 },{ 2, -2, -2 },{ 1, -4, -1 },{ 2, -2, -4 },{ 1, 0, 2 },{ 0, 3, -3 },{ -2, -1, 0 },{ -1, 2, -1 },{ -3, 1, 2 },{ -1, 1, -4 },{ 0, -4, -1 },{ -3, 2, -2 },{ -4, -3, -4 },{ 2, -4, -4 },{ -2, -2, 0 },{ -1, 3, -3 } }, - { { -4, -2, -4 },{ 3, -4, -1 },{ -2, 2, 3 },{ 1, -2, -2 },{ -4, 3, 1 },{ -1, -1, 3 },{ 1, -4, -1 },{ 0, 2, -3 },{ -3, 2, 2 },{ -1, 0, -4 },{ 1, 2, 0 },{ -2, 3, 2 },{ -1, -1, -4 },{ 3, 2, -1 },{ -2, -4, -2 },{ 0, -2, 1 },{ 0, 3, -1 },{ -2, 1, 3 },{ 3, -4, 2 },{ 0, 2, -3 },{ -1, -2, 1 },{ -3, -1, -2 },{ 0, 2, -4 },{ -2, -1, -3 },{ 3, -4, -1 },{ 0, -2, -3 },{ -4, 1, -1 },{ 1, -4, 1 },{ -2, -3, -2 },{ 2, 0, 2 },{ -2, -4, 1 },{ -2, -3, 2 },{ 1, 0, -2 },{ -3, -1, -4 },{ -2, -4, 1 },{ 2, 1, 2 },{ -4, 0, -2 },{ 0, 3, -4 },{ -4, -2, 2 },{ 0, -1, 0 },{ -1, -4, -2 },{ 3, -3, 1 },{ -2, 1, 2 },{ 1, 3, -2 },{ -4, -1, -3 },{ 2, 3, -2 },{ -1, 1, 2 },{ -2, 0, -4 },{ 3, 1, -2 },{ -4, 3, 3 },{ -2, 2, 1 },{ -4, 1, -3 },{ -1, -3, -1 },{ -3, -1, -2 },{ 1, 1, 3 },{ 3, -2, -4 },{ 2, -3, -2 },{ 2, -1, 1 },{ 1, -3, 0 },{ 3, 1, 3 },{ -1, -1, 2 },{ 0, 3, 1 },{ 1, -1, 2 },{ 3, 1, -2 } }, - { { 2, 3, 0 },{ -2, -1, 1 },{ 0, -1, -3 },{ -1, -3, 0 },{ 2, -2, -4 },{ -3, 1, 2 },{ 3, 3, -2 },{ -4, 0, 3 },{ 2, 1, 2 },{ 3, -3, -1 },{ -3, -4, -2 },{ -4, 1, -3 },{ 2, 0, 3 },{ 1, -3, 1 },{ -4, -1, -4 },{ 1, 2, 3 },{ 2, -2, -3 },{ -3, 0, -1 },{ 1, 1, -3 },{ 2, -3, 1 },{ -3, 3, -4 },{ 3, -4, 2 },{ 0, -3, 0 },{ -3, 1, 1 },{ -4, -2, 3 },{ -2, 0, -2 },{ -1, 2, -1 },{ -3, 3, 3 },{ 0, -1, -2 },{ 3, 2, -4 },{ -1, 2, -2 },{ 1, 3, 0 },{ 3, -2, -3 },{ 3, 0, 3 },{ 0, 2, -2 },{ -1, 2, -3 },{ 2, -3, 0 },{ -2, 1, -2 },{ 3, 2, -1 },{ 1, 0, 1 },{ -2, 3, -4 },{ -4, 2, 3 },{ 0, -2, -4 },{ 3, 2, -3 },{ -2, 0, 3 },{ 1, -2, 1 },{ -3, -4, 3 },{ -3, 2, 0 },{ 0, -2, -3 },{ 2, -1, 3 },{ -1, -1, 0 },{ 3, -3, -4 },{ 2, 3, 2 },{ -4, 0, 1 },{ 1, -4, -1 },{ -2, -2, -2 },{ -4, 3, 1 },{ -2, 0, -3 },{ -4, 3, -3 },{ -1, -2, 1 },{ 3, 0, -2 },{ -4, 2, -3 },{ -3, -4, -1 },{ -1, 0, 2 } }, - { { 0, -3, 1 },{ -4, 3, -2 },{ 2, -4, -4 },{ -3, 2, 3 },{ 1, -2, 1 },{ 0, 0, -1 },{ -2, -3, -4 },{ -2, -3, 0 },{ -1, -1, -4 },{ 0, 3, -2 },{ 2, -2, 1 },{ -4, -2, 1 },{ -1, -4, 0 },{ -3, 3, -3 },{ 3, 1, 0 },{ -3, -1, 2 },{ -1, 0, 0 },{ -4, -3, 0 },{ 0, -4, 2 },{ -2, 2, -2 },{ -4, -1, -1 },{ 2, 0, 3 },{ 1, 2, -2 },{ -1, 0, 2 },{ 2, 3, -4 },{ 2, -3, 0 },{ 3, -1, -4 },{ 0, 1, 2 },{ -3, -4, 0 },{ 2, -2, 2 },{ -4, -3, -1 },{ -3, 1, -4 },{ -1, -2, 3 },{ -2, -4, 1 },{ -4, 3, -1 },{ 2, -1, -4 },{ -3, -3, 3 },{ -2, -2, 1 },{ 2, -4, 3 },{ -3, 0, -3 },{ -1, -2, -1 },{ 1, 1, -1 },{ 2, -4, 2 },{ -4, -4, 0 },{ -1, 1, 0 },{ 3, -3, -1 },{ 2, -1, -4 },{ 2, 3, -1 },{ 1, -3, 2 },{ -1, 0, -1 },{ -3, -4, -2 },{ 0, -2, 0 },{ -2, 1, 3 },{ -1, -3, -2 },{ 2, 2, -3 },{ -1, 2, 2 },{ 0, -3, 0 },{ 1, -1, 3 },{ 2, -4, 2 },{ -3, 2, -2 },{ -2, -3, -1 },{ 2, -2, 0 },{ -2, 0, 3 },{ 1, -3, -4 } }, - { { 0, -2, 3 },{ -2, 1, 2 },{ 3, 0, 2 },{ -2, 3, -1 },{ -4, 1, -3 },{ 3, -4, -2 },{ 2, 2, 1 },{ 1, -2, -1 },{ -3, -1, 1 },{ 0, 1, 3 },{ -2, 2, -1 },{ 1, 0, -4 },{ 0, -2, 3 },{ 0, 1, -2 },{ 2, -3, -2 },{ -1, -4, 2 },{ 0, 2, -4 },{ 1, 3, -2 },{ 3, -1, 3 },{ -1, -2, 0 },{ 1, 1, 1 },{ -2, -2, -4 },{ -4, 3, -1 },{ -1, -4, -3 },{ -3, -2, 1 },{ 1, 2, 2 },{ -2, -3, 3 },{ -4, -1, -3 },{ 1, 1, -3 },{ -2, 3, 0 },{ 0, -1, 3 },{ 2, 0, 1 },{ 0, 3, 0 },{ -4, -3, -2 },{ 1, 1, 2 },{ -1, -1, 1 },{ 1, 0, -1 },{ -1, 3, 0 },{ 0, -1, -4 },{ 2, 1, -2 },{ -3, -3, 3 },{ 2, -1, 1 },{ -3, -1, -3 },{ -1, -3, -2 },{ 0, 3, -4 },{ -3, 0, 2 },{ -4, 2, -2 },{ 0, -3, -3 },{ -2, 2, 1 },{ -4, 0, -4 },{ 1, 3, 2 },{ 0, 2, -3 },{ 3, 0, 1 },{ -4, -4, -4 },{ 0, -1, 2 },{ -3, 0, 1 },{ 3, 1, -4 },{ -3, 2, -1 },{ -1, 0, 0 },{ 0, -2, -4 },{ -2, 1, -4 },{ 1, 3, 3 },{ 3, 2, -3 },{ -4, 2, -2 } }, - { { -3, 1, -3 },{ 2, 0, -3 },{ 1, -3, -2 },{ -1, -2, 0 },{ -1, -1, 3 },{ -4, 2, 2 },{ 0, 0, 3 },{ -3, 3, -3 },{ 3, -4, -3 },{ -4, -3, 2 },{ 3, 3, -3 },{ -2, -1, 0 },{ 3, 2, 2 },{ -2, 0, -1 },{ -3, 3, -4 },{ -4, -2, 1 },{ 3, -1, -1 },{ -2, -3, -4 },{ -4, 2, 3 },{ 3, 0, -3 },{ -3, -4, -2 },{ 0, -3, 2 },{ 3, -1, 3 },{ 2, -1, 0 },{ 0, 1, -1 },{ -4, 2, -3 },{ 2, -2, -2 },{ -1, 0, 1 },{ 3, -4, -1 },{ 1, -2, -4 },{ -4, 1, 2 },{ -3, -4, -3 },{ 2, 2, -3 },{ 3, -3, -1 },{ -2, 0, -4 },{ -3, -2, 0 },{ 3, -4, -3 },{ 1, 2, -3 },{ -4, 2, 2 },{ 3, -4, 1 },{ -1, 3, -2 },{ 0, 0, 0 },{ -2, 3, 1 },{ 3, 2, 3 },{ -3, 0, -1 },{ 1, -2, 1 },{ -1, -1, 3 },{ -1, -4, 0 },{ 3, 1, 3 },{ -2, -2, -2 },{ 3, -3, -1 },{ -4, 1, 3 },{ 1, -2, 0 },{ -3, -1, -1 },{ 3, 3, 3 },{ 1, -4, -3 },{ 2, -2, -2 },{ -4, -4, -1 },{ 3, -1, 3 },{ 2, 2, 1 },{ -4, -4, 2 },{ 0, -3, -1 },{ 3, -1, 1 },{ -1, -4, -1 } }, - { { 1, -1, 1 },{ -4, 3, 0 },{ 2, -1, -1 },{ -3, -4, -4 },{ 1, 3, -3 },{ 2, -3, 0 },{ -1, -2, -2 },{ -3, 1, -4 },{ 1, 0, 2 },{ -1, 1, -2 },{ -3, -4, 0 },{ 1, -4, -3 },{ -4, -3, -2 },{ -1, 1, 1 },{ 2, -3, 3 },{ 1, 2, 2 },{ -2, 1, -1 },{ -3, -4, -2 },{ 2, 0, 2 },{ 1, 3, -3 },{ 0, -3, 1 },{ -2, 1, -4 },{ -1, 2, -2 },{ -3, 0, -3 },{ -3, -3, 2 },{ 3, 3, 0 },{ 0, -4, -2 },{ -3, 1, 3 },{ -2, 3, 1 },{ -1, 2, -2 },{ 3, -3, -1 },{ -2, 0, 1 },{ 0, -1, 3 },{ -3, -2, -2 },{ 0, 3, -3 },{ 3, 2, 3 },{ -2, -3, 2 },{ -4, 0, -2 },{ -2, -2, 1 },{ 0, -3, 3 },{ -2, 0, -4 },{ -4, 2, -4 },{ 2, -4, -2 },{ 1, -2, 2 },{ -2, -3, -3 },{ 2, 1, -4 },{ 3, 2, 1 },{ -4, 0, -3 },{ 1, -2, 2 },{ 1, 3, 1 },{ -3, -1, 0 },{ -1, -4, -3 },{ 2, 2, -2 },{ -1, 3, -4 },{ -2, -2, -1 },{ -4, 1, 0 },{ -1, -3, 1 },{ -2, 3, -3 },{ 0, -2, 3 },{ 1, 3, -2 },{ -1, -1, -2 },{ -4, 0, 2 },{ -3, 1, -4 },{ -2, -3, 0 } }, - { { 3, -2, -2 },{ -2, 2, 3 },{ 0, -4, 2 },{ 3, 2, 1 },{ -3, 1, 1 },{ -2, -1, -4 },{ 0, -4, 2 },{ 2, -2, -1 },{ -1, 3, 1 },{ 2, -1, -1 },{ 0, 0, 3 },{ -4, 3, -4 },{ 2, -2, 2 },{ -1, 2, 0 },{ 2, -4, -3 },{ 0, -1, -3 },{ 0, 0, 0 },{ -1, 2, 1 },{ 1, -2, 1 },{ -1, 1, -1 },{ -4, 2, -1 },{ 2, -2, 2 },{ 1, 3, 0 },{ -1, 0, 1 },{ 1, -4, -4 },{ 1, 2, 3 },{ -2, -1, 1 },{ 0, -3, -4 },{ 2, -2, 0 },{ -4, 0, 2 },{ 1, -4, -4 },{ 3, 3, -1 },{ -1, 1, 2 },{ -1, -3, 1 },{ 2, -1, 0 },{ -4, 1, 3 },{ 0, -4, -1 },{ 2, 1, -4 },{ 2, 3, -1 },{ -3, -1, -3 },{ 3, -4, 0 },{ 1, -2, 2 },{ -1, -1, -1 },{ -4, 1, 0 },{ -1, -4, -2 },{ 1, 3, 0 },{ -2, -3, -2 },{ 0, -1, -1 },{ -3, 3, -3 },{ 2, -4, -4 },{ -4, 2, 0 },{ -2, 0, 3 },{ 3, -3, 1 },{ 1, -3, 2 },{ -3, 1, 2 },{ 0, 2, -4 },{ 3, -1, 0 },{ -2, 0, 2 },{ -4, 1, -4 },{ -3, -3, 0 },{ 3, -2, 1 },{ 1, 3, -3 },{ 1, -2, 3 },{ 2, 2, -2 } }, - { { -1, -3, -4 },{ -4, 0, 1 },{ -2, 3, -4 },{ -1, 0, -2 },{ 1, -2, -1 },{ 3, 0, 3 },{ -4, 2, 0 },{ 3, -1, -2 },{ -4, 1, 2 },{ -2, -3, -4 },{ 3, 2, 1 },{ 1, -1, -1 },{ -2, 1, 1 },{ -3, -1, -3 },{ -3, 0, 0 },{ 3, -3, -2 },{ -4, 3, 3 },{ 2, -4, -4 },{ -4, -2, -3 },{ -3, -1, 3 },{ 3, -1, -4 },{ -2, -4, 3 },{ 3, -3, -3 },{ -4, 1, -2 },{ -2, -2, -1 },{ 3, -1, -4 },{ -4, 0, 2 },{ -1, 3, -3 },{ 2, -3, -1 },{ -3, 1, -3 },{ 0, -1, 3 },{ -3, -2, 0 },{ -4, 2, -3 },{ 1, 2, -4 },{ 1, -4, -4 },{ -2, 3, -1 },{ -1, -1, -2 },{ -3, -2, 2 },{ 1, -2, 0 },{ 0, 2, 2 },{ -3, 1, -1 },{ 2, 2, -2 },{ -3, -3, 3 },{ 3, 3, -4 },{ 0, 0, 2 },{ -4, -1, 3 },{ -3, -4, 1 },{ 2, 1, 3 },{ -1, -3, -1 },{ 2, 1, 1 },{ 0, -2, -4 },{ 0, 1, -2 },{ -2, -2, -1 },{ -4, 0, -3 },{ -1, -1, -2 },{ 2, -4, 3 },{ 1, 3, -2 },{ 0, -3, -3 },{ 1, -4, 2 },{ 2, 1, -1 },{ -2, 2, -3 },{ -1, -4, 0 },{ -3, 0, -1 },{ 0, 1, 2 } }, - { { 2, 1, 3 },{ 0, -2, -1 },{ 3, -3, -3 },{ -3, -1, 3 },{ 2, -3, -2 },{ 0, 3, -3 },{ -2, -3, 0 },{ 1, 3, -4 },{ -2, -4, 3 },{ 0, -2, 0 },{ -3, 1, -3 },{ -1, -2, 3 },{ 3, 2, -1 },{ 0, -4, -4 },{ -4, 3, 2 },{ -1, -2, -1 },{ -2, 1, 1 },{ 3, -1, 2 },{ 0, 3, 0 },{ -2, -3, -2 },{ 1, 3, 0 },{ -3, 0, -2 },{ 2, -1, 1 },{ 0, -4, 3 },{ -1, 2, 2 },{ 0, -3, 1 },{ -3, 1, -2 },{ 3, -4, -1 },{ -2, 2, 2 },{ 1, 0, 1 },{ 1, 3, -4 },{ -2, -3, -2 },{ 2, -4, -1 },{ 3, 0, 3 },{ -4, -2, 0 },{ -2, -1, 1 },{ 3, 2, 1 },{ 3, 0, -4 },{ -1, -4, -3 },{ -4, 1, 3 },{ -2, -1, 1 },{ 1, 3, -3 },{ -2, -2, 1 },{ 0, 0, -3 },{ -2, -1, 1 },{ 3, 3, -3 },{ -2, -2, -4 },{ 3, 0, 0 },{ -4, 3, -3 },{ -2, -1, 2 },{ 3, -1, 3 },{ -3, -4, 2 },{ 2, 3, 0 },{ 1, 3, 1 },{ 0, -4, -2 },{ -3, 1, 1 },{ -4, -1, 1 },{ -1, 0, -1 },{ 2, 2, 0 },{ -3, -2, 1 },{ 0, -1, 3 },{ -1, -3, 2 },{ 3, 3, -4 },{ -4, -4, -2 } }, - { { -3, 0, -3 },{ -1, 3, 0 },{ 1, -4, 2 },{ -1, 2, 2 },{ -4, -1, 0 },{ -1, 2, 1 },{ -3, -4, 2 },{ 0, 0, -2 },{ 2, 1, -3 },{ -3, -1, 1 },{ 2, 3, -2 },{ -4, -4, -2 },{ -2, -2, 2 },{ 2, -3, 3 },{ 1, 1, -2 },{ -2, -1, 3 },{ 2, 2, -3 },{ 1, -4, -4 },{ -3, 0, -1 },{ 2, 1, 3 },{ 0, -4, 2 },{ -1, 2, -1 },{ -3, -2, -4 },{ 0, 3, 0 },{ -4, 2, -2 },{ 2, 0, -3 },{ 2, 3, 3 },{ 0, -2, 0 },{ -4, -1, -2 },{ -2, -3, -1 },{ 3, 1, 3 },{ -1, -1, 2 },{ 0, 0, 0 },{ -3, 3, -2 },{ 1, 1, 2 },{ 0, -3, -3 },{ 2, 2, -1 },{ -3, -3, 3 },{ 1, 0, -1 },{ 0, 3, 0 },{ 2, -4, -4 },{ 0, 0, -2 },{ 3, -4, 3 },{ -4, 1, 0 },{ 2, -3, -1 },{ 1, 1, -2 },{ -1, 2, 3 },{ 1, -4, -2 },{ -3, 1, 0 },{ 0, -3, -2 },{ -1, 2, -1 },{ -4, 2, -4 },{ 3, -1, -3 },{ -2, -2, 3 },{ 2, 0, -4 },{ 3, -2, -1 },{ -3, -3, -4 },{ -1, 2, 3 },{ 3, -4, -2 },{ -3, 0, -4 },{ -4, 3, -2 },{ 3, 1, -1 },{ -2, -2, 1 },{ 1, -1, 1 } }, - { { 3, 2, -3 },{ -4, -4, -1 },{ 2, 1, -1 },{ -2, 0, -4 },{ 1, 1, 0 },{ 2, -2, -3 },{ 3, -2, -1 },{ -3, 0, 3 },{ -1, 2, -1 },{ 1, -3, 2 },{ -1, -4, 1 },{ 3, 0, -4 },{ 1, 0, 0 },{ -3, 3, 0 },{ 0, 1, -4 },{ 0, -4, 1 },{ -3, -3, -2 },{ -1, 0, -1 },{ -2, 2, 0 },{ 0, -2, -3 },{ -4, 2, -4 },{ 2, 0, 1 },{ -2, -1, 2 },{ 3, -3, -3 },{ 1, -4, 0 },{ -3, -1, -1 },{ -2, -2, -4 },{ -1, -4, 2 },{ -4, 1, -3 },{ 2, -2, 1 },{ -1, -4, 0 },{ -3, 2, -3 },{ -4, -3, -3 },{ 3, -2, 2 },{ -1, 0, -4 },{ -3, -4, 0 },{ -4, -1, -3 },{ -2, 3, -2 },{ -1, -3, 2 },{ 3, -1, -3 },{ -4, -3, 0 },{ -1, 2, -1 },{ -3, -2, 2 },{ -2, 2, -4 },{ -1, -4, 2 },{ -3, -2, -1 },{ 2, -2, 1 },{ 0, -3, 2 },{ -2, 2, -4 },{ 3, 0, 3 },{ 1, -3, 1 },{ 1, -4, -1 },{ -1, 1, 2 },{ -4, -3, 0 },{ -2, 2, -1 },{ -1, 1, 2 },{ 1, 3, 3 },{ 1, 0, -3 },{ -2, -2, 2 },{ 0, 3, -1 },{ 2, 0, 2 },{ 1, -3, -3 },{ 0, 2, 0 },{ -2, -1, 2 } }, - { { 2, -3, 3 },{ 1, 1, -4 },{ 0, -2, 1 },{ -4, 3, -2 },{ 3, -3, 3 },{ -2, 2, -4 },{ -1, 3, 1 },{ -4, -3, -1 },{ 3, 1, -4 },{ 0, -1, -3 },{ -4, 3, 3 },{ -2, 1, -1 },{ 2, -1, -3 },{ -1, -3, 1 },{ -4, 2, -1 },{ 3, -2, -3 },{ 2, -1, 2 },{ -4, 3, 3 },{ 3, -1, 1 },{ 1, -3, 2 },{ -2, -4, -2 },{ 3, -2, -1 },{ -3, 3, 2 },{ 1, 1, -4 },{ -4, -2, 3 },{ -1, 0, 1 },{ 3, 2, 0 },{ 1, 2, 3 },{ 0, 1, -2 },{ 3, 3, -4 },{ 2, 0, -1 },{ 1, 3, 1 },{ -2, -1, 3 },{ 0, -3, 1 },{ 2, 3, -1 },{ -1, 1, 3 },{ 2, 2, 0 },{ 1, -2, 1 },{ -4, 1, 3 },{ 2, 1, -4 },{ -2, 3, 1 },{ 1, -1, 3 },{ 3, 0, -3 },{ 2, 1, -2 },{ 1, 3, 3 },{ -4, -1, -4 },{ -4, 0, -3 },{ -2, 3, 2 },{ 2, -1, -1 },{ -1, -2, -3 },{ -4, 3, 1 },{ -3, -1, -2 },{ 0, 2, -3 },{ 2, -2, 2 },{ -3, 3, -2 },{ 2, -3, -4 },{ -2, -1, 0 },{ -4, -4, -3 },{ 2, -1, 1 },{ 1, -3, 0 },{ -3, 1, -3 },{ -1, -4, 3 },{ -4, -2, -4 },{ -1, 3, -2 } }, - { { -3, -3, 0 },{ -2, -1, 3 },{ -3, -2, 1 },{ -1, -4, 0 },{ 0, -1, -2 },{ -3, -4, 3 },{ 2, -1, 0 },{ 0, 1, -3 },{ 1, -4, 2 },{ -2, -2, 0 },{ -4, 2, -2 },{ 1, -3, 2 },{ -1, 2, 3 },{ -3, -2, -3 },{ 3, 0, 1 },{ -2, -4, 3 },{ -3, 1, 0 },{ 0, 2, -4 },{ -1, -3, -1 },{ 1, 0, -3 },{ -4, 3, -3 },{ 2, 1, 0 },{ -1, -4, -2 },{ 0, 2, 1 },{ 2, 1, -1 },{ 2, -1, -3 },{ -3, -4, -1 },{ -1, -1, -3 },{ -3, 0, 1 },{ -2, -3, 3 },{ -4, -4, 2 },{ 0, 1, -4 },{ 3, -1, -2 },{ -2, 2, -3 },{ -3, 0, -4 },{ 1, -4, 1 },{ -1, -2, -2 },{ 3, 0, -4 },{ 0, -4, -1 },{ -2, -2, -1 },{ -3, 2, 2 },{ 0, -3, -3 },{ -4, -3, 0 },{ -1, -1, 1 },{ -2, 2, -2 },{ 0, -4, 0 },{ 1, 1, -1 },{ 3, 0, 3 },{ -3, -4, -3 },{ 0, 1, 0 },{ 2, 0, 3 },{ -1, -3, -4 },{ 1, 0, 1 },{ 3, 0, -1 },{ -1, -4, 3 },{ 0, -1, 1 },{ 3, -3, -2 },{ -4, 2, -1 },{ 0, 2, -4 },{ -1, -2, 3 },{ -4, -1, -2 },{ 3, 1, 1 },{ 2, 2, 2 },{ -4, 0, -1 } }, - { { 1, 1, -4 },{ 3, 2, 2 },{ 1, 3, -3 },{ 3, 1, -3 },{ 1, 2, -1 },{ -4, 0, 2 },{ 1, -2, -4 },{ -2, 2, 1 },{ -3, 0, 1 },{ 2, 3, 0 },{ 2, -1, -1 },{ -3, -4, -4 },{ 3, 1, 0 },{ 0, -2, -2 },{ -2, 0, 2 },{ 1, 3, -1 },{ -1, -2, -2 },{ 1, -4, -4 },{ 3, 1, 0 },{ -3, -1, 1 },{ -1, 2, 3 },{ 0, -2, 3 },{ -4, -1, 2 },{ -2, 0, -4 },{ -1, -3, 3 },{ 0, 3, 1 },{ -4, -3, -4 },{ 1, 3, 2 },{ 3, -3, -3 },{ 1, -2, 0 },{ -3, 2, -1 },{ -4, 0, -2 },{ 2, -3, 0 },{ -1, 1, 2 },{ -4, -4, 0 },{ 3, 3, -1 },{ -3, -1, 2 },{ -4, 2, -3 },{ 2, 3, 0 },{ -1, -4, 2 },{ 3, 1, -2 },{ 2, -1, -4 },{ -1, 3, -1 },{ 1, -4, 0 },{ 3, -2, 2 },{ 3, -3, -4 },{ -1, 2, 1 },{ -3, -2, -2 },{ 2, -4, -4 },{ -4, 2, 0 },{ -2, -2, 2 },{ 3, 2, -1 },{ -3, -4, -2 },{ -2, -2, -4 },{ -4, 2, 0 },{ 1, 1, -3 },{ -3, 0, 3 },{ -2, 3, 2 },{ 2, 1, 1 },{ 3, -4, -2 },{ -2, 3, 0 },{ 0, -3, -1 },{ 0, -1, -3 },{ 2, -4, -2 } }, - { { -3, 0, -1 },{ 0, -3, -2 },{ -4, -4, -1 },{ -2, 0, 3 },{ -1, -3, 1 },{ -3, -1, -3 },{ 3, 3, -2 },{ -2, -3, -1 },{ -1, -4, -3 },{ 3, 1, 3 },{ 0, -2, -3 },{ -1, 3, 2 },{ 2, -4, 1 },{ 1, -1, -2 },{ -4, 3, -4 },{ 2, 1, -3 },{ 2, -3, 2 },{ -4, 0, 3 },{ -3, 3, -2 },{ -2, -2, 1 },{ 2, 1, -4 },{ 3, -3, -3 },{ 1, 3, -1 },{ -2, -3, -2 },{ 3, 2, 0 },{ -3, 0, -2 },{ 0, 1, 2 },{ -2, -1, 0 },{ 2, 1, -2 },{ -1, -2, 3 },{ 0, 2, -3 },{ 3, -4, 1 },{ 1, -2, 2 },{ -2, 3, 3 },{ -3, -2, -3 },{ 1, 0, 1 },{ 0, -3, 2 },{ -2, -1, -2 },{ 1, -3, 3 },{ -3, 0, -3 },{ 1, 0, 1 },{ -4, -2, 1 },{ 0, 3, 3 },{ -3, 1, -2 },{ -3, 0, -3 },{ -4, 0, 2 },{ 0, 3, -1 },{ -1, -1, 0 },{ 1, -1, 3 },{ 0, 1, 1 },{ 1, -3, -3 },{ -4, 3, 0 },{ 2, 1, 2 },{ -1, -1, 2 },{ 1, 3, -1 },{ -1, -3, -4 },{ 2, -2, 0 },{ 0, -3, -4 },{ -1, -2, 0 },{ -3, 0, -3 },{ -2, 3, -4 },{ 1, 0, 3 },{ -3, -4, 1 },{ -1, 3, 1 } }, - { { -2, -1, 2 },{ 2, 1, -4 },{ 0, -2, 2 },{ -2, 3, 0 },{ 2, 2, -4 },{ 2, -4, 0 },{ 0, 1, 3 },{ 0, -1, 2 },{ -4, 2, -2 },{ 1, -3, -4 },{ -4, -1, 2 },{ -3, 0, -2 },{ -4, 2, -1 },{ -2, 1, 3 },{ -1, -4, 2 },{ -3, -1, 1 },{ -1, 2, 0 },{ 0, -3, -1 },{ 2, 3, -2 },{ -1, -4, 2 },{ -3, -4, 0 },{ 1, 0, -1 },{ -3, 0, 0 },{ -4, -4, 2 },{ 2, -2, 1 },{ 2, -1, -3 },{ -2, -2, 3 },{ 1, -4, -2 },{ -4, 2, 1 },{ -3, -1, -4 },{ -1, 3, 2 },{ 1, 1, -3 },{ -3, 0, -4 },{ 0, -1, -1 },{ 3, 1, -2 },{ 0, 2, -4 },{ -1, -2, 3 },{ 2, 3, -4 },{ 3, 1, 1 },{ -4, -1, -3 },{ -1, 2, -1 },{ 3, -4, 3 },{ -2, 1, -4 },{ 2, -3, -3 },{ 0, 2, -1 },{ -2, -2, 3 },{ 2, -3, -3 },{ -2, 2, 2 },{ -4, -3, -4 },{ 3, 3, -2 },{ -1, 0, -1 },{ 0, -4, 3 },{ -3, -2, -3 },{ 2, -1, -1 },{ 3, 1, 3 },{ -3, -4, -2 },{ 0, 2, 2 },{ -4, 0, -1 },{ 3, -4, 1 },{ 1, 2, 3 },{ 2, -3, 2 },{ -4, -1, -2 },{ 3, 1, -4 },{ -1, -2, 3 } }, - { { 0, 3, -3 },{ -4, -3, 0 },{ 1, -1, 3 },{ 3, 0, -2 },{ -3, -2, -1 },{ -1, -3, -3 },{ -4, 0, 1 },{ 2, -2, -4 },{ -1, 3, 0 },{ -2, 1, 0 },{ 3, -3, 1 },{ 1, 0, -3 },{ 0, -3, -4 },{ 3, -2, 0 },{ 0, -1, -1 },{ 3, -3, -4 },{ -3, 2, -3 },{ -2, -2, 3 },{ 3, 0, -4 },{ 1, -1, -3 },{ -4, 2, 3 },{ -1, -2, -2 },{ 0, 2, 2 },{ 3, 1, -4 },{ 1, 3, 0 },{ -1, 1, -3 },{ -4, -4, -1 },{ 3, 3, -4 },{ 0, 0, 0 },{ 3, -4, -1 },{ 2, -3, 0 },{ -4, -1, 1 },{ -2, -4, -1 },{ 2, 3, 0 },{ -1, -3, 2 },{ -3, -4, -3 },{ -4, 0, 0 },{ -2, -2, 0 },{ -3, -4, -1 },{ 0, -2, -4 },{ 0, 3, 2 },{ -2, -3, -2 },{ 1, 0, 0 },{ -4, -1, 1 },{ 2, -4, 1 },{ 0, 3, 0 },{ 3, 1, -2 },{ -4, 0, -1 },{ 2, -4, 1 },{ -3, -2, -2 },{ -2, 2, -4 },{ 3, -1, 1 },{ -3, 0, -2 },{ 0, -3, 1 },{ -2, 2, -3 },{ -4, 0, 1 },{ -1, -1, -2 },{ 3, 1, -3 },{ -2, 2, 1 },{ -4, -2, -3 },{ -1, 1, -1 },{ 0, -2, 0 },{ 1, 2, 0 },{ 3, -4, -1 } }, - { { -1, -2, -1 },{ -3, 2, -4 },{ 3, 2, 1 },{ -4, -4, 0 },{ 0, -1, 3 },{ 1, 2, 2 },{ -2, 3, -1 },{ 3, -4, -1 },{ -3, 0, -2 },{ 1, -4, 3 },{ 0, 3, 3 },{ -1, 2, -1 },{ -2, -4, 2 },{ 2, 3, 1 },{ -4, 1, -2 },{ 1, 3, 0 },{ 2, -1, -1 },{ 1, -4, 2 },{ -4, 1, -3 },{ 0, 0, 1 },{ 2, 3, 1 },{ 3, -2, -4 },{ -4, -1, -3 },{ 0, -4, 3 },{ -3, -3, -1 },{ -3, 2, 2 },{ -1, -2, 1 },{ 1, 2, 2 },{ -2, -2, 3 },{ -2, 0, -3 },{ 1, 1, -2 },{ -1, 2, 3 },{ 3, -2, -2 },{ -4, 2, 1 },{ 1, 0, 3 },{ 2, -4, 1 },{ 3, 1, -1 },{ 0, 3, -2 },{ 1, 2, 3 },{ 2, -4, 1 },{ 2, -1, 0 },{ -3, 0, -2 },{ 3, 2, -3 },{ -1, 2, 2 },{ 1, -2, -1 },{ -2, -1, -4 },{ -3, -4, 2 },{ 1, 0, -4 },{ 0, 2, 3 },{ 1, -3, 0 },{ -2, -2, 3 },{ -1, 1, 2 },{ 1, 3, -4 },{ -4, 2, 0 },{ 1, -2, 2 },{ 2, -3, -4 },{ 2, -4, -1 },{ -3, -2, 3 },{ 0, 3, 2 },{ 2, -1, -4 },{ -1, -4, 2 },{ -2, 3, -3 },{ -4, 0, -3 },{ -3, 1, 2 } }, - { { 2, -3, -2 },{ -1, 0, 3 },{ 1, -3, -3 },{ -2, 1, -1 },{ -4, 3, -4 },{ 2, 1, -3 },{ -1, -2, 1 },{ -3, 1, 2 },{ 2, -2, -3 },{ -4, -1, -4 },{ 3, -2, 1 },{ -3, 1, -3 },{ -4, -1, -2 },{ 1, -2, -3 },{ -2, 0, 3 },{ -2, -3, 1 },{ -4, 0, 3 },{ 0, 3, -2 },{ -2, 2, 0 },{ -3, -3, -1 },{ -2, -3, 3 },{ 2, 2, 0 },{ -2, 1, 1 },{ 1, 0, -1 },{ 2, -1, -3 },{ -2, 3, 3 },{ 3, 0, -2 },{ 2, -3, -4 },{ -3, -1, -1 },{ -4, 3, -3 },{ 0, -4, 2 },{ 0, 0, -4 },{ -3, -3, -1 },{ -1, 1, -3 },{ -3, -1, -4 },{ 0, 3, -2 },{ -4, -1, -3 },{ -1, -2, 3 },{ -3, 1, 2 },{ -2, 2, -3 },{ -4, -1, -4 },{ 0, -3, 3 },{ -1, -2, 2 },{ -4, -4, -4 },{ 3, 1, -2 },{ -2, 2, -2 },{ -1, -3, 0 },{ 3, 3, -3 },{ -1, -1, 2 },{ 0, 1, -1 },{ -4, 3, -1 },{ 3, -4, -3 },{ 2, 0, 0 },{ -1, -4, -2 },{ 3, 3, 3 },{ -2, 1, 2 },{ 1, 3, 0 },{ -3, 0, -4 },{ 1, -3, -2 },{ -3, -1, 0 },{ 3, 1, -2 },{ 1, -4, 1 },{ -2, -3, 3 },{ 2, 0, 1 } }, - { { -4, -1, -4 },{ -2, -4, 1 },{ 0, 3, -2 },{ 2, -2, 2 },{ -2, -4, 1 },{ 0, -1, -2 },{ 3, -3, -4 },{ 0, -4, 3 },{ 1, 2, 0 },{ -1, -1, -2 },{ -2, 2, -1 },{ 2, -3, -4 },{ -3, 2, 3 },{ -1, -3, 0 },{ 3, 1, -4 },{ 2, -4, -3 },{ -1, -2, 1 },{ 0, -1, -4 },{ 3, -4, 1 },{ 2, -2, -2 },{ -1, 1, -1 },{ 0, -4, -3 },{ -3, -2, -2 },{ -1, 2, 1 },{ 2, -3, -4 },{ 0, -4, 0 },{ -4, -1, -2 },{ -1, 2, 1 },{ 2, 1, 3 },{ 3, -2, 1 },{ -2, 2, -1 },{ 2, -1, 2 },{ 3, -2, 1 },{ 1, -4, 0 },{ -2, 0, 3 },{ 3, 2, 2 },{ -2, -3, 1 },{ 1, -2, -4 },{ 3, 0, -2 },{ -2, -3, 0 },{ -1, 1, -1 },{ 2, 3, 1 },{ -2, -4, 0 },{ 1, 3, -1 },{ -3, 0, 3 },{ -4, -3, 3 },{ 2, 0, 1 },{ -1, -2, -1 },{ -3, -4, 1 },{ -4, 0, -3 },{ 2, -3, -2 },{ 0, -2, 1 },{ -3, 1, 3 },{ -3, -1, -3 },{ -1, -3, -4 },{ -4, -1, -1 },{ 0, -2, -3 },{ -2, 2, 1 },{ -1, -3, 2 },{ -4, 2, 0 },{ 3, 0, 3 },{ -3, 3, -2 },{ 0, -2, -4 },{ 1, 3, -1 } }, - { { -4, 1, 2 },{ 3, -1, 0 },{ -3, 0, -3 },{ 1, 0, 3 },{ 3, -3, 0 },{ -3, 3, 2 },{ -1, 1, 1 },{ -4, 0, -1 },{ -2, 3, 0 },{ -3, 0, 2 },{ 0, -3, 1 },{ 2, 3, 2 },{ 0, 0, 0 },{ 1, -4, -1 },{ -1, 2, -2 },{ -3, 2, 2 },{ 1, 3, -3 },{ -3, 0, 0 },{ -2, 1, 3 },{ 1, 2, -4 },{ -4, -1, 2 },{ 3, 3, 2 },{ -4, -3, 0 },{ -1, 3, 3 },{ -4, 0, 0 },{ 0, 1, 2 },{ -3, 3, -2 },{ 1, -4, -4 },{ -1, -3, -1 },{ -1, 1, 0 },{ -4, -4, -4 },{ -3, 3, 3 },{ -2, 1, -1 },{ 1, 3, -2 },{ -4, -2, -4 },{ 2, -3, -2 },{ -3, 3, 0 },{ -1, -4, 0 },{ 0, 3, -1 },{ 3, -4, 2 },{ -3, 0, -3 },{ 1, 2, 2 },{ -4, -2, -2 },{ 3, -1, -4 },{ 0, 2, 1 },{ 1, -1, -3 },{ 3, 1, 0 },{ -4, 3, -2 },{ 1, 1, -4 },{ 3, 2, 0 },{ -1, -1, 3 },{ -2, -2, -4 },{ 1, 2, 1 },{ 0, 2, -1 },{ 2, 0, 2 },{ 3, 1, 0 },{ -1, -4, -2 },{ 3, 0, 3 },{ 2, -2, -1 },{ -1, 1, -3 },{ 2, -3, -4 },{ -4, -1, 1 },{ -1, 2, 0 },{ 3, -4, 3 } }, - { { 0, -2, -3 },{ 1, 3, -1 },{ -1, 1, -2 },{ -2, 2, -1 },{ -4, -2, -4 },{ 2, 0, -3 },{ 1, -2, -1 },{ -2, 2, -3 },{ 3, -3, -4 },{ 1, -2, 3 },{ 3, -4, -3 },{ -4, 1, -3 },{ -2, -1, -2 },{ 3, 1, 2 },{ -4, -1, 1 },{ 0, -1, -1 },{ 2, -2, -1 },{ 1, -4, 0 },{ -4, -3, 3 },{ 2, 3, -2 },{ -3, -1, -3 },{ 0, 0, -1 },{ 1, 1, -4 },{ 3, -1, -1 },{ 1, -3, -3 },{ 3, -2, 1 },{ -2, -2, -1 },{ 1, 0, 3 },{ 0, -1, -3 },{ -3, 0, 2 },{ 1, -2, -2 },{ 2, -3, -3 },{ -1, -1, -3 },{ -4, 0, 0 },{ -1, -4, 2 },{ 2, -1, -1 },{ 0, 1, 2 },{ 2, 0, -3 },{ -4, 2, 3 },{ 1, -1, -1 },{ -2, -2, -2 },{ 2, -3, 3 },{ 0, 1, -3 },{ -2, 0, -1 },{ -1, -4, 2 },{ 0, 1, -1 },{ -2, -4, -4 },{ -2, -3, 3 },{ 0, -1, 2 },{ -3, -4, 2 },{ 2, 1, -1 },{ 1, 3, -2 },{ -4, -4, 1 },{ 2, -3, -3 },{ -2, 3, 3 },{ -3, -4, 0 },{ -3, -1, -2 },{ -4, 3, 3 },{ 1, -1, -4 },{ 0, -4, -1 },{ -2, 1, 2 },{ 0, -3, 3 },{ 2, 0, -2 },{ -1, 2, 0 } }, - { { -2, 0, 2 },{ -3, -4, 3 },{ 2, -3, 1 },{ 0, -4, 1 },{ -1, 3, 2 },{ 3, 2, 3 },{ 0, -4, 0 },{ -4, -1, -2 },{ 2, 1, 2 },{ -3, 3, 1 },{ -1, 0, -1 },{ -1, -2, -1 },{ -3, 3, 3 },{ 2, -2, -4 },{ -3, -3, -2 },{ -1, -3, 3 },{ -4, 0, -3 },{ 3, 1, 2 },{ -2, 2, -4 },{ 0, -3, 0 },{ -1, -2, 1 },{ 2, -4, 3 },{ -2, -2, -2 },{ -1, 2, 2 },{ -3, -4, -4 },{ -2, 0, 0 },{ 2, 2, -3 },{ -4, 3, 2 },{ 3, -3, 0 },{ -2, 2, 0 },{ 2, 3, 3 },{ 3, 1, 1 },{ 0, -3, 1 },{ 1, 2, -2 },{ 3, 3, 3 },{ -3, 1, 0 },{ -2, -1, -3 },{ -4, -2, 1 },{ 1, -3, -4 },{ -1, 1, 1 },{ -3, -1, -4 },{ 3, 3, 1 },{ -1, 2, 0 },{ -3, -3, 2 },{ 2, -2, 1 },{ -4, 3, -2 },{ -3, 0, -3 },{ 3, 2, -1 },{ 2, -2, 0 },{ -1, 2, -3 },{ -2, -3, -4 },{ -3, 0, 3 },{ 3, 0, 0 },{ -4, -2, -2 },{ 1, 1, -4 },{ 0, -2, 1 },{ 2, 2, -4 },{ 1, 1, 2 },{ -3, -3, 1 },{ 3, 3, -3 },{ -3, 2, 1 },{ -4, -2, -1 },{ 3, -4, -3 },{ -3, 3, -4 } }, - { { 0, -2, -2 },{ -1, -1, -4 },{ 3, -1, -3 },{ -4, 1, -1 },{ -3, -2, -4 },{ -3, -1, -2 },{ -2, 1, 1 },{ 1, -4, -1 },{ 0, -2, 2 },{ -3, 1, -4 },{ 0, -1, -2 },{ 2, 2, 1 },{ -4, -4, 2 },{ 1, 1, -4 },{ 3, 3, 0 },{ -2, 1, 2 },{ -1, 3, -4 },{ 1, -4, 1 },{ -2, -1, -2 },{ 3, 0, -1 },{ -3, 3, 2 },{ 1, 2, -3 },{ -4, -3, 1 },{ 2, 3, -2 },{ 0, 1, 3 },{ -4, 3, 1 },{ 1, -4, -2 },{ -1, -1, 2 },{ -3, 0, -4 },{ 0, -4, -2 },{ -4, -1, -4 },{ -2, -2, -1 },{ -3, 1, 3 },{ -3, -2, -4 },{ -1, -2, 1 },{ 3, -3, -4 },{ 0, -4, -2 },{ -2, 2, 2 },{ 3, 3, -1 },{ 2, -4, -2 },{ -4, 2, 2 },{ 0, -4, 0 },{ -4, -1, -3 },{ 3, 0, -2 },{ 1, 3, -4 },{ 0, -2, 3 },{ 2, -3, 2 },{ -1, -1, 0 },{ -4, 0, 1 },{ 0, 3, -3 },{ -4, -1, 1 },{ 0, -3, 2 },{ -1, 2, -3 },{ -1, -4, 2 },{ -2, 3, -1 },{ 3, -3, -1 },{ -2, 0, 1 },{ -1, -4, -3 },{ -4, -2, -2 },{ -2, 0, 0 },{ 1, -1, 3 },{ -1, 1, -2 },{ -2, 1, 2 },{ 2, -3, 1 } }, - { { 1, 2, 0 },{ 3, 1, 0 },{ 0, 3, 3 },{ -1, 2, -2 },{ 2, -3, 2 },{ 3, 0, 0 },{ 1, 3, -4 },{ -1, 2, 3 },{ 2, -3, -3 },{ -4, 2, 3 },{ 1, -4, 0 },{ 3, -3, -3 },{ 0, 0, 0 },{ -2, -1, -1 },{ 0, 2, 1 },{ 1, -4, -2 },{ -3, 0, -1 },{ 2, 2, 3 },{ -4, -2, -3 },{ 0, -1, -1 },{ 2, -4, 3 },{ -2, 1, -4 },{ 3, 0, 0 },{ -3, -2, -1 },{ -1, -1, 1 },{ 2, 1, -4 },{ 3, -3, -3 },{ -3, 2, 3 },{ 1, -2, -1 },{ 3, 1, -3 },{ -1, 2, 1 },{ 0, -4, 2 },{ 1, 3, -3 },{ 3, 0, 0 },{ -4, 2, -3 },{ 0, -1, -1 },{ 2, 2, 3 },{ -1, 0, 0 },{ 1, -2, 1 },{ -2, 0, -3 },{ 0, 0, 3 },{ 1, -3, -1 },{ 2, 1, -4 },{ -1, -4, 3 },{ -2, 1, 1 },{ -3, -1, -1 },{ 1, 1, 0 },{ 1, 3, -4 },{ -2, -4, 3 },{ 3, -2, -1 },{ 1, 1, -2 },{ 3, 3, -1 },{ -3, -1, 0 },{ 2, 1, -4 },{ 2, -1, 3 },{ -4, 0, 2 },{ 0, -3, -3 },{ 3, 2, 0 },{ 2, -1, 3 },{ 0, 2, -2 },{ 3, -4, -4 },{ 2, -2, 0 },{ 1, 3, -1 },{ -4, -1, 2 } }, - { { -3, 1, -2 },{ -2, -3, 1 },{ -4, -4, -4 },{ 1, 0, -1 },{ -2, -4, -3 },{ 0, 2, 3 },{ -4, -3, -3 },{ -1, 0, -1 },{ -3, -1, -1 },{ 0, 0, -4 },{ -2, 1, 2 },{ -2, 3, -2 },{ 2, 0, 1 },{ -3, -3, -3 },{ 3, -2, 3 },{ -4, -2, -3 },{ 3, -1, 0 },{ 0, -3, 2 },{ -1, 1, 1 },{ -3, 0, -4 },{ 1, 3, 0 },{ -4, -2, 2 },{ 0, -3, -3 },{ -2, 0, 2 },{ 1, -4, -1 },{ -1, -1, 3 },{ -2, -2, -1 },{ 0, 0, 0 },{ -1, 3, 2 },{ -3, -2, 0 },{ 2, -3, 3 },{ -4, -1, -2 },{ -1, 0, 0 },{ 0, -4, 2 },{ -2, -3, -1 },{ 1, 3, 1 },{ -4, 0, 3 },{ -3, -4, -4 },{ 2, -3, -3 },{ -4, 1, 2 },{ -2, -2, -2 },{ 2, 3, 0 },{ -3, -1, 2 },{ 0, 2, 0 },{ -4, 0, -3 },{ 3, -4, -3 },{ -4, 2, 2 },{ -1, -2, -2 },{ -3, 1, -4 },{ 2, -3, -2 },{ -2, -4, 2 },{ 2, -1, -4 },{ -2, -2, 2 },{ 0, 3, -2 },{ -4, -4, 1 },{ -1, 2, -2 },{ -3, 0, -1 },{ 0, 3, -4 },{ -4, -4, 3 },{ -2, 0, 1 },{ -3, -3, -1 },{ -4, 2, -4 },{ -1, 0, 3 },{ 3, -4, -3 } }, - { { 2, 2, -1 },{ -2, -2, 2 },{ -3, -1, 3 },{ 3, 0, 0 },{ 0, 1, 1 },{ 2, -2, 0 },{ -3, -1, 2 },{ 3, -4, 1 },{ 2, 3, 1 },{ 3, -2, 0 },{ -1, -2, -3 },{ -4, 3, 3 },{ -1, -1, -4 },{ 1, -4, 0 },{ -3, 1, -2 },{ 0, 2, 2 },{ -2, 1, -4 },{ -1, 3, -1 },{ -3, -3, -2 },{ 3, -4, 0 },{ -1, 1, 3 },{ 1, -1, -2 },{ -1, 2, 1 },{ 3, 2, -4 },{ 1, 3, -3 },{ -4, 1, 0 },{ -4, 2, -4 },{ 2, -4, 1 },{ 2, 0, -3 },{ -4, 1, -1 },{ 1, 3, -4 },{ -2, 0, -1 },{ 3, 3, -4 },{ 2, -2, -3 },{ -3, 1, 2 },{ 2, -2, -2 },{ -1, -2, -2 },{ 3, 3, 0 },{ 0, 1, -1 },{ -3, -1, 3 },{ 3, 3, -4 },{ -1, -4, -3 },{ -2, -3, -1 },{ 3, 1, 3 },{ 1, -2, -2 },{ -1, -3, 1 },{ 2, 3, -1 },{ 0, -4, 3 },{ -1, 0, 1 },{ 0, 2, 2 },{ -4, 2, 3 },{ -3, 0, -3 },{ -3, -3, -1 },{ 1, 0, 3 },{ 3, -3, -4 },{ -2, 1, 0 },{ 1, -2, 2 },{ -1, -1, 1 },{ 2, 3, -1 },{ 1, 1, -3 },{ -1, 1, 1 },{ 0, -2, 2 },{ -3, -3, -2 },{ 0, 0, -3 } } - }, - { - { { 3, -2, -2 },{ -3, -1, 1 },{ 0, -3, -1 },{ 1, 1, 3 },{ 3, 0, -3 },{ 1, -1, 0 },{ -2, -4, 3 },{ 1, 0, -3 },{ 0, -4, -2 },{ -1, 0, 0 },{ -4, -3, -3 },{ -3, -4, 2 },{ 2, 2, 3 },{ -2, 0, -2 },{ -2, -4, 2 },{ 0, -2, -2 },{ 3, -1, -1 },{ -4, 2, 0 },{ 2, -4, -4 },{ -1, 2, -3 },{ -2, -3, 2 },{ -4, 3, 3 },{ 3, -1, -2 },{ -1, -2, 3 },{ 3, 3, -2 },{ 0, 0, -1 },{ -3, -3, -2 },{ -1, 2, -4 },{ 0, -4, 2 },{ -3, 0, -1 },{ -2, 2, -3 },{ -1, -3, -2 },{ 2, -1, 0 },{ -2, 2, 3 },{ -3, -4, 2 },{ -3, -2, -1 },{ -2, -2, -2 },{ -4, 1, -3 },{ -2, -3, 2 },{ -3, -1, -1 },{ -4, -2, -4 },{ -1, 3, 3 },{ 1, -3, -2 },{ -3, 1, 2 },{ 1, -1, -2 },{ -2, 3, -4 },{ 2, -4, 1 },{ -3, -2, -1 },{ 3, 2, -3 },{ -2, -3, 2 },{ -4, 2, 0 },{ -1, -2, 1 },{ 1, -3, -4 },{ -3, 1, 2 },{ 1, -4, -3 },{ 3, 2, 0 },{ -2, -1, 2 },{ 3, 1, 2 },{ 0, 3, 3 },{ -3, 0, -4 },{ -1, -4, 1 },{ 0, 3, 2 },{ -3, -3, -3 },{ 2, -4, -4 } }, - { { -2, 1, 0 },{ 1, -3, -2 },{ -1, 3, 2 },{ -4, -4, 2 },{ -3, -3, -2 },{ 0, 2, -1 },{ 3, 2, -4 },{ -4, -1, 1 },{ 3, 1, -2 },{ -1, -2, 1 },{ 1, 3, -4 },{ 3, -1, -2 },{ 0, -2, -1 },{ -3, 3, 0 },{ 3, -3, 3 },{ 1, 2, -3 },{ -1, -3, -4 },{ 1, 0, 1 },{ -3, 1, 3 },{ 0, -1, -2 },{ 2, -2, 1 },{ 0, 2, 0 },{ -2, -4, -4 },{ -4, 0, 1 },{ -1, -1, -4 },{ 2, -3, 0 },{ -2, -1, 2 },{ 2, 3, 0 },{ -4, 0, -1 },{ 2, -2, 1 },{ 1, 1, 3 },{ 0, -3, -1 },{ 3, -2, 0 },{ 1, 3, -3 },{ 1, 1, -4 },{ -1, -3, -1 },{ 3, 3, 3 },{ -1, -3, 1 },{ 3, 0, -3 },{ 2, 3, 3 },{ 0, -3, 0 },{ 3, 1, -2 },{ -2, -1, -1 },{ -1, 2, 1 },{ 3, 1, -1 },{ -4, -3, 3 },{ -2, 0, -2 },{ 0, -2, 2 },{ 1, -1, 0 },{ 1, 1, 3 },{ -1, -1, -4 },{ -4, 1, -1 },{ 0, 0, -3 },{ -2, 2, 0 },{ -4, -2, 3 },{ 0, 0, 1 },{ -4, 1, -4 },{ 2, -3, -1 },{ -4, -2, -2 },{ 3, 1, 0 },{ -4, 2, -3 },{ 1, -1, -2 },{ -4, -2, 0 },{ 0, 0, -1 } }, - { { -4, -4, 2 },{ 0, 0, -3 },{ 3, 2, -4 },{ -2, 1, 0 },{ 2, -1, -3 },{ -4, 3, 1 },{ -1, -2, 2 },{ -2, -3, 3 },{ 2, -3, -1 },{ -4, 1, 2 },{ 1, 0, 3 },{ -2, 1, -1 },{ -3, -3, -4 },{ -1, 1, 1 },{ 2, -1, 1 },{ -4, 3, -1 },{ -1, 0, 1 },{ -3, -2, 2 },{ 3, 3, -3 },{ -2, -4, -1 },{ 1, 1, -4 },{ -3, 0, 1 },{ 2, 3, -2 },{ 1, -4, 0 },{ 1, 2, -3 },{ -3, 3, 1 },{ -2, 1, 3 },{ 1, -4, -3 },{ -1, -3, -4 },{ 3, -1, 0 },{ -4, 3, -3 },{ -3, 3, 2 },{ -2, -1, -4 },{ -4, 0, 1 },{ 2, -4, 0 },{ -4, 1, 2 },{ 2, -1, 0 },{ 0, 2, -2 },{ -3, -2, -1 },{ 1, 2, -4 },{ -2, -4, 1 },{ -4, 0, 2 },{ 1, -2, 3 },{ 0, -4, -4 },{ -4, -2, 2 },{ 1, -1, 0 },{ 0, 3, -3 },{ 3, 2, -4 },{ -4, 0, -2 },{ -3, -3, 1 },{ 2, 3, 3 },{ 2, -4, -2 },{ 3, -2, 2 },{ 2, -3, -2 },{ -3, -1, -1 },{ 2, -4, -3 },{ -1, 2, -2 },{ 0, -4, 1 },{ 1, 3, -3 },{ -1, -3, 0 },{ -2, -1, 3 },{ 2, -3, -4 },{ -2, 3, 2 },{ 3, 2, 3 } }, - { { 2, -1, -4 },{ -3, 3, 0 },{ 0, -2, 3 },{ -1, -2, 1 },{ 1, -4, -1 },{ 0, 0, -3 },{ 2, -4, 0 },{ 1, 0, -4 },{ -3, 3, -3 },{ 0, 2, 0 },{ 3, -4, -2 },{ -4, -2, 1 },{ 2, 2, 2 },{ 1, -2, -4 },{ -4, 0, -3 },{ -2, -4, 3 },{ 2, 1, -1 },{ -2, -1, 0 },{ 3, -3, -2 },{ -4, 2, 2 },{ -1, -2, 0 },{ 3, -3, 3 },{ -3, -1, -1 },{ 0, 1, 2 },{ -4, -2, 3 },{ 3, -1, -1 },{ 0, -2, -1 },{ -4, 0, -2 },{ -3, 2, 2 },{ 0, 2, 3 },{ -2, -4, -2 },{ 2, 0, -1 },{ 0, 1, 3 },{ -1, -2, -2 },{ -1, -1, 3 },{ -2, 2, -3 },{ 0, 0, -4 },{ 1, -2, 1 },{ -4, -4, 2 },{ -2, -1, -1 },{ -1, 0, 0 },{ 3, 3, -3 },{ -3, -3, -3 },{ 2, 3, -2 },{ 3, 1, -3 },{ -3, 1, 1 },{ 2, -4, 3 },{ -1, -4, 1 },{ -2, -2, -3 },{ 3, 3, -1 },{ -2, -4, 2 },{ -3, 0, -3 },{ -1, 3, 1 },{ 1, 1, 3 },{ -1, 3, 0 },{ 3, -2, -4 },{ -2, 2, 2 },{ -3, -1, 0 },{ 2, 0, 3 },{ -3, 2, 1 },{ 3, 0, -1 },{ 1, 1, 1 },{ -3, -1, -1 },{ -1, 1, -3 } }, - { { 1, -4, -1 },{ -3, 0, 2 },{ -4, 2, -2 },{ 3, -1, -4 },{ -1, 3, 3 },{ -2, 1, 2 },{ -4, 2, -2 },{ 0, 1, 1 },{ -2, -1, -3 },{ 2, -4, 3 },{ -2, -2, 0 },{ -1, -1, -3 },{ 3, 3, -1 },{ 0, -4, 0 },{ 3, 2, -2 },{ 1, -3, 2 },{ -3, -2, -4 },{ 0, 3, -2 },{ 1, 0, -4 },{ 0, -1, 3 },{ -1, 1, -2 },{ -4, -4, -3 },{ 1, 3, -3 },{ -2, -2, -1 },{ 3, -3, -4 },{ -1, 2, -4 },{ 1, -4, 1 },{ 3, 0, -3 },{ 2, -3, 1 },{ -3, -1, -4 },{ 1, -2, 0 },{ -1, -4, 1 },{ 3, -3, 2 },{ -3, 2, -3 },{ 3, -3, -1 },{ 1, -4, -2 },{ -3, -1, -4 },{ -2, 3, 0 },{ 0, 1, 2 },{ 2, 2, -3 },{ 2, 1, 3 },{ 0, -2, 2 },{ -1, 2, 1 },{ 0, -4, 0 },{ -2, -1, -1 },{ -1, 0, -1 },{ -4, -3, -4 },{ 2, 2, 2 },{ -3, 1, -1 },{ 0, 1, 0 },{ 1, -1, -4 },{ 0, -2, -3 },{ -4, 2, -1 },{ -2, -3, -4 },{ -3, -4, 2 },{ 0, 0, 1 },{ -4, -1, 3 },{ 1, 1, -1 },{ 0, -3, -3 },{ -2, -4, -4 },{ 0, 3, -2 },{ 2, -4, 3 },{ -4, -2, -4 },{ -1, -3, 1 } }, - { { 2, 3, -2 },{ 1, -2, -1 },{ 3, -4, 1 },{ 1, -3, -1 },{ -3, 0, -3 },{ -3, -3, 0 },{ 3, -2, -1 },{ 3, -3, 3 },{ -3, 3, -1 },{ 0, 0, -2 },{ -3, 2, -4 },{ -1, 1, 2 },{ -4, -3, 3 },{ -2, 0, -2 },{ -1, -1, 3 },{ 3, 2, -1 },{ -1, -4, 0 },{ 2, 1, 2 },{ -4, -4, 1 },{ -3, 3, 0 },{ 2, -3, 1 },{ -2, 1, -4 },{ 0, -1, 2 },{ 2, 0, 1 },{ -3, 3, -2 },{ -2, 0, 2 },{ -3, 1, 3 },{ -1, 3, 0 },{ 0, -3, 2 },{ 3, 1, -1 },{ -2, 2, -2 },{ -4, 3, -3 },{ 1, 1, -4 },{ -3, 0, 0 },{ 0, 3, 1 },{ -4, 2, 2 },{ 3, -3, 3 },{ -1, 0, -1 },{ 3, -3, -2 },{ -4, -4, -4 },{ -3, -1, -2 },{ 1, -1, -1 },{ -4, 1, -4 },{ -3, -3, 3 },{ 3, 3, 1 },{ 0, -2, 3 },{ -3, 3, 0 },{ 1, -1, 0 },{ -2, -1, -2 },{ 3, -3, 2 },{ -4, -3, 3 },{ 1, 2, 0 },{ -1, 0, 2 },{ 3, -1, -1 },{ 2, 1, -3 },{ 1, 3, -2 },{ -2, -3, -2 },{ 3, 1, -4 },{ -3, -2, -2 },{ -1, 0, 2 },{ -4, -2, 1 },{ 0, 3, 0 },{ 3, 0, -3 },{ -2, 2, 3 } }, - { { -3, 1, -4 },{ -1, -2, 3 },{ -2, 3, -3 },{ -4, 1, 2 },{ 2, 2, 0 },{ 0, -4, 1 },{ 1, -1, -4 },{ -1, 2, -3 },{ -4, -4, 2 },{ 1, -2, 0 },{ 3, -1, 1 },{ 2, 2, -3 },{ 1, -4, 0 },{ -3, 1, -4 },{ 0, -2, 1 },{ -4, 2, -3 },{ -3, -1, -4 },{ 0, 0, 3 },{ -2, -3, -2 },{ 3, -1, -3 },{ 1, 2, 2 },{ 3, 2, 0 },{ -3, -4, -1 },{ -4, 2, 3 },{ 1, -4, 0 },{ 2, -3, 0 },{ 0, 2, -3 },{ -4, -2, -2 },{ -2, -1, -4 },{ -3, 2, 3 },{ 0, -1, 3 },{ -1, -3, 1 },{ 2, -2, 2 },{ -2, -4, -2 },{ 2, 1, -1 },{ -1, -2, -3 },{ 2, -1, 1 },{ 0, 2, -3 },{ 1, 3, 3 },{ -1, -2, 1 },{ -2, -4, 0 },{ 3, 3, 2 },{ 2, -3, 1 },{ -2, -1, -2 },{ 1, 0, -4 },{ -1, 2, -3 },{ 3, -4, -2 },{ 0, -3, -4 },{ 2, 2, 3 },{ -1, 0, 1 },{ -3, -2, -3 },{ 0, 3, -2 },{ 2, -4, 1 },{ -2, 1, -2 },{ -4, -1, 3 },{ 0, -2, 0 },{ -1, -4, 1 },{ 2, 2, 3 },{ -4, 3, 1 },{ 3, 2, 2 },{ -3, -1, -3 },{ 1, 1, -2 },{ -2, -3, 2 },{ 0, 0, 0 } }, - { { 0, -4, 1 },{ 1, 0, -3 },{ -2, -1, 0 },{ -1, 1, 3 },{ 2, -2, -4 },{ -1, 3, -2 },{ -2, 0, 3 },{ 0, 1, 1 },{ 2, 0, -2 },{ -4, -3, -4 },{ -1, 0, 3 },{ 0, -3, -1 },{ 1, -1, -3 },{ -2, 3, 2 },{ 2, 0, 0 },{ 1, -3, 2 },{ 2, 3, -3 },{ -1, -2, 0 },{ -3, 2, -1 },{ 0, -1, -4 },{ -2, -4, 3 },{ -1, -2, -2 },{ 0, 0, -2 },{ 3, 1, -4 },{ -1, -2, -3 },{ -2, -1, -1 },{ 0, 0, 2 },{ 2, -4, -1 },{ 3, -2, -3 },{ 1, -4, 0 },{ 3, 0, 0 },{ -4, -1, -3 },{ 1, 2, -1 },{ -2, -1, 3 },{ 0, 3, -4 },{ -4, 0, 3 },{ -2, -4, -2 },{ -3, -2, -1 },{ 2, 1, 1 },{ -4, -1, -1 },{ 1, 2, -4 },{ 0, 2, -3 },{ -1, 0, -1 },{ -2, 1, 2 },{ 1, -4, -1 },{ -4, -2, 2 },{ -3, 0, -2 },{ -2, 1, 2 },{ -4, 3, -3 },{ -1, -4, -1 },{ 3, 2, -1 },{ -3, 1, -4 },{ -1, -2, 0 },{ 1, -3, 2 },{ -3, 3, -4 },{ -2, 0, 0 },{ -3, -3, -1 },{ 1, 0, -4 },{ 0, -3, -1 },{ 2, -1, 0 },{ -1, -4, -4 },{ 2, 2, 3 },{ 3, -3, -1 },{ -4, -1, -2 } }, - { { 2, 2, 0 },{ 3, 3, 2 },{ -3, -3, -2 },{ 3, -1, 1 },{ -4, -4, -1 },{ 1, -2, -2 },{ -3, -1, 2 },{ 2, -4, -1 },{ -2, 1, 2 },{ 3, 3, -3 },{ -2, 3, -1 },{ -3, 1, 2 },{ -4, -2, 1 },{ 3, 2, -2 },{ -1, -4, -2 },{ 0, 3, -1 },{ -4, -2, 3 },{ 3, -4, 1 },{ 2, 1, 2 },{ 1, 0, -1 },{ -4, 3, 0 },{ -3, -3, -3 },{ 1, -1, 3 },{ -1, -3, 1 },{ -4, 3, 2 },{ 3, 1, -4 },{ -3, 2, 3 },{ 1, 0, 1 },{ -4, 3, 2 },{ -2, 1, -2 },{ 0, 3, -4 },{ -1, -4, -1 },{ -3, 1, 1 },{ 3, -2, -3 },{ 0, -4, 0 },{ 1, 3, 2 },{ 3, 1, -3 },{ -3, -3, 2 },{ 2, -4, -4 },{ -2, 0, 2 },{ 0, 0, 3 },{ -3, -3, -3 },{ 2, -2, 0 },{ -4, 1, -4 },{ 3, 3, 1 },{ 0, -2, 0 },{ 3, 2, 3 },{ 2, -1, -1 },{ 0, -2, 1 },{ 1, -3, -4 },{ 2, 0, 2 },{ -2, -1, 3 },{ -4, -4, -1 },{ 2, 2, 1 },{ 3, -2, -4 },{ 1, 2, 2 },{ 3, 1, -3 },{ -4, -1, 1 },{ -2, 0, -2 },{ -1, -4, -3 },{ 0, 1, -1 },{ -3, 1, 1 },{ -2, 3, -4 },{ 1, -2, 2 } }, - { { -4, 1, -4 },{ -1, 0, 3 },{ 1, -4, -1 },{ 0, 2, -4 },{ -2, 0, 2 },{ 3, 1, -3 },{ -3, 3, 0 },{ 0, 2, -4 },{ -4, -3, 1 },{ -1, -2, 0 },{ 0, -4, -2 },{ 2, 1, -4 },{ -1, -3, 0 },{ 2, -1, 3 },{ -3, 0, -4 },{ -3, -3, 2 },{ -2, 1, -4 },{ 0, 0, -2 },{ -2, -3, -3 },{ -1, 2, 1 },{ 3, -2, 2 },{ 1, 1, -4 },{ 2, 3, 0 },{ -2, 2, 1 },{ 2, -1, -1 },{ 0, -4, -2 },{ -3, -3, 0 },{ -1, 2, -2 },{ 2, -2, -4 },{ -2, -3, 2 },{ -4, 2, 3 },{ 2, -2, 2 },{ 1, -3, -4 },{ -3, 0, 2 },{ -2, 2, 0 },{ -4, -3, -1 },{ -1, -1, -4 },{ 0, 2, 0 },{ -1, 3, 0 },{ -2, 3, -2 },{ 3, -3, 0 },{ -4, -4, 1 },{ -2, 3, 3 },{ 0, -1, -1 },{ -1, -3, -2 },{ -3, 3, -3 },{ -2, -4, 1 },{ -4, 0, -4 },{ -1, -1, 3 },{ -3, -4, 0 },{ -4, 3, -2 },{ 1, 1, 1 },{ 3, -1, -3 },{ -1, 3, -2 },{ -4, 0, 3 },{ -1, -3, -1 },{ 2, -4, 2 },{ 0, 3, 3 },{ -3, 3, -2 },{ 1, -2, 3 },{ -4, -2, 2 },{ 3, 0, 1 },{ -1, -2, -3 },{ -3, -4, -2 } }, - { { 3, -3, 2 },{ -2, -2, -2 },{ 2, -2, -3 },{ -4, 2, 3 },{ -1, -1, 1 },{ 2, -4, 0 },{ -1, 0, 3 },{ 2, -3, -4 },{ 3, 0, -1 },{ -3, -1, 3 },{ 1, 2, 2 },{ 3, -1, 1 },{ -4, 3, -3 },{ 0, -4, -1 },{ -2, 2, -3 },{ 1, 1, 0 },{ -1, -1, 1 },{ 2, 3, -3 },{ -3, -4, 3 },{ 2, -1, -2 },{ -4, -1, -2 },{ 0, 1, 1 },{ -3, -3, -1 },{ -4, -4, -4 },{ -1, -2, -2 },{ 3, 3, 2 },{ -4, 1, -3 },{ 2, -2, 1 },{ -1, -1, 0 },{ 3, -4, -1 },{ 0, 1, 0 },{ -2, 0, -3 },{ 2, 3, -2 },{ -1, -1, 3 },{ 2, -2, -2 },{ 3, 2, 1 },{ 1, 0, 2 },{ 2, -3, -3 },{ -4, -1, 3 },{ 3, -2, -4 },{ 1, 1, -2 },{ 1, 1, -2 },{ 3, -2, -4 },{ -3, -4, 2 },{ 2, -1, 3 },{ 1, 1, -3 },{ 2, -3, 0 },{ -1, 1, -2 },{ 2, 3, 2 },{ 3, 2, -3 },{ 0, 0, 0 },{ -1, -2, -4 },{ -3, -3, 2 },{ 0, 0, -1 },{ -2, -4, -2 },{ 0, 2, 0 },{ -4, -1, -3 },{ -2, -2, 0 },{ 3, 1, -4 },{ 3, 2, 1 },{ -2, -3, 0 },{ 0, 3, -2 },{ 2, -1, 3 },{ -1, 2, 0 } }, - { { -4, 3, 1 },{ 0, 0, 0 },{ -1, 1, -1 },{ -3, 3, -2 },{ 1, -3, -4 },{ -3, -2, -2 },{ 0, 2, 2 },{ -2, -1, 1 },{ 1, -2, -2 },{ -2, 3, -3 },{ 2, -4, 0 },{ -3, -2, -4 },{ 0, 0, -1 },{ -2, 1, 3 },{ 3, -2, 1 },{ 1, -4, -2 },{ 3, -3, 3 },{ -4, 2, 0 },{ -3, -2, -4 },{ 0, 2, 0 },{ -2, -2, -1 },{ 3, -4, 3 },{ -2, 0, -3 },{ 2, 2, 3 },{ 1, 0, 2 },{ 1, 0, 0 },{ -2, -3, -4 },{ 1, 2, 3 },{ -3, 0, -3 },{ -3, 3, -3 },{ 1, -1, -2 },{ -4, -3, 1 },{ -1, 2, 1 },{ -4, -4, -4 },{ -2, 0, -1 },{ -3, 1, -3 },{ -2, -3, 3 },{ -3, 1, -2 },{ 0, -2, -1 },{ -1, -4, 1 },{ -4, -1, 2 },{ -1, 2, 0 },{ 0, 0, 1 },{ -1, 2, -4 },{ -4, 0, -1 },{ -2, 2, 2 },{ 0, -2, -1 },{ -4, 2, -4 },{ 1, -1, 2 },{ -3, -3, -1 },{ 1, -4, 1 },{ 2, 2, -3 },{ 1, 1, 3 },{ 3, -2, 0 },{ -3, 0, 1 },{ 2, 2, -4 },{ 2, -2, -1 },{ -3, -3, 2 },{ -1, -1, -1 },{ 1, 0, -4 },{ -4, -4, -3 },{ -3, 1, 1 },{ 2, 2, -4 },{ 1, -1, -1 } }, - { { -2, 1, -2 },{ 3, -3, -4 },{ -2, -4, 3 },{ 3, 0, 1 },{ 1, -3, 2 },{ 2, 1, -3 },{ -4, 3, -1 },{ -4, -4, -1 },{ 0, 1, 2 },{ -3, 2, -2 },{ -1, 1, 0 },{ -4, -1, 3 },{ 1, -3, -2 },{ 2, 2, 2 },{ -3, 3, -4 },{ -4, -1, -2 },{ -1, 0, -1 },{ 1, 3, 2 },{ 1, 1, 1 },{ -1, -4, 2 },{ 2, 0, -2 },{ 1, 3, -4 },{ -4, 2, 1 },{ -1, -1, 0 },{ -3, -2, -2 },{ -2, 1, 3 },{ -4, -1, -1 },{ 0, 3, 1 },{ 3, -4, 2 },{ -2, -2, 2 },{ 2, 1, 3 },{ 3, -4, -1 },{ 0, 0, -3 },{ 1, 2, 2 },{ 3, -2, -1 },{ 1, -4, -2 },{ 0, 3, 1 },{ 3, 0, 2 },{ 2, 2, -3 },{ -2, 3, 2 },{ 1, 0, -3 },{ -3, -3, 3 },{ -3, -3, -2 },{ 3, 3, 1 },{ 1, -4, 0 },{ -2, -2, -3 },{ 3, 3, 0 },{ -3, -4, 3 },{ -1, -3, -1 },{ -2, -2, -3 },{ -4, 1, 3 },{ -2, -1, -1 },{ -4, -4, -2 },{ -1, 3, -4 },{ -3, 1, 2 },{ 0, -3, 3 },{ 3, 3, -3 },{ -4, 1, 1 },{ 1, -4, 3 },{ 0, 3, 0 },{ 2, -1, -1 },{ -1, -3, 2 },{ -2, -3, -3 },{ 0, -4, 2 } }, - { { -3, -2, -4 },{ 2, 2, 2 },{ 0, 3, -3 },{ -4, -1, 0 },{ -1, -1, -1 },{ -2, 2, 3 },{ 3, 0, -4 },{ 2, -1, 1 },{ 1, -3, 3 },{ 3, 0, -4 },{ -2, -3, 1 },{ 3, 3, -1 },{ -4, 0, -3 },{ 1, -4, 1 },{ -1, -2, 0 },{ -2, 0, 3 },{ 0, -3, -4 },{ 2, -1, 0 },{ -4, 0, -3 },{ 3, -3, -3 },{ -2, 2, 2 },{ -3, -1, 1 },{ 2, -3, -1 },{ 0, -3, -3 },{ 3, 3, -4 },{ -1, -4, 1 },{ 3, -3, -3 },{ 2, 0, -4 },{ -1, -2, -2 },{ -4, 1, 0 },{ -1, 3, -4 },{ 0, -3, 0 },{ -3, 1, 1 },{ -3, -1, 3 },{ -1, 3, 0 },{ -1, -1, 1 },{ 2, -4, -4 },{ -3, 0, 0 },{ -4, -1, -4 },{ -1, -4, 0 },{ 3, 1, -1 },{ 2, -1, -3 },{ -1, -2, -1 },{ 2, -3, 2 },{ -4, 0, -2 },{ -1, 1, 3 },{ 2, -1, 1 },{ 0, 0, -4 },{ 3, 1, -2 },{ -1, 3, -4 },{ 2, 0, 0 },{ 3, 3, 3 },{ -1, -3, 0 },{ 1, -1, -3 },{ 1, 0, -1 },{ -1, -4, -3 },{ -2, -3, 0 },{ -1, 0, -2 },{ 2, 2, -3 },{ -2, -2, -2 },{ -3, 2, 3 },{ 3, 0, -1 },{ 1, 1, -2 },{ -4, 0, 3 } }, - { { -1, -1, 0 },{ 1, -3, -1 },{ -4, 1, -2 },{ 3, -4, 2 },{ 1, 2, -4 },{ -3, -4, 0 },{ 0, -3, -2 },{ -1, -2, -3 },{ -3, 3, 1 },{ -1, -1, -1 },{ 2, -4, -3 },{ 0, -2, 3 },{ -2, 2, 2 },{ -1, -1, -1 },{ 3, 1, -3 },{ 0, 2, 2 },{ 2, 3, -2 },{ -2, -4, -1 },{ -3, -2, -1 },{ 0, -2, 3 },{ -4, 3, 0 },{ -1, -4, -2 },{ 1, 0, 2 },{ -2, 1, -2 },{ 2, 3, 0 },{ -4, 0, 3 },{ 0, 2, -2 },{ 1, -1, -1 },{ -3, -3, 2 },{ 2, 2, -1 },{ 1, -1, 1 },{ -3, 0, -4 },{ 2, -2, -2 },{ 3, 1, -3 },{ 1, -3, -4 },{ -4, 2, 3 },{ -4, -2, -1 },{ -1, 3, 3 },{ 1, -3, -2 },{ -2, -3, 3 },{ 0, 2, 1 },{ -4, 3, -4 },{ -2, -1, 3 },{ 0, 1, -4 },{ 1, 3, -1 },{ -3, -2, -3 },{ -2, -3, -2 },{ 1, 3, 1 },{ -4, -4, 2 },{ 0, -2, 1 },{ -3, 2, 2 },{ 0, -3, -4 },{ -3, 1, -2 },{ 3, -2, 1 },{ -4, -1, 3 },{ 2, 2, -2 },{ -3, 0, 2 },{ 1, -1, 3 },{ -4, 3, -4 },{ -3, -3, 2 },{ -1, -1, -4 },{ 1, 1, 0 },{ -4, -2, 1 },{ 3, 3, 1 } }, - { { -1, -1, -3 },{ -3, -2, 2 },{ 2, 2, 1 },{ 0, 0, -3 },{ -3, -2, -2 },{ -2, 3, 2 },{ 1, 0, 3 },{ 3, 2, 0 },{ -3, -1, -3 },{ -2, 1, 2 },{ -4, 3, 0 },{ 1, 1, -4 },{ 3, -1, -2 },{ -3, -4, 0 },{ 2, -3, 1 },{ -4, 1, -3 },{ -3, -2, 3 },{ -1, 2, 2 },{ 3, 1, -4 },{ 1, 1, 1 },{ 2, -1, -3 },{ 3, 0, -4 },{ -1, -3, 3 },{ -4, -2, 1 },{ -3, -1, -1 },{ 0, 1, 0 },{ -2, -4, 2 },{ -4, -2, 1 },{ -2, 3, -3 },{ 0, 0, 3 },{ 3, -4, -3 },{ -2, -2, -1 },{ -4, 2, 3 },{ 0, -4, 2 },{ -2, 1, -2 },{ 0, 0, -1 },{ 3, 1, -3 },{ 2, 2, 2 },{ 0, -1, 1 },{ -3, 1, -2 },{ 1, -2, 0 },{ 2, -4, 2 },{ 0, 1, -3 },{ 3, -4, 1 },{ -1, 0, 0 },{ 2, 2, 3 },{ -4, -3, -3 },{ 3, -1, 0 },{ -3, 1, -1 },{ 2, -1, -3 },{ 1, -4, -1 },{ -2, 0, 1 },{ 0, 3, 0 },{ 2, -4, -3 },{ -2, 2, 1 },{ 3, 3, 0 },{ 0, -2, -4 },{ -1, -4, 1 },{ 3, 1, -1 },{ 3, -3, 1 },{ 2, -4, 2 },{ -1, 3, -4 },{ 0, -4, -3 },{ 2, 2, -2 } }, - { { -3, -4, 3 },{ 3, 1, -4 },{ -2, 0, 0 },{ 0, -3, 3 },{ -1, 1, -1 },{ 2, -1, 0 },{ 0, 1, 1 },{ -4, -4, -4 },{ 1, 2, -1 },{ 0, -2, -2 },{ 2, -3, 3 },{ -3, -2, 1 },{ 0, 3, -3 },{ -4, 0, 3 },{ -2, 2, -2 },{ 1, -2, -4 },{ 3, -4, 1 },{ 1, -1, 0 },{ -4, 3, -2 },{ 0, -3, 2 },{ -2, 2, 0 },{ -3, 2, -1 },{ 2, 3, 2 },{ 1, 2, -4 },{ 3, -4, -3 },{ 2, -2, 3 },{ 1, 3, -4 },{ -3, 1, -1 },{ 3, -4, 0 },{ 1, 2, -2 },{ -4, -1, 2 },{ -1, 3, 0 },{ 2, 3, 1 },{ -1, 0, 0 },{ 2, -3, -2 },{ -3, -1, 1 },{ 1, -4, -4 },{ -2, -2, -1 },{ 3, 2, -3 },{ -4, 3, -4 },{ -1, -2, -1 },{ -3, 0, -2 },{ -3, 2, 0 },{ -2, -1, 2 },{ -4, -2, -2 },{ 3, -4, 0 },{ 0, 1, 2 },{ -1, 0, -4 },{ -1, 2, 3 },{ -4, -3, -3 },{ -2, 0, 2 },{ 2, 2, -4 },{ -4, -2, 3 },{ -2, 0, 2 },{ -4, -3, -4 },{ -1, -3, -2 },{ -3, 1, -1 },{ 1, -2, 2 },{ -2, 2, -3 },{ 0, 0, -1 },{ -4, 2, -2 },{ -3, 0, 3 },{ -2, -2, -1 },{ 1, -3, 2 } }, - { { 0, 2, 3 },{ 1, 3, -1 },{ -2, -2, -2 },{ -4, -3, 1 },{ 2, 3, 2 },{ 3, -4, -3 },{ -4, -2, -2 },{ -2, -3, 2 },{ -1, 3, 2 },{ 3, -4, -2 },{ -2, 0, 0 },{ -1, 0, 2 },{ 1, -4, -4 },{ 2, -1, 2 },{ -2, 3, 0 },{ -1, 0, -4 },{ 0, -3, -1 },{ -1, 0, 3 },{ -2, 0, -2 },{ 2, -4, -3 },{ -3, -3, 3 },{ -4, -1, -1 },{ 0, -4, -2 },{ -1, 0, 1 },{ -2, -3, 0 },{ -3, 2, -2 },{ -1, -1, -3 },{ 3, 0, -4 },{ -1, -2, 1 },{ -3, -3, 2 },{ 1, 1, -4 },{ 0, -4, 3 },{ -2, -1, -3 },{ -3, -3, -4 },{ 3, 2, 2 },{ -1, 3, 0 },{ -3, -2, 2 },{ -1, 0, 3 },{ 2, -4, 1 },{ -2, 0, 3 },{ 3, -4, 2 },{ 2, 3, -4 },{ 2, -3, 3 },{ -1, 3, -3 },{ 1, 0, -4 },{ -3, -2, 3 },{ 1, 2, -1 },{ 1, -3, -2 },{ 2, -2, 1 },{ 0, 3, -1 },{ 3, 1, 0 },{ -1, -3, -2 },{ 3, -1, -1 },{ 1, 1, -1 },{ 0, 3, -3 },{ 3, -1, 3 },{ 2, 0, -3 },{ -4, 3, 0 },{ -3, -3, -2 },{ 0, 1, 3 },{ 2, -2, 0 },{ 1, 3, -3 },{ 3, 0, 1 },{ -4, 1, -4 } }, - { { 2, 0, -2 },{ -4, -4, -3 },{ 3, 3, -3 },{ 1, -1, 0 },{ -3, 2, -4 },{ -2, 0, -4 },{ 1, 2, 0 },{ 2, 1, -1 },{ -3, -1, 3 },{ 0, -1, -3 },{ -4, 2, -4 },{ 3, 1, -1 },{ -2, 2, -3 },{ 0, -3, -2 },{ 3, -4, 1 },{ 2, 1, 0 },{ -3, 3, 2 },{ -4, -3, -3 },{ 2, 2, 1 },{ 0, 0, 1 },{ -1, -2, -4 },{ 1, -2, -2 },{ 3, 1, 2 },{ -4, 0, -3 },{ 1, 1, 3 },{ 0, -3, 1 },{ 2, 1, 0 },{ -4, -3, 2 },{ 0, 2, 3 },{ 2, 3, -1 },{ -3, 0, -2 },{ 3, -2, -3 },{ 1, -2, 1 },{ -4, 1, -1 },{ 2, 0, 3 },{ -2, -4, -3 },{ -4, 2, -2 },{ 1, -3, -3 },{ 0, 1, -1 },{ 0, -1, 0 },{ -4, 0, -2 },{ -1, -3, 1 },{ 0, -1, -3 },{ -3, 1, -1 },{ 3, 3, 2 },{ 0, 1, 1 },{ -4, -1, -3 },{ -3, 3, 0 },{ -2, -4, 2 },{ -3, 0, -4 },{ -4, -4, 3 },{ 0, -2, -3 },{ -3, 2, 2 },{ -1, -4, 0 },{ 2, 2, 3 },{ -2, -2, 0 },{ -1, -4, 1 },{ 1, 0, 2 },{ 3, -4, -4 },{ -1, -1, 1 },{ -3, -2, -4 },{ 3, -3, 2 },{ -2, -1, 0 },{ -1, -3, 0 } }, - { { -3, -2, 1 },{ -1, -1, 2 },{ -3, 0, 1 },{ 0, 1, 2 },{ -1, -2, -1 },{ -4, -3, 3 },{ 1, 3, 2 },{ 0, -3, -3 },{ 3, 0, -4 },{ -2, 3, 1 },{ 2, -3, 1 },{ 0, -1, -1 },{ -4, -2, 3 },{ -3, 2, 1 },{ -1, -1, -1 },{ -4, 1, 3 },{ 3, -1, -2 },{ 1, 2, -4 },{ -1, -2, -1 },{ -3, 3, 2 },{ 3, 1, -3 },{ -2, -1, 3 },{ 2, 3, 1 },{ -3, -3, -2 },{ 3, -1, -1 },{ -2, 3, -4 },{ -4, -4, 2 },{ 0, -2, -2 },{ 1, -1, -3 },{ -2, -1, 1 },{ -4, -3, 0 },{ -1, 2, 0 },{ -2, 3, -1 },{ 1, 0, -3 },{ 1, -2, 2 },{ 0, -1, 0 },{ 3, 3, -1 },{ 2, 1, -4 },{ -3, 3, 0 },{ -2, -2, -3 },{ 1, 2, -3 },{ 0, 1, 1 },{ 3, -4, 3 },{ -4, -2, -1 },{ -1, -4, 0 },{ -2, -3, -2 },{ 2, -1, -4 },{ -1, 1, 1 },{ 3, -2, -1 },{ 1, 1, -2 },{ 2, -1, 0 },{ -1, 3, 1 },{ 1, 0, -3 },{ -4, -3, -4 },{ -3, -2, 1 },{ 0, 1, -2 },{ -4, 3, -4 },{ -1, -1, -1 },{ 2, 2, -1 },{ -4, 2, 1 },{ -1, 3, 3 },{ 0, -4, -2 },{ -4, 1, -2 },{ 2, 3, -1 } }, - { { 1, 2, 3 },{ -1, -4, -4 },{ 3, -3, -1 },{ 2, 2, 3 },{ 1, -4, -2 },{ -1, 0, 0 },{ 3, -1, -2 },{ -3, -2, 1 },{ -4, -4, 0 },{ 1, 2, -2 },{ 1, -2, 3 },{ -3, -4, 2 },{ 3, 0, 0 },{ 1, 3, -3 },{ 1, -2, -4 },{ -2, -4, -2 },{ 0, -1, 0 },{ -3, -4, 3 },{ 3, -3, 0 },{ -2, 2, -2 },{ 0, -4, 0 },{ -4, 2, -1 },{ -2, -4, -4 },{ 0, 2, 3 },{ -1, -2, 0 },{ 2, 0, -3 },{ -3, 2, 1 },{ 2, 3, -1 },{ -2, 1, -4 },{ 3, 1, -1 },{ 0, -4, 3 },{ 2, 2, 2 },{ -4, -4, 3 },{ 0, -3, -2 },{ -3, 2, -4 },{ -2, -4, 1 },{ -4, -2, 2 },{ 1, -1, 3 },{ -1, -3, 1 },{ 3, -4, 3 },{ -3, -2, 2 },{ -2, 3, -2 },{ 2, -1, 0 },{ -3, 2, -4 },{ 1, -3, 3 },{ -2, 2, -3 },{ 3, -1, 0 },{ -4, -4, 3 },{ 1, 2, -3 },{ -2, -3, 2 },{ 0, 2, -4 },{ -2, -2, 2 },{ 3, 1, -1 },{ 1, -4, 3 },{ 2, 0, -2 },{ 0, 1, -3 },{ 3, -3, 2 },{ -3, -2, 3 },{ -2, 0, -2 },{ 1, -3, -3 },{ -2, 1, -1 },{ 0, 0, -3 },{ 1, 0, 3 },{ -2, -3, -4 } }, - { { -4, 1, 0 },{ 0, 1, -2 },{ -2, 3, 1 },{ -2, -2, -4 },{ -4, 0, -3 },{ 3, 3, 1 },{ -2, -1, -3 },{ -3, 1, -1 },{ -1, 1, 3 },{ -1, -2, -3 },{ -3, 3, -4 },{ -2, 1, -2 },{ -1, -3, -2 },{ -2, 0, 2 },{ -3, 2, 3 },{ 2, -3, -3 },{ -1, 3, 1 },{ 0, 0, -1 },{ 2, -1, -4 },{ -4, 1, 1 },{ 1, -3, 2 },{ 2, 0, -4 },{ 3, -2, 0 },{ 0, 0, 1 },{ -4, 1, -2 },{ 3, -4, -1 },{ 0, -1, 3 },{ -1, -2, 2 },{ -3, -4, 0 },{ -4, -3, -3 },{ 0, 0, -4 },{ 1, 1, -2 },{ 3, -1, -4 },{ -3, 3, 0 },{ 2, 1, 3 },{ 3, 0, -3 },{ -1, 1, -2 },{ 2, -1, -4 },{ -4, 3, 1 },{ 0, 0, -1 },{ -1, 0, -4 },{ 1, -3, -1 },{ -4, 1, 0 },{ 0, 0, 2 },{ 2, 0, -2 },{ 0, 1, 1 },{ 2, 3, -1 },{ 0, 0, 2 },{ -1, -1, -2 },{ -4, 0, -3 },{ 3, 3, 1 },{ -3, -4, -1 },{ -1, 0, -2 },{ -4, 3, -1 },{ -2, 2, 2 },{ -1, -1, 0 },{ -4, 3, -3 },{ 2, -4, 1 },{ 0, 2, 0 },{ 3, -1, 0 },{ 2, -4, 1 },{ -4, -2, 2 },{ 2, 2, 0 },{ 3, -2, 1 } }, - { { 1, -1, -1 },{ 2, 2, -3 },{ -3, -1, 2 },{ 1, -3, 0 },{ -4, 1, 0 },{ 0, -3, 3 },{ 0, 2, 2 },{ 2, -4, -4 },{ 3, -3, 2 },{ 0, 2, 0 },{ 2, -1, 2 },{ 3, -1, 0 },{ 0, 3, -4 },{ 0, -4, -1 },{ 3, -2, 2 },{ -4, 0, 1 },{ 1, 1, -4 },{ -4, 3, 3 },{ 2, -2, 1 },{ -3, -2, -3 },{ -1, 1, 2 },{ -2, 3, -2 },{ -3, -1, -3 },{ 1, 1, 3 },{ -1, -3, 2 },{ -2, 3, -3 },{ -3, 2, -4 },{ 1, 0, -2 },{ 3, -1, 3 },{ 2, 2, 1 },{ -3, 3, 2 },{ -2, -2, 1 },{ -1, -2, -2 },{ -4, -1, 1 },{ 0, -3, 2 },{ -2, -2, -1 },{ -3, -4, 1 },{ 0, 2, 0 },{ -2, -3, -2 },{ 2, 1, -3 },{ 3, 2, 0 },{ -2, -2, 3 },{ -1, -4, -4 },{ 3, 3, -3 },{ -3, -2, 3 },{ -3, -3, 1 },{ -4, -4, -4 },{ -3, 3, -4 },{ 0, -2, 0 },{ 2, -4, 3 },{ -3, -3, -2 },{ 2, -1, 0 },{ 0, -1, 3 },{ -2, -3, -4 },{ 3, -2, 1 },{ 2, -4, -1 },{ -2, 1, -4 },{ 1, 0, 3 },{ -1, -3, -3 },{ -3, 3, -4 },{ -3, -1, 3 },{ 0, 1, -2 },{ -2, 3, -4 },{ -3, -4, -3 } }, - { { -1, -3, 3 },{ 3, -2, 2 },{ -1, -4, -2 },{ 2, 3, 3 },{ 1, -1, -2 },{ -3, -4, -4 },{ -1, -1, -1 },{ -4, 3, 1 },{ -2, 0, -2 },{ 2, 0, -1 },{ -4, -4, 1 },{ -2, -3, 3 },{ -4, 1, -1 },{ 2, -2, -3 },{ 2, 2, 0 },{ -1, 1, -2 },{ -3, -3, -1 },{ 3, -4, 2 },{ -1, 0, -2 },{ 1, -1, -3 },{ 3, 2, 3 },{ 0, -4, 0 },{ 2, -2, 0 },{ -4, 3, -4 },{ 3, -3, -1 },{ 1, -1, 0 },{ 2, -2, 1 },{ -4, -3, 0 },{ -1, 2, -2 },{ -1, -4, -1 },{ -3, -1, -3 },{ 3, 2, -1 },{ 2, -4, 0 },{ 1, 1, -4 },{ 3, 3, -1 },{ -4, 0, -3 },{ 1, 3, 3 },{ 3, 0, -4 },{ -1, -2, 3 },{ -3, -4, -3 },{ -4, -1, 2 },{ 1, 2, 1 },{ -3, -4, 1 },{ 2, -1, -1 },{ 0, 2, -2 },{ -1, -2, 0 },{ 1, -1, -2 },{ 3, -3, 3 },{ -2, 2, 0 },{ 1, 1, 1 },{ 1, 2, -4 },{ -2, 1, 2 },{ -1, 3, -3 },{ 1, 0, 1 },{ 1, 0, 0 },{ -3, 3, 3 },{ 0, -1, -2 },{ -2, -2, -1 },{ -4, 2, 2 },{ 1, 1, 0 },{ -2, 0, -4 },{ 3, -4, -1 },{ -1, 2, 1 },{ -4, -1, 2 } }, - { { -2, 3, -4 },{ -3, 0, 0 },{ 0, 2, -1 },{ -1, 1, -4 },{ -2, 0, -1 },{ 2, 2, 0 },{ 3, -2, 2 },{ 1, 1, -3 },{ -3, -2, 3 },{ -1, -3, -2 },{ 0, 2, -4 },{ 1, 1, -3 },{ -3, -1, 1 },{ -1, 3, 3 },{ -4, -3, 0 },{ -2, -1, -4 },{ 1, -4, -3 },{ 0, 2, 0 },{ -3, 3, 0 },{ -2, -4, -4 },{ 0, 2, -1 },{ -4, -3, -2 },{ -3, -2, 2 },{ -1, 0, 1 },{ -3, 2, -2 },{ -2, -4, 1 },{ 0, 0, 2 },{ -2, 1, -3 },{ 2, 3, -4 },{ 0, 0, 1 },{ 1, 1, 0 },{ 0, -3, 3 },{ -4, 0, 2 },{ -2, 2, 3 },{ -1, -4, -3 },{ 0, -3, 1 },{ 2, -1, 0 },{ -4, -3, -1 },{ 1, 1, 1 },{ 0, 2, 2 },{ 2, -2, -1 },{ -1, 3, -2 },{ -4, 0, -3 },{ 0, 1, 2 },{ -2, 2, 3 },{ 3, -4, -4 },{ -1, 1, 2 },{ 2, 0, -1 },{ -3, 3, -3 },{ -1, -2, -2 },{ -4, 0, -1 },{ 0, -2, 3 },{ -4, -4, -2 },{ -3, 2, -3 },{ 3, -2, 2 },{ -4, -3, -4 },{ 2, 1, 1 },{ 3, -4, 2 },{ 3, -2, -3 },{ -1, -3, -2 },{ 2, 2, 2 },{ 1, -2, -3 },{ 0, -3, 0 },{ 2, 0, -2 } }, - { { -2, -4, -1 },{ 1, 2, -4 },{ -4, -1, 1 },{ 3, -3, 2 },{ -3, -2, 1 },{ 2, 0, 3 },{ -4, 3, -3 },{ 0, -4, 0 },{ 3, -1, -4 },{ 1, 3, 2 },{ 2, 2, 0 },{ -2, -2, 3 },{ 3, -4, -2 },{ 0, 2, -3 },{ 1, 0, 1 },{ -2, 3, 3 },{ 3, -2, -1 },{ -1, 0, 3 },{ 2, -3, -2 },{ -4, -1, 1 },{ -1, 1, 3 },{ 3, 3, -1 },{ 1, 0, -4 },{ 2, 1, 3 },{ 0, 1, -3 },{ 0, -2, -4 },{ -4, 3, 3 },{ 3, -1, -1 },{ -2, -3, 2 },{ -4, -2, 3 },{ -1, -3, -2 },{ 3, 3, -4 },{ -3, -2, -3 },{ -2, 0, 1 },{ 2, -1, -2 },{ -1, 2, -4 },{ -3, 1, 2 },{ -2, 3, -2 },{ 2, -4, 0 },{ -1, 3, -3 },{ -3, 0, -4 },{ 1, -3, 3 },{ 3, -3, 0 },{ 2, 1, -4 },{ -4, -3, -1 },{ 1, 0, -3 },{ -2, 3, 0 },{ -4, -4, 1 },{ 0, -1, 3 },{ 3, -4, 2 },{ -2, 0, -4 },{ 2, -3, 1 },{ 3, 1, -1 },{ 0, -4, 0 },{ -1, 2, 2 },{ -2, 1, -4 },{ -1, -1, -2 },{ -3, 2, 0 },{ 1, 3, 1 },{ -4, -1, 3 },{ -3, 1, 1 },{ -3, -1, 0 },{ -4, 3, 3 },{ 3, 1, -2 } }, - { { 0, -3, 1 },{ 2, -2, 3 },{ -4, 1, -3 },{ -1, -4, -2 },{ 0, 3, -3 },{ -2, -3, -4 },{ -1, 1, -1 },{ -3, -3, 2 },{ -1, 1, -1 },{ -3, -2, 1 },{ -4, -4, -3 },{ -1, 0, -1 },{ 2, 0, 0 },{ -3, -3, 2 },{ -1, -4, -2 },{ 2, -1, -4 },{ -4, 1, 1 },{ -3, 0, 2 },{ 1, 2, -1 },{ 2, -2, -4 },{ -1, 0, 1 },{ 1, -4, 2 },{ -2, -3, -3 },{ -4, -4, -1 },{ 3, 3, -1 },{ 1, -3, 2 },{ 2, 1, -2 },{ -3, -4, 0 },{ 1, 2, -4 },{ 2, -1, 2 },{ -4, 1, -3 },{ 0, 2, -1 },{ 2, -4, 0 },{ 0, -2, -2 },{ -4, 3, 3 },{ -3, -3, 0 },{ 3, -2, -3 },{ 0, -1, 3 },{ -4, 0, -2 },{ 3, -1, 1 },{ -2, -3, -1 },{ -2, 1, 3 },{ -3, -2, 0 },{ 0, 3, -2 },{ -1, -1, 1 },{ -3, -2, 2 },{ 0, 2, -1 },{ 3, 1, -4 },{ 1, -3, -3 },{ -3, 2, 0 },{ 2, 3, -2 },{ -3, -1, 0 },{ -2, 2, -4 },{ 1, -1, 3 },{ 2, -3, -1 },{ -4, -1, -1 },{ 1, 3, -3 },{ -3, -3, 0 },{ 0, -4, -4 },{ 0, 0, -1 },{ -1, -3, -2 },{ 3, -4, -4 },{ 1, 0, -3 },{ 0, -2, 2 } }, - { { -3, 2, -3 },{ -1, 0, 0 },{ 3, -1, 2 },{ 1, 2, 0 },{ 2, 0, 3 },{ -4, -1, 0 },{ 1, -2, 1 },{ -2, 2, -2 },{ 3, 0, 3 },{ 1, -1, -4 },{ 2, 2, 1 },{ -2, -2, 2 },{ 0, 1, -4 },{ 3, 3, -3 },{ -4, -1, 0 },{ -2, 1, -1 },{ 2, 3, -2 },{ 0, -3, -3 },{ -2, -4, -3 },{ 3, -2, 2 },{ -3, 2, -2 },{ -3, 3, -3 },{ 2, -1, 0 },{ -1, 2, 3 },{ -2, -1, 1 },{ -4, 0, 0 },{ -1, -2, -3 },{ -1, 0, -1 },{ 0, -4, -2 },{ -2, 2, 1 },{ 2, -1, -3 },{ -3, -2, 3 },{ -2, 3, 2 },{ 1, 1, 0 },{ 1, -3, -4 },{ 2, 0, -1 },{ 0, -4, 2 },{ -4, 2, -4 },{ 1, -2, 0 },{ 0, 1, 2 },{ 2, -4, -2 },{ 1, 2, 1 },{ -4, 2, -3 },{ 1, -4, -4 },{ -2, -1, 1 },{ 3, -4, -3 },{ 2, 3, 3 },{ -4, -2, -1 },{ -2, -1, -2 },{ 1, 2, 1 },{ -1, -2, 3 },{ 0, -3, -3 },{ -4, 3, 2 },{ -2, 0, -3 },{ 3, 3, 1 },{ 0, -4, 3 },{ -1, 0, 3 },{ 2, 0, 2 },{ -2, -2, -1 },{ 2, 1, -3 },{ 3, 3, 2 },{ -2, 2, 1 },{ -1, -3, 3 },{ -4, 3, -1 } }, - { { 3, -4, -4 },{ -2, 3, -2 },{ 0, -3, -1 },{ -2, 1, -4 },{ -3, -2, -2 },{ 3, 2, 2 },{ 0, -4, -4 },{ 2, 3, -2 },{ -4, -3, -3 },{ 0, -4, 0 },{ -3, 3, -1 },{ 3, -3, -2 },{ -4, -1, 3 },{ 1, 2, 1 },{ -1, -2, 3 },{ 3, -4, -3 },{ 1, -3, 2 },{ -1, 2, 0 },{ -4, -1, -1 },{ 1, 3, 3 },{ 0, 1, 0 },{ -4, -3, -4 },{ 0, -1, 1 },{ 1, -2, -2 },{ -3, -3, -4 },{ 3, 2, 1 },{ 2, -2, 3 },{ -3, 3, 2 },{ 3, -2, -2 },{ 1, 0, 0 },{ -2, 3, 0 },{ -1, -4, -1 },{ 3, -1, 1 },{ -1, 0, -4 },{ -4, 2, 3 },{ -1, -1, 1 },{ 1, 1, -2 },{ -2, 3, -1 },{ 3, -3, 2 },{ -2, 3, -4 },{ -4, -1, -3 },{ -1, 0, -2 },{ 2, 3, 3 },{ 3, -2, 2 },{ -2, 0, -1 },{ -1, 2, 0 },{ 1, -3, -4 },{ -3, 0, 2 },{ -1, 1, 0 },{ 3, -4, 2 },{ -4, 1, -2 },{ 2, -1, -1 },{ 1, -4, -4 },{ -1, 0, 0 },{ 2, -3, -2 },{ -3, -2, -3 },{ 3, 1, 0 },{ -4, 3, -2 },{ -2, -3, -4 },{ -4, -1, 3 },{ 1, -2, 0 },{ -3, -4, -2 },{ 2, -1, -1 },{ 1, 1, 0 } }, - { { -3, 0, 2 },{ 2, -1, 3 },{ -4, 2, 1 },{ 1, -4, -1 },{ -1, 0, 3 },{ -1, -3, -1 },{ -4, -1, 1 },{ 0, 0, 2 },{ 3, -2, 2 },{ -2, 2, -4 },{ -1, 1, 3 },{ 1, -1, -1 },{ -2, 0, 0 },{ -1, -4, -3 },{ -3, 2, 1 },{ 1, -2, -4 },{ -2, 0, 3 },{ -4, 3, 0 },{ 3, 0, 1 },{ -2, -1, -4 },{ -1, 1, -1 },{ 2, -4, 2 },{ 3, 2, 3 },{ -2, 1, -3 },{ 1, 1, -1 },{ 0, 3, -2 },{ -2, -4, -3 },{ 0, -1, -4 },{ -3, 1, 1 },{ -4, -3, 3 },{ 2, -3, -3 },{ 0, 0, -4 },{ -4, -2, 2 },{ -3, -4, -2 },{ 3, 2, -3 },{ -2, 0, 0 },{ -3, -3, 3 },{ -1, 0, -3 },{ 2, -2, -1 },{ -3, -2, 3 },{ -1, 1, 0 },{ 3, -4, -1 },{ 0, -2, 0 },{ -4, -3, -2 },{ -1, 1, 2 },{ -4, 3, -2 },{ 0, -2, 1 },{ 2, -4, 3 },{ -2, 0, -3 },{ 0, 3, -4 },{ -4, -3, -1 },{ -1, -2, 2 },{ 3, 1, 1 },{ -2, 0, 2 },{ -4, 2, -1 },{ -2, 2, -4 },{ 0, -2, 2 },{ 1, -4, 1 },{ 3, 2, 0 },{ -1, 3, 3 },{ 1, 0, -4 },{ -3, 1, 2 },{ -1, 2, -4 },{ 0, -2, 0 } }, - { { -1, -4, 1 },{ 1, -3, -3 },{ -4, -2, 0 },{ 3, 3, -4 },{ 0, -1, 2 },{ -3, 3, -3 },{ 3, 1, -3 },{ -2, 0, -1 },{ -3, -3, 0 },{ -1, 1, -3 },{ 1, -4, 1 },{ -3, -2, 2 },{ 2, 3, -4 },{ 2, -3, -2 },{ 0, 1, 2 },{ -3, 3, -1 },{ 0, 1, -2 },{ 3, -4, -4 },{ 0, -3, 3 },{ 1, -2, -2 },{ 2, -4, -3 },{ -4, 3, 1 },{ -2, 0, -1 },{ -1, -2, 0 },{ -4, -4, 2 },{ 2, 0, 3 },{ -4, -3, 1 },{ 1, 2, -1 },{ 3, 3, 2 },{ 0, -1, -4 },{ -2, 2, 2 },{ 3, 1, -2 },{ 1, 3, -1 },{ -3, -2, 1 },{ 0, -3, -1 },{ 2, 3, 2 },{ 3, -4, -4 },{ -4, 1, 1 },{ 0, -4, -3 },{ 2, 2, 1 },{ 0, 1, 2 },{ -2, -1, -4 },{ -3, 3, 1 },{ 1, 0, -3 },{ 2, -1, 3 },{ 3, -3, -4 },{ 1, 1, -2 },{ -4, 2, 0 },{ -1, -1, -2 },{ 2, -3, -3 },{ 3, 2, 3 },{ -3, 2, -2 },{ 1, 3, -1 },{ -3, -3, 3 },{ 0, -1, -3 },{ 2, -4, 1 },{ -3, 1, -2 },{ 2, -1, -1 },{ -3, -2, -3 },{ 0, 0, -1 },{ -2, -4, 1 },{ 3, -3, -3 },{ -4, -1, 3 },{ 2, 3, -3 } }, - { { -3, 2, 2 },{ -2, 0, -2 },{ 3, 1, -3 },{ 0, 1, 1 },{ -2, -3, 0 },{ 1, -2, -2 },{ 1, 2, 3 },{ -3, -4, 1 },{ 2, 3, 3 },{ 0, -1, -4 },{ -4, -1, 0 },{ 3, 3, -3 },{ -4, -3, -1 },{ 1, 0, 1 },{ 3, 1, 2 },{ -4, -1, 0 },{ 2, -3, -3 },{ -1, -1, 2 },{ -3, 2, 0 },{ -2, 2, 1 },{ 0, 0, -1 },{ -3, -1, -2 },{ 1, -3, 1 },{ 3, -2, -3 },{ -3, 3, -4 },{ -1, 0, 0 },{ 3, -1, -2 },{ -2, 1, -3 },{ -1, -4, 3 },{ -4, -2, 0 },{ -3, 0, -3 },{ 2, -4, 3 },{ -1, 1, 0 },{ 1, -1, 1 },{ -2, 2, -3 },{ 2, -1, 0 },{ -1, -2, -2 },{ 1, -1, 1 },{ -4, 2, 0 },{ -2, 0, -2 },{ 1, -3, -4 },{ -4, -4, 3 },{ 2, 2, 1 },{ 0, 2, -3 },{ -3, -4, 0 },{ -2, -1, 1 },{ -3, 2, -1 },{ 3, -3, 2 },{ 1, 1, 1 },{ -3, -1, 1 },{ -2, 0, 0 },{ 0, -4, 0 },{ -1, -2, -3 },{ 2, -4, -4 },{ 0, 0, 0 },{ 3, 1, 2 },{ -4, 3, 3 },{ -1, -1, -4 },{ -1, -4, 2 },{ -4, 2, -2 },{ 2, 0, -2 },{ 1, 2, 2 },{ -2, -2, 0 },{ 3, 1, -2 } }, - { { 1, -3, 1 },{ -3, 3, -1 },{ -2, -4, 2 },{ 2, -1, -1 },{ -4, -4, 3 },{ 2, 2, -1 },{ -1, -1, -4 },{ 2, -2, -2 },{ 0, 2, 0 },{ 3, -3, -2 },{ -2, 0, 2 },{ 0, 1, 3 },{ -2, -4, -2 },{ 0, 2, -1 },{ -2, -3, -4 },{ -1, -2, 3 },{ 1, -4, -2 },{ -3, 3, -1 },{ 2, 0, -3 },{ -4, -2, 2 },{ 3, 1, -4 },{ -1, -3, 2 },{ -3, 3, 3 },{ 2, 2, -2 },{ 1, -4, 2 },{ 0, 2, 3 },{ -3, -2, -1 },{ 1, -3, 0 },{ 2, 0, -2 },{ 0, 3, 0 },{ 1, -1, -1 },{ -2, -3, -3 },{ 3, 3, 2 },{ -4, -4, -4 },{ 0, 0, 3 },{ -4, 1, 2 },{ -3, 3, -1 },{ 0, 1, 3 },{ 3, -3, -4 },{ -3, 0, -1 },{ 3, 3, 2 },{ -1, -2, -1 },{ -2, 1, -2 },{ 3, -2, -1 },{ -1, 3, -1 },{ 2, 0, 3 },{ 0, -2, -3 },{ -2, -4, -4 },{ -4, 3, 3 },{ 0, -4, -3 },{ 1, 0, 2 },{ 3, 1, -4 },{ -3, 3, 1 },{ -4, -1, -2 },{ -2, 3, 3 },{ -1, -3, -1 },{ 1, -3, -2 },{ -2, 1, 1 },{ 3, 3, 0 },{ 2, -3, 3 },{ -2, -2, -4 },{ 0, 3, -1 },{ -4, -3, 0 },{ 0, -1, -4 } }, - { { 2, -1, -1 },{ -1, 0, -4 },{ 1, -2, 3 },{ 0, 2, -3 },{ -3, 3, -4 },{ -1, 0, 2 },{ -4, -3, 1 },{ -2, 1, 2 },{ -4, 0, -4 },{ 1, -4, -1 },{ -3, 2, 1 },{ 1, -2, -4 },{ -1, 2, 3 },{ -4, 0, -3 },{ -3, -1, 2 },{ 3, 3, -3 },{ -2, 0, 1 },{ 2, 1, 1 },{ 0, -2, -4 },{ 1, -4, 3 },{ -2, 3, -2 },{ 2, 1, 0 },{ -1, -1, -4 },{ 0, 1, 0 },{ -4, -3, 1 },{ -2, 0, -4 },{ 1, 3, -1 },{ -4, -2, 2 },{ -1, 1, -4 },{ 3, 2, 2 },{ -4, -4, 1 },{ 0, 0, 2 },{ -3, -2, -4 },{ -1, 2, -1 },{ 3, -2, -2 },{ -2, -3, -3 },{ 1, -4, -4 },{ -2, 3, 2 },{ 2, -4, -3 },{ -1, -2, 2 },{ 0, -1, 0 },{ 2, 2, -3 },{ -3, -1, 3 },{ -2, -3, 2 },{ 0, -4, -4 },{ -4, 1, 0 },{ 1, 0, -2 },{ 2, 3, 1 },{ -1, -2, -2 },{ 3, -2, -1 },{ -4, -3, -2 },{ 0, -1, 3 },{ -2, -2, -1 },{ 1, 2, 2 },{ 2, 0, -2 },{ -3, -2, -4 },{ 1, 0, -3 },{ 3, -2, 2 },{ -4, 0, -4 },{ 0, 1, -3 },{ -3, -1, 1 },{ -1, 1, 3 },{ 3, -4, -3 },{ -2, 2, 3 } }, - { { -4, 1, 0 },{ -1, -4, 1 },{ 3, 0, 0 },{ -4, -1, -2 },{ 3, 1, -3 },{ 0, -2, 0 },{ 1, 2, -1 },{ 3, -3, -3 },{ -3, 3, 3 },{ -1, 1, -3 },{ 2, -3, 2 },{ 1, -1, -1 },{ 3, -2, 1 },{ 2, -4, 0 },{ 0, 2, 0 },{ 1, 1, -2 },{ -4, -3, 3 },{ -1, 2, -2 },{ -4, -1, 0 },{ 3, 0, 1 },{ 0, -3, -2 },{ -4, -2, -3 },{ 1, -4, -1 },{ -2, 0, 1 },{ 3, -2, -2 },{ -3, -1, -3 },{ 3, 1, 1 },{ 2, -4, 3 },{ -3, 2, -3 },{ -2, -2, -4 },{ 0, -3, -2 },{ 2, 2, -2 },{ -4, 1, 0 },{ 2, -3, 3 },{ -1, 0, 0 },{ 0, 1, 2 },{ 2, -2, 1 },{ 1, 0, 0 },{ -4, -1, -2 },{ -3, 2, 3 },{ 1, -4, -2 },{ -4, 0, 1 },{ 1, -3, 0 },{ 2, 1, -4 },{ -1, 3, 3 },{ -4, -1, -3 },{ 3, -3, 2 },{ -3, -1, 0 },{ 1, 1, -1 },{ -2, 2, 3 },{ -1, 1, -4 },{ -2, 3, 0 },{ 2, -3, -3 },{ 3, 1, 3 },{ -1, -4, 0 },{ -3, -4, -1 },{ -4, 2, 1 },{ 0, 3, 3 },{ -2, -4, -1 },{ 1, -4, 2 },{ 2, -2, 0 },{ 2, 2, -2 },{ -3, 0, 2 },{ 0, -3, -3 } }, - { { 3, -3, -2 },{ -3, 2, -4 },{ 0, 3, 1 },{ -2, -3, 2 },{ 1, -3, 2 },{ -3, -1, 3 },{ -2, -4, -2 },{ 3, 0, 1 },{ -1, -2, -1 },{ 0, -1, 2 },{ -4, 3, -2 },{ -3, -3, -4 },{ -2, 3, -3 },{ 0, 0, -1 },{ -3, -3, 2 },{ 2, -1, -1 },{ -1, -2, -4 },{ 3, 0, 2 },{ -2, -4, -3 },{ -3, 2, -1 },{ 1, 3, 0 },{ -3, 0, 3 },{ 2, 2, 2 },{ -4, 2, 2 },{ 0, 3, -3 },{ 2, -4, 3 },{ -1, 0, -1 },{ -1, -3, 2 },{ -3, -1, 0 },{ 2, 3, 1 },{ -3, -1, 0 },{ -1, -2, 3 },{ 3, 3, -3 },{ 1, -1, 1 },{ -3, 3, -1 },{ 3, 2, -3 },{ -4, -2, -1 },{ -1, 1, -2 },{ 0, 0, 1 },{ 3, 3, -4 },{ -2, 1, -1 },{ -1, 3, -4 },{ -3, -1, -2 },{ 3, 2, -1 },{ 1, -2, 1 },{ 0, -2, -2 },{ -1, 2, 2 },{ -2, -3, -3 },{ -3, 0, -4 },{ 2, -1, 2 },{ 2, -4, 0 },{ -3, 2, 1 },{ 0, 0, -3 },{ -4, -2, -4 },{ 0, 1, 2 },{ 2, 3, -4 },{ 0, 1, 0 },{ -1, -1, -2 },{ -3, -2, -1 },{ 0, 3, -4 },{ -2, 0, -3 },{ -4, -1, -1 },{ 1, 3, 1 },{ 1, -2, -1 } }, - { { 1, 3, 2 },{ -3, -2, 3 },{ 2, 1, -1 },{ 2, -4, -3 },{ -1, 2, 0 },{ 2, 3, -1 },{ 0, 2, -4 },{ 1, 0, 3 },{ -3, -4, -3 },{ 2, -1, 0 },{ -1, 1, 1 },{ 3, 0, 3 },{ -3, 1, -2 },{ 2, -4, 3 },{ -2, 3, -4 },{ -4, 2, 1 },{ 0, -4, 2 },{ -2, 3, -1 },{ 1, -2, 3 },{ 2, 1, -4 },{ -1, -4, 1 },{ 3, -1, -3 },{ -2, -1, -4 },{ 1, -3, 0 },{ -1, -3, -2 },{ -2, -2, 0 },{ -4, 3, -4 },{ 1, 0, -2 },{ 0, 1, -3 },{ 3, -4, 3 },{ 1, 1, -1 },{ -2, 0, -4 },{ -2, -3, -2 },{ 0, -4, 2 },{ -2, 0, -4 },{ -3, -4, 3 },{ 2, 2, 3 },{ -2, -3, -4 },{ -3, -4, 2 },{ 3, -2, 0 },{ 2, -3, 2 },{ 2, -2, 3 },{ -2, -4, 2 },{ 0, 0, 1 },{ -3, -4, -3 },{ -2, 3, 0 },{ 2, 1, -1 },{ 3, -4, 3 },{ 0, 3, 1 },{ 1, -3, -1 },{ -4, -2, -2 },{ 3, 0, 2 },{ -3, -3, 1 },{ 1, 2, -1 },{ -2, -1, 0 },{ -2, -3, 3 },{ 3, -3, -3 },{ 2, 0, 1 },{ 3, 2, 2 },{ -4, 1, 3 },{ 3, -3, 1 },{ -1, -4, 3 },{ -3, 2, -4 },{ -2, 0, 2 } }, - { { 3, 1, -3 },{ -1, -1, -2 },{ -4, -2, -4 },{ -3, 0, 0 },{ -2, 0, -4 },{ 3, -2, -3 },{ -4, 1, 0 },{ -4, -3, 1 },{ 2, 3, -2 },{ 1, 2, -4 },{ -2, -4, -1 },{ 0, -3, 0 },{ -4, 2, 1 },{ 1, -2, 0 },{ -1, -1, -2 },{ 3, 0, -3 },{ -1, 2, 0 },{ 2, -1, -2 },{ -3, 1, -3 },{ 0, 0, 0 },{ -4, -3, 2 },{ -1, 2, -1 },{ -3, 3, -2 },{ 3, -4, -1 },{ 0, 1, -4 },{ -3, 1, 3 },{ 2, 2, 1 },{ 3, -3, 1 },{ -4, 3, -2 },{ -2, -2, -1 },{ 0, -4, 2 },{ -4, 2, 2 },{ 3, 2, 0 },{ -4, -2, 1 },{ 1, -1, -3 },{ -1, -3, 0 },{ 0, -1, -2 },{ 1, -1, -3 },{ -4, 3, 0 },{ 0, 0, -1 },{ -1, -1, -3 },{ -4, 1, -3 },{ 0, 3, 0 },{ -4, 2, -2 },{ 1, -2, -4 },{ 3, 0, 3 },{ -2, 2, -4 },{ -4, -1, -1 },{ 0, -2, -3 },{ -1, 2, 3 },{ -2, 1, -3 },{ -1, -4, -4 },{ 1, 3, -1 },{ 3, -1, 3 },{ 2, 2, -2 },{ -4, 0, 2 },{ 1, -2, -3 },{ -4, -4, 0 },{ -2, -1, -4 },{ 1, -3, -2 },{ -2, 3, -2 },{ 2, 1, -1 },{ 0, -1, -4 },{ -1, -4, -1 } }, - { { 2, 3, 1 },{ -2, -4, 0 },{ 1, 2, 3 },{ 3, 3, 1 },{ 0, -4, 3 },{ -3, -1, 1 },{ 1, -3, -1 },{ -1, -2, 3 },{ -2, 0, -3 },{ 0, 1, 2 },{ -3, -2, 3 },{ 3, 3, -3 },{ -1, -1, -4 },{ 2, 1, 2 },{ -3, -3, 3 },{ -4, 1, -1 },{ 1, -4, -3 },{ -3, -3, 0 },{ 1, -2, 2 },{ -2, -3, -2 },{ 2, -1, 3 },{ 3, 1, -3 },{ -3, -2, 2 },{ 1, 0, 3 },{ -4, -1, 1 },{ 2, -1, -3 },{ -2, -4, -1 },{ -1, -2, 2 },{ 0, 0, -4 },{ -3, -1, 0 },{ 2, -1, -3 },{ 1, 1, -4 },{ 0, -3, 3 },{ 2, 1, -1 },{ -1, 3, -4 },{ 3, 2, 2 },{ -4, 1, -1 },{ -1, 3, 2 },{ 3, -4, 3 },{ 1, 2, -2 },{ -3, 0, 3 },{ 1, 2, 1 },{ 3, -2, -1 },{ 2, -3, 2 },{ -1, -1, 3 },{ -4, 1, 0 },{ 1, -3, 1 },{ -3, -1, -2 },{ 3, 2, 2 },{ -4, 0, 1 },{ 3, 3, 0 },{ 0, -1, 2 },{ -2, -2, 0 },{ -4, 0, -2 },{ -1, -4, -4 },{ 0, 3, -1 },{ -3, 2, -2 },{ -1, 3, 3 },{ 1, -1, 0 },{ -1, -4, 2 },{ 2, 0, 1 },{ -4, -2, 0 },{ 3, 2, 3 },{ -4, -3, 0 } }, - { { -3, 0, -1 },{ 0, -1, 1 },{ 1, -3, -2 },{ -4, 1, -2 },{ -1, -2, 2 },{ -3, 3, -3 },{ 2, 2, 2 },{ 3, 1, -2 },{ -3, -4, 0 },{ 3, -1, -1 },{ -4, 0, 1 },{ 1, -3, -3 },{ -1, -4, 1 },{ 1, 0, -1 },{ 0, -2, -4 },{ 2, 3, 1 },{ 2, 1, 2 },{ 0, 0, 3 },{ 3, 3, -4 },{ -1, 2, -4 },{ -4, 3, 1 },{ 1, -4, -1 },{ 0, -3, -2 },{ -2, 3, 1 },{ -1, 2, 2 },{ 3, -2, -2 },{ 1, 1, -3 },{ -2, 2, 0 },{ 3, -3, 3 },{ -1, 3, 1 },{ -4, 2, -2 },{ 3, -3, 1 },{ -2, -1, -3 },{ -3, 3, 0 },{ -3, -2, -2 },{ 2, -4, 1 },{ -3, 0, 1 },{ -2, -3, -4 },{ 2, 1, -4 },{ -4, -2, 1 },{ -2, -4, -1 },{ -2, -1, -4 },{ 0, -4, -4 },{ -3, 3, 0 },{ -2, -3, -1 },{ 2, -4, -3 },{ 1, 3, 1 },{ -1, -2, -2 },{ 2, -3, 0 },{ 1, -4, -4 },{ -3, -4, -2 },{ 2, 2, 3 },{ -1, 1, -3 },{ -3, -2, 1 },{ 2, -4, 1 },{ 2, -2, 2 },{ -2, 1, 1 },{ 3, 1, -4 },{ 0, -2, -1 },{ -3, 2, -3 },{ 0, 2, -4 },{ -3, -2, 2 },{ 1, -3, -2 },{ -1, 1, -3 } }, - { { -2, 2, -4 },{ 3, -2, 3 },{ -3, 1, -4 },{ -1, -4, -1 },{ 3, -1, 0 },{ 2, -3, -4 },{ -2, 1, -1 },{ 0, -1, -4 },{ 0, 3, 2 },{ -1, 2, -4 },{ 2, -3, 3 },{ -2, 1, -2 },{ -3, -1, -2 },{ -4, 3, 2 },{ -2, 2, 0 },{ -2, -2, -3 },{ -1, -4, 1 },{ -4, -1, -1 },{ -2, -1, -1 },{ -3, -4, 1 },{ 2, 0, 0 },{ -1, 0, 3 },{ 3, -1, -3 },{ -4, 2, -4 },{ 2, -4, 0 },{ 0, -3, -1 },{ -4, 3, 3 },{ -3, -4, 1 },{ 2, 0, -4 },{ 1, -2, -2 },{ -1, 1, 3 },{ -3, -4, -1 },{ 2, 0, 2 },{ -1, -4, 3 },{ 1, -1, -2 },{ 0, -3, 3 },{ 2, 2, -3 },{ 0, -2, -1 },{ -1, -1, 0 },{ 0, 3, -3 },{ 2, -3, 2 },{ 3, 1, 1 },{ -1, 0, 3 },{ -3, 1, 1 },{ 3, 2, -2 },{ 0, 0, -3 },{ -3, 0, 2 },{ -4, 2, -4 },{ -2, 1, 3 },{ 0, 1, -1 },{ -2, -1, 0 },{ 1, 0, -4 },{ -4, 3, -1 },{ 1, -3, 3 },{ 0, 2, -4 },{ -1, -1, 0 },{ 3, -3, -2 },{ -4, -3, 1 },{ -2, 0, -3 },{ 2, -4, 3 },{ 3, 0, -1 },{ -2, 3, -2 },{ 0, -1, -3 },{ 3, -4, 2 } }, - { { 2, -1, 0 },{ -1, -2, 2 },{ 1, 3, -3 },{ -2, 2, 1 },{ 0, 0, -2 },{ 1, -4, 3 },{ -1, 3, -1 },{ -4, 0, 1 },{ -4, -4, 0 },{ 1, -2, -2 },{ -2, -1, 0 },{ 3, 2, -4 },{ 0, 3, 2 },{ 3, -4, 3 },{ 1, -1, -2 },{ 3, 0, -4 },{ -3, 2, 0 },{ 0, -3, -2 },{ 3, 2, 3 },{ 1, -2, -3 },{ -3, 1, -2 },{ 0, -2, 2 },{ -3, 2, 0 },{ -2, -4, -1 },{ 0, 0, -4 },{ -3, -2, 2 },{ 1, 0, -3 },{ 0, -1, -1 },{ -2, 1, -1 },{ -3, -4, 2 },{ 2, 3, 1 },{ 0, -2, -4 },{ -2, 1, -2 },{ -4, 2, 0 },{ 3, 0, -4 },{ -2, 2, -1 },{ -4, 1, 2 },{ 1, -4, -2 },{ 3, 0, 3 },{ -4, 1, 0 },{ -2, -2, -2 },{ 0, 3, -2 },{ -4, -1, -3 },{ 1, -2, 0 },{ 2, 2, 3 },{ -2, -2, -4 },{ 3, -4, -1 },{ 0, -1, 3 },{ -1, 0, -3 },{ 2, 3, 2 },{ -3, -2, -3 },{ 3, -3, 1 },{ -2, 0, 2 },{ 3, 1, -1 },{ -3, -1, -2 },{ -4, 0, -3 },{ 1, 3, 3 },{ -3, -2, -1 },{ 1, -1, 2 },{ -3, 2, 0 },{ -4, -4, 1 },{ 2, -3, 3 },{ 1, 1, 1 },{ -4, 3, 0 } }, - { { 0, 0, -2 },{ 0, 2, -1 },{ -4, -3, 2 },{ 2, -1, 3 },{ -4, 2, -4 },{ -3, -2, 1 },{ 0, -2, 2 },{ 2, -3, -3 },{ 3, 1, -3 },{ -3, -2, 3 },{ 1, 2, 2 },{ -4, -2, 1 },{ -1, 0, -1 },{ 2, -3, -3 },{ -4, -2, 0 },{ -1, -4, 2 },{ -3, 3, 1 },{ 0, 1, -3 },{ 2, -4, 2 },{ -4, 3, 1 },{ -1, -3, -4 },{ 2, 3, 2 },{ 3, -2, -2 },{ 1, 1, 1 },{ -1, -1, 3 },{ 3, 3, 0 },{ -1, 1, -2 },{ 3, 2, 1 },{ 0, -2, -4 },{ -4, 1, -3 },{ 3, -3, 0 },{ -4, -1, -3 },{ 3, 3, 1 },{ 0, -2, -4 },{ 1, -2, 2 },{ -2, 0, -3 },{ -1, -3, 1 },{ -2, 3, -4 },{ -3, -3, 3 },{ 1, 0, -3 },{ -3, 2, 2 },{ 3, -3, -1 },{ 2, -4, -4 },{ -1, -1, 0 },{ -2, 1, 2 },{ -4, -3, 2 },{ -1, 3, 0 },{ 1, -2, -1 },{ 3, -4, 1 },{ -4, -3, -2 },{ 1, 2, 0 },{ -1, -2, 3 },{ 0, -4, -4 },{ 2, 3, -3 },{ -2, 1, 2 },{ -1, -4, 0 },{ 3, 2, -4 },{ 0, 3, 2 },{ 2, 1, -4 },{ -1, -1, -2 },{ 0, 3, -4 },{ -2, 1, -2 },{ -1, -2, -1 },{ -3, -4, -4 } }, - { { -3, -3, 3 },{ 3, 0, -3 },{ -2, -4, -2 },{ 2, -1, 0 },{ -3, 1, -3 },{ 3, 3, 0 },{ -2, 0, -2 },{ 2, 2, 3 },{ -1, 1, -1 },{ 0, 3, 1 },{ -2, -4, -4 },{ 2, -4, -3 },{ 0, 0, 0 },{ -3, 1, 1 },{ -1, 2, -4 },{ 2, 1, -2 },{ 1, -3, 3 },{ 3, -1, -4 },{ -1, -2, 0 },{ -2, 0, -1 },{ 1, -3, 0 },{ 0, -1, -4 },{ -3, 0, 3 },{ -2, 3, -1 },{ -4, -3, -3 },{ 2, -4, 2 },{ -2, -2, -3 },{ -4, -3, 3 },{ 2, -1, 2 },{ -2, 3, 0 },{ 1, 0, 3 },{ -2, 0, -1 },{ -1, -3, 0 },{ 2, -3, 3 },{ -3, 2, 3 },{ 3, 3, -2 },{ -3, -1, 0 },{ 3, -2, -1 },{ 0, 2, 1 },{ 2, -4, -4 },{ -1, -1, 0 },{ -1, 0, 3 },{ -3, 2, 1 },{ -4, -4, -4 },{ 0, 3, -2 },{ 2, -3, -2 },{ -3, 0, -3 },{ -3, 1, 1 },{ 1, 3, -4 },{ -2, -1, 3 },{ -1, 1, -4 },{ -3, 2, -2 },{ 1, -4, 1 },{ -4, -1, 0 },{ 0, -3, -2 },{ 2, -2, 3 },{ 1, 0, -1 },{ -4, -2, 0 },{ -2, -4, -3 },{ 3, 1, 3 },{ -1, -2, 1 },{ -4, -1, -3 },{ 2, 2, 3 },{ 2, -1, 2 } }, - { { -2, 1, -4 },{ -2, 3, 1 },{ 1, -2, 1 },{ 0, 1, -4 },{ 0, -3, 3 },{ -1, -4, -1 },{ 1, -1, -3 },{ -2, -4, -4 },{ -4, -1, 1 },{ -1, 0, -1 },{ -3, -1, -2 },{ 2, 2, -2 },{ -3, -2, 2 },{ 1, -1, 3 },{ -4, 3, -1 },{ 1, -1, -3 },{ -2, 0, 1 },{ -4, 2, -1 },{ -3, 3, -2 },{ 3, 1, 3 },{ -4, 1, -3 },{ -1, -4, 1 },{ -4, 2, -3 },{ 1, -3, -2 },{ 2, 0, 0 },{ -1, -1, -4 },{ -3, 3, 0 },{ 1, 1, -2 },{ 0, -4, -2 },{ -1, 2, -1 },{ 1, -2, -4 },{ 0, 2, 2 },{ -3, 2, -3 },{ -1, -4, -1 },{ -4, 0, -1 },{ 1, -4, -3 },{ 2, 1, 2 },{ -1, -1, -1 },{ -4, 3, -2 },{ -2, 1, 0 },{ -4, -3, 2 },{ 3, 3, -2 },{ 1, 0, -3 },{ 0, -2, 2 },{ 3, 0, -1 },{ 2, 2, 3 },{ -1, -1, -3 },{ 0, -3, 0 },{ -4, 1, 2 },{ 2, -4, -1 },{ 3, -1, 0 },{ 2, 0, -3 },{ -4, 3, -1 },{ -2, -2, 3 },{ 1, 1, -4 },{ -1, -3, 1 },{ -3, 3, -2 },{ -3, -4, 3 },{ 0, 0, 0 },{ 2, 0, -1 },{ -3, -3, 2 },{ 3, -4, -1 },{ 0, 0, 0 },{ 1, 2, 0 } }, - { { 3, -4, -3 },{ -4, 3, -1 },{ -1, 0, 2 },{ -3, 2, -3 },{ 2, 3, -1 },{ -4, -2, 2 },{ 3, 2, 0 },{ -3, 3, 2 },{ 2, -3, -2 },{ 3, 1, 2 },{ 0, -3, 0 },{ 3, 2, 3 },{ -1, 3, -4 },{ 3, -3, 0 },{ 0, -4, 2 },{ 3, -2, -2 },{ -1, -4, 3 },{ 0, -2, 1 },{ 1, -4, -4 },{ -2, -1, 2 },{ 3, 2, 2 },{ 2, -1, 1 },{ -3, -4, -1 },{ 3, -2, 2 },{ 0, 2, 1 },{ -2, 1, -1 },{ 3, 2, 2 },{ -1, -3, 1 },{ -3, 0, -3 },{ 3, -1, 2 },{ -3, -4, 1 },{ -4, -2, -2 },{ 2, 1, -2 },{ 3, -1, 1 },{ -2, 1, 0 },{ 1, -2, -4 },{ -3, 2, 2 },{ 0, -3, 3 },{ 1, -4, -3 },{ 2, 0, 3 },{ 1, -2, -4 },{ 0, -2, -1 },{ -2, 2, 3 },{ -3, 1, 0 },{ 1, -1, 1 },{ -2, 1, -4 },{ -4, -4, 1 },{ 3, 2, 3 },{ -2, -2, -2 },{ -3, -2, -3 },{ 0, 3, 2 },{ -1, -3, 1 },{ 1, 0, 2 },{ 3, 1, -1 },{ -3, 2, -3 },{ -1, 0, 2 },{ 3, 2, -4 },{ 2, -1, -2 },{ -1, -3, -3 },{ -2, 2, 1 },{ 1, 2, -2 },{ -2, 3, 2 },{ -3, -2, -3 },{ -1, -3, -2 } }, - { { 2, 1, 3 },{ 0, -2, -2 },{ 1, -3, 0 },{ 3, -1, 3 },{ -2, -4, -2 },{ 0, 0, 1 },{ -1, 1, 3 },{ 1, -3, -3 },{ 0, -2, -4 },{ -2, 2, 3 },{ 1, -2, -3 },{ -4, -4, 1 },{ -2, 0, -1 },{ -2, 1, -2 },{ -3, 1, -3 },{ -3, 2, -4 },{ -2, 3, 0 },{ 2, -1, -1 },{ 2, 3, -3 },{ 1, -2, -3 },{ -1, -3, -2 },{ 0, 0, 0 },{ -1, 3, -4 },{ 2, 3, 3 },{ -3, -2, -2 },{ -4, -1, -4 },{ 0, -4, 3 },{ 1, -2, -3 },{ -4, 3, 0 },{ 2, 1, -4 },{ -2, -3, 3 },{ 3, 1, 0 },{ 1, 3, -4 },{ 0, -1, 2 },{ -1, 3, 3 },{ -1, -3, -3 },{ -4, 1, -2 },{ 3, 0, 0 },{ -2, 2, -4 },{ -3, 1, 1 },{ -1, 3, 0 },{ -3, -1, -2 },{ 3, -4, -4 },{ -4, -3, -3 },{ -1, -4, 0 },{ 1, 3, -2 },{ 2, -2, -1 },{ 1, 0, 2 },{ -1, 3, -4 },{ 2, -1, -1 },{ 0, 2, 3 },{ -4, -4, -2 },{ -2, -2, -4 },{ 0, -3, -2 },{ 2, -1, 1 },{ -4, -4, 0 },{ -2, -1, 1 },{ 1, 1, 3 },{ 0, 3, -1 },{ -4, -2, 2 },{ 1, -1, -4 },{ 2, -3, -4 },{ -4, 1, 0 },{ 0, -1, 2 } }, - { { 1, -4, 3 },{ -3, 0, -4 },{ -1, 1, -2 },{ -3, 2, 2 },{ -4, -3, -4 },{ 2, -1, -3 },{ -2, -2, 0 },{ -4, 3, -1 },{ 3, 0, 1 },{ -3, -4, -1 },{ -1, 3, 0 },{ -4, -1, -4 },{ 1, -2, 1 },{ 2, -1, 2 },{ 2, -3, 0 },{ 1, 0, 3 },{ 0, -3, 1 },{ -4, 1, 2 },{ -3, 0, 0 },{ -2, 2, 1 },{ -4, -3, 3 },{ 0, 1, 0 },{ -2, -1, -3 },{ 1, -4, 2 },{ -1, 1, -1 },{ 2, -3, 1 },{ -3, 0, -3 },{ 3, 2, 2 },{ -2, -1, 3 },{ -1, 3, -1 },{ 1, 0, -1 },{ -2, -1, -3 },{ -1, -4, 3 },{ -3, -2, -2 },{ -4, -3, -1 },{ 3, -4, 1 },{ 2, -1, 1 },{ 0, 3, 2 },{ -4, -4, -1 },{ 3, -3, 2 },{ 1, 0, -1 },{ -2, -2, 3 },{ 2, 1, 2 },{ 3, 3, 0 },{ -1, 0, 3 },{ -3, -3, -2 },{ 0, 1, 2 },{ -3, -4, 0 },{ 3, 0, -3 },{ -2, -3, 1 },{ 1, 1, 0 },{ -3, 0, -4 },{ 3, 2, 1 },{ -1, 3, 3 },{ 0, -2, -1 },{ -2, 2, -4 },{ 1, -3, 2 },{ 2, -2, -2 },{ -4, 1, -3 },{ 3, -4, 0 },{ -1, 0, -2 },{ -2, 0, 3 },{ 3, 3, 1 },{ -4, -2, -1 } }, - { { -2, 3, -1 },{ 3, -3, 1 },{ 2, 3, -3 },{ 0, -4, 1 },{ 1, 1, -1 },{ 3, 3, -4 },{ -3, -3, 3 },{ 0, 1, 1 },{ 2, -1, -2 },{ -2, 2, 3 },{ 2, 0, -3 },{ 0, 1, 2 },{ 3, 3, -2 },{ -1, -4, -1 },{ -1, 3, -4 },{ -4, 2, 2 },{ 2, -4, -2 },{ -1, -1, -4 },{ 3, 0, -2 },{ -3, -4, -1 },{ 3, -2, -4 },{ 1, 2, -1 },{ -4, -2, -4 },{ -3, 0, 1 },{ 2, -3, -3 },{ -1, 3, 0 },{ 0, 1, -1 },{ -2, -2, -2 },{ 0, -4, -4 },{ 3, -3, -2 },{ -4, -4, 2 },{ 0, 2, 1 },{ 2, 0, 1 },{ -3, 3, -2 },{ 2, 2, -4 },{ 0, 0, -3 },{ -3, 0, -1 },{ 1, -2, -4 },{ -1, -2, -2 },{ 2, -1, -3 },{ 0, 2, 1 },{ -4, -4, -3 },{ -1, 2, 1 },{ 0, -1, -4 },{ 2, -1, -1 },{ -2, 2, 2 },{ 0, -1, -4 },{ -4, 2, -1 },{ -2, -2, -2 },{ -4, 3, 1 },{ 1, -1, 3 },{ 2, -3, -2 },{ -1, 2, 0 },{ 2, -1, 2 },{ -4, 0, -3 },{ 3, 1, -3 },{ -3, 3, -1 },{ -1, -2, 0 },{ -2, -4, 1 },{ 2, 1, 3 },{ -3, 2, 1 },{ 0, -3, 2 },{ 1, 2, -2 },{ -1, -1, -3 } }, - { { 1, 1, 1 },{ -1, 0, 2 },{ -4, -1, 0 },{ -2, -2, 3 },{ -1, 0, 0 },{ 0, 2, 2 },{ -3, -4, -3 },{ 1, 1, 0 },{ -4, -4, -4 },{ 3, -2, 2 },{ 0, -3, 0 },{ -3, -3, -3 },{ -3, -3, 3 },{ -4, 1, 1 },{ 1, -2, -3 },{ -2, 1, -1 },{ 3, -2, -3 },{ -1, 3, 3 },{ 1, -3, 1 },{ 0, 3, -2 },{ -2, 0, 2 },{ 3, -4, 3 },{ -3, 3, 1 },{ 1, -1, -2 },{ 3, 2, 3 },{ -4, -2, -4 },{ 2, -1, 3 },{ -4, -3, 1 },{ 1, 2, 1 },{ -3, 1, 0 },{ 2, 3, -3 },{ -4, -1, -1 },{ 3, -3, -4 },{ 1, 1, 0 },{ 0, -2, 2 },{ -2, -4, 3 },{ -2, 2, 1 },{ 2, 1, 3 },{ -3, 2, 0 },{ -3, 3, 3 },{ -2, 0, -4 },{ 2, -3, -2 },{ 1, 2, -1 },{ -3, -2, 3 },{ -4, -3, -3 },{ 3, 1, 0 },{ 1, 3, -3 },{ 3, -3, 1 },{ 2, -4, 3 },{ 0, 1, -4 },{ -1, -2, -1 },{ -3, -4, -4 },{ -2, 1, -3 },{ 1, -4, -1 },{ -3, -2, 2 },{ 2, -4, 3 },{ 0, 0, 1 },{ -3, 2, -2 },{ 3, 3, -4 },{ -3, -1, -3 },{ 0, -2, -4 },{ -3, -4, -1 },{ 3, -1, -2 },{ -3, -4, -4 } }, - { { -4, 2, 0 },{ 0, -3, -4 },{ 2, -1, -2 },{ 1, 3, -3 },{ -4, -3, -2 },{ 2, -2, 1 },{ 3, -2, -1 },{ -1, 3, -2 },{ -2, 0, 3 },{ -3, 1, -4 },{ 1, 3, -1 },{ -2, 2, 0 },{ 3, 0, -4 },{ 1, -1, 1 },{ 0, -4, 0 },{ -3, 0, 3 },{ -3, 0, 2 },{ 1, -2, -1 },{ -2, 1, 0 },{ -4, -1, 3 },{ -1, 2, -3 },{ 2, 1, 0 },{ 0, -3, -2 },{ -1, 1, 2 },{ 0, -4, -1 },{ -2, 2, 2 },{ -3, 0, -3 },{ 3, 3, -2 },{ -1, 0, -4 },{ -2, -1, 2 },{ 1, -2, 3 },{ -1, 2, -3 },{ -2, -4, 2 },{ -4, 0, -1 },{ 3, -1, 0 },{ -1, 3, -3 },{ -4, -3, -2 },{ 3, -1, -4 },{ -1, -3, -1 },{ 0, -4, 2 },{ 3, 1, 0 },{ -4, -1, 1 },{ 3, 3, -3 },{ -2, -2, 0 },{ 0, 0, 2 },{ -2, -4, 1 },{ -1, -2, 3 },{ -3, 0, -2 },{ -1, 2, 2 },{ 1, -2, -3 },{ 3, 2, 2 },{ 2, 3, 1 },{ -4, 0, 3 },{ 3, -3, -1 },{ -2, 3, 0 },{ -4, 0, -2 },{ -1, -1, -4 },{ 2, -3, 3 },{ -2, -3, 2 },{ 1, 0, 2 },{ 1, 1, -1 },{ -1, 3, 0 },{ 2, 1, 2 },{ -2, -2, 3 } }, - { { 3, 0, -2 },{ 2, -2, -1 },{ -3, -4, 3 },{ -2, 1, 1 },{ 3, 2, -1 },{ 0, 0, 3 },{ -4, 2, -3 },{ -1, -1, 1 },{ 1, -3, -1 },{ 3, -4, 1 },{ -1, -1, 2 },{ 2, -1, -2 },{ -4, 2, 3 },{ -1, -2, -3 },{ 3, 2, -2 },{ 2, -3, -3 },{ -1, 3, -4 },{ -4, 1, -1 },{ 2, -4, -3 },{ 2, -2, -4 },{ 1, -3, -2 },{ -3, -1, 1 },{ -2, -2, -4 },{ -4, 1, 0 },{ 3, 0, -4 },{ 1, -3, -1 },{ -1, -4, 0 },{ 0, 3, 3 },{ 2, -4, -2 },{ -1, -1, 0 },{ 3, 1, -3 },{ 0, -3, 1 },{ -3, -2, -2 },{ -1, 1, 3 },{ -3, 2, -4 },{ 1, -2, 0 },{ 1, 0, 1 },{ 0, 3, 2 },{ 1, 1, -1 },{ -4, -3, -3 },{ 1, -2, 3 },{ -1, 1, -2 },{ -3, -4, 2 },{ 0, 1, -4 },{ 2, 0, -2 },{ -4, 2, -1 },{ 1, -3, -2 },{ -2, 1, -4 },{ 3, 0, 0 },{ -3, -1, -1 },{ -4, -3, 0 },{ -2, 0, -2 },{ 0, -1, 1 },{ 0, 1, -3 },{ 1, 2, -4 },{ 3, -3, 2 },{ 1, -2, -1 },{ -4, 1, 0 },{ 0, 3, -2 },{ 3, -2, -1 },{ -4, 2, 3 },{ -4, -3, -4 },{ 1, -1, 1 },{ 0, 3, -3 } }, - { { -3, 0, 2 },{ -1, 1, 0 },{ -1, 3, -3 },{ 0, 1, 2 },{ -2, -3, -4 },{ -3, -1, 0 },{ 1, -4, 2 },{ -2, 1, -4 },{ 2, 3, 0 },{ 0, 0, -3 },{ -4, 2, 3 },{ 0, -4, -2 },{ 1, -4, -1 },{ -2, 1, 2 },{ -3, 3, 2 },{ 1, -1, 1 },{ 0, -4, 0 },{ 3, -1, 3 },{ -1, 3, 1 },{ -3, 0, 2 },{ -4, 2, -1 },{ 1, 3, 1 },{ 3, -4, 3 },{ -3, 3, -2 },{ 1, -1, 3 },{ -3, -1, 1 },{ -2, 1, -3 },{ 3, -2, 2 },{ -4, -3, -1 },{ -4, 2, 0 },{ 0, -4, 1 },{ 2, 0, -4 },{ 2, 3, -1 },{ 1, 1, 2 },{ 3, -4, -3 },{ -2, -2, 1 },{ -1, -4, 3 },{ -4, -1, -2 },{ -3, -2, 0 },{ -2, 0, -4 },{ 3, 3, -2 },{ -2, -1, 1 },{ 1, -2, -1 },{ 2, -3, 2 },{ 1, 3, 3 },{ 3, -1, -4 },{ -3, -2, 3 },{ 2, 1, 0 },{ 0, 3, -3 },{ -4, -4, 3 },{ -1, 2, -4 },{ 2, 1, 3 },{ 1, -2, -2 },{ -3, -4, -1 },{ -1, 3, 0 },{ -2, 0, 1 },{ 0, 2, -3 },{ -3, -4, 1 },{ -1, 0, -3 },{ -2, -4, 1 },{ 3, 1, -2 },{ -1, 0, -3 },{ 2, -3, 0 },{ -2, -4, 2 } }, - { { -4, 2, -1 },{ 1, -2, -4 },{ 1, -1, 3 },{ -4, -4, 0 },{ 3, -3, -2 },{ -1, 3, -4 },{ 2, 0, 1 },{ -4, -3, -2 },{ 2, -2, 2 },{ -3, 2, -2 },{ -3, -2, 1 },{ 2, 1, 0 },{ -2, 0, -4 },{ -1, -3, -1 },{ -4, 0, -2 },{ 2, 2, 1 },{ -4, -3, -2 },{ -2, 2, -4 },{ 3, 0, 0 },{ 0, -3, -2 },{ -1, -4, -3 },{ 2, 1, 2 },{ 0, -1, -3 },{ -1, -2, 0 },{ 2, -4, -3 },{ -1, 3, -1 },{ -4, 2, -2 },{ 0, -1, -3 },{ 2, 0, 3 },{ -2, 3, -4 },{ -3, -2, 2 },{ -2, 3, -2 },{ -4, -1, 1 },{ -1, -3, 0 },{ -2, -1, -4 },{ 2, 2, -2 },{ 2, 1, -1 },{ 3, 1, -4 },{ -1, 3, 1 },{ 2, 2, 3 },{ 0, -4, 2 },{ -4, 0, -4 },{ -1, 2, -1 },{ -4, 2, 0 },{ -2, -4, -3 },{ -1, -1, 1 },{ 0, 3, -1 },{ -4, -4, 1 },{ -2, -1, 2 },{ 1, -2, 1 },{ 0, -3, -3 },{ 3, 3, -1 },{ -3, -4, 1 },{ -4, -1, 3 },{ 2, -2, 2 },{ -2, -3, -2 },{ -4, 1, 2 },{ 3, -1, 3 },{ 2, 2, -4 },{ 1, -1, 1 },{ -2, -2, 0 },{ -1, 1, 3 },{ -3, 3, -4 },{ 3, -4, -2 } }, - { { -2, -3, -3 },{ 3, 3, 1 },{ 0, -2, -1 },{ 2, 2, -3 },{ -4, 0, 2 },{ 1, -2, 0 },{ 0, 3, 3 },{ -2, -1, -3 },{ 3, 0, 3 },{ 0, -4, 0 },{ -1, -1, -4 },{ 1, 3, -3 },{ -3, -2, 1 },{ 3, 3, 3 },{ 1, -2, -3 },{ -2, -4, -4 },{ -1, 0, -1 },{ 0, 1, 3 },{ -3, -2, 2 },{ -2, 2, -2 },{ 3, -2, 3 },{ -2, 0, -4 },{ -4, 2, -1 },{ -2, -3, 1 },{ 0, 2, 2 },{ 3, 0, 1 },{ 2, -3, 3 },{ -1, -3, -4 },{ 1, 1, 0 },{ 3, 1, -2 },{ -1, -3, 3 },{ 3, -1, -1 },{ 1, -4, -3 },{ 0, 2, 3 },{ -4, 0, -1 },{ -3, 3, 3 },{ 0, -3, 0 },{ -4, -1, -1 },{ 0, -4, -3 },{ 3, -3, 0 },{ -3, -2, -1 },{ 2, 1, -3 },{ 0, -3, 3 },{ 3, -1, -3 },{ -3, 1, 0 },{ -2, 2, -2 },{ 2, -3, 0 },{ 3, -3, -4 },{ 1, 1, -2 },{ 2, 2, 0 },{ -3, 0, -2 },{ -1, -1, 2 },{ -1, 1, -4 },{ 2, 3, -3 },{ 1, 0, -3 },{ 2, -1, -1 },{ 0, -4, -4 },{ -1, -2, -1 },{ -3, 3, -1 },{ 1, -3, 3 },{ -4, -4, -2 },{ 0, -1, -1 },{ 2, 2, 1 },{ 1, -1, 2 } }, - { { -1, 1, 3 },{ -3, 0, -2 },{ 0, -3, 0 },{ -3, 2, 3 },{ -2, 0, 1 },{ 2, 1, -1 },{ -1, -4, -3 },{ -3, 2, -1 },{ 1, 1, -4 },{ -1, 3, 3 },{ -4, -3, -1 },{ 2, 2, 1 },{ 3, 1, 2 },{ -1, -3, -1 },{ 0, -1, 0 },{ 2, -1, 3 },{ 3, 3, 2 },{ 1, -4, -1 },{ 2, -1, -4 },{ -4, 3, 0 },{ 0, -4, 1 },{ 1, 1, -1 },{ 2, -3, 3 },{ -3, 3, -2 },{ -1, 0, -4 },{ -4, -4, -2 },{ -2, 3, 2 },{ -3, -2, 0 },{ -3, 2, 1 },{ 0, -4, -3 },{ 1, -3, 0 },{ -3, 2, 2 },{ -2, 1, -2 },{ -1, -2, 2 },{ 3, -4, 1 },{ 0, -2, -3 },{ 1, -3, 2 },{ -2, 2, 2 },{ -1, 0, -2 },{ -3, -1, 3 },{ 1, 2, -2 },{ -2, 3, 1 },{ -1, -1, 2 },{ 1, -3, -4 },{ 0, -2, 3 },{ 3, 3, 2 },{ -4, 0, -3 },{ -1, 1, -1 },{ -2, -1, 3 },{ -3, 3, -4 },{ 2, -4, 1 },{ -2, -2, -1 },{ -4, 2, 2 },{ 3, 1, 1 },{ -3, -3, 0 },{ -4, 3, 3 },{ 3, 2, -2 },{ -1, 1, 2 },{ 2, 0, 0 },{ -4, 2, -3 },{ 3, 1, -4 },{ -3, 3, 2 },{ 0, -2, -2 },{ -4, 0, 0 } }, - { { 2, 2, -4 },{ -2, -4, 1 },{ 3, -1, -3 },{ -1, 1, -4 },{ 1, -3, -3 },{ -3, -4, -2 },{ 3, -1, 0 },{ -3, -2, 2 },{ 2, -4, 1 },{ 3, 0, -2 },{ -2, -1, -3 },{ 0, -3, 2 },{ -4, -4, -2 },{ -2, 0, -4 },{ -3, 2, 0 },{ -4, 2, -3 },{ -2, -3, -2 },{ -4, 2, 1 },{ 1, 1, -3 },{ -3, -3, -1 },{ 2, -1, 2 },{ -3, 2, -2 },{ 1, -2, 0 },{ 0, -1, -4 },{ 3, 1, 3 },{ 1, -2, 0 },{ 0, 1, -1 },{ 1, -1, -4 },{ 2, -2, -1 },{ -4, 3, 3 },{ -4, 0, 1 },{ 2, 0, -4 },{ 3, 3, -3 },{ -4, -1, 0 },{ 2, 1, -4 },{ -3, 3, -2 },{ 3, 0, 0 },{ -2, -2, -4 },{ 1, 3, -3 },{ 3, 1, 1 },{ -2, -2, -4 },{ -4, -4, 2 },{ 1, 0, 0 },{ -3, 1, -1 },{ 2, 0, -1 },{ -2, -4, -4 },{ 1, -2, 3 },{ -3, 2, 2 },{ -1, -2, -1 },{ 0, -3, -3 },{ 3, 2, 3 },{ 0, -1, 0 },{ 1, -4, -2 },{ 0, -3, -4 },{ -2, -2, -1 },{ 0, 0, 1 },{ -2, -4, -4 },{ 1, -2, 1 },{ -3, -3, -3 },{ 0, -1, 1 },{ 2, 0, 3 },{ -2, -4, -4 },{ 3, -2, 2 },{ 1, -3, -1 } }, - { { 0, 3, -2 },{ -1, 2, 2 },{ -4, -2, 1 },{ 2, -2, -1 },{ 0, 3, 2 },{ -1, 3, 3 },{ -4, -1, -4 },{ 0, 2, 1 },{ -4, 3, -2 },{ -1, -2, 2 },{ -3, 2, 0 },{ 1, 1, -2 },{ 2, 0, 3 },{ 0, 3, -1 },{ 2, 1, 2 },{ 3, -2, 1 },{ -1, -2, -3 },{ -1, -4, 3 },{ 3, 1, 2 },{ 0, -2, 1 },{ -1, 3, -4 },{ 3, -4, -3 },{ -2, 1, 2 },{ -4, -4, 1 },{ -2, -1, -1 },{ 2, -2, -3 },{ -3, 2, 3 },{ 3, 0, 2 },{ -1, -4, -3 },{ -1, 1, -2 },{ 0, -2, -4 },{ -2, -1, 0 },{ 1, -4, 2 },{ -1, -3, 3 },{ -2, 2, -2 },{ 0, -4, 1 },{ -4, 1, 3 },{ 2, -4, -1 },{ -4, 2, 1 },{ -1, -3, 3 },{ 0, -3, -1 },{ 2, 1, -2 },{ 3, 2, -4 },{ -2, 3, -2 },{ -4, -2, 1 },{ 0, -4, 1 },{ 1, 3, -3 },{ 3, -1, 0 },{ 2, -4, 1 },{ -4, 1, 0 },{ -2, 0, -3 },{ -4, 3, -4 },{ 2, 2, 2 },{ -1, 0, -1 },{ -3, 3, 3 },{ 1, -1, -3 },{ 3, 2, 0 },{ -4, 1, 3 },{ -1, -3, -2 },{ 3, 3, -1 },{ -2, -4, 0 },{ -1, 1, -1 },{ -4, 3, 1 },{ -3, 0, -3 } }, - { { -2, -2, 0 },{ 2, -4, 3 },{ 1, -1, -2 },{ -4, 1, -1 },{ 0, -3, 2 },{ 3, 0, -1 },{ 1, -2, -2 },{ -2, 1, 2 },{ 1, -3, -3 },{ 0, 0, 3 },{ 3, -4, -4 },{ -1, -1, 1 },{ -4, -2, -3 },{ -3, -4, -1 },{ -1, -3, -4 },{ 1, 1, 3 },{ 0, -1, 0 },{ -3, 0, -4 },{ 2, 0, -2 },{ -2, -3, -1 },{ -4, -1, 3 },{ -1, 0, 0 },{ -3, 3, -3 },{ 2, 2, -2 },{ -1, 3, 0 },{ -2, -4, 1 },{ -4, 3, -3 },{ 0, -3, -2 },{ -2, -1, 1 },{ 2, 2, 3 },{ 3, -3, -1 },{ 0, 3, -1 },{ -3, 2, -3 },{ 2, 0, 1 },{ -4, -3, -1 },{ 1, 0, -3 },{ -1, -1, 2 },{ -3, -2, -2 },{ 1, 0, -4 },{ 2, 1, 0 },{ -3, -1, -3 },{ -1, -2, 2 },{ -4, -4, 3 },{ -1, -1, -3 },{ 2, 2, 3 },{ -3, 1, -2 },{ -4, 0, 0 },{ -2, -3, -4 },{ 0, 3, -2 },{ 1, -1, 3 },{ 3, -2, 2 },{ -1, 0, 0 },{ -3, -3, -3 },{ 2, -1, 3 },{ 3, 1, 0 },{ -4, -4, -4 },{ -1, -2, 2 },{ 2, 0, -1 },{ 0, 3, -4 },{ -3, -2, 2 },{ 1, 2, -3 },{ -4, -2, 0 },{ 1, -1, -2 },{ 3, -3, 3 } }, - { { 0, 1, -1 },{ -3, 0, -4 },{ -1, 3, -4 },{ -2, 0, 0 },{ 2, -4, -3 },{ -3, 2, 1 },{ -2, -3, -4 },{ 3, -1, 0 },{ 2, 0, -1 },{ -3, -4, -1 },{ -2, 3, -4 },{ 1, 1, 1 },{ 3, 2, 0 },{ -2, -1, 3 },{ 2, 2, -2 },{ -4, -4, -2 },{ -2, 3, -1 },{ -4, 3, 0 },{ 2, -4, -3 },{ -3, 2, 1 },{ 1, 2, -2 },{ 1, -2, 1 },{ 3, -1, -4 },{ 0, -3, 2 },{ 1, 0, 1 },{ 2, 0, -4 },{ -1, -3, 3 },{ 3, 1, 0 },{ -3, 3, 0 },{ -4, 0, -4 },{ 1, -1, -2 },{ -2, -4, 3 },{ -1, -2, 2 },{ 0, 1, -2 },{ 3, -2, -4 },{ -1, 1, 0 },{ 2, 3, 2 },{ 3, -1, -3 },{ 0, -4, 0 },{ -2, 3, 1 },{ 3, 3, 2 },{ -2, 0, -2 },{ 1, 0, 0 },{ 0, -3, 2 },{ 0, -1, 0 },{ 3, -2, -2 },{ 2, 2, 3 },{ -1, 0, 2 },{ -3, 1, -1 },{ -3, -4, -4 },{ 1, -3, -2 },{ -2, 1, 1 },{ -3, -4, -2 },{ 1, -2, 1 },{ -2, 2, -2 },{ 0, -3, -3 },{ -2, 3, -1 },{ -2, -1, 3 },{ -4, 0, 0 },{ 2, -1, -2 },{ 0, -3, 3 },{ 2, 1, 2 },{ -1, 2, -4 },{ -2, 0, -3 } }, - { { -4, 3, 1 },{ 1, -3, 2 },{ 3, 2, 1 },{ -2, -3, 0 },{ 3, -2, 3 },{ -4, 0, -3 },{ 0, 3, 1 },{ -1, -4, 3 },{ -4, 2, 0 },{ 0, 3, 3 },{ -1, -2, -2 },{ -4, 0, 2 },{ 2, -3, 0 },{ 0, 0, -3 },{ -3, 3, 2 },{ 0, -1, 1 },{ 3, -2, 1 },{ 1, 2, 3 },{ -1, -3, 2 },{ 3, -1, -1 },{ -2, -3, -3 },{ 0, 1, 3 },{ -4, -4, -1 },{ -3, 1, 3 },{ 3, -3, -1 },{ -3, 2, -2 },{ 1, -2, 2 },{ -2, -1, -1 },{ 1, -4, -3 },{ 0, -3, 2 },{ -4, 2, 1 },{ -3, 1, 0 },{ 2, -1, -4 },{ -4, 3, 1 },{ -3, 2, 3 },{ 1, -4, -2 },{ -2, 2, 1 },{ -3, -3, -1 },{ 0, 1, 3 },{ -4, -1, -2 },{ 1, -3, -1 },{ -4, 2, -4 },{ 3, 3, -1 },{ -3, -4, -4 },{ -2, 2, 1 },{ 1, -3, -4 },{ -2, -2, -3 },{ 0, -4, 1 },{ 3, 3, -3 },{ -1, -2, 1 },{ 3, 2, -1 },{ 0, -1, -4 },{ 2, 3, 2 },{ 3, 0, -1 },{ -4, 3, 2 },{ 1, -2, -3 },{ 2, 1, 1 },{ 3, -4, -2 },{ 1, 2, -4 },{ -2, -4, 1 },{ 3, -2, -3 },{ -3, 3, -1 },{ 0, -4, 1 },{ 2, -4, 3 } }, - { { -1, -2, -1 },{ -3, -1, -3 },{ 2, -1, -2 },{ -4, 1, 3 },{ 0, 3, -4 },{ 2, -1, -2 },{ 1, 1, 0 },{ -3, 2, -2 },{ 2, -2, -3 },{ -2, -1, 1 },{ 3, -1, -3 },{ 1, -3, -2 },{ -3, 3, 3 },{ -2, -2, -2 },{ 1, 0, -4 },{ 2, -4, 0 },{ -1, 1, -3 },{ 0, -3, -4 },{ -4, 1, -2 },{ 1, 0, -4 },{ -1, 1, 2 },{ 2, 3, -2 },{ -2, -2, 0 },{ -1, 3, -3 },{ -2, -1, -4 },{ 0, 2, -2 },{ -4, 1, 2 },{ -1, 0, -4 },{ 2, 3, -1 },{ 3, -2, 3 },{ -1, 0, -3 },{ 1, -3, -3 },{ 3, -1, -1 },{ 1, -4, 2 },{ -2, 0, 0 },{ 3, -3, -3 },{ -1, -2, -2 },{ -2, 0, -4 },{ 2, 2, 2 },{ -1, -2, -4 },{ 2, -4, 0 },{ -2, -2, 3 },{ -1, 1, 1 },{ 2, -1, -2 },{ -4, 1, -1 },{ -1, 0, 2 },{ -4, 3, -1 },{ 0, -1, 0 },{ 2, 1, 2 },{ -4, -1, 3 },{ -1, 2, -3 },{ -4, 1, 3 },{ -1, -3, 0 },{ -2, -4, -4 },{ 0, 2, 0 },{ -3, -1, 2 },{ -1, 1, 3 },{ -3, -3, -3 },{ 0, -1, 1 },{ -1, 0, 2 },{ -3, 1, -1 },{ -2, 3, 0 },{ 1, -1, -2 },{ 3, 0, -4 } }, - { { 1, 2, 3 },{ -1, -4, 0 },{ 0, -3, -1 },{ -2, 2, -2 },{ 1, -4, 2 },{ -1, -2, -1 },{ -4, -3, 2 },{ 3, -3, -3 },{ 0, 0, -4 },{ 1, -4, 2 },{ -4, 1, 0 },{ -1, 1, -4 },{ -1, -4, 2 },{ 3, -2, -1 },{ -4, 2, 1 },{ 2, -3, 2 },{ -3, -1, -1 },{ -2, 0, -2 },{ 3, -2, 1 },{ -4, 3, 3 },{ 0, -4, 0 },{ -3, -1, 1 },{ 2, 0, -3 },{ 1, 2, 2 },{ -1, -4, 1 },{ 3, -4, 3 },{ 2, -1, 0 },{ -4, -3, -3 },{ -2, 1, 1 },{ -3, -4, -2 },{ -1, 3, 0 },{ 2, 2, 3 },{ -2, -2, -1 },{ 0, 3, -4 },{ -1, -3, 1 },{ -4, 2, 3 },{ 1, -1, 1 },{ -4, -4, -1 },{ 3, 3, 1 },{ -3, 0, -3 },{ -2, 2, 2 },{ 0, 0, -1 },{ 0, -3, 3 },{ -3, 3, -3 },{ 3, -2, 2 },{ 1, -4, 3 },{ 3, 2, -2 },{ -3, -3, -4 },{ 1, -3, -1 },{ -2, 0, -2 },{ 1, -2, 0 },{ -3, -4, 1 },{ 1, -1, -3 },{ 3, -1, -2 },{ -4, 0, 3 },{ 0, -4, -4 },{ 2, -2, -1 },{ 1, 2, 0 },{ -4, 3, -2 },{ 3, 1, -4 },{ 1, -3, 3 },{ -4, -2, -3 },{ -2, -3, -2 },{ -4, 0, 1 } }, - { { -2, 1, 2 },{ 2, 3, -3 },{ -4, 0, -4 },{ 3, -2, 1 },{ -3, 3, 0 },{ -1, 1, -4 },{ -3, -1, 1 },{ 2, 3, 2 },{ -2, 2, -1 },{ -3, -2, 3 },{ 3, 2, -1 },{ 2, 3, 1 },{ 0, -1, -3 },{ -4, 0, 0 },{ 1, 1, -4 },{ -1, 1, -3 },{ -3, 3, 3 },{ 2, -4, 2 },{ 0, 2, 0 },{ -2, -2, -1 },{ 3, 0, -3 },{ 1, -3, -1 },{ -3, 1, -4 },{ 0, -3, 2 },{ -4, 1, -1 },{ -3, -2, -3 },{ 1, 1, 1 },{ 3, 3, 3 },{ 0, -2, -2 },{ 1, -1, 2 },{ 3, 1, -4 },{ -4, -4, 1 },{ -4, 1, 2 },{ 0, 0, -3 },{ 2, -1, -2 },{ 3, 1, 0 },{ 0, 3, -4 },{ 1, 0, 3 },{ 1, -4, 0 },{ 0, 1, -2 },{ 2, -1, 1 },{ 3, 2, -3 },{ -4, -4, -4 },{ 2, 0, 0 },{ -2, -3, 0 },{ 0, 2, -3 },{ -1, 0, 0 },{ -4, 1, 1 },{ -1, 3, 3 },{ 2, -4, -4 },{ 0, 0, -2 },{ 3, 3, -1 },{ -2, 3, 3 },{ 2, 1, 1 },{ -1, -3, -1 },{ -2, 3, -2 },{ 1, 0, 1 },{ -3, -3, -3 },{ -2, -2, 2 },{ -1, -4, -1 },{ 2, -1, -1 },{ 3, 2, 1 },{ 0, 1, 3 },{ -1, 2, 0 } } - }, - { - { { 3, -1, -4 },{ 1, -2, 3 },{ 2, -1, 0 },{ -1, 0, 0 },{ -3, -3, 3 },{ -4, 2, -1 },{ 2, -4, 3 },{ 0, 2, -4 },{ 3, -1, -2 },{ -4, 2, 3 },{ 2, 0, -4 },{ 3, -2, -2 },{ -2, -1, 2 },{ -3, 1, 0 },{ -1, -4, -3 },{ -3, -3, 3 },{ 1, -4, -4 },{ 3, -1, 1 },{ -1, -2, 2 },{ -2, -4, -4 },{ 3, -1, 1 },{ -1, 1, 2 },{ -2, -1, -2 },{ 1, 2, 1 },{ -4, 1, 2 },{ 0, -3, -3 },{ 2, -2, -3 },{ -4, 0, -2 },{ 1, -4, 3 },{ -3, 3, -1 },{ -2, -1, -2 },{ 0, -4, -3 },{ -3, 1, -1 },{ 3, 1, -4 },{ -1, -2, -2 },{ 2, -1, -3 },{ -2, 3, -4 },{ -2, -2, -1 },{ 3, 1, -2 },{ 0, -3, 1 },{ 0, -2, 2 },{ -4, 2, -2 },{ -1, -3, 1 },{ 2, -4, -4 },{ -2, 2, -1 },{ -4, 3, -1 },{ -1, -1, -3 },{ 1, 1, 0 },{ -3, -2, 1 },{ 0, 0, -3 },{ -4, 0, -1 },{ 3, 1, -4 },{ 2, -3, 0 },{ -1, 1, -2 },{ -4, 3, 1 },{ -2, 2, 0 },{ -1, -2, 0 },{ -4, 2, 3 },{ -1, -1, 2 },{ 2, -3, 1 },{ 1, 3, -1 },{ -2, -1, 3 },{ 0, -2, 2 },{ -3, 2, -2 } }, - { { -2, -3, -1 },{ -1, -4, 2 },{ -4, 2, -3 },{ 3, -2, -3 },{ 1, 3, -4 },{ 1, 1, 2 },{ -2, 1, 1 },{ -4, -3, -1 },{ 0, 0, 0 },{ -2, -2, -1 },{ -2, 2, 2 },{ 1, -3, 0 },{ 0, -3, -3 },{ 0, 3, -1 },{ 3, -1, 1 },{ 1, 2, -2 },{ -2, 3, -1 },{ -4, 1, -3 },{ 2, 1, -1 },{ 1, 3, 2 },{ -3, -3, -2 },{ 1, 2, -1 },{ 2, -2, -4 },{ -4, -4, -3 },{ 0, 0, 0 },{ 2, 3, 3 },{ -3, -1, 0 },{ 3, 1, -4 },{ -1, 2, 3 },{ 2, 2, -4 },{ 3, 0, 2 },{ -4, -3, -3 },{ -1, 0, 0 },{ 1, 3, 2 },{ -4, 2, -1 },{ -3, -3, 2 },{ 1, 3, 0 },{ -1, 0, 3 },{ 2, -3, -3 },{ -2, -4, 1 },{ 2, 1, -4 },{ -3, 0, -2 },{ 3, -2, 3 },{ 0, 1, -3 },{ -3, -2, 1 },{ 3, -3, 1 },{ 1, -1, 3 },{ -2, 3, 2 },{ 2, 2, -2 },{ -1, -3, 3 },{ -2, -1, -2 },{ 2, 2, 2 },{ -3, -2, 3 },{ 1, -2, -3 },{ -3, -4, -2 },{ 3, 0, 3 },{ 1, -2, -3 },{ -2, 1, -4 },{ 3, -4, 0 },{ -3, 1, -4 },{ -1, 0, 3 },{ -4, 2, -3 },{ 3, 1, 0 },{ -3, 3, 1 } }, - { { 3, 0, -4 },{ -1, 3, 1 },{ -2, 0, 0 },{ 0, -3, 3 },{ -2, -1, 1 },{ 3, -4, -2 },{ -3, -2, 0 },{ 1, 3, -4 },{ 3, -4, 2 },{ 1, -1, -2 },{ 2, -4, 1 },{ -4, 1, -4 },{ -1, 3, 3 },{ 2, 0, -4 },{ -4, -2, 0 },{ -1, 0, 2 },{ 2, -3, 3 },{ -1, -1, 0 },{ 0, -2, -4 },{ -3, 0, -3 },{ -4, 0, 0 },{ 0, 1, 3 },{ -1, -3, 1 },{ 3, 3, 3 },{ -2, 1, -1 },{ -1, -3, -2 },{ -3, 2, 1 },{ 1, -4, -1 },{ 0, -3, -3 },{ -4, -2, 1 },{ -1, -2, -1 },{ 2, -1, 3 },{ 0, 2, -4 },{ 2, -4, 0 },{ -2, -3, 3 },{ 0, 0, -3 },{ -4, -4, 1 },{ 0, -1, -1 },{ -4, 2, 2 },{ -3, 3, -3 },{ 3, 0, 0 },{ 1, -4, 2 },{ -2, 3, -1 },{ 1, -1, -2 },{ -4, 0, -4 },{ 0, 2, 2 },{ -1, -2, -3 },{ -3, -4, -1 },{ 0, 0, -4 },{ 3, -4, 0 },{ 1, 2, -4 },{ -4, -4, -1 },{ -1, 0, 2 },{ 0, 3, -4 },{ 2, -1, -1 },{ -4, 1, 2 },{ 0, -3, 1 },{ -3, -1, -2 },{ 0, 3, -3 },{ 2, -3, -1 },{ -4, -2, 1 },{ -1, -3, -3 },{ 2, -4, -2 },{ 0, -1, -1 } }, - { { 1, -3, -3 },{ -4, 1, 3 },{ 2, 2, -2 },{ -3, -2, -1 },{ 0, 1, -4 },{ -4, -1, -2 },{ 2, 0, 2 },{ -1, 2, -3 },{ -3, 1, 3 },{ -1, 3, -3 },{ 0, -1, -3 },{ -3, 1, -1 },{ -3, -2, 1 },{ 1, 1, 2 },{ -2, -4, -3 },{ -3, 2, -4 },{ 2, -3, -2 },{ -2, 3, 0 },{ 3, -4, 3 },{ -1, 3, 3 },{ 3, -4, -1 },{ 1, -1, -4 },{ -3, 0, -3 },{ -2, -2, 2 },{ 3, -1, -3 },{ 1, -4, -4 },{ -4, -1, 2 },{ 0, 1, 2 },{ -2, 0, -2 },{ 3, 3, 2 },{ -3, -4, 0 },{ 1, 3, -2 },{ -3, 0, 1 },{ 3, -2, 2 },{ 2, -1, -2 },{ -1, 0, -2 },{ 3, 1, -4 },{ 2, -2, 2 },{ -2, -2, -2 },{ 1, 1, -1 },{ -1, -1, 3 },{ -4, 2, -3 },{ -1, -3, 1 },{ 2, 3, 2 },{ -3, 1, 0 },{ 2, -4, -2 },{ 3, 0, 0 },{ -4, 2, 0 },{ 1, 1, -2 },{ -4, -1, 3 },{ -1, 3, 0 },{ 0, -3, -3 },{ -2, 0, 1 },{ 3, 2, 3 },{ -2, -3, 0 },{ -1, 3, -3 },{ 2, -4, -1 },{ 1, 2, 3 },{ -3, -2, 2 },{ 1, 0, 2 },{ -2, 2, -2 },{ 0, 3, 3 },{ 1, -2, 1 },{ -4, 1, 2 } }, - { { -2, 2, -4 },{ 1, -2, 0 },{ 3, -4, -3 },{ 2, -3, 2 },{ -2, 1, 1 },{ 1, 3, 3 },{ -1, -3, -3 },{ 0, -2, 0 },{ -4, -1, 1 },{ 3, -3, -1 },{ -2, -2, 3 },{ 3, 2, 2 },{ 2, -4, -2 },{ -2, -3, -2 },{ 3, -1, 1 },{ 0, -1, -1 },{ -4, 1, 2 },{ 0, 2, -4 },{ 1, -1, -2 },{ -3, -2, 1 },{ 2, 2, -2 },{ -2, -3, 1 },{ 0, 3, -2 },{ -4, 1, 0 },{ 1, 0, 2 },{ -1, 2, 0 },{ 2, -2, -2 },{ 2, 3, 0 },{ -2, -1, 1 },{ -4, -4, -4 },{ 1, 1, 3 },{ -1, 1, 0 },{ -3, -3, -3 },{ -2, 2, -4 },{ -4, 1, -1 },{ 0, 3, 1 },{ -3, -3, 3 },{ 1, 2, -1 },{ 3, 1, -4 },{ 0, -3, 0 },{ 2, -3, 1 },{ -3, 0, -4 },{ 3, -2, -1 },{ 0, -4, -3 },{ -2, 2, 3 },{ -1, -3, -1 },{ 0, 3, 3 },{ -2, -3, -4 },{ 3, -2, 2 },{ -2, 2, 2 },{ 1, 1, 1 },{ 3, -3, -3 },{ -3, -1, -1 },{ 1, -4, -2 },{ -3, 1, 2 },{ 3, -2, -4 },{ -4, 3, 1 },{ -2, 0, -1 },{ -1, -4, -4 },{ 2, 3, 0 },{ 3, -1, -3 },{ -2, 0, -4 },{ 3, -1, -1 },{ -2, 0, 2 } }, - { { 2, -4, 1 },{ -3, -1, -1 },{ 0, 0, 1 },{ -1, 3, -3 },{ -4, 2, -1 },{ 3, -2, 0 },{ -3, -4, -4 },{ 2, 2, 1 },{ 2, 2, -2 },{ -4, -4, -4 },{ 1, 0, 0 },{ 0, 3, 0 },{ -1, -1, -4 },{ -4, 2, 3 },{ 0, 3, 0 },{ -1, 0, 3 },{ 3, -2, -3 },{ -3, -4, 0 },{ -4, 0, 2 },{ 2, 1, -3 },{ -2, 2, 0 },{ -4, -4, 2 },{ -1, 2, 3 },{ 2, -4, -1 },{ 0, -3, -4 },{ -3, 3, 3 },{ -3, -3, -2 },{ 3, 1, -4 },{ 0, -2, 3 },{ 2, 2, -1 },{ 0, 0, -2 },{ 3, -2, -4 },{ -2, -2, 2 },{ 0, 3, -1 },{ 1, -4, 3 },{ 2, -2, -3 },{ -4, 2, 1 },{ -2, -4, 0 },{ -3, -1, -3 },{ -1, -4, 3 },{ -4, 3, -2 },{ 1, -1, 0 },{ 0, 2, 2 },{ -2, -3, 0 },{ -4, -1, -4 },{ 3, -2, 1 },{ 1, 1, 1 },{ -3, -1, -3 },{ 2, 0, -3 },{ -1, -4, -1 },{ -3, -2, -4 },{ 2, 0, 3 },{ -4, 3, -1 },{ 2, -1, 1 },{ -4, 2, -2 },{ 0, 0, 3 },{ -1, -3, 0 },{ 3, -1, -3 },{ 0, 1, -2 },{ -4, -3, 0 },{ -3, -4, 1 },{ -1, 2, 3 },{ -3, -3, 0 },{ -1, 3, -2 } }, - { { 3, 1, 3 },{ 0, 3, 2 },{ -4, 0, -4 },{ -1, -1, 3 },{ 1, -4, -2 },{ 1, 0, -1 },{ -2, -1, 3 },{ -2, 0, -1 },{ 0, 0, 2 },{ 1, 1, 3 },{ -2, -3, -2 },{ -3, -2, 1 },{ 3, 0, -4 },{ 2, -2, -3 },{ 1, 1, 1 },{ -3, -4, -3 },{ 2, 2, 2 },{ -1, 3, -2 },{ 1, -3, 1 },{ 0, -2, -4 },{ -1, -3, 1 },{ 3, -1, -4 },{ 1, -1, -2 },{ 3, 1, 1 },{ -4, -2, -3 },{ -2, 0, 1 },{ 1, 2, -1 },{ -1, 0, -3 },{ -4, -3, 1 },{ -3, -3, -3 },{ 1, 3, 1 },{ -4, -4, 2 },{ 2, -1, -2 },{ 3, 1, 1 },{ -1, 0, 3 },{ -2, -3, 0 },{ 0, -1, -3 },{ 3, 0, 2 },{ -1, 3, -1 },{ 2, 1, 3 },{ 1, 2, -2 },{ -3, -1, 1 },{ -3, 1, -4 },{ 2, 0, -2 },{ 1, 3, 2 },{ -3, 0, -3 },{ 0, -4, -2 },{ -1, 3, 3 },{ 2, -3, -1 },{ 0, 2, 1 },{ -4, 0, -2 },{ -1, -2, 0 },{ 0, 3, -4 },{ 0, -3, 2 },{ -1, 0, -4 },{ 1, -4, -1 },{ -3, -1, -3 },{ 2, 2, 1 },{ -2, 1, 3 },{ 2, 0, 2 },{ 1, -2, -1 },{ 0, 1, -3 },{ 2, -4, -4 },{ -4, -2, -2 } }, - { { 0, -3, 2 },{ -2, 1, -1 },{ 2, -3, -3 },{ -2, -3, 0 },{ 3, 1, -4 },{ -4, 3, 1 },{ 3, 1, -2 },{ 0, -2, -4 },{ -3, -4, 0 },{ 3, 3, -2 },{ -4, 1, -3 },{ -1, 2, -1 },{ 0, -3, 3 },{ -4, -4, 2 },{ -2, 1, -1 },{ -3, -3, -4 },{ 1, 0, 1 },{ -2, -1, -1 },{ 3, 1, -1 },{ -3, 3, 3 },{ -4, 0, -3 },{ 0, 3, -1 },{ -3, 0, 0 },{ 1, -2, -3 },{ -2, 2, 3 },{ -1, -4, -1 },{ 3, -1, 2 },{ 0, -1, -2 },{ -2, -4, 3 },{ -1, 1, -4 },{ 2, 0, 0 },{ -2, 3, 3 },{ -4, -3, -1 },{ 0, 0, -3 },{ -3, 2, -2 },{ 3, -1, -4 },{ -4, -3, -1 },{ 1, 2, -2 },{ -2, -2, -4 },{ -4, 0, 1 },{ -2, -3, -3 },{ 3, -2, -1 },{ -1, -4, 3 },{ 2, 1, -1 },{ -4, -2, 1 },{ 3, 0, 0 },{ -2, -3, -1 },{ -4, 2, 2 },{ -3, -1, 0 },{ 3, 3, -4 },{ 1, -4, 3 },{ -2, 1, 2 },{ 3, -3, -3 },{ 3, 2, 1 },{ -2, -3, 0 },{ 2, 1, 1 },{ -3, 2, 2 },{ 1, -4, -4 },{ -4, -2, -2 },{ -1, 3, -4 },{ -3, 3, 1 },{ 3, 0, -1 },{ -1, -1, 1 },{ -4, 2, -3 } }, - { { 1, 0, -3 },{ 1, -4, -2 },{ -3, 2, 1 },{ -1, 2, 3 },{ 0, -1, 2 },{ -3, -2, 1 },{ -1, -3, -3 },{ -4, 3, 2 },{ -1, -3, 1 },{ 1, -1, -4 },{ 3, -2, 2 },{ -2, -4, 0 },{ 1, 3, -1 },{ -1, -1, -2 },{ 2, 2, 0 },{ -1, -2, 3 },{ 3, -3, -2 },{ -4, 3, -4 },{ 0, -4, 0 },{ 2, -2, 2 },{ 2, -3, 0 },{ -2, 2, 2 },{ 3, -4, 3 },{ -1, -3, -1 },{ 0, 3, 2 },{ 2, 1, -4 },{ -4, -3, 2 },{ 1, 2, 0 },{ 3, 3, 1 },{ -3, -1, -1 },{ -1, 0, -2 },{ 1, 2, 2 },{ -3, -2, -4 },{ 1, -4, 1 },{ -2, 2, 2 },{ 1, -2, 0 },{ -1, 3, 2 },{ 2, 1, 3 },{ 1, -4, 0 },{ 0, -2, 2 },{ 0, 3, -2 },{ 3, -1, 2 },{ -1, 2, 2 },{ -2, -4, -3 },{ 0, 3, -2 },{ -1, -3, 3 },{ 1, 1, -3 },{ 0, -2, -4 },{ -2, -1, 2 },{ 1, 1, -2 },{ -4, -4, -1 },{ -2, -1, 1 },{ 1, 1, -1 },{ -3, 0, -2 },{ -4, -2, -3 },{ 0, 3, 3 },{ 3, -2, -1 },{ -2, 0, 3 },{ 0, -3, 1 },{ 3, -4, -1 },{ -2, -1, -3 },{ 1, -3, 3 },{ -2, 2, 2 },{ 2, -1, 0 } }, - { { -1, -2, -2 },{ -4, -1, 3 },{ 3, 3, -4 },{ 1, -2, 0 },{ -2, -4, -1 },{ 2, 0, -2 },{ 2, 2, 3 },{ 2, -4, -1 },{ 1, 0, -1 },{ -2, 2, 3 },{ 0, -1, -3 },{ -4, 0, 1 },{ 2, 2, -4 },{ 3, 1, 1 },{ -3, -1, -3 },{ 0, 3, 0 },{ -2, 2, 2 },{ 1, 0, 3 },{ -3, 1, -3 },{ -1, -1, -2 },{ -4, -4, -3 },{ 1, 1, 1 },{ -3, -2, -4 },{ -4, -1, -2 },{ 2, 2, -2 },{ -1, 0, 0 },{ -3, -3, -4 },{ -2, -2, -3 },{ 0, 1, -1 },{ 2, -2, 3 },{ 0, -4, -4 },{ 3, -3, 0 },{ -1, -1, -1 },{ 3, 1, -3 },{ -4, 3, 3 },{ 2, -4, -2 },{ 0, 1, -2 },{ -3, -3, -3 },{ -3, -1, 1 },{ 2, 2, -3 },{ -1, -4, -4 },{ -3, 1, 0 },{ -4, 0, -3 },{ 1, -1, -4 },{ 3, -2, 1 },{ -3, 3, 2 },{ 2, 0, -4 },{ 3, 2, 1 },{ -1, -4, 3 },{ -1, 3, -3 },{ 2, -2, 0 },{ 2, 2, -4 },{ -1, -1, 3 },{ -3, 3, 2 },{ 1, -4, -2 },{ -2, -1, -4 },{ -1, 1, -1 },{ 1, 3, -3 },{ -3, -1, 0 },{ 1, 0, -4 },{ -4, 2, 2 },{ 0, 1, -2 },{ -3, -4, -4 },{ 2, 3, 0 } }, - { { 0, -3, 2 },{ -2, 1, -1 },{ 3, 0, 1 },{ -4, -3, -2 },{ 1, 1, -3 },{ -2, 3, -4 },{ -3, -1, 2 },{ 0, 1, -2 },{ -4, -2, -3 },{ -3, 3, 2 },{ 2, 1, 0 },{ -1, -3, -2 },{ -2, -2, 2 },{ 0, -4, 3 },{ -4, 0, -4 },{ 2, -3, 1 },{ -1, -4, -1 },{ -4, -2, 1 },{ 3, 2, -2 },{ 1, -3, 2 },{ -1, 3, -4 },{ 3, 0, -1 },{ 0, 1, 2 },{ 1, -1, 0 },{ -2, 3, -3 },{ -3, -4, 1 },{ 1, 1, 3 },{ 3, 3, 1 },{ -4, -4, -3 },{ -3, 0, -3 },{ -4, 2, 1 },{ -2, 3, -2 },{ 2, 1, 3 },{ -3, -3, -1 },{ -1, 0, 0 },{ 2, -2, -4 },{ -2, -1, 1 },{ -4, 2, -1 },{ 3, 0, 1 },{ -1, 0, -1 },{ -4, 2, 3 },{ 1, -3, -1 },{ 2, 3, 1 },{ 0, -3, 3 },{ -2, 1, -1 },{ -4, -4, -2 },{ -2, -1, 0 },{ -4, -3, -1 },{ 1, -2, -2 },{ -3, 0, 2 },{ -3, 0, 0 },{ 0, -3, -3 },{ -4, -2, -4 },{ 3, -4, 0 },{ 2, 0, 1 },{ 0, 2, 0 },{ 3, -3, 2 },{ -4, -4, -2 },{ -1, 1, 3 },{ 3, 2, 1 },{ 2, -2, 3 },{ -1, -3, -2 },{ 3, 3, -1 },{ -3, 0, 1 } }, - { { 1, -2, 3 },{ -1, 3, -3 },{ -3, 0, 0 },{ 0, -4, 2 },{ -4, 3, 0 },{ -1, -2, 3 },{ 3, -3, 1 },{ 1, -1, 0 },{ -2, -4, -2 },{ 3, 0, 0 },{ 0, -3, -4 },{ -4, 3, -1 },{ 3, 0, -3 },{ 1, -2, 0 },{ -3, 2, -2 },{ 2, 1, -2 },{ -2, -1, -4 },{ 2, 0, -3 },{ 0, -2, 0 },{ -1, 2, 3 },{ -2, -1, 1 },{ -4, -3, 0 },{ 1, 2, -3 },{ -1, -3, 3 },{ 3, -4, 2 },{ 2, 0, -1 },{ 0, -2, -2 },{ -1, -1, 2 },{ 2, 1, 0 },{ 1, -3, 2 },{ 0, -1, 3 },{ -3, -2, 1 },{ -2, 1, -3 },{ 1, -3, 2 },{ 0, 0, -4 },{ -3, 2, 1 },{ 3, -4, 3 },{ 1, -3, 0 },{ 0, 3, -4 },{ 2, -4, 3 },{ -2, -1, 2 },{ 3, -2, -4 },{ -3, -4, -2 },{ 3, 0, 0 },{ -1, 1, 1 },{ 1, -2, -4 },{ 2, 2, 3 },{ -2, 3, 0 },{ 3, 1, -3 },{ 0, -3, 1 },{ -2, 2, 2 },{ 3, 3, -1 },{ -1, 1, 1 },{ 0, 1, -1 },{ -2, -3, 3 },{ -3, 3, -3 },{ -4, 0, 2 },{ 2, -2, -4 },{ 0, 3, -1 },{ -2, -1, -3 },{ -4, -4, 0 },{ 0, -1, -3 },{ -2, -2, 2 },{ -4, 2, -4 } }, - { { 3, -1, -1 },{ -1, -3, -4 },{ 2, 1, -2 },{ 2, -1, 3 },{ 3, 2, -4 },{ 0, 0, -1 },{ -3, 1, -3 },{ 0, 2, -4 },{ -2, -1, 3 },{ 2, -4, 1 },{ -1, 2, 3 },{ 1, -1, 2 },{ -3, -1, -1 },{ -1, -4, 2 },{ 1, 3, 0 },{ 3, -3, 2 },{ -3, 1, 3 },{ -4, -4, 2 },{ -2, 3, -4 },{ -3, 1, -1 },{ 3, -4, 2 },{ 2, 0, -2 },{ -2, -2, -4 },{ -3, 1, 0 },{ -4, 2, -1 },{ 0, -2, -4 },{ 1, 2, 3 },{ -3, 2, -4 },{ -2, -3, -1 },{ 3, 3, 0 },{ -1, 0, -2 },{ 3, -4, -4 },{ 2, 2, -3 },{ -4, -4, -1 },{ 3, 3, 2 },{ -4, -1, -2 },{ 0, 1, -3 },{ -1, -2, 2 },{ -2, 0, -2 },{ -4, -2, -2 },{ 1, 1, 0 },{ -1, 2, -1 },{ -2, -1, -3 },{ -4, 2, 3 },{ 2, 3, -3 },{ -3, -1, -2 },{ 0, 0, 2 },{ -1, -4, 3 },{ 2, 1, -3 },{ -4, -2, -4 },{ 2, -4, -2 },{ 1, -1, 3 },{ 1, -4, -3 },{ -4, 2, -2 },{ 2, -2, -4 },{ -1, -1, -1 },{ 1, 1, -2 },{ -1, -2, 1 },{ -3, 0, 2 },{ 2, -3, -4 },{ -1, 3, 1 },{ -3, 1, 0 },{ 1, 0, -2 },{ 2, -4, 2 } }, - { { -3, 1, -3 },{ 0, 2, -1 },{ -4, -4, 1 },{ -3, -2, 2 },{ -1, -1, -2 },{ -2, -4, 0 },{ 2, -3, 3 },{ -4, 3, 2 },{ 2, -3, -3 },{ -3, 3, -1 },{ -4, 1, -3 },{ -2, -2, -4 },{ 3, 3, 1 },{ -4, 1, 3 },{ -2, 0, -4 },{ -1, -1, -1 },{ 0, 2, 0 },{ 3, 3, -2 },{ 1, -3, 1 },{ 2, -1, -3 },{ -3, -2, -2 },{ 0, 2, 2 },{ -1, 3, -4 },{ 2, 0, 1 },{ -2, -1, 1 },{ -2, 3, -3 },{ -4, -4, 0 },{ 2, 0, 3 },{ -4, -1, -2 },{ 1, 1, -4 },{ -3, -2, -1 },{ 1, -2, 2 },{ 0, 0, 0 },{ -1, 2, 3 },{ -2, -2, 0 },{ 1, -3, -1 },{ -3, 0, -3 },{ 2, 3, 0 },{ 1, 2, -4 },{ -3, -3, 2 },{ 3, 3, -3 },{ 0, 0, 3 },{ -3, -3, 1 },{ 0, 2, 2 },{ 3, -4, 0 },{ 0, -2, -1 },{ -2, -3, -4 },{ -4, -1, 1 },{ 1, 3, -2 },{ -3, -1, -1 },{ -1, 0, 0 },{ -2, 1, 2 },{ -1, -1, -3 },{ -3, 0, 1 },{ 0, 3, 3 },{ 3, -4, 0 },{ -2, 1, -4 },{ 3, -4, 3 },{ 1, 2, 0 },{ -3, 0, -1 },{ 1, 1, -3 },{ 3, -3, 3 },{ -1, -3, -2 },{ -4, 2, 1 } }, - { { 0, -2, 3 },{ -2, 3, 1 },{ 3, 0, -4 },{ -1, 2, -2 },{ 1, 1, -3 },{ -3, -2, 1 },{ 3, 0, -2 },{ -1, 1, -1 },{ -1, -1, 1 },{ 3, 1, 2 },{ 1, -2, -2 },{ 0, -4, 0 },{ 2, -3, -2 },{ 2, -3, -3 },{ 0, 2, -1 },{ -4, -4, -3 },{ 1, -2, 1 },{ -3, 0, -3 },{ -1, -1, 3 },{ 0, 0, -1 },{ 2, 2, 0 },{ -4, -4, 3 },{ 1, -2, -1 },{ 3, -4, 3 },{ 1, -3, -2 },{ 3, -3, -1 },{ -1, 1, -2 },{ 0, -2, 1 },{ 2, -4, 2 },{ -1, 3, 1 },{ -2, -4, -3 },{ -4, 2, 3 },{ -2, -1, 1 },{ 3, -1, -2 },{ 1, 3, -4 },{ -1, -3, 3 },{ 3, 1, 1 },{ -4, -4, 2 },{ -2, -1, -1 },{ 2, -4, 1 },{ -1, 1, 0 },{ 1, -1, -2 },{ -2, -3, -3 },{ 2, -2, -4 },{ -4, 0, -2 },{ -1, 2, 2 },{ 2, 1, -3 },{ 3, 1, 0 },{ -2, -4, 2 },{ 0, 2, 3 },{ 3, -3, -4 },{ -4, 2, 0 },{ 3, -2, -2 },{ 2, -4, 2 },{ 0, 2, 1 },{ -4, -1, 2 },{ -2, -3, -3 },{ -4, 3, -2 },{ 2, -1, 2 },{ -2, -4, -2 },{ -3, -1, -4 },{ 2, 3, 2 },{ -2, 2, 0 },{ 1, -1, -3 } }, - { { 2, -2, 0 },{ 1, -4, 3 },{ 2, 0, 0 },{ -4, -3, 2 },{ 1, 3, 1 },{ -4, -4, 3 },{ 1, 2, -4 },{ -3, -4, -3 },{ 0, -1, 0 },{ 1, -3, -2 },{ -2, 0, -4 },{ -3, 3, 3 },{ -1, 0, 1 },{ -3, 1, -4 },{ 2, 0, 3 },{ -2, 3, 2 },{ 3, -2, -2 },{ -4, -4, 0 },{ -1, 1, 2 },{ 3, -3, 0 },{ -4, 3, -4 },{ -2, 0, 1 },{ -1, -1, 0 },{ -3, 3, -3 },{ 0, 2, 2 },{ -3, 0, 3 },{ 1, -4, -4 },{ -2, 2, -3 },{ -4, 0, 2 },{ -1, 1, -2 },{ 2, 3, 3 },{ 3, 1, 0 },{ 1, -3, -4 },{ -3, -4, -1 },{ -3, 1, 1 },{ 0, -2, -2 },{ -2, 2, -4 },{ 3, 2, 3 },{ 0, 0, -2 },{ 2, -2, 3 },{ -4, 2, -4 },{ -3, -4, 1 },{ 3, 3, -1 },{ -1, 1, 0 },{ -3, -4, 3 },{ 1, 3, -2 },{ -3, -1, 3 },{ 1, -3, -1 },{ -3, -2, 1 },{ 0, 3, -3 },{ 2, 0, 1 },{ -2, -4, 3 },{ 1, 3, -1 },{ -2, -2, -4 },{ -3, 1, -1 },{ 2, 0, -3 },{ 1, 0, -1 },{ 0, 2, 3 },{ -1, -2, 1 },{ 3, 2, -1 },{ -4, -2, 3 },{ 0, -2, -1 },{ -1, 0, -4 },{ -3, -4, -1 } }, - { { -4, 1, -2 },{ -1, 3, -3 },{ -2, -2, -2 },{ 0, -1, -1 },{ 3, -1, -4 },{ -2, 3, -1 },{ 2, 1, 0 },{ 0, -2, 2 },{ -2, 3, 1 },{ -3, 2, 3 },{ -4, -4, 1 },{ 3, 2, 0 },{ 0, -1, 2 },{ 1, -2, -1 },{ -4, -1, 0 },{ 1, -3, 2 },{ -2, 1, -4 },{ 2, 3, -3 },{ 1, -1, -1 },{ -3, -2, -4 },{ 0, 1, -2 },{ -2, -4, -3 },{ 2, 1, -2 },{ 3, -2, 0 },{ -4, -1, -4 },{ -2, 1, 1 },{ 2, 3, 0 },{ 3, 2, -1 },{ 1, -1, 0 },{ 3, -3, -4 },{ -3, -2, -1 },{ 0, -1, -4 },{ -1, 0, -2 },{ 0, 2, 2 },{ 2, 1, -3 },{ -4, -4, 1 },{ 1, -1, -1 },{ -1, -3, -3 },{ -3, -2, -2 },{ 0, 3, -1 },{ -1, 0, -3 },{ 1, 2, 3 },{ -2, -2, 2 },{ 0, -1, -4 },{ 3, 0, -1 },{ 2, 1, 1 },{ -1, -3, -4 },{ -4, 2, 0 },{ 3, 0, -4 },{ 1, -2, -2 },{ -4, 1, -1 },{ 0, -2, -3 },{ -3, 0, 0 },{ -1, 3, -2 },{ 3, -3, 3 },{ -1, 1, 1 },{ -3, -3, -1 },{ 3, -4, 0 },{ -2, 0, -4 },{ 0, 3, -3 },{ 1, 1, 0 },{ 3, -4, -2 },{ -4, 2, 2 },{ 3, 0, 1 } }, - { { 2, -3, 2 },{ -2, 2, -4 },{ -3, -4, 0 },{ 0, 2, 3 },{ -3, -3, 2 },{ -1, -3, -2 },{ 1, -1, 3 },{ -4, -3, -3 },{ 3, 1, -1 },{ 2, 0, -4 },{ 3, -3, -3 },{ 0, -1, -1 },{ -1, 2, -3 },{ -2, -4, -2 },{ 3, 3, -4 },{ -1, -3, -2 },{ 0, 2, 0 },{ 0, 0, 3 },{ -3, -4, 2 },{ -2, -3, 3 },{ 3, 2, 1 },{ 2, 0, 2 },{ 0, -3, 3 },{ -3, 2, -1 },{ -1, 0, -1 },{ 1, -4, -3 },{ -4, -2, 2 },{ -1, -2, 3 },{ -3, -3, -3 },{ 0, 0, 2 },{ -4, 2, 1 },{ -2, -4, 1 },{ -4, 3, 2 },{ -2, -3, 0 },{ 3, -2, 3 },{ -1, 3, -4 },{ 2, 0, 2 },{ -3, -3, 0 },{ -2, 1, 2 },{ 1, -3, 1 },{ 2, -4, 0 },{ 3, 1, -2 },{ -4, 0, -3 },{ 1, -3, 1 },{ -4, 2, 0 },{ -2, -4, -3 },{ 0, -2, 0 },{ -2, -1, 2 },{ 2, 3, -1 },{ -1, -4, 3 },{ -1, -1, -2 },{ 3, 2, 2 },{ -4, -3, 1 },{ 2, -1, 2 },{ -4, -4, -4 },{ 1, -1, 0 },{ -1, 2, -4 },{ 2, -2, 2 },{ -3, -3, -2 },{ -4, -1, 1 },{ -2, -3, 3 },{ -3, -1, 0 },{ -1, 3, 1 },{ 0, -3, -3 } }, - { { -3, -1, -1 },{ 1, 0, 1 },{ 1, 0, 2 },{ 3, 1, -3 },{ 2, 2, -3 },{ -1, 0, -1 },{ -3, 0, 1 },{ 2, 3, -2 },{ -1, -4, 2 },{ -4, -2, 0 },{ -1, 3, -1 },{ -2, 1, 2 },{ 2, -4, 3 },{ -4, 0, 0 },{ 2, 1, 1 },{ -3, -1, 3 },{ -3, -1, -3 },{ 3, 2, 1 },{ -4, 1, -3 },{ 1, 2, -2 },{ -1, -1, -1 },{ -3, -3, -3 },{ -4, 3, 1 },{ 1, -4, -4 },{ 2, 3, 3 },{ 3, -3, -2 },{ 0, -1, 1 },{ 0, 1, -4 },{ -2, 3, -2 },{ 2, -4, 0 },{ 1, 2, -3 },{ 2, 0, -1 },{ 3, -1, -2 },{ 1, -2, -3 },{ -1, 1, 0 },{ -4, 0, -3 },{ 1, -1, 3 },{ 0, 3, -1 },{ 3, 2, -4 },{ -4, -1, 3 },{ -1, 0, -3 },{ -3, -3, -1 },{ -2, -1, 2 },{ -1, 3, -2 },{ 0, -2, 3 },{ -3, 1, 3 },{ 3, -4, -2 },{ 1, 2, 2 },{ -4, 1, -3 },{ -3, -3, 3 },{ -2, 3, 0 },{ 2, -4, -4 },{ -1, 0, -2 },{ 1, 2, -3 },{ -2, 2, 0 },{ 0, -2, -2 },{ -4, 3, 2 },{ 3, 1, -3 },{ 0, 0, -1 },{ 2, 3, 2 },{ 1, 2, -3 },{ 3, 0, -2 },{ 2, 1, -4 },{ -1, 2, 3 } }, - { { 0, -2, -4 },{ 3, 3, 0 },{ -1, -4, -2 },{ -4, -2, -1 },{ -4, -2, 2 },{ 1, 3, 0 },{ 3, -4, -4 },{ -2, -1, -3 },{ 1, 2, 3 },{ 0, 2, -4 },{ -3, 0, -2 },{ 1, -3, 1 },{ -3, -2, -4 },{ 0, 2, -3 },{ 1, -2, -1 },{ 3, -4, 1 },{ -2, -2, -2 },{ 2, -3, 0 },{ 2, -4, 1 },{ 0, 3, -1 },{ -4, -1, 3 },{ 3, 1, -4 },{ 0, 0, 0 },{ -2, -1, -2 },{ -3, -2, 1 },{ -1, 0, 2 },{ -3, 1, -1 },{ 3, -4, -4 },{ -4, 2, 1 },{ 2, -2, 3 },{ -1, 1, -4 },{ -3, -3, 3 },{ -2, 1, 2 },{ 2, 2, -1 },{ 0, -4, 0 },{ -3, -3, 2 },{ 3, 2, -2 },{ 1, -4, 1 },{ -2, 1, 0 },{ -3, 3, -4 },{ 2, -2, -2 },{ 0, 3, 2 },{ 3, 2, -4 },{ 2, -4, 0 },{ 3, 0, -3 },{ -3, 3, -4 },{ 2, 0, -2 },{ -1, -3, 0 },{ 0, -1, -3 },{ 3, -2, -1 },{ 0, 1, 1 },{ 1, 2, 2 },{ -4, -2, 3 },{ 2, -1, -1 },{ 0, -4, 1 },{ -3, 1, 3 },{ 1, -1, -2 },{ -3, -3, 1 },{ 0, -4, 3 },{ -1, -1, 0 },{ -3, -3, -4 },{ 0, -4, 0 },{ -4, -2, 2 },{ -2, -4, -1 } }, - { { -4, -1, 1 },{ -1, 1, -3 },{ -2, -3, 3 },{ 3, 3, -4 },{ 0, -1, 1 },{ -2, -4, 1 },{ 0, 1, 3 },{ -3, -3, 0 },{ 3, -1, 2 },{ -1, -2, 0 },{ -4, -4, -3 },{ 2, 0, 2 },{ 3, -1, -2 },{ -1, 3, 2 },{ -2, 0, 0 },{ 0, 2, -4 },{ -4, 3, 3 },{ -1, 1, -4 },{ -1, 0, -2 },{ 3, -2, -4 },{ -2, -4, 2 },{ 0, -2, 1 },{ 2, 2, -2 },{ 3, 1, 0 },{ -2, -3, -3 },{ 1, 2, 2 },{ -4, 3, -3 },{ 1, -1, 3 },{ -1, -3, -1 },{ -3, 0, -2 },{ 3, -1, 0 },{ -4, 3, 1 },{ 0, -4, -2 },{ -3, 3, -4 },{ -2, 0, 1 },{ 2, 1, -4 },{ -4, -2, -1 },{ -2, -2, -3 },{ -1, -4, 2 },{ 2, -3, -1 },{ 0, 0, 3 },{ -1, -4, 1 },{ -3, -1, 0 },{ 1, 1, 1 },{ -4, -2, -1 },{ -1, -1, 2 },{ -4, -3, 1 },{ 2, 2, 2 },{ -1, 2, -4 },{ -3, 0, 1 },{ 3, -4, -2 },{ -2, 3, -4 },{ -3, 1, -3 },{ 1, -2, 2 },{ -2, 3, -4 },{ 3, 0, -1 },{ 2, -3, -3 },{ -1, 1, 0 },{ -4, -2, -4 },{ 2, 3, -1 },{ -2, -2, 1 },{ 1, 2, -2 },{ -3, 3, 3 },{ 3, 1, -1 } }, - { { 2, 2, 1 },{ 0, -4, -3 },{ -3, -1, 3 },{ 1, 1, -2 },{ 2, -3, -1 },{ -1, 2, -3 },{ -4, -2, -2 },{ 0, 1, -1 },{ 2, 3, -4 },{ -2, -3, 1 },{ 3, 1, -1 },{ 0, 3, 3 },{ -2, 1, 1 },{ -4, -4, -4 },{ 2, -3, 3 },{ -3, -2, -2 },{ 1, 1, -1 },{ 1, -1, 2 },{ -3, 0, 2 },{ -4, 3, 0 },{ 1, 2, -3 },{ -3, -3, -1 },{ -1, 3, 3 },{ -4, -4, 2 },{ 0, 0, -4 },{ -2, -4, -1 },{ 3, -2, 0 },{ 2, 1, -2 },{ 0, 0, 1 },{ -2, -3, 2 },{ 1, 3, -3 },{ -1, -4, -3 },{ 2, -2, 3 },{ 1, -1, 2 },{ 3, -3, -1 },{ -1, 3, -2 },{ 1, -1, 3 },{ 0, 3, 1 },{ -4, 2, -4 },{ 3, -1, -2 },{ -3, 2, 0 },{ -4, -2, -3 },{ 2, 1, -4 },{ -2, -3, -2 },{ 0, 2, -1 },{ 0, 0, 3 },{ 1, 3, -3 },{ -2, -4, 0 },{ -3, -1, -2 },{ 2, -2, 3 },{ -4, 0, 2 },{ -1, -4, 0 },{ 3, -1, -2 },{ -1, -3, 0 },{ -4, 0, 0 },{ 3, -4, 1 },{ -1, -1, 3 },{ -2, 3, -3 },{ 3, 2, -1 },{ -3, 0, 3 },{ 3, -4, 2 },{ -1, 1, -3 },{ 2, 0, -3 },{ 1, -3, 2 } }, - { { -3, -2, -4 },{ -2, 3, -1 },{ 2, 1, 0 },{ -4, -1, 2 },{ -3, 0, -4 },{ 2, 3, 3 },{ 3, 0, 2 },{ -3, 2, 1 },{ -1, -3, -2 },{ 1, 0, 3 },{ -4, 2, -3 },{ 1, -2, -4 },{ -3, -3, -1 },{ 3, 0, 0 },{ -1, -1, 2 },{ 3, 2, -3 },{ -2, -4, 1 },{ 0, -3, -1 },{ 3, -3, -3 },{ -2, -2, 0 },{ -1, 1, 3 },{ 2, -1, -4 },{ 1, 0, -3 },{ 3, -2, 1 },{ -4, -1, -2 },{ 1, 2, 0 },{ -1, -1, 3 },{ -3, -4, 2 },{ -4, 2, -4 },{ 1, 1, -1 },{ -3, -2, 1 },{ 0, 0, 0 },{ 2, 2, -1 },{ -4, 0, -4 },{ -2, -4, 3 },{ -2, 1, -3 },{ 2, -3, 0 },{ -3, 0, 1 },{ -1, -3, 3 },{ 2, -2, -1 },{ 1, 1, 2 },{ 0, -1, -2 },{ -1, 3, 3 },{ 1, -4, 2 },{ -3, -2, 1 },{ 3, 1, -3 },{ 2, -2, -4 },{ -3, -1, 1 },{ 3, 1, -1 },{ 0, 3, -3 },{ 1, 2, 0 },{ -4, -1, -1 },{ 0, -3, 3 },{ -2, 2, -3 },{ 0, 2, -2 },{ -3, 3, -4 },{ 0, -2, 2 },{ -4, 0, 1 },{ 1, -4, -2 },{ 0, -1, -4 },{ -2, 1, 0 },{ 1, -3, -1 },{ -4, -1, 0 },{ -1, 0, -2 } }, - { { 1, -2, 1 },{ 3, 0, 2 },{ -4, -4, -2 },{ 1, 2, -3 },{ -1, -2, 0 },{ -1, -4, -2 },{ 1, -4, -4 },{ -4, -1, 0 },{ -2, 2, -3 },{ -3, -1, 2 },{ 0, -2, -1 },{ -1, -4, 0 },{ 2, 1, -3 },{ 1, 3, 1 },{ 0, -2, -2 },{ -4, 0, 0 },{ 2, 3, -2 },{ -1, 2, 3 },{ -3, -1, 1 },{ 3, 3, -3 },{ 2, 0, -2 },{ -4, -4, 1 },{ -1, 2, -1 },{ -3, -3, 3 },{ 0, 1, -3 },{ 2, 0, -1 },{ -1, 3, -4 },{ -2, -3, -2 },{ 3, 3, -3 },{ 2, -2, 0 },{ 3, -1, 3 },{ -2, 2, -4 },{ -3, -2, 1 },{ -1, 3, -2 },{ 3, 0, 0 },{ 1, -2, 2 },{ -4, 2, -4 },{ 3, -1, -2 },{ 0, 1, -3 },{ -4, 0, -4 },{ -2, 3, 1 },{ -3, -4, 2 },{ 3, 2, -4 },{ 2, -1, 0 },{ -2, 3, 1 },{ -4, -4, -2 },{ 0, 1, 0 },{ -1, -4, 3 },{ -2, -3, -2 },{ 1, 1, 2 },{ -2, -3, -3 },{ 2, 3, -4 },{ 3, 1, 1 },{ -3, 0, 2 },{ 1, -3, 3 },{ 2, -1, -1 },{ -3, 1, -3 },{ 1, 1, 0 },{ 2, -3, 3 },{ -1, 3, -3 },{ -4, -2, 1 },{ -3, 3, 3 },{ 0, -4, -4 },{ -2, 2, 3 } }, - { { 2, -1, -3 },{ -1, -3, 3 },{ 0, 3, -1 },{ -2, -2, 3 },{ 3, -3, 1 },{ -2, 2, 2 },{ 2, 1, -1 },{ 0, -1, 1 },{ 3, -3, -4 },{ 1, -4, 2 },{ 3, 2, -2 },{ -4, 0, 2 },{ -3, -3, 3 },{ -2, 2, -2 },{ -1, -1, 3 },{ -4, -4, -4 },{ 2, -2, 2 },{ 0, 1, -4 },{ -4, 0, -2 },{ 1, -2, 3 },{ 0, -4, 2 },{ -2, 3, -1 },{ 2, 1, 0 },{ -2, 3, -4 },{ -3, -4, 2 },{ 3, -3, 1 },{ 2, 1, 1 },{ -4, -1, 0 },{ 0, -4, 3 },{ -1, 1, 2 },{ -4, -4, -2 },{ 1, 1, -2 },{ 2, -3, 2 },{ 0, -3, 3 },{ -4, 1, -3 },{ 0, -2, -1 },{ -3, 2, 1 },{ -2, -4, 2 },{ 0, 3, 0 },{ 1, -4, -1 },{ 3, -2, 3 },{ -1, -3, -1 },{ -4, 0, -3 },{ 1, 0, -1 },{ -3, -3, -4 },{ -1, 0, 3 },{ 2, 2, 2 },{ -4, 3, -1 },{ -2, -1, -4 },{ 3, -2, 0 },{ -4, 0, 3 },{ -1, -4, 1 },{ -3, -2, -1 },{ 1, 0, -3 },{ -4, -4, 1 },{ -1, -2, -2 },{ -2, -3, -4 },{ 3, 2, 2 },{ -2, -4, 0 },{ -1, -1, -2 },{ 2, 0, -2 },{ 1, 2, 2 },{ 3, -4, -1 },{ -4, 1, 0 } }, - { { 2, 3, -4 },{ -3, 1, -2 },{ 3, -4, -4 },{ 0, 2, 1 },{ -4, 1, -1 },{ -3, 0, -3 },{ 0, -3, -3 },{ -4, 3, 3 },{ -2, 0, 0 },{ 2, 3, -2 },{ 0, 1, 1 },{ -1, -1, -4 },{ 2, 3, 0 },{ 3, -4, -4 },{ -3, 3, 1 },{ -2, 1, -1 },{ 3, 0, -3 },{ -2, -4, 0 },{ 1, -3, -1 },{ -1, 2, 0 },{ -3, -2, -4 },{ -4, -1, -2 },{ 0, -3, 2 },{ 2, -1, -3 },{ 1, -1, -2 },{ -4, -2, 3 },{ -1, 2, -3 },{ -2, 0, -3 },{ 1, -1, 1 },{ -3, 2, -1 },{ 0, -3, 1 },{ -2, 3, -4 },{ -3, -1, 0 },{ 3, -4, -1 },{ -3, 3, -4 },{ 2, -1, 3 },{ -1, -3, -1 },{ 1, 0, -3 },{ 3, -2, 2 },{ -2, -1, -4 },{ -4, 1, 1 },{ -2, 3, -3 },{ 1, -3, 0 },{ 3, -2, 2 },{ -3, 2, -1 },{ 0, -1, -2 },{ 3, -2, -3 },{ 1, 0, 1 },{ 0, 2, 2 },{ 2, -4, -2 },{ -1, 1, -2 },{ 2, 3, -4 },{ -2, -1, 0 },{ 0, 1, -4 },{ 2, 3, 0 },{ 3, 3, 3 },{ -1, -1, 1 },{ -4, 1, -1 },{ -3, 3, -4 },{ 2, -3, 3 },{ -4, 1, -1 },{ 3, -2, -3 },{ -2, 0, 2 },{ 0, 0, 1 } }, - { { -1, -3, 3 },{ -4, -2, 0 },{ -3, 0, -3 },{ -1, -1, 2 },{ 1, -1, -4 },{ 2, 3, 3 },{ -1, 1, 1 },{ 3, -3, -1 },{ -1, -2, -4 },{ -4, 1, 3 },{ -3, -2, -1 },{ 1, -4, 3 },{ -2, 0, -1 },{ 0, -2, -3 },{ 1, -3, 2 },{ 1, -1, 0 },{ 2, 2, 2 },{ -3, -2, 3 },{ -1, 1, -3 },{ 2, 3, 2 },{ 2, 0, -1 },{ 3, -3, 3 },{ -1, 1, 1 },{ -1, 0, -1 },{ 3, 2, 0 },{ -3, 3, -2 },{ 0, -4, 0 },{ 1, -2, -1 },{ 3, -2, -4 },{ -1, 3, -2 },{ 3, 0, 3 },{ 2, -2, -3 },{ -1, 2, 1 },{ -2, 0, -2 },{ 1, 2, 1 },{ 2, -4, 1 },{ -1, 3, -2 },{ -4, 0, 0 },{ -3, 2, -2 },{ 2, 2, 3 },{ -1, -3, -2 },{ 2, -1, 0 },{ 0, 1, 3 },{ -2, 2, -2 },{ 0, -4, 2 },{ 2, 3, 1 },{ -2, -3, -4 },{ -3, -2, 0 },{ -1, 2, -3 },{ -4, -3, 0 },{ -3, -1, 2 },{ 0, 2, 3 },{ 3, -2, -1 },{ -4, -3, 3 },{ 0, 2, -3 },{ -2, 0, -1 },{ 1, -4, 1 },{ 0, -2, -2 },{ 1, 0, 0 },{ 0, -4, 2 },{ -2, 2, -4 },{ -1, -3, 0 },{ 1, -3, -4 },{ -3, -1, -2 } }, - { { 3, 1, -1 },{ 1, 3, 1 },{ 2, 2, 2 },{ -1, -3, -2 },{ 3, -4, 0 },{ -2, -2, 0 },{ -3, -4, -2 },{ 1, -1, 2 },{ 1, 2, -3 },{ -2, -4, 0 },{ 2, -3, -3 },{ 3, 2, -3 },{ -1, 0, -1 },{ -4, 2, 2 },{ -4, 1, 0 },{ -1, -3, -2 },{ 0, 3, -2 },{ -4, -1, -4 },{ -3, -4, 1 },{ 3, -1, 0 },{ -2, 1, -2 },{ 1, 3, -4 },{ -3, -4, -3 },{ -2, 2, 0 },{ -4, -4, 3 },{ 1, 0, -4 },{ -2, -3, 3 },{ 2, 1, 2 },{ -4, 2, 2 },{ -4, -3, 0 },{ 1, 1, -3 },{ -3, -4, 2 },{ 1, -1, -1 },{ -4, 1, 3 },{ 0, -2, -3 },{ -2, -1, 0 },{ 3, 1, -4 },{ -3, -3, 2 },{ 0, -2, -3 },{ 0, 0, 1 },{ 2, -4, -1 },{ -3, 3, -4 },{ -3, -1, 1 },{ 3, -4, -4 },{ -4, -1, -3 },{ 1, 1, 1 },{ -4, 1, 3 },{ 1, -4, -2 },{ 2, 0, 3 },{ 3, 0, -3 },{ 0, -4, -1 },{ 1, 3, 1 },{ -3, 0, -2 },{ -1, -4, 2 },{ 2, -1, -2 },{ -3, -2, -4 },{ -4, -3, 2 },{ 3, 2, -3 },{ -2, -2, -2 },{ 3, 0, 1 },{ 1, 3, 3 },{ -3, -1, -1 },{ -4, 3, 2 },{ 0, 2, 1 } }, - { { -2, 0, -1 },{ -4, -4, -4 },{ 0, -2, 3 },{ -2, 2, -1 },{ -4, 1, -3 },{ 1, 3, 2 },{ -4, 0, -4 },{ 3, 3, -1 },{ -3, -1, -2 },{ 0, 0, 2 },{ -3, 3, 1 },{ 1, -1, 0 },{ 0, 1, 1 },{ 3, -2, 3 },{ 2, -4, -4 },{ -2, 2, -3 },{ 3, -2, 3 },{ 1, 0, 1 },{ 0, 2, -2 },{ -4, -4, -4 },{ -1, -1, 3 },{ 0, -3, 1 },{ -3, -2, 2 },{ 2, 0, -4 },{ 2, -2, 2 },{ 0, 3, -2 },{ 3, 1, 1 },{ -3, -1, -1 },{ -2, -4, -4 },{ -1, 0, 3 },{ 3, 3, 0 },{ -2, -1, 1 },{ -1, 1, -4 },{ 3, -3, 2 },{ -3, -2, -3 },{ -4, 0, 3 },{ 0, -4, -1 },{ 1, -2, 3 },{ 3, 3, 0 },{ -4, -1, 2 },{ -2, 2, -3 },{ 1, -3, 2 },{ -1, 1, -1 },{ -1, 0, 0 },{ 2, -3, -1 },{ -3, 3, -3 },{ -1, -1, 0 },{ 3, 2, -1 },{ -2, 3, 2 },{ -4, -1, -4 },{ -2, 1, 2 },{ -1, -3, -3 },{ 2, 0, -4 },{ -2, 1, 0 },{ 1, 1, 1 },{ 2, 3, -1 },{ -1, 1, 3 },{ 2, 2, 0 },{ -3, -1, -1 },{ -4, 1, -3 },{ 2, -4, -2 },{ -1, 1, 0 },{ 2, -4, -3 },{ 3, -2, -3 } }, - { { -1, -3, 2 },{ 2, -1, -2 },{ 1, 3, 0 },{ -3, -3, 1 },{ 2, 0, -3 },{ 0, -1, 1 },{ -2, -2, 3 },{ -1, -3, 1 },{ 3, 2, 0 },{ 2, -2, 3 },{ -4, 1, -4 },{ -3, -3, -2 },{ -2, -4, -4 },{ -3, 2, -2 },{ -1, -1, -1 },{ -4, 0, 2 },{ -2, -3, -1 },{ 2, 3, 2 },{ 0, 1, -1 },{ -2, -2, 3 },{ 1, 2, -3 },{ -4, 1, 0 },{ 3, 3, -1 },{ 1, 1, 3 },{ -1, -1, -1 },{ -2, -3, -3 },{ -3, 0, -3 },{ 3, 3, 0 },{ 0, -2, -1 },{ 2, -1, -3 },{ 0, -3, -2 },{ -4, -2, -2 },{ 1, -4, 0 },{ 0, 3, -1 },{ 2, 2, -2 },{ 2, 3, 1 },{ -1, 2, -2 },{ -1, 1, -4 },{ -2, 1, -2 },{ 1, -4, -4 },{ 0, 0, 0 },{ -4, -2, 3 },{ 3, 3, -2 },{ 1, -2, 1 },{ -2, 2, 3 },{ 0, -2, -1 },{ -1, 0, 2 },{ 2, -3, -4 },{ -3, -2, 0 },{ 0, -3, 1 },{ 1, 3, -2 },{ 3, -2, 3 },{ -4, -2, -1 },{ -1, 3, 2 },{ 3, -4, 0 },{ -4, -1, -3 },{ 0, -3, 2 },{ -2, -4, -4 },{ -1, -3, 2 },{ -4, 3, 3 },{ 2, -2, -4 },{ -1, -1, 1 },{ -2, 0, 3 },{ 0, 1, 0 } }, - { { -3, 3, 3 },{ -2, -1, -3 },{ 3, 0, -4 },{ -3, -4, 3 },{ -1, 2, 0 },{ 1, 1, -2 },{ 2, -4, -2 },{ -4, 1, -4 },{ -1, 1, -3 },{ 0, -4, -2 },{ -1, 0, 0 },{ 3, -2, 2 },{ 0, 3, 2 },{ 2, -2, 0 },{ 1, 1, 1 },{ 0, 3, -3 },{ 3, -4, 0 },{ -3, -1, -4 },{ -1, -3, -3 },{ 3, 0, 1 },{ 2, -4, 0 },{ 0, 2, -3 },{ -3, -3, -2 },{ -2, -4, -4 },{ -4, 2, 1 },{ 0, -4, 1 },{ 1, -1, 2 },{ -1, -3, -4 },{ 1, 2, 3 },{ -2, 3, 1 },{ -3, 1, 2 },{ 2, 2, 3 },{ -4, 2, -4 },{ -1, 0, 2 },{ -2, -4, -3 },{ -3, -3, 0 },{ -4, -1, 2 },{ 2, -2, 1 },{ -3, -3, -1 },{ -2, 2, 0 },{ 0, -3, 1 },{ 3, 1, -3 },{ -3, -1, -4 },{ 1, -3, 2 },{ -4, 3, -3 },{ 3, -4, -4 },{ -3, -4, -2 },{ 0, 2, 3 },{ -4, 1, -3 },{ 3, 0, -2 },{ 1, 2, 0 },{ -3, -1, 0 },{ 0, 1, -3 },{ -2, -4, 3 },{ 1, 2, -4 },{ -3, -1, -2 },{ 0, 3, 0 },{ 2, 0, -1 },{ 3, 2, 1 },{ 0, -2, -3 },{ 0, 0, 1 },{ -3, 3, -1 },{ 3, -4, -4 },{ -4, 2, -2 } }, - { { 1, -2, -1 },{ -4, -3, 1 },{ -1, 1, 1 },{ 1, -2, -1 },{ 3, 0, -4 },{ -3, -1, 2 },{ 0, 3, -1 },{ -2, -3, 0 },{ 1, -1, 3 },{ 2, 3, 2 },{ -2, -3, -1 },{ 2, 2, -3 },{ -4, 0, -1 },{ 1, 0, 3 },{ -3, -4, -3 },{ -1, 1, 1 },{ 1, -2, 3 },{ -4, 2, -1 },{ 1, -3, 3 },{ -3, 3, 2 },{ -2, 0, -1 },{ -1, -1, 2 },{ 2, -2, 0 },{ 3, 0, 3 },{ 1, 3, -2 },{ 3, 0, -1 },{ -4, 2, 3 },{ -3, -2, 0 },{ 0, -4, -2 },{ -4, 0, -4 },{ 3, -4, 0 },{ -1, 0, -3 },{ 2, -2, -1 },{ 1, -1, 1 },{ 3, 1, 2 },{ 0, 0, -4 },{ 3, -4, -1 },{ 1, 3, -3 },{ -4, 0, 3 },{ 3, -1, -2 },{ 2, 3, -1 },{ -2, 2, 3 },{ -3, -4, 1 },{ 0, 2, -2 },{ -2, -1, 0 },{ 2, 0, 2 },{ 2, 1, 1 },{ -2, -1, 0 },{ 1, 3, -1 },{ -1, -1, 3 },{ -4, -4, 1 },{ -2, -3, -4 },{ 2, 2, -2 },{ 0, 0, 1 },{ -3, -3, -1 },{ 3, -2, 3 },{ -2, 0, 1 },{ -2, -1, -4 },{ 1, -4, -2 },{ -3, 1, 2 },{ -1, -3, -2 },{ -2, 2, -1 },{ 2, -1, 2 },{ 1, -3, 0 } }, - { { -1, 1, -3 },{ 2, 3, 3 },{ 0, -2, -1 },{ -4, 3, 2 },{ -1, -4, -2 },{ -4, -3, 1 },{ 2, 2, 3 },{ 3, 0, -3 },{ -3, -2, -1 },{ -3, 2, 1 },{ -4, -4, -4 },{ 1, -1, 1 },{ -1, 3, 0 },{ -3, -3, -4 },{ 3, 2, -2 },{ -4, -1, -4 },{ -2, 3, -2 },{ -1, -1, 0 },{ 2, 1, -4 },{ 1, -2, -2 },{ -3, 1, -4 },{ 1, -4, 2 },{ -4, 3, 0 },{ -2, -1, -3 },{ -3, 1, 2 },{ 0, -3, -4 },{ 2, 2, 0 },{ -2, 1, -3 },{ 3, -1, -1 },{ -3, 3, 3 },{ 1, -2, -1 },{ -2, -3, 0 },{ -3, 3, -2 },{ -1, -4, 3 },{ -3, -2, -2 },{ -4, 3, 1 },{ 1, 1, 3 },{ -1, -1, 0 },{ 0, -4, 2 },{ -1, 1, -4 },{ -4, -2, 2 },{ -1, -4, 0 },{ 2, 0, -2 },{ 1, -1, -3 },{ -1, 1, 0 },{ -4, -2, 3 },{ 0, 3, -2 },{ -3, -3, -4 },{ 3, -2, -1 },{ 0, -4, 2 },{ -2, 3, -4 },{ 3, -1, 2 },{ 2, 0, 1 },{ -4, -2, 2 },{ 3, 1, -3 },{ -1, 2, 0 },{ 2, -4, -3 },{ -4, 3, 3 },{ -4, -2, 0 },{ 1, -1, 3 },{ 3, 1, 0 },{ 1, -2, -3 },{ -4, -4, 3 },{ 0, 2, -4 } }, - { { 3, -3, -2 },{ -3, 0, -2 },{ -2, -4, -3 },{ 2, 2, 2 },{ 2, -1, -4 },{ -2, 1, -3 },{ 0, -2, -1 },{ -1, 3, 2 },{ 0, -1, 0 },{ 1, 1, -2 },{ -1, 0, 3 },{ 3, -4, -3 },{ 0, -2, 3 },{ -2, -1, -1 },{ -1, -3, 2 },{ 3, -2, 1 },{ 2, 0, 3 },{ 0, -4, -1 },{ -2, 3, 0 },{ 3, -4, 1 },{ -4, 2, -2 },{ 0, -3, -3 },{ 3, 1, 3 },{ -1, -3, -1 },{ -4, -2, -4 },{ 2, -2, -2 },{ -2, -1, 1 },{ 1, -3, 2 },{ -1, 1, 1 },{ 2, -2, -3 },{ 0, 2, 1 },{ 1, -1, 2 },{ -4, 1, -4 },{ 0, 0, 0 },{ 2, 2, -1 },{ -1, -2, -4 },{ -2, -3, -1 },{ -3, 2, -3 },{ 2, -1, 1 },{ 3, 2, -2 },{ -2, -3, -4 },{ 1, 0, -1 },{ -4, -3, 3 },{ 0, 3, 2 },{ 3, -3, -4 },{ -1, -4, -1 },{ 1, -1, 2 },{ -2, 2, 1 },{ 2, -3, -3 },{ -1, 1, 1 },{ -4, 1, -3 },{ 1, 2, -1 },{ -1, -4, -2 },{ -2, 3, -1 },{ -4, 1, -4 },{ 1, -1, 2 },{ 1, -3, -2 },{ 0, 1, -3 },{ 2, 2, 1 },{ -2, 3, -4 },{ -1, -4, -2 },{ -3, 0, 1 },{ -2, 3, -1 },{ 3, 0, 2 } }, - { { -1, -2, -4 },{ 1, -1, 2 },{ -3, 1, 0 },{ 1, -1, 0 },{ 0, 1, 1 },{ 3, -2, -1 },{ -4, -4, 3 },{ -2, 0, -3 },{ 3, -4, -4 },{ -2, 1, -2 },{ 2, -3, 2 },{ -4, 3, 0 },{ 1, 1, -2 },{ 2, 1, -3 },{ 0, 3, 2 },{ 1, 2, -1 },{ -4, 0, -3 },{ -3, -3, 2 },{ -1, 1, -3 },{ 0, -2, 1 },{ 2, 0, 3 },{ -2, -1, -1 },{ 2, 2, -4 },{ 1, -4, 1 },{ 0, 1, 0 },{ -1, 3, 3 },{ -3, -4, -1 },{ 3, 0, -3 },{ -4, 3, 2 },{ -2, -4, -4 },{ -2, 1, 0 },{ 3, 0, -3 },{ -1, -3, -3 },{ -3, -3, 3 },{ 3, 2, 2 },{ 2, -1, -2 },{ 0, 0, 3 },{ 1, -4, -4 },{ -3, -2, -1 },{ -3, 3, 3 },{ 1, -2, 0 },{ 3, 3, 2 },{ -3, -1, -3 },{ -2, 2, 1 },{ 2, 2, 0 },{ -3, 1, -2 },{ -4, 0, -3 },{ 1, 3, 3 },{ -4, 0, 0 },{ 3, -2, -2 },{ 0, 0, 3 },{ -3, -2, 0 },{ 0, -3, 0 },{ 1, -1, 3 },{ 0, -4, 1 },{ -2, -2, -1 },{ -3, 2, 1 },{ -1, -3, 2 },{ 0, -1, -4 },{ 3, -3, -1 },{ -4, 2, 3 },{ 2, 1, -3 },{ 0, -1, 2 },{ -3, -4, 0 } }, - { { -4, 2, 3 },{ -2, 3, 1 },{ 3, 0, -4 },{ -4, -3, 3 },{ -1, 3, -2 },{ -3, 2, 0 },{ 1, 2, -4 },{ 2, -3, 1 },{ -4, 3, 2 },{ 1, -2, 1 },{ -3, -1, -1 },{ -1, 2, -4 },{ -2, -1, -1 },{ -3, -2, 0 },{ -4, -4, -4 },{ 0, 2, 0 },{ -2, -3, 3 },{ 3, -1, -2 },{ 1, 2, -4 },{ -4, -2, 2 },{ -1, 3, 0 },{ -3, -3, -2 },{ 1, 0, 2 },{ -3, 2, -3 },{ 3, 0, -2 },{ -4, -1, 2 },{ 2, 3, 0 },{ 0, 2, -4 },{ 0, -3, -1 },{ 2, -1, -2 },{ 0, -4, 3 },{ -4, -2, 1 },{ 3, 3, -1 },{ 1, 0, 1 },{ -2, -4, -3 },{ -4, -3, 1 },{ -2, 3, 1 },{ 3, 2, -2 },{ -4, 1, 0 },{ 0, -3, 2 },{ -1, 0, -3 },{ 2, 1, -1 },{ -1, -4, -4 },{ 1, -1, -2 },{ -4, -2, -1 },{ 1, -3, 3 },{ 3, -2, -4 },{ 0, -4, -1 },{ -3, 1, -2 },{ -2, 3, 2 },{ -2, -4, 2 },{ 3, 3, -4 },{ 2, 2, -3 },{ -3, 0, 1 },{ 3, 3, -4 },{ -4, 1, -2 },{ 3, -1, -1 },{ 2, 0, 3 },{ -2, -4, 0 },{ -3, 0, 2 },{ 1, -1, 0 },{ -2, -2, -4 },{ 0, 2, -2 },{ 1, 1, 1 } }, - { { -1, 0, -3 },{ 0, -4, -1 },{ 2, -3, -2 },{ 0, -2, -1 },{ -2, -4, 2 },{ 2, 0, 2 },{ -3, -1, -2 },{ -1, 1, -1 },{ 0, -1, 0 },{ -3, -2, -3 },{ 2, 2, 3 },{ -4, -4, 2 },{ 2, -3, 1 },{ 3, 3, 2 },{ -1, 0, -3 },{ 2, -1, 1 },{ -3, -4, -2 },{ 2, 3, 0 },{ 1, -3, 3 },{ -2, 1, -3 },{ 3, -1, -4 },{ -2, -4, 3 },{ -1, 3, 0 },{ -4, -2, 1 },{ -2, -4, 3 },{ 1, -1, -4 },{ -1, -3, -2 },{ -3, -2, 3 },{ -4, 0, 0 },{ 1, 1, 2 },{ -3, 3, -2 },{ -1, 1, -1 },{ -2, -1, 2 },{ 0, 2, 0 },{ -3, -1, -2 },{ 2, 1, -4 },{ 0, 0, 2 },{ 2, -1, 0 },{ -1, -4, -3 },{ -2, -1, 1 },{ 3, 2, -2 },{ -4, -4, -1 },{ -3, 0, 3 },{ 0, -3, 1 },{ 2, 1, -3 },{ -2, 3, 2 },{ -1, 1, 0 },{ 2, -2, 1 },{ -1, -1, -4 },{ 1, -3, -2 },{ 2, -1, -4 },{ -4, 1, -1 },{ -1, -2, 2 },{ -3, -3, -2 },{ 2, 0, 3 },{ -1, -4, 0 },{ 1, -2, -3 },{ -4, 3, -4 },{ 1, 2, -3 },{ 0, -4, -2 },{ -1, 1, 2 },{ 2, -3, -2 },{ -3, -2, 0 },{ 2, -3, -1 } }, - { { -2, 1, 0 },{ -3, -1, 2 },{ -1, 1, -3 },{ 3, 2, 3 },{ -4, -1, -4 },{ 1, -2, -3 },{ 0, -4, 1 },{ 3, 3, 3 },{ -1, 2, -4 },{ 3, -3, -2 },{ 0, 0, -1 },{ -1, 0, -3 },{ 0, 1, 3 },{ 3, -3, -4 },{ -2, -2, 3 },{ -1, 1, -1 },{ -4, 1, -4 },{ 0, 3, 1 },{ -1, -1, -1 },{ -4, 1, 1 },{ 2, -3, -1 },{ 3, 1, -3 },{ 0, -1, -1 },{ 2, -2, -4 },{ 2, 3, -3 },{ -2, 1, -1 },{ 1, 1, 1 },{ 3, -4, -3 },{ -2, 2, 3 },{ -1, 3, -1 },{ 3, -2, -3 },{ 2, -3, -4 },{ -4, -4, 0 },{ 2, 2, -4 },{ 1, -2, 3 },{ -1, 3, 0 },{ -3, -4, -1 },{ -4, -2, -2 },{ 2, 3, 3 },{ 0, 1, -4 },{ -3, -2, 1 },{ 2, 3, 0 },{ -2, -2, 3 },{ 3, 3, -4 },{ -1, -4, 0 },{ -3, 0, 2 },{ 0, 2, -3 },{ -4, -1, -1 },{ 3, 2, 3 },{ -1, 0, 1 },{ -4, -3, 2 },{ 0, 2, 0 },{ 2, -4, 1 },{ 0, 1, -3 },{ -2, 3, -1 },{ -2, -3, 2 },{ 0, -1, 3 },{ -3, 1, 1 },{ -1, 3, 0 },{ -4, -2, 3 },{ 3, 3, -3 },{ -4, 0, 1 },{ -2, 3, 3 },{ 3, -4, -4 } }, - { { 1, 0, -2 },{ 2, 3, 1 },{ -3, 2, -4 },{ 0, -3, 1 },{ -2, 3, -1 },{ 2, 1, 0 },{ -2, -3, -1 },{ -3, 0, 3 },{ -4, -2, 0 },{ 1, -4, 2 },{ -2, 2, 1 },{ 3, -2, -4 },{ -4, 3, 0 },{ -3, 2, -2 },{ 1, 0, -1 },{ 1, -4, 2 },{ 2, -2, 3 },{ 3, 0, 0 },{ -3, -2, -3 },{ -3, -4, -2 },{ 0, 2, 2 },{ -4, 0, 0 },{ -3, 2, 3 },{ -1, -1, 1 },{ -3, -3, 2 },{ 3, 2, -1 },{ 0, 0, 0 },{ -4, -2, -3 },{ 2, -1, -4 },{ 1, -4, 1 },{ -2, 0, 0 },{ 0, 2, 3 },{ -3, -1, -2 },{ -2, 0, 2 },{ 3, -3, -1 },{ -1, 1, -3 },{ -2, -3, -4 },{ 3, 1, 2 },{ 1, 2, -3 },{ -1, -4, -1 },{ 0, -1, 2 },{ 1, -3, -4 },{ 0, 2, -2 },{ -4, 1, 1 },{ 1, -1, -1 },{ 3, -1, -2 },{ -2, -3, -4 },{ 2, -4, 2 },{ -3, 3, 0 },{ 1, -2, -1 },{ 3, 0, -3 },{ -2, 3, 0 },{ -1, -2, 3 },{ 3, -1, -4 },{ 1, 2, 0 },{ -4, 2, -4 },{ 2, -4, -2 },{ 2, 0, -1 },{ 3, -1, -1 },{ -2, -3, -2 },{ 0, -2, -4 },{ 2, 2, 0 },{ 1, -1, -1 },{ -4, 2, 2 } }, - { { 0, -2, 3 },{ -2, -4, 0 },{ 3, -2, 0 },{ 1, -1, -2 },{ -4, 0, 2 },{ 3, 1, -2 },{ -1, 2, -4 },{ 2, -3, -3 },{ 0, 1, -2 },{ 1, 3, -4 },{ -3, -1, 1 },{ -1, -2, 2 },{ 1, -1, -2 },{ -2, -4, 0 },{ 0, 3, 1 },{ -4, 2, -4 },{ -1, -3, -2 },{ -2, 0, 0 },{ -1, 2, -4 },{ 2, -1, 3 },{ 1, 3, -2 },{ 3, -2, 2 },{ -2, -4, -3 },{ 1, 1, -2 },{ 0, -4, 2 },{ -4, 2, -2 },{ -1, -3, 1 },{ 2, 3, 2 },{ -3, 2, -2 },{ 0, -3, 1 },{ -4, -1, -3 },{ 2, 1, 2 },{ -1, -2, 1 },{ 0, 3, -2 },{ -4, -3, 3 },{ 3, 2, 1 },{ -2, -1, 3 },{ 0, 0, 1 },{ -4, -3, 0 },{ -3, 0, -2 },{ 2, -1, 3 },{ -4, 2, -1 },{ -2, 0, 2 },{ 2, -3, -3 },{ -3, -3, 3 },{ 0, 3, 0 },{ 3, -2, 3 },{ 1, 1, -2 },{ -4, -4, -3 },{ -2, 2, -4 },{ -2, -3, 3 },{ 2, 1, -2 },{ -3, -4, -3 },{ -4, 0, -1 },{ 1, -3, 1 },{ -2, -2, 2 },{ -3, 1, -3 },{ 0, -3, 1 },{ -2, -4, -4 },{ 1, 1, 3 },{ 0, 2, 1 },{ -3, -4, 2 },{ -1, -1, -3 },{ -1, -3, -4 } }, - { { 0, 1, -1 },{ -4, 0, -4 },{ -1, 0, 3 },{ -3, -3, -3 },{ 1, -1, 2 },{ -3, -4, 0 },{ 0, -2, 2 },{ -3, -1, 1 },{ 3, 0, 2 },{ -2, -3, -1 },{ -4, 2, 0 },{ 2, 1, -2 },{ -1, -4, 3 },{ 2, 0, -3 },{ 3, -2, 0 },{ 1, -1, -3 },{ -4, 2, 2 },{ 1, -3, -1 },{ 3, 3, 2 },{ 0, -4, 1 },{ -2, -2, -4 },{ -4, -3, -4 },{ -1, 3, -1 },{ 1, 0, 0 },{ 3, 0, -4 },{ -2, -1, -4 },{ -3, -3, 3 },{ 0, 1, -1 },{ -1, -4, -1 },{ 3, 0, 3 },{ -1, 3, -2 },{ 3, -4, -1 },{ -3, -1, -4 },{ 2, -4, 0 },{ 1, 1, -4 },{ -4, -1, -1 },{ 2, 3, -2 },{ 1, -4, -4 },{ -1, -2, 2 },{ 3, 2, -3 },{ -2, -3, -4 },{ 1, 3, 1 },{ 3, -4, 0 },{ -1, -1, -2 },{ -1, 3, 1 },{ -4, 0, -4 },{ -2, 2, 1 },{ 0, 0, 0 },{ -1, 1, 3 },{ 2, -1, 1 },{ 0, -3, -2 },{ -4, 0, 1 },{ 0, 3, 2 },{ -2, 1, 3 },{ 3, -2, -1 },{ -1, 0, -2 },{ 3, 3, 3 },{ -1, 1, 0 },{ -4, 3, 2 },{ 2, -2, 1 },{ -4, -1, -1 },{ 3, 1, -3 },{ -3, -3, 1 },{ 3, 3, -2 } }, - { { -2, -2, 2 },{ 3, -4, -2 },{ 1, 3, 1 },{ 2, 2, -1 },{ -2, 2, -4 },{ -1, -4, -1 },{ -4, 3, 3 },{ 3, 2, -4 },{ 1, 1, -1 },{ -2, -4, 3 },{ 0, 3, -3 },{ 3, 0, -4 },{ -4, -3, 1 },{ -3, 1, 2 },{ -3, 2, -1 },{ -2, -3, 3 },{ 0, 1, -4 },{ 2, -1, -2 },{ -3, -1, -3 },{ -3, 1, 3 },{ 0, 0, 0 },{ 3, 1, -1 },{ -3, 2, 3 },{ 2, -2, 1 },{ -4, -2, 3 },{ -2, 3, 0 },{ 1, -2, -3 },{ 2, -1, 0 },{ -2, -2, -4 },{ -4, 0, 2 },{ -3, 1, -4 },{ 1, -3, 3 },{ -2, 2, -1 },{ -1, 3, 2 },{ 0, 0, -3 },{ -3, -2, 2 },{ -1, -4, -2 },{ 2, 2, 0 },{ -4, 3, -1 },{ 2, 1, 3 },{ -3, -2, 0 },{ -1, 1, -2 },{ 0, -2, -4 },{ -3, 1, 2 },{ 2, 2, -3 },{ 2, -4, -1 },{ -1, -2, 2 },{ -3, -3, -3 },{ 3, 2, -1 },{ -3, -1, 2 },{ 3, 3, -3 },{ 1, -2, 0 },{ 1, -4, -4 },{ 2, 1, -1 },{ -1, -1, -3 },{ 1, 3, 0 },{ -4, -1, -4 },{ 1, -4, -2 },{ -3, 2, -3 },{ -1, 0, -4 },{ 2, 3, -2 },{ 0, -4, 0 },{ -4, 0, 3 },{ 1, 2, 1 } }, - { { 2, -1, -1 },{ -4, 1, 0 },{ -3, -3, -3 },{ 2, -2, 3 },{ 0, 1, 1 },{ 3, 0, -2 },{ 1, -2, -3 },{ -1, -4, 0 },{ -4, 0, -3 },{ -1, -3, 1 },{ 1, -2, -2 },{ 2, -1, 2 },{ -1, 2, -1 },{ 0, 3, -4 },{ 1, -2, -2 },{ 3, -4, 1 },{ -2, 0, 1 },{ 0, 3, -1 },{ -4, -4, 1 },{ -2, -2, -3 },{ 1, 2, 0 },{ -3, -3, 2 },{ 0, -4, -3 },{ -1, 2, -2 },{ 0, 1, 1 },{ 2, -4, -2 },{ 3, 1, 1 },{ -1, 2, 3 },{ 2, 2, -2 },{ 0, -3, 1 },{ 1, 3, 0 },{ 2, -2, 0 },{ -4, 0, -3 },{ 3, -3, 1 },{ -2, -3, 0 },{ -1, 2, -1 },{ 3, 0, 1 },{ -2, -1, -3 },{ 0, -3, 2 },{ 0, 0, 1 },{ -4, -1, -2 },{ 2, 2, 3 },{ 3, -4, 2 },{ -3, -1, 0 },{ 1, -3, -3 },{ 0, 1, 3 },{ -4, 3, -1 },{ 2, -1, -2 },{ 1, -3, -4 },{ -1, -4, 2 },{ -2, 1, -4 },{ -1, 2, 3 },{ -3, -1, 0 },{ -4, -3, -2 },{ -2, 2, 1 },{ -3, -4, 2 },{ 2, -3, 2 },{ 0, -1, 3 },{ 3, -2, -1 },{ -2, -3, 3 },{ -2, -3, 0 },{ -1, -2, 2 },{ 2, 1, -4 },{ -2, -3, -3 } }, - { { -1, -2, 3 },{ 0, 2, -2 },{ -1, -1, 2 },{ -3, 3, -3 },{ -1, -3, -1 },{ -4, 1, 3 },{ -2, -1, -2 },{ 2, 3, 1 },{ 2, -1, 2 },{ -3, 2, -4 },{ 0, 3, 0 },{ -2, -4, 3 },{ -3, -1, 0 },{ -1, -3, -3 },{ 2, 0, 3 },{ -4, 3, 0 },{ 2, -4, -3 },{ -1, -2, 2 },{ 3, 1, -4 },{ 2, 2, -2 },{ 1, -1, 2 },{ 3, 3, -2 },{ -4, -1, 3 },{ 2, -3, -3 },{ -2, 0, -4 },{ -3, -3, 2 },{ -4, 3, -1 },{ 0, -4, -3 },{ -4, -1, 2 },{ -3, 2, -2 },{ 3, -4, -4 },{ -2, -1, 2 },{ 0, 2, -2 },{ -3, -1, 3 },{ 2, 1, -4 },{ 1, 3, -2 },{ -3, -2, 2 },{ 1, 1, 3 },{ -3, -2, -3 },{ 3, -3, -4 },{ 1, -4, 0 },{ -2, 1, -3 },{ 0, 3, -1 },{ -4, 0, -2 },{ -2, 0, 1 },{ 3, -2, -4 },{ -3, -4, 1 },{ -2, 1, 3 },{ 1, 0, 0 },{ -4, 3, -1 },{ -3, 0, -1 },{ 2, -2, 1 },{ -1, -4, -3 },{ 0, 3, 3 },{ 3, 0, -3 },{ 0, 1, -4 },{ -2, -2, -1 },{ -4, 0, 1 },{ 1, 1, -3 },{ 2, 2, 1 },{ 0, -1, -4 },{ -4, 1, -2 },{ 3, 3, 2 },{ 0, 0, 0 } }, - { { -4, 3, -1 },{ 3, -4, -4 },{ -2, 0, 2 },{ 2, -4, 0 },{ 3, -1, -4 },{ -3, 0, 2 },{ 0, -3, 0 },{ 0, 2, -4 },{ 3, -4, 3 },{ -1, -2, -1 },{ -4, 1, 1 },{ 3, 1, -3 },{ 1, -2, -2 },{ -4, 2, 2 },{ 1, 1, 0 },{ -1, -1, -4 },{ -2, 2, -2 },{ -3, -1, 3 },{ 1, 0, 0 },{ -1, -3, 3 },{ -2, -4, -3 },{ -4, 0, 1 },{ -1, -2, -4 },{ 1, 3, 0 },{ 3, 1, 0 },{ 0, 2, 3 },{ -1, -1, -4 },{ -3, 0, 0 },{ 1, -2, 3 },{ 2, -1, -3 },{ -1, 0, -1 },{ -1, 1, 2 },{ -4, -2, -3 },{ 1, -2, 1 },{ -1, -4, -2 },{ 0, -1, 3 },{ -4, -4, -4 },{ -2, 2, 0 },{ 3, 2, -2 },{ -1, 3, -1 },{ -2, -1, 2 },{ 2, -2, 1 },{ -3, -3, -4 },{ 3, -3, 3 },{ -1, 2, 2 },{ 0, 3, -1 },{ -1, 0, 0 },{ 3, -2, -3 },{ 0, 2, 1 },{ -2, -3, -2 },{ 2, -2, 2 },{ 1, 2, -4 },{ 3, 1, 2 },{ 1, 3, -1 },{ -4, -2, 2 },{ -1, 0, 0 },{ 3, 2, -2 },{ -3, 3, -4 },{ 0, -4, 0 },{ -1, 1, 2 },{ -3, 3, -2 },{ 1, -1, -1 },{ -3, -4, 1 },{ 1, -3, -3 } }, - { { 2, -2, 2 },{ -3, 3, 1 },{ 1, -1, -1 },{ 0, 1, 3 },{ 1, -2, -3 },{ -2, 2, -1 },{ 1, -2, 1 },{ -4, 3, -2 },{ -2, 0, -1 },{ -3, -3, -3 },{ 0, -1, -2 },{ 2, 2, 3 },{ -2, -4, 0 },{ 3, 0, -1 },{ 0, -2, 1 },{ -3, -3, -2 },{ 2, 1, 2 },{ 0, -3, -1 },{ 0, 3, -1 },{ -4, -3, -4 },{ -1, 1, -1 },{ 2, 2, 1 },{ 0, -1, -1 },{ -3, -4, 2 },{ -2, -1, -1 },{ 1, -2, -2 },{ -1, -3, -1 },{ 3, 3, 1 },{ -2, 1, -2 },{ 1, -4, 1 },{ -2, -3, 3 },{ -3, 3, -1 },{ 3, -4, 0 },{ 1, 1, -4 },{ -4, 2, 0 },{ 3, 3, 1 },{ 2, -1, -3 },{ -1, 0, -1 },{ 0, -4, 1 },{ -4, 0, -2 },{ -3, 2, 3 },{ -1, 1, 0 },{ 1, 3, -3 },{ -4, 0, -1 },{ 1, -1, 1 },{ 2, -4, -3 },{ -3, -1, -2 },{ 1, 1, 2 },{ -4, -4, -3 },{ -1, -1, 3 },{ 3, 0, 0 },{ -4, -4, -2 },{ -2, -1, -2 },{ -3, -3, 0 },{ 2, -2, -3 },{ 2, -4, 1 },{ -2, 1, 3 },{ 1, -3, 2 },{ 3, -2, -3 },{ -3, 0, 3 },{ 3, -4, -1 },{ 2, -2, 1 },{ -2, 2, 3 },{ 0, 0, -4 } }, - { { 2, 1, 0 },{ -1, -3, -3 },{ -2, 1, -2 },{ -4, 2, 1 },{ 2, 3, -2 },{ -4, -4, -4 },{ -1, -4, 2 },{ 3, 0, -3 },{ 1, -2, 1 },{ 1, 1, 2 },{ 2, 3, 0 },{ -1, 0, -4 },{ -3, -3, 2 },{ -2, -1, -4 },{ 0, 3, 3 },{ 3, 1, -4 },{ -4, -4, -3 },{ 3, 2, 1 },{ -3, -1, -3 },{ 3, 0, 1 },{ -3, -2, 2 },{ 1, 3, -3 },{ 3, -3, 3 },{ -2, 1, -3 },{ -4, 2, 2 },{ 3, 0, 1 },{ 2, -4, -3 },{ -3, -2, 2 },{ 0, 3, 0 },{ -4, 1, -4 },{ 3, 2, -2 },{ 0, 0, 1 },{ 2, -3, -3 },{ -1, 3, 3 },{ -2, 0, 2 },{ -3, -3, -1 },{ 0, -2, 1 },{ -3, 1, 3 },{ 2, -3, 2 },{ 1, -2, -4 },{ 3, -4, -3 },{ -1, -1, -2 },{ 0, -2, 0 },{ 2, -4, -4 },{ -2, 1, 2 },{ -3, 3, -2 },{ -4, -3, -4 },{ 0, 3, 1 },{ 2, -1, -1 },{ -2, 2, -4 },{ 0, 3, -3 },{ -3, 1, 1 },{ -1, -2, 3 },{ 0, 0, -4 },{ -3, 2, 1 },{ -4, -1, -3 },{ 0, -3, -2 },{ -2, -1, -1 },{ -4, 2, 0 },{ -1, -3, -4 },{ 1, 3, -3 },{ -2, 0, -3 },{ -1, -1, 0 },{ -3, 1, -2 } }, - { { -4, -4, 1 },{ 1, -1, 3 },{ 3, -3, 1 },{ -3, -2, -4 },{ 1, 0, 3 },{ 3, -1, 0 },{ -2, 1, 3 },{ 0, 3, 2 },{ -4, 1, -4 },{ -2, -4, -1 },{ -4, -2, 2 },{ 3, -4, 1 },{ 1, 2, -3 },{ -4, 3, -2 },{ 2, -2, -1 },{ -2, -4, 0 },{ -1, 0, 2 },{ -2, -2, 3 },{ 1, 3, -2 },{ -2, -4, 0 },{ 2, -2, 3 },{ -1, 1, -2 },{ -3, -3, 0 },{ 1, 2, -4 },{ 0, -4, -2 },{ -4, -1, 3 },{ -1, 2, -3 },{ -2, 2, -1 },{ 1, 0, -4 },{ 2, -2, 2 },{ -1, -1, 3 },{ -2, 3, -4 },{ -3, -1, -1 },{ 2, -2, 0 },{ 0, 1, -3 },{ 1, -4, -2 },{ -1, 0, -3 },{ 3, 3, -4 },{ -4, -1, 0 },{ 0, 3, 2 },{ -2, 0, 1 },{ 2, -3, 3 },{ -4, 2, 1 },{ -2, -1, 3 },{ 0, 2, -1 },{ 3, -2, 0 },{ -1, -4, 3 },{ 3, 0, -1 },{ -2, -3, 2 },{ -3, -3, 0 },{ 1, -1, 2 },{ 1, -4, 1 },{ 2, 3, -1 },{ 3, -3, -2 },{ 1, 2, 2 },{ 1, 1, 0 },{ -1, 3, 3 },{ 2, -2, -4 },{ 2, 0, 1 },{ 0, 1, -1 },{ -4, -2, 2 },{ 2, 2, 3 },{ -4, -4, -1 },{ 3, 3, 2 } }, - { { -1, 0, -3 },{ 0, 2, -4 },{ -3, -1, -1 },{ -1, -4, 2 },{ -1, 1, 0 },{ 0, -3, -1 },{ -3, -2, -2 },{ 2, 2, -4 },{ 2, -3, 0 },{ -3, -1, 3 },{ 0, 2, -2 },{ -2, 1, -3 },{ -1, -2, 0 },{ 3, -3, 2 },{ 1, 0, 3 },{ -3, 1, -3 },{ 1, 2, -1 },{ 0, -3, -4 },{ 2, 0, 1 },{ -4, 1, -3 },{ 0, 2, -4 },{ -4, -4, -2 },{ -2, -1, 1 },{ 3, 0, -1 },{ 0, 3, -4 },{ 1, -2, 2 },{ -3, 1, 0 },{ 3, -3, 3 },{ 0, -4, -1 },{ -3, -3, -2 },{ -4, 1, 0 },{ 1, -4, 1 },{ 0, -3, 2 },{ -4, 1, 3 },{ -2, -1, -4 },{ 3, -3, 2 },{ -4, -1, 3 },{ -2, 2, 0 },{ -3, 1, -2 },{ 1, -2, -1 },{ -2, 1, -1 },{ 3, -3, -3 },{ -3, 3, -4 },{ -1, 0, -2 },{ 2, -2, 1 },{ 1, 1, -3 },{ -1, -1, 3 },{ 1, 2, 1 },{ -4, 2, -2 },{ -1, 1, -2 },{ 3, -2, -4 },{ -3, 2, -1 },{ -1, 0, -3 },{ -4, -1, 2 },{ -2, -4, -1 },{ 3, -2, -3 },{ -4, 0, -2 },{ 1, 3, 2 },{ -2, -1, 0 },{ -3, -4, -2 },{ 0, 1, 1 },{ -1, -3, -2 },{ 0, -1, -4 },{ 2, -3, -2 } }, - { { 0, -2, 3 },{ -4, 3, -1 },{ 3, 0, 0 },{ 2, 2, -2 },{ -4, 3, -3 },{ -2, 1, -3 },{ 3, 0, 1 },{ -2, -1, -2 },{ -1, -4, 1 },{ -1, 3, -3 },{ 3, -2, -1 },{ 1, -1, 3 },{ -4, 0, -1 },{ -1, 3, -3 },{ -2, -3, 1 },{ 0, -1, -2 },{ 3, 3, 1 },{ -4, -1, 2 },{ -1, -3, -1 },{ 3, 3, 2 },{ 1, -1, 0 },{ -1, 0, 1 },{ 2, 3, 2 },{ -3, -2, 3 },{ 2, -4, 0 },{ -1, 1, -1 },{ 2, -2, -2 },{ -4, 0, 1 },{ -2, 3, -3 },{ 1, -1, 2 },{ 3, 2, -3 },{ -2, 0, -2 },{ 3, 2, -1 },{ -4, -4, -4 },{ 2, 3, 0 },{ 1, 2, 1 },{ -1, 0, -1 },{ 1, -4, -3 },{ 2, -3, 3 },{ -1, -4, 1 },{ -4, 3, -3 },{ 1, -1, 2 },{ 3, 0, 0 },{ 0, -4, 2 },{ -4, -3, -3 },{ -2, 3, -2 },{ -3, 0, 0 },{ 2, -4, -4 },{ 0, -2, -3 },{ 2, 0, 3 },{ 0, -4, 3 },{ -4, 1, 1 },{ 2, -2, -4 },{ 0, 1, 3 },{ -2, 0, -4 },{ -1, -4, 1 },{ -3, 1, 0 },{ 0, -3, -4 },{ 3, -4, 3 },{ -3, 3, -3 },{ 3, -1, 1 },{ 1, 0, 0 },{ -3, 2, 2 },{ -2, 1, 0 } }, - { { 1, 0, 3 },{ -2, -3, 1 },{ 1, -2, -4 },{ -2, -4, 2 },{ 2, -1, 3 },{ -3, -3, -4 },{ 0, 2, 2 },{ 1, -3, 3 },{ -4, 0, -1 },{ 2, 2, 2 },{ 1, 1, -4 },{ -3, -4, 1 },{ 0, -3, 0 },{ 2, -1, -4 },{ -3, 1, 2 },{ -3, -4, -1 },{ 2, -4, -4 },{ 0, 2, 0 },{ -3, 0, -3 },{ -3, -4, 3 },{ -2, -2, -1 },{ 0, 2, -3 },{ 3, -3, -4 },{ -3, 0, 0 },{ -4, 3, -3 },{ 0, -1, 1 },{ -2, -4, -3 },{ 2, 2, 3 },{ 0, 1, -4 },{ -3, -2, 1 },{ -1, 3, 0 },{ -1, 0, 3 },{ 1, -3, -3 },{ -2, 2, 2 },{ -1, -2, -2 },{ 0, 1, -2 },{ -3, -2, 2 },{ 0, -2, -4 },{ 3, 2, 1 },{ -3, 0, -4 },{ 1, 1, 3 },{ -3, -2, -4 },{ -2, 2, 0 },{ 2, -1, -1 },{ 0, 1, 1 },{ 3, 3, -4 },{ -4, -1, 2 },{ 0, -4, -1 },{ -2, 2, 2 },{ -3, 3, 0 },{ -2, -3, -2 },{ -1, 2, 1 },{ 1, -4, -2 },{ -3, 3, 0 },{ 2, 3, -1 },{ 3, -3, 1 },{ 0, 2, 3 },{ -3, 0, -1 },{ 2, -2, -3 },{ -2, 2, -1 },{ -1, -2, 3 },{ 1, 3, -4 },{ -3, -4, -1 },{ 3, -4, -3 } }, - { { 2, -1, -4 },{ -4, 1, -2 },{ -1, 2, -1 },{ 0, 1, 1 },{ 1, -1, 0 },{ 2, -4, 1 },{ -1, 0, -4 },{ -3, 3, -1 },{ 0, -2, -3 },{ -4, -1, -2 },{ -2, 3, 2 },{ -2, -3, 0 },{ 3, 2, -2 },{ -1, 2, 3 },{ 3, 3, -2 },{ -4, -2, -1 },{ -1, 1, 3 },{ -2, 2, 1 },{ 1, -2, -2 },{ 2, 0, -4 },{ 1, -2, 2 },{ 3, -4, 3 },{ -4, 1, -2 },{ 0, -1, -1 },{ -2, -3, 3 },{ 3, 2, -4 },{ -1, -3, 0 },{ -3, 0, 2 },{ 3, -2, -1 },{ 1, -3, 2 },{ -4, -4, -4 },{ 2, -1, -2 },{ -3, -2, 1 },{ 0, -1, -1 },{ 2, -4, 1 },{ -3, -3, -3 },{ -2, 1, 3 },{ 2, 3, -1 },{ -4, 0, 2 },{ 0, -3, 0 },{ 2, -4, -2 },{ -1, 2, 1 },{ 0, -2, 3 },{ -3, -4, -2 },{ -1, 2, 0 },{ -3, -2, 3 },{ 2, -3, -2 },{ -1, 0, 1 },{ 3, -1, -2 },{ 1, 1, -4 },{ 3, -1, -1 },{ -2, -1, -3 },{ 3, 0, 2 },{ 1, -2, 0 },{ -2, -3, 3 },{ -4, 1, -3 },{ 1, -1, -2 },{ -1, 3, 0 },{ 1, 0, 1 },{ -4, -3, -2 },{ -4, 1, 3 },{ 2, -1, -2 },{ -2, 0, 1 },{ -1, 3, 2 } }, - { { -3, -3, -1 },{ 0, -2, 2 },{ 3, 3, 1 },{ -3, -3, -3 },{ -4, 3, -2 },{ -2, -2, -1 },{ 3, 2, 2 },{ 1, 1, 0 },{ 3, -3, 3 },{ -1, -4, 1 },{ 3, 0, -1 },{ 1, -1, -4 },{ -4, 0, 3 },{ 1, -4, -3 },{ 0, -2, 0 },{ 1, 0, 2 },{ 2, -1, -3 },{ 3, -3, -3 },{ -1, 2, 0 },{ -4, 1, 2 },{ -2, 3, 0 },{ -3, 2, -1 },{ -1, -3, -4 },{ 1, 1, 2 },{ 2, -2, 1 },{ -4, 0, -2 },{ 1, 3, -3 },{ 0, -4, -1 },{ -2, -1, -2 },{ 2, 2, 0 },{ -3, 1, -3 },{ 3, 3, 1 },{ -3, 1, 3 },{ 1, 0, -3 },{ -4, 3, 3 },{ 3, 2, -4 },{ 3, -1, 0 },{ -1, -4, -2 },{ -3, 3, -2 },{ -1, -1, 3 },{ -2, 3, -1 },{ 3, -1, 0 },{ -4, 1, -3 },{ 2, 0, -4 },{ 3, -3, 2 },{ -1, -1, -3 },{ 1, 1, 0 },{ -3, 3, -3 },{ -4, -2, 2 },{ 1, -3, 1 },{ -3, 3, 3 },{ -4, -4, -4 },{ 0, 2, -1 },{ -1, 1, -2 },{ -4, -1, -4 },{ 2, -1, 2 },{ -2, -4, -3 },{ -3, -2, 2 },{ 3, 1, -4 },{ 2, -4, 2 },{ -1, 3, -4 },{ 0, -2, -3 },{ 3, -3, 0 },{ -4, 1, -2 } }, - { { 1, 2, -3 },{ 3, -4, 0 },{ -3, 0, 3 },{ -1, -1, -4 },{ 3, 1, 0 },{ -2, 0, 3 },{ -3, -4, -3 },{ -4, -2, -2 },{ -2, 1, -4 },{ 0, 2, 0 },{ 2, -3, -2 },{ -3, 3, -3 },{ 2, 1, 1 },{ -3, -1, -1 },{ -2, -3, 0 },{ -2, 1, 2 },{ -3, 3, -1 },{ -4, -4, 1 },{ 3, 0, -4 },{ 0, -3, -2 },{ -3, -1, 1 },{ 1, -2, -3 },{ 2, 0, 0 },{ 0, -1, -2 },{ -2, 3, 2 },{ -1, -4, 0 },{ -3, 1, 3 },{ 1, -1, 2 },{ -4, 3, -4 },{ -1, 2, 3 },{ 0, -4, -1 },{ -2, 0, 0 },{ 3, -3, -4 },{ 1, -2, -2 },{ -1, -4, -1 },{ -4, 0, 0 },{ 0, 0, 1 },{ 1, 1, -3 },{ -2, -1, -1 },{ 3, -3, -4 },{ 1, 1, -3 },{ -3, 0, 2 },{ 1, -3, -2 },{ -2, 3, -1 },{ -4, 3, 3 },{ 1, 0, -4 },{ -2, -4, -1 },{ 3, 2, 3 },{ -1, 0, -1 },{ 0, 1, 0 },{ -1, 0, -3 },{ 2, -2, 1 },{ -3, -3, 3 },{ 3, 3, -2 },{ 1, -4, 1 },{ -1, 2, -1 },{ 3, 3, 0 },{ 0, 0, -2 },{ -3, -3, 0 },{ 0, 1, 0 },{ -2, 2, -1 },{ 1, 0, 1 },{ -3, -2, 3 },{ 0, 3, 2 } }, - { { -1, -1, -4 },{ 1, -4, -3 },{ -2, -2, -1 },{ 2, 2, 2 },{ 0, -3, -4 },{ 1, -1, 2 },{ 0, 3, 1 },{ 2, -1, -2 },{ 2, 3, 2 },{ -1, 0, 3 },{ -4, -2, -3 },{ 0, 1, 2 },{ -2, -2, 1 },{ -1, -4, -4 },{ 2, 2, -2 },{ 3, 2, -4 },{ 0, -3, -3 },{ -3, -1, 3 },{ -2, 3, 3 },{ 2, -4, -1 },{ -1, 1, -2 },{ 3, 2, 3 },{ -2, -4, 1 },{ -4, 3, -4 },{ 1, -3, -2 },{ 2, 1, -3 },{ 3, 2, -1 },{ -2, -3, -4 },{ 2, -2, 1 },{ 3, -1, 1 },{ -2, -3, -2 },{ 0, -2, -3 },{ -4, 2, 2 },{ -1, 2, 1 },{ -2, 3, 3 },{ 1, -2, -4 },{ -2, -3, 2 },{ 0, -3, 2 },{ -4, -2, 3 },{ 2, 2, 1 },{ -4, -4, 1 },{ 0, -4, 0 },{ -1, -2, -2 },{ 2, 2, 2 },{ -2, -2, 1 },{ 0, -1, 0 },{ -4, -3, 1 },{ 2, -2, -2 },{ -3, -4, -4 },{ -2, 2, 2 },{ 3, -2, -2 },{ 1, 2, 0 },{ -4, -4, 2 },{ 0, 1, -4 },{ -3, 0, 1 },{ -2, -2, 3 },{ 1, 1, 2 },{ -4, -3, -2 },{ -2, 2, 3 },{ 2, -2, -3 },{ -1, -1, 2 },{ 3, -4, -4 },{ -2, -3, -1 },{ 2, 2, 0 } }, - { { -1, -2, 1 },{ -4, 0, 3 },{ -2, 3, 1 },{ -4, 2, -2 },{ 1, -3, -1 },{ -1, 0, -3 },{ -4, 1, -1 },{ 0, -4, 3 },{ -2, -2, -4 },{ -3, 2, -1 },{ 1, -4, 0 },{ 3, -1, -1 },{ 0, 3, 0 },{ 2, 1, 3 },{ 0, -2, 2 },{ -4, -1, 1 },{ 1, -2, -1 },{ -1, 0, 0 },{ 0, 1, 0 },{ 1, -2, -3 },{ -3, -3, 2 },{ -2, -1, -3 },{ 0, 2, 1 },{ 3, 0, 3 },{ -3, -4, 0 },{ -1, -1, 1 },{ -4, -2, 0 },{ 0, 0, -3 },{ -1, -3, 3 },{ -3, 3, -2 },{ 1, 1, 2 },{ 2, 0, 3 },{ -3, -4, -3 },{ 2, -1, 0 },{ 3, 1, -1 },{ -3, -1, -2 },{ 2, 2, -3 },{ -1, 2, -1 },{ 2, 3, 0 },{ -3, 1, -4 },{ 1, -1, 3 },{ 3, 2, -4 },{ -3, 0, 3 },{ 3, -1, -1 },{ 0, -4, -4 },{ -3, 1, -2 },{ 3, 2, -3 },{ -1, 3, 1 },{ 0, -1, 3 },{ 2, -3, 0 },{ -4, 3, -3 },{ -2, -1, -2 },{ 3, 0, -1 },{ -2, 2, 0 },{ 2, -2, -3 },{ -1, -3, -3 },{ -4, 3, -1 },{ 1, -1, -4 },{ 3, -1, 1 },{ -1, 3, -1 },{ -3, -3, -3 },{ -4, 3, 2 },{ 0, 0, 0 },{ -3, 1, -2 } }, - { { 3, 3, -2 },{ 0, -1, -1 },{ 2, -2, -3 },{ 3, 1, 0 },{ -1, -4, 3 },{ -3, 2, -3 },{ 3, 3, 1 },{ -2, -3, 0 },{ 1, -3, -3 },{ 3, 0, 1 },{ -4, 0, 3 },{ -1, -3, -2 },{ -3, -4, -3 },{ -3, 0, -4 },{ -4, 3, -1 },{ -1, -4, 1 },{ 3, 2, -3 },{ 2, 3, -2 },{ -4, -2, 2 },{ 3, 0, -4 },{ -4, 3, 1 },{ 0, -3, -1 },{ 1, -1, -4 },{ -4, -2, -1 },{ 2, 1, -3 },{ 1, -3, 3 },{ -2, 3, 2 },{ 2, 2, -1 },{ -4, 0, -3 },{ 1, -4, -1 },{ -4, 1, -4 },{ 3, 3, -1 },{ -3, -2, 0 },{ 1, -3, -2 },{ 0, 1, -4 },{ -4, -4, 1 },{ 0, 0, 3 },{ -3, -4, 0 },{ 3, 0, -2 },{ -1, -3, -2 },{ -1, -2, -1 },{ -2, 3, 1 },{ 1, -3, -3 },{ -4, 3, -3 },{ -1, -3, 1 },{ 2, 2, 3 },{ -2, 0, 2 },{ 1, 1, 0 },{ -4, -2, -2 },{ -2, 1, -4 },{ 0, -4, 3 },{ 1, 1, 1 },{ -1, -3, 2 },{ -3, 3, -4 },{ 1, -4, -1 },{ 2, -1, 2 },{ -1, 1, 1 },{ 3, -4, -4 },{ 0, 0, 3 },{ -4, -4, 1 },{ 1, 2, -2 },{ 3, 1, 3 },{ -2, -1, -4 },{ 2, -3, 3 } }, - { { 1, -3, 0 },{ -3, -4, 3 },{ 0, 1, -4 },{ -3, 0, 2 },{ 1, -3, 0 },{ -2, -2, 2 },{ 3, 0, -4 },{ -4, -1, -2 },{ -1, 1, 0 },{ 0, 2, 2 },{ -2, 3, -4 },{ 2, -1, 1 },{ 3, 2, 2 },{ 1, -2, -1 },{ 1, -3, -2 },{ -2, -1, 3 },{ -3, 0, -4 },{ -2, -4, 3 },{ 1, -1, -2 },{ -1, -4, 0 },{ -1, 2, 3 },{ 2, 1, -2 },{ -2, -3, 2 },{ -1, 3, 0 },{ -1, 0, -2 },{ -3, 2, -2 },{ 0, -4, -4 },{ 3, -1, 0 },{ -1, -2, 1 },{ 2, 0, 2 },{ -2, -3, 0 },{ 0, -1, 3 },{ -2, -1, -3 },{ -1, 2, 3 },{ -2, 0, 2 },{ 3, -2, -3 },{ -2, 3, 1 },{ 1, -2, -4 },{ 0, -1, 1 },{ -4, 1, 2 },{ -2, -2, -3 },{ 0, 2, 0 },{ -3, -2, 1 },{ 1, 1, 2 },{ -2, 0, -1 },{ 2, -2, -4 },{ -4, -4, -2 },{ -1, -3, -3 },{ 2, -1, -1 },{ 3, 3, 2 },{ 1, 0, 1 },{ -3, -3, -3 },{ 2, 2, -2 },{ 0, -2, 3 },{ 3, 0, 1 },{ -4, 3, -2 },{ 0, 2, 0 },{ -3, -2, 0 },{ -2, 2, -3 },{ 2, -3, -1 },{ 0, 0, 0 },{ 1, -2, -4 },{ -1, -4, 1 },{ -4, 3, -3 } }, - { { 3, 0, 2 },{ -2, 2, -4 },{ -2, -3, 1 },{ 2, 3, -2 },{ -4, -1, -2 },{ 0, -2, 2 },{ 2, 2, -1 },{ 1, -4, 3 },{ 2, 3, -3 },{ -3, -2, -2 },{ 1, -4, -1 },{ -1, 0, -4 },{ -4, 1, 0 },{ 0, 3, 2 },{ -2, 1, -3 },{ 3, -3, 0 },{ 0, 2, 2 },{ -4, 1, -1 },{ 2, -3, -3 },{ 3, 2, 1 },{ -3, 0, 0 },{ -4, -2, -3 },{ 2, 3, 3 },{ 0, -4, 1 },{ 3, 1, 2 },{ 2, -2, -4 },{ -4, 1, 1 },{ -2, -3, 3 },{ 3, 3, -3 },{ -3, 2, -4 },{ 1, -2, -2 },{ -1, 2, 1 },{ 3, -4, -4 },{ 2, 3, 1 },{ -4, 1, -2 },{ 1, -3, 0 },{ 2, -1, -1 },{ -2, 2, 3 },{ -3, -4, -4 },{ 2, 3, 0 },{ 3, -4, 3 },{ 2, 0, -2 },{ -1, -1, 3 },{ 3, -4, 0 },{ 0, 2, -1 },{ -3, -3, 2 },{ 3, 0, 0 },{ 0, 3, 1 },{ -3, -2, 3 },{ -2, 2, -3 },{ -3, -4, -1 },{ 0, -1, 3 },{ -4, 3, 0 },{ -2, 1, 1 },{ -2, -1, -2 },{ -3, -3, -4 },{ -1, -3, 2 },{ 2, 0, 3 },{ 1, -2, -2 },{ -3, 3, -3 },{ -2, 1, 2 },{ -3, 2, 2 },{ -1, -2, -1 },{ -4, 2, 0 } }, - { { 1, 0, -2 },{ 0, -2, -1 },{ -1, -4, 3 },{ 2, 2, 0 },{ 3, 0, -3 },{ -2, 3, -4 },{ -1, 1, 1 },{ -4, -3, -1 },{ -1, -1, 1 },{ -4, -2, -2 },{ 3, -3, 3 },{ 0, 2, 1 },{ 2, -3, -2 },{ -4, -1, 3 },{ -1, -4, -4 },{ 1, 3, 1 },{ 2, -2, -3 },{ -1, 1, -1 },{ 0, -2, 1 },{ -2, 3, 3 },{ 1, -4, -4 },{ 0, -2, -2 },{ 3, 0, -1 },{ -3, -4, -4 },{ -4, 0, -3 },{ 1, -1, -1 },{ 0, 3, 2 },{ -3, -1, -1 },{ 0, -4, -2 },{ -1, 1, 1 },{ -4, 3, -1 },{ 2, -1, -3 },{ -4, 0, 2 },{ -3, -4, -1 },{ 0, -2, -4 },{ -1, -1, 3 },{ -4, 3, -3 },{ 0, 0, 2 },{ 2, -3, -3 },{ -1, 1, -1 },{ -4, -1, 1 },{ 1, 3, -4 },{ -4, -4, -2 },{ 3, 0, -4 },{ -4, 1, -3 },{ -1, 3, 1 },{ -3, -1, -4 },{ 1, 1, -2 },{ -1, -3, 2 },{ 0, -1, -4 },{ 2, 1, 0 },{ 3, -2, -4 },{ -1, -3, -1 },{ 2, -4, -4 },{ 1, 0, 3 },{ 1, 1, -1 },{ 3, 3, -3 },{ -4, 2, -2 },{ -1, -4, 2 },{ 3, -1, 1 },{ -4, 0, -4 },{ 2, -3, -2 },{ 3, -1, -1 },{ 0, 1, -3 } }, - { { -3, -1, 2 },{ -4, 3, -3 },{ 2, -1, -2 },{ -4, 1, -1 },{ 1, -4, 2 },{ -3, -3, 3 },{ 0, -1, -3 },{ 3, 0, 0 },{ 0, 3, 2 },{ -2, 2, 3 },{ 1, 0, -4 },{ -3, 1, 0 },{ -2, -2, -1 },{ 3, -2, -3 },{ 2, 0, 1 },{ -3, 0, -2 },{ -3, -3, 0 },{ 1, 3, 3 },{ -4, -1, -4 },{ -3, -1, -3 },{ 3, 1, 2 },{ -2, 2, -1 },{ -4, -1, 1 },{ -1, 3, 1 },{ 1, -2, 3 },{ -2, 2, 0 },{ 3, -3, 0 },{ -1, 0, -3 },{ 1, -2, 2 },{ 2, -3, 2 },{ 3, -4, 0 },{ -2, 0, 3 },{ 0, -2, -1 },{ 1, -3, 0 },{ -3, 1, 2 },{ 3, 2, -2 },{ -3, -2, 1 },{ 3, -4, -1 },{ -3, 2, 0 },{ 0, 0, 2 },{ 1, -2, -3 },{ -3, 2, -1 },{ -2, -3, 2 },{ -1, 2, 1 },{ 1, -2, 3 },{ 2, -3, 0 },{ 0, -4, -1 },{ 3, 2, 3 },{ -2, 1, -3 },{ -4, -4, 1 },{ -1, 3, -2 },{ 1, 0, 2 },{ -1, 2, 2 },{ -2, 2, -3 },{ -4, -2, 0 },{ 0, -4, 2 },{ 2, -1, 0 },{ -2, -3, 1 },{ 2, 1, -4 },{ 1, -2, -1 },{ 0, -4, 0 },{ -3, 3, 3 },{ 1, -3, 1 },{ -2, -4, 3 } }, - { { 3, 3, -4 },{ -1, -3, 0 },{ 0, 0, 2 },{ -3, -2, -4 },{ -2, 1, 0 },{ -1, -4, -2 },{ 1, 2, -1 },{ -3, -2, -4 },{ 2, 1, -4 },{ 3, -4, -1 },{ -4, -1, 1 },{ -1, 3, -3 },{ -2, -4, 2 },{ 1, 2, 3 },{ -1, 2, -1 },{ -4, -1, -1 },{ 3, -4, 2 },{ -2, 1, -2 },{ 3, -3, 0 },{ 1, -4, -1 },{ -1, 1, 2 },{ 2, -2, 0 },{ -2, -3, -4 },{ 1, 2, -2 },{ -2, -3, -3 },{ 2, -1, 3 },{ -3, -4, -4 },{ 2, 2, -2 },{ -4, 3, 3 },{ -2, 1, -2 },{ -3, -1, -4 },{ 1, 3, -3 },{ -1, 1, 2 },{ 3, 2, -3 },{ -2, 3, 3 },{ 2, -4, -4 },{ -1, 0, -2 },{ -2, 1, 3 },{ 2, -2, -4 },{ -1, -3, -2 },{ -3, 2, 1 },{ 3, -2, 3 },{ 0, 0, -1 },{ 2, 1, -2 },{ -3, -2, -3 },{ -2, -1, -1 },{ -4, 0, -2 },{ 2, 3, 2 },{ 0, -2, -1 },{ 3, 0, 0 },{ -4, -3, -2 },{ -3, 1, 3 },{ 2, -3, -1 },{ 3, 0, 0 },{ 0, 3, 1 },{ -3, -2, -2 },{ -1, 1, -4 },{ -4, 3, 3 },{ 0, 0, 0 },{ -2, 2, 3 },{ 3, 1, -2 },{ -1, -2, -4 },{ -4, 2, -3 },{ 2, 2, 1 } }, - { { -2, -4, -3 },{ -2, -2, 1 },{ 2, 1, 3 },{ 3, 2, -4 },{ 1, -1, 2 },{ -4, 0, 1 },{ 2, 3, 1 },{ -3, -2, 3 },{ -2, 1, 2 },{ 0, -3, -2 },{ 0, -3, -1 },{ 2, 0, 3 },{ 3, -2, -4 },{ -3, 1, 0 },{ 0, -3, -4 },{ -2, 3, -2 },{ 0, -2, 3 },{ 2, 0, -3 },{ -2, 2, -4 },{ 0, 0, 3 },{ -4, 3, 0 },{ 0, -4, -3 },{ 0, 0, 3 },{ 3, 0, 0 },{ -3, 2, -2 },{ 0, 1, 2 },{ -4, 1, -1 },{ 3, -2, 1 },{ 0, 0, -3 },{ 0, 2, -4 },{ 2, -4, 1 },{ -1, -2, 0 },{ -4, 0, -2 },{ 2, -3, -4 },{ -4, -1, -1 },{ 0, 0, 0 },{ 1, -3, 1 },{ -4, 3, -3 },{ 0, -1, 2 },{ 1, 0, 0 },{ 2, -4, -3 },{ -2, 3, 2 },{ -4, -4, -3 },{ 1, 0, -4 },{ -1, 3, 1 },{ -2, -4, 3 },{ 1, 1, 1 },{ -1, -2, -4 },{ -3, 2, 0 },{ 1, -1, -3 },{ 2, 2, 3 },{ 0, -2, -4 },{ -3, -4, -3 },{ -4, -1, -2 },{ -2, 2, 3 },{ 2, 0, -1 },{ -3, -4, 2 },{ 3, -2, -3 },{ -3, -3, -3 },{ 0, -1, 2 },{ -2, 3, 1 },{ -3, 0, 2 },{ 2, -2, 0 },{ 0, 0, -1 } }, - { { -4, 0, -2 },{ 0, 3, 1 },{ -3, -4, -2 },{ -2, 3, -1 },{ 0, -3, -2 },{ 3, -2, -3 },{ -1, 0, -1 },{ -1, -1, -3 },{ 1, -4, 0 },{ -3, 3, 1 },{ -1, 1, -3 },{ -4, 3, 1 },{ 1, -4, -2 },{ -4, 2, 2 },{ 2, 0, 1 },{ 3, -1, -3 },{ -1, 1, 2 },{ -4, 3, 0 },{ -3, -3, -1 },{ 1, -1, 1 },{ 2, 2, -2 },{ -4, -2, -3 },{ -3, 3, 3 },{ 3, -3, -1 },{ -1, -2, -4 },{ 1, -4, 1 },{ -2, 3, 2 },{ -1, -1, -1 },{ -2, -3, 0 },{ 3, -2, 0 },{ -4, 1, 2 },{ 1, 3, 3 },{ 2, -2, 1 },{ -2, -4, 1 },{ 0, 2, 3 },{ -3, -2, 0 },{ 3, 1, 2 },{ 1, -4, -2 },{ -4, 2, 3 },{ -3, -1, -1 },{ -1, 3, -4 },{ 3, -1, 0 },{ 0, 1, 3 },{ -3, -1, 0 },{ 3, 2, 2 },{ 0, -3, -2 },{ 2, 0, -4 },{ -4, -4, 3 },{ 3, -3, -2 },{ -2, 3, 2 },{ 0, -4, 1 },{ -2, 3, -1 },{ -1, -1, 1 },{ 1, 1, 2 },{ 3, -3, -3 },{ 0, -3, -4 },{ 1, 0, 1 },{ 2, 3, -1 },{ 0, 1, -2 },{ -4, -4, -1 },{ 3, 0, -3 },{ 1, -3, -4 },{ -1, -4, -1 },{ 1, 1, 3 } } - }, - { - { { 0, -2, 1 },{ -3, -1, 0 },{ 3, -3, 0 },{ -4, 0, -3 },{ 1, 2, 3 },{ 3, -4, -4 },{ 0, 3, 1 },{ -4, -2, 0 },{ 3, 1, -1 },{ 1, -1, 2 },{ -2, 2, 1 },{ -4, -2, 3 },{ -2, -1, -4 },{ 1, 2, 2 },{ 0, 2, -2 },{ -1, -4, 3 },{ 3, 0, 0 },{ -2, 3, 3 },{ -4, -1, -3 },{ 2, -3, 1 },{ 1, 1, -1 },{ -2, -3, 2 },{ -1, -4, -4 },{ 2, -1, -1 },{ -4, 3, 3 },{ 0, 2, -1 },{ -4, 1, 3 },{ -2, 2, 0 },{ -3, 2, -3 },{ 3, 1, 3 },{ -2, -4, 0 },{ -4, 2, -2 },{ 3, -4, 0 },{ -4, -3, 3 },{ 2, 2, -3 },{ 1, -1, -1 },{ -1, 1, 3 },{ -2, -2, 2 },{ 0, -3, -3 },{ -3, -4, 1 },{ 3, 2, -2 },{ 2, 3, 3 },{ -4, -2, -3 },{ 2, -2, 1 },{ -2, 1, -2 },{ -1, 2, -4 },{ -4, 0, 2 },{ 3, -2, -2 },{ 1, 0, -1 },{ -3, -4, 0 },{ -2, 1, -2 },{ 2, 2, 0 },{ -4, 3, 2 },{ 3, -2, -2 },{ -2, 0, 0 },{ 3, -4, -2 },{ 1, -2, 3 },{ -4, 0, 1 },{ 0, -3, -3 },{ 2, -1, -2 },{ 0, 0, -2 },{ 2, -2, 3 },{ -2, -4, -3 },{ -2, 2, -2 } }, - { { 1, -3, -4 },{ -2, 3, -1 },{ 2, 2, -2 },{ 0, 0, 2 },{ -1, -2, -1 },{ -4, 1, 3 },{ -1, -1, -2 },{ 2, -3, -3 },{ -2, 3, -1 },{ -4, 2, 2 },{ -1, -3, -4 },{ 3, 1, -1 },{ -3, -4, 2 },{ -1, -3, -3 },{ 3, 3, 1 },{ -4, -3, -2 },{ 2, 0, -3 },{ -1, -2, -1 },{ -2, 1, 1 },{ 3, 2, 2 },{ -3, -2, -2 },{ 2, -1, -3 },{ 3, 3, -4 },{ 0, 0, 2 },{ -2, 1, -2 },{ -1, -1, -4 },{ 2, -3, 2 },{ -1, -1, 1 },{ 1, -3, -4 },{ -3, -2, 1 },{ 2, 3, -1 },{ 0, -1, -4 },{ 0, 1, -4 },{ -3, -2, -1 },{ -2, 3, 1 },{ 0, -4, -4 },{ -4, -1, -2 },{ 2, 1, -4 },{ -1, 3, -1 },{ 1, -2, 3 },{ -4, 1, 0 },{ -1, -4, -1 },{ -1, 0, -4 },{ 3, -1, -1 },{ -3, 2, 0 },{ 2, -4, -3 },{ 1, 3, 0 },{ -2, -2, 2 },{ -1, -4, -3 },{ 0, 3, -4 },{ -2, 0, -1 },{ 1, -1, 3 },{ -3, -4, -4 },{ -1, 1, -1 },{ 0, 2, 3 },{ -3, -3, -1 },{ 2, 3, -3 },{ -1, 1, 2 },{ 3, 1, 0 },{ -2, 3, 1 },{ -4, -4, 2 },{ 3, 3, -1 },{ -4, 1, 1 },{ 3, 0, 2 } }, - { { -3, -1, -3 },{ -1, -4, 3 },{ -2, 2, 2 },{ 3, -4, -4 },{ -3, -3, -2 },{ 2, -1, 0 },{ -2, 1, -3 },{ 3, 0, 2 },{ -3, -4, 0 },{ 0, 0, -2 },{ 2, -2, -3 },{ 1, 3, 0 },{ 2, -1, 3 },{ -2, 1, -1 },{ 0, -2, -3 },{ -3, 1, 2 },{ 1, 3, -4 },{ -3, -4, 3 },{ 0, -2, -2 },{ 1, 0, -4 },{ 0, -4, 0 },{ -3, 1, 3 },{ -4, -1, 1 },{ 3, -4, -3 },{ 0, -3, 1 },{ -3, -2, 0 },{ 3, -4, -2 },{ 1, 3, -1 },{ -2, 0, -3 },{ -4, 2, -2 },{ 2, 0, 2 },{ -1, -3, 1 },{ 2, 0, 2 },{ -1, 1, 1 },{ 1, -2, -2 },{ 3, 2, 0 },{ -4, -3, 1 },{ 2, 3, -3 },{ -2, -4, 1 },{ 3, -1, -4 },{ -3, -3, -2 },{ 1, -2, -3 },{ -2, 1, 3 },{ 1, -3, 2 },{ 0, -3, 1 },{ 0, -1, 3 },{ -4, 0, -2 },{ -3, 1, 1 },{ 3, -1, 3 },{ -4, 2, 1 },{ 2, -3, 1 },{ 0, 1, -3 },{ -3, -2, 1 },{ 3, -3, 2 },{ 1, -1, -4 },{ -1, 1, -3 },{ -4, -4, 3 },{ -2, -2, -1 },{ 1, -1, -4 },{ 1, -4, -3 },{ -1, 1, 0 },{ -3, -3, -4 },{ -1, 2, -2 },{ 1, 1, 0 } }, - { { 2, -2, -4 },{ -4, 1, -1 },{ 1, -2, 1 },{ -4, -1, -3 },{ 2, 2, 0 },{ 0, 3, 1 },{ -3, -4, 3 },{ 1, 3, -4 },{ -1, -2, 1 },{ 1, -1, 3 },{ -1, -4, 1 },{ -4, 3, 0 },{ -3, -3, -2 },{ 0, 0, -1 },{ 2, -1, 3 },{ -4, -1, 0 },{ 1, -4, 1 },{ 3, 2, 0 },{ -4, 0, -3 },{ -1, 3, 1 },{ -2, -3, 3 },{ -1, 2, -2 },{ -2, 2, 0 },{ 1, 0, -1 },{ 2, 1, 3 },{ -2, 3, -4 },{ 0, 2, -1 },{ -4, 0, 2 },{ -1, -2, 0 },{ 0, -4, 2 },{ 3, -1, 3 },{ -3, -3, -3 },{ -4, -1, -1 },{ 3, 2, 3 },{ -3, 0, -2 },{ -1, -4, 3 },{ 0, -1, 2 },{ 1, 0, 2 },{ -3, 0, -1 },{ 0, 2, 3 },{ 2, 0, 0 },{ -1, 3, 2 },{ 3, 1, 1 },{ -4, 3, -4 },{ -3, 0, -2 },{ -2, 2, -4 },{ 2, -3, -1 },{ 2, 3, -3 },{ -1, -3, -2 },{ -3, -1, 0 },{ 3, -4, 2 },{ -1, 3, -2 },{ 2, 2, -2 },{ -4, -1, -1 },{ -2, 3, 1 },{ 2, -2, 1 },{ 3, 0, 0 },{ 0, -1, -2 },{ -3, 3, 2 },{ -4, 2, 3 },{ 0, -2, -1 },{ 2, -1, -3 },{ -3, -1, 3 },{ 0, -3, 1 } }, - { { 0, 1, 2 },{ 3, 0, -1 },{ -1, 3, -2 },{ -2, -4, 1 },{ 0, 0, 3 },{ -2, -2, -1 },{ 3, 1, -2 },{ -1, -2, 2 },{ -4, -3, -1 },{ 3, 2, -3 },{ -2, 2, -4 },{ 0, 1, 2 },{ 3, -3, -4 },{ -4, 2, -3 },{ 3, -4, 2 },{ -2, 3, -4 },{ -1, -3, -1 },{ 2, 1, -1 },{ 0, -3, 2 },{ 2, -1, -4 },{ 3, 3, -1 },{ 1, -2, -3 },{ -4, -2, 2 },{ -1, -3, -2 },{ -3, 3, 2 },{ -4, -2, -3 },{ 1, -1, 1 },{ 2, 1, 3 },{ 3, -3, -4 },{ 0, 1, -3 },{ -3, 2, 0 },{ -2, 3, -2 },{ 1, -4, -4 },{ 0, -3, -3 },{ -2, -1, 0 },{ 2, 3, -4 },{ -2, 2, -3 },{ -3, -2, -1 },{ 1, -4, -2 },{ -1, 2, -4 },{ -4, -1, 2 },{ -3, -4, -3 },{ 0, -2, -1 },{ -2, -4, -2 },{ 2, -1, 0 },{ 3, -2, 3 },{ -1, -4, 0 },{ 0, 1, -4 },{ 1, 0, 3 },{ 1, 2, -1 },{ -4, -2, -4 },{ -2, 0, 3 },{ 1, -3, 0 },{ -4, 0, -4 },{ 0, -4, 3 },{ -3, 2, -2 },{ -2, -3, -4 },{ 0, 2, 1 },{ 2, -4, -1 },{ -2, 0, -4 },{ 2, -3, 1 },{ 3, 0, 2 },{ -1, 3, -2 },{ -2, -4, 0 } }, - { { -4, 3, -3 },{ -3, -3, 3 },{ 2, 2, -4 },{ -3, -1, 2 },{ 1, 0, -4 },{ 1, -3, -1 },{ -4, 2, -3 },{ 0, -1, -4 },{ 2, 3, 3 },{ -3, 0, -2 },{ -3, -1, -1 },{ 0, -2, 3 },{ 1, -1, 1 },{ -1, 2, 1 },{ -3, 1, 0 },{ 1, 0, -3 },{ -2, 2, -2 },{ -4, -2, 2 },{ -3, 2, 3 },{ -2, -1, -1 },{ -4, 1, 1 },{ 0, -4, 2 },{ 3, 0, -1 },{ 2, -1, -4 },{ 0, -4, 3 },{ 3, 0, 0 },{ -2, -4, -2 },{ -3, -2, -3 },{ -3, 3, -1 },{ 1, -1, -2 },{ 2, -2, 1 },{ -1, 1, 0 },{ 1, 3, 2 },{ 3, 0, 3 },{ -4, 1, 1 },{ 2, -3, -1 },{ -1, -2, 2 },{ 3, 1, -2 },{ 2, -3, 1 },{ -2, -2, 0 },{ 1, 3, -1 },{ 3, 0, -3 },{ 2, -1, 1 },{ -1, 2, 0 },{ 1, 3, 2 },{ -4, -2, -1 },{ -3, 2, 2 },{ -2, 0, 1 },{ 3, -4, -3 },{ -3, 2, 0 },{ 0, -1, -3 },{ 0, 1, 1 },{ 3, -4, 0 },{ -2, 2, -3 },{ 1, -2, 2 },{ 2, 3, 0 },{ -1, -2, -3 },{ -4, 1, 3 },{ 3, -3, 0 },{ -1, 3, -2 },{ -3, 1, 3 },{ 1, -4, -1 },{ -4, 2, -2 },{ 1, -2, 2 } }, - { { 2, -1, -4 },{ -1, -3, 0 },{ 0, 1, 0 },{ 3, -4, -2 },{ -1, 3, -3 },{ -4, -3, 2 },{ -2, 2, 1 },{ 3, -4, 0 },{ -2, 1, 0 },{ 1, -3, 2 },{ 3, 1, -3 },{ -1, -4, -1 },{ 2, 3, -3 },{ -2, -2, -2 },{ 2, -3, -1 },{ 3, -1, 3 },{ 0, -3, 1 },{ 1, 0, -3 },{ 3, 3, -4 },{ -1, -4, -2 },{ 2, -3, -3 },{ -3, 2, 0 },{ -2, 0, -4 },{ 0, 2, -1 },{ -3, 1, 0 },{ 1, 2, -2 },{ -1, -3, 2 },{ 1, 3, 3 },{ -4, -4, 1 },{ -2, 2, 2 },{ 3, -2, 3 },{ -4, 0, -4 },{ -3, -3, -2 },{ -1, -2, -2 },{ 0, 3, -1 },{ 1, -4, 2 },{ -4, 1, -3 },{ -1, 3, 0 },{ -4, 0, 3 },{ 0, 2, -3 },{ 0, 1, 2 },{ -2, -3, 3 },{ -4, -3, -4 },{ 2, 1, 2 },{ 0, 1, -3 },{ 0, -3, -3 },{ 1, -2, 0 },{ -2, 1, -2 },{ -4, -1, 2 },{ 2, -3, 2 },{ -1, -3, -1 },{ -3, 3, 3 },{ 2, -1, -1 },{ -1, 1, 2 },{ -4, -3, -2 },{ 3, -1, -1 },{ 1, 0, 3 },{ -3, -4, 2 },{ 1, -1, -3 },{ -2, 0, 0 },{ -4, -2, 1 },{ -2, 3, -4 },{ 0, 1, -3 },{ 3, 0, 1 } }, - { { -1, -4, 3 },{ -4, 2, -3 },{ 3, -2, -1 },{ -4, 3, 3 },{ 0, 1, 1 },{ 2, -1, -1 },{ 2, 0, -4 },{ 0, -4, 3 },{ -3, 2, -2 },{ -1, -2, 1 },{ -4, -3, 2 },{ 1, 0, 0 },{ -4, 2, 2 },{ -2, -4, -4 },{ 0, -2, 3 },{ -4, 3, 2 },{ -1, 1, -3 },{ 2, -4, 0 },{ -3, -2, 1 },{ 1, 0, 2 },{ 0, 1, 3 },{ -1, -3, -2 },{ 1, 3, 2 },{ -2, -2, 3 },{ -4, -3, 1 },{ 2, 3, -3 },{ -2, 0, -4 },{ 3, 0, -1 },{ 0, 1, -4 },{ -1, 0, -1 },{ 2, -3, -3 },{ -2, -4, 1 },{ 2, 2, 1 },{ -2, -1, -4 },{ -3, 2, 0 },{ 3, -1, 3 },{ -3, -2, -4 },{ 1, 0, 0 },{ -3, -1, -4 },{ 3, -4, 1 },{ 1, -2, -1 },{ -3, 3, -2 },{ -1, 0, 1 },{ -3, -1, 3 },{ -2, -4, -2 },{ -3, 3, -4 },{ 3, -1, 3 },{ -1, 3, -1 },{ 3, -2, -2 },{ -1, 3, 1 },{ 1, 0, -4 },{ -2, 2, -2 },{ 3, -4, -4 },{ -1, -1, -3 },{ -3, 3, 0 },{ 0, 1, 1 },{ -3, -4, -4 },{ 1, 3, -1 },{ 0, 2, -2 },{ 3, 2, 2 },{ 2, -4, -3 },{ 2, -3, 0 },{ 0, -1, 0 },{ -3, -3, -1 } }, - { { 0, 3, 1 },{ 1, 0, 2 },{ -2, -1, -2 },{ -2, -4, 2 },{ 1, -2, -3 },{ -3, 0, 0 },{ -2, -2, -2 },{ -4, -2, 1 },{ 1, 3, -3 },{ 0, 0, -4 },{ 2, 3, -2 },{ 0, -1, -4 },{ -3, 1, 3 },{ 3, 0, -2 },{ 2, 1, 0 },{ -4, 3, -4 },{ -3, -1, -1 },{ 1, -1, 3 },{ -2, 3, 0 },{ -4, 2, -1 },{ 3, -1, -3 },{ -4, -2, 0 },{ 2, 1, 1 },{ 1, -4, -2 },{ 3, -1, -3 },{ -1, -2, 1 },{ -4, -1, 0 },{ 2, -4, 3 },{ -3, -1, 0 },{ 1, -3, -3 },{ -4, 3, 0 },{ 0, 1, -1 },{ 0, 0, 3 },{ 3, -4, 2 },{ 1, -3, -3 },{ -2, 1, -2 },{ 0, -3, 1 },{ 2, 3, -2 },{ -1, -4, -3 },{ -2, 2, 2 },{ -4, 0, -4 },{ 3, -1, 0 },{ 0, -4, -4 },{ 1, 3, 0 },{ 3, 1, -1 },{ 2, -1, 1 },{ 0, -3, 0 },{ -4, 2, -4 },{ 1, -4, 3 },{ 2, 1, -3 },{ -4, -3, 0 },{ 1, -2, 1 },{ -4, 3, 3 },{ 0, 0, 3 },{ 1, -3, -4 },{ 2, 2, 1 },{ -2, 0, -2 },{ -1, -3, 0 },{ -4, -1, -4 },{ -1, 1, 3 },{ -1, -2, -1 },{ -3, 0, 2 },{ 3, 2, 3 },{ -2, 1, -2 } }, - { { 2, 1, 0 },{ -3, -4, -4 },{ 3, -1, 0 },{ 1, 2, -4 },{ 2, -3, 2 },{ -1, 2, -3 },{ 3, 3, 3 },{ 1, 1, -1 },{ 3, -1, -1 },{ -3, 1, 1 },{ -2, -4, 3 },{ 3, -3, -1 },{ -2, -1, -1 },{ -1, 2, 0 },{ 1, -4, 1 },{ 3, -2, -1 },{ -1, 2, -3 },{ 0, -3, -2 },{ 3, -3, 2 },{ -2, -4, -4 },{ 2, -1, -1 },{ -1, 2, 2 },{ -3, -4, -4 },{ -1, -1, -3 },{ -3, 2, 3 },{ 0, 1, -1 },{ 1, 2, -2 },{ 0, -2, -2 },{ -2, 1, 2 },{ 3, 2, 2 },{ -3, -2, -2 },{ 2, -1, 0 },{ -4, 3, -4 },{ 1, 3, -3 },{ -3, -2, 1 },{ -4, 2, -1 },{ 0, 1, 2 },{ 3, -2, 3 },{ 2, -3, -1 },{ -3, 1, 2 },{ 0, -2, -2 },{ 2, 2, 1 },{ -1, -3, -3 },{ -2, 2, 2 },{ -4, -2, -1 },{ 0, 0, 3 },{ -1, -4, -3 },{ -3, 0, 2 },{ -3, 2, -1 },{ -2, 0, 0 },{ 0, -1, 2 },{ -2, -4, -1 },{ 2, 1, 0 },{ 0, -2, -2 },{ -4, 0, 0 },{ 3, -2, -3 },{ -4, 3, 2 },{ 3, -2, 2 },{ 2, -3, -1 },{ -3, 1, 1 },{ 1, -4, -2 },{ -4, 3, -4 },{ -1, -1, 2 },{ 1, -2, -3 } }, - { { -2, 2, -3 },{ -1, -3, -1 },{ -3, 3, 1 },{ -1, 0, 3 },{ -4, 1, -1 },{ 0, -4, 1 },{ -2, -1, -4 },{ -4, -3, 2 },{ -1, -4, 3 },{ -2, 0, 0 },{ 2, -2, -3 },{ 1, 3, 1 },{ -4, 1, 2 },{ 0, -3, -3 },{ 1, -1, -3 },{ -3, -4, 3 },{ -2, 0, 1 },{ -4, 2, 1 },{ 0, 1, -4 },{ -3, 0, -2 },{ 0, 3, 1 },{ 1, -2, -2 },{ -4, 1, 3 },{ 0, 0, -1 },{ 3, -3, 0 },{ -2, 3, 2 },{ -3, -4, -4 },{ 2, -3, 1 },{ -4, 3, -3 },{ -1, 0, -4 },{ -1, -2, 3 },{ 0, -4, 2 },{ -2, -3, -1 },{ -1, -1, -1 },{ 2, 0, 3 },{ -1, -4, 0 },{ -2, 0, -4 },{ -4, 2, 1 },{ 1, -1, -3 },{ -1, 3, 0 },{ 1, -3, 3 },{ -2, -1, -1 },{ -4, 0, 3 },{ 1, -2, -3 },{ 2, -4, -2 },{ -4, 2, 2 },{ 1, 1, -4 },{ 2, -3, 1 },{ 3, -2, -2 },{ 0, -2, 3 },{ 3, 3, -3 },{ -3, 2, -2 },{ -1, 2, -4 },{ -2, 1, 2 },{ 1, -4, -1 },{ -2, -1, 3 },{ -1, -4, -1 },{ 0, 1, -3 },{ 1, 3, -2 },{ -2, 0, -4 },{ 3, 2, 0 },{ 0, -3, -3 },{ 2, -4, -1 },{ -4, -2, 3 } }, - { { 1, -3, 2 },{ -1, 1, 2 },{ 2, -1, -2 },{ 0, -2, 0 },{ 3, 3, -3 },{ -3, -3, 1 },{ 1, 1, -2 },{ 2, 3, 0 },{ 3, 0, -4 },{ 0, 2, 0 },{ -4, 2, -2 },{ -1, -1, -4 },{ 3, -2, 1 },{ -3, 3, -2 },{ -2, 0, 3 },{ 2, 3, -4 },{ 2, 1, -1 },{ 3, -2, 2 },{ 1, -1, 0 },{ 2, -3, 3 },{ -2, 0, 3 },{ 3, -4, -3 },{ -2, 3, 1 },{ 2, 1, -2 },{ -4, -2, 2 },{ -1, 0, -4 },{ -4, 0, 3 },{ 3, -1, 0 },{ 0, 2, -1 },{ 1, -4, 1 },{ 2, 1, -2 },{ 3, 0, -4 },{ -3, 2, 1 },{ 1, -2, -3 },{ 3, 1, 2 },{ 2, 3, -4 },{ -3, -3, -2 },{ 0, -2, -3 },{ -2, 0, -1 },{ -3, 0, -4 },{ 3, -4, 1 },{ 2, 1, -4 },{ -3, 3, 1 },{ 3, 1, 2 },{ -2, -1, -4 },{ -1, 3, 0 },{ 3, -1, 0 },{ -1, 3, -3 },{ -4, -4, -1 },{ -1, 0, -4 },{ 1, -3, 1 },{ -3, -1, 3 },{ 2, -3, -3 },{ 3, -1, 1 },{ -1, 3, -2 },{ -3, 1, -4 },{ 2, 2, 0 },{ -3, -1, 3 },{ -4, 0, 1 },{ 2, -2, 2 },{ -2, -2, 3 },{ -1, 1, 1 },{ -3, 3, -2 },{ 3, 0, -4 } }, - { { 3, -4, 1 },{ 2, 2, -2 },{ -4, -4, -1 },{ -2, 2, -4 },{ 3, -2, 0 },{ -3, 0, 3 },{ -1, -1, -1 },{ 0, -2, 2 },{ -3, -3, -3 },{ 0, -4, -2 },{ -2, -2, 2 },{ 1, -3, 3 },{ -3, 1, -1 },{ 2, -4, -4 },{ 0, 1, 2 },{ -2, -2, 0 },{ -4, -3, -2 },{ -1, 3, -2 },{ -3, -4, -3 },{ -2, 3, 0 },{ -4, 2, -1 },{ 2, -2, 0 },{ -3, -3, -4 },{ 0, 3, -3 },{ 3, -4, -1 },{ 1, -2, -2 },{ -1, 1, 1 },{ 1, 3, -3 },{ -2, -2, -1 },{ -3, -3, 3 },{ -4, 3, 0 },{ -2, 0, -2 },{ 1, 1, 3 },{ 0, -4, 2 },{ -2, -1, -2 },{ -4, -3, 0 },{ 2, 1, 3 },{ 3, -4, 2 },{ -1, 2, 1 },{ 2, -3, 3 },{ -4, 1, -2 },{ -2, 3, 0 },{ -1, -2, -2 },{ 0, -4, -1 },{ 1, 2, 3 },{ -3, -2, -1 },{ -2, -3, -2 },{ 2, 2, 3 },{ -3, 1, 1 },{ -2, 3, -2 },{ 2, 1, 0 },{ -4, 0, 2 },{ 1, -4, 0 },{ -1, -2, -2 },{ -4, -3, 2 },{ 3, 2, 1 },{ 0, -3, -3 },{ 1, -4, 0 },{ -1, 3, -4 },{ 0, -1, -2 },{ -4, -3, -1 },{ 1, 0, 3 },{ 0, -1, 1 },{ -4, 2, 0 } }, - { { -2, 3, 3 },{ -3, 0, -3 },{ 0, -2, 1 },{ 1, 1, 3 },{ -2, 0, -3 },{ 2, -4, 2 },{ -4, 2, -4 },{ 1, 0, -2 },{ -1, 3, 3 },{ -4, 1, 1 },{ 3, -1, -1 },{ -1, 2, 2 },{ 2, 3, -2 },{ -4, 0, 0 },{ 3, -2, -1 },{ -1, 2, 2 },{ 1, -3, -3 },{ 0, 1, 1 },{ 3, 0, 2 },{ -1, -1, -3 },{ 1, -3, -2 },{ 0, 1, 2 },{ -1, -1, 1 },{ 1, -1, 3 },{ -2, -3, 1 },{ -3, 2, -3 },{ 0, -4, 0 },{ 3, -1, 3 },{ -4, -1, -2 },{ -1, 1, -4 },{ 2, -2, 2 },{ 3, -3, -1 },{ -3, -1, 1 },{ -4, 3, -4 },{ -1, 2, -1 },{ 1, 0, 0 },{ -1, 3, 2 },{ -4, -1, -2 },{ -2, 2, -1 },{ 0, -2, 0 },{ 0, -1, -3 },{ 2, -4, 3 },{ 1, -1, 0 },{ -4, -3, -3 },{ 3, 0, 2 },{ 0, -4, 1 },{ -4, -1, -4 },{ 1, 0, 2 },{ 3, -3, 2 },{ 0, -4, -4 },{ -2, -2, -2 },{ 2, 3, -1 },{ 0, 1, 1 },{ -3, 0, -4 },{ 1, 3, 3 },{ 2, 0, -1 },{ -2, -2, -3 },{ -4, -1, 2 },{ 3, 2, -2 },{ 0, -4, 0 },{ 3, 3, -4 },{ -3, 2, -3 },{ 1, -1, -2 },{ -1, -2, -4 } }, - { { 0, -1, -2 },{ -4, 1, 2 },{ 2, -3, -4 },{ -1, 3, -1 },{ -4, -3, 1 },{ 1, 1, -2 },{ 3, 3, 1 },{ -2, -1, 0 },{ 2, -4, -3 },{ 1, 1, -4 },{ 2, 0, 0 },{ -3, -3, -4 },{ 0, -2, -3 },{ -2, -4, 1 },{ 1, -1, 3 },{ -4, 1, -4 },{ 2, -1, 0 },{ -2, -2, 3 },{ -3, 2, -1 },{ 2, -4, -4 },{ 2, 1, 2 },{ -4, 2, -4 },{ -2, 0, -1 },{ 3, 2, -3 },{ -4, 1, 3 },{ 2, 0, -2 },{ -2, 3, -4 },{ 2, -3, 2 },{ 0, 0, 1 },{ 1, 2, 2 },{ -1, 3, -3 },{ 0, -4, -3 },{ -1, 1, 0 },{ 2, -3, -3 },{ 3, -3, 1 },{ -3, -2, -3 },{ 0, -4, -4 },{ 2, 1, -1 },{ 1, -2, -4 },{ 3, 3, 2 },{ -4, 1, -4 },{ -2, -2, 1 },{ 2, 2, -2 },{ -2, 1, 0 },{ -3, 3, -3 },{ -1, 1, 1 },{ 2, -2, -1 },{ 0, 3, -3 },{ -4, 2, 0 },{ 0, -2, -1 },{ -3, -1, 3 },{ 3, 2, -3 },{ -2, -4, -4 },{ -1, -1, 2 },{ 0, -2, -3 },{ -3, -4, 0 },{ -2, 2, 2 },{ 2, 1, -1 },{ -3, -3, 3 },{ -1, 1, 1 },{ -2, -2, 2 },{ 2, -3, -1 },{ -2, -4, 2 },{ 2, -3, 0 } }, - { { 1, 3, 0 },{ -2, -4, 3 },{ 1, 2, -1 },{ 3, -1, 0 },{ -3, -1, -3 },{ 0, -2, -4 },{ -1, -4, 2 },{ -3, 0, -1 },{ 0, -3, 3 },{ -4, -2, 1 },{ -1, 3, 2 },{ -2, -1, -1 },{ 0, 1, 3 },{ 3, -3, 1 },{ -3, 2, -3 },{ -2, 3, -2 },{ 3, -4, 1 },{ 1, 0, -4 },{ -4, 0, 0 },{ -1, 3, 1 },{ -2, -2, 3 },{ 3, -4, -2 },{ -3, 3, 0 },{ 0, -4, -1 },{ 1, 0, 1 },{ -1, -2, 2 },{ -4, -4, 0 },{ -3, 2, -4 },{ 1, 1, -2 },{ -3, -4, -1 },{ 2, -1, 0 },{ -4, 2, 3 },{ -2, 0, -2 },{ 2, -1, 3 },{ 0, 1, 1 },{ -2, 3, 3 },{ -3, -1, 0 },{ -4, 0, 3 },{ -1, -3, 0 },{ -3, -4, 2 },{ 1, 0, -2 },{ -3, 2, -1 },{ 3, -3, 2 },{ -1, -1, -4 },{ 1, 0, 3 },{ 3, -2, -2 },{ -3, 2, 0 },{ -1, -4, 3 },{ -2, -1, -3 },{ 3, 0, 2 },{ 1, 2, 1 },{ -1, -3, 3 },{ -4, 0, -1 },{ 2, 1, -1 },{ 3, 3, 0 },{ -1, 1, 3 },{ 1, -4, -4 },{ 3, -2, 1 },{ 0, 3, -2 },{ 1, -1, -3 },{ -4, 0, 0 },{ -1, 2, 3 },{ -4, 1, -4 },{ 3, 0, 1 } }, - { { -1, 2, -3 },{ -4, -2, -4 },{ 3, 0, -2 },{ -2, -4, 2 },{ -1, 2, 3 },{ 2, -2, -2 },{ -2, 1, 3 },{ -3, 3, -3 },{ 1, -2, 0 },{ 3, 2, -2 },{ -2, -4, -3 },{ -4, 0, 0 },{ 2, 3, -2 },{ -1, 0, -4 },{ 1, -4, -1 },{ -3, 0, 0 },{ -1, -3, -1 },{ 0, 3, 2 },{ -3, -3, -2 },{ 0, -1, -1 },{ 1, -2, 3 },{ -1, -1, -3 },{ 2, -3, 2 },{ -3, -2, -4 },{ 3, -3, -4 },{ -1, 2, 0 },{ 0, -1, 1 },{ 3, -2, -1 },{ -2, 0, -3 },{ -4, -2, 3 },{ 3, -3, -4 },{ 1, 0, -1 },{ -3, -2, 2 },{ -1, 3, -1 },{ -4, 1, -4 },{ 3, -4, -2 },{ 2, 2, -2 },{ 1, -3, 1 },{ 3, 3, -3 },{ -1, -1, -1 },{ -2, 2, 3 },{ 2, -4, 1 },{ 0, 0, -3 },{ -4, 3, 2 },{ 0, -4, -2 },{ -4, -3, 1 },{ 2, 1, -4 },{ 3, 0, 0 },{ -3, -3, -2 },{ -4, 0, -4 },{ -1, -4, 0 },{ 2, -3, -2 },{ -3, 3, 1 },{ 1, -1, -3 },{ -4, -3, 3 },{ -3, -1, -2 },{ 0, -2, -4 },{ -4, 0, -3 },{ -1, 2, 3 },{ -2, -4, -2 },{ 3, 1, -4 },{ 2, -2, 1 },{ 0, 3, -1 },{ -3, -1, -3 } }, - { { 2, -4, 0 },{ 0, 1, 1 },{ -2, -2, 3 },{ 1, 3, -3 },{ -4, 1, 0 },{ 1, -3, 1 },{ 2, 2, -1 },{ 3, 0, -4 },{ -1, -3, -2 },{ 0, 3, 3 },{ 2, -1, -1 },{ 1, -4, -3 },{ 3, -2, 2 },{ -4, 2, 2 },{ 2, -2, 3 },{ -1, 3, -3 },{ 1, -1, 3 },{ -4, 1, -3 },{ 2, -3, -1 },{ 3, 2, -3 },{ -3, 3, 1 },{ -4, 1, -3 },{ 1, 1, 0 },{ -1, 3, 3 },{ -3, 0, -1 },{ 2, 3, -3 },{ 2, 1, -2 },{ -2, -4, 3 },{ -1, 1, 1 },{ 1, 3, 0 },{ 0, 1, 1 },{ -2, -2, -2 },{ 3, 2, -4 },{ 0, -4, 0 },{ 1, -1, 2 },{ -1, -2, -3 },{ -2, 0, 2 },{ 2, 1, -1 },{ -3, -2, -4 },{ 0, 1, 0 },{ 1, 3, -3 },{ -1, -3, -4 },{ -3, 1, 0 },{ 2, -2, 0 },{ 1, -1, -1 },{ -2, 2, 3 },{ -3, -2, -4 },{ 0, 3, 1 },{ 1, 1, 2 },{ 1, 2, -1 },{ -2, 3, -4 },{ 0, 1, 2 },{ -2, -2, -3 },{ 3, -4, 1 },{ -2, 1, -1 },{ 2, 3, 2 },{ 2, 2, 0 },{ -3, 2, 0 },{ 1, -3, 1 },{ 1, -1, 2 },{ -3, -4, -1 },{ -1, 0, 2 },{ 1, -3, -2 },{ -2, -2, 3 } }, - { { 2, 3, 2 },{ -3, -1, -2 },{ -3, -3, 1 },{ 0, 2, -1 },{ 0, 0, -4 },{ -4, -4, -2 },{ -2, -3, 2 },{ -4, 1, 1 },{ 2, -1, 2 },{ -3, 1, -4 },{ -3, -1, 3 },{ -1, 2, 1 },{ -3, 1, 0 },{ 0, -1, -4 },{ 1, -3, -1 },{ -2, 0, 0 },{ 2, -4, 2 },{ 3, -2, -4 },{ -1, 1, 1 },{ -2, -4, 2 },{ 0, 0, 0 },{ 3, -4, -4 },{ 0, 2, 1 },{ -2, -1, -2 },{ -4, -4, 2 },{ 0, 0, 3 },{ -3, -3, -1 },{ -4, -2, 2 },{ 0, 3, -4 },{ 3, -1, -3 },{ -3, -4, -1 },{ -1, 2, 3 },{ 2, -3, 2 },{ -4, 0, -3 },{ -3, 1, 1 },{ -1, -1, -1 },{ -4, -3, -4 },{ 0, 3, 2 },{ -3, -4, 3 },{ 3, -1, -2 },{ -4, -2, 2 },{ 3, -2, 1 },{ -4, 0, -1 },{ -2, 2, 3 },{ 3, 0, -3 },{ 1, 3, 2 },{ -2, -3, -1 },{ 0, -1, -2 },{ -1, -4, 3 },{ -4, -2, -3 },{ 3, -2, 1 },{ 2, -1, -1 },{ -3, 0, 0 },{ 0, 2, -4 },{ 1, -1, -3 },{ -1, -3, -2 },{ 0, -4, 2 },{ -2, 0, -1 },{ 3, -3, -3 },{ -4, 3, -4 },{ 2, 1, 0 },{ -3, 3, -3 },{ 0, -4, 0 },{ -4, 0, -4 } }, - { { 3, 1, -1 },{ 1, -3, -2 },{ 2, 1, -4 },{ 3, -2, 0 },{ -1, -1, 3 },{ 3, 3, 1 },{ -2, -1, -3 },{ 1, -4, 0 },{ 0, -2, -2 },{ -4, 1, 0 },{ -1, -3, -4 },{ 3, -2, 1 },{ -2, 0, -3 },{ -3, -4, -2 },{ -1, 1, 1 },{ -4, 1, -2 },{ 0, 2, 1 },{ -3, 0, -2 },{ -2, 2, 3 },{ -4, -1, -2 },{ 2, -2, -1 },{ -2, 0, 3 },{ 2, -3, -2 },{ 1, 1, 0 },{ 3, -2, 0 },{ 1, -1, -3 },{ -2, 2, 1 },{ 2, 2, -4 },{ 1, -3, 0 },{ -4, -3, -2 },{ 1, -1, 2 },{ -4, 0, 1 },{ -1, 3, -3 },{ 1, -3, -1 },{ 3, 2, 0 },{ 3, 3, 3 },{ 0, -4, -2 },{ 1, 2, 0 },{ -1, 0, 1 },{ 0, -3, -3 },{ -2, 2, 0 },{ 1, 1, 3 },{ -1, -4, -4 },{ -3, -4, -2 },{ 2, -1, -4 },{ -1, 1, 1 },{ -4, -4, -3 },{ 2, 0, 0 },{ 3, 2, 0 },{ -2, -1, 3 },{ 2, -4, -2 },{ -3, 1, 2 },{ 0, 2, 2 },{ -4, -3, 3 },{ 2, 0, 0 },{ -4, 1, 1 },{ -3, -2, -4 },{ 3, 0, 3 },{ -2, -1, 1 },{ 0, 1, -1 },{ -1, -2, 3 },{ -2, -1, 2 },{ 3, 2, -3 },{ -1, -1, 3 } }, - { { -4, -4, 0 },{ -1, -1, -3 },{ -4, 2, 2 },{ -2, -4, 2 },{ -3, -2, -3 },{ -1, 1, -1 },{ 0, 2, -4 },{ 3, 3, 3 },{ -1, 0, 1 },{ 2, -4, -2 },{ 0, 3, -1 },{ 1, -3, 2 },{ 1, 3, -2 },{ 2, 2, 3 },{ 3, -2, 3 },{ -2, 3, -4 },{ 2, -3, 0 },{ 1, -4, -1 },{ 3, 3, -4 },{ 1, 1, 0 },{ -1, -3, -3 },{ -3, 3, 2 },{ -1, -2, -4 },{ -4, 2, -3 },{ -1, 3, 2 },{ 0, -4, -2 },{ -1, 1, 3 },{ 3, -2, -1 },{ -3, 0, 1 },{ -1, 1, 3 },{ 2, 2, -2 },{ 3, -4, -4 },{ -2, 0, 1 },{ -2, -2, -2 },{ 1, -3, 3 },{ -4, 0, -4 },{ -2, -1, -1 },{ 2, -2, -3 },{ -3, 1, 2 },{ -4, 3, -4 },{ 3, -1, -1 },{ 2, 0, -2 },{ 0, 3, 2 },{ 0, -2, 1 },{ -4, 3, 0 },{ 3, -3, 3 },{ 0, 2, 2 },{ -3, -1, -4 },{ -1, 3, -3 },{ 1, 1, 1 },{ -4, -3, -4 },{ 0, 3, -2 },{ -1, -4, -4 },{ -2, -2, -2 },{ 3, 3, 3 },{ -1, -2, 0 },{ 1, 1, -3 },{ 0, 3, -2 },{ -4, 2, 2 },{ 1, -4, -2 },{ 2, 0, 1 },{ -3, 2, -1 },{ 1, -3, -2 },{ 0, 3, 1 } }, - { { -2, -2, -4 },{ -2, 3, 3 },{ 0, 0, 0 },{ 1, 0, -2 },{ 2, 3, 1 },{ 2, -4, -2 },{ -4, 0, -1 },{ -3, -3, 2 },{ -2, 2, -3 },{ 3, 2, 0 },{ -4, 1, 3 },{ -2, -1, -3 },{ -4, 0, 0 },{ 0, -3, -1 },{ -1, -1, -4 },{ -4, -4, 2 },{ 0, 0, -1 },{ -3, -2, 3 },{ -1, -1, -3 },{ -4, -2, 2 },{ 3, 2, 1 },{ 0, 1, -1 },{ 3, -1, 1 },{ -3, -3, 3 },{ 2, 0, -4 },{ -3, -3, 0 },{ -4, 1, -3 },{ -1, -1, 1 },{ -3, -4, 2 },{ 1, 3, -4 },{ -2, -1, -3 },{ 0, -2, 0 },{ -3, 3, 2 },{ 2, 1, -4 },{ -1, -4, -3 },{ 0, 1, 2 },{ -3, 2, 1 },{ 3, -3, -1 },{ 1, 0, 0 },{ -2, -3, 3 },{ -1, -4, -3 },{ -3, -3, 0 },{ -2, 1, 1 },{ 2, -3, -1 },{ 1, 2, -3 },{ -1, -4, -2 },{ -3, 0, 2 },{ 2, -2, -2 },{ -4, -3, -1 },{ 0, -3, 2 },{ 1, 1, 0 },{ -1, 0, 3 },{ 3, -1, 0 },{ 1, -4, -1 },{ 1, -1, -3 },{ -2, 2, -1 },{ -3, -4, 2 },{ 2, -2, -1 },{ -1, -1, 0 },{ -2, -4, -4 },{ 3, -3, -3 },{ -3, -1, -4 },{ -4, -3, -1 },{ 2, 0, 1 } }, - { { 3, 1, -2 },{ 1, -3, 3 },{ 3, 2, -3 },{ -4, -4, -1 },{ -3, 1, 2 },{ -1, -3, 3 },{ 0, -2, 0 },{ 1, -1, -1 },{ -3, -2, -4 },{ 1, -3, 2 },{ 2, 0, -2 },{ -1, -4, -3 },{ 0, 2, 2 },{ -3, -2, 0 },{ 3, 1, -3 },{ 1, -1, 1 },{ 3, 3, -3 },{ -3, 2, 2 },{ 2, -4, 1 },{ -1, 1, -3 },{ -2, -4, 3 },{ 1, 0, -2 },{ -2, -4, -2 },{ 0, 0, -1 },{ 2, 3, 1 },{ -2, -1, -4 },{ 3, -4, -1 },{ 2, 2, -3 },{ 0, -2, -2 },{ 2, 0, -1 },{ -4, -3, 0 },{ 3, 1, 3 },{ -1, -1, -1 },{ 2, -1, 1 },{ -4, 3, 0 },{ 0, 0, -2 },{ 2, -4, 3 },{ -1, -2, -4 },{ -4, 2, 2 },{ 0, 2, -2 },{ 2, -1, 2 },{ -4, 3, -1 },{ -1, 1, -4 },{ 3, -1, -3 },{ -4, 0, 3 },{ -2, 3, 0 },{ 0, -1, -4 },{ 3, 0, 1 },{ 2, 3, 3 },{ -2, 2, -2 },{ -3, -2, -3 },{ 2, 0, 1 },{ -3, 3, -3 },{ -4, 1, 2 },{ -3, 2, -4 },{ 0, -3, 1 },{ 3, 0, 3 },{ -3, -3, -3 },{ 1, 1, -2 },{ -4, 2, 3 },{ 0, 3, 2 },{ 2, 0, 2 },{ 0, 1, 0 },{ -1, 2, 2 } }, - { { -3, -4, -1 },{ -3, -2, 0 },{ -1, -2, -4 },{ 0, -1, 1 },{ 2, -1, -4 },{ -3, 3, -4 },{ 3, 2, 2 },{ 2, 1, -3 },{ -2, -4, 1 },{ 0, -1, -1 },{ -4, 1, -1 },{ 3, -2, 1 },{ 2, 3, -4 },{ -2, -4, 1 },{ -4, 2, -2 },{ 0, 1, 0 },{ -2, -3, -4 },{ 1, 0, 0 },{ 2, -3, -2 },{ 0, 1, -1 },{ -4, -1, -1 },{ 2, 3, -4 },{ -4, -2, 3 },{ 0, -4, 0 },{ -2, 2, 2 },{ 1, -2, 3 },{ -4, 3, 2 },{ 1, -3, 0 },{ 0, 2, 3 },{ -2, -4, 1 },{ -3, -2, -3 },{ 0, 2, 2 },{ -4, -4, -2 },{ 1, -3, -1 },{ -2, -3, 2 },{ 3, 2, -3 },{ -2, -1, 0 },{ -3, 3, 3 },{ 1, -4, -3 },{ -1, -2, 0 },{ 3, 0, -4 },{ 1, -2, 1 },{ -2, -4, 3 },{ -3, 0, 2 },{ 3, -3, -4 },{ 0, 1, -1 },{ -4, -2, 1 },{ 1, -4, -3 },{ -2, 2, -1 },{ 3, -1, 3 },{ -4, -4, -4 },{ 1, -3, 0 },{ 2, 2, -1 },{ 0, -3, 1 },{ -1, 1, 3 },{ 2, -4, -2 },{ -4, 3, 0 },{ -1, 1, -4 },{ 3, -1, 2 },{ -2, 2, 0 },{ -3, -2, -1 },{ 1, -2, -3 },{ -2, -4, 3 },{ 1, -1, -4 } }, - { { 2, 3, -3 },{ 0, 2, 1 },{ -4, 1, 0 },{ 2, 3, 2 },{ -2, 0, -2 },{ 1, -3, 0 },{ -1, 0, 1 },{ -4, -4, -2 },{ 3, 3, 3 },{ -1, 3, 2 },{ -3, -3, -4 },{ -2, -1, 0 },{ 1, 2, 3 },{ 3, 0, -1 },{ -2, -4, 2 },{ 2, -2, 3 },{ -1, -2, -1 },{ -4, 2, -2 },{ -2, -1, 3 },{ 0, 3, -4 },{ -3, -3, 0 },{ -1, -1, 2 },{ 3, 2, 1 },{ -3, 1, -3 },{ 1, -2, -2 },{ 3, 0, -1 },{ -1, 1, -4 },{ -2, -1, -2 },{ -4, 3, -4 },{ 3, 0, 2 },{ 2, 1, -2 },{ 0, 3, -4 },{ -1, 0, 3 },{ 3, 2, -4 },{ -3, 0, 3 },{ 1, 1, -1 },{ -3, -2, -2 },{ 1, 0, -3 },{ 3, 1, -1 },{ -2, -3, 1 },{ -3, 1, 0 },{ 2, 2, -3 },{ 0, 3, -1 },{ 1, -2, 1 },{ 2, -3, -2 },{ -1, 3, 0 },{ 1, 1, 3 },{ -4, -1, -2 },{ -1, -3, 0 },{ 0, 1, -4 },{ -1, -1, 2 },{ 0, 3, -2 },{ -2, -2, 3 },{ 3, -1, -4 },{ -4, 0, 0 },{ 1, -1, -3 },{ 2, -2, -1 },{ -2, 0, 1 },{ 0, -3, -2 },{ 1, 0, 1 },{ 3, -4, -3 },{ -1, 3, 0 },{ 3, -1, 1 },{ -4, 2, -2 } }, - { { -2, -3, -1 },{ -1, 0, 3 },{ 3, -4, -2 },{ 1, -2, 3 },{ -1, -4, -3 },{ -3, 2, -1 },{ -2, 0, 3 },{ 0, -2, -4 },{ -4, -1, -3 },{ 1, 2, 0 },{ 2, 0, -2 },{ 0, -2, 3 },{ -4, -3, -3 },{ 0, -1, -2 },{ -1, 0, -3 },{ -3, 3, 0 },{ 1, 2, -3 },{ -3, -4, 1 },{ 3, 0, 2 },{ 2, -2, 1 },{ 3, 2, -3 },{ 1, 1, 2 },{ -2, -3, -4 },{ 2, 2, -1 },{ -4, -4, -3 },{ -3, 0, 3 },{ 0, -4, 1 },{ -3, -2, -1 },{ 2, -1, 1 },{ -1, 1, 0 },{ -2, -3, 0 },{ 1, -2, -1 },{ -3, -1, 0 },{ 0, -2, 1 },{ 2, 3, -3 },{ -1, -2, 1 },{ -4, -4, 1 },{ 2, -1, -4 },{ 0, 3, 2 },{ -4, 0, -2 },{ -1, -3, 3 },{ 1, -1, -2 },{ -4, -4, -3 },{ -3, 2, 2 },{ -1, 0, -2 },{ -3, -1, 3 },{ 3, 2, -3 },{ -2, -4, 2 },{ -3, 3, -2 },{ 2, 1, -1 },{ 3, -3, 1 },{ -4, 1, 1 },{ -2, -4, -2 },{ -1, -4, -2 },{ 3, 3, 2 },{ -2, 2, 0 },{ -3, 2, -4 },{ 0, -4, 3 },{ -4, 3, -3 },{ -3, -3, 3 },{ -1, 1, -4 },{ -3, -3, -2 },{ -4, 0, -1 },{ 2, 0, 2 } }, - { { 0, -3, -4 },{ -2, 1, 0 },{ -3, -1, -1 },{ -4, 2, -3 },{ 3, 1, 1 },{ 2, -3, 2 },{ 2, -1, -2 },{ -1, 2, 0 },{ 3, -3, -1 },{ -2, 1, 2 },{ 2, -4, -3 },{ -1, 2, 1 },{ -3, 1, -1 },{ 1, 3, 2 },{ -4, -3, -4 },{ 3, 0, 1 },{ 2, -2, 3 },{ 0, 3, -4 },{ -1, -4, -3 },{ -4, -1, -1 },{ -1, 0, 3 },{ 0, -4, -2 },{ -3, -2, -1 },{ 0, -1, 0 },{ -1, 3, 1 },{ 0, -3, 2 },{ 2, 3, -4 },{ 3, 1, -2 },{ -4, -4, 3 },{ 1, -3, -3 },{ -4, -1, -3 },{ 3, 2, 2 },{ -2, -4, 1 },{ -4, -1, -3 },{ 3, -4, -2 },{ -2, 1, -4 },{ 0, -3, 2 },{ -1, 2, 3 },{ -2, -2, -1 },{ 3, -4, -4 },{ 0, 3, 2 },{ -3, -2, -1 },{ 3, 1, 3 },{ 2, 2, -4 },{ -2, -1, 1 },{ 0, -4, -1 },{ 2, -3, -4 },{ 1, 0, 1 },{ 2, -2, 2 },{ -2, 0, -4 },{ -3, -2, 3 },{ 1, 3, -3 },{ 1, 2, -1 },{ -3, 1, 3 },{ 1, 0, -3 },{ -4, -3, 2 },{ 0, -4, 2 },{ 3, -1, -1 },{ 2, -1, -1 },{ 1, 2, 0 },{ 2, 0, -1 },{ -1, 3, 2 },{ 0, 2, 3 },{ 1, -2, 1 } }, - { { -3, -2, -4 },{ 1, 3, 2 },{ 2, 0, -3 },{ 0, -3, 2 },{ -4, 1, -2 },{ -2, 3, -4 },{ 1, -2, 2 },{ -3, 3, -2 },{ -2, -4, 1 },{ 1, 0, 3 },{ -4, -3, -4 },{ 3, 3, 1 },{ -2, -4, -2 },{ 3, -2, 0 },{ -2, -1, 2 },{ 0, 1, -1 },{ -4, -3, -1 },{ -2, -1, -2 },{ -2, 1, 0 },{ 1, 3, 0 },{ -3, -2, -2 },{ -4, 3, 2 },{ 2, 0, 0 },{ 3, 2, 3 },{ -4, -1, -4 },{ 2, -3, -1 },{ -2, 0, 0 },{ 1, 2, -2 },{ -1, 0, 3 },{ 2, 2, 1 },{ 0, 3, -4 },{ -1, 1, -2 },{ 2, -3, 3 },{ 1, 2, -1 },{ 0, 3, 2 },{ -3, 0, -1 },{ 2, 2, 0 },{ -3, 3, -3 },{ 2, -1, 1 },{ -4, 0, 0 },{ 1, 1, -3 },{ -2, -1, 1 },{ 3, -3, -4 },{ -1, -4, 0 },{ 1, -2, 2 },{ -4, 3, -3 },{ -2, 1, 0 },{ 0, -1, -3 },{ -1, 2, 3 },{ -4, -4, -2 },{ 0, -3, 0 },{ 3, -1, 1 },{ 2, 0, -4 },{ -2, -3, -1 },{ 0, -2, 0 },{ 2, 1, -2 },{ -1, 0, 1 },{ -1, 3, -3 },{ -2, 1, -4 },{ -2, -2, 1 },{ -4, -4, 3 },{ 2, -1, -4 },{ -2, -4, -3 },{ 3, 2, 0 } }, - { { -1, -1, 1 },{ -4, -4, 3 },{ 3, 3, -1 },{ -1, -1, 1 },{ 1, -4, -4 },{ -3, -1, 0 },{ 0, -4, 1 },{ -1, 0, -3 },{ 2, 1, -1 },{ -3, 3, -4 },{ -1, -2, -2 },{ -1, -1, 0 },{ 0, 2, 3 },{ 2, 0, -4 },{ -3, 2, -3 },{ -1, -4, -2 },{ 1, 2, 2 },{ 2, -2, 1 },{ 3, 1, 3 },{ -1, -4, -4 },{ 3, 2, 1 },{ 0, -3, -4 },{ -2, 1, -3 },{ 1, -4, 2 },{ -1, 2, -2 },{ -4, -2, 3 },{ -2, 1, -3 },{ -3, -3, 2 },{ -1, -2, 0 },{ -2, -2, -4 },{ -3, -4, 1 },{ 3, 0, 0 },{ -3, 1, -2 },{ -1, -3, -4 },{ -4, 0, 3 },{ 3, -4, -2 },{ -1, -3, 3 },{ 1, 0, -2 },{ -3, -3, -1 },{ 3, -4, -4 },{ -1, 2, 3 },{ -3, 2, 0 },{ -1, 0, -2 },{ -4, 3, -1 },{ 1, 1, 2 },{ -3, 2, -2 },{ 3, -2, 3 },{ -4, -3, 0 },{ 1, 2, -1 },{ 3, 3, -3 },{ -1, 1, -3 },{ -3, -2, 0 },{ -1, -1, 2 },{ -4, 2, 3 },{ 3, -3, -3 },{ -3, 3, -4 },{ 2, -2, 0 },{ -4, -3, 3 },{ 3, 1, -2 },{ 0, -3, 2 },{ 1, -1, -2 },{ 3, 1, 0 },{ -2, -2, -2 },{ -4, 1, -2 } }, - { { 1, -3, -3 },{ -2, 2, -1 },{ 0, 0, -4 },{ -1, -2, 0 },{ -3, 2, 3 },{ 1, 1, -1 },{ 3, -3, 3 },{ -4, 2, -3 },{ 0, -2, 2 },{ 1, -1, 0 },{ 3, 1, 3 },{ -4, -3, -3 },{ 1, 0, -1 },{ -4, -3, 2 },{ 0, -4, 3 },{ 3, 1, 0 },{ -3, 0, -4 },{ -3, -3, -3 },{ 0, 0, 2 },{ 2, -3, -3 },{ -2, 0, 1 },{ -3, -1, -1 },{ 3, -3, 1 },{ -3, -2, -2 },{ 1, 1, -3 },{ 0, -4, 0 },{ 3, -1, 1 },{ 2, 3, -4 },{ 0, 0, -1 },{ 3, 3, 2 },{ -4, -1, -1 },{ 1, 2, -3 },{ -3, -2, 2 },{ 2, 3, 1 },{ 0, -2, -4 },{ 1, -1, 1 },{ -4, 1, 0 },{ -2, -2, -3 },{ 0, 1, 3 },{ -3, 3, 2 },{ 1, -3, -2 },{ 2, -2, -4 },{ 0, -2, 3 },{ 0, -3, 0 },{ 3, 0, -3 },{ -1, -3, 1 },{ 2, -4, -2 },{ 0, 0, -4 },{ -3, -1, 1 },{ 1, -3, 2 },{ -2, 0, -1 },{ 0, 2, 3 },{ 2, -4, -4 },{ 0, 3, -2 },{ -2, -1, 1 },{ -4, 0, -1 },{ 1, -1, 2 },{ 1, -4, -1 },{ -3, 2, 1 },{ -1, 3, -4 },{ -3, -4, -1 },{ -4, 3, 2 },{ 0, -3, 1 },{ 2, 2, 3 } }, - { { -3, -2, 2 },{ 3, -4, 0 },{ -3, -1, -2 },{ 2, 1, 2 },{ -2, -2, -3 },{ 3, 3, -2 },{ 2, 0, 1 },{ -4, -3, -3 },{ 1, 2, 0 },{ -2, -3, -2 },{ 2, -4, 1 },{ -2, 2, -2 },{ 1, 3, 1 },{ -3, -1, -4 },{ 2, 1, -3 },{ -1, 3, 0 },{ 1, -2, -1 },{ -2, 3, 2 },{ -4, 2, 0 },{ 0, -1, -1 },{ -4, 3, 3 },{ -1, -2, -3 },{ 2, 2, 3 },{ -4, 0, 0 },{ -2, 3, 2 },{ 1, 3, -4 },{ -3, -3, -1 },{ -1, 1, 2 },{ -4, -4, -2 },{ 2, 1, 3 },{ -2, -3, -2 },{ 0, -4, 0 },{ -1, -1, 3 },{ 3, -4, -1 },{ -1, 1, 0 },{ -2, 2, -2 },{ 2, 3, -4 },{ 3, -4, 1 },{ -1, -1, -1 },{ 3, 1, 0 },{ -4, 0, -3 },{ 2, -4, 1 },{ -2, 1, 2 },{ -4, -1, -2 },{ 1, 2, -1 },{ -3, 3, -4 },{ -1, -1, 3 },{ -2, 1, -1 },{ 3, 3, 2 },{ -4, -4, -4 },{ 2, -2, 3 },{ -2, 0, -2 },{ -3, 2, 1 },{ 1, -4, 0 },{ 3, 1, 2 },{ 0, 3, -3 },{ -2, 2, -4 },{ -1, 0, 2 },{ 3, -2, -3 },{ 2, 0, 0 },{ 1, -2, -3 },{ -1, 0, 3 },{ 3, 0, -4 },{ 0, 3, -1 } }, - { { -4, 1, 3 },{ 2, 0, -4 },{ -1, 3, -2 },{ 3, -3, 3 },{ -4, -1, 1 },{ -1, -4, -1 },{ -1, 2, -4 },{ -2, 0, 2 },{ -3, -1, 3 },{ 0, 3, -4 },{ -4, 1, -1 },{ -1, 0, 2 },{ 3, -2, 0 },{ -2, -4, -1 },{ -2, -1, 3 },{ -4, -1, 1 },{ 3, -2, -2 },{ 1, 1, -3 },{ -2, -4, -2 },{ 3, -2, -4 },{ 1, -4, -2 },{ 1, 1, 2 },{ -1, 1, -1 },{ 2, -4, -4 },{ 0, -2, 1 },{ -1, 0, 1 },{ 3, -3, 3 },{ -4, -1, 0 },{ 1, -2, -3 },{ 0, 2, 1 },{ -2, 3, -4 },{ 3, 0, 2 },{ -4, 3, -3 },{ -2, 2, -3 },{ -3, -2, 1 },{ 1, -3, 3 },{ -3, -3, 2 },{ 0, 0, -3 },{ -4, -2, 1 },{ 0, 2, 2 },{ -2, -3, -2 },{ -1, 3, 3 },{ 3, -1, -1 },{ -3, 3, -4 },{ -2, 1, 3 },{ 2, -2, 1 },{ -4, -4, 0 },{ 2, 2, -3 },{ -1, -2, -2 },{ 0, -1, 0 },{ 3, 3, 1 },{ -3, -3, -1 },{ 3, 1, -3 },{ -4, -2, -4 },{ -1, -3, 3 },{ 2, -2, -1 },{ -3, -4, 0 },{ -1, -3, 3 },{ -4, 1, -2 },{ -3, -1, 3 },{ -2, 2, 1 },{ 2, -3, 0 },{ -3, -4, -3 },{ 1, -1, -1 } }, - { { -2, -3, -3 },{ 0, 2, 0 },{ -4, -3, 2 },{ 0, 2, -4 },{ 1, 0, -3 },{ -3, 1, 0 },{ 2, -1, 3 },{ 0, -4, -2 },{ 2, -2, -1 },{ 3, 0, -3 },{ 0, -2, 3 },{ -3, -3, -4 },{ 2, 3, -2 },{ -1, 1, 1 },{ 1, 2, -1 },{ 0, -3, -4 },{ -3, -4, 3 },{ 0, 1, 1 },{ 3, 2, 3 },{ -3, -1, 1 },{ -1, 3, 2 },{ -4, 0, -4 },{ -2, -3, -2 },{ 0, -1, -1 },{ -3, 2, -3 },{ 1, 2, -2 },{ 2, 0, -2 },{ -2, 2, -3 },{ 2, 1, -1 },{ -1, -4, 1 },{ -3, 0, -1 },{ 1, -2, -4 },{ 0, -3, 3 },{ 2, -1, 1 },{ -4, 0, -4 },{ 0, 1, -1 },{ 3, 3, -2 },{ -2, 0, -1 },{ -3, 3, 3 },{ 1, 1, -4 },{ 2, -4, -4 },{ -3, 2, -1 },{ 0, -2, 0 },{ 2, -4, -3 },{ 1, -3, -1 },{ 0, 0, 1 },{ 3, -1, -2 },{ -2, 1, 2 },{ 1, -3, 3 },{ -1, 1, -3 },{ -4, 2, -4 },{ -1, -1, 2 },{ 0, 0, -1 },{ -2, -1, 1 },{ 1, -1, 0 },{ -2, 0, -2 },{ 3, 1, -4 },{ 0, 3, 0 },{ 1, -3, 1 },{ 3, -4, -4 },{ 0, 3, -1 },{ -4, 1, -2 },{ -1, -1, -4 },{ -2, 2, 1 } }, - { { 3, -4, -2 },{ 1, 0, 3 },{ -2, -2, -1 },{ 1, -4, 1 },{ 0, 3, 2 },{ -3, -3, -2 },{ 3, -2, 1 },{ -4, 3, 0 },{ 1, 1, 1 },{ -1, -4, 2 },{ -3, 2, 0 },{ 1, 1, 1 },{ -4, -1, 3 },{ 3, -3, -3 },{ -3, 0, -3 },{ 2, 2, 2 },{ -4, 3, -2 },{ 2, 0, -1 },{ -1, -3, -3 },{ 0, -3, 0 },{ -3, 0, 0 },{ 2, -2, 1 },{ 3, 3, 0 },{ -3, -4, 2 },{ 3, -1, 3 },{ -4, -2, 1 },{ -3, -3, -4 },{ 0, -2, 2 },{ -3, 3, 0 },{ 3, -2, 2 },{ -2, -1, 3 },{ -1, 2, -2 },{ 3, -4, -1 },{ -3, 3, 0 },{ 2, 1, -2 },{ -1, -1, 2 },{ 1, -4, 0 },{ 2, -2, -4 },{ -1, -4, 0 },{ 3, -1, -2 },{ -3, -3, 1 },{ 0, 0, 0 },{ 3, 1, 1 },{ -1, -3, 2 },{ -4, 0, 3 },{ -2, 2, -3 },{ -1, -2, -1 },{ -4, 3, -4 },{ 3, 0, 0 },{ -3, -3, 0 },{ 1, 3, -2 },{ 2, -4, 1 },{ 1, -4, 3 },{ 3, 3, -2 },{ -3, 2, 2 },{ -4, 3, 1 },{ 2, -4, 2 },{ 1, 0, -2 },{ -4, -1, -1 },{ -2, 3, -3 },{ 0, -2, 2 },{ 2, -3, 2 },{ 3, 1, 3 },{ 1, -2, 1 } }, - { { 2, 3, 2 },{ -3, 2, -4 },{ -3, 0, -1 },{ 3, 1, -3 },{ -2, -1, 0 },{ 2, 3, -3 },{ -1, 0, -4 },{ 1, 1, -1 },{ -3, -3, -2 },{ -2, 0, -3 },{ 2, 2, -2 },{ 0, -1, -4 },{ -2, -4, 2 },{ 0, 0, -2 },{ -1, -2, 0 },{ 1, 1, 3 },{ -3, -2, 0 },{ -2, -1, -4 },{ 1, -2, 2 },{ -4, 2, -3 },{ 3, -1, -3 },{ 0, -2, -2 },{ 1, 2, 3 },{ -2, 1, -4 },{ 2, 1, -1 },{ -1, -4, 0 },{ 0, 3, -1 },{ -1, 1, 3 },{ 1, -4, -2 },{ -4, 0, -4 },{ 2, -3, -3 },{ 1, 1, -2 },{ -4, 1, 1 },{ 1, -4, 3 },{ 0, -2, -4 },{ -2, 2, -3 },{ -4, -1, 3 },{ -4, 2, 1 },{ 1, 1, 0 },{ -1, -1, 2 },{ -4, -2, -3 },{ -2, 1, 3 },{ 1, 3, -2 },{ -4, -1, -4 },{ 2, 3, -2 },{ 0, -4, 0 },{ -3, 1, 1 },{ 1, -3, 3 },{ 2, -4, -1 },{ 0, 2, 1 },{ -2, -1, 3 },{ -4, -2, 0 },{ -3, 2, -4 },{ -2, 1, -3 },{ 0, -2, -4 },{ 0, -3, -1 },{ -2, -1, 3 },{ -1, 2, -4 },{ -3, -2, 1 },{ 3, 1, 1 },{ -3, 0, 0 },{ -1, -4, -2 },{ -3, 3, -1 },{ -4, 0, -3 } }, - { { 0, -4, -3 },{ -1, -1, 0 },{ 2, -2, 1 },{ -1, -4, 3 },{ -4, -2, -2 },{ 3, -3, 2 },{ -4, 2, 3 },{ -1, -1, -4 },{ 2, -3, 3 },{ -4, 3, 2 },{ 3, -4, 0 },{ -1, -2, 3 },{ 3, 2, -1 },{ -2, 3, 1 },{ -4, -3, -3 },{ -1, -4, 0 },{ 3, 2, -4 },{ 0, -4, -1 },{ -4, 3, 2 },{ 2, 1, -1 },{ -1, 1, 3 },{ -2, -4, -4 },{ -4, -3, -1 },{ -1, 0, -3 },{ 1, 3, 2 },{ -2, -1, -4 },{ 3, -3, 2 },{ -4, 1, -3 },{ 2, -1, 1 },{ -3, 2, -1 },{ 0, 3, 1 },{ -1, -2, 2 },{ -3, 2, 0 },{ 3, 0, -3 },{ -2, -3, 0 },{ 3, 3, 2 },{ 0, -4, -1 },{ -3, 1, -3 },{ 0, 0, -4 },{ 2, 3, -1 },{ 0, 2, 2 },{ 3, -4, -3 },{ -3, -1, -4 },{ -1, -3, 2 },{ -2, 1, 0 },{ 3, -1, 3 },{ 2, -2, -3 },{ -2, 2, -4 },{ -1, -1, -1 },{ -3, 0, -3 },{ 3, 1, -4 },{ -1, -3, -2 },{ 1, 0, 0 },{ -1, -3, 3 },{ 3, -4, -1 },{ 2, 0, 0 },{ -1, -2, -3 },{ 3, 1, 0 },{ 2, -4, -3 },{ -2, -3, 3 },{ 1, 2, -4 },{ 2, -1, -4 },{ -2, 1, 0 },{ -1, -3, 2 } }, - { { 3, -2, -2 },{ -2, 1, 1 },{ -4, 2, -4 },{ 0, 3, -3 },{ 0, 0, -1 },{ -2, 2, 1 },{ 1, -4, 0 },{ -2, -1, -3 },{ -3, -2, 0 },{ 1, 1, 1 },{ 0, -1, -1 },{ -4, 0, -2 },{ -3, 3, -4 },{ 1, 1, 1 },{ 2, -1, -2 },{ -2, 2, 2 },{ 0, -1, 1 },{ 3, 0, -2 },{ -2, -3, 3 },{ -3, 2, 1 },{ 1, -4, 0 },{ 1, 3, 1 },{ -4, 0, 2 },{ 3, -1, 0 },{ -3, -2, 1 },{ 2, 2, -2 },{ -4, -4, -1 },{ 3, 0, 2 },{ 0, -3, -2 },{ -2, -1, -1 },{ 3, -2, 3 },{ -4, -1, -4 },{ -2, -4, -3 },{ -1, 0, 2 },{ 2, -2, -1 },{ -3, 2, 3 },{ 1, -3, 1 },{ -2, -2, -2 },{ 3, -3, 3 },{ -4, -4, 1 },{ -1, 2, -2 },{ 2, -2, 0 },{ 0, -3, -1 },{ 1, 2, 1 },{ 2, 0, -1 },{ -3, -4, -3 },{ -1, 3, 1 },{ -4, 0, 2 },{ 3, 3, -2 },{ -4, -4, 2 },{ 0, -2, 2 },{ 2, 3, -1 },{ 2, -1, 1 },{ -4, 2, 2 },{ -2, 3, -3 },{ -3, 0, 2 },{ -4, 3, 3 },{ -3, -1, -2 },{ 0, 2, 2 },{ -4, 3, -2 },{ 1, -4, 3 },{ 3, 0, 1 },{ -4, -2, -1 },{ 1, 2, 3 } }, - { { -2, 0, -3 },{ 2, -3, -1 },{ 1, 3, 3 },{ 3, -3, -1 },{ -1, -1, 2 },{ -3, 1, -4 },{ 3, -2, -1 },{ 2, 3, 3 },{ 0, -4, -1 },{ -2, 2, -3 },{ 2, -3, -4 },{ -2, -2, 2 },{ 2, -4, 0 },{ 3, -2, 3 },{ -4, -3, -4 },{ 1, 1, -1 },{ -3, 3, -3 },{ -1, -2, 2 },{ 2, 0, -3 },{ 0, -2, -4 },{ -1, 0, -2 },{ 2, -1, -1 },{ -2, 2, -3 },{ 2, -3, 3 },{ 0, -4, -2 },{ -3, 3, 3 },{ -2, 0, -3 },{ 1, -2, 0 },{ -2, 3, -4 },{ -1, -4, 3 },{ 1, 1, 0 },{ 2, 2, 1 },{ 1, -3, -2 },{ 0, 3, -2 },{ -4, 1, 0 },{ 1, -1, -4 },{ 2, 0, -2 },{ -1, 3, -1 },{ 2, 1, 2 },{ -2, -2, -4 },{ -3, 0, -2 },{ -2, 0, 1 },{ 3, -1, 2 },{ -4, 3, 3 },{ -1, 1, -4 },{ 0, -3, -2 },{ 1, -2, 3 },{ -2, -3, 0 },{ 0, 1, 0 },{ 1, -2, -3 },{ -2, 2, 3 },{ 0, 1, -2 },{ -3, -4, -4 },{ 0, 1, 1 },{ 3, -1, -1 },{ 1, -3, -4 },{ 2, 1, 1 },{ 1, -4, -4 },{ -2, -1, -1 },{ -1, -2, -1 },{ -3, 0, -3 },{ -1, 1, 0 },{ 0, -4, -4 },{ -3, 3, 3 } }, - { { -1, -1, 0 },{ -4, -4, 2 },{ -2, -2, -3 },{ 2, 0, 0 },{ -3, 1, -2 },{ 1, -3, 1 },{ 0, 2, 1 },{ -4, 0, -4 },{ 3, 1, -2 },{ -3, 3, 1 },{ 1, 0, 3 },{ -3, 1, -1 },{ 0, 2, -3 },{ -1, 0, 2 },{ -2, -4, -1 },{ 0, -2, 3 },{ 3, 0, 1 },{ -4, -4, 0 },{ -1, 2, -2 },{ -4, -1, 3 },{ 3, -4, 2 },{ -3, -2, 1 },{ 0, 2, -4 },{ 1, 0, -1 },{ -1, 1, -4 },{ -1, -1, 1 },{ 0, 1, 0 },{ 1, 2, 2 },{ -4, 2, -4 },{ 2, -4, 1 },{ -3, 1, -3 },{ -3, 0, -1 },{ 3, -4, 2 },{ -2, -1, 1 },{ 3, 1, 3 },{ -1, -4, -4 },{ -3, -3, 0 },{ -4, 0, 2 },{ 3, -1, -3 },{ 1, 3, 0 },{ 1, -4, 3 },{ -4, 1, -4 },{ -1, -2, -3 },{ -3, -4, -2 },{ -2, -2, 0 },{ 1, 0, 1 },{ -4, 2, -3 },{ 3, 1, -1 },{ 2, -1, -4 },{ 2, -4, 1 },{ -2, 2, 0 },{ -4, 0, -3 },{ 3, -3, 3 },{ -2, -2, -3 },{ -4, -2, -1 },{ -1, -4, -2 },{ -2, 3, 0 },{ 0, -3, 1 },{ 3, 1, 2 },{ 2, -3, 0 },{ 0, 3, -2 },{ -4, -3, 2 },{ 3, -1, -2 },{ 1, 2, -1 } }, - { { -3, 1, -4 },{ 0, 3, 1 },{ 0, 1, 2 },{ -4, -4, -2 },{ -1, -1, 3 },{ 2, 3, -3 },{ -4, -4, 2 },{ -2, -1, -2 },{ -1, -3, 3 },{ 1, -1, 2 },{ -1, -4, -1 },{ -4, -2, -4 },{ 0, -1, -2 },{ 3, 3, 0 },{ -4, 2, -3 },{ 2, 0, -2 },{ -2, 3, -4 },{ 1, 1, 0 },{ 1, -3, -3 },{ 2, 3, -1 },{ -3, 2, 0 },{ -1, 1, -3 },{ 3, -3, 3 },{ -4, 3, -2 },{ -2, -4, 2 },{ 2, -1, -3 },{ 3, -3, -1 },{ -3, -2, 2 },{ 0, -1, -3 },{ -2, 0, 0 },{ 0, -2, -2 },{ -1, 3, 3 },{ 0, 2, -4 },{ -4, -3, -1 },{ -3, -2, -3 },{ -1, 3, 1 },{ 3, -2, -1 },{ 0, 2, 3 },{ -1, -1, -2 },{ -3, -3, 2 },{ 0, 2, -1 },{ 3, -1, 1 },{ 2, 2, 0 },{ 0, 3, -4 },{ 3, -1, 2 },{ 2, -4, 0 },{ -3, 3, -2 },{ -1, -2, 3 },{ -3, 3, -3 },{ -4, 0, 2 },{ -1, -2, -1 },{ 1, -3, 0 },{ 1, 3, 1 },{ 2, 1, 0 },{ 0, 2, 2 },{ 3, 0, 3 },{ 0, -2, -3 },{ -4, 0, -3 },{ -2, 2, 3 },{ -3, -2, -4 },{ 1, 0, -3 },{ 2, 3, 1 },{ -2, -2, 2 },{ 2, -3, 0 } }, - { { 1, 2, -2 },{ 2, -2, -4 },{ 3, -2, -1 },{ -2, 0, 1 },{ 2, 2, -4 },{ -3, -2, 0 },{ -1, -3, -1 },{ 3, 0, 0 },{ 2, 2, -4 },{ -2, -2, 0 },{ 3, 3, -3 },{ 2, 2, 1 },{ -3, 1, 2 },{ 1, -3, 3 },{ -3, -3, 0 },{ -1, -1, 2 },{ -3, -4, 2 },{ 3, -2, 1 },{ -2, -1, 3 },{ 0, 1, 1 },{ -2, -1, -4 },{ 0, -4, -2 },{ 1, 0, 2 },{ -3, -2, 1 },{ 3, -2, 0 },{ -4, 2, -4 },{ -3, -4, 1 },{ -1, 1, -2 },{ 3, -3, 3 },{ 2, 3, -1 },{ -4, -3, 1 },{ 3, -2, -3 },{ 2, 0, 0 },{ 0, -1, 2 },{ 2, 1, -2 },{ 1, 0, 2 },{ 0, 3, -1 },{ -2, -4, -3 },{ -4, 1, -4 },{ 2, -2, 0 },{ -1, -4, -3 },{ -3, 3, -2 },{ -1, -3, 3 },{ -2, -1, -1 },{ -4, 1, 2 },{ 0, 1, -3 },{ -1, -3, -1 },{ -2, -4, 1 },{ 1, 0, 2 },{ 0, -3, -4 },{ 3, 3, -2 },{ -3, -1, 3 },{ -1, 0, -3 },{ -2, 2, -2 },{ -3, -4, -4 },{ -4, 0, 2 },{ -1, 3, 0 },{ 2, -1, -1 },{ 1, -4, -2 },{ -3, 2, 1 },{ -1, -4, 3 },{ -2, -1, -1 },{ -1, 1, -3 },{ -4, -4, 3 } }, - { { -1, -3, 2 },{ -3, -1, -2 },{ -4, 2, 3 },{ -1, 3, -3 },{ 3, -3, -1 },{ 1, 1, 2 },{ 0, 3, -3 },{ 0, -1, 1 },{ -4, 2, -4 },{ 1, -3, 2 },{ -4, 0, -2 },{ 0, -3, 1 },{ -2, 0, -4 },{ 3, -4, -2 },{ -1, 2, -4 },{ 1, 0, -1 },{ 2, 2, -2 },{ -3, -3, -4 },{ -4, 3, -1 },{ 1, -4, -4 },{ 2, 2, 3 },{ -4, -3, 0 },{ 2, -1, -1 },{ -2, 3, -3 },{ 0, 2, 3 },{ 1, 0, -2 },{ -1, 3, 3 },{ -4, 3, -3 },{ 1, -1, 0 },{ -1, 2, -4 },{ -2, 0, 2 },{ 1, -1, 1 },{ -4, 2, -1 },{ -2, -4, -3 },{ -1, 2, 3 },{ -4, -2, -4 },{ -3, -3, 0 },{ 2, 1, 1 },{ 3, -3, 3 },{ 1, 2, -1 },{ -3, 0, 2 },{ 0, 0, 3 },{ 2, -2, -3 },{ 1, -4, 1 },{ -3, 2, -3 },{ 1, 0, 3 },{ 3, -1, -4 },{ -4, 2, -2 },{ 3, -1, 0 },{ 2, 1, 2 },{ -2, -2, -1 },{ -4, 2, -4 },{ 2, -4, 1 },{ 1, -2, -1 },{ 0, -1, -1 },{ 2, -3, -4 },{ -2, 1, 1 },{ 3, -3, 2 },{ -4, -1, -1 },{ 0, 1, 1 },{ 3, 0, 0 },{ -4, 2, -2 },{ 1, 3, -4 },{ 3, 0, 0 } }, - { { 2, 3, 1 },{ -1, 0, -3 },{ 1, -4, 0 },{ -3, 0, -3 },{ 1, -3, 1 },{ -3, -1, 3 },{ -4, -4, -2 },{ 1, 0, 3 },{ -3, -4, -1 },{ -1, 1, 1 },{ -1, -1, 3 },{ -2, -2, -3 },{ 2, 1, -1 },{ -4, -2, 2 },{ 0, 3, 1 },{ -4, -2, -3 },{ 0, 0, 0 },{ -1, 3, 3 },{ 0, -2, -2 },{ 3, 0, 2 },{ -3, -2, -3 },{ -1, 3, 2 },{ 3, 1, 1 },{ -2, -4, -4 },{ -3, -1, -1 },{ 3, -3, 2 },{ 0, -2, -1 },{ 2, 0, -4 },{ -2, 1, 2 },{ -3, -3, 0 },{ 2, -4, -3 },{ -1, 1, 3 },{ -3, -4, -4 },{ 3, 3, 1 },{ 2, -3, 0 },{ 1, 0, -3 },{ -2, -1, -2 },{ -2, 3, 2 },{ 0, 0, -4 },{ -4, -4, -2 },{ -2, -2, -3 },{ 2, 1, 0 },{ -4, 1, -1 },{ 3, 3, 1 },{ -1, -3, -2 },{ 0, -2, -4 },{ -3, -3, 1 },{ 1, 2, 3 },{ -3, 1, -3 },{ 0, -3, -2 },{ -3, 1, 1 },{ -1, -4, 3 },{ 3, 3, -3 },{ -4, 1, 2 },{ -1, -1, 3 },{ 3, 3, 0 },{ -3, -4, -3 },{ 1, 1, -4 },{ -1, 3, 2 },{ -1, -2, -3 },{ 2, -3, -4 },{ 1, -4, 3 },{ -3, -1, 2 },{ 0, -2, -1 } }, - { { -4, -1, 3 },{ 2, -4, 0 },{ -2, 2, 2 },{ 0, -2, -1 },{ 3, 1, 0 },{ -2, 2, -4 },{ -2, 3, -2 },{ 2, -2, 0 },{ 3, -2, -3 },{ 0, 3, -2 },{ 2, -4, -1 },{ 3, 3, 0 },{ -3, 2, 0 },{ 1, 1, 3 },{ 3, -1, -1 },{ -2, -4, 3 },{ 3, 1, 0 },{ -2, -3, 2 },{ 2, 1, 1 },{ -2, -1, -1 },{ -1, 2, 0 },{ -4, 0, -2 },{ 1, -2, -2 },{ 0, -3, 3 },{ -1, 1, -3 },{ 2, 1, 0 },{ -2, -4, 1 },{ -4, -1, 0 },{ 3, -4, 1 },{ 0, 2, -2 },{ -4, -1, -1 },{ 1, 3, -2 },{ 0, -2, -1 },{ -2, -1, 2 },{ -3, 2, 3 },{ 0, -4, 1 },{ 3, 1, -1 },{ -1, -3, 2 },{ 2, -1, 0 },{ 1, 2, 1 },{ 3, 3, -4 },{ 0, -3, 3 },{ -3, -1, -4 },{ -1, -4, -1 },{ -2, 0, 2 },{ 2, 1, 0 },{ -2, 3, 2 },{ 2, -2, -1 },{ -1, -4, 0 },{ -2, 3, 2 },{ 1, -3, -3 },{ 0, -1, 0 },{ 2, -2, -1 },{ 0, 0, 1 },{ -3, -3, -3 },{ 1, 2, -2 },{ -4, -2, 3 },{ 0, -2, -2 },{ -3, 0, 3 },{ -2, 3, -2 },{ 2, -2, 0 },{ -3, 1, 1 },{ -1, 1, -2 },{ -2, -3, -3 } }, - { { -3, 2, -4 },{ 3, 1, -2 },{ 0, -2, -4 },{ -4, 3, 3 },{ 2, -1, -3 },{ 2, -2, 1 },{ -4, 1, 3 },{ 0, -3, -4 },{ -1, 2, 0 },{ -3, 1, 3 },{ -4, -1, -4 },{ 1, -2, 2 },{ -1, -3, -4 },{ -1, -3, -2 },{ -3, 0, -3 },{ 1, 2, -4 },{ -3, -4, -2 },{ -4, -1, -4 },{ 1, 1, -3 },{ -3, -4, -3 },{ 3, -4, 3 },{ 1, -1, -4 },{ 2, 2, 1 },{ -3, -1, 0 },{ -4, 3, -2 },{ -1, 0, 3 },{ 1, 2, -3 },{ -3, -2, -4 },{ 1, 1, -2 },{ -1, 3, 3 },{ 2, -2, 1 },{ 3, 0, 2 },{ -1, -3, -4 },{ 2, -1, -3 },{ 1, 1, -1 },{ 3, -2, -2 },{ -3, 0, -4 },{ 0, 2, 3 },{ -4, -2, -3 },{ -3, 1, 0 },{ -2, -4, -2 },{ -1, -1, 1 },{ 1, 2, 2 },{ -4, 3, -3 },{ 3, 1, -2 },{ -3, -1, 3 },{ 2, -4, -1 },{ 0, 0, -4 },{ -4, 0, 1 },{ 3, 2, -4 },{ 2, 0, 3 },{ -4, 2, 0 },{ -2, 3, -2 },{ -2, 1, -4 },{ 1, -4, 0 },{ 3, 2, -1 },{ -1, -1, 1 },{ 2, 2, -4 },{ 1, -4, 0 },{ 3, 2, -1 },{ -4, -3, 2 },{ 0, 2, -4 },{ 3, -2, -1 },{ 1, 3, 2 } }, - { { -2, -1, -2 },{ 0, -3, -1 },{ 1, 1, 1 },{ -3, -3, 2 },{ -1, 0, -2 },{ -1, -4, -1 },{ 1, 0, 1 },{ -3, -1, 2 },{ 3, -4, -1 },{ -2, -3, 1 },{ 0, 0, 2 },{ -3, 3, -3 },{ 0, 0, 1 },{ 2, -4, 1 },{ -2, 3, 2 },{ 2, -1, 2 },{ 0, -2, 1 },{ 3, 3, -1 },{ 2, 2, 2 },{ 0, 0, 3 },{ -4, 3, -1 },{ -2, -3, 0 },{ 0, 2, -3 },{ 3, -1, 2 },{ 1, -2, 1 },{ 2, -4, -4 },{ -3, 3, 2 },{ 3, -1, -1 },{ -2, -3, 3 },{ 2, 1, -3 },{ -3, -4, -4 },{ -4, 0, 0 },{ -2, 2, 3 },{ -3, 3, 0 },{ -4, 0, -4 },{ -1, 3, 2 },{ -4, -4, 0 },{ 1, -1, -2 },{ 3, -3, 1 },{ -1, 3, -1 },{ 2, 0, 3 },{ -4, -3, -3 },{ 2, -2, -1 },{ 1, -3, 1 },{ 0, -2, 0 },{ -4, 2, -4 },{ -1, -3, 1 },{ 1, 3, -3 },{ -2, -1, 3 },{ -3, -2, -2 },{ 3, -4, -1 },{ -1, -2, -4 },{ -3, -3, 2 },{ 3, -1, 3 },{ -1, -2, 2 },{ -4, 0, -3 },{ -2, -3, 1 },{ 0, 0, 2 },{ -4, -3, -3 },{ -2, -1, 1 },{ 0, 0, -3 },{ -1, 1, 3 },{ -4, 0, 0 },{ 1, -4, 1 } }, - { { 2, 3, 2 },{ -1, -2, -3 },{ -4, 2, 0 },{ -2, -4, 3 },{ 3, -1, -4 },{ -3, 2, 0 },{ 0, 3, -3 },{ 1, 1, -3 },{ -4, 3, -1 },{ 2, 2, -2 },{ 1, -1, -4 },{ 3, -4, -2 },{ -4, -1, 3 },{ 2, 2, -2 },{ -4, -2, 0 },{ 0, 2, -2 },{ -1, 0, -3 },{ -3, -3, 3 },{ -4, -3, 0 },{ 0, -2, -4 },{ 2, 1, -2 },{ -1, 1, 1 },{ -3, -3, -1 },{ -2, -4, 2 },{ -4, 1, -1 },{ 0, 2, -2 },{ -2, -3, -1 },{ -1, 0, 2 },{ -4, 2, 1 },{ 0, -2, -2 },{ -2, -1, 1 },{ 1, -4, -2 },{ 3, 1, -1 },{ 0, -3, 3 },{ 2, -4, -2 },{ -1, -2, 1 },{ 1, 1, -3 },{ -2, 3, 3 },{ -2, -2, -4 },{ 1, 0, -2 },{ 0, -4, 2 },{ -1, 2, -3 },{ 3, 0, 0 },{ -3, 3, 3 },{ -2, -4, -2 },{ 1, 1, -3 },{ 3, -2, 2 },{ -4, 1, -1 },{ 0, -4, 0 },{ 1, 3, 1 },{ 0, 1, 2 },{ -4, 0, -1 },{ 1, -3, -3 },{ 0, 2, 1 },{ -2, 3, -1 },{ 1, 1, -4 },{ 3, -4, 3 },{ -3, 3, -2 },{ 2, 1, -1 },{ 3, 3, 3 },{ -3, -2, -2 },{ 2, -3, 2 },{ 3, -4, -3 },{ -2, -1, 1 } }, - { { 2, 0, -4 },{ -3, -1, 3 },{ 3, 3, -3 },{ 2, 0, -1 },{ 1, 2, -2 },{ -4, -3, 3 },{ 3, -2, 2 },{ -2, -4, -4 },{ -1, 0, 3 },{ 2, -3, 2 },{ -3, 1, 1 },{ -2, -2, 0 },{ -1, 2, -1 },{ 3, 1, -4 },{ -2, -2, -1 },{ 1, -3, 0 },{ 3, 1, -4 },{ -2, -1, 1 },{ -1, 2, -2 },{ -2, 0, 1 },{ 3, -4, 0 },{ -4, -2, 3 },{ 1, 0, -3 },{ 3, 3, -4 },{ 0, -2, -3 },{ -3, 1, 3 },{ 2, -1, 0 },{ 3, -4, -4 },{ 1, 3, -3 },{ -1, 0, 0 },{ 3, 2, 3 },{ 0, 3, -1 },{ -3, -2, 2 },{ -1, 1, -3 },{ 3, -2, 0 },{ -2, 2, -1 },{ 2, 0, 1 },{ -3, -4, -1 },{ 2, -1, 0 },{ 0, 2, 1 },{ -4, -1, 2 },{ -3, 3, -4 },{ 2, 1, 1 },{ -1, -1, -4 },{ 0, 0, 3 },{ -3, 2, 0 },{ 1, -3, -2 },{ -1, -1, 3 },{ 3, 2, -4 },{ -2, -2, -3 },{ -1, 3, -1 },{ 2, -1, -3 },{ 3, 2, 3 },{ -3, 0, -2 },{ 2, -4, 0 },{ -3, -1, -3 },{ -4, 0, 2 },{ 0, -2, 0 },{ -1, -1, 0 },{ 1, -4, -4 },{ -3, 3, 0 },{ -2, 2, -4 },{ 0, 1, -2 },{ -4, 2, 0 } }, - { { -3, -4, 2 },{ 0, -2, -2 },{ 0, -4, 0 },{ -2, -1, 1 },{ 0, 1, -4 },{ -2, 1, -1 },{ 2, -1, 1 },{ -1, -2, 0 },{ -3, 0, -1 },{ 0, -2, -2 },{ -1, -4, -4 },{ 1, 3, 3 },{ -3, -1, 2 },{ 0, -4, -3 },{ -2, 0, 3 },{ -4, 3, 1 },{ 2, -4, -1 },{ -3, 3, 3 },{ 1, -4, -3 },{ 2, 2, 2 },{ -1, -1, -3 },{ 0, 3, -2 },{ 2, -1, 2 },{ -1, 2, 1 },{ -1, 0, 0 },{ -2, -3, 1 },{ 1, -1, -3 },{ -4, 2, 1 },{ -3, -3, 2 },{ 2, -2, -1 },{ -4, 1, -4 },{ 1, -1, -3 },{ -2, -3, 1 },{ 1, 0, -2 },{ -3, 2, -4 },{ -4, -1, 2 },{ 3, -3, 3 },{ -1, 2, -3 },{ 0, 1, -4 },{ -4, -4, 3 },{ 3, -3, -2 },{ -2, -2, 0 },{ 1, -3, -1 },{ -4, -4, -2 },{ 3, -2, -1 },{ 2, 0, 1 },{ -2, 3, -4 },{ -3, -3, 2 },{ 2, -4, -2 },{ -4, 0, 0 },{ -3, -3, 3 },{ 0, -4, 1 },{ -2, 1, 0 },{ -4, -2, -4 },{ 0, -3, 3 },{ 2, 3, -1 },{ 1, 2, 2 },{ 3, -2, -2 },{ -1, 2, -3 },{ -4, -3, 1 },{ 0, -1, -1 },{ 3, 0, 2 },{ -1, -2, 3 },{ 1, -3, -1 } }, - { { 3, 0, 3 },{ -1, 1, -2 },{ 2, 2, 1 },{ -4, -3, 2 },{ -3, 3, -3 },{ 3, -4, 2 },{ -4, -3, -2 },{ 1, 2, -3 },{ 3, 3, -2 },{ 1, 2, 2 },{ -4, 0, 1 },{ 2, 2, -3 },{ 2, -3, -2 },{ -3, -3, 0 },{ 1, 3, 2 },{ 3, -2, -4 },{ 0, -1, 0 },{ -4, 0, -1 },{ 3, 1, -3 },{ 1, -2, 0 },{ -3, -3, -1 },{ -3, 2, -4 },{ -4, -4, -1 },{ 3, -2, 3 },{ -3, -4, -2 },{ 2, 3, -1 },{ 3, 2, -4 },{ -2, 0, 2 },{ 0, -2, -2 },{ -1, 0, 3 },{ -3, -4, 0 },{ 0, -3, 2 },{ -4, 2, -3 },{ 2, 3, 3 },{ 0, -4, 1 },{ 1, 0, -4 },{ 0, -2, -2 },{ -3, -1, 0 },{ 1, 3, 2 },{ -2, 1, -1 },{ 2, 3, -3 },{ -1, 0, 2 },{ 1, 2, 3 },{ -2, 3, 0 },{ -4, 1, 2 },{ 0, -4, -3 },{ -4, -1, -1 },{ 0, 1, 1 },{ -1, 2, 0 },{ 3, -1, 2 },{ 1, 2, -4 },{ 2, -2, 2 },{ 1, 0, -2 },{ -1, 3, -3 },{ 3, 0, 1 },{ -2, -3, -4 },{ -2, 1, -2 },{ -3, -4, -4 },{ 2, 1, 3 },{ 0, 0, 3 },{ -2, 1, -2 },{ 1, -4, 1 },{ -4, 2, -2 },{ -1, 3, -4 } }, - { { -2, -3, 1 },{ -4, -2, -1 },{ 1, 1, -4 },{ -1, -2, 3 },{ 0, 0, -1 },{ -1, -2, 0 },{ 1, 2, -4 },{ -3, 0, 3 },{ -4, -4, 2 },{ -2, -1, 0 },{ -2, -3, -4 },{ -1, 1, -1 },{ 3, -1, -1 },{ -4, 0, 1 },{ -1, 2, -2 },{ -1, 1, -3 },{ -2, -3, 2 },{ 0, -2, 2 },{ -1, 3, -4 },{ -4, 1, 3 },{ 0, -1, 1 },{ 3, 1, 3 },{ -2, 0, -2 },{ 1, -3, 1 },{ 0, 2, -4 },{ -4, 1, 2 },{ -1, -4, 3 },{ -3, 1, -1 },{ 1, -3, -3 },{ 2, 3, -2 },{ 3, 2, 1 },{ -1, 0, 0 },{ 2, 1, -2 },{ -1, -4, 3 },{ -2, -2, -1 },{ -2, 3, 1 },{ 3, 1, -2 },{ -1, -4, -1 },{ -4, -2, 3 },{ 3, -3, 1 },{ -1, -1, -4 },{ -3, -4, -1 },{ 0, 0, -2 },{ 3, -1, -3 },{ -1, -3, -4 },{ 2, 3, 3 },{ -2, 2, 1 },{ 1, -2, -1 },{ -2, 0, -4 },{ 1, -3, -3 },{ -4, 1, -2 },{ -3, 3, -1 },{ -1, -1, 0 },{ -3, -4, 1 },{ 0, 2, 2 },{ 1, -1, 3 },{ -4, 0, 0 },{ -1, -2, 1 },{ 2, -1, 1 },{ -3, 3, -1 },{ 3, -3, 0 },{ 2, -2, -4 },{ -3, -1, -3 },{ 3, 1, 0 } }, - { { 2, 2, -3 },{ -2, -4, -4 },{ 1, 3, 2 },{ -3, -4, -3 },{ 3, 0, 0 },{ 2, 3, 3 },{ -2, -1, -1 },{ 0, 1, 1 },{ 2, -3, -3 },{ 3, -2, 0 },{ 0, 3, 3 },{ 1, -4, 2 },{ -2, 3, 3 },{ 0, -2, -4 },{ 1, -4, 0 },{ 2, 2, 3 },{ -3, 0, -2 },{ 3, 2, 0 },{ 2, -4, -2 },{ -2, -4, 1 },{ 2, 0, 0 },{ 1, -3, -4 },{ -1, 3, 2 },{ -4, 1, 0 },{ 1, -2, -3 },{ 3, -1, -2 },{ 0, -2, 0 },{ -2, -1, -4 },{ 3, 3, 0 },{ -4, -4, 1 },{ -3, -1, -4 },{ 0, -1, -1 },{ -4, -2, -4 },{ 3, 0, 0 },{ -3, 1, -3 },{ 2, -3, 0 },{ -4, 2, 3 },{ 1, -1, -3 },{ 0, 0, -3 },{ 1, 2, -2 },{ -3, 1, 1 },{ 2, 1, -3 },{ -4, 2, 2 },{ 2, -2, 3 },{ -1, -2, 0 },{ -3, 0, 0 },{ 3, -3, -2 },{ 3, -4, 3 },{ -4, 3, 3 },{ -1, 2, 1 },{ 0, -1, 2 },{ -2, -4, -3 },{ 2, -2, 3 },{ 3, 1, -4 },{ -4, -2, -1 },{ 0, -4, -2 },{ 3, 3, -1 },{ 1, 2, -4 },{ -2, -4, -3 },{ -4, -2, -3 },{ 0, 2, -2 },{ -2, 2, 2 },{ 1, -4, 1 },{ 0, -1, 3 } }, - { { 0, 3, 2 },{ -3, 0, 0 },{ 3, -1, -2 },{ 0, 1, 1 },{ -2, 2, -2 },{ -4, -3, -3 },{ -1, -4, -4 },{ 3, 1, 1 },{ -3, 3, -1 },{ -1, -1, -4 },{ -4, 0, -2 },{ 0, 2, -3 },{ -3, -2, 1 },{ -3, -1, -1 },{ 2, 0, -4 },{ -4, -4, 1 },{ -2, -3, -1 },{ 1, 1, -3 },{ -4, -1, 2 },{ -2, 2, -3 },{ 0, 3, -2 },{ -3, -2, -1 },{ 2, -1, -1 },{ -2, -4, -3 },{ -1, 0, 3 },{ -3, 3, 0 },{ 2, -3, 1 },{ 1, 2, -3 },{ -2, 0, 2 },{ 0, -2, 3 },{ 1, 1, -3 },{ -2, 3, 2 },{ 1, -4, 1 },{ 1, 3, 2 },{ -1, -1, -2 },{ 0, -3, 2 },{ 2, 3, -4 },{ -2, -4, 1 },{ -3, 1, -1 },{ 3, -3, 2 },{ -4, -4, 0 },{ 0, -1, 3 },{ -2, 3, -1 },{ -3, -4, -2 },{ 1, 1, 1 },{ -1, 2, -2 },{ 0, -1, -3 },{ -3, 1, -4 },{ -2, 0, -2 },{ 2, -2, 0 },{ 1, -3, -1 },{ 3, 1, -2 },{ -4, 0, 2 },{ 1, 2, 0 },{ -2, -3, -2 },{ -1, 0, -3 },{ 2, 1, 2 },{ -3, -3, 3 },{ 0, 0, 2 },{ 1, 1, 2 },{ -1, -1, 0 },{ -4, 3, 3 },{ -2, 0, -1 },{ -4, -3, -1 } }, - { { 2, -2, -2 },{ 1, 2, 3 },{ -4, -3, 0 },{ -1, -3, 2 },{ 1, 2, -4 },{ -3, -2, 2 },{ 1, 2, 3 },{ -2, -3, -2 },{ 0, -1, 2 },{ -2, -4, 3 },{ 2, 1, 0 },{ 3, 0, -2 },{ 2, -3, 2 },{ -2, 1, -3 },{ 3, 3, 2 },{ -1, -2, 3 },{ 1, 2, 1 },{ 0, -1, -4 },{ 3, -2, -1 },{ -3, 0, 3 },{ 3, -3, 2 },{ -4, 0, -4 },{ 0, 2, 2 },{ 2, -2, 1 },{ 0, 2, -2 },{ -3, -3, 2 },{ -1, 1, -4 },{ -4, -4, -2 },{ -1, 0, -1 },{ 2, 1, 2 },{ 3, -2, -1 },{ -1, -3, -2 },{ -3, 0, 0 },{ 2, 2, -4 },{ -3, -1, -1 },{ 3, -2, 1 },{ -4, 0, 3 },{ 0, 0, 0 },{ -1, -2, -2 },{ 2, 3, -2 },{ -1, -2, -4 },{ 1, 0, 1 },{ 3, -3, -4 },{ 1, -2, -1 },{ -4, -1, -4 },{ 2, 3, 2 },{ -4, -4, 0 },{ 2, -2, 2 },{ 0, 2, 1 },{ 0, -4, -3 },{ -3, 3, -4 },{ -2, 2, 1 },{ 2, -3, 3 },{ -1, 3, -4 },{ -3, 1, 3 },{ 3, -4, 1 },{ -2, -2, -1 },{ -3, -1, -2 },{ -1, 3, 0 },{ 3, -3, -2 },{ 1, -3, -4 },{ 2, -4, -2 },{ 3, 1, -3 },{ -1, -2, -4 } }, - { { -3, -4, 1 },{ -1, 1, -3 },{ 2, 0, -3 },{ -2, -1, 1 },{ 2, -1, -1 },{ 3, -4, -1 },{ 1, 0, 0 },{ -3, 3, -3 },{ 3, 0, -4 },{ -4, 3, 1 },{ 1, -2, 0 },{ -3, -4, -3 },{ -1, 1, 1 },{ -4, -3, -1 },{ 0, 3, -2 },{ -2, 0, -3 },{ -3, -3, -1 },{ -1, 3, 3 },{ 2, -4, 1 },{ 1, 3, -2 },{ 0, 1, 0 },{ -3, -4, 0 },{ -1, 1, -3 },{ 3, -3, 3 },{ -4, 1, -4 },{ 1, -1, -1 },{ 3, 2, 2 },{ 0, -1, 3 },{ -3, 3, 0 },{ 2, -4, -3 },{ -4, 2, -4 },{ -2, -1, 3 },{ -4, -3, -2 },{ 0, 1, 3 },{ 0, -4, -1 },{ -2, 3, -3 },{ 1, 2, -2 },{ -3, -3, -4 },{ 3, 2, 2 },{ -2, 0, 3 },{ -3, -1, 0 },{ -2, 2, 2 },{ 0, 1, -3 },{ -1, 3, 3 },{ 3, -3, 1 },{ -2, 0, 3 },{ 1, 2, -3 },{ -2, -3, -1 },{ -3, -1, 0 },{ 3, 1, 3 },{ -4, -1, -1 },{ 0, -1, -2 },{ 2, -3, 0 },{ -1, -1, -3 },{ 0, -2, 2 },{ 2, 0, 0 },{ 1, 2, -4 },{ 0, 2, 1 },{ 3, 1, -3 },{ -4, -2, -1 },{ -3, 2, 3 },{ -2, -1, 1 },{ 0, 1, 0 },{ 1, 3, 2 } }, - { { 0, -1, 1 },{ -2, 2, -1 },{ 3, -4, 2 },{ 0, 3, -4 },{ -3, 3, 3 },{ -1, 1, -3 },{ -4, -1, 2 },{ -1, -2, 0 },{ 2, -4, -1 },{ -1, -1, -2 },{ 0, 2, 2 },{ 3, -1, 3 },{ -2, 2, -4 },{ 1, -1, 0 },{ 3, -2, 0 },{ 0, -4, -4 },{ 3, 1, 2 },{ -3, -1, 0 },{ -4, 2, -4 },{ -1, -2, -1 },{ -2, -3, -4 },{ 2, -1, 1 },{ 1, 3, 1 },{ -3, 0, -2 },{ -2, -3, -1 },{ -1, -4, 1 },{ 3, 3, -3 },{ -4, -2, -4 },{ -2, -3, -1 },{ 0, -1, 1 },{ 1, 2, -2 },{ 1, -4, 0 },{ 3, 2, -3 },{ 2, 0, 1 },{ -2, -3, -4 },{ -1, 1, 2 },{ 3, -1, 0 },{ 1, -4, 3 },{ -4, 3, -1 },{ 2, -3, -4 },{ 2, -4, 1 },{ 1, 2, -2 },{ -4, -4, -2 },{ -3, -1, 2 },{ -3, 1, 0 },{ -1, -2, -3 },{ 0, -1, -1 },{ 3, 2, -2 },{ -1, 0, 2 },{ 1, -4, -4 },{ -2, 0, 3 },{ -1, 3, 2 },{ -4, -4, -3 },{ 1, 2, -1 },{ -2, 1, -2 },{ -4, 3, 0 },{ -4, -4, -3 },{ 2, -1, 3 },{ -3, -4, 1 },{ -1, -1, -4 },{ 1, 0, 2 },{ -4, -3, -1 },{ 2, 3, 3 },{ -3, -1, -2 } }, - { { 3, 0, -4 },{ -4, -3, 3 },{ -3, -2, -2 },{ 1, -2, -1 },{ -4, 0, 1 },{ 3, -3, -2 },{ 0, 2, -2 },{ -2, -2, 3 },{ 2, 1, -4 },{ -4, -3, 2 },{ -3, 2, -1 },{ 1, -3, -3 },{ -1, 0, -1 },{ -3, 3, 3 },{ 2, 0, 2 },{ -4, 2, 1 },{ 1, -3, -3 },{ -2, 0, -2 },{ 2, -4, 2 },{ 0, 1, -2 },{ -2, 0, 3 },{ 3, 3, -1 },{ -1, -2, -3 },{ -4, 1, 2 },{ 0, 3, 0 },{ 1, -1, -2 },{ -2, 0, 3 },{ 2, 1, 1 },{ -2, -3, -2 },{ 0, 1, 3 },{ -4, -1, 1 },{ -1, 0, 2 },{ -2, 3, -2 },{ -3, -2, 0 },{ -4, -2, 2 },{ 2, 3, -1 },{ -3, 0, -3 },{ -2, -3, 1 },{ 0, 1, -3 },{ -1, -1, -1 },{ -3, 1, 3 },{ -1, -2, -3 },{ 3, 0, 0 },{ 2, 2, -1 },{ 1, -3, -2 },{ 0, -4, -4 },{ 2, 3, 0 },{ -4, -2, 3 },{ -2, 3, -4 },{ 2, -3, 1 },{ 3, -2, -2 },{ 1, 2, 0 },{ -3, -2, 1 },{ -3, 0, -4 },{ 3, -3, 2 },{ 1, -2, 3 },{ -1, 0, -2 },{ 0, -3, 2 },{ -2, 1, -2 },{ 3, 3, 2 },{ 0, 2, -3 },{ 3, 1, -4 },{ -2, -4, 0 },{ -1, -3, -3 } }, - { { 1, 3, -1 },{ 0, 1, 1 },{ 2, 2, 0 },{ -2, 2, 0 },{ 0, -4, 2 },{ 2, 1, -4 },{ -2, -4, 0 },{ -3, 2, 1 },{ 1, 0, 1 },{ 3, 3, -2 },{ 0, -2, 0 },{ -2, 1, -4 },{ -4, -4, 1 },{ 2, -3, -2 },{ -3, -2, -3 },{ -2, -4, -1 },{ -1, 3, 3 },{ 1, -1, 0 },{ 3, 3, 1 },{ -3, -3, -3 },{ -4, 1, 2 },{ 1, -1, -2 },{ -3, -4, -4 },{ 2, -3, 3 },{ 2, 2, -3 },{ -4, -2, 1 },{ -3, -4, 0 },{ 1, 0, -2 },{ 3, 2, 0 },{ 3, 3, 2 },{ -3, -4, -4 },{ 2, -2, -1 },{ 1, -3, 2 },{ 0, 1, -4 },{ 3, -1, -3 },{ -1, -4, 3 },{ 1, 2, 1 },{ 2, -1, -2 },{ -2, -2, 2 },{ -4, 3, 1 },{ 3, -2, -3 },{ 1, -4, 3 },{ -4, 3, -4 },{ -2, 0, 0 },{ 3, -1, 3 },{ -4, 1, 2 },{ 2, 0, 1 },{ -3, -4, 1 },{ 0, 1, -2 },{ -3, 2, -3 },{ -4, -4, -1 },{ 0, 1, -1 },{ 3, -1, 3 },{ 2, 1, -2 },{ -1, -4, 1 },{ -2, 3, -3 },{ 3, -2, -1 },{ -3, 2, -1 },{ 2, 0, 0 },{ -4, -4, -3 },{ -1, -2, 0 },{ 1, -3, 1 },{ 2, 0, -2 },{ -4, 2, 2 } }, - { { 2, -4, -1 },{ -1, -1, -3 },{ 3, -3, -2 },{ -3, -1, 3 },{ -1, 0, -3 },{ -1, -2, 2 },{ 3, 3, -1 },{ 1, -1, -3 },{ 0, -3, -3 },{ -1, -4, -1 },{ -4, 0, 3 },{ 3, 1, 1 },{ 2, 3, 2 },{ -1, 0, -2 },{ 0, 2, 0 },{ 3, 1, -1 },{ -3, -1, -4 },{ 2, 1, 2 },{ 0, -3, 1 },{ -2, -1, -4 },{ 2, 2, 0 },{ 3, -4, 2 },{ -1, -2, 0 },{ -2, 0, -1 },{ 0, 1, 3 },{ 3, 3, -4 },{ -1, -3, 2 },{ -1, -2, -3 },{ 1, -1, -4 },{ -3, 0, -3 },{ -2, -2, -1 },{ -1, 2, -3 },{ 1, 3, 3 },{ -2, 0, 1 },{ 1, 2, -2 },{ -3, -3, -1 },{ -4, 1, -4 },{ -1, 0, 0 },{ 3, -3, -4 },{ 1, 2, -2 },{ -2, 0, 0 },{ 0, 1, 1 },{ 0, -2, 1 },{ -2, -3, -3 },{ -3, 2, 2 },{ 1, 3, -2 },{ -2, -2, -3 },{ -1, -3, -1 },{ 3, -1, 3 },{ 1, 3, 0 },{ -2, 0, 2 },{ 2, 0, -4 },{ -2, -3, -3 },{ -3, 3, -1 },{ 0, -1, 3 },{ -4, 2, -4 },{ 1, 1, 1 },{ -3, -1, -4 },{ 1, -2, 3 },{ 2, 1, 1 },{ -2, 0, -2 },{ -3, 3, 3 },{ -3, -2, -4 },{ -1, -2, 3 } }, - { { -4, 1, 1 },{ -3, 0, -4 },{ -2, -4, 2 },{ 2, 1, -4 },{ -3, 3, -1 },{ -4, -3, 1 },{ 2, -1, -4 },{ -4, 1, 3 },{ -2, 3, 0 },{ -3, -1, 2 },{ -2, 2, -3 },{ 1, -4, -1 },{ 0, -2, -4 },{ -3, -1, 3 },{ 1, 3, 2 },{ -4, -3, -4 },{ -1, -2, 3 },{ -4, 2, -2 },{ -1, -4, -3 },{ 0, -2, 3 },{ 1, 2, -1 },{ -4, 3, -3 },{ -1, 0, 1 },{ 1, 2, -3 },{ -3, -3, 1 },{ -2, 2, -2 },{ -3, -1, -1 },{ 0, 3, 3 },{ -4, -4, 1 },{ -1, 2, 3 },{ 2, 1, 2 },{ 3, -1, -2 },{ -4, -3, 0 },{ -4, -1, -3 },{ 2, -4, 0 },{ -1, 3, 2 },{ 0, -2, -2 },{ 0, 1, 3 },{ -4, 3, 2 },{ 2, -4, -1 },{ -1, -1, -4 },{ -3, -3, -1 },{ 2, 3, 3 },{ -1, -4, -4 },{ 3, 0, -1 },{ -1, -2, 0 },{ 1, 2, -4 },{ -4, -1, -2 },{ 2, 1, -3 },{ -1, -3, 1 },{ -1, -2, -2 },{ 0, -4, 2 },{ -4, 2, 1 },{ 1, -2, 2 },{ 3, -1, 0 },{ -1, -4, -1 },{ 2, 0, 2 },{ 0, -4, 1 },{ -2, -3, -2 },{ -4, 3, -4 },{ 2, -1, 2 },{ 0, 2, -1 },{ 3, -1, 0 },{ 0, 1, -2 } }, - { { -2, -3, 2 },{ 1, 2, 1 },{ 0, 3, 2 },{ 3, -2, -3 },{ 1, 0, -2 },{ 0, -2, 3 },{ -2, 2, 1 },{ 1, -4, -2 },{ 2, -2, 2 },{ 3, -3, -4 },{ 2, -1, -2 },{ -4, 2, 1 },{ 2, -1, 0 },{ -2, -3, -3 },{ 3, 0, -1 },{ 1, -4, 1 },{ 3, 0, 0 },{ -2, 3, -2 },{ 2, 1, 0 },{ -4, 0, -1 },{ -2, -3, 1 },{ 3, 1, -4 },{ 0, -3, 3 },{ -4, -2, -1 },{ 3, -4, 0 },{ 1, -1, 2 },{ 2, 0, -3 },{ -2, 1, 0 },{ 3, -2, 1 },{ -4, -4, -1 },{ 0, -3, 0 },{ 0, 0, -2 },{ -3, 2, 1 },{ -1, -2, -4 },{ 2, -1, 3 },{ 3, 0, -3 },{ -2, -4, -1 },{ 2, -2, -3 },{ -3, 0, 1 },{ -1, -4, 0 },{ -3, 2, -3 },{ 3, 0, 2 },{ -4, -1, -2 },{ 2, 1, -2 },{ 0, -4, 1 },{ -4, -3, 1 },{ 3, 0, 3 },{ 0, 3, 2 },{ -3, -2, 0 },{ 2, 1, 3 },{ -4, 3, -4 },{ 3, 2, -2 },{ 2, -3, 0 },{ -2, 1, -4 },{ -2, -3, -3 },{ 0, 0, -2 },{ -4, 3, -3 },{ -2, 2, 2 },{ 3, -2, -3 },{ 0, 1, -1 },{ -1, -3, 1 },{ 1, -4, -3 },{ -2, 2, -3 },{ 2, -3, 0 } }, - { { 3, -1, -2 },{ 1, 0, 0 },{ -4, -4, -1 },{ -4, 2, 3 },{ -1, -3, 0 },{ 3, 1, -2 },{ -3, 3, -4 },{ -1, 0, 0 },{ -4, 2, -1 },{ 0, 1, -2 },{ 1, 0, 3 },{ -1, 3, 2 },{ -1, -2, -4 },{ -2, 2, 2 },{ -4, 1, -2 },{ -1, 2, -3 },{ 0, -1, 2 },{ -3, -3, -1 },{ 1, -1, 3 },{ 3, 3, -4 },{ 0, -2, 2 },{ -2, -1, -2 },{ -3, 3, 3 },{ 2, -1, -4 },{ -1, 1, -1 },{ -4, 3, -3 },{ 0, -3, 3 },{ 2, -3, -4 },{ 1, 2, -2 },{ -2, 3, -3 },{ 2, 1, -4 },{ -2, -4, 3 },{ 1, 3, 1 },{ 3, -4, 2 },{ 0, 3, -1 },{ -3, 1, 1 },{ -2, -1, 2 },{ 1, 3, -4 },{ 3, 1, 3 },{ 0, -2, -2 },{ 2, 3, 2 },{ 1, 1, 3 },{ -1, -2, 0 },{ -2, 2, -1 },{ -3, 3, 3 },{ 2, -2, -4 },{ -2, 2, 2 },{ 0, -4, -2 },{ -2, -4, -3 },{ -2, 0, -1 },{ 1, -2, 0 },{ -3, -1, 2 },{ -1, 0, -2 },{ -3, 2, 3 },{ 3, 3, 2 },{ 0, -3, 3 },{ 2, -2, 0 },{ -3, 1, -1 },{ 1, 0, 0 },{ -4, 3, 3 },{ 3, -4, -2 },{ -3, 0, 2 },{ -4, 3, 3 },{ -3, -2, -4 } }, - { { -1, -1, -3 },{ -3, 3, -2 },{ 1, -2, -4 },{ 2, 1, 1 },{ -1, -1, -3 },{ 2, -4, 0 },{ -3, 0, 2 },{ 3, -2, 3 },{ -1, -3, -3 },{ -3, 3, 1 },{ -3, -3, 0 },{ 3, -4, -1 },{ -4, 1, -3 },{ 2, -3, 1 },{ 3, -4, 3 },{ -2, 3, -1 },{ 2, -2, -4 },{ -3, 1, 2 },{ -1, -4, -3 },{ -1, 0, 1 },{ -3, -2, 0 },{ 2, -4, -2 },{ 3, 1, -3 },{ -1, 0, 2 },{ 1, 2, -2 },{ -2, -4, 2 },{ -3, 0, 0 },{ -1, 3, 1 },{ -3, -2, 2 },{ -4, 0, 2 },{ 3, -1, -1 },{ -3, -1, -1 },{ 2, 1, -4 },{ -2, -3, -2 },{ -4, 2, -2 },{ -1, -3, -4 },{ 1, 2, 1 },{ -4, -3, -2 },{ -1, -1, 0 },{ -4, 0, -3 },{ -2, -3, 1 },{ 1, -4, -2 },{ -4, -3, -4 },{ 3, -1, -3 },{ 1, 0, -1 },{ -3, 1, -3 },{ -4, -1, -1 },{ 2, 1, 0 },{ 3, -1, 1 },{ 0, 1, -4 },{ -4, 3, 1 },{ 1, -4, -1 },{ -1, 1, -3 },{ 1, -2, -1 },{ 2, -4, 1 },{ -4, -1, -4 },{ -1, -1, -2 },{ 3, -4, 1 },{ -2, -1, 3 },{ 2, -3, -4 },{ -1, 2, -3 },{ 1, -2, 0 },{ 0, 0, 1 },{ 3, 1, 3 } }, - { { 2, -4, 2 },{ -1, 1, 3 },{ -2, -3, -4 },{ 0, 3, 2 },{ -3, -1, -1 },{ -2, 2, 1 },{ 0, -3, -2 },{ 1, 1, -4 },{ -2, -1, 3 },{ 0, -4, -4 },{ 2, 0, -3 },{ 0, 3, -2 },{ 0, 0, 0 },{ 1, -2, -1 },{ -3, 0, 0 },{ -4, -1, -4 },{ 0, -2, 1 },{ 1, 2, 0 },{ 3, -4, -2 },{ -4, 3, -4 },{ 0, 0, -1 },{ -2, 2, 3 },{ -4, 2, 0 },{ 1, -3, 0 },{ -3, -2, 1 },{ 3, -2, -3 },{ 3, -1, -4 },{ 2, -4, -1 },{ 0, 0, -2 },{ 1, -3, -3 },{ -1, -2, 3 },{ -1, 3, 1 },{ 1, 0, -3 },{ -2, 0, 2 },{ 0, -2, 0 },{ 3, 0, 3 },{ -3, -4, -3 },{ 3, 3, 0 },{ 2, 0, 2 },{ -2, 2, -1 },{ 0, -1, -4 },{ 0, 0, 2 },{ -3, 2, 0 },{ -1, 3, 2 },{ 0, -4, 1 },{ 3, -3, 3 },{ -1, -3, 0 },{ 1, 3, -4 },{ -3, 2, 3 },{ -1, -3, 2 },{ 2, -1, -3 },{ 3, -2, 3 },{ 0, -3, -4 },{ -4, 0, 1 },{ 0, 3, -3 },{ -2, 2, 2 },{ -3, 1, 0 },{ 1, 3, -4 },{ -1, -3, -1 },{ -3, 2, 2 },{ -3, 1, 1 },{ -1, -1, -4 },{ 1, -3, -1 },{ -4, 3, -1 } } - } -}; diff --git a/GLideN64/src/BufferCopy/BlueNoiseTexture.h b/GLideN64/src/BufferCopy/BlueNoiseTexture.h deleted file mode 100644 index 748361b..0000000 --- a/GLideN64/src/BufferCopy/BlueNoiseTexture.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -struct BlueNoiseItem -{ - signed char r, g, b; -}; - -extern const BlueNoiseItem blueNoiseTex[8][64][64]; diff --git a/GLideN64/src/BufferCopy/ColorBufferToRDRAM.cpp b/GLideN64/src/BufferCopy/ColorBufferToRDRAM.cpp deleted file mode 100644 index 13d0250..0000000 --- a/GLideN64/src/BufferCopy/ColorBufferToRDRAM.cpp +++ /dev/null @@ -1,284 +0,0 @@ -#include -#include - -#include "ColorBufferToRDRAM.h" -#include "WriteToRDRAM.h" - -#include -#include -#include -#include -#include -#include "Log.h" -#include "MemoryStatus.h" - -#include -#include -#include -#include -#include "BlueNoiseTexture.h" - -using namespace graphics; - -ColorBufferToRDRAM::ColorBufferToRDRAM() - : m_pCurFrameBuffer(nullptr) -{ -} - -u32 ColorBufferToRDRAM::m_blueNoiseIdx = 0; - -ColorBufferToRDRAM::~ColorBufferToRDRAM() -{ -} - -void ColorBufferToRDRAM::init() -{ -} - -void ColorBufferToRDRAM::destroy() { - -} - -bool ColorBufferToRDRAM::_prepareCopy(u32& _startAddress) -{ - if (VI.width == 0 || frameBufferList().getCurrent() == nullptr) - return false; - - FrameBuffer * pBuffer = frameBufferList().findBuffer(_startAddress); - if (pBuffer == nullptr || pBuffer->m_isOBScreen) - return false; - - DisplayWindow & wnd = dwnd(); - const u32 curFrame = wnd.getBuffersSwapCount(); - - _startAddress &= ~0xfff; - if (_startAddress < pBuffer->m_startAddress) - _startAddress = pBuffer->m_startAddress; - - const u32 numPixels = pBuffer->m_width * pBuffer->m_height; - if (numPixels == 0) - return false; - - const u32 stride = pBuffer->m_width << pBuffer->m_size >> 1; - const u32 bufferHeight = cutHeight(_startAddress, pBuffer->m_height, stride); - if (bufferHeight == 0) - return false; - - CachedTexture* colorBufferTexture = pBuffer->getColorFbTexture(); - - m_pCurFrameBuffer = pBuffer; - - if ((config.generalEmulation.hacks & hack_subscreen) != 0 && m_pCurFrameBuffer->m_width == VI.width) { - copyWhiteToRDRAM(m_pCurFrameBuffer); - return false; - } - - ObjectHandle readBuffer; - - if (config.video.multisampling != 0) { - m_pCurFrameBuffer->resolveMultisampledTexture(); - readBuffer = m_pCurFrameBuffer->m_resolveFBO; - } else { - readBuffer = m_pCurFrameBuffer->m_FBO; - } - - if (!m_pCurFrameBuffer->isAuxiliary()) { - u32 x0 = 0; - u32 width; - if (config.frameBufferEmulation.nativeResFactor == 0 && m_pCurFrameBuffer->m_scale != 1.0f) { - const u32 screenWidth = wnd.getWidth(); - width = screenWidth; - if (wnd.isAdjustScreen()) { - width = static_cast(screenWidth*wnd.getAdjustScale()); - x0 = (screenWidth - width) / 2; - } - } else { - width = m_pCurFrameBuffer->m_pTexture->width; - } - u32 height = (u32)(bufferHeight * m_pCurFrameBuffer->m_scale); - - CachedTexture * pInputTexture = m_pCurFrameBuffer->m_pTexture; - GraphicsDrawer::BlitOrCopyRectParams blitParams; - blitParams.srcX0 = x0; - blitParams.srcY0 = 0; - blitParams.srcX1 = x0 + width; - blitParams.srcY1 = height; - blitParams.srcWidth = pInputTexture->width; - blitParams.srcHeight = pInputTexture->height; - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = m_pCurFrameBuffer->m_width; - blitParams.dstY1 = bufferHeight; - blitParams.dstWidth = colorBufferTexture->width; - blitParams.dstHeight = colorBufferTexture->height; - blitParams.filter = m_pCurFrameBuffer->m_scale == 1.0f ? textureParameters::FILTER_NEAREST : textureParameters::FILTER_LINEAR; - blitParams.tex[0] = pInputTexture; - blitParams.combiner = CombinerInfo::get().getTexrectDownscaleCopyProgram(); - blitParams.readBuffer = readBuffer; - blitParams.drawBuffer = pBuffer->getColorFbFbo(); - blitParams.mask = blitMask::COLOR_BUFFER; - wnd.getDrawer().blitOrCopyTexturedRect(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, pBuffer->getColorFbFbo()); - } else { - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, readBuffer); - } - - return true; -} - -u8 ColorBufferToRDRAM::_RGBAtoR8(u8 _c, u32 x, u32 y) { - return _c; -} - -u16 ColorBufferToRDRAM::_RGBAtoRGBA16(u32 _c, u32 x, u32 y) { - // Precalculated 4x4 bayer matrix values for 5Bit - static const s32 thresholdMapBayer[4][4] = { - { -4, 2, -3, 4 }, - { 0, -2, 2, -1 }, - { -3, 3, -4, 3 }, - { 1, -1, 1, -2 } - }; - - // Precalculated 4x4 magic square matrix values for 5Bit - static const s32 thresholdMapMagicSquare[4][4] = { - { -4, 2, 2, -1 }, - { 3, -2, -3, 1 }, - { -3, 0, 4, -2 }, - { 3, -1, -4, 1 } - }; - - union RGBA c; - c.raw = _c; - - if (config.generalEmulation.enableDitheringPattern == 0 || config.frameBufferEmulation.nativeResFactor != 1) { - // Apply color dithering - switch (config.generalEmulation.rdramImageDitheringMode) { - case Config::BufferDitheringMode::bdmBayer: - case Config::BufferDitheringMode::bdmMagicSquare: - { - s32 threshold = config.generalEmulation.rdramImageDitheringMode == Config::BufferDitheringMode::bdmBayer ? - thresholdMapBayer[x & 3][y & 3] : - thresholdMapMagicSquare[x & 3][y & 3]; - c.r = (u8)std::max(std::min((s32)c.r + threshold, 255), 0); - c.g = (u8)std::max(std::min((s32)c.g + threshold, 255), 0); - c.b = (u8)std::max(std::min((s32)c.b + threshold, 255), 0); - } - break; - case Config::BufferDitheringMode::bdmBlueNoise: - { - const BlueNoiseItem& threshold = blueNoiseTex[m_blueNoiseIdx & 7][x & 63][y & 63]; - c.r = (u8)std::max(std::min((s32)c.r + threshold.r, 255), 0); - c.g = (u8)std::max(std::min((s32)c.g + threshold.g, 255), 0); - c.b = (u8)std::max(std::min((s32)c.b + threshold.b, 255), 0); - } - break; - } - } - - return ((c.r >> 3) << 11) | ((c.g >> 3) << 6) | ((c.b >> 3) << 1) | (c.a == 0 ? 0 : 1); -} - -u32 ColorBufferToRDRAM::_RGBAtoRGBA32(u32 _c, u32 x, u32 y) { - RGBA c; - c.raw = _c; - return (c.r << 24) | (c.g << 16) | (c.b << 8) | c.a; -} - -void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync) -{ - const u32 stride = m_pCurFrameBuffer->m_width << m_pCurFrameBuffer->m_size >> 1; - const u32 max_height = std::min((u32)VI_GetMaxBufferHeight(m_pCurFrameBuffer->m_width), cutHeight(_startAddress, m_pCurFrameBuffer->m_height, stride)); - - u32 numPixels = (_endAddress - _startAddress) >> (m_pCurFrameBuffer->m_size - 1); - if (numPixels / m_pCurFrameBuffer->m_width > max_height) { - _endAddress = _startAddress + (max_height * stride); - numPixels = (_endAddress - _startAddress) >> (m_pCurFrameBuffer->m_size - 1); - } - - const u32 width = m_pCurFrameBuffer->m_width; - const s32 x0 = 0; - const s32 y0 = (_startAddress - m_pCurFrameBuffer->m_startAddress) / stride; - const u32 y1 = (_endAddress - m_pCurFrameBuffer->m_startAddress) / stride; - const u32 height = std::min(max_height, 1u + y1 - y0); - - const u8* pPixels = m_pCurFrameBuffer->readPixels(x0, y0, width, height, m_pCurFrameBuffer->m_size, _sync); - frameBufferList().setCurrentDrawBuffer(); - if (pPixels == nullptr) - return; - - if (m_pCurFrameBuffer->m_size == G_IM_SIZ_32b) { - u32 *ptr_src = (u32*)pPixels; - u32 *ptr_dst = (u32*)(RDRAM + _startAddress); - writeToRdram(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA32, valueTester, 0, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size); - } else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_16b) { - u32 *ptr_src = (u32*)pPixels; - u16 *ptr_dst = (u16*)(RDRAM + _startAddress); - m_blueNoiseIdx++; - writeToRdram(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA16, valueTester, 1, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size); - } else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_8b) { - u8 *ptr_src = (u8*)pPixels; - u8 *ptr_dst = RDRAM + _startAddress; - writeToRdram(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoR8, dummyTester, 3, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size); - } - - m_pCurFrameBuffer->m_copiedToRdram = true; - m_pCurFrameBuffer->copyRdram(); - - m_pCurFrameBuffer->cleanUp(); - - gDP.changed |= CHANGED_SCISSOR; -} - -void ColorBufferToRDRAM::copyToRDRAM(u32 _address, bool _sync) -{ - if (!isMemoryWritable(RDRAM + _address, gDP.colorImage.width << gDP.colorImage.size >> 1)) - return; - if (!_prepareCopy(_address)) - return; - if (config.frameBufferEmulation.copyToRDRAM == Config::CopyToRDRAM::ctDisable) - return; - - const u32 numBytes = (m_pCurFrameBuffer->m_width*m_pCurFrameBuffer->m_height) << m_pCurFrameBuffer->m_size >> 1; - _copy(m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_startAddress + numBytes, _sync); -} - -void ColorBufferToRDRAM::copyChunkToRDRAM(u32 _startAddress) -{ - const u32 endAddress = (_startAddress & ~0xfff) + 0x1000; - - if (!isMemoryWritable(RDRAM + _startAddress, endAddress - _startAddress)) - return; - if (!_prepareCopy(_startAddress)) - return; - _copy(_startAddress, endAddress, true); -} - - -ColorBufferToRDRAM & ColorBufferToRDRAM::get() -{ - static ColorBufferToRDRAM cbCopy; - return cbCopy; -} - -void copyWhiteToRDRAM(FrameBuffer * _pBuffer) -{ - if (_pBuffer->m_size == G_IM_SIZ_32b) { - u32 *ptr_dst = (u32*)(RDRAM + _pBuffer->m_startAddress); - - for (u32 y = 0; y < VI.height; ++y) { - for (u32 x = 0; x < VI.width; ++x) - ptr_dst[x + y*VI.width] = 0xFFFFFFFF; - } - } else { - u16 *ptr_dst = (u16*)(RDRAM + _pBuffer->m_startAddress); - - for (u32 y = 0; y < VI.height; ++y) { - for (u32 x = 0; x < VI.width; ++x) { - ptr_dst[(x + y*VI.width) ^ 1] = 0xFFFF; - } - } - } - _pBuffer->m_copiedToRdram = true; - _pBuffer->copyRdram(); -} diff --git a/GLideN64/src/BufferCopy/ColorBufferToRDRAM.h b/GLideN64/src/BufferCopy/ColorBufferToRDRAM.h deleted file mode 100644 index dd48096..0000000 --- a/GLideN64/src/BufferCopy/ColorBufferToRDRAM.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef ColorBufferToRDRAM_H -#define ColorBufferToRDRAM_H - -#include -#include -#include -#include - -namespace graphics { - class ColorBufferReader; -} - -struct CachedTexture; -struct FrameBuffer; - -class ColorBufferToRDRAM -{ -public: - void init(); - void destroy(); - - void copyToRDRAM(u32 _address, bool _sync); - void copyChunkToRDRAM(u32 _startAddress); - - static ColorBufferToRDRAM & get(); - -private: - ColorBufferToRDRAM(); - ColorBufferToRDRAM(const ColorBufferToRDRAM &) = delete; - virtual ~ColorBufferToRDRAM(); - - union RGBA { - struct { - u8 r, g, b, a; - }; - u32 raw; - }; - - bool _prepareCopy(u32& _startAddress); - - void _copy(u32 _startAddress, u32 _endAddress, bool _sync); - - // Convert pixel from video memory to N64 buffer format. - static u8 _RGBAtoR8(u8 _c, u32 x, u32 y); - static u16 _RGBAtoRGBA16(u32 _c, u32 x, u32 y); - static u32 _RGBAtoRGBA32(u32 _c, u32 x, u32 y); - - FrameBuffer * m_pCurFrameBuffer; - - static u32 m_blueNoiseIdx; -}; - -void copyWhiteToRDRAM(FrameBuffer * _pBuffer); - -#endif // ColorBufferToRDRAM diff --git a/GLideN64/src/BufferCopy/ColorBufferToRDRAMStub.h b/GLideN64/src/BufferCopy/ColorBufferToRDRAMStub.h deleted file mode 100644 index bc4e255..0000000 --- a/GLideN64/src/BufferCopy/ColorBufferToRDRAMStub.h +++ /dev/null @@ -1,15 +0,0 @@ -#include "ColorBufferToRDRAM.h" - -class ColorBufferToRDRAMStub : public ColorBufferToRDRAM -{ -public: - ColorBufferToRDRAMStub() : ColorBufferToRDRAM() {} - ~ColorBufferToRDRAMStub() {}; - -private: - void _init() override {} - void _initBuffers() override {} - void _destroyBuffers(void) override {} - bool _readPixels(GLint _x0, GLint _y0, GLsizei _width, GLsizei _height, u32 _size, bool _sync) override {} - void _cleanUp() override {} -}; diff --git a/GLideN64/src/BufferCopy/DepthBufferToRDRAM.cpp b/GLideN64/src/BufferCopy/DepthBufferToRDRAM.cpp deleted file mode 100644 index 8cf3913..0000000 --- a/GLideN64/src/BufferCopy/DepthBufferToRDRAM.cpp +++ /dev/null @@ -1,315 +0,0 @@ -#include -#include -#include -#include - -#include "DepthBufferToRDRAM.h" -#include "WriteToRDRAM.h" -#include "MemoryStatus.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -using namespace graphics; - -#define DEPTH_TEX_WIDTH 640 -#define DEPTH_TEX_HEIGHT 580 - -DepthBufferToRDRAM::DepthBufferToRDRAM() - : m_frameCount(-1) - , m_pColorTexture(nullptr) - , m_pDepthTexture(nullptr) - , m_pCurFrameBuffer(nullptr) -{ -} - -DepthBufferToRDRAM::~DepthBufferToRDRAM() -{ -} - -DepthBufferToRDRAM & DepthBufferToRDRAM::get() -{ - static DepthBufferToRDRAM dbCopy; - return dbCopy; -} - -void DepthBufferToRDRAM::init() -{ - // Generate and initialize Pixel Buffer Objects - m_pbuf.reset(gfxContext.createPixelReadBuffer(DEPTH_TEX_WIDTH * DEPTH_TEX_HEIGHT * sizeof(float))); - if (!m_pbuf) - return; - - m_pColorTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pColorTexture->format = G_IM_FMT_I; - m_pColorTexture->size = 2; - m_pColorTexture->clampS = 1; - m_pColorTexture->clampT = 1; - m_pColorTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pColorTexture->maskS = 0; - m_pColorTexture->maskT = 0; - m_pColorTexture->mirrorS = 0; - m_pColorTexture->mirrorT = 0; - m_pColorTexture->width = DEPTH_TEX_WIDTH; - m_pColorTexture->height = DEPTH_TEX_HEIGHT; - m_pColorTexture->textureBytes = m_pColorTexture->width * m_pColorTexture->height; - - m_pDepthTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pDepthTexture->format = G_IM_FMT_I; - m_pColorTexture->size = 2; - m_pDepthTexture->clampS = 1; - m_pDepthTexture->clampT = 1; - m_pDepthTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pDepthTexture->maskS = 0; - m_pDepthTexture->maskT = 0; - m_pDepthTexture->mirrorS = 0; - m_pDepthTexture->mirrorT = 0; - m_pDepthTexture->width = DEPTH_TEX_WIDTH; - m_pDepthTexture->height = DEPTH_TEX_HEIGHT; - m_pDepthTexture->textureBytes = m_pDepthTexture->width * m_pDepthTexture->height * sizeof(float); - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - Context::InitTextureParams initParams; - initParams.handle = m_pColorTexture->name; - initParams.textureUnitIndex = textureIndices::Tex[0]; - initParams.width = m_pColorTexture->width; - initParams.height = m_pColorTexture->height; - initParams.internalFormat = fbTexFormats.monochromeInternalFormat; - initParams.format = fbTexFormats.monochromeFormat; - initParams.dataType = fbTexFormats.monochromeType; - gfxContext.init2DTexture(initParams); - - Context::TexParameters setParams; - setParams.handle = m_pColorTexture->name; - setParams.target = textureTarget::TEXTURE_2D; - setParams.textureUnitIndex = textureIndices::Tex[0]; - setParams.minFilter = textureParameters::FILTER_NEAREST; - setParams.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(setParams); - - initParams.handle = m_pDepthTexture->name; - initParams.width = m_pDepthTexture->width; - initParams.height = m_pDepthTexture->height; - initParams.internalFormat = fbTexFormats.depthInternalFormat; - initParams.format = fbTexFormats.depthFormat; - initParams.dataType = fbTexFormats.depthType; - gfxContext.init2DTexture(initParams); - - setParams.handle = m_pDepthTexture->name; - gfxContext.setTextureParameters(setParams); - - m_FBO = gfxContext.createFramebuffer(); - Context::FrameBufferRenderTarget bufTarget; - bufTarget.bufferHandle = m_FBO; - bufTarget.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - bufTarget.attachment = bufferAttachment::COLOR_ATTACHMENT0; - bufTarget.textureTarget = textureTarget::TEXTURE_2D; - bufTarget.textureHandle = m_pColorTexture->name; - gfxContext.addFrameBufferRenderTarget(bufTarget); - - bufTarget.attachment = bufferAttachment::DEPTH_ATTACHMENT; - bufTarget.textureHandle = m_pDepthTexture->name; - gfxContext.addFrameBufferRenderTarget(bufTarget); - - // check if everything is OK - assert(!gfxContext.isFramebufferError()); - assert(!gfxContext.isError()); - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); -} - -void DepthBufferToRDRAM::destroy() { - if (!m_pbuf) - return; - - gfxContext.deleteFramebuffer(m_FBO); - m_FBO.reset(); - if (m_pColorTexture != nullptr) { - textureCache().removeFrameBufferTexture(m_pColorTexture); - m_pColorTexture = nullptr; - } - if (m_pDepthTexture != nullptr) { - textureCache().removeFrameBufferTexture(m_pDepthTexture); - m_pDepthTexture = nullptr; - } - m_pbuf.reset(); -} - -bool DepthBufferToRDRAM::_prepareCopy(u32& _startAddress, bool _copyChunk) -{ - const u32 curFrame = dwnd().getBuffersSwapCount(); - if (_copyChunk && m_frameCount == curFrame) - return true; - - if ((VI.width | VI.height) == 0) // Incorrect buffer size. Don't copy - return false; - - FrameBuffer *pBuffer = frameBufferList().findBuffer(_startAddress); - if (pBuffer == nullptr || pBuffer->isAuxiliary() || pBuffer->m_pDepthBuffer == nullptr || !pBuffer->m_pDepthBuffer->m_cleared) - return false; - - FrameBuffer * pDepthFrameBuffer = frameBufferList().findBuffer(pBuffer->m_pDepthBuffer->m_address); - if (pDepthFrameBuffer != nullptr) - m_pCurFrameBuffer = pDepthFrameBuffer; - else - m_pCurFrameBuffer = pBuffer; - - if (m_pCurFrameBuffer->m_width != pBuffer->m_pDepthBuffer->m_width) - return false; - - const u32 numPixels = m_pCurFrameBuffer->m_width * m_pCurFrameBuffer->m_height; - const u32 bufferOrigin = m_pCurFrameBuffer->m_pDepthBuffer->m_address; - if (bufferOrigin + numPixels * 2 > RDRAMSize + 1) - return false; - - const u32 height = cutHeight(bufferOrigin, m_pCurFrameBuffer->m_height, m_pCurFrameBuffer->m_width * 2); - if (height == 0) - return false; - - _startAddress &= ~0xfff; - if (_startAddress < bufferOrigin) - _startAddress = bufferOrigin; - - ObjectHandle readBuffer = pBuffer->m_FBO; - if (config.video.multisampling != 0) { - m_pCurFrameBuffer->m_pDepthBuffer->resolveDepthBufferTexture(m_pCurFrameBuffer); - readBuffer = m_pCurFrameBuffer->m_resolveFBO; - } - - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = readBuffer; - blitParams.drawBuffer = m_FBO; - blitParams.srcX0 = 0; - blitParams.srcY0 = 0; - blitParams.srcX1 = m_pCurFrameBuffer->m_pTexture->width; - blitParams.srcY1 = s32(m_pCurFrameBuffer->m_height * m_pCurFrameBuffer->m_scale); - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = m_pCurFrameBuffer->m_width; - blitParams.dstY1 = m_pCurFrameBuffer->m_height; - blitParams.mask = blitMask::DEPTH_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - frameBufferList().setCurrentDrawBuffer(); - m_frameCount = curFrame; - return true; -} - -u16 DepthBufferToRDRAM::_FloatToUInt16(f32 _z, u32 x, u32 y) -{ - static const u16 * const zLUT = depthBufferList().getZLUT(); - u32 idx = 0x3FFFF; - - if (_z < 0.0f) { - idx = 0; - } else if (_z < 1.0f) { - _z *= 262144.0f; - idx = std::min(0x3FFFFU, u32(floorf(_z + 0.5f))); - } - - return zLUT[idx]; -} - -bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress) -{ - DepthBuffer * pDepthBuffer = m_pCurFrameBuffer->m_pDepthBuffer; - const u32 stride = m_pCurFrameBuffer->m_width << 1; - const u32 max_height = cutHeight(_startAddress, m_pCurFrameBuffer->m_height, stride); - - u32 numPixels = (_endAddress - _startAddress) >> 1; - if (numPixels / m_pCurFrameBuffer->m_width > max_height) { - _endAddress = _startAddress + (max_height * stride); - numPixels = (_endAddress - _startAddress) >> 1; - } - - const u32 width = m_pCurFrameBuffer->m_width; - const s32 x0 = 0; - const s32 y0 = (_startAddress - pDepthBuffer->m_address) / stride; - const u32 y1 = (_endAddress - pDepthBuffer->m_address) / stride; - const u32 height = std::min(max_height, 1u + y1 - y0); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, m_FBO); - - PixelBufferBinder binder(m_pbuf.get()); - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - m_pbuf->readPixels(x0, y0, width, height, fbTexFormats.depthFormat, fbTexFormats.depthType); - u8 * pixelData = (u8*)m_pbuf->getDataRange(0, width * height * fbTexFormats.depthFormatBytes); - if (pixelData == nullptr) - return false; - - f32 * ptr_src = (f32*)pixelData; - u16 *ptr_dst = (u16*)(RDRAM + _startAddress); - - std::vector srcBuf(width * height); - memcpy(srcBuf.data(), ptr_src, width * height * sizeof(f32)); - writeToRdram(srcBuf.data(), - ptr_dst, - &DepthBufferToRDRAM::_FloatToUInt16, - dummyTester, - 1, - width, - height, - numPixels, - _startAddress, - pDepthBuffer->m_address, - G_IM_SIZ_16b); - - pDepthBuffer->m_cleared = false; - FrameBuffer * pBuffer = frameBufferList().findBuffer(pDepthBuffer->m_address); - if (pBuffer != nullptr) - pBuffer->m_cleared = false; - - m_pbuf->closeReadBuffer(); - - gDP.changed |= CHANGED_SCISSOR; - return true; -} - -bool DepthBufferToRDRAM::copyToRDRAM(u32 _address) -{ - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender) - return true; - - if (!m_pbuf) - return false; - - if (!isMemoryWritable(RDRAM + _address, gDP.colorImage.width * 2)) - return false; - - if (!_prepareCopy(_address, false)) - return false; - - const u32 endAddress = m_pCurFrameBuffer->m_pDepthBuffer->m_address + - m_pCurFrameBuffer->m_width * m_pCurFrameBuffer->m_height * 2; - - return _copy(m_pCurFrameBuffer->m_pDepthBuffer->m_address, endAddress); -} - -bool DepthBufferToRDRAM::copyChunkToRDRAM(u32 _startAddress) -{ - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender) - return true; - - if (!m_pbuf) - return false; - - const u32 endAddress = (_startAddress & ~0xfff) + 0x1000; - - if (!isMemoryWritable(RDRAM + _startAddress, endAddress - _startAddress)) - return false; - - if (!_prepareCopy(_startAddress, true)) - return false; - - return _copy(_startAddress, endAddress); -} diff --git a/GLideN64/src/BufferCopy/DepthBufferToRDRAM.h b/GLideN64/src/BufferCopy/DepthBufferToRDRAM.h deleted file mode 100644 index f25681f..0000000 --- a/GLideN64/src/BufferCopy/DepthBufferToRDRAM.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef DepthBufferToRDRAM_H -#define DepthBufferToRDRAM_H - -#include -#include - -namespace graphics { - class PixelReadBuffer; -} - -struct CachedTexture; -struct FrameBuffer; - -class DepthBufferToRDRAM -{ -public: - void init(); - void destroy(); - - bool copyToRDRAM(u32 _address); - bool copyChunkToRDRAM(u32 _startAddress); - - static DepthBufferToRDRAM & get(); - -private: - DepthBufferToRDRAM(); - ~DepthBufferToRDRAM(); - - bool _prepareCopy(u32& _startAddress, bool _copyChunk); - bool _copy(u32 _startAddress, u32 _endAddress); - - // Convert pixel from video memory to N64 depth buffer format. - static u16 _FloatToUInt16(f32 _z, u32 x, u32 y); - - graphics::ObjectHandle m_FBO; - std::unique_ptr m_pbuf; - u32 m_frameCount; - CachedTexture * m_pColorTexture; - CachedTexture * m_pDepthTexture; - FrameBuffer * m_pCurFrameBuffer; -}; - -#endif // DepthBufferToRDRAM_H diff --git a/GLideN64/src/BufferCopy/RDRAMtoColorBuffer.cpp b/GLideN64/src/BufferCopy/RDRAMtoColorBuffer.cpp deleted file mode 100644 index bb4fe0e..0000000 --- a/GLideN64/src/BufferCopy/RDRAMtoColorBuffer.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include "RDRAMtoColorBuffer.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -using namespace graphics; - -RDRAMtoColorBuffer::RDRAMtoColorBuffer() - : m_pCurBuffer(nullptr) - , m_pTexture(nullptr) - , m_pbuf(nullptr) { -} - -RDRAMtoColorBuffer & RDRAMtoColorBuffer::get() -{ - static RDRAMtoColorBuffer toCB; - return toCB; -} - -void RDRAMtoColorBuffer::init() -{ - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - m_pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pTexture->format = G_IM_FMT_RGBA; - m_pTexture->size = 2; - m_pTexture->clampS = 1; - m_pTexture->clampT = 1; - m_pTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pTexture->maskS = 0; - m_pTexture->maskT = 0; - m_pTexture->mirrorS = 0; - m_pTexture->mirrorT = 0; - m_pTexture->width = 640; - m_pTexture->height = 580; - m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.colorFormatBytes; - - m_pTexture->hdRatioS = 1.0f; - m_pTexture->hdRatioT = 1.0f; - - Context::InitTextureParams initParams; - initParams.handle = m_pTexture->name; - initParams.width = m_pTexture->width; - initParams.height = m_pTexture->height; - initParams.internalFormat = fbTexFormats.colorInternalFormat; - initParams.format = fbTexFormats.colorFormat; - initParams.dataType = fbTexFormats.colorType; - gfxContext.init2DTexture(initParams); - - Context::TexParameters setParams; - setParams.handle = m_pTexture->name; - setParams.target = textureTarget::TEXTURE_2D; - setParams.textureUnitIndex = textureIndices::Tex[0]; - setParams.minFilter = textureParameters::FILTER_LINEAR; - setParams.magFilter = textureParameters::FILTER_LINEAR; - gfxContext.setTextureParameters(setParams); - - m_pbuf = (u8*)malloc(m_pTexture->textureBytes); -} - -void RDRAMtoColorBuffer::destroy() -{ - if (m_pTexture != nullptr) { - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = nullptr; - } - free(m_pbuf); - m_pbuf = nullptr; -} - -void RDRAMtoColorBuffer::addAddress(u32 _address, u32 _size) -{ - if (m_pCurBuffer == nullptr) { - m_pCurBuffer = frameBufferList().findBuffer(_address); - if (m_pCurBuffer == nullptr) - return; - } - - const u32 pixelSize = 1 << m_pCurBuffer->m_size >> 1; - if (_size != pixelSize && (_address%pixelSize) > 0) - return; - m_vecAddress.push_back(_address); - gDP.colorImage.changed = TRUE; -} - -// Write the whole buffer -template -bool _copyBufferFromRdram(u32 _address, u32* _dst, u32(*converter)(TSrc _c, bool _bCFB), u32 _xor, u32 _x0, u32 _y0, u32 _width, u32 _height, bool _fullAlpha) -{ - if ((_address & 1) != 0) - return false; - TSrc * src = reinterpret_cast(RDRAM + _address); - const u32 bound = (RDRAMSize + 1 - _address) >> (sizeof(TSrc) / 2); - TSrc col; - u32 idx; - u32 summ = 0; - u32 dsty = 0; - const u32 y1 = _y0 + _height; - for (u32 y = _y0; y < y1; ++y) { - for (u32 x = _x0; x < _width; ++x) { - idx = (x + y *_width) ^ _xor; - if (idx >= bound) - break; - col = src[idx]; - summ += col; - _dst[x + dsty*_width] = converter(col, _fullAlpha); - } - ++dsty; - } - - return summ != 0; -} - -// Write only pixels provided with FBWrite -template -bool _copyPixelsFromRdram(u32 _address, const std::vector & _vecAddress, u32* _dst, u32(*converter)(TSrc _c, bool _bCFB), u32 _xor, u32 _width, u32 _height, bool _fullAlpha) -{ - memset(_dst, 0, _width*_height*sizeof(u32)); - TSrc * src = reinterpret_cast(RDRAM + _address); - const u32 szPixel = sizeof(TSrc); - const size_t numPixels = _vecAddress.size(); - TSrc col; - u32 summ = 0; - u32 idx, w, h; - for (size_t i = 0; i < numPixels; ++i) { - if (_vecAddress[i] < _address) - return false; - idx = (_vecAddress[i] - _address) / szPixel; - w = idx % _width; - h = idx / _width; - if (h > _height) - return false; - col = src[idx]; - summ += col; - _dst[(w + h * _width) ^ _xor] = converter(col, _fullAlpha); - } - - return summ != 0; -} - -static -u32 RGBA16ToABGR32(u16 col, bool _fullAlpha) -{ - u32 r, g, b, a; - r = ((col >> 11) & 31) << 3; - g = ((col >> 6) & 31) << 3; - b = ((col >> 1) & 31) << 3; - if (_fullAlpha) - a = 0xFF; - else - a = (col & 1) > 0 ? 0xFF : 0U; - return ((a << 24) | (b << 16) | (g << 8) | r); -} - -static -u32 RGBA32ToABGR32(u32 col, bool _fullAlpha) -{ - u32 r, g, b, a; - r = (col >> 24) & 0xff; - g = (col >> 16) & 0xff; - b = (col >> 8) & 0xff; - if (_fullAlpha) - a = 0xFF; - else - a = col & 0xFF; - return ((a << 24) | (b << 16) | (g << 8) | r); -} - -void RDRAMtoColorBuffer::_copyFromRDRAM(u32 _height, bool _fullAlpha) -{ - Cleaner cleaner(this); - const u32 address = m_pCurBuffer->m_startAddress; - const u32 width = m_pCurBuffer->m_width; - const u32 height = _height; - - const u32 x0 = 0; - const u32 y0 = 0; - const u32 y1 = y0 + height; - - const bool bUseAlpha = !_fullAlpha && m_pCurBuffer->m_changed; - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - u32 * pDst = nullptr; - std::unique_ptr dstData; - - //If not using float, the initial coversion will already be correct - if (fbTexFormats.colorType == datatype::FLOAT) { - const u32 initialDataSize = width*height * 4; - dstData = std::unique_ptr(new u8[initialDataSize]); - pDst = reinterpret_cast(dstData.get()); - } else { - pDst = reinterpret_cast(m_pbuf); - } - - bool bCopy; - if (m_vecAddress.empty()) { - if (m_pCurBuffer->m_size == G_IM_SIZ_16b) - bCopy = _copyBufferFromRdram(address, pDst, RGBA16ToABGR32, 1, x0, y0, width, height, _fullAlpha); - else - bCopy = _copyBufferFromRdram(address, pDst, RGBA32ToABGR32, 0, x0, y0, width, height, _fullAlpha); - } else { - if (m_pCurBuffer->m_size == G_IM_SIZ_16b) - bCopy = _copyPixelsFromRdram(address, m_vecAddress, pDst, RGBA16ToABGR32, 1, width, height, _fullAlpha); - else - bCopy = _copyPixelsFromRdram(address, m_vecAddress, pDst, RGBA32ToABGR32, 0, width, height, _fullAlpha); - } - - //Convert integer format to float - if (fbTexFormats.colorType == datatype::FLOAT) { - f32* floatData = reinterpret_cast(m_pbuf); - u8* byteData = dstData.get(); - const u32 widthPixels = width*4; - for (unsigned int heightIndex = 0; heightIndex < height; ++heightIndex) { - for (unsigned int widthIndex = 0; widthIndex < widthPixels; ++widthIndex) { - u8& src = *(byteData + heightIndex*widthPixels + widthIndex); - float& dst = *(floatData + heightIndex*widthPixels + widthIndex); - dst = src/255.0f; - } - } - } - - if (!FBInfo::fbInfo.isSupported()) { - if (bUseAlpha && config.frameBufferEmulation.copyToRDRAM == Config::ctDisable) { - u32 totalBytes = (width * height) << m_pCurBuffer->m_size >> 1; - if (address + totalBytes > RDRAMSize + 1) - totalBytes = RDRAMSize + 1 - address; - memset(RDRAM + address, 0, totalBytes); - } - } - - if (!bCopy) - return; - - const u32 cycleType = gDP.otherMode.cycleType; - gDP.otherMode.cycleType = G_CYC_COPY; - CombinerInfo::get().setPolygonMode(DrawingState::TexRect); - CombinerInfo::get().update(); - - Context::UpdateTextureDataParams updateParams; - updateParams.handle = m_pTexture->name; - updateParams.textureUnitIndex = textureIndices::Tex[0]; - updateParams.width = width; - updateParams.height = height; - updateParams.format = fbTexFormats.colorFormat; - updateParams.dataType = fbTexFormats.colorType; - updateParams.data = m_pbuf; - gfxContext.update2DTexture(updateParams); - - m_pTexture->scaleS = 1.0f / (float)m_pTexture->width; - m_pTexture->scaleT = 1.0f / (float)m_pTexture->height; - m_pTexture->shiftScaleS = 1.0f; - m_pTexture->shiftScaleT = 1.0f; - m_pTexture->offsetS = 0.0f; - m_pTexture->offsetT = 0.0f; - textureCache().activateTexture(0, m_pTexture); - - gDPTile tile0 = {0}; - gDPTile * pTile0 = gSP.textureTile[0]; - gSP.textureTile[0] = &tile0; - - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA); - gfxContext.enable(enable::DEPTH_TEST, false); - - CombinerInfo::get().updateParameters(); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pCurBuffer->m_FBO); - - gfxContext.enable(enable::SCISSOR_TEST, false); - GraphicsDrawer::TexturedRectParams texRectParams((float)x0, (float)y0, (float)width, (float)height, - 1.0f, 1.0f, 0, 0, - false, true, false, m_pCurBuffer); - dwnd().getDrawer().drawTexturedRect(texRectParams); - gfxContext.enable(enable::SCISSOR_TEST, true); - gDP.otherMode.cycleType = cycleType; - - frameBufferList().setCurrentDrawBuffer(); - - gSP.textureTile[0] = pTile0; - - gDP.changed |= CHANGED_RENDERMODE | CHANGED_COMBINE; -} - -void RDRAMtoColorBuffer::copyFromRDRAM(u32 _address, bool _bCFB) -{ - if (m_pCurBuffer == nullptr) { - if (_bCFB || (config.frameBufferEmulation.copyFromRDRAM != 0 && !FBInfo::fbInfo.isSupported())) - m_pCurBuffer = frameBufferList().findBuffer(_address); - } else { - if (m_vecAddress.empty()) { - m_pCurBuffer = nullptr; - return; - } -// frameBufferList().setCurrent(m_pCurBuffer); - } - - if (m_pCurBuffer == nullptr || m_pCurBuffer->m_size < G_IM_SIZ_16b) - return; - - const u32 height = cutHeight(m_pCurBuffer->m_startAddress, - m_pCurBuffer->m_startAddress == _address ? - VI.real_height : - VI_GetMaxBufferHeight(m_pCurBuffer->m_width), m_pCurBuffer->m_width << m_pCurBuffer->m_size >> 1); - if (height == 0) - return; - - _copyFromRDRAM(height, _bCFB); -} - -void RDRAMtoColorBuffer::copyFromRDRAM(FrameBuffer * _pBuffer) -{ - if (_pBuffer == nullptr) - return; - m_pCurBuffer = _pBuffer; - const u32 height = cutHeight(m_pCurBuffer->m_startAddress, - VI_GetMaxBufferHeight(m_pCurBuffer->m_width), m_pCurBuffer->m_width << m_pCurBuffer->m_size >> 1); - _copyFromRDRAM(height, true); -} - -void RDRAMtoColorBuffer::reset() -{ - m_pCurBuffer = nullptr; - m_vecAddress.clear(); -} diff --git a/GLideN64/src/BufferCopy/RDRAMtoColorBuffer.h b/GLideN64/src/BufferCopy/RDRAMtoColorBuffer.h deleted file mode 100644 index 8fe7bfe..0000000 --- a/GLideN64/src/BufferCopy/RDRAMtoColorBuffer.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef RDRAMtoColorBuffer_H -#define RDRAMtoColorBuffer_H - -#include -#include -#include -#include - -struct CachedTexture; -struct FrameBuffer; - -class RDRAMtoColorBuffer -{ -public: - void init(); - void destroy(); - - void addAddress(u32 _address, u32 _size); - - void copyFromRDRAM(u32 _address, bool _bCFB); - void copyFromRDRAM(FrameBuffer * _pBuffer); - - static RDRAMtoColorBuffer & get(); - -private: - RDRAMtoColorBuffer(); - RDRAMtoColorBuffer(const RDRAMtoColorBuffer &) = delete; - - void _copyFromRDRAM(u32 _height, bool _fullAlpha); - void reset(); - - class Cleaner - { - public: - Cleaner(RDRAMtoColorBuffer * _p) : m_p(_p), m_pCurrentBuffer(frameBufferList().getCurrent()) {} - ~Cleaner() - { - m_p->reset(); - frameBufferList().setCurrent(m_pCurrentBuffer); - } - private: - RDRAMtoColorBuffer * m_p; - FrameBuffer * m_pCurrentBuffer; - }; - - FrameBuffer * m_pCurBuffer; - CachedTexture * m_pTexture; - std::vector m_vecAddress; - u8* m_pbuf; -}; - -#endif // RDRAMtoColorBuffer_H diff --git a/GLideN64/src/BufferCopy/WriteToRDRAM.h b/GLideN64/src/BufferCopy/WriteToRDRAM.h deleted file mode 100644 index 745218c..0000000 --- a/GLideN64/src/BufferCopy/WriteToRDRAM.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef WriteToRDRAM_H -#define WriteToRDRAM_H - - -#include "../Types.h" - -template -bool valueTester(T _c) -{ - return _c != testValue; -} - -template -bool dummyTester(T _c) -{ - return true; -} - -template -void writeToRdram(TSrc* _src, TDst* _dst, - TDst(*converter)(TSrc _c, u32 x, u32 y), - bool(*tester)(TSrc _c), - u32 _xor, - u32 _width, - u32 _height, - u32 _numPixels, - u32 _startAddress, - u32 _bufferAddress, - u32 _bufferSize) -{ - u32 chunkStart = ((_startAddress - _bufferAddress) >> (_bufferSize - 1)) % _width; - if (chunkStart % 2 != 0) { - --chunkStart; - --_dst; - ++_numPixels; - } - - u32 numStored = 0; - u32 y = 0; - TSrc c; - if (chunkStart > 0) { - for (u32 x = chunkStart; x < _width; ++x) { - c = _src[x]; - if (tester(c)) - _dst[numStored ^ _xor] = converter(c, x, y); - ++numStored; - } - ++y; - _dst += numStored; - } - - u32 dsty = 0; - for (; y < _height; ++y) { - for (u32 x = 0; x < _width && numStored < _numPixels; ++x) { - c = _src[x + y *_width]; - if (tester(c)) - _dst[(x + dsty*_width) ^ _xor] = converter(c, x, y); - ++numStored; - } - ++dsty; - } -} - -#endif // WriteToRDRAM_H diff --git a/GLideN64/src/CMakeLists.txt b/GLideN64/src/CMakeLists.txt deleted file mode 100644 index 60b5d41..0000000 --- a/GLideN64/src/CMakeLists.txt +++ /dev/null @@ -1,533 +0,0 @@ -cmake_minimum_required(VERSION 3.9) - -option(EGL "Set to ON if targeting an EGL device" ${EGL}) -option(PANDORA "Set to ON if targeting an OpenPandora" ${PANDORA}) -option(ODROID "Set to ON if targeting an Odroid" ${ODROID}) -option(MUPENPLUSAPI "Set to ON for Mupen64Plus plugin" ${MUPENPLUSAPI}) -option(MUPENPLUSAPI_GLIDENUI "Set to ON for GLideNUI for Mupen64Plus" ${MUPENPLUSAPI_GLIDENUI}) -option(MESA "Set to ON to disable Raspberry Pi autodetection" ${MESA}) -option(VERO4K "Set to ON if targeting a Vero4k" ${VERO4K}) -option(ANDROID "Set to ON if targeting an Android device" ${ANDROID}) -option(GL_PROFILE "Set to ON to turn on GL profiling" ${GL_PROFILE}) - -# run script to generate Revision.h -set(PATH_REVISION "Revision.h") -add_custom_command( - OUTPUT ${PATH_REVISION} - COMMAND ${CMAKE_SOURCE_DIR}/getRevision.sh - COMMENT "Generate Git version" -) -set_property(SOURCE ${PATH_REVISION} PROPERTY SKIP_AUTOGEN ON) - -project( GLideN64 ) - -set(GLideN64_SOURCES - 3DMath.cpp - Combiner.cpp - CombinerKey.cpp - CommonPluginAPI.cpp - Config.cpp - convert.cpp - CRC32.cpp - DebugDump.cpp - Debugger.cpp - DepthBuffer.cpp - DisplayWindow.cpp - DisplayLoadProgress.cpp - FrameBuffer.cpp - FrameBufferInfo.cpp - GBI.cpp - gDP.cpp - GLideN64.cpp - GraphicsDrawer.cpp - gSP.cpp - Log.cpp - N64.cpp - NoiseTexture.cpp - PaletteTexture.cpp - Performance.cpp - PostProcessor.cpp - RDP.cpp - RSP.cpp - RSP_LoadMatrix.cpp - SoftwareRender.cpp - TexrectDrawer.cpp - TextDrawer.cpp - TextureFilterHandler.cpp - Textures.cpp - VI.cpp - ZlutTexture.cpp - BufferCopy/BlueNoiseTexture.cpp - BufferCopy/ColorBufferToRDRAM.cpp - BufferCopy/DepthBufferToRDRAM.cpp - BufferCopy/RDRAMtoColorBuffer.cpp - DepthBufferRender/ClipPolygon.cpp - DepthBufferRender/DepthBufferRender.cpp - common/CommonAPIImpl_common.cpp - Graphics/Context.cpp - Graphics/ColorBufferReader.cpp - Graphics/CombinerProgram.cpp - Graphics/ObjectHandle.cpp - Graphics/OpenGLContext/GLFunctions.cpp - Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.cpp - Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.cpp - Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.cpp - Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.cpp - Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp - Graphics/OpenGLContext/opengl_Attributes.cpp - Graphics/OpenGLContext/opengl_BufferedDrawer.cpp - Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp - Graphics/OpenGLContext/opengl_CachedFunctions.cpp - Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp - Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp - Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.cpp - Graphics/OpenGLContext/opengl_ContextImpl.cpp - Graphics/OpenGLContext/opengl_GLInfo.cpp - Graphics/OpenGLContext/opengl_Parameters.cpp - Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.cpp - Graphics/OpenGLContext/opengl_UnbufferedDrawer.cpp - Graphics/OpenGLContext/opengl_Utils.cpp - Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.cpp - Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp - Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp - Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp - Graphics/OpenGLContext/GLSL/glsl_FXAA.cpp - Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.cpp - Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp - Graphics/OpenGLContext/GLSL/glsl_Utils.cpp - uCodes/F3D.cpp - uCodes/F3DBETA.cpp - uCodes/F3DDKR.cpp - uCodes/F3DEX.cpp - uCodes/F3DAM.cpp - uCodes/F3DEX2.cpp - uCodes/F3DEX2ACCLAIM.cpp - uCodes/F3DEX2CBFD.cpp - uCodes/F3DZEX2.cpp - uCodes/F3DFLX2.cpp - uCodes/F3DGOLDEN.cpp - uCodes/F3DTEXA.cpp - uCodes/F3DPD.cpp - uCodes/F3DSETA.cpp - uCodes/F5Indi_Naboo.cpp - uCodes/F5Rogue.cpp - uCodes/L3D.cpp - uCodes/L3DEX2.cpp - uCodes/L3DEX.cpp - uCodes/S2DEX2.cpp - uCodes/S2DEX.cpp - uCodes/T3DUX.cpp - uCodes/Turbo3D.cpp - uCodes/ZSort.cpp - uCodes/ZSortBOSS.cpp -) - -set(GLideNUI_SOURCES - GLideNUI/AboutDialog.cpp - GLideNUI/AboutDialog.ui - GLideNUI/ConfigDialog.cpp - GLideNUI/Config_GLideNUI.cpp - GLideNUI/GLideNUI.cpp - GLideNUI/ScreenShot.cpp - GLideNUI/Settings.cpp - GLideNUI/QtKeyToHID.cpp - GLideNUI/configDialog.ui - GLideNUI/icon.qrc -) - -if(MUPENPLUSAPI_GLIDENUI) - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTORCC ON) - set(CMAKE_AUTOUIC ON) - - find_package(Qt5 COMPONENTS Core Widgets Gui REQUIRED) - set(GLIDENUI_LIBRARIES - Qt5::Widgets Qt5::Core Qt5::Gui - ) - list(APPEND GLideNUI_SOURCES - GLideNUI/fullscreenresolutions_mupen64plus.cpp - ) -endif(MUPENPLUSAPI_GLIDENUI) - -#check if we're running on Raspberry Pi -if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA) - message("bcm_host.h found") - set(BCMHOST ON) - set(EGL ON) - set(EGL_LIB -lbrcmEGL -lbrcmGLESv2) - add_definitions( - -DVC - ) - include_directories( - "${CMAKE_FIND_ROOT_PATH}/opt/vc/include" - "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos" - "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vmcs_host/linux" - "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos/pthreads" - ) - link_directories( - "${CMAKE_FIND_ROOT_PATH}/opt/vc/lib" - "${CMAKE_FIND_ROOT_PATH}/opt/vc/lib/GL" - ) -else(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA) - set(EGL_LIB -lEGL) -endif(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA) - -if(MUPENPLUSAPI) - add_definitions( - -DMUPENPLUSAPI - -DTXFILTER_LIB - ) - include_directories( . inc ) - set(GLideN64_SOURCES_UNIX - MupenPlusPluginAPI.cpp - mupenplus/CommonAPIImpl_mupenplus.cpp - mupenplus/MemoryStatus_mupenplus.cpp - mupenplus/MupenPlusAPIImpl.cpp - Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp - ) - - if(MUPENPLUSAPI_GLIDENUI) - add_definitions(-DM64P_GLIDENUI) - list(APPEND GLideN64_SOURCES_UNIX - ${GLideNUI_SOURCES} - ) - else() - list(APPEND GLideN64_SOURCES_UNIX - mupenplus/Config_mupenplus.cpp - ) - endif() - - set(GLideN64_SOURCES_WIN ${GLideN64_SOURCES_UNIX} - ) - if (ANDROID) - set(GLideN64_DLL_NAME libmupen64plus-video-GLideN64) - else() - set(GLideN64_DLL_NAME mupen64plus-video-GLideN64) - endif() -else(MUPENPLUSAPI) - if(UNIX) - message(FATAL_ERROR "UNIX build requires MUPENPLUSAPI!") - endif(UNIX) - set(GLideN64_SOURCES_WIN - ZilmarPluginAPI.cpp - GLideNUI/Config_GLideNUI.cpp - windows/CommonAPIImpl_windows.cpp - windows/GLideN64_windows.cpp - windows/MemoryStatus_windows.cpp - common/GLFunctions.cpp - windows/ZilmarAPIImpl_windows.cpp - Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp - ) - set(GLideN64_DLL_NAME GLideN64) -endif(MUPENPLUSAPI) - -add_subdirectory( osal ) -include_directories( osal ) - -if (NOHQ) - list(APPEND GLideN64_SOURCES - TxFilterStub.cpp - ) -else (NOHQ) - add_subdirectory( GLideNHQ ) - include_directories( GLideNHQ ) -endif(NOHQ) - -if(UNIX) - list(APPEND GLideN64_SOURCES ${GLideN64_SOURCES_UNIX}) - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - add_definitions( - -DOS_MAC_OS_X - ) - if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) - set(CMAKE_MACOSX_RPATH 0) - endif() - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - add_definitions( - -DOS_LINUX - ) - endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -endif(UNIX) - -if(MINGW) - add_definitions( - -DMINGW - ) -endif(MINGW) - -if(WIN32) - list(APPEND GLideN64_SOURCES ${GLideN64_SOURCES_WIN}) - add_definitions( - -DOS_WINDOWS - -D__WIN32__ - -DWIN32 - -D_WIN32_ASM - -D_CRT_SECURE_NO_WARNINGS - -D__MSC__ - ) -endif(WIN32) - -if(SDL) - include(FindPkgConfig) - pkg_check_modules(SDL REQUIRED sdl) - include_directories(${SDL_INCLUDE_DIRS}) - add_definitions( - -DUSE_SDL - ) -endif(SDL) - -if(PANDORA) - #Pandora as a SGX530, but it should share the bugs and limitations as SGX540 - add_definitions( - -DPANDORA - -DPowerVR_SGX_540 - -DEGL - ) -endif(PANDORA) - -if(ODROID) - add_definitions( - -DODROID - ) -endif(ODROID) - -if(VERO4K) - add_definitions( - -DVERO4K - ) -endif(VERO4K) - -if(ANDROID) - add_definitions(-DOS_ANDROID -DEGL_EGLEXT_PROTOTYPES -DEGL) - set(EGL ON) - - if(ANDROID_ABI STREQUAL "armeabi-v7a" OR ANDROID_ABI STREQUAL "arm64-v8a") - set(NEON_OPT ON) - set(VEC4_OPT ON) - set(CRC_NEON ON) - elseif(ANDROID_ABI STREQUAL "x86" OR ANDROID_ABI STREQUAL "x86_64") - set(CRC_OPT ON) - set(VEC4_OPT ON) - endif() - - list(APPEND GLideN64_SOURCES - Log_android.cpp - Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.cpp - Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.cpp - Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.cpp - Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.cpp - Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.cpp - ) - - list(REMOVE_ITEM GLideN64_SOURCES - Log.cpp - ) - - find_library( # Defines the name of the path variable that stores the - # location of the NDK library. - LOG_LIB - - # Specifies the name of the NDK library that - # CMake needs to locate. - log ) -endif(ANDROID) - -if(ANDROID) - set( FREETYPE_INCLUDE_DIRS "${ANDROID_LIB_PATH}/freetype/include" ) -elseif(UNIX OR BCMHOST) - set( FREETYPE_INCLUDE_DIRS "/usr/include/freetype2/" ) -else(UNIX OR BCMHOST) - set( ENV{FREETYPE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../freetype ) -endif(ANDROID) - -if(ANDROID) - add_library( ANDROID_FREETYPE - SHARED - IMPORTED ) - - if( CMAKE_BUILD_TYPE STREQUAL "Debug") - set( BUILD_VARIANT "debug" ) - else() - set( BUILD_VARIANT "release" ) - endif() - - set_target_properties( # Specifies the target library. - ANDROID_FREETYPE - - # Specifies the parameter you want to define. - PROPERTIES IMPORTED_LOCATION - - # Provides the path to the library you want to import. - ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libfreetype.so) - set(FREETYPE_LIBRARIES ANDROID_FREETYPE) -else(ANDROID) - FIND_PACKAGE( Freetype REQUIRED ) -endif(ANDROID) - -include_directories( ${FREETYPE_INCLUDE_DIRS} ) - -if(VEC4_OPT) - add_definitions( - -D__VEC4_OPT - ) -endif(VEC4_OPT) - -if(CRC_ARMV8) - list(REMOVE_ITEM GLideN64_SOURCES - CRC32.cpp - ) - list(APPEND GLideN64_SOURCES - CRC32_ARMV8.cpp - ) -elseif(CRC_OPT) - list(REMOVE_ITEM GLideN64_SOURCES - CRC32.cpp - ) - list(APPEND GLideN64_SOURCES - CRC_OPT.cpp - ) -elseif(CRC_NEON) - list(REMOVE_ITEM GLideN64_SOURCES - CRC32.cpp - ) - list(APPEND GLideN64_SOURCES - Neon/CRC_OPT_NEON.cpp - ) -endif(CRC_ARMV8) - -if(NEON_OPT) - add_definitions( - -D__NEON_OPT - ) - list(APPEND GLideN64_SOURCES - Neon/3DMathNeon.cpp - Neon/gSPNeon.cpp - Neon/RSP_LoadMatrixNeon.cpp - ) - list(REMOVE_ITEM GLideN64_SOURCES - 3DMath.cpp - RSP_LoadMatrix.cpp - ) -endif(NEON_OPT) - -if(X86_OPT) - list(APPEND GLideN64_SOURCES - RSP_LoadMatrixX86.cpp - ) - list(REMOVE_ITEM GLideN64_SOURCES - RSP_LoadMatrix.cpp - ) -endif(X86_OPT) - -# Build type - -if( NOT CMAKE_BUILD_TYPE) - set( CMAKE_BUILD_TYPE Release) -endif( NOT CMAKE_BUILD_TYPE) - -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - set( CMAKE_BUILD_TYPE Debug) - set( DEBUG_BUILD TRUE) - add_definitions( - -DGL_DEBUG - ) -endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - -if(GL_PROFILE) - add_definitions( - -DGL_PROFILE -DGL_DEBUG - ) -endif(GL_PROFILE) - -if(EGL) - add_definitions( - -DEGL - ) - set(OPENGL_LIBRARIES ${EGL_LIB}) -else(EGL) - find_package(OpenGL REQUIRED) - include_directories(${OpenGL_INCLUDE_DIRS}) - link_directories(${OpenGL_LIBRARY_DIRS}) - add_definitions(${OpenGL_DEFINITIONS}) - if(NOT OPENGL_FOUND) - message(ERROR " OPENGL not found!") - endif(NOT OPENGL_FOUND) -endif(EGL) - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - #check for compiler version - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE G++_VERSION) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND G++_VERSION VERSION_LESS 4.8) - message("Found compiler version " ${G++_VERSION}) - message(SEND_ERROR "You need at least G++ 4.8 to compile GLideN64!") - elseif(G++_VERSION VERSION_LESS 3.3) - message("Found compiler version " ${G++_VERSION}) - message(SEND_ERROR "You need at least Clang 3.3 to compile GLideN64!") - endif() - set(GCC_CPP11_COMPILE_FLAGS "-std=c++11") - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" ) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(GCC_STATIC_LINK_FLAGS "-static-libgcc") - endif() - set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCC_STATIC_LINK_FLAGS}" ) -endif() - -set(CMAKE_CXX_STANDARD 11) - -add_library( ${GLideN64_DLL_NAME} SHARED ${GLideN64_SOURCES} ${PATH_REVISION}) - -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - SET_TARGET_PROPERTIES( - ${GLideN64_DLL_NAME} - PROPERTIES - LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need. - PREFIX "" - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/Debug - ) - - if(SDL) - if (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osald ) - else (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osald GLideNHQd ) - endif (NOHQ) - else(SDL) - if (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osald ) - else (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osald GLideNHQd ) - endif (NOHQ) - endif(SDL) -endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - -if( CMAKE_BUILD_TYPE STREQUAL "Release") - include(CheckIPOSupported) - check_ipo_supported(RESULT result) - if(result) - message("Interprocedural optimizations enabled") - set_property(TARGET ${GLideN64_DLL_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -O3") - endif() - - SET_TARGET_PROPERTIES( - ${GLideN64_DLL_NAME} - PROPERTIES - LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need. - PREFIX "" - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/Release - ) - - if(SDL) - if (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal ) - else (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal GLideNHQ ) - endif (NOHQ) - else(SDL) - if (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal ) - else (NOHQ) - target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal GLideNHQ ) - endif (NOHQ) - endif(SDL) -endif( CMAKE_BUILD_TYPE STREQUAL "Release") diff --git a/GLideN64/src/CRC.h b/GLideN64/src/CRC.h deleted file mode 100644 index 19cd397..0000000 --- a/GLideN64/src/CRC.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include "Types.h" - -void CRC_Init(); - -u32 CRC_Calculate_Strict( u32 crc, const void *buffer, u32 count ); -u64 CRC_Calculate( u64 crc, const void *buffer, u32 count ); -u64 CRC_CalculatePalette( u64 crc, const void *buffer, u32 count ); diff --git a/GLideN64/src/CRC32.cpp b/GLideN64/src/CRC32.cpp deleted file mode 100644 index 425f853..0000000 --- a/GLideN64/src/CRC32.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "CRC.h" - -#define CRC32_POLYNOMIAL 0x04C11DB7U - -static unsigned int CRCTable[ 256 ]; - -static -u32 Reflect( u32 ref, u32 ch ) -{ - u32 value = 0; - - // Swap bit 0 for bit 7 - // bit 1 for bit 6, etc. - for (u32 i = 1; i < (ch + 1); ++i) { - if(ref & 1) - value |= 1 << (ch - i); - ref >>= 1; - } - return value; -} - -void CRC_Init() -{ - u32 crc; - - for (u32 i = 0; i < 256; ++i) { - crc = Reflect( i, 8U ) << 24U; - for (int j = 0; j < 8; ++j) - crc = (crc << 1U) ^ (crc & (1U << 31U) ? CRC32_POLYNOMIAL : 0U); - - CRCTable[i] = Reflect( crc, 32U ); - } -} - -u64 CRC_Calculate( u64 crc, const void * buffer, u32 count ) -{ - u32 crc32 = static_cast(crc); - u32 orig = crc32; - - const u8 *p = reinterpret_cast(buffer); - while (count--) - crc32 = (crc32 >> 8) ^ CRCTable[(crc32 & 0xFF) ^ *p++]; - - return crc32 ^ orig; -} - -u32 CRC_Calculate_Strict( u32 crc, const void * buffer, u32 count ) -{ - return static_cast(CRC_Calculate(crc, buffer, count)); -} - -u64 CRC_CalculatePalette(u64 crc, const void * buffer, u32 count ) -{ - u32 crc32 = static_cast(crc); - u32 orig = crc32; - - const u8 *p = reinterpret_cast(buffer); - while (count--) { - crc32 = (crc32 >> 8) ^ CRCTable[(crc32 & 0xFF) ^ *p++]; - crc32 = (crc32 >> 8) ^ CRCTable[(crc32 & 0xFF) ^ *p++]; - - p += 6; - } - - return crc32 ^ orig; -} diff --git a/GLideN64/src/CRC32_ARMV8.cpp b/GLideN64/src/CRC32_ARMV8.cpp deleted file mode 100644 index 226d619..0000000 --- a/GLideN64/src/CRC32_ARMV8.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2017-Present Stefan Eschenbacher. All rights reserved. -// -// This ARMv8 CRC32 code, is dual-licensed under GNU General Public License -// version 2 ("GPL") and the Apache License version 2 ("ASL"). For the GPL, -// please see LICENSE. For the ASL, you may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. - -#include "CRC.h" -#include - -void CRC_Init() -{ -} - -u64 CRC_Calculate( u64 crc, const void * buffer, u32 count ) -{ - u8 *p; - u32 crc32 = static_cast(crc); - u32 orig = crc32; - - p = (u8*) buffer; - - // use eight byte crc intrinsic __crc32d if count is high enough. - // __crc32d, __crc32w, __crc32h and __crc32b use polynomial 0x04C11DB7 - while (count >= 8) { - crc32 = __crc32d(crc32, *((u64*)p)); - p += 8; - count -= 8; - } - if (count >= 4) { - crc32 = __crc32w(crc32, *((u32*)p)); - p += 4; - count -= 4; - } - if (count >= 2) { - crc32 = __crc32h(crc32, *((u16*)p)); - p += 2; - count -= 2; - } - if (count == 1) - crc32 = __crc32b(crc32, *p); - - return crc32 ^ orig; -} - -u32 CRC_Calculate_Strict( u32 crc, const void * buffer, u32 count ) -{ - return CRC_Calculate(crc, buffer, count); -} - -u64 CRC_CalculatePalette(u64 crc, const void * buffer, u32 count ) -{ - u8 *p; - u32 crc32 = static_cast(crc); - u32 orig = crc32; - - p = (u8*) buffer; - while (count--) { - // use two byte intrinsic __crc32h - crc32 = __crc32h(crc32, *((u16*)p)); - p += 8; - } - - return crc32 ^ orig; -} diff --git a/GLideN64/src/CRC_OPT.cpp b/GLideN64/src/CRC_OPT.cpp deleted file mode 100644 index 05a62e5..0000000 --- a/GLideN64/src/CRC_OPT.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "CRC.h" -#define XXH_INLINE_ALL -#include "xxHash/xxhash.h" - -#define CRC32_POLYNOMIAL 0x04C11DB7 - -unsigned int CRCTable[ 256 ]; - -static -u32 Reflect( u32 ref, char ch ) -{ - u32 value = 0; - - // Swap bit 0 for bit 7 - // bit 1 for bit 6, etc. - for (int i = 1; i < (ch + 1); ++i) { - if(ref & 1) - value |= 1 << (ch - i); - ref >>= 1; - } - return value; -} - -void CRC_Init() -{ - u32 crc; - - for (int i = 0; i < 256; ++i) { - crc = Reflect( i, 8 ) << 24; - for (int j = 0; j < 8; ++j) - crc = (crc << 1) ^ (crc & (1 << 31) ? CRC32_POLYNOMIAL : 0); - - CRCTable[i] = Reflect( crc, 32 ); - } -} - -u32 CRC_Calculate_Strict( u32 crc, const void * buffer, u32 count ) -{ - u8 *p; - u32 orig = crc; - - p = (u8*) buffer; - while (count--) - crc = (crc >> 8) ^ CRCTable[(crc & 0xFF) ^ *p++]; - - return crc ^ orig; -} - -u64 CRC_Calculate( u64 crc, const void * buffer, u32 count ) -{ - return XXH3_64bits_withSeed(buffer, count, crc); -} - -u64 CRC_CalculatePalette( u64 crc, const void * buffer, u32 count ) -{ - u8 *p = (u8*) buffer; - while (count--) { - crc = XXH3_64bits_withSeed(p, 2, crc); - p += 8; - } - return crc; -} diff --git a/GLideN64/src/Combiner.cpp b/GLideN64/src/Combiner.cpp deleted file mode 100644 index 7cadc5e..0000000 --- a/GLideN64/src/Combiner.cpp +++ /dev/null @@ -1,376 +0,0 @@ -#include -#include -#include -#include -#include - -#include "Combiner.h" -#include "DebugDump.h" -#include "gDP.h" -#include "Config.h" -#include "PluginAPI.h" -#include "RSP.h" -#include "Graphics/Context.h" - -using namespace graphics; - -static u32 saRGBExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0, G_GCI_TEXEL1, G_GCI_PRIMITIVE, - G_GCI_SHADE, G_GCI_ENVIRONMENT, G_GCI_ONE, G_GCI_NOISE, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO -}; - -static u32 sbRGBExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0, G_GCI_TEXEL1, G_GCI_PRIMITIVE, - G_GCI_SHADE, G_GCI_ENVIRONMENT, G_GCI_CENTER, G_GCI_K4, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO -}; - -static u32 mRGBExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0, G_GCI_TEXEL1, G_GCI_PRIMITIVE, - G_GCI_SHADE, G_GCI_ENVIRONMENT, G_GCI_SCALE, G_GCI_COMBINED_ALPHA, - G_GCI_TEXEL0_ALPHA, G_GCI_TEXEL1_ALPHA, G_GCI_PRIMITIVE_ALPHA, G_GCI_SHADE_ALPHA, - G_GCI_ENV_ALPHA, G_GCI_LOD_FRACTION, G_GCI_PRIM_LOD_FRAC, G_GCI_K5, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, - G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO, G_GCI_ZERO -}; - -static u32 aRGBExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0, G_GCI_TEXEL1, G_GCI_PRIMITIVE, - G_GCI_SHADE, G_GCI_ENVIRONMENT, G_GCI_ONE, G_GCI_ZERO -}; - -static u32 saAExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0_ALPHA, G_GCI_TEXEL1_ALPHA, G_GCI_PRIMITIVE_ALPHA, - G_GCI_SHADE_ALPHA, G_GCI_ENV_ALPHA, G_GCI_ONE, G_GCI_ZERO -}; - -static u32 sbAExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0_ALPHA, G_GCI_TEXEL1_ALPHA, G_GCI_PRIMITIVE_ALPHA, - G_GCI_SHADE_ALPHA, G_GCI_ENV_ALPHA, G_GCI_ONE, G_GCI_ZERO -}; - -static u32 mAExpanded[] = -{ - G_GCI_LOD_FRACTION, G_GCI_TEXEL0_ALPHA, G_GCI_TEXEL1_ALPHA, G_GCI_PRIMITIVE_ALPHA, - G_GCI_SHADE_ALPHA, G_GCI_ENV_ALPHA, G_GCI_PRIM_LOD_FRAC, G_GCI_ZERO, -}; - -static u32 aAExpanded[] = -{ - G_GCI_COMBINED, G_GCI_TEXEL0_ALPHA, G_GCI_TEXEL1_ALPHA, G_GCI_PRIMITIVE_ALPHA, - G_GCI_SHADE_ALPHA, G_GCI_ENV_ALPHA, G_GCI_ONE, G_GCI_ZERO -}; - -void Combiner_Init() { - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.init(); - gDP.otherMode.cycleType = G_CYC_1CYCLE; -} - -void Combiner_Destroy() { - CombinerInfo::get().destroy(); -} - -/*---------------CombinerInfo-------------*/ - -CombinerInfo & CombinerInfo::get() -{ - static CombinerInfo info; - return info; -} - -void CombinerInfo::init() -{ - gfxContext.resetCombinerProgramBuilder(); - m_pCurrent = nullptr; - - m_shadersLoaded = 0; - if (config.generalEmulation.enableShadersStorage != 0 && !_loadShadersStorage()) { - for (auto cur = m_combiners.begin(); cur != m_combiners.end(); ++cur) - delete cur->second; - m_combiners.clear(); - } - - if (m_combiners.empty()) { - setPolygonMode(DrawingState::TexRect); - gDP.otherMode.cycleType = G_CYC_COPY; - setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0)); - gDP.otherMode.cycleType = G_CYC_FILL; - setCombine(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE)); - } - - m_shadowmapProgram.reset(gfxContext.createDepthFogShader()); - m_texrectUpscaleCopyProgram.reset(gfxContext.createTexrectUpscaleCopyShader()); - m_texrectColorAndDepthUpscaleCopyProgram.reset(gfxContext.createTexrectColorAndDepthUpscaleCopyShader()); - m_texrectDownscaleCopyProgram.reset(gfxContext.createTexrectDownscaleCopyShader()); - m_texrectColorAndDepthDownscaleCopyProgram.reset(gfxContext.createTexrectColorAndDepthDownscaleCopyShader()); -} - -void CombinerInfo::destroy() -{ - m_shadowmapProgram.reset(); - m_texrectUpscaleCopyProgram.reset(); - m_texrectColorAndDepthUpscaleCopyProgram.reset(); - m_texrectDownscaleCopyProgram.reset(); - m_texrectColorAndDepthDownscaleCopyProgram.reset(); - - m_pCurrent = nullptr; - if (config.generalEmulation.enableShadersStorage != 0) - _saveShadersStorage(); - m_shadersLoaded = 0; - for (auto cur = m_combiners.begin(); cur != m_combiners.end(); ++cur) - delete cur->second; - m_combiners.clear(); -} - -static -void SimplifyCycle( CombineCycle *cc, CombinerStage *stage ) -{ - // Load the first operand - stage->op[0].op = LOAD; - stage->op[0].param1 = cc->sa; - stage->numOps = 1; - - // If we're just subtracting zero, skip it - if (cc->sb != G_GCI_ZERO) { - // Subtracting a number from itself is zero - if (cc->sb == stage->op[0].param1) - stage->op[0].param1 = G_GCI_ZERO; - else { - stage->op[1].op = SUB; - stage->op[1].param1 = cc->sb; - stage->numOps++; - } - } - - // If we either subtracted, or didn't load a zero - if ((stage->numOps > 1) || (stage->op[0].param1 != G_GCI_ZERO)) { - // Multiplying by zero is zero - if (cc->m == G_GCI_ZERO) { - stage->numOps = 1; - stage->op[0].op = LOAD; - stage->op[0].param1 = G_GCI_ZERO; - } else { - // Multiplying by one, so just do a load - if ((stage->numOps == 1) && (stage->op[0].param1 == G_GCI_ONE)) - stage->op[0].param1 = cc->m; - else { - stage->op[stage->numOps].op = MUL; - stage->op[stage->numOps].param1 = cc->m; - stage->numOps++; - } - } - } - - // Don't bother adding zero - if (cc->a != G_GCI_ZERO) { - // If all we have so far is zero, then load this instead - if ((stage->numOps == 1) && (stage->op[0].param1 == G_GCI_ZERO)) - stage->op[0].param1 = cc->a; - else { - stage->op[stage->numOps].op = ADD; - stage->op[stage->numOps].param1 = cc->a; - stage->numOps++; - } - } - - // Handle interpolation - if ((stage->numOps == 4) && (stage->op[1].param1 == stage->op[3].param1)) { - stage->numOps = 1; - stage->op[0].op = INTER; - stage->op[0].param2 = stage->op[1].param1; - stage->op[0].param3 = stage->op[2].param1; - } -} - -graphics::CombinerProgram * Combiner_Compile(CombinerKey key) -{ - gDPCombine combine; - - combine.mux = key.getMux(); - - Combiner color, alpha; - - const u32 cycleType = key.getCycleType(); - const u32 numCycles = cycleType + 1; - color.numStages = numCycles; - alpha.numStages = numCycles; - - CombineCycle cc[2]; - CombineCycle ac[2]; - - // Simplify each RDP combiner cycle into a combiner stage - if (cycleType == G_CYC_1CYCLE) { - // 1 cycle mode uses combiner equations from 2nd cycle - u32 colorMux[4] = { saRGBExpanded[combine.saRGB1], sbRGBExpanded[combine.sbRGB1], - mRGBExpanded[combine.mRGB1], aRGBExpanded[combine.aRGB1] }; - // Check for 'combined' mux - for (u32 i = 0; i < 4; ++i) { - if (colorMux[i] == G_GCI_COMBINED || colorMux[i] == G_GCI_COMBINED_ALPHA) - colorMux[i] = G_GCI_ZERO; - } - cc[1].sa = colorMux[0]; - cc[1].sb = colorMux[1]; - cc[1].m = colorMux[2]; - cc[1].a = colorMux[3]; - SimplifyCycle(&cc[1], &color.stage[0]); - - u32 alphaMux[4] = { saAExpanded[combine.saA1], sbAExpanded[combine.sbA1], - mAExpanded[combine.mA1], aAExpanded[combine.aA1] }; - // Check for 'combined' mux - for (u32 i = 0; i < 4; ++i) { - if (alphaMux[i] == G_GCI_COMBINED) - alphaMux[i] = G_GCI_ZERO; - } - ac[1].sa = alphaMux[0]; - ac[1].sb = alphaMux[1]; - ac[1].m = alphaMux[2]; - ac[1].a = alphaMux[3]; - SimplifyCycle(&ac[1], &alpha.stage[0]); - } else { - // Decode and expand the combine mode into a more general form - cc[1].sa = saRGBExpanded[combine.saRGB1]; - cc[1].sb = sbRGBExpanded[combine.sbRGB1]; - cc[1].m = mRGBExpanded[combine.mRGB1]; - cc[1].a = aRGBExpanded[combine.aRGB1]; - ac[1].sa = saAExpanded[combine.saA1]; - ac[1].sb = sbAExpanded[combine.sbA1]; - ac[1].m = mAExpanded[combine.mA1]; - ac[1].a = aAExpanded[combine.aA1]; - - cc[0].sa = saRGBExpanded[combine.saRGB0]; - cc[0].sb = sbRGBExpanded[combine.sbRGB0]; - cc[0].m = mRGBExpanded[combine.mRGB0]; - cc[0].a = aRGBExpanded[combine.aRGB0]; - ac[0].sa = saAExpanded[combine.saA0]; - ac[0].sb = sbAExpanded[combine.sbA0]; - ac[0].m = mAExpanded[combine.mA0]; - ac[0].a = aAExpanded[combine.aA0]; - - SimplifyCycle(&cc[0], &color.stage[0]); - SimplifyCycle(&ac[0], &alpha.stage[0]); - - const bool equalStages = (memcmp(cc, cc + 1, sizeof(CombineCycle)) | memcmp(ac, ac + 1, sizeof(CombineCycle))) == 0; - if (!equalStages) { - SimplifyCycle(&cc[1], &color.stage[1]); - SimplifyCycle(&ac[1], &alpha.stage[1]); - } else { - color.numStages = 1; - alpha.numStages = 1; - } - } - - return gfxContext.createCombinerProgram(color, alpha, key); -} - -void CombinerInfo::update() -{ - // TODO: find, why gDP.changed & CHANGED_COMBINE not always works (e.g. Mario Tennis). -// if (gDP.changed & CHANGED_COMBINE) { - if (gDP.otherMode.cycleType == G_CYC_COPY) - setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0)); - else if (gDP.otherMode.cycleType == G_CYC_FILL) - setCombine(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE)); - else - setCombine(gDP.combine.mux); - gDP.changed &= ~CHANGED_COMBINE; -// } -} - -void CombinerInfo::setCombine(u64 _mux ) -{ - const CombinerKey key(_mux); - if (m_pCurrent != nullptr && m_pCurrent->getKey() == key) { - m_bChanged = false; - return; - } - auto iter = m_combiners.find(key); - if (iter != m_combiners.end()) { - m_pCurrent = iter->second; - } else { - m_pCurrent = Combiner_Compile(key); - m_pCurrent->update(true); - m_combiners[m_pCurrent->getKey()] = m_pCurrent; - } - m_bChanged = true; -} - -void CombinerInfo::updateParameters() -{ - m_pCurrent->update(false); -} - -void CombinerInfo::setDepthFogCombiner() -{ - if (m_shadowmapProgram) { - m_shadowmapProgram->activate(); - m_pCurrent = m_shadowmapProgram.get(); - } -} - -ShaderProgram * CombinerInfo::getTexrectUpscaleCopyProgram() -{ - return m_texrectUpscaleCopyProgram.get(); -} - -ShaderProgram * CombinerInfo::getTexrectColorAndDepthUpscaleCopyProgram() -{ - return m_texrectColorAndDepthUpscaleCopyProgram.get(); -} - -ShaderProgram * CombinerInfo::getTexrectDownscaleCopyProgram() -{ - return m_texrectDownscaleCopyProgram.get(); -} - -ShaderProgram * CombinerInfo::getTexrectColorAndDepthDownscaleCopyProgram() -{ - return m_texrectColorAndDepthDownscaleCopyProgram.get(); -} - -bool CombinerInfo::isShaderCacheSupported() const -{ - return config.generalEmulation.enableShadersStorage != 0 && Context::ShaderProgramBinary; -} - -void CombinerInfo::setPolygonMode(DrawingState _drawingState) -{ - switch (_drawingState) { - case DrawingState::Rect: - case DrawingState::TexRect: - m_rectMode = true; - break; - default: - m_rectMode = false; - break; - } -} - -void CombinerInfo::_saveShadersStorage() const -{ - if (m_shadersLoaded >= m_combiners.size()) - return; - - gfxContext.saveShadersStorage(m_combiners); -} - -bool CombinerInfo::_loadShadersStorage() -{ - if (gfxContext.loadShadersStorage(m_combiners)) { - m_shadersLoaded = static_cast(m_combiners.size()); - return true; - } - - return false; -} diff --git a/GLideN64/src/Combiner.h b/GLideN64/src/Combiner.h deleted file mode 100644 index a33cf27..0000000 --- a/GLideN64/src/Combiner.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef COMBINER_H -#define COMBINER_H - -#include -#include - -#include "GLideN64.h" -#include "GraphicsDrawer.h" -#include "gDP.h" -#include "CombinerKey.h" -#include "Graphics/CombinerProgram.h" -#include "Graphics/ShaderProgram.h" - -/* -* G_SETCOMBINE: color combine modes -*/ -/* Color combiner constants: */ -#define G_CCMUX_COMBINED 0 -#define G_CCMUX_TEXEL0 1 -#define G_CCMUX_TEXEL1 2 -#define G_CCMUX_PRIMITIVE 3 -#define G_CCMUX_SHADE 4 -#define G_CCMUX_ENVIRONMENT 5 -#define G_CCMUX_CENTER 6 -#define G_CCMUX_SCALE 6 -#define G_CCMUX_COMBINED_ALPHA 7 -#define G_CCMUX_TEXEL0_ALPHA 8 -#define G_CCMUX_TEXEL1_ALPHA 9 -#define G_CCMUX_PRIMITIVE_ALPHA 10 -#define G_CCMUX_SHADE_ALPHA 11 -#define G_CCMUX_ENV_ALPHA 12 -#define G_CCMUX_LOD_FRACTION 13 -#define G_CCMUX_PRIM_LOD_FRAC 14 -#define G_CCMUX_NOISE 7 -#define G_CCMUX_K4 7 -#define G_CCMUX_K5 15 -#define G_CCMUX_1 6 -#define G_CCMUX_0 31 - -/* Alpha combiner constants: */ -#define G_ACMUX_COMBINED 0 -#define G_ACMUX_TEXEL0 1 -#define G_ACMUX_TEXEL1 2 -#define G_ACMUX_PRIMITIVE 3 -#define G_ACMUX_SHADE 4 -#define G_ACMUX_ENVIRONMENT 5 -#define G_ACMUX_LOD_FRACTION 0 -#define G_ACMUX_PRIM_LOD_FRAC 6 -#define G_ACMUX_1 6 -#define G_ACMUX_0 7 - -#define EncodeCombineMode( a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ - a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1 ) \ - static_cast((static_cast(_SHIFTL( G_CCMUX_##a0, 20, 4 ) | _SHIFTL( G_CCMUX_##c0, 15, 5 ) | \ - _SHIFTL( G_ACMUX_##Aa0, 12, 3 ) | _SHIFTL( G_ACMUX_##Ac0, 9, 3 ) | \ - _SHIFTL( G_CCMUX_##a1, 5, 4 ) | _SHIFTL( G_CCMUX_##c1, 0, 5 )) << 32) | \ - static_cast(_SHIFTL( G_CCMUX_##b0, 28, 4 ) | _SHIFTL( G_CCMUX_##d0, 15, 3 ) | \ - _SHIFTL( G_ACMUX_##Ab0, 12, 3 ) | _SHIFTL( G_ACMUX_##Ad0, 9, 3 ) | \ - _SHIFTL( G_CCMUX_##b1, 24, 4 ) | _SHIFTL( G_ACMUX_##Aa1, 21, 3 ) | \ - _SHIFTL( G_ACMUX_##Ac1, 18, 3 ) | _SHIFTL( G_CCMUX_##d1, 6, 3 ) | \ - _SHIFTL( G_ACMUX_##Ab1, 3, 3 ) | _SHIFTL( G_ACMUX_##Ad1, 0, 3 ))) - -// Internal combiner commands -#define LOAD 0 -#define SUB 1 -#define MUL 2 -#define ADD 3 -#define INTER 4 - -// Internal generalized combiner inputs -#define G_GCI_COMBINED 0 -#define G_GCI_TEXEL0 1 -#define G_GCI_TEXEL1 2 -#define G_GCI_PRIMITIVE 3 -#define G_GCI_SHADE 4 -#define G_GCI_ENVIRONMENT 5 -#define G_GCI_CENTER 6 -#define G_GCI_SCALE 7 -#define G_GCI_COMBINED_ALPHA 8 -#define G_GCI_TEXEL0_ALPHA 9 -#define G_GCI_TEXEL1_ALPHA 10 -#define G_GCI_PRIMITIVE_ALPHA 11 -#define G_GCI_SHADE_ALPHA 12 -#define G_GCI_ENV_ALPHA 13 -#define G_GCI_LOD_FRACTION 14 -#define G_GCI_PRIM_LOD_FRAC 15 -#define G_GCI_NOISE 16 -#define G_GCI_K4 17 -#define G_GCI_K5 18 -#define G_GCI_ONE 19 -#define G_GCI_ZERO 20 -#define G_GCI_HALF 21 -#define G_GCI_HW_LIGHT 22 -#define G_GCI_HW_LIGHT 22 -#define G_GCI_LAST 23 - -struct CombinerOp -{ - u32 op = LOAD; - u32 param1 = G_GCI_LAST; - u32 param2 = G_GCI_LAST; - u32 param3 = G_GCI_LAST; -}; - -struct CombinerStage -{ - u32 numOps; - CombinerOp op[6]; -}; - -struct Combiner -{ - u32 numStages; - CombinerStage stage[2]; -}; - -struct CombineCycle -{ - u32 sa, sb, m, a; -}; - -class CombinerInfo -{ -public: - void init(); - void destroy(); - void update(); - void setCombine(u64 _mux); - void updateParameters(); - - void setDepthFogCombiner(); - graphics::ShaderProgram * getTexrectUpscaleCopyProgram(); - graphics::ShaderProgram * getTexrectColorAndDepthUpscaleCopyProgram(); - graphics::ShaderProgram * getTexrectDownscaleCopyProgram(); - graphics::ShaderProgram * getTexrectColorAndDepthDownscaleCopyProgram(); - - graphics::CombinerProgram * getCurrent() const { return m_pCurrent; } - bool isChanged() const {return m_bChanged;} - bool isShaderCacheSupported() const; - - static CombinerInfo & get(); - - void setPolygonMode(DrawingState _drawingState); - bool isRectMode() const { return m_rectMode; } - -private: - CombinerInfo() - : m_bChanged(false) - , m_rectMode(true) - , m_shadersLoaded(0) - , m_configOptionsBitSet(0) - , m_pCurrent(nullptr) {} - CombinerInfo(const CombinerInfo &) = delete; - - void _saveShadersStorage() const; - bool _loadShadersStorage(); - - bool m_bChanged; - bool m_rectMode; - u32 m_shadersLoaded; - u32 m_configOptionsBitSet; - - graphics::CombinerProgram * m_pCurrent; - graphics::Combiners m_combiners; - - std::unique_ptr m_shadowmapProgram; - std::unique_ptr m_texrectUpscaleCopyProgram; - std::unique_ptr m_texrectColorAndDepthUpscaleCopyProgram; - std::unique_ptr m_texrectDownscaleCopyProgram; - std::unique_ptr m_texrectColorAndDepthDownscaleCopyProgram; -}; - -inline -graphics::CombinerProgram * currentCombiner() { - return CombinerInfo::get().getCurrent(); -} - -void Combiner_Init(); -void Combiner_Destroy(); -graphics::CombinerProgram * Combiner_Compile(CombinerKey key); - -#endif - diff --git a/GLideN64/src/CombinerKey.cpp b/GLideN64/src/CombinerKey.cpp deleted file mode 100644 index 9115832..0000000 --- a/GLideN64/src/CombinerKey.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "Combiner.h" -#include "CombinerKey.h" - - -/*---------------CombinerKey-------------*/ - -CombinerKey::CombinerKey(u64 _mux, bool _setModeBits) -{ - m_key.mux = _mux; - if (!_setModeBits) - return; - - // High byte of muxs0 is zero. We can use it for addtional combiner flags: - // [0 - 0] polygon type: 0 - triangle, 1 - rect - // [1 - 2] cycle type - // [3 - 3] bi_lerp1 - // [4 - 4] bi_lerp0 - // [5 - 5] is HWL supported - u32 flags = CombinerInfo::get().isRectMode() ? 1U : 0U; - const u32 cycleType = gDP.otherMode.cycleType; - const u32 bilerp = (gDP.otherMode.h >> 10) & 3; - const u32 isHWLSupported = static_cast(GBI.isHWLSupported()); - flags |= (cycleType << 1); - flags |= (bilerp << 3); - flags |= (isHWLSupported << 5); - - m_key.muxs0 |= (flags << 24); -} - -CombinerKey::CombinerKey(const CombinerKey & _other) -{ - m_key.mux = _other.m_key.mux; -} - -void CombinerKey::operator=(u64 _mux) -{ - m_key.mux = _mux; -} - -void CombinerKey::operator=(const CombinerKey & _other) -{ - m_key.mux = _other.m_key.mux; -} - -bool CombinerKey::operator==(const CombinerKey & _other) const -{ - return m_key.mux == _other.m_key.mux; -} - -bool CombinerKey::operator<(const CombinerKey & _other) const -{ - return m_key.mux < _other.m_key.mux; -} - -u32 CombinerKey::getCycleType() const -{ - return (m_key.muxs0 >> 25) & 3; -} - -u32 CombinerKey::getBilerp() const -{ - return (m_key.muxs0 >> 27) & 3; -} - -bool CombinerKey::isRectKey() const -{ - return ((m_key.muxs0 >> 24) & 1) != 0; -} - -bool CombinerKey::isHWLSupported() const -{ - return ((m_key.muxs0 >> 29) & 1) != 0; -} - -void CombinerKey::read(std::istream & _is) -{ - _is.read(reinterpret_cast(&m_key.mux), sizeof(m_key.mux)); -} - -const CombinerKey & CombinerKey::getEmpty() -{ - static CombinerKey emptyKey; - return emptyKey; -} diff --git a/GLideN64/src/CombinerKey.h b/GLideN64/src/CombinerKey.h deleted file mode 100644 index c50af5e..0000000 --- a/GLideN64/src/CombinerKey.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -#include -#include "gDP.h" - -class CombinerKey { -public: - CombinerKey() { - m_key.mux = 0; - } - explicit CombinerKey(u64 _mux, bool _setModeBits = true); - CombinerKey(const CombinerKey & _other); - - void operator=(u64 _mux); - void operator=(const CombinerKey & _other); - - bool operator==(const CombinerKey & _other) const; - bool operator<(const CombinerKey & _other) const; - - bool isRectKey() const; - - bool isHWLSupported() const; - - u32 getCycleType() const; - - u32 getBilerp() const; - - u64 getMux() const { return m_key.mux; } - - void read(std::istream & _is); - - static const CombinerKey & getEmpty(); - -private: - gDPCombine m_key; -}; diff --git a/GLideN64/src/CommonPluginAPI.cpp b/GLideN64/src/CommonPluginAPI.cpp deleted file mode 100644 index 77336f9..0000000 --- a/GLideN64/src/CommonPluginAPI.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#ifdef OS_WINDOWS -# include -#else -# include "winlnxdefs.h" -#endif // OS_WINDOWS - -#include "PluginAPI.h" - -extern "C" { - -EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info) -{ - return api().InitiateGFX(Gfx_Info); -} - -EXPORT void CALL MoveScreen (int xpos, int ypos) -{ - api().MoveScreen(xpos, ypos); -} - -EXPORT void CALL ProcessDList(void) -{ - api().ProcessDList(); -} - -EXPORT void CALL ProcessRDPList(void) -{ - api().ProcessRDPList(); -} - -EXPORT void CALL RomClosed (void) -{ - api().RomClosed(); -} - -EXPORT void CALL ShowCFB (void) -{ - api().ShowCFB(); -} - -EXPORT void CALL UpdateScreen (void) -{ - api().UpdateScreen(); -} - -EXPORT void CALL ViStatusChanged (void) -{ - api().ViStatusChanged(); -} - -EXPORT void CALL ViWidthChanged (void) -{ - api().ViWidthChanged(); -} - -EXPORT void CALL ChangeWindow(void) -{ - api().ChangeWindow(); -} - -EXPORT void CALL FBWrite(unsigned int addr, unsigned int size) -{ - api().FBWrite(addr, size); -} - -EXPORT void CALL FBRead(unsigned int addr) -{ - api().FBRead(addr); -} - -EXPORT void CALL FBGetFrameBufferInfo(void *pinfo) -{ - api().FBGetFrameBufferInfo(pinfo); -} - -#ifndef MUPENPLUSAPI -EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, unsigned int size) -{ - api().FBWList(plist, size); -} -#endif -} diff --git a/GLideN64/src/Config.cpp b/GLideN64/src/Config.cpp deleted file mode 100644 index e4932d5..0000000 --- a/GLideN64/src/Config.cpp +++ /dev/null @@ -1,201 +0,0 @@ -#ifdef OS_WINDOWS -# include -#else -# include "winlnxdefs.h" -#endif // OS_WINDOWS -#include "RSP.h" -#include "PluginAPI.h" -#include "Config.h" -#include "GBI.h" -#include "wst.h" -#include "osal_keys.h" - -void Config::resetToDefaults() -{ - version = CONFIG_VERSION_CURRENT; - -#if defined(PANDORA) || defined(VC) - video.fullscreen = 1; - video.fullscreenWidth = video.windowedWidth = 800; -#else - video.fullscreen = 0; - video.fullscreenWidth = video.windowedWidth = 640; -#endif - video.fullscreenHeight = video.windowedHeight = 480; - video.fullscreenRefresh = 60; - video.fxaa = 0; - video.multisampling = 0; - video.maxMultiSampling = 0; - video.verticalSync = 0; - -#if defined(OS_ANDROID) - video.threadedVideo = 1; -#else - video.threadedVideo = 0; -#endif - - texture.maxAnisotropy = 0; - texture.bilinearMode = BILINEAR_STANDARD; - texture.enableHalosRemoval = 0; - texture.screenShotFormat = 0; - - generalEmulation.enableLOD = 1; - generalEmulation.enableHiresNoiseDithering = 0; - generalEmulation.enableDitheringPattern = 0; - generalEmulation.enableDitheringQuantization = 1; - generalEmulation.rdramImageDitheringMode = BufferDitheringMode::bdmBlueNoise; - generalEmulation.enableHWLighting = 0; - generalEmulation.enableCoverage = 0; - generalEmulation.enableClipping = 1; - generalEmulation.enableCustomSettings = 1; - generalEmulation.enableShadersStorage = 1; - generalEmulation.enableLegacyBlending = 0; - generalEmulation.enableHybridFilter = 1; - generalEmulation.hacks = 0; -#if defined(OS_ANDROID) || defined(OS_IOS) - generalEmulation.enableFragmentDepthWrite = 0; - generalEmulation.forcePolygonOffset = 0; - generalEmulation.polygonOffsetFactor = 0.0f; - generalEmulation.polygonOffsetUnits = 0.0f; -#else - generalEmulation.enableFragmentDepthWrite = 1; -#endif - - graphics2D.correctTexrectCoords = tcDisable; - graphics2D.enableNativeResTexrects = NativeResTexrectsMode::ntDisable; - graphics2D.bgMode = BGMode::bgStripped; - graphics2D.enableTexCoordBounds = 0; - - frameBufferEmulation.enable = 1; - frameBufferEmulation.copyDepthToRDRAM = cdSoftwareRender; - frameBufferEmulation.copyFromRDRAM = 0; - frameBufferEmulation.copyAuxToRDRAM = 0; - frameBufferEmulation.copyToRDRAM = ctDoubleBuffer; - frameBufferEmulation.N64DepthCompare = dcDisable; - frameBufferEmulation.forceDepthBufferClear = 0; - frameBufferEmulation.aspect = a43; - frameBufferEmulation.bufferSwapMode = bsOnVerticalInterrupt; - frameBufferEmulation.nativeResFactor = 2; - frameBufferEmulation.fbInfoReadColorChunk = 0; - frameBufferEmulation.fbInfoReadDepthChunk = 1; - frameBufferEmulation.copyDepthToMainDepthBuffer = 0; -#ifndef MUPENPLUSAPI - frameBufferEmulation.fbInfoDisabled = 0; -#else - frameBufferEmulation.fbInfoDisabled = 1; -#endif - frameBufferEmulation.enableOverscan = 0; - - textureFilter.txFilterMode = 0; - textureFilter.txEnhancementMode = 0; - textureFilter.txDeposterize = 0; - textureFilter.txFilterIgnoreBG = 0; - textureFilter.txCacheSize = 100 * gc_uMegabyte; - - textureFilter.txHiresEnable = 0; - textureFilter.txHiresFullAlphaChannel = 1; - textureFilter.txHresAltCRC = 0; - - textureFilter.txForce16bpp = 0; - textureFilter.txCacheCompression = 1; - textureFilter.txSaveCache = 1; - - textureFilter.txEnhancedTextureFileStorage = 0; - textureFilter.txHiresTextureFileStorage = 0; - - api().GetUserDataPath(textureFilter.txPath); - gln_wcscat(textureFilter.txPath, wst("/hires_texture")); - api().GetUserCachePath(textureFilter.txCachePath); - gln_wcscat(textureFilter.txCachePath, wst("/cache")); - api().GetUserCachePath(textureFilter.txDumpPath); - gln_wcscat(textureFilter.txDumpPath, wst("/texture_dump")); - -#ifdef OS_WINDOWS - font.name.assign("arial.ttf"); -#elif defined (OS_ANDROID) - font.name.assign("DroidSans.ttf"); -#elif defined (PANDORA) - font.name.assign("LiberationMono-Regular.ttf"); -#else - font.name = "FreeSans.ttf"; -#endif - font.size = 18; - font.color[0] = 0xB5; - font.color[1] = 0xE6; - font.color[2] = 0x1D; - font.color[3] = 0xFF; - for (int i = 0; i < 4; ++i) - font.colorf[i] = font.color[i] / 255.0f; - - gammaCorrection.force = 0; - gammaCorrection.level = 2.0f; - - onScreenDisplay.vis = 0; - onScreenDisplay.fps = 0; - onScreenDisplay.percent = 0; - onScreenDisplay.internalResolution = 0; - onScreenDisplay.renderingResolution = 0; - onScreenDisplay.statistics = 0; - onScreenDisplay.pos = posBottomLeft; - - for (u32 idx = 0; idx < HotKey::hkTotal; ++idx) - hotkeys.keys[idx] = 0; - - debug.dumpMode = 0; -} - -bool isHWLightingAllowed() -{ - if (config.generalEmulation.enableHWLighting == 0) - return false; - return GBI.isHWLSupported(); -} - -void Config::validate() -{ - if (frameBufferEmulation.enable != 0 && frameBufferEmulation.N64DepthCompare != dcDisable) - video.multisampling = 0; - if (frameBufferEmulation.nativeResFactor == 1) { - graphics2D.enableNativeResTexrects = 0; - graphics2D.correctTexrectCoords = tcDisable; - } else { - if (graphics2D.enableNativeResTexrects != 0) - graphics2D.correctTexrectCoords = tcDisable; - } -} - -const char* Config::hotkeyIniName(u32 _idx) -{ - switch (_idx) - { - case Config::HotKey::hkTexDump: - return "hkTexDump"; - case Config::HotKey::hkHdTexReload: - return "hkHdTexReload"; - case Config::HotKey::hkHdTexToggle: - return "hkHdTexToggle"; - case Config::HotKey::hkTexCoordBounds: - return "hkTexCoordBounds"; - case Config::HotKey::hkNativeResTexrects: - return "hkNativeResTexrects"; - case Config::HotKey::hkVsync: - return "hkVsync"; - case Config::HotKey::hkFBEmulation: - return "hkFBEmulation"; - case Config::HotKey::hkN64DepthCompare: - return "hkN64DepthCompare"; - case Config::HotKey::hkOsdVis: - return "hkOsdVis"; - case Config::HotKey::hkOsdFps: - return "hkOsdFps"; - case Config::HotKey::hkOsdPercent: - return "hkOsdPercent"; - case Config::HotKey::hkOsdInternalResolution: - return "hkOsdInternalResolution"; - case Config::HotKey::hkOsdRenderingResolution: - return "hkOsdRenderingResolution"; - case Config::HotKey::hkForceGammaCorrection: - return "hkForceGammaCorrection"; - } - return nullptr; -} diff --git a/GLideN64/src/Config.h b/GLideN64/src/Config.h deleted file mode 100644 index 41d5866..0000000 --- a/GLideN64/src/Config.h +++ /dev/null @@ -1,284 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#include -#include "Types.h" - -#define CONFIG_WITH_PROFILES 23U -#define CONFIG_VERSION_CURRENT 29U - -#define BILINEAR_3POINT 0 -#define BILINEAR_STANDARD 1 -#define BILINEAR_3POINT_WITH_COLOR_BLEEDING 2 -#define BILINEAR_STANDARD_WITH_COLOR_BLEEDING_AND_PREMULTIPLIED_ALPHA 3 - -const u32 gc_uMegabyte = 1024U * 1024U; - -struct Config -{ - u32 netplay; - - u32 version; - - std::string translationFile; - - struct - { - u32 fullscreen; - u32 windowedWidth, windowedHeight; - u32 fullscreenWidth, fullscreenHeight, fullscreenRefresh; - u32 fxaa; - u32 multisampling, maxMultiSampling; - u32 verticalSync; - u32 threadedVideo; - } video; - - struct - { - u32 maxAnisotropy; - f32 maxAnisotropyF; - u32 bilinearMode; - u32 enableHalosRemoval; - u32 screenShotFormat; - } texture; - - enum TexrectCorrectionMode { - tcDisable = 0, - tcSmart, - tcForce - }; - - enum BufferDitheringMode { - bdmDisable = 0, - bdmBayer, - bdmMagicSquare, - bdmBlueNoise - }; - - struct { - u32 enableDitheringPattern; - u32 enableDitheringQuantization; - u32 enableHiresNoiseDithering; - u32 rdramImageDitheringMode; - u32 enableLOD; - u32 enableHWLighting; - u32 enableCoverage; - u32 enableClipping; - u32 enableCustomSettings; - u32 enableShadersStorage; - u32 enableLegacyBlending; - u32 enableHybridFilter; - u32 enableFragmentDepthWrite; - u32 hacks; -#if defined(OS_ANDROID) || defined(OS_IOS) - u32 forcePolygonOffset; - f32 polygonOffsetFactor; - f32 polygonOffsetUnits; -#endif - } generalEmulation; - - enum BGMode { - bgOnePiece = 0, - bgStripped = 1 - }; - - enum NativeResTexrectsMode { - ntDisable = 0, - ntOptimized, - ntUnptimized - }; - - struct { - u32 correctTexrectCoords; - u32 enableNativeResTexrects; - u32 bgMode; - u32 enableTexCoordBounds; - } graphics2D; - - enum Aspect { - aStretch = 0, - a43 = 1, - a169 = 2, - aAdjust = 3, - aTotal = 4 - }; - - enum CopyToRDRAM { - ctDisable = 0, - ctSync = 1, - ctDoubleBuffer = 2, - ctTripleBuffer = 3 - }; - - enum BufferSwapMode { - bsOnVerticalInterrupt = 0, - bsOnVIOriginChange, - bsOnColorImageChange - }; - - enum CopyDepthMode { - cdDisable = 0, - cdCopyFromVRam = 1, - cdSoftwareRender = 2 - }; - - enum N64DepthCompareMode { - dcDisable = 0, - dcFast, - dcCompatible - }; - - struct { - u32 enable; - u32 aspect; // 0: stretch ; 1: 4/3 ; 2: 16/9; 3: adjust - u32 bufferSwapMode; // 0: on VI update call; 1: on VI origin change; 2: on main frame buffer update - u32 nativeResFactor; - u32 N64DepthCompare; - u32 forceDepthBufferClear; - u32 copyAuxToRDRAM; - // Buffer read/write - u32 copyToRDRAM; - u32 copyDepthToRDRAM; - u32 copyFromRDRAM; - - // FBInfo - u32 fbInfoSupported; - u32 fbInfoDisabled; - u32 fbInfoReadColorChunk; - u32 fbInfoReadDepthChunk; - - // Depth buffer copy. For Reshade. - u32 copyDepthToMainDepthBuffer; - - // Overscan - u32 enableOverscan; - struct { - s32 left = 0; - s32 right = 0; - s32 top = 0; - s32 bottom = 0; - } overscanPAL, overscanNTSC; - } frameBufferEmulation; - - struct - { - u32 txFilterMode; // Texture filtering mode, eg Sharpen - u32 txEnhancementMode; // Texture enhancement mode, eg 2xSAI - u32 txDeposterize; // Deposterize texture before enhancement - u32 txFilterIgnoreBG; // Do not apply filtering to backgrounds textures - u32 txCacheSize; // Cache size in Mbytes - - u32 txHiresEnable; // Use high-resolution texture packs - u32 txHiresFullAlphaChannel; // Use alpha channel fully - u32 txHresAltCRC; // Use alternative method of paletted textures CRC calculation - - u32 txForce16bpp; // Force use 16bit color textures - u32 txCacheCompression; // Zip textures cache - u32 txSaveCache; // Save texture cache to hard disk - - u32 txEnhancedTextureFileStorage; // Use file storage instead of memory cache for enhanced textures. - u32 txHiresTextureFileStorage; // Use file storage instead of memory cache for hires textures. - - wchar_t txPath[PLUGIN_PATH_SIZE]; // Path to texture packs - wchar_t txCachePath[PLUGIN_PATH_SIZE]; // Path to store texture cache, that is .htc files - wchar_t txDumpPath[PLUGIN_PATH_SIZE]; // Path to store texture dumps - } textureFilter; - - struct - { - std::string name; - u32 size; - u8 color[4]; - float colorf[4]; - } font; - - struct { - u32 force; - f32 level; - } gammaCorrection; - - enum CountersPosition { - posTopLeft = 1, - posTopCenter = 2, - posTopRight = 4, - posTop = posTopLeft | posTopCenter | posTopRight, - posBottomLeft = 8, - posBottomCenter = 16, - posBottomRight = 32, - posBottom = posBottomLeft | posBottomCenter | posBottomRight - }; - - struct { - u32 vis; - u32 fps; - u32 percent; - u32 internalResolution; - u32 renderingResolution; - u32 statistics; - u32 pos; - } onScreenDisplay; - - enum HotKey { - hkTexDump = 0, - hkHdTexReload, - hkHdTexToggle, - hkTexCoordBounds, - hkNativeResTexrects, - hkVsync, - hkFBEmulation, - hkN64DepthCompare, - hkOsdVis, - hkOsdFps, - hkOsdPercent, - hkOsdInternalResolution, - hkOsdRenderingResolution, - hkForceGammaCorrection, - hkTotal - }; - - struct { - u8 keys[hkTotal]; - } hotkeys; - - struct { - u32 dumpMode; - } debug; - - void resetToDefaults(); - void validate(); - static const char* hotkeyIniName(u32 _idx); -}; - -#define hack_Ogre64 (1<<0) //Ogre Battle 64 background copy -#define hack_noDepthFrameBuffers (1<<1) //Do not use depth buffers as texture -#define hack_blurPauseScreen (1<<2) //Game copies frame buffer to depth buffer area, CPU blurs it. That image is used as background for pause screen. -#define hack_clearAloneDepthBuffer (1<<3) //Force clear depth buffer if there is no frame buffer for it. Multiplayer in GE and PD. -#define hack_StarCraftBackgrounds (1<<4) //StarCraft special check for frame buffer usage. -#define hack_subscreen (1<<6) //Fix subscreen delay in Zelda OOT and Doubutsu no Mori -#define hack_blastCorps (1<<7) //Blast Corps black polygons -#define hack_rectDepthBufferCopyPD (1<<8) //Copy depth buffer only when game need it. Optimized for PD -#define hack_rectDepthBufferCopyCBFD (1<<9) //Copy depth buffer only when game need it. Optimized for CBFD -#define hack_WinBack (1<<10) //Hack for WinBack to remove gray rectangle in HLE mode -#define hack_ZeldaMM (1<<11) //Special hacks for Zelda MM -#define hack_ModifyVertexXyInShader (1<<12) //Pass screen coordinates provided in gSPModifyVertex to vertes shader. -#define hack_LodeRunner (1<<13) //Hack for Lode runner VI issues. -#define hack_doNotResetOtherModeH (1<<14) //Don't reset othermode.h after dlist end. Quake and Quake 2 -#define hack_doNotResetOtherModeL (1<<15) //Don't reset othermode.l after dlist end. Quake -#define hack_LoadDepthTextures (1<<16) //Load textures for depth buffer -#define hack_Snap (1<<17) //Frame buffer settings for camera detection in Pokemon Snap. Copy aux buffers at fullsync -#define hack_MK64 (1<<18) //Hack for load MK64 HD textures properly. -#define hack_RE2 (1<<19) //RE2 hacks. -#define hack_ZeldaMonochrome (1<<20) //Hack for Zeldas monochrome effects. -#define hack_TonyHawk (1<<21) //Hack for Tony Hawk blend mode. -#define hack_WCWNitro (1<<22) //Hack for WCW Nitro backgrounds. - -extern Config config; - -void Config_LoadConfig(); -#if defined(M64P_GLIDENUI) || !defined(MUPENPLUSAPI) -void Config_DoConfig(/*HWND hParent*/); -#endif - -bool isHWLightingAllowed(); - -#endif // CONFIG_H diff --git a/GLideN64/src/DebugDump.cpp b/GLideN64/src/DebugDump.cpp deleted file mode 100644 index 05ea066..0000000 --- a/GLideN64/src/DebugDump.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "PluginAPI.h" -#include "Log.h" -#include "wst.h" -#include "DebugDump.h" -#include "DisplayWindow.h" - -#ifdef DEBUG_DUMP - -class BufferedLog -{ -public: - BufferedLog(u32 _mode); - BufferedLog(const BufferedLog&) = delete; - ~BufferedLog(); - - void print(const char* _message); - bool needPrint(u32 _mode) const; - -private: - u32 m_mode; - std::ofstream m_log; - std::vector m_logBuffer; -}; - -BufferedLog::BufferedLog(u32 _mode) : m_mode(_mode) -{ - try { - m_logBuffer.resize(1024*1024); - m_log.rdbuf()->pubsetbuf(&m_logBuffer.front(), m_logBuffer.size()); - } catch(std::bad_alloc&) { - LOG(LOG_ERROR, "Failed to alloc memory for log buffer"); - } - - wchar_t logPath[PLUGIN_PATH_SIZE + 16]; - api().GetUserDataPath(logPath); - gln_wcscat(logPath, wst("/gliden64.debug.log")); - const size_t bufSize = PLUGIN_PATH_SIZE * 6; - char cbuf[bufSize]; - wcstombs(cbuf, logPath, bufSize); - m_log.open(cbuf, std::ios::trunc); -} - -BufferedLog::~BufferedLog() -{ - m_log.flush(); - m_log.close(); -} - -void BufferedLog::print(const char* _message) -{ - m_log << _message; -} - -bool BufferedLog::needPrint(u32 _mode) const -{ - return (m_mode&_mode) != 0; -} - -std::unique_ptr g_log; - -void DebugMsg(u32 _mode, const char * _format, ...) -{ - if (!g_log || !g_log->needPrint(_mode)) - return; - - char buf[1024]; - char* text = buf; - if ((_mode & DEBUG_IGNORED) != 0) { - sprintf(buf, "Ignored: "); - text += strlen(buf); - } - if ((_mode & DEBUG_ERROR) != 0) { - sprintf(buf, "Error: "); - text += strlen(buf); - } - - va_list va; - va_start(va, _format); - vsprintf(text, _format, va); - va_end(va); - - g_log->print(buf); -} - -void StartDump(u32 _mode) -{ - dwnd().getDrawer().showMessage("Start commands logging\n", Milliseconds(750)); - g_log.reset(new BufferedLog(_mode)); -} - -void EndDump() -{ - dwnd().getDrawer().showMessage("Stop commands logging\n", Milliseconds(750)); - g_log.reset(); -} - -void SwitchDump(u32 _mode) -{ - if (_mode == 0) - return; - - if (!g_log) - StartDump(_mode); - else - EndDump(); -} - -bool IsDump() -{ - return !!g_log; -} - -#endif // DEBUG_DUMP diff --git a/GLideN64/src/DebugDump.h b/GLideN64/src/DebugDump.h deleted file mode 100644 index 85f31bc..0000000 --- a/GLideN64/src/DebugDump.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef DEBUG_H -#define DEBUG_H - -#include "Types.h" - -#define DEBUG_LOW 0x01 -#define DEBUG_NORMAL 0x02 -#define DEBUG_DETAIL 0x04 -#define DEBUG_IGNORED 0x08 -#define DEBUG_ERROR 0x10 - -#ifdef DEBUG_DUMP - -void DebugMsg(u32 _mode, const char * _format, ...); -void StartDump(u32 _mode); -void EndDump(); -void SwitchDump(u32 _mode); -bool IsDump(); - -static const char *ImageFormatText[] = -{ - "G_IM_FMT_RGBA", - "G_IM_FMT_YUV", - "G_IM_FMT_CI", - "G_IM_FMT_IA", - "G_IM_FMT_I", - "G_IM_FMT_INVALID", - "G_IM_FMT_INVALID", - "G_IM_FMT_INVALID" -}; - -static const char *ImageSizeText[] = -{ - "G_IM_SIZ_4b", - "G_IM_SIZ_8b", - "G_IM_SIZ_16b", - "G_IM_SIZ_32b" -}; - -static const char *SegmentText[] = -{ - "G_MWO_SEGMENT_0", "G_MWO_SEGMENT_1", "G_MWO_SEGMENT_2", "G_MWO_SEGMENT_3", - "G_MWO_SEGMENT_4", "G_MWO_SEGMENT_5", "G_MWO_SEGMENT_6", "G_MWO_SEGMENT_7", - "G_MWO_SEGMENT_8", "G_MWO_SEGMENT_9", "G_MWO_SEGMENT_A", "G_MWO_SEGMENT_B", - "G_MWO_SEGMENT_C", "G_MWO_SEGMENT_D", "G_MWO_SEGMENT_E", "G_MWO_SEGMENT_F" -}; - -static const char *AAEnableText = "AA_EN"; -static const char *DepthCompareText = "Z_CMP"; -static const char *DepthUpdateText = "Z_UPD"; -static const char *ColorOnCvgText = "CLR_ON_CVG"; -static const char *CvgXAlphaText = "CVG_X_ALPHA"; -static const char *AlphaCvgSelText = "ALPHA_CVG_SEL"; -static const char *ForceBlenderText = "FORCE_BL"; - -static const char *AlphaCompareText[] = -{ - "G_AC_NONE", "G_AC_THRESHOLD", "G_AC_INVALID", "G_AC_DITHER" -}; - -static const char *DepthSourceText[] = -{ - "G_ZS_PIXEL", "G_ZS_PRIM" -}; - -static const char *AlphaDitherText[] = -{ - "G_AD_PATTERN", "G_AD_NOTPATTERN", "G_AD_NOISE", "G_AD_DISABLE" -}; - -static const char *ColorDitherText[] = -{ - "G_CD_MAGICSQ", "G_CD_BAYER", "G_CD_NOISE", "G_CD_DISABLE" -}; - -static const char *CombineKeyText[] = -{ - "G_CK_NONE", "G_CK_KEY" -}; - -static const char *TextureConvertText[] = -{ - "G_TC_CONV", "G_TC_INVALID", "G_TC_INVALID", "G_TC_INVALID", "G_TC_INVALID", "G_TC_FILTCONV", "G_TC_FILT", "G_TC_INVALID" -}; - -static const char *TextureFilterText[] = -{ - "G_TF_POINT", "G_TF_INVALID", "G_TF_BILERP", "G_TF_AVERAGE" -}; - -static const char *TextureLUTText[] = -{ - "G_TT_NONE", "G_TT_INVALID", "G_TT_RGBA16", "G_TT_IA16" -}; - -static const char *TextureLODText[] = -{ - "G_TL_TILE", "G_TL_LOD" -}; - -static const char *TextureDetailText[] = -{ - "G_TD_CLAMP", "G_TD_SHARPEN", "G_TD_DETAIL" -}; - -static const char *TexturePerspText[] = -{ - "G_TP_NONE", "G_TP_PERSP" -}; - -static const char *CycleTypeText[] = -{ - "G_CYC_1CYCLE", "G_CYC_2CYCLE", "G_CYC_COPY", "G_CYC_FILL" -}; - -static const char *PipelineModeText[] = -{ - "G_PM_NPRIMITIVE", "G_PM_1PRIMITIVE" -}; - -static const char *CvgDestText[] = -{ - "CVG_DST_CLAMP", "CVG_DST_WRAP", "CVG_DST_FULL", "CVG_DST_SAVE" -}; - -static const char *DepthModeText[] = -{ - "ZMODE_OPA", "ZMODE_INTER", "ZMODE_XLU", "ZMODE_DEC" -}; - -static const char *ScissorModeText[] = -{ - "G_SC_NON_INTERLACE", "G_SC_INVALID", "G_SC_EVEN_INTERLACE", "G_SC_ODD_INTERLACE" -}; - -static const char *saRGBText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "NOISE", "1", - "0", "0", "0", "0", - "0", "0", "0", "0" -}; - -static const char *sbRGBText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "CENTER", "K4", - "0", "0", "0", "0", - "0", "0", "0", "0" -}; - -static const char *mRGBText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "SCALE", "COMBINED_ALPHA", - "TEXEL0_ALPHA", "TEXEL1_ALPHA", "PRIMITIVE_ALPHA", "SHADE_ALPHA", - "ENV_ALPHA", "LOD_FRACTION", "PRIM_LOD_FRAC", "K5", - "0", "0", "0", "0", - "0", "0", "0", "0", - "0", "0", "0", "0", - "0", "0", "0", "0" -}; - -static const char *aRGBText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "1", "0", -}; - -static const char *saAText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "1", "0", -}; - -static const char *sbAText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "1", "0", -}; - -static const char *mAText[] = -{ - "LOD_FRACTION", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "PRIM_LOD_FRAC", "0", -}; - -static const char *aAText[] = -{ - "COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "1", "0", -}; - - - -#else - -#define DebugMsg(type, A, ...) -#define SwitchDump(A) - -#endif // DEBUG_DUMP - -#endif // DEBUG_H diff --git a/GLideN64/src/Debugger.cpp b/GLideN64/src/Debugger.cpp deleted file mode 100644 index f8cb09a..0000000 --- a/GLideN64/src/Debugger.cpp +++ /dev/null @@ -1,1347 +0,0 @@ -#include -#include "assert.h" -#include "math.h" -#include "Platform.h" -#include "GLideN64.h" -#include "Revision.h" -#include "RSP.h" -#include "Config.h" -#include "Combiner.h" -#include "FrameBuffer.h" -#include "DisplayWindow.h" -#include "TextDrawer.h" -#include "DebugDump.h" -#include "Debugger.h" -#include "osal_keys.h" - -#ifndef MUPENPLUSAPI -#include "windows/GLideN64_windows.h" -#endif - -Debugger g_debugger; - -using namespace graphics; - -#ifdef DEBUG_DUMP - -static -bool getCursorPos(long & _x, long & _y) -{ -#ifdef OS_WINDOWS - POINT pt; - const bool res = GetCursorPos(&pt) == TRUE; -#ifndef MUPENPLUSAPI - ScreenToClient(hWnd, &pt); -#else - static HWND hWnd = NULL; - if (hWnd == NULL) { - wchar_t caption[64]; -# ifdef _DEBUG - swprintf(caption, 64, L"mupen64plus: %ls debug. Revision %ls", pluginNameW, PLUGIN_REVISION_W); -# else // _DEBUG - swprintf(caption, 64, L"%s. Revision %s", pluginName, PLUGIN_REVISION); -# endif // _DEBUG - hWnd = FindWindowEx(NULL, NULL, NULL, caption); - } - ScreenToClient(hWnd, &pt); -#endif // MUPENPLUSAPI - _x = pt.x; - _y = pt.y; - return res; -#else // OS_WINDOWS - _x = _y = 0; - return false; -#endif -} - -f32 Debugger::TriInfo::getScreenX(const Debugger::Vertex & _v) const -{ - if ((_v.modify & MODIFY_XY) != 0) - return _v.x; - return _v.x / _v.w * viewport.vscale[0] + viewport.vtrans[0]; -} - -f32 Debugger::TriInfo::getScreenY(const Debugger::Vertex & _v) const -{ - if ((_v.modify & MODIFY_XY) != 0) - return _v.y; - return -_v.y / _v.w * viewport.vscale[1] + viewport.vtrans[1]; -} - -f32 Debugger::TriInfo::getScreenZ(const Debugger::Vertex & _v) const -{ - if ((_v.modify & MODIFY_Z) != 0) - return _v.z; - return (_v.z / _v.w * viewport.vscale[2] + viewport.vtrans[2]); -} - -f32 Debugger::TriInfo::getModelX(const Debugger::Vertex & _v) const -{ - if ((_v.modify & MODIFY_XY) == 0) - return _v.x; - - f32 scaleX, scaleY; - calcCoordsScales(frameBufferList().findBuffer(frameBufferAddress), scaleX, scaleY); - return (2.0f * _v.x * scaleX - 1.0f) * _v.w; -} - -f32 Debugger::TriInfo::getModelY(const Debugger::Vertex & _v) const -{ - if ((_v.modify & MODIFY_XY) == 0) - return _v.y; - - f32 scaleX, scaleY; - calcCoordsScales(frameBufferList().findBuffer(frameBufferAddress), scaleX, scaleY); - return (-2.0f * _v.y * scaleY + 1.0f) * _v.w; -} - -f32 Debugger::TriInfo::getModelZ(const Debugger::Vertex & _v) const -{ - if ((_v.modify & MODIFY_Z) == 0) - return _v.z; - - return _v.z * _v.w; -} - - -bool Debugger::TriInfo::isInside(long x, long y) const -{ - if (vertices[0].x == vertices[1].x && vertices[0].y == vertices[1].y) - return false; - - u32 i, j; - - for (i = 0; i < vertices.size(); i++) { - j = i + 1; - if (j == vertices.size()) - j = 0; - - if ((y - getScreenY(vertices[i]))*(getScreenX(vertices[j]) - getScreenX(vertices[i])) - - (x - getScreenX(vertices[i]))*(getScreenY(vertices[j]) - getScreenY(vertices[i])) < 0) - break; // It's outside - } - - if (i == vertices.size()) // all lines passed - return true; - - for (i = 0; i < vertices.size(); i++) { - j = i + 1; - if (j == vertices.size()) - j = 0; - - if ((y - getScreenY(vertices[i]))*(getScreenX(vertices[j]) - getScreenX(vertices[i])) - - (x - getScreenX(vertices[i]))*(getScreenY(vertices[j]) - getScreenY(vertices[i])) > 0) - break; // It's outside - } - - return i == vertices.size(); // all lines passed -} - -Debugger::Debugger() -{ - m_triSel = m_triangles.end(); - m_startTexRow[0] = m_startTexRow[1] = 0; - for (u32 i = 0; i < 2; ++i) { - m_selectedTexPos[i].col = 0; - m_selectedTexPos[i].row = 0; - } -} - -Debugger::~Debugger() -{ -} - -void Debugger::checkDebugState() -{ - if (osal_is_key_pressed(KEY_ScrollLock, 0x0001)) - m_bDebugMode = !m_bDebugMode; - - if (m_bDebugMode && osal_is_key_pressed(KEY_Insert, 0x0001)) - m_bCapture = true; -} - -void Debugger::_debugKeys() -{ - if (osal_is_key_pressed(KEY_Right, 0x0001)) { - if (std::next(m_triSel) != m_triangles.cend()) - ++m_triSel; - else - m_triSel = m_triangles.cbegin(); - } - - if (osal_is_key_pressed(KEY_Left, 0x0001)) { - if (m_triSel != m_triangles.cbegin()) - --m_triSel; - else - m_triSel = std::prev(m_triangles.cend()); - } - - if (osal_is_key_pressed(KEY_F, 0x0001)) { - if (m_pCurTexInfo != nullptr) { - auto curTexName = m_pCurTexInfo->texture->name; - auto beginItr = - (std::next(m_triSel) != m_triangles.cend() && - ((m_triSel->tex_info[0] && m_triSel->tex_info[0]->texture->name == curTexName) || - (m_triSel->tex_info[1] && m_triSel->tex_info[1]->texture->name == curTexName))) ? - std::next(m_triSel) : - m_triangles.cbegin(); - auto predicate = [curTexName](const Triangles::value_type & val) { - if (val.tex_info[0].operator bool() && val.tex_info[0]->texture->name == curTexName) - return true; - if (val.tex_info[1].operator bool() && val.tex_info[1]->texture->name == curTexName) - return true; - return false; - }; - auto iter = std::find_if(beginItr, m_triangles.cend(), predicate); - if (iter == m_triangles.cend() && beginItr != m_triangles.cbegin()) - iter = std::find_if(m_triangles.cbegin(), beginItr, predicate); - if (iter != m_triangles.cend()) - m_triSel = iter; - } - } - - if (osal_is_key_pressed(KEY_B, 0x0001)) { - if (std::next(m_curFBAddr) != m_fbAddrs.end()) - ++m_curFBAddr; - else - m_curFBAddr = m_fbAddrs.begin(); - } - - if (osal_is_key_pressed(KEY_V, 0x0001)) { - if (m_curFBAddr != m_fbAddrs.begin()) - --m_curFBAddr; - else - m_curFBAddr = std::prev(m_fbAddrs.end()); - } - - if (osal_is_key_pressed(KEY_Q, 0x0001)) - m_tmu = 0; - if (osal_is_key_pressed(KEY_W, 0x0001)) - m_tmu = 1; - - if (osal_is_key_pressed(KEY_A, 0x0001)) - m_textureMode = TextureMode::both; // texture & texture alpha - if (osal_is_key_pressed(KEY_S, 0x0001)) - m_textureMode = TextureMode::texture; // texture - if (osal_is_key_pressed(KEY_D, 0x0001)) - m_textureMode = TextureMode::alpha; // texture alpha - - if (osal_is_key_pressed(KEY_1, 0x0001)) - m_curPage = Page::general; - if (osal_is_key_pressed(KEY_2, 0x0001)) - m_curPage = Page::tex1; - if (osal_is_key_pressed(KEY_3, 0x0001)) - m_curPage = Page::tex2; - if (osal_is_key_pressed(KEY_4, 0x0001)) - m_curPage = Page::colors; - if (osal_is_key_pressed(KEY_5, 0x0001)) - m_curPage = Page::blender; - if (osal_is_key_pressed(KEY_6, 0x0001)) - m_curPage = Page::othermode_l; - if (osal_is_key_pressed(KEY_7, 0x0001)) - m_curPage = Page::othermode_h; - if (osal_is_key_pressed(KEY_8, 0x0001)) - m_curPage = Page::texcoords; - if (osal_is_key_pressed(KEY_9, 0x0001)) - m_curPage = Page::coords; - if (osal_is_key_pressed(KEY_0, 0x0001)) - m_curPage = Page::texinfo; -} - -void Debugger::_fillTriInfo(TriInfo & _info) -{ - _info.cycle_type = gDP.otherMode.cycleType; - _info.combine = gDP.combine; - _info.otherMode = gDP.otherMode; - _info.geometryMode = gSP.geometryMode; - _info.fog_color = gDP.fogColor; - _info.fill_color = gDP.fillColor; - _info.blend_color = gDP.blendColor; - _info.env_color = gDP.envColor; - _info.prim_color = gDP.primColor; - _info.primDepthZ = gDP.primDepth.z; - _info.primDepthDeltaZ = gDP.primDepth.deltaZ; - _info.fogMultiplier = gSP.fog.multiplierf; - _info.fogOffset = gSP.fog.offsetf; - _info.K4 = gDP.convert.k4; - _info.K5 = gDP.convert.k5; - _info.viewport = gSP.viewport; - _info.frameBufferAddress = gDP.colorImage.address; - - if (currentCombiner()->usesTexture()) { - TextureCache& cache = TextureCache::get(); - for (u32 i = 0; i < 2; ++i) { - if (cache.current[i] == nullptr) - continue; - TexInfo * pInfo = new TexInfo; - pInfo->scales = gSP.texture.scales; - pInfo->scalet = gSP.texture.scalet; - pInfo->texture = cache.current[i]; - pInfo->texLoadInfo = gDP.loadInfo[gSP.textureTile[i]->tmem]; - _info.tex_info[i].reset(pInfo); - } - } -} - -void Debugger::_addTrianglesByElements(const Context::DrawTriangleParameters & _params) -{ - u16 * elements = reinterpret_cast(_params.elements); - u32 cur_tri = static_cast(m_triangles.size()); - for (u32 i = 0; i < _params.elementsCount;) { - m_triangles.emplace_back(); - TriInfo & info = m_triangles.back(); - for (u32 j = 0; j < 3; ++j) - info.vertices[j] = Vertex(_params.vertices[elements[i++]]); - info.tri_n = cur_tri++; - info.type = ttTriangle; - _fillTriInfo(info); - } -} - -void Debugger::_addTriangles(const Context::DrawTriangleParameters & _params) -{ - u32 cur_tri = static_cast(m_triangles.size()); - for (u32 i = 0; i < _params.verticesCount;) { - m_triangles.emplace_back(); - TriInfo & info = m_triangles.back(); - if (_params.mode == drawmode::TRIANGLES) { - for (u32 j = 0; j < 3; ++j) - info.vertices[j] = Vertex(_params.vertices[i++]); - } else { - assert(_params.mode == drawmode::TRIANGLE_STRIP); - for (u32 j = 0; j < 3; ++j) - info.vertices[j] = Vertex(_params.vertices[i + j]); - ++i; - } - info.tri_n = cur_tri++; - info.type = ttTriangle; - _fillTriInfo(info); - if (i + 3 > _params.verticesCount) - return; - } -} - -void Debugger::addTriangles(const graphics::Context::DrawTriangleParameters & _params) -{ - if (!m_bCapture) - return; - - if (_params.elements != nullptr) { - _addTrianglesByElements(_params); - } else { - _addTriangles(_params); - } -} - -void Debugger::addRects(const graphics::Context::DrawRectParameters & _params) -{ - if (!m_bCapture) - return; - - u32 cur_tri = static_cast(m_triangles.size()); - for (u32 i = 0; i < 2; ++i) { - m_triangles.emplace_back(); - TriInfo & info = m_triangles.back(); - for (u32 j = 0; j < 3; ++j) - info.vertices[j] = Vertex(_params.vertices[i+j]); - info.tri_n = cur_tri++; - info.type = _params.texrect ? ttTexrect : ttFillrect; - _fillTriInfo(info); - } -} - -void Debugger::_setTextureCombiner() -{ - gDP.otherMode.cycleType = G_CYC_1CYCLE; - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.setPolygonMode(DrawingState::TexRect); - switch (m_textureMode) { - case TextureMode::texture: - cmbInfo.setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, 1, 0, 0, 0, TEXEL0, 0, 0, 0, 1)); - break; - case TextureMode::alpha: - cmbInfo.setCombine(EncodeCombineMode(0, 0, 0, 1, 0, 0, 0, TEXEL0, 0, 0, 0, 1, 0, 0, 0, TEXEL0)); - break; - case TextureMode::both: - cmbInfo.setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0)); - break; - } - cmbInfo.getCurrent()->update(false); -} - -void Debugger::_setLineCombiner() -{ - gDP.otherMode.cycleType = G_CYC_1CYCLE; - gDP.envColor.r = gDP.envColor.g = 0; - gDP.envColor.b = gDP.envColor.a = 1; - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.setPolygonMode(DrawingState::Triangle); - cmbInfo.setCombine(EncodeCombineMode(0, 0, 0, ENVIRONMENT, 0, 0, 0, ENVIRONMENT, 0, 0, 0, ENVIRONMENT, 0, 0, 0, ENVIRONMENT)); - cmbInfo.getCurrent()->update(true); -} - -void Debugger::_drawTextureFrame(const RectVertex * _rect) -{ - //Draw lines for selected texture - _setLineCombiner(); - const f32 lineWidth = 1.5f; - SPVertex vertexBuf[2]; - memset(vertexBuf, 0, sizeof(vertexBuf)); - SPVertex & v0 = vertexBuf[0]; - v0.x = _rect[0].x; - v0.y = -_rect[0].y; - v0.z = _rect[0].z; - v0.w = _rect[0].w; - SPVertex & v1 = vertexBuf[1]; - v1 = v0; - v1.x = _rect[1].x; - gfxContext.drawLine(lineWidth, vertexBuf); - v1.x = _rect[0].x; - v1.y = -_rect[2].y; - gfxContext.drawLine(lineWidth, vertexBuf); - v0.x = _rect[1].x; - v1.x = _rect[1].x; - gfxContext.drawLine(lineWidth, vertexBuf); - v0.x = _rect[0].x; - v0.y = -_rect[2].y; - gfxContext.drawLine(lineWidth, vertexBuf); - - _setTextureCombiner(); -} - -void Debugger::_drawTriangleFrame() -{ - if (m_triSel == m_triangles.end()) - return; - - FrameBuffer * pBuffer = frameBufferList().findBuffer(m_triSel->frameBufferAddress); - if (pBuffer == nullptr) - return; - - DisplayWindow & wnd = dwnd(); - - const s32 hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2; - const s32 vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset(); - - const u32 areaWidth = wnd.getWidth() * 5 / 8; - const u32 areaHeight = wnd.getHeight() * 5 / 8; - - gfxContext.setViewport(hOffset, vOffset + wnd.getHeight() * 3 / 8, areaWidth, areaHeight); - - const Debugger::Vertex * vertices = m_triSel->vertices.data(); - //Draw lines for selected triangle - _setLineCombiner(); - const f32 lineWidth = 1.5f; - SPVertex vertexBuf[2]; - memset(vertexBuf, 0, sizeof(vertexBuf)); - SPVertex & v0 = vertexBuf[0]; - v0.x = m_triSel->getModelX(vertices[0]); - v0.y = -m_triSel->getModelY(vertices[0]); - v0.z = m_triSel->getModelZ(vertices[0]); - v0.w = vertices[0].w; - SPVertex & v1 = vertexBuf[1]; - v1.x = m_triSel->getModelX(vertices[1]); - v1.y = -m_triSel->getModelY(vertices[1]); - v1.z = m_triSel->getModelZ(vertices[1]); - v1.w = vertices[1].w; - gfxContext.drawLine(lineWidth, vertexBuf); - v0.x = m_triSel->getModelX(vertices[2]); - v0.y = -m_triSel->getModelY(vertices[2]); - v0.z = m_triSel->getModelZ(vertices[2]); - v0.w = vertices[2].w; - gfxContext.drawLine(lineWidth, vertexBuf); - v1.x = m_triSel->getModelX(vertices[0]); - v1.y = -m_triSel->getModelY(vertices[0]); - v1.z = m_triSel->getModelZ(vertices[0]); - v1.w = vertices[0].w; - gfxContext.drawLine(lineWidth, vertexBuf); - - _setTextureCombiner(); -} - -void Debugger::_drawTextureCache() -{ - DisplayWindow & wnd = dwnd(); - TextureCache & cache = textureCache(); - - const s32 hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2; - const s32 vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset(); - const u32 areaHeight = wnd.getHeight() * 3 / 8; - - gfxContext.setViewport(hOffset, vOffset, wnd.getWidth(), areaHeight); - - gfxContext.enable(enable::CULL_FACE, false); - gfxContext.enable(enable::BLEND, m_textureMode != TextureMode::texture); - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enableDepthWrite(false); - gfxContext.setDepthCompare(compare::ALWAYS); - gfxContext.enable(enable::SCISSOR_TEST, false); - _setTextureCombiner(); - - gSP.changed |= CHANGED_GEOMETRYMODE | CHANGED_VIEWPORT; - gDP.changed |= CHANGED_RENDERMODE | CHANGED_TILE | CHANGED_COMBINE; - - const f32 rectWidth = 2.0f / m_cacheViewerCols; - const f32 rectHeight = 2.0f / m_cacheViewerRows; - const f32 Z = 0.0f; - const f32 W = 1.0f; - - if (m_clickY >= (long)(wnd.getHeight() * 5 / 8)) { - long y = m_clickY - wnd.getHeight() * 5 / 8; - m_selectedTexPos[m_tmu].row = y * m_cacheViewerRows/ areaHeight; - m_selectedTexPos[m_tmu].col = m_clickX * m_cacheViewerCols/ wnd.getWidth(); - } - - f32 X = -1.0f; - f32 Y = 1.0f; - RectVertex rect[4]; - RectVertex rectSelected[4]; - struct Framer { - Framer(Debugger * _d, RectVertex * _r) : d(_d), r(_r) {} - ~Framer() { - d->_drawTextureFrame(r); - } - Debugger * d; - RectVertex * r; - } framer(this, rectSelected); - - TexInfos & texInfos = m_texturesToDisplay[m_tmu]; - if (texInfos.empty()) { - std::set displayedTextures; - for (auto& t : m_triangles) { - if (!t.tex_info[m_tmu]) - continue; - auto res = displayedTextures.insert(t.tex_info[m_tmu]->texture->name); - if(res.second) - texInfos.push_back(t.tex_info[m_tmu].get()); - } - } - - if (osal_is_key_pressed(KEY_Up, 0x0001)) { - if ((m_startTexRow[m_tmu] + 1) * m_cacheViewerCols < texInfos.size()) - m_startTexRow[m_tmu]++; - } - - if (osal_is_key_pressed(KEY_Down, 0x0001)) { - if (m_startTexRow[m_tmu] > 0) - --m_startTexRow[m_tmu]; - } - - if (osal_is_key_pressed(KEY_Space, 0x0001)) { - if (m_triSel->tex_info[m_tmu]) { - graphics::ObjectHandle tex = m_triSel->tex_info[m_tmu]->texture->name; - auto iter = std::find_if(texInfos.begin(), - texInfos.end(), - [tex](const TexInfos::value_type & val) { - return val->texture->name == tex; - }); - auto d = std::distance(texInfos.begin(), iter); - m_startTexRow[m_tmu] = static_cast(d) / m_cacheViewerCols; - m_clickY = 0; - m_selectedTexPos[m_tmu].row = 0; - m_selectedTexPos[m_tmu].col = d % m_cacheViewerCols; - } - } - - if (texInfos.empty()) - return; - auto infoIter = texInfos.begin(); - std::advance(infoIter, m_startTexRow[m_tmu] * m_cacheViewerCols); - - for (u32 r = 0; r < m_cacheViewerRows; ++r) { - - for (u32 c = 0; c < m_cacheViewerCols; ++c) { - rect[0].x = X; - rect[0].y = Y; - rect[0].z = Z; - rect[0].w = W; - rect[1].x = X + rectWidth; - rect[1].y = rect[0].y; - rect[1].z = Z; - rect[1].w = W; - rect[2].x = rect[0].x; - rect[2].y = Y - rectHeight; - rect[2].z = Z; - rect[2].w = W; - rect[3].x = rect[1].x; - rect[3].y = rect[2].y; - rect[3].z = Z; - rect[3].w = W; - - rect[0].s0 = 0; - rect[0].t0 = 0; - rect[1].s0 = (*infoIter)->texture->width; - rect[1].t0 = 0; - rect[2].s0 = 0; - rect[2].t0 = (*infoIter)->texture->height; - rect[3].s0 = rect[1].s0; - rect[3].t0 = rect[2].t0; - - if (r == m_selectedTexPos[m_tmu].row && c == m_selectedTexPos[m_tmu].col) { - memcpy(rectSelected, rect, sizeof(rect)); - m_pCurTexInfo = *infoIter; - } - Context::TexParameters texParams; - texParams.handle = (*infoIter)->texture->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[0]; - texParams.minFilter = textureParameters::FILTER_NEAREST; - texParams.magFilter = textureParameters::FILTER_NEAREST; - texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - gfxContext.setTextureParameters(texParams); - - cache.current[0] = const_cast((*infoIter)->texture); - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = rect; - rectParams.combiner = currentCombiner(); - currentCombiner()->update(false); - gfxContext.drawRects(rectParams); - - X += rectWidth; - ++infoIter; - if (infoIter == texInfos.end()) - return; - } - - X = -1.0f; - Y -= rectHeight; - } - - gfxContext.enable(enable::SCISSOR_TEST, true); -} - -void Debugger::_drawFrameBuffer(FrameBuffer * _pBuffer) -{ - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - CachedTexture * pBufferTexture = _pBuffer->m_pTexture; - ObjectHandle readBuffer = _pBuffer->m_FBO; - - if (pBufferTexture->frameBufferTexture == CachedTexture::fbMultiSample) { - _pBuffer->resolveMultisampledTexture(true); - readBuffer = _pBuffer->m_resolveFBO; - pBufferTexture = _pBuffer->m_pResolveTexture; - } - - s32 srcCoord[4] = { 0, 0, pBufferTexture->width, (s32)(_pBuffer->m_height * _pBuffer->m_scale) }; - const s32 hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2; - const s32 vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset() + wnd.getHeight()*3/8; - s32 dstCoord[4] = { hOffset, vOffset, hOffset + (s32)wnd.getWidth()*5/8, vOffset + (s32)wnd.getHeight()*5/8 }; - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - float clearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; - drawer.clearColorBuffer(clearColor); - - GraphicsDrawer::BlitOrCopyRectParams blitParams; - blitParams.srcX0 = srcCoord[0]; - blitParams.srcY0 = srcCoord[3]; - blitParams.srcX1 = srcCoord[2]; - blitParams.srcY1 = srcCoord[1]; - blitParams.srcWidth = pBufferTexture->width; - blitParams.srcHeight = pBufferTexture->height; - blitParams.dstX0 = dstCoord[0]; - blitParams.dstY0 = dstCoord[1]; - blitParams.dstX1 = dstCoord[2]; - blitParams.dstY1 = dstCoord[3]; - blitParams.dstWidth = wnd.getScreenWidth(); - blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset(); - const bool downscale = blitParams.srcWidth >= blitParams.dstWidth || blitParams.srcHeight >= blitParams.dstHeight; - blitParams.filter = downscale || config.generalEmulation.enableHybridFilter > 0 ? - textureParameters::FILTER_LINEAR : - textureParameters::FILTER_NEAREST; //upscale; hybridFilter disabled - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.tex[0] = pBufferTexture; - blitParams.combiner = downscale ? CombinerInfo::get().getTexrectDownscaleCopyProgram() : - CombinerInfo::get().getTexrectUpscaleCopyProgram(); - blitParams.readBuffer = readBuffer; - - drawer.blitOrCopyTexturedRect(blitParams); -} - -inline -void setTextColor(u32 _c) -{ - float color[4] = { _SHIFTR(_c, 24, 8) / 255.0f, _SHIFTR(_c, 16, 8) / 255.0f, - _SHIFTR(_c, 8, 8) / 255.0f, _SHIFTR(_c, 0, 8) / 255.0f }; - g_textDrawer.setTextColor(color); -} - -#define COL_CATEGORY() setTextColor(0xD288F4FF) -#define COL_CC() setTextColor(0x88C3F4FF) -#define COL_AC() setTextColor(0x3CEE5EFF) -#define COL_TEXT() setTextColor(0xFFFFFFFF) -#define COL_SEL(x) setTextColor((x)?0x00FF00FF:0x800000FF) - -#define DRAW_TEXT() g_textDrawer.drawText(buf, ulx, uly) - -#define OUTPUT1(fmt,other) sprintf(buf, fmt, other); ulx = _ulx; DRAW_TEXT(); uly -= _yShift - -#define OUTPUT0(txt) strncpy(buf, txt, sizeof(buf)); ulx = _ulx; DRAW_TEXT(); uly -= _yShift - -#define OUTPUT2(fmt, other1, other2) sprintf(buf, fmt, other1, other2); ulx = _ulx; DRAW_TEXT(); uly -= _yShift - -#define OUTPUT_COLOR(fmt, r, g, b, a) sprintf(buf, fmt, r, g, b, a); ulx = _ulx; DRAW_TEXT(); uly -= _yShift - -#define OUTPUT_(txt,cc) strncpy(buf, txt, sizeof(buf)); ulx = _ulx; COL_SEL(cc); DRAW_TEXT();\ - g_textDrawer.getTextSize(txt, tW, tH); ulx += tW - -#define _OUTPUT1(txt,cc) strncpy(buf, txt, sizeof(buf)); COL_SEL(cc); DRAW_TEXT();\ - g_textDrawer.getTextSize(txt, tW, tH); ulx += tW - -#define LINE_FEED() uly -= _yShift - - -static const char *tri_type[4] = { "TRIANGLE", "TEXRECT", "FILLRECT", "BACKGROUND" }; - -void Debugger::_drawGeneral(f32 _ulx, f32 _uly, f32 _yShift) -{ - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - COL_CATEGORY(); - OUTPUT0("GENERAL (page 1):"); - COL_TEXT(); - OUTPUT1("tri #%d", m_triSel->tri_n); - OUTPUT1("type: %s", tri_type[(u32)(m_triSel->type)]); - OUTPUT1("geom: 0x%08x", m_triSel->geometryMode); - OUTPUT1("othermode_h: 0x%08x", m_triSel->otherMode.h); - OUTPUT1("othermode_l: 0x%08x", m_triSel->otherMode.l); - LINE_FEED(); - COL_CATEGORY(); - OUTPUT0("COMBINE:"); - COL_TEXT(); - OUTPUT1("cycle_mode: %s", CycleTypeText[m_triSel->cycle_type]); - OUTPUT1("muxs0: 0x%08x", m_triSel->combine.muxs0); - OUTPUT1("muxs1: 0x%08x", m_triSel->combine.muxs1); - COL_CC(); - OUTPUT1("a0: %s", saRGBText[m_triSel->combine.saRGB0]); - OUTPUT1("b0: %s", sbRGBText[m_triSel->combine.sbRGB0]); - OUTPUT1("c0: %s", mRGBText[m_triSel->combine.mRGB0]); - OUTPUT1("d0: %s", aRGBText[m_triSel->combine.aRGB0]); - COL_AC(); - OUTPUT1("Aa0: %s", saAText[m_triSel->combine.saA0]); - OUTPUT1("Ab0: %s", sbAText[m_triSel->combine.sbA0]); - OUTPUT1("Ac0: %s", mAText[m_triSel->combine.mA0]); - OUTPUT1("Ad0: %s", aAText[m_triSel->combine.aA0]); - COL_CC(); - OUTPUT1("a1: %s", saRGBText[m_triSel->combine.saRGB1]); - OUTPUT1("b1: %s", sbRGBText[m_triSel->combine.sbRGB1]); - OUTPUT1("c1: %s", mRGBText[m_triSel->combine.mRGB1]); - OUTPUT1("d1: %s", aRGBText[m_triSel->combine.aRGB1]); - COL_AC(); - OUTPUT1("Aa1: %s", saAText[m_triSel->combine.saA1]); - OUTPUT1("Ab1: %s", sbAText[m_triSel->combine.sbA1]); - OUTPUT1("Ac1: %s", mAText[m_triSel->combine.mA1]); - OUTPUT1("Ad1: %s", aAText[m_triSel->combine.aA1]); -} - -void Debugger::_drawTex(f32 _ulx, f32 _uly, f32 _yShift) -{ - static const char *str_cm[] = { "WRAP/NO CLAMP", "MIRROR/NO CLAMP", "WRAP/CLAMP", "MIRROR/CLAMP" }; - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - const u32 tex = m_curPage == Page::tex1 ? 0 : 1; - COL_CATEGORY(); - OUTPUT2("TEXTURE %d (page %d):", tex, tex + 2); - COL_TEXT(); - if (!m_triSel->tex_info[tex]) { - OUTPUT0("NOT USED"); - return; - } - const CachedTexture * texture = m_triSel->tex_info[tex]->texture; - const gDPLoadTileInfo & texLoadInfo = m_triSel->tex_info[tex]->texLoadInfo; - OUTPUT1("CRC: 0x%llx", texture->crc); - OUTPUT1("tex_size: %s", ImageSizeText[texture->size]); - OUTPUT1("tex_format: %s", ImageFormatText[texture->format]); - OUTPUT1("width: %d", texture->width); - OUTPUT1("height: %d", texture->height); - OUTPUT1("palette: %d", texture->palette); - OUTPUT1("clamp_s: %d", texture->clampS); - OUTPUT1("clamp_t: %d", texture->clampT); - OUTPUT1("mirror_s: %d", texture->mirrorS); - OUTPUT1("mirror_t: %d", texture->mirrorT); - OUTPUT1("mask_s: %d", texture->maskS); - OUTPUT1("mask_t: %d", texture->maskT); - OUTPUT1("offset_s: %.2f", texture->offsetS); - OUTPUT1("offset_t: %.2f", texture->offsetT); - OUTPUT1("ul_s: %d", texLoadInfo.uls); - OUTPUT1("ul_t: %d", texLoadInfo.ult); - OUTPUT1("lr_s: %d", texLoadInfo.lrs); - OUTPUT1("lr_t: %d", texLoadInfo.lrt); - OUTPUT1("scale_s: %f", texture->scaleS); - OUTPUT1("scale_t: %f", texture->scaleT); - OUTPUT1("s_mode: %s", str_cm[((texture->clampS << 1) | texture->mirrorS) & 3]); - OUTPUT1("t_mode: %s", str_cm[((texture->clampT << 1) | texture->mirrorT) & 3]); -} - -void Debugger::_drawColors(f32 _ulx, f32 _uly, f32 _yShift) -{ - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - COL_CATEGORY(); - OUTPUT0("COLORS (page 4)"); - COL_TEXT(); - const gDPInfo::PrimColor & prim = m_triSel->prim_color; - OUTPUT_COLOR("prim: r %.2f g %.2f b %.2f a %.2f", prim.r, prim.g, prim.b, prim.a); - const gDPInfo::Color & env = m_triSel->env_color; - OUTPUT_COLOR("env: r %.2f g %.2f b %.2f a %.2f", env.r, env.g, env.b, env.a); - const gDPInfo::Color & fog = m_triSel->fog_color; - OUTPUT_COLOR("fog: r %.2f g %.2f b %.2f a %.2f", fog.r, fog.g, fog.b, fog.a); - const gDPInfo::Color & blend = m_triSel->blend_color; - OUTPUT_COLOR("blend: r %.2f g %.2f b %.2f a %.2f", blend.r, blend.g, blend.b, blend.a); - OUTPUT1("K4: %02x", m_triSel->K4); - OUTPUT1("K5: %02x", m_triSel->K5); - OUTPUT1("prim_lodmin: %.2f", prim.m); - OUTPUT1("prim_lodfrac: %.2f", prim.l); - const gDPInfo::FillColor & fill = m_triSel->fill_color; - OUTPUT1("fill: %08x", fill.color); - OUTPUT1("prim_z: %.2f", m_triSel->primDepthZ); - OUTPUT1("prim_dz: %.2f", m_triSel->primDepthDeltaZ); -} - -void Debugger::_drawBlender(f32 _ulx, f32 _uly, f32 _yShift) -{ - static const char *FBLa[] = { "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" }; - static const char *FBLb[] = { "G_BL_A_IN", "G_BL_A_FOG", "G_BL_A_SHADE", "G_BL_0" }; - static const char *FBLc[] = { "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" }; - static const char *FBLd[] = { "G_BL_1MA", "G_BL_A_MEM", "G_BL_1", "G_BL_0" }; - - const gDPInfo::OtherMode & om = m_triSel->otherMode; - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - COL_CATEGORY(); - OUTPUT0("BLENDER (page 5)"); - COL_TEXT(); - OUTPUT1("cycle_mode: %s", CycleTypeText[m_triSel->cycle_type]); - LINE_FEED(); - OUTPUT1("fbl_a0: %s", FBLa[om.c1_m1a]); - OUTPUT1("fbl_b0: %s", FBLb[om.c1_m1b]); - OUTPUT1("fbl_c0: %s", FBLc[om.c1_m2a]); - OUTPUT1("fbl_d0: %s", FBLd[om.c1_m2b]); - OUTPUT1("fbl_a1: %s", FBLa[om.c2_m1a]); - OUTPUT1("fbl_b1: %s", FBLb[om.c2_m1b]); - OUTPUT1("fbl_c1: %s", FBLc[om.c2_m2a]); - OUTPUT1("fbl_d1: %s", FBLd[om.c2_m2b]); - LINE_FEED(); - OUTPUT1("fbl: %08x", om.l & 0xFFFF0000); - OUTPUT1("fbl #1: %08x", om.l & 0xCCCC0000); - OUTPUT1("fbl #2: %08x", om.l & 0x33330000); -} - -void Debugger::_drawOthermodeL(f32 _ulx, f32 _uly, f32 _yShift) -{ - const u32 othermode_l = m_triSel->otherMode.l; - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - float tW, tH; - - COL_CATEGORY(); - OUTPUT1("OTHERMODE_L: %08x (page 6)", othermode_l); - OUTPUT_("AC_NONE ", (othermode_l & 3) == 0); - _OUTPUT1("AC_THRESHOLD ", (othermode_l & 3) == 1); - _OUTPUT1("AC_DITHER", (othermode_l & 3) == 3); - LINE_FEED(); - OUTPUT_("ZS_PIXEL ", !(othermode_l & 4)); - _OUTPUT1("ZS_PRIM", (othermode_l & 4)); - LINE_FEED(); - LINE_FEED(); - COL_CATEGORY(); - OUTPUT1("RENDERMODE: %08x", othermode_l); - OUTPUT_("AA_EN", othermode_l & 0x08); - LINE_FEED(); - OUTPUT_("Z_CMP", othermode_l & 0x10); - LINE_FEED(); - OUTPUT_("Z_UPD", othermode_l & 0x20); - LINE_FEED(); - OUTPUT_("IM_RD", othermode_l & 0x40); - LINE_FEED(); - OUTPUT_("CLR_ON_CVG", othermode_l & 0x80); - LINE_FEED(); - OUTPUT_("CVG_DST_CLAMP ", (othermode_l & 0x300) == 0x000); - _OUTPUT1(".._WRAP ", (othermode_l & 0x300) == 0x100); - _OUTPUT1(".._FULL ", (othermode_l & 0x300) == 0x200); - _OUTPUT1(".._SAVE", (othermode_l & 0x300) == 0x300); - LINE_FEED(); - OUTPUT_("ZM_OPA ", (othermode_l & 0xC00) == 0x000); - _OUTPUT1("ZM_INTER ", (othermode_l & 0xC00) == 0x400); - _OUTPUT1("ZM_XLU ", (othermode_l & 0xC00) == 0x800); - _OUTPUT1("ZM_DEC ", (othermode_l & 0xC00) == 0xC00); - LINE_FEED(); - OUTPUT_("CVG_X_ALPHA", othermode_l & 0x1000); - LINE_FEED(); - OUTPUT_("ALPHA_CVG_SEL", othermode_l & 0x2000); - LINE_FEED(); - OUTPUT_("FORCE_BL", othermode_l & 0x4000); -} - -void Debugger::_drawOthermodeH(f32 _ulx, f32 _uly, f32 _yShift) -{ - const u32 othermode_h = m_triSel->otherMode.h; - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - float tW, tH; - - COL_CATEGORY(); - OUTPUT1("OTHERMODE_H: %08x (page 7)", othermode_h); - OUTPUT_("CK_NONE", (othermode_h & 0x100) == 0); - _OUTPUT1("CK_KEY", (othermode_h & 0x100) == 1); - LINE_FEED(); - OUTPUT_("TC_CONV", (othermode_h & 0xE00) == 0x200); - _OUTPUT1("TC_FILTCONV", (othermode_h & 0xE00) == 0xA00); - _OUTPUT1("TC_FILT", (othermode_h & 0xE00) == 0xC00); - LINE_FEED(); - OUTPUT_("TF_POINT", (othermode_h & 0x3000) == 0x0000); - _OUTPUT1("TF_AVERAGE", (othermode_h & 0x3000) == 0x3000); - _OUTPUT1("TF_BILERP", (othermode_h & 0x3000) == 0x2000); - LINE_FEED(); - OUTPUT_("TT_NONE", (othermode_h & 0xC000) == 0x0000); - _OUTPUT1("TT_RGBA16", (othermode_h & 0xC000) == 0x8000); - _OUTPUT1("TT_IA16", (othermode_h & 0xC000) == 0xC000); - LINE_FEED(); - OUTPUT_("TL_TILE", (othermode_h & 0x10000) == 0x00000); - _OUTPUT1("TL_LOD", (othermode_h & 0x10000) == 0x10000); - LINE_FEED(); - OUTPUT_("TD_CLAMP", (othermode_h & 0x60000) == 0x00000); - _OUTPUT1("TD_SHARPEN", (othermode_h & 0x60000) == 0x20000); - _OUTPUT1("TD_DETAIL", (othermode_h & 0x60000) == 0x40000); - LINE_FEED(); - OUTPUT_("TP_NONE", (othermode_h & 0x80000) == 0x00000); - _OUTPUT1("TP_PERSP", (othermode_h & 0x80000) == 0x80000); - LINE_FEED(); - OUTPUT_("1CYCLE", (othermode_h & 0x300000) == 0x000000); - _OUTPUT1("2CYCLE", (othermode_h & 0x300000) == 0x100000); - _OUTPUT1("COPY", (othermode_h & 0x300000) == 0x200000); - _OUTPUT1("FILL", (othermode_h & 0x300000) == 0x300000); - LINE_FEED(); - OUTPUT_("PM_1PRIM", (othermode_h & 0x400000) == 0x000000); - _OUTPUT1("PM_NPRIM", (othermode_h & 0x400000) == 0x400000); -} - -void Debugger::_drawTexCoords(f32 _ulx, f32 _uly, f32 _yShift) -{ - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - COL_CATEGORY(); - OUTPUT0("TEXCOORDS (page 8)"); - COL_TEXT(); - OUTPUT1("type: %s", tri_type[(u32)(m_triSel->type)]); - if (m_triSel->type == ttFillrect) - return; - - LINE_FEED(); - - if (m_triSel->type == ttTriangle) { - for (u32 j = 0; j < m_triSel->vertices.size(); ++j) { - OUTPUT2("v[%d].s: %f", j, m_triSel->vertices[j].s0); - OUTPUT2("v[%d].t: %f", j, m_triSel->vertices[j].t0); - } - return; - } - - for (u32 j = 0; j < m_triSel->vertices.size(); ++j) { - OUTPUT2("v[%d].s0: %f", j, m_triSel->vertices[j].s0); - OUTPUT2("v[%d].t0: %f", j, m_triSel->vertices[j].t0); - OUTPUT2("v[%d].s1: %f", j, m_triSel->vertices[j].s1); - OUTPUT2("v[%d].t1: %f", j, m_triSel->vertices[j].t1); - } - -} - -void Debugger::_drawVertexCoords(f32 _ulx, f32 _uly, f32 _yShift) -{ - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - COL_CATEGORY(); - OUTPUT0("VERTEX (page 9)"); - COL_TEXT(); - OUTPUT1("type: %s", tri_type[(u32)(m_triSel->type)]); - LINE_FEED(); - - if (m_triSel->type == ttTriangle) { - for (u32 j = 0; j < m_triSel->vertices.size(); ++j) { - const Vertex & v = m_triSel->vertices[j]; - if (RSP.LLE) { - OUTPUT2("v[%d].x: %f", j, v.x); - OUTPUT2("v[%d].y: %f", j, v.y); - OUTPUT2("v[%d].z: %f", j, v.z); - } - else { - OUTPUT2("v[%d].x: %f", j, m_triSel->getScreenX(v)); - OUTPUT2("v[%d].y: %f", j, m_triSel->getScreenY(v)); - OUTPUT2("v[%d].z: %f", j, m_triSel->getScreenZ(v)); - } - OUTPUT2("v[%d].w: %f", j, v.w); - OUTPUT2("v[%d].r: %.2f", j, v.r); - OUTPUT2("v[%d].g: %.2f", j, v.g); - OUTPUT2("v[%d].b: %.2f", j, v.b); - if (RSP.LLE) { - OUTPUT2("v[%d].a: %.2f", j, v.a); - } - else { - if ((m_triSel->geometryMode & G_FOG) == 0) { - OUTPUT2("v[%d].a: %.2f", j, v.a); - } - else { - f32 f = v.z / v.w * m_triSel->fogMultiplier + m_triSel->fogOffset; - if (f < 0.0f) - f = 0.0f; - if (f > 1.0f) - f = 1.0f; - OUTPUT2("v[%d].a: %.2f", j, f); - } - } - - } - return; - } - - for (u32 j = 0; j < m_triSel->vertices.size(); ++j) { - const Vertex & v = m_triSel->vertices[j]; - OUTPUT2("v[%d].x: %f", j, v.x); - OUTPUT2("v[%d].y: %f", j, v.y); - OUTPUT2("v[%d].z: %f", j, v.z); - } -} - -void Debugger::_drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift) -{ - static const char *LoadType[] = { "LOADTYPE_BLOCK", "LOADTYPE_TILE" }; - static const char *FrameBufferType[] = { "NONE", "ONE_SAMPLE", "MULTI_SAMPLE" }; - char buf[256]; - f32 ulx = _ulx; - f32 uly = _uly; - - COL_CATEGORY(); - OUTPUT0("TEXTURE (page 0)"); - if (m_pCurTexInfo == nullptr) - return; - const CachedTexture * pTexture = m_pCurTexInfo->texture; - textureCache().current[0] = const_cast(pTexture); - const gDPLoadTileInfo & texLoadInfo = m_pCurTexInfo->texLoadInfo; - - COL_TEXT(); - OUTPUT1("addr: %08x", texLoadInfo.texAddress); - OUTPUT1("scale_s: %f", m_pCurTexInfo->scales); - OUTPUT1("scale_t: %f", m_pCurTexInfo->scalet); - OUTPUT1("load: %s", LoadType[texLoadInfo.loadType&1]); - OUTPUT1("t_mem: %04x", pTexture->tMem); - OUTPUT1("framebuffer: %s", FrameBufferType[(u32)pTexture->frameBufferTexture]); - OUTPUT1("crc: %llx", pTexture->crc); - // OUTPUT1("texrecting: %d", cache[_debugger.tex_sel].texrecting); - OUTPUT1("tex_size: %s", ImageSizeText[pTexture->size]); - OUTPUT1("tex_format: %s", ImageFormatText[pTexture->format]); - OUTPUT1("width: %d", pTexture->width); - OUTPUT1("height: %d", pTexture->height); - OUTPUT1("palette: %d", pTexture->palette); - OUTPUT1("line: %d", pTexture->line); - OUTPUT1("lod: %d", pTexture->max_level); - - const f32 Z = 0.0f; - const f32 W = 1.0f; - - DisplayWindow & wnd = dwnd(); - const u32 winWidth = wnd.getWidth(); - const u32 winHeight = wnd.getHeight(); - f32 winAspect = f32(winWidth) / f32(winHeight); - - f32 width = fabsf(_lrx - ulx); - f32 height = fabsf(_lry - uly); - - if (width > height) { - f32 scale = height / width; - f32 diff = 0.5f * width * (1.0f - scale); - ulx += diff; - _lrx -= diff; - width = fabsf(_lrx - ulx); - } else { - f32 scale = width / height; - f32 diff = 0.5f * height * (1.0f - scale); - uly += diff; - _lry -= diff; - height = fabsf(_lry - uly); - } - - if (pTexture->width <= pTexture->height) { - f32 tex_aspect = f32(pTexture->width) / f32(pTexture->height); - f32 scale = tex_aspect / winAspect; - f32 diff = 0.5f * width * (1.0f - scale); - ulx += diff; - _lrx -= diff; - } else { - f32 tex_aspect = f32(pTexture->height) / f32(pTexture->width); - f32 scale = tex_aspect / winAspect; - f32 diff = 0.5f * height * (1.0f - scale); - uly -= diff; - _lry += diff; - } - - RectVertex rect[4]; - rect[0].x = ulx; - rect[0].y = -uly; - rect[0].z = Z; - rect[0].w = W; - rect[1].x = _lrx; - rect[1].y = rect[0].y; - rect[1].z = Z; - rect[1].w = W; - rect[2].x = rect[0].x; - rect[2].y = -_lry; - rect[2].z = Z; - rect[2].w = W; - rect[3].x = rect[1].x; - rect[3].y = rect[2].y; - rect[3].z = Z; - rect[3].w = W; - - f32 s0 = 0, t0 = 0, s1 = f32(pTexture->width), t1 = f32(pTexture->height); - - rect[0].s0 = s0; - rect[0].t0 = t1; - rect[1].s0 = s1; - rect[1].t0 = t1; - rect[2].s0 = s0; - rect[2].t0 = t0; - rect[3].s0 = s1; - rect[3].t0 = t0; - - _setTextureCombiner(); - Context::TexParameters texParams; - texParams.handle = m_pCurTexInfo->texture->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[0]; - texParams.minFilter = textureParameters::FILTER_NEAREST; - texParams.magFilter = textureParameters::FILTER_NEAREST; - texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - - gfxContext.setTextureParameters(texParams); - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = rect; - rectParams.combiner = currentCombiner(); - gfxContext.drawRects(rectParams); -} - -void Debugger::_drawMouseCursor() -{ - long x, y; - if (!getCursorPos(x, y)) - return; - - DisplayWindow & wnd = dwnd(); - const u32 winWidth = wnd.getWidth(); - const u32 winHeight = wnd.getHeight(); - - if (x < 0 || x > (long)winWidth || y < 0 || y > (long)winHeight) - return; - - const f32 scaleX = 1.0f / winWidth; - const f32 scaleY = 1.0f / winHeight; - - SPVertex vertices[3]; - memset(vertices, 0,sizeof (vertices)); - - SPVertex & v0 = vertices[0]; - v0.x = (f32)x * (2.0f * scaleX) - 1.0f; - v0.y = (f32)y * (2.0f * scaleY) - 1.0f; - v0.z = 0.0f; - v0.w = 1.0f; - SPVertex & v1 = vertices[1]; - v1 = v0; - v1.y = (f32)(y + 10) * (2.0f * scaleY) - 1.0f; - SPVertex & v2 = vertices[2]; - v2 = v1; - v2.x = (f32)(x + 6) * (2.0f * scaleX) - 1.0f; - - const s32 hOffset = (wnd.getScreenWidth() - winWidth) / 2; - const s32 vOffset = (wnd.getScreenHeight() - winHeight) / 2 + wnd.getHeightOffset(); - gfxContext.setViewport(hOffset, - vOffset, - winWidth, winHeight); - - _setLineCombiner(); - Context::DrawTriangleParameters triParams; - triParams.mode = drawmode::TRIANGLES; - triParams.verticesCount = 3; - triParams.vertices = vertices; - triParams.combiner = currentCombiner(); - gfxContext.drawTriangles(triParams); -} - -void Debugger::_findSelected() -{ - if (!getCursorPos(m_clickX, m_clickY)) - return; - - const long x = m_clickX; - const long y = m_clickY; - DisplayWindow & wnd = dwnd(); - const long winWidth = (long)wnd.getWidth(); - const long winHeight = (long)wnd.getHeight(); - - if (x < 0 || x > winWidth || y < 0 || y > winHeight) - return; - - if (x < winWidth * 5 / 8 && y < winHeight * 5 / 8) { - for (auto iter = std::next(m_triSel); iter != m_triangles.end(); ++iter) { - if (iter->isInside(x, y)) { - m_triSel = iter; - return; - } - } - - for (auto iter = m_triangles.begin(); iter != m_triSel; ++iter) { - if (iter->isInside(x, y)) { - m_triSel = iter; - return; - } - } - } -} - -void Debugger::_drawDebugInfo() -{ - DisplayWindow & wnd = dwnd(); - m_triSel = m_triangles.begin(); - m_clickX = m_clickY = 0; - m_tmu = 0; - m_startTexRow[0] = m_startTexRow[1] = 0; - m_texturesToDisplay[0].clear(); - m_texturesToDisplay[1].clear(); - memset(m_selectedTexPos, 0, sizeof(m_selectedTexPos)); - - for (auto& i : m_triangles) { - if (i.frameBufferAddress != gDP.depthImageAddress) - m_fbAddrs.insert(i.frameBufferAddress); - } - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer == nullptr) - return; - m_curFBAddr = m_fbAddrs.find(pBuffer->m_startAddress); - if (m_curFBAddr == m_fbAddrs.end()) { - for (m_curFBAddr = m_fbAddrs.begin(); m_curFBAddr != m_fbAddrs.end(); ++m_curFBAddr) { - pBuffer = frameBufferList().findBuffer(*m_curFBAddr); - if (pBuffer != nullptr && pBuffer->m_isMainBuffer && !pBuffer->m_isDepthBuffer) - break; - } - } - if (m_curFBAddr == m_fbAddrs.end()) - return; - - const u32 winWidth = wnd.getWidth(); - const u32 winHeight = wnd.getHeight(); - const s32 hOffset = (wnd.getScreenWidth() - winWidth) / 2; - const s32 vOffset = (wnd.getScreenHeight() - winHeight) / 2 + wnd.getHeightOffset(); - const s32 areaWidth = winWidth * 3 / 8; - - float tW, tH; - g_textDrawer.getTextSize("W_0'", tW, tH); - const f32 yShift = tH * 1.6f; - - const f32 scaleX = 1.0f / winWidth; - const f32 scaleY = 1.0f / winHeight; - const f32 ulx = (f32)(winWidth - areaWidth) * (2.0f * scaleX) - 1.0f; - const f32 uly = 1.0f - yShift; - const f32 lrx = (f32)(winWidth) * (2.0f * scaleX) - 1.0f; - const f32 lry = -((f32)(winHeight * 5 / 8)* (2.0f * scaleY) - 1.0f); - - while (!osal_is_key_pressed(KEY_Insert, 0x0001)) { - osal_keys_update_state(); - _debugKeys(); - _drawFrameBuffer(frameBufferList().findBuffer(*m_curFBAddr)); - _drawTextureCache(); - - if (osal_is_key_pressed(MB_Left, 0x0001)) - _findSelected(); - _drawTriangleFrame(); - _drawMouseCursor(); - - gfxContext.setViewport(hOffset, - vOffset, - winWidth, winHeight); - - switch (m_curPage) { - case Page::general: - _drawGeneral(ulx, uly, yShift); - break; - case Page::tex1: - case Page::tex2: - _drawTex(ulx, uly, yShift); - break; - case Page::colors: - _drawColors(ulx, uly, yShift); - break; - case Page::blender: - _drawBlender(ulx, uly, yShift); - break; - case Page::othermode_l: - _drawOthermodeL(ulx, uly, yShift); - break; - case Page::othermode_h: - _drawOthermodeH(ulx, uly, yShift); - break; - case Page::texcoords: - _drawTexCoords(ulx, uly, yShift); - break; - case Page::coords: - _drawVertexCoords(ulx, uly, yShift); - break; - case Page::texinfo: - _drawTexture(ulx, uly, lrx, lry, yShift); - break; - } - - wnd.swapBuffers(); - } - - m_triangles.clear(); - m_triSel = m_triangles.end(); - g_textDrawer.setTextColor(config.font.colorf); - m_bCapture = false; -} - -void Debugger::draw() -{ - if (m_triangles.empty()) { - _drawFrameBuffer(frameBufferList().getCurrent()); - dwnd().swapBuffers(); - } else { - _drawDebugInfo(); - } - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - FrameBuffer *pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr) - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, pBuffer->m_FBO); - gDP.changed |= CHANGED_SCISSOR; -} - -#else // DEBUG_DUMP - -Debugger::Debugger() : m_bDebugMode(false) {} -Debugger::~Debugger() {} -void Debugger::checkDebugState() {} -void Debugger::addTriangles(const graphics::Context::DrawTriangleParameters &) {} -void Debugger::addRects(const graphics::Context::DrawRectParameters &) {} -void Debugger::draw() {} - -#endif // DEBUG_DUMP diff --git a/GLideN64/src/Debugger.h b/GLideN64/src/Debugger.h deleted file mode 100644 index 834e0ec..0000000 --- a/GLideN64/src/Debugger.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef DEBUGGER_H - -#include -#include -#include -#include -#include -#include "Graphics/Context.h" -#include "Graphics/Parameters.h" -#include "gSP.h" -#include "gDP.h" -#include "Textures.h" - -enum TriangleType { - ttTriangle, - ttTexrect, - ttFillrect, - ttBackground -}; - -class Debugger -{ -public: - Debugger(); - ~Debugger(); - - void checkDebugState(); - - void addTriangles(const graphics::Context::DrawTriangleParameters & _params); - - void addRects(const graphics::Context::DrawRectParameters & _params); - - bool isDebugMode() const { return m_bDebugMode; } - bool isCaptureMode() const { return m_bCapture; } - - void draw(); - -private: - struct TexInfo { - f32 scales, scalet; - const CachedTexture * texture; - gDPLoadTileInfo texLoadInfo; - }; - - struct Vertex { - f32 x, y, z, w; - f32 r, g, b, a; - f32 s0, t0, s1, t1; - u32 modify; - - Vertex() = default; - - Vertex(const SPVertex & _v) - : x(_v.x) - , y(_v.y) - , z(_v.z) - , w(_v.w) - , r(_v.r) - , g(_v.g) - , b(_v.b) - , a(_v.a) - , s0(_v.s) - , t0(_v.t) - , s1(_v.s) - , t1(_v.t) - , modify(_v.modify) - {} - - Vertex(const RectVertex & _v) - : x(_v.x) - , y(_v.y) - , z(_v.z) - , w(_v.w) - , s0(_v.s0) - , t0(_v.t0) - , s1(_v.s1) - , t1(_v.t1) - , modify(MODIFY_XY | MODIFY_Z) - { - r = g = b = a = 0.0f; - } - }; - - struct TriInfo { - std::array vertices; - gDPCombine combine; // Combine mode at the time of rendering - u32 cycle_type; - gDPInfo::OtherMode otherMode; - u32 geometryMode; // geometry mode flags - u32 frameBufferAddress; - u32 tri_n; // Triangle number - - TriangleType type; // 0-normal, 1-texrect, 2-fillrect - - gSPInfo::Viewport viewport; - - // texture info - std::array, 2> tex_info; - - // colors - gDPInfo::Color fog_color; - gDPInfo::Color blend_color; - gDPInfo::Color env_color; - gDPInfo::FillColor fill_color; - gDPInfo::PrimColor prim_color; - f32 primDepthZ, primDepthDeltaZ; - f32 fogMultiplier, fogOffset; - s32 K4, K5; - - f32 getScreenX(const Vertex & _v) const; - f32 getScreenY(const Vertex & _v) const; - f32 getScreenZ(const Vertex & _v) const; - f32 getModelX(const Vertex & _v) const; - f32 getModelY(const Vertex & _v) const; - f32 getModelZ(const Vertex & _v) const; - - bool isInside(long x, long y) const; - }; - - enum class Page { - general, - tex1, - tex2, - colors, - blender, - othermode_l, - othermode_h, - texcoords, - coords, - texinfo - }; - - enum class TextureMode { - texture, - alpha, - both - }; - - void _fillTriInfo(TriInfo & _info); - void _addTriangles(const graphics::Context::DrawTriangleParameters & _params); - void _addTrianglesByElements(const graphics::Context::DrawTriangleParameters & _params); - void _debugKeys(); - void _drawFrameBuffer(FrameBuffer * _pBuffer); - void _drawDebugInfo(); - void _setTextureCombiner(); - void _setLineCombiner(); - void _drawTextureFrame(const RectVertex * _rect); - void _drawTextureCache(); - - void _drawGeneral(f32 _ulx, f32 _uly, f32 _yShift); - void _drawTex(f32 _ulx, f32 _uly, f32 _yShift); - void _drawColors(f32 _ulx, f32 _uly, f32 _yShift); - void _drawBlender(f32 _ulx, f32 _uly, f32 _yShift); - void _drawOthermodeL(f32 _ulx, f32 _uly, f32 _yShift); - void _drawOthermodeH(f32 _ulx, f32 _uly, f32 _yShift); - void _drawTexCoords(f32 _ulx, f32 _uly, f32 _yShift); - void _drawVertexCoords(f32 _ulx, f32 _uly, f32 _yShift); - void _drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift); - void _drawTriangleFrame(); - void _drawMouseCursor(); - void _findSelected(); - - typedef std::list Triangles; - typedef std::list TexInfos; - typedef std::set FrameBufferAddrs; - - Triangles m_triangles; - Triangles::const_iterator m_triSel; - const TexInfo * m_pCurTexInfo = nullptr; - TextureMode m_textureMode = TextureMode::both; - - FrameBufferAddrs m_fbAddrs; - FrameBufferAddrs::const_iterator m_curFBAddr; - - Page m_curPage = Page::general; - bool m_bDebugMode = false; - bool m_bCapture = false; - - long m_clickX = 0; - long m_clickY = 0; - - u32 m_tmu = 0; - u32 m_startTexRow[2]; - TexInfos m_texturesToDisplay[2]; - struct { - u32 row, col; - } m_selectedTexPos[2]; - - const u32 m_cacheViewerRows = 4; - const u32 m_cacheViewerCols = 16; -}; - -extern Debugger g_debugger; - -#endif // DEBUGGER_H diff --git a/GLideN64/src/DepthBuffer.cpp b/GLideN64/src/DepthBuffer.cpp deleted file mode 100644 index 0a16c37..0000000 --- a/GLideN64/src/DepthBuffer.cpp +++ /dev/null @@ -1,530 +0,0 @@ -#if defined(OS_MAC_OS_X) || defined(OS_IOS) -#include -#else -#include -#endif -#include -#include "Combiner.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "VI.h" -#include "Config.h" -#include "DebugDump.h" -#include -#include -#include "DisplayWindow.h" - -using namespace graphics; - -DepthBuffer::DepthBuffer() -{ - m_copyFBO = gfxContext.createFramebuffer(); -} - -DepthBuffer::~DepthBuffer() -{ - gfxContext.deleteFramebuffer(m_depthRenderbuffer); - gfxContext.deleteFramebuffer(m_copyFBO); - gfxContext.deleteFramebuffer(m_ZTextureClearFBO); - gfxContext.deleteFramebuffer(m_DeltaZTextureClearFBO); - - textureCache().removeFrameBufferTexture(m_pDepthImageZTexture); - textureCache().removeFrameBufferTexture(m_pDepthImageDeltaZTexture); - textureCache().removeFrameBufferTexture(m_pDepthBufferTexture); - textureCache().removeFrameBufferTexture(m_pResolveDepthBufferTexture); - textureCache().removeFrameBufferTexture(m_pDepthBufferCopyTexture); -} - -void DepthBuffer::_initDepthImageTexture(FrameBuffer * _pBuffer, CachedTexture& _cachedTexture, graphics::ObjectHandle & _clearFBO) -{ - const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats(); - - _cachedTexture.width = _pBuffer->m_pTexture->width; - _cachedTexture.height = _pBuffer->m_pTexture->height; - _cachedTexture.format = 0; - _cachedTexture.size = 2; - _cachedTexture.clampS = 1; - _cachedTexture.clampT = 1; - _cachedTexture.address = _pBuffer->m_startAddress; - _cachedTexture.clampWidth = static_cast(_pBuffer->m_width); - _cachedTexture.clampHeight = static_cast(_pBuffer->m_height); - _cachedTexture.frameBufferTexture = CachedTexture::fbOneSample; - _cachedTexture.maskS = 0; - _cachedTexture.maskT = 0; - _cachedTexture.mirrorS = 0; - _cachedTexture.mirrorT = 0; - _cachedTexture.textureBytes = _cachedTexture.width * _cachedTexture.height * fbTexFormat.depthImageFormatBytes; - - { - Context::InitTextureParams params; - params.handle = _cachedTexture.name; - params.width = _cachedTexture.width; - params.height = _cachedTexture.height; - params.internalFormat = fbTexFormat.depthImageInternalFormat; - params.format = fbTexFormat.depthImageFormat; - params.dataType = fbTexFormat.depthImageType; - gfxContext.init2DTexture(params); - } - { - Context::TexParameters params; - params.handle = _cachedTexture.name; - params.target = textureTarget::TEXTURE_2D; - params.textureUnitIndex = textureIndices::Tex[0]; - params.minFilter = textureParameters::FILTER_NEAREST; - params.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(params); - } - { - Context::FrameBufferRenderTarget targetParams; - targetParams.bufferHandle = _clearFBO; - targetParams.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - targetParams.attachment = bufferAttachment::COLOR_ATTACHMENT0; - targetParams.textureHandle = _cachedTexture.name; - targetParams.textureTarget = textureTarget::TEXTURE_2D; - gfxContext.addFrameBufferRenderTarget(targetParams); - } -} - -void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer) -{ - if (config.frameBufferEmulation.N64DepthCompare == Config::dcDisable || m_pDepthImageZTexture != nullptr) - return; - - m_pDepthImageZTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_ZTextureClearFBO = gfxContext.createFramebuffer(); - m_pDepthImageDeltaZTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_DeltaZTextureClearFBO = gfxContext.createFramebuffer(); - - _initDepthImageTexture(_pBuffer, *m_pDepthImageZTexture, m_ZTextureClearFBO); - _initDepthImageTexture(_pBuffer, *m_pDepthImageDeltaZTexture, m_DeltaZTextureClearFBO); - - depthBufferList().clearBuffer(); -} - -void DepthBuffer::_initDepthBufferTexture(const FrameBuffer * _pBuffer, CachedTexture * _pTexture, bool _multisample) -{ - const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats(); - - if (_pBuffer != nullptr) { - _pTexture->width = _pBuffer->m_pTexture->width; - _pTexture->height = _pBuffer->m_pTexture->height; - _pTexture->address = _pBuffer->m_startAddress; - _pTexture->clampWidth = static_cast(_pBuffer->m_width); - _pTexture->clampHeight = VI_GetMaxBufferHeight(static_cast(_pBuffer->m_width)); - } else { - const u16 maxHeight = VI_GetMaxBufferHeight(static_cast(VI.width)); - if (config.frameBufferEmulation.nativeResFactor == 0) { - _pTexture->width = static_cast(dwnd().getWidth()); - _pTexture->height = static_cast(static_cast(static_cast(maxHeight) * dwnd().getScaleX())); - } else { - _pTexture->width = static_cast(VI.width * config.frameBufferEmulation.nativeResFactor); - _pTexture->height = static_cast(maxHeight * config.frameBufferEmulation.nativeResFactor); - } - _pTexture->address = gDP.depthImageAddress; - _pTexture->clampWidth = static_cast(VI.width); - _pTexture->clampHeight = maxHeight; - } - _pTexture->format = 0; - _pTexture->size = 2; - _pTexture->clampS = 1; - _pTexture->clampT = 1; - _pTexture->frameBufferTexture = CachedTexture::fbOneSample; - _pTexture->maskS = 0; - _pTexture->maskT = 0; - _pTexture->mirrorS = 0; - _pTexture->mirrorT = 0; - _pTexture->textureBytes = _pTexture->width * _pTexture->height * fbTexFormat.depthFormatBytes; - - Context::InitTextureParams initParams; - initParams.handle = _pTexture->name; - initParams.msaaLevel = _multisample ? config.video.multisampling : 0U; - initParams.width = _pTexture->width; - initParams.height = _pTexture->height; - initParams.internalFormat = fbTexFormat.depthInternalFormat; - initParams.format = fbTexFormat.depthFormat; - initParams.dataType = fbTexFormat.depthType; - gfxContext.init2DTexture(initParams); - - if (!_multisample) { - _pTexture->frameBufferTexture = CachedTexture::fbOneSample; - Context::TexParameters texParams; - texParams.handle = _pTexture->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[0]; - texParams.minFilter = textureParameters::FILTER_NEAREST; - texParams.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(texParams); - } else { - _pTexture->frameBufferTexture = CachedTexture::fbMultiSample; - } -} - -void DepthBuffer::_initDepthBufferRenderbuffer(FrameBuffer * _pBuffer) -{ - if (m_depthRenderbuffer.isNotNull()) - return; - u32 height; - if (_pBuffer != nullptr) { - m_depthRenderbufferWidth = _pBuffer->m_pTexture->width; - height = _pBuffer->m_pTexture->height; - } else { - if (config.frameBufferEmulation.nativeResFactor == 0) { - m_depthRenderbufferWidth = dwnd().getWidth(); - height = static_cast(static_cast(VI_GetMaxBufferHeight(static_cast(VI.width))) * dwnd().getScaleX()); - } else { - m_depthRenderbufferWidth = VI.width * config.frameBufferEmulation.nativeResFactor; - height = VI_GetMaxBufferHeight(static_cast(VI.width)) * config.frameBufferEmulation.nativeResFactor; - } - } - - m_depthRenderbuffer = gfxContext.createRenderbuffer(); - Context::InitRenderbufferParams params; - params.handle = m_depthRenderbuffer; - params.target = textureTarget::RENDERBUFFER; - params.format = gfxContext.getFramebufferTextureFormats().depthInternalFormat; - params.width = m_depthRenderbufferWidth; - params.height = height; - gfxContext.initRenderbuffer(params); -} - -void DepthBuffer::setDepthAttachment(ObjectHandle _fbo, BufferTargetParam _target) -{ - Context::FrameBufferRenderTarget params; - params.attachment = bufferAttachment::DEPTH_ATTACHMENT; - params.bufferHandle = _fbo; - params.bufferTarget = _target; - if (Context::DepthFramebufferTextures) { - params.textureHandle = m_pDepthBufferTexture->name; - params.textureTarget = config.video.multisampling != 0 ? textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D; - } else { - params.textureHandle = m_depthRenderbuffer; - params.textureTarget = textureTarget::RENDERBUFFER; - } - gfxContext.addFrameBufferRenderTarget(params); - - m_copied = false; - m_resolved = false; -} - -void DepthBuffer::initDepthBufferTexture(FrameBuffer * _pBuffer) -{ - if (Context::DepthFramebufferTextures) { - if (m_pDepthBufferTexture == nullptr) { - m_pDepthBufferTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0 ? - textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D); - _initDepthBufferTexture(_pBuffer, m_pDepthBufferTexture, config.video.multisampling != 0); - } - } else { - _initDepthBufferRenderbuffer(_pBuffer); - } - - if (config.video.multisampling != 0 && m_pResolveDepthBufferTexture == nullptr) { - m_pResolveDepthBufferTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - _initDepthBufferTexture(_pBuffer, m_pResolveDepthBufferTexture, false); - } -} - -CachedTexture * DepthBuffer::resolveDepthBufferTexture(FrameBuffer * _pBuffer) -{ - if (config.video.multisampling == 0) - return m_pDepthBufferTexture; - - if (m_resolved) - return m_pResolveDepthBufferTexture; - - Context::FrameBufferRenderTarget targetParams; - targetParams.attachment = bufferAttachment::DEPTH_ATTACHMENT; - targetParams.bufferHandle = _pBuffer->m_resolveFBO; - targetParams.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - targetParams.textureHandle = m_pResolveDepthBufferTexture->name; - targetParams.textureTarget = textureTarget::TEXTURE_2D; - gfxContext.addFrameBufferRenderTarget(targetParams); - - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = _pBuffer->m_FBO; - blitParams.drawBuffer = _pBuffer->m_resolveFBO; - blitParams.srcX0 = 0; - blitParams.srcY0 = 0; - blitParams.srcX1 = m_pDepthBufferTexture->width; - blitParams.srcY1 = m_pDepthBufferTexture->height; - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = m_pResolveDepthBufferTexture->width; - blitParams.dstY1 = m_pResolveDepthBufferTexture->height; - blitParams.mask = blitMask::DEPTH_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, _pBuffer->m_FBO); - - m_resolved = true; - return m_pResolveDepthBufferTexture; -} - -void DepthBuffer::copyDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture *& _pTexture, graphics::ObjectHandle _copyFBO) -{ - if (_pTexture == nullptr) { - _pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - _initDepthBufferTexture(_pBuffer, _pTexture, false); - } - - Context::FrameBufferRenderTarget targetParams; - targetParams.bufferHandle = _copyFBO; - targetParams.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - targetParams.attachment = bufferAttachment::COLOR_ATTACHMENT0; - targetParams.textureHandle = _pBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample ? - _pBuffer->m_pResolveTexture->name : - _pBuffer->m_pTexture->name; - targetParams.textureTarget = textureTarget::TEXTURE_2D; - - gfxContext.addFrameBufferRenderTarget(targetParams); - - targetParams.attachment = bufferAttachment::DEPTH_ATTACHMENT; - targetParams.textureHandle = _pTexture->name; - - gfxContext.addFrameBufferRenderTarget(targetParams); - - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = _pBuffer->m_FBO; - blitParams.drawBuffer = _copyFBO; - blitParams.srcX0 = blitParams.dstX0 = 0; - blitParams.srcY0 = blitParams.dstY0 = 0; - blitParams.srcX1 = blitParams.dstX1 = _pTexture->width; - blitParams.srcY1 = blitParams.dstY1 = _pTexture->height; - blitParams.mask = blitMask::DEPTH_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, _pBuffer->m_FBO); -} - -CachedTexture * DepthBuffer::copyDepthBufferTexture(FrameBuffer * _pBuffer) -{ - if (m_copied) - return m_pDepthBufferCopyTexture; - - DepthBuffer::copyDepthBufferTexture(_pBuffer, m_pDepthBufferCopyTexture, m_copyFBO); - m_copied = true; - return m_pDepthBufferCopyTexture; -} - -void DepthBuffer::activateDepthBufferTexture(FrameBuffer * _pBuffer) -{ - textureCache().activateTexture(0, resolveDepthBufferTexture(_pBuffer)); - gfxContext.textureBarrier(); -} - -void DepthBuffer::bindDepthImageTexture(ObjectHandle _fbo) -{ - if (Context::FramebufferFetchDepth) { - Context::FrameBufferRenderTarget targetParams; - targetParams.bufferHandle = _fbo; - targetParams.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - targetParams.attachment = bufferAttachment::COLOR_ATTACHMENT1; - targetParams.textureHandle = m_pDepthImageZTexture->name; - targetParams.textureTarget = textureTarget::TEXTURE_2D; - gfxContext.addFrameBufferRenderTarget(targetParams); - - targetParams.attachment = bufferAttachment::COLOR_ATTACHMENT2; - targetParams.textureHandle = m_pDepthImageDeltaZTexture->name; - gfxContext.addFrameBufferRenderTarget(targetParams); - - gfxContext.setDrawBuffers(3); - } else if (Context::ImageTextures) { - Context::BindImageTextureParameters bindParams; - bindParams.imageUnit = textureImageUnits::DepthZ; - bindParams.texture = m_pDepthImageZTexture->name; - bindParams.accessMode = textureImageAccessMode::READ_WRITE; - bindParams.textureFormat = gfxContext.getFramebufferTextureFormats().depthImageInternalFormat; - gfxContext.bindImageTexture(bindParams); - - bindParams.imageUnit = textureImageUnits::DepthDeltaZ; - bindParams.texture = m_pDepthImageDeltaZTexture->name; - gfxContext.bindImageTexture(bindParams); - } -} - -DepthBufferList::DepthBufferList() : m_pCurrent(nullptr), m_pzLUT(nullptr) -{ - m_pzLUT = new u16[0x40000]; - for (u32 i = 0; i<0x40000; i++) { - u32 exponent = 0; - u32 testbit = 1 << 17; - while ((i & testbit) && (exponent < 7)) { - exponent++; - testbit = 1 << (17 - exponent); - } - - const u32 mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff; - m_pzLUT[i] = static_cast(((exponent << 11) | mantissa) << 2); - } -} - -DepthBufferList::~DepthBufferList() -{ - delete[] m_pzLUT; - m_pzLUT = nullptr; - m_list.clear(); -} - -DepthBufferList & DepthBufferList::get() -{ - static DepthBufferList depthBufferList; - return depthBufferList; -} - -void DepthBufferList::init() -{ - m_pCurrent = nullptr; -} - -void DepthBufferList::destroy() -{ - m_pCurrent = nullptr; - m_list.clear(); -} - -void DepthBufferList::setCleared(bool _cleared) -{ - for (DepthBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) - iter->m_cleared = _cleared; -} - -DepthBuffer * DepthBufferList::findBuffer(u32 _address) -{ - for (DepthBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) - if (iter->m_address == _address) - return &(*iter); - return nullptr; -} - -void DepthBufferList::removeBuffer(u32 _address ) -{ - for (DepthBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) - if (iter->m_address == _address) { - frameBufferList().clearDepthBuffer(&(*iter)); - m_list.erase(iter); - return; - } -} - -void DepthBufferList::_createScreenSizeBuffer(u32 _address) -{ - FrameBuffer * pFrameBuffer = frameBufferList().findBuffer(VI.width*2); - if (pFrameBuffer == nullptr) - return; - - m_list.emplace_front(); - DepthBuffer & buffer = m_list.front(); - - buffer.m_address = _address; - buffer.m_width = pFrameBuffer->m_width; - - buffer.initDepthBufferTexture(pFrameBuffer); - - m_pCurrent = &buffer; - frameBufferList().attachDepthBuffer(); - m_pCurrent = nullptr; -} - -void DepthBufferList::saveBuffer(u32 _address) -{ - if (config.frameBufferEmulation.enable == 0) { - if (m_list.empty()) - _createScreenSizeBuffer(_address); - return; - } - - FrameBuffer * pFrameBuffer = frameBufferList().findBuffer(_address); - if (pFrameBuffer != nullptr) - pFrameBuffer->m_isDepthBuffer = true; - - DepthBuffer * pDepthBuffer = nullptr; - if (pFrameBuffer != nullptr && pFrameBuffer->m_startAddress != _address) - pDepthBuffer = findBuffer(pFrameBuffer->m_startAddress); - else - pDepthBuffer = findBuffer(_address); - - if (pDepthBuffer != nullptr && pFrameBuffer != nullptr && pDepthBuffer->m_width != pFrameBuffer->m_width) { - removeBuffer(_address); - pDepthBuffer = nullptr; - } - - if (pDepthBuffer == nullptr) { - m_list.emplace_front(); - DepthBuffer & buffer = m_list.front(); - - buffer.m_address = _address; - buffer.m_width = pFrameBuffer != nullptr ? pFrameBuffer->m_width : VI.width; - - buffer.initDepthBufferTexture(pFrameBuffer); - - pDepthBuffer = &buffer; - } - - DepthBuffer * pCurrent = m_pCurrent; - m_pCurrent = pDepthBuffer; - frameBufferList().attachDepthBuffer(); - if (pFrameBuffer == nullptr && (config.generalEmulation.hacks & hack_clearAloneDepthBuffer) != 0) - clearBuffer(); - if (pDepthBuffer->m_address != gDP.depthImageAddress) - m_pCurrent = pCurrent; -} - -void DepthBufferList::clearBuffer() -{ - if (m_pCurrent != nullptr) - m_pCurrent->m_cleared = true; - - if (config.frameBufferEmulation.enable == 0 || config.frameBufferEmulation.N64DepthCompare == Config::dcDisable) { - gfxContext.clearDepthBuffer(); - return; - } - - // Clear depth image texture - FrameBuffer * pColorBuffer = frameBufferList().getCurrent(); - if (pColorBuffer == nullptr || pColorBuffer->m_pDepthBuffer == nullptr) - return; - DepthBuffer * pDepthBuffer = pColorBuffer->m_pDepthBuffer; - - //if (pColorBuffer->m_pTexture->realWidth == pDepthBuffer->m_pDepthImageZTexture->realWidth) - { - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, pDepthBuffer->m_ZTextureClearFBO); - gfxContext.clearColorBuffer(1.0f, 0.0f, 0.0f, 0.0f); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, pDepthBuffer->m_DeltaZTextureClearFBO); - gfxContext.clearColorBuffer(1.0f, 0.0f, 0.0f, 0.0f); - } - //else { - // gDP.rectColor.g = gDP.rectColor.b = gDP.rectColor.a = 0.0f; - // u32 cycleType = gDP.otherMode.cycleType; - // u32 fillcolor = gDP.fillColor.color; - // gDP.otherMode.cycleType = G_CYC_FILL; - // gDP.fillColor.color = 0; - // const int lrx = pColorBuffer->m_width; - // const int lry = VI_GetMaxBufferHeight(pColorBuffer->m_width); - // gDP.rectColor.r = 1.0f; - // gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, pDepthBuffer->m_ZTextureClearFBO); - // dwnd().getDrawer().drawRect(0, 0, lrx, lry); - // gDP.rectColor.r = 0.0f; - // gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, pDepthBuffer->m_DeltaZTextureClearFBO); - // dwnd().getDrawer().drawRect(0, 0, lrx, lry); - // gDP.otherMode.cycleType = cycleType; - // gDP.fillColor.color = fillcolor; - //} - frameBufferList().setCurrentDrawBuffer(); -} - -void DepthBuffer_Init() -{ - depthBufferList().init(); -} - -void DepthBuffer_Destroy() -{ - depthBufferList().destroy(); -} diff --git a/GLideN64/src/DepthBuffer.h b/GLideN64/src/DepthBuffer.h deleted file mode 100644 index ac4e150..0000000 --- a/GLideN64/src/DepthBuffer.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef DEPTHBUFFER_H -#define DEPTHBUFFER_H - -#include "Types.h" -#include "Textures.h" -#include "Graphics/ObjectHandle.h" -#include "Graphics/Parameter.h" - -struct FrameBuffer; - -struct DepthBuffer -{ - DepthBuffer(); - ~DepthBuffer(); - void initDepthImageTexture(FrameBuffer * _pBuffer); - void initDepthBufferTexture(FrameBuffer * _pBuffer); - CachedTexture * resolveDepthBufferTexture(FrameBuffer * _pBuffer); - CachedTexture * copyDepthBufferTexture(FrameBuffer * _pBuffer); - - void setDepthAttachment(graphics::ObjectHandle _fbo, graphics::BufferTargetParam _target); - void activateDepthBufferTexture(FrameBuffer * _pBuffer); - - void bindDepthImageTexture(graphics::ObjectHandle _fbo); - - u32 m_address = 0; - u32 m_width = 0; - bool m_cleared = false; - - CachedTexture *m_pDepthBufferTexture = nullptr; - - graphics::ObjectHandle m_depthRenderbuffer; - u32 m_depthRenderbufferWidth = 0; - - CachedTexture *m_pDepthImageZTexture = nullptr; - CachedTexture *m_pDepthImageDeltaZTexture = nullptr; - graphics::ObjectHandle m_ZTextureClearFBO; - graphics::ObjectHandle m_DeltaZTextureClearFBO; - - // multisampling - CachedTexture *m_pResolveDepthBufferTexture = nullptr; - bool m_resolved = false; - - // render to depth buffer - graphics::ObjectHandle m_copyFBO; - CachedTexture *m_pDepthBufferCopyTexture = nullptr; - bool m_copied = false; - - static void copyDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture *& _pTexture, graphics::ObjectHandle _copyFBO); - static void _initDepthBufferTexture(const FrameBuffer * _pBuffer, CachedTexture *_pTexture, bool _multisample); - -private: - static void _initDepthImageTexture(FrameBuffer * _pBuffer, CachedTexture& _cachedTexture, graphics::ObjectHandle & _clearFBO); - - void _initDepthBufferRenderbuffer(FrameBuffer * _pBuffer); -}; - -class DepthBufferList -{ -public: - void init(); - void destroy(); - void saveBuffer(u32 _address); - void removeBuffer(u32 _address); - void clearBuffer(); - void setCleared(bool _cleared); - DepthBuffer *findBuffer(u32 _address); - DepthBuffer * getCurrent() const {return m_pCurrent;} - - static DepthBufferList & get(); - - const u16 * const getZLUT() const {return m_pzLUT;} - -private: - DepthBufferList(); - DepthBufferList(const DepthBufferList &) = delete; - ~DepthBufferList(); - - void _createScreenSizeBuffer(u32 _address); - - typedef std::list DepthBuffers; - DepthBuffers m_list; - DepthBuffer *m_pCurrent; - u16 * m_pzLUT; -}; - -inline -DepthBufferList & depthBufferList() -{ - return DepthBufferList::get(); -} - -void DepthBuffer_Init(); -void DepthBuffer_Destroy(); - -#endif diff --git a/GLideN64/src/DepthBufferRender/ClipPolygon.cpp b/GLideN64/src/DepthBufferRender/ClipPolygon.cpp deleted file mode 100644 index 5183f39..0000000 --- a/GLideN64/src/DepthBufferRender/ClipPolygon.cpp +++ /dev/null @@ -1,532 +0,0 @@ - -/* - * 2D clipping of a triangle into a polygon using the clipping - * boundarys LeftClip, RightClip, TopClip and BotClip. - * - * The code is based on Sutherland-Hodgman algorithm where we - * clip the polygon against each clipping boundary in turn. - * - * Note! This code is far from optimal but it does what it is - * supposed to do. - * - * This source is part of the fatmap2.txt document by - * Mats Byggmastar, mri@penti.sit.fi - * 17.4.1997 Jakobstad, Finland - * - * Companies with self respect are encouraged to contact me if - * any of this code is to be used as part of a commercial product. - */ - -//**************************************************************** -// -// Adopted for GLideN64 by Gonetz, Dec 2016 -// -//**************************************************************** - - -#include -#include "gSP.h" -#include "Combiner.h" -#include "ClipPolygon.h" -#include "DisplayWindow.h" - -/* - * vbp is a pointer to a vertex array. The first 3 vertices in that - * array is our source vertices. The rest of the array will be used - * to hold new vertices created during clipping. - * - * you can then access the new vertices using the *final variable - * - * function returns the number of vertices in the resulting polygon - */ -unsigned int clipInScreenSpace(vertexclip *** final, vertexclip * vbp, unsigned int numVertices) -{ - const float LeftClip = gSP.viewport.x; - const float RightClip = LeftClip + gSP.viewport.width; - const float BotClip = gSP.viewport.y; - const float TopClip = BotClip + gSP.viewport.height; - graphics::CombinerProgram * pCurrCmb = currentCombiner(); - const bool clipColor = pCurrCmb->usesShade(); - const bool clipTexCoords = pCurrCmb->usesTexture(); - - auto cliptestx = [LeftClip, RightClip](vertexclip * v) - { - int bits = 0; - if (v->y < LeftClip) - bits |= LEFT; - if (v->y > RightClip) - bits |= RIGHT; - return bits; - }; - - auto cliptesty = [BotClip, TopClip](vertexclip * v) - { - int bits = 0; - if (v->y < BotClip) - bits |= BOT; - if (v->y > TopClip) - bits |= TOP; - return bits; - }; - - auto clipVertex = [clipColor, clipTexCoords](vertexclip const* src1, vertexclip const* src2, vertexclip * dst, float a) - { - float ima = 1.0f - a; -#define doClip(V) dst->V = src1->V*ima + src2->V*a - doClip(x); - doClip(y); - doClip(z); -#undef doClip - }; - - static vertexclip * vp1[12], * vp2[12]; // vertex ptr buffers - vertexclip ** src = vp1; - vertexclip ** dst = vp2; - vertexclip ** tmp; - - for (unsigned int n = 0; n < numVertices; n++) - vp1[n] = vbp + n; - vp1[numVertices] = vbp + 0; - - vbp += numVertices; // Next free vertex - - unsigned int dsti = 0; - unsigned int max = numVertices; - - // right clip - for (unsigned int n = 0; n < max; n++) { - vertexclip * src1 = src[n]; // current vertex - vertexclip * src2 = src[n + 1]; // next vertex - if ((src1->clip & RIGHT) == VISIBLE) { - dst[dsti++] = src1; // add clip vertex to list - if ((src2->clip & RIGHT) == VISIBLE) - continue; - } else if ((src2->clip & RIGHT) != VISIBLE) - continue; - float a = (RightClip - src1->x) / (src2->x - src1->x); - dst[dsti] = vbp++; // create new vertex - clipVertex(src1, src2, dst[dsti], a); - dst[dsti]->x = RightClip; - dst[dsti]->clip = cliptesty(dst[dsti]); - dsti++; - } - dst[dsti] = dst[0]; - tmp = src; src = dst; dst = tmp; // swap src - dst buffers - max = dsti; - dsti = 0; - - // left clip - for(unsigned int n = 0; n < max; n++) { - vertexclip * src1 = src[n]; // current vertex - vertexclip * src2 = src[n+1]; // next vertex - if((src1->clip & LEFT) == VISIBLE) { - dst[dsti++] = src1; // add clip vertex to list - if((src2->clip & LEFT) == VISIBLE) - continue; - } else if((src2->clip & LEFT) != VISIBLE) - continue; - float a = (LeftClip - src1->x) / (src2->x - src1->x); - dst[dsti] = vbp++; // create new vertex - clipVertex(src1, src2, dst[dsti], a); - dst[dsti]->x = LeftClip; - dst[dsti]->clip = cliptesty(dst[dsti]); - dsti++; - } - dst[dsti] = dst[0]; - tmp = src; src = dst; dst = tmp; // Swap src - dst buffers - max = dsti; - dsti = 0; - - // top clip - for(unsigned int n = 0; n < max; n++) { - vertexclip * src1 = src[n]; // current vertex - vertexclip * src2 = src[n+1]; // next vertex - if((src1->clip & TOP) == VISIBLE) { - dst[dsti++] = src1; // add clip vertex to list - if((src2->clip & TOP) == VISIBLE) - continue; - } else if((src2->clip & TOP) != VISIBLE) - continue; - float a = (TopClip - src1->y) / (src2->y - src1->y); - dst[dsti] = vbp++; // create new vertex - clipVertex(src1, src2, dst[dsti], a); - dst[dsti]->y = TopClip; - dst[dsti]->clip = cliptestx(dst[dsti]); - dsti++; - } - dst[dsti] = dst[0]; - tmp = src; src = dst; dst = tmp; // swap src - dst buffers - max = dsti; - dsti = 0; - - // bot clip - for(unsigned int n = 0; n < max; n++) { - vertexclip * src1 = src[n]; // current vertex - vertexclip * src2 = src[n+1]; // next vertex - if((src1->clip & BOT) == VISIBLE) { - dst[dsti++] = src1; // add clip vertex to list - if((src2->clip & BOT) == VISIBLE) - continue; - } else if((src2->clip & BOT) != VISIBLE) - continue; - float a = (BotClip - src1->y) / (src2->y - src1->y); - dst[dsti] = vbp++; // create new vertex - clipVertex(src1, src2, dst[dsti], a); - dst[dsti]->y = BotClip; - dsti++; - } - - *final = dst; - - return dsti; -} - -unsigned int clipW(const SPVertex ** _vsrc, SPVertex * _vdst) -{ - graphics::CombinerProgram * pCurrCmb = currentCombiner(); - const bool clipColor = pCurrCmb->usesShade(); - const bool clipTexCoords = pCurrCmb->usesTexture(); - - auto copyVertex = [](SPVertex & _dst, const SPVertex * _src) - { - _dst.x = _src->x; - _dst.y = _src->y; - _dst.z = _src->z; - _dst.w = _src->w; - _dst.modify = _src->modify; - }; - - unsigned int dsti = 0; - for (int n = 0; n < 3; ++n) { - const SPVertex * src1 = _vsrc[n]; // current vertex - const SPVertex * src2 = _vsrc[n + 1]; // next vertex - if (src1->w >= 0.01f) { - copyVertex(_vdst[dsti++], src1); // add visible vertex to list - if (src2->w >= 0.01f) - continue; - } else if (src2->w < 0.01f) - continue; - float a = (-src1->w) / (src2->w - src1->w); - float ima = 1.0f - a; - // create new vertex - _vdst[dsti].x = src1->x*ima + src2->x*a; - _vdst[dsti].y = src1->y*ima + src2->y*a; - _vdst[dsti].z = src1->z*ima + src2->z*a; - _vdst[dsti].w = 0.01f; - _vdst[dsti].modify = 0; - dsti++; - } - return dsti; -} - -// -------------------------------------------------------------------------------------------------------------------- -// -// clipping using homogeneous coordinates -// http://www.3dcpptutorials.sk/ -// -// -------------------------------------------------------------------------------------------------------------------- -// -// c equals the x or y or z coordinate of a fragment -// -// -------------------------------------------------------------------------------------------------------------------- -// -// a fragment of an edge is in front of or lies on a negative clip plane: - w <= c -// -// a fragment of an edge is behind a negative clip plane: - w > c -// -// to find the intersection of an edge with a negative clip plane we need to find t for which: - w = c -// -// -------------------------------------------------------------------------------------------------------------------- -// -// w = w1 + (w2 - w1) * t -// c = c1 + (c2 - c1) * t -// -// - w = c -// -// - (w1 + (w2 - w1) * t) = c1 + (c2 - c1) * t -// - w1 - (w2 - w1) * t = c1 + (c2 - c1) * t -// - (w2 - w1) * t = c1 + w1 + (c2 - c1) * t -// - (c2 - c1) * t - (w2 - w1) * t = c1 + w1 -// (c2 - c1) * t + (w2 - w1) * t = - c1 - w1 -// (c2 - c1 + w2 - w1) * t = - c1 - w1 -// t = (- c1 - w1) / (c2 - c1 + w2 - w1) -// t = (c1 + w1) / (- c2 + c1 - w2 + w1) -// t = (c1 + w1) / (c1 - c2 + w1 - w2) -// -// -------------------------------------------------------------------------------------------------------------------- -// -// a fragment of an edge is in front of or lies on a positive clip plane: c <= w -// -// a fragment of an edge is behind a positive clip plane: c > w -// -// to find the intersection of an edge with a positive clip plane we need to find t for which: c = w -// -// -------------------------------------------------------------------------------------------------------------------- -// -// c = c1 + (c2 - c1) * t -// w = w1 + (w2 - w1) * t -// -// c = w -// -// c1 + (c2 - c1) * t = w1 + (w2 - w1) * t -// (c2 - c1) * t = w1 - c1 + (w2 - w1) * t -// (c2 - c1) * t - (w2 - w1) * t = w1 - c1 -// ((c2 - c1) - (w2 - w1)) * t = w1 - c1 -// (c2 - c1 - w2 + w1) * t = w1 - c1 -// t = (w1 - c1) / (c2 - c1 - w2 + w1) -// t = (- w1 + c1) / (- c2 + c1 + w2 - w1) -// t = (c1 - w1) / (c1 - c2 - w1 + w2) -// -// -------------------------------------------------------------------------------------------------------------------- -void clipInHomogeneousSpace(SPVertex * _pVertices, std::vector & _vResult, int _clipPlane) -{ - if (_clipPlane == 5 && GBI.isNoN()) { - // Skip near plane clipping - clipInHomogeneousSpace(_pVertices, _vResult, _clipPlane + 1); - return; - } - - graphics::CombinerProgram * pCurrCmb = currentCombiner(); - const bool usesColor = pCurrCmb->usesShade(); - const bool usesTexture = pCurrCmb->usesTexture(); - const float wScale = static_cast(gSP.clipRatio); - const float xScale = dwnd().getAdjustScale(); - - auto clipVertex = [usesColor, usesTexture](SPVertex const* src, SPVertex * dst, float t) - { -#define doClip(V) dst->V += (src->V - dst->V) * t - doClip(x); - doClip(y); - doClip(z); - doClip(w); - doClip(bc0); - doClip(bc1); - if (usesColor) - { - doClip(r); - doClip(g); - doClip(b); - doClip(a); - doClip(flat_r); - doClip(flat_g); - doClip(flat_b); - doClip(flat_a); - } - if (usesTexture) - { - doClip(s); - doClip(t); - } - dst->modify = src->modify & (MODIFY_ST | MODIFY_RGBA); - dst->HWLight = src->HWLight; -#undef doClip - }; - - auto copyVertex = [usesColor, usesTexture](SPVertex const* src, SPVertex * dst) - { -#define doCopy(V) dst->V = src->V - doCopy(x); - doCopy(y); - doCopy(z); - doCopy(w); - doCopy(bc0); - doCopy(bc1); - doCopy(a); - doCopy(flat_a); - if (usesColor) - { - doCopy(r); - doCopy(g); - doCopy(b); - doCopy(flat_r); - doCopy(flat_g); - doCopy(flat_b); - } - if (usesTexture) - { - doCopy(s); - doCopy(t); - } - doCopy(HWLight); - dst->modify = src->modify & (MODIFY_ST | MODIFY_RGBA); -#undef doCopy - }; - - - if (_clipPlane >= 1 && _clipPlane <= 6) { - unsigned int fifocp, fbcp, fbcpc = 0; // fragment in front of clip plane, fragment behind clip plane, fragments behind clip plane count - - // visibility testing - - SPVertex *pVertex = _pVertices; - - for (unsigned int i = 0; i < 3; i++) { - bool visible; - - switch (_clipPlane) { - case 1: - visible = -pVertex->w * wScale <= pVertex->x * xScale; - break; - case 2: - visible = pVertex->x * xScale <= pVertex->w * wScale; - break; - case 3: - visible = -pVertex->w * wScale <= pVertex->y; - break; - case 4: - visible = pVertex->y <= pVertex->w * wScale; - break; - case 5: - visible = -pVertex->w * wScale <= pVertex->z; - break; - case 6: - visible = pVertex->z <= pVertex->w * wScale; - break; - } - - if (visible) { - fifocp = i; - } else { - fbcp = i; - fbcpc++; - } - - pVertex++; - } - - // clipping - - if (fbcpc == 3) { - return; - } else if (fbcpc == 2) { - SPVertex *Vertex1 = _pVertices + (fifocp + 1) % 3; - SPVertex *Vertex2 = _pVertices + (fifocp + 2) % 3; - SPVertex *Vertex3 = _pVertices + fifocp; - - float t1, t2; - const float scaledW1 = Vertex1->w * wScale; - const float scaledW2 = Vertex2->w * wScale; - const float scaledW3 = Vertex3->w * wScale; - - switch (_clipPlane) { - case 1: - { - const float scaledX1 = Vertex1->x * xScale; - const float scaledX2 = Vertex2->x * xScale; - const float scaledX3 = Vertex3->x * xScale; - t1 = (scaledX1 + scaledW1) / (scaledX1 - scaledX3 + scaledW1 - scaledW3); - t2 = (scaledX2 + scaledW2) / (scaledX2 - scaledX3 + scaledW2 - scaledW3); - } - break; - - case 2: - { - const float scaledX1 = Vertex1->x * xScale; - const float scaledX2 = Vertex2->x * xScale; - const float scaledX3 = Vertex3->x * xScale; - t1 = (scaledX1 - scaledW1) / (scaledX1 - scaledX3 - scaledW1 + scaledW3); - t2 = (scaledX2 - scaledW2) / (scaledX2 - scaledX3 - scaledW2 + scaledW3); - } - break; - - case 3: - t1 = (Vertex1->y + scaledW1) / (Vertex1->y - Vertex3->y + scaledW1 - scaledW3); - t2 = (Vertex2->y + scaledW2) / (Vertex2->y - Vertex3->y + scaledW2 - scaledW3); - break; - - case 4: - t1 = (Vertex1->y - scaledW1) / (Vertex1->y - Vertex3->y - scaledW1 + scaledW3); - t2 = (Vertex2->y - scaledW2) / (Vertex2->y - Vertex3->y - scaledW2 + scaledW3); - break; - - case 5: - t1 = (Vertex1->z + scaledW1) / (Vertex1->z - Vertex3->z + scaledW1 - scaledW3); - t2 = (Vertex2->z + scaledW2) / (Vertex2->z - Vertex3->z + scaledW2 - scaledW3); - break; - - case 6: - t1 = (Vertex1->z - scaledW1) / (Vertex1->z - Vertex3->z - scaledW1 + scaledW3); - t2 = (Vertex2->z - scaledW2) / (Vertex2->z - Vertex3->z - scaledW2 + scaledW3); - break; - } - - clipVertex(Vertex3, Vertex1, t1); - clipVertex(Vertex3, Vertex2, t2); - - clipInHomogeneousSpace(_pVertices, _vResult, _clipPlane + 1); - } else if (fbcpc == 1) { - unsigned int if1 = (fbcp + 1) % 3, if2 = (fbcp + 2) % 3; - - SPVertex *Vertex1 = _pVertices + if1; - SPVertex *Vertex2 = _pVertices + if2; - SPVertex *Vertex3 = _pVertices + fbcp; - - SPVertex NewVertices[3]; - - SPVertex *NewVertex1 = NewVertices + if1; - SPVertex *NewVertex2 = NewVertices + if2; - SPVertex *NewVertex3 = NewVertices + fbcp; - - float t1, t2; - const float scaledW1 = Vertex1->w * wScale; - const float scaledW2 = Vertex2->w * wScale; - const float scaledW3 = Vertex3->w * wScale; - - switch (_clipPlane) { - case 1: - { - const float scaledX1 = Vertex1->x * xScale; - const float scaledX2 = Vertex2->x * xScale; - const float scaledX3 = Vertex3->x * xScale; - t1 = (scaledX3 + scaledW3) / (scaledX3 - scaledX1 + scaledW3 - scaledW1); - t2 = (scaledX3 + scaledW3) / (scaledX3 - scaledX2 + scaledW3 - scaledW2); - } - break; - - case 2: - { - const float scaledX1 = Vertex1->x * xScale; - const float scaledX2 = Vertex2->x * xScale; - const float scaledX3 = Vertex3->x * xScale; - t1 = (scaledX3 - scaledW3) / (scaledX3 - scaledX1 - scaledW3 + scaledW1); - t2 = (scaledX3 - scaledW3) / (scaledX3 - scaledX2 - scaledW3 + scaledW2); - } - break; - - case 3: - t1 = (Vertex3->y + scaledW3) / (Vertex3->y - Vertex1->y + scaledW3 - scaledW1); - t2 = (Vertex3->y + scaledW3) / (Vertex3->y - Vertex2->y + scaledW3 - scaledW2); - break; - - case 4: - t1 = (Vertex3->y - scaledW3) / (Vertex3->y - Vertex1->y - scaledW3 + scaledW1); - t2 = (Vertex3->y - scaledW3) / (Vertex3->y - Vertex2->y - scaledW3 + scaledW2); - break; - - case 5: - t1 = (Vertex3->z + scaledW3) / (Vertex3->z - Vertex1->z + scaledW3 - scaledW1); - t2 = (Vertex3->z + scaledW3) / (Vertex3->z - Vertex2->z + scaledW3 - scaledW2); - break; - - case 6: - t1 = (Vertex3->z - scaledW3) / (Vertex3->z - Vertex1->z - scaledW3 + scaledW1); - t2 = (Vertex3->z - scaledW3) / (Vertex3->z - Vertex2->z - scaledW3 + scaledW2); - break; - } - - copyVertex(Vertex3, NewVertex3); - copyVertex(Vertex2, NewVertex2); - clipVertex(Vertex1, Vertex3, t1); - copyVertex(Vertex3, NewVertex1); - clipVertex(NewVertex2, NewVertex3, t2); - - clipInHomogeneousSpace(_pVertices, _vResult, _clipPlane + 1); - clipInHomogeneousSpace(NewVertices, _vResult, _clipPlane + 1); - } else if (fbcpc == 0) { - clipInHomogeneousSpace(_pVertices, _vResult, _clipPlane + 1); - } - } else if (_clipPlane == 7) { - for (int i = 0; i < 3; ++i) - _vResult.push_back(_pVertices[i]); - } -} diff --git a/GLideN64/src/DepthBufferRender/ClipPolygon.h b/GLideN64/src/DepthBufferRender/ClipPolygon.h deleted file mode 100644 index dd5cb18..0000000 --- a/GLideN64/src/DepthBufferRender/ClipPolygon.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CLIP_POLYGON_H -#define CLIP_POLYGON_H - -#define VISIBLE 0 -#define LEFT 1 -#define RIGHT 2 -#define TOP 4 -#define BOT 8 - -struct SPVertex; - -struct vertexclip -{ - float x, y, z; - int clip; -}; - -/* - * vbp is a pointer to a vertex array. The first 3 vertices in that - * array is our source vertices. The rest of the array will be used - * to hold new vertices created during clipping. - * - * you can then access the new vertices using the *final variable - * - * function returns the number of vertices in the resulting polygon - */ -unsigned int clipInScreenSpace(vertexclip *** final, vertexclip * vbp, unsigned int numVertices); - -unsigned int clipW(const SPVertex ** _vsrc, SPVertex * _vdst); - -void clipInHomogeneousSpace(SPVertex * pFragments, std::vector & _vResult, int _clipPlane = 1); - -#endif // CLIP_POLYGON_H diff --git a/GLideN64/src/DepthBufferRender/DepthBufferRender.cpp b/GLideN64/src/DepthBufferRender/DepthBufferRender.cpp deleted file mode 100644 index daf088b..0000000 --- a/GLideN64/src/DepthBufferRender/DepthBufferRender.cpp +++ /dev/null @@ -1,274 +0,0 @@ -//**************************************************************** -// -// Software rendering into N64 depth buffer -// Idea and N64 depth value format by Orkin -// Polygon rasterization algorithm is taken from FATMAP2 engine by Mats Byggmastar, mri@penti.sit.fi -// -// Created by Gonetz, Dec 2004 -// -//**************************************************************** - -//**************************************************************** -// -// Adopted for GLideN64 by Gonetz, Dec 2016 -// -//**************************************************************** - -#include -#include "N64.h" -#include "gDP.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "DepthBufferRender.h" - -static vertexi * max_vtx; // Max y vertex (ending vertex) -static vertexi * start_vtx, *end_vtx; // First and last vertex in array -static vertexi * right_vtx, *left_vtx; // Current right and left vertex - -static int right_height, left_height; -static int right_x, right_dxdy, left_x, left_dxdy; -static int left_z, left_dzdy; - -__inline int imul16(int x, int y) // (x * y) >> 16 -{ - return (int)((unsigned long long)(((long long)x) * ((long long)y)) >> 16); -} - -__inline int imul14(int x, int y) // (x * y) >> 14 -{ - return (int)((unsigned long long)(((long long)x) * ((long long)y)) >> 14); -} - -__inline int idiv16(int x, int y) // (x << 16) / y -{ - return (int)((long long)((((unsigned long long)x) << 16)) / ((long long)y)); -} - -__inline int iceil(int x) -{ - x += 0xffff; - return x / 0x10000; -} - -__inline int isub(int x, int y) // safe x - y -{ - return (int)((long long)x - (long long)y); -} - -__inline int isumm(int x, int y) // safe x + y -{ - return (int)((long long)x + (long long)y); -} - -static -void RightSection(void) -{ - // Walk backwards trough the vertex array - - vertexi * v2, *v1 = right_vtx; - if (right_vtx > start_vtx) - v2 = right_vtx - 1; - else - v2 = end_vtx; // Wrap to end of array - right_vtx = v2; - - // v1 = top vertex - // v2 = bottom vertex - - // Calculate number of scanlines in this section - - right_height = isub(iceil(v2->y), iceil(v1->y)); - if (right_height <= 0) - return; - - // Guard against possible div overflows - - if (right_height > 1) { - // OK, no worries, we have a section that is at least - // one pixel high. Calculate slope as usual. - - int height = isub(v2->y, v1->y); - right_dxdy = idiv16(isub(v2->x, v1->x), height); - } else { - // Height is less or equal to one pixel. - // Calculate slope = width * 1/height - // using 18:14 bit precision to avoid overflows. - - int inv_height = (0x10000 << 14) / (isub(v2->y, v1->y)); - right_dxdy = imul14(isub(v2->x, v1->x), inv_height); - } - - // Prestep initial values - - int prestep = isub((iceil(v1->y) << 16), v1->y); - right_x = isumm(v1->x, imul16(prestep, right_dxdy)); -} - -static -void LeftSection(void) -{ - // Walk forward trough the vertex array - - vertexi * v2, *v1 = left_vtx; - if (left_vtx < end_vtx) - v2 = left_vtx + 1; - else - v2 = start_vtx; // Wrap to start of array - left_vtx = v2; - - // v1 = top vertex - // v2 = bottom vertex - - // Calculate number of scanlines in this section - - left_height = isub(iceil(v2->y), iceil(v1->y)); - if (left_height <= 0) - return; - - // Guard against possible div overflows - - if (left_height > 1) { - // OK, no worries, we have a section that is at least - // one pixel high. Calculate slope as usual. - - int height = isub(v2->y, v1->y); - left_dxdy = idiv16(isub(v2->x, v1->x), height); - left_dzdy = idiv16(isub(v2->z, v1->z), height); - } else { - // Height is less or equal to one pixel. - // Calculate slope = width * 1/height - // using 18:14 bit precision to avoid overflows. - - int inv_height = (0x10000 << 14) / isub(v2->y, v1->y); - left_dxdy = imul14(isub(v2->x, v1->x), inv_height); - left_dzdy = imul14(isub(v2->z, v1->z), inv_height); - } - - // Prestep initial values - - int prestep = (iceil(v1->y) << 16) - v1->y; - left_x = isumm(v1->x, imul16(prestep, left_dxdy)); - left_z = isumm(v1->z, imul16(prestep, left_dzdy)); -} - - -void Rasterize(vertexi * vtx, int vertices, int dzdx) -{ - start_vtx = vtx; // First vertex in array - - // Search trough the vtx array to find min y, max y - // and the location of these structures. - - vertexi * min_vtx = vtx; - max_vtx = vtx; - - int min_y = vtx->y; - int max_y = vtx->y; - - vtx++; - - for (int n = 1; n < vertices; n++) { - if (vtx->y < min_y) { - min_y = vtx->y; - min_vtx = vtx; - } else if (vtx->y > max_y) { - max_y = vtx->y; - max_vtx = vtx; - } - vtx++; - } - - // OK, now we know where in the array we should start and - // where to end while scanning the edges of the polygon - - left_vtx = min_vtx; // Left side starting vertex - right_vtx = min_vtx; // Right side starting vertex - end_vtx = vtx - 1; // Last vertex in array - - // Search for the first usable right section - - do { - if (right_vtx == max_vtx) - return; - RightSection(); - } while (right_height <= 0); - - // Search for the first usable left section - - do { - if (left_vtx == max_vtx) - return; - LeftSection(); - } while (left_height <= 0); - - u16 * destptr = (u16*)(RDRAM + gDP.depthImageAddress); - int y1 = iceil(min_y); - if (y1 >= (int)gDP.scissor.lry) - return; - int shift; - - const u16 * const zLUT = depthBufferList().getZLUT(); - const s32 depthBufferWidth = static_cast(depthBufferList().getCurrent()->m_width); - - for (;;) { - int x1 = iceil(left_x); - if (x1 < (int)gDP.scissor.ulx) - x1 = (int)gDP.scissor.ulx; - int width = iceil(right_x) - x1; - if (x1 + width >= (int)gDP.scissor.lrx) - width = (int)(gDP.scissor.lrx - x1 - 1); - - if (width > 0 && y1 >= (int)gDP.scissor.uly) { - - // Prestep initial z - - int prestep = isub((int)((unsigned int)x1 << 16), left_x); - int z = isumm(left_z, imul16(prestep, dzdx)); - - shift = x1 + y1*depthBufferWidth; - //draw to depth buffer - int trueZ; - int idx; - u16 encodedZ; - for (int x = 0; x < width; x++) { - trueZ = z / 8192; - if (trueZ < 0) - trueZ = 0; - encodedZ = zLUT[trueZ]; - idx = (shift + x) ^ 1; - if (encodedZ < destptr[idx]) - destptr[idx] = encodedZ; - z = isumm(z, dzdx); - } - } - - //destptr += rdp.zi_width; - y1++; - if (y1 >= (int)gDP.scissor.lry) - return; - - // Scan the right side - - if (--right_height <= 0) { // End of this section? - do { - if (right_vtx == max_vtx) - return; - RightSection(); - } while (right_height <= 0); - } else - right_x += right_dxdy; - - // Scan the left side - - if (--left_height <= 0) { // End of this section? - do { - if (left_vtx == max_vtx) - return; - LeftSection(); - } while (left_height <= 0); - } else { - left_x = isumm(left_x, left_dxdy); - left_z = isumm(left_z, left_dzdy); - } - } -} diff --git a/GLideN64/src/DepthBufferRender/DepthBufferRender.h b/GLideN64/src/DepthBufferRender/DepthBufferRender.h deleted file mode 100644 index c84cf56..0000000 --- a/GLideN64/src/DepthBufferRender/DepthBufferRender.h +++ /dev/null @@ -1,19 +0,0 @@ -//**************************************************************** -// -// Software rendering to N64 depth buffer -// Created by Gonetz, Dec 2004 -// -//**************************************************************** - -#ifndef DEPTH_BUFFER_RENDER_H -#define DEPTH_BUFFER_RENDER_H - -struct vertexi -{ - int x, y; // Screen position in 16:16 bit fixed point - int z; // z value in 16:16 bit fixed point -}; - -void Rasterize(vertexi * vtx, int vertices, int dzdx); - -#endif //DEPTH_BUFFER_RENDER_H diff --git a/GLideN64/src/DisplayLoadProgress.cpp b/GLideN64/src/DisplayLoadProgress.cpp deleted file mode 100644 index f968da9..0000000 --- a/GLideN64/src/DisplayLoadProgress.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include -#include "GLideNHQ/Ext_TxFilter.h" -#include -#include - -#include "FrameBuffer.h" -#include "DisplayWindow.h" -#include "DisplayLoadProgress.h" - -void displayLoadProgress(const wchar_t *format, ...) -{ - va_list args; - wchar_t wbuf[INFO_BUF]; - char buf[INFO_BUF]; - - // process input -#ifdef OS_ANDROID - const u32 bufSize = 2048; - char cbuf[bufSize]; - char fmt[bufSize]; - wcstombs(fmt, format, bufSize); - va_start(args, format); - vsprintf(cbuf, fmt, args); - va_end(args); - mbstowcs(wbuf, cbuf, INFO_BUF); -#else - va_start(args, format); - vswprintf(wbuf, INFO_BUF, format, args); - va_end(args); -#endif - - // XXX: convert to multibyte - wcstombs(buf, wbuf, INFO_BUF); - - FrameBuffer* pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr) - gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle::defaultFramebuffer); - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.clearColorBuffer(nullptr); - if (strlen(buf) > 0) - drawer.drawText(buf, -0.9f, 0); - dwnd().swapBuffers(); - - if (pBuffer != nullptr) - gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, pBuffer->m_FBO); -} diff --git a/GLideN64/src/DisplayLoadProgress.h b/GLideN64/src/DisplayLoadProgress.h deleted file mode 100644 index 701d27d..0000000 --- a/GLideN64/src/DisplayLoadProgress.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef DISPLAYLOADPROGRESS_H -#define DISPLAYLOADPROGRESS_H - -void displayLoadProgress(const wchar_t *format, ...); - -#endif // DISPLAYLOADPROGRESS_H diff --git a/GLideN64/src/DisplayWindow.cpp b/GLideN64/src/DisplayWindow.cpp deleted file mode 100644 index c13a587..0000000 --- a/GLideN64/src/DisplayWindow.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include -#include -#include "Config.h" -#include "RSP.h" -#include "VI.h" -#include "Graphics/Context.h" -#include "DisplayWindow.h" -#include "PluginAPI.h" -#include "FrameBuffer.h" - -#ifdef min -#undef min -#endif - -bool DisplayWindow::start() -{ - if (!_start()) - return false; - - graphics::ObjectHandle::defaultFramebuffer = _getDefaultFramebuffer(); - - gfxContext.init(); - m_drawer._initData(); - m_buffersSwapCount = 0; - - // only query max MSAA when needed - if (m_maxMsaa == 0) { - m_maxMsaa = gfxContext.getMaxMSAALevel(); - } - - return true; -} - -void DisplayWindow::stop() -{ - m_drawer._destroyData(); - gfxContext.destroy(); - _stop(); -} - -void DisplayWindow::restart() -{ - _restart(); - m_bResizeWindow = true; -} - -void DisplayWindow::swapBuffers() -{ - m_drawer.drawOSD(); - m_drawer.clearStatistics(); - _swapBuffers(); - if (!RSP.LLE) { - if ((config.generalEmulation.hacks & hack_doNotResetOtherModeL) == 0) - gDP.otherMode.l = 0; - if ((config.generalEmulation.hacks & hack_doNotResetOtherModeH) == 0) - gDP.otherMode.h = 0x0CFF; - } - ++m_buffersSwapCount; -} - -void DisplayWindow::setCaptureScreen(const char * const _strDirectory) -{ - ::mbstowcs(m_strScreenDirectory, _strDirectory, PLUGIN_PATH_SIZE - 1); - m_bCaptureScreen = true; -} - -void DisplayWindow::saveScreenshot() -{ - if (!m_bCaptureScreen) - return; - _saveScreenshot(); - m_bCaptureScreen = false; -} - -void DisplayWindow::saveBufferContent(FrameBuffer * _pBuffer) -{ - saveBufferContent(_pBuffer->m_FBO, _pBuffer->m_pTexture); -} - -void DisplayWindow::saveBufferContent(graphics::ObjectHandle _fbo, CachedTexture *_pTexture) -{ - if (wcslen(m_strScreenDirectory) == 0) { - api().FindPluginPath(m_strScreenDirectory); - std::wstring pluginPath(m_strScreenDirectory); - if (pluginPath.back() != L'/') - pluginPath += L'/'; - ::wcsncpy(m_strScreenDirectory, pluginPath.c_str(), std::min(size_t(PLUGIN_PATH_SIZE), pluginPath.length() + 1)); - } - _saveBufferContent(_fbo, _pTexture); -} - -bool DisplayWindow::changeWindow() -{ - if (!m_bToggleFullscreen) - return false; - m_drawer._destroyData(); - _changeWindow(); - updateScale(); - m_drawer._initData(); - m_bToggleFullscreen = false; - return true; -} - -void DisplayWindow::closeWindow() -{ - if (!m_bToggleFullscreen || !m_bFullscreen) - return; - if (m_drawer.getDrawingState() != DrawingState::Non) - m_drawer._destroyData(); - _changeWindow(); - m_bToggleFullscreen = false; -} - - -void DisplayWindow::setWindowSize(u32 _width, u32 _height) -{ - if (m_width != _width || m_height != _height) { - m_resizeWidth = _width; - m_resizeHeight = _height; - m_bResizeWindow = true; - } -} - -bool DisplayWindow::resizeWindow() -{ - if (!m_bResizeWindow) - return false; - m_drawer._destroyData(); - if (!_resizeWindow()) - if(!_start()) - return false; - updateScale(); - m_drawer._initData(); - m_bResizeWindow = false; - return true; -} - -void DisplayWindow::updateScale() -{ - if (VI.width == 0 || VI.height == 0) - return; - m_scaleX = static_cast(m_width) / static_cast(VI.width); - m_scaleY = static_cast(m_height) / static_cast(VI.height); -} - -void DisplayWindow::_setBufferSize() -{ - m_bAdjustScreen = false; - switch (config.frameBufferEmulation.aspect) { - case Config::aStretch: // stretch - m_width = m_screenWidth; - m_height = m_screenHeight; - break; - case Config::a43: // force 4/3 - if (m_screenWidth * 3 / 4 > m_screenHeight) { - m_height = m_screenHeight; - m_width = m_screenHeight * 4 / 3; - } else if (m_screenHeight * 4 / 3 > m_screenWidth) { - m_width = m_screenWidth; - m_height = m_screenWidth * 3 / 4; - } else { - m_width = m_screenWidth; - m_height = m_screenHeight; - } - break; - case Config::a169: // force 16/9 - if (m_screenWidth * 9 / 16 > m_screenHeight) { - m_height = m_screenHeight; - m_width = m_screenHeight * 16 / 9; - } else if (m_screenHeight * 16 / 9 > m_screenWidth) { - m_width = m_screenWidth; - m_height = m_screenWidth * 9 / 16; - } else { - m_width = m_screenWidth; - m_height = m_screenHeight; - } - break; - case Config::aAdjust: // adjust - m_width = m_screenWidth; - m_height = m_screenHeight; - if (m_screenWidth * 3 / 4 > m_screenHeight) { - f32 width43 = m_screenHeight * 4.0f / 3.0f; - m_adjustScale = width43 / m_screenWidth; - m_bAdjustScreen = true; - } - break; - default: - assert(false && "Unknown aspect ratio"); - m_width = m_screenWidth; - m_height = m_screenHeight; - } -} - -void DisplayWindow::readScreen(void **_pDest, long *_pWidth, long *_pHeight) -{ - _readScreen(_pDest, _pWidth, _pHeight); -} - -void DisplayWindow::readScreen2(void * _dest, int * _width, int * _height, int _front) -{ - _readScreen2(_dest, _width, _height, _front); -} - -u32 DisplayWindow::maxMSAALevel() const -{ - return m_maxMsaa; -} diff --git a/GLideN64/src/DisplayWindow.h b/GLideN64/src/DisplayWindow.h deleted file mode 100644 index 6b7851f..0000000 --- a/GLideN64/src/DisplayWindow.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once -#include "Types.h" -#include "GraphicsDrawer.h" - -class DisplayWindow -{ -public: - virtual ~DisplayWindow() {} - - bool start(); - void stop(); - void restart(); - void swapBuffers(); - void saveScreenshot(); - void saveBufferContent(FrameBuffer * _pBuffer); - void saveBufferContent(graphics::ObjectHandle _fbo, CachedTexture *_pTexture); - bool changeWindow(); - bool resizeWindow(); - void closeWindow(); - void setWindowSize(u32 _width, u32 _height); - void setCaptureScreen(const char * const _strDirectory); - void setToggleFullscreen() { m_bToggleFullscreen = true; } - void readScreen(void **_pDest, long *_pWidth, long *_pHeight); - void readScreen2(void * _dest, int * _width, int * _height, int _front); - u32 maxMSAALevel() const; - - void updateScale(); - f32 getScaleX() const { return m_scaleX; } - f32 getScaleY() const { return m_scaleY; } - f32 getAdjustScale() const { return m_adjustScale; } - u32 getBuffersSwapCount() const { return m_buffersSwapCount; } - u32 getWidth() const { return m_width; } - u32 getHeight() const { return m_height; } - u32 getScreenWidth() const { return m_screenWidth; } - u32 getScreenHeight() const { return m_screenHeight; } - u32 getHeightOffset() const { return m_heightOffset; } - bool isFullscreen() const { return m_bFullscreen; } - bool isAdjustScreen() const { return m_bAdjustScreen; } - bool isResizeWindow() const { return m_bResizeWindow; } - - GraphicsDrawer & getDrawer() { return m_drawer; } - - static DisplayWindow & get(); - -protected: - DisplayWindow() = default; - - void _setBufferSize(); - - bool m_bCaptureScreen = false; - bool m_bToggleFullscreen = false; - bool m_bResizeWindow = false; - bool m_bFullscreen = false; - bool m_bAdjustScreen = false; - - u32 m_buffersSwapCount = 0; - u32 m_width = 0; - u32 m_height = 0; - u32 m_heightOffset = 0; - u32 m_screenWidth = 0; - u32 m_screenHeight = 0; - u32 m_screenRefresh = 0; - u32 m_resizeWidth = 0; - u32 m_resizeHeight = 0; - u32 m_maxMsaa = 0; - f32 m_scaleX = 0.0f; - f32 m_scaleY = 0.0f; - f32 m_adjustScale = 1.0f; - - wchar_t m_strScreenDirectory[PLUGIN_PATH_SIZE]; - -private: - GraphicsDrawer m_drawer; - - virtual bool _start() = 0; - virtual void _stop() = 0; - virtual void _restart() = 0; - virtual void _swapBuffers() = 0; - virtual void _saveScreenshot() = 0; - virtual void _saveBufferContent(graphics::ObjectHandle _fbo, CachedTexture *_pTexture) = 0; - virtual void _changeWindow() = 0; - virtual bool _resizeWindow() = 0; - virtual void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) = 0; - virtual void _readScreen2(void * _dest, int * _width, int * _height, int _front) = 0; - virtual graphics::ObjectHandle _getDefaultFramebuffer() = 0; - -}; - -inline -DisplayWindow & dwnd() -{ - return DisplayWindow::get(); -} diff --git a/GLideN64/src/FrameBuffer.cpp b/GLideN64/src/FrameBuffer.cpp deleted file mode 100644 index 98e8388..0000000 --- a/GLideN64/src/FrameBuffer.cpp +++ /dev/null @@ -1,1810 +0,0 @@ -#include -#include -#include -#include -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "VI.h" -#include "Textures.h" -#include "Combiner.h" -#include "Types.h" -#include "Config.h" -#include "Debugger.h" -#include "DebugDump.h" -#include "PostProcessor.h" -#include "FrameBufferInfo.h" -#include "Log.h" -#include "MemoryStatus.h" - -#include "BufferCopy/ColorBufferToRDRAM.h" -#include "BufferCopy/DepthBufferToRDRAM.h" -#include "BufferCopy/RDRAMtoColorBuffer.h" - -#include -#include -#include -#include "DisplayWindow.h" - -using namespace std; -using namespace graphics; - -FrameBuffer::FrameBuffer() - : m_copyFBO(ObjectHandle::defaultFramebuffer) - , m_ColorBufferFBO(0) - , m_pColorBufferTexture(nullptr) -{ - m_pTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0 ? - textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D); - m_FBO = gfxContext.createFramebuffer(); - - if (config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0) - m_depthFBO = gfxContext.createFramebuffer(); -} - -FrameBuffer::~FrameBuffer() -{ - gfxContext.deleteFramebuffer(m_FBO); - gfxContext.deleteFramebuffer(m_depthFBO); - gfxContext.deleteFramebuffer(m_resolveFBO); - gfxContext.deleteFramebuffer(m_SubFBO); - gfxContext.deleteFramebuffer(m_copyFBO); - - textureCache().removeFrameBufferTexture(m_pTexture); - textureCache().removeFrameBufferTexture(m_pDepthTexture); - textureCache().removeFrameBufferTexture(m_pResolveTexture); - textureCache().removeFrameBufferTexture(m_pSubTexture); - textureCache().removeFrameBufferTexture(m_pFrameBufferCopyTexture); - - _destroyColorFBTexure(); -} - -static -void _initFrameBufferTexture(u32 _address, u16 _width, u16 _height, f32 _scale, u16 _format, u16 _size, CachedTexture *_pTexture) -{ - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - _pTexture->width = static_cast(static_cast(static_cast(_width) * _scale)); - _pTexture->height = static_cast(static_cast(static_cast(_height) * _scale)); - _pTexture->format = _format; - _pTexture->size = _size; - _pTexture->clampS = 1; - _pTexture->clampT = 1; - _pTexture->address = _address; - _pTexture->clampWidth = _width; - _pTexture->clampHeight = _height; - _pTexture->frameBufferTexture = CachedTexture::fbOneSample; - _pTexture->maskS = 0; - _pTexture->maskT = 0; - _pTexture->mirrorS = 0; - _pTexture->mirrorT = 0; - _pTexture->textureBytes = _pTexture->width * _pTexture->height; - _pTexture->hdRatioS = _scale; - _pTexture->hdRatioT = _scale; - if (_size > G_IM_SIZ_8b) - _pTexture->textureBytes *= fbTexFormats.colorFormatBytes; - else - _pTexture->textureBytes *= fbTexFormats.monochromeFormatBytes; -} - -void FrameBuffer::_initTexture(u16 _width, u16 _height, u16 _format, u16 _size, CachedTexture *_pTexture) -{ - _initFrameBufferTexture(m_startAddress, _width, _height, m_scale, _format, _size, _pTexture); -} - -static -void _setAndAttachBufferTexture(ObjectHandle _fbo, CachedTexture *_pTexture, u32 _t, bool _multisampling) -{ - const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats(); - Context::InitTextureParams initParams; - initParams.handle = _pTexture->name; - initParams.textureUnitIndex = textureIndices::Tex[_t]; - if (_multisampling) - initParams.msaaLevel = config.video.multisampling; - initParams.width = _pTexture->width; - initParams.height = _pTexture->height; - if (_pTexture->size > G_IM_SIZ_8b) { - initParams.internalFormat = fbTexFormat.colorInternalFormat; - initParams.format = fbTexFormat.colorFormat; - initParams.dataType = fbTexFormat.colorType; - } else { - initParams.internalFormat = fbTexFormat.monochromeInternalFormat; - initParams.format = fbTexFormat.monochromeFormat; - initParams.dataType = fbTexFormat.monochromeType; - } - gfxContext.init2DTexture(initParams); - - if (!_multisampling) { - Context::TexParameters texParams; - texParams.handle = _pTexture->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[_t]; - texParams.minFilter = textureParameters::FILTER_NEAREST; - texParams.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(texParams); - } - - Context::FrameBufferRenderTarget bufTarget; - bufTarget.bufferHandle = _fbo; - bufTarget.bufferTarget = bufferTarget::FRAMEBUFFER; - bufTarget.attachment = bufferAttachment::COLOR_ATTACHMENT0; - bufTarget.textureTarget = _multisampling ? textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D; - bufTarget.textureHandle = _pTexture->name; - gfxContext.addFrameBufferRenderTarget(bufTarget); - assert(!gfxContext.isFramebufferError()); -} - -void FrameBuffer::_setAndAttachTexture(ObjectHandle _fbo, CachedTexture *_pTexture, u32 _t, bool _multisampling) -{ - _setAndAttachBufferTexture(_fbo, _pTexture, _t, _multisampling); -} - -bool FrameBuffer::isAuxiliary() const -{ - return m_width != VI.width; -} - -void FrameBuffer::init(u32 _address, u16 _format, u16 _size, u16 _width, bool _cfb) -{ - m_startAddress = _address; - m_width = _width; - m_height = _cfb ? VI.height : 1; -// m_height = VI.height; - m_size = _size; - updateEndAddress(); - if (isAuxiliary() && config.frameBufferEmulation.copyAuxToRDRAM != 0) { - m_scale = 1.0f; - } else if (config.frameBufferEmulation.nativeResFactor != 0 && config.frameBufferEmulation.enable != 0) { - m_scale = static_cast(config.frameBufferEmulation.nativeResFactor); - } else { - m_scale = std::max(dwnd().getScaleX(), 1.0f); - } - m_cfb = _cfb; - m_cleared = false; - m_fingerprint = false; - m_swapCount = dwnd().getBuffersSwapCount(); - - const u16 maxHeight = VI_GetMaxBufferHeight(_width); - _initTexture(_width, maxHeight, _format, _size, m_pTexture); - - if (config.video.multisampling != 0) { - _setAndAttachTexture(m_FBO, m_pTexture, 0, true); - m_pTexture->frameBufferTexture = CachedTexture::fbMultiSample; - - m_pResolveTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - _initTexture(_width, maxHeight, _format, _size, m_pResolveTexture); - m_resolveFBO = gfxContext.createFramebuffer(); - _setAndAttachTexture(m_resolveFBO, m_pResolveTexture, 0, false); - assert(!gfxContext.isFramebufferError()); - - gfxContext.bindFramebuffer(bufferTarget::FRAMEBUFFER, m_FBO); - } else - _setAndAttachTexture(m_FBO, m_pTexture, 0, false); - -// gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); -} - -void FrameBuffer::updateEndAddress() -{ - const u32 height = max(1U, m_height); - m_endAddress = min(RDRAMSize, m_startAddress + (((m_width * height) << m_size >> 1) - 1)); -} - -inline -u32 _cutHeight(u32 _address, u32 _height, u32 _stride) -{ - if (_address > RDRAMSize) - return 0; - if (_address + _stride * _height > (RDRAMSize + 1)) - return (RDRAMSize + 1 - _address) / _stride; - return _height; -} - -void FrameBuffer::setBufferClearParams(u32 _fillcolor, s32 _ulx, s32 _uly, s32 _lrx, s32 _lry) -{ - m_cleared = true; - m_clearParams.fillcolor = _fillcolor; - m_clearParams.ulx = _ulx; - m_clearParams.lrx = _lrx; - m_clearParams.uly = _uly; - m_clearParams.lry = _lry; -} - -void FrameBuffer::copyRdram() -{ - const u32 stride = m_width << m_size >> 1; - const u32 height = _cutHeight(m_startAddress, m_height, stride); - if (height == 0) - return; - - m_cleared = false; - - const u32 dataSize = stride * height; - - // Auxiliary frame buffer - if (isAuxiliary() && config.frameBufferEmulation.copyAuxToRDRAM == 0) { - // Write small amount of data to the start of the buffer. - // This is necessary for auxilary buffers: game can restore content of RDRAM when buffer is not needed anymore - // Thus content of RDRAM on moment of buffer creation will be the same as when buffer becomes obsolete. - // Validity check will see that the RDRAM is the same and thus the buffer is valid, which is false. - const u32 twoPercent = max(4U, dataSize / 200); - u32 start = m_startAddress >> 2; - u32 * pData = reinterpret_cast(RDRAM); - for (u32 i = 0; i < twoPercent; ++i) { - if (i < 4) - pData[start++] = fingerprint[i]; - else - pData[start++] = 0; - } - m_fingerprint = true; - return; - } - m_RdramCopy.resize(dataSize); - memcpy(m_RdramCopy.data(), RDRAM + m_startAddress, dataSize); -} - -void FrameBuffer::setDirty() -{ - m_cleared = false; - m_RdramCopy.clear(); -} - -bool FrameBuffer::isValid(bool _forceCheck) const -{ - if (!_forceCheck) { - if (m_validityChecked == dwnd().getBuffersSwapCount()) - return true; // Already checked - m_validityChecked = dwnd().getBuffersSwapCount(); - } - - const u32 * const pData = reinterpret_cast(RDRAM); - - if (m_cleared) { - const u32 testColor = m_clearParams.fillcolor & 0xFFFEFFFE; - const u32 stride = m_width << m_size >> 1; - const s32 lry = static_cast(_cutHeight(m_startAddress, static_cast(m_clearParams.lry), stride)); - if (lry == 0) - return false; - - const u32 ci_width_in_dwords = m_width >> (3 - m_size); - const u32 start = (m_startAddress >> 2) + static_cast(m_clearParams.uly) * ci_width_in_dwords; - const u32 * dst = pData + start; - u32 wrongPixels = 0; - for (s32 y = m_clearParams.uly; y < lry; ++y) { - for (s32 x = m_clearParams.ulx; x < m_clearParams.lrx; ++x) { - if ((dst[x] & 0xFFFEFFFE) != testColor) - ++wrongPixels; - } - dst += ci_width_in_dwords; - } - return wrongPixels < (m_endAddress - m_startAddress) / 400; // threshold level 1% of dwords - } else if (m_fingerprint) { - //check if our fingerprint is still there - u32 start = m_startAddress >> 2; - for (u32 i = 0; i < 4; ++i) - if ((pData[start++] & 0xFFFEFFFE) != (fingerprint[i] & 0xFFFEFFFE)) - return false; - return true; - } else if (!m_RdramCopy.empty()) { - const u32 * const pCopy = reinterpret_cast(m_RdramCopy.data()); - const u32 size = static_cast(m_RdramCopy.size()); - const u32 size_dwords = size >> 2; - u32 start = m_startAddress >> 2; - u32 wrongPixels = 0; - for (u32 i = 0; i < size_dwords; ++i) { - if ((pData[start++] & 0xFFFEFFFE) != (pCopy[i] & 0xFFFEFFFE)) - ++wrongPixels; - } - return wrongPixels < size / 400; // threshold level 1% of dwords - } - return true; // No data to decide -} - -void FrameBuffer::resolveMultisampledTexture(bool _bForce) -{ - if (!Context::Multisampling) - return; - - if (m_resolved && !_bForce) - return; - - if (!m_pResolveTexture) - return; - - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = m_FBO; - blitParams.drawBuffer = m_resolveFBO; - blitParams.srcX0 = 0; - blitParams.srcY0 = 0; - blitParams.srcX1 = m_pTexture->width; - blitParams.srcY1 = m_pTexture->height; - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = m_pResolveTexture->width; - blitParams.dstY1 = m_pResolveTexture->height; - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - frameBufferList().setCurrentDrawBuffer(); - m_resolved = true; -} - -void FrameBuffer::copyDepthTexture() -{ - if (config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0) - DepthBuffer::copyDepthBufferTexture(this, m_pDepthTexture, m_depthFBO); -} - -bool FrameBuffer::_initSubTexture(u32 _t) -{ - if (!m_SubFBO.isNotNull()) - m_SubFBO = gfxContext.createFramebuffer(); - - gDPTile * pTile = gSP.textureTile[_t]; - if (pTile->lrs < pTile->uls || pTile->lrt < pTile->ult) - return false; - const u32 width = pTile->lrs - pTile->uls + 1; - const u32 height = pTile->lrt - pTile->ult + 1; - - if (m_pSubTexture != nullptr) { - if (m_pSubTexture->size == m_pTexture->size && - m_pSubTexture->clampWidth == width && - m_pSubTexture->clampHeight == height) - return true; - textureCache().removeFrameBufferTexture(m_pSubTexture); - } - - m_pSubTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - _initTexture(static_cast(width), static_cast(height), m_pTexture->format, m_pTexture->size, m_pSubTexture); - - m_pSubTexture->clampS = pTile->clamps; - m_pSubTexture->clampT = pTile->clampt; - m_pSubTexture->offsetS = 0.0f; - m_pSubTexture->offsetT = 0.0f; - m_pSubTexture->hdRatioS = m_pTexture->hdRatioS; - m_pSubTexture->hdRatioT = m_pTexture->hdRatioT; - - - _setAndAttachTexture(m_SubFBO, m_pSubTexture, _t, false); - - return true; -} - -CachedTexture * FrameBuffer::_getSubTexture(u32 _t) -{ - if (!Context::BlitFramebuffer) - return m_pTexture; - - if (!_initSubTexture(_t)) - return m_pTexture; - - s32 x0 = static_cast(m_pTexture->offsetS * m_scale); - s32 y0 = static_cast(m_pTexture->offsetT * m_scale); - s32 copyWidth = m_pSubTexture->width; - if (x0 + copyWidth > m_pTexture->width) - copyWidth = m_pTexture->width - x0; - s32 copyHeight = m_pSubTexture->height; - if (y0 + copyHeight > m_pTexture->height) - copyHeight = m_pTexture->height - y0; - - ObjectHandle readFBO = m_FBO; - if (Context::WeakBlitFramebuffer && - m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) { - resolveMultisampledTexture(true); - readFBO = m_resolveFBO; - } - - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = readFBO; - blitParams.drawBuffer = m_SubFBO; - blitParams.srcX0 = x0; - blitParams.srcY0 = y0; - blitParams.srcX1 = x0 + copyWidth; - blitParams.srcY1 = y0 + copyHeight; - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = copyWidth; - blitParams.dstY1 = copyHeight; - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - frameBufferList().setCurrentDrawBuffer(); - - return m_pSubTexture; -} - -void FrameBuffer::_initCopyTexture() -{ - m_copyFBO = gfxContext.createFramebuffer(); - m_pFrameBufferCopyTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0 ? - textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D); - _initTexture(static_cast(m_width), VI_GetMaxBufferHeight(static_cast(m_width)), - m_pTexture->format, m_pTexture->size, m_pFrameBufferCopyTexture); - _setAndAttachTexture(m_copyFBO, m_pFrameBufferCopyTexture, 0, config.video.multisampling != 0); - if (config.video.multisampling != 0) - m_pFrameBufferCopyTexture->frameBufferTexture = CachedTexture::fbMultiSample; -} - -CachedTexture * FrameBuffer::_copyFrameBufferTexture() -{ - if (m_copied) - return m_pFrameBufferCopyTexture; - - if (m_pFrameBufferCopyTexture == nullptr) - _initCopyTexture(); - - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = m_FBO; - blitParams.drawBuffer = m_copyFBO; - blitParams.srcX0 = 0; - blitParams.srcY0 = 0; - blitParams.srcX1 = m_pTexture->width; - blitParams.srcY1 = m_pTexture->height; - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = m_pTexture->width; - blitParams.dstY1 = m_pTexture->height; - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - frameBufferList().setCurrentDrawBuffer(); - - m_copied = true; - return m_pFrameBufferCopyTexture; -} - -CachedTexture * FrameBuffer::getTexture(u32 _t) -{ - const bool getDepthTexture = m_isDepthBuffer && - gDP.colorImage.address == gDP.depthImageAddress && - m_pDepthBuffer != nullptr && - (config.generalEmulation.hacks & hack_ZeldaMM) == 0; - CachedTexture *pTexture = getDepthTexture ? m_pDepthBuffer->m_pDepthBufferTexture : m_pTexture; - - if (this == frameBufferList().getCurrent()) { - if (Context::TextureBarrier) - gfxContext.textureBarrier(); - else if (Context::BlitFramebuffer) - pTexture = getDepthTexture ? m_pDepthBuffer->copyDepthBufferTexture(this) : _copyFrameBufferTexture(); - } - - const u32 shift = (gSP.textureTile[_t]->imageAddress - m_startAddress) >> (m_size - 1); - const u32 factor = m_width; - if (m_loadType == LOADTYPE_TILE) { - pTexture->offsetS = static_cast(m_loadTileOrigin.uls + (shift % factor)); - pTexture->offsetT = static_cast(m_loadTileOrigin.ult + shift / factor); - } else { - pTexture->offsetS = static_cast(shift % factor); - pTexture->offsetT = static_cast(shift / factor); - } - - if (!getDepthTexture && (gSP.textureTile[_t]->clamps == 0 || gSP.textureTile[_t]->clampt == 0)) - pTexture = _getSubTexture(_t); - - pTexture->scaleS = m_scale / static_cast(pTexture->width); - pTexture->scaleT = m_scale / static_cast(pTexture->height); - - if (gSP.textureTile[_t]->shifts > 10) - pTexture->shiftScaleS = static_cast(1 << (16 - gSP.textureTile[_t]->shifts)); - else if (gSP.textureTile[_t]->shifts > 0) - pTexture->shiftScaleS = 1.0f / static_cast(1 << gSP.textureTile[_t]->shifts); - else - pTexture->shiftScaleS = 1.0f; - - if (gSP.textureTile[_t]->shiftt > 10) - pTexture->shiftScaleT = static_cast(1 << (16 - gSP.textureTile[_t]->shiftt)); - else if (gSP.textureTile[_t]->shiftt > 0) - pTexture->shiftScaleT = 1.0f / static_cast(1 << gSP.textureTile[_t]->shiftt); - else - pTexture->shiftScaleT = 1.0f; - - return pTexture; -} - -CachedTexture * FrameBuffer::getTextureBG() -{ - CachedTexture *pTexture = m_pTexture; - - if (this == frameBufferList().getCurrent()) { - if (Context::TextureBarrier) - gfxContext.textureBarrier(); - else if (Context::BlitFramebuffer) - pTexture = _copyFrameBufferTexture(); - } - - pTexture->scaleS = m_scale / static_cast(pTexture->width); - pTexture->scaleT = m_scale / static_cast(pTexture->height); - - pTexture->shiftScaleS = 1.0f; - pTexture->shiftScaleT = 1.0f; - - pTexture->offsetS = gSP.bgImage.imageX; - pTexture->offsetT = gSP.bgImage.imageY; - return pTexture; -} - -CachedTexture * FrameBuffer::getColorFbTexture() -{ - if(m_pColorBufferTexture == nullptr || - m_pColorBufferTexture->width != m_width || - m_pColorBufferTexture->height != VI_GetMaxBufferHeight(m_width)) - { - _destroyColorFBTexure(); - _initColorFBTexture(m_width); - } - - return m_pColorBufferTexture; -} - -graphics::ObjectHandle FrameBuffer::getColorFbFbo() -{ - return m_ColorBufferFBO; -} - -const u8 * FrameBuffer::readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync) -{ - return m_bufferReader->readPixels(_x0, _y0, _width, _height, _size, _sync); -} - -void FrameBuffer::cleanUp() -{ - m_bufferReader->cleanUp(); -} - -void FrameBuffer::_initColorFBTexture(int _width) -{ - m_ColorBufferFBO = gfxContext.createFramebuffer(); - - const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats(); - - m_pColorBufferTexture = textureCache().addFrameBufferTexture(Context::EglImage ? textureTarget::TEXTURE_EXTERNAL : textureTarget::TEXTURE_2D); - m_pColorBufferTexture->format = G_IM_FMT_RGBA; - m_pColorBufferTexture->size = 2; - m_pColorBufferTexture->clampS = 1; - m_pColorBufferTexture->clampT = 1; - m_pColorBufferTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pColorBufferTexture->maskS = 0; - m_pColorBufferTexture->maskT = 0; - m_pColorBufferTexture->mirrorS = 0; - m_pColorBufferTexture->mirrorT = 0; - m_pColorBufferTexture->width = _width; - m_pColorBufferTexture->height = VI_GetMaxBufferHeight(_width); - m_pColorBufferTexture->textureBytes = m_pColorBufferTexture->width * m_pColorBufferTexture->height * fbTexFormat.colorFormatBytes; - - m_bufferReader.reset(gfxContext.createColorBufferReader(m_pColorBufferTexture)); - - // Skip this since texture is initialized in the EGL color buffer reader - if (!Context::EglImage) - { - Context::InitTextureParams params; - params.handle = m_pColorBufferTexture->name; - params.target = textureTarget::TEXTURE_2D; - params.width = m_pColorBufferTexture->width; - params.height = m_pColorBufferTexture->height; - params.internalFormat = fbTexFormat.colorInternalFormat; - params.format = fbTexFormat.colorFormat; - params.dataType = fbTexFormat.colorType; - gfxContext.init2DTexture(params); - } - - { - Context::TexParameters params; - params.handle = m_pColorBufferTexture->name; - params.target = Context::EglImage ? textureTarget::TEXTURE_EXTERNAL : textureTarget::TEXTURE_2D; - params.textureUnitIndex = textureIndices::Tex[0]; - params.minFilter = textureParameters::FILTER_LINEAR; - params.magFilter = textureParameters::FILTER_LINEAR; - gfxContext.setTextureParameters(params); - } - { - Context::FrameBufferRenderTarget bufTarget; - bufTarget.bufferHandle = ObjectHandle(m_ColorBufferFBO); - bufTarget.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - bufTarget.attachment = bufferAttachment::COLOR_ATTACHMENT0; - bufTarget.textureTarget = Context::EglImageFramebuffer ? textureTarget::TEXTURE_EXTERNAL : textureTarget::TEXTURE_2D; - bufTarget.textureHandle = m_pColorBufferTexture->name; - gfxContext.addFrameBufferRenderTarget(bufTarget); - } - - // check if everything is OK - assert(!gfxContext.isFramebufferError()); - - gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle::defaultFramebuffer); -} - -void FrameBuffer::_destroyColorFBTexure() -{ - m_bufferReader.reset(); - - if (m_pColorBufferTexture != nullptr) { - textureCache().removeFrameBufferTexture(m_pColorBufferTexture); - m_pColorBufferTexture = nullptr; - } - - if (m_ColorBufferFBO.isNotNull()) { - gfxContext.deleteFramebuffer(m_ColorBufferFBO); - m_ColorBufferFBO.reset(); - } -} - -FrameBufferList & FrameBufferList::get() -{ - static FrameBufferList frameBufferList; - return frameBufferList; -} - -void FrameBufferList::init() -{ - m_pCurrent = nullptr; - m_pCopy = nullptr; - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - m_prevColorImageHeight = 0; - m_overscan.init(); - m_rdpUpdate.init(); -} - -void FrameBufferList::destroy() { - gfxContext.bindFramebuffer(bufferTarget::FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - m_list.clear(); - m_pCurrent = nullptr; - m_pCopy = nullptr; - m_overscan.destroy(); -} - -void FrameBufferList::setBufferChanged(f32 _maxY) -{ - gDP.colorImage.changed = TRUE; - gDP.colorImage.height = max(gDP.colorImage.height, static_cast(_maxY)); - gDP.colorImage.height = min(gDP.colorImage.height, static_cast(gDP.scissor.lry)); - if (m_pCurrent != nullptr) { - m_pCurrent->m_height = max(m_pCurrent->m_height, gDP.colorImage.height); - m_pCurrent->m_cfb = false; - m_pCurrent->m_changed = true; - m_pCurrent->m_copiedToRdram = false; - } -} - -void FrameBufferList::clearBuffersChanged() -{ - gDP.colorImage.changed = FALSE; - FrameBuffer * pBuffer = frameBufferList().findBuffer(*REG.VI_ORIGIN & 0xffffff); - if (pBuffer != nullptr) - pBuffer->m_changed = false; -} - -void FrameBufferList::setCurrentDrawBuffer() const -{ - if (m_pCurrent != nullptr) - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pCurrent->m_FBO); - else if (!m_list.empty()) - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_list.back().m_FBO); -} - -FrameBuffer * FrameBufferList::findBuffer(u32 _startAddress) -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - if (iter->m_startAddress <= _startAddress && iter->m_endAddress >= _startAddress) // [ { ] - return &(*iter); - } - return nullptr; -} - -FrameBuffer * FrameBufferList::getBuffer(u32 _startAddress) -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - if (iter->m_startAddress == _startAddress) - return &(*iter); - } - return nullptr; -} - -inline -bool isOverlapping(const FrameBuffer * _buf1, const FrameBuffer * _buf2) -{ - if (_buf1->m_endAddress < _buf2->m_endAddress && _buf1->m_width == _buf2->m_width && _buf1->m_size == _buf2->m_size) { - const u32 diff = _buf1->m_endAddress - _buf2->m_startAddress + 1; - const u32 stride = _buf1->m_width << _buf1->m_size >> 1; - if ((diff % stride == 0) && (diff / stride < 5)) - return true; - else - return false; - } - return false; -} - -void FrameBufferList::removeIntersections() -{ - assert(!m_list.empty()); - - FrameBuffers::iterator iter = m_list.end(); - do { - --iter; - if (&(*iter) == m_pCurrent) - continue; - if (iter->m_startAddress <= m_pCurrent->m_startAddress && iter->m_endAddress >= m_pCurrent->m_startAddress) { // [ { ] - if (isOverlapping(&(*iter), m_pCurrent)) { - iter->m_endAddress = m_pCurrent->m_startAddress - 1; - continue; - } - iter = m_list.erase(iter); - } else if (m_pCurrent->m_startAddress <= iter->m_startAddress && m_pCurrent->m_endAddress >= iter->m_startAddress) { // { [ } - if (isOverlapping(m_pCurrent, &(*iter))) { - m_pCurrent->m_endAddress = iter->m_startAddress - 1; - continue; - } - iter = m_list.erase(iter); - } - } while (iter != m_list.begin()); -} - -FrameBuffer * FrameBufferList::findTmpBuffer(u32 _address) -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) - if (iter->m_startAddress > _address || iter->m_endAddress < _address) - return &(*iter); - return nullptr; -} - -void FrameBufferList::updateCurrentBufferEndAddress() -{ - if (m_pCurrent == nullptr) - return; - m_pCurrent->updateEndAddress(); - removeIntersections(); -} - -void FrameBufferList::_createScreenSizeBuffer() -{ - if (VI.height == 0) - return; - m_list.emplace_front(); - FrameBuffer & buffer = m_list.front(); - buffer.init(VI.width * 2, G_IM_FMT_RGBA, G_IM_SIZ_16b, static_cast(VI.width), false); -} - -void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _width, bool _cfb) -{ - if (_width > 640) - return; - - if (_width == 512 && (config.generalEmulation.hacks & hack_RE2) != 0) - _width = static_cast(*REG.VI_WIDTH); - - if (config.frameBufferEmulation.enable == 0) { - if (m_list.empty()) - _createScreenSizeBuffer(); - return; - } - - if (m_pCurrent != nullptr && - config.frameBufferEmulation.copyAuxToRDRAM != 0 && - (config.generalEmulation.hacks & hack_Snap) == 0) { - if (m_pCurrent->isAuxiliary()) { - FrameBuffer_CopyToRDRAM(m_pCurrent->m_startAddress, true); - removeBuffer(m_pCurrent->m_startAddress); - } - } - - DisplayWindow & wnd = dwnd(); - bool bPrevIsDepth = false; - - if (m_pCurrent != nullptr) { - bPrevIsDepth = m_pCurrent->m_isDepthBuffer; - m_pCurrent->m_readable = true; - m_pCurrent->updateEndAddress(); - - if (!m_pCurrent->m_isDepthBuffer && - !m_pCurrent->m_copiedToRdram && - !m_pCurrent->m_cfb && - !m_pCurrent->m_cleared && - m_pCurrent->m_RdramCopy.empty() && - m_pCurrent->m_height > 1) { - m_pCurrent->copyRdram(); - } - - removeIntersections(); - } - - const float scaleX = config.frameBufferEmulation.nativeResFactor == 0 ? - wnd.getScaleX() : - static_cast(config.frameBufferEmulation.nativeResFactor); - - if (m_pCurrent == nullptr || m_pCurrent->m_startAddress != _address || m_pCurrent->m_width != _width) - m_pCurrent = findBuffer(_address); - - auto isSubBuffer = [_address, _width, _size, &wnd](const FrameBuffer * _pBuffer) -> bool - { - if (_pBuffer->m_swapCount == wnd.getBuffersSwapCount() && - !_pBuffer->m_cfb && - _pBuffer->m_width == _width && - _pBuffer->m_size == _size) - { - const u32 stride = _width << _size >> 1; - const u32 diffFromStart = _address - _pBuffer->m_startAddress; - if (diffFromStart % stride != 0) - return true; - const u32 diffFromEnd = _pBuffer->m_endAddress - _address + 1; - if ((diffFromEnd / stride > 5)) - return true; - } - return false; - }; - - auto isOverlappingBuffer = [_address, _width, _size](const FrameBuffer * _pBuffer) -> bool - { - if (_pBuffer->m_width == _width && _pBuffer->m_size == _size) { - const u32 stride = _width << _size >> 1; - const u32 diffEnd = _pBuffer->m_endAddress - _address + 1; - if ((diffEnd / stride < 5)) - return true; - } - return false; - }; - - if (m_pCurrent != nullptr) { - m_pCurrent->m_originX = m_pCurrent->m_originY = 0; - if ((m_pCurrent->m_startAddress != _address)) { - if (isSubBuffer(m_pCurrent)) { - const u32 stride = _width << _size >> 1; - const u32 addrOffset = _address - m_pCurrent->m_startAddress; - m_pCurrent->m_originX = (addrOffset % stride) >> (_size - 1); - m_pCurrent->m_originY = addrOffset / stride; - gSP.changed |= CHANGED_VIEWPORT; - gDP.changed |= CHANGED_SCISSOR; - return; - } else if (isOverlappingBuffer(m_pCurrent)) { - m_pCurrent->m_endAddress = _address - 1; - m_pCurrent = nullptr; - } else { - removeBuffer(m_pCurrent->m_startAddress); - m_pCurrent = nullptr; - } - } else if ((m_pCurrent->m_width != _width) || - (m_pCurrent->m_size < _size) || - (m_pCurrent->m_scale != scaleX)) { - removeBuffer(m_pCurrent->m_startAddress); - m_pCurrent = nullptr; - } else { - m_pCurrent->m_resolved = false; - gfxContext.bindFramebuffer(bufferTarget::FRAMEBUFFER, m_pCurrent->m_FBO); - if (m_pCurrent->m_size != _size) { - f32 fillColor[4]; - gDPGetFillColor(fillColor); - wnd.getDrawer().clearColorBuffer(fillColor); - m_pCurrent->m_size = _size; - m_pCurrent->m_pTexture->format = _format; - m_pCurrent->m_pTexture->size = _size; - if (m_pCurrent->m_pResolveTexture != nullptr) { - m_pCurrent->m_pResolveTexture->format = _format; - m_pCurrent->m_pResolveTexture->size = _size; - } - if (m_pCurrent->m_copiedToRdram) - m_pCurrent->copyRdram(); - } - } - } - const bool bNew = m_pCurrent == nullptr; - if (bNew) { - // Wasn't found or removed, create a new one - m_list.emplace_front(); - FrameBuffer & buffer = m_list.front(); - buffer.init(_address, _format, _size, _width, _cfb); - m_pCurrent = &buffer; - RDRAMtoColorBuffer::get().copyFromRDRAM(m_pCurrent); - if (_cfb) - m_pCurrent->copyRdram(); - } - - if (_address == gDP.depthImageAddress) - depthBufferList().saveBuffer(_address); - else - attachDepthBuffer(); - - DebugMsg( DEBUG_NORMAL, "FrameBuffer_SaveBuffer( 0x%08X )\n", _address); - - if (m_pCurrent->isAuxiliary() && - m_pCurrent->m_pDepthBuffer != nullptr && - bPrevIsDepth && - (config.generalEmulation.hacks&hack_LoadDepthTextures) == 0) { - // N64 games may use partial depth buffer clear for aux buffers - // It will not work for GL, so we have to force clear depth buffer for aux buffer - wnd.getDrawer().clearDepthBuffer(); - } - - m_pCurrent->m_isDepthBuffer = _address == gDP.depthImageAddress; - m_pCurrent->m_isPauseScreen = m_pCurrent->m_isOBScreen = false; - m_pCurrent->m_copied = false; - m_pCurrent->m_swapCount = wnd.getBuffersSwapCount(); -} - -void FrameBufferList::copyAux() -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - if (iter->isAuxiliary()) - FrameBuffer_CopyToRDRAM(iter->m_startAddress, true); - } -} - -void FrameBufferList::removeAux() -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - while (iter->isAuxiliary()) { - if (&(*iter) == m_pCurrent) { - m_pCurrent = nullptr; - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - } - iter = m_list.erase(iter); - if (iter == m_list.end()) - return; - } - } -} - -void FrameBufferList::removeBuffer(u32 _address ) -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) - if (iter->m_startAddress == _address) { - if (&(*iter) == m_pCurrent) { - m_pCurrent = nullptr; - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - } - m_list.erase(iter); - return; - } -} - -void FrameBufferList::removeBuffers(u32 _width) -{ - m_pCurrent = nullptr; - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - while (iter->m_width == _width) { - if (&(*iter) == m_pCurrent) { - m_pCurrent = nullptr; - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - } - iter = m_list.erase(iter); - if (iter == m_list.end()) - return; - } - } -} - -void FrameBufferList::depthBufferCopyRdram() -{ - FrameBuffer * pCurrentDepthBuffer = findBuffer(gDP.depthImageAddress); - if (pCurrentDepthBuffer != nullptr) - pCurrentDepthBuffer->copyRdram(); -} - -void FrameBufferList::fillBufferInfo(void * _pinfo, u32 _size) -{ - FBInfo::FrameBufferInfo* pInfo = reinterpret_cast(_pinfo); - - u32 idx = 0; - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - if (iter->m_width == VI.width && !iter->m_cfb && !iter->m_isDepthBuffer) { - pInfo[idx].addr = iter->m_startAddress; - pInfo[idx].width = iter->m_width; - pInfo[idx].height = iter->m_height; - pInfo[idx++].size = iter->m_size; - if (idx >= _size) - return; - } - } -} - -void FrameBufferList::attachDepthBuffer() -{ - FrameBuffer * pCurrent = config.frameBufferEmulation.enable == 0 ? &m_list.back() : m_pCurrent; - if (pCurrent == nullptr) - return; - - DepthBuffer * pDepthBuffer = depthBufferList().getCurrent(); - - if (pCurrent->m_FBO.isNotNull() && pDepthBuffer != nullptr) { - pDepthBuffer->initDepthImageTexture(pCurrent); - pDepthBuffer->initDepthBufferTexture(pCurrent); - - bool goodDepthBufferTexture = false; - if (Context::DepthFramebufferTextures) { - if (Context::WeakBlitFramebuffer) - goodDepthBufferTexture = pDepthBuffer->m_pDepthBufferTexture->width == pCurrent->m_pTexture->width; - else - goodDepthBufferTexture = pDepthBuffer->m_pDepthBufferTexture->width >= pCurrent->m_pTexture->width || - std::abs(static_cast(pCurrent->m_width) - static_cast(pDepthBuffer->m_width)) < 2; - } else { - goodDepthBufferTexture = pDepthBuffer->m_depthRenderbufferWidth == pCurrent->m_pTexture->width; - } - - if (goodDepthBufferTexture) { - pCurrent->m_pDepthBuffer = pDepthBuffer; - pDepthBuffer->setDepthAttachment(pCurrent->m_FBO, bufferTarget::DRAW_FRAMEBUFFER); - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) - pDepthBuffer->bindDepthImageTexture(pCurrent->m_FBO); - } else - pCurrent->m_pDepthBuffer = nullptr; - } else - pCurrent->m_pDepthBuffer = nullptr; - - assert(!gfxContext.isFramebufferError()); -} - -void FrameBufferList::clearDepthBuffer(DepthBuffer * _pDepthBuffer) -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - if (iter->m_pDepthBuffer == _pDepthBuffer) { - iter->m_pDepthBuffer = nullptr; - } - } -} - -void FrameBuffer_Init() -{ - frameBufferList().init(); - if (config.frameBufferEmulation.enable != 0) { - ColorBufferToRDRAM::get().init(); - DepthBufferToRDRAM::get().init(); - RDRAMtoColorBuffer::get().init(); - } -} - -void FrameBuffer_Destroy() -{ - RDRAMtoColorBuffer::get().destroy(); - DepthBufferToRDRAM::get().destroy(); - ColorBufferToRDRAM::get().destroy(); - frameBufferList().destroy(); -} - -void FrameBufferList::_renderScreenSizeBuffer() -{ - if (m_list.empty()) - return; - - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - FrameBuffer *pBuffer = &m_list.back(); - PostProcessor & postProcessor = PostProcessor::get(); - FrameBuffer * pFilteredBuffer = pBuffer; - for (const auto & f : postProcessor.getPostprocessingList()) - pFilteredBuffer = f(postProcessor, pFilteredBuffer); - CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture; - - const u32 wndWidth = wnd.getWidth(); - const u32 wndHeight = wnd.getHeight(); - s32 srcCoord[4] = { 0, 0, static_cast(wndWidth), static_cast(wndHeight) }; - - const u32 screenWidth = wnd.getScreenWidth(); - const u32 screenHeight = wnd.getScreenHeight(); - const u32 wndHeightOffset = wnd.getHeightOffset(); - const s32 hOffset = (screenWidth - wndWidth) / 2; - const s32 vOffset = (screenHeight - wndHeight) / 2 + wndHeightOffset; - s32 dstCoord[4] = { hOffset, vOffset, hOffset + static_cast(wndWidth), vOffset + static_cast(wndHeight) }; - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); - - GraphicsDrawer::BlitOrCopyRectParams blitParams; - blitParams.srcX0 = srcCoord[0]; - blitParams.srcY0 = srcCoord[3]; - blitParams.srcX1 = srcCoord[2]; - blitParams.srcY1 = srcCoord[1]; - blitParams.srcWidth = wndWidth; - blitParams.srcHeight = wndHeight; - blitParams.dstX0 = dstCoord[0]; - blitParams.dstY0 = dstCoord[1]; - blitParams.dstX1 = dstCoord[2]; - blitParams.dstY1 = dstCoord[3]; - blitParams.dstWidth = screenWidth; - blitParams.dstHeight = screenHeight + wndHeightOffset; - const bool downscale = blitParams.srcWidth >= blitParams.dstWidth || blitParams.srcHeight >= blitParams.dstHeight; - blitParams.filter = downscale || config.generalEmulation.enableHybridFilter > 0 ? - textureParameters::FILTER_LINEAR : - textureParameters::FILTER_NEAREST; //upscale; hybridFilter disabled - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.tex[0] = pBufferTexture; - blitParams.combiner = downscale ? CombinerInfo::get().getTexrectDownscaleCopyProgram() : - CombinerInfo::get().getTexrectUpscaleCopyProgram(); - blitParams.readBuffer = pFilteredBuffer->m_FBO; - - drawer.blitOrCopyTexturedRect(blitParams); - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - wnd.swapBuffers(); - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, pBuffer->m_FBO); - if (config.frameBufferEmulation.forceDepthBufferClear != 0) { - drawer.clearDepthBuffer(); - } - gDP.changed |= CHANGED_SCISSOR; -} - -void FrameBufferList::RdpUpdate::init() -{ - oldvstart = 0U; - prevvicurrent = 0U; - prevwasblank = false; - prevserrate = false; - oldlowerfield = false; - emucontrolsvicurrent = -1; -} - -/* This function was taken from angrylion's code and adopted for my needs */ -bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result) -{ - static const s32 PRESCALE_WIDTH = 640U; - static const s32 PRESCALE_HEIGHT = 625U; - - const s32 x_add = _SHIFTR(*REG.VI_X_SCALE, 0, 12); - const s32 y_add = _SHIFTR(*REG.VI_Y_SCALE, 0, 12); - const u32 v_sync = _SHIFTR(*REG.VI_V_SYNC, 0, 10); - const bool ispal = (v_sync > 550); - const s32 x1 = _SHIFTR( *REG.VI_H_START, 16, 10 ); - const s32 y1 = _SHIFTR( *REG.VI_V_START, 16, 10 ); - const s32 x2 = _SHIFTR( *REG.VI_H_START, 0, 10 ); - const s32 y2 = _SHIFTR( *REG.VI_V_START, 0, 10 ); - - const s32 delta_x = x2 - x1; - const s32 delta_y = y2 - y1; - const u32 vitype = _SHIFTR( *REG.VI_STATUS, 0, 2 ); - - const bool serration_pulses = (*REG.VI_STATUS & VI_STATUS_SERRATE_ENABLED) != 0; - const bool validinterlace = ((vitype & 2) != 0 ) && serration_pulses; - if (validinterlace && prevserrate && emucontrolsvicurrent < 0) - emucontrolsvicurrent = (*REG.VI_V_CURRENT_LINE & 1) != prevvicurrent ? 1 : 0; - - bool lowerfield = 0; - if (validinterlace) { - if (emucontrolsvicurrent == 1) - lowerfield = (*REG.VI_V_CURRENT_LINE & 1) == 0; - else if (!emucontrolsvicurrent) { - if (y1 == oldvstart) - lowerfield = !oldlowerfield; - else - lowerfield = y1 < oldvstart; - } - } - - oldlowerfield = lowerfield; - - if (validinterlace) { - prevserrate = true; - prevvicurrent = *REG.VI_V_CURRENT_LINE & 1; - oldvstart = y1; - } else - prevserrate = false; - - s32 hres = delta_x; - s32 vres = delta_y; - s32 h_start = x1 - (ispal ? 128 : 108); - s32 v_start = (y1 - (ispal ? 44 : 34)) / 2; - s32 x_start = _SHIFTR(*REG.VI_X_SCALE, 16, 12); - s32 y_start = _SHIFTR(*REG.VI_Y_SCALE, 16, 12); - - bool h_start_clamped = h_start < 0; - if (h_start < 0) { - x_start -= x_add * h_start; - hres += h_start; - - h_start = 0; - } - - if (v_start < 0) { - y_start += (y_add * (-v_start)); - v_start = 0; - } - - vres >>= 1; - - const bool hres_clamped = hres + h_start > PRESCALE_WIDTH; - if (hres_clamped) - hres = PRESCALE_WIDTH - h_start; - if (vres + v_start > PRESCALE_HEIGHT) - vres = PRESCALE_HEIGHT - v_start; - - s32 vactivelines = static_cast(v_sync - (ispal ? 44 : 34)); - if (vactivelines > PRESCALE_HEIGHT) { - LOG(LOG_VERBOSE, "VI_V_SYNC_REG too big"); - return false; - } - - if (vactivelines < 0) { - LOG(LOG_VERBOSE, "vactivelines lesser than 0"); - return false; - } - - if (hres <= 0 || vres <= 0 || ((vitype & 2) == 0 && prevwasblank)) /* early return. */ - return false; - - if ((vitype & 2) == 0) { - prevwasblank = true; - return false; - } - - prevwasblank = false; - - _result.vi_hres = static_cast(hres); - _result.vi_vres = static_cast(vres); - _result.vi_ispal = ispal; - _result.vi_h_start = static_cast(h_start); - _result.vi_v_start = static_cast(v_start); - _result.vi_x_start = static_cast(x_start); - _result.vi_y_start = static_cast(y_start); - _result.vi_x_add = static_cast(x_add); - _result.vi_y_add = static_cast(y_add); - _result.vi_minhpass = h_start_clamped ? 0 : 8; - _result.vi_maxhpass = hres_clamped ? 0 : 7; - _result.vi_width = _SHIFTR(*REG.VI_WIDTH, 0, 12); - _result.vi_lowerfield = lowerfield; - _result.vi_origin = _SHIFTR(*REG.VI_ORIGIN, 0, 24); - _result.vi_fsaa = (*REG.VI_STATUS & 512) == 0; - _result.vi_divot = (*REG.VI_STATUS & VI_STATUS_DIVOT_ENABLED) != 0; - return true; - -#if 0 - { - int pixels; - int prevy, y_start; - int cur_x, line_x; - register int i; - const int VI_width = *GET_GFX_INFO(VI_WIDTH) & 0x00000FFF; - const int x_add = *GET_GFX_INFO(VI_X_SCALE) & 0x00000FFF; - const int y_add = *GET_GFX_INFO(VI_Y_SCALE) & 0x00000FFF; - - y_start = *GET_GFX_INFO(VI_Y_SCALE) >> 16 & 0x0FFF; - - //while (--vres >= 0) - { - x_start = *GET_GFX_INFO(VI_X_SCALE) >> 16 & 0x0FFF; - prescale_ptr += line_count; - - prevy = y_start >> 10; - pixels = VI_width * prevy; - - //for (i = 0; i < hres; i++) - { - unsigned long pix; - unsigned long addr; - - line_x = x_start >> 10; - cur_x = pixels + line_x; - - x_start += x_add; - addr = frame_buffer + 4 * cur_x; - pix = *(int32_t *)(RDRAM + addr); - } - y_start += y_add; - } - } -#endif -} - -s32 FrameBufferList::OverscanBuffer::getHOffset() const -{ - if (m_enabled) - return 0; - - return m_hOffset; -} - -s32 FrameBufferList::OverscanBuffer::getVOffset() const -{ - if (m_enabled) - return 0; - - return m_vOffset; -} - -f32 FrameBufferList::OverscanBuffer::getScaleX() const -{ - if (m_enabled) - return m_scale; - return dwnd().getScaleX(); -} - -f32 FrameBufferList::OverscanBuffer::getScaleY(u32 _fullHeight) const -{ - if (m_enabled) - return m_scale; - - return static_cast(dwnd().getHeight()) / static_cast(_fullHeight); -} - -void FrameBufferList::OverscanBuffer::init() -{ - m_enabled = config.frameBufferEmulation.enableOverscan != 0; - if (m_enabled) - m_FBO = gfxContext.createFramebuffer(); - - DisplayWindow & wnd = dwnd(); - m_hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2; - m_vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2; - m_scale = wnd.getScaleX(); - m_drawingWidth = wnd.getWidth(); - m_bufferWidth = wnd.getScreenWidth(); - m_bufferHeight = wnd.getScreenHeight() + wnd.getHeightOffset(); -} - -void FrameBufferList::OverscanBuffer::destroy() -{ - gfxContext.deleteFramebuffer(m_FBO); - m_FBO = graphics::ObjectHandle::null; - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = nullptr; - textureCache().removeFrameBufferTexture(m_pDepthTexture); - m_pDepthTexture = nullptr; -#if defined(OS_WINDOWS) - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - gfxContext.clearDepthBuffer(); -#endif -} - -void FrameBufferList::OverscanBuffer::setInputBuffer(const FrameBuffer * _pBuffer) -{ - if (!m_enabled) { - return; - } - - if (m_pTexture != nullptr && - m_pTexture->width == _pBuffer->m_pTexture->width && - m_pTexture->height == _pBuffer->m_pTexture->height && - m_scale == _pBuffer->m_scale) { - return; - } - - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - const CachedTexture * pSrcTexture = _pBuffer->m_pTexture; - _initFrameBufferTexture(0, - _pBuffer->m_width, - VI_GetMaxBufferHeight(_pBuffer->m_width), - _pBuffer->m_scale, - pSrcTexture->format, - pSrcTexture->size, - m_pTexture); - _setAndAttachBufferTexture(m_FBO, m_pTexture, 0, false); - m_scale = _pBuffer->m_scale; - m_drawingWidth = m_bufferWidth = m_pTexture->width; - m_bufferHeight = m_pTexture->height; - - if (config.frameBufferEmulation.copyDepthToMainDepthBuffer == 0) - return; - - // Init depth texture - textureCache().removeFrameBufferTexture(m_pDepthTexture); - m_pDepthTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - DepthBuffer::_initDepthBufferTexture(_pBuffer, m_pDepthTexture, false); - Context::FrameBufferRenderTarget params; - params.attachment = bufferAttachment::DEPTH_ATTACHMENT; - params.bufferHandle = m_FBO; - params.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - params.textureHandle = m_pDepthTexture->name; - params.textureTarget = textureTarget::TEXTURE_2D; - gfxContext.addFrameBufferRenderTarget(params); -} - -void FrameBufferList::OverscanBuffer::activate() -{ - if (!m_enabled) { - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - return; - } - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_FBO); -} - -void FrameBufferList::OverscanBuffer::draw(u32 _fullHeight, bool _PAL) -{ - if (!m_enabled) - return; - - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); -#if defined(OS_WINDOWS) - gfxContext.clearDepthBuffer(); -#endif - GraphicsDrawer::BlitOrCopyRectParams blitParams; - const auto & overscan = _PAL ? config.frameBufferEmulation.overscanPAL : config.frameBufferEmulation.overscanNTSC; - const s32 left = static_cast(overscan.left * m_scale); - const s32 right = static_cast(overscan.right * m_scale); - const s32 top = static_cast(overscan.top * m_scale); - const s32 bottom = static_cast(overscan.bottom * m_scale); - blitParams.srcX0 = left; - blitParams.srcY0 = static_cast(_fullHeight * m_scale) - bottom; - blitParams.srcX1 = static_cast(m_bufferWidth) - right; - blitParams.srcY1 = top; - blitParams.srcWidth = m_pTexture->width; - blitParams.srcHeight = m_pTexture->height; - blitParams.dstX0 = m_hOffset; - blitParams.dstY0 = m_vOffset + static_cast(wnd.getHeightOffset()); - blitParams.dstX1 = m_hOffset + static_cast(wnd.getWidth()); - blitParams.dstY1 = m_vOffset + static_cast(wnd.getHeight() + wnd.getHeightOffset()); - blitParams.dstWidth = wnd.getScreenWidth(); - blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset(); - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.tex[0] = m_pTexture; - const bool downscale = blitParams.srcWidth >= blitParams.dstWidth || blitParams.srcHeight >= blitParams.dstHeight; - blitParams.filter = downscale || config.generalEmulation.enableHybridFilter > 0 ? - textureParameters::FILTER_LINEAR : - textureParameters::FILTER_NEAREST; //upscale; hybridFilter disabled - if (config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0) { - blitParams.tex[1] = m_pDepthTexture; - blitParams.combiner = downscale ? CombinerInfo::get().getTexrectColorAndDepthDownscaleCopyProgram() : - CombinerInfo::get().getTexrectColorAndDepthUpscaleCopyProgram(); - } - if (blitParams.combiner == nullptr) { - // copyDepthToMainDepthBuffer not set or not supported - blitParams.combiner = downscale ? CombinerInfo::get().getTexrectDownscaleCopyProgram() : - CombinerInfo::get().getTexrectUpscaleCopyProgram(); - } - - blitParams.readBuffer = m_FBO; - blitParams.invertY = false; - - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); -// drawer.blitOrCopyTexturedRect(blitParams); - drawer.copyTexturedRect(blitParams); -} - -void FrameBufferList::renderBuffer() -{ - if (g_debugger.isDebugMode()) { - g_debugger.draw(); - return; - } - - if (config.frameBufferEmulation.enable == 0) { - _renderScreenSizeBuffer(); - return; - } - - RdpUpdateResult rdpRes; - if (!m_rdpUpdate.update(rdpRes)) { - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); - dwnd().swapBuffers(); - if (m_pCurrent != nullptr) - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pCurrent->m_FBO); - return; - } - - FrameBuffer *pBuffer = findBuffer(rdpRes.vi_origin); - if (pBuffer == nullptr) - return; - pBuffer->m_isMainBuffer = true; - m_overscan.setInputBuffer(pBuffer); - - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - s32 srcY0, srcY1; - s32 dstX0, dstX1, dstY0, dstY1; - s32 srcWidth, srcHeight; - s32 XoffsetLeft = 0, XoffsetRight = 0; - s32 srcPartHeight = 0; - s32 dstPartHeight = 0; - - dstY0 = static_cast(rdpRes.vi_v_start); - - const u32 vFullHeight = rdpRes.vi_ispal ? 288 : 240; - const f32 dstScaleY = m_overscan.getScaleY(vFullHeight); - - const u32 addrOffset = ((rdpRes.vi_origin - pBuffer->m_startAddress) << 1 >> pBuffer->m_size); - srcY0 = static_cast(addrOffset / pBuffer->m_width); - if ((addrOffset != 0) && (pBuffer->m_width == addrOffset * 2)) - srcY0 = 1; - - if ((rdpRes.vi_width != addrOffset * 2) && (addrOffset % rdpRes.vi_width != 0)) - XoffsetRight = static_cast(rdpRes.vi_width - addrOffset % rdpRes.vi_width); - if (XoffsetRight == static_cast(pBuffer->m_width)) { - XoffsetRight = 0; - } else if (XoffsetRight > static_cast(pBuffer->m_width / 2)) { - XoffsetRight = 0; - XoffsetLeft = static_cast(addrOffset % rdpRes.vi_width); - } - - if (!rdpRes.vi_lowerfield) { - if (srcY0 > 0 && (pBuffer->m_width > 320 || pBuffer->m_height > 240)) - --srcY0; - if (dstY0 > 0) - --dstY0; - } - - if ((config.generalEmulation.hacks & hack_LodeRunner) != 0) { - srcY0 = 1; - XoffsetRight = XoffsetLeft = 0; - } - - srcWidth = static_cast(min(rdpRes.vi_width, (rdpRes.vi_hres * rdpRes.vi_x_add) >> 10)); - srcHeight = static_cast(rdpRes.vi_width * ((rdpRes.vi_vres*rdpRes.vi_y_add + rdpRes.vi_y_start) >> 10) / pBuffer->m_width); - - const u32 stride = pBuffer->m_width << pBuffer->m_size >> 1; - FrameBuffer *pNextBuffer = findBuffer(rdpRes.vi_origin + stride * min(u32(srcHeight) - 1, pBuffer->m_height - 1) - 1); - if (pNextBuffer == pBuffer) - pNextBuffer = nullptr; - - if (pNextBuffer != nullptr) { - dstPartHeight = srcY0; - srcPartHeight = srcY0; - srcY1 = srcHeight; - dstY1 = dstY0 + static_cast(rdpRes.vi_vres) - dstPartHeight; - } else { - dstY1 = dstY0 + static_cast(rdpRes.vi_vres); - srcY1 = srcY0 + srcHeight; - } - PostProcessor & postProcessor = PostProcessor::get(); - FrameBuffer * pFilteredBuffer = pBuffer; - for (const auto & f : postProcessor.getPostprocessingList()) - pFilteredBuffer = f(postProcessor, pFilteredBuffer); - - const f32 viScaleX = _FIXED2FLOAT(_SHIFTR(*REG.VI_X_SCALE, 0, 12), 10); - const f32 srcScaleX = pFilteredBuffer->m_scale; - const f32 dstScaleX = m_overscan.getDrawingWidth() / (640 * viScaleX); - const s32 hx0 = static_cast(rdpRes.vi_h_start + rdpRes.vi_minhpass); - const s32 h0 = (rdpRes.vi_ispal ? 128 : 108); - const s32 hEnd = _SHIFTR(*REG.VI_H_START, 0, 10); - const s32 hx1 = max(0, h0 + 640 - hEnd + static_cast(rdpRes.vi_maxhpass)); - //const s32 hx1 = hx0 + rdpRes.vi_hres; - dstX0 = static_cast((hx0 * viScaleX + f32(XoffsetRight)) * dstScaleX); - dstX1 = static_cast(m_overscan.getDrawingWidth()) - static_cast(hx1 * viScaleX * dstScaleX); - - const f32 srcScaleY = pFilteredBuffer->m_scale; - CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture; - const s32 cutleft = static_cast(rdpRes.vi_minhpass * viScaleX * srcScaleX); - const s32 cutright = static_cast(rdpRes.vi_maxhpass * viScaleX * srcScaleX); - s32 srcCoord[4] = { static_cast((XoffsetLeft) * srcScaleX) + cutleft, - static_cast(srcY0*srcScaleY), - static_cast((srcWidth + XoffsetLeft - XoffsetRight) * srcScaleX) - cutright, - min(static_cast(srcY1*srcScaleY), static_cast(pBufferTexture->height)) }; - if (srcCoord[2] > pBufferTexture->width || srcCoord[3] > pBufferTexture->height) { - removeBuffer(pBuffer->m_startAddress); - return; - } - - const s32 hOffset = m_overscan.getHOffset(); - const s32 vOffset = m_overscan.getVOffset(); - s32 dstCoord[4] = { dstX0 + hOffset, - vOffset + static_cast(dstY0*dstScaleY), - hOffset + dstX1, - vOffset + static_cast(dstY1*dstScaleY) }; - - ObjectHandle readBuffer; - - if (pFilteredBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) { - pFilteredBuffer->resolveMultisampledTexture(true); - readBuffer = pFilteredBuffer->m_resolveFBO; - pBufferTexture = pFilteredBuffer->m_pResolveTexture; - } else { - readBuffer = pFilteredBuffer->m_FBO; - } - - m_overscan.activate(); - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); -#if defined(OS_WINDOWS) - gfxContext.clearDepthBuffer(); -#endif - - GraphicsDrawer::BlitOrCopyRectParams blitParams; - blitParams.srcX0 = srcCoord[0]; - blitParams.srcY0 = srcCoord[1]; - blitParams.srcX1 = srcCoord[2]; - blitParams.srcY1 = srcCoord[3]; - blitParams.srcWidth = pBufferTexture->width; - blitParams.srcHeight = pBufferTexture->height; - blitParams.dstX0 = dstCoord[0]; - blitParams.dstY0 = dstCoord[1]; - blitParams.dstX1 = dstCoord[2]; - blitParams.dstY1 = dstCoord[3]; - blitParams.dstWidth = m_overscan.getBufferWidth(); - blitParams.dstHeight = m_overscan.getBufferHeight(); - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.tex[0] = pBufferTexture; - const bool downscale = blitParams.srcWidth >= blitParams.dstWidth || blitParams.srcHeight >= blitParams.dstHeight; - blitParams.filter = downscale || config.generalEmulation.enableHybridFilter > 0 ? - textureParameters::FILTER_LINEAR : - textureParameters::FILTER_NEAREST; //upscale; hybridFilter disabled - if (config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0) { - blitParams.tex[1] = pBuffer->m_pDepthTexture; - blitParams.combiner = downscale ? CombinerInfo::get().getTexrectColorAndDepthDownscaleCopyProgram() : - CombinerInfo::get().getTexrectColorAndDepthUpscaleCopyProgram(); - } - if (blitParams.combiner == nullptr) { - // copyDepthToMainDepthBuffer not set or not supported - blitParams.combiner = downscale ? CombinerInfo::get().getTexrectDownscaleCopyProgram() : - CombinerInfo::get().getTexrectUpscaleCopyProgram(); - } - blitParams.readBuffer = readBuffer; - blitParams.invertY = config.frameBufferEmulation.enableOverscan == 0; - - drawer.copyTexturedRect(blitParams); - - if (pNextBuffer != nullptr) { - pNextBuffer->m_isMainBuffer = true; - pFilteredBuffer = pNextBuffer; - for (const auto & f : postProcessor.getPostprocessingList()) - pFilteredBuffer = f(postProcessor, pFilteredBuffer); - srcY1 = srcPartHeight; - dstY0 = dstY1; - dstY1 = dstY0 + dstPartHeight; - if (pFilteredBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) { - pFilteredBuffer->resolveMultisampledTexture(); - readBuffer = pFilteredBuffer->m_resolveFBO; - pBufferTexture = pFilteredBuffer->m_pResolveTexture; - } else { - readBuffer = pFilteredBuffer->m_FBO; - pBufferTexture = pFilteredBuffer->m_pTexture; - } - - blitParams.srcY0 = 0; - blitParams.srcY1 = min(static_cast(srcY1*srcScaleY), static_cast(pFilteredBuffer->m_pTexture->height)); - blitParams.srcWidth = pBufferTexture->width; - blitParams.srcHeight = pBufferTexture->height; - blitParams.dstY0 = vOffset + static_cast(dstY0*dstScaleY); - blitParams.dstY1 = vOffset + static_cast(dstY1*dstScaleY); - blitParams.dstWidth = m_overscan.getBufferWidth(); - blitParams.dstHeight = m_overscan.getBufferHeight(); - blitParams.tex[0] = pBufferTexture; - blitParams.tex[1] = pNextBuffer->m_pDepthTexture; - blitParams.mask = blitMask::COLOR_BUFFER; - blitParams.readBuffer = readBuffer; - - drawer.copyTexturedRect(blitParams); - } - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - m_overscan.draw(vFullHeight, rdpRes.vi_ispal); - - wnd.swapBuffers(); - if (m_pCurrent != nullptr) { - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pCurrent->m_FBO); - } - if (config.frameBufferEmulation.forceDepthBufferClear != 0) { - drawer.clearDepthBuffer(); - } - - const s32 X = hOffset; - const s32 Y = static_cast(wnd.getHeightOffset()); - const s32 W = static_cast(wnd.getWidth()); - const s32 H = static_cast(wnd.getHeight()); - - gfxContext.setScissor(X, Y, W, H); - gDP.changed |= CHANGED_SCISSOR; -} - -void FrameBufferList::fillRDRAM(s32 ulx, s32 uly, s32 lrx, s32 lry) -{ - if (m_pCurrent == nullptr) - return; - - if (config.frameBufferEmulation.copyFromRDRAM !=0 && !m_pCurrent->m_isDepthBuffer) - // Do not write to RDRAM color buffer if copyFromRDRAM enabled. - return; - - ulx = static_cast(min(max(static_cast(ulx), gDP.scissor.ulx), gDP.scissor.lrx)); - lrx = static_cast(min(max(static_cast(lrx), gDP.scissor.ulx), gDP.scissor.lrx)); - uly = static_cast(min(max(static_cast(uly), gDP.scissor.uly), gDP.scissor.lry)); - lry = static_cast(min(max(static_cast(lry), gDP.scissor.uly), gDP.scissor.lry)); - - const u32 stride = gDP.colorImage.width << gDP.colorImage.size >> 1; - const u32 lowerBound = gDP.colorImage.address + static_cast(lry)*stride; - if (lowerBound > RDRAMSize) - lry -= (lowerBound - RDRAMSize) / stride; - u32 ci_width_in_dwords = gDP.colorImage.width >> (3 - gDP.colorImage.size); - ulx >>= (3 - gDP.colorImage.size); - lrx >>= (3 - gDP.colorImage.size); - u32 * dst = reinterpret_cast(RDRAM + gDP.colorImage.address); - dst += static_cast(uly) * ci_width_in_dwords; - if (!isMemoryWritable(dst, lowerBound - gDP.colorImage.address)) - return; - for (s32 y = uly; y < lry; ++y) { - for (s32 x = ulx; x < lrx; ++x) { - dst[x] = gDP.fillColor.color; - } - dst += ci_width_in_dwords; - } - - m_pCurrent->setBufferClearParams(gDP.fillColor.color, ulx, uly, lrx, lry); -} - -void FrameBuffer_ActivateBufferTexture(u32 t, u32 _frameBufferAddress) -{ - FrameBuffer * pBuffer = frameBufferList().getBuffer(_frameBufferAddress); - if (pBuffer == nullptr) - return; - - CachedTexture *pTexture = pBuffer->getTexture(t); - if (pTexture == nullptr) - return; - -// frameBufferList().renderBuffer(pBuffer->m_startAddress); - textureCache().activateTexture(t, pTexture); - gDP.changed |= CHANGED_FB_TEXTURE; -} - -void FrameBuffer_ActivateBufferTextureBG(u32 t, u32 _frameBufferAddress) -{ - FrameBuffer * pBuffer = frameBufferList().getBuffer(_frameBufferAddress); - if (pBuffer == nullptr) - return; - - CachedTexture *pTexture = pBuffer->getTextureBG(); - if (pTexture == nullptr) - return; - -// frameBufferList().renderBuffer(pBuffer->m_startAddress); - textureCache().activateTexture(t, pTexture); - gDP.changed |= CHANGED_FB_TEXTURE; -} - -void FrameBuffer_CopyToRDRAM(u32 _address, bool _sync) -{ - ColorBufferToRDRAM::get().copyToRDRAM(_address, _sync); -} - -void FrameBuffer_CopyChunkToRDRAM(u32 _address) -{ - ColorBufferToRDRAM::get().copyChunkToRDRAM(_address); -} - -bool FrameBuffer_CopyDepthBuffer( u32 address ) -{ - FrameBufferList & fblist = frameBufferList(); - FrameBuffer * pCopyBuffer = fblist.getCopyBuffer(); - if (pCopyBuffer != nullptr) { - // This code is mainly to emulate Zelda MM camera. - ColorBufferToRDRAM::get().copyToRDRAM(pCopyBuffer->m_startAddress, true); - pCopyBuffer->m_RdramCopy.resize(0); // To disable validity check by RDRAM content. CPU may change content of the buffer for some unknown reason. - fblist.setCopyBuffer(nullptr); - return true; - } - - if (DepthBufferToRDRAM::get().copyToRDRAM(address)) { - fblist.depthBufferCopyRdram(); - return true; - } - - return false; -} - -bool FrameBuffer_CopyDepthBufferChunk(u32 address) -{ - return DepthBufferToRDRAM::get().copyChunkToRDRAM(address); -} - -void FrameBuffer_CopyFromRDRAM(u32 _address, bool _bCFB) -{ - RDRAMtoColorBuffer::get().copyFromRDRAM(_address, _bCFB); -} - -void FrameBuffer_AddAddress(u32 address, u32 _size) -{ - RDRAMtoColorBuffer::get().addAddress(address, _size); -} - -u32 cutHeight(u32 _address, u32 _height, u32 _stride) -{ - return _cutHeight(_address, _height, _stride); -} - -void calcCoordsScales(const FrameBuffer * _pBuffer, f32 & _scaleX, f32 & _scaleY) -{ - const u32 bufferWidth = _pBuffer != nullptr ? _pBuffer->m_width : VI.width; - const u32 bufferHeight = VI_GetMaxBufferHeight(static_cast(bufferWidth)); - _scaleX = 1.0f / f32(bufferWidth); - _scaleY = 1.0f / f32(bufferHeight); -} diff --git a/GLideN64/src/FrameBuffer.h b/GLideN64/src/FrameBuffer.h deleted file mode 100644 index 6e06dae..0000000 --- a/GLideN64/src/FrameBuffer.h +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef FRAMEBUFFER_H -#define FRAMEBUFFER_H - -#include -#include -#include - -#include "gDP.h" -#include "Textures.h" -#include "Graphics/ObjectHandle.h" - -struct gDPTile; -struct DepthBuffer; - -const u32 fingerprint[4] = { 2, 6, 4, 3 }; - -namespace graphics { - class ColorBufferReader; -} - -struct FrameBuffer -{ - FrameBuffer(); - ~FrameBuffer(); - void init(u32 _address, u16 _format, u16 _size, u16 _width, bool _cfb); - void updateEndAddress(); - void resolveMultisampledTexture(bool _bForce = false); - void copyDepthTexture(); - CachedTexture * getTexture(u32 _t); - CachedTexture * getTextureBG(); - void setBufferClearParams(u32 _fillcolor, s32 _ulx, s32 _uly, s32 _lrx, s32 _lry); - void copyRdram(); - void setDirty(); - bool isValid(bool _forceCheck) const; - bool isAuxiliary() const; - CachedTexture * getColorFbTexture(); - graphics::ObjectHandle getColorFbFbo(); - const u8 * readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync); - void cleanUp(); - - u32 m_startAddress = 0; - u32 m_endAddress = 0; - u32 m_size = 0; - u32 m_width = 0; - u32 m_height = 0; - u32 m_originX = 0; - u32 m_originY = 0; - u32 m_swapCount = 0; - float m_scale = 0.0f; - bool m_copiedToRdram = false; - bool m_fingerprint = false; - bool m_cleared = false; - bool m_changed = false; - bool m_cfb = false; - bool m_isDepthBuffer = false; - bool m_isPauseScreen = false; - bool m_isOBScreen = false; - bool m_isMainBuffer = false; - bool m_readable = false; - bool m_copied = false; - - struct { - u32 uls = 0; - u32 ult = 0;; - } m_loadTileOrigin; - u32 m_loadType = LOADTYPE_BLOCK; - - graphics::ObjectHandle m_FBO; - CachedTexture *m_pTexture = nullptr; - - graphics::ObjectHandle m_depthFBO; - CachedTexture *m_pDepthTexture = nullptr; - - std::unique_ptr m_bufferReader; - graphics::ObjectHandle m_ColorBufferFBO; - CachedTexture *m_pColorBufferTexture = nullptr; - - DepthBuffer *m_pDepthBuffer = nullptr; - - // multisampling - graphics::ObjectHandle m_resolveFBO; - CachedTexture *m_pResolveTexture = nullptr; - bool m_resolved = false; - - // subtexture - graphics::ObjectHandle m_SubFBO; - CachedTexture *m_pSubTexture = nullptr; - - // copy FBO - graphics::ObjectHandle m_copyFBO; - CachedTexture * m_pFrameBufferCopyTexture = nullptr; - - std::vector m_RdramCopy; - -private: - struct { - u32 fillcolor = 0; - s32 ulx = 0; - s32 uly = 0; - s32 lrx = 0; - s32 lry = 0; - } m_clearParams; - - void _initTexture(u16 _width, u16 _height, u16 _format, u16 _size, CachedTexture *_pTexture); - void _setAndAttachTexture(graphics::ObjectHandle _fbo, CachedTexture *_pTexture, u32 _t, bool _multisampling); - bool _initSubTexture(u32 _t); - void _initCopyTexture(); - CachedTexture * _copyFrameBufferTexture(); - CachedTexture * _getSubTexture(u32 _t); - void _initColorFBTexture(int _width); - void _destroyColorFBTexure(); - - mutable u32 m_validityChecked = false; -}; - -class FrameBufferList -{ -public: - void init(); - void destroy(); - void saveBuffer(u32 _address, u16 _format, u16 _size, u16 _width, bool _cfb); - void removeAux(); - void copyAux(); - void removeBuffer(u32 _address); - void removeBuffers(u32 _width); - void attachDepthBuffer(); - void clearDepthBuffer(DepthBuffer * _pDepthBuffer); - FrameBuffer * findBuffer(u32 _startAddress); - FrameBuffer * getBuffer(u32 _startAddress); - FrameBuffer * findTmpBuffer(u32 _address); - FrameBuffer * getCurrent() const {return m_pCurrent;} - void setCurrent(FrameBuffer * _pCurrent) { m_pCurrent = _pCurrent; } - void updateCurrentBufferEndAddress(); - void renderBuffer(); - void setBufferChanged(f32 _maxY); - void clearBuffersChanged(); - void setCurrentDrawBuffer() const; - void fillRDRAM(s32 ulx, s32 uly, s32 lrx, s32 lry); - - FrameBuffer * getCopyBuffer() const { return m_pCopy; } - void setCopyBuffer(FrameBuffer * _pBuffer) { m_pCopy = _pBuffer; } - void depthBufferCopyRdram(); - - void fillBufferInfo(void * _pinfo, u32 _size); - - static FrameBufferList & get(); - -private: - FrameBufferList() : m_pCurrent(nullptr), m_pCopy(nullptr), m_prevColorImageHeight(0) {} - FrameBufferList(const FrameBufferList &) = delete; - - void removeIntersections(); - - void _createScreenSizeBuffer(); - void _renderScreenSizeBuffer(); - - class OverscanBuffer - { - public: - void init(); - void destroy(); - - void setInputBuffer(const FrameBuffer * _pBuffer); - void activate(); - void draw(u32 _fullHeight, bool _PAL); - - s32 getHOffset() const; - s32 getVOffset() const; - f32 getScaleX() const; - f32 getScaleY(u32 _fullHeight) const; - u32 getDrawingWidth() const { return m_drawingWidth; } - u32 getBufferWidth() const { return m_bufferWidth; } - u32 getBufferHeight() const { return m_bufferHeight; } - - private: - s32 m_hOffset = 0; - s32 m_vOffset = 0; - f32 m_scale = 1.0f; - u32 m_drawingWidth = 0U; - u32 m_bufferWidth = 0U; - u32 m_bufferHeight = 0U; - bool m_enabled = false; - - graphics::ObjectHandle m_FBO; - CachedTexture *m_pTexture = nullptr; - CachedTexture *m_pDepthTexture = nullptr; - }; - - typedef std::list FrameBuffers; - FrameBuffers m_list; - FrameBuffer * m_pCurrent; - FrameBuffer * m_pCopy; - u32 m_prevColorImageHeight; - OverscanBuffer m_overscan; - - struct RdpUpdateResult { - u32 vi_vres; - u32 vi_hres; - u32 vi_v_start; - u32 vi_h_start; - u32 vi_x_start; - u32 vi_y_start; - u32 vi_x_add; - u32 vi_y_add; - u32 vi_width; - u32 vi_origin; - u32 vi_minhpass; - u32 vi_maxhpass; - bool vi_lowerfield; - bool vi_fsaa; - bool vi_divot; - bool vi_ispal; - }; - - class RdpUpdate - { - public: - void init(); - bool update(RdpUpdateResult & _result); - - private: - s32 oldvstart = 0; - u32 prevvicurrent = 0U; - bool prevwasblank = false; - bool prevserrate = false; - bool oldlowerfield = false; - s32 emucontrolsvicurrent = -1; - } m_rdpUpdate; -}; - -inline -FrameBufferList & frameBufferList() -{ - return FrameBufferList::get(); -} - -u32 cutHeight(u32 _address, u32 _height, u32 _stride); -void calcCoordsScales(const FrameBuffer * _pBuffer, f32 & _scaleX, f32 & _scaleY); - -void FrameBuffer_Init(); -void FrameBuffer_Destroy(); -void FrameBuffer_CopyToRDRAM( u32 _address , bool _sync ); -void FrameBuffer_CopyChunkToRDRAM(u32 _address); -void FrameBuffer_CopyFromRDRAM(u32 address, bool bUseAlpha); -void FrameBuffer_AddAddress(u32 address, u32 _size); -bool FrameBuffer_CopyDepthBuffer(u32 address); -bool FrameBuffer_CopyDepthBufferChunk(u32 address); -void FrameBuffer_ActivateBufferTexture(u32 t, u32 _frameBufferAddress); -void FrameBuffer_ActivateBufferTextureBG(u32 t, u32 _frameBufferAddress); - -#endif diff --git a/GLideN64/src/FrameBufferEmulationIssues.txt b/GLideN64/src/FrameBufferEmulationIssues.txt deleted file mode 100644 index 0bc6adf..0000000 --- a/GLideN64/src/FrameBufferEmulationIssues.txt +++ /dev/null @@ -1,111 +0,0 @@ -Ïðîáëåìû ñ ýìóëÿöèåé ôðåéì áóôåðà. - -Zelda MM: -ïðîâåðêà íà òî, ÷òî ñîäåðæèìîå áóôåðà çàïîëíåíî pBuffer->fillcolor îáëàìûâàåòñÿ íà ýêðàíå ïàóçû. -Ïðè÷èíà: Êàäð êîïèðóåòñÿ â áóôåð, êîòîðûé ñ íà÷àëå îòðèñîâêè èñïîëüçóåòñÿ ïîä depth buffer è ÷èñòèòñÿ 0xfffcfffc. -Ïðîãðàììà ìåæäó âûçîâàìè dysplay list ÷òî-òî ñàìà ïèøåò â ýòîò áóôåð (âûñòàâëÿåò alpha â 1), è íà ñëåäóþùåì êàäðå -ïðîâåðêà íå ñðàáàòûâàåò. - -detect fb final results: -rdp.frame_buffers[0].status = ci_main, addr: 00000500, height: 0 -rdp.frame_buffers[1].status = ci_zimg, addr: 00383ac0, height: 240 -rdp.frame_buffers[2].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[3].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[4].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[5].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[6].status = ci_copy, addr: 00383ac0, height: 240 -rdp.frame_buffers[7].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[8].status = ci_aux, addr: 00784600, height: 240 -rdp.frame_buffers[9].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[10].status = ci_main, addr: 00000500, height: 240 -DetectFrameBufferUsage End - -detect fb final results: -rdp.frame_buffers[0].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[1].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[2].status = ci_main, addr: 00000500, height: 240 -rdp.frame_buffers[3].status = ci_main, addr: 00000500, height: 240 -DetectFrameBufferUsage End - -Ðåøåíèå: ïðîâåðÿòü òîëüêî 16áèò áóôåð è áåç àëüôà áèòà. - - -Zelda OOT: -Òà æå ïðîáëåìà ñ ýêðàíîì ïàóçû, ÷òî â Zelda MM -Ê òîìó æå ýêðàí íå ðàáîòàåò åñëè âêëþ÷åí subscreen fix! - - -Mario Tennis: -Scoreboard. Òàáëèöà ñ÷¸òà è äàò÷èê ñêîðîñòè ïîäà÷è âûãëÿäÿò êàê ÷¸ðíûé ôîí ñ òåêñòîì. -Ïðè÷èíà: òåêñòóðû òàáëèöû è äàò÷èêà ãðóçÿòñÿ â ïàìÿòü. Òåêñòà â íèõ íåò, ïóñòûå îáëàñòè. -Ìû âèäèì ýòè òåêñòóðû ïðè îòêëþ÷åííîé ýìóëÿöèè áóôåðà êàäðà. Êîãäà íóæíî îáíîâèòü òåêñò, -èãðà çàâîäèò âñïîìîãàòåëüíûé áóôåð êàäðà ïî àäðåñó, ãäå ëåæèò òåêñòóðà, è ðåíäèò òåêñò â íóæíûõ ìåñòàõ. -Ïîòîì òåêñòóðà ñ òåêñòîì íàêëàäûâàåòñÿ íà ïîëèãîíû òàáëèöû. Òàê êàê àäðåñ áóôåðà ñîâïàäàåò ñ àäðåñîì òåêñòóðû, -áóôåð èñïîëüçóåòñÿ âìåñòî íåå, à â íåì òîëüêî òåêñò. -Ðåøåíèå: ïîñëå îòðèñîâêè êîïèðîâàòü ñîäåðæèìîå áóôåðà îáðàòíî â RDRAM. Íóæíî íàéòè íîðìàëüíîå óñëîâèå äëÿ -îïðåäåëåíèÿ òàêîãî áóôåðà. Ïîêà àäðåñà áóôåðîâ çàõàðäêîäàíû. - -F1 Pole Position: -Ïðîáëåìû ñ ôîíîì â ìåíþ. Ïîñëå òèòðîâ çàïóñêàåòñÿ äåìî ñ 3D ìîäåëÿìè. Èñïîëüçóåòñÿ áóôåð ãëóáèíû. -Ïðå ïåðåõîäå ñíîâà ê ìåíþ òåêòóðû ôîíà ãðóçÿòñÿ â îáëàñòü, êîòîðàÿ èñïîëüçîâàëàñü ïîä z áóôåð. -Ó áóôåðà ôëàã cleared ñáðîøåí ïîñëå çàïèñè z áóôåðà â RDRAM, ïðîâåðêà âàëèäíîñòè íå íàõîäèò ïðîáëåì. è òåêòóðà -ãðóçèòñÿ èç ïóñòîãî áóôåðà. - -Ðåøåíèå: Depth copy to RDRAM çàïèñûâàåò checksum çàïèñàííûõ äàííûõ â áóôåð, ñîîòâåñòâóþùèé áóôåðó ãëóáèíû. -Òîãäà â äàëüíåéøåì ïðîâåðêà ïî checksum óäàëèò ýòîò áóôåð. -Upd: Ðåøåíèå ïëîõîå. Ëîìàåò subscreen in Zelda OOT. Èãðà ìåíÿåò îáëàñòü z áóôåðà (âûñòàâëÿåò alpha = 1) êîãäà èñïîëüçóåò åãî êàê ôîí äëÿ -ýêðàíà ïàóçû. Checksum íå áúåò. Ðåøåíèå - ðàçäåëèòü îïöèè hack_noDepthFrameBuffers è hack_blurPauseScreen -Äëÿ ýòîé èãðû âêëþ÷èòü hack_noDepthFrameBuffers è ïðîñòî óáèðàòü áóôåð ãëóáèíû ïðè ïîïûòêå ñ÷èòàòü èç íåãî òåêñòóðó. - - -Mickey's Speedway USA: -pause screen ðàáîòàåò òàê: â îáëàñòü òåêóùåãî áóôåðà ãëóáèíû êîïèðóåòñÿ áóôåð êàäðà, êîòîðûé â äàííûé ìîìåíò îòîáðàæàåòñ ÿ íà ýêðàíå. -Äàëåå ýòîò áóôåð ðàçìûâàåòñÿ íà óðîâíå CPU è ïîòîì èñïîëüçóåòñÿ êàê òåêñòóðà. Ïîäîáíûé ìåõàíèçì ðàáîòàåò â Conker BFD. -×òîáû ïîëó÷èòü ðàçìûòèå íóæíî êîïèðîâàòü áóôåð êàäðà â RDRAM, à â ìîìåíò âûçîâà ïàóçû ñêîïèðîâàòü åãî (memcopy) â -áóôåð ãëóáèíû â RDRAM. Ïðè ýòîì íóæíî ÷òîáû ýòà îáëàñòü íå î÷èñòèëàñü ÷åðåç gDPFillRDRAM ïðè ñìåíå áóôåðà. -Äëÿ ïî÷èíêè îòêëþ÷èë âûçîâ gDPFillRDRAM åñëè m_isDepthBuffer == true. - - -Jet Force Gemini: -Îáíàðóæèëàñü ïðîáëåìà ñ âñïîìîãàòåëüíûì 8áèò áóôåðîì äëÿ òåíåé. Áóôåð ñîçäàåòñÿ îòäåëüíûì display list'îì. -Áóôåð ñîçäàåòñÿ, î÷èùàåòñÿ fillrect, ñòîèò ôëàã cleared. Ïîñëå ýòîãî èãðà ïèøåò ïàðó áàéò â ñåðåäèíå áóôåðà, è -â ñëåäóþùåì display list, ãäå áóôåð èñïîëüçóåòñÿ, ïðîâåðêà ïî RDRAM íå ñðàáàòûâàåò. - -Ïðèøëîñü ñäåëàòü ïðîâåðêó íå ñòðîãîé, à îòñåêàòü åñëè êîëè÷åñòâî îøèáî÷íûõ ïèêñåëîâ â áóôåðå ìåíüøå ïîðîãîâîãî çíà÷åíèÿ. -Ïîêà ñäåëàë ïîðîã â 1%. - -Pokemon Stadium 2: -Âîçíèêëà ïðîáëåìà ñ ïîðòðåòàìè ïîêåìîíîâ. Ïîðòðåòû ñîçäàþòñÿ â âñïîìîãàòåëüíûõ áóôåðàõ êîãäà íà ýêðàíå îòîáðàæàåòñÿ -ìåíþ âûáîðà ïîêåìîíîâ.  ýòîò ìîìåíò ðàáîòàåò interlaced âèäåî ðåæèì. Ïîòîì èãðà ïåðåêëþ÷àåòñÿ â ðåæèì áèòâû, -è ïåðåêëþ÷àåò âèäåî ðåæèì â non-interlaced. Ïðè ïåðåêëþ÷åíèèè ðåæèìîâ âñå áóôåðû ñáðàñûâàëèñü è ïîðòðåòû òåðÿëèñü. - -Ïðèøëîñü ñäåëàòü ñáðîñ òîëüêî äëÿ ïîëíîýêðàííûõ áóôåðîâ. - -Pokemon Stadium: -Èãðà èñïîëüçóåò êó÷ó âñïîìîãàòåëüíûõ áóôåðîâ äëÿ îòðèñîâêè ìåíþ. Ïðè ýòîì áóôåðà ìîãóò èìåòü îäèíàêîâóþ øèðèíó, íî ðàçíóþ -âûñîòó. È ðàñïîëàãàòüñÿ äðóã çà äðóãîì. Êîä, êîòîðûé ïðîâåðÿåò ïåðåñå÷åíèå íîâîãî áóôåðà ñ ñóùåñòâóþùèìè è âûáðàñûâàåò âñå -ïåðåñåêàþùèåñÿ áóôåðà, â äàííîì ñëó÷àå âûêèäûâàë áîëüøóþ ÷àñòü áóôåðîâ èç çà íåâåðíî ïðîñòàâëåííîé âûñîòû, à çíà÷èò è -íèæíåãî àäðåñà áóôåðà. - -Ïðèøëîñü ïðàâèòü êîä êîððåêöèè âûñîòû áóôåðà, è âûçûâàòü ìåòîä ïîèñêà ïåðåñå÷åíèé ïîñëå êîððåêöèè. - - -Blast Corps: -Âîçíèêëà ïðîáëåìà ñ depth image, êîòîðàÿ ïðèâîäèëà ê îñòàíîâêå âèäåî äðàéâåðà. Èãðà ñîçäàâàëà âñïîìîãàòåëüíûé depth image -äëÿ âñïîìîãàòåëüíîãî color image. Àäðåñ âñïîìîãàòåëüíîãî depth image ñîâïàäàë ñ àäðåñîì îñíîâíîãî, íî øèðèíà ñòàâèëàñü òàêàÿ æå -êàê ó âñïîìîãàòåëüíîãî color image. Èç-çà ïîñëåäîâàòåëüíîñòè êîìàíä ïëàãèí íå âîâðåìÿ ïðîñåêàë èçìåíåíèå ðàçìåðîâ depth image, -÷òî ïðèâîäèëî ê óñòàíîâêå íåâåðíîãî depth buffer äëÿ FBO è ê êðàõó äðàéâåðà. - -Ðåøåíèå: Ïðè âûçîâå setcolorimage, åñëè color image == depth image, âûçûâàòü depthBufferList().saveBuffer, êîòîðûé -ïðè íåîáõîäèìîñòè ïåðåñîçäàñò depth buffer. - - -StarCraft: -Âûÿñíÿë ïðè÷èíó ñòðàøíûõ ãëþêîâ â LLE. Îáíàðóæèë ïðåêðàñíîå. -Èãðà âûäåëÿåò òåêóùèé áóôåð êàäðà ïî àäðåñó 0x00176540. Êîíåö áóôåðà 0x0019bd3f -Çàïóñêàåòñÿ BgCopy, êîòîðàÿ ðèñóåò ïîäëîæêó íà âåñü ýêðàí. Àäðåñ 8 áèòíîé êàðòèíêè äëÿ îòðèñîâêè 0x00189140 -Ò.å. êàðòèíêà íàõîäèòñÿ ïîñðåäè áóôåðà, êîòîðûé êîìàíäà BgCopy äîëæíà çàïîëíèòü ýòîé êàðòèíêîé. -Ïîñêîëüêó êàðòèíêà 8 áèòíàÿ à áóôåð 16 áèòíûé, íà êîíñîëè âñ¸ ðàáîòàåò: ÷èòàåì êàðòèíêó èç ñåðåäèíû áóôåðà è ðèñóåì åå æå â íà÷àëå. -Ïðè îòðèñîâêå êàðòèíêà êîíå÷íî æå çàòèðàåòñÿ, íî êîíñîëü ÷èòàåò è ðèñóåò åå ïî ÷àñòÿì è çàòèðàåìûå äàííûå íà ýòîò ìîìåíò óæå íå íóæíû. -Ïëàãèíó ñíîñèò êðûøó ïðîâåðêà íà âàëèäíîñòü áóôåðà.  HLE CheckForFrameBufferTexture äëÿ çàäíèêîâ íå âûçûâàåòñÿ, -à _loadBGImage èãíîðèðóåò ïîïàäàíèå àäðåñà êàðòèíêè â áóôåð åñëè êàðòèíêà 8 áèòíàÿ. diff --git a/GLideN64/src/FrameBufferInfo.cpp b/GLideN64/src/FrameBufferInfo.cpp deleted file mode 100644 index c12a941..0000000 --- a/GLideN64/src/FrameBufferInfo.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include "FrameBufferInfoAPI.h" -#include "FrameBufferInfo.h" -#include "Config.h" -#include "gSP.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "RSP.h" -#include "VI.h" -#include "Log.h" - -namespace FBInfo { - - FBInfo fbInfo; - - FBInfo::FBInfo() - { - reset(); - } - - void FBInfo::reset() { - m_supported = false; - m_writeBuffers.fill(nullptr); - m_readBuffers.fill(nullptr); - } - - FBInfo::BufferSearchResult FBInfo::_findBuffer(const BuffersArray& _buffers, const FrameBuffer* _buf) const - { - u32 i = 0; - while (_buffers[i] != nullptr) { - if (_buffers[i++] == _buf) - return BufferSearchResult(true, i); - } - assert(i < _buffers.size()); - return BufferSearchResult(false, i); - } - - - void FBInfo::Write(u32 addr, u32 size) - { - const u32 address = RSP_SegmentToPhysical(addr); - const FrameBuffer* writeBuffer = frameBufferList().findBuffer(address); - if (writeBuffer == nullptr) - return; - const auto findRes = _findBuffer(m_writeBuffers, writeBuffer); - if (!findRes.first) - m_writeBuffers[findRes.second] = writeBuffer; - FrameBuffer_AddAddress(address, size); - } - - void FBInfo::WriteList(FrameBufferModifyEntry *plist, u32 size) - { - LOG(LOG_WARNING, "FBWList size=%u", size); - } - - void FBInfo::Read(u32 addr) - { - const u32 address = RSP_SegmentToPhysical(addr); - FrameBuffer * pBuffer = frameBufferList().findBuffer(address); - - if (pBuffer == nullptr || _findBuffer(m_writeBuffers, pBuffer).first) - return; - - const auto findRes = _findBuffer(m_readBuffers, pBuffer); - if (pBuffer->m_isDepthBuffer) { - if (config.frameBufferEmulation.fbInfoReadDepthChunk != 0) - FrameBuffer_CopyDepthBufferChunk(address); - else if (!findRes.first) - FrameBuffer_CopyDepthBuffer(address); - } else { - if (config.frameBufferEmulation.fbInfoReadColorChunk != 0) - FrameBuffer_CopyChunkToRDRAM(address); - else if (!findRes.first) - FrameBuffer_CopyToRDRAM(address, true); - } - - if (!findRes.first) - m_readBuffers[findRes.second] = pBuffer; - } - - void FBInfo::GetInfo(void *pinfo) - { - // debugPrint("FBGetInfo\n"); - FrameBufferInfo * pFBInfo = (FrameBufferInfo*)pinfo; - memset(pFBInfo, 0, sizeof(FrameBufferInfo)* 6); - - if (config.frameBufferEmulation.fbInfoDisabled != 0) - return; - - u32 idx = 0; - DepthBuffer * pDepthBuffer = depthBufferList().getCurrent(); - if (pDepthBuffer != nullptr) { - pFBInfo[idx].addr = pDepthBuffer->m_address; - pFBInfo[idx].width = pDepthBuffer->m_width; - pFBInfo[idx].height = VI.real_height; - pFBInfo[idx++].size = 2; - } - frameBufferList().fillBufferInfo(&pFBInfo[idx], 6 - idx); - - m_writeBuffers.fill(nullptr); - m_readBuffers.fill(nullptr); - m_supported = true; - } -} diff --git a/GLideN64/src/FrameBufferInfo.h b/GLideN64/src/FrameBufferInfo.h deleted file mode 100644 index 6cbba36..0000000 --- a/GLideN64/src/FrameBufferInfo.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef _FRAME_BUFFER_INFO_H_ -#define _FRAME_BUFFER_INFO_H_ - -#include "Platform.h" - -#include -#include "Types.h" -#include "PluginAPI.h" - -struct FrameBuffer; - -namespace FBInfo { - - struct FrameBufferInfo - { - unsigned int addr; - unsigned int size; - unsigned int width; - unsigned int height; - }; - - struct FrameBufferModifyEntry - { - unsigned int addr; - unsigned int val; - unsigned int size; - }; - - class FBInfo { - public: - FBInfo(); - - void Write(u32 addr, u32 size); - - void WriteList(FrameBufferModifyEntry *plist, u32 size); - - void Read(u32 addr); - - void GetInfo(void *pinfo); - - bool isSupported() const { return m_supported; } - - void reset(); - - private: - using BuffersArray = std::array; - using BufferSearchResult = std::pair; - BufferSearchResult _findBuffer(const BuffersArray& _buffers, const FrameBuffer* _buf) const; - - BuffersArray m_writeBuffers; - BuffersArray m_readBuffers; - bool m_supported; - }; - - extern FBInfo fbInfo; -} - -#endif // _FRAME_BUFFER_INFO_H_ diff --git a/GLideN64/src/FrameBufferInfoAPI.h b/GLideN64/src/FrameBufferInfoAPI.h deleted file mode 100644 index 8fd435b..0000000 --- a/GLideN64/src/FrameBufferInfoAPI.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _FRAME_BUFFER_INFO_API_H_ -#define _FRAME_BUFFER_INFO_API_H_ - -#if defined(__cplusplus) -extern "C" { -#endif - -#ifdef OS_WINDOWS - #define EXPORT __declspec(dllexport) - #define CALL __cdecl -#else - #define EXPORT __attribute__((visibility("default"))) - #define CALL -#endif - -/****************************************************************** - Function: FrameBufferWrite - Purpose: This function is called to notify the dll that the - frame buffer has been modified by CPU at the given address. - input: addr rdram address - size 1 = unsigned char, 2 = unsigned short, 4=unsigned int - output: none -*******************************************************************/ -EXPORT void CALL FBWrite(unsigned int addr, unsigned int size); - -struct FrameBufferModifyEntry; - -/****************************************************************** - Function: FrameBufferWriteList - Purpose: This function is called to notify the dll that the - frame buffer has been modified by CPU at the given address. - input: FrameBufferModifyEntry *plist - size = size of the plist, max = 1024 - output: none -*******************************************************************/ -EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, unsigned int size); - -/****************************************************************** - Function: FrameBufferRead - Purpose: This function is called to notify the dll that the - frame buffer memory is beening read at the given address. - DLL should copy content from its render buffer to the frame buffer - in N64 RDRAM - DLL is responsible to maintain its own frame buffer memory addr list - DLL should copy 4KB block content back to RDRAM frame buffer. - Emulator should not call this function again if other memory - is read within the same 4KB range - input: addr rdram address - output: none -*******************************************************************/ -EXPORT void CALL FBRead(unsigned int addr); - -/************************************************************************ -Function: FBGetFrameBufferInfo -Purpose: This function is called by the emulator core to retrieve depth -buffer information from the video plugin in order to be able -to notify the video plugin about CPU depth buffer read/write -operations - -size: -= 1 byte -= 2 word (16 bit) <-- this is N64 default depth buffer format -= 4 dword (32 bit) - -when depth buffer information is not available yet, set all values -in the FrameBufferInfo structure to 0 - -input: FrameBufferInfo *pinfo -pinfo is pointed to a FrameBufferInfo structure which to be -filled in by this function -output: Values are return in the FrameBufferInfo structure -************************************************************************/ -EXPORT void CALL FBGetFrameBufferInfo(void *pinfo); - -#if defined(__cplusplus) -} -#endif - -#endif // _FRAME_BUFFER_INFO_API_H_ diff --git a/GLideN64/src/GBI.cpp b/GLideN64/src/GBI.cpp deleted file mode 100644 index 87c5af8..0000000 --- a/GLideN64/src/GBI.cpp +++ /dev/null @@ -1,480 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "convert.h" -#include "N64.h" -#include "GLideN64.h" -#include "GBI.h" -#include "RDP.h" -#include "RSP.h" -#include "uCodes/F3D.h" -#include "uCodes/F3DEX.h" -#include "uCodes/F3DEX2.h" -#include "uCodes/L3D.h" -#include "uCodes/L3DEX.h" -#include "uCodes/L3DEX2.h" -#include "uCodes/S2DEX.h" -#include "uCodes/S2DEX2.h" -#include "uCodes/F3DAM.h" -#include "uCodes/F3DDKR.h" -#include "uCodes/F3DBETA.h" -#include "uCodes/F3DPD.h" -#include "uCodes/F3DSETA.h" -#include "uCodes/F3DGOLDEN.h" -#include "uCodes/F3DEX2CBFD.h" -#include "uCodes/F3DZEX2.h" -#include "uCodes/F3DTEXA.h" -#include "uCodes/F3DEX2ACCLAIM.h" -#include "uCodes/F3DFLX2.h" -#include "uCodes/F5Indi_Naboo.h" -#include "uCodes/F5Rogue.h" -#include "uCodes/ZSort.h" -#include "uCodes/ZSortBOSS.h" -#include "CRC.h" -#include "Log.h" -#include "DebugDump.h" -#include "Graphics/Context.h" -#include "Graphics/Parameters.h" - -u32 last_good_ucode = (u32) -1; - -struct SpecialMicrocodeInfo -{ - u32 type; - bool NoN; // ucode does not use near clipping - bool negativeY; // Y is inverted - bool fast3DPerspNorm; // ucode is from Fast3D family and has G_PERSPNORMALIZE. See #1303 - u32 crc; -}; - -static const -std::vector specialMicrocodes = -{ - { S2DEX2, false, true, false, 0x02c399dd }, // Animal Forest - { F3DEX, false, false, true, 0x0ace4c3f }, // Mario Kart 64 - { F3D, true, false, false, 0x16c3a775 }, // AeroFighters - { F3DEX2CBFD, true, true, false, 0x1b4ace88 }, // Conker's Bad Fur Day - { F3DPD, true, true, false, 0x1c4f7869 }, // Perfect Dark - { F3D, false, false, true, 0x1f24cc84 }, // Wayne Gretzky's 3D Hockey (U) - { F5Indi_Naboo, false, false, false, 0x23fef05f }, // SW Ep.1 Battle for Naboo - { Turbo3D, false, true, false, 0x2bdcfc8a }, // Dark Rift, Turbo3D - { F3DSETA, false, true, true, 0x2edee7be }, // RSP SW Version: 2.0D, 04-01-96 - { F3DGOLDEN, true, true, false, 0x302bca09 }, // RSP SW Version: 2.0G, 09-30-96 GoldenEye - { F3D, false, false, false, 0x4AED6B3B }, // Vivid Dolls [ALECK64] - { F3D, true, true, true, 0x54c558ba }, // RSP SW Version: 2.0D, 04-01-96 Pilot Wings, Blast Corps - { ZSortBOSS, false, false, false, 0x553538cc }, // World Driver Championship - { F3D, false, false, true, 0x55be9bad }, // RSP SW Version: 2.0D, 04-01-96, Mischief Makers, Mortal Combat Trilogy, J.League Live - { F3DEX, true, true, true, 0x637b4b58 }, // RSP SW Version: 2.0D, 04-01-96 Power League - { F5Indi_Naboo, false, false, false, 0x6859bf8e }, // Indiana Jones - { F3D, false, false, true, 0x6932365f }, // Super Mario 64 - { ZSortBOSS, false, false, false, 0x6a76f8dd }, // Stunt Racer - { F3DDKR, false, true, true, 0x6e6fc893 }, // Diddy Kong Racing - { ZSortBOSS, false, false, false, 0x75ed44cc }, // World Driver Championship, European - { F3D, true, false, true, 0x77195a68 }, // Dark Rift - { L3D, true, true, true, 0x771ce0c4 }, // RSP SW Version: 2.0D, 04-01-96 Blast Corps - { F3D, false, false, false, 0x7d372819 }, // Pachinko nichi 365 - { F3DDKR, false, true, true, 0x8d91244f }, // Diddy Kong Racing - { F3DBETA, false, true, true, 0x94c4c833 }, // Star Wars Shadows of Empire - { S2DEX_1_05, false, true, false, 0x9df31081 }, // RSP Gfx ucode S2DEX 1.06 Yoshitaka Yasumoto Nintendo - { T3DUX, false, true, false, 0xbad437f2 }, // T3DUX vers 0.83 for Toukon Road - { F3DJFG, false, true, true, 0xbde9d1fb }, // Jet Force Gemini, Mickey - { T3DUX, false, true, false, 0xd0a1aa3d }, // T3DUX vers 0.85 for Toukon Road 2 - { F3DBETA, false, true, true, 0xd17906e2 }, // RSP SW Version: 2.0D, 04-01-96, Wave Race (U) - { F3DZEX2MM, true, true, false, 0xd39a0d4f }, // Animal Forest - { F3D, false, false, true, 0xd3ab59b2 }, // Cruise'n USA - { F5Rogue, false, false, false, 0xda51ccdb }, // Star Wars RS - { F3D, false, false, false, 0xe01e14be }, // Eikou no Saint Andrews - { F3DEX2ACCLAIM,true, true, false, 0xe44df568 }, // Acclaim games: Turok2 & 3, Armories and South park - { F3D, false, true, false, 0xe62a706d }, // Fast3D -}; - -u32 G_RDPHALF_1, G_RDPHALF_2, G_RDPHALF_CONT; -u32 G_SPNOOP; -u32 G_SETOTHERMODE_H, G_SETOTHERMODE_L; -u32 G_DL, G_ENDDL, G_CULLDL, G_BRANCH_Z, G_BRANCH_W; -u32 G_LOAD_UCODE; -u32 G_MOVEMEM, G_MOVEWORD; -u32 G_MTX, G_POPMTX; -u32 G_GEOMETRYMODE, G_SETGEOMETRYMODE, G_CLEARGEOMETRYMODE; -u32 G_TEXTURE; -u32 G_DMA_IO, G_DMA_DL, G_DMA_TRI, G_DMA_MTX, G_DMA_VTX, G_DMA_TEX_OFFSET, G_DMA_OFFSETS; -u32 G_SPECIAL_1, G_SPECIAL_2, G_SPECIAL_3; -u32 G_VTX, G_MODIFYVTX, G_VTXCOLORBASE; -u32 G_TRI1, G_TRI2, G_TRIX; -u32 G_QUAD, G_LINE3D; -u32 G_RESERVED0, G_RESERVED1, G_RESERVED2, G_RESERVED3; -u32 G_SPRITE2D_BASE; -u32 G_BG_1CYC, G_BG_COPY; -u32 G_OBJ_RECTANGLE, G_OBJ_SPRITE, G_OBJ_MOVEMEM; -u32 G_SELECT_DL, G_OBJ_RENDERMODE, G_OBJ_RECTANGLE_R; -u32 G_OBJ_LOADTXTR, G_OBJ_LDTX_SPRITE, G_OBJ_LDTX_RECT, G_OBJ_LDTX_RECT_R; -u32 G_RDPHALF_0; -u32 G_PERSPNORM; -u32 G_ZOBJ, G_ZRDPCMD, G_ZWAITSIGNAL, G_ZMTXCAT, G_ZMULT_MPMTX, G_ZLIGHTING; - - -u32 G_MTX_STACKSIZE; -u32 G_MTX_MODELVIEW; -u32 G_MTX_PROJECTION; -u32 G_MTX_MUL; -u32 G_MTX_LOAD; -u32 G_MTX_NOPUSH; -u32 G_MTX_PUSH; - -u32 G_TEXTURE_ENABLE; -u32 G_SHADING_SMOOTH; -u32 G_CULL_FRONT; -u32 G_CULL_BACK; -u32 G_CULL_BOTH; -u32 G_CLIPPING; - -u32 G_MV_VIEWPORT; - -u32 G_MWO_aLIGHT_1, G_MWO_bLIGHT_1; -u32 G_MWO_aLIGHT_2, G_MWO_bLIGHT_2; -u32 G_MWO_aLIGHT_3, G_MWO_bLIGHT_3; -u32 G_MWO_aLIGHT_4, G_MWO_bLIGHT_4; -u32 G_MWO_aLIGHT_5, G_MWO_bLIGHT_5; -u32 G_MWO_aLIGHT_6, G_MWO_bLIGHT_6; -u32 G_MWO_aLIGHT_7, G_MWO_bLIGHT_7; -u32 G_MWO_aLIGHT_8, G_MWO_bLIGHT_8; - -GBIInfo GBI; - -void GBI_Unknown( u32 w0, u32 w1 ) -{ - DebugMsg(DEBUG_NORMAL, "UNKNOWN GBI COMMAND 0x%02X", _SHIFTR(w0, 24, 8)); -} - -void GBIInfo::init() -{ - m_hwlSupported = true; - m_pCurrent = nullptr; - _flushCommands(); -} - -void GBIInfo::destroy() -{ - m_pCurrent = nullptr; - m_list.clear(); -} - -bool GBIInfo::isHWLSupported() const -{ - return m_hwlSupported; -} - -void GBIInfo::setHWLSupported(bool _supported) -{ - m_hwlSupported = _supported; -} - -void GBIInfo::_flushCommands() -{ - std::fill(std::begin(cmd), std::end(cmd), GBI_Unknown); -} - -void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent) -{ - if (_pCurrent->type == NONE) { - LOG(LOG_ERROR, "[GLideN64]: error - unknown ucode!!!"); - return; - } - - if ((_pCurrent->type == ZSortBOSS) && (!REG.SP_STATUS)) { - assert(false && "ZSortBOSS ucode needs access to SP_STATUS register'n"); - } - - if (m_pCurrent == nullptr || (m_pCurrent->type != _pCurrent->type)) { - m_pCurrent = _pCurrent; - _flushCommands(); - - RDP_Init(); - - G_TRI1 = G_TRI2 = G_TRIX = G_QUAD = -1; // For correct work of gSPFlushTriangles() - gSP.clipRatio = 1U; - - switch (m_pCurrent->type) { - case F3D: - case Turbo3D: - F3D_Init(); - m_hwlSupported = true; - break; - case F3DEX: - F3DEX_Init(); - m_hwlSupported = true; - gSP.clipRatio = m_pCurrent->Rej ? 2U : 1U; - break; - case F3DEX2: - F3DEX2_Init(); - m_hwlSupported = true; - gSP.clipRatio = 2U; - break; - case L3D: - L3D_Init(); - m_hwlSupported = false; - break; - case L3DEX: - L3DEX_Init(); - m_hwlSupported = false; - gSP.clipRatio = m_pCurrent->Rej ? 2U : 1U; - break; - case L3DEX2: - L3DEX2_Init(); - m_hwlSupported = false; - gSP.clipRatio = 2U; - break; - case S2DEX_1_03: - S2DEX_1_03_Init(); - m_hwlSupported = false; - break; - case S2DEX_1_05: - S2DEX_1_05_Init(); - m_hwlSupported = false; - break; - case S2DEX_1_07: - S2DEX_1_07_Init(); - m_hwlSupported = false; - break; - case S2DEX2: - S2DEX2_Init(); - m_hwlSupported = false; - break; - case F3DDKR: - F3DDKR_Init(); - m_hwlSupported = false; - break; - case F3DJFG: - F3DJFG_Init(); - m_hwlSupported = false; - break; - case F3DBETA: - F3DBETA_Init(); - m_hwlSupported = true; - break; - case F3DPD: - F3DPD_Init(); - m_hwlSupported = true; - break; - case F3DAM: - F3DAM_Init(); - m_hwlSupported = true; - break; - case ZSortp: - ZSort_Init(); - m_hwlSupported = true; - break; - case F3DEX2CBFD: - F3DEX2CBFD_Init(); - m_hwlSupported = false; - break; - case F3DSETA: - F3DSETA_Init(); - m_hwlSupported = true; - break; - case F3DGOLDEN: - F3DGOLDEN_Init(); - m_hwlSupported = true; - break; - case F3DZEX2OOT: - F3DZEX2_Init(); - m_hwlSupported = true; - gSP.clipRatio = 2U; - break; - case F3DZEX2MM: - F3DZEX2_Init(); - m_hwlSupported = false; - gSP.clipRatio = 2U; - break; - case F3DTEXA: - F3DTEXA_Init(); - m_hwlSupported = true; - break; - case T3DUX: - F3D_Init(); - m_hwlSupported = false; - break; - case F3DEX2ACCLAIM: - F3DEX2ACCLAIM_Init(); - m_hwlSupported = false; - gSP.clipRatio = 2U; - break; - case F5Rogue: - F5Rogue_Init(); - m_hwlSupported = false; - break; - case F3DFLX2: - F3DFLX2_Init(); - m_hwlSupported = true; - gSP.clipRatio = 2U; - break; - case ZSortBOSS: - ZSortBOSS_Init(); - m_hwlSupported = true; - break; - case F5Indi_Naboo: - F5Indi_Naboo_Init(); - m_hwlSupported = false; - break; - } - if (m_pCurrent->NoN) - gfxContext.setClampMode(graphics::ClampMode::NoNearPlaneClipping); - else - gfxContext.setClampMode(graphics::ClampMode::ClippingEnabled); - if (m_pCurrent->fast3DPersp) { - GBI_SetGBI(G_PERSPNORM, F3DBETA_PERSPNORM, F3DBETA_Perpnorm); - GBI_SetGBI(G_RDPHALF_1, F3DBETA_RDPHALF_1, F3D_RDPHalf_1); - GBI_SetGBI(G_RDPHALF_2, F3DBETA_RDPHALF_2, F3D_RDPHalf_2); - } - } else if (m_pCurrent->NoN != _pCurrent->NoN) { - if (_pCurrent->NoN) - gfxContext.setClampMode(graphics::ClampMode::NoNearPlaneClipping); - else - gfxContext.setClampMode(graphics::ClampMode::ClippingEnabled); - } - m_pCurrent = _pCurrent; -} - -bool GBIInfo::_makeExistingMicrocodeCurrent(u32 uc_start, u32 uc_dstart, u32 uc_dsize) -{ - auto iter = std::find_if(m_list.begin(), m_list.end(), [=](const MicrocodeInfo& info) { - return info.address == uc_start && info.dataAddress == uc_dstart && info.dataSize == uc_dsize; - }); - - if (iter == m_list.end()) - return false; - - _makeCurrent(&*iter); - return true; -} - -void GBIInfo::loadMicrocode(u32 uc_start, u32 uc_dstart, u16 uc_dsize) -{ - if (_makeExistingMicrocodeCurrent(uc_start, uc_dstart, uc_dsize)) - return; - - m_list.emplace_front(); - MicrocodeInfo & current = m_list.front(); - current.address = uc_start; - current.dataAddress = uc_dstart; - current.dataSize = uc_dsize; - current.type = NONE; - - // See if we can identify it by CRC - const u32 uc_crc = CRC_Calculate_Strict( 0xFFFFFFFF, &RDRAM[uc_start & 0x1FFFFFFF], 4096 ); - SpecialMicrocodeInfo infoToSearch; - infoToSearch.crc = uc_crc; - auto it = std::lower_bound(specialMicrocodes.begin(), specialMicrocodes.end(), infoToSearch, - [](const SpecialMicrocodeInfo & i, const SpecialMicrocodeInfo & j){ return i.crc < j.crc; }); - if (it != specialMicrocodes.end() && it->crc == uc_crc) { - const SpecialMicrocodeInfo & info = *it; - current.type = info.type; - current.NoN = info.NoN; - current.negativeY = info.negativeY; - current.fast3DPersp = info.fast3DPerspNorm; - LOG(LOG_VERBOSE, "Load microcode type: %d crc: 0x%08x romname: %s", current.type, uc_crc, RSP.romname); - _makeCurrent(¤t); - return; - } - - // See if we can identify it by text - char uc_data[2048]; - UnswapCopyWrap(RDRAM, uc_dstart & 0x1FFFFFFF, (u8*)uc_data, 0, 0x7FF, 2048); - char uc_str[256]; - strcpy(uc_str, "Not Found"); - - for (u32 i = 0; i < 2046; ++i) { - if ((uc_data[i] == 'R') && (uc_data[i+1] == 'S') && (uc_data[i+2] == 'P')) { - u32 j = 0; - while (uc_data[i+j] > 0x0A) { - uc_str[j] = uc_data[i+j]; - j++; - } - - uc_str[j] = 0x00; - - int type = NONE; - - if (strncmp(&uc_str[4], "SW", 2) == 0) { - type = F3D; - } else if (strncmp(&uc_str[4], "Gfx", 3) == 0) { - current.NoN = (strstr( uc_str + 4, ".NoN") != nullptr); - current.Rej = (strstr(uc_str + 4, ".Rej") != nullptr); - if (current.Rej) - // For the Z direction, a reject box can be done with the far plane, but not with the near plane. - current.NoN = true; - - if (strncmp( &uc_str[14], "F3D", 3 ) == 0) { - if (uc_str[28] == '1' || strncmp(&uc_str[28], "0.95", 4) == 0 || strncmp(&uc_str[28], "0.96", 4) == 0) - type = F3DEX; - else if (uc_str[31] == '2') { - type = F3DEX2; - if (uc_str[35] == 'H') - current.combineMatrices = true; - } - if (strncmp(&uc_str[14], "F3DFLX", 6) == 0) { - type = F3DFLX2; - current.NoN = true; - } else if (strncmp(&uc_str[14], "F3DZEX", 6) == 0) { - // Zelda games - if (uc_str[34] == '6') - type = F3DZEX2OOT; - else - type = F3DZEX2MM; - current.combineMatrices = false; - } else if (strncmp(&uc_str[14], "F3DTEX/A", 8) == 0) - type = F3DTEXA; - else if (strncmp(&uc_str[14], "F3DAM", 5) == 0) - type = F3DAM; - else if (strncmp(&uc_str[14], "F3DLX.Rej", 9) == 0) { - current.NoN = true; - current.cullBoth = false; - } else if (strncmp(&uc_str[14], "F3DLP.Rej", 9) == 0) { - current.texturePersp = false; - current.NoN = true; - } - } - else if (strncmp( &uc_str[14], "L3D", 3 ) == 0) { - u32 t = 22; - while (!std::isdigit(uc_str[t]) && t++ < j); - if (uc_str[t] == '1') - type = L3DEX; - else if (uc_str[t] == '2') - type = L3DEX2; - } - else if (strncmp( &uc_str[14], "S2D", 3 ) == 0) { - u32 t = 20; - while (!std::isdigit(uc_str[t]) && t++ < j); - if (uc_str[t] == '1') { - if (strncmp(&uc_str[21], "1.03", 4) == 0) - type = S2DEX_1_03; - else if (strncmp(&uc_str[21], "1.05", 4) == 0) - type = S2DEX_1_05; - else - type = S2DEX_1_07; - } else if (uc_str[t] == '2') - type = S2DEX2; - current.texturePersp = false; - } - else if (strncmp(&uc_str[14], "ZSortp", 6) == 0) { - type = ZSortp; - } - } - - if (type != NONE) { - current.type = type; - LOG(LOG_VERBOSE, "Load microcode (%s) type: %d crc: 0x%08x romname: %s", uc_str, current.type, uc_crc, RSP.romname); - _makeCurrent(¤t); - return; - } - - break; - } - } - - assert(false && "unknown ucode!!!'n"); - _makeCurrent(¤t); -} diff --git a/GLideN64/src/GBI.h b/GLideN64/src/GBI.h deleted file mode 100644 index ee77ab1..0000000 --- a/GLideN64/src/GBI.h +++ /dev/null @@ -1,569 +0,0 @@ -#ifndef GBI_H -#define GBI_H - -#include - -#include "Types.h" - -// Microcode Types -#define F3D 0 -#define F3DEX 1 -#define F3DEX2 2 -#define L3D 3 -#define L3DEX 4 -#define L3DEX2 5 -#define S2DEX_1_07 6 -#define S2DEX2 7 -#define F3DPD 8 -#define F3DDKR 9 -#define F3DJFG 10 -#define F3DGOLDEN 11 -#define F3DBETA 12 -#define F3DEX2CBFD 13 -#define Turbo3D 14 -#define ZSortp 15 -#define F3DSETA 16 -#define F3DZEX2OOT 17 -#define F3DZEX2MM 18 -#define F3DTEXA 19 -#define T3DUX 20 -#define F3DEX2ACCLAIM 21 -#define F3DAM 22 -#define F3DFLX2 23 -#define ZSortBOSS 24 -#define F5Rogue 25 -#define F5Indi_Naboo 26 -#define S2DEX_1_03 27 -#define S2DEX_1_05 28 -#define NONE 29 - -// Fixed point conversion factors -#define FIXED2FLOATRECIP1 0.5f -#define FIXED2FLOATRECIP2 0.25f -#define FIXED2FLOATRECIP3 0.125f -#define FIXED2FLOATRECIP4 0.0625f -#define FIXED2FLOATRECIP5 0.03125f -#define FIXED2FLOATRECIP6 0.015625f -#define FIXED2FLOATRECIP7 0.0078125f -#define FIXED2FLOATRECIP8 0.00390625f -#define FIXED2FLOATRECIP9 0.001953125f -#define FIXED2FLOATRECIP10 0.0009765625f -#define FIXED2FLOATRECIP11 0.00048828125f -#define FIXED2FLOATRECIP12 2.44140625e-04f -#define FIXED2FLOATRECIP13 1.220703125e-04f -#define FIXED2FLOATRECIP14 6.103515625e-05f -#define FIXED2FLOATRECIP15 3.0517578125e-05f -#define FIXED2FLOATRECIP16 1.52587890625e-05f - -#define _FIXED2FLOAT( v, b ) \ - (static_cast(v) * FIXED2FLOATRECIP##b) - -#define FIXED2FLOATRECIPCOLOR5 3.22580635547637939453125e-02f -#define FIXED2FLOATRECIPCOLOR7 7.8740157186985015869140625e-03f -#define FIXED2FLOATRECIPCOLOR8 3.9215688593685626983642578125e-03f - -#define _FIXED2FLOATCOLOR( v, b ) \ - (static_cast(v) * FIXED2FLOATRECIPCOLOR##b) - - -// Useful macros for decoding GBI command's parameters -#define _SHIFTL( v, s, w ) \ - ((static_cast(v) & ((0x01 << w) - 1)) << s) -#define _SHIFTR( v, s, w ) \ - ((static_cast(v) >> s) & ((0x01 << w) - 1)) - -// These are all the constant flags -#define G_ZBUFFER 0x00000001 -#define G_SHADE 0x00000004 -#define G_ACCLAIM_LIGHTING 0x00000080 -#define G_FOG 0x00010000 -#define G_LIGHTING 0x00020000 -#define G_TEXTURE_GEN 0x00040000 -#define G_TEXTURE_GEN_LINEAR 0x00080000 -#define G_LOD 0x00100000 -#define G_POINT_LIGHTING 0x00400000 - -#define G_MV_MMTX 2 -#define G_MV_PMTX 6 -#define G_MV_LIGHT 10 -#define G_MV_POINT 12 -#define G_MV_MATRIX 14 -#define G_MV_NORMALES 14 - -#define G_MVO_LOOKATX 0 -#define G_MVO_LOOKATY 24 -#define G_MVO_L0 48 -#define G_MVO_L1 72 -#define G_MVO_L2 96 -#define G_MVO_L3 120 -#define G_MVO_L4 144 -#define G_MVO_L5 168 -#define G_MVO_L6 192 -#define G_MVO_L7 216 - -#define G_MV_LOOKATY 0x82 -#define G_MV_LOOKATX 0x84 -#define G_MV_L0 0x86 -#define G_MV_L1 0x88 -#define G_MV_L2 0x8a -#define G_MV_L3 0x8c -#define G_MV_L4 0x8e -#define G_MV_L5 0x90 -#define G_MV_L6 0x92 -#define G_MV_L7 0x94 -#define G_MV_TXTATT 0x96 -#define G_MV_MATRIX_1 0x9E -#define G_MV_MATRIX_2 0x98 -#define G_MV_MATRIX_3 0x9A -#define G_MV_MATRIX_4 0x9C - -#define G_MW_MATRIX 0x00 -#define G_MW_NUMLIGHT 0x02 -#define G_MW_CLIP 0x04 -#define G_MW_SEGMENT 0x06 -#define G_MW_FOG 0x08 -#define G_MW_GENSTAT 0x08 -#define G_MW_LIGHTCOL 0x0A -#define G_MW_FORCEMTX 0x0C -#define G_MW_POINTS 0x0C -#define G_MW_PERSPNORM 0x0E -#define G_MW_COORD_MOD 0x10 - -#define G_MWO_NUMLIGHT 0x00 -#define G_MWO_CLIP_RNX 0x04 -#define G_MWO_CLIP_RNY 0x0c -#define G_MWO_CLIP_RPX 0x14 -#define G_MWO_CLIP_RPY 0x1c -#define G_MWO_SEGMENT_0 0x00 -#define G_MWO_SEGMENT_1 0x01 -#define G_MWO_SEGMENT_2 0x02 -#define G_MWO_SEGMENT_3 0x03 -#define G_MWO_SEGMENT_4 0x04 -#define G_MWO_SEGMENT_5 0x05 -#define G_MWO_SEGMENT_6 0x06 -#define G_MWO_SEGMENT_7 0x07 -#define G_MWO_SEGMENT_8 0x08 -#define G_MWO_SEGMENT_9 0x09 -#define G_MWO_SEGMENT_A 0x0a -#define G_MWO_SEGMENT_B 0x0b -#define G_MWO_SEGMENT_C 0x0c -#define G_MWO_SEGMENT_D 0x0d -#define G_MWO_SEGMENT_E 0x0e -#define G_MWO_SEGMENT_F 0x0f -#define G_MWO_FOG 0x00 - -#define G_MWO_MATRIX_XX_XY_I 0x00 -#define G_MWO_MATRIX_XZ_XW_I 0x04 -#define G_MWO_MATRIX_YX_YY_I 0x08 -#define G_MWO_MATRIX_YZ_YW_I 0x0C -#define G_MWO_MATRIX_ZX_ZY_I 0x10 -#define G_MWO_MATRIX_ZZ_ZW_I 0x14 -#define G_MWO_MATRIX_WX_WY_I 0x18 -#define G_MWO_MATRIX_WZ_WW_I 0x1C -#define G_MWO_MATRIX_XX_XY_F 0x20 -#define G_MWO_MATRIX_XZ_XW_F 0x24 -#define G_MWO_MATRIX_YX_YY_F 0x28 -#define G_MWO_MATRIX_YZ_YW_F 0x2C -#define G_MWO_MATRIX_ZX_ZY_F 0x30 -#define G_MWO_MATRIX_ZZ_ZW_F 0x34 -#define G_MWO_MATRIX_WX_WY_F 0x38 -#define G_MWO_MATRIX_WZ_WW_F 0x3C -#define G_MWO_POINT_RGBA 0x10 -#define G_MWO_POINT_ST 0x14 -#define G_MWO_POINT_XYSCREEN 0x18 -#define G_MWO_POINT_ZSCREEN 0x1C - -// These flags change between ucodes -extern u32 G_MTX_STACKSIZE; - -extern u32 G_MTX_MODELVIEW; -extern u32 G_MTX_PROJECTION; -extern u32 G_MTX_MUL; -extern u32 G_MTX_LOAD; -extern u32 G_MTX_NOPUSH; -extern u32 G_MTX_PUSH; - -extern u32 G_TEXTURE_ENABLE; -extern u32 G_SHADING_SMOOTH; -extern u32 G_CULL_FRONT; -extern u32 G_CULL_BACK; -extern u32 G_CULL_BOTH; -extern u32 G_CLIPPING; - -extern u32 G_MV_VIEWPORT; - -extern u32 G_MWO_aLIGHT_1, G_MWO_bLIGHT_1; -extern u32 G_MWO_aLIGHT_2, G_MWO_bLIGHT_2; -extern u32 G_MWO_aLIGHT_3, G_MWO_bLIGHT_3; -extern u32 G_MWO_aLIGHT_4, G_MWO_bLIGHT_4; -extern u32 G_MWO_aLIGHT_5, G_MWO_bLIGHT_5; -extern u32 G_MWO_aLIGHT_6, G_MWO_bLIGHT_6; -extern u32 G_MWO_aLIGHT_7, G_MWO_bLIGHT_7; -extern u32 G_MWO_aLIGHT_8, G_MWO_bLIGHT_8; - -// Image formats -#define G_IM_FMT_RGBA 0 -#define G_IM_FMT_YUV 1 -#define G_IM_FMT_CI 2 -#define G_IM_FMT_IA 3 -#define G_IM_FMT_I 4 - -// Image sizes -#define G_IM_SIZ_4b 0 -#define G_IM_SIZ_8b 1 -#define G_IM_SIZ_16b 2 -#define G_IM_SIZ_32b 3 -#define G_IM_SIZ_DD 5 - -#define G_TX_NOMIRROR 0x00 // 0 << 0 -#define G_TX_MIRROR 0x01 -#define G_TX_WRAP 0x00 // 0 << 1 -#define G_TX_CLAMP 0x02 - -#define G_NOOP 0x00 - -#define G_IMMFIRST -65 - -// These GBI commands are common to all ucodes -#define G_SETCIMG 0xFF /* -1 */ -#define G_SETZIMG 0xFE /* -2 */ -#define G_SETTIMG 0xFD /* -3 */ -#define G_SETCOMBINE 0xFC /* -4 */ -#define G_SETENVCOLOR 0xFB /* -5 */ -#define G_SETPRIMCOLOR 0xFA /* -6 */ -#define G_SETBLENDCOLOR 0xF9 /* -7 */ -#define G_SETFOGCOLOR 0xF8 /* -8 */ -#define G_SETFILLCOLOR 0xF7 /* -9 */ -#define G_FILLRECT 0xF6 /* -10 */ -#define G_SETTILE 0xF5 /* -11 */ -#define G_LOADTILE 0xF4 /* -12 */ -#define G_LOADBLOCK 0xF3 /* -13 */ -#define G_SETTILESIZE 0xF2 /* -14 */ -#define G_LOADTLUT 0xF0 /* -16 */ -#define G_RDPSETOTHERMODE 0xEF /* -17 */ -#define G_SETPRIMDEPTH 0xEE /* -18 */ -#define G_SETSCISSOR 0xED /* -19 */ -#define G_SETCONVERT 0xEC /* -20 */ -#define G_SETKEYR 0xEB /* -21 */ -#define G_SETKEYGB 0xEA /* -22 */ -#define G_RDPFULLSYNC 0xE9 /* -23 */ -#define G_RDPTILESYNC 0xE8 /* -24 */ -#define G_RDPPIPESYNC 0xE7 /* -25 */ -#define G_RDPLOADSYNC 0xE6 /* -26 */ -#define G_TEXRECTFLIP 0xE5 /* -27 */ -#define G_TEXRECT 0xE4 /* -28 */ - -#define G_RDPNOOP 0xC0 - -#define G_TRI_FILL 0xC8 /* fill triangle: 11001000 */ -#define G_TRI_SHADE 0xCC /* shade triangle: 11001100 */ -#define G_TRI_TXTR 0xCA /* texture triangle: 11001010 */ -#define G_TRI_SHADE_TXTR 0xCE /* shade, texture triangle: 11001110 */ -#define G_TRI_FILL_ZBUFF 0xC9 /* fill, zbuff triangle: 11001001 */ -#define G_TRI_SHADE_ZBUFF 0xCD /* shade, zbuff triangle: 11001101 */ -#define G_TRI_TXTR_ZBUFF 0xCB /* texture, zbuff triangle: 11001011 */ -#define G_TRI_SHADE_TXTR_ZBUFF 0xCF /* shade, txtr, zbuff trngl: 11001111 */ - -/* - * G_SETOTHERMODE_L sft: shift count - */ -#define G_MDSFT_ALPHACOMPARE 0 -#define G_MDSFT_ZSRCSEL 2 -#define G_MDSFT_RENDERMODE 3 -#define G_MDSFT_BLENDER 16 - -/* - * G_SETOTHERMODE_H sft: shift count - */ -#define G_MDSFT_BLENDMASK 0 /* unsupported */ -#define G_MDSFT_ALPHADITHER 4 -#define G_MDSFT_RGBDITHER 6 - -#define G_MDSFT_COMBKEY 8 -#define G_MDSFT_TEXTCONV 9 -#define G_MDSFT_TEXTFILT 12 -#define G_MDSFT_TEXTLUT 14 -#define G_MDSFT_TEXTLOD 16 -#define G_MDSFT_TEXTDETAIL 17 -#define G_MDSFT_TEXTPERSP 19 -#define G_MDSFT_CYCLETYPE 20 -#define G_MDSFT_COLORDITHER 22 /* unsupported in HW 2.0 */ -#define G_MDSFT_PIPELINE 23 - -/* G_SETOTHERMODE_H gPipelineMode */ -#define G_PM_1PRIMITIVE 1 -#define G_PM_NPRIMITIVE 0 - -/* G_SETOTHERMODE_H gSetCycleType */ -#define G_CYC_1CYCLE 0 -#define G_CYC_2CYCLE 1 -#define G_CYC_COPY 2 -#define G_CYC_FILL 3 - -/* G_SETOTHERMODE_H gSetTexturePersp */ -#define G_TP_NONE 0 -#define G_TP_PERSP 1 - -/* G_SETOTHERMODE_H gSetTextureDetail */ -#define G_TD_CLAMP 0 -#define G_TD_SHARPEN 1 -#define G_TD_DETAIL 2 - -/* G_SETOTHERMODE_H gSetTextureLOD */ -#define G_TL_TILE 0 -#define G_TL_LOD 1 - -/* G_SETOTHERMODE_H gSetTextureLUT */ -#define G_TT_NONE 0 -#define G_TT_RGBA16 2 -#define G_TT_IA16 3 - -/* G_SETOTHERMODE_H gSetTextureFilter */ -#define G_TF_POINT 0 -#define G_TF_AVERAGE 3 -#define G_TF_BILERP 2 - -/* G_SETOTHERMODE_H gSetTextureConvert */ -#define G_TC_CONV 0 -#define G_TC_FILTCONV 5 -#define G_TC_FILT 6 - -/* G_SETOTHERMODE_H gSetCombineKey */ -#define G_CK_NONE 0 -#define G_CK_KEY 1 - -/* G_SETOTHERMODE_H gSetColorDither */ -#define G_CD_MAGICSQ 0 -#define G_CD_BAYER 1 -#define G_CD_NOISE 2 - -#define G_CD_DISABLE 3 -#define G_CD_ENABLE G_CD_NOISE /* HW 1.0 compatibility mode */ - -/* G_SETOTHERMODE_H gSetAlphaDither */ -#define G_AD_PATTERN 0 -#define G_AD_NOTPATTERN 1 -#define G_AD_NOISE 2 -#define G_AD_DISABLE 3 - -/* G_SETOTHERMODE_L gSetAlphaCompare */ -#define G_AC_NONE 0 -#define G_AC_THRESHOLD 1 -#define G_AC_DITHER 3 - -/* G_SETOTHERMODE_L gSetDepthSource */ -#define G_ZS_PIXEL 0 -#define G_ZS_PRIM 1 - -/* G_SETOTHERMODE_L gSetRenderMode */ -#define AA_EN 1 -#define Z_CMP 1 -#define Z_UPD 1 -#define IM_RD 1 -#define CLR_ON_CVG 1 -#define CVG_DST_CLAMP 0 -#define CVG_DST_WRAP 1 -#define CVG_DST_FULL 2 -#define CVG_DST_SAVE 3 -#define ZMODE_OPA 0 -#define ZMODE_INTER 1 -#define ZMODE_XLU 2 -#define ZMODE_DEC 3 -#define CVG_X_ALPHA 1 -#define ALPHA_CVG_SEL 1 -#define FORCE_BL 1 -#define TEX_EDGE 0 // not used - -#define G_SC_NON_INTERLACE 0 -#define G_SC_EVEN_INTERLACE 2 -#define G_SC_ODD_INTERLACE 3 - -extern u32 G_RDPHALF_1, G_RDPHALF_2, G_RDPHALF_CONT; -extern u32 G_SPNOOP; -extern u32 G_SETOTHERMODE_H, G_SETOTHERMODE_L; -extern u32 G_DL, G_ENDDL, G_CULLDL, G_BRANCH_Z, G_BRANCH_W; -extern u32 G_LOAD_UCODE; -extern u32 G_MOVEMEM, G_MOVEWORD; -extern u32 G_MTX, G_POPMTX; -extern u32 G_GEOMETRYMODE, G_SETGEOMETRYMODE, G_CLEARGEOMETRYMODE; -extern u32 G_TEXTURE; -extern u32 G_DMA_IO, G_DMA_DL, G_DMA_TRI, G_DMA_MTX, G_DMA_VTX, G_DMA_TEX_OFFSET, G_DMA_OFFSETS; -extern u32 G_SPECIAL_1, G_SPECIAL_2, G_SPECIAL_3; -extern u32 G_VTX, G_MODIFYVTX, G_VTXCOLORBASE; -extern u32 G_TRI1, G_TRI2, G_TRIX; -extern u32 G_QUAD, G_LINE3D; -extern u32 G_RESERVED0, G_RESERVED1, G_RESERVED2, G_RESERVED3; -extern u32 G_SPRITE2D_BASE; -extern u32 G_BG_1CYC, G_BG_COPY; -extern u32 G_OBJ_RECTANGLE, G_OBJ_SPRITE, G_OBJ_MOVEMEM; -extern u32 G_SELECT_DL, G_OBJ_RENDERMODE, G_OBJ_RECTANGLE_R; -extern u32 G_OBJ_LOADTXTR, G_OBJ_LDTX_SPRITE, G_OBJ_LDTX_RECT, G_OBJ_LDTX_RECT_R; -extern u32 G_RDPHALF_0; -extern u32 G_PERSPNORM; -extern u32 G_ZOBJ, G_ZRDPCMD, G_ZWAITSIGNAL, G_ZMTXCAT, G_ZMULT_MPMTX, G_ZLIGHTING; - -#define LIGHT_1 1 -#define LIGHT_2 2 -#define LIGHT_3 3 -#define LIGHT_4 4 -#define LIGHT_5 5 -#define LIGHT_6 6 -#define LIGHT_7 7 -#define LIGHT_8 8 - -#define G_DL_PUSH 0x00 -#define G_DL_NOPUSH 0x01 - -typedef struct -{ - s16 y; - s16 x; - - u16 flag; - s16 z; - - s16 t; - s16 s; - - union { - struct - { - u8 a; - u8 b; - u8 g; - u8 r; - } color; - struct - { - s8 a; - s8 z; // b - s8 y; //g - s8 x; //r - } normal; - }; -} Vertex; - -typedef struct -{ - s16 y, x; - u16 ci; - s16 z; - s16 t, s; -} PDVertex; - -typedef struct -{ - u8 v2, v1, v0, flag; - s16 t0, s0; - s16 t1, s1; - s16 t2, s2; -} DKRTriangle; - -typedef struct -{ - s16 y, x; - u16 flag; - s16 z; -} SWVertex; - -struct Light -{ - u8 pad0, b, g, r; - u8 pad1, b2, g2, r2; - s8 pad2, z, y, x; -}; - -// GBI commands -typedef void (*GBIFunc)( u32 w0, u32 w1 ); - -struct MicrocodeInfo -{ - u32 address = 0; - u32 dataAddress = 0;; - u16 dataSize = 0; - u32 type = NONE; - bool NoN = false; - bool Rej = false; - bool cullBoth = true; - bool negativeY = true; - bool fast3DPersp = false; - bool texturePersp = true; - bool combineMatrices = false; -}; - -struct GBIInfo -{ - GBIFunc cmd[256]; - - u32 PCStackSize; - - void init(); - void destroy(); - void loadMicrocode(u32 uc_start, u32 uc_dstart, u16 uc_dsize); - u32 getMicrocodeType() const {return m_pCurrent != nullptr ? m_pCurrent->type : NONE;} - bool isHWLSupported() const; - void setHWLSupported(bool _supported); - bool isNoN() const { return m_pCurrent != nullptr ? m_pCurrent->NoN : false; } - bool isRej() const { return m_pCurrent != nullptr ? m_pCurrent->Rej : false; } - bool isCullBoth() const { return m_pCurrent != nullptr ? m_pCurrent->cullBoth : false; } - bool isNegativeY() const { return m_pCurrent != nullptr ? m_pCurrent->negativeY : true; } - bool isTexturePersp() const { return m_pCurrent != nullptr ? m_pCurrent->texturePersp: true; } - bool isCombineMatrices() const { return m_pCurrent != nullptr ? m_pCurrent->combineMatrices: false; } - -private: - void _flushCommands(); - - void _makeCurrent(MicrocodeInfo * _pCurrent); - bool _makeExistingMicrocodeCurrent(u32 uc_start, u32 uc_dstart, u32 uc_dsize); - - bool m_hwlSupported; - MicrocodeInfo * m_pCurrent; - - typedef std::list Microcodes; - Microcodes m_list; -}; - -extern GBIInfo GBI; - -// Allows easier setting of GBI commands -#define GBI_SetGBI( command, value, function ) \ - command = value; \ - GBI.cmd[command] = function - -#define GBI_InitFlags( ucode ) \ - G_MTX_STACKSIZE = ucode##_MTX_STACKSIZE; \ - G_MTX_MODELVIEW = ucode##_MTX_MODELVIEW; \ - G_MTX_PROJECTION = ucode##_MTX_PROJECTION; \ - G_MTX_MUL = ucode##_MTX_MUL; \ - G_MTX_LOAD = ucode##_MTX_LOAD; \ - G_MTX_NOPUSH = ucode##_MTX_NOPUSH; \ - G_MTX_PUSH = ucode##_MTX_PUSH; \ -\ - G_TEXTURE_ENABLE = ucode##_TEXTURE_ENABLE; \ - G_SHADING_SMOOTH = ucode##_SHADING_SMOOTH; \ - G_CULL_FRONT = ucode##_CULL_FRONT; \ - G_CULL_BACK = ucode##_CULL_BACK; \ - G_CULL_BOTH = ucode##_CULL_BOTH; \ - G_CLIPPING = ucode##_CLIPPING; \ -\ - G_MV_VIEWPORT = ucode##_MV_VIEWPORT; \ -\ - G_MWO_aLIGHT_1 = ucode##_MWO_aLIGHT_1; \ - G_MWO_bLIGHT_1 = ucode##_MWO_bLIGHT_1; \ - G_MWO_aLIGHT_2 = ucode##_MWO_aLIGHT_2; \ - G_MWO_bLIGHT_2 = ucode##_MWO_bLIGHT_2; \ - G_MWO_aLIGHT_3 = ucode##_MWO_aLIGHT_3; \ - G_MWO_bLIGHT_3 = ucode##_MWO_bLIGHT_3; \ - G_MWO_aLIGHT_4 = ucode##_MWO_aLIGHT_4; \ - G_MWO_bLIGHT_4 = ucode##_MWO_bLIGHT_4; \ - G_MWO_aLIGHT_5 = ucode##_MWO_aLIGHT_5; \ - G_MWO_bLIGHT_5 = ucode##_MWO_bLIGHT_5; \ - G_MWO_aLIGHT_6 = ucode##_MWO_aLIGHT_6; \ - G_MWO_bLIGHT_6 = ucode##_MWO_bLIGHT_6; \ - G_MWO_aLIGHT_7 = ucode##_MWO_aLIGHT_7; \ - G_MWO_bLIGHT_7 = ucode##_MWO_bLIGHT_7; \ - G_MWO_aLIGHT_8 = ucode##_MWO_aLIGHT_8; \ - G_MWO_bLIGHT_8 = ucode##_MWO_bLIGHT_8; - -#endif - diff --git a/GLideN64/src/GLideN64.cpp b/GLideN64/src/GLideN64.cpp deleted file mode 100644 index d1b2645..0000000 --- a/GLideN64/src/GLideN64.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "Revision.h" -char pluginName[] = "GLideN64"; -char pluginNameWithRevision[] = "GLideN64 rev." PLUGIN_REVISION; -wchar_t pluginNameW[] = L"GLideN64"; -void (*CheckInterrupts)( void ); diff --git a/GLideN64/src/GLideN64.h b/GLideN64/src/GLideN64.h deleted file mode 100644 index 0b0471f..0000000 --- a/GLideN64/src/GLideN64.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GLIDEN64_H -#define GLIDEN64_H - -extern char pluginName[]; -extern char pluginNameWithRevision[]; -extern wchar_t pluginNameW[]; -extern void (*CheckInterrupts)( void ); - -#endif // GLIDEN64_H diff --git a/GLideN64/src/GLideN64.rc b/GLideN64/src/GLideN64.rc deleted file mode 100644 index 7ca2c41..0000000 Binary files a/GLideN64/src/GLideN64.rc and /dev/null differ diff --git a/GLideN64/src/GLideNHQ/CMakeLists.txt b/GLideN64/src/GLideNHQ/CMakeLists.txt deleted file mode 100644 index 6f8562b..0000000 --- a/GLideN64/src/GLideNHQ/CMakeLists.txt +++ /dev/null @@ -1,185 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -project( GLideNHQ ) - -set(GLideNHQ_SOURCES - TextureFilters.cpp - TextureFilters_2xsai.cpp - TextureFilters_hq2x.cpp - TextureFilters_hq4x.cpp - TextureFilters_xbrz.cpp - TxCache.cpp - TxDbg.cpp - TxFilter.cpp - TxFilterExport.cpp - TxHiResCache.cpp - TxImage.cpp - TxQuantize.cpp - TxReSample.cpp - TxTexCache.cpp - TxUtil.cpp -) - -if(MINGW OR PANDORA OR BCMHOST) - include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../osal ) -else(MINGW OR PANDORA OR BCMHOST) - include_directories( inc ${CMAKE_CURRENT_SOURCE_DIR}/../osal ) -endif(MINGW OR PANDORA OR BCMHOST) -LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/lib ) - -if(UNIX) - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - add_definitions( - -DOS_MAC_OS_X - ) - set(APPLE ON) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - add_definitions( - -DNDEBUG - -DOS_LINUX - ) - endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -endif(UNIX) - -if(WIN32) - LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/lib ) - add_definitions( - -DWIN32 - -DOS_WINDOWS - -D_CRT_SECURE_NO_WARNINGS - ) -endif(WIN32) - -# Build type - -if( NOT CMAKE_BUILD_TYPE) - set( CMAKE_BUILD_TYPE Release) -endif( NOT CMAKE_BUILD_TYPE) - -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - set( CMAKE_BUILD_TYPE Debug) - set( DEBUG_BUILD TRUE) - add_definitions( - -DDEBUG - ) -endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - add_definitions( -D__MSC__) -endif() - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(GCC_CPP11_COMPILE_FLAGS "-std=c++0x -Wno-unused-result") - if( NOT GHQCHK ) - if ( NOT MINGW ) - SET ( PIC_FLAGS "-fPIC" ) - endif ( NOT MINGW) - SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} -static ${PIC_FLAGS} " ) - SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static ${PIC_FLAGS} " ) - else( NOT GHQCHK ) - SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" ) - endif( NOT GHQCHK ) -#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} " ) -endif() - -if( NOT GHQCHK ) - - add_definitions( -DTXFILTER_LIB) - - if( CMAKE_BUILD_TYPE STREQUAL "Debug") - SET( BUILD_VARIANT "debug" ) - else() - SET( BUILD_VARIANT "release" ) - endif() - - if( CMAKE_BUILD_TYPE STREQUAL "Debug") - add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES}) - - set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1) - - if(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) - FIND_PACKAGE( ZLIB REQUIRED ) - FIND_PACKAGE( PNG REQUIRED ) - target_link_libraries(GLideNHQd - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - osald - ) - elseif(ANDROID) - target_link_libraries(GLideNHQ PRIVATE - ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libpng.a - z - dl - osal - ) - else(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) - target_link_libraries(GLideNHQd PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a - dl - osald - ) - endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) - endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - - if( CMAKE_BUILD_TYPE STREQUAL "Release") - add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES}) - -# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1) -# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_END_STATIC 1) -# set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -# find_library(PNGLIB libpng.a) - - if(PANDORA) - target_link_libraries(GLideNHQ PRIVATE - /mnt/utmp/codeblocks/usr/lib/libpng.a - /mnt/utmp/codeblocks/usr/lib/libz.a - osal - ) - elseif(BCMHOST OR MINGW OR APPLE OR USE_SYSTEM_LIBS) - FIND_PACKAGE( ZLIB REQUIRED ) - FIND_PACKAGE( PNG REQUIRED ) - target_link_libraries(GLideNHQ - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - osal - ) - elseif(ANDROID) - target_link_libraries(GLideNHQ PRIVATE - ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libpng.a - z - dl - osal - ) - else(PANDORA) - target_link_libraries(GLideNHQ PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a - dl - osal - ) - endif(PANDORA) - endif( CMAKE_BUILD_TYPE STREQUAL "Release") -else( NOT GHQCHK ) - add_definitions(-DGHQCHK) - - add_library( ghqchk SHARED ${GLideNHQ_SOURCES}) - - SET_TARGET_PROPERTIES( - ghqchk - PROPERTIES - LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need. - PREFIX "" - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin - ) - - if( CMAKE_BUILD_TYPE STREQUAL "Debug") - target_link_libraries(ghqchk png z ) - endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - - if( CMAKE_BUILD_TYPE STREQUAL "Release") - target_link_libraries(ghqchk png z ) - endif( CMAKE_BUILD_TYPE STREQUAL "Release") -endif( NOT GHQCHK ) - diff --git a/GLideN64/src/GLideNHQ/Ext_TxFilter.cpp b/GLideN64/src/GLideNHQ/Ext_TxFilter.cpp deleted file mode 100644 index 947017c..0000000 --- a/GLideN64/src/GLideNHQ/Ext_TxFilter.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include "Ext_TxFilter.h" - -typedef boolean (*txfilter_init)(int maxwidth, int maxheight, int maxbpp, - int options, int cachesize, - const wchar_t *path, const wchar_t *ident, - dispInfoFuncExt callback); - -typedef void (*txfilter_shutdown)(void); - -typedef boolean (*txfilter_filter)(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat, - uint64 g64crc, GHQTexInfo *info); - -typedef boolean (*txfilter_hirestex)(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info); - -typedef uint64 (*txfilter_checksum)(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette); - -typedef boolean (*txfilter_dmptx)(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64); - -typedef boolean (*txfilter_reloadhirestex)(); - -static struct { - TXHMODULE lib; - txfilter_init init; - txfilter_shutdown shutdown; - txfilter_filter filter; - txfilter_hirestex hirestex; - txfilter_checksum checksum; - txfilter_dmptx dmptx; - txfilter_reloadhirestex reloadhirestex; -} txfilter; - -void ext_ghq_shutdown(void) -{ - if (txfilter.shutdown) - (*txfilter.shutdown)(); - - if (txfilter.lib) { - DLCLOSE(txfilter.lib); - memset(&txfilter, 0, sizeof(txfilter)); - } -} - -boolean ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, - const wchar_t *path, const wchar_t *ident, - dispInfoFuncExt callback) -{ - boolean bRet = 0; - - if (!txfilter.lib) { - wchar_t curpath[MAX_PATH]; - wcscpy(curpath, path); -#ifdef WIN32 -#ifdef GHQCHK - wcscat(curpath, wst("\\ghqchk.dll")); -#else - wcscat(curpath, wst("\\GlideHQ.dll")); -#endif - txfilter.lib = DLOPEN(curpath); -#else - char cbuf[MAX_PATH]; -#ifdef GHQCHK - wcscat(curpath, wst("/ghqchk.so")); -#else - wcscat(curpath, wst("/GlideHQ.so")); -#endif - wcstombs(cbuf, curpath, MAX_PATH); - txfilter.lib = DLOPEN(cbuf); -#endif - } - - if (txfilter.lib) { - if (!txfilter.init) - txfilter.init = (txfilter_init)DLSYM(txfilter.lib, "txfilter_init"); - if (!txfilter.shutdown) - txfilter.shutdown = (txfilter_shutdown)DLSYM(txfilter.lib, "txfilter_shutdown"); - if (!txfilter.filter) - txfilter.filter = (txfilter_filter)DLSYM(txfilter.lib, "txfilter_filter"); - if (!txfilter.hirestex) - txfilter.hirestex = (txfilter_hirestex)DLSYM(txfilter.lib, "txfilter_hirestex"); - if (!txfilter.checksum) - txfilter.checksum = (txfilter_checksum)DLSYM(txfilter.lib, "txfilter_checksum"); - if (!txfilter.dmptx) - txfilter.dmptx = (txfilter_dmptx)DLSYM(txfilter.lib, "txfilter_dmptx"); - if (!txfilter.reloadhirestex) - txfilter.reloadhirestex = (txfilter_reloadhirestex)DLSYM(txfilter.lib, "txfilter_reloadhirestex"); - } - - if (txfilter.init && txfilter.shutdown && txfilter.filter && - txfilter.hirestex && txfilter.checksum /*&& txfilter.dmptx && txfilter.reloadhirestex */) - bRet = (*txfilter.init)(maxwidth, maxheight, maxbpp, options, cachesize, path, ident, callback); - else - ext_ghq_shutdown(); - - return bRet; -} - -boolean ext_ghq_txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat, - uint64 g64crc, GHQTexInfo *info) -{ - boolean ret = 0; - - if (txfilter.filter) - ret = (*txfilter.filter)(src, srcwidth, srcheight, srcformat, - g64crc, info); - - return ret; -} - -boolean ext_ghq_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info) -{ - boolean ret = 0; - - if (txfilter.hirestex) - ret = (*txfilter.hirestex)(g64crc, r_crc64, palette, info); - - return ret; -} - -uint64 ext_ghq_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette) -{ - uint64 ret = 0; - - if (txfilter.checksum) - ret = (*txfilter.checksum)(src, width, height, size, rowStride, palette); - - return ret; -} - -boolean ext_ghq_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64) -{ - boolean ret = 0; - - if (txfilter.dmptx) - ret = (*txfilter.dmptx)(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64); - - return ret; -} - -boolean ext_ghq_reloadhirestex() -{ - boolean ret = 0; - - if (txfilter.reloadhirestex) - ret = (*txfilter.reloadhirestex)(); - - return ret; -} diff --git a/GLideN64/src/GLideNHQ/Ext_TxFilter.h b/GLideN64/src/GLideNHQ/Ext_TxFilter.h deleted file mode 100644 index 7185637..0000000 --- a/GLideN64/src/GLideNHQ/Ext_TxFilter.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __EXT_TXFILTER_H__ -#define __EXT_TXFILTER_H__ - -#ifdef OS_WINDOWS -#include -#define TXHMODULE HMODULE -#define DLOPEN(a) LoadLibraryW(a) -#define DLCLOSE(a) FreeLibrary(a) -#define DLSYM(a, b) GetProcAddress(a, b) -#define GETCWD(a, b) GetCurrentDirectoryW(a, b) -#define CHDIR(a) SetCurrentDirectoryW(a) -#else -#include -#include -#include -#define MAX_PATH 4095 -#define TXHMODULE void* -#define DLOPEN(a) dlopen(a, RTLD_LAZY|RTLD_GLOBAL) -#define DLCLOSE(a) dlclose(a) -#define DLSYM(a, b) dlsym(a, b) -#define GETCWD(a, b) getcwd(b, a) -#define CHDIR(a) chdir(a) -#endif - -#ifdef __MSC__ -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else -typedef long long int64; -typedef unsigned long long uint64; -typedef unsigned char boolean; -#endif - -#define NO_OPTIONS 0x00000000 - -#define FILTER_MASK 0x000000ff -#define NO_FILTER 0x00000000 -#define SMOOTH_FILTER_MASK 0x0000000f -#define NO_SMOOTH_FILTER 0x00000000 -#define SMOOTH_FILTER_1 0x00000001 -#define SMOOTH_FILTER_2 0x00000002 -#define SMOOTH_FILTER_3 0x00000003 -#define SMOOTH_FILTER_4 0x00000004 -#define SHARP_FILTER_MASK 0x000000f0 -#define NO_SHARP_FILTER 0x00000000 -#define SHARP_FILTER_1 0x00000010 -#define SHARP_FILTER_2 0x00000020 - -#define ENHANCEMENT_MASK 0x00000f00 -#define NO_ENHANCEMENT 0x00000000 -#define X2_ENHANCEMENT 0x00000100 -#define X2SAI_ENHANCEMENT 0x00000200 -#define HQ2X_ENHANCEMENT 0x00000300 -#define LQ2X_ENHANCEMENT 0x00000400 -#define HQ4X_ENHANCEMENT 0x00000500 -#define HQ2XS_ENHANCEMENT 0x00000600 -#define LQ2XS_ENHANCEMENT 0x00000700 -#define BRZ2X_ENHANCEMENT 0x00000800 -#define BRZ3X_ENHANCEMENT 0x00000900 -#define BRZ4X_ENHANCEMENT 0x00000a00 -#define BRZ5X_ENHANCEMENT 0x00000b00 -#define BRZ6X_ENHANCEMENT 0x00000c00 - -#define DEPOSTERIZE 0x00001000 - -#define HIRESTEXTURES_MASK 0x000f0000 -#define NO_HIRESTEXTURES 0x00000000 -#define GHQ_HIRESTEXTURES 0x00010000 -#define RICE_HIRESTEXTURES 0x00020000 -#define JABO_HIRESTEXTURES 0x00030000 - -#define FILE_CACHE_MASK 0x00300000 -#define FILE_TEXCACHE 0x00100000 -#define FILE_HIRESTEXCACHE 0x00200000 -#define GZ_TEXCACHE 0x00400000 -#define GZ_HIRESTEXCACHE 0x00800000 -#define DUMP_TEXCACHE 0x01000000 -#define DUMP_HIRESTEXCACHE 0x02000000 -#define TILE_HIRESTEX 0x04000000 -#define UNDEFINED_0 0x08000000 -#define FORCE16BPP_HIRESTEX 0x10000000 -#define FORCE16BPP_TEX 0x20000000 -#define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */ -#define DUMP_TEX 0x80000000 - -struct GHQTexInfo { - unsigned char *data = nullptr; - int width = 0; - int height = 0; - unsigned int format = 0; - unsigned short texture_format = 0; - unsigned short pixel_type = 0; - unsigned char is_hires_tex = 0; -}; - -/* Callback to display hires texture info. - * Gonetz - * - * void DispInfo(const char *format, ...) - * { - * va_list args; - * char buf[INFO_BUF]; - * - * va_start(args, format); - * vsprintf(buf, format, args); - * va_end(args); - * - * printf(buf); - * } - */ -#define INFO_BUF 4095 -typedef void (*dispInfoFuncExt)(const wchar_t *format, ...); - -/* dll exports */ -/* Use TXFilter as a library. Define exported functions. */ -#ifdef OS_WINDOWS -#ifdef TXFILTER_LIB -#define TAPI __declspec(dllexport) -#define TAPIENTRY -#else -#define TAPI -#define TAPIENTRY -#endif -#else // OS_WINDOWS -#ifdef TXFILTER_LIB -#define TAPI __attribute__((visibility("default"))) -#define TAPIENTRY -#else -#define TAPI -#define TAPIENTRY -#endif -#endif // OS_WINDOWS - -#ifdef TXFILTER_DLL -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned long uint32; - -boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */ - int maxheight,/* maximum texture height supported by hardware */ - int maxbpp, /* maximum texture bpp supported by hardware */ - int options, /* options */ - int cachesize,/* cache textures to system memory */ - const wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */ - const wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */ - dispInfoFuncExt callback /* callback function to display info */ - ); - -void ext_ghq_shutdown(void); - -boolean ext_ghq_txfilter(unsigned char *src, /* input texture */ - int srcwidth, /* width of input texture */ - int srcheight, /* height of input texture */ - unsigned short srcformat, /* format of input texture */ - uint64 g64crc, /* glide64 crc */ - GHQTexInfo *info /* output */ - ); - -boolean ext_ghq_hirestex(uint64 g64crc, /* glide64 crc */ - uint64 r_crc64, /* checksum hi:palette low:texture */ - unsigned short *palette, /* palette for CI textures */ - GHQTexInfo *info /* output */ - ); - -uint64 ext_ghq_checksum(unsigned char *src, /* input texture */ - int width, /* width of texture */ - int height, /* height of texture */ - int size, /* type of texture pixel */ - int rowStride, /* row stride in bytes */ - unsigned char *palette /* palette */ - ); - -boolean ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */ - int width, /* width of texture */ - int height, /* height of texture */ - int rowStridePixel, /* row stride of input texture in pixels */ - unsigned short gfmt, /* glide format of input texture */ - unsigned short n64fmt,/* N64 format hi:format low:size */ - uint64 r_crc64 /* checksum hi:palette low:texture */ - ); - -boolean ext_ghq_reloadhirestex(); - -#else - -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; - -#ifdef __cplusplus -extern "C"{ -#endif - -TAPI boolean TAPIENTRY -txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, - const wchar_t *txCachePath, const wchar_t *txDumpPath, const wchar_t * texPackPath, - const wchar_t* ident, dispInfoFuncExt callback); - -TAPI void TAPIENTRY -txfilter_shutdown(void); - -TAPI boolean TAPIENTRY -txfilter_filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, - uint64 g64crc, GHQTexInfo *info); - -TAPI boolean TAPIENTRY -txfilter_hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info); - -TAPI uint64 TAPIENTRY -txfilter_checksum(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette); - -TAPI boolean TAPIENTRY -txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64); - -TAPI boolean TAPIENTRY -txfilter_reloadhirestex(); - -TAPI void TAPIENTRY -txfilter_dumpcache(void); - -#ifdef __cplusplus -} -#endif - -#endif /* TXFILTER_DLL */ - -#endif /* __EXT_TXFILTER_H__ */ diff --git a/GLideN64/src/GLideNHQ/GlideHQ.rc b/GLideN64/src/GLideNHQ/GlideHQ.rc deleted file mode 100644 index 9346c06..0000000 --- a/GLideN64/src/GLideNHQ/GlideHQ.rc +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "bldno.h" - -#define ID(id) id - -#define VS_FILE_INFO ID(16) /* Version stamp res type */ -#define VS_VERSION_INFO ID(1) /* Version stamp res ID */ -#define VS_USER_DEFINED ID(100) /* User-defined res IDs */ - -#define VOS_DOS_WINDOWS32 0x00010004L -#define VFT_DLL 0x00000002L -#define VER_PRERELEASE 0 -#define VER_PRIVATEBUILD 0 -#define VER_DEBUG 0 - -#define VERSIONNAME "GlideHQ.dll\0" -#define PRODNAME "GlideHQ\0" -#define DESCRIPT "Texture filtering DLL\0" -#define COPYRIGHTSTR "Copyright (C) 2007 Hiroshi Morii\0" -#define CONTACTSTR "Hiroshi Morii http://www.3dfxzone.it/koolsmoky\0" - -#define MANVERSION 1 -#define MANREVISION 02 -#define MINVERSION 00 - -#define VERSIONSTR "1.02.00." BUILD_NUMBER_STR - -VS_VERSION_INFO VERSIONINFO - FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER - PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER - FILEFLAGSMASK 0x0030003FL - FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) - - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - BEGIN - VALUE "FileDescription", DESCRIPT - VALUE "FileVersion", VERSIONSTR - VALUE "InternalName", VERSIONNAME - VALUE "LegalCopyright", COPYRIGHTSTR - VALUE "OriginalFilename", VERSIONNAME - VALUE "ProductName", PRODNAME - VALUE "ProductVersion", VERSIONSTR - VALUE "Contact", CONTACTSTR - END - END - BLOCK "VarFileInfo" - BEGIN - /* the following line should be extended for localized versions */ - VALUE "Translation", 0x409, 1252 - END -END diff --git a/GLideN64/src/GLideNHQ/README.txt b/GLideN64/src/GLideNHQ/README.txt deleted file mode 100644 index c903e57..0000000 --- a/GLideN64/src/GLideNHQ/README.txt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * GlideHQ (Texture enhancer library for Glide64) - * Version: 1.5 - * - * Copyright (C) 2007 Hiroshi Morii aka KoolSmoky All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -About: -This is a realtime texture enhancer library with hi-resolution texture -pack support for Glide64 (http://glide64.emuxhaven.net). Traditional and -non-traditional techniques have been used to achieve speed and high image -quality even on a 9 year old 3Dfx Voodoo2. - -Although the 3Dfx Glide3x texture format naming conventions are used, the -library can be expanded for generic use. - -Supported: -OS: 32bit Linux and MS Windows -Enhancers: Hq4x, Hq2x, Hq2xS, Lq2x, Lq2xS, Super2xSai, x2 -Filters: Smooth (1,2,3,4), Sharp (1,2) -Compressors: FXT1, S3TC -Input formats: GR_TEXFMT_ALPHA_8, - GR_TEXFMT_RGB_565, - GR_TEXFMT_ARGB_1555, - GR_TEXFMT_ARGB_4444, - GR_TEXFMT_ARGB_8888, - GR_TEXFMT_ALPHA_INTENSITY_44, - GR_TEXFMT_ALPHA_INTENSITY_88 -Output formats: Same as input unless compression or hires packs are used. -Hires texture packs: Rice format (Jabo and GlideHQ format coming later) - -Acknowledgments: -I hope you enjoy GlideHQ (texture enhancer library for Glide64). Greatest -thanks to Gonetz for making this happen in his busy time. We've rushed -everything to share the eye-candy with all of you N64 emulation fans. I -would also like to thank a great friend of mine, Daniel Borca for providing -the texture compression code, Maxim Stepin (hq2x 4x), and Derek Liauw Kie Fa -(2xSaI) for the filtering engines, Rice for his N64 graphics plugin source -code, and Mudlord for the hq2xS lq2xS code. GlideHQ also uses the boost C++ -libraries, zlib general purpose compression library, and the Portable Network -Graphics library. Thanks to all the developers for making them available. And -special thanks to the Glide64 beta testing crew. Without their feedbacks -this library would not have seen daylight. Thank you all. - -The source code for GlideHQ is released in hopes that it will be improved. -I know the coding is not on par after so much late night caffeine boosts. -If you have suggestions or modifications, please feel free to post them on -the Glide64 forum at emuxhaven. - -Porting the library to other platforms should not be so hard. The coding is -done with cross platform compatibility in mind and will build with GCC and -GNU make. Currently supported are 32bit Linux and MS Windows. - -If you are looking for driver updates for your 3Dfx Interactive Inc. gfx -card, grab them from the forums at http://www.3dfxzone.it/enboard/ -Unbelievable as it seems, drivers are still being updated after 6 years -from 3Dfx's demise. - -I know N64 rules, anyone up for PSX? :)) - --KoolSmoky - -References: -[1] R.W. Floyd & L. Steinberg, An adaptive algorithm for spatial grey scale, - Proceedings of the Society of Information Display 17, pp75-77, 1976 -[2] Ken Turkowski, Filters for Common Resampling Tasks, Apple Computer 1990 - http://www.worldserver.com/turk/computergraphics/ResamplingFilters.pdf -[3] Don P. Mitchell and Arun N. Netravali, Reconstruction Filters in Computer - Graphics, SIGGRAPH '88, Proceedings of the 15th annual conference on - Computer graphics and interactive techniques, pp221-228, 1988 -[4] J. F. Kaiser and W. A. Reed, Data smoothing using low-pass digital - filters, Rev. Sci. instrum. 48 (11), pp1447-1457, 1977 -[5] Maxim Stepin, hq4x Magnification Filter, http://www.hiend3d.com/hq4x.html -[6] Derek Liauw Kie Fa, 2xSaI, http://elektron.its.tudelft.nl/~dalikifa -[7] Dirk Stevens, Eagle engine http://www.retrofx.com/rfxtech.html -[8] 3DFX_texture_compression_FXT1 and EXT_texture_compression_s3tc extension - specs from the OpenGL Extension Registry. http://oss.sgi.com/projects/ - ogl-sample/registry/ diff --git a/GLideN64/src/GLideNHQ/TextureFilters.cpp b/GLideN64/src/GLideNHQ/TextureFilters.cpp deleted file mode 100644 index dac694b..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters.cpp +++ /dev/null @@ -1,816 +0,0 @@ -/* -Copyright (C) 2003 Rice1964 - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/* Copyright (C) 2007 Hiroshi Morii - * Modified for the Texture Filtering library - */ - -#include -#include -#include -#include "TextureFilters.h" -#include "TxUtil.h" - -/************************************************************************/ -/* 2X filters */ -/************************************************************************/ - -#define DWORD_MAKE(r, g, b, a) ((uint32) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) -#define WORD_MAKE(r, g, b, a) ((uint16) (((a) << 12) | ((r) << 8) | ((g) << 4) | (b))) - -// Basic 2x R8G8B8A8 filter with interpolation - -void Texture2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint32 *pDst1, *pDst2; - uint32 *pSrc, *pSrc2; - uint32 nWidth = width; - uint32 nHeight = height; - - uint32 b1 = 0; - uint32 g1 = 0; - uint32 r1 = 0; - uint32 a1 = 0; - uint32 b2 = 0; - uint32 g2 = 0; - uint32 r2 = 0; - uint32 a2 = 0; - uint32 b3 = 0; - uint32 g3 = 0; - uint32 r3 = 0; - uint32 a3 = 0; - uint32 b4 = 0; - uint32 g4 = 0; - uint32 r4 = 0; - uint32 a4 = 0; - - uint32 xSrc; - uint32 ySrc; - - for (ySrc = 0; ySrc < nHeight; ySrc++) - { - pSrc = (uint32*)(((uint8*)srcPtr)+ySrc*srcPitch); - pSrc2 = (uint32*)(((uint8*)srcPtr)+(ySrc+1)*srcPitch); - pDst1 = (uint32*)(((uint8*)dstPtr)+(ySrc*2)*dstPitch); - pDst2 = (uint32*)(((uint8*)dstPtr)+(ySrc*2+1)*dstPitch); - - for (xSrc = 0; xSrc < nWidth; xSrc++) - { - b1 = (pSrc[xSrc]>>0)&0xFF; - g1 = (pSrc[xSrc]>>8)&0xFF; - r1 = (pSrc[xSrc]>>16)&0xFF; - a1 = (pSrc[xSrc]>>24)&0xFF; - - if( xSrc>0)&0xFF; - g2 = (pSrc[xSrc+1]>>8)&0xFF; - r2 = (pSrc[xSrc+1]>>16)&0xFF; - a2 = (pSrc[xSrc+1]>>24)&0xFF; - } - - if( ySrc>0)&0xFF; - g3 = (pSrc2[xSrc]>>8)&0xFF; - r3 = (pSrc2[xSrc]>>16)&0xFF; - a3 = (pSrc2[xSrc]>>24)&0xFF; - if( xSrc>0)&0xFF; - g4 = (pSrc2[xSrc+1]>>8)&0xFF; - r4 = (pSrc2[xSrc+1]>>16)&0xFF; - a4 = (pSrc2[xSrc+1]>>24)&0xFF; - } - } - - - // Pixel 1 - pDst1[xSrc*2] = pSrc[xSrc]; - - // Pixel 2 - if( xSrc> 0)&0xF; - g1 = (pSrc[xSrc]>> 4)&0xF; - r1 = (pSrc[xSrc]>> 8)&0xF; - a1 = (pSrc[xSrc]>>12)&0xF; - - if( xSrc> 0)&0xF; - g2 = (pSrc[xSrc+1]>> 4)&0xF; - r2 = (pSrc[xSrc+1]>> 8)&0xF; - a2 = (pSrc[xSrc+1]>>12)&0xF; - } - - if( ySrc> 0)&0xF; - g3 = (pSrc2[xSrc]>> 4)&0xF; - r3 = (pSrc2[xSrc]>> 8)&0xF; - a3 = (pSrc2[xSrc]>>12)&0xF; - if( xSrc> 0)&0xF; - g4 = (pSrc2[xSrc+1]>> 4)&0xF; - r4 = (pSrc2[xSrc+1]>> 8)&0xF; - a4 = (pSrc2[xSrc+1]>>12)&0xF; - } - } - - // Pixel 1 - pDst1[xSrc*2] = pSrc[xSrc]; - - // Pixel 2 - if( xSrc - */ -void SharpFilter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter) -{ - // NOTE: for now we get away with copying the boundaries - // filter the boundaries if we face problems - - uint32 mul1, mul2, mul3, shift4; - - uint32 x,y,z; - uint32 *_src1, *_src2, *_src3, *_dest; - uint32 val[4]; - uint32 t1,t2,t3,t4,t5,t6,t7,t8,t9; - - switch( filter ) - { - case SHARP_FILTER_2: - mul1=1; - mul2=8; - mul3=12; - shift4=2; - break; - case SHARP_FILTER_1: - default: - mul1=1; - mul2=8; - mul3=16; - shift4=3; - break; - } - - // setup rows - _src1 = src; - _src2 = _src1 + srcwidth; - _src3 = _src2 + srcwidth; - _dest = dest; - - // copy the first row - memcpy(_dest, _src1, (srcwidth << 2)); - _dest += srcwidth; - // filter 2nd row to 1 row before the last - for (y = 1; y < srcheight-1; y++) { - // copy the first pixel - _dest[0] = *_src2; - // filter 2nd pixel to 1 pixel before last - for (x = 1; x < srcwidth-1; x++) { - for (z=0; z<4; z++) { - t1 = *((uint8*)(_src1+x-1)+z); - t2 = *((uint8*)(_src1+x )+z); - t3 = *((uint8*)(_src1+x+1)+z); - t4 = *((uint8*)(_src2+x-1)+z); - t5 = *((uint8*)(_src2+x )+z); - t6 = *((uint8*)(_src2+x+1)+z); - t7 = *((uint8*)(_src3+x-1)+z); - t8 = *((uint8*)(_src3+x )+z); - t9 = *((uint8*)(_src3+x+1)+z); - - if( (t5*mul2) > (t1+t3+t7+t9+t2+t4+t6+t8)*mul1 ) { - val[z]= ((t5*mul3) - (t1+t3+t7+t9+t2+t4+t6+t8)*mul1)>>shift4; - if (val[z] > 0xFF) val[z] = 0xFF; - } else { - val[z] = t5; - } - } - _dest[x] = val[0]|(val[1]<<8)|(val[2]<<16)|(val[3]<<24); - } - // copy the ending pixel - _dest[srcwidth-1] = *(_src3 - 1); - // next row - _src1 += srcwidth; - _src2 += srcwidth; - _src3 += srcwidth; - _dest += srcwidth; - } - // copy the last row - memcpy(_dest, _src2, (srcwidth << 2)); -} - -#if !_16BPP_HACK -void SharpFilter_4444(uint16 *src, uint32 srcwidth, uint32 srcheight, uint16 *dest, uint32 filter) -{ - // NOTE: for now we get away with copying the boundaries - // filter the boundaries if we face problems - - uint16 mul1, mul2, mul3, shift4; - - uint32 x,y,z; - uint16 *_src1, *_src2, *_src3, *_dest; - uint16 val[4]; - uint16 t1,t2,t3,t4,t5,t6,t7,t8,t9; - - switch( filter ) { - case SHARP_FILTER_2: - mul1=1; - mul2=8; - mul3=12; - shift4=2; - break; - case SHARP_FILTER_1: - default: - mul1=1; - mul2=8; - mul3=16; - shift4=3; - break; - } - - // setup rows - _src1 = src; - _src2 = _src1 + srcwidth; - _src3 = _src2 + srcwidth; - _dest = dest; - - // copy the first row - memcpy(_dest, _src1, (srcwidth << 1)); - _dest += srcwidth; - // filter 2nd row to 1 row before the last - for( y = 1; y < srcheight - 1; y++) { - // copy the first pixel - _dest[0] = *_src2; - // filter 2nd pixel to 1 pixel before last - for( x = 1; x < srcwidth - 1; x++) { - for( z = 0; z < 4; z++ ) { - /* Hiroshi Morii - * Read the entire 16bit pixel and then extract the A,R,G,B components. - */ - uint32 shift = z << 2; - t1 = ((*((uint16*)(_src1+x-1))) >> shift) & 0xF; - t2 = ((*((uint16*)(_src1+x ))) >> shift) & 0xF; - t3 = ((*((uint16*)(_src1+x+1))) >> shift) & 0xF; - t4 = ((*((uint16*)(_src2+x-1))) >> shift) & 0xF; - t5 = ((*((uint16*)(_src2+x ))) >> shift) & 0xF; - t6 = ((*((uint16*)(_src2+x+1))) >> shift) & 0xF; - t7 = ((*((uint16*)(_src3+x-1))) >> shift) & 0xF; - t8 = ((*((uint16*)(_src3+x ))) >> shift) & 0xF; - t9 = ((*((uint16*)(_src3+x+1))) >> shift) & 0xF; - - if( (t5*mul2) > (t1+t3+t7+t9+t2+t4+t6+t8)*mul1 ) { - val[z] = ((t5*mul3) - (t1+t3+t7+t9+t2+t4+t6+t8)*mul1)>>shift4; - if (val[z] > 0xF) val[z] = 0xF; - } else { - val[z] = t5; - } - } - _dest[x] = val[0]|(val[1]<<4)|(val[2]<<8)|(val[3]<<12); - } - // copy the ending pixel - _dest[srcwidth-1] = *(_src3 - 1); - // next row - _src1 += srcwidth; - _src2 += srcwidth; - _src3 += srcwidth; - _dest += srcwidth; - } - // copy the last row - memcpy(_dest, _src2, (srcwidth << 1)); -} -#endif /* !_16BPP_HACK */ - -/* - * Smooth filters - * Hiroshi Morii - */ -void SmoothFilter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter) -{ - // NOTE: for now we get away with copying the boundaries - // filter the boundaries if we face problems - - uint32 mul1, mul2, mul3, shift4; - - uint32 x,y,z; - uint32 *_src1, *_src2, *_src3, *_dest; - uint32 val[4]; - uint32 t1,t2,t3,t4,t5,t6,t7,t8,t9; - - switch( filter ) { - case SMOOTH_FILTER_4: - mul1=1; - mul2=2; - mul3=4; - shift4=4; - break; - case SMOOTH_FILTER_3: - mul1=1; - mul2=1; - mul3=8; - shift4=4; - break; - case SMOOTH_FILTER_2: - mul1=1; - mul2=1; - mul3=2; - shift4=2; - break; - case SMOOTH_FILTER_1: - default: - mul1=1; - mul2=1; - mul3=6; - shift4=3; - break; - } - - switch (filter) { - case SMOOTH_FILTER_3: - case SMOOTH_FILTER_4: - // setup rows - _src1 = src; - _src2 = _src1 + srcwidth; - _src3 = _src2 + srcwidth; - _dest = dest; - // copy the first row - memcpy(_dest, _src1, (srcwidth << 2)); - _dest += srcwidth; - // filter 2nd row to 1 row before the last - for (y = 1; y < srcheight - 1; y++){ - // copy the first pixel - _dest[0] = _src2[0]; - // filter 2nd pixel to 1 pixel before last - for (x = 1; x < srcwidth - 1; x++) { - for (z = 0; z < 4; z++ ) { - t1 = *((uint8*)(_src1+x-1)+z); - t2 = *((uint8*)(_src1+x )+z); - t3 = *((uint8*)(_src1+x+1)+z); - t4 = *((uint8*)(_src2+x-1)+z); - t5 = *((uint8*)(_src2+x )+z); - t6 = *((uint8*)(_src2+x+1)+z); - t7 = *((uint8*)(_src3+x-1)+z); - t8 = *((uint8*)(_src3+x )+z); - t9 = *((uint8*)(_src3+x+1)+z); - /* the component value must not overflow 0xFF */ - val[z] = ((t1+t3+t7+t9)*mul1+((t2+t4+t6+t8)*mul2)+(t5*mul3))>>shift4; - if (val[z] > 0xFF) val[z] = 0xFF; - } - _dest[x] = val[0]|(val[1]<<8)|(val[2]<<16)|(val[3]<<24); - } - // copy the ending pixel - _dest[srcwidth-1] = *(_src3 - 1); - // next row - _src1 += srcwidth; - _src2 += srcwidth; - _src3 += srcwidth; - _dest += srcwidth; - } - // copy the last row - memcpy(_dest, _src2, (srcwidth << 2)); - break; - case SMOOTH_FILTER_1: - case SMOOTH_FILTER_2: - default: - // setup rows - _src1 = src; - _src2 = _src1 + srcwidth; - _src3 = _src2 + srcwidth; - _dest = dest; - // copy the first row - memcpy(_dest, _src1, (srcwidth << 2)); - _dest += srcwidth; - // filter 2nd row to 1 row before the last - for (y = 1; y < srcheight - 1; y++) { - // filter 1st pixel to the last - if (y & 1) { - for( x = 0; x < srcwidth; x++) { - for( z = 0; z < 4; z++ ) { - t2 = *((uint8*)(_src1+x )+z); - t5 = *((uint8*)(_src2+x )+z); - t8 = *((uint8*)(_src3+x )+z); - /* the component value must not overflow 0xFF */ - val[z] = ((t2+t8)*mul2+(t5*mul3))>>shift4; - if (val[z] > 0xFF) val[z] = 0xFF; - } - _dest[x] = val[0]|(val[1]<<8)|(val[2]<<16)|(val[3]<<24); - } - } else { - memcpy(_dest, _src2, (srcwidth << 2)); - } - // next row - _src1 += srcwidth; - _src2 += srcwidth; - _src3 += srcwidth; - _dest += srcwidth; - } - // copy the last row - memcpy(_dest, _src2, (srcwidth << 2)); - break; - } -} - -#if !_16BPP_HACK -void SmoothFilter_4444(uint16 *src, uint32 srcwidth, uint32 srcheight, uint16 *dest, uint32 filter) -{ - // NOTE: for now we get away with copying the boundaries - // filter the boundaries if we face problems - - uint16 mul1, mul2, mul3, shift4; - - uint32 x,y,z; - uint16 *_src1, *_src2, *_src3, *_dest; - uint16 val[4]; - uint16 t1,t2,t3,t4,t5,t6,t7,t8,t9; - - switch( filter ) { - case SMOOTH_FILTER_4: - mul1=1; - mul2=2; - mul3=4; - shift4=4; - break; - case SMOOTH_FILTER_3: - mul1=1; - mul2=1; - mul3=8; - shift4=4; - break; - case SMOOTH_FILTER_2: - mul1=1; - mul2=1; - mul3=2; - shift4=2; - break; - case SMOOTH_FILTER_1: - default: - mul1=1; - mul2=1; - mul3=6; - shift4=3; - break; - } - - switch (filter) { - case SMOOTH_FILTER_3: - case SMOOTH_FILTER_4: - // setup rows - _src1 = src; - _src2 = _src1 + srcwidth; - _src3 = _src2 + srcwidth; - _dest = dest; - // copy the first row - memcpy(_dest, _src1, (srcwidth << 1)); - _dest += srcwidth; - // filter 2nd row to 1 row before the last - for (y = 1; y < srcheight - 1; y++) { - // copy the first pixel - _dest[0] = *_src2; - // filter 2nd pixel to 1 pixel before last - for (x = 1; x < srcwidth - 1; x++) { - for (z = 0; z < 4; z++ ) { - /* Read the entire 16bit pixel and then extract the A,R,G,B components. */ - uint32 shift = z << 2; - t1 = ((*(uint16*)(_src1+x-1)) >> shift) & 0xF; - t2 = ((*(uint16*)(_src1+x )) >> shift) & 0xF; - t3 = ((*(uint16*)(_src1+x+1)) >> shift) & 0xF; - t4 = ((*(uint16*)(_src2+x-1)) >> shift) & 0xF; - t5 = ((*(uint16*)(_src2+x )) >> shift) & 0xF; - t6 = ((*(uint16*)(_src2+x+1)) >> shift) & 0xF; - t7 = ((*(uint16*)(_src3+x-1)) >> shift) & 0xF; - t8 = ((*(uint16*)(_src3+x )) >> shift) & 0xF; - t9 = ((*(uint16*)(_src3+x+1)) >> shift) & 0xF; - /* the component value must not overflow 0xF */ - val[z] = ((t1+t3+t7+t9)*mul1+((t2+t4+t6+t8)*mul2)+(t5*mul3))>>shift4; - if (val[z] > 0xF) val[z] = 0xF; - } - _dest[x] = val[0]|(val[1]<<4)|(val[2]<<8)|(val[3]<<12); - } - // copy the ending pixel - _dest[srcwidth-1] = *(_src3 - 1); - // next row - _src1 += srcwidth; - _src2 += srcwidth; - _src3 += srcwidth; - _dest += srcwidth; - } - // copy the last row - memcpy(_dest, _src2, (srcwidth << 1)); - break; - case SMOOTH_FILTER_1: - case SMOOTH_FILTER_2: - default: - // setup rows - _src1 = src; - _src2 = _src1 + srcwidth; - _src3 = _src2 + srcwidth; - _dest = dest; - // copy the first row - memcpy(_dest, _src1, (srcwidth << 1)); - _dest += srcwidth; - // filter 2nd row to 1 row before the last - for( y = 1; y < srcheight - 1; y++) { - if (y & 1) { - for( x = 0; x < srcwidth; x++) { - for( z = 0; z < 4; z++ ) { - /* Read the entire 16bit pixel and then extract the A,R,G,B components. */ - uint32 shift = z << 2; - t2 = ((*(uint16*)(_src1+x)) >> shift) & 0xF; - t5 = ((*(uint16*)(_src2+x)) >> shift) & 0xF; - t8 = ((*(uint16*)(_src3+x)) >> shift) & 0xF; - /* the component value must not overflow 0xF */ - val[z] = ((t2+t8)*mul2+(t5*mul3))>>shift4; - if (val[z] > 0xF) val[z] = 0xF; - } - _dest[x] = val[0]|(val[1]<<4)|(val[2]<<8)|(val[3]<<12); - } - } else { - memcpy(_dest, _src2, (srcwidth << 1)); - } - // next row - _src1 += srcwidth; - _src2 += srcwidth; - _src3 += srcwidth; - _dest += srcwidth; - } - // copy the last row - memcpy(_dest, _src2, (srcwidth << 1)); - break; - } -} -#endif /* !_16BPP_HACK */ - -// deposterization: smoothes posterized gradients from low-color-depth (e.g. 444, 565, compressed) sources -// Copyright (c) 2012- PPSSPP Project. -static -void deposterizeH(uint32* data, uint32* out, int w, int l, int u) { - static const int T = 8; - for (int y = l; y < u; ++y) { - for (int x = 0; x < w; ++x) { - int inpos = y*w + x; - uint32 center = data[inpos]; - if (x == 0 || x == w - 1) { - out[y*w + x] = center; - continue; - } - uint32 left = data[inpos - 1]; - uint32 right = data[inpos + 1]; - out[y*w + x] = 0; - for (int c = 0; c < 4; ++c) { - uint8 lc = ((left >> c * 8) & 0xFF); - uint8 cc = ((center >> c * 8) & 0xFF); - uint8 rc = ((right >> c * 8) & 0xFF); - if ((lc != rc) && ((lc == cc && abs((int)((int)rc) - cc) <= T) || (rc == cc && abs((int)((int)lc) - cc) <= T))) { - // blend this component - out[y*w + x] |= ((rc + lc) / 2) << (c * 8); - } - else { - // no change for this component - out[y*w + x] |= cc << (c * 8); - } - } - } - } -} - -static -void deposterizeV(uint32* data, uint32* out, int w, int h, int l, int u) { - static const int BLOCK_SIZE = 32; - static const int T = 8; - for (int xb = 0; xb < w / BLOCK_SIZE + 1; ++xb) { - for (int y = l; y < u; ++y) { - for (int x = xb*BLOCK_SIZE; x < (xb + 1)*BLOCK_SIZE && x < w; ++x) { - uint32 center = data[y * w + x]; - if (y == 0 || y == h - 1) { - out[y*w + x] = center; - continue; - } - uint32 upper = data[(y - 1) * w + x]; - uint32 lower = data[(y + 1) * w + x]; - out[y*w + x] = 0; - for (int c = 0; c < 4; ++c) { - uint8 uc = ((upper >> c * 8) & 0xFF); - uint8 cc = ((center >> c * 8) & 0xFF); - uint8 lc = ((lower >> c * 8) & 0xFF); - if ((uc != lc) && ((uc == cc && abs((int)((int)lc) - cc) <= T) || (lc == cc && abs((int)((int)uc) - cc) <= T))) { - // blend this component - out[y*w + x] |= ((lc + uc) / 2) << (c * 8); - } - else { - // no change for this component - out[y*w + x] |= cc << (c * 8); - } - } - } - } - } -} - -static -void DePosterize(uint32* source, uint32* dest, uint32* buf, int width, int height) { - deposterizeH(source, buf, width, 0, height); - deposterizeV(buf, dest, width, height, 0, height); - deposterizeH(dest, buf, width, 0, height); - deposterizeV(buf, dest, width, height, 0, height); -} - -void filter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter, uint32 threadId) { - if (filter & DEPOSTERIZE) { - const auto bufSize = srcwidth * srcheight; - uint32 * tex = TxMemBuf::getInstance()->getThreadBuf(threadId, 0, bufSize); - uint32 * buf = TxMemBuf::getInstance()->getThreadBuf(threadId, 1, bufSize); - if (tex != nullptr && buf != nullptr) { - DePosterize(src, tex, buf, srcwidth, srcheight); - src = tex; - } - } - switch (filter & ENHANCEMENT_MASK) { - case BRZ2X_ENHANCEMENT: - xbrz::scale(2, (const uint32_t *)const_cast(src), (uint32_t *)dest, srcwidth, srcheight, xbrz::ColorFormat::ABGR); - return; - case BRZ3X_ENHANCEMENT: - xbrz::scale(3, (const uint32_t *)const_cast(src), (uint32_t *)dest, srcwidth, srcheight, xbrz::ColorFormat::ABGR); - return; - case BRZ4X_ENHANCEMENT: - xbrz::scale(4, (const uint32_t *)const_cast(src), (uint32_t *)dest, srcwidth, srcheight, xbrz::ColorFormat::ABGR); - return; - case BRZ5X_ENHANCEMENT: - xbrz::scale(5, (const uint32_t *)const_cast(src), (uint32_t *)dest, srcwidth, srcheight, xbrz::ColorFormat::ABGR); - return; - case BRZ6X_ENHANCEMENT: - xbrz::scale(6, (const uint32_t *)const_cast(src), (uint32_t *)dest, srcwidth, srcheight, xbrz::ColorFormat::ABGR); - return; - case HQ4X_ENHANCEMENT: - hq4x_8888((uint8*)src, (uint8*)dest, srcwidth, srcheight, srcwidth, (srcwidth << 4)); - return; - case HQ2X_ENHANCEMENT: - hq2x_32((uint8*)src, (srcwidth << 2), (uint8*)dest, (srcwidth << 3), srcwidth, srcheight); - return; - case HQ2XS_ENHANCEMENT: - hq2xS_32((uint8*)src, (srcwidth << 2), (uint8*)dest, (srcwidth << 3), srcwidth, srcheight); - return; - case LQ2X_ENHANCEMENT: - lq2x_32((uint8*)src, (srcwidth << 2), (uint8*)dest, (srcwidth << 3), srcwidth, srcheight); - return; - case LQ2XS_ENHANCEMENT: - lq2xS_32((uint8*)src, (srcwidth << 2), (uint8*)dest, (srcwidth << 3), srcwidth, srcheight); - return; - case X2SAI_ENHANCEMENT: - Super2xSaI_8888((uint32*)src, (uint32*)dest, srcwidth, srcheight, srcwidth); - return; - case X2_ENHANCEMENT: - Texture2x_32((uint8*)src, (srcwidth << 2), (uint8*)dest, (srcwidth << 3), srcwidth, srcheight); - return; - } - - switch (filter & (SMOOTH_FILTER_MASK|SHARP_FILTER_MASK)) { - case SMOOTH_FILTER_1: - case SMOOTH_FILTER_2: - case SMOOTH_FILTER_3: - case SMOOTH_FILTER_4: - SmoothFilter_8888((uint32*)src, srcwidth, srcheight, (uint32*)dest, (filter & SMOOTH_FILTER_MASK)); - return; - case SHARP_FILTER_1: - case SHARP_FILTER_2: - SharpFilter_8888((uint32*)src, srcwidth, srcheight, (uint32*)dest, (filter & SHARP_FILTER_MASK)); - return; - } -} diff --git a/GLideN64/src/GLideNHQ/TextureFilters.h b/GLideN64/src/GLideNHQ/TextureFilters.h deleted file mode 100644 index 86a5c5f..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifndef __TEXTUREFILTERS_H__ -#define __TEXTUREFILTERS_H__ - -/* 16bpp filters are somewhat buggy and output image is not clean. - * Since there's not much time, we'll just convert them to ARGB8888 - * and use 32bpp filters until fixed. - * (1:enable hack, 0:disable hack) */ -#define _16BPP_HACK 1 - -#include "TxInternal.h" -#include "TextureFilters_xbrz.h" - -/* enhancers */ -void hq4x_8888(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL); - -void hq2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); -void hq2xS_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); - -void lq2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); -void lq2xS_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); - -void Super2xSaI_8888(uint32 *srcPtr, uint32 *destPtr, uint32 width, uint32 height, uint32 pitch); - -void Texture2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); - -/* filters */ -void SharpFilter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter); - -void SmoothFilter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter); - -/* helper */ -void filter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter, uint32 threadId); - -#if !_16BPP_HACK -void hq4x_init(void); -void hq4x_4444(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL); -void hq4x_1555(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL); -void hq4x_565 (unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL); - -void hq2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); -void hq2xS_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); - -void lq2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); -void lq2xS_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); - -void Super2xSaI_4444(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch); -void Super2xSaI_1555(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch); -void Super2xSaI_565 (uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch); -void Super2xSaI_8 (uint8 *srcPtr, uint8 *destPtr, uint32 width, uint32 height, uint32 pitch); - -void Texture2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); - -void SharpFilter_4444(uint16 *src, uint32 srcwidth, uint32 srcheight, uint16 *dest, uint32 filter); - -void SmoothFilter_4444(uint16 *src, uint32 srcwidth, uint32 srcheight, uint16 *dest, uint32 filter); -#endif - -#endif /* __TEXTUREFILTERS_H__ */ diff --git a/GLideN64/src/GLideNHQ/TextureFilters_2xsai.cpp b/GLideN64/src/GLideNHQ/TextureFilters_2xsai.cpp deleted file mode 100644 index 38226df..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_2xsai.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Based on Derek Liauw Kie Fa and Rice1964 Super2xSaI code */ - -#include "TextureFilters.h" - -#define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D)) - -void Super2xSaI_8888(uint32 *srcPtr, uint32 *destPtr, uint32 width, uint32 height, uint32 pitch) -{ -#define SAI_INTERPOLATE_8888(A, B) ((A & 0xFEFEFEFE) >> 1) + ((B & 0xFEFEFEFE) >> 1) + (A & B & 0x01010101) -#define SAI_Q_INTERPOLATE_8888(A, B, C, D) ((A & 0xFCFCFCFC) >> 2) + ((B & 0xFCFCFCFC) >> 2) + ((C & 0xFCFCFCFC) >> 2) + ((D & 0xFCFCFCFC) >> 2) \ - + ((((A & 0x03030303) + (B & 0x03030303) + (C & 0x03030303) + (D & 0x03030303)) >> 2) & 0x03030303) - -#define SAI_INTERPOLATE SAI_INTERPOLATE_8888 -#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_8888 - - uint32 destWidth = width << 1; - uint32 destHeight = height << 1; - - uint32 color4, color5, color6; - uint32 color1, color2, color3; - uint32 colorA0, colorA1, colorA2, colorA3; - uint32 colorB0, colorB1, colorB2, colorB3; - uint32 colorS1, colorS2; - uint32 product1a, product1b, product2a, product2b; - -#include "TextureFilters_2xsai.h" - -#undef SAI_INTERPOLATE -#undef SAI_Q_INTERPOLATE -} - -#if !_16BPP_HACK -void Super2xSaI_4444(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch) -{ -#define SAI_INTERPOLATE_4444(A, B) ((A & 0xEEEE) >> 1) + ((B & 0xEEEE) >> 1) + (A & B & 0x1111) -#define SAI_Q_INTERPOLATE_4444(A, B, C, D) ((A & 0xCCCC) >> 2) + ((B & 0xCCCC) >> 2) + ((C & 0xCCCC) >> 2) + ((D & 0xCCCC) >> 2) \ - + ((((A & 0x3333) + (B & 0x3333) + (C & 0x3333) + (D & 0x3333)) >> 2) & 0x3333) - -#define SAI_INTERPOLATE SAI_INTERPOLATE_4444 -#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_4444 - - uint32 destWidth = width << 1; - uint32 destHeight = height << 1; - - uint16 color4, color5, color6; - uint16 color1, color2, color3; - uint16 colorA0, colorA1, colorA2, colorA3; - uint16 colorB0, colorB1, colorB2, colorB3; - uint16 colorS1, colorS2; - uint16 product1a, product1b, product2a, product2b; - -#include "TextureFilters_2xsai.h" - -#undef SAI_INTERPOLATE -#undef SAI_Q_INTERPOLATE -} - -void Super2xSaI_1555(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch) -{ -#define SAI_INTERPOLATE_1555(A, B) ((A & 0x7BDE) >> 1) + ((B & 0x7BDE) >> 1) + (A & B & 0x8421) -#define SAI_Q_INTERPOLATE_1555(A, B, C, D) ((A & 0x739C) >> 2) + ((B & 0x739C) >> 2) + ((C & 0x739C) >> 2) + ((D & 0x739C) >> 2) \ - + ((((A & 0x8C63) + (B & 0x8C63) + (C & 0x8C63) + (D & 0x8C63)) >> 2) & 0x8C63) - -#define SAI_INTERPOLATE SAI_INTERPOLATE_1555 -#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_1555 - - uint32 destWidth = width << 1; - uint32 destHeight = height << 1; - - uint16 color4, color5, color6; - uint16 color1, color2, color3; - uint16 colorA0, colorA1, colorA2, colorA3; - uint16 colorB0, colorB1, colorB2, colorB3; - uint16 colorS1, colorS2; - uint16 product1a, product1b, product2a, product2b; - -#include "TextureFilters_2xsai.h" - -#undef SAI_INTERPOLATE -#undef SAI_Q_INTERPOLATE -} - -void Super2xSaI_565(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch) -{ -#define SAI_INTERPOLATE_565(A, B) ((A & 0xF7DE) >> 1) + ((B & 0xF7DE) >> 1) + (A & B & 0x0821) -#define SAI_Q_INTERPOLATE_565(A, B, C, D) ((A & 0xE79C) >> 2) + ((B & 0xE79C) >> 2) + ((C & 0xE79C) >> 2) + ((D & 0xE79C) >> 2) \ - + ((((A & 0x1863) + (B & 0x1863) + (C & 0x1863) + (D & 0x1863)) >> 2) & 0x1863) - -#define SAI_INTERPOLATE SAI_INTERPOLATE_565 -#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_565 - - uint32 destWidth = width << 1; - uint32 destHeight = height << 1; - - uint16 color4, color5, color6; - uint16 color1, color2, color3; - uint16 colorA0, colorA1, colorA2, colorA3; - uint16 colorB0, colorB1, colorB2, colorB3; - uint16 colorS1, colorS2; - uint16 product1a, product1b, product2a, product2b; - -#include "TextureFilters_2xsai.h" - -#undef SAI_INTERPOLATE -#undef SAI_Q_INTERPOLATE -} - -void Super2xSaI_8(uint8 *srcPtr, uint8 *destPtr, uint32 width, uint32 height, uint32 pitch) -{ -#define SAI_INTERPOLATE_8(A, B) ((A & 0xFE) >> 1) + ((B & 0xFE) >> 1) + (A & B & 0x01) -#define SAI_Q_INTERPOLATE_8(A, B, C, D) ((A & 0xFC) >> 2) + ((B & 0xFC) >> 2) + ((C & 0xFC) >> 2) + ((D & 0xFC) >> 2) \ - + ((((A & 0x03) + (B & 0x03) + (C & 0x03) + (D & 0x03)) >> 2) & 0x03) - -#define SAI_INTERPOLATE SAI_INTERPOLATE_8 -#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_8 - - uint32 destWidth = width << 1; - uint32 destHeight = height << 1; - - uint8 color4, color5, color6; - uint8 color1, color2, color3; - uint8 colorA0, colorA1, colorA2, colorA3; - uint8 colorB0, colorB1, colorB2, colorB3; - uint8 colorS1, colorS2; - uint8 product1a, product1b, product2a, product2b; - -#include "TextureFilters_2xsai.h" - -#undef SAI_INTERPOLATE -#undef SAI_Q_INTERPOLATE -} -#endif /* !_16BPP_HACK */ diff --git a/GLideN64/src/GLideNHQ/TextureFilters_2xsai.h b/GLideN64/src/GLideNHQ/TextureFilters_2xsai.h deleted file mode 100644 index f6696ae..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_2xsai.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Based on Derek Liauw Kie Fa and Rice1964 Super2xSaI code */ - - int row0, row1, row2, row3; - int col0, col1, col2, col3; - - uint16 x; - uint16 y; - - for (y = 0; y < height; y++) { - if ((y > 0) && (y < height - 1)) { - row0 = width; - row0 = -row0; - row1 = 0; - row2 = width; - row3 = (y == height - 2 ? width : width << 1); - } else { - row0 = 0; - row1 = 0; - row2 = 0; - row3 = 0; - } - - for (x = 0; x < width; x++) { -//--------------------------------------- B0 B1 B2 B3 -// 4 5 6 S2 -// 1 2 3 S1 -// A0 A1 A2 A3 - if ((x > 0) && (x < width - 1)) { - col0 = -1; - col1 = 0; - col2 = 1; - col3 = (x == width - 2 ? 1 : 2); - } else { - col0 = 0; - col1 = 0; - col2 = 0; - col3 = 0; - } - - colorB0 = *(srcPtr + col0 + row0); - colorB1 = *(srcPtr + col1 + row0); - colorB2 = *(srcPtr + col2 + row0); - colorB3 = *(srcPtr + col3 + row0); - - color4 = *(srcPtr + col0 + row1); - color5 = *(srcPtr + col1 + row1); - color6 = *(srcPtr + col2 + row1); - colorS2 = *(srcPtr + col3 + row1); - - color1 = *(srcPtr + col0 + row2); - color2 = *(srcPtr + col1 + row2); - color3 = *(srcPtr + col2 + row2); - colorS1 = *(srcPtr + col3 + row2); - - colorA0 = *(srcPtr + col0 + row3); - colorA1 = *(srcPtr + col1 + row3); - colorA2 = *(srcPtr + col2 + row3); - colorA3 = *(srcPtr + col3 + row3); - -//-------------------------------------- - if (color2 == color6 && color5 != color3) - product2b = product1b = color2; - else if (color5 == color3 && color2 != color6) - product2b = product1b = color5; - else if (color5 == color3 && color2 == color6) { - int r = 0; - - r += GET_RESULT(color6, color5, color1, colorA1); - r += GET_RESULT(color6, color5, color4, colorB1); - r += GET_RESULT(color6, color5, colorA2, colorS1); - r += GET_RESULT(color6, color5, colorB2, colorS2); - - if (r > 0) - product2b = product1b = color6; - else if (r < 0) - product2b = product1b = color5; - else - product2b = product1b = SAI_INTERPOLATE(color5, color6); - - } else { - - if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) - product2b = SAI_Q_INTERPOLATE(color3, color3, color3, color2); - else if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3) - product2b = SAI_Q_INTERPOLATE(color2, color2, color2, color3); - else - product2b = SAI_INTERPOLATE(color2, color3); - - if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0) - product1b = SAI_Q_INTERPOLATE(color6, color6, color6, color5); - else if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3) - product1b = SAI_Q_INTERPOLATE(color6, color5, color5, color5); - else - product1b = SAI_INTERPOLATE(color5, color6); - } - - if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2) - product2a = SAI_INTERPOLATE(color2, color5); - else if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0) - product2a = SAI_INTERPOLATE(color2, color5); - else - product2a = color2; - - if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2) - product1a = SAI_INTERPOLATE(color2, color5); - else if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0) - product1a = SAI_INTERPOLATE(color2, color5); - else - product1a = color5; - - - destPtr[0] = product1a; - destPtr[1] = product1b; - destPtr[destWidth] = product2a; - destPtr[destWidth + 1] = product2b; - - srcPtr++; - destPtr += 2; - } - srcPtr += (pitch-width); - destPtr += (((pitch-width)<<1)+(pitch<<1)); - } diff --git a/GLideN64/src/GLideNHQ/TextureFilters_hq2x.cpp b/GLideN64/src/GLideNHQ/TextureFilters_hq2x.cpp deleted file mode 100644 index 0df5782..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_hq2x.cpp +++ /dev/null @@ -1,1510 +0,0 @@ -/* -Copyright (C) 2003 Rice1964 - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/* Copyright (C) 2007 Hiroshi Morii - * Modified for the Texture Filtering library - */ - -/* 2007 Mudlord - Added hq2xS lq2xS filters */ - -#include "TextureFilters.h" - -/************************************************************************/ -/* hq2x filters */ -/************************************************************************/ - -/***************************************************************************/ -/* Basic types */ - -/***************************************************************************/ -/* interpolation */ - -//static unsigned interp_bits_per_pixel; - -#if !_16BPP_HACK -#define INTERP_16_MASK_1_3(v) ((v)&0x0F0F) -#define INTERP_16_MASK_SHIFT_2_4(v) (((v)&0xF0F0)>>4) -#define INTERP_16_MASK_SHIFTBACK_2_4(v) ((INTERP_16_MASK_1_3(v))<<4) - -static uint16 hq2x_interp_16_521(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*5 + INTERP_16_MASK_1_3(p2)*2 + INTERP_16_MASK_1_3(p3)*1) / 8) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*5 + INTERP_16_MASK_SHIFT_2_4(p2)*2 + INTERP_16_MASK_SHIFT_2_4(p3)*1) / 8); -} - -static uint16 hq2x_interp_16_332(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*3 + INTERP_16_MASK_1_3(p2)*3 + INTERP_16_MASK_1_3(p3)*2) / 8) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*3 + INTERP_16_MASK_SHIFT_2_4(p2)*3 + INTERP_16_MASK_SHIFT_2_4(p3)*2) / 8); -} - -static uint16 hq2x_interp_16_611(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*6 + INTERP_16_MASK_1_3(p2) + INTERP_16_MASK_1_3(p3)) / 8) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*6 + INTERP_16_MASK_SHIFT_2_4(p2) + INTERP_16_MASK_SHIFT_2_4(p3)) / 8); -} - -static uint16 hq2x_interp_16_71(uint16 p1, uint16 p2) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*7 + INTERP_16_MASK_1_3(p2)) / 8) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*7 + INTERP_16_MASK_SHIFT_2_4(p2)) / 8); -} - -static uint16 hq2x_interp_16_211(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*2 + INTERP_16_MASK_1_3(p2) + INTERP_16_MASK_1_3(p3)) / 4) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*2 + INTERP_16_MASK_SHIFT_2_4(p2) + INTERP_16_MASK_SHIFT_2_4(p3)) / 4); -} - -static uint16 hq2x_interp_16_772(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3(((INTERP_16_MASK_1_3(p1) + INTERP_16_MASK_1_3(p2))*7 + INTERP_16_MASK_1_3(p3)*2) / 16) - | INTERP_16_MASK_SHIFTBACK_2_4(((INTERP_16_MASK_SHIFT_2_4(p1) + INTERP_16_MASK_SHIFT_2_4(p2))*7 + INTERP_16_MASK_SHIFT_2_4(p3)*2) / 16); -} - -static uint16 hq2x_interp_16_11(uint16 p1, uint16 p2) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1) + INTERP_16_MASK_1_3(p2)) / 2) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1) + INTERP_16_MASK_SHIFT_2_4(p2)) / 2); -} - -static uint16 hq2x_interp_16_31(uint16 p1, uint16 p2) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*3 + INTERP_16_MASK_1_3(p2)) / 4) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*3 + INTERP_16_MASK_SHIFT_2_4(p2)) / 4); -} - -static uint16 hq2x_interp_16_1411(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*14 + INTERP_16_MASK_1_3(p2) + INTERP_16_MASK_1_3(p3)) / 16) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*14 + INTERP_16_MASK_SHIFT_2_4(p2) + INTERP_16_MASK_SHIFT_2_4(p3)) / 16); -} - -static uint16 hq2x_interp_16_431(uint16 p1, uint16 p2, uint16 p3) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*4 + INTERP_16_MASK_1_3(p2)*3 + INTERP_16_MASK_1_3(p3)) / 8) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*4 + INTERP_16_MASK_SHIFT_2_4(p2)*3 + INTERP_16_MASK_SHIFT_2_4(p3)) / 8); -} - -static uint16 hq2x_interp_16_53(uint16 p1, uint16 p2) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*5 + INTERP_16_MASK_1_3(p2)*3) / 8) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*5 + INTERP_16_MASK_SHIFT_2_4(p2)*3) / 8); -} - -static uint16 hq2x_interp_16_151(uint16 p1, uint16 p2) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*15 + INTERP_16_MASK_1_3(p2)) / 16) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*15 + INTERP_16_MASK_SHIFT_2_4(p2)) / 16); -} - -static uint16 hq2x_interp_16_97(uint16 p1, uint16 p2) -{ - return INTERP_16_MASK_1_3((INTERP_16_MASK_1_3(p1)*9 + INTERP_16_MASK_1_3(p2)*7) / 16) - | INTERP_16_MASK_SHIFTBACK_2_4((INTERP_16_MASK_SHIFT_2_4(p1)*9 + INTERP_16_MASK_SHIFT_2_4(p2)*7) / 16); -} -#endif /* !_16BPP_HACK */ - -#define INTERP_32_MASK_1_3(v) ((v)&0x00FF00FF) -#define INTERP_32_MASK_SHIFT_2_4(v) (((v)&0xFF00FF00)>>8) -#define INTERP_32_MASK_SHIFTBACK_2_4(v) (((INTERP_32_MASK_1_3(v))<<8)) - -static uint32 hq2x_interp_32_521(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*5 + INTERP_32_MASK_1_3(p2)*2 + INTERP_32_MASK_1_3(p3)*1) / 8) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*5 + INTERP_32_MASK_SHIFT_2_4(p2)*2 + INTERP_32_MASK_SHIFT_2_4(p3)*1) / 8); -} - -static uint32 hq2x_interp_32_332(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*3 + INTERP_32_MASK_1_3(p2)*3 + INTERP_32_MASK_1_3(p3)*2) / 8) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*3 + INTERP_32_MASK_SHIFT_2_4(p2)*3 + INTERP_32_MASK_SHIFT_2_4(p3)*2) / 8); -} - -static uint32 hq2x_interp_32_211(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*2 + INTERP_32_MASK_1_3(p2) + INTERP_32_MASK_1_3(p3)) / 4) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*2 + INTERP_32_MASK_SHIFT_2_4(p2) + INTERP_32_MASK_SHIFT_2_4(p3)) / 4); -} - -static uint32 hq2x_interp_32_611(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*6 + INTERP_32_MASK_1_3(p2) + INTERP_32_MASK_1_3(p3)) / 8) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*6 + INTERP_32_MASK_SHIFT_2_4(p2) + INTERP_32_MASK_SHIFT_2_4(p3)) / 8); -} - -static uint32 hq2x_interp_32_71(uint32 p1, uint32 p2) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*7 + INTERP_32_MASK_1_3(p2)) / 8) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*7 + INTERP_32_MASK_SHIFT_2_4(p2)) / 8); -} - -static uint32 hq2x_interp_32_772(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3(((INTERP_32_MASK_1_3(p1) + INTERP_32_MASK_1_3(p2))*7 + INTERP_32_MASK_1_3(p3)*2) / 16) - | INTERP_32_MASK_SHIFTBACK_2_4(((INTERP_32_MASK_SHIFT_2_4(p1) + INTERP_32_MASK_SHIFT_2_4(p2))*7 + INTERP_32_MASK_SHIFT_2_4(p3)*2) / 16); -} - -static uint32 hq2x_interp_32_11(uint32 p1, uint32 p2) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1) + INTERP_32_MASK_1_3(p2)) / 2) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1) + INTERP_32_MASK_SHIFT_2_4(p2)) / 2); -} - -static uint32 hq2x_interp_32_31(uint32 p1, uint32 p2) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*3 + INTERP_32_MASK_1_3(p2)) / 4) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*3 + INTERP_32_MASK_SHIFT_2_4(p2)) / 4); -} - -static uint32 hq2x_interp_32_1411(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*14 + INTERP_32_MASK_1_3(p2) + INTERP_32_MASK_1_3(p3)) / 16) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*14 + INTERP_32_MASK_SHIFT_2_4(p2) + INTERP_32_MASK_SHIFT_2_4(p3)) / 16); -} - -static uint32 hq2x_interp_32_431(uint32 p1, uint32 p2, uint32 p3) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*4 + INTERP_32_MASK_1_3(p2)*3 + INTERP_32_MASK_1_3(p3)) / 8) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*4 + INTERP_32_MASK_SHIFT_2_4(p2)*3 + INTERP_32_MASK_SHIFT_2_4(p3)) / 8); -} - -static uint32 hq2x_interp_32_53(uint32 p1, uint32 p2) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*5 + INTERP_32_MASK_1_3(p2)*3) / 8) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*5 + INTERP_32_MASK_SHIFT_2_4(p2)*3) / 8); -} - -static uint32 hq2x_interp_32_151(uint32 p1, uint32 p2) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*15 + INTERP_32_MASK_1_3(p2)) / 16) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*15 + INTERP_32_MASK_SHIFT_2_4(p2)) / 16); -} - -static uint32 hq2x_interp_32_97(uint32 p1, uint32 p2) -{ - return INTERP_32_MASK_1_3((INTERP_32_MASK_1_3(p1)*9 + INTERP_32_MASK_1_3(p2)*7) / 16) - | INTERP_32_MASK_SHIFTBACK_2_4((INTERP_32_MASK_SHIFT_2_4(p1)*9 + INTERP_32_MASK_SHIFT_2_4(p2)*7) / 16); -} - -/***************************************************************************/ -/* diff */ - -#define INTERP_Y_LIMIT (0x30*4) -#define INTERP_U_LIMIT (0x07*4) -#define INTERP_V_LIMIT (0x06*8) - -#if !_16BPP_HACK -static int hq2x_interp_16_diff(uint16 p1, uint16 p2) -{ - int r, g, b; - int y, u, v; - - if (p1 == p2) - return 0; - - r = (int)((p1 & 0x000F) - (p2 & 0x000F)); - g = (int)((p1 & 0x00F0) - (p2 & 0x00F0)) >> 4; - b = (int)((p1 & 0x0F00) - (p2 & 0x0F00)) >> 8; - - y = r + g + b; - u = r - b; - v = -r + 2*g - b; - - if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT) - return 1; - - if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT) - return 1; - - if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT) - return 1; - - return 0; -} -#endif /* !_16BPP_HACK */ - -static int hq2x_interp_32_diff(uint32 p1, uint32 p2) -{ - int r, g, b; - int y, u, v; - - if ((p1 & 0xF8F8F8) == (p2 & 0xF8F8F8)) - return 0; - - r = (int)((p1 & 0xFF) - (p2 & 0xFF)); - g = (int)((p1 & 0xFF00) - (p2 & 0xFF00)) >> 8; - b = (int)((p1 & 0xFF0000) - (p2 & 0xFF0000)) >> 16; - - y = r + g + b; - u = r - b; - v = -r + 2*g - b; - - if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT) - return 1; - - if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT) - return 1; - - if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT) - return 1; - - return 0; -} - -/*static void interp_set(unsigned bits_per_pixel) -{ - interp_bits_per_pixel = bits_per_pixel; -}*/ - -#if !_16BPP_HACK -static void hq2x_16_def(uint16* dst0, uint16* dst1, const uint16* src0, const uint16* src1, const uint16* src2, unsigned count) -{ - unsigned i; - - for(i=0;i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = c[1]; - c[3] = c[4]; - c[6] = c[7]; - } - - if (i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = c[1]; - c[3] = c[4]; - c[6] = c[7]; - } - - if (i> 3; - r = (int)((c[j] & 0xF800)) >> 8; - } else { - b = (int)((c[j] & 0x1F)) << 3; - g = (int)((c[j] & 0x3E0)) >> 2; - r = (int)((c[j] & 0x7C00)) >> 7; - } - const int bright = r+r+r + g+g+g + b+b; - if(bright > maxBright) maxBright = bright; - if(bright < minBright) minBright = bright; - - brightArray[j] = bright; - } - int diffBright = ((maxBright - minBright) * 7) >> 4; - if(diffBright > 7) { -#define ABS(x) ((x) < 0 ? -(x) : (x)) - - const int centerBright = brightArray[4]; - if(ABS(brightArray[0] - centerBright) > diffBright) - mask |= 1 << 0; - if(ABS(brightArray[1] - centerBright) > diffBright) - mask |= 1 << 1; - if(ABS(brightArray[2] - centerBright) > diffBright) - mask |= 1 << 2; - if(ABS(brightArray[3] - centerBright) > diffBright) - mask |= 1 << 3; - if(ABS(brightArray[5] - centerBright) > diffBright) - mask |= 1 << 4; - if(ABS(brightArray[6] - centerBright) > diffBright) - mask |= 1 << 5; - if(ABS(brightArray[7] - centerBright) > diffBright) - mask |= 1 << 6; - if(ABS(brightArray[8] - centerBright) > diffBright) - mask |= 1 << 7; - } - -#define P0 dst0[0] -#define P1 dst0[1] -#define P2 dst1[0] -#define P3 dst1[1] -#define HQ2X_MUR false -#define HQ2X_MDR false -#define HQ2X_MDL false -#define HQ2X_MUL false -#define IC(p0) c[p0] -#define I11(p0,p1) hq2x_interp_16_11(c[p0], c[p1]) -#define I211(p0,p1,p2) hq2x_interp_16_211(c[p0], c[p1], c[p2]) -#define I31(p0,p1) hq2x_interp_16_31(c[p0], c[p1]) -#define I332(p0,p1,p2) hq2x_interp_16_332(c[p0], c[p1], c[p2]) -#define I431(p0,p1,p2) hq2x_interp_16_431(c[p0], c[p1], c[p2]) -#define I521(p0,p1,p2) hq2x_interp_16_521(c[p0], c[p1], c[p2]) -#define I53(p0,p1) hq2x_interp_16_53(c[p0], c[p1]) -#define I611(p0,p1,p2) hq2x_interp_16_611(c[p0], c[p1], c[p2]) -#define I71(p0,p1) hq2x_interp_16_71(c[p0], c[p1]) -#define I772(p0,p1,p2) hq2x_interp_16_772(c[p0], c[p1], c[p2]) -#define I97(p0,p1) hq2x_interp_16_97(c[p0], c[p1]) -#define I1411(p0,p1,p2) hq2x_interp_16_1411(c[p0], c[p1], c[p2]) -#define I151(p0,p1) hq2x_interp_16_151(c[p0], c[p1]) - - switch (mask) { -#include "TextureFilters_hq2x.h" - } - -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef HQ2X_MUR -#undef HQ2X_MDR -#undef HQ2X_MDL -#undef HQ2X_MUL -#undef IC -#undef I11 -#undef I211 -#undef I31 -#undef I332 -#undef I431 -#undef I521 -#undef I53 -#undef I611 -#undef I71 -#undef I772 -#undef I97 -#undef I1411 -#undef I151 - - src0 += 1; - src1 += 1; - src2 += 1; - dst0 += 2; - dst1 += 2; - } -} -#endif /* !_16BPP_HACK */ - -static void hq2x_32_def(uint32* dst0, uint32* dst1, const uint32* src0, const uint32* src1, const uint32* src2, unsigned count) -{ - unsigned i; - - for(i=0;i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = src0[0]; - c[3] = src1[0]; - c[6] = src2[0]; - } - - if (i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = src0[0]; - c[3] = src1[0]; - c[6] = src2[0]; - } - - if (i> 8; - const int r = (int)((c[j] & 0xF80000)) >> 16; - const int bright = r+r+r + g+g+g + b+b; - if(bright > maxBright) maxBright = bright; - if(bright < minBright) minBright = bright; - - brightArray[j] = bright; - } - int diffBright = ((maxBright - minBright) * 7) >> 4; - if(diffBright > 7) { -#define ABS(x) ((x) < 0 ? -(x) : (x)) - - const int centerBright = brightArray[4]; - if(ABS(brightArray[0] - centerBright) > diffBright) - mask |= 1 << 0; - if(ABS(brightArray[1] - centerBright) > diffBright) - mask |= 1 << 1; - if(ABS(brightArray[2] - centerBright) > diffBright) - mask |= 1 << 2; - if(ABS(brightArray[3] - centerBright) > diffBright) - mask |= 1 << 3; - if(ABS(brightArray[5] - centerBright) > diffBright) - mask |= 1 << 4; - if(ABS(brightArray[6] - centerBright) > diffBright) - mask |= 1 << 5; - if(ABS(brightArray[7] - centerBright) > diffBright) - mask |= 1 << 6; - if(ABS(brightArray[8] - centerBright) > diffBright) - mask |= 1 << 7; - } -#define P0 dst0[0] -#define P1 dst0[1] -#define P2 dst1[0] -#define P3 dst1[1] -#define HQ2X_MUR false -#define HQ2X_MDR false -#define HQ2X_MDL false -#define HQ2X_MUL false -#define IC(p0) c[p0] -#define I11(p0,p1) hq2x_interp_32_11(c[p0], c[p1]) -#define I211(p0,p1,p2) hq2x_interp_32_211(c[p0], c[p1], c[p2]) -#define I31(p0,p1) hq2x_interp_32_31(c[p0], c[p1]) -#define I332(p0,p1,p2) hq2x_interp_32_332(c[p0], c[p1], c[p2]) -#define I431(p0,p1,p2) hq2x_interp_32_431(c[p0], c[p1], c[p2]) -#define I521(p0,p1,p2) hq2x_interp_32_521(c[p0], c[p1], c[p2]) -#define I53(p0,p1) hq2x_interp_32_53(c[p0], c[p1]) -#define I611(p0,p1,p2) hq2x_interp_32_611(c[p0], c[p1], c[p2]) -#define I71(p0,p1) hq2x_interp_32_71(c[p0], c[p1]) -#define I772(p0,p1,p2) hq2x_interp_32_772(c[p0], c[p1], c[p2]) -#define I97(p0,p1) hq2x_interp_32_97(c[p0], c[p1]) -#define I1411(p0,p1,p2) hq2x_interp_32_1411(c[p0], c[p1], c[p2]) -#define I151(p0,p1) hq2x_interp_32_151(c[p0], c[p1]) - - switch (mask) { -#include "TextureFilters_hq2x.h" - } - -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef HQ2X_MUR -#undef HQ2X_MDR -#undef HQ2X_MDL -#undef HQ2X_MUL -#undef IC -#undef I11 -#undef I211 -#undef I31 -#undef I332 -#undef I431 -#undef I521 -#undef I53 -#undef I611 -#undef I71 -#undef I772 -#undef I97 -#undef I1411 -#undef I151 - - src0 += 1; - src1 += 1; - src2 += 1; - dst0 += 2; - dst1 += 2; - } -} - -/***************************************************************************/ -/* LQ2x C implementation */ - -/* -* This effect is derived from the hq2x effect made by Maxim Stepin -*/ - -#if !_16BPP_HACK -static void lq2x_16_def(uint16* dst0, uint16* dst1, const uint16* src0, const uint16* src1, const uint16* src2, unsigned count) -{ - unsigned i; - - for(i=0;i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = c[1]; - c[3] = c[4]; - c[6] = c[7]; - } - - if (i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = c[1]; - c[3] = c[4]; - c[6] = c[7]; - } - - if (i> 8; - const int r = (int)((c[j] & 0xF80000)) >> 16; - const int bright = r+r+r + g+g+g + b+b; - if(bright > maxBright) maxBright = bright; - if(bright < minBright) minBright = bright; - - brightArray[j] = bright; - } - int diffBright = ((maxBright - minBright) * 7) >> 4; - if(diffBright > 7) { -#define ABS(x) ((x) < 0 ? -(x) : (x)) - - const int centerBright = brightArray[4]; - if(ABS(brightArray[0] - centerBright) > diffBright) - mask |= 1 << 0; - if(ABS(brightArray[1] - centerBright) > diffBright) - mask |= 1 << 1; - if(ABS(brightArray[2] - centerBright) > diffBright) - mask |= 1 << 2; - if(ABS(brightArray[3] - centerBright) > diffBright) - mask |= 1 << 3; - if(ABS(brightArray[5] - centerBright) > diffBright) - mask |= 1 << 4; - if(ABS(brightArray[6] - centerBright) > diffBright) - mask |= 1 << 5; - if(ABS(brightArray[7] - centerBright) > diffBright) - mask |= 1 << 6; - if(ABS(brightArray[8] - centerBright) > diffBright) - mask |= 1 << 7; - } - -#define P0 dst0[0] -#define P1 dst0[1] -#define P2 dst1[0] -#define P3 dst1[1] -#define HQ2X_MUR false -#define HQ2X_MDR false -#define HQ2X_MDL false -#define HQ2X_MUL false -#define IC(p0) c[p0] -#define I11(p0,p1) hq2x_interp_16_11(c[p0], c[p1]) -#define I211(p0,p1,p2) hq2x_interp_16_211(c[p0], c[p1], c[p2]) -#define I31(p0,p1) hq2x_interp_16_31(c[p0], c[p1]) -#define I332(p0,p1,p2) hq2x_interp_16_332(c[p0], c[p1], c[p2]) -#define I431(p0,p1,p2) hq2x_interp_16_431(c[p0], c[p1], c[p2]) -#define I521(p0,p1,p2) hq2x_interp_16_521(c[p0], c[p1], c[p2]) -#define I53(p0,p1) hq2x_interp_16_53(c[p0], c[p1]) -#define I611(p0,p1,p2) hq2x_interp_16_611(c[p0], c[p1], c[p2]) -#define I71(p0,p1) hq2x_interp_16_71(c[p0], c[p1]) -#define I772(p0,p1,p2) hq2x_interp_16_772(c[p0], c[p1], c[p2]) -#define I97(p0,p1) hq2x_interp_16_97(c[p0], c[p1]) -#define I1411(p0,p1,p2) hq2x_interp_16_1411(c[p0], c[p1], c[p2]) -#define I151(p0,p1) hq2x_interp_16_151(c[p0], c[p1]) - - switch (mask) { -#include "TextureFilters_lq2x.h" - } - -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef HQ2X_MUR -#undef HQ2X_MDR -#undef HQ2X_MDL -#undef HQ2X_MUL -#undef IC -#undef I11 -#undef I211 -#undef I31 -#undef I332 -#undef I431 -#undef I521 -#undef I53 -#undef I611 -#undef I71 -#undef I772 -#undef I97 -#undef I1411 -#undef I151 - - src0 += 1; - src1 += 1; - src2 += 1; - dst0 += 2; - dst1 += 2; - } -} -#endif /* !_16BPP_HACK */ - -static void lq2x_32_def(uint32* dst0, uint32* dst1, const uint32* src0, const uint32* src1, const uint32* src2, unsigned count) -{ - unsigned i; - - for(i=0;i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = c[1]; - c[3] = c[4]; - c[6] = c[7]; - } - - if (i0) { - c[0] = src0[-1]; - c[3] = src1[-1]; - c[6] = src2[-1]; - } else { - c[0] = c[1]; - c[3] = c[4]; - c[6] = c[7]; - } - - if (i> 8; - const int r = (int)((c[j] & 0xF80000)) >> 16; - const int bright = r+r+r + g+g+g + b+b; - if(bright > maxBright) maxBright = bright; - if(bright < minBright) minBright = bright; - - brightArray[j] = bright; - } - int diffBright = ((maxBright - minBright) * 7) >> 4; - if(diffBright > 7) { -#define ABS(x) ((x) < 0 ? -(x) : (x)) - - const int centerBright = brightArray[4]; - if(ABS(brightArray[0] - centerBright) > diffBright) - mask |= 1 << 0; - if(ABS(brightArray[1] - centerBright) > diffBright) - mask |= 1 << 1; - if(ABS(brightArray[2] - centerBright) > diffBright) - mask |= 1 << 2; - if(ABS(brightArray[3] - centerBright) > diffBright) - mask |= 1 << 3; - if(ABS(brightArray[5] - centerBright) > diffBright) - mask |= 1 << 4; - if(ABS(brightArray[6] - centerBright) > diffBright) - mask |= 1 << 5; - if(ABS(brightArray[7] - centerBright) > diffBright) - mask |= 1 << 6; - if(ABS(brightArray[8] - centerBright) > diffBright) - mask |= 1 << 7; - } - -#define P0 dst0[0] -#define P1 dst0[1] -#define P2 dst1[0] -#define P3 dst1[1] -#define HQ2X_MUR false -#define HQ2X_MDR false -#define HQ2X_MDL false -#define HQ2X_MUL false -#define IC(p0) c[p0] -#define I11(p0,p1) hq2x_interp_32_11(c[p0], c[p1]) -#define I211(p0,p1,p2) hq2x_interp_32_211(c[p0], c[p1], c[p2]) -#define I31(p0,p1) hq2x_interp_32_31(c[p0], c[p1]) -#define I332(p0,p1,p2) hq2x_interp_32_332(c[p0], c[p1], c[p2]) -#define I431(p0,p1,p2) hq2x_interp_32_431(c[p0], c[p1], c[p2]) -#define I521(p0,p1,p2) hq2x_interp_32_521(c[p0], c[p1], c[p2]) -#define I53(p0,p1) hq2x_interp_32_53(c[p0], c[p1]) -#define I611(p0,p1,p2) hq2x_interp_32_611(c[p0], c[p1], c[p2]) -#define I71(p0,p1) hq2x_interp_32_71(c[p0], c[p1]) -#define I772(p0,p1,p2) hq2x_interp_32_772(c[p0], c[p1], c[p2]) -#define I97(p0,p1) hq2x_interp_32_97(c[p0], c[p1]) -#define I1411(p0,p1,p2) hq2x_interp_32_1411(c[p0], c[p1], c[p2]) -#define I151(p0,p1) hq2x_interp_32_151(c[p0], c[p1]) - - switch (mask) { -#include "TextureFilters_lq2x.h" - } - -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef HQ2X_MUR -#undef HQ2X_MDR -#undef HQ2X_MDL -#undef HQ2X_MUL -#undef IC -#undef I11 -#undef I211 -#undef I31 -#undef I332 -#undef I431 -#undef I521 -#undef I53 -#undef I611 -#undef I71 -#undef I772 -#undef I97 -#undef I1411 -#undef I151 - - src0 += 1; - src1 += 1; - src2 += 1; - dst0 += 2; - dst1 += 2; - } -} - -#if !_16BPP_HACK -void hq2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint16 *dst0 = (uint16 *)dstPtr; - uint16 *dst1 = dst0 + (dstPitch >> 1); - - uint16 *src0 = (uint16 *)srcPtr; - uint16 *src1 = src0 + (srcPitch >> 1); - uint16 *src2 = src1 + (srcPitch >> 1); - - int count; - - hq2x_16_def(dst0, dst1, src0, src0, src1, width); - if( height == 1 ) return; - - count = height; - - count -= 2; - while(count>0) { - dst0 += dstPitch; - dst1 += dstPitch; - hq2x_16_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 1; - --count; - } - dst0 += dstPitch; - dst1 += dstPitch; - hq2x_16_def(dst0, dst1, src0, src1, src1, width); -} - - -void hq2xS_16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ - u16 *dst0 = (u16 *)dstPtr; - u16 *dst1 = dst0 + (dstPitch >> 1); - - u16 *src0 = (u16 *)srcPtr; - u16 *src1 = src0 + (srcPitch >> 1); - u16 *src2 = src1 + (srcPitch >> 1); - - hq2xS_16_def(dst0, dst1, src0, src0, src1, width); - - int count = height; - - count -= 2; - while(count) { - dst0 += dstPitch; - dst1 += dstPitch; - hq2xS_16_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 1; - --count; - } - dst0 += dstPitch; - dst1 += dstPitch; - hq2xS_16_def(dst0, dst1, src0, src1, src1, width); -} -#endif /* !_16BPP_HACK */ - -void hq2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint32 *dst0 = (uint32 *)dstPtr; - uint32 *dst1 = dst0 + (dstPitch >> 2); - - uint32 *src0 = (uint32 *)srcPtr; - uint32 *src1 = src0 + (srcPitch >> 2); - uint32 *src2 = src1 + (srcPitch >> 2); - - int count; - - hq2x_32_def(dst0, dst1, src0, src0, src1, width); - if( height == 1 ) return; - - count = height; - - count -= 2; - while(count>0) { - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - hq2x_32_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 2; - --count; - } - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - hq2x_32_def(dst0, dst1, src0, src1, src1, width); -} - -void hq2xS_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint32 *dst0 = (uint32 *)dstPtr; - uint32 *dst1 = dst0 + (dstPitch >> 2); - - uint32 *src0 = (uint32 *)srcPtr; - uint32 *src1 = src0 + (srcPitch >> 2); - uint32 *src2 = src1 + (srcPitch >> 2); - hq2xS_32_def(dst0, dst1, src0, src0, src1, width); - - int count = height; - - count -= 2; - while(count) { - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - hq2xS_32_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 2; - --count; - } - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - hq2xS_32_def(dst0, dst1, src0, src1, src1, width); -} - -#if !_16BPP_HACK -void lq2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint16 *dst0 = (uint16 *)dstPtr; - uint16 *dst1 = dst0 + (dstPitch >> 1); - - uint16 *src0 = (uint16 *)srcPtr; - uint16 *src1 = src0 + (srcPitch >> 1); - uint16 *src2 = src1 + (srcPitch >> 1); - - int count; - - lq2x_16_def(dst0, dst1, src0, src0, src1, width); - if( height == 1 ) return; - - count = height; - - count -= 2; - while(count>0) { - dst0 += dstPitch; - dst1 += dstPitch; - hq2x_16_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 1; - --count; - } - dst0 += dstPitch; - dst1 += dstPitch; - lq2x_16_def(dst0, dst1, src0, src1, src1, width); -} - -void lq2xS_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint16 *dst0 = (uint16 *)dstPtr; - uint16 *dst1 = dst0 + (dstPitch >> 1); - - uint16 *src0 = (uint16 *)srcPtr; - uint16 *src1 = src0 + (srcPitch >> 1); - uint16 *src2 = src1 + (srcPitch >> 1); - - int count; - - lq2xS_16_def(dst0, dst1, src0, src0, src1, width); - if( height == 1 ) return; - - count = height; - - count -= 2; - while(count>0) { - dst0 += dstPitch; - dst1 += dstPitch; - hq2x_16_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 1; - --count; - } - dst0 += dstPitch; - dst1 += dstPitch; - lq2xS_16_def(dst0, dst1, src0, src1, src1, width); -} -#endif /* !_16BPP_HACK */ - -void lq2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint32 *dst0 = (uint32 *)dstPtr; - uint32 *dst1 = dst0 + (dstPitch >> 2); - - uint32 *src0 = (uint32 *)srcPtr; - uint32 *src1 = src0 + (srcPitch >> 2); - uint32 *src2 = src1 + (srcPitch >> 2); - - int count; - - lq2x_32_def(dst0, dst1, src0, src0, src1, width); - if( height == 1 ) return; - - count = height; - - count -= 2; - while(count>0) { - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - hq2x_32_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 2; - --count; - } - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - lq2x_32_def(dst0, dst1, src0, src1, src1, width); -} - -void lq2xS_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) -{ - uint32 *dst0 = (uint32 *)dstPtr; - uint32 *dst1 = dst0 + (dstPitch >> 2); - - uint32 *src0 = (uint32 *)srcPtr; - uint32 *src1 = src0 + (srcPitch >> 2); - uint32 *src2 = src1 + (srcPitch >> 2); - - int count; - - lq2xS_32_def(dst0, dst1, src0, src0, src1, width); - if( height == 1 ) return; - - count = height; - - count -= 2; - while(count>0) { - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - hq2x_32_def(dst0, dst1, src0, src1, src2, width); - src0 = src1; - src1 = src2; - src2 += srcPitch >> 2; - --count; - } - dst0 += dstPitch >> 1; - dst1 += dstPitch >> 1; - lq2xS_32_def(dst0, dst1, src0, src1, src1, width); -} - -/************************************************************************/ -/* hq3x filters */ -/************************************************************************/ - -/************************************************************************/ -/* scale2x filters */ -/************************************************************************/ - -/************************************************************************/ -/* scale3x filters */ -/************************************************************************/ - diff --git a/GLideN64/src/GLideNHQ/TextureFilters_hq2x.h b/GLideN64/src/GLideNHQ/TextureFilters_hq2x.h deleted file mode 100644 index 7946323..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_hq2x.h +++ /dev/null @@ -1,1847 +0,0 @@ -/* -Copyright (C) 2003 Rice1964 - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/* Copyright (C) 2007 Hiroshi Morii - * Modified for the Texture Filtering library - */ - -case 0 : -case 1 : -case 4 : -case 5 : -case 32 : -case 33 : -case 36 : -case 37 : -case 128 : -case 129 : -case 132 : -case 133 : -case 160 : -case 161 : -case 164 : -case 165 : -{ - P0 = I211(4, 1, 3); - P1 = I211(4, 1, 5); - P2 = I211(4, 3, 7); - P3 = I211(4, 5, 7); -} break; -case 2 : -case 34 : -case 130 : -case 162 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I211(4, 3, 7); - P3 = I211(4, 5, 7); -} break; -case 3 : -case 35 : -case 131 : -case 163 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - P2 = I211(4, 3, 7); - P3 = I211(4, 5, 7); -} break; -case 6 : -case 38 : -case 134 : -case 166 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - P2 = I211(4, 3, 7); - P3 = I211(4, 5, 7); -} break; -case 7 : -case 39 : -case 135 : -case 167 : -{ - P0 = I31(4, 3); - P1 = I31(4, 5); - P2 = I211(4, 3, 7); - P3 = I211(4, 5, 7); -} break; -case 8 : -case 12 : -case 136 : -case 140 : -{ - P0 = I31(4, 0); - P1 = I211(4, 1, 5); - P2 = I31(4, 6); - P3 = I211(4, 5, 7); -} break; -case 9 : -case 13 : -case 137 : -case 141 : -{ - P0 = I31(4, 1); - P1 = I211(4, 1, 5); - P2 = I31(4, 6); - P3 = I211(4, 5, 7); -} break; -case 10 : -case 138 : -{ - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 11 : -case 139 : -{ - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 14 : -case 142 : -{ - P2 = I31(4, 6); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - P1 = I31(4, 5); - } else { - P0 = I332(1, 3, 4); - P1 = I521(4, 1, 5); - } -} break; -case 15 : -case 143 : -{ - P2 = I31(4, 6); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = IC(4); - P1 = I31(4, 5); - } else { - P0 = I332(1, 3, 4); - P1 = I521(4, 1, 5); - } -} break; -case 16 : -case 17 : -case 48 : -case 49 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 2); - P2 = I211(4, 3, 7); - P3 = I31(4, 8); -} break; -case 18 : -case 50 : -{ - P0 = I31(4, 0); - P2 = I211(4, 3, 7); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 19 : -case 51 : -{ - P2 = I211(4, 3, 7); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P0 = I31(4, 3); - P1 = I31(4, 2); - } else { - P0 = I521(4, 1, 3); - P1 = I332(1, 5, 4); - } -} break; -case 20 : -case 21 : -case 52 : -case 53 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 1); - P2 = I211(4, 3, 7); - P3 = I31(4, 8); -} break; -case 22 : -case 54 : -{ - P0 = I31(4, 0); - P2 = I211(4, 3, 7); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 23 : -case 55 : -{ - P2 = I211(4, 3, 7); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P0 = I31(4, 3); - P1 = IC(4); - } else { - P0 = I521(4, 1, 3); - P1 = I332(1, 5, 4); - } -} break; -case 24 : -case 66 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 25 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 26 : -case 31 : -case 95 : -{ - P2 = I31(4, 6); - P3 = I31(4, 8); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 27 : -case 75 : -{ - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 8); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 28 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 29 : -{ - P0 = I31(4, 1); - P1 = I31(4, 1); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 30 : -case 86 : -{ - P0 = I31(4, 0); - P2 = I31(4, 6); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 40 : -case 44 : -case 168 : -case 172 : -{ - P0 = I31(4, 0); - P1 = I211(4, 1, 5); - P2 = I31(4, 7); - P3 = I211(4, 5, 7); -} break; -case 41 : -case 45 : -case 169 : -case 173 : -{ - P0 = I31(4, 1); - P1 = I211(4, 1, 5); - P2 = I31(4, 7); - P3 = I211(4, 5, 7); -} break; -case 42 : -case 170 : -{ - P1 = I31(4, 2); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - P2 = I31(4, 7); - } else { - P0 = I332(1, 3, 4); - P2 = I521(4, 3, 7); - } -} break; -case 43 : -case 171 : -{ - P1 = I31(4, 2); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = IC(4); - P2 = I31(4, 7); - } else { - P0 = I332(1, 3, 4); - P2 = I521(4, 3, 7); - } -} break; -case 46 : -case 174 : -{ - P1 = I31(4, 5); - P2 = I31(4, 7); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } -} break; -case 47 : -case 175 : -{ - P1 = I31(4, 5); - P2 = I31(4, 7); - P3 = I211(4, 5, 7); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } -} break; -case 56 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 7); - P3 = I31(4, 8); -} break; -case 57 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - P2 = I31(4, 7); - P3 = I31(4, 8); -} break; -case 58 : -{ - P2 = I31(4, 7); - P3 = I31(4, 8); - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 59 : -{ - P2 = I31(4, 7); - P3 = I31(4, 8); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 60 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - P2 = I31(4, 7); - P3 = I31(4, 8); -} break; -case 61 : -{ - P0 = I31(4, 1); - P1 = I31(4, 1); - P2 = I31(4, 7); - P3 = I31(4, 8); -} break; -case 62 : -{ - P0 = I31(4, 0); - P2 = I31(4, 7); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 63 : -{ - P2 = I31(4, 7); - P3 = I31(4, 8); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 64 : -case 65 : -case 68 : -case 69 : -{ - P0 = I211(4, 1, 3); - P1 = I211(4, 1, 5); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 67 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 70 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 71 : -{ - P0 = I31(4, 3); - P1 = I31(4, 5); - P2 = I31(4, 6); - P3 = I31(4, 8); -} break; -case 72 : -case 76 : -{ - P0 = I31(4, 0); - P1 = I211(4, 1, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I211(4, 3, 7); - } -} break; -case 73 : -case 77 : -{ - P1 = I211(4, 1, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P0 = I31(4, 1); - P2 = I31(4, 6); - } else { - P0 = I521(4, 3, 1); - P2 = I332(3, 7, 4); - } -} break; -case 74 : -case 107 : -case 123 : -{ - P1 = I31(4, 2); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 78 : -{ - P1 = I31(4, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } -} break; -case 79 : -{ - P1 = I31(4, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 80 : -case 81 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 2); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 82 : -case 214 : -case 222 : -{ - P0 = I31(4, 0); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 83 : -{ - P0 = I31(4, 3); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 84 : -case 85 : -{ - P0 = I211(4, 1, 3); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P1 = I31(4, 1); - P3 = I31(4, 8); - } else { - P1 = I521(4, 5, 1); - P3 = I332(5, 7, 4); - } -} break; -case 87 : -{ - P0 = I31(4, 3); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 88 : -case 248 : -case 250 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 89 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } -} break; -case 90 : -{ - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 91 : -{ - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 92 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } -} break; -case 93 : -{ - P0 = I31(4, 1); - P1 = I31(4, 1); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } -} break; -case 94 : -{ - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 96 : -case 97 : -case 100 : -case 101 : -{ - P0 = I211(4, 1, 3); - P1 = I211(4, 1, 5); - P2 = I31(4, 3); - P3 = I31(4, 8); -} break; -case 98 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 3); - P3 = I31(4, 8); -} break; -case 99 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - P2 = I31(4, 3); - P3 = I31(4, 8); -} break; -case 102 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - P2 = I31(4, 3); - P3 = I31(4, 8); -} break; -case 103 : -{ - P0 = I31(4, 3); - P1 = I31(4, 5); - P2 = I31(4, 3); - P3 = I31(4, 8); -} break; -case 104 : -case 108 : -{ - P0 = I31(4, 0); - P1 = I211(4, 1, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } -} break; -case 105 : -case 109 : -{ - P1 = I211(4, 1, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P0 = I31(4, 1); - P2 = IC(4); - } else { - P0 = I521(4, 3, 1); - P2 = I332(3, 7, 4); - } -} break; -case 106 : -case 120 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } -} break; -case 110 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } -} break; -case 111 : -{ - P1 = I31(4, 5); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } -} break; -case 112 : -case 113 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 2); - if (HQ2X_MDR) { - P2 = I31(4, 3); - P3 = I31(4, 8); - } else { - P2 = I521(4, 7, 3); - P3 = I332(5, 7, 4); - } -} break; -case 114 : -{ - P0 = I31(4, 0); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 115 : -{ - P0 = I31(4, 3); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 116 : -case 117 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 1); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } -} break; -case 118 : -{ - P0 = I31(4, 0); - P2 = I31(4, 3); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 119 : -{ - P2 = I31(4, 3); - P3 = I31(4, 8); - if (HQ2X_MUR) { - P0 = I31(4, 3); - P1 = IC(4); - } else { - P0 = I521(4, 1, 3); - P1 = I332(1, 5, 4); - } -} break; -case 121 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } -} break; -case 122 : -{ - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = I31(4, 8); - } else { - P3 = I611(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 124 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } -} break; -case 125 : -{ - P1 = I31(4, 1); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P0 = I31(4, 1); - P2 = IC(4); - } else { - P0 = I521(4, 3, 1); - P2 = I332(3, 7, 4); - } -} break; -case 126 : -{ - P0 = I31(4, 0); - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 127 : -{ - P3 = I31(4, 8); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 144 : -case 145 : -case 176 : -case 177 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 2); - P2 = I211(4, 3, 7); - P3 = I31(4, 7); -} break; -case 146 : -case 178 : -{ - P0 = I31(4, 0); - P2 = I211(4, 3, 7); - if (HQ2X_MUR) { - P1 = I31(4, 2); - P3 = I31(4, 7); - } else { - P1 = I332(1, 5, 4); - P3 = I521(4, 5, 7); - } -} break; -case 147 : -case 179 : -{ - P0 = I31(4, 3); - P2 = I211(4, 3, 7); - P3 = I31(4, 7); - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 148 : -case 149 : -case 180 : -case 181 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 1); - P2 = I211(4, 3, 7); - P3 = I31(4, 7); -} break; -case 150 : -case 182 : -{ - P0 = I31(4, 0); - P2 = I211(4, 3, 7); - if (HQ2X_MUR) { - P1 = IC(4); - P3 = I31(4, 7); - } else { - P1 = I332(1, 5, 4); - P3 = I521(4, 5, 7); - } -} break; -case 151 : -case 183 : -{ - P0 = I31(4, 3); - P2 = I211(4, 3, 7); - P3 = I31(4, 7); - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 152 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 7); -} break; -case 153 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 7); -} break; -case 154 : -{ - P2 = I31(4, 6); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 155 : -{ - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 156 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - P2 = I31(4, 6); - P3 = I31(4, 7); -} break; -case 157 : -{ - P0 = I31(4, 1); - P1 = I31(4, 1); - P2 = I31(4, 6); - P3 = I31(4, 7); -} break; -case 158 : -{ - P2 = I31(4, 6); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 159 : -{ - P2 = I31(4, 6); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 184 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 7); - P3 = I31(4, 7); -} break; -case 185 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - P2 = I31(4, 7); - P3 = I31(4, 7); -} break; -case 186 : -{ - P2 = I31(4, 7); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 187 : -{ - P1 = I31(4, 2); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = IC(4); - P2 = I31(4, 7); - } else { - P0 = I332(1, 3, 4); - P2 = I521(4, 3, 7); - } -} break; -case 188 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - P2 = I31(4, 7); - P3 = I31(4, 7); -} break; -case 189 : -{ - P0 = I31(4, 1); - P1 = I31(4, 1); - P2 = I31(4, 7); - P3 = I31(4, 7); -} break; -case 190 : -{ - P0 = I31(4, 0); - P2 = I31(4, 7); - if (HQ2X_MUR) { - P1 = IC(4); - P3 = I31(4, 7); - } else { - P1 = I332(1, 5, 4); - P3 = I521(4, 5, 7); - } -} break; -case 191 : -{ - P2 = I31(4, 7); - P3 = I31(4, 7); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 192 : -case 193 : -case 196 : -case 197 : -{ - P0 = I211(4, 1, 3); - P1 = I211(4, 1, 5); - P2 = I31(4, 6); - P3 = I31(4, 5); -} break; -case 194 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 5); -} break; -case 195 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 5); -} break; -case 198 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - P2 = I31(4, 6); - P3 = I31(4, 5); -} break; -case 199 : -{ - P0 = I31(4, 3); - P1 = I31(4, 5); - P2 = I31(4, 6); - P3 = I31(4, 5); -} break; -case 200 : -case 204 : -{ - P0 = I31(4, 0); - P1 = I211(4, 1, 5); - if (HQ2X_MDL) { - P2 = I31(4, 6); - P3 = I31(4, 5); - } else { - P2 = I332(3, 7, 4); - P3 = I521(4, 7, 5); - } -} break; -case 201 : -case 205 : -{ - P0 = I31(4, 1); - P1 = I211(4, 1, 5); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } -} break; -case 202 : -{ - P1 = I31(4, 2); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } -} break; -case 203 : -{ - P1 = I31(4, 2); - P2 = I31(4, 6); - P3 = I31(4, 5); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 206 : -{ - P1 = I31(4, 5); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } -} break; -case 207 : -{ - P2 = I31(4, 6); - P3 = I31(4, 5); - if (HQ2X_MUL) { - P0 = IC(4); - P1 = I31(4, 5); - } else { - P0 = I332(1, 3, 4); - P1 = I521(4, 1, 5); - } -} break; -case 208 : -case 209 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 2); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 210 : -case 216 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 211 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 212 : -case 213 : -{ - P0 = I211(4, 1, 3); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P1 = I31(4, 1); - P3 = IC(4); - } else { - P1 = I521(4, 5, 1); - P3 = I332(5, 7, 4); - } -} break; -case 215 : -{ - P0 = I31(4, 3); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 217 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 218 : -{ - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 219 : -{ - P1 = I31(4, 2); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 220 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - if (HQ2X_MDL) { - P2 = I31(4, 6); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 221 : -{ - P0 = I31(4, 1); - P2 = I31(4, 6); - if (HQ2X_MDR) { - P1 = I31(4, 1); - P3 = IC(4); - } else { - P1 = I521(4, 5, 1); - P3 = I332(5, 7, 4); - } -} break; -case 223 : -{ - P2 = I31(4, 6); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 224 : -case 225 : -case 228 : -case 229 : -{ - P0 = I211(4, 1, 3); - P1 = I211(4, 1, 5); - P2 = I31(4, 3); - P3 = I31(4, 5); -} break; -case 226 : -{ - P0 = I31(4, 0); - P1 = I31(4, 2); - P2 = I31(4, 3); - P3 = I31(4, 5); -} break; -case 227 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - P2 = I31(4, 3); - P3 = I31(4, 5); -} break; -case 230 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - P2 = I31(4, 3); - P3 = I31(4, 5); -} break; -case 231 : -{ - P0 = I31(4, 3); - P1 = I31(4, 5); - P2 = I31(4, 3); - P3 = I31(4, 5); -} break; -case 232 : -case 236 : -{ - P0 = I31(4, 0); - P1 = I211(4, 1, 5); - if (HQ2X_MDL) { - P2 = IC(4); - P3 = I31(4, 5); - } else { - P2 = I332(3, 7, 4); - P3 = I521(4, 7, 5); - } -} break; -case 233 : -case 237 : -{ - P0 = I31(4, 1); - P1 = I211(4, 1, 5); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } -} break; -case 234 : -{ - P1 = I31(4, 2); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = I31(4, 0); - } else { - P0 = I611(4, 1, 3); - } -} break; -case 235 : -{ - P1 = I31(4, 2); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 238 : -{ - P0 = I31(4, 0); - P1 = I31(4, 5); - if (HQ2X_MDL) { - P2 = IC(4); - P3 = I31(4, 5); - } else { - P2 = I332(3, 7, 4); - P3 = I521(4, 7, 5); - } -} break; -case 239 : -{ - P1 = I31(4, 5); - P3 = I31(4, 5); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } -} break; -case 240 : -case 241 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 2); - if (HQ2X_MDR) { - P2 = I31(4, 3); - P3 = IC(4); - } else { - P2 = I521(4, 7, 3); - P3 = I332(5, 7, 4); - } -} break; -case 242 : -{ - P0 = I31(4, 0); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = I31(4, 2); - } else { - P1 = I611(4, 1, 5); - } -} break; -case 243 : -{ - P0 = I31(4, 3); - P1 = I31(4, 2); - if (HQ2X_MDR) { - P2 = I31(4, 3); - P3 = IC(4); - } else { - P2 = I521(4, 7, 3); - P3 = I332(5, 7, 4); - } -} break; -case 244 : -case 245 : -{ - P0 = I211(4, 1, 3); - P1 = I31(4, 1); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } -} break; -case 246 : -{ - P0 = I31(4, 0); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 247 : -{ - P0 = I31(4, 3); - P2 = I31(4, 3); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 249 : -{ - P0 = I31(4, 1); - P1 = I31(4, 2); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } -} break; -case 251 : -{ - P1 = I31(4, 2); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 252 : -{ - P0 = I31(4, 0); - P1 = I31(4, 1); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } -} break; -case 253 : -{ - P0 = I31(4, 1); - P1 = I31(4, 1); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } -} break; -case 254 : -{ - P0 = I31(4, 0); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 255 : -{ - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; diff --git a/GLideN64/src/GLideNHQ/TextureFilters_hq4x.cpp b/GLideN64/src/GLideNHQ/TextureFilters_hq4x.cpp deleted file mode 100644 index b5b61ac..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_hq4x.cpp +++ /dev/null @@ -1,835 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Based on Maxim Stepin and Rice1964 hq4x code */ - -#include -#include -#include "TextureFilters.h" - -#if !_16BPP_HACK -static uint32 RGB444toYUV[4096]; -#define RGB444toYUV(val) RGB444toYUV[val & 0x0FFF] /* val = ARGB4444 */ - -static uint32 RGB555toYUV(uint32 val) -{ - uint32 r, g, b, Y, u, v; - - b = (val & 0x7C00) >> 7; - g = (val & 0x03E0) >> 2; - r = (val & 0x001F) << 3; - r |= r >> 5; - g |= g >> 5; - b |= b >> 5; - - Y = (r + g + b) >> 2; - u = 128 + ((r - b) >> 2); - v = 128 + ((2*g - r - b)>>3); - - return ((Y << 16) | (u << 8) | v); -} - -static uint32 RGB565toYUV(uint32 val) -{ - uint32 r, g, b, Y, u, v; - - b = (val & 0xF800) >> 8; - g = (val & 0x07E0) >> 3; - r = (val & 0x001F) << 3; - r |= r >> 5; - g |= g >> 6; - b |= b >> 5; - - Y = (r + g + b) >> 2; - u = 128 + ((r - b) >> 2); - v = 128 + ((2*g - r - b)>>3); - - return ((Y << 16) | (u << 8) | v); -} -#endif /* !_16BPP_HACK */ - -static uint32 RGB888toYUV(uint32 val) -{ - uint32 r, g, b, Y, u, v; - - b = (val & 0x00ff0000) >> 16; - g = (val & 0x0000ff00) >> 8; - r = val & 0x000000ff; - - Y = (r + g + b) >> 2; - u = (0x00000200 + r - b) >> 2; - v = (0x00000400 + (g << 1) - r - b) >> 3; - - return ((Y << 16) | (u << 8) | v); -} - -#define Ymask 0x00FF0000 -#define Umask 0x0000FF00 -#define Vmask 0x000000FF -#define trY 0x00300000 // ? -#define trU 0x00000700 // ?? -#define trV 0x00000006 // ??? - -#define HQ4X_INTERP1(n, b) \ -static void hq4x_Interp1_##n (uint8 * pc, uint##b p1, uint##b p2) \ -{ \ - /* *((uint##b*)pc) = (p1*3+p2) >> 2; */ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1)*3 + INTERP_##n##_MASK_1_3(p2)) / 4) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1)*3 + INTERP_##n##_MASK_SHIFT_2_4(p2)) / 4 ); \ -} - -#define HQ4X_INTERP2(n, b) \ -static void hq4x_Interp2_##n (uint8 * pc, uint##b p1, uint##b p2, uint##b p3) \ -{ \ - /**((uint##b*)pc) = (p1*2+p2+p3) >> 2;*/ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1)*2 + INTERP_##n##_MASK_1_3(p2) + INTERP_##n##_MASK_1_3(p3)) / 4) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1)*2 + INTERP_##n##_MASK_SHIFT_2_4(p2) + INTERP_##n##_MASK_SHIFT_2_4(p3)) / 4); \ -} - -#define HQ4X_INTERP3(n, b) \ -static void hq4x_Interp3_##n (uint8 * pc, uint##b p1, uint##b p2) \ -{ \ - /**((uint##b*)pc) = (p1*7+p2)/8;*/ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1)*7 + INTERP_##n##_MASK_1_3(p2)) / 8) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1)*7 + INTERP_##n##_MASK_SHIFT_2_4(p2)) / 8); \ -} - -#define HQ4X_INTERP5(n, b) \ -static void hq4x_Interp5_##n (uint8 * pc, uint##b p1, uint##b p2) \ -{ \ - /**((uint##b*)pc) = (p1+p2) >> 1;*/ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1) + INTERP_##n##_MASK_1_3(p2)) / 2) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1) + INTERP_##n##_MASK_SHIFT_2_4(p2)) / 2); \ -} - -#define HQ4X_INTERP6(n, b) \ -static void hq4x_Interp6_##n (uint8 * pc, uint##b p1, uint##b p2, uint##b p3) \ -{ \ - /**((uint##b*)pc) = (p1*5+p2*2+p3)/8;*/ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1)*5 + INTERP_##n##_MASK_1_3(p2)*2 + INTERP_##n##_MASK_1_3(p3)) / 8) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1)*5 + INTERP_##n##_MASK_SHIFT_2_4(p2)*2 + INTERP_##n##_MASK_SHIFT_2_4(p3)) / 8); \ -} - -#define HQ4X_INTERP7(n, b) \ -static void hq4x_Interp7_##n (uint8 * pc, uint##b p1, uint##b p2, uint##b p3) \ -{ \ - /**((uint##b*)pc) = (p1*6+p2+p3)/8;*/ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1)*6 + INTERP_##n##_MASK_1_3(p2) + INTERP_##n##_MASK_1_3(p3)) / 8) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1)*6 + INTERP_##n##_MASK_SHIFT_2_4(p2) + INTERP_##n##_MASK_SHIFT_2_4(p3)) / 8); \ -} - -#define HQ4X_INTERP8(n, b) \ -static void hq4x_Interp8_##n (uint8 * pc, uint##b p1, uint##b p2) \ -{ \ - /**((uint##b*)pc) = (p1*5+p2*3)/8;*/ \ - *((uint##b*)pc) = INTERP_##n##_MASK_1_3((INTERP_##n##_MASK_1_3(p1)*5 + INTERP_##n##_MASK_1_3(p2)*3) / 8) \ - | INTERP_##n##_MASK_SHIFTBACK_2_4((INTERP_##n##_MASK_SHIFT_2_4(p1)*5 + INTERP_##n##_MASK_SHIFT_2_4(p2)*3) / 8); \ -} - -#if !_16BPP_HACK -#define INTERP_4444_MASK_1_3(v) (v & 0x0F0F) -#define INTERP_4444_MASK_SHIFT_2_4(v) ((v & 0xF0F0) >> 4) -#define INTERP_4444_MASK_SHIFTBACK_2_4(v) (INTERP_4444_MASK_1_3(v) << 4) -HQ4X_INTERP1(4444, 16) -HQ4X_INTERP2(4444, 16) -HQ4X_INTERP3(4444, 16) -HQ4X_INTERP5(4444, 16) -HQ4X_INTERP6(4444, 16) -HQ4X_INTERP7(4444, 16) -HQ4X_INTERP8(4444, 16) - -#define INTERP_1555_MASK_1_3(v) (v & 0x7C1F) -#define INTERP_1555_MASK_SHIFT_2_4(v) ((v & 0x83E0) >> 5) -#define INTERP_1555_MASK_SHIFTBACK_2_4(v) (INTERP_1555_MASK_1_3(v) << 5) -HQ4X_INTERP1(1555, 16) -HQ4X_INTERP2(1555, 16) -HQ4X_INTERP3(1555, 16) -HQ4X_INTERP5(1555, 16) -HQ4X_INTERP6(1555, 16) -HQ4X_INTERP7(1555, 16) -HQ4X_INTERP8(1555, 16) - -#define INTERP_565_MASK_1_3(v) (v & 0xF81F) -#define INTERP_565_MASK_SHIFT_2_4(v) ((v & 0x7E0) >> 5) -#define INTERP_565_MASK_SHIFTBACK_2_4(v) (INTERP_565_MASK_1_3(v) << 5) -HQ4X_INTERP1(565, 16) -HQ4X_INTERP2(565, 16) -HQ4X_INTERP3(565, 16) -HQ4X_INTERP5(565, 16) -HQ4X_INTERP6(565, 16) -HQ4X_INTERP7(565, 16) -HQ4X_INTERP8(565, 16) -#endif /* !_16BPP_HACK */ - -#define INTERP_8888_MASK_1_3(v) (v & 0x00FF00FF) -#define INTERP_8888_MASK_SHIFT_2_4(v) ((v & 0xFF00FF00) >> 8) -#define INTERP_8888_MASK_SHIFTBACK_2_4(v) (INTERP_8888_MASK_1_3(v) << 8) -HQ4X_INTERP1(8888, 32) -HQ4X_INTERP2(8888, 32) -HQ4X_INTERP3(8888, 32) -HQ4X_INTERP5(8888, 32) -HQ4X_INTERP6(8888, 32) -HQ4X_INTERP7(8888, 32) -HQ4X_INTERP8(8888, 32) - -#define PIXEL00_0 *((int*)(pOut)) = c[5]; -#define PIXEL00_11 hq4x_Interp1(pOut, c[5], c[4]); -#define PIXEL00_12 hq4x_Interp1(pOut, c[5], c[2]); -#define PIXEL00_20 hq4x_Interp2(pOut, c[5], c[2], c[4]); -#define PIXEL00_50 hq4x_Interp5(pOut, c[2], c[4]); -#define PIXEL00_80 hq4x_Interp8(pOut, c[5], c[1]); -#define PIXEL00_81 hq4x_Interp8(pOut, c[5], c[4]); -#define PIXEL00_82 hq4x_Interp8(pOut, c[5], c[2]); -#define PIXEL01_0 *((int*)(pOut+BPP)) = c[5]; -#define PIXEL01_10 hq4x_Interp1(pOut+BPP, c[5], c[1]); -#define PIXEL01_12 hq4x_Interp1(pOut+BPP, c[5], c[2]); -#define PIXEL01_14 hq4x_Interp1(pOut+BPP, c[2], c[5]); -#define PIXEL01_21 hq4x_Interp2(pOut+BPP, c[2], c[5], c[4]); -#define PIXEL01_31 hq4x_Interp3(pOut+BPP, c[5], c[4]); -#define PIXEL01_50 hq4x_Interp5(pOut+BPP, c[2], c[5]); -#define PIXEL01_60 hq4x_Interp6(pOut+BPP, c[5], c[2], c[4]); -#define PIXEL01_61 hq4x_Interp6(pOut+BPP, c[5], c[2], c[1]); -#define PIXEL01_82 hq4x_Interp8(pOut+BPP, c[5], c[2]); -#define PIXEL01_83 hq4x_Interp8(pOut+BPP, c[2], c[4]); -#define PIXEL02_0 *((int*)(pOut+BPP2)) = c[5]; -#define PIXEL02_10 hq4x_Interp1(pOut+BPP2, c[5], c[3]); -#define PIXEL02_11 hq4x_Interp1(pOut+BPP2, c[5], c[2]); -#define PIXEL02_13 hq4x_Interp1(pOut+BPP2, c[2], c[5]); -#define PIXEL02_21 hq4x_Interp2(pOut+BPP2, c[2], c[5], c[6]); -#define PIXEL02_32 hq4x_Interp3(pOut+BPP2, c[5], c[6]); -#define PIXEL02_50 hq4x_Interp5(pOut+BPP2, c[2], c[5]); -#define PIXEL02_60 hq4x_Interp6(pOut+BPP2, c[5], c[2], c[6]); -#define PIXEL02_61 hq4x_Interp6(pOut+BPP2, c[5], c[2], c[3]); -#define PIXEL02_81 hq4x_Interp8(pOut+BPP2, c[5], c[2]); -#define PIXEL02_83 hq4x_Interp8(pOut+BPP2, c[2], c[6]); -#define PIXEL03_0 *((int*)(pOut+BPP3)) = c[5]; -#define PIXEL03_11 hq4x_Interp1(pOut+BPP3, c[5], c[2]); -#define PIXEL03_12 hq4x_Interp1(pOut+BPP3, c[5], c[6]); -#define PIXEL03_20 hq4x_Interp2(pOut+BPP3, c[5], c[2], c[6]); -#define PIXEL03_50 hq4x_Interp5(pOut+BPP3, c[2], c[6]); -#define PIXEL03_80 hq4x_Interp8(pOut+BPP3, c[5], c[3]); -#define PIXEL03_81 hq4x_Interp8(pOut+BPP3, c[5], c[2]); -#define PIXEL03_82 hq4x_Interp8(pOut+BPP3, c[5], c[6]); -#define PIXEL10_0 *((int*)(pOut+BpL)) = c[5]; -#define PIXEL10_10 hq4x_Interp1(pOut+BpL, c[5], c[1]); -#define PIXEL10_11 hq4x_Interp1(pOut+BpL, c[5], c[4]); -#define PIXEL10_13 hq4x_Interp1(pOut+BpL, c[4], c[5]); -#define PIXEL10_21 hq4x_Interp2(pOut+BpL, c[4], c[5], c[2]); -#define PIXEL10_32 hq4x_Interp3(pOut+BpL, c[5], c[2]); -#define PIXEL10_50 hq4x_Interp5(pOut+BpL, c[4], c[5]); -#define PIXEL10_60 hq4x_Interp6(pOut+BpL, c[5], c[4], c[2]); -#define PIXEL10_61 hq4x_Interp6(pOut+BpL, c[5], c[4], c[1]); -#define PIXEL10_81 hq4x_Interp8(pOut+BpL, c[5], c[4]); -#define PIXEL10_83 hq4x_Interp8(pOut+BpL, c[4], c[2]); -#define PIXEL11_0 *((int*)(pOut+BpL+BPP)) = c[5]; -#define PIXEL11_30 hq4x_Interp3(pOut+BpL+BPP, c[5], c[1]); -#define PIXEL11_31 hq4x_Interp3(pOut+BpL+BPP, c[5], c[4]); -#define PIXEL11_32 hq4x_Interp3(pOut+BpL+BPP, c[5], c[2]); -#define PIXEL11_70 hq4x_Interp7(pOut+BpL+BPP, c[5], c[4], c[2]); -#define PIXEL12_0 *((int*)(pOut+BpL+BPP2)) = c[5]; -#define PIXEL12_30 hq4x_Interp3(pOut+BpL+BPP2, c[5], c[3]); -#define PIXEL12_31 hq4x_Interp3(pOut+BpL+BPP2, c[5], c[2]); -#define PIXEL12_32 hq4x_Interp3(pOut+BpL+BPP2, c[5], c[6]); -#define PIXEL12_70 hq4x_Interp7(pOut+BpL+BPP2, c[5], c[6], c[2]); -#define PIXEL13_0 *((int*)(pOut+BpL+BPP3)) = c[5]; -#define PIXEL13_10 hq4x_Interp1(pOut+BpL+BPP3, c[5], c[3]); -#define PIXEL13_12 hq4x_Interp1(pOut+BpL+BPP3, c[5], c[6]); -#define PIXEL13_14 hq4x_Interp1(pOut+BpL+BPP3, c[6], c[5]); -#define PIXEL13_21 hq4x_Interp2(pOut+BpL+BPP3, c[6], c[5], c[2]); -#define PIXEL13_31 hq4x_Interp3(pOut+BpL+BPP3, c[5], c[2]); -#define PIXEL13_50 hq4x_Interp5(pOut+BpL+BPP3, c[6], c[5]); -#define PIXEL13_60 hq4x_Interp6(pOut+BpL+BPP3, c[5], c[6], c[2]); -#define PIXEL13_61 hq4x_Interp6(pOut+BpL+BPP3, c[5], c[6], c[3]); -#define PIXEL13_82 hq4x_Interp8(pOut+BpL+BPP3, c[5], c[6]); -#define PIXEL13_83 hq4x_Interp8(pOut+BpL+BPP3, c[6], c[2]); -#define PIXEL20_0 *((int*)(pOut+BpL+BpL)) = c[5]; -#define PIXEL20_10 hq4x_Interp1(pOut+BpL+BpL, c[5], c[7]); -#define PIXEL20_12 hq4x_Interp1(pOut+BpL+BpL, c[5], c[4]); -#define PIXEL20_14 hq4x_Interp1(pOut+BpL+BpL, c[4], c[5]); -#define PIXEL20_21 hq4x_Interp2(pOut+BpL+BpL, c[4], c[5], c[8]); -#define PIXEL20_31 hq4x_Interp3(pOut+BpL+BpL, c[5], c[8]); -#define PIXEL20_50 hq4x_Interp5(pOut+BpL+BpL, c[4], c[5]); -#define PIXEL20_60 hq4x_Interp6(pOut+BpL+BpL, c[5], c[4], c[8]); -#define PIXEL20_61 hq4x_Interp6(pOut+BpL+BpL, c[5], c[4], c[7]); -#define PIXEL20_82 hq4x_Interp8(pOut+BpL+BpL, c[5], c[4]); -#define PIXEL20_83 hq4x_Interp8(pOut+BpL+BpL, c[4], c[8]); -#define PIXEL21_0 *((int*)(pOut+BpL+BpL+BPP)) = c[5]; -#define PIXEL21_30 hq4x_Interp3(pOut+BpL+BpL+BPP, c[5], c[7]); -#define PIXEL21_31 hq4x_Interp3(pOut+BpL+BpL+BPP, c[5], c[8]); -#define PIXEL21_32 hq4x_Interp3(pOut+BpL+BpL+BPP, c[5], c[4]); -#define PIXEL21_70 hq4x_Interp7(pOut+BpL+BpL+BPP, c[5], c[4], c[8]); -#define PIXEL22_0 *((int*)(pOut+BpL+BpL+BPP2)) = c[5]; -#define PIXEL22_30 hq4x_Interp3(pOut+BpL+BpL+BPP2, c[5], c[9]); -#define PIXEL22_31 hq4x_Interp3(pOut+BpL+BpL+BPP2, c[5], c[6]); -#define PIXEL22_32 hq4x_Interp3(pOut+BpL+BpL+BPP2, c[5], c[8]); -#define PIXEL22_70 hq4x_Interp7(pOut+BpL+BpL+BPP2, c[5], c[6], c[8]); -#define PIXEL23_0 *((int*)(pOut+BpL+BpL+BPP3)) = c[5]; -#define PIXEL23_10 hq4x_Interp1(pOut+BpL+BpL+BPP3, c[5], c[9]); -#define PIXEL23_11 hq4x_Interp1(pOut+BpL+BpL+BPP3, c[5], c[6]); -#define PIXEL23_13 hq4x_Interp1(pOut+BpL+BpL+BPP3, c[6], c[5]); -#define PIXEL23_21 hq4x_Interp2(pOut+BpL+BpL+BPP3, c[6], c[5], c[8]); -#define PIXEL23_32 hq4x_Interp3(pOut+BpL+BpL+BPP3, c[5], c[8]); -#define PIXEL23_50 hq4x_Interp5(pOut+BpL+BpL+BPP3, c[6], c[5]); -#define PIXEL23_60 hq4x_Interp6(pOut+BpL+BpL+BPP3, c[5], c[6], c[8]); -#define PIXEL23_61 hq4x_Interp6(pOut+BpL+BpL+BPP3, c[5], c[6], c[9]); -#define PIXEL23_81 hq4x_Interp8(pOut+BpL+BpL+BPP3, c[5], c[6]); -#define PIXEL23_83 hq4x_Interp8(pOut+BpL+BpL+BPP3, c[6], c[8]); -#define PIXEL30_0 *((int*)(pOut+BpL+BpL+BpL)) = c[5]; -#define PIXEL30_11 hq4x_Interp1(pOut+BpL+BpL+BpL, c[5], c[8]); -#define PIXEL30_12 hq4x_Interp1(pOut+BpL+BpL+BpL, c[5], c[4]); -#define PIXEL30_20 hq4x_Interp2(pOut+BpL+BpL+BpL, c[5], c[8], c[4]); -#define PIXEL30_50 hq4x_Interp5(pOut+BpL+BpL+BpL, c[8], c[4]); -#define PIXEL30_80 hq4x_Interp8(pOut+BpL+BpL+BpL, c[5], c[7]); -#define PIXEL30_81 hq4x_Interp8(pOut+BpL+BpL+BpL, c[5], c[8]); -#define PIXEL30_82 hq4x_Interp8(pOut+BpL+BpL+BpL, c[5], c[4]); -#define PIXEL31_0 *((int*)(pOut+BpL+BpL+BpL+BPP)) = c[5]; -#define PIXEL31_10 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP, c[5], c[7]); -#define PIXEL31_11 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP, c[5], c[8]); -#define PIXEL31_13 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP, c[8], c[5]); -#define PIXEL31_21 hq4x_Interp2(pOut+BpL+BpL+BpL+BPP, c[8], c[5], c[4]); -#define PIXEL31_32 hq4x_Interp3(pOut+BpL+BpL+BpL+BPP, c[5], c[4]); -#define PIXEL31_50 hq4x_Interp5(pOut+BpL+BpL+BpL+BPP, c[8], c[5]); -#define PIXEL31_60 hq4x_Interp6(pOut+BpL+BpL+BpL+BPP, c[5], c[8], c[4]); -#define PIXEL31_61 hq4x_Interp6(pOut+BpL+BpL+BpL+BPP, c[5], c[8], c[7]); -#define PIXEL31_81 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP, c[5], c[8]); -#define PIXEL31_83 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP, c[8], c[4]); -#define PIXEL32_0 *((int*)(pOut+BpL+BpL+BpL+BPP2)) = c[5]; -#define PIXEL32_10 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP2, c[5], c[9]); -#define PIXEL32_12 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP2, c[5], c[8]); -#define PIXEL32_14 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP2, c[8], c[5]); -#define PIXEL32_21 hq4x_Interp2(pOut+BpL+BpL+BpL+BPP2, c[8], c[5], c[6]); -#define PIXEL32_31 hq4x_Interp3(pOut+BpL+BpL+BpL+BPP2, c[5], c[6]); -#define PIXEL32_50 hq4x_Interp5(pOut+BpL+BpL+BpL+BPP2, c[8], c[5]); -#define PIXEL32_60 hq4x_Interp6(pOut+BpL+BpL+BpL+BPP2, c[5], c[8], c[6]); -#define PIXEL32_61 hq4x_Interp6(pOut+BpL+BpL+BpL+BPP2, c[5], c[8], c[9]); -#define PIXEL32_82 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP2, c[5], c[8]); -#define PIXEL32_83 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP2, c[8], c[6]); -#define PIXEL33_0 *((int*)(pOut+BpL+BpL+BpL+BPP3)) = c[5]; -#define PIXEL33_11 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP3, c[5], c[6]); -#define PIXEL33_12 hq4x_Interp1(pOut+BpL+BpL+BpL+BPP3, c[5], c[8]); -#define PIXEL33_20 hq4x_Interp2(pOut+BpL+BpL+BpL+BPP3, c[5], c[8], c[6]); -#define PIXEL33_50 hq4x_Interp5(pOut+BpL+BpL+BpL+BPP3, c[8], c[6]); -#define PIXEL33_80 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP3, c[5], c[9]); -#define PIXEL33_81 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP3, c[5], c[6]); -#define PIXEL33_82 hq4x_Interp8(pOut+BpL+BpL+BpL+BPP3, c[5], c[8]); - -#define HQ4X_DIFF(n, b) \ -static int Diff_##n (uint##b w1, uint##b w2) \ -{ \ - int YUV1, YUV2; \ - YUV1 = RGB##n##toYUV(w1); \ - YUV2 = RGB##n##toYUV(w2); \ - return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) || \ - ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || \ - ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ); \ -} - -HQ4X_DIFF(888, 32) - -#if !_16BPP_HACK -HQ4X_DIFF(444, 16) -HQ4X_DIFF(555, 16) -HQ4X_DIFF(565, 16) - -void hq4x_4444(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL) -{ -#define hq4x_Interp1 hq4x_Interp1_4444 -#define hq4x_Interp2 hq4x_Interp2_4444 -#define hq4x_Interp3 hq4x_Interp3_4444 -#define hq4x_Interp4 hq4x_Interp4_4444 -#define hq4x_Interp5 hq4x_Interp5_4444 -#define hq4x_Interp6 hq4x_Interp6_4444 -#define hq4x_Interp7 hq4x_Interp7_4444 -#define hq4x_Interp8 hq4x_Interp8_4444 -#define Diff Diff_444 -#define BPP 2 -#define BPP2 4 -#define BPP3 6 - - int i, j, k; - int prevline, nextline; - uint16 w[10]; - uint16 c[10]; - - int pattern; - int flag; - - int YUV1, YUV2; - - // +----+----+----+ - // | | | | - // | w1 | w2 | w3 | - // +----+----+----+ - // | | | | - // | w4 | w5 | w6 | - // +----+----+----+ - // | | | | - // | w7 | w8 | w9 | - // +----+----+----+ - - for (j = 0; j < Yres; j++) { - if (j>0) prevline = -SrcPPL*2; else prevline = 0; - if (j0) { - w[1] = *((uint16*)(pIn + prevline - 2)); - w[4] = *((uint16*)(pIn - 2)); - w[7] = *((uint16*)(pIn + nextline - 2)); - } else { - w[1] = w[2]; - w[4] = w[5]; - w[7] = w[8]; - } - - if (i trY ) || - ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || - ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ) - pattern |= flag; - } - flag <<= 1; - } - - for (k=1; k<=9; k++) - c[k] = w[k]; - -#include "TextureFilters_hq4x.h" - - pIn+=2; - pOut+=8; - } - pIn += 2*(SrcPPL-Xres); - pOut+= 8*(SrcPPL-Xres); - pOut+=BpL; - pOut+=BpL; - pOut+=BpL; - } - -#undef BPP -#undef BPP2 -#undef BPP3 -#undef Diff -#undef hq4x_Interp1 -#undef hq4x_Interp2 -#undef hq4x_Interp3 -#undef hq4x_Interp4 -#undef hq4x_Interp5 -#undef hq4x_Interp6 -#undef hq4x_Interp7 -#undef hq4x_Interp8 -} - -void hq4x_1555(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL) -{ -#define hq4x_Interp1 hq4x_Interp1_1555 -#define hq4x_Interp2 hq4x_Interp2_1555 -#define hq4x_Interp3 hq4x_Interp3_1555 -#define hq4x_Interp4 hq4x_Interp4_1555 -#define hq4x_Interp5 hq4x_Interp5_1555 -#define hq4x_Interp6 hq4x_Interp6_1555 -#define hq4x_Interp7 hq4x_Interp7_1555 -#define hq4x_Interp8 hq4x_Interp8_1555 -#define Diff Diff_555 -#define BPP 2 -#define BPP2 4 -#define BPP3 6 - - int i, j, k; - int prevline, nextline; - uint16 w[10]; - uint16 c[10]; - - int pattern; - int flag; - - int YUV1, YUV2; - - // +----+----+----+ - // | | | | - // | w1 | w2 | w3 | - // +----+----+----+ - // | | | | - // | w4 | w5 | w6 | - // +----+----+----+ - // | | | | - // | w7 | w8 | w9 | - // +----+----+----+ - - for (j = 0; j < Yres; j++) { - if (j>0) prevline = -SrcPPL*2; else prevline = 0; - if (j0) { - w[1] = *((uint16*)(pIn + prevline - 2)); - w[4] = *((uint16*)(pIn - 2)); - w[7] = *((uint16*)(pIn + nextline - 2)); - } else { - w[1] = w[2]; - w[4] = w[5]; - w[7] = w[8]; - } - - if (i trY ) || - ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || - ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ) - pattern |= flag; - } - flag <<= 1; - } - - for (k=1; k<=9; k++) - c[k] = w[k]; - -#include "TextureFilters_hq4x.h" - - pIn+=2; - pOut+=8; - } - pIn += 2*(SrcPPL-Xres); - pOut+= 8*(SrcPPL-Xres); - pOut+=BpL; - pOut+=BpL; - pOut+=BpL; - } - -#undef BPP -#undef BPP2 -#undef BPP3 -#undef Diff -#undef hq4x_Interp1 -#undef hq4x_Interp2 -#undef hq4x_Interp3 -#undef hq4x_Interp4 -#undef hq4x_Interp5 -#undef hq4x_Interp6 -#undef hq4x_Interp7 -#undef hq4x_Interp8 -} - -void hq4x_565(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL) -{ -#define hq4x_Interp1 hq4x_Interp1_565 -#define hq4x_Interp2 hq4x_Interp2_565 -#define hq4x_Interp3 hq4x_Interp3_565 -#define hq4x_Interp4 hq4x_Interp4_565 -#define hq4x_Interp5 hq4x_Interp5_565 -#define hq4x_Interp6 hq4x_Interp6_565 -#define hq4x_Interp7 hq4x_Interp7_565 -#define hq4x_Interp8 hq4x_Interp8_565 -#define Diff Diff_565 -#define BPP 2 -#define BPP2 4 -#define BPP3 6 - - int i, j, k; - int prevline, nextline; - uint16 w[10]; - uint16 c[10]; - - int pattern; - int flag; - - int YUV1, YUV2; - - // +----+----+----+ - // | | | | - // | w1 | w2 | w3 | - // +----+----+----+ - // | | | | - // | w4 | w5 | w6 | - // +----+----+----+ - // | | | | - // | w7 | w8 | w9 | - // +----+----+----+ - - for (j = 0; j < Yres; j++) { - if (j>0) prevline = -SrcPPL*2; else prevline = 0; - if (j0) { - w[1] = *((uint16*)(pIn + prevline - 2)); - w[4] = *((uint16*)(pIn - 2)); - w[7] = *((uint16*)(pIn + nextline - 2)); - } else { - w[1] = w[2]; - w[4] = w[5]; - w[7] = w[8]; - } - - if (i trY ) || - ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || - ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ) - pattern |= flag; - } - flag <<= 1; - } - - for (k=1; k<=9; k++) - c[k] = w[k]; - -#include "TextureFilters_hq4x.h" - - pIn+=2; - pOut+=8; - } - pIn += 2*(SrcPPL-Xres); - pOut+= 8*(SrcPPL-Xres); - pOut+=BpL; - pOut+=BpL; - pOut+=BpL; - } - -#undef BPP -#undef BPP2 -#undef BPP3 -#undef Diff -#undef hq4x_Interp1 -#undef hq4x_Interp2 -#undef hq4x_Interp3 -#undef hq4x_Interp4 -#undef hq4x_Interp5 -#undef hq4x_Interp6 -#undef hq4x_Interp7 -#undef hq4x_Interp8 -} -#endif /* !_16BPP_HACK */ - -void hq4x_8888(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL) -{ -#define hq4x_Interp1 hq4x_Interp1_8888 -#define hq4x_Interp2 hq4x_Interp2_8888 -#define hq4x_Interp3 hq4x_Interp3_8888 -#define hq4x_Interp4 hq4x_Interp4_8888 -#define hq4x_Interp5 hq4x_Interp5_8888 -#define hq4x_Interp6 hq4x_Interp6_8888 -#define hq4x_Interp7 hq4x_Interp7_8888 -#define hq4x_Interp8 hq4x_Interp8_8888 -#define Diff Diff_888 -#define BPP 4 -#define BPP2 8 -#define BPP3 12 - - int i, j, k; - int prevline, nextline; - uint32 w[10]; - uint32 c[10]; - - int pattern; - int flag; - - int YUV1, YUV2; - - // +----+----+----+ - // | | | | - // | w1 | w2 | w3 | - // +----+----+----+ - // | | | | - // | w4 | w5 | w6 | - // +----+----+----+ - // | | | | - // | w7 | w8 | w9 | - // +----+----+----+ - - for (j = 0; j < Yres; j++) { - if (j>0) prevline = -SrcPPL*4; else prevline = 0; - if (j0) { - w[1] = *((uint32*)(pIn + prevline - 4)); - w[4] = *((uint32*)(pIn - 4)); - w[7] = *((uint32*)(pIn + nextline - 4)); - } else { - w[1] = w[2]; - w[4] = w[5]; - w[7] = w[8]; - } - - if (i trY ) || - ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || - ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ) - pattern |= flag; - } - flag <<= 1; - } - - for (k=1; k<=9; k++) - c[k] = w[k]; - -#include "TextureFilters_hq4x.h" - - pIn+=4; - pOut+=16; - } - - pIn += 4*(SrcPPL-Xres); - pOut+= 16*(SrcPPL-Xres); - pOut+=BpL; - pOut+=BpL; - pOut+=BpL; - } - -#undef BPP -#undef BPP2 -#undef BPP3 -#undef Diff -#undef hq4x_Interp1 -#undef hq4x_Interp2 -#undef hq4x_Interp3 -#undef hq4x_Interp4 -#undef hq4x_Interp5 -#undef hq4x_Interp6 -#undef hq4x_Interp7 -#undef hq4x_Interp8 -} - -#if !_16BPP_HACK -void hq4x_init(void) -{ - static int done = 0; - int r, g, b, Y, u, v, i, j, k; - - if (done ) return; - - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - for (k = 0; k < 16; k++) { - r = (i << 4) | i; - g = (j << 4) | j; - b = (k << 4) | k; - - /* Microsoft's RGB888->YUV conversion */ - /*Y = ((( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16) & 0xFF; - u = ((( -38 * r - 74 * g + 112 * b + 128) >> 8) + 128) & 0xFF; - v = ((( 112 * r - 94 * g - 18 * b + 128) >> 8) + 128) & 0xFF;*/ - - Y = (r + g + b) >> 2; - u = 128 + ((r - b) >> 2); - v = 128 + ((-r + 2*g -b)>>3); - - RGB444toYUV[(i << 8) | (j << 4) | k] = (Y << 16) | (u << 8) | v; - } - } - } - - done = 1; -} -#endif /* !_16BPP_HACK */ diff --git a/GLideN64/src/GLideNHQ/TextureFilters_hq4x.h b/GLideN64/src/GLideNHQ/TextureFilters_hq4x.h deleted file mode 100644 index a3a2740..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_hq4x.h +++ /dev/null @@ -1,4999 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Based on Maxim Stepin and Rice1964 hq4x code */ - - switch (pattern) - { - case 0: - case 1: - case 4: - case 32: - case 128: - case 5: - case 132: - case 160: - case 33: - case 129: - case 36: - case 133: - case 164: - case 161: - case 37: - case 165: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - break; - } - case 2: - case 34: - case 130: - case 162: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - break; - } - case 16: - case 17: - case 48: - case 49: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - break; - } - case 64: - case 65: - case 68: - case 69: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 8: - case 12: - case 136: - case 140: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - break; - } - case 3: - case 35: - case 131: - case 163: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - break; - } - case 6: - case 38: - case 134: - case 166: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - break; - } - case 20: - case 21: - case 52: - case 53: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - break; - } - case 144: - case 145: - case 176: - case 177: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - break; - } - case 192: - case 193: - case 196: - case 197: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 96: - case 97: - case 100: - case 101: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 40: - case 44: - case 168: - case 172: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 9: - case 13: - case 137: - case 141: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - break; - } - case 18: - case 50: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL12_0 - PIXEL13_50 - } - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - break; - } - case 80: - case 81: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 72: - case 76: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_50 - PIXEL21_0 - PIXEL30_50 - PIXEL31_50 - } - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 10: - case 138: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - PIXEL11_0 - } - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - break; - } - case 66: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 24: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 7: - case 39: - case 135: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - break; - } - case 148: - case 149: - case 180: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - break; - } - case 224: - case 228: - case 225: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - break; - } - case 41: - case 169: - case 45: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 22: - case 54: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - break; - } - case 208: - case 209: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 104: - case 108: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 11: - case 139: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - break; - } - case 19: - case 51: - { - if (Diff(w[2], w[6])) - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL00_12 - PIXEL01_14 - PIXEL02_83 - PIXEL03_50 - PIXEL12_70 - PIXEL13_21 - } - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - break; - } - case 146: - case 178: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - PIXEL23_32 - PIXEL33_82 - } - else - { - PIXEL02_21 - PIXEL03_50 - PIXEL12_70 - PIXEL13_83 - PIXEL23_13 - PIXEL33_11 - } - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - break; - } - case 84: - case 85: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - if (Diff(w[6], w[8])) - { - PIXEL03_81 - PIXEL13_31 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL03_12 - PIXEL13_14 - PIXEL22_70 - PIXEL23_83 - PIXEL32_21 - PIXEL33_50 - } - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - break; - } - case 112: - case 113: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_70 - PIXEL23_21 - PIXEL30_11 - PIXEL31_13 - PIXEL32_83 - PIXEL33_50 - } - break; - } - case 200: - case 204: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - } - else - { - PIXEL20_21 - PIXEL21_70 - PIXEL30_50 - PIXEL31_83 - PIXEL32_14 - PIXEL33_12 - } - PIXEL22_31 - PIXEL23_81 - break; - } - case 73: - case 77: - { - if (Diff(w[8], w[4])) - { - PIXEL00_82 - PIXEL10_32 - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL00_11 - PIXEL10_13 - PIXEL20_83 - PIXEL21_70 - PIXEL30_50 - PIXEL31_21 - } - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 42: - case 170: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - PIXEL20_31 - PIXEL30_81 - } - else - { - PIXEL00_50 - PIXEL01_21 - PIXEL10_83 - PIXEL11_70 - PIXEL20_14 - PIXEL30_12 - } - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 14: - case 142: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_50 - PIXEL01_83 - PIXEL02_13 - PIXEL03_11 - PIXEL10_21 - PIXEL11_70 - } - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - break; - } - case 67: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 70: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 28: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 152: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 194: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 98: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 56: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 25: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 26: - case 31: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 82: - case 214: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 88: - case 248: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - break; - } - case 74: - case 107: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 27: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 86: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 216: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 106: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 30: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 210: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 120: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 75: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 29: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - break; - } - case 198: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 184: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 99: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 57: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 71: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 156: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 226: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - break; - } - case 60: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 195: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 102: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 153: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 58: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 83: - { - PIXEL00_81 - PIXEL01_31 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL10_81 - PIXEL11_31 - PIXEL20_61 - PIXEL21_30 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 92: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 202: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - break; - } - case 78: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 154: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 114: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - PIXEL30_82 - PIXEL31_32 - break; - } - case 89: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 90: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 55: - case 23: - { - if (Diff(w[2], w[6])) - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - PIXEL03_0 - PIXEL12_0 - PIXEL13_0 - } - else - { - PIXEL00_12 - PIXEL01_14 - PIXEL02_83 - PIXEL03_50 - PIXEL12_70 - PIXEL13_21 - } - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - break; - } - case 182: - case 150: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL12_0 - PIXEL13_0 - PIXEL23_32 - PIXEL33_82 - } - else - { - PIXEL02_21 - PIXEL03_50 - PIXEL12_70 - PIXEL13_83 - PIXEL23_13 - PIXEL33_11 - } - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - break; - } - case 213: - case 212: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - if (Diff(w[6], w[8])) - { - PIXEL03_81 - PIXEL13_31 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL03_12 - PIXEL13_14 - PIXEL22_70 - PIXEL23_83 - PIXEL32_21 - PIXEL33_50 - } - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - break; - } - case 241: - case 240: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - if (Diff(w[6], w[8])) - { - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL22_70 - PIXEL23_21 - PIXEL30_11 - PIXEL31_13 - PIXEL32_83 - PIXEL33_50 - } - break; - } - case 236: - case 232: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL21_0 - PIXEL30_0 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - } - else - { - PIXEL20_21 - PIXEL21_70 - PIXEL30_50 - PIXEL31_83 - PIXEL32_14 - PIXEL33_12 - } - PIXEL22_31 - PIXEL23_81 - break; - } - case 109: - case 105: - { - if (Diff(w[8], w[4])) - { - PIXEL00_82 - PIXEL10_32 - PIXEL20_0 - PIXEL21_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL00_11 - PIXEL10_13 - PIXEL20_83 - PIXEL21_70 - PIXEL30_50 - PIXEL31_21 - } - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 171: - case 43: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - PIXEL11_0 - PIXEL20_31 - PIXEL30_81 - } - else - { - PIXEL00_50 - PIXEL01_21 - PIXEL10_83 - PIXEL11_70 - PIXEL20_14 - PIXEL30_12 - } - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 143: - case 15: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - } - else - { - PIXEL00_50 - PIXEL01_83 - PIXEL02_13 - PIXEL03_11 - PIXEL10_21 - PIXEL11_70 - } - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - break; - } - case 124: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 203: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 62: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 211: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 118: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 217: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 110: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 155: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 188: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 185: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 61: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 157: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 103: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 227: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - break; - } - case 230: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - break; - } - case 199: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 220: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - break; - } - case 158: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 234: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - break; - } - case 242: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_82 - PIXEL31_32 - break; - } - case 59: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL11_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 121: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 87: - { - PIXEL00_81 - PIXEL01_31 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 79: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_32 - PIXEL03_82 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 122: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 94: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL12_0 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 218: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - break; - } - case 91: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL11_0 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 229: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - break; - } - case 167: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - break; - } - case 173: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 181: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - break; - } - case 186: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 115: - { - PIXEL00_81 - PIXEL01_31 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - PIXEL30_82 - PIXEL31_32 - break; - } - case 93: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - break; - } - case 206: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - break; - } - case 205: - case 201: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - if (Diff(w[8], w[4])) - { - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - } - else - { - PIXEL20_12 - PIXEL21_0 - PIXEL30_20 - PIXEL31_11 - } - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - break; - } - case 174: - case 46: - { - if (Diff(w[4], w[2])) - { - PIXEL00_80 - PIXEL01_10 - PIXEL10_10 - PIXEL11_30 - } - else - { - PIXEL00_20 - PIXEL01_12 - PIXEL10_11 - PIXEL11_0 - } - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 179: - case 147: - { - PIXEL00_81 - PIXEL01_31 - if (Diff(w[2], w[6])) - { - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - } - else - { - PIXEL02_11 - PIXEL03_20 - PIXEL12_0 - PIXEL13_12 - } - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - break; - } - case 117: - case 116: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - if (Diff(w[6], w[8])) - { - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - } - else - { - PIXEL22_0 - PIXEL23_11 - PIXEL32_12 - PIXEL33_20 - } - PIXEL30_82 - PIXEL31_32 - break; - } - case 189: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 231: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - break; - } - case 126: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 219: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 125: - { - if (Diff(w[8], w[4])) - { - PIXEL00_82 - PIXEL10_32 - PIXEL20_0 - PIXEL21_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL00_11 - PIXEL10_13 - PIXEL20_83 - PIXEL21_70 - PIXEL30_50 - PIXEL31_21 - } - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 221: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - if (Diff(w[6], w[8])) - { - PIXEL03_81 - PIXEL13_31 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL03_12 - PIXEL13_14 - PIXEL22_70 - PIXEL23_83 - PIXEL32_21 - PIXEL33_50 - } - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - break; - } - case 207: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - } - else - { - PIXEL00_50 - PIXEL01_83 - PIXEL02_13 - PIXEL03_11 - PIXEL10_21 - PIXEL11_70 - } - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - break; - } - case 238: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL21_0 - PIXEL30_0 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - } - else - { - PIXEL20_21 - PIXEL21_70 - PIXEL30_50 - PIXEL31_83 - PIXEL32_14 - PIXEL33_12 - } - PIXEL22_31 - PIXEL23_81 - break; - } - case 190: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL12_0 - PIXEL13_0 - PIXEL23_32 - PIXEL33_82 - } - else - { - PIXEL02_21 - PIXEL03_50 - PIXEL12_70 - PIXEL13_83 - PIXEL23_13 - PIXEL33_11 - } - PIXEL10_10 - PIXEL11_30 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - break; - } - case 187: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - PIXEL11_0 - PIXEL20_31 - PIXEL30_81 - } - else - { - PIXEL00_50 - PIXEL01_21 - PIXEL10_83 - PIXEL11_70 - PIXEL20_14 - PIXEL30_12 - } - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 243: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - if (Diff(w[6], w[8])) - { - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL22_70 - PIXEL23_21 - PIXEL30_11 - PIXEL31_13 - PIXEL32_83 - PIXEL33_50 - } - break; - } - case 119: - { - if (Diff(w[2], w[6])) - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - PIXEL03_0 - PIXEL12_0 - PIXEL13_0 - } - else - { - PIXEL00_12 - PIXEL01_14 - PIXEL02_83 - PIXEL03_50 - PIXEL12_70 - PIXEL13_21 - } - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - break; - } - case 237: - case 233: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - break; - } - case 175: - case 47: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - break; - } - case 183: - case 151: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - break; - } - case 245: - case 244: - { - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - case 250: - { - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - break; - } - case 123: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 95: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 222: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 252: - { - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - case 249: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - break; - } - case 235: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - break; - } - case 111: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - break; - } - case 63: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - break; - } - case 159: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - break; - } - case 215: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 246: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - case 254: - { - PIXEL00_80 - PIXEL01_10 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - case 253: - { - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - case 251: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - break; - } - case 239: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - break; - } - case 127: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - if (Diff(w[2], w[6])) - { - PIXEL02_0 - PIXEL03_0 - PIXEL13_0 - } - else - { - PIXEL02_50 - PIXEL03_50 - PIXEL13_50 - } - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - if (Diff(w[8], w[4])) - { - PIXEL20_0 - PIXEL30_0 - PIXEL31_0 - } - else - { - PIXEL20_50 - PIXEL30_50 - PIXEL31_50 - } - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - break; - } - case 191: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - break; - } - case 223: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - PIXEL01_0 - PIXEL10_0 - } - else - { - PIXEL00_50 - PIXEL01_50 - PIXEL10_50 - } - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - if (Diff(w[6], w[8])) - { - PIXEL23_0 - PIXEL32_0 - PIXEL33_0 - } - else - { - PIXEL23_50 - PIXEL32_50 - PIXEL33_50 - } - PIXEL30_80 - PIXEL31_10 - break; - } - case 247: - { - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - case 255: - { - if (Diff(w[4], w[2])) - { - PIXEL00_0 - } - else - { - PIXEL00_20 - } - PIXEL01_0 - PIXEL02_0 - if (Diff(w[2], w[6])) - { - PIXEL03_0 - } - else - { - PIXEL03_20 - } - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - if (Diff(w[8], w[4])) - { - PIXEL30_0 - } - else - { - PIXEL30_20 - } - PIXEL31_0 - PIXEL32_0 - if (Diff(w[6], w[8])) - { - PIXEL33_0 - } - else - { - PIXEL33_20 - } - break; - } - } diff --git a/GLideN64/src/GLideNHQ/TextureFilters_lq2x.h b/GLideN64/src/GLideNHQ/TextureFilters_lq2x.h deleted file mode 100644 index b5318ab..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_lq2x.h +++ /dev/null @@ -1,1307 +0,0 @@ -/* -Copyright (C) 2003 Rice1964 - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/* Copyright (C) 2007 Hiroshi Morii - * Modified for the Texture Filtering library - */ - -case 0 : -case 2 : -case 4 : -case 6 : -case 8 : -case 12 : -case 16 : -case 20 : -case 24 : -case 28 : -case 32 : -case 34 : -case 36 : -case 38 : -case 40 : -case 44 : -case 48 : -case 52 : -case 56 : -case 60 : -case 64 : -case 66 : -case 68 : -case 70 : -case 96 : -case 98 : -case 100 : -case 102 : -case 128 : -case 130 : -case 132 : -case 134 : -case 136 : -case 140 : -case 144 : -case 148 : -case 152 : -case 156 : -case 160 : -case 162 : -case 164 : -case 166 : -case 168 : -case 172 : -case 176 : -case 180 : -case 184 : -case 188 : -case 192 : -case 194 : -case 196 : -case 198 : -case 224 : -case 226 : -case 228 : -case 230 : -{ - P0 = IC(0); - P1 = IC(0); - P2 = IC(0); - P3 = IC(0); -} break; -case 1 : -case 5 : -case 9 : -case 13 : -case 17 : -case 21 : -case 25 : -case 29 : -case 33 : -case 37 : -case 41 : -case 45 : -case 49 : -case 53 : -case 57 : -case 61 : -case 65 : -case 69 : -case 97 : -case 101 : -case 129 : -case 133 : -case 137 : -case 141 : -case 145 : -case 149 : -case 153 : -case 157 : -case 161 : -case 165 : -case 169 : -case 173 : -case 177 : -case 181 : -case 185 : -case 189 : -case 193 : -case 197 : -case 225 : -case 229 : -{ - P0 = IC(1); - P1 = IC(1); - P2 = IC(1); - P3 = IC(1); -} break; -case 3 : -case 35 : -case 67 : -case 99 : -case 131 : -case 163 : -case 195 : -case 227 : -{ - P0 = IC(2); - P1 = IC(2); - P2 = IC(2); - P3 = IC(2); -} break; -case 7 : -case 39 : -case 71 : -case 103 : -case 135 : -case 167 : -case 199 : -case 231 : -{ - P0 = IC(3); - P1 = IC(3); - P2 = IC(3); - P3 = IC(3); -} break; -case 10 : -case 138 : -{ - P1 = IC(0); - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I211(0, 1, 3); - } -} break; -case 11 : -case 27 : -case 75 : -case 139 : -case 155 : -case 203 : -{ - P1 = IC(2); - P2 = IC(2); - P3 = IC(2); - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } -} break; -case 14 : -case 142 : -{ - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - P1 = IC(0); - } else { - P0 = I332(1, 3, 0); - P1 = I31(0, 1); - } -} break; -case 15 : -case 143 : -case 207 : -{ - P2 = IC(4); - P3 = IC(4); - if (HQ2X_MUL) { - P0 = IC(4); - P1 = IC(4); - } else { - P0 = I332(1, 3, 4); - P1 = I31(4, 1); - } -} break; -case 18 : -case 22 : -case 30 : -case 50 : -case 54 : -case 62 : -case 86 : -case 118 : -{ - P0 = IC(0); - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 19 : -case 51 : -{ - P2 = IC(2); - P3 = IC(2); - if (HQ2X_MUR) { - P0 = IC(2); - P1 = IC(2); - } else { - P0 = I31(2, 1); - P1 = I332(1, 5, 2); - } -} break; -case 23 : -case 55 : -case 119 : -{ - P2 = IC(3); - P3 = IC(3); - if (HQ2X_MUR) { - P0 = IC(3); - P1 = IC(3); - } else { - P0 = I31(3, 1); - P1 = I332(1, 5, 3); - } -} break; -case 26 : -{ - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I211(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 31 : -case 95 : -{ - P2 = IC(4); - P3 = IC(4); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 42 : -case 170 : -{ - P1 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - P2 = IC(0); - } else { - P0 = I332(1, 3, 0); - P2 = I31(0, 3); - } -} break; -case 43 : -case 171 : -case 187 : -{ - P1 = IC(2); - P3 = IC(2); - if (HQ2X_MUL) { - P0 = IC(2); - P2 = IC(2); - } else { - P0 = I332(1, 3, 2); - P2 = I31(2, 3); - } -} break; -case 46 : -case 174 : -{ - P1 = IC(0); - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } -} break; -case 47 : -case 175 : -{ - P1 = IC(4); - P2 = IC(4); - P3 = IC(4); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } -} break; -case 58 : -case 154 : -case 186 : -{ - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I611(0, 1, 5); - } -} break; -case 59 : -{ - P2 = IC(2); - P3 = IC(2); - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(2); - } else { - P1 = I611(2, 1, 5); - } -} break; -case 63 : -{ - P2 = IC(4); - P3 = IC(4); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 72 : -case 76 : -case 104 : -case 106 : -case 108 : -case 110 : -case 120 : -case 124 : -{ - P0 = IC(0); - P1 = IC(0); - P3 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } -} break; -case 73 : -case 77 : -case 105 : -case 109 : -case 125 : -{ - P1 = IC(1); - P3 = IC(1); - if (HQ2X_MDL) { - P0 = IC(1); - P2 = IC(1); - } else { - P0 = I31(1, 3); - P2 = I332(3, 7, 1); - } -} break; -case 74 : -{ - P1 = IC(0); - P3 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I211(0, 1, 3); - } -} break; -case 78 : -case 202 : -case 206 : -{ - P1 = IC(0); - P3 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I611(0, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } -} break; -case 79 : -{ - P1 = IC(4); - P3 = IC(4); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I611(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } -} break; -case 80 : -case 208 : -case 210 : -case 216 : -{ - P0 = IC(0); - P1 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I211(0, 5, 7); - } -} break; -case 81 : -case 209 : -case 217 : -{ - P0 = IC(1); - P1 = IC(1); - P2 = IC(1); - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I211(1, 5, 7); - } -} break; -case 82 : -case 214 : -case 222 : -{ - P0 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I211(0, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 83 : -case 115 : -{ - P0 = IC(2); - P2 = IC(2); - if (HQ2X_MDR) { - P3 = IC(2); - } else { - P3 = I611(2, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(2); - } else { - P1 = I611(2, 1, 5); - } -} break; -case 84 : -case 212 : -{ - P0 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P1 = IC(0); - P3 = IC(0); - } else { - P1 = I31(0, 5); - P3 = I332(5, 7, 0); - } -} break; -case 85 : -case 213 : -case 221 : -{ - P0 = IC(1); - P2 = IC(1); - if (HQ2X_MDR) { - P1 = IC(1); - P3 = IC(1); - } else { - P1 = I31(1, 5); - P3 = I332(5, 7, 1); - } -} break; -case 87 : -{ - P0 = IC(3); - P2 = IC(3); - if (HQ2X_MDR) { - P3 = IC(3); - } else { - P3 = I611(3, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(3); - } else { - P1 = I211(3, 1, 5); - } -} break; -case 88 : -case 248 : -case 250 : -{ - P0 = IC(0); - P1 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I211(0, 5, 7); - } -} break; -case 89 : -case 93 : -{ - P0 = IC(1); - P1 = IC(1); - if (HQ2X_MDL) { - P2 = IC(1); - } else { - P2 = I611(1, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I611(1, 5, 7); - } -} break; -case 90 : -{ - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I611(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I611(0, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I611(0, 1, 5); - } -} break; -case 91 : -{ - if (HQ2X_MDL) { - P2 = IC(2); - } else { - P2 = I611(2, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(2); - } else { - P3 = I611(2, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(2); - } else { - P1 = I611(2, 1, 5); - } -} break; -case 92 : -{ - P0 = IC(0); - P1 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I611(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I611(0, 5, 7); - } -} break; -case 94 : -{ - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I611(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I611(0, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 107 : -case 123 : -{ - P1 = IC(2); - P3 = IC(2); - if (HQ2X_MDL) { - P2 = IC(2); - } else { - P2 = I211(2, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } -} break; -case 111 : -{ - P1 = IC(4); - P3 = IC(4); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } -} break; -case 112 : -case 240 : -{ - P0 = IC(0); - P1 = IC(0); - if (HQ2X_MDR) { - P2 = IC(0); - P3 = IC(0); - } else { - P2 = I31(0, 7); - P3 = I332(5, 7, 0); - } -} break; -case 113 : -case 241 : -{ - P0 = IC(1); - P1 = IC(1); - if (HQ2X_MDR) { - P2 = IC(1); - P3 = IC(1); - } else { - P2 = I31(1, 7); - P3 = I332(5, 7, 1); - } -} break; -case 114 : -{ - P0 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I611(0, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I611(0, 1, 5); - } -} break; -case 116 : -{ - P0 = IC(0); - P1 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I611(0, 5, 7); - } -} break; -case 117 : -{ - P0 = IC(1); - P1 = IC(1); - P2 = IC(1); - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I611(1, 5, 7); - } -} break; -case 121 : -{ - P0 = IC(1); - P1 = IC(1); - if (HQ2X_MDL) { - P2 = IC(1); - } else { - P2 = I211(1, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I611(1, 5, 7); - } -} break; -case 122 : -{ - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I611(0, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I611(0, 1, 5); - } -} break; -case 126 : -{ - P0 = IC(0); - P3 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 127 : -{ - P3 = IC(4); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I211(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I211(4, 1, 5); - } -} break; -case 146 : -case 150 : -case 178 : -case 182 : -case 190 : -{ - P0 = IC(0); - P2 = IC(0); - if (HQ2X_MUR) { - P1 = IC(0); - P3 = IC(0); - } else { - P1 = I332(1, 5, 0); - P3 = I31(0, 5); - } -} break; -case 147 : -case 179 : -{ - P0 = IC(2); - P2 = IC(2); - P3 = IC(2); - if (HQ2X_MUR) { - P1 = IC(2); - } else { - P1 = I611(2, 1, 5); - } -} break; -case 151 : -case 183 : -{ - P0 = IC(3); - P2 = IC(3); - P3 = IC(3); - if (HQ2X_MUR) { - P1 = IC(3); - } else { - P1 = I1411(3, 1, 5); - } -} break; -case 158 : -{ - P2 = IC(0); - P3 = IC(0); - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 159 : -{ - P2 = IC(4); - P3 = IC(4); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 191 : -{ - P2 = IC(4); - P3 = IC(4); - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 200 : -case 204 : -case 232 : -case 236 : -case 238 : -{ - P0 = IC(0); - P1 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - P3 = IC(0); - } else { - P2 = I332(3, 7, 0); - P3 = I31(0, 7); - } -} break; -case 201 : -case 205 : -{ - P0 = IC(1); - P1 = IC(1); - P3 = IC(1); - if (HQ2X_MDL) { - P2 = IC(1); - } else { - P2 = I611(1, 3, 7); - } -} break; -case 211 : -{ - P0 = IC(2); - P1 = IC(2); - P2 = IC(2); - if (HQ2X_MDR) { - P3 = IC(2); - } else { - P3 = I211(2, 5, 7); - } -} break; -case 215 : -{ - P0 = IC(3); - P2 = IC(3); - if (HQ2X_MDR) { - P3 = IC(3); - } else { - P3 = I211(3, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(3); - } else { - P1 = I1411(3, 1, 5); - } -} break; -case 218 : -{ - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I611(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I211(0, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I611(0, 1, 5); - } -} break; -case 219 : -{ - P1 = IC(2); - P2 = IC(2); - if (HQ2X_MDR) { - P3 = IC(2); - } else { - P3 = I211(2, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } -} break; -case 220 : -{ - P0 = IC(0); - P1 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I611(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I211(0, 5, 7); - } -} break; -case 223 : -{ - P2 = IC(4); - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I211(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I211(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; -case 233 : -case 237 : -{ - P0 = IC(1); - P1 = IC(1); - P3 = IC(1); - if (HQ2X_MDL) { - P2 = IC(1); - } else { - P2 = I1411(1, 3, 7); - } -} break; -case 234 : -{ - P1 = IC(0); - P3 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(0); - } else { - P0 = I611(0, 1, 3); - } -} break; -case 235 : -{ - P1 = IC(2); - P3 = IC(2); - if (HQ2X_MDL) { - P2 = IC(2); - } else { - P2 = I1411(2, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } -} break; -case 239 : -{ - P1 = IC(4); - P3 = IC(4); - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } -} break; -case 242 : -{ - P0 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I211(0, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I611(0, 1, 5); - } -} break; -case 243 : -{ - P0 = IC(2); - P1 = IC(2); - if (HQ2X_MDR) { - P2 = IC(2); - P3 = IC(2); - } else { - P2 = I31(2, 7); - P3 = I332(5, 7, 2); - } -} break; -case 244 : -{ - P0 = IC(0); - P1 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I1411(0, 5, 7); - } -} break; -case 245 : -{ - P0 = IC(1); - P1 = IC(1); - P2 = IC(1); - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I1411(1, 5, 7); - } -} break; -case 246 : -{ - P0 = IC(0); - P2 = IC(0); - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I1411(0, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 247 : -{ - P0 = IC(3); - P2 = IC(3); - if (HQ2X_MDR) { - P3 = IC(3); - } else { - P3 = I1411(3, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(3); - } else { - P1 = I1411(3, 1, 5); - } -} break; -case 249 : -{ - P0 = IC(1); - P1 = IC(1); - if (HQ2X_MDL) { - P2 = IC(1); - } else { - P2 = I1411(1, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I211(1, 5, 7); - } -} break; -case 251 : -{ - P1 = IC(2); - if (HQ2X_MDL) { - P2 = IC(2); - } else { - P2 = I1411(2, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(2); - } else { - P3 = I211(2, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(2); - } else { - P0 = I211(2, 1, 3); - } -} break; -case 252 : -{ - P0 = IC(0); - P1 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I1411(0, 5, 7); - } -} break; -case 253 : -{ - P0 = IC(1); - P1 = IC(1); - if (HQ2X_MDL) { - P2 = IC(1); - } else { - P2 = I1411(1, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(1); - } else { - P3 = I1411(1, 5, 7); - } -} break; -case 254 : -{ - P0 = IC(0); - if (HQ2X_MDL) { - P2 = IC(0); - } else { - P2 = I211(0, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(0); - } else { - P3 = I1411(0, 5, 7); - } - if (HQ2X_MUR) { - P1 = IC(0); - } else { - P1 = I211(0, 1, 5); - } -} break; -case 255 : -{ - if (HQ2X_MDL) { - P2 = IC(4); - } else { - P2 = I1411(4, 3, 7); - } - if (HQ2X_MDR) { - P3 = IC(4); - } else { - P3 = I1411(4, 5, 7); - } - if (HQ2X_MUL) { - P0 = IC(4); - } else { - P0 = I1411(4, 1, 3); - } - if (HQ2X_MUR) { - P1 = IC(4); - } else { - P1 = I1411(4, 1, 5); - } -} break; diff --git a/GLideN64/src/GLideNHQ/TextureFilters_xbrz.cpp b/GLideN64/src/GLideNHQ/TextureFilters_xbrz.cpp deleted file mode 100644 index b91252f..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_xbrz.cpp +++ /dev/null @@ -1,1221 +0,0 @@ -// **************************************************************************** -// * This file is part of the HqMAME project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// * * -// * Additionally and as a special exception, the author gives permission * -// * to link the code of this program with the MAME library (or with modified * -// * versions of MAME that use the same license as MAME), and distribute * -// * linked combinations including the two. You must obey the GNU General * -// * Public License in all respects for all of the code used other than MAME. * -// * If you modify this file, you may extend this exception to your version * -// * of the file, but you are not obligated to do so. If you do not wish to * -// * do so, delete this exception statement from your version. * -// **************************************************************************** - -#include "TextureFilters_xbrz.h" -#include -#include -#include -#include - -namespace -{ -template inline -unsigned char getByte(uint32_t val) { return static_cast((val >> (8 * N)) & 0xff); } - -inline unsigned char getAlpha(uint32_t pix) { return getByte<3>(pix); } -inline unsigned char getBlue (uint32_t pix) { return getByte<2>(pix); } -inline unsigned char getGreen(uint32_t pix) { return getByte<1>(pix); } -inline unsigned char getRed (uint32_t pix) { return getByte<0>(pix); } - - -inline uint32_t makePixel(unsigned char b, unsigned char g, unsigned char r) { return (b << 16) | (g << 8) | r; } -inline uint32_t makePixel(unsigned char a, unsigned char b, unsigned char g, unsigned char r) { return (a << 24) | (b << 16) | (g << 8) | r; } - - -template inline -uint32_t gradientBGR(uint32_t pixFront, uint32_t pixBack) //blend front color with opacity M / N over opaque background: http://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending -{ - static_assert(0 < M && M < N && N <= 1000, ""); - - auto calcColor = [](unsigned char colFront, unsigned char colBack) -> unsigned char { return (colFront * M + colBack * (N - M)) / N; }; - - return makePixel(calcColor(getBlue(pixFront), getBlue(pixBack)), - calcColor(getGreen(pixFront), getGreen(pixBack)), - calcColor(getRed(pixFront), getRed(pixBack))); -} - - -template inline -uint32_t gradientABGR(uint32_t pixFront, uint32_t pixBack) //find intermediate color between two colors with alpha channels (=> NO alpha blending!!!) -{ - static_assert(0 < M && M < N && N <= 1000, ""); - - const unsigned int weightFront = getAlpha(pixFront) * M; - const unsigned int weightBack = getAlpha(pixBack) * (N - M); - const unsigned int weightSum = weightFront + weightBack; - if (weightSum == 0) - return 0; - - auto calcColor = [=](unsigned char colFront, unsigned char colBack) - { - return static_cast((colFront * weightFront + colBack * weightBack) / weightSum); - }; - - return makePixel(static_cast(weightSum / N), - calcColor(getBlue(pixFront), getBlue(pixBack)), - calcColor(getGreen(pixFront), getGreen(pixBack)), - calcColor(getRed(pixFront), getRed(pixBack))); -} - - -//inline -//double fastSqrt(double n) -//{ -// __asm //speeds up xBRZ by about 9% compared to std::sqrt which internally uses the same assembler instructions but adds some "fluff" -// { -// fld n -// fsqrt -// } -//} -// - - -uint32_t* byteAdvance(uint32_t* ptr, int bytes) { return reinterpret_cast< uint32_t*>(reinterpret_cast< char*>(ptr)+bytes); } -const uint32_t* byteAdvance(const uint32_t* ptr, int bytes) { return reinterpret_cast(reinterpret_cast(ptr)+bytes); } - - -//fill block with the given color -inline -void fillBlock(uint32_t* trg, int pitch, uint32_t col, int blockWidth, int blockHeight) -{ - //for (int y = 0; y < blockHeight; ++y, trg = byteAdvance(trg, pitch)) - // std::fill(trg, trg + blockWidth, col); - - for (int y = 0; y < blockHeight; ++y, trg = byteAdvance(trg, pitch)) - for (int x = 0; x < blockWidth; ++x) - trg[x] = col; -} - -inline -void fillBlock(uint32_t* trg, int pitch, uint32_t col, int n) { fillBlock(trg, pitch, col, n, n); } - - -#ifdef _MSC_VER -#define FORCE_INLINE __forceinline -#elif defined __GNUC__ -#define FORCE_INLINE __attribute__((always_inline)) inline -#else -#define FORCE_INLINE inline -#endif - - -enum RotationDegree //clock-wise -{ - ROT_0, - ROT_90, - ROT_180, - ROT_270 -}; - -//calculate input matrix coordinates after rotation at compile time -template -struct MatrixRotation; - -template -struct MatrixRotation -{ - static const size_t I_old = I; - static const size_t J_old = J; -}; - -template //(i, j) = (row, col) indices, N = size of (square) matrix -struct MatrixRotation -{ - static const size_t I_old = N - 1 - MatrixRotation(rotDeg - 1), I, J, N>::J_old; //old coordinates before rotation! - static const size_t J_old = MatrixRotation(rotDeg - 1), I, J, N>::I_old; // -}; - - -template -class OutputMatrix -{ -public: - OutputMatrix(uint32_t* out, int outWidth) : //access matrix area, top-left at position "out" for image with given width - out_(out), - outWidth_(outWidth) {} - - template - uint32_t& ref() const - { - static const size_t I_old = MatrixRotation::I_old; - static const size_t J_old = MatrixRotation::J_old; - return *(out_ + J_old + I_old * outWidth_); - } - -private: - uint32_t* out_; - const int outWidth_; -}; - - -template inline -T square(T value) { return value * value; } - - - -inline -double distRGB(uint32_t pix1, uint32_t pix2) -{ - const double r_diff = static_cast(getRed(pix1)) - getRed(pix2); - const double g_diff = static_cast(getGreen(pix1)) - getGreen(pix2); - const double b_diff = static_cast(getBlue(pix1)) - getBlue(pix2); - - //euklidean RGB distance - return std::sqrt(square(r_diff) + square(g_diff) + square(b_diff)); -} - - -inline -double distYCbCr(uint32_t pix1, uint32_t pix2, double lumaWeight) -{ - //http://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.601_conversion - //YCbCr conversion is a matrix multiplication => take advantage of linearity by subtracting first! - const int r_diff = static_cast(getRed(pix1)) - getRed(pix2); //we may delay division by 255 to after matrix multiplication - const int g_diff = static_cast(getGreen(pix1)) - getGreen(pix2); // - const int b_diff = static_cast(getBlue(pix1)) - getBlue(pix2); //substraction for int is noticeable faster than for double! - - //const double k_b = 0.0722; //ITU-R BT.709 conversion - //const double k_r = 0.2126; // - const double k_b = 0.0593; //ITU-R BT.2020 conversion - const double k_r = 0.2627; // - const double k_g = 1 - k_b - k_r; - - const double scale_b = 0.5 / (1 - k_b); - const double scale_r = 0.5 / (1 - k_r); - - const double y = k_r * r_diff + k_g * g_diff + k_b * b_diff; //[!], analog YCbCr! - const double c_b = scale_b * (b_diff - y); - const double c_r = scale_r * (r_diff - y); - - //we skip division by 255 to have similar range like other distance functions - return std::sqrt(square(lumaWeight * y) + square(c_b) + square(c_r)); -} - -struct DistYCbCrBuffer //30% perf boost compared to distYCbCr()! -{ -public: - static double dist(uint32_t pix1, uint32_t pix2) - { -//#if defined _MSC_VER && _MSC_VER < 1900 -//#error function scope static initialization is not yet thread-safe! -//#endif - static const DistYCbCrBuffer inst; - return inst.distImpl(pix1, pix2); - } - -private: - DistYCbCrBuffer() : buffer(256 * 256 * 256) - { - for (uint32_t i = 0; i < 256 * 256 * 256; ++i) //startup time: 114 ms on Intel Core i5 (four cores) - { - const int r_diff = getByte<2>(i) * 2 - 255; - const int g_diff = getByte<1>(i) * 2 - 255; - const int b_diff = getByte<0>(i) * 2 - 255; - - const double k_b = 0.0593; //ITU-R BT.2020 conversion - const double k_r = 0.2627; // - const double k_g = 1 - k_b - k_r; - - const double scale_b = 0.5 / (1 - k_b); - const double scale_r = 0.5 / (1 - k_r); - - const double y = k_r * r_diff + k_g * g_diff + k_b * b_diff; //[!], analog YCbCr! - const double c_b = scale_b * (b_diff - y); - const double c_r = scale_r * (r_diff - y); - - buffer[i] = static_cast(std::sqrt(square(y) + square(c_b) + square(c_r))); - } - } - - double distImpl(uint32_t pix1, uint32_t pix2) const - { - //if (pix1 == pix2) -> 8% perf degradation! - // return 0; - //if (pix1 > pix2) - // std::swap(pix1, pix2); -> 30% perf degradation!!! - - const int r_diff = static_cast(getRed(pix1)) - getRed(pix2); - const int g_diff = static_cast(getGreen(pix1)) - getGreen(pix2); - const int b_diff = static_cast(getBlue(pix1)) - getBlue(pix2); - - return buffer[(((b_diff + 255) / 2) << 16) | //slightly reduce precision (division by 2) to squeeze value into single byte - (((g_diff + 255) / 2) << 8) | - ((r_diff + 255) / 2)]; - } - - std::vector buffer; //consumes 64 MB memory; using double is only 2% faster, but takes 128 MB -}; - -enum BlendType -{ - BLEND_NONE = 0, - BLEND_NORMAL, //a normal indication to blend - BLEND_DOMINANT, //a strong indication to blend - //attention: BlendType must fit into the value range of 2 bit!!! -}; - -struct BlendResult -{ - BlendType - /**/blend_f, blend_g, - /**/blend_j, blend_k; -}; - - -struct Kernel_4x4 //kernel for preprocessing step -{ - uint32_t - /**/a, b, c, d, - /**/e, f, g, h, - /**/i, j, k, l, - /**/m, n, o, p; -}; - -/* -input kernel area naming convention: ------------------ -| A | B | C | D | -----|---|---|---| -| E | F | G | H | //evaluate the four corners between F, G, J, K -----|---|---|---| //input pixel is at position F -| I | J | K | L | -----|---|---|---| -| M | N | O | P | ------------------ -*/ -template -FORCE_INLINE //detect blend direction -BlendResult preProcessCorners(const Kernel_4x4& ker, const xbrz::ScalerCfg& cfg) //result: F, G, J, K corners of "GradientType" -{ - BlendResult result = {}; - - if ((ker.f == ker.g && - ker.j == ker.k) || - (ker.f == ker.j && - ker.g == ker.k)) - return result; - - auto dist = [&](uint32_t pix1, uint32_t pix2) { return ColorDistance::dist(pix1, pix2, cfg.luminanceWeight); }; - - const int weight = 4; - double jg = dist(ker.i, ker.f) + dist(ker.f, ker.c) + dist(ker.n, ker.k) + dist(ker.k, ker.h) + weight * dist(ker.j, ker.g); - double fk = dist(ker.e, ker.j) + dist(ker.j, ker.o) + dist(ker.b, ker.g) + dist(ker.g, ker.l) + weight * dist(ker.f, ker.k); - - if (jg < fk) //test sample: 70% of values max(jg, fk) / min(jg, fk) are between 1.1 and 3.7 with median being 1.8 - { - const bool dominantGradient = cfg.dominantDirectionThreshold * jg < fk; - if (ker.f != ker.g && ker.f != ker.j) - result.blend_f = dominantGradient ? BLEND_DOMINANT : BLEND_NORMAL; - - if (ker.k != ker.j && ker.k != ker.g) - result.blend_k = dominantGradient ? BLEND_DOMINANT : BLEND_NORMAL; - } - else if (fk < jg) - { - const bool dominantGradient = cfg.dominantDirectionThreshold * fk < jg; - if (ker.j != ker.f && ker.j != ker.k) - result.blend_j = dominantGradient ? BLEND_DOMINANT : BLEND_NORMAL; - - if (ker.g != ker.f && ker.g != ker.k) - result.blend_g = dominantGradient ? BLEND_DOMINANT : BLEND_NORMAL; - } - return result; -} - -struct Kernel_3x3 -{ - uint32_t - /**/a, b, c, - /**/d, e, f, - /**/g, h, i; -}; - -#define DEF_GETTER(x) template uint32_t inline get_##x(const Kernel_3x3& ker) { return ker.x; } -//we cannot and NEED NOT write "ker.##x" since ## concatenates preprocessor tokens but "." is not a token -DEF_GETTER(a) DEF_GETTER(b) DEF_GETTER(c) -DEF_GETTER(d) DEF_GETTER(e) DEF_GETTER(f) -DEF_GETTER(g) DEF_GETTER(h) DEF_GETTER(i) -#undef DEF_GETTER - -#define DEF_GETTER(x, y) template <> inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } -DEF_GETTER(a, g) DEF_GETTER(b, d) DEF_GETTER(c, a) -DEF_GETTER(d, h) DEF_GETTER(e, e) DEF_GETTER(f, b) -DEF_GETTER(g, i) DEF_GETTER(h, f) DEF_GETTER(i, c) -#undef DEF_GETTER - -#define DEF_GETTER(x, y) template <> inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } -DEF_GETTER(a, i) DEF_GETTER(b, h) DEF_GETTER(c, g) -DEF_GETTER(d, f) DEF_GETTER(e, e) DEF_GETTER(f, d) -DEF_GETTER(g, c) DEF_GETTER(h, b) DEF_GETTER(i, a) -#undef DEF_GETTER - -#define DEF_GETTER(x, y) template <> inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } -DEF_GETTER(a, c) DEF_GETTER(b, f) DEF_GETTER(c, i) -DEF_GETTER(d, b) DEF_GETTER(e, e) DEF_GETTER(f, h) -DEF_GETTER(g, a) DEF_GETTER(h, d) DEF_GETTER(i, g) -#undef DEF_GETTER - - -//compress four blend types into a single byte -inline BlendType getTopL(unsigned char b) { return static_cast(0x3 & b); } -inline BlendType getTopR(unsigned char b) { return static_cast(0x3 & (b >> 2)); } -inline BlendType getBottomR(unsigned char b) { return static_cast(0x3 & (b >> 4)); } -inline BlendType getBottomL(unsigned char b) { return static_cast(0x3 & (b >> 6)); } - -inline void setTopL(unsigned char& b, BlendType bt) { b |= bt; } //buffer is assumed to be initialized before preprocessing! -inline void setTopR(unsigned char& b, BlendType bt) { b |= (bt << 2); } -inline void setBottomR(unsigned char& b, BlendType bt) { b |= (bt << 4); } -inline void setBottomL(unsigned char& b, BlendType bt) { b |= (bt << 6); } - -inline bool blendingNeeded(unsigned char b) { return b != 0; } - -template inline -unsigned char rotateBlendInfo(unsigned char b) { return b; } -template <> inline unsigned char rotateBlendInfo(unsigned char b) { return ((b << 2) | (b >> 6)) & 0xff; } -template <> inline unsigned char rotateBlendInfo(unsigned char b) { return ((b << 4) | (b >> 4)) & 0xff; } -template <> inline unsigned char rotateBlendInfo(unsigned char b) { return ((b << 6) | (b >> 2)) & 0xff; } - - -#if !defined(NDEBUG) && defined(_MSC_VER) -int debugPixelX = -1; -int debugPixelY = 12; -__declspec(thread) bool breakIntoDebugger = false; -#endif - - -/* -input kernel area naming convention: -------------- -| A | B | C | -----|---|---| -| D | E | F | //input pixel is at position E -----|---|---| -| G | H | I | -------------- -*/ -template -FORCE_INLINE //perf: quite worth it! -void blendPixel(const Kernel_3x3& ker, -uint32_t* target, int trgWidth, -unsigned char blendInfo, //result of preprocessing all four corners of pixel "e" -const xbrz::ScalerCfg& cfg) -{ -#define a get_a(ker) -#define b get_b(ker) -#define c get_c(ker) -#define d get_d(ker) -#define e get_e(ker) -#define f get_f(ker) -#define g get_g(ker) -#define h get_h(ker) -#define i get_i(ker) - -#if !defined(NDEBUG) && defined(_MSC_VER) - if (breakIntoDebugger) - __debugbreak(); //__asm int 3; -#endif - - const unsigned char blend = rotateBlendInfo(blendInfo); - - if (getBottomR(blend) >= BLEND_NORMAL) - { - auto eq = [&](uint32_t pix1, uint32_t pix2) { return ColorDistance::dist(pix1, pix2, cfg.luminanceWeight) < cfg.equalColorTolerance; }; - auto dist = [&](uint32_t pix1, uint32_t pix2) { return ColorDistance::dist(pix1, pix2, cfg.luminanceWeight); }; - - const bool doLineBlend = [&]() -> bool - { - if (getBottomR(blend) >= BLEND_DOMINANT) - return true; - - //make sure there is no second blending in an adjacent rotation for this pixel: handles insular pixels, mario eyes - if (getTopR(blend) != BLEND_NONE && !eq(e, g)) //but support double-blending for 90° corners - return false; - if (getBottomL(blend) != BLEND_NONE && !eq(e, c)) - return false; - - //no full blending for L-shapes; blend corner only (handles "mario mushroom eyes") - if (!eq(e, i) && eq(g, h) && eq(h, i) && eq(i, f) && eq(f, c)) - return false; - - return true; - }(); - - const uint32_t px = dist(e, f) <= dist(e, h) ? f : h; //choose most similar color - - OutputMatrix out(target, trgWidth); - - if (doLineBlend) - { - const double fg = dist(f, g); //test sample: 70% of values max(fg, hc) / min(fg, hc) are between 1.1 and 3.7 with median being 1.9 - const double hc = dist(h, c); // - - const bool haveShallowLine = cfg.steepDirectionThreshold * fg <= hc && e != g && d != g; - const bool haveSteepLine = cfg.steepDirectionThreshold * hc <= fg && e != c && b != c; - - if (haveShallowLine) - { - if (haveSteepLine) - Scaler::blendLineSteepAndShallow(px, out); - else - Scaler::blendLineShallow(px, out); - } - else - { - if (haveSteepLine) - Scaler::blendLineSteep(px, out); - else - Scaler::blendLineDiagonal(px, out); - } - } - else - Scaler::blendCorner(px, out); - } - -#undef a -#undef b -#undef c -#undef d -#undef e -#undef f -#undef g -#undef h -#undef i -} - - -template //scaler policy: see "Scaler2x" reference implementation -void scaleImage(const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, const xbrz::ScalerCfg& cfg, int yFirst, int yLast) -{ - yFirst = std::max(yFirst, 0); - yLast = std::min(yLast, srcHeight); - if (yFirst >= yLast || srcWidth <= 0) - return; - - const int trgWidth = srcWidth * Scaler::scale; - - //"use" space at the end of the image as temporary buffer for "on the fly preprocessing": we even could use larger area of - //"sizeof(uint32_t) * srcWidth * (yLast - yFirst)" bytes without risk of accidental overwriting before accessing - const int bufferSize = srcWidth; - unsigned char* preProcBuffer = reinterpret_cast(trg + yLast * Scaler::scale * trgWidth) - bufferSize; - std::fill(preProcBuffer, preProcBuffer + bufferSize, 0); - static_assert(BLEND_NONE == 0, ""); - - //initialize preprocessing buffer for first row of current stripe: detect upper left and right corner blending - //this cannot be optimized for adjacent processing stripes; we must not allow for a memory race condition! - if (yFirst > 0) - { - const int y = yFirst - 1; - - const uint32_t* s_m1 = src + srcWidth * std::max(y - 1, 0); - const uint32_t* s_0 = src + srcWidth * y; //center line - const uint32_t* s_p1 = src + srcWidth * std::min(y + 1, srcHeight - 1); - const uint32_t* s_p2 = src + srcWidth * std::min(y + 2, srcHeight - 1); - - for (int x = 0; x < srcWidth; ++x) - { - const int x_m1 = std::max(x - 1, 0); - const int x_p1 = std::min(x + 1, srcWidth - 1); - const int x_p2 = std::min(x + 2, srcWidth - 1); - - Kernel_4x4 ker = {}; //perf: initialization is negligible - ker.a = s_m1[x_m1]; //read sequentially from memory as far as possible - ker.b = s_m1[x]; - ker.c = s_m1[x_p1]; - ker.d = s_m1[x_p2]; - - ker.e = s_0[x_m1]; - ker.f = s_0[x]; - ker.g = s_0[x_p1]; - ker.h = s_0[x_p2]; - - ker.i = s_p1[x_m1]; - ker.j = s_p1[x]; - ker.k = s_p1[x_p1]; - ker.l = s_p1[x_p2]; - - ker.m = s_p2[x_m1]; - ker.n = s_p2[x]; - ker.o = s_p2[x_p1]; - ker.p = s_p2[x_p2]; - - const BlendResult res = preProcessCorners(ker, cfg); - /* - preprocessing blend result: - --------- - | F | G | //evalute corner between F, G, J, K - ----|---| //input pixel is at position F - | J | K | - --------- - */ - setTopR(preProcBuffer[x], res.blend_j); - - if (x + 1 < bufferSize) - setTopL(preProcBuffer[x + 1], res.blend_k); - } - } - //------------------------------------------------------------------------------------ - - for (int y = yFirst; y < yLast; ++y) - { - uint32_t* out = trg + Scaler::scale * y * trgWidth; //consider MT "striped" access - - const uint32_t* s_m1 = src + srcWidth * std::max(y - 1, 0); - const uint32_t* s_0 = src + srcWidth * y; //center line - const uint32_t* s_p1 = src + srcWidth * std::min(y + 1, srcHeight - 1); - const uint32_t* s_p2 = src + srcWidth * std::min(y + 2, srcHeight - 1); - - unsigned char blend_xy1 = 0; //corner blending for current (x, y + 1) position - - for (int x = 0; x < srcWidth; ++x, out += Scaler::scale) - { -#if !defined(NDEBUG) && defined(_MSC_VER) - breakIntoDebugger = debugPixelX == x && debugPixelY == y; -#endif - //all those bounds checks have only insignificant impact on performance! - const int x_m1 = std::max(x - 1, 0); //perf: prefer array indexing to additional pointers! - const int x_p1 = std::min(x + 1, srcWidth - 1); - const int x_p2 = std::min(x + 2, srcWidth - 1); - - Kernel_4x4 ker4 = {}; //perf: initialization is negligible - - ker4.a = s_m1[x_m1]; //read sequentially from memory as far as possible - ker4.b = s_m1[x]; - ker4.c = s_m1[x_p1]; - ker4.d = s_m1[x_p2]; - - ker4.e = s_0[x_m1]; - ker4.f = s_0[x]; - ker4.g = s_0[x_p1]; - ker4.h = s_0[x_p2]; - - ker4.i = s_p1[x_m1]; - ker4.j = s_p1[x]; - ker4.k = s_p1[x_p1]; - ker4.l = s_p1[x_p2]; - - ker4.m = s_p2[x_m1]; - ker4.n = s_p2[x]; - ker4.o = s_p2[x_p1]; - ker4.p = s_p2[x_p2]; - - //evaluate the four corners on bottom-right of current pixel - unsigned char blend_xy = 0; //for current (x, y) position - { - const BlendResult res = preProcessCorners(ker4, cfg); - /* - preprocessing blend result: - --------- - | F | G | //evalute corner between F, G, J, K - ----|---| //current input pixel is at position F - | J | K | - --------- - */ - blend_xy = preProcBuffer[x]; - setBottomR(blend_xy, res.blend_f); //all four corners of (x, y) have been determined at this point due to processing sequence! - - setTopR(blend_xy1, res.blend_j); //set 2nd known corner for (x, y + 1) - preProcBuffer[x] = blend_xy1; //store on current buffer position for use on next row - - blend_xy1 = 0; - setTopL(blend_xy1, res.blend_k); //set 1st known corner for (x + 1, y + 1) and buffer for use on next column - - if (x + 1 < bufferSize) //set 3rd known corner for (x + 1, y) - setBottomL(preProcBuffer[x + 1], res.blend_g); - } - - //fill block of size scale * scale with the given color - fillBlock(out, trgWidth * sizeof(uint32_t), ker4.f, Scaler::scale); //place *after* preprocessing step, to not overwrite the results while processing the the last pixel! - - //blend four corners of current pixel - if (blendingNeeded(blend_xy)) //good 5% perf-improvement - { - Kernel_3x3 ker3 = {}; //perf: initialization is negligible - - ker3.a = ker4.a; - ker3.b = ker4.b; - ker3.c = ker4.c; - - ker3.d = ker4.e; - ker3.e = ker4.f; - ker3.f = ker4.g; - - ker3.g = ker4.i; - ker3.h = ker4.j; - ker3.i = ker4.k; - - blendPixel(ker3, out, trgWidth, blend_xy, cfg); - blendPixel(ker3, out, trgWidth, blend_xy, cfg); - blendPixel(ker3, out, trgWidth, blend_xy, cfg); - blendPixel(ker3, out, trgWidth, blend_xy, cfg); - } - } - } -} - -//------------------------------------------------------------------------------------ - -template -struct Scaler2x : public ColorGradient -{ - static const int scale = 2; - - template //bring template function into scope for GCC - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) { ColorGradient::template alphaGrad(pixBack, pixFront); } - - - template - static void blendLineShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - } - - template - static void blendLineSteep(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - } - - template - static void blendLineSteepAndShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<1, 0>(), col); - alphaGrad<1, 4>(out.template ref<0, 1>(), col); - alphaGrad<5, 6>(out.template ref<1, 1>(), col); //[!] fixes 7/8 used in xBR - } - - template - static void blendLineDiagonal(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 2>(out.template ref<1, 1>(), col); - } - - template - static void blendCorner(uint32_t col, OutputMatrix& out) - { - //model a round corner - alphaGrad<21, 100>(out.template ref<1, 1>(), col); //exact: 1 - pi/4 = 0.2146018366 - } -}; - - -template -struct Scaler3x : public ColorGradient -{ - static const int scale = 3; - - template //bring template function into scope for GCC - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) { ColorGradient::template alphaGrad(pixBack, pixFront); } - - - template - static void blendLineShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - - alphaGrad<3, 4>(out.template ref(), col); - out.template ref() = col; - } - - template - static void blendLineSteep(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<1, 4>(out.template ref<2, scale - 2>(), col); - - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - out.template ref<2, scale - 1>() = col; - } - - template - static void blendLineSteepAndShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<2, 0>(), col); - alphaGrad<1, 4>(out.template ref<0, 2>(), col); - alphaGrad<3, 4>(out.template ref<2, 1>(), col); - alphaGrad<3, 4>(out.template ref<1, 2>(), col); - out.template ref<2, 2>() = col; - } - - template - static void blendLineDiagonal(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 8>(out.template ref<1, 2>(), col); //conflict with other rotations for this odd scale - alphaGrad<1, 8>(out.template ref<2, 1>(), col); - alphaGrad<7, 8>(out.template ref<2, 2>(), col); // - } - - template - static void blendCorner(uint32_t col, OutputMatrix& out) - { - //model a round corner - alphaGrad<45, 100>(out.template ref<2, 2>(), col); //exact: 0.4545939598 - //alphaGrad<7, 256>(out.template ref<2, 1>(), col); //0.02826017254 -> negligible + avoid conflicts with other rotations for this odd scale - //alphaGrad<7, 256>(out.template ref<1, 2>(), col); //0.02826017254 - } -}; - - -template -struct Scaler4x : public ColorGradient -{ - static const int scale = 4; - - template //bring template function into scope for GCC - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) { ColorGradient::template alphaGrad(pixBack, pixFront); } - - - template - static void blendLineShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - - alphaGrad<3, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - - out.template ref() = col; - out.template ref() = col; - } - - template - static void blendLineSteep(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<1, 4>(out.template ref<2, scale - 2>(), col); - - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - alphaGrad<3, 4>(out.template ref<3, scale - 2>(), col); - - out.template ref<2, scale - 1>() = col; - out.template ref<3, scale - 1>() = col; - } - - template - static void blendLineSteepAndShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<3, 4>(out.template ref<3, 1>(), col); - alphaGrad<3, 4>(out.template ref<1, 3>(), col); - alphaGrad<1, 4>(out.template ref<3, 0>(), col); - alphaGrad<1, 4>(out.template ref<0, 3>(), col); - - alphaGrad<1, 3>(out.template ref<2, 2>(), col); //[!] fixes 1/4 used in xBR - - out.template ref<3, 3>() = col; - out.template ref<3, 2>() = col; - out.template ref<2, 3>() = col; - } - - template - static void blendLineDiagonal(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 2>(out.template ref(), col); - alphaGrad<1, 2>(out.template ref(), col); - out.template ref() = col; - } - - template - static void blendCorner(uint32_t col, OutputMatrix& out) - { - //model a round corner - alphaGrad<68, 100>(out.template ref<3, 3>(), col); //exact: 0.6848532563 - alphaGrad< 9, 100>(out.template ref<3, 2>(), col); //0.08677704501 - alphaGrad< 9, 100>(out.template ref<2, 3>(), col); //0.08677704501 - } -}; - - -template -struct Scaler5x : public ColorGradient -{ - static const int scale = 5; - - template //bring template function into scope for GCC - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) { ColorGradient::template alphaGrad(pixBack, pixFront); } - - - template - static void blendLineShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - - alphaGrad<3, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - - out.template ref() = col; - out.template ref() = col; - out.template ref() = col; - out.template ref() = col; - } - - template - static void blendLineSteep(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<1, 4>(out.template ref<2, scale - 2>(), col); - alphaGrad<1, 4>(out.template ref<4, scale - 3>(), col); - - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - alphaGrad<3, 4>(out.template ref<3, scale - 2>(), col); - - out.template ref<2, scale - 1>() = col; - out.template ref<3, scale - 1>() = col; - out.template ref<4, scale - 1>() = col; - out.template ref<4, scale - 2>() = col; - } - - template - static void blendLineSteepAndShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<1, 4>(out.template ref<2, scale - 2>(), col); - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - - alphaGrad<2, 3>(out.template ref<3, 3>(), col); - - out.template ref<2, scale - 1>() = col; - out.template ref<3, scale - 1>() = col; - out.template ref<4, scale - 1>() = col; - - out.template ref() = col; - out.template ref() = col; - } - - template - static void blendLineDiagonal(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 8>(out.template ref(), col); //conflict with other rotations for this odd scale - alphaGrad<1, 8>(out.template ref(), col); - alphaGrad<1, 8>(out.template ref(), col); // - - alphaGrad<7, 8>(out.template ref<4, 3>(), col); - alphaGrad<7, 8>(out.template ref<3, 4>(), col); - - out.template ref<4, 4>() = col; - } - - template - static void blendCorner(uint32_t col, OutputMatrix& out) - { - //model a round corner - alphaGrad<86, 100>(out.template ref<4, 4>(), col); //exact: 0.8631434088 - alphaGrad<23, 100>(out.template ref<4, 3>(), col); //0.2306749731 - alphaGrad<23, 100>(out.template ref<3, 4>(), col); //0.2306749731 - //alphaGrad<1, 64>(out.template ref<4, 2>(), col); //0.01676812367 -> negligible + avoid conflicts with other rotations for this odd scale - //alphaGrad<1, 64>(out.template ref<2, 4>(), col); //0.01676812367 - } -}; - - -template -struct Scaler6x : public ColorGradient -{ - static const int scale = 6; - - template //bring template function into scope for GCC - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) { ColorGradient::template alphaGrad(pixBack, pixFront); } - - - template - static void blendLineShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - - alphaGrad<3, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - - out.template ref() = col; - out.template ref() = col; - out.template ref() = col; - out.template ref() = col; - - out.template ref() = col; - out.template ref() = col; - } - - template - static void blendLineSteep(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<1, 4>(out.template ref<2, scale - 2>(), col); - alphaGrad<1, 4>(out.template ref<4, scale - 3>(), col); - - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - alphaGrad<3, 4>(out.template ref<3, scale - 2>(), col); - alphaGrad<3, 4>(out.template ref<5, scale - 3>(), col); - - out.template ref<2, scale - 1>() = col; - out.template ref<3, scale - 1>() = col; - out.template ref<4, scale - 1>() = col; - out.template ref<5, scale - 1>() = col; - - out.template ref<4, scale - 2>() = col; - out.template ref<5, scale - 2>() = col; - } - - template - static void blendLineSteepAndShallow(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 4>(out.template ref<0, scale - 1>(), col); - alphaGrad<1, 4>(out.template ref<2, scale - 2>(), col); - alphaGrad<3, 4>(out.template ref<1, scale - 1>(), col); - alphaGrad<3, 4>(out.template ref<3, scale - 2>(), col); - - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<1, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - alphaGrad<3, 4>(out.template ref(), col); - - out.template ref<2, scale - 1>() = col; - out.template ref<3, scale - 1>() = col; - out.template ref<4, scale - 1>() = col; - out.template ref<5, scale - 1>() = col; - - out.template ref<4, scale - 2>() = col; - out.template ref<5, scale - 2>() = col; - - out.template ref() = col; - out.template ref() = col; - } - - template - static void blendLineDiagonal(uint32_t col, OutputMatrix& out) - { - alphaGrad<1, 2>(out.template ref(), col); - alphaGrad<1, 2>(out.template ref(), col); - alphaGrad<1, 2>(out.template ref(), col); - - out.template ref() = col; - out.template ref() = col; - out.template ref() = col; - } - - template - static void blendCorner(uint32_t col, OutputMatrix& out) - { - //model a round corner - alphaGrad<97, 100>(out.template ref<5, 5>(), col); //exact: 0.9711013910 - alphaGrad<42, 100>(out.template ref<4, 5>(), col); //0.4236372243 - alphaGrad<42, 100>(out.template ref<5, 4>(), col); //0.4236372243 - alphaGrad< 6, 100>(out.template ref<5, 3>(), col); //0.05652034508 - alphaGrad< 6, 100>(out.template ref<3, 5>(), col); //0.05652034508 - } -}; - -//------------------------------------------------------------------------------------ - -struct ColorDistanceBGR -{ - static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight) - { - return DistYCbCrBuffer::dist(pix1, pix2); - - //if (pix1 == pix2) //about 4% perf boost - // return 0; - //return distYCbCr(pix1, pix2, luminanceWeight); - } -}; - -struct ColorDistanceABGR -{ - static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight) - { - const double a1 = getAlpha(pix1) / 255.0; - const double a2 = getAlpha(pix2) / 255.0; - /* - Requirements for a color distance handling alpha channel: with a1, a2 in [0, 1] - - 1. if a1 = a2, distance should be: a1 * distYCbCr() - 2. if a1 = 0, distance should be: a2 * distYCbCr(black, white) = a2 * 255 - 3. if a1 = 1, ??? maybe: 255 * (1 - a2) + a2 * distYCbCr() - */ - - //return std::min(a1, a2) * DistYCbCrBuffer::dist(pix1, pix2) + 255 * abs(a1 - a2); - //=> following code is 15% faster: - const double d = DistYCbCrBuffer::dist(pix1, pix2); - if (a1 < a2) - return a1 * d + 255 * (a2 - a1); - else - return a2 * d + 255 * (a1 - a2); - - //alternative? return std::sqrt(a1 * a2 * square(DistYCbCrBuffer::dist(pix1, pix2)) + square(255 * (a1 - a2))); - } -}; - - -struct ColorGradientBGR -{ - template - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) - { - pixBack = gradientBGR(pixFront, pixBack); - } -}; - -struct ColorGradientABGR -{ - template - static void alphaGrad(uint32_t& pixBack, uint32_t pixFront) - { - pixBack = gradientABGR(pixFront, pixBack); - } -}; -} - -void xbrz::init() -{ - static bool inited = false; - if (!inited) { - DistYCbCrBuffer::dist(0, 0); - inited = true; - } -} - -void xbrz::scale(size_t factor, const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, ColorFormat colFmt, const xbrz::ScalerCfg& cfg, int yFirst, int yLast) -{ - switch (colFmt) - { - case ColorFormat::ABGR: - switch (factor) - { - case 2: - return scaleImage, ColorDistanceABGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 3: - return scaleImage, ColorDistanceABGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 4: - return scaleImage, ColorDistanceABGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 5: - return scaleImage, ColorDistanceABGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 6: - return scaleImage, ColorDistanceABGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - } - break; - - case ColorFormat::BGR: - switch (factor) - { - case 2: - return scaleImage, ColorDistanceBGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 3: - return scaleImage, ColorDistanceBGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 4: - return scaleImage, ColorDistanceBGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 5: - return scaleImage, ColorDistanceBGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - case 6: - return scaleImage, ColorDistanceBGR>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); - } - break; - } - assert(false); -} - - -bool xbrz::equalColorTest(uint32_t col1, uint32_t col2, ColorFormat colFmt, double luminanceWeight, double equalColorTolerance) -{ - switch (colFmt) - { - case ColorFormat::ABGR: - return ColorDistanceABGR::dist(col1, col2, luminanceWeight) < equalColorTolerance; - - case ColorFormat::BGR: - return ColorDistanceBGR::dist(col1, col2, luminanceWeight) < equalColorTolerance; - } - assert(false); - return false; -} - - -void xbrz::nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, int srcPitch, - uint32_t* trg, int trgWidth, int trgHeight, int trgPitch, - SliceType st, int yFirst, int yLast) -{ - if (srcPitch < srcWidth * static_cast(sizeof(uint32_t)) || - trgPitch < trgWidth * static_cast(sizeof(uint32_t))) - { - assert(false); - return; - } - - switch (st) - { - case NN_SCALE_SLICE_SOURCE: - //nearest-neighbor (going over source image - fast for upscaling, since source is read only once - yFirst = std::max(yFirst, 0); - yLast = std::min(yLast, srcHeight); - if (yFirst >= yLast || trgWidth <= 0 || trgHeight <= 0) return; - - for (int y = yFirst; y < yLast; ++y) - { - //mathematically: ySrc = floor(srcHeight * yTrg / trgHeight) - // => search for integers in: [ySrc, ySrc + 1) * trgHeight / srcHeight - - //keep within for loop to support MT input slices! - const int yTrg_first = (y * trgHeight + srcHeight - 1) / srcHeight; //=ceil(y * trgHeight / srcHeight) - const int yTrg_last = ((y + 1) * trgHeight + srcHeight - 1) / srcHeight; //=ceil(((y + 1) * trgHeight) / srcHeight) - const int blockHeight = yTrg_last - yTrg_first; - - if (blockHeight > 0) - { - const uint32_t* srcLine = byteAdvance(src, y * srcPitch); - uint32_t* trgLine = byteAdvance(trg, yTrg_first * trgPitch); - int xTrg_first = 0; - - for (int x = 0; x < srcWidth; ++x) - { - int xTrg_last = ((x + 1) * trgWidth + srcWidth - 1) / srcWidth; - const int blockWidth = xTrg_last - xTrg_first; - if (blockWidth > 0) - { - xTrg_first = xTrg_last; - fillBlock(trgLine, trgPitch, srcLine[x], blockWidth, blockHeight); - trgLine += blockWidth; - } - } - } - } - break; - - case NN_SCALE_SLICE_TARGET: - //nearest-neighbor (going over target image - slow for upscaling, since source is read multiple times missing out on cache! Fast for similar image sizes!) - yFirst = std::max(yFirst, 0); - yLast = std::min(yLast, trgHeight); - if (yFirst >= yLast || srcHeight <= 0 || srcWidth <= 0) return; - - for (int y = yFirst; y < yLast; ++y) - { - uint32_t* trgLine = byteAdvance(trg, y * trgPitch); - const int ySrc = srcHeight * y / trgHeight; - const uint32_t* srcLine = byteAdvance(src, ySrc * srcPitch); - for (int x = 0; x < trgWidth; ++x) - { - const int xSrc = srcWidth * x / trgWidth; - trgLine[x] = srcLine[xSrc]; - } - } - break; - } -} diff --git a/GLideN64/src/GLideNHQ/TextureFilters_xbrz.h b/GLideN64/src/GLideNHQ/TextureFilters_xbrz.h deleted file mode 100644 index 5e4d183..0000000 --- a/GLideN64/src/GLideNHQ/TextureFilters_xbrz.h +++ /dev/null @@ -1,116 +0,0 @@ -// **************************************************************************** -// * This file is part of the HqMAME project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// * * -// * Additionally and as a special exception, the author gives permission * -// * to link the code of this program with the MAME library (or with modified * -// * versions of MAME that use the same license as MAME), and distribute * -// * linked combinations including the two. You must obey the GNU General * -// * Public License in all respects for all of the code used other than MAME. * -// * If you modify this file, you may extend this exception to your version * -// * of the file, but you are not obligated to do so. If you do not wish to * -// * do so, delete this exception statement from your version. * -// **************************************************************************** - -// **************************************************************************** -// Minor modifications for GLideN64 project by Sergey Lipskiy (gonetz AT ngs DOT ru) -// Changes: color formats changed from RGB/ARGB to BGR/ABGR -// added init() function. -// ScalerCfg moved to this file -// **************************************************************************** - -#ifndef XBRZ_HEADER_3847894708239054 -#define XBRZ_HEADER_3847894708239054 - -#include //size_t -#include //uint32_t -#include - -namespace xbrz -{ -/* -------------------------------------------------------------------------- -| xBRZ: "Scale by rules" - high quality image upscaling filter by Zenju | -------------------------------------------------------------------------- -using a modified approach of xBR: -http://board.byuu.org/viewtopic.php?f=10&t=2248 -- new rule set preserving small image features -- highly optimized for performance -- support alpha channel -- support multithreading -- support 64-bit architectures -- support processing image slices -- support scaling up to 6xBRZ -*/ - -struct ScalerCfg -{ - double luminanceWeight = 1; - double equalColorTolerance = 30; - double dominantDirectionThreshold = 3.6; - double steepDirectionThreshold = 2.2; - double newTestAttribute = 0; //unused; test new parameters -}; - -enum class ColorFormat //from high bits -> low bits, 8 bit per channel -{ - ABGR, //including alpha channel - BGR, //8 bit for each red, green, blue, upper 8 bits unused -}; - -/* - Initialization of static members to avoid - #error function scope static initialization is not yet thread-safe! - with my compiler. -*/ -void init(); - -/* --> map source (srcWidth * srcHeight) to target (scale * width x scale * height) image, optionally processing a half-open slice of rows [yFirst, yLast) only --> support for source/target pitch in bytes! --> if your emulator changes only a few image slices during each cycle (e.g. DOSBox) then there's no need to run xBRZ on the complete image: - Just make sure you enlarge the source image slice by 2 rows on top and 2 on bottom (this is the additional range the xBRZ algorithm is using during analysis) - Caveat: If there are multiple changed slices, make sure they do not overlap after adding these additional rows in order to avoid a memory race condition - in the target image data if you are using multiple threads for processing each enlarged slice! - -THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, yLast) ranges do not overlap! - - there is a minor inefficiency for the first row of a slice, so avoid processing single rows only -*/ -void scale(size_t factor, //valid range: 2 - 6 - const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, - ColorFormat colFmt, - const ScalerCfg& cfg = ScalerCfg(), - int yFirst = 0, int yLast = INT_MAX); //slice of source image - -void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, - uint32_t* trg, int trgWidth, int trgHeight); - -enum SliceType -{ - NN_SCALE_SLICE_SOURCE, - NN_SCALE_SLICE_TARGET, -}; -void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, int srcPitch, //pitch in bytes! - uint32_t* trg, int trgWidth, int trgHeight, int trgPitch, - SliceType st, int yFirst, int yLast); - -//parameter tuning -bool equalColorTest(uint32_t col1, uint32_t col2, ColorFormat colFmt, double luminanceWeight, double equalColorTolerance); - - - - - -//########################### implementation ########################### -inline -void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, - uint32_t* trg, int trgWidth, int trgHeight) -{ - nearestNeighborScale(src, srcWidth, srcHeight, srcWidth * sizeof(uint32_t), - trg, trgWidth, trgHeight, trgWidth * sizeof(uint32_t), - NN_SCALE_SLICE_TARGET, 0, trgHeight); -} -} - -#endif diff --git a/GLideN64/src/GLideNHQ/TxCache.cpp b/GLideN64/src/GLideNHQ/TxCache.cpp deleted file mode 100644 index 892887c..0000000 --- a/GLideN64/src/GLideNHQ/TxCache.cpp +++ /dev/null @@ -1,947 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef __MSC__ -#pragma warning(disable: 4786) -#endif - -#include -#include -#include -#include -#include -#include - -#include - -#include "TxCache.h" -#include "TxDbg.h" - -class TxCacheImpl -{ -public: - virtual ~TxCacheImpl() = default; - - virtual bool add(Checksum checksum, GHQTexInfo *info, int dataSize = 0) = 0; - virtual bool get(Checksum checksum, GHQTexInfo *info) = 0; - virtual bool save(const wchar_t *path, const wchar_t *filename, const int config) = 0; - virtual bool load(const wchar_t *path, const wchar_t *filename, const int config, bool force) = 0; - virtual bool del(Checksum checksum) = 0; - virtual bool isCached(Checksum checksum) = 0; - virtual void clear() = 0; - virtual bool empty() const = 0; - virtual uint32 getOptions() const = 0; - virtual void setOptions(uint32 options) = 0; - - virtual uint64 size() const = 0; - virtual uint64 totalSize() const = 0; - virtual uint64 cacheLimit() const = 0; -}; - - -/************************** TxMemoryCache *************************************/ - -class TxMemoryCache : public TxCacheImpl -{ -public: - TxMemoryCache(uint32 _options, uint64 cacheLimit, dispInfoFuncExt callback); - ~TxMemoryCache(); - - bool add(Checksum checksum, GHQTexInfo *info, int dataSize = 0) override; - bool get(Checksum checksum, GHQTexInfo *info) override; - - bool save(const wchar_t *path, const wchar_t *filename, const int config) override; - bool load(const wchar_t *path, const wchar_t *filename, const int config, bool force) override; - bool del(Checksum checksum) override; - bool isCached(Checksum checksum) override; - void clear() override; - bool empty() const override { return _cache.empty(); } - - uint64 size() const override { return _cache.size(); } - uint64 totalSize() const override { return _totalSize; } - uint64 cacheLimit() const override { return _cacheLimit; } - uint32 getOptions() const override { return _options; } - void setOptions(uint32 options) override { _options = options; } - -private: - struct TXCACHE { - int size; - GHQTexInfo info; - std::list::iterator it; - }; - - uint32 _options; - dispInfoFuncExt _callback; - uint64 _cacheLimit; - uint64 _totalSize; - - std::map _cache; - std::list _cachelist; - - uint8 *_gzdest0 = nullptr; - uint8 *_gzdest1 = nullptr; - uint32 _gzdestLen = 0; -}; - -TxMemoryCache::TxMemoryCache(uint32 options, - uint64 cacheLimit, - dispInfoFuncExt callback) - : _options(options) - , _cacheLimit(cacheLimit) - , _callback(callback) - , _totalSize(0U) -{ - /* zlib memory buffers to (de)compress hires textures */ - if (_options & (GZ_TEXCACHE | GZ_HIRESTEXCACHE)) { - _gzdest0 = TxMemBuf::getInstance()->get(0); - _gzdest1 = TxMemBuf::getInstance()->get(1); - _gzdestLen = (TxMemBuf::getInstance()->size_of(0) < TxMemBuf::getInstance()->size_of(1)) ? - TxMemBuf::getInstance()->size_of(0) : TxMemBuf::getInstance()->size_of(1); - - if (!_gzdest0 || !_gzdest1 || !_gzdestLen) { - _options &= ~(GZ_TEXCACHE | GZ_HIRESTEXCACHE); - _gzdest0 = nullptr; - _gzdest1 = nullptr; - _gzdestLen = 0; - } - } -} - -TxMemoryCache::~TxMemoryCache() -{ - /* free memory, clean up, etc */ - clear(); -} - -bool TxMemoryCache::add(Checksum checksum, GHQTexInfo *info, int dataSize) -{ - /* NOTE: dataSize must be provided if info->data is zlib compressed. */ - - if (!checksum || !info->data || _cache.find(checksum) != _cache.end()) - return false; - - uint8 *dest = info->data; - uint32 format = info->format; - - if (dataSize == 0) { - dataSize = TxUtil::sizeofTx(info->width, info->height, info->format); - - if (!dataSize) - return false; - - if (_options & (GZ_TEXCACHE | GZ_HIRESTEXCACHE)) { - /* zlib compress it. compression level:1 (best speed) */ - uLongf destLen = _gzdestLen; - dest = (dest == _gzdest0) ? _gzdest1 : _gzdest0; - if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) { - dest = info->data; - DBG_INFO(80, wst("Error: zlib compression failed!\n")); - } else { - DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), (float)dataSize / 1000, (float)destLen / 1000); - dataSize = destLen; - format |= GL_TEXFMT_GZ; - } - } - } - - /* if cache size exceeds limit, remove old cache */ - if (_cacheLimit != 0) { - _totalSize += dataSize; - if ((_totalSize > _cacheLimit) && !_cachelist.empty()) { - /* _cachelist is arranged so that frequently used textures are in the back */ - std::list::iterator itList = _cachelist.begin(); - while (itList != _cachelist.end()) { - /* find it in _cache */ - auto itMap = _cache.find(*itList); - if (itMap != _cache.end()) { - /* yep we have it. remove it. */ - _totalSize -= (*itMap).second->size; - free((*itMap).second->info.data); - delete (*itMap).second; - _cache.erase(itMap); - } - itList++; - - /* check if memory cache has enough space */ - if (_totalSize <= _cacheLimit) - break; - } - /* remove from _cachelist */ - _cachelist.erase(_cachelist.begin(), itList); - - DBG_INFO(80, wst("+++++++++\n")); - } - _totalSize -= dataSize; - } - - /* cache it */ - uint8 *tmpdata = (uint8*)malloc(dataSize); - if (tmpdata == nullptr) - return false; - - TXCACHE *txCache = new TXCACHE; - /* we can directly write as we filter, but for now we get away - * with doing memcpy after all the filtering is done. - */ - memcpy(tmpdata, dest, dataSize); - - /* copy it */ - memcpy(&txCache->info, info, sizeof(GHQTexInfo)); - txCache->info.data = tmpdata; - txCache->info.format = format; - txCache->size = dataSize; - - /* add to cache */ - if (_cacheLimit != 0) { - _cachelist.push_back(checksum); - txCache->it = --(_cachelist.end()); - } - /* _cache[checksum] = txCache; */ - _cache.insert(std::map::value_type(checksum, txCache)); - -#ifdef DEBUG - DBG_INFO(80, wst("[%5d] added!! crc:%08X %08X %d x %d gfmt:%x total:%.02fmb\n"), - _cache.size(), checksum._hi, checksum._low, - info->width, info->height, info->format & 0xffff, (double)_totalSize / 1000000); - - if (_cacheLimit != 0) { - DBG_INFO(80, wst("cache max config:%.02fmb\n"), (double)_cacheLimit / 1000000); - - if (_cache.size() != _cachelist.size()) { - DBG_INFO(80, wst("Error: cache/cachelist mismatch! (%d/%d)\n"), _cache.size(), _cachelist.size()); - } - } -#endif - - /* total cache size */ - _totalSize += dataSize; - - return true; -} - -bool TxMemoryCache::get(Checksum checksum, GHQTexInfo *info) -{ - if (!checksum || _cache.empty()) - return false; - - /* find a match in cache */ - auto itMap = _cache.find(checksum); - if (itMap != _cache.end()) { - /* yep, we've got it. */ - memcpy(info, &(((*itMap).second)->info), sizeof(GHQTexInfo)); - - /* push it to the back of the list */ - if (_cacheLimit != 0) { - _cachelist.erase(((*itMap).second)->it); - _cachelist.push_back(checksum); - ((*itMap).second)->it = --(_cachelist.end()); - } - - /* zlib decompress it */ - if (info->format & GL_TEXFMT_GZ) { - uLongf destLen = _gzdestLen; - uint8 *dest = (_gzdest0 == info->data) ? _gzdest1 : _gzdest0; - if (uncompress(dest, &destLen, info->data, ((*itMap).second)->size) != Z_OK) { - DBG_INFO(80, wst("Error: zlib decompression failed!\n")); - return false; - } - info->data = dest; - info->format &= ~GL_TEXFMT_GZ; - DBG_INFO(80, wst("zlib decompressed: %.02fkb->%.02fkb\n"), (float)(((*itMap).second)->size) / 1000, (float)destLen / 1000); - } - - return true; - } - - return false; -} - -bool TxMemoryCache::save(const wchar_t *path, const wchar_t *filename, int config) -{ - if (_cache.empty()) - return false; - - /* dump cache to disk */ - char cbuf[MAX_PATH]; - - osal_mkdirp(path); - -#ifdef OS_WINDOWS - wchar_t curpath[MAX_PATH]; - GETCWD(MAX_PATH, curpath); - CHDIR(path); -#else - char curpath[MAX_PATH]; - GETCWD(MAX_PATH, curpath); - wcstombs(cbuf, path, MAX_PATH); - CHDIR(cbuf); -#endif - - wcstombs(cbuf, filename, MAX_PATH); - - gzFile gzfp = gzopen(cbuf, "wb1"); - DBG_INFO(80, wst("gzfp:%x file:%ls\n"), gzfp, filename); - if (gzfp) { - /* write header to determine config match */ - gzwrite(gzfp, &config, 4); - - auto itMap = _cache.begin(); - int total = 0; - while (itMap != _cache.end()) { - uint8 *dest = (*itMap).second->info.data; - uint32 destLen = (*itMap).second->size; - uint32 format = (*itMap).second->info.format; - - /* to keep things simple, we save the texture data in a zlib uncompressed state. */ - /* sigh... for those who cannot wait the extra few seconds. changed to keep - * texture data in a zlib compressed state. if the GZ_TEXCACHE or GZ_HIRESTEXCACHE - * option is toggled, the cache will need to be rebuilt. - */ - /*if (format & GL_TEXFMT_GZ) { - dest = _gzdest0; - destLen = _gzdestLen; - if (dest && destLen) { - if (uncompress(dest, &destLen, (*itMap).second->info.data, (*itMap).second->size) != Z_OK) { - dest = nullptr; - destLen = 0; - } - format &= ~GL_TEXFMT_GZ; - } - }*/ - - if (dest && destLen) { - /* texture checksum */ - gzwrite(gzfp, &((*itMap).first), 8); - - /* other texture info */ - gzwrite(gzfp, &((*itMap).second->info.width), 4); - gzwrite(gzfp, &((*itMap).second->info.height), 4); - gzwrite(gzfp, &format, 4); - gzwrite(gzfp, &((*itMap).second->info.texture_format), 2); - gzwrite(gzfp, &((*itMap).second->info.pixel_type), 2); - gzwrite(gzfp, &((*itMap).second->info.is_hires_tex), 1); - - gzwrite(gzfp, &destLen, 4); - gzwrite(gzfp, dest, destLen); - } - - itMap++; - - if (_callback) - (*_callback)(wst("Total textures saved to HDD: %d\n"), ++total); - } - gzclose(gzfp); - } - - CHDIR(curpath); - - return !_cache.empty(); -} - -bool TxMemoryCache::load(const wchar_t *path, const wchar_t *filename, int config, bool force) -{ - /* find it on disk */ - char cbuf[MAX_PATH]; - -#ifdef OS_WINDOWS - wchar_t curpath[MAX_PATH]; - GETCWD(MAX_PATH, curpath); - CHDIR(path); -#else - char curpath[MAX_PATH]; - GETCWD(MAX_PATH, curpath); - wcstombs(cbuf, path, MAX_PATH); - CHDIR(cbuf); -#endif - - wcstombs(cbuf, filename, MAX_PATH); - - gzFile gzfp = gzopen(cbuf, "rb"); - DBG_INFO(80, wst("gzfp:%x file:%ls\n"), gzfp, filename); - if (gzfp) { - /* yep, we have it. load it into memory cache. */ - int dataSize; - uint64 checksum; - int tmpconfig; - /* read header to determine config match */ - gzread(gzfp, &tmpconfig, 4); - - if (tmpconfig == config || force) { - do { - GHQTexInfo tmpInfo; - - gzread(gzfp, &checksum, 8); - - gzread(gzfp, &tmpInfo.width, 4); - gzread(gzfp, &tmpInfo.height, 4); - gzread(gzfp, &tmpInfo.format, 4); - gzread(gzfp, &tmpInfo.texture_format, 2); - gzread(gzfp, &tmpInfo.pixel_type, 2); - gzread(gzfp, &tmpInfo.is_hires_tex, 1); - - gzread(gzfp, &dataSize, 4); - - tmpInfo.data = (uint8*)malloc(dataSize); - if (tmpInfo.data) { - gzread(gzfp, tmpInfo.data, dataSize); - - /* add to memory cache */ - add(checksum, &tmpInfo, (tmpInfo.format & GL_TEXFMT_GZ) ? dataSize : 0); - - free(tmpInfo.data); - } else { - gzseek(gzfp, dataSize, SEEK_CUR); - } - - /* skip in between to prevent the loop from being tied down to vsync */ - if (_callback && (!(_cache.size() % 100) || gzeof(gzfp))) - (*_callback)(wst("[%d] total mem:%.02fmb - %ls\n"), _cache.size(), (float)_totalSize / 1000000, filename); - - } while (!gzeof(gzfp)); - gzclose(gzfp); - } - } - - CHDIR(curpath); - - return !_cache.empty(); -} - -bool TxMemoryCache::del(Checksum checksum) -{ - if (!checksum || _cache.empty()) - return false; - - auto itMap = _cache.find(checksum); - if (itMap != _cache.end()) { - - /* for texture cache (not hi-res cache) */ - if (!_cachelist.empty()) - _cachelist.erase(((*itMap).second)->it); - - /* remove from cache */ - free((*itMap).second->info.data); - _totalSize -= (*itMap).second->size; - delete (*itMap).second; - _cache.erase(itMap); - - DBG_INFO(80, wst("removed from cache: checksum = %08X %08X\n"), checksum._low, checksum._hi); - - return true; - } - - return false; -} - -bool TxMemoryCache::isCached(Checksum checksum) -{ - return _cache.find(checksum) != _cache.end(); -} - -void TxMemoryCache::clear() -{ - if (!_cache.empty()) { - auto itMap = _cache.begin(); - while (itMap != _cache.end()) { - free((*itMap).second->info.data); - delete (*itMap).second; - itMap++; - } - _cache.clear(); - } - - if (!_cachelist.empty()) - _cachelist.clear(); - - _totalSize = 0; -} - -/************************** TxFileCache *************************************/ - -class TxFileStorage : public TxCacheImpl -{ -public: - TxFileStorage(uint32 _options, const wchar_t *cachePath, dispInfoFuncExt callback); - ~TxFileStorage() = default; - - bool add(Checksum checksum, GHQTexInfo *info, int dataSize = 0) override; - bool get(Checksum checksum, GHQTexInfo *info) override; - - bool save(const wchar_t *path, const wchar_t *filename, const int config) override; - bool load(const wchar_t *path, const wchar_t *filename, const int config, bool force) override; - bool del(Checksum checksum) override { return false; } - bool isCached(Checksum checksum) override; - void clear() override; - bool empty() const override { return _storage.empty(); } - - uint64 size() const override { return _storage.size(); } - uint64 totalSize() const override { return _totalSize; } - uint64 cacheLimit() const override { return 0UL; } - uint32 getOptions() const override { return _options; } - void setOptions(uint32 options) override { _options = options; } - -private: - bool open(bool forRead); - bool writeData(uint32 destLen, const GHQTexInfo & info); - bool readData(GHQTexInfo & info); - void buildFullPath(); - - uint32 _options; - tx_wstring _cachePath; - tx_wstring _filename; - std::string _fullPath; - dispInfoFuncExt _callback; - uint64 _totalSize = 0; - - using StorageMap = std::unordered_map; - StorageMap _storage; - - uint8 *_gzdest0 = nullptr; - uint8 *_gzdest1 = nullptr; - uint32 _gzdestLen = 0; - - std::ifstream _infile; - std::ofstream _outfile; - int64 _storagePos = 0; - bool _dirty = false; - static const int _fakeConfig; - static const int64 _initialPos; -}; - -const int TxFileStorage::_fakeConfig = -1; -const int64 TxFileStorage::_initialPos = sizeof(int64) + sizeof(int); - -TxFileStorage::TxFileStorage(uint32 options, - const wchar_t *cachePath, - dispInfoFuncExt callback) - : _options(options) - , _callback(callback) -{ - /* save path name */ - if (cachePath) - _cachePath.assign(cachePath); - - _gzdest0 = TxMemBuf::getInstance()->get(0); - _gzdest1 = TxMemBuf::getInstance()->get(1); - _gzdestLen = (TxMemBuf::getInstance()->size_of(0) < TxMemBuf::getInstance()->size_of(1)) ? - TxMemBuf::getInstance()->size_of(0) : TxMemBuf::getInstance()->size_of(1); - - if (!_gzdest0 || !_gzdest1 || !_gzdestLen) { - _options &= ~(GZ_TEXCACHE | GZ_HIRESTEXCACHE); - _gzdest0 = nullptr; - _gzdest1 = nullptr; - _gzdestLen = 0; - } -} - -#define FWRITE(a) _outfile.write((char*)(&a), sizeof(a)) -#define FREAD(a) _infile.read((char*)(&a), sizeof(a)) - -void TxFileStorage::buildFullPath() -{ - char cbuf[MAX_PATH * 2]; - tx_wstring filename = _cachePath + OSAL_DIR_SEPARATOR_STR + _filename; - wcstombs(cbuf, filename.c_str(), MAX_PATH * 2); - _fullPath = cbuf; -} - -bool TxFileStorage::open(bool forRead) -{ - if (_infile.is_open()) - _infile.close(); - if (_outfile.is_open()) - _outfile.close(); - - if (forRead) { - /* find it on disk */ - _infile.open(_fullPath, std::ifstream::in | std::ifstream::binary); - DBG_INFO(80, wst("file:%s %s\n"), _fullPath.c_str(), _infile.good() ? "opened for read" : "failed to open"); - return _infile.good(); - } - - if (osal_path_existsA(_fullPath.c_str()) != 0) { - assert(_storagePos != 0L); - _outfile.open(_fullPath, std::ofstream::out | std::ofstream::binary); - DBG_INFO(80, wst("file:%s %s\n"), _fullPath.c_str(), _outfile.good() ? "opened for write" : "failed to open"); - return _outfile.good(); - } - - if (osal_mkdirp(_cachePath.c_str()) != 0) - return false; - - _outfile.open(_fullPath, std::ofstream::out | std::ofstream::binary); - DBG_INFO(80, wst("file:%s %s\n"), _fullPath.c_str(), _outfile.good() ? L"created for write" : L"failed to create"); - if (!_outfile.good()) - return false; - - FWRITE(_fakeConfig); - _storagePos = _initialPos; - FWRITE(_storagePos); - - return _outfile.good(); -} - -void TxFileStorage::clear() -{ - if (empty() && osal_path_existsA(_fullPath.c_str()) == 0) - return; - - _storage.clear(); - _storagePos = 0UL; - _dirty = false; - - if (_infile.is_open()) - _infile.close(); - if (_outfile.is_open()) - _outfile.close(); - - _outfile.open(_fullPath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); - FWRITE(_fakeConfig); - _storagePos = _initialPos; - FWRITE(_storagePos); - _outfile.close(); -} - -bool TxFileStorage::writeData(uint32 dataSize, const GHQTexInfo & info) -{ - if (info.data == nullptr || dataSize == 0) - return false; - FWRITE(info.width); - FWRITE(info.height); - FWRITE(info.format); - FWRITE(info.texture_format); - FWRITE(info.pixel_type); - FWRITE(info.is_hires_tex); - FWRITE(dataSize); - _outfile.write((char*)info.data, dataSize); - return _outfile.good(); -} - -bool TxFileStorage::readData(GHQTexInfo & info) -{ - FREAD(info.width); - FREAD(info.height); - FREAD(info.format); - FREAD(info.texture_format); - FREAD(info.pixel_type); - FREAD(info.is_hires_tex); - - uint32 dataSize = 0U; - FREAD(dataSize); - if (dataSize == 0) - return false; - - if (_gzdest0 == nullptr) - return false; - - _infile.read((char*)_gzdest0, dataSize); - if (!_infile.good()) - return false; - - /* zlib decompress it */ - if (info.format & GL_TEXFMT_GZ) { - uLongf destLen = _gzdestLen; - if (uncompress(_gzdest1, &destLen, _gzdest0, dataSize) != Z_OK) { - DBG_INFO(80, wst("Error: zlib decompression failed!\n")); - return false; - } - info.data = _gzdest1; - info.format &= ~GL_TEXFMT_GZ; - DBG_INFO(80, wst("zlib decompressed: %.02gkb->%.02gkb\n"), dataSize / 1024.0, destLen / 1024.0); - } else { - info.data = _gzdest0; - } - - return true; -} - -bool TxFileStorage::add(Checksum checksum, GHQTexInfo *info, int dataSize) -{ - /* NOTE: dataSize must be provided if info->data is zlib compressed. */ - - if (!checksum || !info->data || _storage.find(checksum) != _storage.end()) - return false; - - if (_infile.is_open() || !_outfile.is_open()) - if (!open(false)) - return false; - - if (!_dirty) { - // Make position of storage data invalid. - // It will prevent attempts to load unsaved storage file. - _outfile.seekp(sizeof(_options), std::ofstream::beg); - int64 pos = -1; - FWRITE(pos); - } - - uint8 *dest = info->data; - uint32 format = info->format; - - if (dataSize == 0) { - dataSize = TxUtil::sizeofTx(info->width, info->height, info->format); - - if (!dataSize) - return false; - - if (_options & (GZ_TEXCACHE | GZ_HIRESTEXCACHE)) { - /* zlib compress it. compression level:1 (best speed) */ - uLongf destLen = _gzdestLen; - dest = (dest == _gzdest0) ? _gzdest1 : _gzdest0; - if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) { - dest = info->data; - DBG_INFO(80, wst("Error: zlib compression failed!\n")); - } else { - DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), dataSize / 1024.0, destLen / 1024.0); - dataSize = destLen; - format |= GL_TEXFMT_GZ; - } - } - } - - GHQTexInfo infoToWrite = *info; - infoToWrite.data = dest; - infoToWrite.format = format; - - _outfile.seekp(_storagePos, std::ofstream::beg); - assert(_storagePos == _outfile.tellp()); - - _storage.insert(StorageMap::value_type(checksum._checksum, _storagePos)); - if (!writeData(dataSize, infoToWrite)) - return false; - _storagePos = _outfile.tellp(); - _dirty = true; - -#ifdef DEBUG - DBG_INFO(80, wst("[%5d] added!! crc:%08X %08X %d x %d gfmt:%x total:%.02fmb\n"), - _storage.size(), checksum._hi, checksum._low, - info->width, info->height, info->format & 0xffff, (double)(_totalSize / 1024) / 1024.0); -#endif - - /* total storage size */ - _totalSize += dataSize; - - return true; -} - -bool TxFileStorage::get(Checksum checksum, GHQTexInfo *info) -{ - if (!checksum || _storage.empty()) - return false; - - /* find a match in storage */ - auto itMap = _storage.find(checksum); - if (itMap == _storage.end()) - return false; - - if (_outfile.is_open() || !_infile.is_open()) - if (!open(true)) - return false; - - _infile.seekg(itMap->second, std::ifstream::beg); - return readData(*info); -} - -bool TxFileStorage::save(const wchar_t *path, const wchar_t *filename, int config) -{ - assert(_cachePath == path); - if (_filename.empty()) { - _filename = filename; - buildFullPath(); - } else - assert(_filename == filename); - - if (!_dirty) - return true; - - if (_storage.empty() || _storagePos == 0UL) - return false; - - if (_infile.is_open() || !_outfile.is_open()) - if (!open(false)) - return false; - - _outfile.seekp(0L, std::ofstream::beg); - - FWRITE(config); - FWRITE(_storagePos); - _outfile.seekp(_storagePos, std::ofstream::beg); - int storageSize = static_cast(_storage.size()); - FWRITE(storageSize); - if (_callback) - (*_callback)(wst("Saving texture storage...\n")); - for (auto& item : _storage) { - FWRITE(item.first); - FWRITE(item.second); - } - _outfile.close(); - if (_callback) - (*_callback)(wst("Done\n")); - - return true; -} - -bool TxFileStorage::load(const wchar_t *path, const wchar_t *filename, int config, bool force) -{ - assert(_cachePath == path); - if (_filename.empty()) { - _filename = filename; - buildFullPath(); - } else - assert(_filename == filename); - - if (_outfile.is_open() || !_infile.is_open()) - if (!open(true)) - return false; - - int tmpconfig = 0; - /* read header to determine config match */ - _infile.seekg(0L, std::ifstream::beg); - FREAD(tmpconfig); - FREAD(_storagePos); - if (tmpconfig == _fakeConfig) { - if (_storagePos != _initialPos) - return false; - } else if (tmpconfig != config && !force) - return false; - - if (_storagePos <= sizeof(config) + sizeof(_storagePos)) - return false; - _infile.seekg(_storagePos, std::ifstream::beg); - - int storageSize = 0; - FREAD(storageSize); - if (storageSize <= 0) - return false; - - if (_callback) - (*_callback)(wst("Loading texture storage...\n")); - uint64 key; - int64 value; - for (int i = 0; i < storageSize; ++i) { - FREAD(key); - FREAD(value); - _storage.insert(StorageMap::value_type(key, value)); - } - if (_callback) - (*_callback)(wst("Done\n")); - - _dirty = false; - return !_storage.empty(); -} - -bool TxFileStorage::isCached(Checksum checksum) -{ - return _storage.find(checksum) != _storage.end(); -} - -/************************** TxCache *************************************/ - -TxCache::~TxCache() -{ -} - -TxCache::TxCache(uint32 options, - uint64 cachesize, - const wchar_t *cachePath, - const wchar_t *ident, - dispInfoFuncExt callback) - : _callback(callback) -{ - /* save path name */ - if (cachePath) - _cachePath.assign(cachePath); - - /* save ROM name */ - if (ident) - _ident.assign(ident); - - if ((options & FILE_CACHE_MASK) == 0) - _pImpl.reset(new TxMemoryCache(options, cachesize, _callback)); - else - _pImpl.reset(new TxFileStorage(options, cachePath, _callback)); -} - -bool TxCache::add(Checksum checksum, GHQTexInfo *info, int dataSize) -{ - return _pImpl->add(checksum, info, dataSize); -} - -bool TxCache::get(Checksum checksum, GHQTexInfo *info) -{ - return _pImpl->get(checksum, info); -} - -uint64 TxCache::size() const -{ - return _pImpl->size(); -} - -uint64 TxCache::totalSize() const -{ - return _pImpl->totalSize(); -} - -uint64 TxCache::cacheLimit() const -{ - return _pImpl->cacheLimit(); -} - -bool TxCache::save() -{ - return _pImpl->save(_cachePath.c_str(), _getFileName().c_str(), _getConfig()); -} - -bool TxCache::load(bool force) -{ - return _pImpl->load(_cachePath.c_str(), _getFileName().c_str(), _getConfig(), force); -} - -bool TxCache::del(Checksum checksum) -{ - return _pImpl->del(checksum); -} - -bool TxCache::isCached(Checksum checksum) -{ - return _pImpl->isCached(checksum); -} - -void TxCache::clear() -{ - _pImpl->clear(); -} - -bool TxCache::empty() const -{ - return _pImpl->empty(); -} - -uint32 TxCache::getOptions() const -{ - return _pImpl->getOptions(); -} - -void TxCache::setOptions(uint32 options) -{ - _pImpl->setOptions(options); -} diff --git a/GLideN64/src/GLideNHQ/TxCache.h b/GLideN64/src/GLideNHQ/TxCache.h deleted file mode 100644 index af06a95..0000000 --- a/GLideN64/src/GLideNHQ/TxCache.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXCACHE_H__ -#define __TXCACHE_H__ - -#include -#include -#include - -#include "TxInternal.h" -#include "TxUtil.h" - -struct Checksum -{ - union - { - uint64 _checksum; /* checksum hi:palette low:texture */ - struct - { - uint32 _low; - uint32 _hi; - }; - }; - - Checksum(uint64 checksum) : _checksum(checksum) {} - operator bool() { - return _checksum != 0; - } - operator uint64() { - return _checksum; - } -}; - -class TxCacheImpl; - -class TxCache -{ -private: - std::unique_ptr _pImpl; - -protected: - tx_wstring _ident; - tx_wstring _cachePath; - dispInfoFuncExt _callback; - - bool save(); - bool load(bool force); - bool del(Checksum checksum); /* checksum hi:palette low:texture */ - bool isCached(Checksum checksum); /* checksum hi:palette low:texture */ - void clear(); - uint64 size() const; // number of elements - uint64 totalSize() const; // size of elements in bytes - uint64 cacheLimit() const; - uint32 getOptions() const; - void setOptions(uint32 options); - - virtual tx_wstring _getFileName() const = 0; - virtual int _getConfig() const = 0; - -public: - virtual ~TxCache(); - TxCache(uint32 options, uint64 cacheLimit, const wchar_t *cachePath, const wchar_t *ident, dispInfoFuncExt callback); - bool add(Checksum checksum, GHQTexInfo *info, int dataSize = 0); - bool get(Checksum checksum, GHQTexInfo *info); - bool empty() const; -}; - -#endif /* __TXCACHE_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxDbg.cpp b/GLideN64/src/GLideNHQ/TxDbg.cpp deleted file mode 100644 index 838ba14..0000000 --- a/GLideN64/src/GLideNHQ/TxDbg.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#define DBG_LEVEL 80 - -#include "TxDbg.h" -#include -#include - -#ifdef OS_ANDROID - -#include -#include - -TxDbg::TxDbg() -{ - _level = DBG_LEVEL; -} - -TxDbg::~TxDbg() -{} - - -void -TxDbg::output(const int level, const wchar_t *format, ...) -{ - if (level > _level) - return; - - char fmt[2048]; - wcstombs(fmt, format, 2048); - - va_list ap; - va_start(ap, format); - __android_log_vprint(ANDROID_LOG_DEBUG, "GLideN64", fmt, ap); - va_end(ap); -} - -#else // OS_ANDROID -TxDbg::TxDbg() -{ - _level = DBG_LEVEL; - - if (!_dbgfile) -#ifdef GHQCHK - _dbgfile = fopen("ghqchk.txt", "w"); -#else - _dbgfile = fopen("glidenhq.dbg", "w"); -#endif -} - -TxDbg::~TxDbg() -{ - if (_dbgfile) { - fclose(_dbgfile); - _dbgfile = 0; - } - - _level = DBG_LEVEL; -} - -void -TxDbg::output(const int level, const wchar_t *format, ...) -{ - if (level > _level) - return; - - va_list args; - wchar_t newformat[4095]; - - va_start(args, format); - tx_swprintf(newformat, 4095, wst("%d:\t"), level); - wcscat(newformat, format); - vfwprintf(_dbgfile, newformat, args); - fflush(_dbgfile); -#ifdef GHQCHK - //vwprintf(newformat, args); - vwprintf(newformat.c_str(), args); -#endif - va_end(args); -} -#endif // OS_ANDROID diff --git a/GLideN64/src/GLideNHQ/TxDbg.h b/GLideN64/src/GLideNHQ/TxDbg.h deleted file mode 100644 index 0a64d6a..0000000 --- a/GLideN64/src/GLideNHQ/TxDbg.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXDBG_H__ -#define __TXDBG_H__ - -#include -#include "TxInternal.h" - -class TxDbg -{ -private: - FILE* _dbgfile; - int _level; - TxDbg(); -public: - static TxDbg* getInstance() { - static TxDbg txDbg; - return &txDbg; - } - ~TxDbg(); - void output(const int level, const wchar_t *format, ...); -}; - -#ifdef DEBUG -#define DBG_INFO TxDbg::getInstance()->output -#define INFO DBG_INFO -#else -#define DBG_INFO(A, ...) -#ifdef GHQCHK -#define INFO TxDbg::getInstance()->output -#else -#if 0 /* XXX enable this to log basic hires texture checks */ -#define INFO TxDbg::getInstance()->output -#else -#define INFO DBG_INFO -#endif -#endif -#endif - -#endif /* __TXDBG_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxFilter.cpp b/GLideN64/src/GLideNHQ/TxFilter.cpp deleted file mode 100644 index 6ef6908..0000000 --- a/GLideN64/src/GLideNHQ/TxFilter.cpp +++ /dev/null @@ -1,660 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef __MSC__ -#pragma warning(disable: 4786) -#endif - -#include -#include -#include -#include - -#include -#include "TxFilter.h" -#include "TextureFilters.h" -#include "TxDbg.h" -#include "bldno.h" - -void TxFilter::clear() -{ - /* clear hires texture cache */ - delete _txHiResCache; - - /* clear texture cache */ - delete _txTexCache; - - /* free memory */ - TxMemBuf::getInstance()->shutdown(); - - /* clear other stuff */ - delete _txImage; - delete _txQuantize; -} - -TxFilter::~TxFilter() -{ - clear(); -} - -TxFilter::TxFilter(int maxwidth, - int maxheight, - int maxbpp, - int options, - int cachesize, - const wchar_t * texCachePath, - const wchar_t * texDumpPath, - const wchar_t * texPackPath, - const wchar_t * ident, - dispInfoFuncExt callback) - : _tex1(nullptr) - , _tex2(nullptr) - , _txQuantize(nullptr) - , _txTexCache(nullptr) - , _txHiResCache(nullptr) - , _txImage(nullptr) -{ - /* HACKALERT: the emulator misbehaves and sometimes forgets to shutdown */ - if ((ident && wcscmp(ident, wst("DEFAULT")) != 0 && _ident.compare(ident) == 0) && - _maxwidth == maxwidth && - _maxheight == maxheight && - _maxbpp == maxbpp && - _options == options && - _cacheSize == cachesize) return; - // clear(); /* gcc does not allow the destructor to be called */ - if (texCachePath == nullptr || texDumpPath == nullptr || texPackPath == nullptr) - return; - - /* shamelessness :P this first call to the debug output message creates - * a file in the executable directory. */ - INFO(0, wst("------------------------------------------------------------------\n")); -#ifdef GHQCHK - INFO(0, wst(" GLideNHQ Hires Texture Checker 1.02.00.%d\n"), BUILD_NUMBER); -#else - INFO(0, wst(" GLideNHQ version 1.00.00.%d\n"), BUILD_NUMBER); -#endif - INFO(0, wst(" Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n")); - INFO(0, wst(" email : koolsmoky(at)users.sourceforge.net\n")); - INFO(0, wst(" website : http://www.3dfxzone.it/koolsmoky\n")); - INFO(0, wst("\n")); - INFO(0, wst(" GLideN64 GitHub : https://github.com/gonetz/GLideN64\n")); - INFO(0, wst("------------------------------------------------------------------\n")); - - _options = options; - - _txImage = new TxImage(); - _txQuantize = new TxQuantize(); - - /* get number of CPU cores. */ - _numcore = TxUtil::getNumberofProcessors(); - - _initialized = 0; - - _tex1 = nullptr; - _tex2 = nullptr; - - _maxwidth = maxwidth > 4096 ? 4096 : maxwidth; - _maxheight = maxheight > 4096 ? 4096 : maxheight; - _maxbpp = maxbpp; - - _cacheSize = cachesize; - - /* TODO: validate options and do overrides here*/ - - /* save pathes */ - if (texDumpPath) - _dumpPath.assign(texDumpPath); - - /* save ROM name */ - if (ident && wcscmp(ident, wst("DEFAULT")) != 0) - _ident.assign(ident); - - /* replace ':' in ROM name with '-' */ - removeColon(_ident); - - if (TxMemBuf::getInstance()->init(_maxwidth, _maxheight)) { - if (!_tex1) - _tex1 = TxMemBuf::getInstance()->get(0); - - if (!_tex2) - _tex2 = TxMemBuf::getInstance()->get(1); - } - -#if !_16BPP_HACK - /* initialize hq4x filter */ - hq4x_init(); -#endif - - /* initialize texture cache in bytes. 128Mb will do nicely in most cases */ - _txTexCache = new TxTexCache(_options, _cacheSize, texCachePath, _ident.c_str(), callback); - - /* hires texture */ -#if HIRES_TEXTURE - _txHiResCache = new TxHiResCache(_maxwidth, _maxheight, _maxbpp, _options, texCachePath, texPackPath, _ident.c_str(), callback); - - if (_txHiResCache->empty()) - _options &= ~HIRESTEXTURES_MASK; -#endif - - if (_tex1 && _tex2) - _initialized = 1; -} - -boolean -TxFilter::filter(uint8 *src, int srcwidth, int srcheight, ColorFormat srcformat, uint64 g64crc, GHQTexInfo *info) -{ - uint8 *texture = src; - uint8 *tmptex = _tex1; - assert(srcformat != graphics::colorFormat::RGBA); - ColorFormat destformat = srcformat; - - /* We need to be initialized first! */ - if (!_initialized) return 0; - - /* find cached textures */ - if (_cacheSize) { - - /* calculate checksum of source texture */ - if (!g64crc) - g64crc = (uint64)(TxUtil::checksumTx(texture, srcwidth, srcheight, srcformat)); - - DBG_INFO(80, wst("filter: crc:%08X %08X %d x %d gfmt:%x\n"), - (uint32)(g64crc >> 32), (uint32)(g64crc & 0xffffffff), srcwidth, srcheight, u32(srcformat)); - - /* check if we have it in cache */ - if ((g64crc & 0xffffffff00000000) == 0 && /* we reach here only when there is no hires texture for this crc */ - _txTexCache->get(g64crc, info)) { - DBG_INFO(80, wst("cache hit: %d x %d gfmt:%x\n"), info->width, info->height, info->format); - return 1; /* yep, we've got it */ - } - } - - /* Leave small textures alone because filtering makes little difference. - * Moreover, some filters require at least 4 * 4 to work. - * Bypass _options to do ARGB8888->16bpp if _maxbpp=16 or forced color reduction. - */ - if ((srcwidth >= 4 && srcheight >= 4) && - ((_options & (FILTER_MASK|ENHANCEMENT_MASK)) || - (srcformat == graphics::internalcolorFormat::RGBA8 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)))) { - - if (srcformat != graphics::internalcolorFormat::RGBA8) { - if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, srcformat, graphics::internalcolorFormat::RGBA8)) { - DBG_INFO(80, wst("Error: unsupported format! gfmt:%x\n"), u32(srcformat)); - return 0; - } - texture = tmptex; - destformat = graphics::internalcolorFormat::RGBA8; - } - - if (destformat == graphics::internalcolorFormat::RGBA8) { - - /* - * prepare texture enhancements (x2, x4 scalers) - */ - int scale = 1, num_filters = 0; - uint32 filter = 0; - - const uint32 enhancement = (_options & ENHANCEMENT_MASK); - switch (enhancement) { - case NO_ENHANCEMENT: - // Do nothing - break; - case HQ4X_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 2) && srcheight <= (_maxheight >> 2)) { - filter |= HQ4X_ENHANCEMENT; - scale = 4; - num_filters++; - } else if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - filter |= HQ2X_ENHANCEMENT; - scale = 2; - num_filters++; - } - break; - case BRZ3X_ENHANCEMENT: - xbrz::init(); - if (srcwidth <= (_maxwidth / 3) && srcheight <= (_maxheight / 3)) { - filter |= BRZ3X_ENHANCEMENT; - scale = 3; - num_filters++; - } else if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - filter |= BRZ2X_ENHANCEMENT; - scale = 2; - num_filters++; - } - break; - case BRZ4X_ENHANCEMENT: - xbrz::init(); - if (srcwidth <= (_maxwidth >> 2) && srcheight <= (_maxheight >> 2)) { - filter |= BRZ4X_ENHANCEMENT; - scale = 4; - num_filters++; - } else if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - filter |= BRZ2X_ENHANCEMENT; - scale = 2; - num_filters++; - } - break; - case BRZ5X_ENHANCEMENT: - xbrz::init(); - if (srcwidth <= (_maxwidth / 5) && srcheight <= (_maxheight / 5)) { - filter |= BRZ5X_ENHANCEMENT; - scale = 5; - num_filters++; - } else if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - filter |= BRZ2X_ENHANCEMENT; - scale = 2; - num_filters++; - } - break; - case BRZ6X_ENHANCEMENT: - xbrz::init(); - if (srcwidth <= (_maxwidth / 6) && srcheight <= (_maxheight / 6)) { - filter |= BRZ6X_ENHANCEMENT; - scale = 6; - num_filters++; - } - else if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - filter |= BRZ2X_ENHANCEMENT; - scale = 2; - num_filters++; - } - break; - default: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - filter |= enhancement; - scale = 2; - num_filters++; - } - } - - /* - * prepare texture filters - */ - if (_options & (SMOOTH_FILTER_MASK|SHARP_FILTER_MASK)) { - filter |= (_options & (SMOOTH_FILTER_MASK|SHARP_FILTER_MASK)); - num_filters++; - } - - filter |= _options & DEPOSTERIZE; - /* - * execute texture enhancements and filters - */ - while (num_filters > 0) { - - tmptex = (texture == _tex1) ? _tex2 : _tex1; - - uint8 *_texture = texture; - uint8 *_tmptex = tmptex; - - unsigned int numcore = _numcore; - unsigned int blkrow = 0; - while (numcore > 1 && blkrow == 0) { - blkrow = (srcheight >> 2) / numcore; - numcore--; - } - if (blkrow > 0 && numcore > 1) { - std::thread *thrd[MAX_NUMCORE]; - unsigned int i; - int blkheight = blkrow << 2; - unsigned int srcStride = (srcwidth * blkheight) << 2; - unsigned int destStride = srcStride * scale * scale; - for (i = 0; i < numcore - 1; i++) { - thrd[i] = new std::thread(std::bind(filter_8888, - (uint32*)_texture, - srcwidth, - blkheight, - (uint32*)_tmptex, - filter, - i)); - _texture += srcStride; - _tmptex += destStride; - } - thrd[i] = new std::thread(std::bind(filter_8888, - (uint32*)_texture, - srcwidth, - srcheight - blkheight * i, - (uint32*)_tmptex, - filter, - i)); - for (i = 0; i < numcore; i++) { - thrd[i]->join(); - delete thrd[i]; - } - } else { - filter_8888((uint32*)_texture, srcwidth, srcheight, (uint32*)_tmptex, filter, 0); - } - - if (filter & ENHANCEMENT_MASK) { - srcwidth *= scale; - srcheight *= scale; - filter &= ~ENHANCEMENT_MASK; - scale = 1; - } - - texture = tmptex; - num_filters--; - } - - /* - * texture (re)conversions - */ - if (destformat == graphics::internalcolorFormat::RGBA8 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)) { - if (srcformat == graphics::internalcolorFormat::RGBA8) - srcformat = graphics::internalcolorFormat::RGBA4; - if (srcformat != graphics::internalcolorFormat::RGBA8) { - tmptex = (texture == _tex1) ? _tex2 : _tex1; - if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, graphics::internalcolorFormat::RGBA8, srcformat)) { - DBG_INFO(80, wst("Error: unsupported format! gfmt:%x\n"), srcformat); - return 0; - } - texture = tmptex; - destformat = srcformat; - } - } - } -#if !_16BPP_HACK - else if (destformat == graphics::internalcolorFormat::RGBA4) { - - int scale = 1; - tmptex = (texture == _tex1) ? _tex2 : _tex1; - - switch (_options & ENHANCEMENT_MASK) { - case HQ4X_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 2) && srcheight <= (_maxheight >> 2)) { - hq4x_4444((uint8*)texture, (uint8*)tmptex, srcwidth, srcheight, srcwidth, srcwidth * 4 * 2); - scale = 4; - }/* else if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - hq2x_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight); - scale = 2; - }*/ - break; - case HQ2X_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - hq2x_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight); - scale = 2; - } - break; - case HQ2XS_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - hq2xS_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight); - scale = 2; - } - break; - case LQ2X_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - lq2x_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight); - scale = 2; - } - break; - case LQ2XS_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - lq2xS_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight); - scale = 2; - } - break; - case X2SAI_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - Super2xSaI_4444((uint16*)texture, (uint16*)tmptex, srcwidth, srcheight, srcwidth); - scale = 2; - } - break; - case X2_ENHANCEMENT: - if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) { - Texture2x_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight); - scale = 2; - } - } - if (scale) { - srcwidth *= scale; - srcheight *= scale; - texture = tmptex; - } - - if (_options & SMOOTH_FILTER_MASK) { - tmptex = (texture == _tex1) ? _tex2 : _tex1; - SmoothFilter_4444((uint16*)texture, srcwidth, srcheight, (uint16*)tmptex, (_options & SMOOTH_FILTER_MASK)); - texture = tmptex; - } else if (_options & SHARP_FILTER_MASK) { - tmptex = (texture == _tex1) ? _tex2 : _tex1; - SharpFilter_4444((uint16*)texture, srcwidth, srcheight, (uint16*)tmptex, (_options & SHARP_FILTER_MASK)); - texture = tmptex; - } - } -#endif /* _16BPP_HACK */ - } - - /* fill in the texture info. */ - info->data = texture; - info->width = srcwidth; - info->height = srcheight; - info->is_hires_tex = 0; - setTextureFormat(destformat, info); - - /* cache the texture. */ - if (_cacheSize) - _txTexCache->add(g64crc, info); - - DBG_INFO(80, wst("filtered texture: %d x %d gfmt:%x\n"), info->width, info->height, info->format); - - return 1; -} - -boolean -TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info) -{ - /* NOTE: Rice CRC32 sometimes return the same value for different textures. - * As a workaround, Glide64 CRC32 is used for the key for NON-hires - * texture cache. - * - * r_crc64 = hi:palette low:texture - * (separate crc. doesn't necessary have to be rice crc) - * g64crc = texture + palette glide64 crc32 - * (can be any other crc if robust) - */ - - DBG_INFO(80, wst("hirestex: r_crc64:%08X %08X, g64crc:%08X %08X\n"), - (uint32)(r_crc64 >> 32), (uint32)(r_crc64 & 0xffffffff), - (uint32)(g64crc >> 32), (uint32)(g64crc & 0xffffffff)); - -#if HIRES_TEXTURE - /* check if we have it in hires memory cache. */ - if ((_options & HIRESTEXTURES_MASK) && r_crc64) { - if (_txHiResCache->get(r_crc64, info)) { - DBG_INFO(80, wst("hires hit: %d x %d gfmt:%x\n"), info->width, info->height, info->format); - - /* TODO: Enable emulation for special N64 combiner modes. There are few ways - * to get this done. Also applies for CI textures below. - * - * Solution 1. Load the hiresolution textures in ARGB8888 (or A8, IA88) format - * to cache. When a cache is hit, then we take the modes passed in from Glide64 - * (also TODO) and apply the modification. Then we do color reduction or format - * conversion or compression if desired and stuff it into the non-hires texture - * cache. - * - * Solution 2. When a cache is hit and if the combiner modes are present, - * convert the texture to ARGB4444 and pass it back to Glide64 to process. - * If a texture is compressed, it needs to be decompressed first. Then add - * the processed texture to the non-hires texture cache. - * - * Solution 3. Hybrid of the above 2. Load the textures in ARGB8888 (A8, IA88) - * format. Convert the texture to ARGB4444 and pass it back to Glide64 when - * the combiner modes are present. Get the processed texture back from Glide64 - * and compress if desired and add it to the non-hires texture cache. - * - * Solution 4. Take the easy way out and forget about this whole thing. - */ - - return 1; /* yep, got it */ - } - if (_txHiResCache->get((r_crc64 >> 32), info) || - _txHiResCache->get((r_crc64 & 0xffffffff), info)) { - DBG_INFO(80, wst("hires hit: %d x %d gfmt:%x\n"), info->width, info->height, info->format); - - /* for true CI textures, we use the passed in palette to convert to - * ARGB1555 and add it to memory cache. - * - * NOTE: we do this AFTER all other texture cache searches because - * only a few texture packs actually use true CI textures. - * - * NOTE: the pre-converted palette from Glide64 is in RGBA5551 format. - * A comp comes before RGB comp. - */ - // TODO: deal with palette textures - if (palette && u32(info->format) == u32(graphics::internalcolorFormat::COLOR_INDEX8)) { - DBG_INFO(80, wst("found COLOR_INDEX8 format. Need conversion!!\n")); - - int width = info->width; - int height = info->height; - ColorFormat format(u32(info->format)); - /* XXX: avoid collision with zlib compression buffer in TxHiResTexture::get */ - uint8 *texture = info->data; - uint8 *tmptex = (texture == _tex1) ? _tex2 : _tex1; - - /* use palette and convert to 16bit format */ - _txQuantize->P8_16BPP((uint32*)texture, (uint32*)tmptex, info->width, info->height, (uint32*)palette); - texture = tmptex; - format = graphics::internalcolorFormat::RGB5_A1; - - /* fill in the required info to return */ - info->data = texture; - info->width = width; - info->height = height; - info->is_hires_tex = 1; - setTextureFormat(format, info); - - /* XXX: add to hires texture cache!!! */ - _txHiResCache->add(r_crc64, info); - - DBG_INFO(80, wst("COLOR_INDEX8 loaded as gfmt:%x!\n"), u32(format)); - } - - return 1; - } - } -#endif - - /* check if we have it in memory cache */ - if (_cacheSize && g64crc) { - if (_txTexCache->get(g64crc, info)) { - DBG_INFO(80, wst("cache hit: %d x %d gfmt:%x\n"), info->width, info->height, info->format); - return 1; /* yep, we've got it */ - } - } - - DBG_INFO(80, wst("no cache hits.\n")); - - return 0; -} - -uint64 -TxFilter::checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette) -{ - if (_options & (HIRESTEXTURES_MASK|DUMP_TEX)) - return TxUtil::checksum64(src, width, height, size, rowStride, palette); - - return 0; -} - -boolean -TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, ColorFormat gfmt, uint16 n64fmt, uint64 r_crc64) -{ - assert(gfmt != graphics::colorFormat::RGBA); - if (!_initialized) - return 0; - - if (!(_options & DUMP_TEX)) - return 0; - - DBG_INFO(80, wst("gfmt = %02x n64fmt = %02x\n"), u32(gfmt), n64fmt); - DBG_INFO(80, wst("hirestex: r_crc64:%08X %08X\n"), - (uint32)(r_crc64 >> 32), (uint32)(r_crc64 & 0xffffffff)); - - if (gfmt != graphics::internalcolorFormat::RGBA8) { - if (!_txQuantize->quantize(src, _tex1, rowStridePixel, height, gfmt, graphics::internalcolorFormat::RGBA8)) - return 0; - src = _tex1; - } - - if (!_dumpPath.empty() && !_ident.empty()) { - /* dump it to disk */ - FILE *fp = nullptr; - tx_wstring tmpbuf; - - /* create directories */ - tmpbuf.assign(_dumpPath); - tmpbuf.append(wst("/")); - tmpbuf.append(_ident); - tmpbuf.append(wst("/GLideNHQ")); - if (!osal_path_existsW(tmpbuf.c_str()) && osal_mkdirp(tmpbuf.c_str()) != 0) - return 0; - - if ((n64fmt >> 8) == 0x2) { - wchar_t wbuf[256]; - tx_swprintf(wbuf, 256, wst("/%ls#%08X#%01X#%01X#%08X_ciByRGBA.png"), _ident.c_str(), (uint32)(r_crc64 & 0xffffffff), (n64fmt >> 8), (n64fmt & 0xf), (uint32)(r_crc64 >> 32)); - tmpbuf.append(wbuf); - } else { - wchar_t wbuf[256]; - tx_swprintf(wbuf, 256, wst("/%ls#%08X#%01X#%01X_all.png"), _ident.c_str(), (uint32)(r_crc64 & 0xffffffff), (n64fmt >> 8), (n64fmt & 0xf)); - tmpbuf.append(wbuf); - } - -#ifdef OS_WINDOWS - if ((fp = _wfopen(tmpbuf.c_str(), wst("wb"))) != nullptr) { -#else - char cbuf[MAX_PATH]; - wcstombs(cbuf, tmpbuf.c_str(), MAX_PATH); - if ((fp = fopen(cbuf, "wb")) != nullptr) { -#endif - _txImage->writePNG(src, fp, width, height, (rowStridePixel << 2), graphics::internalcolorFormat::RGBA8); - fclose(fp); - return 1; - } - } - - return 0; -} - -boolean -TxFilter::reloadhirestex() -{ - DBG_INFO(80, wst("Reload hires textures from texture pack.\n")); - - if (_txHiResCache->load(0) && !_txHiResCache->empty()) { - _options |= HIRESTEXTURES_MASK; - return 1; - } - - _options &= ~HIRESTEXTURES_MASK; - return 0; -} - -void -TxFilter::dumpcache() -{ - _txTexCache->dump(); - - /* hires texture */ -#if HIRES_TEXTURE - _txHiResCache->dump(); -#endif -} diff --git a/GLideN64/src/GLideNHQ/TxFilter.h b/GLideN64/src/GLideNHQ/TxFilter.h deleted file mode 100644 index f3e24bf..0000000 --- a/GLideN64/src/GLideNHQ/TxFilter.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXFILTER_H__ -#define __TXFILTER_H__ - -#include "TxInternal.h" -#include "TxQuantize.h" -#include "TxHiResCache.h" -#include "TxTexCache.h" -#include "TxUtil.h" -#include "TxImage.h" - -class TxFilter -{ -private: - int _numcore; - - uint8 *_tex1; - uint8 *_tex2; - int _maxwidth; - int _maxheight; - int _maxbpp; - int _options; - int _cacheSize; - tx_wstring _ident; - tx_wstring _dumpPath; - TxQuantize *_txQuantize; - TxTexCache *_txTexCache; - TxHiResCache *_txHiResCache; - TxImage *_txImage; - boolean _initialized; - void clear(); -public: - ~TxFilter(); - TxFilter(int maxwidth, - int maxheight, - int maxbpp, - int options, - int cachesize, - const wchar_t * texCachePath, - const wchar_t * texDumpPath, - const wchar_t * texPackPath, - const wchar_t * ident, - dispInfoFuncExt callback); - boolean filter(uint8 *src, - int srcwidth, - int srcheight, - ColorFormat srcformat, - uint64 g64crc, /* glide64 crc, 64bit for future use */ - GHQTexInfo *info); - boolean hirestex(uint64 g64crc, /* glide64 crc, 64bit for future use */ - uint64 r_crc64, /* checksum hi:palette low:texture */ - uint16 *palette, - GHQTexInfo *info); - uint64 checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette); - boolean dmptx(uint8 *src, int width, int height, int rowStridePixel, ColorFormat gfmt, uint16 n64fmt, uint64 r_crc64); - boolean reloadhirestex(); - void dumpcache(); -}; - -#endif /* __TXFILTER_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxFilterExport.cpp b/GLideN64/src/GLideNHQ/TxFilterExport.cpp deleted file mode 100644 index 243fdb6..0000000 --- a/GLideN64/src/GLideNHQ/TxFilterExport.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef __MSC__ -#pragma warning(disable: 4786) -#endif - -#include "TxFilter.h" - -TxFilter *txFilter = nullptr; - -#ifdef __cplusplus -extern "C"{ -#endif - -TAPI boolean TAPIENTRY -txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, - const wchar_t * txCachePath, const wchar_t* txDumpPath, const wchar_t * texPackPath, const wchar_t * ident, - dispInfoFuncExt callback) -{ - if (txFilter) return 0; - - txFilter = new TxFilter(maxwidth, maxheight, maxbpp, options, cachesize, - txCachePath, txDumpPath, texPackPath, ident, callback); - - return 1; -} - -TAPI void TAPIENTRY -txfilter_shutdown(void) -{ - if (txFilter) delete txFilter; - - txFilter = nullptr; -} - -TAPI boolean TAPIENTRY -txfilter_filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, - uint64 g64crc, GHQTexInfo *info) -{ - if (txFilter) - return txFilter->filter(src, srcwidth, srcheight, ColorFormat(u32(srcformat)), - g64crc, info); - - return 0; -} - -TAPI boolean TAPIENTRY -txfilter_hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info) -{ - if (txFilter) - return txFilter->hirestex(g64crc, r_crc64, palette, info); - - return 0; -} - -TAPI uint64 TAPIENTRY -txfilter_checksum(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette) -{ - if (txFilter) - return txFilter->checksum64(src, width, height, size, rowStride, palette); - - return 0; -} - -TAPI boolean TAPIENTRY -txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64) -{ - if (txFilter) - return txFilter->dmptx(src, width, height, rowStridePixel, ColorFormat(u32(gfmt)), n64fmt, r_crc64); - - return 0; -} - -TAPI boolean TAPIENTRY -txfilter_reloadhirestex() -{ - if (txFilter) - return txFilter->reloadhirestex(); - - return 0; -} - -TAPI void TAPIENTRY -txfilter_dumpcache(void) -{ - if (txFilter) - txFilter->dumpcache(); -} - - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/GLideNHQ/TxHiResCache.cpp b/GLideN64/src/GLideNHQ/TxHiResCache.cpp deleted file mode 100644 index 47022dd..0000000 --- a/GLideN64/src/GLideNHQ/TxHiResCache.cpp +++ /dev/null @@ -1,803 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* 2007 Gonetz - * Added callback to display hires texture info. */ - -#ifdef __MSC__ -#pragma warning(disable: 4786) -#endif - -/* use power of 2 texture size - * (0:disable, 1:enable, 2:3dfx) */ -#define POW2_TEXTURES 0 - -/* use aggressive format assumption for quantization - * (0:disable, 1:enable, 2:extreme) */ -#define AGGRESSIVE_QUANTIZATION 1 - -#include "TxHiResCache.h" -#include "TxDbg.h" -#include -#include -#include -#include -#include - -#define HIRES_DUMP_ENABLED (FILE_HIRESTEXCACHE|DUMP_HIRESTEXCACHE) - -TxHiResCache::~TxHiResCache() -{ -} - -TxHiResCache::TxHiResCache(int maxwidth, - int maxheight, - int maxbpp, - int options, - const wchar_t *cachePath, - const wchar_t *texPackPath, - const wchar_t *ident, - dispInfoFuncExt callback) - : TxCache((options & ~(GZ_TEXCACHE | FILE_TEXCACHE)), 0, cachePath, ident, callback) - , _maxwidth(maxwidth) - , _maxheight(maxheight) - , _maxbpp(maxbpp) - , _abortLoad(false) - , _cacheDumped(false) - , _txImage(new TxImage()) - , _txQuantize(new TxQuantize()) - , _txReSample(new TxReSample()) -{ - - if (texPackPath) - _texPackPath.assign(texPackPath); - - if (_cachePath.empty() || _ident.empty()) { - setOptions(getOptions() & ~HIRES_DUMP_ENABLED); - return; - } - - /* read in hires texture cache */ - if (getOptions() & HIRES_DUMP_ENABLED) { - /* find it on disk */ - _cacheDumped = TxCache::load(!_HiResTexPackPathExists()); - } - - /* read in hires textures */ - if (!_cacheDumped) { - if (TxHiResCache::load(0) && (getOptions() & HIRES_DUMP_ENABLED) != 0) - _cacheDumped = TxCache::save(); - } -} - -void TxHiResCache::dump() -{ - if ((getOptions() & HIRES_DUMP_ENABLED) && !_cacheDumped && !_abortLoad && !empty()) { - /* dump cache to disk */ - _cacheDumped = TxCache::save(); - } -} - -tx_wstring TxHiResCache::_getFileName() const -{ - tx_wstring filename = _ident + wst("_HIRESTEXTURES."); - filename += ((getOptions() & FILE_HIRESTEXCACHE) == 0) ? TEXCACHE_EXT : TEXSTREAM_EXT; - removeColon(filename); - return filename; -} - -int TxHiResCache::_getConfig() const -{ - return getOptions() & - (HIRESTEXTURES_MASK | - TILE_HIRESTEX | - FORCE16BPP_HIRESTEX | - GZ_HIRESTEXCACHE | - FILE_HIRESTEXCACHE | - LET_TEXARTISTS_FLY); -} - -boolean TxHiResCache::_HiResTexPackPathExists() const -{ - tx_wstring dir_path(_texPackPath); - dir_path += OSAL_DIR_SEPARATOR_STR; - dir_path += _ident; - return osal_path_existsW(dir_path.c_str()); -} - -bool TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */ -{ - if (_texPackPath.empty() || _ident.empty()) - return false; - - if (!replace) - TxCache::clear(); - - tx_wstring dir_path(_texPackPath); - - switch (getOptions() & HIRESTEXTURES_MASK) { - case RICE_HIRESTEXTURES: - INFO(80, wst("-----\n")); - INFO(80, wst("using Rice hires texture format...\n")); - INFO(80, wst(" must be one of the following;\n")); - INFO(80, wst(" 1) *_rgb.png + *_a.png\n")); - INFO(80, wst(" 2) *_all.png\n")); - INFO(80, wst(" 3) *_ciByRGBA.png\n")); - INFO(80, wst(" 4) *_allciByRGBA.png\n")); - INFO(80, wst(" 5) *_ci.bmp\n")); - INFO(80, wst(" usage of only 2) and 3) highly recommended!\n")); - INFO(80, wst(" folder names must be in US-ASCII characters!\n")); - - dir_path += OSAL_DIR_SEPARATOR_STR; - dir_path += _ident; - - const LoadResult res = loadHiResTextures(dir_path.c_str(), replace); - if (res == resError) { - if (_callback) (*_callback)(wst("Texture pack load failed. Clear hiresolution texture cache.\n")); - INFO(80, wst("Texture pack load failed. Clear hiresolution texture cache.\n")); - clear(); - } - return res == resOk; - } - return false; -} - -TxHiResCache::LoadResult TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace) -{ - DBG_INFO(80, wst("-----\n")); - DBG_INFO(80, wst("path: %ls\n"), dir_path); - - /* find it on disk */ - if (!osal_path_existsW(dir_path)) { - INFO(80, wst("Error: path not found!\n")); - return resNotFound; - } - - LoadResult result = resOk; - -#ifdef OS_WINDOWS - wchar_t curpath[MAX_PATH]; - GETCWD(MAX_PATH, curpath); - CHDIR(dir_path); -#else - char curpath[MAX_PATH]; - char cbuf[MAX_PATH]; - wcstombs(cbuf, dir_path, MAX_PATH); - GETCWD(MAX_PATH, curpath); - CHDIR(cbuf); -#endif - - void *dir = osal_search_dir_open(dir_path); - const wchar_t *foundfilename; - // the path of the texture - tx_wstring texturefilename; - - do { - - if (KBHIT(0x1B)) { - _abortLoad = true; - if (_callback) (*_callback)(wst("Aborted loading hiresolution texture!\n")); - INFO(80, wst("Error: aborted loading hiresolution texture!\n")); - } - if (_abortLoad) - break; - - foundfilename = osal_search_dir_read_next(dir); - // The array is empty, break the current operation - if (foundfilename == nullptr) - break; - // The current file is a hidden one - if (wccmp(foundfilename, wst("."))) - // These files we don't need - continue; - texturefilename.assign(dir_path); - texturefilename += OSAL_DIR_SEPARATOR_STR; - texturefilename += foundfilename; - - /* recursive read into sub-directory */ - if (osal_is_directory(texturefilename.c_str())) { - result = loadHiResTextures(texturefilename.c_str(), replace); - if (result == resOk) - continue; - else - break; - } - - DBG_INFO(80, wst("-----\n")); - DBG_INFO(80, wst("file: %ls\n"), foundfilename); - - int width = 0, height = 0; - ColorFormat format = graphics::internalcolorFormat::NOCOLOR; - uint8 *tex = nullptr; - int tmpwidth = 0, tmpheight = 0; - ColorFormat tmpformat = graphics::internalcolorFormat::NOCOLOR; - uint8 *tmptex = nullptr; - ColorFormat destformat = graphics::internalcolorFormat::NOCOLOR; - - /* Rice hi-res textures: begin - */ - uint32 chksum = 0, fmt = 0, siz = 0, palchksum = 0; - bool hasWildcard = false; - char *pfname = nullptr, fname[MAX_PATH]; - std::string ident; - FILE *fp = nullptr; - - wcstombs(fname, _ident.c_str(), MAX_PATH); - /* XXX case sensitivity fiasco! - * files must use _a, _rgb, _all, _allciByRGBA, _ciByRGBA, _ci - * and file extensions must be in lower case letters! */ -#ifdef OS_WINDOWS - { - unsigned int i; - for (i = 0; i < strlen(fname); i++) fname[i] = tolower(fname[i]); - } -#endif - ident.assign(fname); - - /* read in Rice's file naming convention */ -#define CRCFMTSIZ_LEN 13 -#define CRCWILDCARD_LEN 15 -#define PALCRC_LEN 9 - wcstombs(fname, foundfilename, MAX_PATH); - /* XXX case sensitivity fiasco! - * files must use _a, _rgb, _all, _allciByRGBA, _ciByRGBA, _ci - * and file extensions must be in lower case letters! */ -#ifdef OS_WINDOWS - { - unsigned int i; - for (i = 0; i < strlen(fname); i++) fname[i] = tolower(fname[i]); - } -#endif - pfname = fname + strlen(fname) - 4; - if (!(pfname == strstr(fname, ".png") || - pfname == strstr(fname, ".bmp") || - pfname == strstr(fname, ".dds"))) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Error: not png or bmp or dds!\n")); - continue; - } - pfname = strstr(fname, ident.c_str()); - if (pfname != fname) pfname = 0; - if (pfname) { - uint32_t length = 0; - const char* strName = pfname + ident.size(); - - /* wildcard support */ - if (strchr(strName, '$')) { - if (sscanf(strName, "#%08X#%01X#%01X#$", &chksum, &fmt, &siz) == 3) { - length = CRCWILDCARD_LEN; - } else if (sscanf(strName, "#$#%01X#%01X#%08X", &fmt, &siz, &palchksum) == 3) { - length = CRCWILDCARD_LEN; - } - - hasWildcard = (length != 0); - } else { - if (sscanf(strName, "#%08X#%01X#%01X#%08X", &chksum, &fmt, &siz, &palchksum) == 4) { - length = CRCFMTSIZ_LEN + PALCRC_LEN; - } else if (sscanf(strName, "#%08X#%01X#%01X", &chksum, &fmt, &siz) == 3) { - length = CRCFMTSIZ_LEN; - } - } - - if (length) { - pfname += (ident.size() + length); - } else { - pfname = 0; - } - } - - if (!pfname) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n", dir_path)); - INFO(80, wst("file: %ls\n", foundfilename)); -#endif - INFO(80, wst("Error: not Rice texture naming convention!\n")); - continue; - } - if (!chksum && !hasWildcard) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Error: crc32 = 0!\n")); - continue; - } - - /* check if we already have it in hires texture cache */ - if (!replace) { - uint64 chksum64 = (uint64)palchksum; - if (chksum) { - chksum64 <<= 32; - chksum64 |= (uint64)chksum; - } - if (isCached(chksum64)) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Error: already cached! duplicate texture!\n")); - continue; - } - } - - DBG_INFO(80, wst("rom: %ls chksum:%08X %08X fmt:%x size:%x\n"), _ident.c_str(), chksum, palchksum, fmt, siz); - - /* Deal with the wackiness some texture packs utilize Rice format. - * Read in the following order: _a.* + _rgb.*, _all.png _ciByRGBA.png, - * _allciByRGBA.png, and _ci.bmp. PNG are prefered over BMP. - * - * For some reason there are texture packs that include them all. Some - * even have RGB textures named as _all.* and ARGB textures named as - * _rgb.*... Someone pleeeez write a GOOD guideline for the texture - * designers!!! - * - * We allow hires textures to have higher bpp than the N64 originals. - */ - /* N64 formats - * Format: 0 - RGBA, 1 - YUV, 2 - CI, 3 - IA, 4 - I - * Size: 0 - 4bit, 1 - 8bit, 2 - 16bit, 3 - 32 bit - */ - - /* - * read in _rgb.* and _a.* - */ - if (pfname == strstr(fname, "_rgb.") || pfname == strstr(fname, "_a.")) { - strcpy(pfname, "_rgb.png"); - if (!osal_path_existsA(fname)) { - strcpy(pfname, "_rgb.bmp"); - if (!osal_path_existsA(fname)) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Error: missing _rgb.*! _a.* must be paired with _rgb.*!\n")); - continue; - } - } - /* _a.png */ - strcpy(pfname, "_a.png"); - if ((fp = fopen(fname, "rb")) != nullptr) { - tmptex = _txImage->readPNG(fp, &tmpwidth, &tmpheight, &tmpformat); - fclose(fp); - } - if (!tmptex) { - /* _a.bmp */ - strcpy(pfname, "_a.bmp"); - if ((fp = fopen(fname, "rb")) != nullptr) { - tmptex = _txImage->readBMP(fp, &tmpwidth, &tmpheight, &tmpformat); - fclose(fp); - } - } - /* _rgb.png */ - strcpy(pfname, "_rgb.png"); - if ((fp = fopen(fname, "rb")) != nullptr) { - tex = _txImage->readPNG(fp, &width, &height, &format); - fclose(fp); - } - if (!tex) { - /* _rgb.bmp */ - strcpy(pfname, "_rgb.bmp"); - if ((fp = fopen(fname, "rb")) != nullptr) { - tex = _txImage->readBMP(fp, &width, &height, &format); - fclose(fp); - } - } - if (tmptex) { - /* check if _rgb.* and _a.* have matching size and format. */ - if (!tex || width != tmpwidth || height != tmpheight || - format != graphics::internalcolorFormat::RGBA8 || tmpformat != graphics::internalcolorFormat::RGBA8) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - if (!tex) { - INFO(80, wst("Error: missing _rgb.*!\n")); - } - else if (width != tmpwidth || height != tmpheight) { - INFO(80, wst("Error: _rgb.* and _a.* have mismatched width or height!\n")); - } - else if (format != graphics::internalcolorFormat::RGBA8 || tmpformat != graphics::internalcolorFormat::RGBA8) { - INFO(80, wst("Error: _rgb.* or _a.* not in 32bit color!\n")); - } - if (tex) free(tex); - free(tmptex); - tex = nullptr; - tmptex = nullptr; - continue; - } - } - /* make adjustments */ - if (tex) { - if (tmptex) { - /* merge (A)RGB and A comp */ - DBG_INFO(80, wst("merge (A)RGB and A comp\n")); - int i; - for (i = 0; i < height * width; i++) { -#if 1 - /* use R comp for alpha. this is what Rice uses. sigh... */ - ((uint32*)tex)[i] &= 0x00ffffff; - ((uint32*)tex)[i] |= ((((uint32*)tmptex)[i] & 0xff) << 24); -#endif -#if 0 - /* use libpng style grayscale conversion */ - uint32 texel = ((uint32*)tmptex)[i]; - uint32 acomp = (((texel >> 16) & 0xff) * 6969 + - ((texel >> 8) & 0xff) * 23434 + - ((texel ) & 0xff) * 2365) / 32768; - ((uint32*)tex)[i] = (acomp << 24) | (((uint32*)tex)[i] & 0x00ffffff); -#endif -#if 0 - /* use the standard NTSC gray scale conversion */ - uint32 texel = ((uint32*)tmptex)[i]; - uint32 acomp = (((texel >> 16) & 0xff) * 299 + - ((texel >> 8) & 0xff) * 587 + - ((texel ) & 0xff) * 114) / 1000; - ((uint32*)tex)[i] = (acomp << 24) | (((uint32*)tex)[i] & 0x00ffffff); -#endif - } - free(tmptex); - tmptex = nullptr; - } - else { - /* clobber A comp. never a question of alpha. only RGB used. */ -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Warning: missing _a.*! only using _rgb.*. treat as opaque texture.\n")); - int i; - for (i = 0; i < height * width; i++) { - ((uint32*)tex)[i] |= 0xff000000; - } - } - } - } - else - - /* - * read in _all.png, _all.dds, _allciByRGBA.png, _allciByRGBA.dds - * _ciByRGBA.png, _ciByRGBA.dds, _ci.bmp - */ - if (pfname == strstr(fname, "_all.png") || - pfname == strstr(fname, "_all.dds") || -#ifdef OS_WINDOWS - pfname == strstr(fname, "_allcibyrgba.png") || - pfname == strstr(fname, "_allcibyrgba.dds") || - pfname == strstr(fname, "_cibyrgba.png") || - pfname == strstr(fname, "_cibyrgba.dds") || -#else - pfname == strstr(fname, "_allciByRGBA.png") || - pfname == strstr(fname, "_allciByRGBA.dds") || - pfname == strstr(fname, "_ciByRGBA.png") || - pfname == strstr(fname, "_ciByRGBA.dds") || -#endif - pfname == strstr(fname, "_ci.bmp")) { - if ((fp = fopen(fname, "rb")) != nullptr) { - if (strstr(fname, ".png")) - tex = _txImage->readPNG(fp, &width, &height, &format); - else - tex = _txImage->readBMP(fp, &width, &height, &format); - fclose(fp); - } - } - - /* if we do not have a texture at this point we are screwed */ - if (!tex) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Error: load failed!\n")); - continue; - } - DBG_INFO(80, wst("read in as %d x %d gfmt:%x\n"), tmpwidth, tmpheight, tmpformat); - - /* check if size and format are OK */ - if (!(format == graphics::internalcolorFormat::RGBA8 || format == graphics::internalcolorFormat::COLOR_INDEX8) || - (width * height) < 4) { /* TxQuantize requirement: width * height must be 4 or larger. */ - free(tex); - tex = nullptr; -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - INFO(80, wst("Error: not width * height > 4 or 8bit palette color or 32bpp or dxt1 or dxt3 or dxt5!\n")); - continue; - } - - /* analyze and determine best format to quantize */ - if (format == graphics::internalcolorFormat::RGBA8) { - int i; - int alphabits = 0; - int fullalpha = 0; - boolean intensity = 1; - - if (!(getOptions() & LET_TEXARTISTS_FLY)) { - /* HACK ALERT! */ - /* Account for Rice's weirdness with fmt:0 siz:2 textures. - * Although the conditions are relaxed with other formats, - * the D3D RGBA5551 surface is used for this format in certain - * cases. See Nintemod's SuperMario64 life gauge and power - * meter. The same goes for fmt:2 textures. See Mollymutt's - * PaperMario text. */ - if ((fmt == 0 && siz == 2) || fmt == 2) { - DBG_INFO(80, wst("Remove black, white, etc borders along the alpha edges.\n")); - /* round A comp */ - for (i = 0; i < height * width; i++) { - uint32 texel = ((uint32*)tex)[i]; - ((uint32*)tex)[i] = ((texel & 0xff000000) == 0xff000000 ? 0xff000000 : 0) | - (texel & 0x00ffffff); - } - /* Substitute texel color with the average of the surrounding - * opaque texels. This removes borders regardless of hardware - * texture filtering (bilinear, etc). */ - int j; - for (i = 0; i < height; i++) { - for (j = 0; j < width; j++) { - uint32 texel = ((uint32*)tex)[i * width + j]; - if ((texel & 0xff000000) != 0xff000000) { - uint32 tmptexel[8]; - uint32 k, numtexel, r, g, b; - numtexel = r = g = b = 0; - memset(&tmptexel, 0, sizeof(tmptexel)); - if (i > 0) { - tmptexel[0] = ((uint32*)tex)[(i - 1) * width + j]; /* north */ - if (j > 0) tmptexel[1] = ((uint32*)tex)[(i - 1) * width + j - 1]; /* north-west */ - if (j < width - 1) tmptexel[2] = ((uint32*)tex)[(i - 1) * width + j + 1]; /* north-east */ - } - if (i < height - 1) { - tmptexel[3] = ((uint32*)tex)[(i + 1) * width + j]; /* south */ - if (j > 0) tmptexel[4] = ((uint32*)tex)[(i + 1) * width + j - 1]; /* south-west */ - if (j < width - 1) tmptexel[5] = ((uint32*)tex)[(i + 1) * width + j + 1]; /* south-east */ - } - if (j > 0) tmptexel[6] = ((uint32*)tex)[i * width + j - 1]; /* west */ - if (j < width - 1) tmptexel[7] = ((uint32*)tex)[i * width + j + 1]; /* east */ - for (k = 0; k < 8; k++) { - if ((tmptexel[k] & 0xff000000) == 0xff000000) { - b += ((tmptexel[k] & 0x00ff0000) >> 16); - g += ((tmptexel[k] & 0x0000ff00) >> 8); - r += ((tmptexel[k] & 0x000000ff)); - numtexel++; - } - } - if (numtexel) { - ((uint32*)tex)[i * width + j] = ((b / numtexel) << 16) | - ((g / numtexel) << 8) | - ((r / numtexel)); - } - else { - ((uint32*)tex)[i * width + j] = texel & 0x00ffffff; - } - } - } - } - } - } - - /* simple analysis of texture */ - for (i = 0; i < height * width; i++) { - uint32 texel = ((uint32*)tex)[i]; - if (alphabits != 8) { -#if AGGRESSIVE_QUANTIZATION - if ((texel & 0xff000000) < 0x00000003) { - alphabits = 1; - fullalpha++; - } else if ((texel & 0xff000000) < 0xfe000000) { - alphabits = 8; - } -#else - if ((texel & 0xff000000) == 0x00000000) { - alphabits = 1; - fullalpha++; - } else if ((texel & 0xff000000) != 0xff000000) { - alphabits = 8; - } -#endif - } - if (intensity) { - int rcomp = (texel >> 16) & 0xff; - int gcomp = (texel >> 8) & 0xff; - int bcomp = (texel)& 0xff; -#if AGGRESSIVE_QUANTIZATION - if (abs(rcomp - gcomp) > 8 || abs(rcomp - bcomp) > 8 || abs(gcomp - bcomp) > 8) - intensity = 0; -#else - if (rcomp != gcomp || rcomp != bcomp || gcomp != bcomp) intensity = 0; -#endif - } - if (!intensity && alphabits == 8) - break; - } - DBG_INFO(80, wst("required alpha bits:%d zero acomp texels:%d rgb as intensity:%d\n"), alphabits, fullalpha, intensity); - - /* preparations based on above analysis */ - if (_maxbpp < 32 || getOptions() & FORCE16BPP_HIRESTEX) { - if (alphabits == 0) - destformat = graphics::internalcolorFormat::RGB8; - else if (alphabits == 1) - destformat = graphics::internalcolorFormat::RGB5_A1; - else - destformat = graphics::internalcolorFormat::RGBA8; - } - else { - destformat = graphics::internalcolorFormat::RGBA8; - } - if (fmt == 4 && alphabits == 0) { - destformat = graphics::internalcolorFormat::RGBA8; - /* Rice I format; I = (R + G + B) / 3 */ - for (i = 0; i < height * width; i++) { - uint32 texel = ((uint32*)tex)[i]; - uint32 icomp = (((texel >> 16) & 0xff) + - ((texel >> 8) & 0xff) + - ((texel)& 0xff)) / 3; - ((uint32*)tex)[i] = (icomp << 24) | (texel & 0x00ffffff); - } - } - - DBG_INFO(80, wst("best gfmt:%x\n"), u32(destformat)); - } - /* - * Rice hi-res textures: end */ - - - /* XXX: only RGBA8888 for now. comeback to this later... */ - if (format == graphics::internalcolorFormat::RGBA8) { - - /* minification */ - if (width > _maxwidth || height > _maxheight) { - int ratio = 1; - if (width / _maxwidth > height / _maxheight) { - ratio = (int)ceil((double)width / _maxwidth); - } - else { - ratio = (int)ceil((double)height / _maxheight); - } - if (!_txReSample->minify(&tex, &width, &height, ratio)) { - free(tex); - tex = nullptr; - DBG_INFO(80, wst("Error: minification failed!\n")); - continue; - } - } - -#if POW2_TEXTURES -#if (POW2_TEXTURES == 2) - /* 3dfx Glide3x aspect ratio (8:1 - 1:8) */ - if (!_txReSample->nextPow2(&tex, &width , &height, 32, 1)) { -#else - /* normal pow2 expansion */ - if (!_txReSample->nextPow2(&tex, &width , &height, 32, 0)) { -#endif - free(tex); - tex = nullptr; - DBG_INFO(80, wst("Error: aspect ratio adjustment failed!\n")); - continue; - } -#endif - - /* quantize */ - { - tmptex = (uint8 *)malloc(TxUtil::sizeofTx(width, height, destformat)); - if (tmptex == nullptr) { - free(tex); - tex = nullptr; - result = resError; - break; - } - if (destformat == graphics::internalcolorFormat::RGBA8 || - destformat == graphics::internalcolorFormat::RGBA4) { - if (_maxbpp < 32 || getOptions() & FORCE16BPP_HIRESTEX) - destformat = graphics::internalcolorFormat::RGBA4; - } - else if (destformat == graphics::internalcolorFormat::RGB5_A1) { - if (_maxbpp < 32 || getOptions() & FORCE16BPP_HIRESTEX) - destformat = graphics::internalcolorFormat::RGB5_A1; - } - if (_txQuantize->quantize(tex, tmptex, width, height, graphics::internalcolorFormat::RGBA8, destformat, 0)) { - format = destformat; - free(tex); - tex = tmptex; - } - else - free(tmptex); - tmptex = nullptr; - } - } - - - /* last minute validations */ - if (!tex || (!chksum && !hasWildcard) || !width || !height || format == graphics::internalcolorFormat::NOCOLOR || width > _maxwidth || height > _maxheight) { -#if !DEBUG - INFO(80, wst("-----\n")); - INFO(80, wst("path: %ls\n"), dir_path.string().c_str()); - INFO(80, wst("file: %ls\n"), it->path().leaf().c_str()); -#endif - if (tex) { - free(tex); - tex = nullptr; - INFO(80, wst("Error: bad format or size! %d x %d gfmt:%x\n"), width, height, u32(format)); - } - else { - INFO(80, wst("Error: load failed!!\n")); - } - continue; - } - - /* load it into hires texture cache. */ - { - uint64 chksum64 = (uint64)palchksum; - if (chksum) { - chksum64 <<= 32; - chksum64 |= (uint64)chksum; - } - - GHQTexInfo tmpInfo; - tmpInfo.data = tex; - tmpInfo.width = width; - tmpInfo.height = height; - tmpInfo.is_hires_tex = 1; - setTextureFormat(format, &tmpInfo); - - /* remove redundant in cache */ - if (replace && TxCache::del(chksum64)) { - DBG_INFO(80, wst("removed duplicate old cache.\n")); - } - - /* add to cache */ - const boolean added = TxCache::add(chksum64, &tmpInfo); - free(tex); - if (added) { - /* Callback to display hires texture info. - * Gonetz */ - if (_callback) { - wchar_t tmpbuf[MAX_PATH]; - mbstowcs(tmpbuf, fname, MAX_PATH); - (*_callback)(wst("[%d] total mem:%.2fmb - %ls\n"), int(size()), (totalSize() / 1024) / 1024.0f, tmpbuf); - } - DBG_INFO(80, wst("texture loaded!\n")); - } - else { - result = resError; - break; - } - } - - } while (foundfilename != nullptr); - osal_search_dir_close(dir); - - CHDIR(curpath); - - return result; -} diff --git a/GLideN64/src/GLideNHQ/TxHiResCache.h b/GLideN64/src/GLideNHQ/TxHiResCache.h deleted file mode 100644 index 1326ce9..0000000 --- a/GLideN64/src/GLideNHQ/TxHiResCache.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXHIRESCACHE_H__ -#define __TXHIRESCACHE_H__ - -/* support hires textures - * 0: disable - * 1: enable - */ -#define HIRES_TEXTURE 1 - -#include "TxCache.h" -#include "TxQuantize.h" -#include "TxImage.h" -#include "TxReSample.h" - -class TxHiResCache : public TxCache -{ -private: - int _maxwidth; - int _maxheight; - int _maxbpp; - bool _abortLoad; - bool _cacheDumped; - std::unique_ptr _txImage; - std::unique_ptr _txQuantize; - std::unique_ptr _txReSample; - tx_wstring _texPackPath; - enum LoadResult { - resOk, - resNotFound, - resError - }; - LoadResult loadHiResTextures(const wchar_t * dir_path, boolean replace); - boolean _HiResTexPackPathExists() const; - tx_wstring _getFileName() const override; - int _getConfig() const override; - -public: - ~TxHiResCache(); - TxHiResCache(int maxwidth, - int maxheight, - int maxbpp, - int options, - const wchar_t *cachePath, - const wchar_t *texPackPath, - const wchar_t *ident, - dispInfoFuncExt callback); - bool load(boolean replace); - void dump(); -}; - -#endif /* __TXHIRESCACHE_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxImage.cpp b/GLideN64/src/GLideNHQ/TxImage.cpp deleted file mode 100644 index 9262b99..0000000 --- a/GLideN64/src/GLideNHQ/TxImage.cpp +++ /dev/null @@ -1,637 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* use power of 2 texture size - * (0:disable, 1:enable, 2:3dfx) */ -#define POW2_TEXTURES 0 - -/* check 8 bytes. use a larger value if needed. */ -#define PNG_CHK_BYTES 8 - -#include -#include -#include - -#include "TxImage.h" -#include "TxReSample.h" -#include "TxDbg.h" - -boolean -TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr) -{ - unsigned char sig[PNG_CHK_BYTES]; - - /* check for valid file pointer */ - if (!fp) - return 0; - - /* check if file is PNG */ - if (fread(sig, 1, PNG_CHK_BYTES, fp) != PNG_CHK_BYTES) - return 0; - - if (png_sig_cmp(sig, 0, PNG_CHK_BYTES) != 0) - return 0; - - /* get PNG file info */ - *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (!*png_ptr) - return 0; - - *info_ptr = png_create_info_struct(*png_ptr); - if (!*info_ptr) { - png_destroy_read_struct(png_ptr, nullptr, nullptr); - return 0; - } - - if (setjmp(png_jmpbuf(*png_ptr))) { - DBG_INFO(80, wst("error reading png!\n")); - png_destroy_read_struct(png_ptr, info_ptr, nullptr); - return 0; - } - - png_init_io(*png_ptr, fp); - png_set_sig_bytes(*png_ptr, PNG_CHK_BYTES); - png_read_info(*png_ptr, *info_ptr); - - return 1; -} - -uint8* -TxImage::readPNG(FILE* fp, int* width, int* height, ColorFormat *format) -{ - /* NOTE: returned image format is GR_TEXFMT_ARGB_8888 */ - - png_structp png_ptr; - png_infop info_ptr; - uint8 *image = nullptr; - int bit_depth, color_type, interlace_type, compression_type, filter_type, - row_bytes, o_width, o_height, num_pas; - - /* initialize */ - *width = 0; - *height = 0; - *format = graphics::internalcolorFormat::NOCOLOR; - - /* check if we have a valid png file */ - if (!fp) - return nullptr; - - if (!getPNGInfo(fp, &png_ptr, &info_ptr)) { - INFO(80, wst("error reading png file! png image is corrupt.\n")); - return nullptr; - } - - png_get_IHDR(png_ptr, info_ptr, - (png_uint_32*)&o_width, (png_uint_32*)&o_height, &bit_depth, &color_type, - &interlace_type, &compression_type, &filter_type); - - DBG_INFO(80, wst("png format %d x %d bitdepth:%d color:%x interlace:%x compression:%x filter:%x\n"), - o_width, o_height, bit_depth, color_type, - interlace_type, compression_type, filter_type); - - /* transformations */ - - /* Rice hi-res textures - * _all.png - * _rgb.png, _a.png - * _ciByRGBA.png - * _allciByRGBA.png - */ - - /* strip if color channel is larger than 8 bits */ - if (bit_depth > 8) { - png_set_strip_16(png_ptr); - bit_depth = 8; - } - -#if 1 - /* These are not really required per Rice format spec, - * but is done just in case someone uses them. - */ - /* convert palette color to rgb color */ - if (color_type == PNG_COLOR_TYPE_PALETTE) { - png_set_palette_to_rgb(png_ptr); - color_type = PNG_COLOR_TYPE_RGB; - } - - /* expand 1,2,4 bit gray scale to 8 bit gray scale */ - if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) - png_set_expand_gray_1_2_4_to_8(png_ptr); - - /* convert gray scale or gray scale + alpha to rgb color */ - if (color_type == PNG_COLOR_TYPE_GRAY || - color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { - png_set_gray_to_rgb(png_ptr); - color_type = PNG_COLOR_TYPE_RGB; - } -#endif - - /* add alpha channel if any */ - if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { - png_set_tRNS_to_alpha(png_ptr); - color_type = PNG_COLOR_TYPE_RGB_ALPHA; - } - - /* convert rgb to rgba */ - if (color_type == PNG_COLOR_TYPE_RGB) { - png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); - color_type = PNG_COLOR_TYPE_RGB_ALPHA; - } - - /* punt invalid formats */ - if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) { - png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); - DBG_INFO(80, wst("Error: not PNG_COLOR_TYPE_RGB_ALPHA format!\n")); - return nullptr; - } - - /*png_color_8p sig_bit; - if (png_get_sBIT(png_ptr, info_ptr, &sig_bit)) - png_set_shift(png_ptr, sig_bit);*/ - - /* convert rgba to bgra */ - //png_set_bgr(png_ptr); // OpenGL does not need it - - /* turn on interlace handling to cope with the weirdness - * of texture authors using interlaced format */ - num_pas = png_set_interlace_handling(png_ptr); - - /* update info structure */ - png_read_update_info(png_ptr, info_ptr); - - /* we only get here if RGBA8888 */ - row_bytes = static_cast(png_get_rowbytes(png_ptr, info_ptr)); - - /* allocate memory to read in image */ - image = (uint8*)malloc(row_bytes * o_height); - - /* read in image */ - if (image) { - int pas, i; - uint8* tmpimage; - - for (pas = 0; pas < num_pas; pas++) { /* deal with interlacing */ - tmpimage = image; - - for (i = 0; i < o_height; i++) { - /* copy row */ - png_read_rows(png_ptr, &tmpimage, nullptr, 1); - tmpimage += row_bytes; - } - } - - /* read rest of the info structure */ - png_read_end(png_ptr, info_ptr); - - *width = (row_bytes >> 2); - *height = o_height; - *format = graphics::internalcolorFormat::RGBA8; - -#if POW2_TEXTURES - /* next power of 2 size conversions */ - /* NOTE: I can do this in the above loop for faster operations, but some - * texture packs require a workaround. see HACKALERT in nextPow2(). - */ - - TxReSample txReSample = new TxReSample; // XXX: temporary. move to a better place. - -#if (POW2_TEXTURES == 2) - if (!txReSample->nextPow2(&image, width, height, 32, 1)) { -#else - if (!txReSample->nextPow2(&image, width, height, 32, 0)) { -#endif - if (image) { - free(image); - image = nullptr; - } - *width = 0; - *height = 0; - *format = graphics::internalcolorFormat::NOCOLOR; - } - - delete txReSample; - -#endif /* POW2_TEXTURES */ - } - - /* clean up */ - png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); - -#ifdef DEBUG - if (!image) { - DBG_INFO(80, wst("Error: failed to load png image!\n")); - } -#endif - - return image; -} - -boolean -TxImage::writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, ColorFormat format) -{ - assert(format == graphics::internalcolorFormat::RGBA8); - png_structp png_ptr = nullptr; - png_infop info_ptr = nullptr; - png_color_8 sig_bit; - int bit_depth = 0, color_type = 0, row_bytes = 0; - int i = 0; - - if (!src || !fp) - return 0; - - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (png_ptr == nullptr) - return 0; - - info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == nullptr) { - png_destroy_write_struct(&png_ptr, nullptr); - return 0; - } - - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_write_struct(&png_ptr, &info_ptr); - return 0; - } - - png_init_io(png_ptr, fp); - - bit_depth = 8; - sig_bit.red = 8; - sig_bit.green = 8; - sig_bit.blue = 8; - sig_bit.alpha = 8; - color_type = PNG_COLOR_TYPE_RGB_ALPHA; - - //row_bytes = (bit_depth * width) >> 1; - row_bytes = rowStride; - //png_set_bgr(png_ptr); // OpenGL does not need it - png_set_sBIT(png_ptr, info_ptr, &sig_bit); - - png_set_IHDR(png_ptr, info_ptr, width, height, - bit_depth, color_type, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - - png_write_info(png_ptr, info_ptr); - for (i = 0; i < height; i++) { - png_write_row(png_ptr, (png_bytep)src); - src += row_bytes; - } - png_write_end(png_ptr, info_ptr); - - png_destroy_write_struct(&png_ptr, &info_ptr); - - return 1; -} - -boolean -TxImage::getBMPInfo(FILE* fp, BITMAPFILEHEADER* bmp_fhdr, BITMAPINFOHEADER* bmp_ihdr) -{ - /* - * read in BITMAPFILEHEADER - */ - - /* is this a BMP file? */ - if (fread(&bmp_fhdr->bfType, 2, 1, fp) != 1) - return 0; - - if (memcmp(&bmp_fhdr->bfType, "BM", 2) != 0) - return 0; - - /* get file size */ - if (fread(&bmp_fhdr->bfSize, 4, 1, fp) != 1) - return 0; - - /* reserved 1 */ - if (fread(&bmp_fhdr->bfReserved1, 2, 1, fp) != 1) - return 0; - - /* reserved 2 */ - if (fread(&bmp_fhdr->bfReserved2, 2, 1, fp) != 1) - return 0; - - /* offset to the image data */ - if (fread(&bmp_fhdr->bfOffBits, 4, 1, fp) != 1) - return 0; - - /* - * read in BITMAPINFOHEADER - */ - - /* size of BITMAPINFOHEADER */ - if (fread(&bmp_ihdr->biSize, 4, 1, fp) != 1) - return 0; - - /* is this a Windows BMP? */ - if (bmp_ihdr->biSize != 40) - return 0; - - /* width of the bitmap in pixels */ - if (fread(&bmp_ihdr->biWidth, 4, 1, fp) != 1) - return 0; - - /* height of the bitmap in pixels */ - if (fread(&bmp_ihdr->biHeight, 4, 1, fp) != 1) - return 0; - - /* number of planes (always 1) */ - if (fread(&bmp_ihdr->biPlanes, 2, 1, fp) != 1) - return 0; - - /* number of bits-per-pixel. (1, 4, 8, 16, 24, 32) */ - if (fread(&bmp_ihdr->biBitCount, 2, 1, fp) != 1) - return 0; - - /* compression for a compressed bottom-up bitmap - * 0 : uncompressed format - * 1 : run-length encoded 4 bpp format - * 2 : run-length encoded 8 bpp format - * 3 : bitfield - */ - if (fread(&bmp_ihdr->biCompression, 4, 1, fp) != 1) - return 0; - - /* size of the image in bytes */ - if (fread(&bmp_ihdr->biSizeImage, 4, 1, fp) != 1) - return 0; - - /* horizontal resolution in pixels-per-meter */ - if (fread(&bmp_ihdr->biXPelsPerMeter, 4, 1, fp) != 1) - return 0; - - /* vertical resolution in pixels-per-meter */ - if (fread(&bmp_ihdr->biYPelsPerMeter, 4, 1, fp) != 1) - return 0; - - /* number of color indexes in the color table that are actually used */ - if (fread(&bmp_ihdr->biClrUsed, 4, 1, fp) != 1) - return 0; - - /* the number of color indexes that are required for displaying */ - if (fread(&bmp_ihdr->biClrImportant, 4, 1, fp) != 1) - return 0; - - return 1; -} - -uint8* -TxImage::readBMP(FILE* fp, int* width, int* height, ColorFormat *format) -{ - /* NOTE: returned image format; - * 4, 8bit palette bmp -> COLOR_INDEX8 - * 24, 32bit bmp -> RGBA8 - */ - - uint8 *image = nullptr; - uint8 *image_row = nullptr; - uint8 *tmpimage = nullptr; - int row_bytes, pos, i, j; - /* Windows Bitmap */ - BITMAPFILEHEADER bmp_fhdr; - BITMAPINFOHEADER bmp_ihdr; - - /* initialize */ - *width = 0; - *height = 0; - *format = graphics::internalcolorFormat::NOCOLOR; - - /* check if we have a valid bmp file */ - if (!fp) - return nullptr; - - if (!getBMPInfo(fp, &bmp_fhdr, &bmp_ihdr)) { - INFO(80, wst("error reading bitmap file! bitmap image is corrupt.\n")); - return nullptr; - } - - DBG_INFO(80, wst("bmp format %d x %d bitdepth:%d compression:%x offset:%d\n"), - bmp_ihdr.biWidth, bmp_ihdr.biHeight, bmp_ihdr.biBitCount, - bmp_ihdr.biCompression, bmp_fhdr.bfOffBits); - - /* rowStride in bytes */ - row_bytes = (bmp_ihdr.biWidth * bmp_ihdr.biBitCount) >> 3; - /* align to 4bytes boundary */ - row_bytes = (row_bytes + 3) & ~3; - - /* Rice hi-res textures */ - if (!(bmp_ihdr.biBitCount == 8 || bmp_ihdr.biBitCount == 4 || bmp_ihdr.biBitCount == 32 || bmp_ihdr.biBitCount == 24) || - bmp_ihdr.biCompression != 0) { - DBG_INFO(80, wst("Error: incompatible bitmap format!\n")); - return nullptr; - } - - switch (bmp_ihdr.biBitCount) { - case 8: - case 32: - /* 8 bit, 32 bit bitmap */ - image = (uint8*)malloc(row_bytes * bmp_ihdr.biHeight); - if (image) { - tmpimage = image; - pos = bmp_fhdr.bfOffBits + row_bytes * (bmp_ihdr.biHeight - 1); - for (i = 0; i < bmp_ihdr.biHeight; i++) { - /* read in image */ - fseek(fp, pos, SEEK_SET); - fread(tmpimage, row_bytes, 1, fp); - tmpimage += row_bytes; - pos -= row_bytes; - } - } - break; - case 4: - /* 4bit bitmap */ - image = (uint8*)malloc((row_bytes * bmp_ihdr.biHeight) << 1); - image_row = (uint8*)malloc(row_bytes); - if (image && image_row) { - tmpimage = image; - pos = bmp_fhdr.bfOffBits + row_bytes * (bmp_ihdr.biHeight - 1); - for (i = 0; i < bmp_ihdr.biHeight; i++) { - /* read in image */ - fseek(fp, pos, SEEK_SET); - fread(image_row, row_bytes, 1, fp); - /* expand 4bpp to 8bpp. stuff 4bit values into 8bit comps. */ - for (j = 0; j < row_bytes; j++) { - tmpimage[j << 1] = image_row[j] & 0x0f; - tmpimage[(j << 1) + 1] = (image_row[j] & 0xf0) >> 4; - } - tmpimage += (row_bytes << 1); - pos -= row_bytes; - } - free(image_row); - } else { - if (image_row) free(image_row); - if (image) free(image); - image = nullptr; - } - break; - case 24: - /* 24 bit bitmap */ - image = (uint8*)malloc((bmp_ihdr.biWidth * bmp_ihdr.biHeight) << 2); - image_row = (uint8*)malloc(row_bytes); - if (image && image_row) { - tmpimage = image; - pos = bmp_fhdr.bfOffBits + row_bytes * (bmp_ihdr.biHeight - 1); - for (i = 0; i < bmp_ihdr.biHeight; i++) { - /* read in image */ - fseek(fp, pos, SEEK_SET); - fread(image_row, row_bytes, 1, fp); - /* convert 24bpp to 32bpp. */ - for (j = 0; j < bmp_ihdr.biWidth; j++) { - tmpimage[(j << 2)] = image_row[j * 3]; - tmpimage[(j << 2) + 1] = image_row[j * 3 + 1]; - tmpimage[(j << 2) + 2] = image_row[j * 3 + 2]; - tmpimage[(j << 2) + 3] = 0xFF; - } - tmpimage += (bmp_ihdr.biWidth << 2); - pos -= row_bytes; - } - free(image_row); - } else { - if (image_row) free(image_row); - if (image) free(image); - image = nullptr; - } - } - - if (image) { - *width = (row_bytes << 3) / bmp_ihdr.biBitCount; - *height = bmp_ihdr.biHeight; - - switch (bmp_ihdr.biBitCount) { - case 8: - case 4: - *format = graphics::internalcolorFormat::COLOR_INDEX8; - break; - case 32: - case 24: - *format = graphics::internalcolorFormat::RGBA8; - } - -#if POW2_TEXTURES - /* next power of 2 size conversions */ - /* NOTE: I can do this in the above loop for faster operations, but some - * texture packs require a workaround. see HACKALERT in nextPow2(). - */ - - TxReSample txReSample = new TxReSample; // XXX: temporary. move to a better place. - -#if (POW2_TEXTURES == 2) - if (!txReSample->nextPow2(&image, width, height, 8, 1)) { -#else - if (!txReSample->nextPow2(&image, width, height, 8, 0)) { -#endif - if (image) { - free(image); - image = nullptr; - } - *width = 0; - *height = 0; - *format = graphics::internalcolorFormat::NOCOLOR; - } - - delete txReSample; - -#endif /* POW2_TEXTURES */ - } - -#ifdef DEBUG - if (!image) { - DBG_INFO(80, wst("Error: failed to load bmp image!\n")); - } -#endif - - return image; -} - -boolean -TxImage::getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr) -{ - /* - * read in DDSFILEHEADER - */ - - /* is this a DDS file? */ - if (fread(&dds_fhdr->dwMagic, 4, 1, fp) != 1) - return 0; - - if (memcmp(&dds_fhdr->dwMagic, "DDS ", 4) != 0) - return 0; - - if (fread(&dds_fhdr->dwSize, 4, 1, fp) != 1) - return 0; - - /* get file flags */ - if (fread(&dds_fhdr->dwFlags, 4, 1, fp) != 1) - return 0; - - /* height of dds in pixels */ - if (fread(&dds_fhdr->dwHeight, 4, 1, fp) != 1) - return 0; - - /* width of dds in pixels */ - if (fread(&dds_fhdr->dwWidth, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->dwLinearSize, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->dwDepth, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->dwMipMapCount, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->dwReserved1, 4 * 11, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwSize, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwFlags, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwFourCC, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwRGBBitCount, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwRBitMask, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwGBitMask, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwBBitMask, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->ddpf.dwRGBAlphaBitMask, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->dwCaps1, 4, 1, fp) != 1) - return 0; - - if (fread(&dds_fhdr->dwCaps2, 4, 1, fp) != 1) - return 0; - - return 1; -} diff --git a/GLideN64/src/GLideNHQ/TxImage.h b/GLideN64/src/GLideNHQ/TxImage.h deleted file mode 100644 index 91f07d9..0000000 --- a/GLideN64/src/GLideNHQ/TxImage.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXIMAGE_H__ -#define __TXIMAGE_H__ - -#include -#include -#include "TxInternal.h" - -#ifndef WIN32 -typedef struct tagBITMAPFILEHEADER { - unsigned short bfType; - unsigned long bfSize; - unsigned short bfReserved1; - unsigned short bfReserved2; - unsigned long bfOffBits; -} BITMAPFILEHEADER; - -typedef struct tagBITMAPINFOHEADER { - unsigned long biSize; - long biWidth; - long biHeight; - unsigned short biPlanes; - unsigned short biBitCount; - unsigned long biCompression; - unsigned long biSizeImage; - long biXPelsPerMeter; - long biYPelsPerMeter; - unsigned long biClrUsed; - unsigned long biClrImportant; -} BITMAPINFOHEADER; -#else -typedef struct tagBITMAPFILEHEADER BITMAPFILEHEADER; -typedef struct tagBITMAPINFOHEADER BITMAPINFOHEADER; -#endif - -#define DDSD_CAPS 0x00000001 -#define DDSD_HEIGHT 0x00000002 -#define DDSD_WIDTH 0x00000004 -#define DDSD_PITCH 0x00000008 -#define DDSD_PIXELFORMAT 0x00001000 -#define DDSD_MIPMAPCOUNT 0x00020000 -#define DDSD_LINEARSIZE 0x00080000 -#define DDSD_DEPTH 0x00800000 - -#define DDPF_ALPHAPIXELS 0x00000001 -#define DDPF_FOURCC 0x00000004 -#define DDPF_RGB 0x00000040 - -#define DDSCAPS_COMPLEX 0x00000008 -#define DDSCAPS_TEXTURE 0x00001000 -#define DDSCAPS_MIPMAP 0x00400000 - -typedef struct tagDDSPIXELFORMAT { - unsigned long dwSize; - unsigned long dwFlags; - unsigned long dwFourCC; - unsigned long dwRGBBitCount; - unsigned long dwRBitMask; - unsigned long dwGBitMask; - unsigned long dwBBitMask; - unsigned long dwRGBAlphaBitMask; -} DDSPIXELFORMAT; - -typedef struct tagDDSFILEHEADER { - unsigned long dwMagic; - unsigned long dwSize; - unsigned long dwFlags; - unsigned long dwHeight; - unsigned long dwWidth; - unsigned long dwLinearSize; - unsigned long dwDepth; - unsigned long dwMipMapCount; - unsigned long dwReserved1[11]; - DDSPIXELFORMAT ddpf; - unsigned long dwCaps1; - unsigned long dwCaps2; -} DDSFILEHEADER; - -class TxImage -{ -private: - boolean getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr); - boolean getBMPInfo(FILE *fp, BITMAPFILEHEADER *bmp_fhdr, BITMAPINFOHEADER *bmp_ihdr); - boolean getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr); -public: - TxImage() {} - ~TxImage() {} - uint8* readPNG(FILE* fp, int* width, int* height, ColorFormat* format); - boolean writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, ColorFormat format/*, uint8 *palette*/); - uint8* readBMP(FILE* fp, int* width, int* height, ColorFormat* format); -}; - -#endif /* __TXIMAGE_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxInternal.h b/GLideN64/src/GLideNHQ/TxInternal.h deleted file mode 100644 index 7a387aa..0000000 --- a/GLideN64/src/GLideNHQ/TxInternal.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __INTERNAL_H__ -#define __INTERNAL_H__ - -#include "Ext_TxFilter.h" -#include "txWidestringWrapper.h" - -#include - -#ifdef WIN32 -#define KBHIT(key) ((GetAsyncKeyState(key) & 0x8001) == 0x8001) -#else -#define KBHIT(key) (0) -#endif - -typedef graphics::InternalColorFormatParam ColorFormat; - -/* in-memory zlib texture compression */ -#define GL_TEXFMT_GZ 0x80000000 - -#endif /* __INTERNAL_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxQuantize.cpp b/GLideN64/src/GLideNHQ/TxQuantize.cpp deleted file mode 100644 index 97c3e8f..0000000 --- a/GLideN64/src/GLideNHQ/TxQuantize.cpp +++ /dev/null @@ -1,946 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef __MSC__ -#pragma warning(disable: 4786) -#endif - -/* NOTE: The codes are not optimized. They can be made faster. */ - -#include -#include -#include - -#include "TxQuantize.h" - -static const unsigned char One2Eight[2] = -{ - 0, // 0 = 00000000 - 255, // 1 = 11111111 -}; - -static const unsigned char Five2Eight[32] = -{ - 0, // 00000 = 00000000 - 8, // 00001 = 00001000 - 16, // 00010 = 00010000 - 25, // 00011 = 00011001 - 33, // 00100 = 00100001 - 41, // 00101 = 00101001 - 49, // 00110 = 00110001 - 58, // 00111 = 00111010 - 66, // 01000 = 01000010 - 74, // 01001 = 01001010 - 82, // 01010 = 01010010 - 90, // 01011 = 01011010 - 99, // 01100 = 01100011 - 107, // 01101 = 01101011 - 115, // 01110 = 01110011 - 123, // 01111 = 01111011 - 132, // 10000 = 10000100 - 140, // 10001 = 10001100 - 148, // 10010 = 10010100 - 156, // 10011 = 10011100 - 165, // 10100 = 10100101 - 173, // 10101 = 10101101 - 181, // 10110 = 10110101 - 189, // 10111 = 10111101 - 197, // 11000 = 11000101 - 206, // 11001 = 11001110 - 214, // 11010 = 11010110 - 222, // 11011 = 11011110 - 230, // 11100 = 11100110 - 239, // 11101 = 11101111 - 247, // 11110 = 11110111 - 255 // 11111 = 11111111 -}; - -TxQuantize::TxQuantize() -{ - /* get number of CPU cores. */ - _numcore = TxUtil::getNumberofProcessors(); -} - - -TxQuantize::~TxQuantize() -{ -} - -void -TxQuantize::ARGB1555_ARGB8888(uint32* src, uint32* dest, int width, int height) -{ - const int siz = (width * height) >> 1; - uint8 r, g, b, a; - uint32 color; - for (int i = 0; i < siz; ++i) { - color = (*src) & 0xffff; - r = Five2Eight[color >> 11]; - g = Five2Eight[(color >> 6) & 0x001f]; - b = Five2Eight[(color >> 1) & 0x001f]; - a = One2Eight [(color ) & 0x0001]; - *dest = (a << 24) | (b << 16) | (g << 8) | r; - ++dest; - color = (*src) >> 16; - r = Five2Eight[color >> 11]; - g = Five2Eight[(color >> 6) & 0x001f]; - b = Five2Eight[(color >> 1) & 0x001f]; - a = One2Eight [(color ) & 0x0001]; - *dest = (a << 24) | (b << 16) | (g << 8) | r; - ++dest; - ++src; - } -} - -void -TxQuantize::ARGB4444_ARGB8888(uint32* src, uint32* dest, int width, int height) -{ - const int siz = (width * height) >> 1; - for (int i = 0; i < siz; ++i) { - *dest = ((*src & 0x0000f000) >> 8 ) | - ((*src & 0x00000f00) << 4 ) | - ((*src & 0x000000f0) << 16) | - ((*src & 0x0000000f) << 28); - *dest |= (*dest >> 4); - dest++; - *dest = ((*src & 0xf0000000) >> 24) | - ((*src & 0x0f000000) >> 12) | - ((*src & 0x00f00000) >> 0 ) | - ((*src & 0x000f0000) << 12); - *dest |= (*dest >> 4); - dest++; - src++; - } -} - -void -TxQuantize::RGB565_ARGB8888(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 1; - int i; - for (i = 0; i < siz; i++) { - *dest = (0xff000000 | - ((*src & 0x0000f800) << 8) | ((*src & 0x0000e000) << 3) | - ((*src & 0x000007e0) << 5) | ((*src & 0x00000600) >> 1) | - ((*src & 0x0000001f) << 3) | ((*src & 0x0000001c) >> 2)); - dest++; - *dest = (0xff000000 | - ((*src & 0xf8000000) >> 8) | ((*src & 0xe0000000) >> 13) | - ((*src & 0x07e00000) >> 11) | ((*src & 0x06000000) >> 17) | - ((*src & 0x001f0000) >> 13) | ((*src & 0x001c0000) >> 18)); - dest++; - src++; - } -} - -void -TxQuantize::A8_ARGB8888(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 2; - int i; - for (i = 0; i < siz; i++) { - *dest = (*src & 0x000000ff); - *dest |= (*dest << 8); - *dest |= (*dest << 16); - dest++; - *dest = (*src & 0x0000ff00); - *dest |= (*dest >> 8); - *dest |= (*dest << 16); - dest++; - *dest = (*src & 0x00ff0000); - *dest |= (*dest << 8); - *dest |= (*dest >> 16); - dest++; - *dest = (*src & 0xff000000); - *dest |= (*dest >> 8); - *dest |= (*dest >> 16); - dest++; - src++; - } -} - -void -TxQuantize::AI44_ARGB8888(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 2; - int i; - for (i = 0; i < siz; i++) { - *dest = (*src & 0x0000000f); - *dest |= ((*dest << 8) | (*dest << 16)); - *dest |= ((*src & 0x000000f0) << 20); - *dest |= (*dest << 4); - dest++; - *dest = (*src & 0x00000f00); - *dest |= ((*dest << 8) | (*dest >> 8)); - *dest |= ((*src & 0x0000f000) << 12); - *dest |= (*dest << 4); - dest++; - *dest = (*src & 0x000f0000); - *dest |= ((*dest >> 8) | (*dest >> 16)); - *dest |= ((*src & 0x00f00000) << 4); - *dest |= (*dest << 4); - dest++; - *dest = ((*src & 0x0f000000) >> 4); - *dest |= ((*dest >> 8) | (*dest >> 16)); - *dest |= (*src & 0xf0000000); - *dest |= (*dest >> 4); - dest++; - src++; - } -} - -void -TxQuantize::AI88_ARGB8888(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 1; - int i; - for (i = 0; i < siz; i++) { - *dest = (*src & 0x000000ff); - *dest |= ((*dest << 8) | (*dest << 16)); - *dest |= ((*src & 0x0000ff00) << 16); - dest++; - *dest = (*src & 0x00ff0000); - *dest |= ((*dest >> 8) | (*dest >> 16)); - *dest |= (*src & 0xff000000); - dest++; - src++; - } -} - -void -TxQuantize::ARGB8888_ARGB1555(uint32* src, uint32* dest, int width, int height) -{ - const int siz = (width * height) >> 1; - uint32 color; - uint32 r, g, b; - for (int i = 0; i < siz; i++) { - color = *src; - *dest = ((color & 0xff000000) ? 0x0001 : 0x0000); - r = (color & 0x000000FF) >> 3; - g = (color & 0x0000FF00) >> 11; - b = (color & 0x00FF0000) >> 19; - *dest |= (r<<11)|(g<<6)|(b<<1); - src++; - color = *src; - *dest |= ((color & 0xff000000) ? 0x00010000 : 0x0000); - r = (color & 0x000000FF) >> 3; - g = (color & 0x0000FF00) >> 11; - b = (color & 0x00FF0000) >> 19; - *dest |= (r<<27)|(g<<22)|(b<<17); - src++; - dest++; - } -} - -void -TxQuantize::ARGB8888_ARGB4444(uint32* src, uint32* dest, int width, int height) -{ - const int siz = (width * height) >> 1; - for (int i = 0; i < siz; ++i) { - *dest = (((*src & 0xf0000000) >> 28) | - ((*src & 0x00f00000) >> 16) | - ((*src & 0x0000f000) >> 4) | - ((*src & 0x000000f0) << 8)); - src++; - *dest |= (((*src & 0xf0000000) >> 12) | - ((*src & 0x00f00000) << 0) | - ((*src & 0x0000f000) << 12) | - ((*src & 0x000000f0) << 24)); - src++; - dest++; - } -} - -void -TxQuantize::ARGB8888_RGB565(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 1; - int i; - for (i = 0; i < siz; i++) { - *dest = (((*src & 0x000000f8) >> 3) | - ((*src & 0x0000fc00) >> 5) | - ((*src & 0x00f80000) >> 8)); - src++; - *dest |= (((*src & 0x000000f8) << 13) | - ((*src & 0x0000fc00) << 11) | - ((*src & 0x00f80000) << 8)); - src++; - dest++; - } -} - -void -TxQuantize::ARGB8888_A8(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 2; - int i; - for (i = 0; i < siz; i++) { - *dest = (*src & 0x0000ff00) >> 8; - src++; - *dest |= (*src & 0x0000ff00); - src++; - *dest |= ((*src & 0x0000ff00) << 8); - src++; - *dest |= ((*src & 0x0000ff00) << 16); - src++; - dest++; - } -} - -void -TxQuantize::ARGB8888_AI44(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 2; - int i; - for (i = 0; i < siz; i++) { - *dest = (((*src & 0xf0000000) >> 24) | ((*src & 0x0000f000) >> 12)); - src++; - *dest |= (((*src & 0xf0000000) >> 16) | ((*src & 0x0000f000) >> 4)); - src++; - *dest |= (((*src & 0xf0000000) >> 8) | ((*src & 0x0000f000) << 4)); - src++; - *dest |= ((*src & 0xf0000000) | ((*src & 0x0000f000) << 12)); - src++; - dest++; - } -} - -void -TxQuantize::ARGB8888_AI88(uint32* src, uint32* dest, int width, int height) -{ - int siz = (width * height) >> 1; - int i; - for (i = 0; i < siz; i++) { - *dest = (((*src & 0xff000000) >> 16) | ((*src & 0x0000ff00) >> 8)); - src++; - *dest |= ((*src & 0xff000000) | ((*src & 0x0000ff00) << 8)); - src++; - dest++; - } -} - -/* R.W. Floyd and L. Steinberg, An adaptive algorithm - * for spatial grey scale, Proceedings of the Society - * of Information Display 17, pp75-77, 1976 - */ -void -TxQuantize::ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height) -{ - /* Floyd-Steinberg error-diffusion halftoning */ - - int i, x, y; - int qr, qg, qb; /* quantized incoming values */ - int ir, ig, ib; /* incoming values */ - int t; - int *errR = new int[width]; - int *errG = new int[width]; - int *errB = new int[width]; - - uint16 *dest = (uint16 *)dst; - - for (i = 0; i < width; i++) errR[i] = errG[i] = errB[i] = 0; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - /* incoming pixel values */ - ir = ((*src >> 16) & 0xFF) * 10000; - ig = ((*src >> 8) & 0xFF) * 10000; - ib = ((*src ) & 0xFF) * 10000; - - if (x == 0) qr = qg = qb = 0; - - /* quantize pixel values. - * qr * 0.4375 is the error from the pixel to the left, - * errR is the error from the pixel to the top, top left, and top right */ - /* qr * 0.4375 is the error distribution to the EAST in - * the previous loop */ - ir += errR[x] + qr * 4375 / 10000; - ig += errG[x] + qg * 4375 / 10000; - ib += errB[x] + qb * 4375 / 10000; - - /* error distribution to the SOUTH-EAST in the previous loop - * can't calculate in the previous loop because it steps on - * the above quantization */ - errR[x] = qr * 625 / 10000; - errG[x] = qg * 625 / 10000; - errB[x] = qb * 625 / 10000; - - qr = ir; - qg = ig; - qb = ib; - - /* clamp */ - if (qr < 0) qr = 0; else if (qr > 2550000) qr = 2550000; - if (qg < 0) qg = 0; else if (qg > 2550000) qg = 2550000; - if (qb < 0) qb = 0; else if (qb > 2550000) qb = 2550000; - - /* convert to RGB565 */ - qr = qr * 0x1F / 2550000; - qg = qg * 0x3F / 2550000; - qb = qb * 0x1F / 2550000; - - /* this is the dithered pixel */ - t = (qr << 11) | (qg << 5) | qb; - - /* compute the errors */ - qr = ((qr << 3) | (qr >> 2)) * 10000; - qg = ((qg << 2) | (qg >> 4)) * 10000; - qb = ((qb << 3) | (qb >> 2)) * 10000; - qr = ir - qr; - qg = ig - qg; - qb = ib - qb; - - /* compute the error distributions */ - /* Floyd-Steinberg filter - * 7/16 (=0.4375) to the EAST - * 5/16 (=0.3125) to the SOUTH - * 1/16 (=0.0625) to the SOUTH-EAST - * 3/16 (=0.1875) to the SOUTH-WEST - * - * x 7/16 - * 3/16 5/16 1/16 - */ - /* SOUTH-WEST */ - if (x > 1) { - errR[x - 1] += qr * 1875 / 10000; - errG[x - 1] += qg * 1875 / 10000; - errB[x - 1] += qb * 1875 / 10000; - } - - /* SOUTH */ - errR[x] += qr * 3125 / 10000; - errG[x] += qg * 3125 / 10000; - errB[x] += qb * 3125 / 10000; - - *dest = (t & 0xFFFF); - - dest++; - src++; - } - } - - delete [] errR; - delete [] errG; - delete [] errB; -} - - -void -TxQuantize::ARGB8888_ARGB1555_ErrD(uint32* src, uint32* dst, int width, int height) -{ - /* Floyd-Steinberg error-diffusion halftoning */ - - int i, x, y; - int qr, qg, qb; /* quantized incoming values */ - int ir, ig, ib; /* incoming values */ - int t; - int *errR = new int[width]; - int *errG = new int[width]; - int *errB = new int[width]; - - uint16 *dest = (uint16 *)dst; - - for (i = 0; i < width; i++) errR[i] = errG[i] = errB[i] = 0; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - /* incoming pixel values */ - ir = ((*src >> 16) & 0xFF) * 10000; - ig = ((*src >> 8) & 0xFF) * 10000; - ib = ((*src ) & 0xFF) * 10000; - - if (x == 0) qr = qg = qb = 0; - - /* quantize pixel values. - * qr * 0.4375 is the error from the pixel to the left, - * errR is the error from the pixel to the top, top left, and top right */ - /* qr * 0.4375 is the error distribution to the EAST in - * the previous loop */ - ir += errR[x] + qr * 4375 / 10000; - ig += errG[x] + qg * 4375 / 10000; - ib += errB[x] + qb * 4375 / 10000; - - /* error distribution to the SOUTH-EAST of the previous loop. - * cannot calculate in the previous loop because it steps on - * the above quantization */ - errR[x] = qr * 625 / 10000; - errG[x] = qg * 625 / 10000; - errB[x] = qb * 625 / 10000; - - qr = ir; - qg = ig; - qb = ib; - - /* clamp */ - if (qr < 0) qr = 0; else if (qr > 2550000) qr = 2550000; - if (qg < 0) qg = 0; else if (qg > 2550000) qg = 2550000; - if (qb < 0) qb = 0; else if (qb > 2550000) qb = 2550000; - - /* convert to RGB555 */ - qr = qr * 0x1F / 2550000; - qg = qg * 0x1F / 2550000; - qb = qb * 0x1F / 2550000; - - /* this is the dithered pixel */ - t = (qr << 10) | (qg << 5) | qb; - t |= ((*src >> 24) ? 0x8000 : 0); - - /* compute the errors */ - qr = ((qr << 3) | (qr >> 2)) * 10000; - qg = ((qg << 3) | (qg >> 2)) * 10000; - qb = ((qb << 3) | (qb >> 2)) * 10000; - qr = ir - qr; - qg = ig - qg; - qb = ib - qb; - - /* compute the error distributions */ - /* Floyd-Steinberg filter - * 7/16 (=0.4375) to the EAST - * 5/16 (=0.3125) to the SOUTH - * 1/16 (=0.0625) to the SOUTH-EAST - * 3/16 (=0.1875) to the SOUTH-WEST - * - * x 7/16 - * 3/16 5/16 1/16 - */ - /* SOUTH-WEST */ - if (x > 1) { - errR[x - 1] += qr * 1875 / 10000; - errG[x - 1] += qg * 1875 / 10000; - errB[x - 1] += qb * 1875 / 10000; - } - - /* SOUTH */ - errR[x] += qr * 3125 / 10000; - errG[x] += qg * 3125 / 10000; - errB[x] += qb * 3125 / 10000; - - *dest = (t & 0xFFFF); - - dest++; - src++; - } - } - - delete [] errR; - delete [] errG; - delete [] errB; -} - -void -TxQuantize::ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int height) -{ - /* Floyd-Steinberg error-diffusion halftoning */ - - int i, x, y; - int qr, qg, qb, qa; /* quantized incoming values */ - int ir, ig, ib, ia; /* incoming values */ - int t; - int *errR = new int[width]; - int *errG = new int[width]; - int *errB = new int[width]; - int *errA = new int[width]; - - uint16 *dest = (uint16 *)dst; - - for (i = 0; i < width; i++) errR[i] = errG[i] = errB[i] = errA[i] = 0; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - /* incoming pixel values */ - ir = ((*src >> 16) & 0xFF) * 10000; - ig = ((*src >> 8) & 0xFF) * 10000; - ib = ((*src ) & 0xFF) * 10000; - ia = ((*src >> 24) & 0xFF) * 10000; - - if (x == 0) qr = qg = qb = qa = 0; - - /* quantize pixel values. - * qr * 0.4375 is the error from the pixel to the left, - * errR is the error from the pixel to the top, top left, and top right */ - /* qr * 0.4375 is the error distribution to the EAST in - * the previous loop */ - ir += errR[x] + qr * 4375 / 10000; - ig += errG[x] + qg * 4375 / 10000; - ib += errB[x] + qb * 4375 / 10000; - ia += errA[x] + qa * 4375 / 10000; - - /* error distribution to the SOUTH-EAST of the previous loop. - * cannot calculate in the previous loop because it steps on - * the above quantization */ - errR[x] = qr * 625 / 10000; - errG[x] = qg * 625 / 10000; - errB[x] = qb * 625 / 10000; - errA[x] = qa * 625 / 10000; - - qr = ir; - qg = ig; - qb = ib; - qa = ia; - - /* clamp */ - if (qr < 0) qr = 0; else if (qr > 2550000) qr = 2550000; - if (qg < 0) qg = 0; else if (qg > 2550000) qg = 2550000; - if (qb < 0) qb = 0; else if (qb > 2550000) qb = 2550000; - if (qa < 0) qa = 0; else if (qa > 2550000) qa = 2550000; - - /* convert to RGB444 */ - qr = qr * 0xF / 2550000; - qg = qg * 0xF / 2550000; - qb = qb * 0xF / 2550000; - qa = qa * 0xF / 2550000; - - t = (qr << 8) | (qg << 4) | qb; - t |= (*src >> 16) & 0xF000; - - /* compute the errors */ - qr = ((qr << 4) | qr) * 10000; - qg = ((qg << 4) | qg) * 10000; - qb = ((qb << 4) | qb) * 10000; - qa = ((qa << 4) | qa) * 10000; - qr = ir - qr; - qg = ig - qg; - qb = ib - qb; - qa = ia - qa; - - /* compute the error distributions */ - /* Floyd-Steinberg filter - * 7/16 (=0.4375) to the EAST - * 5/16 (=0.3125) to the SOUTH - * 1/16 (=0.0625) to the SOUTH-EAST - * 3/16 (=0.1875) to the SOUTH-WEST - * - * x 7/16 - * 3/16 5/16 1/16 - */ - /* SOUTH-WEST */ - if (x > 1) { - errR[x - 1] += qr * 1875 / 10000; - errG[x - 1] += qg * 1875 / 10000; - errB[x - 1] += qb * 1875 / 10000; - errA[x - 1] += qa * 1875 / 10000; - } - - /* SOUTH */ - errR[x] += qr * 3125 / 10000; - errG[x] += qg * 3125 / 10000; - errB[x] += qb * 3125 / 10000; - errA[x] += qa * 3125 / 10000; - - *dest = (t & 0xFFFF); - - dest++; - src++; - } - } - - delete [] errR; - delete [] errG; - delete [] errB; - delete [] errA; -} - -void -TxQuantize::ARGB8888_AI44_ErrD(uint32* src, uint32* dst, int width, int height) -{ - /* Floyd-Steinberg error-diffusion halftoning */ - - int i, x, y; - int qi, qa; /* quantized incoming values */ - int ii, ia; /* incoming values */ - int t; - int *errI = new int[width]; - int *errA = new int[width]; - - uint8 *dest = (uint8 *)dst; - - for (i = 0; i < width; i++) errI[i] = errA[i] = 0; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - /* 3dfx style Intensity = R * 0.299 + G * 0.587 + B * 0.114 */ - ii = ((*src >> 16) & 0xFF) * 2990 + - ((*src >> 8) & 0xFF) * 5870 + - ((*src ) & 0xFF) * 1140; - ia = ((*src >> 24) & 0xFF) * 10000; - - if (x == 0) qi = qa = 0; - - /* quantize pixel values. - * qi * 0.4375 is the error from the pixel to the left, - * errI is the error from the pixel to the top, top left, and top right */ - /* qi * 0.4375 is the error distrtibution to the EAST in - * the previous loop */ - ii += errI[x] + qi * 4375 / 10000; - ia += errA[x] + qa * 4375 / 10000; - - /* error distribution to the SOUTH-EAST in the previous loop. - * cannot calculate in the previous loop because it steps on - * the above quantization */ - errI[x] = qi * 625 / 10000; - errA[x] = qa * 625 / 10000; - - qi = ii; - qa = ia; - - /* clamp */ - if (qi < 0) qi = 0; else if (qi > 2550000) qi = 2550000; - if (qa < 0) qa = 0; else if (qa > 2550000) qa = 2550000; - - /* convert to I4 */ - qi = qi * 0xF / 2550000; - qa = qa * 0xF / 2550000; - - t = qi; - t |= ((*src >> 24) & 0xF0); - - /* compute the errors */ - qi = ((qi << 4) | qi) * 10000; - qa = ((qa << 4) | qa) * 10000; - qi = ii - qi; - qa = ia - qa; - - /* compute the error distributions */ - /* Floyd-Steinberg filter - * 7/16 (=0.4375) to the EAST - * 5/16 (=0.3125) to the SOUTH - * 1/16 (=0.0625) to the SOUTH-EAST - * 3/16 (=0.1875) to the SOUTH-WEST - * - * x 7/16 - * 3/16 5/16 1/16 - */ - /* SOUTH-WEST */ - if (x > 1) { - errI[x - 1] += qi * 1875 / 10000; - errA[x - 1] += qa * 1875 / 10000; - } - - /* SOUTH */ - errI[x] += qi * 3125 / 10000; - errA[x] += qa * 3125 / 10000; - - *dest = t & 0xFF; - - dest++; - src++; - } - } - - delete [] errI; - delete [] errA; -} - -void -TxQuantize::ARGB8888_AI88_Slow(uint32* src, uint32* dst, int width, int height) -{ - int x, y; - uint16 *dest = (uint16 *)dst; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { -#if 1 - /* libpng style grayscale conversion. - * Reduce RGB files to grayscale with or without alpha - * using the equation given in Poynton's ColorFAQ at - * - * Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net - * - * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B - * - * We approximate this with - * - * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B - * - * which can be expressed with integers as - * - * Y = (6969 * R + 23434 * G + 2365 * B)/32768 - * - * The calculation is to be done in a linear colorspace. - */ - *dest = (((int)((((*src >> 16) & 0xFF) * 6969 + - ((*src >> 8) & 0xFF) * 23434 + - ((*src ) & 0xFF) * 2365) / 32768) & 0xFF) | - (uint16)((*src >> 16) & 0xFF00)); -#else - /* 3dfx style Intensity = R * 0.299 + G * 0.587 + B * 0.114 - * this is same as the standard NTSC gray scale conversion. */ - *dest = (((int)((((*src >> 16) & 0xFF) * 299 + - ((*src >> 8) & 0xFF) * 587 + - ((*src ) & 0xFF) * 114) / 1000) & 0xFF) | - (uint16)((*src >> 16) & 0xFF00)); -#endif - dest++; - src++; - } - } -} - -void -TxQuantize::ARGB8888_I8_Slow(uint32* src, uint32* dst, int width, int height) -{ - int x, y; - uint8 *dest = (uint8 *)dst; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { -#if 1 - /* libpng style Intensity = (6969 * R + 23434 * G + 2365 * B)/32768 */ - *dest = (int)((((*src >> 16) & 0xFF) * 6969 + - ((*src >> 8) & 0xFF) * 23434 + - ((*src ) & 0xFF) * 2365) / 32768) & 0xFF; -#else - /* 3dfx style Intensity = R * 0.299 + G * 0.587 + B * 0.114 - * this is same as the standard NTSC gray scale conversion. */ - *dest = (int)((((*src >>16) & 0xFF) * 299 + - ((*src >> 8) & 0xFF) * 587 + - ((*src ) & 0xFF) * 114) / 1000) & 0xFF; -#endif - dest++; - src++; - } - } -} - -void -TxQuantize::P8_16BPP(uint32* src, uint32* dest, int width, int height, uint32* palette) -{ - /* passed in palette is RGBA5551 format */ - int i; - int size = width * height; - for (i = 0; i < size; i++) { - ((uint16*)dest)[i] = ((uint16*)palette)[(int)(((uint8*)src)[i])]; - ((uint16*)dest)[i] = ((((uint16*)dest)[i] << 15) | (((uint16*)dest)[i] >> 1)); - } -} - -boolean -TxQuantize::quantize(uint8* src, uint8* dest, int width, int height, ColorFormat srcformat, ColorFormat destformat, boolean fastQuantizer) -{ - typedef void (TxQuantize::*quantizerFunc)(uint32* src, uint32* dest, int width, int height); - assert(srcformat != graphics::colorFormat::RGBA); - assert(destformat != graphics::colorFormat::RGBA); - quantizerFunc quantizer; - int bpp_shift = 0; - - if (destformat == graphics::internalcolorFormat::RGBA8) { - if (srcformat == graphics::internalcolorFormat::RGB5_A1) { - quantizer = &TxQuantize::ARGB1555_ARGB8888; - bpp_shift = 1; - } else if (srcformat == graphics::internalcolorFormat::RGBA4) { - quantizer = &TxQuantize::ARGB4444_ARGB8888; - bpp_shift = 1; - } else if (srcformat == graphics::internalcolorFormat::RGB8) { - quantizer = &TxQuantize::RGB565_ARGB8888; - bpp_shift = 1; - } else - return 0; - - unsigned int numcore = _numcore; - unsigned int blkrow = 0; - while (numcore > 1 && blkrow == 0) { - blkrow = (height >> 2) / numcore; - numcore--; - } - if (blkrow > 0 && numcore > 1) { - std::thread *thrd[MAX_NUMCORE]; - unsigned int i; - int blkheight = blkrow << 2; - unsigned int srcStride = (width * blkheight) << (2 - bpp_shift); - unsigned int destStride = srcStride << bpp_shift; - for (i = 0; i < numcore - 1; i++) { - thrd[i] = new std::thread(std::bind(quantizer, - this, - (uint32*)src, - (uint32*)dest, - width, - blkheight)); - src += srcStride; - dest += destStride; - } - thrd[i] = new std::thread(std::bind(quantizer, - this, - (uint32*)src, - (uint32*)dest, - width, - height - blkheight * i)); - for (i = 0; i < numcore; i++) { - thrd[i]->join(); - delete thrd[i]; - } - } else { - (*this.*quantizer)((uint32*)src, (uint32*)dest, width, height); - } - - } else if (srcformat == graphics::internalcolorFormat::RGBA8) { - if (destformat == graphics::internalcolorFormat::RGB5_A1) { - quantizer = fastQuantizer ? &TxQuantize::ARGB8888_ARGB1555 : &TxQuantize::ARGB8888_ARGB1555_ErrD; - bpp_shift = 1; - } else if (destformat == graphics::internalcolorFormat::RGBA4) { - quantizer = fastQuantizer ? &TxQuantize::ARGB8888_ARGB4444 : &TxQuantize::ARGB8888_ARGB4444_ErrD; - bpp_shift = 1; - } else if (destformat == graphics::internalcolorFormat::RGB8) { - quantizer = fastQuantizer ? &TxQuantize::ARGB8888_RGB565 : &TxQuantize::ARGB8888_RGB565_ErrD; - bpp_shift = 1; - } else - return 0; - - unsigned int numcore = _numcore; - unsigned int blkrow = 0; - while (numcore > 1 && blkrow == 0) { - blkrow = (height >> 2) / numcore; - numcore--; - } - if (blkrow > 0 && numcore > 1) { - std::thread *thrd[MAX_NUMCORE]; - unsigned int i; - int blkheight = blkrow << 2; - unsigned int srcStride = (width * blkheight) << 2; - unsigned int destStride = srcStride >> bpp_shift; - for (i = 0; i < numcore - 1; i++) { - thrd[i] = new std::thread(std::bind(quantizer, - this, - (uint32*)src, - (uint32*)dest, - width, - blkheight)); - src += srcStride; - dest += destStride; - } - thrd[i] = new std::thread(std::bind(quantizer, - this, - (uint32*)src, - (uint32*)dest, - width, - height - blkheight * i)); - for (i = 0; i < numcore; i++) { - thrd[i]->join(); - delete thrd[i]; - } - } else { - (*this.*quantizer)((uint32*)src, (uint32*)dest, width, height); - } - - } else { - return 0; - } - - return 1; -} diff --git a/GLideN64/src/GLideNHQ/TxQuantize.h b/GLideN64/src/GLideNHQ/TxQuantize.h deleted file mode 100644 index 354b09a..0000000 --- a/GLideN64/src/GLideNHQ/TxQuantize.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXQUANTIZE_H__ -#define __TXQUANTIZE_H__ - -#include "TxInternal.h" -#include "TxUtil.h" - -class TxQuantize -{ -private: - int _numcore; - - /* fast optimized... well, sort of. */ - void ARGB1555_ARGB8888(uint32* src, uint32* dst, int width, int height); - void ARGB4444_ARGB8888(uint32* src, uint32* dst, int width, int height); - void RGB565_ARGB8888(uint32* src, uint32* dst, int width, int height); - void A8_ARGB8888(uint32* src, uint32* dst, int width, int height); - void AI44_ARGB8888(uint32* src, uint32* dst, int width, int height); - void AI88_ARGB8888(uint32* src, uint32* dst, int width, int height); - - void ARGB8888_ARGB1555(uint32* src, uint32* dst, int width, int height); - void ARGB8888_ARGB4444(uint32* src, uint32* dst, int width, int height); - void ARGB8888_RGB565(uint32* src, uint32* dst, int width, int height); - void ARGB8888_A8(uint32* src, uint32* dst, int width, int height); - void ARGB8888_AI44(uint32* src, uint32* dst, int width, int height); - void ARGB8888_AI88(uint32* src, uint32* dst, int width, int height); - - /* quality */ - void ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height); - void ARGB8888_ARGB1555_ErrD(uint32* src, uint32* dst, int width, int height); - void ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int height); - void ARGB8888_AI44_ErrD(uint32* src, uint32* dst, int width, int height); - void ARGB8888_AI88_Slow(uint32* src, uint32* dst, int width, int height); - void ARGB8888_I8_Slow(uint32* src, uint32* dst, int width, int height); - -public: - TxQuantize(); - ~TxQuantize(); - - /* others */ - void P8_16BPP(uint32* src, uint32* dst, int width, int height, uint32* palette); - - boolean quantize(uint8* src, uint8* dest, int width, int height, ColorFormat srcformat, ColorFormat destformat, boolean fastQuantizer = 1); -}; - -#endif /* __TXQUANTIZE_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxReSample.cpp b/GLideN64/src/GLideNHQ/TxReSample.cpp deleted file mode 100644 index 1713262..0000000 --- a/GLideN64/src/GLideNHQ/TxReSample.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "TxReSample.h" -#include "TxDbg.h" -#include -#include - -#define _USE_MATH_DEFINES -#include - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -int -TxReSample::nextPow2(int num) -{ - num = num - 1; - num = num | (num >> 1); - num = num | (num >> 2); - num = num | (num >> 4); - num = num | (num >> 8); - num = num | (num >> 16); - /*num = num | (num >> 32);*//* for 64bit architecture */ - num = num + 1; - - return num; -} - -boolean -TxReSample::nextPow2(uint8** image, int* width, int* height, int bpp, boolean use_3dfx = 0) -{ - /* NOTE: bpp must be one of the follwing: 8, 16, 24, 32 bits per pixel */ - - if (!*image || !*width || !*height || !bpp) - return 0; - - int row_bytes = ((*width * bpp) >> 3); - int o_row_bytes = row_bytes; - int o_width = *width; - int n_width = *width; - int o_height = *height; - int n_height = *height; - - /* HACKALERT: I have explicitly subtracted (n) from width/height to - * adjust textures that have (n) pixel larger width/height than - * power of 2 size. This is a dirty hack for textures that have - * munged aspect ratio by (n) pixel to the original. - */ - if (n_width > 64) n_width -= 4; - else if (n_width > 16) n_width -= 2; - else if (n_width > 4) n_width -= 1; - - if (n_height > 64) n_height -= 4; - else if (n_height > 16) n_height -= 2; - else if (n_height > 4) n_height -= 1; - - n_width = nextPow2(n_width); - n_height = nextPow2(n_height); - row_bytes = (n_width * bpp) >> 3; - - /* 3dfx Glide3 format, W:H aspect ratio range (8:1 - 1:8) */ - if (use_3dfx) { - if (n_width > n_height) { - if (n_width > (n_height << 3)) - n_height = n_width >> 3; - } else { - if (n_height > (n_width << 3)) { - n_width = n_height >> 3; - row_bytes = (n_width * bpp) >> 3; - } - } - DBG_INFO(80, wst("using 3dfx W:H aspect ratio range (8:1 - 1:8).\n")); - } - - /* do we really need to do this ? */ - if (o_width == n_width && o_height == n_height) - return 1; /* nope */ - - DBG_INFO(80, wst("expand image to next power of 2 dimensions. %d x %d -> %d x %d\n"), - o_width, o_height, n_width, n_height); - - if (o_width > n_width) - o_width = n_width; - - if (o_height > n_height) - o_height = n_height; - - /* allocate memory to read in image */ - uint8 *pow2image = (uint8*)malloc(row_bytes * n_height); - - /* read in image */ - if (pow2image) { - int i, j; - uint8 *tmpimage = *image, *tmppow2image = pow2image; - - for (i = 0; i < o_height; i++) { - /* copy row */ - memcpy(tmppow2image, tmpimage, ((o_width * bpp) >> 3)); - - /* expand to pow2 size by replication */ - for(j = ((o_width * bpp) >> 3); j < row_bytes; j++) - tmppow2image[j] = tmppow2image[j - (bpp >> 3)]; - - tmppow2image += row_bytes; - tmpimage += o_row_bytes; - } - /* expand to pow2 size by replication */ - for (i = o_height; i < n_height; i++) - memcpy(&pow2image[row_bytes * i], &pow2image[row_bytes * (i - 1)], row_bytes); - - free(*image); - - *image = pow2image; - *height = n_height; - *width = n_width; - - return 1; - } - - return 0; -} - -/* Ken Turkowski - * Filters for Common Resampling Tasks - * Apple Computer 1990 - */ -double -TxReSample::tent(double x) -{ - if (x < 0.0) x = -x; - if (x < 1.0) return (1.0 - x); - return 0.0; -} - -double -TxReSample::gaussian(double x) -{ - if (x < 0) x = -x; - if (x < 2.0) return pow(2.0, -2.0 * x * x); - return 0.0; -} - -double -TxReSample::sinc(double x) -{ - if (x == 0) return 1.0; - x *= M_PI; - return (sin(x) / x); -} - -double -TxReSample::lanczos3(double x) -{ - if (x < 0) x = -x; - if (x < 3.0) return (sinc(x) * sinc(x/3.0)); - return 0.0; -} - -/* Don P. Mitchell and Arun N. Netravali - * Reconstruction Filters in Computer Graphics - * SIGGRAPH '88 - * Proceedings of the 15th annual conference on Computer - * graphics and interactive techniques, pp221-228, 1988 - */ -double -TxReSample::mitchell(double x) -{ - if (x < 0) x = -x; - if (x < 2.0) { - const double B = 1.0 / 3.0; - const double C = 1.0 / 3.0; - if (x < 1.0) { - x = (((12.0 - 9.0 * B - 6.0 * C) * (x * x * x)) - + ((-18.0 + 12.0 * B + 6.0 * C) * (x * x)) - + (6.0 - 2.0 * B)); - } else { - x = (((-1.0 * B - 6.0 * C) * (x * x * x)) - + ((6.0 * B + 30.0 * C) * (x * x)) - + ((-12.0 * B - 48.0 * C) * x) - + (8.0 * B + 24.0 * C)); - } - return (x / 6.0); - } - return 0.0; -} - -/* J. F. Kaiser and W. A. Reed - * Data smoothing using low-pass digital filters - * Rev. Sci. instrum. 48 (11), pp1447-1457, 1977 - */ -double -TxReSample::besselI0(double x) -{ - /* zero-order modified bessel function of the first kind */ - const double eps_coeff = 1E-16; /* small enough */ - double xh, sum, pow, ds; - xh = 0.5 * x; - sum = 1.0; - pow = 1.0; - ds = 1.0; - int k = 0; - while (ds > sum * eps_coeff) { - k++; - pow *= (xh / k); - ds = pow * pow; - sum = sum + ds; - } - return sum; -} - -double -TxReSample::kaiser(double x) -{ - const double alpha = 4.0; - const double half_window = 5.0; - const double ratio = x / half_window; - return sinc(x) * besselI0(alpha * sqrt(1 - ratio * ratio)) / besselI0(alpha); -} - -boolean -TxReSample::minify(uint8 **src, int *width, int *height, int ratio) -{ - /* NOTE: src must be ARGB8888, ratio is the inverse representation */ - - if (!*src || ratio < 2) return 0; - - /* Image Resampling */ - - /* half width of filter window. - * NOTE: must be 1.0 or larger. - * - * kaiser-bessel 5, lanczos3 3, mitchell 2, gaussian 1.5, tent 1 - */ - double half_window = 5.0; - - int x, y, x2, y2, z; - double A, R, G, B; - uint32 texel; - - int tmpwidth = *width / ratio; - int tmpheight = *height / ratio; - - /* resampled destination */ - uint8 *tmptex = (uint8*)malloc((tmpwidth * tmpheight) << 2); - if (!tmptex) return 0; - - /* work buffer. single row */ - uint8 *workbuf = (uint8*)malloc(*width << 2); - if (!workbuf) { - free(tmptex); - return 0; - } - - /* prepare filter lookup table. only half width required for symetric filters. */ - double *weight = (double*)malloc((int)((half_window * ratio) * sizeof(double))); - if (!weight) { - free(tmptex); - free(workbuf); - return 0; - } - for (x = 0; x < half_window * ratio; x++) { - //weight[x] = tent((double)x / ratio) / ratio; - //weight[x] = gaussian((double)x / ratio) / ratio; - //weight[x] = lanczos3((double)x / ratio) / ratio; - //weight[x] = mitchell((double)x / ratio) / ratio; - weight[x] = kaiser((double)x / ratio) / ratio; - } - - /* linear convolution */ - for (y = 0; y < tmpheight; y++) { - for (x = 0; x < *width; x++) { - texel = ((uint32*)*src)[y * ratio * *width + x]; - A = (double)(texel >> 24) * weight[0]; - R = (double)((texel >> 16) & 0xff) * weight[0]; - G = (double)((texel >> 8) & 0xff) * weight[0]; - B = (double)((texel ) & 0xff) * weight[0]; - for (y2 = 1; y2 < half_window * ratio; y2++) { - z = y * ratio + y2; - if (z >= *height) z = *height - 1; - texel = ((uint32*)*src)[z * *width + x]; - A += (double)(texel >> 24) * weight[y2]; - R += (double)((texel >> 16) & 0xff) * weight[y2]; - G += (double)((texel >> 8) & 0xff) * weight[y2]; - B += (double)((texel ) & 0xff) * weight[y2]; - z = y * ratio - y2; - if (z < 0) z = 0; - texel = ((uint32*)*src)[z * *width + x]; - A += (double)(texel >> 24) * weight[y2]; - R += (double)((texel >> 16) & 0xff) * weight[y2]; - G += (double)((texel >> 8) & 0xff) * weight[y2]; - B += (double)((texel ) & 0xff) * weight[y2]; - } - if (A < 0) A = 0; else if (A > 255) A = 255; - if (R < 0) R = 0; else if (R > 255) R = 255; - if (G < 0) G = 0; else if (G > 255) G = 255; - if (B < 0) B = 0; else if (B > 255) B = 255; - ((uint32*)workbuf)[x] = (((uint32)A << 24) | ((uint32)R << 16) | ((uint32)G << 8) | (uint32)B); - } - for (x = 0; x < tmpwidth; x++) { - texel = ((uint32*)workbuf)[x * ratio]; - A = (double)(texel >> 24) * weight[0]; - R = (double)((texel >> 16) & 0xff) * weight[0]; - G = (double)((texel >> 8) & 0xff) * weight[0]; - B = (double)((texel ) & 0xff) * weight[0]; - for (x2 = 1; x2 < half_window * ratio; x2++) { - z = x * ratio + x2; - if (z >= *width) z = *width - 1; - texel = ((uint32*)workbuf)[z]; - A += (double)(texel >> 24) * weight[x2]; - R += (double)((texel >> 16) & 0xff) * weight[x2]; - G += (double)((texel >> 8) & 0xff) * weight[x2]; - B += (double)((texel ) & 0xff) * weight[x2]; - z = x * ratio - x2; - if (z < 0) z = 0; - texel = ((uint32*)workbuf)[z]; - A += (double)(texel >> 24) * weight[x2]; - R += (double)((texel >> 16) & 0xff) * weight[x2]; - G += (double)((texel >> 8) & 0xff) * weight[x2]; - B += (double)((texel ) & 0xff) * weight[x2]; - } - if (A < 0) A = 0; else if (A > 255) A = 255; - if (R < 0) R = 0; else if (R > 255) R = 255; - if (G < 0) G = 0; else if (G > 255) G = 255; - if (B < 0) B = 0; else if (B > 255) B = 255; - ((uint32*)tmptex)[y * tmpwidth + x] = (((uint32)A << 24) | ((uint32)R << 16) | ((uint32)G << 8) | (uint32)B); - } - } - - free(*src); - *src = tmptex; - free(weight); - free(workbuf); - *width = tmpwidth; - *height = tmpheight; - - DBG_INFO(80, wst("minification ratio:%d -> %d x %d\n"), ratio, *width, *height); - - return 1; -} diff --git a/GLideN64/src/GLideNHQ/TxReSample.h b/GLideN64/src/GLideNHQ/TxReSample.h deleted file mode 100644 index 805647d..0000000 --- a/GLideN64/src/GLideNHQ/TxReSample.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXRESAMPLE_H__ -#define __TXRESAMPLE_H__ - -#include "TxInternal.h" - -class TxReSample -{ -private: - double tent(double x); - double gaussian(double x); - double sinc(double x); - double lanczos3(double x); - double mitchell(double x); - double besselI0(double x); - double kaiser(double x); -public: - boolean minify(uint8 **src, int *width, int *height, int ratio); - boolean nextPow2(uint8** image, int* width, int* height, int bpp, boolean use_3dfx); - int nextPow2(int num); -}; - -#endif /* __TXRESAMPLE_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxTexCache.cpp b/GLideN64/src/GLideNHQ/TxTexCache.cpp deleted file mode 100644 index a8255ea..0000000 --- a/GLideN64/src/GLideNHQ/TxTexCache.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef __MSC__ -#pragma warning(disable: 4786) -#endif - -#include "TxTexCache.h" -#include "TxDbg.h" -#include -#include - -#define TEXCACHE_DUMP_ENABLED (FILE_TEXCACHE|DUMP_TEXCACHE) - -TxTexCache::~TxTexCache() -{ -} - -TxTexCache::TxTexCache(int options, int cachesize, const wchar_t *cachePath, const wchar_t *ident, - dispInfoFuncExt callback) - : TxCache((options & ~(GZ_HIRESTEXCACHE | FILE_HIRESTEXCACHE)), cachesize, cachePath, ident, callback) - , _cacheDumped(false) -{ - /* assert local options */ - if (_cachePath.empty() || _ident.empty()) - setOptions(getOptions() & ~TEXCACHE_DUMP_ENABLED); - - if (getOptions() & TEXCACHE_DUMP_ENABLED) { - /* find it on disk */ - _cacheDumped = TxCache::load(false); - if (!_cacheDumped) - TxCache::clear(); - } -} - -bool TxTexCache::add(uint64 checksum, GHQTexInfo *info) -{ - const bool res = TxCache::add(checksum, info); - if (res) - _cacheDumped = false; - return res; -} - -void -TxTexCache::dump() -{ - if ((getOptions() & TEXCACHE_DUMP_ENABLED) && !_cacheDumped) { - /* dump cache to disk */ - _cacheDumped = TxCache::save(); - } -} - -tx_wstring TxTexCache::_getFileName() const -{ - tx_wstring filename = _ident + wst("_MEMORYCACHE."); - filename += ((getOptions() & FILE_TEXCACHE) == 0) ? TEXCACHE_EXT : TEXSTREAM_EXT; - removeColon(filename); - return filename; -} - -int TxTexCache::_getConfig() const -{ - return getOptions() & - (FILTER_MASK | - ENHANCEMENT_MASK | - FORCE16BPP_TEX | - FILE_TEXCACHE | - GZ_TEXCACHE); -} diff --git a/GLideN64/src/GLideNHQ/TxTexCache.h b/GLideN64/src/GLideNHQ/TxTexCache.h deleted file mode 100644 index 4a4a9e3..0000000 --- a/GLideN64/src/GLideNHQ/TxTexCache.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXTEXCACHE_H__ -#define __TXTEXCACHE_H__ - -#include "TxCache.h" - -class TxTexCache : public TxCache -{ -private: - bool _cacheDumped; - - tx_wstring _getFileName() const override; - int _getConfig() const override; - -public: - ~TxTexCache(); - TxTexCache(int options, int cachesize, const wchar_t *cachePath, const wchar_t *ident, dispInfoFuncExt callback); - bool add(uint64 checksum /* checksum hi:palette low:texture */, GHQTexInfo *info); - void dump(); -}; - -#endif /* __TXTEXCACHE_H__ */ diff --git a/GLideN64/src/GLideNHQ/TxUtil.cpp b/GLideN64/src/GLideNHQ/TxUtil.cpp deleted file mode 100644 index fa6e4fc..0000000 --- a/GLideN64/src/GLideNHQ/TxUtil.cpp +++ /dev/null @@ -1,606 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include "TxUtil.h" -#include "TxDbg.h" -#include -#include - -#if defined (OS_WINDOWS) -#include -#elif defined (OS_MAC_OS_X) -#include -#include -#include -#elif defined (OS_LINUX) -#include -#include -#endif - -/* - * Utilities - ******************************************************************************/ -uint32 -TxUtil::checksumTx(uint8 *src, int width, int height, ColorFormat format) -{ - int dataSize = sizeofTx(width, height, format); - - /* for now we use adler32 if something else is better - * we can simply swtich later - */ - /* return (dataSize ? Adler32(src, dataSize, 1) : 0); */ - - /* zlib crc32 */ - return (dataSize ? crc32(crc32(0L, Z_NULL, 0), src, dataSize) : 0); -} - -int -TxUtil::sizeofTx(int width, int height, ColorFormat format) -{ - int dataSize = 0; - - /* a lookup table for the shifts would be better */ - if (format == graphics::internalcolorFormat::COLOR_INDEX8) { - dataSize = width * height; - } else if (format == graphics::internalcolorFormat::RGBA4 || - format == graphics::internalcolorFormat::RGB5_A1 || - format == graphics::internalcolorFormat::RGB8) { - dataSize = (width * height) << 1; - } else if (format == graphics::internalcolorFormat::RGBA8) { - dataSize = (width * height) << 2; - } else { - /* unsupported format */ - DBG_INFO(80, wst("Error: cannot get size. unsupported gfmt:%x\n"), format); - } - - return dataSize; -} - -uint32 -TxUtil::checksum(uint8 *src, int width, int height, int size, int rowStride) -{ - /* Rice CRC32 for now. We can switch this to Jabo MD5 or - * any other custom checksum. - * TODO: use *_HIRESTEXTURE option. */ - - if (!src) return 0; - - return RiceCRC32(src, width, height, size, rowStride); -} - -uint64 -TxUtil::checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette) -{ - /* Rice CRC32 for now. We can switch this to Jabo MD5 or - * any other custom checksum. - * TODO: use *_HIRESTEXTURE option. */ - /* Returned value is 64bits: hi=palette crc32 low=texture crc32 */ - - if (!src) return 0; - - uint64 crc64Ret = 0; - - if (palette) { - uint32 crc32 = 0, cimax = 0; - switch (size & 0xff) { - case 1: - if (RiceCRC32_CI8(src, width, height, rowStride, &crc32, &cimax)) { - crc64Ret = (uint64)RiceCRC32(palette, cimax + 1, 1, 2, 512); - crc64Ret <<= 32; - crc64Ret |= (uint64)crc32; - } - break; - case 0: - if (RiceCRC32_CI4(src, width, height, rowStride, &crc32, &cimax)) { - crc64Ret = (uint64)RiceCRC32(palette, cimax + 1, 1, 2, 32); - crc64Ret <<= 32; - crc64Ret |= (uint64)crc32; - } - } - } - if (!crc64Ret) { - crc64Ret = (uint64)RiceCRC32(src, width, height, size, rowStride); - } - - return crc64Ret; -} - -/* Rice CRC32 for hires texture packs */ -/* NOTE: The following is used in Glide64 to calculate the CRC32 - * for Rice hires texture packs. - * - * BYTE* addr = (BYTE*)(gfx.RDRAM + - * rdp.addr[rdp.tiles[tile].t_mem] + - * (rdp.tiles[tile].ul_t * bpl) + - * (((rdp.tiles[tile].ul_s<>1)); - * RiceCRC32(addr, - * rdp.tiles[tile].width, - * rdp.tiles[tile].height, - * (unsigned short)(rdp.tiles[tile].format << 8 | rdp.tiles[tile].size), - * bpl); - */ -uint32 -TxUtil::RiceCRC32(const uint8* src, int width, int height, int size, int rowStride) -{ - /* NOTE: bytes_per_width must be equal or larger than 4 */ - - uint32 crc32Ret = 0; - const uint32 bytesPerLine = width << size >> 1; - - try { -#ifdef WIN32_ASM - __asm { - push ebx; - push esi; - push edi; - - mov ecx, dword ptr [src]; - mov eax, dword ptr [height]; - mov edx, 0; - dec eax; - -loop2: - mov ebx, dword ptr[bytesPerLine]; - sub ebx, 4; - -loop1: - mov esi, dword ptr [ecx+ebx]; - xor esi, ebx; - rol edx, 4; - add edx, esi; - sub ebx, 4; - jge loop1; - - xor esi, eax; - add edx, esi; - add ecx, dword ptr [rowStride]; - dec eax; - jge loop2; - - mov dword ptr [crc32Ret], edx; - - pop edi; - pop esi; - pop ebx; - } -#else - int y = height - 1; - while (y >= 0) - { - uint32 esi = 0; - int x = bytesPerLine - 4; - while (x >= 0) - { - esi = *(uint32*)(src + x); - esi ^= x; - - crc32Ret = (crc32Ret << 4) + ((crc32Ret >> 28) & 15); - crc32Ret += esi; - x -= 4; - } - esi ^= y; - crc32Ret += esi; - src += rowStride; - --y; - } -#endif - } catch(...) { - DBG_INFO(80, wst("Error: RiceCRC32 exception!\n")); - } - - return crc32Ret; -} - -static -uint8 CalculateMaxCI8b(const uint8* src, uint32 width, uint32 height, uint32 rowStride) -{ - uint8 val = 0; - for (uint32 y = 0; y < height; ++y) { - const uint8 * buf = src + rowStride * y; - for (uint32 x = 0; x val) - val = buf[x]; - if (val == 0xFF) - return 0xFF; - } - } - return val; -} - -static -uint8 CalculateMaxCI4b(const uint8* src, uint32 width, uint32 height, uint32 rowStride) -{ - uint8 val = 0; - uint8 val1, val2; - width >>= 1; - for (uint32 y = 0; y < height; ++y) { - const uint8 * buf = src + rowStride * y; - for (uint32 x = 0; x> 4; - val2 = buf[x] & 0xF; - if (val1 > val) val = val1; - if (val2 > val) val = val2; - if (val == 0xF) - return 0xF; - } - } - return val; -} - -boolean -TxUtil::RiceCRC32_CI4(const uint8* src, int width, int height, int rowStride, - uint32* crc32, uint32* cimax) -{ - /* NOTE: bytes_per_width must be equal or larger than 4 */ - - uint32 crc32Ret = 0; - uint32 cimaxRet = 0; - const uint32 bytes_per_width = width >> 1; - - /*if (bytes_per_width < 4) return 0;*/ - - /* 4bit CI */ - try { -#ifdef WIN32_ASM - __asm { - push ebx; - push esi; - push edi; - - mov ecx, dword ptr [src]; - mov eax, dword ptr [height]; - mov edx, 0; - mov edi, 0; - dec eax; - -loop2: - mov ebx, dword ptr [bytes_per_width]; - sub ebx, 4; - -loop1: - mov esi, dword ptr [ecx+ebx]; - - cmp edi, 0x0000000f; - je findmax0; - - push ecx; - mov ecx, esi; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax8; - mov edi, ecx; - -findmax8: - mov ecx, esi; - shr ecx, 4; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax7; - mov edi, ecx; - -findmax7: - mov ecx, esi; - shr ecx, 8; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax6; - mov edi, ecx; - -findmax6: - mov ecx, esi; - shr ecx, 12; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax5; - mov edi, ecx; - -findmax5: - mov ecx, esi; - shr ecx, 16; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax4; - mov edi, ecx; - -findmax4: - mov ecx, esi; - shr ecx, 20; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax3; - mov edi, ecx; - -findmax3: - mov ecx, esi; - shr ecx, 24; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax2; - mov edi, ecx; - -findmax2: - mov ecx, esi; - shr ecx, 28; - and ecx, 0x0000000f; - cmp ecx, edi; - jb findmax1; - mov edi, ecx; - -findmax1: - pop ecx; - -findmax0: - xor esi, ebx; - rol edx, 4; - add edx, esi; - sub ebx, 4; - jge loop1; - - xor esi, eax; - add edx, esi; - add ecx, dword ptr [rowStride]; - dec eax; - jge loop2; - - mov dword ptr [crc32Ret], edx; - mov dword ptr [cimaxRet], edi; - - pop edi; - pop esi; - pop ebx; - } -#else - crc32Ret = RiceCRC32(src, width, height, 0, rowStride); - cimaxRet = CalculateMaxCI4b(src, width, height, rowStride); -#endif - } catch(...) { - DBG_INFO(80, wst("Error: RiceCRC32 exception!\n")); - } - - *crc32 = crc32Ret; - *cimax = cimaxRet; - - return 1; -} - -boolean -TxUtil::RiceCRC32_CI8(const uint8* src, int width, int height, int rowStride, - uint32* crc32, uint32* cimax) -{ - /* NOTE: bytes_per_width must be equal or larger than 4 */ - - uint32 crc32Ret = 0; - uint32 cimaxRet = 0; - - /* 8bit CI */ - try { -#ifdef WIN32_ASM - const uint32 bytes_per_width = width; - __asm { - push ebx; - push esi; - push edi; - - mov ecx, dword ptr [src]; - mov eax, dword ptr [height]; - mov edx, 0; - mov edi, 0; - dec eax; - -loop2: - mov ebx, dword ptr [bytes_per_width]; - sub ebx, 4; - -loop1: - mov esi, dword ptr [ecx+ebx]; - - cmp edi, 0x000000ff; - je findmax0; - - push ecx; - mov ecx, esi; - and ecx, 0x000000ff; - cmp ecx, edi; - jb findmax4; - mov edi, ecx; - -findmax4: - mov ecx, esi; - shr ecx, 8; - and ecx, 0x000000ff; - cmp ecx, edi; - jb findmax3; - mov edi, ecx; - -findmax3: - mov ecx, esi; - shr ecx, 16; - and ecx, 0x000000ff; - cmp ecx, edi; - jb findmax2; - mov edi, ecx; - -findmax2: - mov ecx, esi; - shr ecx, 24; - and ecx, 0x000000ff; - cmp ecx, edi; - jb findmax1; - mov edi, ecx; - -findmax1: - pop ecx; - -findmax0: - xor esi, ebx; - rol edx, 4; - add edx, esi; - sub ebx, 4; - jge loop1; - - xor esi, eax; - add edx, esi; - add ecx, dword ptr [rowStride]; - dec eax; - jge loop2; - - mov dword ptr [crc32Ret], edx; - mov dword ptr [cimaxRet], edi; - - pop edi; - pop esi; - pop ebx; - } -#else - crc32Ret = RiceCRC32(src, width, height, 1, rowStride); - cimaxRet = CalculateMaxCI8b(src, width, height, rowStride); -#endif - } catch(...) { - DBG_INFO(80, wst("Error: RiceCRC32 exception!\n")); - } - - *crc32 = crc32Ret; - *cimax = cimaxRet; - - return 1; -} - -uint32 TxUtil::getNumberofProcessors() -{ - uint32 numcore = std::thread::hardware_concurrency(); - if (numcore > MAX_NUMCORE) numcore = MAX_NUMCORE; - DBG_INFO(80, wst("Number of processors : %d\n"), numcore); - return numcore; -} - -/* - * Memory buffers for texture manipulations - ******************************************************************************/ -TxMemBuf::TxMemBuf() -{ - for (uint32 i = 0; i < 2; i++) { - _tex[i] = nullptr; - _size[i] = 0; - } -} - -TxMemBuf::~TxMemBuf() -{ - shutdown(); -} - -boolean -TxMemBuf::init(int maxwidth, int maxheight) -{ - try { - for (uint32 i = 0; i < 2; i++) { - if (_tex[i] == nullptr) { - _tex[i] = (uint8 *)malloc(maxwidth * maxheight * 4); - _size[i] = maxwidth * maxheight * 4; - } - - if (_tex[i] == nullptr) { - shutdown(); - return 0; - } - } - - if (_bufs.empty()) { - const int numcore = TxUtil::getNumberofProcessors(); - const size_t numBuffers = numcore*2; - _bufs.resize(numBuffers); - } - } catch(std::bad_alloc) { - shutdown(); - return 0; - } - - return 1; -} - -void -TxMemBuf::shutdown() -{ - for (int i = 0; i < 2; i++) { - if (_tex[i] != nullptr) - free(_tex[i]); - _tex[i] = nullptr; - _size[i] = 0; - } - - _bufs.clear(); -} - -uint8* -TxMemBuf::get(uint32 num) -{ - assert(num < 2); - return _tex[num]; -} - -uint32 -TxMemBuf::size_of(uint32 num) -{ - assert(num < 2); - return _size[num]; -} - -uint32* -TxMemBuf::getThreadBuf(uint32 threadIdx, uint32 num, uint32 size) -{ - assert(num < 2); - const auto idx = threadIdx * 2 + num; - auto& buf = _bufs[idx]; - - if (buf.size() < size) { - try { - buf.resize(size, 0); - } catch(std::bad_alloc) { - return nullptr; - } - } - - return buf.data(); -} - -void setTextureFormat(ColorFormat internalFormat, GHQTexInfo * info) -{ - info->format = u32(internalFormat); - if (internalFormat == graphics::internalcolorFormat::RGBA8) { - info->texture_format = static_cast(u32(graphics::colorFormat::RGBA)); - info->pixel_type = static_cast(u32(graphics::datatype::UNSIGNED_BYTE)); - } else if (internalFormat == graphics::internalcolorFormat::RGB8) { - info->texture_format = static_cast(u32(graphics::colorFormat::RED_GREEN_BLUE)); - info->pixel_type = static_cast(u32(graphics::datatype::UNSIGNED_SHORT_5_6_5)); - } else if (internalFormat == graphics::internalcolorFormat::RGBA4) { - info->texture_format = static_cast(u32(graphics::colorFormat::RGBA)); - info->pixel_type = static_cast(u32(graphics::datatype::UNSIGNED_SHORT_4_4_4_4)); - } else if (internalFormat == graphics::internalcolorFormat::RGB5_A1) { - info->texture_format = static_cast(u32(graphics::colorFormat::RGBA)); - info->pixel_type = static_cast(u32(graphics::datatype::UNSIGNED_SHORT_5_5_5_1)); - } else { - info->texture_format = static_cast(u32(graphics::colorFormat::RGBA)); - info->pixel_type = static_cast(u32(graphics::datatype::UNSIGNED_BYTE)); - } -} diff --git a/GLideN64/src/GLideNHQ/TxUtil.h b/GLideN64/src/GLideNHQ/TxUtil.h deleted file mode 100644 index 26b6a05..0000000 --- a/GLideN64/src/GLideNHQ/TxUtil.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TXUTIL_H__ -#define __TXUTIL_H__ - -/* maximum number of CPU cores allowed */ -#define MAX_NUMCORE 8 - -#include "TxInternal.h" - -/* extension for cache files */ -#define TEXCACHE_EXT wst("htc") -#define TEXSTREAM_EXT wst("hts") - -#include - -class TxUtil -{ -private: - static uint32 RiceCRC32(const uint8* src, int width, int height, int size, int rowStride); - static boolean RiceCRC32_CI4(const uint8* src, int width, int height, int rowStride, - uint32* crc32, uint32* cimax); - static boolean RiceCRC32_CI8(const uint8* src, int width, int height, int rowStride, - uint32* crc32, uint32* cimax); -public: - static int sizeofTx(int width, int height, ColorFormat format); - static uint32 checksumTx(uint8 *data, int width, int height, ColorFormat format); -#if 0 /* unused */ - static uint32 chkAlpha(uint32* src, int width, int height); -#endif - static uint32 checksum(uint8 *src, int width, int height, int size, int rowStride); - static uint64 checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette); - static uint32 getNumberofProcessors(); -}; - -class TxMemBuf -{ -private: - uint8 *_tex[2]; - uint32 _size[2]; - std::vector< std::vector > _bufs; - TxMemBuf(); -public: - static TxMemBuf* getInstance() { - static TxMemBuf txMemBuf; - return &txMemBuf; - } - ~TxMemBuf(); - boolean init(int maxwidth, int maxheight); - void shutdown(); - uint8 *get(uint32 num); - uint32 size_of(uint32 num); - uint32 *getThreadBuf(uint32 threadIdx, uint32 num, uint32 size); -}; - -void setTextureFormat(ColorFormat internalFormat, GHQTexInfo * info); - -#endif /* __TXUTIL_H__ */ diff --git a/GLideN64/src/GLideNHQ/bldno.cpp b/GLideN64/src/GLideNHQ/bldno.cpp deleted file mode 100644 index f71eefc..0000000 --- a/GLideN64/src/GLideNHQ/bldno.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - -int main (void) -{ - struct tm locTime; - time_t sysTime; - char *build; - - time(&sysTime); - locTime = *localtime(&sysTime); - - if ((build = getenv("BUILD_NUMBER")) != NULL) { - printf("#define BUILD_NUMBER %s\n", build); - printf("#define BUILD_NUMBER_STR \"%s\"\n", build); - } else { - unsigned short magic; - magic = (locTime.tm_yday << 7) | - (locTime.tm_hour << 2) | - (locTime.tm_min / 15); - printf("#define BUILD_NUMBER %d\n", magic); - printf("#define BUILD_NUMBER_STR \"%d\"\n", magic); - } - - return 0; -} diff --git a/GLideN64/src/GLideNHQ/bldno.h b/GLideN64/src/GLideNHQ/bldno.h deleted file mode 100644 index eb0ec01..0000000 --- a/GLideN64/src/GLideNHQ/bldno.h +++ /dev/null @@ -1,2 +0,0 @@ -#define BUILD_NUMBER 13480 -#define BUILD_NUMBER_STR "13480" diff --git a/GLideN64/src/GLideNHQ/gpl-2.0.txt b/GLideN64/src/GLideNHQ/gpl-2.0.txt deleted file mode 100644 index d511905..0000000 --- a/GLideN64/src/GLideNHQ/gpl-2.0.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 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. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -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 give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to -this License. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 Program -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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), 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 Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. 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. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; 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. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/GLideN64/src/GLideNHQ/inc/png.h b/GLideN64/src/GLideNHQ/inc/png.h deleted file mode 100644 index 51ac8ab..0000000 --- a/GLideN64/src/GLideNHQ/inc/png.h +++ /dev/null @@ -1,3276 +0,0 @@ - -/* png.h - header file for PNG reference library - * - * libpng version 1.6.32, August 24, 2017 - * - * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This code is released under the libpng license (See LICENSE, below) - * - * Authors and maintainers: - * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat - * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017: - * Glenn Randers-Pehrson. - * See also "Contributing Authors", below. - */ - -/* - * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: - * - * If you modify libpng you may insert additional notices immediately following - * this sentence. - * - * This code is released under the libpng license. - * - * libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are - * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are - * derived from libpng-1.0.6, and are distributed according to the same - * disclaimer and license as libpng-1.0.6 with the following individuals - * added to the list of Contributing Authors: - * - * Simon-Pierre Cadieux - * Eric S. Raymond - * Mans Rullgard - * Cosmin Truta - * Gilles Vollant - * James Yu - * Mandar Sahastrabuddhe - * Google Inc. - * Vadim Barkov - * - * and with the following additions to the disclaimer: - * - * There is no warranty against interference with your enjoyment of the - * library or against infringement. There is no warranty that our - * efforts or the library will fulfill any of your particular purposes - * or needs. This library is provided with all faults, and the entire - * risk of satisfactory quality, performance, accuracy, and effort is with - * the user. - * - * Some files in the "contrib" directory and some configure-generated - * files that are distributed with libpng have other copyright owners and - * are released under other open source licenses. - * - * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are - * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from - * libpng-0.96, and are distributed according to the same disclaimer and - * license as libpng-0.96, with the following individuals added to the list - * of Contributing Authors: - * - * Tom Lane - * Glenn Randers-Pehrson - * Willem van Schaik - * - * libpng versions 0.89, June 1996, through 0.96, May 1997, are - * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, - * and are distributed according to the same disclaimer and license as - * libpng-0.88, with the following individuals added to the list of - * Contributing Authors: - * - * John Bowler - * Kevin Bracey - * Sam Bushell - * Magnus Holmgren - * Greg Roelofs - * Tom Tanner - * - * Some files in the "scripts" directory have other copyright owners - * but are released under this license. - * - * libpng versions 0.5, May 1995, through 0.88, January 1996, are - * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. - * - * For the purposes of this copyright and license, "Contributing Authors" - * is defined as the following set of individuals: - * - * Andreas Dilger - * Dave Martindale - * Guy Eric Schalnat - * Paul Schmidt - * Tim Wegner - * - * The PNG Reference Library is supplied "AS IS". The Contributing Authors - * and Group 42, Inc. disclaim all warranties, expressed or implied, - * including, without limitation, the warranties of merchantability and of - * fitness for any purpose. The Contributing Authors and Group 42, Inc. - * assume no liability for direct, indirect, incidental, special, exemplary, - * or consequential damages, which may result from the use of the PNG - * Reference Library, even if advised of the possibility of such damage. - * - * Permission is hereby granted to use, copy, modify, and distribute this - * source code, or portions hereof, for any purpose, without fee, subject - * to the following restrictions: - * - * 1. The origin of this source code must not be misrepresented. - * - * 2. Altered versions must be plainly marked as such and must not - * be misrepresented as being the original source. - * - * 3. This Copyright notice may not be removed or altered from any - * source or altered source distribution. - * - * The Contributing Authors and Group 42, Inc. specifically permit, without - * fee, and encourage the use of this source code as a component to - * supporting the PNG file format in commercial products. If you use this - * source code in a product, acknowledgment is not required but would be - * appreciated. - * - * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. - * - * TRADEMARK: - * - * The name "libpng" has not been registered by the Copyright owner - * as a trademark in any jurisdiction. However, because libpng has - * been distributed and maintained world-wide, continually since 1995, - * the Copyright owner claims "common-law trademark protection" in any - * jurisdiction where common-law trademark is recognized. - * - * OSI CERTIFICATION: - * - * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is - * a certification mark of the Open Source Initiative. OSI has not addressed - * the additional disclaimers inserted at version 1.0.7. - * - * EXPORT CONTROL: - * - * The Copyright owner believes that the Export Control Classification - * Number (ECCN) for libpng is EAR99, which means not subject to export - * controls or International Traffic in Arms Regulations (ITAR) because - * it is open source, publicly available software, that does not contain - * any encryption software. See the EAR, paragraphs 734.3(b)(3) and - * 734.7(b). - */ - -/* - * A "png_get_copyright" function is available, for convenient use in "about" - * boxes and the like: - * - * printf("%s", png_get_copyright(NULL)); - * - * Also, the PNG logo (in PNG format, of course) is supplied in the - * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). - */ - -/* - * The contributing authors would like to thank all those who helped - * with testing, bug fixes, and patience. This wouldn't have been - * possible without all of you. - * - * Thanks to Frank J. T. Wojcik for helping with the documentation. - */ - -/* Note about libpng version numbers: - * - * Due to various miscommunications, unforeseen code incompatibilities - * and occasional factors outside the authors' control, version numbering - * on the library has not always been consistent and straightforward. - * The following table summarizes matters since version 0.89c, which was - * the first widely used release: - * - * source png.h png.h shared-lib - * version string int version - * ------- ------ ----- ---------- - * 0.89c "1.0 beta 3" 0.89 89 1.0.89 - * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] - * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] - * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] - * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] - * 0.97c 0.97 97 2.0.97 - * 0.98 0.98 98 2.0.98 - * 0.99 0.99 98 2.0.99 - * 0.99a-m 0.99 99 2.0.99 - * 1.00 1.00 100 2.1.0 [100 should be 10000] - * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] - * 1.0.1 png.h string is 10001 2.1.0 - * 1.0.1a-e identical to the 10002 from here on, the shared library - * 1.0.2 source version) 10002 is 2.V where V is the source code - * 1.0.2a-b 10003 version, except as noted. - * 1.0.3 10003 - * 1.0.3a-d 10004 - * 1.0.4 10004 - * 1.0.4a-f 10005 - * 1.0.5 (+ 2 patches) 10005 - * 1.0.5a-d 10006 - * 1.0.5e-r 10100 (not source compatible) - * 1.0.5s-v 10006 (not binary compatible) - * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) - * 1.0.6d-f 10007 (still binary incompatible) - * 1.0.6g 10007 - * 1.0.6h 10007 10.6h (testing xy.z so-numbering) - * 1.0.6i 10007 10.6i - * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) - * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) - * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) - * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) - * 1.0.7 1 10007 (still compatible) - * ... - * 1.0.19 10 10019 10.so.0.19[.0] - * ... - * 1.2.57 13 10257 12.so.0.57[.0] - * ... - * 1.5.28 15 10527 15.so.15.28[.0] - * ... - * 1.6.32 16 10632 16.so.16.32[.0] - * - * Henceforth the source version will match the shared-library major - * and minor numbers; the shared-library major version number will be - * used for changes in backward compatibility, as it is intended. The - * PNG_LIBPNG_VER macro, which is not used within libpng but is available - * for applications, is an unsigned integer of the form xyyzz corresponding - * to the source version x.y.z (leading zeros in y and z). Beta versions - * were given the previous public release number plus a letter, until - * version 1.0.6j; from then on they were given the upcoming public - * release number plus "betaNN" or "rcNN". - * - * Binary incompatibility exists only when applications make direct access - * to the info_ptr or png_ptr members through png.h, and the compiled - * application is loaded with a different version of the library. - * - * DLLNUM will change each time there are forward or backward changes - * in binary compatibility (e.g., when a new feature is added). - * - * See libpng.txt or libpng.3 for more information. The PNG specification - * is available as a W3C Recommendation and as an ISO Specification, - * - * - * If you just need to read a PNG file and don't want to read the documentation - * skip to the end of this file and read the section entitled 'simplified API'. - */ - -/* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.32" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32 - August 24, 2017\n" - -#define PNG_LIBPNG_VER_SONUM 16 -#define PNG_LIBPNG_VER_DLLNUM 16 - -/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ -#define PNG_LIBPNG_VER_MAJOR 1 -#define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 32 - -/* This should match the numeric part of the final component of - * PNG_LIBPNG_VER_STRING, omitting any leading zero: - */ - -#define PNG_LIBPNG_VER_BUILD 0 - -/* Release Status */ -#define PNG_LIBPNG_BUILD_ALPHA 1 -#define PNG_LIBPNG_BUILD_BETA 2 -#define PNG_LIBPNG_BUILD_RC 3 -#define PNG_LIBPNG_BUILD_STABLE 4 -#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 - -/* Release-Specific Flags */ -#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with - PNG_LIBPNG_BUILD_STABLE only */ -#define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with - PNG_LIBPNG_BUILD_SPECIAL */ -#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with - PNG_LIBPNG_BUILD_PRIVATE */ - -#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE - -/* Careful here. At one time, Guy wanted to use 082, but that would be octal. - * We must not include leading zeros. - * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only - * version 1.0.0 was mis-numbered 100 instead of 10000). From - * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release - */ -#define PNG_LIBPNG_VER 10632 /* 1.6.32 */ - -/* Library configuration: these options cannot be changed after - * the library has been built. - */ -#ifndef PNGLCONF_H -/* If pnglibconf.h is missing, you can - * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h - */ -# include "pnglibconf.h" -#endif - -#ifndef PNG_VERSION_INFO_ONLY -/* Machine specific configuration. */ -# include "pngconf.h" -#endif - -/* - * Added at libpng-1.2.8 - * - * Ref MSDN: Private as priority over Special - * VS_FF_PRIVATEBUILD File *was not* built using standard release - * procedures. If this value is given, the StringFileInfo block must - * contain a PrivateBuild string. - * - * VS_FF_SPECIALBUILD File *was* built by the original company using - * standard release procedures but is a variation of the standard - * file of the same version number. If this value is given, the - * StringFileInfo block must contain a SpecialBuild string. - */ - -#ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */ -# define PNG_LIBPNG_BUILD_TYPE \ - (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE) -#else -# ifdef PNG_LIBPNG_SPECIALBUILD -# define PNG_LIBPNG_BUILD_TYPE \ - (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL) -# else -# define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) -# endif -#endif - -#ifndef PNG_VERSION_INFO_ONLY - -/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Version information for C files, stored in png.c. This had better match - * the version above. - */ -#define png_libpng_ver png_get_header_ver(NULL) - -/* This file is arranged in several sections: - * - * 1. [omitted] - * 2. Any configuration options that can be specified by for the application - * code when it is built. (Build time configuration is in pnglibconf.h) - * 3. Type definitions (base types are defined in pngconf.h), structure - * definitions. - * 4. Exported library functions. - * 5. Simplified API. - * 6. Implementation options. - * - * The library source code has additional files (principally pngpriv.h) that - * allow configuration of the library. - */ - -/* Section 1: [omitted] */ - -/* Section 2: run time configuration - * See pnglibconf.h for build time configuration - * - * Run time configuration allows the application to choose between - * implementations of certain arithmetic APIs. The default is set - * at build time and recorded in pnglibconf.h, but it is safe to - * override these (and only these) settings. Note that this won't - * change what the library does, only application code, and the - * settings can (and probably should) be made on a per-file basis - * by setting the #defines before including png.h - * - * Use macros to read integers from PNG data or use the exported - * functions? - * PNG_USE_READ_MACROS: use the macros (see below) Note that - * the macros evaluate their argument multiple times. - * PNG_NO_USE_READ_MACROS: call the relevant library function. - * - * Use the alternative algorithm for compositing alpha samples that - * does not use division? - * PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division' - * algorithm. - * PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm. - * - * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is - * false? - * PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error - * APIs to png_warning. - * Otherwise the calls are mapped to png_error. - */ - -/* Section 3: type definitions, including structures and compile time - * constants. - * See pngconf.h for base types that vary by machine/system - */ - -/* This triggers a compiler error in png.c, if png.c and png.h - * do not agree upon the version number. - */ -typedef char* png_libpng_version_1_6_32; - -/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. - * - * png_struct is the cache of information used while reading or writing a single - * PNG file. One of these is always required, although the simplified API - * (below) hides the creation and destruction of it. - */ -typedef struct png_struct_def png_struct; -typedef const png_struct * png_const_structp; -typedef png_struct * png_structp; -typedef png_struct * * png_structpp; - -/* png_info contains information read from or to be written to a PNG file. One - * or more of these must exist while reading or creating a PNG file. The - * information is not used by libpng during read but is used to control what - * gets written when a PNG file is created. "png_get_" function calls read - * information during read and "png_set_" functions calls write information - * when creating a PNG. - * been moved into a separate header file that is not accessible to - * applications. Read libpng-manual.txt or libpng.3 for more info. - */ -typedef struct png_info_def png_info; -typedef png_info * png_infop; -typedef const png_info * png_const_infop; -typedef png_info * * png_infopp; - -/* Types with names ending 'p' are pointer types. The corresponding types with - * names ending 'rp' are identical pointer types except that the pointer is - * marked 'restrict', which means that it is the only pointer to the object - * passed to the function. Applications should not use the 'restrict' types; - * it is always valid to pass 'p' to a pointer with a function argument of the - * corresponding 'rp' type. Different compilers have different rules with - * regard to type matching in the presence of 'restrict'. For backward - * compatibility libpng callbacks never have 'restrict' in their parameters and, - * consequentially, writing portable application code is extremely difficult if - * an attempt is made to use 'restrict'. - */ -typedef png_struct * PNG_RESTRICT png_structrp; -typedef const png_struct * PNG_RESTRICT png_const_structrp; -typedef png_info * PNG_RESTRICT png_inforp; -typedef const png_info * PNG_RESTRICT png_const_inforp; - -/* Three color definitions. The order of the red, green, and blue, (and the - * exact size) is not important, although the size of the fields need to - * be png_byte or png_uint_16 (as defined below). - */ -typedef struct png_color_struct -{ - png_byte red; - png_byte green; - png_byte blue; -} png_color; -typedef png_color * png_colorp; -typedef const png_color * png_const_colorp; -typedef png_color * * png_colorpp; - -typedef struct png_color_16_struct -{ - png_byte index; /* used for palette files */ - png_uint_16 red; /* for use in red green blue files */ - png_uint_16 green; - png_uint_16 blue; - png_uint_16 gray; /* for use in grayscale files */ -} png_color_16; -typedef png_color_16 * png_color_16p; -typedef const png_color_16 * png_const_color_16p; -typedef png_color_16 * * png_color_16pp; - -typedef struct png_color_8_struct -{ - png_byte red; /* for use in red green blue files */ - png_byte green; - png_byte blue; - png_byte gray; /* for use in grayscale files */ - png_byte alpha; /* for alpha channel files */ -} png_color_8; -typedef png_color_8 * png_color_8p; -typedef const png_color_8 * png_const_color_8p; -typedef png_color_8 * * png_color_8pp; - -/* - * The following two structures are used for the in-core representation - * of sPLT chunks. - */ -typedef struct png_sPLT_entry_struct -{ - png_uint_16 red; - png_uint_16 green; - png_uint_16 blue; - png_uint_16 alpha; - png_uint_16 frequency; -} png_sPLT_entry; -typedef png_sPLT_entry * png_sPLT_entryp; -typedef const png_sPLT_entry * png_const_sPLT_entryp; -typedef png_sPLT_entry * * png_sPLT_entrypp; - -/* When the depth of the sPLT palette is 8 bits, the color and alpha samples - * occupy the LSB of their respective members, and the MSB of each member - * is zero-filled. The frequency member always occupies the full 16 bits. - */ - -typedef struct png_sPLT_struct -{ - png_charp name; /* palette name */ - png_byte depth; /* depth of palette samples */ - png_sPLT_entryp entries; /* palette entries */ - png_int_32 nentries; /* number of palette entries */ -} png_sPLT_t; -typedef png_sPLT_t * png_sPLT_tp; -typedef const png_sPLT_t * png_const_sPLT_tp; -typedef png_sPLT_t * * png_sPLT_tpp; - -#ifdef PNG_TEXT_SUPPORTED -/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, - * and whether that contents is compressed or not. The "key" field - * points to a regular zero-terminated C string. The "text" fields can be a - * regular C string, an empty string, or a NULL pointer. - * However, the structure returned by png_get_text() will always contain - * the "text" field as a regular zero-terminated C string (possibly - * empty), never a NULL pointer, so it can be safely used in printf() and - * other string-handling functions. Note that the "itxt_length", "lang", and - * "lang_key" members of the structure only exist when the library is built - * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by - * default without iTXt support. Also note that when iTXt *is* supported, - * the "lang" and "lang_key" fields contain NULL pointers when the - * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or - * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the - * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag" - * which is always 0 or 1, or its "compression method" which is always 0. - */ -typedef struct png_text_struct -{ - int compression; /* compression value: - -1: tEXt, none - 0: zTXt, deflate - 1: iTXt, none - 2: iTXt, deflate */ - png_charp key; /* keyword, 1-79 character description of "text" */ - png_charp text; /* comment, may be an empty string (ie "") - or a NULL pointer */ - png_size_t text_length; /* length of the text string */ - png_size_t itxt_length; /* length of the itxt string */ - png_charp lang; /* language code, 0-79 characters - or a NULL pointer */ - png_charp lang_key; /* keyword translated UTF-8 string, 0 or more - chars or a NULL pointer */ -} png_text; -typedef png_text * png_textp; -typedef const png_text * png_const_textp; -typedef png_text * * png_textpp; -#endif - -/* Supported compression types for text in PNG files (tEXt, and zTXt). - * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ -#define PNG_TEXT_COMPRESSION_NONE_WR -3 -#define PNG_TEXT_COMPRESSION_zTXt_WR -2 -#define PNG_TEXT_COMPRESSION_NONE -1 -#define PNG_TEXT_COMPRESSION_zTXt 0 -#define PNG_ITXT_COMPRESSION_NONE 1 -#define PNG_ITXT_COMPRESSION_zTXt 2 -#define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ - -/* png_time is a way to hold the time in an machine independent way. - * Two conversions are provided, both from time_t and struct tm. There - * is no portable way to convert to either of these structures, as far - * as I know. If you know of a portable way, send it to me. As a side - * note - PNG has always been Year 2000 compliant! - */ -typedef struct png_time_struct -{ - png_uint_16 year; /* full year, as in, 1995 */ - png_byte month; /* month of year, 1 - 12 */ - png_byte day; /* day of month, 1 - 31 */ - png_byte hour; /* hour of day, 0 - 23 */ - png_byte minute; /* minute of hour, 0 - 59 */ - png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ -} png_time; -typedef png_time * png_timep; -typedef const png_time * png_const_timep; -typedef png_time * * png_timepp; - -#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\ - defined(PNG_USER_CHUNKS_SUPPORTED) -/* png_unknown_chunk is a structure to hold queued chunks for which there is - * no specific support. The idea is that we can use this to queue - * up private chunks for output even though the library doesn't actually - * know about their semantics. - * - * The data in the structure is set by libpng on read and used on write. - */ -typedef struct png_unknown_chunk_t -{ - png_byte name[5]; /* Textual chunk name with '\0' terminator */ - png_byte *data; /* Data, should not be modified on read! */ - png_size_t size; - - /* On write 'location' must be set using the flag values listed below. - * Notice that on read it is set by libpng however the values stored have - * more bits set than are listed below. Always treat the value as a - * bitmask. On write set only one bit - setting multiple bits may cause the - * chunk to be written in multiple places. - */ - png_byte location; /* mode of operation at read time */ -} -png_unknown_chunk; - -typedef png_unknown_chunk * png_unknown_chunkp; -typedef const png_unknown_chunk * png_const_unknown_chunkp; -typedef png_unknown_chunk * * png_unknown_chunkpp; -#endif - -/* Flag values for the unknown chunk location byte. */ -#define PNG_HAVE_IHDR 0x01 -#define PNG_HAVE_PLTE 0x02 -#define PNG_AFTER_IDAT 0x08 - -/* Maximum positive integer used in PNG is (2^31)-1 */ -#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) -#define PNG_UINT_32_MAX ((png_uint_32)(-1)) -#define PNG_SIZE_MAX ((png_size_t)(-1)) - -/* These are constants for fixed point values encoded in the - * PNG specification manner (x100000) - */ -#define PNG_FP_1 100000 -#define PNG_FP_HALF 50000 -#define PNG_FP_MAX ((png_fixed_point)0x7fffffffL) -#define PNG_FP_MIN (-PNG_FP_MAX) - -/* These describe the color_type field in png_info. */ -/* color type masks */ -#define PNG_COLOR_MASK_PALETTE 1 -#define PNG_COLOR_MASK_COLOR 2 -#define PNG_COLOR_MASK_ALPHA 4 - -/* color types. Note that not all combinations are legal */ -#define PNG_COLOR_TYPE_GRAY 0 -#define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) -#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) -#define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) -#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) -/* aliases */ -#define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA -#define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA - -/* This is for compression type. PNG 1.0-1.2 only define the single type. */ -#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ -#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE - -/* This is for filter type. PNG 1.0-1.2 only define the single type. */ -#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ -#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ -#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE - -/* These are for the interlacing type. These values should NOT be changed. */ -#define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ -#define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ -#define PNG_INTERLACE_LAST 2 /* Not a valid value */ - -/* These are for the oFFs chunk. These values should NOT be changed. */ -#define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ -#define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ -#define PNG_OFFSET_LAST 2 /* Not a valid value */ - -/* These are for the pCAL chunk. These values should NOT be changed. */ -#define PNG_EQUATION_LINEAR 0 /* Linear transformation */ -#define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ -#define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ -#define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ -#define PNG_EQUATION_LAST 4 /* Not a valid value */ - -/* These are for the sCAL chunk. These values should NOT be changed. */ -#define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ -#define PNG_SCALE_METER 1 /* meters per pixel */ -#define PNG_SCALE_RADIAN 2 /* radians per pixel */ -#define PNG_SCALE_LAST 3 /* Not a valid value */ - -/* These are for the pHYs chunk. These values should NOT be changed. */ -#define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ -#define PNG_RESOLUTION_METER 1 /* pixels/meter */ -#define PNG_RESOLUTION_LAST 2 /* Not a valid value */ - -/* These are for the sRGB chunk. These values should NOT be changed. */ -#define PNG_sRGB_INTENT_PERCEPTUAL 0 -#define PNG_sRGB_INTENT_RELATIVE 1 -#define PNG_sRGB_INTENT_SATURATION 2 -#define PNG_sRGB_INTENT_ABSOLUTE 3 -#define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ - -/* This is for text chunks */ -#define PNG_KEYWORD_MAX_LENGTH 79 - -/* Maximum number of entries in PLTE/sPLT/tRNS arrays */ -#define PNG_MAX_PALETTE_LENGTH 256 - -/* These determine if an ancillary chunk's data has been successfully read - * from the PNG header, or if the application has filled in the corresponding - * data in the info_struct to be written into the output file. The values - * of the PNG_INFO_ defines should NOT be changed. - */ -#define PNG_INFO_gAMA 0x0001U -#define PNG_INFO_sBIT 0x0002U -#define PNG_INFO_cHRM 0x0004U -#define PNG_INFO_PLTE 0x0008U -#define PNG_INFO_tRNS 0x0010U -#define PNG_INFO_bKGD 0x0020U -#define PNG_INFO_hIST 0x0040U -#define PNG_INFO_pHYs 0x0080U -#define PNG_INFO_oFFs 0x0100U -#define PNG_INFO_tIME 0x0200U -#define PNG_INFO_pCAL 0x0400U -#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */ -#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */ -#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */ -#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */ -#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */ -#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */ - -/* This is used for the transformation routines, as some of them - * change these values for the row. It also should enable using - * the routines for other purposes. - */ -typedef struct png_row_info_struct -{ - png_uint_32 width; /* width of row */ - png_size_t rowbytes; /* number of bytes in row */ - png_byte color_type; /* color type of row */ - png_byte bit_depth; /* bit depth of row */ - png_byte channels; /* number of channels (1, 2, 3, or 4) */ - png_byte pixel_depth; /* bits per pixel (depth * channels) */ -} png_row_info; - -typedef png_row_info * png_row_infop; -typedef png_row_info * * png_row_infopp; - -/* These are the function types for the I/O functions and for the functions - * that allow the user to override the default I/O functions with his or her - * own. The png_error_ptr type should match that of user-supplied warning - * and error functions, while the png_rw_ptr type should match that of the - * user read/write data functions. Note that the 'write' function must not - * modify the buffer it is passed. The 'read' function, on the other hand, is - * expected to return the read data in the buffer. - */ -typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); -typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t)); -typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); -typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32, - int)); -typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, - int)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); -typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); - -/* The following callback receives png_uint_32 row_number, int pass for the - * png_bytep data of the row. When transforming an interlaced image the - * row number is the row number within the sub-image of the interlace pass, so - * the value will increase to the height of the sub-image (not the full image) - * then reset to 0 for the next pass. - * - * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to - * find the output pixel (x,y) given an interlaced sub-image pixel - * (row,col,pass). (See below for these macros.) - */ -typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, - png_uint_32, int)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, - png_bytep)); -#endif - -#ifdef PNG_USER_CHUNKS_SUPPORTED -typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, - png_unknown_chunkp)); -#endif -#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED -/* not used anywhere */ -/* typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); */ -#endif - -#ifdef PNG_SETJMP_SUPPORTED -/* This must match the function definition in , and the application - * must include this before png.h to obtain the definition of jmp_buf. The - * function is required to be PNG_NORETURN, but this is not checked. If the - * function does return the application will crash via an abort() or similar - * system level call. - * - * If you get a warning here while building the library you may need to make - * changes to ensure that pnglibconf.h records the calling convention used by - * your compiler. This may be very difficult - try using a different compiler - * to build the library! - */ -PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef); -#endif - -/* Transform masks for the high-level interface */ -#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ -#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ -#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ -#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ -#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ -#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ -#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ -#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ -#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ -#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ -#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ -#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ -#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ -/* Added to libpng-1.2.34 */ -#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER -#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ -/* Added to libpng-1.4.0 */ -#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ -/* Added to libpng-1.5.4 */ -#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ -#if INT_MAX >= 0x8000 /* else this might break */ -#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ -#endif - -/* Flags for MNG supported features */ -#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 -#define PNG_FLAG_MNG_FILTER_64 0x04 -#define PNG_ALL_MNG_FEATURES 0x05 - -/* NOTE: prior to 1.5 these functions had no 'API' style declaration, - * this allowed the zlib default functions to be used on Windows - * platforms. In 1.5 the zlib default malloc (which just calls malloc and - * ignores the first argument) should be completely compatible with the - * following. - */ -typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, - png_alloc_size_t)); -typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); - -/* Section 4: exported functions - * Here are the function definitions most commonly used. This is not - * the place to find out how to use libpng. See libpng-manual.txt for the - * full explanation, see example.c for the summary. This just provides - * a simple one line description of the use of each function. - * - * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in - * pngconf.h and in the *.dfn files in the scripts directory. - * - * PNG_EXPORT(ordinal, type, name, (args)); - * - * ordinal: ordinal that is used while building - * *.def files. The ordinal value is only - * relevant when preprocessing png.h with - * the *.dfn files for building symbol table - * entries, and are removed by pngconf.h. - * type: return type of the function - * name: function name - * args: function arguments, with types - * - * When we wish to append attributes to a function prototype we use - * the PNG_EXPORTA() macro instead. - * - * PNG_EXPORTA(ordinal, type, name, (args), attributes); - * - * ordinal, type, name, and args: same as in PNG_EXPORT(). - * attributes: function attributes - */ - -/* Returns the version number of the library */ -PNG_EXPORT(1, png_uint_32, png_access_version_number, (void)); - -/* Tell lib we have already handled the first magic bytes. - * Handling more than 8 bytes from the beginning of the file is an error. - */ -PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes)); - -/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a - * PNG file. Returns zero if the supplied bytes match the 8-byte PNG - * signature, and non-zero otherwise. Having num_to_check == 0 or - * start > 7 will always fail (ie return non-zero). - */ -PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start, - png_size_t num_to_check)); - -/* Simple signature checking function. This is the same as calling - * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). - */ -#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) - -/* Allocate and initialize png_ptr struct for reading, and any other memory. */ -PNG_EXPORTA(4, png_structp, png_create_read_struct, - (png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn), - PNG_ALLOCATED); - -/* Allocate and initialize png_ptr struct for writing, and any other memory */ -PNG_EXPORTA(5, png_structp, png_create_write_struct, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn), - PNG_ALLOCATED); - -PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size, - (png_const_structrp png_ptr)); - -PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr, - png_size_t size)); - -/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp - * match up. - */ -#ifdef PNG_SETJMP_SUPPORTED -/* This function returns the jmp_buf built in to *png_ptr. It must be - * supplied with an appropriate 'longjmp' function to use on that jmp_buf - * unless the default error function is overridden in which case NULL is - * acceptable. The size of the jmp_buf is checked against the actual size - * allocated by the library - the call will return NULL on a mismatch - * indicating an ABI mismatch. - */ -PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr, - png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); -# define png_jmpbuf(png_ptr) \ - (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf)))) -#else -# define png_jmpbuf(png_ptr) \ - (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) -#endif -/* This function should be used by libpng applications in place of - * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it - * will use it; otherwise it will call PNG_ABORT(). This function was - * added in libpng-1.5.0. - */ -PNG_EXPORTA(9, void, png_longjmp, (png_const_structrp png_ptr, int val), - PNG_NORETURN); - -#ifdef PNG_READ_SUPPORTED -/* Reset the compression stream */ -PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED); -#endif - -/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ -#ifdef PNG_USER_MEM_SUPPORTED -PNG_EXPORTA(11, png_structp, png_create_read_struct_2, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn, - png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), - PNG_ALLOCATED); -PNG_EXPORTA(12, png_structp, png_create_write_struct_2, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn, - png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), - PNG_ALLOCATED); -#endif - -/* Write the PNG file signature. */ -PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr)); - -/* Write a PNG chunk - size, type, (optional) data, CRC. */ -PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep - chunk_name, png_const_bytep data, png_size_t length)); - -/* Write the start of a PNG chunk - length and chunk name. */ -PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr, - png_const_bytep chunk_name, png_uint_32 length)); - -/* Write the data of a PNG chunk started with png_write_chunk_start(). */ -PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr, - png_const_bytep data, png_size_t length)); - -/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ -PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr)); - -/* Allocate and initialize the info structure */ -PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr), - PNG_ALLOCATED); - -/* DEPRECATED: this function allowed init structures to be created using the - * default allocation method (typically malloc). Use is deprecated in 1.6.0 and - * the API will be removed in the future. - */ -PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr, - png_size_t png_info_struct_size), PNG_DEPRECATED); - -/* Writes all the PNG information before the image. */ -PNG_EXPORT(20, void, png_write_info_before_PLTE, - (png_structrp png_ptr, png_const_inforp info_ptr)); -PNG_EXPORT(21, void, png_write_info, - (png_structrp png_ptr, png_const_inforp info_ptr)); - -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED -/* Read the information before the actual image data. */ -PNG_EXPORT(22, void, png_read_info, - (png_structrp png_ptr, png_inforp info_ptr)); -#endif - -#ifdef PNG_TIME_RFC1123_SUPPORTED - /* Convert to a US string format: there is no localization support in this - * routine. The original implementation used a 29 character buffer in - * png_struct, this will be removed in future versions. - */ -#if PNG_LIBPNG_VER < 10700 -/* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */ -PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, (png_structrp png_ptr, - png_const_timep ptime),PNG_DEPRECATED); -#endif -PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, (char out[29], - png_const_timep ptime)); -#endif - -#ifdef PNG_CONVERT_tIME_SUPPORTED -/* Convert from a struct tm to png_time */ -PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime, - const struct tm * ttime)); - -/* Convert from time_t to png_time. Uses gmtime() */ -PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime)); -#endif /* CONVERT_tIME */ - -#ifdef PNG_READ_EXPAND_SUPPORTED -/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ -PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr)); -PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr)); -PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr)); -PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structrp png_ptr)); -#endif - -#ifdef PNG_READ_EXPAND_16_SUPPORTED -/* Expand to 16-bit channels, forces conversion of palette to RGB and expansion - * of a tRNS chunk if present. - */ -PNG_EXPORT(221, void, png_set_expand_16, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* Use blue, green, red order for pixels. */ -PNG_EXPORT(30, void, png_set_bgr, (png_structrp png_ptr)); -#endif - -#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED -/* Expand the grayscale to 24-bit RGB if necessary. */ -PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr)); -#endif - -#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED -/* Reduce RGB to grayscale. */ -#define PNG_ERROR_ACTION_NONE 1 -#define PNG_ERROR_ACTION_WARN 2 -#define PNG_ERROR_ACTION_ERROR 3 -#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ - -PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr, - int error_action, double red, double green)) -PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr, - int error_action, png_fixed_point red, png_fixed_point green)) - -PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp - png_ptr)); -#endif - -#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED -PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, - png_colorp palette)); -#endif - -#ifdef PNG_READ_ALPHA_MODE_SUPPORTED -/* How the alpha channel is interpreted - this affects how the color channels - * of a PNG file are returned to the calling application when an alpha channel, - * or a tRNS chunk in a palette file, is present. - * - * This has no effect on the way pixels are written into a PNG output - * datastream. The color samples in a PNG datastream are never premultiplied - * with the alpha samples. - * - * The default is to return data according to the PNG specification: the alpha - * channel is a linear measure of the contribution of the pixel to the - * corresponding composited pixel, and the color channels are unassociated - * (not premultiplied). The gamma encoded color channels must be scaled - * according to the contribution and to do this it is necessary to undo - * the encoding, scale the color values, perform the composition and reencode - * the values. This is the 'PNG' mode. - * - * The alternative is to 'associate' the alpha with the color information by - * storing color channel values that have been scaled by the alpha. - * image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes - * (the latter being the two common names for associated alpha color channels). - * - * For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha - * value is equal to the maximum value. - * - * The final choice is to gamma encode the alpha channel as well. This is - * broken because, in practice, no implementation that uses this choice - * correctly undoes the encoding before handling alpha composition. Use this - * choice only if other serious errors in the software or hardware you use - * mandate it; the typical serious error is for dark halos to appear around - * opaque areas of the composited PNG image because of arithmetic overflow. - * - * The API function png_set_alpha_mode specifies which of these choices to use - * with an enumerated 'mode' value and the gamma of the required output: - */ -#define PNG_ALPHA_PNG 0 /* according to the PNG standard */ -#define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ -#define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ -#define PNG_ALPHA_PREMULTIPLIED 1 /* as above */ -#define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ -#define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ - -PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode, - double output_gamma)) -PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, - int mode, png_fixed_point output_gamma)) -#endif - -#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) -/* The output_gamma value is a screen gamma in libpng terminology: it expresses - * how to decode the output values, not how they are encoded. - */ -#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */ -#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */ -#define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */ -#define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */ -#endif - -/* The following are examples of calls to png_set_alpha_mode to achieve the - * required overall gamma correction and, where necessary, alpha - * premultiplication. - * - * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); - * This is the default libpng handling of the alpha channel - it is not - * pre-multiplied into the color components. In addition the call states - * that the output is for a sRGB system and causes all PNG files without gAMA - * chunks to be assumed to be encoded using sRGB. - * - * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); - * In this case the output is assumed to be something like an sRGB conformant - * display preceeded by a power-law lookup table of power 1.45. This is how - * early Mac systems behaved. - * - * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR); - * This is the classic Jim Blinn approach and will work in academic - * environments where everything is done by the book. It has the shortcoming - * of assuming that input PNG data with no gamma information is linear - this - * is unlikely to be correct unless the PNG files where generated locally. - * Most of the time the output precision will be so low as to show - * significant banding in dark areas of the image. - * - * png_set_expand_16(pp); - * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB); - * This is a somewhat more realistic Jim Blinn inspired approach. PNG files - * are assumed to have the sRGB encoding if not marked with a gamma value and - * the output is always 16 bits per component. This permits accurate scaling - * and processing of the data. If you know that your input PNG files were - * generated locally you might need to replace PNG_DEFAULT_sRGB with the - * correct value for your system. - * - * png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB); - * If you just need to composite the PNG image onto an existing background - * and if you control the code that does this you can use the optimization - * setting. In this case you just copy completely opaque pixels to the - * output. For pixels that are not completely transparent (you just skip - * those) you do the composition math using png_composite or png_composite_16 - * below then encode the resultant 8-bit or 16-bit values to match the output - * encoding. - * - * Other cases - * If neither the PNG nor the standard linear encoding work for you because - * of the software or hardware you use then you have a big problem. The PNG - * case will probably result in halos around the image. The linear encoding - * will probably result in a washed out, too bright, image (it's actually too - * contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably - * substantially reduce the halos. Alternatively try: - * - * png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB); - * This option will also reduce the halos, but there will be slight dark - * halos round the opaque parts of the image where the background is light. - * In the OPTIMIZED mode the halos will be light halos where the background - * is dark. Take your pick - the halos are unavoidable unless you can get - * your hardware/software fixed! (The OPTIMIZED approach is slightly - * faster.) - * - * When the default gamma of PNG files doesn't match the output gamma. - * If you have PNG files with no gamma information png_set_alpha_mode allows - * you to provide a default gamma, but it also sets the ouput gamma to the - * matching value. If you know your PNG files have a gamma that doesn't - * match the output you can take advantage of the fact that - * png_set_alpha_mode always sets the output gamma but only sets the PNG - * default if it is not already set: - * - * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); - * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); - * The first call sets both the default and the output gamma values, the - * second call overrides the output gamma without changing the default. This - * is easier than achieving the same effect with png_set_gamma. You must use - * PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will - * fire if more than one call to png_set_alpha_mode and png_set_background is - * made in the same read operation, however multiple calls with PNG_ALPHA_PNG - * are ignored. - */ - -#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED -PNG_EXPORT(36, void, png_set_strip_alpha, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) -/* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */ -PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler, - int flags)); -/* The values of the PNG_FILLER_ defines should NOT be changed */ -# define PNG_FILLER_BEFORE 0 -# define PNG_FILLER_AFTER 1 -/* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */ -PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr, - png_uint_32 filler, int flags)); -#endif /* READ_FILLER || WRITE_FILLER */ - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* Swap bytes in 16-bit depth files. */ -PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) -/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ -PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ - defined(PNG_WRITE_PACKSWAP_SUPPORTED) -/* Swap packing order of pixels in bytes. */ -PNG_EXPORT(43, void, png_set_packswap, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) -/* Converts files to legal bit depths. */ -PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p - true_bits)); -#endif - -#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ - defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* Have the code handle the interlacing. Returns the number of passes. - * MUST be called before png_read_update_info or png_start_read_image, - * otherwise it will not have the desired effect. Note that it is still - * necessary to call png_read_row or png_read_rows png_get_image_height - * times for each pass. -*/ -PNG_EXPORT(45, int, png_set_interlace_handling, (png_structrp png_ptr)); -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -/* Invert monochrome files */ -PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr)); -#endif - -#ifdef PNG_READ_BACKGROUND_SUPPORTED -/* Handle alpha and tRNS by replacing with a background color. Prior to - * libpng-1.5.4 this API must not be called before the PNG file header has been - * read. Doing so will result in unexpected behavior and possible warnings or - * errors if the PNG file contains a bKGD chunk. - */ -PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr, - png_const_color_16p background_color, int background_gamma_code, - int need_expand, double background_gamma)) -PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr, - png_const_color_16p background_color, int background_gamma_code, - int need_expand, png_fixed_point background_gamma)) -#endif -#ifdef PNG_READ_BACKGROUND_SUPPORTED -# define PNG_BACKGROUND_GAMMA_UNKNOWN 0 -# define PNG_BACKGROUND_GAMMA_SCREEN 1 -# define PNG_BACKGROUND_GAMMA_FILE 2 -# define PNG_BACKGROUND_GAMMA_UNIQUE 3 -#endif - -#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED -/* Scale a 16-bit depth file down to 8-bit, accurately. */ -PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr)); -#endif - -#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED -#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */ -/* Strip the second byte of information from a 16-bit depth file. */ -PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr)); -#endif - -#ifdef PNG_READ_QUANTIZE_SUPPORTED -/* Turn on quantizing, and reduce the palette to the number of colors - * available. - */ -PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr, - png_colorp palette, int num_palette, int maximum_colors, - png_const_uint_16p histogram, int full_quantize)); -#endif - -#ifdef PNG_READ_GAMMA_SUPPORTED -/* The threshold on gamma processing is configurable but hard-wired into the - * library. The following is the floating point variant. - */ -#define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001) - -/* Handle gamma correction. Screen_gamma=(display_exponent). - * NOTE: this API simply sets the screen and file gamma values. It will - * therefore override the value for gamma in a PNG file if it is called after - * the file header has been read - use with care - call before reading the PNG - * file for best results! - * - * These routines accept the same gamma values as png_set_alpha_mode (described - * above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either - * API (floating point or fixed.) Notice, however, that the 'file_gamma' value - * is the inverse of a 'screen gamma' value. - */ -PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr, - double screen_gamma, double override_file_gamma)) -PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr, - png_fixed_point screen_gamma, png_fixed_point override_file_gamma)) -#endif - -#ifdef PNG_WRITE_FLUSH_SUPPORTED -/* Set how many lines between output flushes - 0 for no flushing */ -PNG_EXPORT(51, void, png_set_flush, (png_structrp png_ptr, int nrows)); -/* Flush the current PNG output buffer */ -PNG_EXPORT(52, void, png_write_flush, (png_structrp png_ptr)); -#endif - -/* Optional update palette with requested transformations */ -PNG_EXPORT(53, void, png_start_read_image, (png_structrp png_ptr)); - -/* Optional call to update the users info structure */ -PNG_EXPORT(54, void, png_read_update_info, (png_structrp png_ptr, - png_inforp info_ptr)); - -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED -/* Read one or more rows of image data. */ -PNG_EXPORT(55, void, png_read_rows, (png_structrp png_ptr, png_bytepp row, - png_bytepp display_row, png_uint_32 num_rows)); -#endif - -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED -/* Read a row of data. */ -PNG_EXPORT(56, void, png_read_row, (png_structrp png_ptr, png_bytep row, - png_bytep display_row)); -#endif - -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED -/* Read the whole image into memory at once. */ -PNG_EXPORT(57, void, png_read_image, (png_structrp png_ptr, png_bytepp image)); -#endif - -/* Write a row of image data */ -PNG_EXPORT(58, void, png_write_row, (png_structrp png_ptr, - png_const_bytep row)); - -/* Write a few rows of image data: (*row) is not written; however, the type - * is declared as writeable to maintain compatibility with previous versions - * of libpng and to allow the 'display_row' array from read_rows to be passed - * unchanged to write_rows. - */ -PNG_EXPORT(59, void, png_write_rows, (png_structrp png_ptr, png_bytepp row, - png_uint_32 num_rows)); - -/* Write the image data */ -PNG_EXPORT(60, void, png_write_image, (png_structrp png_ptr, png_bytepp image)); - -/* Write the end of the PNG file. */ -PNG_EXPORT(61, void, png_write_end, (png_structrp png_ptr, - png_inforp info_ptr)); - -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED -/* Read the end of the PNG file. */ -PNG_EXPORT(62, void, png_read_end, (png_structrp png_ptr, png_inforp info_ptr)); -#endif - -/* Free any memory associated with the png_info_struct */ -PNG_EXPORT(63, void, png_destroy_info_struct, (png_const_structrp png_ptr, - png_infopp info_ptr_ptr)); - -/* Free any memory associated with the png_struct and the png_info_structs */ -PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr, - png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); - -/* Free any memory associated with the png_struct and the png_info_structs */ -PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr, - png_infopp info_ptr_ptr)); - -/* Set the libpng method of handling chunk CRC errors */ -PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action, - int ancil_action)); - -/* Values for png_set_crc_action() say how to handle CRC errors in - * ancillary and critical chunks, and whether to use the data contained - * therein. Note that it is impossible to "discard" data in a critical - * chunk. For versions prior to 0.90, the action was always error/quit, - * whereas in version 0.90 and later, the action for CRC errors in ancillary - * chunks is warn/discard. These values should NOT be changed. - * - * value action:critical action:ancillary - */ -#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ -#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ -#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ -#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ -#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ -#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ - -#ifdef PNG_WRITE_SUPPORTED -/* These functions give the user control over the scan-line filtering in - * libpng and the compression methods used by zlib. These functions are - * mainly useful for testing, as the defaults should work with most users. - * Those users who are tight on memory or want faster performance at the - * expense of compression can modify them. See the compression library - * header file (zlib.h) for an explination of the compression functions. - */ - -/* Set the filtering method(s) used by libpng. Currently, the only valid - * value for "method" is 0. - */ -PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method, - int filters)); -#endif /* WRITE */ - -/* Flags for png_set_filter() to say which filters to use. The flags - * are chosen so that they don't conflict with real filter types - * below, in case they are supplied instead of the #defined constants. - * These values should NOT be changed. - */ -#define PNG_NO_FILTERS 0x00 -#define PNG_FILTER_NONE 0x08 -#define PNG_FILTER_SUB 0x10 -#define PNG_FILTER_UP 0x20 -#define PNG_FILTER_AVG 0x40 -#define PNG_FILTER_PAETH 0x80 -#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP) -#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH) - -/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. - * These defines should NOT be changed. - */ -#define PNG_FILTER_VALUE_NONE 0 -#define PNG_FILTER_VALUE_SUB 1 -#define PNG_FILTER_VALUE_UP 2 -#define PNG_FILTER_VALUE_AVG 3 -#define PNG_FILTER_VALUE_PAETH 4 -#define PNG_FILTER_VALUE_LAST 5 - -#ifdef PNG_WRITE_SUPPORTED -#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */ -PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr, - int heuristic_method, int num_weights, png_const_doublep filter_weights, - png_const_doublep filter_costs)) -PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, - (png_structrp png_ptr, int heuristic_method, int num_weights, - png_const_fixed_point_p filter_weights, - png_const_fixed_point_p filter_costs)) -#endif /* WRITE_WEIGHTED_FILTER */ - -/* The following are no longer used and will be removed from libpng-1.7: */ -#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ -#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ -#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ -#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ - -/* Set the library compression level. Currently, valid values range from - * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 - * (0 - no compression, 9 - "maximal" compression). Note that tests have - * shown that zlib compression levels 3-6 usually perform as well as level 9 - * for PNG images, and do considerably fewer caclulations. In the future, - * these values may not correspond directly to the zlib compression levels. - */ -#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED -PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr, - int level)); - -PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr, - int mem_level)); - -PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr, - int strategy)); - -/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a - * smaller value of window_bits if it can do so safely. - */ -PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr, - int window_bits)); - -PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr, - int method)); -#endif /* WRITE_CUSTOMIZE_COMPRESSION */ - -#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED -/* Also set zlib parameters for compressing non-IDAT chunks */ -PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr, - int level)); - -PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr, - int mem_level)); - -PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr, - int strategy)); - -/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a - * smaller value of window_bits if it can do so safely. - */ -PNG_EXPORT(225, void, png_set_text_compression_window_bits, - (png_structrp png_ptr, int window_bits)); - -PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr, - int method)); -#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */ -#endif /* WRITE */ - -/* These next functions are called for input/output, memory, and error - * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, - * and call standard C I/O routines such as fread(), fwrite(), and - * fprintf(). These functions can be made to use other I/O routines - * at run time for those applications that need to handle I/O in a - * different manner by calling png_set_???_fn(). See libpng-manual.txt for - * more information. - */ - -#ifdef PNG_STDIO_SUPPORTED -/* Initialize the input/output for the PNG file to the default functions. */ -PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp)); -#endif - -/* Replace the (error and abort), and warning functions with user - * supplied functions. If no messages are to be printed you must still - * write and use replacement functions. The replacement error_fn should - * still do a longjmp to the last setjmp location if you are using this - * method of error handling. If error_fn or warning_fn is NULL, the - * default function will be used. - */ - -PNG_EXPORT(75, void, png_set_error_fn, (png_structrp png_ptr, - png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); - -/* Return the user pointer associated with the error functions */ -PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr)); - -/* Replace the default data output functions with a user supplied one(s). - * If buffered output is not used, then output_flush_fn can be set to NULL. - * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time - * output_flush_fn will be ignored (and thus can be NULL). - * It is probably a mistake to use NULL for output_flush_fn if - * write_data_fn is not also NULL unless you have built libpng with - * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's - * default flush function, which uses the standard *FILE structure, will - * be used. - */ -PNG_EXPORT(77, void, png_set_write_fn, (png_structrp png_ptr, png_voidp io_ptr, - png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); - -/* Replace the default data input function with a user supplied one. */ -PNG_EXPORT(78, void, png_set_read_fn, (png_structrp png_ptr, png_voidp io_ptr, - png_rw_ptr read_data_fn)); - -/* Return the user pointer associated with the I/O functions */ -PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_const_structrp png_ptr)); - -PNG_EXPORT(80, void, png_set_read_status_fn, (png_structrp png_ptr, - png_read_status_ptr read_row_fn)); - -PNG_EXPORT(81, void, png_set_write_status_fn, (png_structrp png_ptr, - png_write_status_ptr write_row_fn)); - -#ifdef PNG_USER_MEM_SUPPORTED -/* Replace the default memory allocation functions with user supplied one(s). */ -PNG_EXPORT(82, void, png_set_mem_fn, (png_structrp png_ptr, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -/* Return the user pointer associated with the memory functions */ -PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structrp png_ptr)); -#endif - -#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED -PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structrp png_ptr, - png_user_transform_ptr read_user_transform_fn)); -#endif - -#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED -PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structrp png_ptr, - png_user_transform_ptr write_user_transform_fn)); -#endif - -#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED -PNG_EXPORT(86, void, png_set_user_transform_info, (png_structrp png_ptr, - png_voidp user_transform_ptr, int user_transform_depth, - int user_transform_channels)); -/* Return the user pointer associated with the user transform functions */ -PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, - (png_const_structrp png_ptr)); -#endif - -#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED -/* Return information about the row currently being processed. Note that these - * APIs do not fail but will return unexpected results if called outside a user - * transform callback. Also note that when transforming an interlaced image the - * row number is the row number within the sub-image of the interlace pass, so - * the value will increase to the height of the sub-image (not the full image) - * then reset to 0 for the next pass. - * - * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to - * find the output pixel (x,y) given an interlaced sub-image pixel - * (row,col,pass). (See below for these macros.) - */ -PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structrp)); -PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp)); -#endif - -#ifdef PNG_READ_USER_CHUNKS_SUPPORTED -/* This callback is called only for *unknown* chunks. If - * PNG_HANDLE_AS_UNKNOWN_SUPPORTED is set then it is possible to set known - * chunks to be treated as unknown, however in this case the callback must do - * any processing required by the chunk (e.g. by calling the appropriate - * png_set_ APIs.) - * - * There is no write support - on write, by default, all the chunks in the - * 'unknown' list are written in the specified position. - * - * The integer return from the callback function is interpreted thus: - * - * negative: An error occurred; png_chunk_error will be called. - * zero: The chunk was not handled, the chunk will be saved. A critical - * chunk will cause an error at this point unless it is to be saved. - * positive: The chunk was handled, libpng will ignore/discard it. - * - * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about - * how this behavior will change in libpng 1.7 - */ -PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr, - png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); -#endif - -#ifdef PNG_USER_CHUNKS_SUPPORTED -PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr)); -#endif - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -/* Sets the function callbacks for the push reader, and a pointer to a - * user-defined structure available to the callback functions. - */ -PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structrp png_ptr, - png_voidp progressive_ptr, png_progressive_info_ptr info_fn, - png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); - -/* Returns the user pointer associated with the push read functions */ -PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, - (png_const_structrp png_ptr)); - -/* Function to be called when data becomes available */ -PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr, - png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size)); - -/* A function which may be called *only* within png_process_data to stop the - * processing of any more data. The function returns the number of bytes - * remaining, excluding any that libpng has cached internally. A subsequent - * call to png_process_data must supply these bytes again. If the argument - * 'save' is set to true the routine will first save all the pending data and - * will always return 0. - */ -PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save)); - -/* A function which may be called *only* outside (after) a call to - * png_process_data. It returns the number of bytes of data to skip in the - * input. Normally it will return 0, but if it returns a non-zero value the - * application must skip than number of bytes of input data and pass the - * following data to the next call to png_process_data. - */ -PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); - -/* Function that combines rows. 'new_row' is a flag that should come from - * the callback and be non-NULL if anything needs to be done; the library - * stores its own version of the new data internally and ignores the passed - * in value. - */ -PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr, - png_bytep old_row, png_const_bytep new_row)); -#endif /* PROGRESSIVE_READ */ - -PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED); -/* Added at libpng version 1.4.0 */ -PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED); - -/* Added at libpng version 1.2.4 */ -PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED); - -/* Frees a pointer allocated by png_malloc() */ -PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr)); - -/* Free data that was allocated internally */ -PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 free_me, int num)); - -/* Reassign responsibility for freeing existing data, whether allocated - * by libpng or by the application; this works on the png_info structure passed - * in, it does not change the state for other png_info structures. - * - * It is unlikely that this function works correctly as of 1.6.0 and using it - * may result either in memory leaks or double free of allocated data. - */ -PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr, - png_inforp info_ptr, int freer, png_uint_32 mask)); - -/* Assignments for png_data_freer */ -#define PNG_DESTROY_WILL_FREE_DATA 1 -#define PNG_SET_WILL_FREE_DATA 1 -#define PNG_USER_WILL_FREE_DATA 2 -/* Flags for png_ptr->free_me and info_ptr->free_me */ -#define PNG_FREE_HIST 0x0008U -#define PNG_FREE_ICCP 0x0010U -#define PNG_FREE_SPLT 0x0020U -#define PNG_FREE_ROWS 0x0040U -#define PNG_FREE_PCAL 0x0080U -#define PNG_FREE_SCAL 0x0100U -#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED -# define PNG_FREE_UNKN 0x0200U -#endif -/* PNG_FREE_LIST 0x0400U removed in 1.6.0 because it is ignored */ -#define PNG_FREE_PLTE 0x1000U -#define PNG_FREE_TRNS 0x2000U -#define PNG_FREE_TEXT 0x4000U -#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */ -#define PNG_FREE_ALL 0xffffU -#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ - -#ifdef PNG_USER_MEM_SUPPORTED -PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED); -PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr, - png_voidp ptr), PNG_DEPRECATED); -#endif - -#ifdef PNG_ERROR_TEXT_SUPPORTED -/* Fatal error in PNG image of libpng - can't continue */ -PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr, - png_const_charp error_message), PNG_NORETURN); - -/* The same, but the chunk name is prepended to the error string. */ -PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr, - png_const_charp error_message), PNG_NORETURN); - -#else -/* Fatal error in PNG image of libpng - can't continue */ -PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN); -# define png_error(s1,s2) png_err(s1) -# define png_chunk_error(s1,s2) png_err(s1) -#endif - -#ifdef PNG_WARNINGS_SUPPORTED -/* Non-fatal error in libpng. Can continue, but may have a problem. */ -PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr, - png_const_charp warning_message)); - -/* Non-fatal error in libpng, chunk name is prepended to message. */ -PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr, - png_const_charp warning_message)); -#else -# define png_warning(s1,s2) ((void)(s1)) -# define png_chunk_warning(s1,s2) ((void)(s1)) -#endif - -#ifdef PNG_BENIGN_ERRORS_SUPPORTED -/* Benign error in libpng. Can continue, but may have a problem. - * User can choose whether to handle as a fatal error or as a warning. */ -PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr, - png_const_charp warning_message)); - -#ifdef PNG_READ_SUPPORTED -/* Same, chunk name is prepended to message (only during read) */ -PNG_EXPORT(108, void, png_chunk_benign_error, (png_const_structrp png_ptr, - png_const_charp warning_message)); -#endif - -PNG_EXPORT(109, void, png_set_benign_errors, - (png_structrp png_ptr, int allowed)); -#else -# ifdef PNG_ALLOW_BENIGN_ERRORS -# define png_benign_error png_warning -# define png_chunk_benign_error png_chunk_warning -# else -# define png_benign_error png_error -# define png_chunk_benign_error png_chunk_error -# endif -#endif - -/* The png_set_ functions are for storing values in the png_info_struct. - * Similarly, the png_get_ calls are used to read values from the - * png_info_struct, either storing the parameters in the passed variables, or - * setting pointers into the png_info_struct where the data is stored. The - * png_get_ functions return a non-zero value if the data was available - * in info_ptr, or return zero and do not change any of the parameters if the - * data was not available. - * - * These functions should be used instead of directly accessing png_info - * to avoid problems with future changes in the size and internal layout of - * png_info_struct. - */ -/* Returns "flag" if chunk data is valid in info_ptr. */ -PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 flag)); - -/* Returns number of bytes needed to hold a transformed row. */ -PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -#ifdef PNG_INFO_IMAGE_SUPPORTED -/* Returns row_pointers, which is an array of pointers to scanlines that was - * returned from png_read_png(). - */ -PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Set row_pointers, which is an array of pointers to scanlines for use - * by png_write_png(). - */ -PNG_EXPORT(113, void, png_set_rows, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytepp row_pointers)); -#endif - -/* Returns number of color channels in image. */ -PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -#ifdef PNG_EASY_ACCESS_SUPPORTED -/* Returns image width in pixels. */ -PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image height in pixels. */ -PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image bit_depth. */ -PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image color_type. */ -PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image filter_type. */ -PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image interlace_type. */ -PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image compression_type. */ -PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); - -/* Returns image resolution in pixels per meter, from pHYs chunk data. */ -PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); -PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); -PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); - -/* Returns pixel aspect ratio, computed from pHYs chunk data. */ -PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) -PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) - -/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ -PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); -PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); -PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); -PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); - -#endif /* EASY_ACCESS */ - -#ifdef PNG_READ_SUPPORTED -/* Returns pointer to signature string read from PNG header */ -PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); -#endif - -#ifdef PNG_bKGD_SUPPORTED -PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr, - png_inforp info_ptr, png_color_16p *background)); -#endif - -#ifdef PNG_bKGD_SUPPORTED -PNG_EXPORT(132, void, png_set_bKGD, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_color_16p background)); -#endif - -#ifdef PNG_cHRM_SUPPORTED -PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, - double *red_y, double *green_x, double *green_y, double *blue_x, - double *blue_y)) -PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z, - double *green_X, double *green_Y, double *green_Z, double *blue_X, - double *blue_Y, double *blue_Z)) -PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, - png_fixed_point *int_white_x, png_fixed_point *int_white_y, - png_fixed_point *int_red_x, png_fixed_point *int_red_y, - png_fixed_point *int_green_x, png_fixed_point *int_green_y, - png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)) -PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, - png_fixed_point *int_red_X, png_fixed_point *int_red_Y, - png_fixed_point *int_red_Z, png_fixed_point *int_green_X, - png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, - png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, - png_fixed_point *int_blue_Z)) -#endif - -#ifdef PNG_cHRM_SUPPORTED -PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr, - png_inforp info_ptr, - double white_x, double white_y, double red_x, double red_y, double green_x, - double green_y, double blue_x, double blue_y)) -PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr, - png_inforp info_ptr, double red_X, double red_Y, double red_Z, - double green_X, double green_Y, double green_Z, double blue_X, - double blue_Y, double blue_Z)) -PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, png_fixed_point int_white_x, - png_fixed_point int_white_y, png_fixed_point int_red_x, - png_fixed_point int_red_y, png_fixed_point int_green_x, - png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)) -PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, - png_fixed_point int_red_Z, png_fixed_point int_green_X, - png_fixed_point int_green_Y, png_fixed_point int_green_Z, - png_fixed_point int_blue_X, png_fixed_point int_blue_Y, - png_fixed_point int_blue_Z)) -#endif - -#ifdef PNG_eXIf_SUPPORTED -PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytep *exif)); -PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_bytep exif)); - -PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif)); -PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif)); -#endif - -#ifdef PNG_gAMA_SUPPORTED -PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *file_gamma)) -PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, - png_fixed_point *int_file_gamma)) -#endif - -#ifdef PNG_gAMA_SUPPORTED -PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr, - png_inforp info_ptr, double file_gamma)) -PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, png_fixed_point int_file_gamma)) -#endif - -#ifdef PNG_hIST_SUPPORTED -PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_16p *hist)); -PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_uint_16p hist)); -#endif - -PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, - int *bit_depth, int *color_type, int *interlace_method, - int *compression_method, int *filter_method)); - -PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_method, int compression_method, - int filter_method)); - -#ifdef PNG_oFFs_SUPPORTED -PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, - int *unit_type)); -#endif - -#ifdef PNG_oFFs_SUPPORTED -PNG_EXPORT(146, void, png_set_oFFs, (png_const_structrp png_ptr, - png_inforp info_ptr, png_int_32 offset_x, png_int_32 offset_y, - int unit_type)); -#endif - -#ifdef PNG_pCAL_SUPPORTED -PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structrp png_ptr, - png_inforp info_ptr, png_charp *purpose, png_int_32 *X0, - png_int_32 *X1, int *type, int *nparams, png_charp *units, - png_charpp *params)); -#endif - -#ifdef PNG_pCAL_SUPPORTED -PNG_EXPORT(148, void, png_set_pCAL, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1, - int type, int nparams, png_const_charp units, png_charpp params)); -#endif - -#ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, - int *unit_type)); -#endif - -#ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(150, void, png_set_pHYs, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); -#endif - -PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structrp png_ptr, - png_inforp info_ptr, png_colorp *palette, int *num_palette)); - -PNG_EXPORT(152, void, png_set_PLTE, (png_structrp png_ptr, - png_inforp info_ptr, png_const_colorp palette, int num_palette)); - -#ifdef PNG_sBIT_SUPPORTED -PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_color_8p *sig_bit)); -#endif - -#ifdef PNG_sBIT_SUPPORTED -PNG_EXPORT(154, void, png_set_sBIT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_color_8p sig_bit)); -#endif - -#ifdef PNG_sRGB_SUPPORTED -PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structrp png_ptr, - png_const_inforp info_ptr, int *file_srgb_intent)); -#endif - -#ifdef PNG_sRGB_SUPPORTED -PNG_EXPORT(156, void, png_set_sRGB, (png_const_structrp png_ptr, - png_inforp info_ptr, int srgb_intent)); -PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_const_structrp png_ptr, - png_inforp info_ptr, int srgb_intent)); -#endif - -#ifdef PNG_iCCP_SUPPORTED -PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structrp png_ptr, - png_inforp info_ptr, png_charpp name, int *compression_type, - png_bytepp profile, png_uint_32 *proflen)); -#endif - -#ifdef PNG_iCCP_SUPPORTED -PNG_EXPORT(159, void, png_set_iCCP, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_charp name, int compression_type, - png_const_bytep profile, png_uint_32 proflen)); -#endif - -#ifdef PNG_sPLT_SUPPORTED -PNG_EXPORT(160, int, png_get_sPLT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_sPLT_tpp entries)); -#endif - -#ifdef PNG_sPLT_SUPPORTED -PNG_EXPORT(161, void, png_set_sPLT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)); -#endif - -#ifdef PNG_TEXT_SUPPORTED -/* png_get_text also returns the number of text chunks in *num_text */ -PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr, - png_inforp info_ptr, png_textp *text_ptr, int *num_text)); -#endif - -/* Note while png_set_text() will accept a structure whose text, - * language, and translated keywords are NULL pointers, the structure - * returned by png_get_text will always contain regular - * zero-terminated C strings. They might be empty strings but - * they will never be NULL pointers. - */ - -#ifdef PNG_TEXT_SUPPORTED -PNG_EXPORT(163, void, png_set_text, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_textp text_ptr, int num_text)); -#endif - -#ifdef PNG_tIME_SUPPORTED -PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structrp png_ptr, - png_inforp info_ptr, png_timep *mod_time)); -#endif - -#ifdef PNG_tIME_SUPPORTED -PNG_EXPORT(165, void, png_set_tIME, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_timep mod_time)); -#endif - -#ifdef PNG_tRNS_SUPPORTED -PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytep *trans_alpha, int *num_trans, - png_color_16p *trans_color)); -#endif - -#ifdef PNG_tRNS_SUPPORTED -PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr, - png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans, - png_const_color_16p trans_color)); -#endif - -#ifdef PNG_sCAL_SUPPORTED -PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr, - png_const_inforp info_ptr, int *unit, double *width, double *height)) -#if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ - defined(PNG_FLOATING_POINT_SUPPORTED) -/* NOTE: this API is currently implemented using floating point arithmetic, - * consequently it can only be used on systems with floating point support. - * In any case the range of values supported by png_fixed_point is small and it - * is highly recommended that png_get_sCAL_s be used instead. - */ -PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, - png_fixed_point *width, png_fixed_point *height)) -#endif -PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, - (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, - png_charpp swidth, png_charpp sheight)); - -PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr, - png_inforp info_ptr, int unit, double width, double height)) -PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, int unit, png_fixed_point width, - png_fixed_point height)) -PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr, - png_inforp info_ptr, int unit, - png_const_charp swidth, png_const_charp sheight)); -#endif /* sCAL */ - -#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED -/* Provide the default handling for all unknown chunks or, optionally, for - * specific unknown chunks. - * - * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was - * ignored and the default was used, the per-chunk setting only had an effect on - * write. If you wish to have chunk-specific handling on read in code that must - * work on earlier versions you must use a user chunk callback to specify the - * desired handling (keep or discard.) - * - * The 'keep' parameter is a PNG_HANDLE_CHUNK_ value as listed below. The - * parameter is interpreted as follows: - * - * READ: - * PNG_HANDLE_CHUNK_AS_DEFAULT: - * Known chunks: do normal libpng processing, do not keep the chunk (but - * see the comments below about PNG_HANDLE_AS_UNKNOWN_SUPPORTED) - * Unknown chunks: for a specific chunk use the global default, when used - * as the default discard the chunk data. - * PNG_HANDLE_CHUNK_NEVER: - * Discard the chunk data. - * PNG_HANDLE_CHUNK_IF_SAFE: - * Keep the chunk data if the chunk is not critical else raise a chunk - * error. - * PNG_HANDLE_CHUNK_ALWAYS: - * Keep the chunk data. - * - * If the chunk data is saved it can be retrieved using png_get_unknown_chunks, - * below. Notice that specifying "AS_DEFAULT" as a global default is equivalent - * to specifying "NEVER", however when "AS_DEFAULT" is used for specific chunks - * it simply resets the behavior to the libpng default. - * - * INTERACTION WTIH USER CHUNK CALLBACKS: - * The per-chunk handling is always used when there is a png_user_chunk_ptr - * callback and the callback returns 0; the chunk is then always stored *unless* - * it is critical and the per-chunk setting is other than ALWAYS. Notice that - * the global default is *not* used in this case. (In effect the per-chunk - * value is incremented to at least IF_SAFE.) - * - * IMPORTANT NOTE: this behavior will change in libpng 1.7 - the global and - * per-chunk defaults will be honored. If you want to preserve the current - * behavior when your callback returns 0 you must set PNG_HANDLE_CHUNK_IF_SAFE - * as the default - if you don't do this libpng 1.6 will issue a warning. - * - * If you want unhandled unknown chunks to be discarded in libpng 1.6 and - * earlier simply return '1' (handled). - * - * PNG_HANDLE_AS_UNKNOWN_SUPPORTED: - * If this is *not* set known chunks will always be handled by libpng and - * will never be stored in the unknown chunk list. Known chunks listed to - * png_set_keep_unknown_chunks will have no effect. If it is set then known - * chunks listed with a keep other than AS_DEFAULT will *never* be processed - * by libpng, in addition critical chunks must either be processed by the - * callback or saved. - * - * The IHDR and IEND chunks must not be listed. Because this turns off the - * default handling for chunks that would otherwise be recognized the - * behavior of libpng transformations may well become incorrect! - * - * WRITE: - * When writing chunks the options only apply to the chunks specified by - * png_set_unknown_chunks (below), libpng will *always* write known chunks - * required by png_set_ calls and will always write the core critical chunks - * (as required for PLTE). - * - * Each chunk in the png_set_unknown_chunks list is looked up in the - * png_set_keep_unknown_chunks list to find the keep setting, this is then - * interpreted as follows: - * - * PNG_HANDLE_CHUNK_AS_DEFAULT: - * Write safe-to-copy chunks and write other chunks if the global - * default is set to _ALWAYS, otherwise don't write this chunk. - * PNG_HANDLE_CHUNK_NEVER: - * Do not write the chunk. - * PNG_HANDLE_CHUNK_IF_SAFE: - * Write the chunk if it is safe-to-copy, otherwise do not write it. - * PNG_HANDLE_CHUNK_ALWAYS: - * Write the chunk. - * - * Note that the default behavior is effectively the opposite of the read case - - * in read unknown chunks are not stored by default, in write they are written - * by default. Also the behavior of PNG_HANDLE_CHUNK_IF_SAFE is very different - * - on write the safe-to-copy bit is checked, on read the critical bit is - * checked and on read if the chunk is critical an error will be raised. - * - * num_chunks: - * =========== - * If num_chunks is positive, then the "keep" parameter specifies the manner - * for handling only those chunks appearing in the chunk_list array, - * otherwise the chunk list array is ignored. - * - * If num_chunks is 0 the "keep" parameter specifies the default behavior for - * unknown chunks, as described above. - * - * If num_chunks is negative, then the "keep" parameter specifies the manner - * for handling all unknown chunks plus all chunks recognized by libpng - * except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to - * be processed by libpng. - */ -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr, - int keep, png_const_bytep chunk_list, int num_chunks)); -#endif /* HANDLE_AS_UNKNOWN */ - -/* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned; - * the result is therefore true (non-zero) if special handling is required, - * false for the default handling. - */ -PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr, - png_const_bytep chunk_name)); -#endif /* SET_UNKNOWN_CHUNKS */ - -#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED -PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_unknown_chunkp unknowns, - int num_unknowns)); - /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added - * unknowns to the location currently stored in the png_struct. This is - * invariably the wrong value on write. To fix this call the following API - * for each chunk in the list with the correct location. If you know your - * code won't be compiled on earlier versions you can rely on - * png_set_unknown_chunks(write-ptr, png_get_unknown_chunks(read-ptr)) doing - * the correct thing. - */ - -PNG_EXPORT(175, void, png_set_unknown_chunk_location, - (png_const_structrp png_ptr, png_inforp info_ptr, int chunk, int location)); - -PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structrp png_ptr, - png_inforp info_ptr, png_unknown_chunkpp entries)); -#endif - -/* Png_free_data() will turn off the "valid" flag for anything it frees. - * If you need to turn it off for a chunk that your application has freed, - * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); - */ -PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr, - png_inforp info_ptr, int mask)); - -#ifdef PNG_INFO_IMAGE_SUPPORTED -/* The "params" pointer is currently not used and is for future expansion. */ -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED -PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr, - int transforms, png_voidp params)); -#endif -#ifdef PNG_WRITE_SUPPORTED -PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr, - int transforms, png_voidp params)); -#endif -#endif - -PNG_EXPORT(180, png_const_charp, png_get_copyright, - (png_const_structrp png_ptr)); -PNG_EXPORT(181, png_const_charp, png_get_header_ver, - (png_const_structrp png_ptr)); -PNG_EXPORT(182, png_const_charp, png_get_header_version, - (png_const_structrp png_ptr)); -PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, - (png_const_structrp png_ptr)); - -#ifdef PNG_MNG_FEATURES_SUPPORTED -PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr, - png_uint_32 mng_features_permitted)); -#endif - -/* For use in png_set_keep_unknown, added to version 1.2.6 */ -#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 -#define PNG_HANDLE_CHUNK_NEVER 1 -#define PNG_HANDLE_CHUNK_IF_SAFE 2 -#define PNG_HANDLE_CHUNK_ALWAYS 3 -#define PNG_HANDLE_CHUNK_LAST 4 - -/* Strip the prepended error numbers ("#nnn ") from error and warning - * messages before passing them to the error or warning handler. - */ -#ifdef PNG_ERROR_NUMBERS_SUPPORTED -PNG_EXPORT(185, void, png_set_strip_error_numbers, (png_structrp png_ptr, - png_uint_32 strip_mode)); -#endif - -/* Added in libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -PNG_EXPORT(186, void, png_set_user_limits, (png_structrp png_ptr, - png_uint_32 user_width_max, png_uint_32 user_height_max)); -PNG_EXPORT(187, png_uint_32, png_get_user_width_max, - (png_const_structrp png_ptr)); -PNG_EXPORT(188, png_uint_32, png_get_user_height_max, - (png_const_structrp png_ptr)); -/* Added in libpng-1.4.0 */ -PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structrp png_ptr, - png_uint_32 user_chunk_cache_max)); -PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, - (png_const_structrp png_ptr)); -/* Added in libpng-1.4.1 */ -PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structrp png_ptr, - png_alloc_size_t user_chunk_cache_max)); -PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, - (png_const_structrp png_ptr)); -#endif - -#if defined(PNG_INCH_CONVERSIONS_SUPPORTED) -PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); - -PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); - -PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); - -PNG_FP_EXPORT(196, float, png_get_x_offset_inches, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) -#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ -PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) -#endif - -PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr, - png_const_inforp info_ptr)) -#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ -PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) -#endif - -# ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, - int *unit_type)); -# endif /* pHYs */ -#endif /* INCH_CONVERSIONS */ - -/* Added in libpng-1.4.0 */ -#ifdef PNG_IO_STATE_SUPPORTED -PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr)); - -/* Removed from libpng 1.6; use png_get_io_chunk_type. */ -PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr), - PNG_DEPRECATED) - -PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, - (png_const_structrp png_ptr)); - -/* The flags returned by png_get_io_state() are the following: */ -# define PNG_IO_NONE 0x0000 /* no I/O at this moment */ -# define PNG_IO_READING 0x0001 /* currently reading */ -# define PNG_IO_WRITING 0x0002 /* currently writing */ -# define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ -# define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ -# define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ -# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ -# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ -# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ -#endif /* IO_STATE */ - -/* Interlace support. The following macros are always defined so that if - * libpng interlace handling is turned off the macros may be used to handle - * interlaced images within the application. - */ -#define PNG_INTERLACE_ADAM7_PASSES 7 - -/* Two macros to return the first row and first column of the original, - * full, image which appears in a given pass. 'pass' is in the range 0 - * to 6 and the result is in the range 0 to 7. - */ -#define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7) -#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7) - -/* A macro to return the offset between pixels in the output row for a pair of - * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that - * follows. Note that ROW_OFFSET is the offset from one row to the next whereas - * COL_OFFSET is from one column to the next, within a row. - */ -#define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8) -#define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1)) - -/* Two macros to help evaluate the number of rows or columns in each - * pass. This is expressed as a shift - effectively log2 of the number or - * rows or columns in each 8x8 tile of the original image. - */ -#define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3) -#define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3) - -/* Hence two macros to determine the number of rows or columns in a given - * pass of an image given its height or width. In fact these macros may - * return non-zero even though the sub-image is empty, because the other - * dimension may be empty for a small image. - */ -#define PNG_PASS_ROWS(height, pass) (((height)+(((1<>PNG_PASS_ROW_SHIFT(pass)) -#define PNG_PASS_COLS(width, pass) (((width)+(((1<>PNG_PASS_COL_SHIFT(pass)) - -/* For the reader row callbacks (both progressive and sequential) it is - * necessary to find the row in the output image given a row in an interlaced - * image, so two more macros: - */ -#define PNG_ROW_FROM_PASS_ROW(y_in, pass) \ - (((y_in)<>(((7-(off))-(pass))<<2)) & 0xF) | \ - ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0)) - -#define PNG_ROW_IN_INTERLACE_PASS(y, pass) \ - ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1) -#define PNG_COL_IN_INTERLACE_PASS(x, pass) \ - ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1) - -#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED -/* With these routines we avoid an integer divide, which will be slower on - * most machines. However, it does take more operations than the corresponding - * divide method, so it may be slower on a few RISC systems. There are two - * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. - * - * Note that the rounding factors are NOT supposed to be the same! 128 and - * 32768 are correct for the NODIV code; 127 and 32767 are correct for the - * standard method. - * - * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] - */ - - /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ - -# define png_composite(composite, fg, alpha, bg) \ - { \ - png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \ - * (png_uint_16)(alpha) \ - + (png_uint_16)(bg)*(png_uint_16)(255 \ - - (png_uint_16)(alpha)) + 128); \ - (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \ - } - -# define png_composite_16(composite, fg, alpha, bg) \ - { \ - png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \ - * (png_uint_32)(alpha) \ - + (png_uint_32)(bg)*(65535 \ - - (png_uint_32)(alpha)) + 32768); \ - (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); \ - } - -#else /* Standard method using integer division */ - -# define png_composite(composite, fg, alpha, bg) \ - (composite) = \ - (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \ - (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ - 127) / 255)) - -# define png_composite_16(composite, fg, alpha, bg) \ - (composite) = \ - (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \ - (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \ - 32767) / 65535)) -#endif /* READ_COMPOSITE_NODIV */ - -#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED -PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); -PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); -PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); -#endif - -PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr, - png_const_bytep buf)); -/* No png_get_int_16 -- may be added if there's a real need for it. */ - -/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ -#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED -PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i)); -#endif -#ifdef PNG_SAVE_INT_32_SUPPORTED -PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); -#endif - -/* Place a 16-bit number into a buffer in PNG byte order. - * The parameter is declared unsigned int, not png_uint_16, - * just to avoid potential problems on pre-ANSI C compilers. - */ -#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED -PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); -/* No png_save_int_16 -- may be added if there's a real need for it. */ -#endif - -#ifdef PNG_USE_READ_MACROS -/* Inline macros to do direct reads of bytes from the input buffer. - * The png_get_int_32() routine assumes we are using two's complement - * format for negative values, which is almost certainly true. - */ -# define PNG_get_uint_32(buf) \ - (((png_uint_32)(*(buf)) << 24) + \ - ((png_uint_32)(*((buf) + 1)) << 16) + \ - ((png_uint_32)(*((buf) + 2)) << 8) + \ - ((png_uint_32)(*((buf) + 3)))) - - /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the - * function) incorrectly returned a value of type png_uint_32. - */ -# define PNG_get_uint_16(buf) \ - ((png_uint_16) \ - (((unsigned int)(*(buf)) << 8) + \ - ((unsigned int)(*((buf) + 1))))) - -# define PNG_get_int_32(buf) \ - ((png_int_32)((*(buf) & 0x80) \ - ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \ - : (png_int_32)png_get_uint_32(buf))) - -/* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h, - * but defining a macro name prefixed with PNG_PREFIX. - */ -# ifndef PNG_PREFIX -# define png_get_uint_32(buf) PNG_get_uint_32(buf) -# define png_get_uint_16(buf) PNG_get_uint_16(buf) -# define png_get_int_32(buf) PNG_get_int_32(buf) -# endif -#else -# ifdef PNG_PREFIX - /* No macros; revert to the (redefined) function */ -# define PNG_get_uint_32 (png_get_uint_32) -# define PNG_get_uint_16 (png_get_uint_16) -# define PNG_get_int_32 (png_get_int_32) -# endif -#endif - -#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED -PNG_EXPORT(242, void, png_set_check_for_invalid_index, - (png_structrp png_ptr, int allowed)); -# ifdef PNG_GET_PALETTE_MAX_SUPPORTED -PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr, - png_const_infop info_ptr)); -# endif -#endif /* CHECK_FOR_INVALID_INDEX */ - -/******************************************************************************* - * Section 5: SIMPLIFIED API - ******************************************************************************* - * - * Please read the documentation in libpng-manual.txt (TODO: write said - * documentation) if you don't understand what follows. - * - * The simplified API hides the details of both libpng and the PNG file format - * itself. It allows PNG files to be read into a very limited number of - * in-memory bitmap formats or to be written from the same formats. If these - * formats do not accomodate your needs then you can, and should, use the more - * sophisticated APIs above - these support a wide variety of in-memory formats - * and a wide variety of sophisticated transformations to those formats as well - * as a wide variety of APIs to manipulate ancillary information. - * - * To read a PNG file using the simplified API: - * - * 1) Declare a 'png_image' structure (see below) on the stack, set the - * version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL - * (this is REQUIRED, your program may crash if you don't do it.) - * 2) Call the appropriate png_image_begin_read... function. - * 3) Set the png_image 'format' member to the required sample format. - * 4) Allocate a buffer for the image and, if required, the color-map. - * 5) Call png_image_finish_read to read the image and, if required, the - * color-map into your buffers. - * - * There are no restrictions on the format of the PNG input itself; all valid - * color types, bit depths, and interlace methods are acceptable, and the - * input image is transformed as necessary to the requested in-memory format - * during the png_image_finish_read() step. The only caveat is that if you - * request a color-mapped image from a PNG that is full-color or makes - * complex use of an alpha channel the transformation is extremely lossy and the - * result may look terrible. - * - * To write a PNG file using the simplified API: - * - * 1) Declare a 'png_image' structure on the stack and memset() it to all zero. - * 2) Initialize the members of the structure that describe the image, setting - * the 'format' member to the format of the image samples. - * 3) Call the appropriate png_image_write... function with a pointer to the - * image and, if necessary, the color-map to write the PNG data. - * - * png_image is a structure that describes the in-memory format of an image - * when it is being read or defines the in-memory format of an image that you - * need to write: - */ -#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \ - defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) - -#define PNG_IMAGE_VERSION 1 - -typedef struct png_control *png_controlp; -typedef struct -{ - png_controlp opaque; /* Initialize to NULL, free with png_image_free */ - png_uint_32 version; /* Set to PNG_IMAGE_VERSION */ - png_uint_32 width; /* Image width in pixels (columns) */ - png_uint_32 height; /* Image height in pixels (rows) */ - png_uint_32 format; /* Image format as defined below */ - png_uint_32 flags; /* A bit mask containing informational flags */ - png_uint_32 colormap_entries; - /* Number of entries in the color-map */ - - /* In the event of an error or warning the following field will be set to a - * non-zero value and the 'message' field will contain a '\0' terminated - * string with the libpng error or warning message. If both warnings and - * an error were encountered, only the error is recorded. If there - * are multiple warnings, only the first one is recorded. - * - * The upper 30 bits of this value are reserved, the low two bits contain - * a value as follows: - */ -# define PNG_IMAGE_WARNING 1 -# define PNG_IMAGE_ERROR 2 - /* - * The result is a two-bit code such that a value more than 1 indicates - * a failure in the API just called: - * - * 0 - no warning or error - * 1 - warning - * 2 - error - * 3 - error preceded by warning - */ -# define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1) - - png_uint_32 warning_or_error; - - char message[64]; -} png_image, *png_imagep; - -/* The samples of the image have one to four channels whose components have - * original values in the range 0 to 1.0: - * - * 1: A single gray or luminance channel (G). - * 2: A gray/luminance channel and an alpha channel (GA). - * 3: Three red, green, blue color channels (RGB). - * 4: Three color channels and an alpha channel (RGBA). - * - * The components are encoded in one of two ways: - * - * a) As a small integer, value 0..255, contained in a single byte. For the - * alpha channel the original value is simply value/255. For the color or - * luminance channels the value is encoded according to the sRGB specification - * and matches the 8-bit format expected by typical display devices. - * - * The color/gray channels are not scaled (pre-multiplied) by the alpha - * channel and are suitable for passing to color management software. - * - * b) As a value in the range 0..65535, contained in a 2-byte integer. All - * channels can be converted to the original value by dividing by 65535; all - * channels are linear. Color channels use the RGB encoding (RGB end-points) of - * the sRGB specification. This encoding is identified by the - * PNG_FORMAT_FLAG_LINEAR flag below. - * - * When the simplified API needs to convert between sRGB and linear colorspaces, - * the actual sRGB transfer curve defined in the sRGB specification (see the - * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 - * approximation used elsewhere in libpng. - * - * When an alpha channel is present it is expected to denote pixel coverage - * of the color or luminance channels and is returned as an associated alpha - * channel: the color/gray channels are scaled (pre-multiplied) by the alpha - * value. - * - * The samples are either contained directly in the image data, between 1 and 8 - * bytes per pixel according to the encoding, or are held in a color-map indexed - * by bytes in the image data. In the case of a color-map the color-map entries - * are individual samples, encoded as above, and the image data has one byte per - * pixel to select the relevant sample from the color-map. - */ - -/* PNG_FORMAT_* - * - * #defines to be used in png_image::format. Each #define identifies a - * particular layout of sample data and, if present, alpha values. There are - * separate defines for each of the two component encodings. - * - * A format is built up using single bit flag values. All combinations are - * valid. Formats can be built up from the flag values or you can use one of - * the predefined values below. When testing formats always use the FORMAT_FLAG - * macros to test for individual features - future versions of the library may - * add new flags. - * - * When reading or writing color-mapped images the format should be set to the - * format of the entries in the color-map then png_image_{read,write}_colormap - * called to read or write the color-map and set the format correctly for the - * image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly! - * - * NOTE: libpng can be built with particular features disabled. If you see - * compiler errors because the definition of one of the following flags has been - * compiled out it is because libpng does not have the required support. It is - * possible, however, for the libpng configuration to enable the format on just - * read or just write; in that case you may see an error at run time. You can - * guard against this by checking for the definition of the appropriate - * "_SUPPORTED" macro, one of: - * - * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED - */ -#define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */ -#define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */ -#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2-byte channels else 1-byte */ -#define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */ - -#ifdef PNG_FORMAT_BGR_SUPPORTED -# define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */ -#endif - -#ifdef PNG_FORMAT_AFIRST_SUPPORTED -# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */ -#endif - -/* Commonly used formats have predefined macros. - * - * First the single byte (sRGB) formats: - */ -#define PNG_FORMAT_GRAY 0 -#define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA -#define PNG_FORMAT_AG (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST) -#define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR -#define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR) -#define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA) -#define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST) -#define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA) -#define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST) - -/* Then the linear 2-byte formats. When naming these "Y" is used to - * indicate a luminance (gray) channel. - */ -#define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR -#define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA) -#define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR) -#define PNG_FORMAT_LINEAR_RGB_ALPHA \ - (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA) - -/* With color-mapped formats the image data is one byte for each pixel, the byte - * is an index into the color-map which is formatted as above. To obtain a - * color-mapped format it is sufficient just to add the PNG_FOMAT_FLAG_COLORMAP - * to one of the above definitions, or you can use one of the definitions below. - */ -#define PNG_FORMAT_RGB_COLORMAP (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_COLORMAP) -#define PNG_FORMAT_BGR_COLORMAP (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_COLORMAP) -#define PNG_FORMAT_RGBA_COLORMAP (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_COLORMAP) -#define PNG_FORMAT_ARGB_COLORMAP (PNG_FORMAT_ARGB|PNG_FORMAT_FLAG_COLORMAP) -#define PNG_FORMAT_BGRA_COLORMAP (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_COLORMAP) -#define PNG_FORMAT_ABGR_COLORMAP (PNG_FORMAT_ABGR|PNG_FORMAT_FLAG_COLORMAP) - -/* PNG_IMAGE macros - * - * These are convenience macros to derive information from a png_image - * structure. The PNG_IMAGE_SAMPLE_ macros return values appropriate to the - * actual image sample values - either the entries in the color-map or the - * pixels in the image. The PNG_IMAGE_PIXEL_ macros return corresponding values - * for the pixels and will always return 1 for color-mapped formats. The - * remaining macros return information about the rows in the image and the - * complete image. - * - * NOTE: All the macros that take a png_image::format parameter are compile time - * constants if the format parameter is, itself, a constant. Therefore these - * macros can be used in array declarations and case labels where required. - * Similarly the macros are also pre-processor constants (sizeof is not used) so - * they can be used in #if tests. - * - * First the information about the samples. - */ -#define PNG_IMAGE_SAMPLE_CHANNELS(fmt)\ - (((fmt)&(PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA))+1) - /* Return the total number of channels in a given format: 1..4 */ - -#define PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)\ - ((((fmt) & PNG_FORMAT_FLAG_LINEAR) >> 2)+1) - /* Return the size in bytes of a single component of a pixel or color-map - * entry (as appropriate) in the image: 1 or 2. - */ - -#define PNG_IMAGE_SAMPLE_SIZE(fmt)\ - (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)) - /* This is the size of the sample data for one sample. If the image is - * color-mapped it is the size of one color-map entry (and image pixels are - * one byte in size), otherwise it is the size of one image pixel. - */ - -#define PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(fmt)\ - (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * 256) - /* The maximum size of the color-map required by the format expressed in a - * count of components. This can be used to compile-time allocate a - * color-map: - * - * png_uint_16 colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(linear_fmt)]; - * - * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)]; - * - * Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the - * information from one of the png_image_begin_read_ APIs and dynamically - * allocate the required memory. - */ - -/* Corresponding information about the pixels */ -#define PNG_IMAGE_PIXEL_(test,fmt)\ - (((fmt)&PNG_FORMAT_FLAG_COLORMAP)?1:test(fmt)) - -#define PNG_IMAGE_PIXEL_CHANNELS(fmt)\ - PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_CHANNELS,fmt) - /* The number of separate channels (components) in a pixel; 1 for a - * color-mapped image. - */ - -#define PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)\ - PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_COMPONENT_SIZE,fmt) - /* The size, in bytes, of each component in a pixel; 1 for a color-mapped - * image. - */ - -#define PNG_IMAGE_PIXEL_SIZE(fmt) PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_SIZE,fmt) - /* The size, in bytes, of a complete pixel; 1 for a color-mapped image. */ - -/* Information about the whole row, or whole image */ -#define PNG_IMAGE_ROW_STRIDE(image)\ - (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width) - /* Return the total number of components in a single row of the image; this - * is the minimum 'row stride', the minimum count of components between each - * row. For a color-mapped image this is the minimum number of bytes in a - * row. - * - * WARNING: this macro overflows for some images with more than one component - * and very large image widths. libpng will refuse to process an image where - * this macro would overflow. - */ - -#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\ - (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride)) - /* Return the size, in bytes, of an image buffer given a png_image and a row - * stride - the number of components to leave space for in each row. - * - * WARNING: this macro overflows a 32-bit integer for some large PNG images, - * libpng will refuse to process an image where such an overflow would occur. - */ - -#define PNG_IMAGE_SIZE(image)\ - PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image)) - /* Return the size, in bytes, of the image in memory given just a png_image; - * the row stride is the minimum stride required for the image. - */ - -#define PNG_IMAGE_COLORMAP_SIZE(image)\ - (PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries) - /* Return the size, in bytes, of the color-map of this image. If the image - * format is not a color-map format this will return a size sufficient for - * 256 entries in the given format; check PNG_FORMAT_FLAG_COLORMAP if - * you don't want to allocate a color-map in this case. - */ - -/* PNG_IMAGE_FLAG_* - * - * Flags containing additional information about the image are held in the - * 'flags' field of png_image. - */ -#define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01 - /* This indicates the the RGB values of the in-memory bitmap do not - * correspond to the red, green and blue end-points defined by sRGB. - */ - -#define PNG_IMAGE_FLAG_FAST 0x02 - /* On write emphasise speed over compression; the resultant PNG file will be - * larger but will be produced significantly faster, particular for large - * images. Do not use this option for images which will be distributed, only - * used it when producing intermediate files that will be read back in - * repeatedly. For a typical 24-bit image the option will double the read - * speed at the cost of increasing the image size by 25%, however for many - * more compressible images the PNG file can be 10 times larger with only a - * slight speed gain. - */ - -#define PNG_IMAGE_FLAG_16BIT_sRGB 0x04 - /* On read if the image is a 16-bit per component image and there is no gAMA - * or sRGB chunk assume that the components are sRGB encoded. Notice that - * images output by the simplified API always have gamma information; setting - * this flag only affects the interpretation of 16-bit images from an - * external source. It is recommended that the application expose this flag - * to the user; the user can normally easily recognize the difference between - * linear and sRGB encoding. This flag has no effect on write - the data - * passed to the write APIs must have the correct encoding (as defined - * above.) - * - * If the flag is not set (the default) input 16-bit per component data is - * assumed to be linear. - * - * NOTE: the flag can only be set after the png_image_begin_read_ call, - * because that call initializes the 'flags' field. - */ - -#ifdef PNG_SIMPLIFIED_READ_SUPPORTED -/* READ APIs - * --------- - * - * The png_image passed to the read APIs must have been initialized by setting - * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.) - */ -#ifdef PNG_STDIO_SUPPORTED -PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image, - const char *file_name)); - /* The named file is opened for read and the image header is filled in - * from the PNG header in the file. - */ - -PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image, - FILE* file)); - /* The PNG header is read from the stdio FILE object. */ -#endif /* STDIO */ - -PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image, - png_const_voidp memory, png_size_t size)); - /* The PNG header is read from the given memory buffer. */ - -PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image, - png_const_colorp background, void *buffer, png_int_32 row_stride, - void *colormap)); - /* Finish reading the image into the supplied buffer and clean up the - * png_image structure. - * - * row_stride is the step, in byte or 2-byte units as appropriate, - * between adjacent rows. A positive stride indicates that the top-most row - * is first in the buffer - the normal top-down arrangement. A negative - * stride indicates that the bottom-most row is first in the buffer. - * - * background need only be supplied if an alpha channel must be removed from - * a png_byte format and the removal is to be done by compositing on a solid - * color; otherwise it may be NULL and any composition will be done directly - * onto the buffer. The value is an sRGB color to use for the background, - * for grayscale output the green channel is used. - * - * background must be supplied when an alpha channel must be removed from a - * single byte color-mapped output format, in other words if: - * - * 1) The original format from png_image_begin_read_from_* had - * PNG_FORMAT_FLAG_ALPHA set. - * 2) The format set by the application does not. - * 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and - * PNG_FORMAT_FLAG_LINEAR *not* set. - * - * For linear output removing the alpha channel is always done by compositing - * on black and background is ignored. - * - * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must - * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE. - * image->colormap_entries will be updated to the actual number of entries - * written to the colormap; this may be less than the original value. - */ - -PNG_EXPORT(238, void, png_image_free, (png_imagep image)); - /* Free any data allocated by libpng in image->opaque, setting the pointer to - * NULL. May be called at any time after the structure is initialized. - */ -#endif /* SIMPLIFIED_READ */ - -#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED -/* WRITE APIS - * ---------- - * For write you must initialize a png_image structure to describe the image to - * be written. To do this use memset to set the whole structure to 0 then - * initialize fields describing your image. - * - * version: must be set to PNG_IMAGE_VERSION - * opaque: must be initialized to NULL - * width: image width in pixels - * height: image height in rows - * format: the format of the data (image and color-map) you wish to write - * flags: set to 0 unless one of the defined flags applies; set - * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB - * values do not correspond to the colors in sRGB. - * colormap_entries: set to the number of entries in the color-map (0 to 256) - */ -#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED -PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image, - const char *file, int convert_to_8bit, const void *buffer, - png_int_32 row_stride, const void *colormap)); - /* Write the image to the named file. */ - -PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, - int convert_to_8_bit, const void *buffer, png_int_32 row_stride, - const void *colormap)); - /* Write the image to the given (FILE*). */ -#endif /* SIMPLIFIED_WRITE_STDIO */ - -/* With all write APIs if image is in one of the linear formats with 16-bit - * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG - * gamma encoded according to the sRGB specification, otherwise a 16-bit linear - * encoded PNG file is written. - * - * With color-mapped data formats the colormap parameter point to a color-map - * with at least image->colormap_entries encoded in the specified format. If - * the format is linear the written PNG color-map will be converted to sRGB - * regardless of the convert_to_8_bit flag. - * - * With all APIs row_stride is handled as in the read APIs - it is the spacing - * from one row to the next in component sized units (1 or 2 bytes) and if - * negative indicates a bottom-up row layout in the buffer. If row_stride is - * zero, libpng will calculate it for you from the image width and number of - * channels. - * - * Note that the write API does not support interlacing, sub-8-bit pixels or - * most ancillary chunks. If you need to write text chunks (e.g. for copyright - * notices) you need to use one of the other APIs. - */ - -PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory, - png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit, - const void *buffer, png_int_32 row_stride, const void *colormap)); - /* Write the image to the given memory buffer. The function both writes the - * whole PNG data stream to *memory and updates *memory_bytes with the count - * of bytes written. - * - * 'memory' may be NULL. In this case *memory_bytes is not read however on - * success the number of bytes which would have been written will still be - * stored in *memory_bytes. On failure *memory_bytes will contain 0. - * - * If 'memory' is not NULL it must point to memory[*memory_bytes] of - * writeable memory. - * - * If the function returns success memory[*memory_bytes] (if 'memory' is not - * NULL) contains the written PNG data. *memory_bytes will always be less - * than or equal to the original value. - * - * If the function returns false and *memory_bytes was not changed an error - * occured during write. If *memory_bytes was changed, or is not 0 if - * 'memory' was NULL, the write would have succeeded but for the memory - * buffer being too small. *memory_bytes contains the required number of - * bytes and will be bigger that the original value. - */ - -#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\ - row_stride, colormap)\ - png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\ - row_stride, colormap) - /* Return the amount of memory in 'size' required to compress this image. - * The png_image structure 'image' must be filled in as in the above - * function and must not be changed before the actual write call, the buffer - * and all other parameters must also be identical to that in the final - * write call. The 'size' variable need not be initialized. - * - * NOTE: the macro returns true/false, if false is returned 'size' will be - * set to zero and the write failed and probably will fail if tried again. - */ - -/* You can pre-allocate the buffer by making sure it is of sufficient size - * regardless of the amount of compression achieved. The buffer size will - * always be bigger than the original image and it will never be filled. The - * following macros are provided to assist in allocating the buffer. - */ -#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height) - /* The number of uncompressed bytes in the PNG byte encoding of the image; - * uncompressing the PNG IDAT data will give this number of bytes. - * - * NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this - * macro can because of the extra bytes used in the PNG byte encoding. You - * need to avoid this macro if your image size approaches 2^30 in width or - * height. The same goes for the remainder of these macros; they all produce - * bigger numbers than the actual in-memory image size. - */ -#ifndef PNG_ZLIB_MAX_SIZE -# define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U) - /* An upper bound on the number of compressed bytes given 'b' uncompressed - * bytes. This is based on deflateBounds() in zlib; different - * implementations of zlib compression may conceivably produce more data so - * if your zlib implementation is not zlib itself redefine this macro - * appropriately. - */ -#endif - -#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\ - PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image)) - /* An upper bound on the size of the data in the PNG IDAT chunks. */ - -#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\ - ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\ - (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\ - 12U+3U*(image).colormap_entries/*PLTE data*/+\ - (((image).format&PNG_FORMAT_FLAG_ALPHA)?\ - 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\ - 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size)) - /* A helper for the following macro; if your compiler cannot handle the - * following macro use this one with the result of - * PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most - * compilers should handle this just fine.) - */ - -#define PNG_IMAGE_PNG_SIZE_MAX(image)\ - PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image)) - /* An upper bound on the total length of the PNG data stream for 'image'. - * The result is of type png_alloc_size_t, on 32-bit systems this may - * overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will - * run out of buffer space but return a corrected size which should work. - */ -#endif /* SIMPLIFIED_WRITE */ -/******************************************************************************* - * END OF SIMPLIFIED API - ******************************************************************************/ -#endif /* SIMPLIFIED_{READ|WRITE} */ - -/******************************************************************************* - * Section 6: IMPLEMENTATION OPTIONS - ******************************************************************************* - * - * Support for arbitrary implementation-specific optimizations. The API allows - * particular options to be turned on or off. 'Option' is the number of the - * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given - * by the PNG_OPTION_ defines below. - * - * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions, - * are detected at run time, however sometimes it may be impossible - * to do this in user mode, in which case it is necessary to discover - * the capabilities in an OS specific way. Such capabilities are - * listed here when libpng has support for them and must be turned - * ON by the application if present. - * - * SOFTWARE: sometimes software optimizations actually result in performance - * decrease on some architectures or systems, or with some sets of - * PNG images. 'Software' options allow such optimizations to be - * selected at run time. - */ -#ifdef PNG_SET_OPTION_SUPPORTED -#ifdef PNG_ARM_NEON_API_SUPPORTED -# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ -#endif -#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ -#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */ -#ifdef PNG_MIPS_MSA_API_SUPPORTED -# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */ -#endif -#define PNG_IGNORE_ADLER32 8 -#ifdef PNG_POWERPC_VSX_API_SUPPORTED -# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */ -#endif -#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */ - -/* Return values: NOTE: there are four values and 'off' is *not* zero */ -#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ -#define PNG_OPTION_INVALID 1 /* Option number out of range */ -#define PNG_OPTION_OFF 2 -#define PNG_OPTION_ON 3 - -PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, - int onoff)); -#endif /* SET_OPTION */ - -/******************************************************************************* - * END OF HARDWARE AND SOFTWARE OPTIONS - ******************************************************************************/ - -/* Maintainer: Put new public prototypes here ^, in libpng.3, in project - * defs, and in scripts/symbols.def. - */ - -/* The last ordinal number (this is the *last* one already used; the next - * one to use is one more than this.) - */ -#ifdef PNG_EXPORT_LAST_ORDINAL - PNG_EXPORT_LAST_ORDINAL(249); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* PNG_VERSION_INFO_ONLY */ -/* Do not put anything past this line */ -#endif /* PNG_H */ diff --git a/GLideN64/src/GLideNHQ/inc/pngconf.h b/GLideN64/src/GLideNHQ/inc/pngconf.h deleted file mode 100644 index c0f1554..0000000 --- a/GLideN64/src/GLideNHQ/inc/pngconf.h +++ /dev/null @@ -1,622 +0,0 @@ - -/* pngconf.h - machine configurable file for libpng - * - * libpng version 1.6.32, August 24, 2017 - * - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This code is released under the libpng license. - * For conditions of distribution and use, see the disclaimer - * and license in png.h - * - * Any machine specific code is near the front of this file, so if you - * are configuring libpng for a machine, you may want to read the section - * starting here down to where it starts to typedef png_color, png_text, - * and png_info. - */ - -#ifndef PNGCONF_H -#define PNGCONF_H - -#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */ - -/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C - * compiler for correct compilation. The following header files are required by - * the standard. If your compiler doesn't provide these header files, or they - * do not match the standard, you will need to provide/improve them. - */ -#include -#include - -/* Library header files. These header files are all defined by ISOC90; libpng - * expects conformant implementations, however, an ISOC90 conformant system need - * not provide these header files if the functionality cannot be implemented. - * In this case it will be necessary to disable the relevant parts of libpng in - * the build of pnglibconf.h. - * - * Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not - * include this unnecessary header file. - */ - -#ifdef PNG_STDIO_SUPPORTED - /* Required for the definition of FILE: */ -# include -#endif - -#ifdef PNG_SETJMP_SUPPORTED - /* Required for the definition of jmp_buf and the declaration of longjmp: */ -# include -#endif - -#ifdef PNG_CONVERT_tIME_SUPPORTED - /* Required for struct tm: */ -# include -#endif - -#endif /* PNG_BUILDING_SYMBOL_TABLE */ - -/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using - * PNG_NO_CONST; this is no longer supported except for data declarations which - * apparently still cause problems in 2011 on some compilers. - */ -#define PNG_CONST const /* backward compatibility only */ - -/* This controls optimization of the reading of 16-bit and 32-bit values - * from PNG files. It can be set on a per-app-file basis - it - * just changes whether a macro is used when the function is called. - * The library builder sets the default; if read functions are not - * built into the library the macro implementation is forced on. - */ -#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED -# define PNG_USE_READ_MACROS -#endif -#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) -# if PNG_DEFAULT_READ_MACROS -# define PNG_USE_READ_MACROS -# endif -#endif - -/* COMPILER SPECIFIC OPTIONS. - * - * These options are provided so that a variety of difficult compilers - * can be used. Some are fixed at build time (e.g. PNG_API_RULE - * below) but still have compiler specific implementations, others - * may be changed on a per-file basis when compiling against libpng. - */ - -/* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect - * against legacy (pre ISOC90) compilers that did not understand function - * prototypes. It is not required for modern C compilers. - */ -#ifndef PNGARG -# define PNGARG(arglist) arglist -#endif - -/* Function calling conventions. - * ============================= - * Normally it is not necessary to specify to the compiler how to call - * a function - it just does it - however on x86 systems derived from - * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems - * and some others) there are multiple ways to call a function and the - * default can be changed on the compiler command line. For this reason - * libpng specifies the calling convention of every exported function and - * every function called via a user supplied function pointer. This is - * done in this file by defining the following macros: - * - * PNGAPI Calling convention for exported functions. - * PNGCBAPI Calling convention for user provided (callback) functions. - * PNGCAPI Calling convention used by the ANSI-C library (required - * for longjmp callbacks and sometimes used internally to - * specify the calling convention for zlib). - * - * These macros should never be overridden. If it is necessary to - * change calling convention in a private build this can be done - * by setting PNG_API_RULE (which defaults to 0) to one of the values - * below to select the correct 'API' variants. - * - * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout. - * This is correct in every known environment. - * PNG_API_RULE=1 Use the operating system convention for PNGAPI and - * the 'C' calling convention (from PNGCAPI) for - * callbacks (PNGCBAPI). This is no longer required - * in any known environment - if it has to be used - * please post an explanation of the problem to the - * libpng mailing list. - * - * These cases only differ if the operating system does not use the C - * calling convention, at present this just means the above cases - * (x86 DOS/Windows sytems) and, even then, this does not apply to - * Cygwin running on those systems. - * - * Note that the value must be defined in pnglibconf.h so that what - * the application uses to call the library matches the conventions - * set when building the library. - */ - -/* Symbol export - * ============= - * When building a shared library it is almost always necessary to tell - * the compiler which symbols to export. The png.h macro 'PNG_EXPORT' - * is used to mark the symbols. On some systems these symbols can be - * extracted at link time and need no special processing by the compiler, - * on other systems the symbols are flagged by the compiler and just - * the declaration requires a special tag applied (unfortunately) in a - * compiler dependent way. Some systems can do either. - * - * A small number of older systems also require a symbol from a DLL to - * be flagged to the program that calls it. This is a problem because - * we do not know in the header file included by application code that - * the symbol will come from a shared library, as opposed to a statically - * linked one. For this reason the application must tell us by setting - * the magic flag PNG_USE_DLL to turn on the special processing before - * it includes png.h. - * - * Four additional macros are used to make this happen: - * - * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from - * the build or imported if PNG_USE_DLL is set - compiler - * and system specific. - * - * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to - * 'type', compiler specific. - * - * PNG_DLL_EXPORT Set to the magic to use during a libpng build to - * make a symbol exported from the DLL. Not used in the - * public header files; see pngpriv.h for how it is used - * in the libpng build. - * - * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come - * from a DLL - used to define PNG_IMPEXP when - * PNG_USE_DLL is set. - */ - -/* System specific discovery. - * ========================== - * This code is used at build time to find PNG_IMPEXP, the API settings - * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL - * import processing is possible. On Windows systems it also sets - * compiler-specific macros to the values required to change the calling - * conventions of the various functions. - */ -#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\ - defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) - /* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or - * MinGW on any architecture currently supported by Windows. Also includes - * Watcom builds but these need special treatment because they are not - * compatible with GCC or Visual C because of different calling conventions. - */ -# if PNG_API_RULE == 2 - /* If this line results in an error, either because __watcall is not - * understood or because of a redefine just below you cannot use *this* - * build of the library with the compiler you are using. *This* build was - * build using Watcom and applications must also be built using Watcom! - */ -# define PNGCAPI __watcall -# endif - -# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800)) -# define PNGCAPI __cdecl -# if PNG_API_RULE == 1 - /* If this line results in an error __stdcall is not understood and - * PNG_API_RULE should not have been set to '1'. - */ -# define PNGAPI __stdcall -# endif -# else - /* An older compiler, or one not detected (erroneously) above, - * if necessary override on the command line to get the correct - * variants for the compiler. - */ -# ifndef PNGCAPI -# define PNGCAPI _cdecl -# endif -# if PNG_API_RULE == 1 && !defined(PNGAPI) -# define PNGAPI _stdcall -# endif -# endif /* compiler/api */ - - /* NOTE: PNGCBAPI always defaults to PNGCAPI. */ - -# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD) -# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed" -# endif - -# if (defined(_MSC_VER) && _MSC_VER < 800) ||\ - (defined(__BORLANDC__) && __BORLANDC__ < 0x500) - /* older Borland and MSC - * compilers used '__export' and required this to be after - * the type. - */ -# ifndef PNG_EXPORT_TYPE -# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP -# endif -# define PNG_DLL_EXPORT __export -# else /* newer compiler */ -# define PNG_DLL_EXPORT __declspec(dllexport) -# ifndef PNG_DLL_IMPORT -# define PNG_DLL_IMPORT __declspec(dllimport) -# endif -# endif /* compiler */ - -#else /* !Windows */ -# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) -# define PNGAPI _System -# else /* !Windows/x86 && !OS/2 */ - /* Use the defaults, or define PNG*API on the command line (but - * this will have to be done for every compile!) - */ -# endif /* other system, !OS/2 */ -#endif /* !Windows/x86 */ - -/* Now do all the defaulting . */ -#ifndef PNGCAPI -# define PNGCAPI -#endif -#ifndef PNGCBAPI -# define PNGCBAPI PNGCAPI -#endif -#ifndef PNGAPI -# define PNGAPI PNGCAPI -#endif - -/* PNG_IMPEXP may be set on the compilation system command line or (if not set) - * then in an internal header file when building the library, otherwise (when - * using the library) it is set here. - */ -#ifndef PNG_IMPEXP -# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT) - /* This forces use of a DLL, disallowing static linking */ -# define PNG_IMPEXP PNG_DLL_IMPORT -# endif - -# ifndef PNG_IMPEXP -# define PNG_IMPEXP -# endif -#endif - -/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat - * 'attributes' as a storage class - the attributes go at the start of the - * function definition, and attributes are always appended regardless of the - * compiler. This considerably simplifies these macros but may cause problems - * if any compilers both need function attributes and fail to handle them as - * a storage class (this is unlikely.) - */ -#ifndef PNG_FUNCTION -# define PNG_FUNCTION(type, name, args, attributes) attributes type name args -#endif - -#ifndef PNG_EXPORT_TYPE -# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type -#endif - - /* The ordinal value is only relevant when preprocessing png.h for symbol - * table entries, so we discard it here. See the .dfn files in the - * scripts directory. - */ - -#ifndef PNG_EXPORTA -# define PNG_EXPORTA(ordinal, type, name, args, attributes) \ - PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \ - PNG_LINKAGE_API attributes) -#endif - -/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, - * so make something non-empty to satisfy the requirement: - */ -#define PNG_EMPTY /*empty list*/ - -#define PNG_EXPORT(ordinal, type, name, args) \ - PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY) - -/* Use PNG_REMOVED to comment out a removed interface. */ -#ifndef PNG_REMOVED -# define PNG_REMOVED(ordinal, type, name, args, attributes) -#endif - -#ifndef PNG_CALLBACK -# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args) -#endif - -/* Support for compiler specific function attributes. These are used - * so that where compiler support is available incorrect use of API - * functions in png.h will generate compiler warnings. - * - * Added at libpng-1.2.41. - */ - -#ifndef PNG_NO_PEDANTIC_WARNINGS -# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED -# define PNG_PEDANTIC_WARNINGS_SUPPORTED -# endif -#endif - -#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED - /* Support for compiler specific function attributes. These are used - * so that where compiler support is available, incorrect use of API - * functions in png.h will generate compiler warnings. Added at libpng - * version 1.2.41. Disabling these removes the warnings but may also produce - * less efficient code. - */ -# if defined(__clang__) && defined(__has_attribute) - /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */ -# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__) -# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) -# endif -# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__) -# define PNG_NORETURN __attribute__((__noreturn__)) -# endif -# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__) -# define PNG_ALLOCATED __attribute__((__malloc__)) -# endif -# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__) -# define PNG_DEPRECATED __attribute__((__deprecated__)) -# endif -# if !defined(PNG_PRIVATE) -# ifdef __has_extension -# if __has_extension(attribute_unavailable_with_message) -# define PNG_PRIVATE __attribute__((__unavailable__(\ - "This function is not exported by libpng."))) -# endif -# endif -# endif -# ifndef PNG_RESTRICT -# define PNG_RESTRICT __restrict -# endif - -# elif defined(__GNUC__) -# ifndef PNG_USE_RESULT -# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) -# endif -# ifndef PNG_NORETURN -# define PNG_NORETURN __attribute__((__noreturn__)) -# endif -# if __GNUC__ >= 3 -# ifndef PNG_ALLOCATED -# define PNG_ALLOCATED __attribute__((__malloc__)) -# endif -# ifndef PNG_DEPRECATED -# define PNG_DEPRECATED __attribute__((__deprecated__)) -# endif -# ifndef PNG_PRIVATE -# if 0 /* Doesn't work so we use deprecated instead*/ -# define PNG_PRIVATE \ - __attribute__((warning("This function is not exported by libpng."))) -# else -# define PNG_PRIVATE \ - __attribute__((__deprecated__)) -# endif -# endif -# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1)) -# ifndef PNG_RESTRICT -# define PNG_RESTRICT __restrict -# endif -# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */ -# endif /* __GNUC__ >= 3 */ - -# elif defined(_MSC_VER) && (_MSC_VER >= 1300) -# ifndef PNG_USE_RESULT -# define PNG_USE_RESULT /* not supported */ -# endif -# ifndef PNG_NORETURN -# define PNG_NORETURN __declspec(noreturn) -# endif -# ifndef PNG_ALLOCATED -# if (_MSC_VER >= 1400) -# define PNG_ALLOCATED __declspec(restrict) -# endif -# endif -# ifndef PNG_DEPRECATED -# define PNG_DEPRECATED __declspec(deprecated) -# endif -# ifndef PNG_PRIVATE -# define PNG_PRIVATE __declspec(deprecated) -# endif -# ifndef PNG_RESTRICT -# if (_MSC_VER >= 1400) -# define PNG_RESTRICT __restrict -# endif -# endif - -# elif defined(__WATCOMC__) -# ifndef PNG_RESTRICT -# define PNG_RESTRICT __restrict -# endif -# endif -#endif /* PNG_PEDANTIC_WARNINGS */ - -#ifndef PNG_DEPRECATED -# define PNG_DEPRECATED /* Use of this function is deprecated */ -#endif -#ifndef PNG_USE_RESULT -# define PNG_USE_RESULT /* The result of this function must be checked */ -#endif -#ifndef PNG_NORETURN -# define PNG_NORETURN /* This function does not return */ -#endif -#ifndef PNG_ALLOCATED -# define PNG_ALLOCATED /* The result of the function is new memory */ -#endif -#ifndef PNG_PRIVATE -# define PNG_PRIVATE /* This is a private libpng function */ -#endif -#ifndef PNG_RESTRICT -# define PNG_RESTRICT /* The C99 "restrict" feature */ -#endif - -#ifndef PNG_FP_EXPORT /* A floating point API. */ -# ifdef PNG_FLOATING_POINT_SUPPORTED -# define PNG_FP_EXPORT(ordinal, type, name, args)\ - PNG_EXPORT(ordinal, type, name, args); -# else /* No floating point APIs */ -# define PNG_FP_EXPORT(ordinal, type, name, args) -# endif -#endif -#ifndef PNG_FIXED_EXPORT /* A fixed point API. */ -# ifdef PNG_FIXED_POINT_SUPPORTED -# define PNG_FIXED_EXPORT(ordinal, type, name, args)\ - PNG_EXPORT(ordinal, type, name, args); -# else /* No fixed point APIs */ -# define PNG_FIXED_EXPORT(ordinal, type, name, args) -# endif -#endif - -#ifndef PNG_BUILDING_SYMBOL_TABLE -/* Some typedefs to get us started. These should be safe on most of the common - * platforms. - * - * png_uint_32 and png_int_32 may, currently, be larger than required to hold a - * 32-bit value however this is not normally advisable. - * - * png_uint_16 and png_int_16 should always be two bytes in size - this is - * verified at library build time. - * - * png_byte must always be one byte in size. - * - * The checks below use constants from limits.h, as defined by the ISOC90 - * standard. - */ -#if CHAR_BIT == 8 && UCHAR_MAX == 255 - typedef unsigned char png_byte; -#else -# error "libpng requires 8-bit bytes" -#endif - -#if INT_MIN == -32768 && INT_MAX == 32767 - typedef int png_int_16; -#elif SHRT_MIN == -32768 && SHRT_MAX == 32767 - typedef short png_int_16; -#else -# error "libpng requires a signed 16-bit type" -#endif - -#if UINT_MAX == 65535 - typedef unsigned int png_uint_16; -#elif USHRT_MAX == 65535 - typedef unsigned short png_uint_16; -#else -# error "libpng requires an unsigned 16-bit type" -#endif - -#if INT_MIN < -2147483646 && INT_MAX > 2147483646 - typedef int png_int_32; -#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646 - typedef long int png_int_32; -#else -# error "libpng requires a signed 32-bit (or more) type" -#endif - -#if UINT_MAX > 4294967294U - typedef unsigned int png_uint_32; -#elif ULONG_MAX > 4294967294U - typedef unsigned long int png_uint_32; -#else -# error "libpng requires an unsigned 32-bit (or more) type" -#endif - -/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however, - * requires an ISOC90 compiler and relies on consistent behavior of sizeof. - */ -typedef size_t png_size_t; -typedef ptrdiff_t png_ptrdiff_t; - -/* libpng needs to know the maximum value of 'size_t' and this controls the - * definition of png_alloc_size_t, below. This maximum value of size_t limits - * but does not control the maximum allocations the library makes - there is - * direct application control of this through png_set_user_limits(). - */ -#ifndef PNG_SMALL_SIZE_T - /* Compiler specific tests for systems where size_t is known to be less than - * 32 bits (some of these systems may no longer work because of the lack of - * 'far' support; see above.) - */ -# if (defined(__TURBOC__) && !defined(__FLAT__)) ||\ - (defined(_MSC_VER) && defined(MAXSEG_64K)) -# define PNG_SMALL_SIZE_T -# endif -#endif - -/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no - * smaller than png_uint_32. Casts from png_size_t or png_uint_32 to - * png_alloc_size_t are not necessary; in fact, it is recommended not to use - * them at all so that the compiler can complain when something turns out to be - * problematic. - * - * Casts in the other direction (from png_alloc_size_t to png_size_t or - * png_uint_32) should be explicitly applied; however, we do not expect to - * encounter practical situations that require such conversions. - * - * PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than - * 4294967295 - i.e. less than the maximum value of png_uint_32. - */ -#ifdef PNG_SMALL_SIZE_T - typedef png_uint_32 png_alloc_size_t; -#else - typedef png_size_t png_alloc_size_t; -#endif - -/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler - * implementations of Intel CPU specific support of user-mode segmented address - * spaces, where 16-bit pointers address more than 65536 bytes of memory using - * separate 'segment' registers. The implementation requires two different - * types of pointer (only one of which includes the segment value.) - * - * If required this support is available in version 1.2 of libpng and may be - * available in versions through 1.5, although the correctness of the code has - * not been verified recently. - */ - -/* Typedef for floating-point numbers that are converted to fixed-point with a - * multiple of 100,000, e.g., gamma - */ -typedef png_int_32 png_fixed_point; - -/* Add typedefs for pointers */ -typedef void * png_voidp; -typedef const void * png_const_voidp; -typedef png_byte * png_bytep; -typedef const png_byte * png_const_bytep; -typedef png_uint_32 * png_uint_32p; -typedef const png_uint_32 * png_const_uint_32p; -typedef png_int_32 * png_int_32p; -typedef const png_int_32 * png_const_int_32p; -typedef png_uint_16 * png_uint_16p; -typedef const png_uint_16 * png_const_uint_16p; -typedef png_int_16 * png_int_16p; -typedef const png_int_16 * png_const_int_16p; -typedef char * png_charp; -typedef const char * png_const_charp; -typedef png_fixed_point * png_fixed_point_p; -typedef const png_fixed_point * png_const_fixed_point_p; -typedef png_size_t * png_size_tp; -typedef const png_size_t * png_const_size_tp; - -#ifdef PNG_STDIO_SUPPORTED -typedef FILE * png_FILE_p; -#endif - -#ifdef PNG_FLOATING_POINT_SUPPORTED -typedef double * png_doublep; -typedef const double * png_const_doublep; -#endif - -/* Pointers to pointers; i.e. arrays */ -typedef png_byte * * png_bytepp; -typedef png_uint_32 * * png_uint_32pp; -typedef png_int_32 * * png_int_32pp; -typedef png_uint_16 * * png_uint_16pp; -typedef png_int_16 * * png_int_16pp; -typedef const char * * png_const_charpp; -typedef char * * png_charpp; -typedef png_fixed_point * * png_fixed_point_pp; -#ifdef PNG_FLOATING_POINT_SUPPORTED -typedef double * * png_doublepp; -#endif - -/* Pointers to pointers to pointers; i.e., pointer to array */ -typedef char * * * png_charppp; - -#endif /* PNG_BUILDING_SYMBOL_TABLE */ - -#endif /* PNGCONF_H */ diff --git a/GLideN64/src/GLideNHQ/inc/pnglibconf.h b/GLideN64/src/GLideNHQ/inc/pnglibconf.h deleted file mode 100644 index 9e45f73..0000000 --- a/GLideN64/src/GLideNHQ/inc/pnglibconf.h +++ /dev/null @@ -1,220 +0,0 @@ -/* libpng 1.6.32 STANDARD API DEFINITION */ - -/* pnglibconf.h - library build configuration */ - -/* Libpng version 1.6.32 - August 24, 2017 */ - -/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */ - -/* This code is released under the libpng license. */ -/* For conditions of distribution and use, see the disclaimer */ -/* and license in png.h */ - -/* pnglibconf.h */ -/* Machine generated file: DO NOT EDIT */ -/* Derived from: scripts/pnglibconf.dfa */ -#ifndef PNGLCONF_H -#define PNGLCONF_H -/* options */ -#define PNG_16BIT_SUPPORTED -#define PNG_ALIGNED_MEMORY_SUPPORTED -/*#undef PNG_ARM_NEON_API_SUPPORTED*/ -/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/ -/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ -/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ -#define PNG_BENIGN_ERRORS_SUPPORTED -#define PNG_BENIGN_READ_ERRORS_SUPPORTED -/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/ -#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED -#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED -#define PNG_COLORSPACE_SUPPORTED -#define PNG_CONSOLE_IO_SUPPORTED -#define PNG_CONVERT_tIME_SUPPORTED -#define PNG_EASY_ACCESS_SUPPORTED -/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ -#define PNG_ERROR_TEXT_SUPPORTED -#define PNG_FIXED_POINT_SUPPORTED -#define PNG_FLOATING_ARITHMETIC_SUPPORTED -#define PNG_FLOATING_POINT_SUPPORTED -#define PNG_FORMAT_AFIRST_SUPPORTED -#define PNG_FORMAT_BGR_SUPPORTED -#define PNG_GAMMA_SUPPORTED -#define PNG_GET_PALETTE_MAX_SUPPORTED -#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -#define PNG_INCH_CONVERSIONS_SUPPORTED -#define PNG_INFO_IMAGE_SUPPORTED -#define PNG_IO_STATE_SUPPORTED -#define PNG_MNG_FEATURES_SUPPORTED -#define PNG_POINTER_INDEXING_SUPPORTED -#define PNG_PROGRESSIVE_READ_SUPPORTED -#define PNG_READ_16BIT_SUPPORTED -#define PNG_READ_ALPHA_MODE_SUPPORTED -#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED -#define PNG_READ_BACKGROUND_SUPPORTED -#define PNG_READ_BGR_SUPPORTED -#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED -#define PNG_READ_COMPOSITE_NODIV_SUPPORTED -#define PNG_READ_COMPRESSED_TEXT_SUPPORTED -#define PNG_READ_EXPAND_16_SUPPORTED -#define PNG_READ_EXPAND_SUPPORTED -#define PNG_READ_FILLER_SUPPORTED -#define PNG_READ_GAMMA_SUPPORTED -#define PNG_READ_GET_PALETTE_MAX_SUPPORTED -#define PNG_READ_GRAY_TO_RGB_SUPPORTED -#define PNG_READ_INTERLACING_SUPPORTED -#define PNG_READ_INT_FUNCTIONS_SUPPORTED -#define PNG_READ_INVERT_ALPHA_SUPPORTED -#define PNG_READ_INVERT_SUPPORTED -#define PNG_READ_OPT_PLTE_SUPPORTED -#define PNG_READ_PACKSWAP_SUPPORTED -#define PNG_READ_PACK_SUPPORTED -#define PNG_READ_QUANTIZE_SUPPORTED -#define PNG_READ_RGB_TO_GRAY_SUPPORTED -#define PNG_READ_SCALE_16_TO_8_SUPPORTED -#define PNG_READ_SHIFT_SUPPORTED -#define PNG_READ_STRIP_16_TO_8_SUPPORTED -#define PNG_READ_STRIP_ALPHA_SUPPORTED -#define PNG_READ_SUPPORTED -#define PNG_READ_SWAP_ALPHA_SUPPORTED -#define PNG_READ_SWAP_SUPPORTED -#define PNG_READ_TEXT_SUPPORTED -#define PNG_READ_TRANSFORMS_SUPPORTED -#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_READ_USER_CHUNKS_SUPPORTED -#define PNG_READ_USER_TRANSFORM_SUPPORTED -#define PNG_READ_bKGD_SUPPORTED -#define PNG_READ_cHRM_SUPPORTED -#define PNG_READ_eXIf_SUPPORTED -#define PNG_READ_gAMA_SUPPORTED -#define PNG_READ_hIST_SUPPORTED -#define PNG_READ_iCCP_SUPPORTED -#define PNG_READ_iTXt_SUPPORTED -#define PNG_READ_oFFs_SUPPORTED -#define PNG_READ_pCAL_SUPPORTED -#define PNG_READ_pHYs_SUPPORTED -#define PNG_READ_sBIT_SUPPORTED -#define PNG_READ_sCAL_SUPPORTED -#define PNG_READ_sPLT_SUPPORTED -#define PNG_READ_sRGB_SUPPORTED -#define PNG_READ_tEXt_SUPPORTED -#define PNG_READ_tIME_SUPPORTED -#define PNG_READ_tRNS_SUPPORTED -#define PNG_READ_zTXt_SUPPORTED -#define PNG_SAVE_INT_32_SUPPORTED -#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_SEQUENTIAL_READ_SUPPORTED -#define PNG_SETJMP_SUPPORTED -#define PNG_SET_OPTION_SUPPORTED -#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_SET_USER_LIMITS_SUPPORTED -#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED -#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED -#define PNG_SIMPLIFIED_READ_SUPPORTED -#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED -#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED -#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED -#define PNG_SIMPLIFIED_WRITE_SUPPORTED -#define PNG_STDIO_SUPPORTED -#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_TEXT_SUPPORTED -#define PNG_TIME_RFC1123_SUPPORTED -#define PNG_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_USER_CHUNKS_SUPPORTED -#define PNG_USER_LIMITS_SUPPORTED -#define PNG_USER_MEM_SUPPORTED -#define PNG_USER_TRANSFORM_INFO_SUPPORTED -#define PNG_USER_TRANSFORM_PTR_SUPPORTED -#define PNG_WARNINGS_SUPPORTED -#define PNG_WRITE_16BIT_SUPPORTED -#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED -#define PNG_WRITE_BGR_SUPPORTED -#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED -#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED -#define PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED -#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED -#define PNG_WRITE_FILLER_SUPPORTED -#define PNG_WRITE_FILTER_SUPPORTED -#define PNG_WRITE_FLUSH_SUPPORTED -#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED -#define PNG_WRITE_INTERLACING_SUPPORTED -#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED -#define PNG_WRITE_INVERT_ALPHA_SUPPORTED -#define PNG_WRITE_INVERT_SUPPORTED -#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED -#define PNG_WRITE_PACKSWAP_SUPPORTED -#define PNG_WRITE_PACK_SUPPORTED -#define PNG_WRITE_SHIFT_SUPPORTED -#define PNG_WRITE_SUPPORTED -#define PNG_WRITE_SWAP_ALPHA_SUPPORTED -#define PNG_WRITE_SWAP_SUPPORTED -#define PNG_WRITE_TEXT_SUPPORTED -#define PNG_WRITE_TRANSFORMS_SUPPORTED -#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_WRITE_USER_TRANSFORM_SUPPORTED -#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED -#define PNG_WRITE_bKGD_SUPPORTED -#define PNG_WRITE_cHRM_SUPPORTED -#define PNG_WRITE_eXIf_SUPPORTED -#define PNG_WRITE_gAMA_SUPPORTED -#define PNG_WRITE_hIST_SUPPORTED -#define PNG_WRITE_iCCP_SUPPORTED -#define PNG_WRITE_iTXt_SUPPORTED -#define PNG_WRITE_oFFs_SUPPORTED -#define PNG_WRITE_pCAL_SUPPORTED -#define PNG_WRITE_pHYs_SUPPORTED -#define PNG_WRITE_sBIT_SUPPORTED -#define PNG_WRITE_sCAL_SUPPORTED -#define PNG_WRITE_sPLT_SUPPORTED -#define PNG_WRITE_sRGB_SUPPORTED -#define PNG_WRITE_tEXt_SUPPORTED -#define PNG_WRITE_tIME_SUPPORTED -#define PNG_WRITE_tRNS_SUPPORTED -#define PNG_WRITE_zTXt_SUPPORTED -#define PNG_bKGD_SUPPORTED -#define PNG_cHRM_SUPPORTED -#define PNG_eXIf_SUPPORTED -#define PNG_gAMA_SUPPORTED -#define PNG_hIST_SUPPORTED -#define PNG_iCCP_SUPPORTED -#define PNG_iTXt_SUPPORTED -#define PNG_oFFs_SUPPORTED -#define PNG_pCAL_SUPPORTED -#define PNG_pHYs_SUPPORTED -#define PNG_sBIT_SUPPORTED -#define PNG_sCAL_SUPPORTED -#define PNG_sPLT_SUPPORTED -#define PNG_sRGB_SUPPORTED -#define PNG_tEXt_SUPPORTED -#define PNG_tIME_SUPPORTED -#define PNG_tRNS_SUPPORTED -#define PNG_zTXt_SUPPORTED -/* end of options */ -/* settings */ -#define PNG_API_RULE 0 -#define PNG_DEFAULT_READ_MACROS 1 -#define PNG_GAMMA_THRESHOLD_FIXED 5000 -#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE -#define PNG_INFLATE_BUF_SIZE 1024 -#define PNG_LINKAGE_API extern -#define PNG_LINKAGE_CALLBACK extern -#define PNG_LINKAGE_DATA extern -#define PNG_LINKAGE_FUNCTION extern -#define PNG_MAX_GAMMA_8 11 -#define PNG_QUANTIZE_BLUE_BITS 5 -#define PNG_QUANTIZE_GREEN_BITS 5 -#define PNG_QUANTIZE_RED_BITS 5 -#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1) -#define PNG_TEXT_Z_DEFAULT_STRATEGY 0 -#define PNG_USER_CHUNK_CACHE_MAX 1000 -#define PNG_USER_CHUNK_MALLOC_MAX 8000000 -#define PNG_USER_HEIGHT_MAX 1000000 -#define PNG_USER_WIDTH_MAX 1000000 -#define PNG_ZBUF_SIZE 8192 -#define PNG_ZLIB_VERNUM 0 /* unknown */ -#define PNG_Z_DEFAULT_COMPRESSION (-1) -#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0 -#define PNG_Z_DEFAULT_STRATEGY 1 -#define PNG_sCAL_PRECISION 5 -#define PNG_sRGB_PROFILE_CHECKS 2 -/* end of settings */ -#endif /* PNGLCONF_H */ diff --git a/GLideN64/src/GLideNHQ/inc/pngstruct.h b/GLideN64/src/GLideNHQ/inc/pngstruct.h deleted file mode 100644 index d83f971..0000000 --- a/GLideN64/src/GLideNHQ/inc/pngstruct.h +++ /dev/null @@ -1,483 +0,0 @@ - -/* pngstruct.h - header file for PNG reference library - * - * Last changed in libpng 1.6.32 [August 24, 2017] - * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This code is released under the libpng license. - * For conditions of distribution and use, see the disclaimer - * and license in png.h - */ - -/* The structure that holds the information to read and write PNG files. - * The only people who need to care about what is inside of this are the - * people who will be modifying the library for their own special needs. - * It should NOT be accessed directly by an application. - */ - -#ifndef PNGSTRUCT_H -#define PNGSTRUCT_H -/* zlib.h defines the structure z_stream, an instance of which is included - * in this structure and is required for decompressing the LZ compressed - * data in PNG files. - */ -#ifndef ZLIB_CONST - /* We must ensure that zlib uses 'const' in declarations. */ -# define ZLIB_CONST -#endif -#include "zlib.h" -#ifdef const - /* zlib.h sometimes #defines const to nothing, undo this. */ -# undef const -#endif - -/* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility - * with older builds. - */ -#if ZLIB_VERNUM < 0x1260 -# define PNGZ_MSG_CAST(s) png_constcast(char*,s) -# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b) -#else -# define PNGZ_MSG_CAST(s) (s) -# define PNGZ_INPUT_CAST(b) (b) -#endif - -/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib - * can handle at once. This type need be no larger than 16 bits (so maximum of - * 65535), this define allows us to discover how big it is, but limited by the - * maximuum for png_size_t. The value can be overriden in a library build - * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably - * lower value (e.g. 255 works). A lower value may help memory usage (slightly) - * and may even improve performance on some systems (and degrade it on others.) - */ -#ifndef ZLIB_IO_MAX -# define ZLIB_IO_MAX ((uInt)-1) -#endif - -#ifdef PNG_WRITE_SUPPORTED -/* The type of a compression buffer list used by the write code. */ -typedef struct png_compression_buffer -{ - struct png_compression_buffer *next; - png_byte output[1]; /* actually zbuf_size */ -} png_compression_buffer, *png_compression_bufferp; - -#define PNG_COMPRESSION_BUFFER_SIZE(pp)\ - (offsetof(png_compression_buffer, output) + (pp)->zbuffer_size) -#endif - -/* Colorspace support; structures used in png_struct, png_info and in internal - * functions to hold and communicate information about the color space. - * - * PNG_COLORSPACE_SUPPORTED is only required if the application will perform - * colorspace corrections, otherwise all the colorspace information can be - * skipped and the size of libpng can be reduced (significantly) by compiling - * out the colorspace support. - */ -#ifdef PNG_COLORSPACE_SUPPORTED -/* The chromaticities of the red, green and blue colorants and the chromaticity - * of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)). - */ -typedef struct png_xy -{ - png_fixed_point redx, redy; - png_fixed_point greenx, greeny; - png_fixed_point bluex, bluey; - png_fixed_point whitex, whitey; -} png_xy; - -/* The same data as above but encoded as CIE XYZ values. When this data comes - * from chromaticities the sum of the Y values is assumed to be 1.0 - */ -typedef struct png_XYZ -{ - png_fixed_point red_X, red_Y, red_Z; - png_fixed_point green_X, green_Y, green_Z; - png_fixed_point blue_X, blue_Y, blue_Z; -} png_XYZ; -#endif /* COLORSPACE */ - -#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED) -/* A colorspace is all the above plus, potentially, profile information; - * however at present libpng does not use the profile internally so it is only - * stored in the png_info struct (if iCCP is supported.) The rendering intent - * is retained here and is checked. - * - * The file gamma encoding information is also stored here and gamma correction - * is done by libpng, whereas color correction must currently be done by the - * application. - */ -typedef struct png_colorspace -{ -#ifdef PNG_GAMMA_SUPPORTED - png_fixed_point gamma; /* File gamma */ -#endif - -#ifdef PNG_COLORSPACE_SUPPORTED - png_xy end_points_xy; /* End points as chromaticities */ - png_XYZ end_points_XYZ; /* End points as CIE XYZ colorant values */ - png_uint_16 rendering_intent; /* Rendering intent of a profile */ -#endif - - /* Flags are always defined to simplify the code. */ - png_uint_16 flags; /* As defined below */ -} png_colorspace, * PNG_RESTRICT png_colorspacerp; - -typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp; - -/* General flags for the 'flags' field */ -#define PNG_COLORSPACE_HAVE_GAMMA 0x0001 -#define PNG_COLORSPACE_HAVE_ENDPOINTS 0x0002 -#define PNG_COLORSPACE_HAVE_INTENT 0x0004 -#define PNG_COLORSPACE_FROM_gAMA 0x0008 -#define PNG_COLORSPACE_FROM_cHRM 0x0010 -#define PNG_COLORSPACE_FROM_sRGB 0x0020 -#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040 -#define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */ -#define PNG_COLORSPACE_INVALID 0x8000 -#define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags)) -#endif /* COLORSPACE || GAMMA */ - -struct png_struct_def -{ -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */ - png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */ - jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */ - size_t jmp_buf_size; /* size of the above, if allocated */ -#endif - png_error_ptr error_fn; /* function for printing errors and aborting */ -#ifdef PNG_WARNINGS_SUPPORTED - png_error_ptr warning_fn; /* function for printing warnings */ -#endif - png_voidp error_ptr; /* user supplied struct for error functions */ - png_rw_ptr write_data_fn; /* function for writing output data */ - png_rw_ptr read_data_fn; /* function for reading input data */ - png_voidp io_ptr; /* ptr to application struct for I/O functions */ - -#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED - png_user_transform_ptr read_user_transform_fn; /* user read transform */ -#endif - -#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED - png_user_transform_ptr write_user_transform_fn; /* user write transform */ -#endif - -/* These were added in libpng-1.0.2 */ -#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - png_voidp user_transform_ptr; /* user supplied struct for user transform */ - png_byte user_transform_depth; /* bit depth of user transformed pixels */ - png_byte user_transform_channels; /* channels in user transformed pixels */ -#endif -#endif - - png_uint_32 mode; /* tells us where we are in the PNG file */ - png_uint_32 flags; /* flags indicating various things to libpng */ - png_uint_32 transformations; /* which transformations to perform */ - - png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */ - z_stream zstream; /* decompression structure */ - -#ifdef PNG_WRITE_SUPPORTED - png_compression_bufferp zbuffer_list; /* Created on demand during write */ - uInt zbuffer_size; /* size of the actual buffer */ - - int zlib_level; /* holds zlib compression level */ - int zlib_method; /* holds zlib compression method */ - int zlib_window_bits; /* holds zlib compression window bits */ - int zlib_mem_level; /* holds zlib compression memory level */ - int zlib_strategy; /* holds zlib compression strategy */ -#endif -/* Added at libpng 1.5.4 */ -#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED - int zlib_text_level; /* holds zlib compression level */ - int zlib_text_method; /* holds zlib compression method */ - int zlib_text_window_bits; /* holds zlib compression window bits */ - int zlib_text_mem_level; /* holds zlib compression memory level */ - int zlib_text_strategy; /* holds zlib compression strategy */ -#endif -/* End of material added at libpng 1.5.4 */ -/* Added at libpng 1.6.0 */ -#ifdef PNG_WRITE_SUPPORTED - int zlib_set_level; /* Actual values set into the zstream on write */ - int zlib_set_method; - int zlib_set_window_bits; - int zlib_set_mem_level; - int zlib_set_strategy; -#endif - - png_uint_32 width; /* width of image in pixels */ - png_uint_32 height; /* height of image in pixels */ - png_uint_32 num_rows; /* number of rows in current pass */ - png_uint_32 usr_width; /* width of row at start of write */ - png_size_t rowbytes; /* size of row in bytes */ - png_uint_32 iwidth; /* width of current interlaced row in pixels */ - png_uint_32 row_number; /* current row in interlace pass */ - png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */ - png_bytep prev_row; /* buffer to save previous (unfiltered) row. - * While reading this is a pointer into - * big_prev_row; while writing it is separately - * allocated if needed. - */ - png_bytep row_buf; /* buffer to save current (unfiltered) row. - * While reading, this is a pointer into - * big_row_buf; while writing it is separately - * allocated. - */ -#ifdef PNG_WRITE_FILTER_SUPPORTED - png_bytep try_row; /* buffer to save trial row when filtering */ - png_bytep tst_row; /* buffer to save best trial row when filtering */ -#endif - png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */ - - png_uint_32 idat_size; /* current IDAT size for read */ - png_uint_32 crc; /* current chunk CRC value */ - png_colorp palette; /* palette from the input file */ - png_uint_16 num_palette; /* number of color entries in palette */ - -/* Added at libpng-1.5.10 */ -#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED - int num_palette_max; /* maximum palette index found in IDAT */ -#endif - - png_uint_16 num_trans; /* number of transparency values */ - png_byte compression; /* file compression type (always 0) */ - png_byte filter; /* file filter type (always 0) */ - png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ - png_byte pass; /* current interlace pass (0 - 6) */ - png_byte do_filter; /* row filter flags (see PNG_FILTER_ in png.h ) */ - png_byte color_type; /* color type of file */ - png_byte bit_depth; /* bit depth of file */ - png_byte usr_bit_depth; /* bit depth of users row: write only */ - png_byte pixel_depth; /* number of bits per pixel */ - png_byte channels; /* number of channels in file */ -#ifdef PNG_WRITE_SUPPORTED - png_byte usr_channels; /* channels at start of write: write only */ -#endif - png_byte sig_bytes; /* magic bytes read/written from start of file */ - png_byte maximum_pixel_depth; - /* pixel depth used for the row buffers */ - png_byte transformed_pixel_depth; - /* pixel depth after read/write transforms */ -#if ZLIB_VERNUM >= 0x1240 - png_byte zstream_start; /* at start of an input zlib stream */ -#endif /* Zlib >= 1.2.4 */ -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) - png_uint_16 filler; /* filler bytes for pixel expansion */ -#endif - -#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) ||\ - defined(PNG_READ_ALPHA_MODE_SUPPORTED) - png_byte background_gamma_type; - png_fixed_point background_gamma; - png_color_16 background; /* background color in screen gamma space */ -#ifdef PNG_READ_GAMMA_SUPPORTED - png_color_16 background_1; /* background normalized to gamma 1.0 */ -#endif -#endif /* bKGD */ - -#ifdef PNG_WRITE_FLUSH_SUPPORTED - png_flush_ptr output_flush_fn; /* Function for flushing output */ - png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ - png_uint_32 flush_rows; /* number of rows written since last flush */ -#endif - -#ifdef PNG_READ_GAMMA_SUPPORTED - int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */ - png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */ - - png_bytep gamma_table; /* gamma table for 8-bit depth files */ - png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ -#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ - defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \ - defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - png_bytep gamma_from_1; /* converts from 1.0 to screen */ - png_bytep gamma_to_1; /* converts from file to 1.0 */ - png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ - png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ -#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */ -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) - png_color_8 sig_bit; /* significant bits in each available channel */ -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) - png_color_8 shift; /* shift for significant bit tranformation */ -#endif - -#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ - || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_bytep trans_alpha; /* alpha values for paletted files */ - png_color_16 trans_color; /* transparent color for non-paletted files */ -#endif - - png_read_status_ptr read_row_fn; /* called after each row is decoded */ - png_write_status_ptr write_row_fn; /* called after each row is encoded */ -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED - png_progressive_info_ptr info_fn; /* called after header data fully read */ - png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */ - png_progressive_end_ptr end_fn; /* called after image is complete */ - png_bytep save_buffer_ptr; /* current location in save_buffer */ - png_bytep save_buffer; /* buffer for previously read data */ - png_bytep current_buffer_ptr; /* current location in current_buffer */ - png_bytep current_buffer; /* buffer for recently used data */ - png_uint_32 push_length; /* size of current input chunk */ - png_uint_32 skip_length; /* bytes to skip in input data */ - png_size_t save_buffer_size; /* amount of data now in save_buffer */ - png_size_t save_buffer_max; /* total size of save_buffer */ - png_size_t buffer_size; /* total amount of available input data */ - png_size_t current_buffer_size; /* amount of data now in current_buffer */ - int process_mode; /* what push library is currently doing */ - int cur_palette; /* current push library palette index */ - -#endif /* PROGRESSIVE_READ */ - -#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) -/* For the Borland special 64K segment handler */ - png_bytepp offset_table_ptr; - png_bytep offset_table; - png_uint_16 offset_table_number; - png_uint_16 offset_table_count; - png_uint_16 offset_table_count_free; -#endif - -#ifdef PNG_READ_QUANTIZE_SUPPORTED - png_bytep palette_lookup; /* lookup table for quantizing */ - png_bytep quantize_index; /* index translation for palette files */ -#endif - -/* Options */ -#ifdef PNG_SET_OPTION_SUPPORTED - png_uint_32 options; /* On/off state (up to 16 options) */ -#endif - -#if PNG_LIBPNG_VER < 10700 -/* To do: remove this from libpng-1.7 */ -#ifdef PNG_TIME_RFC1123_SUPPORTED - char time_buffer[29]; /* String to hold RFC 1123 time text */ -#endif -#endif - -/* New members added in libpng-1.0.6 */ - - png_uint_32 free_me; /* flags items libpng is responsible for freeing */ - -#ifdef PNG_USER_CHUNKS_SUPPORTED - png_voidp user_chunk_ptr; -#ifdef PNG_READ_USER_CHUNKS_SUPPORTED - png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ -#endif -#endif - -#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED - int unknown_default; /* As PNG_HANDLE_* */ - unsigned int num_chunk_list; /* Number of entries in the list */ - png_bytep chunk_list; /* List of png_byte[5]; the textual chunk name - * followed by a PNG_HANDLE_* byte */ -#endif - -/* New members added in libpng-1.0.3 */ -#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED - png_byte rgb_to_gray_status; - /* Added in libpng 1.5.5 to record setting of coefficients: */ - png_byte rgb_to_gray_coefficients_set; - /* These were changed from png_byte in libpng-1.0.6 */ - png_uint_16 rgb_to_gray_red_coeff; - png_uint_16 rgb_to_gray_green_coeff; - /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */ -#endif - -/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ -#if defined(PNG_MNG_FEATURES_SUPPORTED) -/* Changed from png_byte to png_uint_32 at version 1.2.0 */ - png_uint_32 mng_features_permitted; -#endif - -/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ -#ifdef PNG_MNG_FEATURES_SUPPORTED - png_byte filter_type; -#endif - -/* New members added in libpng-1.2.0 */ - -/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ -#ifdef PNG_USER_MEM_SUPPORTED - png_voidp mem_ptr; /* user supplied struct for mem functions */ - png_malloc_ptr malloc_fn; /* function for allocating memory */ - png_free_ptr free_fn; /* function for freeing memory */ -#endif - -/* New member added in libpng-1.0.13 and 1.2.0 */ - png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ - -#ifdef PNG_READ_QUANTIZE_SUPPORTED -/* The following three members were added at version 1.0.14 and 1.2.4 */ - png_bytep quantize_sort; /* working sort array */ - png_bytep index_to_palette; /* where the original index currently is - in the palette */ - png_bytep palette_to_index; /* which original index points to this - palette color */ -#endif - -/* New members added in libpng-1.0.16 and 1.2.6 */ - png_byte compression_type; - -#ifdef PNG_USER_LIMITS_SUPPORTED - png_uint_32 user_width_max; - png_uint_32 user_height_max; - - /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown - * chunks that can be stored (0 means unlimited). - */ - png_uint_32 user_chunk_cache_max; - - /* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk - * can occupy when decompressed. 0 means unlimited. - */ - png_alloc_size_t user_chunk_malloc_max; -#endif - -/* New member added in libpng-1.0.25 and 1.2.17 */ -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED - /* Temporary storage for unknown chunk that the library doesn't recognize, - * used while reading the chunk. - */ - png_unknown_chunk unknown_chunk; -#endif - -/* New member added in libpng-1.2.26 */ - png_size_t old_big_row_buf_size; - -#ifdef PNG_READ_SUPPORTED -/* New member added in libpng-1.2.30 */ - png_bytep read_buffer; /* buffer for reading chunk data */ - png_alloc_size_t read_buffer_size; /* current size of the buffer */ -#endif -#ifdef PNG_SEQUENTIAL_READ_SUPPORTED - uInt IDAT_read_size; /* limit on read buffer size for IDAT */ -#endif - -#ifdef PNG_IO_STATE_SUPPORTED -/* New member added in libpng-1.4.0 */ - png_uint_32 io_state; -#endif - -/* New member added in libpng-1.5.6 */ - png_bytep big_prev_row; - -/* New member added in libpng-1.5.7 */ - void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info, - png_bytep row, png_const_bytep prev_row); - -#ifdef PNG_READ_SUPPORTED -#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED) - png_colorspace colorspace; -#endif -#endif -}; -#endif /* PNGSTRUCT_H */ diff --git a/GLideN64/src/GLideNHQ/inc/zconf.h b/GLideN64/src/GLideNHQ/inc/zconf.h deleted file mode 100644 index 5e1d68a..0000000 --- a/GLideN64/src/GLideNHQ/inc/zconf.h +++ /dev/null @@ -1,534 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET - -/* all linked symbols and init macros */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# define adler32_z z_adler32_z -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define crc32_z z_crc32_z -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateGetDictionary z_deflateGetDictionary -# define deflateInit z_deflateInit -# define deflateInit2 z_deflateInit2 -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzfread z_gzfread -# define gzfwrite z_gzfwrite -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzvprintf z_gzvprintf -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit z_inflateBackInit -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCodesUsed z_inflateCodesUsed -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetDictionary z_inflateGetDictionary -# define inflateGetHeader z_inflateGetHeader -# define inflateInit z_inflateInit -# define inflateInit2 z_inflateInit2 -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateResetKeep z_inflateResetKeep -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateValidate z_inflateValidate -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# define uncompress2 z_uncompress2 -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -#ifdef Z_SOLO - typedef unsigned long z_size_t; -#else -# define z_longlong long long -# if defined(NO_SIZE_T) - typedef unsigned NO_SIZE_T z_size_t; -# elif defined(STDC) -# include - typedef size_t z_size_t; -# else - typedef unsigned long z_size_t; -# endif -# undef z_longlong -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned -# elif (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# elif (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -#endif - -#ifdef Z_U4 - typedef Z_U4 z_crc_t; -#else - typedef unsigned long z_crc_t; -#endif - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H -#endif - -#ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif -#endif - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -# include /* for va_list */ -# endif -#endif - -#ifdef _WIN32 -# ifndef Z_SOLO -# include /* for wchar_t */ -# endif -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H -#endif -#ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/GLideN64/src/GLideNHQ/inc/zlib.h b/GLideN64/src/GLideNHQ/inc/zlib.h deleted file mode 100644 index f09cdaf..0000000 --- a/GLideN64/src/GLideNHQ/inc/zlib.h +++ /dev/null @@ -1,1912 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 - - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.11" -#define ZLIB_VERNUM 0x12b0 -#define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 -#define ZLIB_VER_SUBREVISION 0 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip and raw deflate streams in - memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in the case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - z_const Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total number of input bytes read so far */ - - Bytef *next_out; /* next output byte will go here */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total number of bytes output so far */ - - z_const char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text - for deflate, or the decoding state for inflate */ - uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. In that case, zlib is thread-safe. When zalloc and zfree are - Z_NULL on entry to the initialization function, they are set to internal - routines that use the standard library functions malloc() and free(). - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this if - the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers - returned by zalloc for objects of exactly 65536 bytes *must* have their - offset normalized to zero. The default allocation function provided by this - library ensures this (see zutil.c). To reduce memory requirements and avoid - any allocation of 64K objects, at the expense of compression ratio, compile - the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use by the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field for deflate() */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary. Some output may be provided even if - flush is zero. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 0), or after each call of deflate(). If deflate returns Z_OK and with - zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput - in that case. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed - codes block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this - function must be called again with Z_FINISH and more output space (updated - avail_out) but no more input data, until it returns with Z_STREAM_END or an - error. After deflate has returned Z_STREAM_END, the only possible operations - on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used in the first deflate call after deflateInit if all the - compression is to be done in a single step. In order to complete in one - call, avail_out must be at least the value returned by deflateBound (see - below). Then deflate is guaranteed to return Z_STREAM_END. If not enough - output space is provided, deflate will not return Z_STREAM_END, and it must - be called again as described above. - - deflate() sets strm->adler to the Adler-32 checksum of all input read - so far (that is, total_in bytes). If a gzip stream is being generated, then - strm->adler will be the CRC-32 checksum of the input read so far. (See - deflateInit2 below.) - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is - considered binary. This field is only for information purposes and does not - affect the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL or the state was inadvertently written over - by the application), or Z_BUF_ERROR if no progress is possible (for example - avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and - deflate() can be called again with more input and more output space to - continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. In the current version of inflate, the provided input is not - read or consumed. The allocation of a sliding window will be deferred to - the first call of inflate (if the decompression does not complete on the - first call). If zalloc and zfree are set to Z_NULL, inflateInit updates - them to use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression. - Actual decompression will be done by inflate(). So next_in, and avail_in, - next_out, and avail_out are unused and unchanged. The current - implementation of inflateInit() does not process any header information -- - that is deferred until inflate() is called. -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), then next_in and avail_in are updated - accordingly, and processing will resume at this point for the next call of - inflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. If the - caller of inflate() does not provide both available input and available - output space, it is possible that there will be no progress made. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate returns Z_OK and with zero avail_out, it must be - called again after making room in the output buffer because there might be - more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed Adler-32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained unless inflateGetHeader() is used. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - produced so far. The CRC-32 is checked against the gzip trailer, as is the - uncompressed length, modulo 2^32. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value, in which case strm->msg points to a string with a more specific - error), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL, or the state was inadvertently written over - by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR - if no progress was possible or if there was not enough room in the output - buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is to be attempted. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state - was inconsistent. -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - For the current implementation of deflate(), a windowBits value of 8 (a - window size of 256 bytes) is not supported. As a result, a request for 8 - will result in 9 (a 512-byte window). In that case, providing 8 to - inflateInit2() will result in an error when the zlib header with 9 is - checked against the initialization of inflate(). The remedy is to not use 8 - with deflateInit2() with this initialization, or at least in that case use 9 - with inflateInit2(). - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute a check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to the appropriate value, - if the operating system was determined at compile time. If a gzip stream is - being written, strm->adler is a CRC-32 instead of an Adler-32. - - For raw deflate or gzip encoding, a request for a 256-byte window is - rejected as invalid, since only the zlib header provides a means of - transmitting the window size to the decompressor. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the Adler-32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler-32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - Adler-32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); -/* - Returns the sliding dictionary being maintained by deflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If deflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. - - deflateGetDictionary() may return a length less than the window size, even - when more than the window size in input has been provided. It may return up - to 258 bytes less in that case, due to how zlib's implementation of deflate - manages the sliding window and lookahead for matches, where matches can be - up to 258 bytes long. If the application needs the last window-size bytes of - input, then that would need to be saved by the application outside of zlib. - - deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, but - does not free and reallocate the internal compression state. The stream - will leave the compression level and any other attributes that may have been - set unchanged. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2(). This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). - - If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does - not have enough output space to complete, then the parameter change will not - take effect. In this case, deflateParams() can be called again with the - same parameters and more output space to try again. - - In order to assure a change in the parameters on the first try, the - deflate stream should be flushed using deflate() with Z_BLOCK or other flush - request until strm.avail_out is not zero, before calling deflateParams(). - Then no more input data should be provided before the deflateParams() call. - If this is done, the old level and strategy will be applied to the data - compressed before deflateParams(), and the new level and strategy will be - applied to the the data compressed after deflateParams(). - - deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream - state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if - there was not enough output space to complete the compression of the - available input data before a change in the strategy or approach. Note that - in the case of a Z_BUF_ERROR, the parameters are not changed. A return - value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be - retried with more output space. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. -*/ - -ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, - unsigned *pending, - int *bits)); -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are Z_NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. - */ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an Adler-32 or a CRC-32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler-32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler-32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, - int windowBits)); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. If the window size is changed, then the - memory allocated for the window is freed, and the window will be reallocated - by inflate() if needed. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL), or if - the windowBits parameter is invalid. -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above, or -65536 if the provided - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not Z_NULL and the respective field is not - present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the parameters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, - z_const unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the default - behavior of inflate(), which expects a zlib header and trailer around the - deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero -- buf is ignored in that - case -- and inflateBack() will return a buffer error. inflateBack() will - call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. - out() should return zero on success, or non-zero on failure. If out() - returns non-zero, inflateBack() will return with an error. Neither in() nor - out() are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be Z_NULL only if in() returned an error. If - strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: ZLIB_DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - -#ifndef Z_SOLO - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. compress() is equivalent to compress2() with a level - parameter of Z_DEFAULT_COMPRESSION. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed data. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ - -ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong *sourceLen)); -/* - Same as uncompress, except that sourceLen is a pointer, where the - length of the source is *sourceLen. On return, *sourceLen is the number of - source bytes consumed. -*/ - - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ - -/* -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. - - "a" can be used instead of "w" to request that the gzip stream that will - be written be appended to the file. "+" will result in an error, since - reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. - - The next call of gzclose on the returned gzFile will also close the file - descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); -/* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. - - gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not - opened for writing, Z_ERRNO if there is an error writing the flushed data, - or Z_MEM_ERROR if there is a memory allocation error. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. If len is too large to fit in an int, - then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. -*/ - -ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, - gzFile file)); -/* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. - - gzfread() returns the number of full items read of size size, or zero if - the end of the file was reached and a full item could not be read, or if - there was an error. gzerror() must be consulted if zero is returned in - order to determine if there was an error. If the multiplication of size and - nitems overflows, i.e. the product does not fit in a z_size_t, then nothing - is read, zero is returned, and the error state is set to Z_STREAM_ERROR. - - In the event that the end of file is reached and only a partial item is - available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf - and the end-of-file flag is set. The length of the partial item read is not - provided, but could be inferred from the result of gztell(). This behavior - is the same as the behavior of fread() implementations in common libraries, - but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. -*/ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. -*/ - -ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, - z_size_t nitems, gzFile file)); -/* - gzfwrite() writes nitems items of size size from buf to file, duplicating - the interface of stdio's fwrite(), with size_t request and return types. If - the library defines size_t, then z_size_t is identical to size_t. If not, - then z_size_t is an unsigned integer type that can contain a pointer. - - gzfwrite() returns the number of full items written of size size, or zero - if there was an error. If the multiplication of size and nitems overflows, - i.e. the product does not fit in a z_size_t, then nothing is written, zero - is returned, and the error state is set to Z_STREAM_ERROR. -*/ - -ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or a negative zlib error code in case - of error. The number of uncompressed bytes written is limited to 8191, or - one less than the buffer size given to gzbuffer(). The caller should assure - that this limit is not exceeded. If it is exceeded, then gzprintf() will - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. - This can be determined using zlibCompileFlags(). -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. - - gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If there was an error, the contents at - buf are indeterminate. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte or -1 - in case of end of file or error. This is implemented as a macro for speed. - As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file - points to has been clobbered or not. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. - gzungetc() returns the character pushed, or -1 on failure. gzungetc() will - fail if c is -1, and may fail if a character has been pushed but not read - yet. If gzungetc is used immediately after gzopen or gzdopen, at least the - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. - - If the flush parameter is Z_FINISH, the remaining data is written and the - gzip stream is completed in the output. If gzwrite() is called again, a new - gzip stream will be started in the output. gzread() is able to read such - concatenated gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); - - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. - - If gzeof() returns true, then the read functions will return no more data, - unless the end-of-file indicator is reset by gzclearerr() and the input file - has grown since the previous end of file was detected. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. - - If the input file is empty, gzdirect() will return true, since the input - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you - cannot call gzerror with file, since its structures have been deallocated. - gzclose must not be called more than once on the same file, just as free - must not be called more than once on the same allocation. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ - -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - -#endif /* !Z_SOLO */ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. - - An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed - much faster. - - Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); -/* - Same as adler32(), but with a size_t length. -*/ - -/* -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); -/* - Same as crc32(), but with a size_t length. -*/ - -/* -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#ifdef Z_PREFIX_SET -# define z_deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define z_inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#else -# define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#endif - -#ifndef Z_SOLO - -/* gzgetc() macro and its supporting function and exposed data structure. Note - * that the real internal state is much larger than the exposed structure. - * This abbreviated structure exposes just enough for the gzgetc() macro. The - * user should not mess with these exposed elements, since their names or - * behavior could change in the future, perhaps even capriciously. They can - * only be used by the gzgetc() macro. You have been warned. - */ -struct gzFile_s { - unsigned have; - unsigned char *next; - z_off64_t pos; -}; -ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ -#ifdef Z_PREFIX_SET -# undef z_gzgetc -# define z_gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) -#else -# define gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) -#endif - -/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or - * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if - * both are true, the application gets the *64 functions, and the regular - * functions are changed to 64 bits) -- in case these are set on systems - * without large file support, _LFS64_LARGEFILE must also be true - */ -#ifdef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); -#endif - -#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) -# ifdef Z_PREFIX_SET -# define z_gzopen z_gzopen64 -# define z_gzseek z_gzseek64 -# define z_gztell z_gztell64 -# define z_gzoffset z_gzoffset64 -# define z_adler32_combine z_adler32_combine64 -# define z_crc32_combine z_crc32_combine64 -# else -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# endif -# ifndef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -# endif -#else - ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); -#endif - -#else /* Z_SOLO */ - - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); - -#endif /* !Z_SOLO */ - -/* undocumented functions */ -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); -ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); -ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); -ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); -ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) -ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, - const char *mode)); -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, - const char *format, - va_list va)); -# endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/GLideN64/src/GLideNHQ/lib/libdxtn.a b/GLideN64/src/GLideNHQ/lib/libdxtn.a deleted file mode 100644 index 8049127..0000000 Binary files a/GLideN64/src/GLideNHQ/lib/libdxtn.a and /dev/null differ diff --git a/GLideN64/src/GLideNHQ/lib/libpng.a b/GLideN64/src/GLideNHQ/lib/libpng.a deleted file mode 100644 index bb5dec0..0000000 Binary files a/GLideN64/src/GLideNHQ/lib/libpng.a and /dev/null differ diff --git a/GLideN64/src/GLideNHQ/lib/libz.a b/GLideN64/src/GLideNHQ/lib/libz.a deleted file mode 100644 index dd30f79..0000000 Binary files a/GLideN64/src/GLideNHQ/lib/libz.a and /dev/null differ diff --git a/GLideN64/src/GLideNHQ/test/CMakeLists.txt b/GLideN64/src/GLideNHQ/test/CMakeLists.txt deleted file mode 100644 index 7f166b4..0000000 --- a/GLideN64/src/GLideNHQ/test/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -project( test_hq ) - -# Build type - -if( NOT CMAKE_BUILD_TYPE) - set( CMAKE_BUILD_TYPE Release) -endif( NOT CMAKE_BUILD_TYPE) - -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - set( CMAKE_BUILD_TYPE Debug) - set( DEBUG_BUILD TRUE) - add_definitions( - -DDEBUG - ) -endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - -add_definitions( - -DGHQCHK=1 - -DTXFILTER_DLL=1 -) - -if(WIN32) - add_definitions( - -DWIN32 - -DOS_WINDOWS - ) -endif(WIN32) - -#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" ) - -add_executable( test_hq test.cpp ../Ext_TxFilter.cpp ) diff --git a/GLideN64/src/GLideNHQ/test/Makefile.gcc b/GLideN64/src/GLideNHQ/test/Makefile.gcc deleted file mode 100644 index e76af4b..0000000 --- a/GLideN64/src/GLideNHQ/test/Makefile.gcc +++ /dev/null @@ -1,70 +0,0 @@ -# This MUST be processed by GNU make -# -# Texture Filtering Test Linux Makefile -# Version: 1.0 -# -# Copyright (C) 2007 Hiroshi Morii All Rights Reserved. -# Email koolsmoky(at)users.sourceforge.net -# Web http://www.3dfxzone.it/koolsmoky -# -# this is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# this 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Make; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -# - -# -# Available options: -# -# Environment variables: -# -# Targets: -# all: build dynamic module -# clean: remove object files -# realclean: remove all generated files -# - -# -# GCC does not have SEH (structured exception handling) -# - -.PHONY: all clean realclean - -CC = g++ -CFLAGS += -I. -I../ -CFLAGS += -fPIC -DPIC -CFLAGS += -DGHQCHK=1 - -LD = g++ -LDFLAGS += -ldl -lstdc++ - -RM = rm - -SOURCES = \ - test.cpp \ - ../Ext_TxFilter.cpp - -OBJECTS = $(SOURCES:.cpp=.o) - -.cpp.o: - $(CC) -o $@ $(CFLAGS) -c $< - -all: test.exe - -test.exe: $(OBJECTS) - $(LD) -o $@ $(LDFLAGS) $^ - -clean: - -$(RM) *.o - -realclean: clean - -$(RM) test.exe diff --git a/GLideN64/src/GLideNHQ/test/Makefile.vc8 b/GLideN64/src/GLideNHQ/test/Makefile.vc8 deleted file mode 100644 index 007f538..0000000 --- a/GLideN64/src/GLideNHQ/test/Makefile.vc8 +++ /dev/null @@ -1,68 +0,0 @@ -# This MUST be processed by GNU make -# -# Texture Filtering Test MSVC Makefile -# Version: 1.0 -# -# Copyright (C) 2007 Hiroshi Morii All Rights Reserved. -# Email koolsmoky(at)users.sourceforge.net -# Web http://www.3dfxzone.it/koolsmoky -# -# this is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# this 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Make; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -# - -# -# Available options: -# -# Targets: -# all: build everything -# clean: remove object files -# realclean: remove all generated files -# - -.PHONY: all clean realclean -.SUFFIXES: .cpp .obj - -CC = cl -LD = _link # change this to suite your build environment - -UNLINK = $(RM) $(1) - -CFLAGS += -D__MSC__ -DWIN32 -D_CONSOLE -EHa -D_CRT_SECURE_NO_DEPRECATE -CFLAGS += -I. -I../ -CFLAGS += -DGHQCHK=1 - -#LDFLAGS += -ltcg:STATUS - -SOURCES = \ - test.cpp \ - ../Ext_TxFilter.cpp - -OBJECTS = $(SOURCES:.cpp=.obj) - -.cpp.obj: - $(CC) -Fo$@ $(CFLAGS) -c $< - -all: test.exe - -test.exe: $(OBJECTS) - $(LD) -out:$@ $(LDFLAGS) $(OBJECTS) - -$(OBJECTS): $(SOURCES) - -clean: - -$(RM) *.obj *.pdb *.ilk - -realclean: clean - -$(RM) test.exe diff --git a/GLideN64/src/GLideNHQ/test/test.cpp b/GLideN64/src/GLideNHQ/test/test.cpp deleted file mode 100644 index 86ed01a..0000000 --- a/GLideN64/src/GLideNHQ/test/test.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Texture Filtering - * Version: 1.0 - * - * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. - * Email koolsmoky(at)users.sourceforge.net - * Web http://www.3dfxzone.it/koolsmoky - * - * this is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * this 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "../Ext_TxFilter.h" -#include -#include -#include - -void DisplayLoadProgress(const wchar_t *format, ...) -{ -#if 0 - va_list args; - wchar_t wbuf[INFO_BUF]; - char buf[INFO_BUF]; - - /* process input */ - va_start(args, format); - vswprintf(wbuf, format, args); - va_end(args); - - /* XXX: convert to multibyte */ - wcstombs(buf, wbuf, INFO_BUF); - printf(buf); -#else - static unsigned int i = 0; - i++; - if (i == 1) printf("\b-"); - else if (i == 2) printf("\b\\"); - else if (i == 3) printf("\b|"); - else { - printf("\b/"); - i = 0; - } -#endif -} - -int main(int argc, char* argv[]) -{ - float dummy = 1.1; /* force the compiler to load floating point support */ - boolean bret = 0; - int options = 0; - - /* Plugin path */ - wchar_t path[MAX_PATH]; -#ifdef WIN32 - GETCWD(MAX_PATH, path); -#else - char cbuf[MAX_PATH]; - GETCWD(MAX_PATH, cbuf); - mbstowcs(path, cbuf, MAX_PATH); -#endif - - /* ROM name */ - wchar_t name[21] = L"DEFAULT"; - - printf("------------------------------------------------------------------\n"); - printf(" GlideHQ Hires Texture Checker version 1.2\n"); - printf(" Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n"); - printf(" email : koolsmoky(at)users.sourceforge.net\n"); - printf(" website : http://www.3dfxzone.it/koolsmoky\n"); - printf("\n"); - printf(" Glide64 official website : http://glide64.emuxhaven.net\n"); - printf("\n"); - printf(" Usage: ghqchk.exe \"INTERNAL ROM NAME\"\n"); - printf("------------------------------------------------------------------\n"); - - if (argc != 2) return 0; - - printf("Checking \"%s\"... ", argv[1]); - - mbstowcs(name, argv[1], 21); - - //options |= COMPRESS_TEX; - //options |= COMPRESS_HIRESTEX; - //options |= S3TC_COMPRESSION; - //options |= TILE_HIRESTEX; - //options |= FORCE16BPP_TEX; - //options |= FORCE16BPP_HIRESTEX; - //options |= GZ_TEXCACHE; - options |= GZ_HIRESTEXCACHE; - //options |= (DUMP_TEXCACHE|DUMP_HIRESTEXCACHE); - options |= LET_TEXARTISTS_FLY; - //options |= DUMP_TEX; - options |= RICE_HIRESTEXTURES; - - bret = ext_ghq_init(1024, // max texture width supported by hardware - 1024, // max texture height supported by hardware - 32, // max texture bpp supported by hardware - options, - 0, // cache texture to system memory - path, // plugin path - name, // name of ROM. must be no longer than 256 characters - DisplayLoadProgress); - - ext_ghq_shutdown(); - - printf("\bDone!\nLogged to ghqchk.txt\n"); - - return bret; -} diff --git a/GLideN64/src/GLideNHQ/txWidestringWrapper.cpp b/GLideN64/src/GLideNHQ/txWidestringWrapper.cpp deleted file mode 100644 index ea00584..0000000 --- a/GLideN64/src/GLideNHQ/txWidestringWrapper.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#ifdef OS_ANDROID - -#include -#include -#include -#include "txWidestringWrapper.h" - -tx_wstring::tx_wstring(const wchar_t * wstr) : _wstring(wstr) -{ - wcstombs(cbuf, wstr, BUF_SIZE); - _astring.assign(cbuf); -} - -tx_wstring::tx_wstring(const tx_wstring & other) : _wstring(other.c_str()) -{ - wcstombs(cbuf, other.c_str(), BUF_SIZE); - _astring.assign(cbuf); -} - -void tx_wstring::assign(const wchar_t * wstr) -{ - _wstring.assign(wstr); - wcstombs(cbuf, wstr, BUF_SIZE); - _astring.assign(cbuf); -} - -void tx_wstring::assign(const tx_wstring & wstr) -{ - _wstring.assign(wstr.c_str()); - wcstombs(cbuf, wstr.c_str(), BUF_SIZE); - _astring.assign(cbuf); -} - -void tx_wstring::append(const tx_wstring & wstr) -{ - wcstombs(cbuf, wstr.c_str(), BUF_SIZE); - _astring.append(cbuf); - mbstowcs(wbuf, _astring.c_str(), BUF_SIZE); - _wstring.assign(wbuf); -} - -tx_wstring & tx_wstring::operator=(const tx_wstring & other) -{ - assign(other); - return *this; -} - -tx_wstring & tx_wstring::operator+=(const tx_wstring & other) -{ - append(other); - return *this; -} - -tx_wstring & tx_wstring::operator+=(const wchar_t * wstr) -{ - append(wstr); - return *this; -} - -tx_wstring tx_wstring::operator+(const tx_wstring & wstr) const -{ - tx_wstring ans(_wstring.c_str()); - ans.append(wstr); - return ans; -} - -tx_wstring tx_wstring::operator+(const wchar_t * wstr) const -{ - tx_wstring ans(_wstring.c_str()); - ans.append(wstr); - return ans; -} - -const wchar_t * tx_wstring::c_str() const -{ - return _wstring.c_str(); -} - -bool tx_wstring::empty() const -{ - return _astring.empty(); -} - -int tx_wstring::compare(const wchar_t * wstr) -{ - wcstombs(cbuf, wstr, BUF_SIZE); - return _astring.compare(cbuf); -} - -dummyWString::dummyWString(const char * _str) -{ - wchar_t buf[BUF_SIZE]; - mbstowcs(buf, _str, BUF_SIZE); - _wstr.assign(buf); -} - -int tx_swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...) -{ - char cbuf[BUF_SIZE]; - char fmt[BUF_SIZE]; - wcstombs(fmt, format, BUF_SIZE); - - va_list ap; - va_start(ap, format); - int res = vsprintf(cbuf, fmt, ap); - va_end(ap); - mbstowcs(ws, cbuf, len); - return res; -} - -bool wccmp(const wchar_t* w1, const wchar_t* w2) -{ - char cbuf1[16]; - wcstombs(cbuf1, w1, 16); - char cbuf2[16]; - wcstombs(cbuf2, w2, 16); - return cbuf1[0] == cbuf2[0]; -} -#endif // OS_ANDROID diff --git a/GLideN64/src/GLideNHQ/txWidestringWrapper.h b/GLideN64/src/GLideNHQ/txWidestringWrapper.h deleted file mode 100644 index 100c119..0000000 --- a/GLideN64/src/GLideNHQ/txWidestringWrapper.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef ___TXWIDESCREENWRAPPER_H__ -#define ___TXWIDESCREENWRAPPER_H__ - -#include -#include - -#ifdef OS_ANDROID - -int tx_swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...); -bool wccmp(const wchar_t* w1, const wchar_t* w2); - -#define BUF_SIZE 2048 - -class tx_wstring { -public: - tx_wstring() {} - tx_wstring(const wchar_t * wstr); - tx_wstring(const tx_wstring & other); - void assign(const wchar_t * wstr); - void assign(const tx_wstring & wstr); - void append(const tx_wstring & wstr); - tx_wstring & operator=(const tx_wstring & other); - tx_wstring & operator+=(const tx_wstring & other); - tx_wstring & operator+=(const wchar_t * wstr); - tx_wstring operator+(const tx_wstring & wstr) const; - tx_wstring operator+(const wchar_t * wstr) const; - const wchar_t * c_str() const; - bool empty() const; - int compare(const wchar_t * wstr); - -private: - std::wstring _wstring; - std::string _astring; - char cbuf[BUF_SIZE]; - wchar_t wbuf[BUF_SIZE]; -}; - -class dummyWString -{ -public: - dummyWString(const char * _str); - - const wchar_t * c_str() const { - return _wstr.c_str(); - } - -private: - std::wstring _wstr; -}; - -#define wst(A) dummyWString(A).c_str() - -#define removeColon(A) -#else - -#define tx_swprintf swprintf -#define wst(A) L##A -#define wccmp(A, B) A[0] == B[0] - -typedef std::wstring tx_wstring; - -inline -void removeColon(tx_wstring& _s) -{ - std::replace(_s.begin(), _s.end(), L':', L'-'); -} - -#endif // OS_ANDROID - -#endif // ___TXWIDESCREENWRAPPER_H__ diff --git a/GLideN64/src/GLideNUI-wtl/About.cpp b/GLideN64/src/GLideNUI-wtl/About.cpp deleted file mode 100644 index b2b7ef4..0000000 --- a/GLideN64/src/GLideNUI-wtl/About.cpp +++ /dev/null @@ -1,403 +0,0 @@ -#include "About.h" -#include "resource.h" -#include "Language.h" - -extern HINSTANCE hInstance; - -class CAboutContributersTab : - public CAboutTab -{ -public: - BEGIN_MSG_MAP(CAboutContributersTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - END_MSG_MAP() - - CAboutContributersTab() : - CAboutTab(IDD_TAB_CONTRIBUTORS) - { - } - - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) - { - const TCHAR Contributors[] = - { - L"Logan McNaughton\r\n\r\n" - L"Francisco Zurita\r\n\r\n" - L"gizmo98\r\n\r\n" - L"purplemarshmallow\r\n\r\n" - L"zilmar\r\n\r\n" - L"matthewharvey\r\n\r\n" - L"lioncash\r\n\r\n" - L"Predator82Germany\r\n\r\n" - L"AmbientMalice\r\n\r\n" - L"baptiste0602\r\n\r\n" - L"Gilles Siberlin\r\n\r\n" - L"Daniel Eck\r\n\r\n" - L"Víctor \"IlDucci\"\r\n\r\n" - L"orbea\r\n\r\n" - L"BenjaminSiskoo\r\n\r\n" - L"ptitSeb\r\n\r\n" - L"Kimberly J.Ortega\r\n\r\n" - L"Maxime Morel\r\n\r\n" - L"tony971\r\n\r\n" - L"SigmaVirus\r\n\r\n" - L"Jools Wills\r\n\r\n" - L"Nekokabu\r\n\r\n" - L"nicklauslittle\r\n\r\n" - L"Nebuleon\r\n\r\n" - L"sergiobenrocha2\r\n\r\n" - L"MichaÅ‚ Durak\r\n\r\n" - L"Mushman" - }; - GetDlgItem(IDC_CONTRIBUTORS).SetWindowText(Contributors); - return true; - } - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - if ((HWND)lParam == GetDlgItem(IDC_CONTRIBUTORS)) - { - SetBkMode((HDC)wParam, TRANSPARENT); - return (LRESULT)GetSysColorBrush(COLOR_3DFACE); - } - return (LRESULT)GetStockObject(WHITE_BRUSH); - } -}; - -class CAboutFundersTab : - public CAboutTab -{ -public: - BEGIN_MSG_MAP(CAboutFundersTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - END_MSG_MAP() - - CAboutFundersTab() : - CAboutTab(IDD_TAB_FUNDERS) - { - } - - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) - { - const TCHAR Funders1[] = - { - L"zolcos\r\n" - L"Mush Man\r\n" - L"nesplayer4life\r\n" - L"neko9876\r\n" - L"AnthonyHeathcoat\r\n" - L"daman6009\r\n" - L"Paul Lamb\r\n" - L"zilmar\r\n" - }; - std::wstring FundersList = - { - L"Ryan Rosser\r\n" - L"Amadeus Sterl\r\n" - L"Narann\r\n" - L"camara_luiz\r\n" - L"weinerschnitzel\r\n" - L"microdev\r\n" - L"Thomas Ginelli\r\n" - L"ace977\r\n" - L"patryk.szalanski\r\n" - L"Detomine\r\n" - L"itasovski\r\n" - L"keithclark1985\r\n" - L"josephrmoore\r\n" - L"fckyourlies\r\n" - L"dougforr\r\n" - L"camdenfurse\r\n" - L"grandslam810\r\n" - L"rictic\r\n" - L"Fred Lambes\r\n" - L"David Vercruyssen\r\n" - L"danielgormly\r\n" - L"lukecool\r\n" - L"rhilsky\r\n" - L"phillipstuerzl\r\n" - L"killjoy1337\r\n" - L"ratop46\r\n" - L"william.a.moore\r\n" - L"RSP16\r\n" - L"kzidek127\r\n" - L"Dan Holberg\r\n" - L"178amm\r\n" - L"peterchrjoergensen\r\n" - L"hill_jm\r\n" - L"petercullenbryan\r\n" - L"Christopher M Rock\r\n" - L"Kenny.R.Mitchell\r\n" - L"Kevin Grasso\r\n" - L"mtgyure\r\n" - L"Anthony Heathcoat\r\n" - L"Liam Burns\r\n" - L"Steven Impson\r\n" - L"Gwyn.Whieldon\r\n" - L"hipnotoad\r\n" - L"shmuklidooha\r\n" - L"bcanard123\r\n" - L"Ben Slater\r\n" - L"Mike Nagy\r\n" - L"littlegreendude55\r\n" - L"Jay Loring\r\n" - L"Damion D\r\n" - L"heranbago\r\n" - L"baptiste.guilbert\r\n" - L"shadowpower69\r\n" - L"j.mcguirk72\r\n" - L"Peter Greenwood\r\n" - L"fla56\r\n" - L"Sergio\r\n" - L"theboy_181\r\n" - L"Jindo Fox\r\n" - L"s1n.pcc\r\n" - L"rafaelvasco\r\n" - L"copileo\r\n" - L"hugues.fabien\r\n" - L"seanmcm157\r\n" - L"David Morris\r\n" - L"Jason Lightner\r\n" - L"olivier_crepin77\r\n" - L"Paul Lamb\r\n" - L"thegump2.0\r\n" - L"Bates\r\n" - L"cdoublejj\r\n" - L"buddybenj\r\n" - L"don.carmical\r\n" - L"kyussgreen\r\n" - L"info1092\r\n" - L"YQ\r\n" - L"Allan Nordhøy\r\n" - L"christian010\r\n" - L"creuseur2patateradio\r\n" - L"chrisbevanlee\r\n" - L"theschklingen\r\n" - L"Thomas Lindstrøm\r\n" - L"Djipi\r\n" - L"Dartus\r\n" - L"Oscar Abraham\r\n" - L"nwstrathdee\r\n" - L"will7046\r\n" - L"Richard42\r\n" - L"V1del\r\n" - L"AnthonyBentley\r\n" - L"buddybenj\r\n" - L"nickshooter251\r\n" - L"sicurella12\r\n" - L"jcspringer\r\n" - L"Gru So\r\n" - L"Vinícius dos Santos Oliveira\r\n" - L"Jimmy Haugh\r\n" - L"Malcolm\r\n" - L"Alex Strange\r\n" - L"Espen Jensen\r\n" - L"m.johnsondelta\r\n" - L"alexzandar.toxic2\r\n" - L"Ben Slater\r\n" - L"WC-Predator\r\n" - L"Mush Man\r\n" - L"Ben Slater\r\n" - L"aznlucidx\r\n" - L"Nathan Dick\r\n" - L"paulanocom\r\n" - L"Ryan Rosser\r\n" - L"nekow42\r\n" - L"mgos1\r\n" - L"ian.macdonald996\r\n" - L"itasovski\r\n" - L"vikingpower1\r\n" - L"DukeX007X\r\n" - L"palaciosgabriel\r\n" - L"Franz-Josef Haider\r\n" - L"e-male\r\n" - L"aweath\r\n" - L"famicom4\r\n" - L"Keith_at_UMR\r\n" - L"sweatypickle\r\n" - L"jeremydmiller\r\n\r\n" - }; - FundersList += wGS(ABOUT_AND_MORE); - CWindow Funders = GetDlgItem(IDC_FUNDERS); - Funders.SetWindowText(Funders1); - m_SubtitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeSubheading, IDC_FUNDERS); - GetDlgItem(IDC_FUNDERS_LIST).SetWindowText(FundersList.c_str()); - return true; - }; - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - if ((HWND)lParam == GetDlgItem(IDC_FUNDERS_LIST)) - { - SetBkMode((HDC)wParam, TRANSPARENT); - return (LRESULT)GetSysColorBrush(COLOR_3DFACE); - } - return (LRESULT)GetStockObject(WHITE_BRUSH); - } -}; - -class CAboutCreditsTab : - public CAboutTab -{ -public: - BEGIN_MSG_MAP(CAboutCreditsTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - END_MSG_MAP() - - CAboutCreditsTab() : - CAboutTab(IDD_TAB_CREDITS) - { - } - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) - { - SetDlgItemTextW(IDC_TXT_AUTHOR_GLN64, wGS(ABOUT_AUTHOR_GLN64).c_str()); - SetDlgItemTextW(IDC_TXT_AUTHOR_GLES2N64, wGS(ABOUT_AUTHOR_GLES2N64).c_str()); - SetDlgItemTextW(IDC_TXT_AUTHOR_GLIDEHQ, wGS(ABOUT_AUTHOR_GLIDEHQ).c_str()); - SetDlgItemTextW(IDC_TXT_AUTHOR_Z64, wGS(ABOUT_AUTHOR_Z64).c_str()); - - const UINT Creditors[] = - { - IDC_ORKIN, - IDC_YONGZH, - IDC_HIROSHI, - IDC_ZIGGY - }; - for (const UINT &Creditor : Creditors) { - m_SubtitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeSubheading, Creditor); - } - return true; - }; -}; - -CAboutTab::CAboutTab(uint32_t _IDD) : - IDD(_IDD) -{ -} - -CAboutTab::~CAboutTab() -{ -} - -BOOL CAboutTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) -{ - SetDlgItemTextW(IDC_TXT_NEW_GEN, wGS(ABOUT_NEXT_GENERATION).c_str()); - SetDlgItemTextW(IDC_TXT_AUTHORS, wGS(ABOUT_AUTHORS).c_str()); - SetDlgItemTextW(IDC_TXT_DEVELOPER, wGS(ABOUT_DEVELOPER).c_str()); - SetDlgItemTextW(IDC_TXT_BETA_TESTER, wGS(ABOUT_BETA_TESTER).c_str()); - SetDlgItemTextW(IDC_TXT_GUI_DESIGNER, wGS(ABOUT_GUI_DESIGNER).c_str()); - - const UINT Authors[] = - { - IDC_SERGEY, - IDC_OLIVIER, - IDC_RYAN - }; - for (const UINT &Author : Authors) { - m_SubtitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeSubheading, Author); - } - return true; -} - -LRESULT CAboutTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -CAboutDlg::~CAboutDlg() -{ - for (size_t i = 0, n = m_TabWindows.size(); i < n; i++) - { - delete m_TabWindows[i]; - } - m_TabWindows.clear(); -} - -LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/ , LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - SetWindowText(wGS(ABOUT_ABOUT_TITLE).c_str()); - - HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); - SetIcon(hIcon, TRUE); - HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); - SetIcon(hIconSmall, FALSE); - SIZEF dpiScale = DpiScale(m_hWnd); - SIZE iconSz = { (LONG)(48 * dpiScale.cx), (LONG)(48 * dpiScale.cy) }; - - m_TitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeHeading, IDC_ABOUT_TITLE); - m_AboutIcon.SubclassWindow(GetDlgItem(IDC_ABOUT_ICON)); - if (dpiScale.cx > 1.0 || dpiScale.cy > 1.0) { - m_AboutIcon.SetIcon(MAKEINTRESOURCE(IDI_APPICON), 256, 256); //load hi-def icon - } - else { - m_AboutIcon.SetIcon(MAKEINTRESOURCE(IDI_APPICON), 48, 48); //load regular icon - } - m_AboutIcon.SetWindowPos(HWND_TOP, 0, 0, iconSz.cx, iconSz.cy, SWP_NOMOVE | SWP_NOZORDER); - - m_Tabs.Attach(GetDlgItem(IDC_TABS)); - AddTab(wGS(ABOUT_TAB_ABOUT).c_str(), new CAboutTab(IDD_TAB_ABOUT)); - AddTab(wGS(ABOUT_TAB_CONTRIBUTORS).c_str(), new CAboutContributersTab); - AddTab(wGS(ABOUT_TAB_FUNDERS).c_str(), new CAboutFundersTab); - AddTab(wGS(ABOUT_TAB_CREDITS).c_str(), new CAboutCreditsTab); - return 0; -} - -CRect CAboutDlg::GetTabRect() -{ - CRect TabRect; - m_Tabs.GetWindowRect(&TabRect); - ScreenToClient(&TabRect); - m_Tabs.AdjustRect(FALSE, &TabRect); - return TabRect; -} - -void CAboutDlg::AddTab(const wchar_t * caption, CAboutTab * tab) -{ - m_Tabs.AddItem(caption); - tab->Create(m_hWnd, 0); - tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW); - m_TabWindows.push_back(tab); - - if (m_TabWindows.size() == 1) - { - ShowTab(0); - } -} - -void CAboutDlg::ShowTab(int nPage) -{ - for (size_t i = 0; i < m_TabWindows.size(); i++) - { - m_TabWindows[i]->ShowWindow(SW_HIDE); - } - - CRect TabRect = GetTabRect(); - m_TabWindows[nPage]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW); - - CRect WinRect, ClientRect; - m_TabWindows[nPage]->GetWindowRect(WinRect); - m_TabWindows[nPage]->GetClientRect(ClientRect); - - m_Tabs.RedrawWindow(); -} - -LRESULT CAboutDlg::OnTabChange(NMHDR* /*pNMHDR*/) -{ - ShowTab(m_Tabs.GetCurSel()); - return FALSE; -} - -LRESULT CAboutDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - EndDialog(wID); - return 0; -} - -LRESULT CAboutDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - EndDialog(wID); - return 0; -} \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/About.h b/GLideN64/src/GLideNUI-wtl/About.h deleted file mode 100644 index 9274a88..0000000 --- a/GLideN64/src/GLideNUI-wtl/About.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include "wtl.h" -#include "wtl-WindowFont.h" -#include "wtl-BitmapPicture.h" -#include "resource.h" -#include - - -class CAboutTab : - public CDialogImpl -{ -public: - CAboutTab(uint32_t _IDD); - virtual ~CAboutTab(); - - BEGIN_MSG_MAP(CAboutTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - END_MSG_MAP() - - uint32_t IDD; - -protected: - BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); - LRESULT OnColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - - CWindowFont m_SubtitleFont; -}; - -class CAboutDlg : - public CDialogImpl -{ -public: - ~CAboutDlg(); - - enum { IDD = IDD_ABOUT }; - - BEGIN_MSG_MAP_EX(CAboutDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_ID_HANDLER(IDOK, OnOK) - COMMAND_ID_HANDLER(IDCANCEL, OnCancel) - NOTIFY_HANDLER_EX(IDC_TABS, TCN_SELCHANGE, OnTabChange) - END_MSG_MAP() - -protected: - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnTabChange(NMHDR* pNMHDR); - - void AddTab(const wchar_t * caption, CAboutTab *); - void ShowTab(int nPage); - CRect GetTabRect(); - - CWindowFont m_TitleFont; - CBitmapPicture m_AboutIcon; - CTabCtrl m_Tabs; - std::vector m_TabWindows; -}; \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/ConfigDlg.cpp b/GLideN64/src/GLideNUI-wtl/ConfigDlg.cpp deleted file mode 100644 index c6ad95c..0000000 --- a/GLideN64/src/GLideNUI-wtl/ConfigDlg.cpp +++ /dev/null @@ -1,440 +0,0 @@ -#pragma once -#include "wtl.h" -#include "ConfigDlg.h" -#include "../Config.h" -#include "Settings.h" -#include "config-video.h" -#include "config-emulation.h" -#include "config-framebuffer.h" -#include "config-texture.h" -#include "config-osd.h" -#include "config-debug.h" -#include "util/util.h" -#include "InputDialog.h" -#include "Language.h" - -CConfigDlg::CConfigDlg() : - m_blockReInit(false), - m_EmulationTab(NULL), - m_Saved(false), - m_TabLeft(0), - m_ProfileLeft(0) -{ -} - -CConfigDlg::~CConfigDlg() { - m_EmulationTab = NULL; - for (size_t i = 0; i < m_TabWindows.size(); i++) - delete m_TabWindows[i]; - m_TabWindows.clear(); -} - -void CConfigDlg::setIniPath(const std::string & IniPath) { - m_strIniPath = IniPath; -} - -void CConfigDlg::setRomName(const char * RomName) { - m_romName = RomName == NULL || strlen(RomName) == 0 ? NULL : RomName; -} - -void CConfigDlg::setMSAALevel(uint32_t _maxMSAALevel) { - m_maxMSAALevel = _maxMSAALevel; -} - -uint32_t CConfigDlg::getMSAALevel() const { - return m_maxMSAALevel; -} - -LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); - SetIcon(hIcon, TRUE); - HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); - SetIcon(hIconSmall, FALSE); - - m_FrameBufferTab = new CFrameBufferTab(); - m_VideoTab = new CVideoTab(*this, *m_FrameBufferTab, m_strIniPath.c_str()); - m_EmulationTab = new CEmulationTab(*this); - m_OsdTab = new COsdTab(); - - m_Tabs.Attach(GetDlgItem(IDC_TABS)); - AddTab(TAB_VIDEO, m_VideoTab); - AddTab(TAB_EMULATION, m_EmulationTab); - AddTab(TAB_FRAME_BUFFER, m_FrameBufferTab); - AddTab(TAB_TEXTURE_ENHANCEMENT, new CTextureEnhancementTab); - AddTab(TAB_OSD, m_OsdTab); -#ifdef DEBUG_DUMP - AddTab(TAB_DEBUG, new CDebugTab); -#endif - - RECT Rect; - GetDlgItem(IDC_TABS).GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - m_TabLeft = Rect.left; - - if (m_romName != NULL) { - std::wstring RomName(ToUTF16(m_romName)); - CWindow dlgItem = GetDlgItem(IDC_GAME_PROFILE_NAME); - CDC dc; - dc.CreateCompatibleDC(NULL); - dc.SelectFont(dlgItem.GetFont()); - SIZE size; - dc.GetTextExtent(RomName.c_str(), static_cast(RomName.length()), &size); - - RECT Rect; - dlgItem.GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - Rect.right = Rect.left + size.cx; - dlgItem.MoveWindow(&Rect); - dlgItem.SetWindowText(RomName.c_str()); - - m_ProfileLeft = Rect.right + 10; - - CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_CHECKED); - CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_UNCHECKED); - } else { - CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_UNCHECKED); - CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_CHECKED); - GetDlgItem(IDC_SETTINGS_PROFILE_STATIC).GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - m_ProfileLeft = Rect.left; - } - - ProfileList Profiles = getProfiles(m_strIniPath.c_str()); - std::string CurrentProfile = getCurrentProfile(m_strIniPath.c_str()); - CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE)); - profilesComboBox.ResetContent(); - for (ProfileList::const_iterator itr = Profiles.begin(); itr != Profiles.end(); itr++) { - int Index = profilesComboBox.AddString(ToUTF16(itr->c_str()).c_str()); - if (CurrentProfile == *itr) - profilesComboBox.SetCurSel(Index); - } - profilesComboBox.AddString(L"New..."); - GetDlgItem(IDC_REMOVE_PROFILE).EnableWindow(profilesComboBox.GetCount() > 2); - Init(); - return 0; -} - -void CConfigDlg::OnCustomSettingsToggled(bool checked) { - if (m_hWnd == NULL) - return; - - checked = m_romName != NULL ? checked : false; - GetDlgItem(IDC_GAME_PROFILE).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE); - GetDlgItem(IDC_SAVE_SETTINGS_STATIC).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE); - GetDlgItem(IDC_GAME_PROFILE_NAME).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE); - GetDlgItem(IDC_USE_PROFILE).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE); - - int32_t Move = 0; - if (checked) { - RECT Rect; - CWindow UseProfile = GetDlgItem(IDC_USE_PROFILE); - UseProfile.GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - Move = Rect.left - m_ProfileLeft; - if (Move != 0) { - Rect.left -= Move; - Rect.right -= Move; - UseProfile.MoveWindow(&Rect); - } - uint32_t Left = Rect.right + 2; - - CWindow ProfileStatic = GetDlgItem(IDC_SETTINGS_PROFILE_STATIC); - ProfileStatic.GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - Move = Rect.left - Left; - } else { - RECT Rect; - GetDlgItem(IDC_SETTINGS_PROFILE_STATIC).GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - - Move = Rect.left - m_TabLeft; - } - if (Move != 0) { - int nID[] = { - IDC_SETTINGS_PROFILE_STATIC, - IDC_PROFILE, - IDC_REMOVE_PROFILE, - }; - - RECT Rect; - GetDlgItem(nID[0]).GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - - for (size_t i = 0, n = sizeof(nID) / sizeof(nID[0]); i < n; i++) { - CWindow window = GetDlgItem(nID[i]); - window.GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - - Rect.left -= Move; - Rect.right -= Move; - window.MoveWindow(&Rect); - } - } -} - -LRESULT CConfigDlg::OnProfileChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/) { - CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE)); - int nIndex = profilesComboBox.GetCurSel(); - if (nIndex < 0) { return 0; } - - int nLen = profilesComboBox.GetLBTextLen(nIndex); - if (nLen == CB_ERR) { return FALSE; } - - std::wstring Profile; - Profile.resize(nLen); - profilesComboBox.GetLBText(nIndex, (wchar_t *)Profile.data()); - - CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_CHECKED); - CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_UNCHECKED); - if (Profile == L"New...") { - bool ok; - std::string switchToProfile = getCurrentProfile(m_strIniPath.c_str()); - std::string newProfile = FromUTF16(CInputDialog::getText(L"New Profile", L"New profile name:", ok).c_str()); - CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE)); - if (ok) { - ProfileList Profiles = getProfiles(m_strIniPath.c_str()); - if (strcmp(newProfile.c_str(), "New...") == 0) { - MessageBox(L"New settings profiles cannot be called \"New...\".", L"New Profile", MB_OK | MB_ICONWARNING); - } - else if (newProfile.empty()) { - MessageBox(L"Please type a name for your new settings profile.", L"New Profile", MB_OK | MB_ICONWARNING); - } - else if (Profiles.find(newProfile.c_str()) != Profiles.end()) { - MessageBox(L"This settings profile already exists.", L"New Profile", MB_OK | MB_ICONWARNING); - } else { - profilesComboBox.AddString(ToUTF16(newProfile.c_str()).c_str()); - addProfile(m_strIniPath.c_str(), newProfile.c_str()); - GetDlgItem(IDC_REMOVE_PROFILE).EnableWindow(profilesComboBox.GetCount() > 2); - switchToProfile = newProfile; - } - } - for (int i = 0, n = profilesComboBox.GetCount(); i < n; ++i) { - std::wstring Profile; - Profile.resize(profilesComboBox.GetLBTextLen(i) + 1); - profilesComboBox.GetLBText(i, (wchar_t *)Profile.data()); - - if (strcmp(FromUTF16(Profile.c_str()).c_str(),switchToProfile.c_str()) == 0) { - profilesComboBox.SetCurSel(i); - break; - } - } - return 0; - } - changeProfile(m_strIniPath.c_str(), FromUTF16(Profile.c_str()).c_str()); - Init(true); - return 0; -} - -void CConfigDlg::SaveSettings() { - m_Saved = true; - for (size_t i = 0; i < m_TabWindows.size(); i++) - m_TabWindows[i]->SaveSettings(); - - if (config.generalEmulation.enableCustomSettings && CButton(GetDlgItem(IDC_GAME_PROFILE)).GetCheck() == BST_CHECKED && m_romName != nullptr) - saveCustomRomSettings(m_strIniPath.c_str(), m_romName); - else - writeSettings(m_strIniPath.c_str()); - Init(true); -} - -LRESULT CConfigDlg::OnRestoreDefaults(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - int Res = MessageBox(L"Are you sure you want to reset all settings to default?", L"Restore Defaults?", MB_YESNO | MB_ICONWARNING); - if (Res == IDYES) { - const u32 enableCustomSettings = config.generalEmulation.enableCustomSettings; - config.resetToDefaults(); - config.generalEmulation.enableCustomSettings = enableCustomSettings; - setRomName(m_romName); - Init(); - } - return 0; -} - -LRESULT CConfigDlg::OnGameProfile(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { - CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_UNCHECKED); - Init(true, true); - return 0; -} - -LRESULT CConfigDlg::OnUseProfile(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { - CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_UNCHECKED); - Init(true, true); - return 0; -} - -LRESULT CConfigDlg::OnRemoveProfile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE)); - if (profilesComboBox.GetCount() <= 2) - return 0; - - int nIndex = profilesComboBox.GetCurSel(); - std::wstring profile; - profile.resize(profilesComboBox.GetLBTextLen(nIndex) + 1); - profilesComboBox.GetLBText(nIndex, (wchar_t *)profile.data()); - - ProfileList Profiles = getProfiles(m_strIniPath.c_str()); - if (Profiles.find(FromUTF16(profile.c_str()).c_str()) == Profiles.end()) - return 0; - - std::wstring msg = L"Are you sure you want to remove the settings profile \""; - msg += profile.c_str(); - msg += L"\"?"; - if (MessageBox(msg.c_str(), L"Remove Profile", MB_YESNO | MB_ICONWARNING) == IDYES) { - removeProfile(m_strIniPath.c_str(), FromUTF16(profile.c_str()).c_str()); - for (int i = 0, n = profilesComboBox.GetCount(); i < n; ++i) { - std::wstring ProfileItem; - ProfileItem.resize(profilesComboBox.GetLBTextLen(i) + 1); - profilesComboBox.GetLBText(i, (wchar_t *)ProfileItem.data()); - - if (wcscmp(ProfileItem.c_str(),profile.c_str()) == 0) { - profilesComboBox.DeleteString(i); - break; - } - } - for (int i = 0, n = profilesComboBox.GetCount(); i < n; ++i) { - std::wstring ProfileItem; - ProfileItem.resize(profilesComboBox.GetLBTextLen(i) + 1); - profilesComboBox.GetLBText(i, (wchar_t *)ProfileItem.data()); - if (wcscmp(ProfileItem.c_str(),L"New...") != 0) { - profilesComboBox.SetCurSel(i); - changeProfile(m_strIniPath.c_str(), FromUTF16(ProfileItem.c_str()).c_str()); - Init(true); - break; - } - } - GetDlgItem(IDC_REMOVE_PROFILE).EnableWindow(profilesComboBox.GetCount() > 2); - } - return 0; -} - -LRESULT CConfigDlg::OnSaveClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - SaveSettings(); - EndDialog(wID); - return 0; -} - -LRESULT CConfigDlg::OnSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - SaveSettings(); - return 0; -} - -LRESULT CConfigDlg::OnTabChange(NMHDR* /*pNMHDR*/) { - ShowTab(m_Tabs.GetCurSel()); - return FALSE; -} - -LRESULT CConfigDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - EndDialog(wID); - return 0; -} - -void CConfigDlg::Init(bool reInit, bool blockCustomSettings) { - if (m_blockReInit) - return; - - m_blockReInit = true; - bool CustomSettings = m_EmulationTab != NULL && CButton(m_EmulationTab->GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED; - - if (reInit && m_romName != NULL && CustomSettings && CButton(GetDlgItem(IDC_GAME_PROFILE)).GetCheck() == BST_CHECKED) { - loadCustomRomSettings(m_strIniPath.c_str(), m_romName); - } else if (reInit) { - loadSettings(m_strIniPath.c_str()); - } - - for (size_t i = 0; i < m_TabWindows.size(); i++) - m_TabWindows[i]->LoadSettings(blockCustomSettings); - - for (size_t i = 0; i < m_TabWindows.size(); i++) - m_TabWindows[i]->ApplyLanguage(); - ApplyLanguage(); - m_blockReInit = false; -} - -CRect CConfigDlg::GetTabRect() { - CRect TabRect; - m_Tabs.GetWindowRect(&TabRect); - ScreenToClient(&TabRect); - m_Tabs.AdjustRect(FALSE, &TabRect); - return TabRect; -} - -void CConfigDlg::AddTab(languageStringID caption, CConfigTab * tab) { - m_Tabs.AddItem(TCIF_TEXT | TCIF_PARAM, wGS(caption).c_str(), 0, caption); - tab->Create(m_hWnd, 0); - tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW); - m_TabWindows.push_back(tab); - - if (m_TabWindows.size() == 1) - ShowTab(0); -} - -void CConfigDlg::ShowTab(int nPage) { - if (nPage == 4 && !m_OsdTab->m_FontsLoaded) { // OSD tab - m_OsdTab->LoadFonts(); - } - - for (size_t i = 0; i < m_TabWindows.size(); i++) - m_TabWindows[i]->ShowWindow(SW_HIDE); - - CRect TabRect = GetTabRect(); - m_TabWindows[nPage]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW); - - CRect WinRect, ClientRect; - m_TabWindows[nPage]->GetWindowRect(WinRect); - m_TabWindows[nPage]->GetClientRect(ClientRect); - - m_Tabs.RedrawWindow(); -} - -void CConfigDlg::SetLanguage(const std::string & language) { - LoadCurrentStrings(m_strIniPath.c_str(), language); - for (int i = 0, n = m_Tabs.GetItemCount(); i < n; i++) { - TCITEM tci = { 0 }; - tci.mask = TCIF_PARAM; - m_Tabs.GetItem(i, &tci); - if (tci.lParam != 0) { - tci.mask = TCIF_TEXT; - std::wstring caption = wGS((languageStringID)tci.lParam); - tci.pszText = (LPWSTR)caption.c_str(); - m_Tabs.SetItem(i, &tci); - } - } - for (size_t i = 0; i < m_TabWindows.size(); i++) - m_TabWindows[i]->ApplyLanguage(); - ApplyLanguage(); -} - -void CConfigDlg::ApplyLanguage(void) -{ - SetDlgItemTextW(IDC_SAVE_SETTINGS_STATIC, wGS(CFG_SAVE_SETTINGS_FOR).c_str()); - SetDlgItemTextW(IDC_SETTINGS_PROFILE_STATIC, wGS(CFG_SETTINGS_PROFILE).c_str()); - SetDlgItemTextW(IDC_REMOVE_PROFILE, wGS(CFG_REMOVE).c_str()); - SetDlgItemTextW(ID_RESTORE_DEFAULTS, wGS(CFG_RESTORE_DEFAULTS).c_str()); - SetDlgItemTextW(ID_SAVECLOSE, wGS(CFG_SAVE_AND_CLOSE).c_str()); - SetDlgItemTextW(ID_SAVE, wGS(CFG_SAVE).c_str()); - SetDlgItemTextW(IDCANCEL, wGS(CFG_CLOSE).c_str()); -} - -class GlideN64WtlModule : - public CAppModule -{ -public: - GlideN64WtlModule(HINSTANCE hinst) { - Init(NULL, hinst); - } - virtual ~GlideN64WtlModule(void) { - Term(); - } -}; - -GlideN64WtlModule * WtlModule = NULL; - -void ConfigInit(void * hinst) { - WtlModule = new GlideN64WtlModule((HINSTANCE)hinst); -} - -void ConfigCleanup(void) { - if (WtlModule) { - delete WtlModule; - WtlModule = NULL; - } -} diff --git a/GLideN64/src/GLideNUI-wtl/ConfigDlg.h b/GLideN64/src/GLideNUI-wtl/ConfigDlg.h deleted file mode 100644 index 395c719..0000000 --- a/GLideN64/src/GLideNUI-wtl/ConfigDlg.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once -#include -#include "wtl.h" -#include "config-tab.h" -#include "language.h" -#include "resource.h" -#include - -class CFrameBufferTab; -class CVideoTab; -class CEmulationTab; -class COsdTab; - -class CConfigDlg : - public CDialogImpl -{ -public: - CConfigDlg(); - ~CConfigDlg(); - - enum { IDD = IDD_CONFIG }; - - BEGIN_MSG_MAP_EX(CConfigDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - NOTIFY_HANDLER_EX(IDC_TABS, TCN_SELCHANGE, OnTabChange) - COMMAND_HANDLER(IDC_PROFILE, CBN_SELCHANGE, OnProfileChanged) - COMMAND_HANDLER_EX(IDC_GAME_PROFILE, BN_CLICKED, OnGameProfile) - COMMAND_HANDLER_EX(IDC_USE_PROFILE, BN_CLICKED, OnUseProfile) - COMMAND_ID_HANDLER(IDC_REMOVE_PROFILE, OnRemoveProfile) - COMMAND_ID_HANDLER(ID_RESTORE_DEFAULTS, OnRestoreDefaults) - COMMAND_ID_HANDLER(ID_SAVECLOSE, OnSaveClose) - COMMAND_ID_HANDLER(ID_SAVE, OnSave) - COMMAND_ID_HANDLER(IDCANCEL, OnCancel) - END_MSG_MAP() - - void setIniPath(const std::string & IniPath); - void setRomName(const char * RomName); - void setMSAALevel(uint32_t _maxMSAALevel); - uint32_t getMSAALevel() const; - bool Saved(void) const { return m_Saved; } - void OnCustomSettingsToggled(bool checked); - void SetLanguage(const std::string & language); - -protected: - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnRemoveProfile(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnRestoreDefaults(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnSaveClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnTabChange(NMHDR* pNMHDR); - LRESULT OnProfileChanged(WORD wNotifyCode, WORD wID, HWND hwnd, BOOL& bHandled); - LRESULT OnGameProfile(UINT /*Code*/, int id, HWND /*ctl*/); - LRESULT OnUseProfile(UINT /*Code*/, int id, HWND /*ctl*/); - - void Init(bool reInit = false, bool blockCustomSettings = false); - void AddTab(languageStringID StringID, CConfigTab * tab); - void ShowTab(int nPage); - CRect GetTabRect(); - void SaveSettings(); - void ApplyLanguage(); - - CTabCtrl m_Tabs; - std::vector m_TabWindows; - std::string m_strIniPath; - const char * m_romName; - uint32_t m_maxMSAALevel; - bool m_blockReInit; - CFrameBufferTab * m_FrameBufferTab; - CVideoTab * m_VideoTab; - CEmulationTab * m_EmulationTab; - COsdTab * m_OsdTab; - uint32_t m_TabLeft, m_ProfileLeft; - bool m_Saved; -}; - -#ifdef _WIN32 -void ConfigInit(void * hinst); -void ConfigCleanup(void); -#endif \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/FileClass.cpp b/GLideN64/src/GLideNUI-wtl/FileClass.cpp deleted file mode 100644 index 1409885..0000000 --- a/GLideN64/src/GLideNUI-wtl/FileClass.cpp +++ /dev/null @@ -1,350 +0,0 @@ -#include "FileClass.h" -#ifdef _WIN32 -#include -#define USE_WINDOWS_API -#include -#else -#include -#endif - -#if defined(_MSC_VER) -#include -#else -#define _ASSERTE(expr) ((void)0) -#endif - -CFile::CFile() : -#ifdef USE_WINDOWS_API -m_hFile(INVALID_HANDLE_VALUE), -#else -m_hFile(NULL), -#endif -m_bCloseOnDelete(false) -{ -} - -CFile::CFile(void * hFile) : -m_hFile(hFile), -m_bCloseOnDelete(true) -{ - if (hFile == 0) - { - _ASSERTE(hFile != 0); - } -} - -CFile::CFile(const char * lpszFileName, uint32_t nOpenFlags) : -#ifdef USE_WINDOWS_API -m_hFile(INVALID_HANDLE_VALUE), -#else -m_hFile(NULL), -#endif -m_bCloseOnDelete(true) -{ - Open(lpszFileName, nOpenFlags); -} - -CFile::~CFile() -{ -#ifdef USE_WINDOWS_API - if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete) -#else - if (m_hFile != NULL && m_bCloseOnDelete) -#endif - { - Close(); -} -} - -bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags) -{ - if (!Close()) - { - return false; - } - - if (lpszFileName == NULL || strlen(lpszFileName) == 0) - { - return false; - } - - m_bCloseOnDelete = true; -#ifdef USE_WINDOWS_API - m_hFile = INVALID_HANDLE_VALUE; - - ULONG dwAccess = 0; - switch (nOpenFlags & 3) - { - case modeRead: - dwAccess = GENERIC_READ; - break; - case modeWrite: - dwAccess = GENERIC_WRITE; - break; - case modeReadWrite: - dwAccess = GENERIC_READ | GENERIC_WRITE; - break; - default: - _ASSERTE(false); - } - - // map share mode - ULONG dwShareMode = 0; - - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; } - if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; } - if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; } - - // map modeNoInherit flag - SECURITY_ATTRIBUTES sa; - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0; - - // map creation flags - ULONG dwCreateFlag = OPEN_EXISTING; - if (nOpenFlags & modeCreate) - { - dwCreateFlag = ((nOpenFlags & modeNoTruncate) != 0) ? OPEN_ALWAYS : CREATE_ALWAYS; - } - - // attempt file creation - HANDLE hFile = ::CreateFileA(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) - { //#define ERROR_PATH_NOT_FOUND 3L - //ULONG err = GetLastError(); - return false; - } - m_hFile = hFile; -#else - if ((nOpenFlags & modeNoTruncate) == 0 && (nOpenFlags & CFileBase::modeCreate) == CFileBase::modeCreate) - { - CPath(lpszFileName).Delete(); - } - if ((nOpenFlags & CFileBase::modeCreate) != CFileBase::modeCreate) - { - if (!CPath(lpszFileName).Exists()) - { - return false; - } - } - - if ((nOpenFlags & CFileBase::modeCreate) == CFileBase::modeCreate) - { - CPath file(lpszFileName); - if (!file.Exists()) - { - FILE * fp = fopen(lpszFileName,"wb"); - if (fp) - { - fclose(fp); - } - if (!file.Exists()) - { - return false; - } - } - } - - if ((nOpenFlags & CFileBase::modeWrite) == CFileBase::modeWrite || - (nOpenFlags & CFileBase::modeReadWrite) == CFileBase::modeReadWrite) - { - m_hFile = fopen(lpszFileName, "rb+"); - if (m_hFile != NULL) - { - SeekToBegin(); - } - } - else if ((nOpenFlags & CFileBase::modeRead) == CFileBase::modeRead) - { - m_hFile = fopen(lpszFileName, "rb"); - if (m_hFile != NULL) - { - SeekToBegin(); - } - } - else - { - return false; - } -#endif - m_bCloseOnDelete = true; - return true; -} - -bool CFile::Close() -{ - bool bError = true; -#ifdef USE_WINDOWS_API - if (m_hFile != INVALID_HANDLE_VALUE) - { - bError = !::CloseHandle(m_hFile); - } - m_hFile = INVALID_HANDLE_VALUE; -#else - if (m_hFile != NULL) - { - fclose((FILE *)m_hFile); - m_hFile = NULL; - } -#endif - m_bCloseOnDelete = false; - return bError; -} - -uint32_t CFile::SeekToEnd(void) -{ - return Seek(0, CFile::end); -} - -void CFile::SeekToBegin(void) -{ - Seek(0, CFile::begin); -} - -bool CFile::IsOpen(void) const -{ -#ifdef USE_WINDOWS_API - return m_hFile != INVALID_HANDLE_VALUE; -#else - return m_hFile != NULL; -#endif -} - -bool CFile::Flush() -{ -#ifdef USE_WINDOWS_API - if (m_hFile == INVALID_HANDLE_VALUE) - { - return true; - } - - return ::FlushFileBuffers(m_hFile) != 0; -#else - fflush((FILE *)m_hFile); - fsync(fileno((FILE *)m_hFile)); - return true; -#endif -} - -bool CFile::Write(const void* lpBuf, uint32_t nCount) -{ - if (nCount == 0) - { - return true; // avoid Win32 "null-write" option - } - -#ifdef USE_WINDOWS_API - ULONG nWritten = 0; - if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL)) - { - return false; - } - - if (nWritten != nCount) - { - // Win32s will not return an error all the time (usually DISK_FULL) - return false; - } -#else - if (fwrite(lpBuf, 1, nCount, (FILE *)m_hFile) != nCount) - { - return false; - } -#endif - return true; -} - -uint32_t CFile::Read(void* lpBuf, uint32_t nCount) -{ - if (nCount == 0) - { - return 0; // avoid Win32 "null-read" - } - -#ifdef USE_WINDOWS_API - DWORD dwRead = 0; - if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL)) - { - return 0; - } - return (uint32_t)dwRead; -#else - uint32_t res = fread(lpBuf, sizeof(uint8_t), nCount, (FILE *)m_hFile); - return res; -#endif -} - -int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom) -{ -#ifdef USE_WINDOWS_API - ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom); - if (dwNew == (ULONG)-1) - { - return -1; - } - return dwNew; -#else - if (m_hFile == NULL) - { - return -1; - } - int origin; - - switch (nFrom) - { - case begin: origin = SEEK_SET; break; - case current: origin = SEEK_CUR; break; - case end: origin = SEEK_END; break; - default: - return -1; - } - - Flush(); - int res = fseek((FILE *)m_hFile, lOff, origin); - return res; -#endif -} - -uint32_t CFile::GetPosition() const -{ -#ifdef USE_WINDOWS_API - return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT); -#else - return (uint32_t)ftell((FILE *)m_hFile); -#endif -} - -bool CFile::SetLength(uint32_t dwNewLen) -{ - Seek((int32_t)dwNewLen, begin); - return SetEndOfFile(); -} - -uint32_t CFile::GetLength() const -{ -#ifdef USE_WINDOWS_API - return GetFileSize(m_hFile, 0); -#else - uint32_t pos = GetPosition(); - fseek((FILE *)m_hFile, 0, SEEK_END); - uint32_t FileSize = GetPosition(); - fseek((FILE *)m_hFile, (int32_t)pos, SEEK_SET); - return FileSize; -#endif -} - -bool CFile::SetEndOfFile() -{ -#ifdef USE_WINDOWS_API - return ::SetEndOfFile(m_hFile) != 0; -#else - Flush(); -#ifdef _WIN32 - return _chsize(_fileno((FILE *)m_hFile),GetPosition()) == 0; -#else - return ftruncate(fileno((FILE *)m_hFile),GetPosition()) == 0; -#endif -#endif -} \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/FileClass.h b/GLideN64/src/GLideNUI-wtl/FileClass.h deleted file mode 100644 index 8141342..0000000 --- a/GLideN64/src/GLideNUI-wtl/FileClass.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include - -class CFileBase -{ -public: - enum OpenFlags - { - modeRead = 0x0000, - modeWrite = 0x0001, - modeReadWrite = 0x0002, - shareCompat = 0x0000, - shareExclusive = 0x0010, - shareDenyWrite = 0x0020, - shareDenyRead = 0x0030, - shareDenyNone = 0x0040, - modeNoInherit = 0x0080, - modeCreate = 0x1000, - modeNoTruncate = 0x2000, - }; - - enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 }; - - virtual bool Open(const char * lpszFileName, uint32_t nOpenFlags ) = 0; - - virtual uint32_t GetPosition() const = 0; - virtual int32_t Seek(int32_t lOff, SeekPosition nFrom) = 0; - virtual bool SetLength(uint32_t dwNewLen) = 0; - virtual uint32_t GetLength() const = 0; - - virtual uint32_t Read(void* lpBuf, uint32_t nCount) = 0; - virtual bool Write(const void* lpBuf, uint32_t nCount) = 0; - - virtual bool Flush() = 0; - virtual bool Close() = 0; - virtual bool IsOpen() const = 0; - virtual bool SetEndOfFile() = 0; -}; - -class CFile : public CFileBase -{ - // Attributes - void * m_hFile; - bool m_bCloseOnDelete; - -public: - // Flag values - - // Constructors - CFile(); - CFile(void * hFile); - CFile(const char * lpszFileName, uint32_t nOpenFlags); - - // Deconstructors - virtual ~CFile(); - - // Operations - virtual bool Open(const char * lpszFileName, uint32_t nOpenFlags ); - - uint32_t SeekToEnd ( void ); - void SeekToBegin ( void ); - - // Overridables - virtual uint32_t GetPosition() const; - virtual int32_t Seek(int32_t lOff, SeekPosition nFrom); - virtual bool SetLength(uint32_t dwNewLen); - virtual uint32_t GetLength() const; - - virtual uint32_t Read(void* lpBuf, uint32_t nCount); - virtual bool Write(const void* lpBuf, uint32_t nCount); - - virtual bool Flush(); - virtual bool Close(); - virtual bool IsOpen() const; - virtual bool SetEndOfFile(); - -private: - CFile(const CFile&); // Disable copy constructor - CFile& operator=(const CFile&); // Disable assignment -}; diff --git a/GLideN64/src/GLideNUI-wtl/FontInfo.cpp b/GLideN64/src/GLideNUI-wtl/FontInfo.cpp deleted file mode 100644 index 9388c5b..0000000 --- a/GLideN64/src/GLideNUI-wtl/FontInfo.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include "FontInfo.h" -#include "FileClass.h" -#include -#include -#include -#include -#include - -#pragma warning(disable:4996) - -typedef struct _tagTT_OFFSET_TABLE -{ - uint16_t uMajorVersion; - uint16_t uMinorVersion; - uint16_t uNumOfTables; - uint16_t uSearchRange; - uint16_t uEntrySelector; - uint16_t uRangeShift; -} TT_OFFSET_TABLE; - -typedef struct _tagTT_TABLE_DIRECTORY -{ - char szTag[4]; //table name - uint32_t uCheckSum; //Check sum - uint32_t uOffset; //Offset from beginning of file - uint32_t uLength; //length of the table in bytes -} TT_TABLE_DIRECTORY; - -typedef struct _tagTT_NAME_TABLE_HEADER -{ - uint16_t uFSelector; //format selector. Always 0 - uint16_t uNRCount; //Name Records count - uint16_t uStorageOffset; //Offset for strings storage, from start of the table -} TT_NAME_TABLE_HEADER; - -typedef struct _tagTT_NAME_RECORD -{ - uint16_t uPlatformID; - uint16_t uEncodingID; - uint16_t uLanguageID; - uint16_t uNameID; - uint16_t uStringLength; - uint16_t uStringOffset; //from start of storage area -} TT_NAME_RECORD; - -#define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x)) -#define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x))) - -std::string GetFontNameFromFile(const char * FontFilePath) -{ - CFile f; - - if (!f.Open(FontFilePath, CFile::modeRead | CFile::shareDenyWrite)) - { - return std::string(""); - } - TT_OFFSET_TABLE ttOffsetTable; - f.Read(&ttOffsetTable, sizeof(TT_OFFSET_TABLE)); - ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables); - ttOffsetTable.uMajorVersion = SWAPWORD(ttOffsetTable.uMajorVersion); - ttOffsetTable.uMinorVersion = SWAPWORD(ttOffsetTable.uMinorVersion); - - //check is this is a true type font and the version is 1.0 - if (ttOffsetTable.uMajorVersion != 1 || ttOffsetTable.uMinorVersion != 0) - { - return std::string(""); - } - - TT_TABLE_DIRECTORY tblDir; - bool bFound = false; - for (int i = 0; i< ttOffsetTable.uNumOfTables; i++) - { - f.Read(&tblDir, sizeof(TT_TABLE_DIRECTORY)); - if (_strnicmp(tblDir.szTag, "name", 4) == 0) - { - bFound = true; - tblDir.uLength = SWAPLONG(tblDir.uLength); - tblDir.uOffset = SWAPLONG(tblDir.uOffset); - break; - } - } - - std::string res; - if (bFound) - { - f.Seek(tblDir.uOffset, CFile::begin); - TT_NAME_TABLE_HEADER ttNTHeader; - f.Read(&ttNTHeader, sizeof(TT_NAME_TABLE_HEADER)); - ttNTHeader.uNRCount = SWAPWORD(ttNTHeader.uNRCount); - ttNTHeader.uStorageOffset = SWAPWORD(ttNTHeader.uStorageOffset); - TT_NAME_RECORD ttRecord; - bFound = false; - - for (int i = 0; i NameBuf; - NameBuf.resize(ttRecord.uStringLength + 1); - memset(NameBuf.data(), 0, ttRecord.uStringLength + 1); - f.Read(NameBuf.data(), ttRecord.uStringLength); - if (NameBuf[0] != '\0') - { - res = NameBuf.data(); - break; - } - f.Seek(nPos, CFile::begin); - } - } - } - f.Close(); - return res; -} - -std::string GetFontFolder() -{ - char szFontPath[MAX_PATH]; - if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_FONTS, NULL, 0, szFontPath))) - { - return szFontPath; - } - return ""; -} - -FontList GetFontFiles() -{ - std::string FontFolder = GetFontFolder(); - FontList fonts; - - if (FontFolder.length() > 0) - { - std::string SearchQuery = FontFolder; - SearchQuery += "\\*.ttf"; - - WIN32_FIND_DATAA FindData; - HANDLE hFind = FindFirstFileA(SearchQuery.c_str(), &FindData); - if (hFind != INVALID_HANDLE_VALUE) - { - do - { - std::string FontFile = FontFolder; - FontFile += "\\"; - FontFile += FindData.cFileName; - std::string FontName = GetFontNameFromFile(FontFile.c_str()); - if (FontName.length() > 0) - { - fonts.insert(FontList::value_type(FindData.cFileName, FontName)); - } - } while (FindNextFileA(hFind, &FindData)); - FindClose(hFind); - } - } - - if (fonts.size() == 0) - { - fonts.insert(FontList::value_type("arial.ttf", "Arial")); - } - return fonts; -} diff --git a/GLideN64/src/GLideNUI-wtl/FontInfo.h b/GLideN64/src/GLideNUI-wtl/FontInfo.h deleted file mode 100644 index 2079dca..0000000 --- a/GLideN64/src/GLideNUI-wtl/FontInfo.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#include -#include - -typedef std::map FontList; - -FontList GetFontFiles(); -std::string GetFontFolder(); -std::string GetFontNameFromFile(const char * FontFilePath); - diff --git a/GLideN64/src/GLideNUI-wtl/FullscreenResolutions.h b/GLideN64/src/GLideNUI-wtl/FullscreenResolutions.h deleted file mode 100644 index fd9f171..0000000 --- a/GLideN64/src/GLideNUI-wtl/FullscreenResolutions.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#include -#include - -typedef std::vector StringList; - -void fillFullscreenResolutionsList(StringList & _listResolutions, int & _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx); -void fillFullscreenRefreshRateList(int _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx); -void getFullscreenResolutions(int _idx, unsigned int & _width, unsigned int & _height); -void getFullscreenRefreshRate(int _idx, unsigned int & _rate); \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/GLideNUI.cpp b/GLideN64/src/GLideNUI-wtl/GLideNUI.cpp deleted file mode 100644 index a50699c..0000000 --- a/GLideN64/src/GLideNUI-wtl/GLideNUI.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "About.h" - -#include - -#include "GLideNUI.h" -#include "Settings.h" -#include "../Config.h" -#include "ConfigDlg.h" - -#ifdef QT_STATICPLUGIN -#include -Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -#endif - -//#define RUN_DIALOG_IN_THREAD - -static -int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, bool & _accepted) -{ - std::string IniFolder; - uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL); - IniFolder.resize(slength); - slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL); - IniFolder.resize(slength - 1); //Remove null end char - - loadSettings(IniFolder.c_str()); - if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0) - loadCustomRomSettings(IniFolder.c_str(), _romName); - - LoadCurrentStrings(IniFolder.c_str(), config.translationFile); - - CConfigDlg Dlg; - Dlg.setIniPath(IniFolder.c_str()); - Dlg.setRomName(_romName); - Dlg.setMSAALevel(_maxMSAALevel); - Dlg.DoModal(); - _accepted = Dlg.Saved(); - return 0; -} - -bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel) -{ - bool accepted = false; -#ifdef RUN_DIALOG_IN_THREAD - std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted)); - configThread.join(); -#else - openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted); -#endif - return accepted; - -} - -EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel) -{ - return runConfigThread(_strFileName, _romName, _maxMSAALevel); -} - -EXPORT int CALL RunAbout(const wchar_t * _strFileName) -{ - std::string IniFolder; - uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL); - IniFolder.resize(slength); - slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL); - IniFolder.resize(slength - 1); //Remove null end char - - LoadCurrentStrings(IniFolder.c_str(), config.translationFile); - - CAboutDlg Dlg; - Dlg.DoModal(); - return 0; -} - -EXPORT void CALL LoadConfig(const wchar_t * _strFileName) -{ - std::string IniFolder; - uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL); - IniFolder.resize(slength); - slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL); - IniFolder.resize(slength - 1); //Remove null end char - - loadSettings(IniFolder.c_str()); -} - -EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName) -{ - std::string IniFolder; - uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL); - IniFolder.resize(slength); - slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL); - IniFolder.resize(slength - 1); //Remove null end char - - loadCustomRomSettings(IniFolder.c_str(), _romName); -} diff --git a/GLideN64/src/GLideNUI-wtl/GLideNUI.h b/GLideN64/src/GLideNUI-wtl/GLideNUI.h deleted file mode 100644 index 01dd5a1..0000000 --- a/GLideN64/src/GLideNUI-wtl/GLideNUI.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef GLIDENUII_H -#define GLIDENUII_H - -#if defined(__cplusplus) -extern "C" { -#endif - -#ifdef _WIN32 -#define EXPORT __declspec(dllexport) -#define CALL __cdecl -#else -#define EXPORT __attribute__((visibility("default"))) -#define CALL -#endif - -EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel); -EXPORT int CALL RunAbout(const wchar_t * _strFileName); -EXPORT void CALL LoadConfig(const wchar_t * _strFileName); -EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName); -EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data); - -#if defined(__cplusplus) -} -#endif - -#endif // GLIDENUII_H diff --git a/GLideN64/src/GLideNUI-wtl/GLideNUI.rc b/GLideN64/src/GLideNUI-wtl/GLideNUI.rc deleted file mode 100644 index cb2d579..0000000 Binary files a/GLideN64/src/GLideNUI-wtl/GLideNUI.rc and /dev/null differ diff --git a/GLideN64/src/GLideNUI-wtl/GlSettings.cpp b/GLideN64/src/GLideNUI-wtl/GlSettings.cpp deleted file mode 100644 index 6f9c910..0000000 --- a/GLideN64/src/GLideNUI-wtl/GlSettings.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include "GlSettings.h" - -GlColor::GlColor(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha) : - m_Red(Red), - m_Green(Green), - m_Blue(Blue), - m_Alpha(Alpha) -{ -} - -GlSettings::GlSettings(const char * IniFile) : - m_IniFile(IniFile) -{ - m_IniFile.SetAutoFlush(false); - m_CurrentSection = "General"; -} - -GlSettingValue GlSettings::value(const char * Key) -{ - std::string SectionKey = !m_SubSection.empty() ? m_SubSection+"\\"+ Key : Key; - std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), ""); - GlSettingValue SettingsValue(value.c_str()); - return SettingsValue; -} - -GlSettingValue GlSettings::value(const char * Key, int32_t DefaultValue) -{ - char szDefaultValue[400]; - sprintf_s(szDefaultValue, sizeof(szDefaultValue), "%d", DefaultValue); - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue); - GlSettingValue SettingsValue(value.c_str()); - return SettingsValue; -} - -GlSettingValue GlSettings::value(const char * Key, uint32_t DefaultValue) -{ - char szDefaultValue[400]; - sprintf_s(szDefaultValue, sizeof(szDefaultValue), "%d", DefaultValue); - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue); - GlSettingValue SettingsValue(value.c_str()); - return SettingsValue; -} - -GlSettingValue GlSettings::value(const char * Key, float DefaultValue) -{ - char szDefaultValue[400]; - sprintf_s(szDefaultValue, sizeof(szDefaultValue), "%f", DefaultValue); - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue); - GlSettingValue SettingsValue(value.c_str()); - return SettingsValue; -} - -GlSettingValue GlSettings::value(const char * Key, const char * DefaultValue) -{ - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), DefaultValue); - GlSettingValue SettingsValue(value.c_str()); - return SettingsValue; -} - -GlSettingValue GlSettings::value(const char * Key, const GlColor & DefaultValue) -{ - char szDefaultValue[400]; -#pragma warning(disable: 4996) - sprintf(szDefaultValue, "@Variant(\\0\\0\\x43\\x1\\xff\\xff\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x)", DefaultValue.Red(), DefaultValue.Red(), DefaultValue.Green(), DefaultValue.Green(), DefaultValue.Blue(), DefaultValue.Blue(), DefaultValue.Alpha(), DefaultValue.Alpha()); -#pragma warning(default: 4996) - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue); - GlSettingValue SettingsValue(value.c_str()); - return SettingsValue; -} - -void GlSettings::setValue(const char * Key, float value) -{ - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - char text[400]; -#pragma warning(disable: 4996) - sprintf(text, "%f", value); -#pragma warning(default: 4996) - m_IniFile.SaveString(m_CurrentSection.c_str(), SectionKey.c_str(), text); -} - -void GlSettings::setValue(const char * Key, int32_t value) -{ - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - m_IniFile.SaveNumber(m_CurrentSection.c_str(), SectionKey.c_str(), value); -} - -void GlSettings::setValue(const char * Key, uint32_t value) -{ - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - m_IniFile.SaveNumber(m_CurrentSection.c_str(), SectionKey.c_str(), value); -} - -void GlSettings::setValue(const char * Key, const char * value) -{ - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - m_IniFile.SaveString(m_CurrentSection.c_str(), SectionKey.c_str(), value); -} - -void GlSettings::setValue(const char * Key, const GlColor & value) -{ - char txValue[400]; -#pragma warning(disable: 4996) - sprintf(txValue, "@Variant(\\0\\0\\x43\\x1\\xff\\xff\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x)", value.Red(), value.Red(), value.Green(), value.Green(), value.Blue(), value.Blue(), value.Alpha(), value.Alpha()); -#pragma warning(default: 4996) - std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key; - m_IniFile.SaveString(m_CurrentSection.c_str(), SectionKey.c_str(), txValue); -} - -void GlSettings::clear(void) -{ - CIniFile::SectionList sections; - m_IniFile.GetVectorOfSections(sections); - for (CIniFile::SectionList::const_iterator itr = sections.begin(); itr != sections.end(); itr++) - { - m_IniFile.DeleteSection(itr->c_str()); - } -} - -void GlSettings::remove(const char * section) -{ - m_IniFile.DeleteSection(section); -} - -void GlSettings::beginGroup(const char * section) -{ - if (strcmp(m_CurrentSection.c_str(), "General") == 0) - { - m_CurrentSection = section; - } - else - { - m_SubSection = section; - } -} - -void GlSettings::endGroup(void) -{ - if (!m_SubSection.empty()) - { - m_SubSection = ""; - } - else - { - m_CurrentSection = "General"; - m_IniFile.FlushChanges(); - } -} - -GlSettings::sections GlSettings::childGroups() -{ - CIniFile::SectionList Children; - m_IniFile.GetVectorOfSections(Children); - - sections Sections; - for (CIniFile::SectionList::iterator itr = Children.begin(); itr != Children.end(); itr++) - { -#pragma warning(disable: 4996) - if (stricmp("General", itr->c_str()) == 0) - { - continue; - } -#pragma warning(default: 4996) - Sections.insert(itr->c_str()); - } - return Sections; -} - - -GlSettingValue::GlSettingValue(const char * value) : - m_Value(value != NULL ? value : "") -{ -} - -GlSettingValue::GlSettingValue(const GlSettingValue& rhs) : - m_Value(rhs.m_Value) -{ -} - -GlSettingValue& GlSettingValue::operator=(const GlSettingValue&rhs) -{ - m_Value = rhs.m_Value; - return *this; -} - -int32_t GlSettingValue::toInt() const -{ - uint32_t Value = 0; -#pragma warning(disable: 4996) - sscanf(m_Value.c_str(), "%d", &Value); -#pragma warning(default: 4996) - return Value; -} - -float GlSettingValue::toFloat() const -{ - float Value = 0.0; -#pragma warning(disable: 4996) - sscanf(m_Value.c_str(), "%f", &Value); -#pragma warning(default: 4996) - return Value; -} - -std::string GlSettingValue::toString() const -{ - return m_Value; -} - -GlColor GlSettingValue::toGlColor() const -{ - uint8_t Red = 0, Green = 0, Blue = 0, Alpha = 0; - - if (strncmp("@Variant(", m_Value.c_str(), 9) == 0) - { - std::vector tokens; - - std::string value = m_Value.substr(9); - char delimiter = '\\'; - std::string::size_type lastPos = value.find_first_not_of(delimiter, 0); - std::string::size_type pos = value.find_first_of(delimiter, lastPos); - while (std::string::npos != pos) - { - tokens.push_back(value.substr(lastPos, pos - lastPos)); - lastPos = pos + 1; - pos = value.find_first_of(delimiter, lastPos); - } - if (std::string::npos != lastPos) - { - tokens.push_back(value.substr(lastPos)); - } - - if (tokens.size() >= 14) - { - Red = ParseGlColor(tokens[7].c_str()); - Green = ParseGlColor(tokens[9].c_str()); - Blue = ParseGlColor(tokens[11].c_str()); - Alpha = ParseGlColor(tokens[13].c_str()); - } - } - - return GlColor(Red, Green, Blue, Alpha); -} - -uint8_t GlSettingValue::ParseGlColor(const char * color) -{ - if (color == NULL) { return 0; } - if (color[0] == '0') { return 0; } - if (color[0] == 'x') - { - uint32_t Value = 0; -#pragma warning(disable: 4996) - sscanf(&color[1], "%X", &Value); -#pragma warning(default: 4996) - return (uint8_t)Value; - } - return 0; -} diff --git a/GLideN64/src/GLideNUI-wtl/GlSettings.h b/GLideN64/src/GLideNUI-wtl/GlSettings.h deleted file mode 100644 index 522ded6..0000000 --- a/GLideN64/src/GLideNUI-wtl/GlSettings.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once -#include "IniFileClass.h" -#include - -class GlColor -{ -public: - GlColor(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha = 0); - - inline uint8_t Red(void) const { return m_Red; } - inline uint8_t Green(void) const { return m_Green; } - inline uint8_t Blue(void) const { return m_Blue; } - inline uint8_t Alpha(void) const { return m_Alpha; } -private: - GlColor(); - - uint8_t m_Red, m_Green, m_Blue, m_Alpha; -}; - -class GlSettingValue -{ -public: - GlSettingValue(const char *); - GlSettingValue(const GlSettingValue&); - GlSettingValue& operator=(const GlSettingValue&); - - int32_t toInt() const; - float toFloat() const; - std::string toString() const; - GlColor toGlColor() const; - -private: - GlSettingValue(); - - static uint8_t ParseGlColor(const char *); - - std::string m_Value; -}; - -class GlSettings -{ -public: - typedef std::set sections; - - GlSettings(const char * IniFile); - - GlSettingValue value(const char * Key); - GlSettingValue value(const char * Key, int32_t DefaultValue); - GlSettingValue value(const char * Key, uint32_t DefaultValue); - GlSettingValue value(const char * Key, float DefaultValue); - GlSettingValue value(const char * Key, const char * DefaultValue); - GlSettingValue value(const char * Key, const GlColor & DefaultValue); - - void setValue(const char * Key, int32_t value); - void setValue(const char * Key, uint32_t value); - void setValue(const char * Key, float value); - void setValue(const char * Key, const char * value); - void setValue(const char * Key, const GlColor & value); - - sections childGroups(); - - void clear(void); - void remove(const char * section); - void beginGroup(const char * section); - void endGroup(void); - -private: - GlSettings(); - GlSettings(const GlSettings&); - GlSettings& operator=(const GlSettings&); - - CIniFile m_IniFile; - std::string m_CurrentSection; - std::string m_SubSection; -}; \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/IniFileClass.cpp b/GLideN64/src/GLideNUI-wtl/IniFileClass.cpp deleted file mode 100644 index 4daa9f7..0000000 --- a/GLideN64/src/GLideNUI-wtl/IniFileClass.cpp +++ /dev/null @@ -1,879 +0,0 @@ -#include "IniFileClass.h" -#include -#include - -#pragma warning(disable:4996) - -CIniFileBase::CIniFileBase(CFileBase & FileObject, const char * FileName) : - m_lastSectionSearch(0), - m_CurrentSectionFilePos(0), - m_LineFeed("\r\n"), - m_ReadOnly(true), - m_InstantFlush(true), - m_File(FileObject), - m_FileName(FileName), - m_CurrentSectionDirty(false), - m_SortFunction(NULL) -{ -} - -CIniFileBase::~CIniFileBase(void) -{ - SaveCurrentSection(); -} - -void CIniFileBase::fInsertSpaces(int Pos, int NoOfSpaces) -{ - enum { fIS_MvSize = 0x2000 }; - - unsigned char Data[fIS_MvSize + 1]; - int SizeToRead, result; - long end, WritePos; - - m_File.Seek(0, CFileBase::end); - end = m_File.GetPosition(); - - if (NoOfSpaces > 0) - { - std::string SpaceBuffer = FormatStr("%*c", NoOfSpaces, ' '); - - do - { - SizeToRead = end - Pos; - if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } - if (SizeToRead > 0) - { - m_File.Seek(SizeToRead * -1, CFileBase::current); - WritePos = m_File.GetPosition(); - memset(Data, 0, sizeof(Data)); - result = m_File.Read(Data, SizeToRead); - m_File.Seek(WritePos, CFileBase::begin); - end = WritePos; - - m_File.Write(SpaceBuffer.c_str(), (uint32_t)SpaceBuffer.length()); - m_File.Write(Data, result); - m_File.Seek(WritePos, CFileBase::begin); - } - } while (SizeToRead > 0); - } - if (NoOfSpaces < 0) - { - int ReadPos = Pos + (NoOfSpaces * -1); - WritePos = Pos; - - do - { - SizeToRead = end - ReadPos; - if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } - m_File.Seek(ReadPos, CFileBase::begin); - m_File.Read(Data, SizeToRead); - m_File.Seek(WritePos, CFileBase::begin); - m_File.Write(Data, SizeToRead); - ReadPos += SizeToRead; - WritePos += SizeToRead; - } while (SizeToRead > 0); - - m_File.Seek(WritePos, CFileBase::begin); - std::string SpaceBuffer = FormatStr("%*c", (NoOfSpaces * -1), ' '); - m_File.Write(SpaceBuffer.c_str(), (uint32_t)SpaceBuffer.length()); - - m_File.Seek(WritePos, CFileBase::begin); - m_File.SetEndOfFile(); - m_File.Seek(0, CFileBase::begin); - } -} - -int CIniFileBase::GetStringFromFile(char * & String, std::unique_ptr &Data, int & MaxDataSize, int & DataSize, int & ReadPos) -{ - enum { BufferIncrease = 0x2000 }; - if (MaxDataSize == 0) - { - ReadPos = 0; - MaxDataSize = BufferIncrease; - Data.reset(new char[MaxDataSize]); - DataSize = m_File.Read(&Data.get()[DataSize], MaxDataSize); - } - - for (;;) - { - int count; - - for (count = ReadPos; count < DataSize; count++) - { - if (Data.get()[count] == '\n') - { - int len = (count - ReadPos) + 1; - String = &Data.get()[ReadPos]; - String[len - 1] = 0; - ReadPos = count + 1; - return len; - } - } - - if (ReadPos != 0) - { - if ((DataSize - ReadPos) > 0) - { - memmove(Data.get(), &Data.get()[ReadPos], DataSize - ReadPos); - } - DataSize -= ReadPos; - ReadPos = 0; - } - else - { - //Increase buffer size - int NewMaxDataSize = MaxDataSize + BufferIncrease; - char * NewBuffer = new char[NewMaxDataSize]; - if (NewBuffer == NULL) - { - return -1; - } - memcpy(NewBuffer, Data.get(), DataSize); - MaxDataSize = NewMaxDataSize; - Data.reset(NewBuffer); - } - - int dwRead = m_File.Read(&Data.get()[DataSize], MaxDataSize - DataSize); - if (dwRead == 0) - { - if (DataSize > 0) - { - int len = DataSize + 1; - String = &Data.get()[ReadPos]; - String[len - 1] = 0; - DataSize = 0; - ReadPos = 0; - return len; - } - return -1; - } - DataSize += dwRead; - } -} - -void CIniFileBase::SaveCurrentSection(void) -{ - if (!m_CurrentSectionDirty) - { - return; - } - m_CurrentSectionDirty = false; - if (m_CurrentSection.length() == 0) - { - m_CurrentSection = "default"; - } - - int lineFeedLen = (int)strlen(m_LineFeed); - - if (m_CurrentSectionFilePos == -1) - { - //Section has not been added yet - m_File.Seek(0, CFileBase::end); - - int len = (int)m_CurrentSection.length() + (lineFeedLen * 2) + 5; - std::unique_ptr SectionName(new char[len]); - if (m_File.GetLength() < (int)strlen(m_LineFeed)) - { - sprintf(SectionName.get(), "[%s]%s", m_CurrentSection.c_str(), m_LineFeed); - } - else - { - sprintf(SectionName.get(), "%s[%s]%s", m_LineFeed, m_CurrentSection.c_str(), m_LineFeed); - } - m_File.Write(SectionName.get(), (int)strlen(SectionName.get())); - m_CurrentSectionFilePos = m_File.GetPosition(); - m_SectionsPos.insert(FILELOC::value_type(m_CurrentSection, m_CurrentSectionFilePos)); - } - else - { - //increase/decrease space needed - int NeededBufferLen = 0; - { - std::unique_ptr LineData; - int len = 0; - - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5; - if (newLen > len) - { - LineData.reset(new char[newLen]); - len = newLen; - } - sprintf(LineData.get(), "%s=%s%s", iter->first.c_str(), iter->second.c_str(), m_LineFeed); - NeededBufferLen += (int)strlen(LineData.get()); - } - } - int currentLen = 0; - - m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin); - - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; - std::unique_ptr Data; - char *Input = NULL; - - //Skip first line as it is the section name - int StartPos = m_CurrentSectionFilePos; - int EndPos = StartPos; - do - { - result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1 || Input[0] != '[') - { - EndPos = ((m_File.GetPosition() - DataSize) + ReadPos); - - continue; - } - if (Input[0] == '[') - { - NeededBufferLen += lineFeedLen; - } - break; - } while (result >= 0); - currentLen = EndPos - StartPos; - - if (NeededBufferLen != currentLen) - { - fInsertSpaces(StartPos, NeededBufferLen - currentLen); - m_File.Flush(); - ClearSectionPosList(StartPos); - } - //set pointer to beginning of the start pos - m_File.Seek(StartPos, CFileBase::begin); - } - - { - std::unique_ptr LineData; - int len = 0; - - if (m_SortFunction != NULL) - { - KeyValueVector data; - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - data.push_back(KeyValueItem(&iter->first, &iter->second)); - } - m_SortFunction(data); - for (size_t i = 0, n = data.size(); i < n; i++) - { - KeyValueItem & item = data[i]; - int newLen = (int)(item.first->length()) + (int)item.second->length() + lineFeedLen + 5; - if (newLen > len) - { - LineData.reset(new char[newLen]); - len = newLen; - } - sprintf(LineData.get(), "%s=%s%s", item.first->c_str(), item.second->c_str(), m_LineFeed); - m_File.Write(LineData.get(), (int)strlen(LineData.get())); - } - } - else - { - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5; - if (newLen > len) - { - LineData.reset(new char[newLen]); - len = newLen; - } - sprintf(LineData.get(), "%s=%s%s", iter->first.c_str(), iter->second.c_str(), m_LineFeed); - m_File.Write(LineData.get(), (int)strlen(LineData.get())); - } - } - } - m_File.Flush(); -} - -bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool ChangeCurrentSection) -{ - if (strcmp(lpSectionName, m_CurrentSection.c_str()) == 0) - { - return true; - } - if (ChangeCurrentSection) - { - SaveCurrentSection(); - m_CurrentSection = ""; - } - - std::unique_ptr Data; - char *Input = NULL; - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; - - FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName)); - bool bFoundSection = false; - if (iter != m_SectionsPos.end()) - { - if (ChangeCurrentSection) - { - m_CurrentSection = iter->first; - m_CurrentSectionFilePos = iter->second; - } - m_File.Seek(iter->second, CFileBase::begin); - bFoundSection = true; - } - else - { - m_File.Seek(m_lastSectionSearch, CFileBase::begin); - - //long Fpos; - uint8_t pUTF8[3]; - pUTF8[0] = 0xef; - pUTF8[1] = 0xbb; - pUTF8[2] = 0xbf; - - do - { - result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } - - //We Only care about sections - char * CurrentSection = Input; - - if (m_lastSectionSearch == 0 && !memcmp(CurrentSection, pUTF8, 3)) - { - CurrentSection += 3; - } - - if (CurrentSection[0] != '[') { continue; } - int lineEndPos = (int)strlen(CurrentSection) - 1; - if (CurrentSection[lineEndPos] != ']') { continue; } - //take off the ']' from the end of the string - CurrentSection[lineEndPos] = 0; - CurrentSection += 1; - m_lastSectionSearch = (m_File.GetPosition() - DataSize) + ReadPos; - m_SectionsPos.insert(FILELOC::value_type(CurrentSection, m_lastSectionSearch)); - - if (_stricmp(lpSectionName, CurrentSection) != 0) - { - continue; - } - - if (ChangeCurrentSection) - { - m_CurrentSection = lpSectionName; - m_CurrentSectionFilePos = m_lastSectionSearch; - } - else - { - m_File.Seek(m_lastSectionSearch, CFileBase::begin); - } - bFoundSection = true; - break; - } while (result >= 0); - } - - if (!bFoundSection && strcmp(lpSectionName, "default") == 0) - { - m_SectionsPos.insert(FILELOC::value_type(lpSectionName, 0)); - if (ChangeCurrentSection) - { - m_CurrentSection = lpSectionName; - m_CurrentSectionFilePos = 0; - } - m_File.Seek(m_lastSectionSearch, CFileBase::begin); - bFoundSection = true; - } - - if (bFoundSection && ChangeCurrentSection) - { - m_CurrentSectionData.clear(); - do - { - result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } - if (Input[0] == '[') { break; } - char * Pos = strchr(Input, '='); - if (Pos == NULL) { continue; } - char * Value = &Pos[1]; - - char * Pos1 = Pos - 1; - while (((*Pos1 == ' ') || (*Pos1 == '\t')) && (Pos1 > Input)) - { - Pos1--; - } - Pos1[1] = 0; - - m_CurrentSectionData.insert(KeyValueList::value_type(Input, Value)); - } while (result >= 0); - } - - return bFoundSection; -} - -const char * CIniFileBase::CleanLine(char * Line) -{ - char * Pos = Line; - - //Remove any comment from the line - while (Pos != NULL) - { - Pos = strchr(Pos, '/'); - if (Pos != NULL) - { - if (Pos[1] == '/') - { - if (Pos > Line) - { - char * Pos_1 = Pos - 1; - - if (Pos_1[0] != ':') - { - Pos[0] = 0; - } - else - Pos += 1; - } - else - { - Pos[0] = 0; - } - } - else - { - Pos += 1; - } - } - } - - //strip any spaces or line feeds from the end of the line - for (int count = (int)strlen(&Line[0]) - 1; count >= 0; count--) - { - if (Line[count] != ' ' && Line[count] != '\r') { break; } - Line[count] = 0; - } - return Line; -} - -void CIniFileBase::OpenIniFileReadOnly() -{ - if (m_File.Open(m_FileName.c_str(), CFileBase::modeRead)) - { - m_ReadOnly = true; - m_File.Seek(0, CFileBase::begin); - } -} - -void CIniFileBase::OpenIniFile(bool bCreate) -{ - //Open for reading/Writing - m_ReadOnly = false; - if (!m_File.Open(m_FileName.c_str(), CFileBase::modeReadWrite | CFileBase::shareDenyWrite)) - { - if (!m_File.Open(m_FileName.c_str(), CFileBase::modeRead)) - { - if (bCreate) - { - if (!m_File.Open(m_FileName.c_str(), CFileBase::modeReadWrite | CFileBase::modeCreate | CFileBase::shareDenyWrite)) - { - return; - } - } - } - else - { - m_ReadOnly = true; - } - } - m_File.Seek(0, CFileBase::begin); -} - -bool CIniFileBase::IsEmpty() -{ - if (m_File.GetLength() == 0) - return true; - return false; -} - -bool CIniFileBase::IsFileOpen(void) -{ - return m_File.IsOpen(); -} - -bool CIniFileBase::DeleteSection(const char * lpSectionName) -{ - if (!m_File.IsOpen()) { return false; } - - SaveCurrentSection(); - if (!MoveToSectionNameData(lpSectionName, true)) - { - return false; - } - m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin); - long DeleteSectionStart = m_CurrentSectionFilePos - (strlen(lpSectionName) + strlen(m_LineFeed) + 2); - long NextSectionStart = -1; - - { - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, NextLine = 0, result; - std::unique_ptr Data; - char *Input = NULL; - do - { - result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } - - if (Input[0] != '[') - { - NextLine = (m_File.GetPosition() - DataSize) + ReadPos; - continue; - } - NextSectionStart = NextLine != 0 ? NextLine : (m_File.GetPosition() - DataSize) + ReadPos; - break; - } while (result >= 0); - } - - if (NextSectionStart != -1) - { - m_File.Seek(0, CFileBase::end); - long end = m_File.GetPosition(); - long ReadPos = NextSectionStart; - long WritePos = DeleteSectionStart; - - enum { fIS_MvSize = 0x2000 }; - unsigned char Data[fIS_MvSize + 1]; - int SizeToRead; - do - { - SizeToRead = end - ReadPos; - if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } - m_File.Seek(ReadPos, CFileBase::begin); - m_File.Read(Data, SizeToRead); - m_File.Seek(WritePos, CFileBase::begin); - m_File.Write(Data, SizeToRead); - ReadPos += SizeToRead; - WritePos += SizeToRead; - } while (SizeToRead > 0); - m_File.Seek(DeleteSectionStart + (end - NextSectionStart), CFileBase::begin); - m_File.Flush(); - m_File.SetEndOfFile(); - } - else - { - m_File.Seek(DeleteSectionStart, CFileBase::begin); - m_File.Flush(); - m_File.SetEndOfFile(); - } - m_File.Flush(); - ClearSectionPosList(0); - m_CurrentSection = ""; - m_CurrentSectionData.clear(); - m_CurrentSectionFilePos = -1; - return true; -} - -bool CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, std::string & Value) -{ - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - lpSectionName = "default"; - } - - if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - Value = iter->second.c_str(); - return true; - } - } - Value = lpDefault; - return false; -} - -std::string CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault) -{ - std::string Value; - GetString(lpSectionName, lpKeyName, lpDefault, Value); - return Value; -} - -uint32_t CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, char * lpReturnedString, uint32_t nSize) -{ - std::string strSection; - - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - strSection = lpSectionName; - } - - if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(), true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - strncpy(lpReturnedString, iter->second.c_str(), nSize - 1); - lpReturnedString[nSize - 1] = 0; - return (uint32_t)strlen(lpReturnedString); - } - } - strncpy(lpReturnedString, lpDefault, nSize - 1); - lpReturnedString[nSize - 1] = 0; - return (uint32_t)strlen(lpReturnedString); -} - -uint32_t CIniFileBase::GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault) -{ - uint32_t Value; - GetNumber(lpSectionName, lpKeyName, nDefault, Value); - return Value; -} - -bool CIniFileBase::GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault, uint32_t & Value) -{ - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - lpSectionName = "default"; - } - - if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - Value = 0; - sscanf(iter->second.c_str(), "%u", &Value); - return true; - } - } - Value = nDefault; - return false; -} - -void CIniFileBase::SaveString(const char * lpSectionName, const char * lpKeyName, const char * lpString) -{ - if (!m_File.IsOpen()) - { - if (lpString) - { - OpenIniFile(); - } - if (!m_File.IsOpen()) - { - return; - } - } - std::string strSection; - - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - strSection = lpSectionName; - } - - if (!MoveToSectionNameData(strSection.c_str(), true)) - { - m_CurrentSection = strSection; - m_CurrentSectionData.clear(); - m_CurrentSectionFilePos = -1; - } - - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - if (lpString) - { - if (iter->second != lpString) - { - iter->second = lpString; - m_CurrentSectionDirty = true; - } - } - else - { - m_CurrentSectionData.erase(iter); - m_CurrentSectionDirty = true; - } - } - else - { - if (lpString) - { - m_CurrentSectionData.insert(KeyValueList::value_type(lpKeyName, lpString)); - m_CurrentSectionDirty = true; - } - } - - if (m_InstantFlush) - { - SaveCurrentSection(); - } -} - -void CIniFileBase::SaveNumber(const char * lpSectionName, const char * lpKeyName, int32_t Value) -{ - //translate the string to an ascii version and save as text - SaveString(lpSectionName, lpKeyName, FormatStr("%d", Value).c_str()); -} - -bool CIniFileBase::EntryExists(const char * lpSectionName, const char * lpKeyName) -{ - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - lpSectionName = "default"; - } - - if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - return true; - } - } - return false; -} - -void CIniFileBase::FlushChanges(void) -{ - SaveCurrentSection(); -} - -void CIniFileBase::SetAutoFlush(bool AutoFlush) -{ - m_InstantFlush = AutoFlush; - if (AutoFlush) - { - FlushChanges(); - } -} - -void CIniFileBase::GetKeyList(const char * lpSectionName, strlist &List) -{ - List.clear(); - - if (!m_File.IsOpen()) - { - return; - } - - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - lpSectionName = "default"; - } - - if (MoveToSectionNameData(lpSectionName, true)) - { - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - List.push_back(iter->first); - } - } -} - -void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & List) -{ - if (!m_File.IsOpen()) - { - return; - } - - std::string strSection; - - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - strSection = lpSectionName; - } - - if (!MoveToSectionNameData(strSection.c_str(), false)) { return; } - - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; - std::unique_ptr Data; - char *Input = NULL; - do - { - result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } - if (Input[0] == '[') { break; } - char * Pos = strchr(Input, '='); - if (Pos == NULL) { continue; } - Pos[0] = 0; - - List.insert(KeyValueData::value_type(Input, &Pos[1])); - } while (result >= 0); -} - -void CIniFileBase::SetCustomSort(SortData SortFunction) -{ - m_SortFunction = SortFunction; -} - -void CIniFileBase::ClearSectionPosList(long FilePos) -{ - if (FilePos <= 0) - { - m_SectionsPos.clear(); - m_lastSectionSearch = 0; - } - else - { - FILELOC::iterator iter = m_SectionsPos.begin(); - while (iter != m_SectionsPos.end()) - { - FILELOC::iterator CurrentIter = iter; - iter++; - long TestFilePos = CurrentIter->second; - if (TestFilePos > FilePos) - { - m_SectionsPos.erase(CurrentIter); - } - } - m_lastSectionSearch = FilePos; - } -} - -void CIniFileBase::GetVectorOfSections(SectionList & sections) -{ - sections.clear(); - - if (!m_File.IsOpen()) - { - return; - } - - { - std::string DoesNotExist = FormatStr("DoesNotExist%d%d%d", rand(), rand(), rand()); - MoveToSectionNameData(DoesNotExist.c_str(), false); - } - - for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++) - { - sections.push_back(iter->first); - } -} - -std::string CIniFileBase::FormatStr(const char * strFormat, ...) -{ - std::string FormatedStr; - va_list args; - va_start(args, strFormat); - - size_t nlen = _vscprintf(strFormat, args) + 1; - char * buffer = (char *)alloca(nlen * sizeof(char)); - buffer[nlen - 1] = 0; - if (buffer != NULL) - { - vsprintf(buffer, strFormat, args); - FormatedStr = buffer; - } - - va_end(args); - return FormatedStr; -} diff --git a/GLideN64/src/GLideNUI-wtl/IniFileClass.h b/GLideN64/src/GLideNUI-wtl/IniFileClass.h deleted file mode 100644 index 10572b5..0000000 --- a/GLideN64/src/GLideNUI-wtl/IniFileClass.h +++ /dev/null @@ -1,127 +0,0 @@ -#pragma once - -#ifndef _WIN32 -#include -#endif - -#include "FileClass.h" -#include -#include -#include -#include -#include - -class CIniFileBase -{ -public: - typedef std::map KeyValueData; - typedef std::vector SectionList; - typedef std::list strlist; - typedef std::pair KeyValueItem; - typedef std::vector KeyValueVector; - typedef void(*SortData)(KeyValueVector &); - - CIniFileBase(CFileBase & FileObject, const char * FileName); - virtual ~CIniFileBase(void); - - bool IsEmpty(); - bool IsFileOpen(void); - bool DeleteSection(const char * lpSectionName); - bool GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, std::string & Value); - std::string GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault); - uint32_t GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, char * lpReturnedString, uint32_t nSize); - uint32_t GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault); - bool GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault, uint32_t & Value); - - virtual void SaveString(const char * lpSectionName, const char * lpKeyName, const char * lpString); - virtual void SaveNumber(const char * lpSectionName, const char * lpKeyName, int32_t Value); - void SetAutoFlush(bool AutoFlush); - void FlushChanges(void); - bool EntryExists(const char * lpSectionName, const char * lpKeyName); - void GetKeyList(const char * lpSectionName, strlist &List); - void GetKeyValueData(const char * lpSectionName, KeyValueData & List); - void SetCustomSort(SortData SortFunction); - - void GetVectorOfSections(SectionList & sections); - const std::string &GetFileName() { return m_FileName; } - -protected: - void OpenIniFileReadOnly(); - void OpenIniFile(bool bCreate = true); - void SaveCurrentSection(void); - - std::string FormatStr(const char * strFormat, ...); - - CFileBase & m_File; - std::string m_FileName; - -private: - struct insensitive_compare - { - bool operator() (const std::string & a, const std::string & b) const - { - return _stricmp(a.c_str(), b.c_str()) < 0; - } - }; - - typedef std::map FILELOC; - typedef FILELOC::iterator FILELOC_ITR; - typedef std::map KeyValueList; - - std::string m_CurrentSection; - bool m_CurrentSectionDirty; - int m_CurrentSectionFilePos; // Where in the file is the current Section - KeyValueList m_CurrentSectionData; - - long m_lastSectionSearch; // When Scanning for a section, what was the last scanned pos - - bool m_ReadOnly; - bool m_InstantFlush; - const char * m_LineFeed; - - FILELOC m_SectionsPos; - SortData m_SortFunction; - - void fInsertSpaces(int Pos, int NoOfSpaces); - int GetStringFromFile(char * & String, std::unique_ptr &Data, int & MaxDataSize, int & DataSize, int & ReadPos); - bool MoveToSectionNameData(const char * lpSectionName, bool ChangeCurrentSection); - const char * CleanLine(char * Line); - void ClearSectionPosList(long FilePos); - -}; - -template -class CIniFileT : - public CIniFileBase -{ -public: - CIniFileT(const char * FileName) : - CIniFileBase(m_FileObject, FileName) - { - //Try to open file for reading - OpenIniFile(); - } - - CIniFileT(const char * FileName, bool bCreate, bool bReadOnly) : - CIniFileBase(m_FileObject, FileName) - { - if (bReadOnly) - { - OpenIniFileReadOnly(); - } - else - { - //Try to open file for reading - OpenIniFile(bCreate); - } - } - virtual ~CIniFileT(void) - { - SaveCurrentSection(); - } - -protected: - CFileStorage m_FileObject; -}; - -typedef CIniFileT CIniFile; diff --git a/GLideN64/src/GLideNUI-wtl/InputDialog.cpp b/GLideN64/src/GLideNUI-wtl/InputDialog.cpp deleted file mode 100644 index 0e4a79b..0000000 --- a/GLideN64/src/GLideNUI-wtl/InputDialog.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "InputDialog.h" - -CInputDialog::CInputDialog(wchar_t * DlgTitle, wchar_t * Message, bool & ok) : - m_DlgTitle(DlgTitle != NULL ? DlgTitle : L""), - m_Message(Message != NULL ? Message : L""), - m_ok(ok) -{ - m_ok = false; -} - -std::wstring CInputDialog::getText(wchar_t * DlgTitle, wchar_t * Message, bool & ok) -{ - CInputDialog Dlg(DlgTitle, Message, ok); - Dlg.DoModal(); - return Dlg.GetInput(); -} - -LRESULT CInputDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); - SetIcon(hIcon, TRUE); - HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); - SetIcon(hIconSmall, FALSE); - - SetWindowText(m_DlgTitle.c_str()); - GetDlgItem(IDC_INFO).SetWindowText(m_Message.c_str()); - GetDlgItem(IDC_INPUT).SetFocus(); - return 0; -} - -LRESULT CInputDialog::OnOk(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - CWindow InputWnd = GetDlgItem(IDC_INPUT); - m_Input.resize(InputWnd.GetWindowTextLength() + 1); - InputWnd.GetWindowText((wchar_t *)m_Input.data(), m_Input.size()); - - m_ok = true; - EndDialog(wID); - return 0; -} - -LRESULT CInputDialog::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - EndDialog(wID); - return 0; -} diff --git a/GLideN64/src/GLideNUI-wtl/InputDialog.h b/GLideN64/src/GLideNUI-wtl/InputDialog.h deleted file mode 100644 index aaa9b15..0000000 --- a/GLideN64/src/GLideNUI-wtl/InputDialog.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once -#include -#include "wtl.h" -#include "resource.h" - -class CInputDialog : - public CDialogImpl -{ -public: - static std::wstring getText(wchar_t * DlgTitle, wchar_t * Message, bool & ok); - - CInputDialog(wchar_t * DlgTitle, wchar_t * Message, bool & ok); - - enum { IDD = IDD_INPUT_DIALOG }; - - BEGIN_MSG_MAP_EX(CInputDialog) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_ID_HANDLER(IDOK, OnOk) - COMMAND_ID_HANDLER(IDCANCEL, OnCancel) - END_MSG_MAP() - - const std::wstring & GetInput() const { return m_Input; } - -protected: - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - -private: - CInputDialog(void); - - std::wstring m_DlgTitle, m_Message, m_Input; - bool & m_ok; -}; \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/Language.cpp b/GLideN64/src/GLideNUI-wtl/Language.cpp deleted file mode 100644 index 4032229..0000000 --- a/GLideN64/src/GLideNUI-wtl/Language.cpp +++ /dev/null @@ -1,414 +0,0 @@ -#include "Language.h" -#include -#include -#include -#include "../Config.h" - -bool g_debugLang = false; -LANG_STRINGS g_currentStrings, g_defaultStrings; - -void LoadDefaultStrings(void) -{ - //Config Dialog - g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_VIDEO, "Video")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_EMULATION, "Emulation")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_FRAME_BUFFER, "Frame buffer")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_TEXTURE_ENHANCEMENT, "Texture enhancement")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_OSD, "OSD")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_DEBUG, "Debug")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SAVE_SETTINGS_FOR, "Save settings for:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SETTINGS_PROFILE, "Settings profile:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_REMOVE, "Remove")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_RESTORE_DEFAULTS, "Restore Defaults")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SAVE_AND_CLOSE, "Save and Close")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SAVE, "Save")); - g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_CLOSE, "Close")); - - //Video Tab - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_GROUP, "Video")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FULL_SCREEN_RES, "Full screen resolution:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FULL_SCREEN_RES_TOOLTIP, "All the resolutions that your video card/monitor supports should be displayed.\n\n[Recommended: Maximum resolution for your monitor unless performance becomes an issue]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_REFRESH_RATE, "Refresh rate:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_REFRESH_RATE_TOOLTIP, "")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_WINDOWED_RESOLUTION, "Windowed resolution:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_WINDOWED_RESOLUTION_TOOLTIP, "This option selects the resolution for windowed mode. You can also type in a custom window size.\n\n[Recommended: 640 x 480, 800 x 600, 1024 x 768, 1280 x 960]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_RATIO, "Aspect ratio:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_RATIO_TOOLTIP, "This setting adjusts the aspect ratio of the video output. All N64 games support 4:3. Some games support 16:9 within game settings. Use Stretch to fill the screen without pillar or letterboxing.\n\nTry to adjust game to fit tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_4_3, "4:3 (recommended)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_16_19, "16:9")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_STRETCH, "Stretch")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_ADJUST, "Try to adjust game to fit")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_VSYNC, "Enable VSync")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_VSYNC_TOOLTIP, "Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.\n\n[Recommended: Usually off, on if you have image tearing problems]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_THREADED_VIDEO, "Enable threaded video")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_THREADED_VIDEO_TOOLTIP, "Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.\n\n[Recommended: Usually off, unless there are performance issues]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_OVERSCAN, "Overscan")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_OVERSCAN_TOOLTIP, "When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_NTSC, "NTSC")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_PAL, "PAL")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANTI_ALIASING, "Anti-aliasing")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_NO_ANTI_ALIASING, "No anti-aliasing")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FAST_ANTI_ALIASING, "Fast approximate anti-aliasing (FXAA)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_MULTISAMPLE_ANTI_ALIASING, "Multisample anti-aliasing (MSAA):")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_OFF, "Off")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_HIGH, "High")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_TOOLTIP, "GLideN64 offers two methods to smooth jagged polygons:\n\nFast approximate anti-aliasing (FXAA): FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with N64-style depth compare. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.\n\nMultisample anti-aliasing (MSAA): MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with N64-style depth compare and may cause minor glitches in some games.\n\nRecommendation: [Usually 16x MSAA, or FXAA with N64-style depth compare]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_INFO, "Multisample anti-aliasing is not compatible with N64-style depth compare.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FILTERING_GROUP, "Filtering")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANISOTROPIC, "Anisotropic filtering:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANISOTROPIC_OFF, "Off")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANISOTROPIC_HIGH, "High")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR, "Bilinear filtering:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR_STANDARD, "Standard")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR_3POINT, "N64-style 3 point")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR_TOOLTIP, "Bilinear filtering: Textures will use standard PC-style bilinear filtering.\n\nN64-style 3 point: Textures will be filtered more like the N64. The result is less smooth but more accurate.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_GROUP, "Dithering")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_PATTERN, "Pattern (RDRAM):")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_APPLY_TO_OUTPUT, "Apply to final output")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_APPLY_TO_OUTPUT_TOOLTIP, "This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_5BIT_QUANTIZATION, "Enable 5-bit quantization")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_5BIT_QUANTIZATION_TOOLTIP, "Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_HIRES_NOISE, "High resolution noise")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_HIRES_NOISE_TOOLTIP, "This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_MODE_TOOLTIP, "RDRAM dithering prevents color banding in games with framebuffer effects.\nSettings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_DISABLE, "disable")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_BAYER, "Bayer")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_MAGIC_SQUARE, "Magic square")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_BLUE_NOISE, "Blue noise")); - g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_LANGUAGE, "Language:")); - - //Emulation Tab - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_USE_PER_GAME, "Use per-game settings")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_USE_PER_GAME_TOOLTIP, "When enabled, all non-default values of settings are stored individually for each game.\n\nWhen a game is running, settings are displayed and saved for the currently running game.\n\nNote: GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.\n\n[Recommended: Checked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_N64_STYLE_MIP_MAPPING, "Enable N64-style mip-mapping")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_N64_STYLE_MIP_MAPPING_TOOLTIP, "The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.\n\n[Recommended: Checked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_HWLIGHTING, "Enable per-pixel lighting (better quality, HLE only)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_HWLIGHTING_TOOLTIP, "In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.\n\n[Recommended: Your preference]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_PIXEL_COVERAGE, "Enable pixel coverage calculation")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_PIXEL_COVERAGE_TOOLTIP, "Enables approximated pixel coverage calculation. N64 uses pixel coverage for anti-aliasing and in some special blending modes. Some games have wire-frame mode aka 'pen and ink' mode. This mode also needs pixel coverage calculated.\n\n[Recommended: Checked, unless performance is hurt]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_SHADERS_STORAGE, "Store compiled shaders for performance (recommended)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_SHADERS_STORAGE_TOOLTIP, "Use persistent storage for compiled shader programs.\nEach game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.\n\n[Recommended: Checked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_INTERNAL_RES, "Internal resolution")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_INTERNAL_RES_TOOLTIP, "This option sets the output render buffer size. By default, the render buffer is set to the Same as output resolution, but you can set it to the Original N64 resolution or a Multiple of N64 resolution.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_FACTOR0X, "Same as output resolution")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_FACTOR1X, "Original N64 resolution (most accurate)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_FACTORXX, "Multiple of N64 resolution:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_GAMMA, "Gamma")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_GAMMA_TOOLTIP, "Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.\n\n[Recommended: Unchecked; 2.00]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_GAMMA_CORRECTION, "Custom gamma correction level:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_GAMMA_INFO, "Selecting this option overrides gamma correction specified by the game.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_2D_ELEMENTS, "2D elements")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_RENDER_2D_ELEMENTS, "Render 2D elements in N64 resolution (best quality, can be slow):")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_RENDER_2D_TOOLTIP, "When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.\n\n[Recommended: Checked, unless you have performance problems]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_RENDER_DISABLE, "Disable")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_RENDER_ENABLE_OPTIMIZED, "Enable optimized")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_RENDER_ENABLE_UNOPTIMIZED, "Enable unoptimized")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_HALOS_REMOVAL, "Try to remove colored halos around transparent objects")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_FIX_BLACK_LINES, "Fix black lines between 2D elements:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_FIX_BLACK_LINES_TOOLTIP, "In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.\n\nFor adjacent 2D elements: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.\n\nAlways: Apply the correction for every 2D element. Select this option when For adjacent 2D elements doesn't help.\n\nNever: Don't attempt to correct black lines between 2D elements.\n\n[Recommended: Game dependent, mostly Never]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_ADJACENT_2D_ELEMENTS, "For adjacent 2D elements")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_ALWAYS, "Always")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_NEVER, "Never")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_BACKGROUND, "Background rendering mode (HLE only):")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_BACKGROUND_TOOLTIP, "Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:\n\nOne piece: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.\n\nStripped: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use \"Render 2D elements in N64 resolution\" option to remove the gaps.\n\n[Recommended: Game dependent, mostly Stripped]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_ONE_PIECE, "One piece")); - g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_STRIPPED, "Stripped")); - - //Frame Buffer Tab - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_ENABLE, "Emulate frame buffer")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_ENABLE_INFO, "Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_AUX_BUFFERS, "Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_AUX_BUFFERS_TOOLTIP, "When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.\n\n[Recommended: Usually unchecked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_SWAP, "Frame buffer swap on:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_SWAP_TOOLTIP, "This option controls how often GLideN64 updates the main frame buffer.\n\nVertical interrupt: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.\n\nVI origin change: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.\n\nColor buffer change: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_VERTICAL_INTERRUPT, "Vertical interrupt (recommended, fewest game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_VI_ORIGIN_CHANGE, "VI origin change (faster, few game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COLOR_BUFFER_CHANGE, "Color buffer change (fastest, some game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_INFO_ENABLE, "Use emulator help to read/write frame buffers")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_INFO_ENABLE_TOOLTIP, "Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.\n\n[Recommended: Usually unchecked, but for some games/emulators it may be faster checked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_READ_COLOR_CHUNK, "Read color buffer in 4 KB chunks")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_READ_COLOR_CHUNK_TOOLTIP, "When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.\n\n[Recommended: Usually unchecked, because the color buffer is usually read entirely]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_READ_DEPTH_CHUNK, "Read depth buffer in 4 KB chunks")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_READ_DEPTH_CHUNK_TOOLTIP, "When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.\n\n[Recommended: Checked, because the depth buffer is not often read entirely]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_COLOR_BUFFER, "Copy video card frame buffer to N64 memory:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_COLOR_BUFFER_TOOLTIP, "In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.\n\nNever: Disable copying buffers from video card.\n\nSynchronous: Effects are detected for all games, but it can be slow. Use for games where Asynchronous doesn't work.\n\nAsynchronous: Effects are detected for most games.\n\n[Recommended: Usually Asynchronous]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_NEVER, "Never (fastest, many game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_SYNCHRONOUS, "Synchronous (slowest, fewest game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_ASYNCHRONOUS, "Asynchronous (fast, few game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_BUFFER, "Copy video card depth buffer to N64 memory:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_BUFFER_TOOLTIP, "The depth buffer is used to emulate some effects (e.g. coronas):\n\nNever: Depth buffer is disabled.\n\nFrom VRAM: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.\n\nIn software: Generally faster than copying from VRAM, but the result can be imperfect.\n\n[Recommended: In software]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_NEVER, "Never (fastest, most game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_VRAM, "From VRAM (slow, some game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_SOFTWARE, "In software (fast, fewest game issues)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_N64_DEPTH_COMPARE, "N64-style depth compare (experimental, disables MSAA)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_N64_DEPTH_COMPARE_TOOLTIP, "The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. Experimental!\nFast mode requires OpenGL 4.2 and fragment shader interlock extensions.\nCompatible mode requires only core OpenGL 4.2 Can be slow!\n[Recommended: Sometimes checked, for several games]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_N64_DEPTH_DISABLE, "Disable")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_N64_DEPTH_FAST, "Fast")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_N64_DEPTH_COMPATIBLE, "Compatible")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_FORCE_DEPTH_BUFFER_CLEAR, "Force depth buffer clear")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_FORCE_DEPTH_BUFFER_CLEAR_TOOLTIP, "Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.\n\n[Recommended: off, except for Eikou no Saint Andrews]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_RENDER_FRAMEBUFFER, "Render N64 frame buffer to output")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_RENDER_FRAMEBUFFER_TOOLTIP, "When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.\n\n[Recommended: Usually unchecked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_TO_MAIN, "Copy depth to main depth buffer")); - g_defaultStrings.insert(LANG_STRINGS::value_type(FRAMEBUFFER_COPY_DEPTH_TO_MAIN_TOOLTIP, "This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.\n\n[Recommended: only if you use Reshade and need depth dependant effects]")); - - //Texture enhancement - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_TEXTURES_GROUP, "N64 textures")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER, "Filter:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_TOOLTIP, "This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.\n\n[Recommended: Your preference]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_NONE, "None")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_SMOOTH1, "Smooth filtering 1")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_SMOOTH2, "Smooth filtering 2")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_SMOOTH3, "Smooth filtering 3")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_SMOOTH4, "Smooth filtering 4")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_SHARP1, "Sharp filtering 1")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_N64_FILTER_SHARP2, "Sharp filtering 2")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_ENHANCEMENT, "Enhancement:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_ENHANCEMENT_TOOLTIP, "There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.\n\nWhen Store is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck Disable for backgrounds for the best performance.\n\n[Recommended: Your preference]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_ENHANCEMENT_NONE, "None")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_ENHANCEMENT_STORE, "Store")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_DECREASE_COLOR, "Decrease color banding (recommended for xBRZ enhancement)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_DECREASE_COLOR_TOOLTIP, "This option enables a pre-processing step that reduces posterization issues on enhanced textures.\n\n[Recommended: Checked for xBRZ]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_IGNORE_BACKGROUNDS, "Disable for backgrounds")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_IGNORE_BACKGROUNDS_TOOLTIP, "This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.\n\n[Recommended: Checked, unless Enhancement is set to Store]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_USE_FILE_STORAGE, "Use file storage instead of memory cache")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_USE_TEXTURE_PACK, "Use texture pack")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_TEXTURE_PACK, "Texture pack path:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_TEXTURE_PACK_TOOLTIP, "Select path to the folder with texture packs.\nDefault: Plugin/hires_texture")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_CACHE_PATH, "Texture cache path:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_DUMP_PATH, "Texture dump path:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_USE_FULL_TRANSPARENCIES, "Use full transparencies (recommended for newer texture packs)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_USE_FULL_TRANSPARENCIES_TOOLTIP, "When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.\n\nClear this option for older or poorly designed texture packs.\n\n[Recommended: Texture pack dependent]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_ALTERNATIVE_CRC, "Alternative CRC calculation (for old Rice Video packs)")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_ALTERNATIVE_CRC_TOOLTIP, "This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.\n\n[Recommended: Mostly unchecked, checked for old texture packs]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_USE_FILE_STORAGE_TOOLTIP, "This option enables alternative storage for hi-res textures. Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size. File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size. Disable \"Compress texture cache\" option for better performance.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_SIZE_OF_MEMORY_CACHE, "Size of memory cache for enhanced textures:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_SIZE_OF_MEMORY_CACHE_TOOLTIP, "Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.\n\n[Recommended: PC and game dependent]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_SAVE_ENHANCED, "Save enhanced texture cache to hard disk")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_SAVE_ENHANCED_TOOLTIP, "This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.\n\nWhen using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5-60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.\n\n[Recommended: Checked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_COMPRESS_CACHE, "Compress texture cache")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_COMPRESS_CACHE_TOOLTIP, "Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.\n\n[Recommended: Checked]")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_CONVERT_16BPP, "Convert textures to 16 bpp")); - g_defaultStrings.insert(LANG_STRINGS::value_type(TEXTURE_CONVERT_16BPP_TOOLTIP, "This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.\n\n[Recommended: Unchecked]")); - - //On-screen display - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_POSITION, "Position")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_DISPLAY_FPS, "Display FPS")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_DISPLAY_VI, "Display VI/s")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_DISPLAY_PERCENTAGE, "Display percentage")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_DISPLAY_INTERNAL_RESOLUTION, "Display internal resolution")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_DISPLAY_RENDERING_RESOLUTION, "Display rendering resolution")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_FONT, "Font")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_SIZE, "Size:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_PX, "px")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_COLOR, "Color:")); - g_defaultStrings.insert(LANG_STRINGS::value_type(OSD_PREVIEW, "Preview")); - - //Debug tab - g_defaultStrings.insert(LANG_STRINGS::value_type(DEBUG_DUMP_LOWLEVEL_INFO, "Dump low-level info")); - g_defaultStrings.insert(LANG_STRINGS::value_type(DEBUG_DUMP_DISPLAY_LIST, "Dump display list commands")); - g_defaultStrings.insert(LANG_STRINGS::value_type(DEBUG_DUMP_DETAILED_INFO, "Dump detailed info (matrices, vertices, etc.)")); - - //About - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_ABOUT_TITLE, "About GLideN64")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_TAB_ABOUT, "About")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_TAB_CONTRIBUTORS, "Contributors")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_TAB_FUNDERS, "Funders")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_TAB_CREDITS, "Credits")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_NEXT_GENERATION, "The next generation open source graphics plugin for N64 emulators.")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_AUTHORS, "Authors")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_DEVELOPER, "Developer")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_BETA_TESTER, "Beta tester")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_GUI_DESIGNER, "GUI designer")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_AND_MORE, "... and more")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_AUTHOR_GLN64, "Author of the original glN64 graphics plugin")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_AUTHOR_GLES2N64, "Author of gles2n64, a port of glN64 to GL ES 2.0")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_AUTHOR_GLIDEHQ, "Author of the GlideHQ texture library")); - g_defaultStrings.insert(LANG_STRINGS::value_type(ABOUT_AUTHOR_Z64, "Author of z64, an OpenGL LLE plugin")); -} - -LANG_STRINGS GetDefaultStrings(void) -{ - if (g_defaultStrings.size() == 0) - LoadDefaultStrings(); - return g_defaultStrings; -} - -LANG_STR GetNextLangString(FILE * file) -{ - if (feof(file)) - return LANG_STR(0, ""); - - char token = 0; - char prevtoken = 0; - while (token != '#' && !feof(file)) - fread(&token, 1, 1, file); - - if (feof(file)) - return LANG_STR(0, ""); - - int32_t StringID; - fscanf_s(file, "%d", &StringID); - - token = 0; - while (token != '#' && !feof(file)) - fread(&token, 1, 1, file); - - if (feof(file)) - return LANG_STR(0, ""); - - while (token != '"' && !feof(file)) - fread(&token, 1, 1, file); - - if (feof(file)) - return LANG_STR(0, ""); - - fread(&token, 1, 1, file); - stdstr text; - while (!feof(file)) { - if (token == '"' && prevtoken != '\\') break; //escape quote - prevtoken = token; - text += token; - fread(&token, 1, 1, file); - } - text.Replace("\\n", "\n"); - text.Replace("\\\"", "\""); - return LANG_STR(StringID, text); -} - -bool LoadLanguageFile(const std::string & langFile) -{ - if (g_defaultStrings.size() == 0) - LoadDefaultStrings(); - - g_currentStrings.clear(); - if (g_debugLang) - return true; - - FILE *file = NULL; - if (fopen_s(&file, langFile.c_str(), "rb") != 0 || file == NULL) - return false; - - uint8_t utf_bom[3]; - if (fread(&utf_bom, sizeof(utf_bom), 1, file) != 1 || utf_bom[0] != 0xEF || utf_bom[1] != 0xBB || utf_bom[2] != 0xBF) { - fclose(file); - return false; - } - - while (!feof(file)) - g_currentStrings.insert(GetNextLangString(file)); - - fclose(file); - return true; -} - -void LoadCurrentStrings(const char * path, const std::string & lang) -{ - std::string translationsFolder(path); - std::replace(translationsFolder.begin(), translationsFolder.end(), '/', '\\'); - if (translationsFolder[translationsFolder.length() - 1] != '\\') - { - translationsFolder += '\\'; - } - translationsFolder += "translations\\"; - if (lang.length() > 0) - { - std::string langFile = translationsFolder + lang; - if (LoadLanguageFile(langFile)) - { - return; - } - } - if (g_defaultStrings.size() == 0) - LoadDefaultStrings(); - - g_currentStrings.clear(); -} - - -std::string GetLangString(const char * FileName, languageStringID ID) -{ - FILE *file = NULL; - if (fopen_s(&file, FileName, "rb") != 0 || file == NULL) - return ""; - - uint8_t utf_bom[3]; - if (fread(&utf_bom, sizeof(utf_bom), 1, file) != 1 || - utf_bom[0] != 0xEF || - utf_bom[1] != 0xBB || - utf_bom[2] != 0xBF) - { - fclose(file); - return ""; - } - - while (!feof(file)) { - LANG_STR String = GetNextLangString(file); - if (String.first == ID) { - fclose(file); - return String.second; - } - } - fclose(file); - return ""; -} - -LanguageList GetLanguageList(const char * path) -{ - std::string pluginFolder(path); - std::replace(pluginFolder.begin(), pluginFolder.end(), '/', '\\'); - if (pluginFolder[pluginFolder.length() - 1] != '\\') - { - pluginFolder += '\\'; - } - pluginFolder += "translations\\"; - std::string nameFilters = pluginFolder + "gliden64_*.Lang"; - - WIN32_FIND_DATAA FindData; - HANDLE hFindFile = FindFirstFileA(nameFilters.c_str(), &FindData); // Find anything - LanguageList languages; - if (hFindFile != INVALID_HANDLE_VALUE) { - do { - std::string langFile = pluginFolder + FindData.cFileName; - LanguageFile file; - - file.Filename = FindData.cFileName; - file.LanguageName = GetLangString(langFile.c_str(), LANGUAGE_NAME); - - if (file.LanguageName.length() == 0 || file.LanguageName == stdstr().FromUTF16(L"English")) - continue; - - languages.push_back(file); - } while (FindNextFileA(hFindFile, &FindData)); - FindClose(hFindFile); - } - return languages; -} - -const std::string & GetString(languageStringID stringID) -{ - LANG_STRINGS::iterator currentString = g_currentStrings.find(stringID); - if (currentString != g_currentStrings.end()) - return currentString->second; - - if (g_debugLang) { - char debugStr[300]; - sprintf_s(debugStr, "#%d#", stringID); - std::pair ret = g_currentStrings.insert(LANG_STRINGS::value_type(stringID, debugStr)); - if (ret.second) - return ret.first->second; - } - - LANG_STRINGS::iterator DefString = g_defaultStrings.find(stringID); - if (DefString != g_defaultStrings.end()) - { - return DefString->second; - } - static std::string emptyString; - return emptyString; -} - -std::wstring wGS(languageStringID StringID) -{ - return stdstr(GetString(StringID)).ToUTF16(); -} \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/Language.h b/GLideN64/src/GLideNUI-wtl/Language.h deleted file mode 100644 index 2ee6fe8..0000000 --- a/GLideN64/src/GLideNUI-wtl/Language.h +++ /dev/null @@ -1,261 +0,0 @@ -#pragma once -#include -#include -#include "util/StdString.h" - -enum languageStringID -{ - /********************************************************************************* - * Meta Information * - *********************************************************************************/ - LANGUAGE_NAME = 1, - - /********************************************************************************* - * Config Dialog * - *********************************************************************************/ - TAB_VIDEO = 1000, - TAB_EMULATION = 1001, - TAB_FRAME_BUFFER = 1002, - TAB_TEXTURE_ENHANCEMENT = 1003, - TAB_OSD = 1004, - TAB_DEBUG = 1005, - CFG_SAVE_SETTINGS_FOR = 1010, - CFG_SETTINGS_PROFILE = 1011, - CFG_REMOVE = 1012, - CFG_RESTORE_DEFAULTS = 1013, - CFG_SAVE_AND_CLOSE = 1014, - CFG_SAVE = 1015, - CFG_CLOSE = 1016, - - /********************************************************************************* - * Video Tab * - *********************************************************************************/ - VIDEO_GROUP = 2000, - VIDEO_FULL_SCREEN_RES = 2001, - VIDEO_FULL_SCREEN_RES_TOOLTIP = 2002, - VIDEO_REFRESH_RATE = 2003, - VIDEO_REFRESH_RATE_TOOLTIP = 2004, - VIDEO_WINDOWED_RESOLUTION = 2005, - VIDEO_WINDOWED_RESOLUTION_TOOLTIP = 2006, - VIDEO_ASPECT_RATIO = 2007, - VIDEO_ASPECT_RATIO_TOOLTIP = 2008, - VIDEO_ASPECT_4_3 = 2009, - VIDEO_ASPECT_16_19 = 2010, - VIDEO_ASPECT_STRETCH = 2011, - VIDEO_ASPECT_ADJUST = 2012, - VIDEO_VSYNC = 2013, - VIDEO_VSYNC_TOOLTIP = 2014, - VIDEO_THREADED_VIDEO = 2015, - VIDEO_THREADED_VIDEO_TOOLTIP = 2016, - VIDEO_OVERSCAN = 2017, - VIDEO_OVERSCAN_TOOLTIP = 2018, - VIDEO_NTSC = 2019, - VIDEO_PAL = 2020, - VIDEO_ANTI_ALIASING = 2021, - VIDEO_NO_ANTI_ALIASING = 2022, - VIDEO_FAST_ANTI_ALIASING = 2023, - VIDEO_MULTISAMPLE_ANTI_ALIASING = 2024, - VIDEO_AA_OFF = 2025, - VIDEO_AA_HIGH = 2026, - VIDEO_AA_TOOLTIP = 2027, - VIDEO_AA_INFO = 2028, - VIDEO_FILTERING_GROUP = 2029, - VIDEO_ANISOTROPIC = 2030, - VIDEO_ANISOTROPIC_OFF = 2031, - VIDEO_ANISOTROPIC_HIGH = 2032, - VIDEO_BILINEAR = 2033, - VIDEO_BILINEAR_STANDARD = 2034, - VIDEO_BILINEAR_3POINT = 2035, - VIDEO_BILINEAR_TOOLTIP = 2036, - VIDEO_DITHERING_GROUP = 2037, - VIDEO_PATTERN = 2038, - VIDEO_DITHERING_APPLY_TO_OUTPUT = 2039, - VIDEO_DITHERING_APPLY_TO_OUTPUT_TOOLTIP = 2040, - VIDEO_DITHERING_5BIT_QUANTIZATION = 2041, - VIDEO_DITHERING_5BIT_QUANTIZATION_TOOLTIP = 2042, - VIDEO_DITHERING_HIRES_NOISE = 2043, - VIDEO_DITHERING_HIRES_NOISE_TOOLTIP = 2044, - VIDEO_DITHERING_MODE_TOOLTIP = 2045, - VIDEO_DITHERING_DISABLE = 2046, - VIDEO_DITHERING_BAYER = 2047, - VIDEO_DITHERING_MAGIC_SQUARE = 2048, - VIDEO_DITHERING_BLUE_NOISE = 2049, - VIDEO_LANGUAGE = 2050, - - /********************************************************************************* - * Emulation Tab * - *********************************************************************************/ - EMULATION_USE_PER_GAME = 3000, - EMULATION_USE_PER_GAME_TOOLTIP = 3001, - EMULATION_N64_STYLE_MIP_MAPPING = 3002, - EMULATION_N64_STYLE_MIP_MAPPING_TOOLTIP = 3003, - EMULATION_HWLIGHTING = 3004, - EMULATION_HWLIGHTING_TOOLTIP = 3005, - EMULATION_SHADERS_STORAGE = 3006, - EMULATION_SHADERS_STORAGE_TOOLTIP = 3007, - EMULATION_INTERNAL_RES = 3008, - EMULATION_INTERNAL_RES_TOOLTIP = 3009, - EMULATION_FACTOR0X = 3010, - EMULATION_FACTOR1X = 3011, - EMULATION_FACTORXX = 3012, - EMULATION_GAMMA = 3013, - EMULATION_GAMMA_TOOLTIP = 3014, - EMULATION_GAMMA_CORRECTION = 3015, - EMULATION_GAMMA_INFO = 3016, - EMULATION_2D_ELEMENTS = 3017, - EMULATION_RENDER_2D_ELEMENTS = 3018, - EMULATION_RENDER_2D_TOOLTIP = 3019, - EMULATION_RENDER_DISABLE = 3020, - EMULATION_RENDER_ENABLE_OPTIMIZED = 3021, - EMULATION_RENDER_ENABLE_UNOPTIMIZED = 3022, - EMULATION_HALOS_REMOVAL = 3023, - EMULATION_FIX_BLACK_LINES = 3024, - EMULATION_FIX_BLACK_LINES_TOOLTIP = 3025, - EMULATION_ADJACENT_2D_ELEMENTS = 3026, - EMULATION_ALWAYS = 3027, - EMULATION_NEVER = 3028, - EMULATION_BACKGROUND = 3029, - EMULATION_BACKGROUND_TOOLTIP = 3030, - EMULATION_ONE_PIECE = 3031, - EMULATION_STRIPPED = 3032, - EMULATION_PIXEL_COVERAGE = 3033, - EMULATION_PIXEL_COVERAGE_TOOLTIP = 3034, - - /********************************************************************************* - * Frame Buffer Tab * - *********************************************************************************/ - FRAMEBUFFER_ENABLE = 4000, - FRAMEBUFFER_ENABLE_INFO = 4001, - FRAMEBUFFER_COPY_AUX_BUFFERS = 4002, - FRAMEBUFFER_COPY_AUX_BUFFERS_TOOLTIP = 4003, - FRAMEBUFFER_SWAP = 4004, - FRAMEBUFFER_SWAP_TOOLTIP = 4005, - FRAMEBUFFER_VERTICAL_INTERRUPT = 4006, - FRAMEBUFFER_VI_ORIGIN_CHANGE = 4007, - FRAMEBUFFER_COLOR_BUFFER_CHANGE = 4008, - FRAMEBUFFER_INFO_ENABLE = 4009, - FRAMEBUFFER_INFO_ENABLE_TOOLTIP = 4010, - FRAMEBUFFER_READ_COLOR_CHUNK = 4011, - FRAMEBUFFER_READ_COLOR_CHUNK_TOOLTIP = 4012, - FRAMEBUFFER_READ_DEPTH_CHUNK = 4013, - FRAMEBUFFER_READ_DEPTH_CHUNK_TOOLTIP = 4014, - FRAMEBUFFER_COPY_COLOR_BUFFER = 4015, - FRAMEBUFFER_COPY_COLOR_BUFFER_TOOLTIP = 4016, - FRAMEBUFFER_COPY_NEVER = 4017, - FRAMEBUFFER_COPY_SYNCHRONOUS = 4018, - FRAMEBUFFER_COPY_ASYNCHRONOUS = 4019, - FRAMEBUFFER_COPY_DEPTH_BUFFER = 4020, - FRAMEBUFFER_COPY_DEPTH_BUFFER_TOOLTIP = 4021, - FRAMEBUFFER_COPY_DEPTH_NEVER = 4022, - FRAMEBUFFER_COPY_DEPTH_VRAM = 4023, - FRAMEBUFFER_COPY_DEPTH_SOFTWARE = 4024, - FRAMEBUFFER_N64_DEPTH_COMPARE = 4025, - FRAMEBUFFER_N64_DEPTH_COMPARE_TOOLTIP = 4026, - FRAMEBUFFER_N64_DEPTH_DISABLE = 4027, - FRAMEBUFFER_N64_DEPTH_FAST = 4028, - FRAMEBUFFER_N64_DEPTH_COMPATIBLE = 4029, - FRAMEBUFFER_FORCE_DEPTH_BUFFER_CLEAR = 4030, - FRAMEBUFFER_FORCE_DEPTH_BUFFER_CLEAR_TOOLTIP = 4031, - FRAMEBUFFER_RENDER_FRAMEBUFFER = 4032, - FRAMEBUFFER_RENDER_FRAMEBUFFER_TOOLTIP = 4033, - FRAMEBUFFER_COPY_DEPTH_TO_MAIN = 4034, - FRAMEBUFFER_COPY_DEPTH_TO_MAIN_TOOLTIP = 4035, - - /********************************************************************************* - * Texture Enhancement Tab * - *********************************************************************************/ - TEXTURE_N64_TEXTURES_GROUP = 5000, - TEXTURE_N64_FILTER = 5001, - TEXTURE_N64_FILTER_TOOLTIP = 5002, - TEXTURE_N64_FILTER_NONE = 5003, - TEXTURE_N64_FILTER_SMOOTH1 = 5004, - TEXTURE_N64_FILTER_SMOOTH2 = 5005, - TEXTURE_N64_FILTER_SMOOTH3 = 5006, - TEXTURE_N64_FILTER_SMOOTH4 = 5007, - TEXTURE_N64_FILTER_SHARP1 = 5008, - TEXTURE_N64_FILTER_SHARP2 = 5009, - TEXTURE_ENHANCEMENT = 5010, - TEXTURE_ENHANCEMENT_TOOLTIP = 5011, - TEXTURE_ENHANCEMENT_NONE = 5012, - TEXTURE_ENHANCEMENT_STORE = 5013, - TEXTURE_DECREASE_COLOR = 5014, - TEXTURE_DECREASE_COLOR_TOOLTIP = 5015, - TEXTURE_IGNORE_BACKGROUNDS = 5016, - TEXTURE_IGNORE_BACKGROUNDS_TOOLTIP = 5017, - TEXTURE_USE_FILE_STORAGE = 5018, - TEXTURE_USE_TEXTURE_PACK = 5019, - TEXTURE_TEXTURE_PACK = 5020, - TEXTURE_TEXTURE_PACK_TOOLTIP = 5021, - TEXTURE_CACHE_PATH = 5022, - TEXTURE_DUMP_PATH = 5023, - TEXTURE_USE_FULL_TRANSPARENCIES = 5024, - TEXTURE_USE_FULL_TRANSPARENCIES_TOOLTIP = 5025, - TEXTURE_ALTERNATIVE_CRC = 5026, - TEXTURE_ALTERNATIVE_CRC_TOOLTIP = 5027, - TEXTURE_USE_FILE_STORAGE_TOOLTIP = 5028, - TEXTURE_SIZE_OF_MEMORY_CACHE = 5031, - TEXTURE_SIZE_OF_MEMORY_CACHE_TOOLTIP = 5032, - TEXTURE_SAVE_ENHANCED = 5033, - TEXTURE_SAVE_ENHANCED_TOOLTIP = 5034, - TEXTURE_COMPRESS_CACHE = 5035, - TEXTURE_COMPRESS_CACHE_TOOLTIP = 5036, - TEXTURE_CONVERT_16BPP = 5037, - TEXTURE_CONVERT_16BPP_TOOLTIP = 5038, - TEXTURE_RELOAD = 5039, - TEXTURE_RELOAD_TOOLTIP = 5040, - - /********************************************************************************* - * On-screen display * - *********************************************************************************/ - OSD_POSITION = 6000, - OSD_DISPLAY_FPS = 6001, - OSD_DISPLAY_VI = 6002, - OSD_DISPLAY_PERCENTAGE = 6003, - OSD_DISPLAY_INTERNAL_RESOLUTION = 6004, - OSD_DISPLAY_RENDERING_RESOLUTION = 6005, - OSD_FONT = 6006, - OSD_SIZE = 6007, - OSD_PX = 6008, - OSD_COLOR = 6009, - OSD_PREVIEW = 6010, - - /********************************************************************************* - * Debug * - *********************************************************************************/ - DEBUG_DUMP_LOWLEVEL_INFO = 7000, - DEBUG_DUMP_DISPLAY_LIST = 7001, - DEBUG_DUMP_DETAILED_INFO = 7002, - - /********************************************************************************* - * About * - *********************************************************************************/ - ABOUT_ABOUT_TITLE = 9000, - ABOUT_TAB_ABOUT = 9001, - ABOUT_TAB_CONTRIBUTORS = 9002, - ABOUT_TAB_FUNDERS = 9003, - ABOUT_TAB_CREDITS = 9004, - ABOUT_NEXT_GENERATION = 9005, - ABOUT_AUTHORS = 9006, - ABOUT_DEVELOPER = 9007, - ABOUT_BETA_TESTER = 9008, - ABOUT_GUI_DESIGNER = 9009, - ABOUT_AND_MORE = 9010, - ABOUT_AUTHOR_GLN64 = 9011, - ABOUT_AUTHOR_GLES2N64 = 9012, - ABOUT_AUTHOR_GLIDEHQ = 9013, - ABOUT_AUTHOR_Z64 = 9014, -}; - -struct LanguageFile -{ - std::string Filename; - std::string LanguageName; -}; -typedef std::list LanguageList; -typedef std::map LANG_STRINGS; -typedef LANG_STRINGS::value_type LANG_STR; - -void LoadCurrentStrings(const char * path, const std::string & lang); -LanguageList GetLanguageList(const char * path); -LANG_STRINGS GetDefaultStrings(void); -std::wstring wGS(languageStringID StringID); \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/ScreenShot.cpp b/GLideN64/src/GLideNUI-wtl/ScreenShot.cpp deleted file mode 100644 index 8a0e21a..0000000 --- a/GLideN64/src/GLideNUI-wtl/ScreenShot.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "GLideNUI.h" -#include "../Config.h" -#include "util/util.h" -#include -#include "../GLideNHQ/inc/png.h" - -void write_png_file(const wchar_t * file_name, int width, int height, const uint8_t *buffer) -{ -#pragma warning(disable: 4996) - FILE *fp = _wfopen(file_name, L"wb"); -#pragma warning(default: 4996) - if (!fp) return; - - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL) { - fclose(fp); - return; - } - - png_infop info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { - png_destroy_read_struct(&png_ptr, NULL, NULL); - fclose(fp); - return; - } - - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); - fclose(fp); - return; - } - - png_init_io(png_ptr, fp); - - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); - fclose(fp); - return; - } - - png_byte bit_depth = 8; - png_byte color_type = PNG_COLOR_TYPE_RGB; - png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - png_write_info(png_ptr, info_ptr); - - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); - fclose(fp); - return; - } - - int pixel_size = 3; - int p = 0; - png_bytep * row_pointers = (png_bytep*)malloc(sizeof(png_bytep)* height); - for (int y = height - 1; y >= 0; y--) { - row_pointers[y] = (png_byte*)malloc(width*pixel_size); - for (int x = 0; x < width; x++) { - row_pointers[y][x*pixel_size + 0] = buffer[p++]; - row_pointers[y][x*pixel_size + 1] = buffer[p++]; - row_pointers[y][x*pixel_size + 2] = buffer[p++]; - } - } - png_write_image(png_ptr, row_pointers); - - for (int y = 0; y < height; y++) { - free(row_pointers[y]); - } - free(row_pointers); - - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); - fclose(fp); - return; - } - png_write_end(png_ptr, NULL); - fclose(fp); -} - -EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data) -{ - const wchar_t * fileExt = L"png"; - - std::wstring folder = _folder; - if (folder.size() > 1 && folder[folder.size() - 1] == L'\\') folder.resize(folder.size() - 1); - - WIN32_FIND_DATA FindData = { 0 }; - HANDLE hFindFile = FindFirstFile(folder.c_str(), &FindData); // Find anything - if (hFindFile == INVALID_HANDLE_VALUE) { - ::CreateDirectory(folder.c_str(), NULL); - hFindFile = FindFirstFile(folder.c_str(), &FindData); - } - if (hFindFile != INVALID_HANDLE_VALUE) - FindClose(hFindFile); - - if ((FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - return; - - std::wstring romName = ToUTF16(_name); - for (size_t i = 0, n = romName.size(); i < n; i++) { - if (romName[i] == L' ') romName[i] = L'_'; - if (romName[i] == L':') romName[i] = L';'; - } - - wchar_t fileName[MAX_PATH]; - int i; - for (i = 0; i < 1000; ++i) { -#pragma warning(disable: 4996) - swprintf(fileName, L"%ls\\GLideN64_%ls_%03i.%s", folder.c_str(), romName.c_str(), i, fileExt); -#pragma warning(default: 4996) - hFindFile = FindFirstFile(fileName, &FindData); - if (hFindFile == INVALID_HANDLE_VALUE) - { - break; - } - FindClose(hFindFile); - } - if (i == 1000) - return; - - write_png_file(fileName, _width, _height, _data); -} diff --git a/GLideN64/src/GLideNUI-wtl/Settings.cpp b/GLideN64/src/GLideNUI-wtl/Settings.cpp deleted file mode 100644 index 1411cbe..0000000 --- a/GLideN64/src/GLideNUI-wtl/Settings.cpp +++ /dev/null @@ -1,575 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include "../winlnxdefs.h" -#endif -#include "../GBI.h" -#include "../Config.h" - -#include "Settings.h" -#include "GlSettings.h" -#include "util/util.h" -#include -#include - -static const char * strIniFileName = "GLideN64.ini"; -static const char * strCustomSettingsFileName = "GLideN64.custom.ini"; -static const char * strUserProfile = "User"; - -static -void _loadSettings(GlSettings & settings) -{ - config.version = settings.value("version").toInt(); - - settings.beginGroup("video"); - config.video.fullscreenWidth = settings.value("fullscreenWidth", config.video.fullscreenWidth).toInt(); - config.video.fullscreenHeight = settings.value("fullscreenHeight", config.video.fullscreenHeight).toInt(); - config.video.windowedWidth = settings.value("windowedWidth", config.video.windowedWidth).toInt(); - config.video.windowedHeight = settings.value("windowedHeight", config.video.windowedHeight).toInt(); - config.video.fullscreenRefresh = settings.value("fullscreenRefresh", config.video.fullscreenRefresh).toInt(); - config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt(); - config.video.maxMultiSampling = settings.value("maxMultiSampling", config.video.maxMultiSampling).toInt(); - config.video.fxaa= settings.value("fxaa", config.video.fxaa).toInt(); - config.video.verticalSync = settings.value("verticalSync", config.video.verticalSync).toInt(); - config.video.threadedVideo = settings.value("threadedVideo", config.video.threadedVideo).toInt(); - settings.endGroup(); - - settings.beginGroup("texture"); - config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt(); - config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt(); - config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt(); - config.texture.screenShotFormat = settings.value("screenShotFormat", config.texture.screenShotFormat).toInt(); - settings.endGroup(); - - settings.beginGroup("generalEmulation"); - config.generalEmulation.enableDitheringPattern = settings.value("enableDitheringPattern", config.generalEmulation.enableDitheringPattern).toInt(); - config.generalEmulation.enableDitheringQuantization = settings.value("enableDitheringQuantization", config.generalEmulation.enableDitheringQuantization).toInt(); - config.generalEmulation.enableHiresNoiseDithering = settings.value("enableHiresNoiseDithering", config.generalEmulation.enableHiresNoiseDithering).toInt(); - config.generalEmulation.rdramImageDitheringMode = settings.value("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode).toInt(); - config.generalEmulation.enableLOD = settings.value("enableLOD", config.generalEmulation.enableLOD).toInt(); - config.generalEmulation.enableHWLighting = settings.value("enableHWLighting", config.generalEmulation.enableHWLighting).toInt(); - config.generalEmulation.enableCoverage = settings.value("enableCoverage", config.generalEmulation.enableCoverage).toInt(); - config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt(); - config.generalEmulation.enableLegacyBlending = settings.value("enableLegacyBlending", config.generalEmulation.enableLegacyBlending).toInt(); //ini only - config.generalEmulation.enableHybridFilter = settings.value("enableHybridFilter", config.generalEmulation.enableHybridFilter).toInt(); //ini only - config.generalEmulation.enableFragmentDepthWrite = settings.value("enableFragmentDepthWrite", config.generalEmulation.enableFragmentDepthWrite).toInt(); //ini only - config.generalEmulation.enableCustomSettings = settings.value("enableCustomSettings", config.generalEmulation.enableCustomSettings).toInt(); - settings.endGroup(); - - settings.beginGroup("graphics2D"); - config.graphics2D.correctTexrectCoords = settings.value("correctTexrectCoords", config.graphics2D.correctTexrectCoords).toInt(); - config.graphics2D.enableNativeResTexrects = settings.value("enableNativeResTexrects", config.graphics2D.enableNativeResTexrects).toInt(); - config.graphics2D.bgMode = settings.value("bgMode", config.graphics2D.bgMode).toInt(); - settings.endGroup(); - - settings.beginGroup("frameBufferEmulation"); - config.frameBufferEmulation.enable = settings.value("enable", config.frameBufferEmulation.enable).toInt(); - config.frameBufferEmulation.aspect = settings.value("aspect", config.frameBufferEmulation.aspect).toInt(); - config.frameBufferEmulation.nativeResFactor = settings.value("nativeResFactor", config.frameBufferEmulation.nativeResFactor).toInt(); - config.frameBufferEmulation.bufferSwapMode = settings.value("bufferSwapMode", config.frameBufferEmulation.bufferSwapMode).toInt(); - config.frameBufferEmulation.N64DepthCompare = settings.value("N64DepthCompare", config.frameBufferEmulation.N64DepthCompare).toInt(); - config.frameBufferEmulation.forceDepthBufferClear = settings.value("forceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear).toInt(); - config.frameBufferEmulation.copyAuxToRDRAM = settings.value("copyAuxToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM).toInt(); - config.frameBufferEmulation.copyToRDRAM = settings.value("copyToRDRAM", config.frameBufferEmulation.copyToRDRAM).toInt(); - config.frameBufferEmulation.copyDepthToRDRAM = settings.value("copyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM).toInt(); - config.frameBufferEmulation.copyFromRDRAM = settings.value("copyFromRDRAM", config.frameBufferEmulation.copyFromRDRAM).toInt(); - config.frameBufferEmulation.fbInfoDisabled = settings.value("fbInfoDisabled", config.frameBufferEmulation.fbInfoDisabled).toInt(); - config.frameBufferEmulation.fbInfoReadColorChunk = settings.value("fbInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk).toInt(); - config.frameBufferEmulation.fbInfoReadDepthChunk = settings.value("fbInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk).toInt(); - config.frameBufferEmulation.copyDepthToMainDepthBuffer = settings.value("copyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer).toInt(); - config.frameBufferEmulation.enableOverscan = settings.value("enableOverscan", config.frameBufferEmulation.enableOverscan).toInt(); - config.frameBufferEmulation.overscanPAL.left = settings.value("overscanPalLeft", config.frameBufferEmulation.overscanPAL.left).toInt(); - config.frameBufferEmulation.overscanPAL.right = settings.value("overscanPalRight", config.frameBufferEmulation.overscanPAL.right).toInt(); - config.frameBufferEmulation.overscanPAL.top = settings.value("overscanPalTop", config.frameBufferEmulation.overscanPAL.top).toInt(); - config.frameBufferEmulation.overscanPAL.bottom= settings.value("overscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom).toInt(); - config.frameBufferEmulation.overscanNTSC.left = settings.value("overscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left).toInt(); - config.frameBufferEmulation.overscanNTSC.right = settings.value("overscanNtscRight", config.frameBufferEmulation.overscanNTSC.right).toInt(); - config.frameBufferEmulation.overscanNTSC.top = settings.value("overscanNtscTop", config.frameBufferEmulation.overscanNTSC.top).toInt(); - config.frameBufferEmulation.overscanNTSC.bottom = settings.value("overscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom).toInt(); - settings.endGroup(); - - settings.beginGroup("textureFilter"); - config.textureFilter.txFilterMode = settings.value("txFilterMode", config.textureFilter.txFilterMode).toInt(); - config.textureFilter.txEnhancementMode = settings.value("txEnhancementMode", config.textureFilter.txEnhancementMode).toInt(); - config.textureFilter.txDeposterize = settings.value("txDeposterize", config.textureFilter.txDeposterize).toInt(); - config.textureFilter.txFilterIgnoreBG = settings.value("txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG).toInt(); - config.textureFilter.txCacheSize = settings.value("txCacheSize", config.textureFilter.txCacheSize).toInt(); - config.textureFilter.txHiresEnable = settings.value("txHiresEnable", config.textureFilter.txHiresEnable).toInt(); - config.textureFilter.txHiresFullAlphaChannel = settings.value("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel).toInt(); - config.textureFilter.txHresAltCRC = settings.value("txHresAltCRC", config.textureFilter.txHresAltCRC).toInt(); - config.textureFilter.txForce16bpp = settings.value("txForce16bpp", config.textureFilter.txForce16bpp).toInt(); - config.textureFilter.txCacheCompression = settings.value("txCacheCompression", config.textureFilter.txCacheCompression).toInt(); - config.textureFilter.txSaveCache = settings.value("txSaveCache", config.textureFilter.txSaveCache).toInt(); - config.textureFilter.txEnhancedTextureFileStorage = settings.value("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage).toInt(); - config.textureFilter.txHiresTextureFileStorage = settings.value("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage).toInt(); - wcscpy_s(config.textureFilter.txPath, ToUTF16(settings.value("txPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str()); - wcscpy_s(config.textureFilter.txCachePath, ToUTF16(settings.value("txCachePath", FromUTF16(config.textureFilter.txCachePath).c_str()).toString().c_str()).c_str()); - wcscpy_s(config.textureFilter.txDumpPath, ToUTF16(settings.value("txDumpPath", FromUTF16(config.textureFilter.txDumpPath).c_str()).toString().c_str()).c_str()); - settings.endGroup(); - - settings.beginGroup("font"); - config.font.name = settings.value("name", config.font.name.c_str()).toString(); - if (config.font.name.empty()) - config.font.name = "arial.ttf"; - config.font.size = settings.value("size", config.font.size).toInt(); - GlColor fontColor = settings.value("color", GlColor(config.font.color[0], config.font.color[1], config.font.color[2])).toGlColor(); - config.font.color[0] = fontColor.Red(); - config.font.color[1] = fontColor.Green(); - config.font.color[2] = fontColor.Blue(); - config.font.color[3] = fontColor.Alpha(); - config.font.colorf[0] = _FIXED2FLOAT(config.font.color[0], 8); - config.font.colorf[1] = _FIXED2FLOAT(config.font.color[1], 8); - config.font.colorf[2] = _FIXED2FLOAT(config.font.color[2], 8); - config.font.colorf[3] = config.font.color[3] == 0 ? 1.0f : _FIXED2FLOAT(config.font.color[3], 8); - settings.endGroup(); - - settings.beginGroup("gammaCorrection"); - config.gammaCorrection.force = settings.value("force", config.gammaCorrection.force).toInt(); - config.gammaCorrection.level = settings.value("level", config.gammaCorrection.level).toFloat(); - settings.endGroup(); - - settings.beginGroup("onScreenDisplay"); - config.onScreenDisplay.fps = settings.value("showFPS", config.onScreenDisplay.fps).toInt(); - config.onScreenDisplay.vis = settings.value("showVIS", config.onScreenDisplay.vis).toInt(); - config.onScreenDisplay.percent = settings.value("showPercent", config.onScreenDisplay.percent).toInt(); - config.onScreenDisplay.internalResolution = settings.value("showInternalResolution", config.onScreenDisplay.internalResolution).toInt(); - config.onScreenDisplay.renderingResolution = settings.value("showRenderingResolution", config.onScreenDisplay.renderingResolution).toInt(); - config.onScreenDisplay.statistics = settings.value("showStatistics", config.onScreenDisplay.statistics).toInt(); - config.onScreenDisplay.pos = settings.value("osdPos", config.onScreenDisplay.pos).toInt(); - settings.endGroup(); - - settings.beginGroup("debug"); - config.debug.dumpMode = settings.value("dumpMode", config.debug.dumpMode).toInt(); - settings.endGroup(); -} - -void loadSettings(const char * _strIniFolder) -{ - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - - bool rewriteSettings = false; - { - const u32 hacks = config.generalEmulation.hacks; - GlSettings settings(IniFileName.c_str()); - const u32 configVersion = settings.value("version", 0).toInt(); - config.resetToDefaults(); - config.generalEmulation.hacks = hacks; - config.translationFile = settings.value("translation", config.translationFile.c_str()).toString(); - if (configVersion < CONFIG_WITH_PROFILES) { - _loadSettings(settings); - config.version = CONFIG_VERSION_CURRENT; - settings.clear(); - settings.setValue("version", CONFIG_VERSION_CURRENT); - settings.setValue("profile", strUserProfile); - settings.setValue("translation", config.translationFile.c_str()); - settings.beginGroup(strUserProfile); - writeSettings(_strIniFolder); - settings.endGroup(); - } - std::string profile = settings.value("profile", strUserProfile).toString(); - GlSettings::sections childGroups = settings.childGroups(); - if (childGroups.find(profile.c_str()) != childGroups.end()) { - settings.beginGroup(profile.c_str()); - _loadSettings(settings); - settings.endGroup(); - } else - rewriteSettings = true; - if (config.version != CONFIG_VERSION_CURRENT) - rewriteSettings = true; - } - if (rewriteSettings) { - // Keep settings up-to-date - { - GlSettings settings(IniFileName.c_str()); - std::string profile = settings.value("profile", strUserProfile).toString(); - settings.remove(profile.c_str()); - } - config.version = CONFIG_VERSION_CURRENT; - writeSettings(_strIniFolder); - } -} - -void writeSettings(const char * _strIniFolder) -{ - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - - GlSettings settings(IniFileName.c_str()); - settings.setValue("version", config.version); - settings.setValue("translation", config.translationFile.c_str()); - std::string profile = settings.value("profile", strUserProfile).toString(); - if (profile.length() > 0) - { - settings.beginGroup(profile.c_str()); - settings.setValue("version", config.version); - - settings.beginGroup("video"); - settings.setValue("fullscreenWidth", config.video.fullscreenWidth); - settings.setValue("fullscreenHeight", config.video.fullscreenHeight); - settings.setValue("windowedWidth", config.video.windowedWidth); - settings.setValue("windowedHeight", config.video.windowedHeight); - settings.setValue("fullscreenRefresh", config.video.fullscreenRefresh); - settings.setValue("multisampling", config.video.multisampling); - settings.setValue("maxMultiSampling", config.video.maxMultiSampling); - settings.setValue("fxaa", config.video.fxaa); - settings.setValue("verticalSync", config.video.verticalSync); - settings.setValue("threadedVideo", config.video.threadedVideo); - settings.endGroup(); - - settings.beginGroup("texture"); - settings.setValue("maxAnisotropy", config.texture.maxAnisotropy); - settings.setValue("bilinearMode", config.texture.bilinearMode); - settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval); - settings.setValue("screenShotFormat", config.texture.screenShotFormat); - settings.endGroup(); - - settings.beginGroup("generalEmulation"); - settings.setValue("enableDitheringPattern", config.generalEmulation.enableDitheringPattern); - settings.setValue("enableDitheringQuantization", config.generalEmulation.enableDitheringQuantization); - settings.setValue("enableHiresNoiseDithering", config.generalEmulation.enableHiresNoiseDithering); - settings.setValue("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode); - settings.setValue("enableLOD", config.generalEmulation.enableLOD); - settings.setValue("enableHWLighting", config.generalEmulation.enableHWLighting); - settings.setValue("enableCoverage", config.generalEmulation.enableCoverage); - settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage); - settings.setValue("enableLegacyBlending", config.generalEmulation.enableLegacyBlending); //ini only - settings.setValue("enableHybridFilter", config.generalEmulation.enableHybridFilter); //ini only - settings.setValue("enableFragmentDepthWrite", config.generalEmulation.enableFragmentDepthWrite); //ini only - settings.setValue("enableCustomSettings", config.generalEmulation.enableCustomSettings); - settings.endGroup(); - - settings.beginGroup("graphics2D"); - settings.setValue("correctTexrectCoords", config.graphics2D.correctTexrectCoords); - settings.setValue("enableNativeResTexrects", config.graphics2D.enableNativeResTexrects); - settings.setValue("bgMode", config.graphics2D.bgMode); - settings.endGroup(); - - settings.beginGroup("frameBufferEmulation"); - settings.setValue("enable", config.frameBufferEmulation.enable); - settings.setValue("aspect", config.frameBufferEmulation.aspect); - settings.setValue("nativeResFactor", config.frameBufferEmulation.nativeResFactor); - settings.setValue("bufferSwapMode", config.frameBufferEmulation.bufferSwapMode); - settings.setValue("N64DepthCompare", config.frameBufferEmulation.N64DepthCompare); - settings.setValue("forceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear); - settings.setValue("copyAuxToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM); - settings.setValue("copyFromRDRAM", config.frameBufferEmulation.copyFromRDRAM); - settings.setValue("copyToRDRAM", config.frameBufferEmulation.copyToRDRAM); - settings.setValue("copyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM); - settings.setValue("fbInfoDisabled", config.frameBufferEmulation.fbInfoDisabled); - settings.setValue("fbInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk); - settings.setValue("fbInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk); - settings.setValue("copyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer); - settings.setValue("enableOverscan", config.frameBufferEmulation.enableOverscan); - settings.setValue("overscanPalLeft", config.frameBufferEmulation.overscanPAL.left); - settings.setValue("overscanPalRight", config.frameBufferEmulation.overscanPAL.right); - settings.setValue("overscanPalTop", config.frameBufferEmulation.overscanPAL.top); - settings.setValue("overscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom); - settings.setValue("overscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left); - settings.setValue("overscanNtscRight", config.frameBufferEmulation.overscanNTSC.right); - settings.setValue("overscanNtscTop", config.frameBufferEmulation.overscanNTSC.top); - settings.setValue("overscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom); - settings.endGroup(); - - settings.beginGroup("textureFilter"); - settings.setValue("txFilterMode", config.textureFilter.txFilterMode); - settings.setValue("txEnhancementMode", config.textureFilter.txEnhancementMode); - settings.setValue("txDeposterize", config.textureFilter.txDeposterize); - settings.setValue("txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG); - settings.setValue("txCacheSize", config.textureFilter.txCacheSize); - settings.setValue("txHiresEnable", config.textureFilter.txHiresEnable); - settings.setValue("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel); - settings.setValue("txHresAltCRC", config.textureFilter.txHresAltCRC); - settings.setValue("txForce16bpp", config.textureFilter.txForce16bpp); - settings.setValue("txCacheCompression", config.textureFilter.txCacheCompression); - settings.setValue("txSaveCache", config.textureFilter.txSaveCache); - settings.setValue("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage); - settings.setValue("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage); - settings.setValue("txPath", FromUTF16(config.textureFilter.txPath).c_str()); - settings.setValue("txCachePath", FromUTF16(config.textureFilter.txCachePath).c_str()); - settings.setValue("txDumpPath", FromUTF16(config.textureFilter.txDumpPath).c_str()); - settings.endGroup(); - - settings.beginGroup("font"); - settings.setValue("name", config.font.name.c_str()); - settings.setValue("size", config.font.size); - settings.setValue("color", GlColor(config.font.color[0], config.font.color[1], config.font.color[2], config.font.color[3])); - settings.endGroup(); - - settings.beginGroup("gammaCorrection"); - settings.setValue("force", config.gammaCorrection.force); - settings.setValue("level", config.gammaCorrection.level); - settings.endGroup(); - - settings.beginGroup("onScreenDisplay"); - settings.setValue("showFPS", config.onScreenDisplay.fps); - settings.setValue("showVIS", config.onScreenDisplay.vis); - settings.setValue("showPercent", config.onScreenDisplay.percent); - settings.setValue("showInternalResolution", config.onScreenDisplay.internalResolution); - settings.setValue("showRenderingResolution", config.onScreenDisplay.renderingResolution); - settings.setValue("osdPos", config.onScreenDisplay.pos); - settings.setValue("showStatistics", config.onScreenDisplay.statistics); - settings.endGroup(); - - settings.beginGroup("debug"); - settings.setValue("dumpMode", config.debug.dumpMode); - settings.endGroup(); - - settings.endGroup(); - } -} - -static -std::string _getRomName(const char * _strRomName) -{ - std::string RomName; - - enum { CP_SHIFT_JIS = 932 }; - int utf16size = MultiByteToWideChar(CP_SHIFT_JIS, MB_ERR_INVALID_CHARS, _strRomName, -1, 0, 0); - if (utf16size != 0) - { - std::unique_ptr pUTF16(new WCHAR[utf16size]); - if (MultiByteToWideChar(CP_SHIFT_JIS, 0, (LPCCH)_strRomName, -1, pUTF16.get(), utf16size) != 0) - { - std::wstring wsRomName(pUTF16.get(), utf16size); - std::transform(wsRomName.begin(), wsRomName.end(), wsRomName.begin(), (int(*)(int)) toupper); - std::string::size_type pos = wsRomName.find(L" "); - std::wstring replace = L"%20"; - while (pos != std::string::npos) - { - wsRomName.replace(pos, 1, replace); - pos = wsRomName.find(L" ", pos + replace.length()); - } - - int utf8size = ::WideCharToMultiByte(CP_UTF8, 0, wsRomName.c_str(), -1, 0, 0, 0, 0); - if (utf8size != 0) - { - std::unique_ptr pUTF8(new char[utf8size]); - if (::WideCharToMultiByte(CP_UTF8, 0, wsRomName.c_str(), -1, pUTF8.get(), utf8size, 0, 0) != 0) - { - RomName = std::string(pUTF8.get()); - } - } - } - } - return RomName; -} - -void loadCustomRomSettings(const char * _strIniFolder, const char * _strRomName) -{ - std::string CustomIniFileName = _strIniFolder; - CustomIniFileName += "/"; - CustomIniFileName += strCustomSettingsFileName; - - GlSettings settings(CustomIniFileName.c_str()); - GlSettings::sections childGroups = settings.childGroups(); - const std::string romName = _getRomName(_strRomName); - if (childGroups.find(romName.c_str()) == childGroups.end()) - return; - - settings.beginGroup(romName.c_str()); - _loadSettings(settings); - settings.endGroup(); - config.version = CONFIG_VERSION_CURRENT; -} - -void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName) -{ - Config origConfig; - origConfig.resetToDefaults(); - std::swap(config, origConfig); - loadSettings(_strIniFolder); - std::swap(config, origConfig); - - std::string CustomIniFileName = _strIniFolder; - CustomIniFileName += "/"; - CustomIniFileName += strCustomSettingsFileName; - - GlSettings settings(CustomIniFileName.c_str()); - const std::string romName = _getRomName(_strRomName); - -#define WriteCustomSetting(G, S) \ - if (origConfig.G.S != config.G.S || \ - origConfig.G.S != settings.value(#S, config.G.S).toInt()) \ - settings.setValue(#S, config.G.S) -#define WriteCustomSetting2(G, N, S) \ - if (origConfig.G.S != config.G.S || \ - origConfig.G.S != settings.value(#N, config.G.S).toInt()) \ - settings.setValue(#N, config.G.S) -#define WriteCustomSettingF(G, S) \ - if (origConfig.G.S != config.G.S || \ - origConfig.G.S != settings.value(#S, config.G.S).toFloat()) \ - settings.setValue(#S, config.G.S) -#define WriteCustomSettingS(S) \ - const std::string new##S = FromUTF16(config.textureFilter.S); \ - const std::string orig##S = FromUTF16(origConfig.textureFilter.S); \ - if (orig##S != new##S || \ - orig##S != settings.value(#S, new##S.c_str()).toString()) \ - settings.setValue(#S, new##S.c_str()) - - settings.beginGroup(romName.c_str()); - - settings.beginGroup("video"); - WriteCustomSetting(video, fullscreenWidth); - WriteCustomSetting(video, fullscreenHeight); - WriteCustomSetting(video, windowedWidth); - WriteCustomSetting(video, windowedHeight); - WriteCustomSetting(video, fullscreenRefresh); - WriteCustomSetting(video, multisampling); - WriteCustomSetting(video, fxaa); - WriteCustomSetting(video, verticalSync); - settings.endGroup(); - - settings.beginGroup("texture"); - WriteCustomSetting(texture, maxAnisotropy); - WriteCustomSetting(texture, bilinearMode); - WriteCustomSetting(texture, enableHalosRemoval); - WriteCustomSetting(texture, screenShotFormat); - settings.endGroup(); - - settings.beginGroup("generalEmulation"); - WriteCustomSetting(generalEmulation, enableDitheringPattern); - WriteCustomSetting(generalEmulation, enableDitheringQuantization); - WriteCustomSetting(generalEmulation, enableHiresNoiseDithering); - WriteCustomSetting(generalEmulation, rdramImageDitheringMode); - WriteCustomSetting(generalEmulation, enableLOD); - WriteCustomSetting(generalEmulation, enableHWLighting); - WriteCustomSetting(generalEmulation, enableCoverage); - WriteCustomSetting(generalEmulation, enableShadersStorage); - settings.endGroup(); - - settings.beginGroup("graphics2D"); - WriteCustomSetting(graphics2D, correctTexrectCoords); - WriteCustomSetting(graphics2D, enableNativeResTexrects); - WriteCustomSetting(graphics2D, bgMode); - settings.endGroup(); - - settings.beginGroup("frameBufferEmulation"); - WriteCustomSetting(frameBufferEmulation, enable); - WriteCustomSetting(frameBufferEmulation, aspect); - WriteCustomSetting(frameBufferEmulation, nativeResFactor); - WriteCustomSetting(frameBufferEmulation, bufferSwapMode); - WriteCustomSetting(frameBufferEmulation, N64DepthCompare); - WriteCustomSetting(frameBufferEmulation, forceDepthBufferClear); - WriteCustomSetting(frameBufferEmulation, copyAuxToRDRAM); - WriteCustomSetting(frameBufferEmulation, copyFromRDRAM); - WriteCustomSetting(frameBufferEmulation, copyToRDRAM); - WriteCustomSetting(frameBufferEmulation, copyDepthToRDRAM); - WriteCustomSetting(frameBufferEmulation, fbInfoDisabled); - WriteCustomSetting(frameBufferEmulation, fbInfoReadColorChunk); - WriteCustomSetting(frameBufferEmulation, fbInfoReadDepthChunk); - WriteCustomSetting(frameBufferEmulation, copyDepthToMainDepthBuffer); - WriteCustomSetting(frameBufferEmulation, enableOverscan); - WriteCustomSetting2(frameBufferEmulation, overscanPalLeft, overscanPAL.left); - WriteCustomSetting2(frameBufferEmulation, overscanPalRight, overscanPAL.right); - WriteCustomSetting2(frameBufferEmulation, overscanPalTop, overscanPAL.top); - WriteCustomSetting2(frameBufferEmulation, overscanPalBottom, overscanPAL.bottom); - WriteCustomSetting2(frameBufferEmulation, overscanNtscLeft, overscanNTSC.left); - WriteCustomSetting2(frameBufferEmulation, overscanNtscRight, overscanNTSC.right); - WriteCustomSetting2(frameBufferEmulation, overscanNtscTop, overscanNTSC.top); - WriteCustomSetting2(frameBufferEmulation, overscanNtscBottom, overscanNTSC.bottom); - settings.endGroup(); - - settings.beginGroup("textureFilter"); - WriteCustomSetting(textureFilter, txFilterMode); - WriteCustomSetting(textureFilter, txEnhancementMode); - WriteCustomSetting(textureFilter, txDeposterize); - WriteCustomSetting(textureFilter, txFilterIgnoreBG); - WriteCustomSetting(textureFilter, txCacheSize); - WriteCustomSetting(textureFilter, txEnhancedTextureFileStorage); - WriteCustomSetting(textureFilter, txHiresTextureFileStorage); - WriteCustomSetting(textureFilter, txHiresEnable); - WriteCustomSetting(textureFilter, txHiresFullAlphaChannel); - WriteCustomSetting(textureFilter, txHresAltCRC); - WriteCustomSetting(textureFilter, txForce16bpp); - WriteCustomSetting(textureFilter, txCacheCompression); - WriteCustomSetting(textureFilter, txSaveCache); - WriteCustomSettingS(txPath); - WriteCustomSettingS(txCachePath); - WriteCustomSettingS(txDumpPath); - settings.endGroup(); - - settings.beginGroup("gammaCorrection"); - WriteCustomSetting(gammaCorrection, force); - WriteCustomSettingF(gammaCorrection, level); - settings.endGroup(); - - settings.beginGroup("onScreenDisplay"); - WriteCustomSetting2(onScreenDisplay, showFPS, fps); - WriteCustomSetting2(onScreenDisplay, showVIS, vis); - WriteCustomSetting2(onScreenDisplay, showPercent, percent); - WriteCustomSetting2(onScreenDisplay, showInternalResolution, internalResolution); - WriteCustomSetting2(onScreenDisplay, showRenderingResolution, renderingResolution); - WriteCustomSetting2(onScreenDisplay, osdPos, pos); - settings.endGroup(); - - settings.endGroup(); -} - -std::string getTranslationFile() -{ - return config.translationFile.c_str(); -} - -ProfileList getProfiles(const char * _strIniFolder) -{ - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - GlSettings settings(IniFileName.c_str()); - GlSettings::sections children = settings.childGroups(); - - ProfileList profiles; - for (GlSettings::sections::const_iterator itr = children.begin(); itr != children.end(); itr++) - { - profiles.insert(itr->c_str()); - } - return profiles; -} - -std::string getCurrentProfile(const char * _strIniFolder) -{ - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - GlSettings settings(IniFileName.c_str()); - return settings.value("profile", strUserProfile).toString(); -} - -void changeProfile(const char * _strIniFolder, const char * _strProfile) -{ - { - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - - GlSettings settings(IniFileName.c_str()); - settings.setValue("profile", _strProfile); - } - loadSettings(_strIniFolder); -} - -void addProfile(const char * _strIniFolder, const char * _strProfile) -{ - { - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - - GlSettings settings(IniFileName.c_str()); - settings.setValue("profile", _strProfile); - } - writeSettings(_strIniFolder); -} - -void removeProfile(const char * _strIniFolder, const char * _strProfile) -{ - std::string IniFileName = _strIniFolder; - IniFileName += "/"; - IniFileName += strIniFileName; - - GlSettings settings(IniFileName.c_str()); - settings.remove(_strProfile); -} diff --git a/GLideN64/src/GLideNUI-wtl/Settings.h b/GLideN64/src/GLideNUI-wtl/Settings.h deleted file mode 100644 index 97a81a2..0000000 --- a/GLideN64/src/GLideNUI-wtl/Settings.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#include -#include -typedef std::set ProfileList; - -void loadSettings(const char * _strIniFolder); -void writeSettings(const char * _strIniFolder); -void loadCustomRomSettings(const char * _strIniFolder, const char * _strRomName); -void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName); -std::string getTranslationFile(); -ProfileList getProfiles(const char * _strIniFolder); -std::string getCurrentProfile(const char * _strIniFolder); -void changeProfile(const char * _strIniFolder, const char * _strProfile); -void addProfile(const char * _strIniFolder, const char * _strProfile); -void removeProfile(const char * _strIniFolder, const char * _strProfile); diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlapp.h b/GLideN64/src/GLideNUI-wtl/WTL/atlapp.h deleted file mode 100644 index 742a6f6..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlapp.h +++ /dev/null @@ -1,2125 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLAPP_H__ -#define __ATLAPP_H__ - -#pragma once - -#ifndef __cplusplus - #error WTL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLBASE_H__ - #error atlapp.h requires atlbase.h to be included first -#endif - -#ifndef _WIN32_WCE - #if (WINVER < 0x0400) - #error WTL requires Windows version 4.0 or higher - #endif - - #if (_WIN32_IE < 0x0300) - #error WTL requires IE version 3.0 or higher - #endif -#endif - -#ifdef _ATL_NO_COMMODULE - #error WTL requires that _ATL_NO_COMMODULE is not defined -#endif - -#if (_ATL_VER >= 0x0900) && defined(_ATL_MIN_CRT) - #error _ATL_MIN_CRT is not supported with ATL 9.0 and higher -#endif - -#if defined(_WIN32_WCE) && defined(_ATL_MIN_CRT) - #pragma message("Warning: WTL for Windows CE doesn't use _ATL_MIN_CRT") -#endif - -#include -#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) - #include // for _beginthreadex -#endif - -#if (_ATL_VER < 0x0800) && !defined(_DEBUG) - #include -#endif - -#include -#ifndef _WIN32_WCE - #pragma comment(lib, "comctl32.lib") -#endif - -#ifndef _WIN32_WCE - #include "atlres.h" -#else // CE specific - #include "atlresce.h" -#endif // _WIN32_WCE - -// We need to disable this warning because of template class arguments -#pragma warning(disable: 4127) - -#if (_ATL_VER >= 0x0900) && !defined(_SECURE_ATL) - #define _SECURE_ATL 1 -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// WTL version number - -#define _WTL_VER 0x0810 - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CMessageFilter -// CIdleHandler -// CMessageLoop -// -// CAppModule -// CServerAppModule -// -// CRegKeyEx -// -// Global functions: -// AtlGetDefaultGuiFont() -// AtlCreateControlFont() -// AtlCreateBoldFont() -// AtlInitCommonControls() - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for Windows CE - -#ifdef _WIN32_WCE - -#ifndef SW_SHOWDEFAULT - #define SW_SHOWDEFAULT SW_SHOWNORMAL -#endif // !SW_SHOWDEFAULT - -// These get's OR-ed in a constant and will have no effect. -// Defining them reduces the number of #ifdefs required for CE. -#define LR_DEFAULTSIZE 0 -#define LR_LOADFROMFILE 0 - -#ifndef SM_CXCURSOR - #define SM_CXCURSOR 13 -#endif -#ifndef SM_CYCURSOR - #define SM_CYCURSOR 14 -#endif - -inline BOOL IsMenu(HMENU hMenu) -{ - MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; - ::SetLastError(0); - BOOL bRet = ::GetMenuItemInfo(hMenu, 0, TRUE, &mii); - if(!bRet) - bRet = (::GetLastError() != ERROR_INVALID_MENU_HANDLE) ? TRUE : FALSE; - return bRet; -} - -#if (_WIN32_WCE >= 410) -extern "C" void WINAPI ListView_SetItemSpacing(HWND hwndLV, int iHeight); -#endif // (_WIN32_WCE >= 410) - -inline int MulDiv(IN int nNumber, IN int nNumerator, IN int nDenominator) -{ - __int64 multiple = nNumber * nNumerator; - return static_cast(multiple / nDenominator); -} - -#if (_ATL_VER >= 0x0800) - -#ifndef _WTL_KEEP_WS_OVERLAPPEDWINDOW - #ifdef WS_OVERLAPPEDWINDOW - #undef WS_OVERLAPPEDWINDOW - #define WS_OVERLAPPEDWINDOW 0 - #endif // WS_OVERLAPPEDWINDOW -#endif // !_WTL_KEEP_WS_OVERLAPPEDWINDOW - -#ifndef RDW_FRAME - #define RDW_FRAME 0 -#endif // !RDW_FRAME - -#ifndef WM_WINDOWPOSCHANGING - #define WM_WINDOWPOSCHANGING 0 -#endif // !WM_WINDOWPOSCHANGING - -#define FreeResource(x) -#define UnlockResource(x) - -namespace ATL -{ - inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw() - { return E_NOTIMPL; } - inline HRESULT CComModule::RevokeClassObjects() throw() - { return E_NOTIMPL; } -}; // namespace ATL - -#ifndef lstrlenW - #define lstrlenW (int)ATL::lstrlenW -#endif // lstrlenW - -inline int WINAPI lstrlenA(LPCSTR lpszString) -{ return ATL::lstrlenA(lpszString); } - -#ifdef lstrcpyn - #undef lstrcpyn - #define lstrcpyn ATL::lstrcpynW -#endif // lstrcpyn - -#ifndef SetWindowLongPtrW - inline LONG_PTR tmp_SetWindowLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) - { - return( ::SetWindowLongW( hWnd, nIndex, LONG( dwNewLong ) ) ); - } - #define SetWindowLongPtrW tmp_SetWindowLongPtrW -#endif - -#ifndef GetWindowLongPtrW - inline LONG_PTR tmp_GetWindowLongPtrW( HWND hWnd, int nIndex ) - { - return( ::GetWindowLongW( hWnd, nIndex ) ); - } - #define GetWindowLongPtrW tmp_GetWindowLongPtrW -#endif - -#ifndef LongToPtr - #define LongToPtr(x) ((void*)x) -#endif - -#ifndef PtrToInt - #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) -#endif - -#else // !(_ATL_VER >= 0x0800) - -#ifdef lstrlenW - #undef lstrlenW - #define lstrlenW (int)::wcslen -#endif // lstrlenW - -#define lstrlenA (int)strlen - -#ifndef lstrcpyn - inline LPTSTR lstrcpyn(LPTSTR lpstrDest, LPCTSTR lpstrSrc, int nLength) - { - if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) - return NULL; - int nLen = min(lstrlen(lpstrSrc), nLength - 1); - LPTSTR lpstrRet = (LPTSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(TCHAR)); - lpstrDest[nLen] = 0; - return lpstrRet; - } -#endif // !lstrcpyn - -#ifndef lstrcpynW - inline LPWSTR lstrcpynW(LPWSTR lpstrDest, LPCWSTR lpstrSrc, int nLength) - { - return lstrcpyn(lpstrDest, lpstrSrc, nLength); // WinCE is Unicode only - } -#endif // !lstrcpynW - -#ifndef lstrcpynA - inline LPSTR lstrcpynA(LPSTR lpstrDest, LPCSTR lpstrSrc, int nLength) - { - if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) - return NULL; - int nLen = min(lstrlenA(lpstrSrc), nLength - 1); - LPSTR lpstrRet = (LPSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(char)); - lpstrDest[nLen] = 0; - return lpstrRet; - } -#endif // !lstrcpyn - -#ifdef TrackPopupMenu - #undef TrackPopupMenu -#endif // TrackPopupMenu - -#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \ -static CWndClassInfo& GetWndClassInfo() \ -{ \ - static CWndClassInfo wc = \ - { \ - { style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \ - }; \ - return wc; \ -} - -#ifndef _MAX_FNAME - #define _MAX_FNAME _MAX_PATH -#endif // _MAX_FNAME - -#if (_WIN32_WCE < 400) - #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) -#endif // (_WIN32_WCE < 400) - -#if (_WIN32_WCE < 410) - #define WHEEL_PAGESCROLL (UINT_MAX) - #define WHEEL_DELTA 120 -#endif // (_WIN32_WCE < 410) - -#ifdef DrawIcon - #undef DrawIcon -#endif - -#ifndef VARCMP_LT - #define VARCMP_LT 0 -#endif -#ifndef VARCMP_EQ - #define VARCMP_EQ 1 -#endif -#ifndef VARCMP_GT - #define VARCMP_GT 2 -#endif -#ifndef VARCMP_NULL - #define VARCMP_NULL 3 -#endif - -#ifndef RDW_ALLCHILDREN - #define RDW_ALLCHILDREN 0 -#endif - -#endif // !(_ATL_VER >= 0x0800) - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for using original VC++ 6.0 headers with WTL - -#ifndef _ATL_NO_OLD_HEADERS_WIN64 -#if !defined(_WIN64) && (_ATL_VER < 0x0700) - - #ifndef PSM_INSERTPAGE - #define PSM_INSERTPAGE (WM_USER + 119) - #endif // !PSM_INSERTPAGE - - #ifndef GetClassLongPtr - #define GetClassLongPtrA GetClassLongA - #define GetClassLongPtrW GetClassLongW - #ifdef UNICODE - #define GetClassLongPtr GetClassLongPtrW - #else - #define GetClassLongPtr GetClassLongPtrA - #endif // !UNICODE - #endif // !GetClassLongPtr - - #ifndef GCLP_HICONSM - #define GCLP_HICONSM (-34) - #endif // !GCLP_HICONSM - - #ifndef GetWindowLongPtr - #define GetWindowLongPtrA GetWindowLongA - #define GetWindowLongPtrW GetWindowLongW - #ifdef UNICODE - #define GetWindowLongPtr GetWindowLongPtrW - #else - #define GetWindowLongPtr GetWindowLongPtrA - #endif // !UNICODE - #endif // !GetWindowLongPtr - - #ifndef SetWindowLongPtr - #define SetWindowLongPtrA SetWindowLongA - #define SetWindowLongPtrW SetWindowLongW - #ifdef UNICODE - #define SetWindowLongPtr SetWindowLongPtrW - #else - #define SetWindowLongPtr SetWindowLongPtrA - #endif // !UNICODE - #endif // !SetWindowLongPtr - - #ifndef GWLP_WNDPROC - #define GWLP_WNDPROC (-4) - #endif - #ifndef GWLP_HINSTANCE - #define GWLP_HINSTANCE (-6) - #endif - #ifndef GWLP_HWNDPARENT - #define GWLP_HWNDPARENT (-8) - #endif - #ifndef GWLP_USERDATA - #define GWLP_USERDATA (-21) - #endif - #ifndef GWLP_ID - #define GWLP_ID (-12) - #endif - - #ifndef DWLP_MSGRESULT - #define DWLP_MSGRESULT 0 - #endif - - typedef long LONG_PTR; - typedef unsigned long ULONG_PTR; - typedef ULONG_PTR DWORD_PTR; - - #ifndef HandleToUlong - #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) ) - #endif - #ifndef HandleToLong - #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) - #endif - #ifndef LongToHandle - #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h)) - #endif - #ifndef PtrToUlong - #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) - #endif - #ifndef PtrToLong - #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) ) - #endif - #ifndef PtrToUint - #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) - #endif - #ifndef PtrToInt - #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) - #endif - #ifndef PtrToUshort - #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) - #endif - #ifndef PtrToShort - #define PtrToShort( p ) ((short)(LONG_PTR)(p) ) - #endif - #ifndef IntToPtr - #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i)) - #endif - #ifndef UIntToPtr - #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui)) - #endif - #ifndef LongToPtr - #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l)) - #endif - #ifndef ULongToPtr - #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul)) - #endif - -#endif // !defined(_WIN64) && (_ATL_VER < 0x0700) -#endif // !_ATL_NO_OLD_HEADERS_WIN64 - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for SecureHelper functions - -#ifndef _TRUNCATE - #define _TRUNCATE ((size_t)-1) -#endif - -#ifndef _ERRCODE_DEFINED - #define _ERRCODE_DEFINED - typedef int errno_t; -#endif - -#ifndef _SECURECRT_ERRCODE_VALUES_DEFINED - #define _SECURECRT_ERRCODE_VALUES_DEFINED - #define EINVAL 22 - #define STRUNCATE 80 -#endif - -#ifndef _countof - #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Miscellaneous global support - -// define useful macros from winuser.h -#ifndef IS_INTRESOURCE - #define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0) -#endif // IS_INTRESOURCE - -// protect template members from windowsx.h macros -#ifdef _INC_WINDOWSX - #undef SubclassWindow -#endif // _INC_WINDOWSX - -// define useful macros from windowsx.h -#ifndef GET_X_LPARAM - #define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam)) -#endif -#ifndef GET_Y_LPARAM - #define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam)) -#endif - -// Dummy structs for compiling with /CLR -#if (_MSC_VER >= 1300) && defined(_MANAGED) - __if_not_exists(_IMAGELIST::_IMAGELIST) { struct _IMAGELIST { }; } - __if_not_exists(_TREEITEM::_TREEITEM) { struct _TREEITEM { }; } - __if_not_exists(_PSP::_PSP) { struct _PSP { }; } -#endif - -// Define ATLVERIFY macro for ATL3 -#if (_ATL_VER < 0x0700) - #ifndef ATLVERIFY - #ifdef _DEBUG - #define ATLVERIFY(expr) ATLASSERT(expr) - #else - #define ATLVERIFY(expr) (expr) - #endif // DEBUG - #endif // ATLVERIFY -#endif // (_ATL_VER < 0x0700) - -// Forward declaration for ATL3 and ATL11 fix -#if (((_ATL_VER < 0x0700) && defined(_ATL_DLL)) || (_ATL_VER >= 0x0B00)) && !defined(_WIN32_WCE) - namespace ATL { HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); }; -#endif - -#ifndef WM_MOUSEHWHEEL - #define WM_MOUSEHWHEEL 0x020E -#endif - - -namespace WTL -{ - -#if (_ATL_VER >= 0x0700) - DECLARE_TRACE_CATEGORY(atlTraceUI); - #ifdef _DEBUG - __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI")); - #endif // _DEBUG -#else // !(_ATL_VER >= 0x0700) - enum wtlTraceFlags - { - atlTraceUI = 0x10000000 - }; -#endif // !(_ATL_VER >= 0x0700) - -// Windows version helper -inline bool AtlIsOldWindows() -{ - OSVERSIONINFO ovi = { 0 }; - ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - BOOL bRet = ::GetVersionEx(&ovi); - return (!bRet || !((ovi.dwMajorVersion >= 5) || (ovi.dwMajorVersion == 4 && ovi.dwMinorVersion >= 90))); -} - -// Default GUI font helper - "MS Shell Dlg" stock font -inline HFONT AtlGetDefaultGuiFont() -{ -#ifndef _WIN32_WCE - return (HFONT)::GetStockObject(DEFAULT_GUI_FONT); -#else // CE specific - return (HFONT)::GetStockObject(SYSTEM_FONT); -#endif // _WIN32_WCE -} - -// Control font helper - default font for controls not in a dialog -// (NOTE: Caller owns the font, and should destroy it when it's no longer needed) -inline HFONT AtlCreateControlFont() -{ -#ifndef _WIN32_WCE - LOGFONT lf = { 0 }; - ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); - HFONT hFont = ::CreateFontIndirect(&lf); - ATLASSERT(hFont != NULL); - return hFont; -#else // CE specific - return (HFONT)::GetStockObject(SYSTEM_FONT); -#endif // _WIN32_WCE -} - -// Bold font helper -// (NOTE: Caller owns the font, and should destroy it when it's no longer needed) -inline HFONT AtlCreateBoldFont(HFONT hFont = NULL) -{ - LOGFONT lf = { 0 }; -#ifndef _WIN32_WCE - if(hFont == NULL) - ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); - else - ATLVERIFY(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)); -#else // CE specific - if(hFont == NULL) - hFont = (HFONT)::GetStockObject(SYSTEM_FONT); - ATLVERIFY(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)); -#endif // _WIN32_WCE - lf.lfWeight = FW_BOLD; - HFONT hFontBold = ::CreateFontIndirect(&lf); - ATLASSERT(hFontBold != NULL); - return hFontBold; -} - -// Common Controls initialization helper -inline BOOL AtlInitCommonControls(DWORD dwFlags) -{ - INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), dwFlags }; - BOOL bRet = ::InitCommonControlsEx(&iccx); - ATLASSERT(bRet); - return bRet; -} - - -/////////////////////////////////////////////////////////////////////////////// -// RunTimeHelper - helper functions for Windows version and structure sizes - -// Not for Windows CE -#if defined(_WIN32_WCE) && !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) - #define _WTL_NO_RUNTIME_STRUCT_SIZE -#endif - -#ifndef _WTL_NO_RUNTIME_STRUCT_SIZE - -#ifndef _SIZEOF_STRUCT - #define _SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) -#endif - -#if (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) - #define REBARBANDINFO_V6_SIZE _SIZEOF_STRUCT(REBARBANDINFO, cxHeader) -#endif // (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) - -#if (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) - #define LVGROUP_V5_SIZE _SIZEOF_STRUCT(LVGROUP, uAlign) -#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) - -#if (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) - #define LVTILEINFO_V5_SIZE _SIZEOF_STRUCT(LVTILEINFO, puColumns) -#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) - #define MCHITTESTINFO_V1_SIZE _SIZEOF_STRUCT(MCHITTESTINFO, st) -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) - -#if !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) - #define NONCLIENTMETRICS_V1_SIZE _SIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont) -#endif // !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) - -#endif // !_WTL_NO_RUNTIME_STRUCT_SIZE - -namespace RunTimeHelper -{ -#ifndef _WIN32_WCE - inline bool IsCommCtrl6() - { - DWORD dwMajor = 0, dwMinor = 0; - HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - return (SUCCEEDED(hRet) && (dwMajor >= 6)); - } - - inline bool IsVista() - { - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - BOOL bRet = ::GetVersionEx(&ovi); - return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6)); - } - - inline bool IsThemeAvailable() - { - bool bRet = false; - - if(IsCommCtrl6()) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(hThemeDLL != NULL) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsThemeActive)(); - PFN_IsThemeActive pfnIsThemeActive = (PFN_IsThemeActive)::GetProcAddress(hThemeDLL, "IsThemeActive"); - ATLASSERT(pfnIsThemeActive != NULL); - bRet = (pfnIsThemeActive != NULL) && (pfnIsThemeActive() != FALSE); - if(bRet) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsAppThemed)(); - PFN_IsAppThemed pfnIsAppThemed = (PFN_IsAppThemed)::GetProcAddress(hThemeDLL, "IsAppThemed"); - ATLASSERT(pfnIsAppThemed != NULL); - bRet = (pfnIsAppThemed != NULL) && (pfnIsAppThemed() != FALSE); - } - - ::FreeLibrary(hThemeDLL); - } - } - - return bRet; - } - - inline bool IsWin7() - { - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - BOOL bRet = ::GetVersionEx(&ovi); - return ((bRet != FALSE) && (ovi.dwMajorVersion == 6) && (ovi.dwMinorVersion >= 1)); - } - - inline bool IsRibbonUIAvailable() - { - static INT iRibbonUI = -1; - -#if defined(NTDDI_WIN7) && (NTDDI_VERSION >= NTDDI_WIN7) - if (iRibbonUI == -1) - { - HMODULE hRibbonDLL = ::LoadLibrary(_T("propsys.dll")); - if (hRibbonDLL != NULL) - { - const GUID CLSID_UIRibbonFramework = { 0x926749fa, 0x2615, 0x4987, { 0x88, 0x45, 0xc3, 0x3e, 0x65, 0xf2, 0xb9, 0x57 } }; - // block - create instance - { - ATL::CComPtr pIUIFramework; - iRibbonUI = SUCCEEDED(pIUIFramework.CoCreateInstance(CLSID_UIRibbonFramework)) ? 1 : 0; - } - ::FreeLibrary(hRibbonDLL); - } - else - { - iRibbonUI = 0; - } - } -#endif // defined(NTDDI_WIN7) && (NTDDI_VERSION >= NTDDI_WIN7) - - return (iRibbonUI == 1); - } - -#endif // !_WIN32_WCE - - inline int SizeOf_REBARBANDINFO() - { - int nSize = sizeof(REBARBANDINFO); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - if(!(IsVista() && IsCommCtrl6())) - nSize = REBARBANDINFO_V6_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; - } - -#if (_WIN32_WINNT >= 0x501) - inline int SizeOf_LVGROUP() - { - int nSize = sizeof(LVGROUP); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - if(!IsVista()) - nSize = LVGROUP_V5_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; - } - - inline int SizeOf_LVTILEINFO() - { - int nSize = sizeof(LVTILEINFO); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - if(!IsVista()) - nSize = LVTILEINFO_V5_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; - } -#endif // (_WIN32_WINNT >= 0x501) - - inline int SizeOf_MCHITTESTINFO() - { - int nSize = sizeof(MCHITTESTINFO); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - if(!(IsVista() && IsCommCtrl6())) - nSize = MCHITTESTINFO_V1_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - return nSize; - } - -#ifndef _WIN32_WCE - inline int SizeOf_NONCLIENTMETRICS() - { - int nSize = sizeof(NONCLIENTMETRICS); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) - if(!IsVista()) - nSize = NONCLIENTMETRICS_V1_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) - return nSize; - } -#endif // !_WIN32_WCE -}; - - -/////////////////////////////////////////////////////////////////////////////// -// ModuleHelper - helper functions for ATL3 and ATL7 module classes - -namespace ModuleHelper -{ - inline HINSTANCE GetModuleInstance() - { -#if (_ATL_VER >= 0x0700) - return ATL::_AtlBaseModule.GetModuleInstance(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->GetModuleInstance(); -#endif // !(_ATL_VER >= 0x0700) - } - - inline HINSTANCE GetResourceInstance() - { -#if (_ATL_VER >= 0x0700) - return ATL::_AtlBaseModule.GetResourceInstance(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->GetResourceInstance(); -#endif // !(_ATL_VER >= 0x0700) - } - - inline void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject) - { -#if (_ATL_VER >= 0x0700) - ATL::_AtlWinModule.AddCreateWndData(pData, pObject); -#else // !(_ATL_VER >= 0x0700) - ATL::_pModule->AddCreateWndData(pData, pObject); -#endif // !(_ATL_VER >= 0x0700) - } - - inline void* ExtractCreateWndData() - { -#if (_ATL_VER >= 0x0700) - return ATL::_AtlWinModule.ExtractCreateWndData(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->ExtractCreateWndData(); -#endif // !(_ATL_VER >= 0x0700) - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// SecureHelper - helper functions for VS2005 secure CRT - -namespace SecureHelper -{ - inline void strcpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::strcpy_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenA(lpstrSrc)) - ATLVERIFY(lstrcpyA(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::wcscpy_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenW(lpstrSrc)) - ATLVERIFY(lstrcpyW(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) - { -#ifdef _UNICODE - strcpyW_x(lpstrDest, cchDest, lpstrSrc); -#else - strcpyA_x(lpstrDest, cchDest, lpstrSrc); -#endif - } - - inline errno_t strncpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc, size_t cchCount) - { -#if _SECURE_ATL - return ATL::Checked::strncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - errno_t nRet = 0; - if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) - { - nRet = EINVAL; - } - else if(cchCount == _TRUNCATE) - { - cchCount = min(cchDest - 1, size_t(lstrlenA(lpstrSrc))); - nRet = STRUNCATE; - } - else if(cchDest <= cchCount) - { - lpstrDest[0] = 0; - nRet = EINVAL; - } - if(nRet == 0 || nRet == STRUNCATE) - nRet = (lstrcpynA(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; - ATLASSERT(nRet == 0 || nRet == STRUNCATE); - return nRet; -#endif - } - - inline errno_t strncpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc, size_t cchCount) - { -#if _SECURE_ATL - return ATL::Checked::wcsncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - errno_t nRet = 0; - if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) - { - nRet = EINVAL; - } - else if(cchCount == _TRUNCATE) - { - cchCount = min(cchDest - 1, size_t(lstrlenW(lpstrSrc))); - nRet = STRUNCATE; - } - else if(cchDest <= cchCount) - { - lpstrDest[0] = 0; - nRet = EINVAL; - } - if(nRet == 0 || nRet == STRUNCATE) - nRet = (lstrcpynW(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; - ATLASSERT(nRet == 0 || nRet == STRUNCATE); - return nRet; -#endif - } - - inline errno_t strncpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc, size_t cchCount) - { -#ifdef _UNICODE - return strncpyW_x(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - return strncpyA_x(lpstrDest, cchDest, lpstrSrc, cchCount); -#endif - } - - inline void strcatA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::strcat_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenA(lpstrSrc)) - ATLVERIFY(lstrcatA(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcatW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::wcscat_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenW(lpstrSrc)) - ATLVERIFY(lstrcatW(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcat_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) - { -#ifdef _UNICODE - strcatW_x(lpstrDest, cchDest, lpstrSrc); -#else - strcatA_x(lpstrDest, cchDest, lpstrSrc); -#endif - } - - inline void memcpy_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) - { -#if _SECURE_ATL - ATL::Checked::memcpy_s(pDest, cbDest, pSrc, cbSrc); -#else - if(cbDest >= cbSrc) - memcpy(pDest, pSrc, cbSrc); - else - ATLASSERT(FALSE); -#endif - } - - inline void memmove_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) - { -#if _SECURE_ATL - ATL::Checked::memmove_s(pDest, cbDest, pSrc, cbSrc); -#else - if(cbDest >= cbSrc) - memmove(pDest, pSrc, cbSrc); - else - ATLASSERT(FALSE); -#endif - } - - inline int vsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) - { -#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) - return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); -#else - cchBuff; // Avoid unused argument warning -#pragma warning(disable: 4996) - return _vstprintf(lpstrBuff, lpstrFormat, args); -#pragma warning(default: 4996) -#endif - } - - inline int wvsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) - { -#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) - return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); -#else - cchBuff; // Avoid unused argument warning - return ::wvsprintf(lpstrBuff, lpstrFormat, args); -#endif - } - - inline int sprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) - { - va_list args; - va_start(args, lpstrFormat); - int nRes = vsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); - va_end(args); - return nRes; - } - - inline int wsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) - { - va_list args; - va_start(args, lpstrFormat); - int nRes = wvsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); - va_end(args); - return nRes; - } -}; // namespace SecureHelper - - -/////////////////////////////////////////////////////////////////////////////// -// MinCrtHelper - helper functions for using _ATL_MIN_CRT - -namespace MinCrtHelper -{ - inline int _isspace(TCHAR ch) - { -#ifndef _ATL_MIN_CRT - return _istspace(ch); -#else // _ATL_MIN_CRT - WORD type = 0; - ::GetStringTypeEx(::GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); - return (type & C1_SPACE) == C1_SPACE; -#endif // _ATL_MIN_CRT - } - - inline int _isdigit(TCHAR ch) - { -#ifndef _ATL_MIN_CRT - return _istdigit(ch); -#else // _ATL_MIN_CRT - WORD type = 0; - ::GetStringTypeEx(::GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); - return (type & C1_DIGIT) == C1_DIGIT; -#endif // _ATL_MIN_CRT - } - - inline int _atoi(LPCTSTR str) - { -#ifndef _ATL_MIN_CRT - return _ttoi(str); -#else // _ATL_MIN_CRT - while(_isspace(*str) != 0) - ++str; - - TCHAR ch = *str++; - TCHAR sign = ch; // save sign indication - if(ch == _T('-') || ch == _T('+')) - ch = *str++; // skip sign - - int total = 0; - while(_isdigit(ch) != 0) - { - total = 10 * total + (ch - '0'); // accumulate digit - ch = *str++; // get next char - } - - return (sign == '-') ? -total : total; // return result, negated if necessary -#endif // _ATL_MIN_CRT - } - - inline LPCTSTR _strrchr(LPCTSTR str, TCHAR ch) - { -#ifndef _ATL_MIN_CRT - return _tcsrchr(str, ch); -#else // _ATL_MIN_CRT - LPCTSTR lpsz = NULL; - while(*str != 0) - { - if(*str == ch) - lpsz = str; - str = ::CharNext(str); - } - return lpsz; -#endif // _ATL_MIN_CRT - } - - inline LPTSTR _strrchr(LPTSTR str, TCHAR ch) - { -#ifndef _ATL_MIN_CRT - return _tcsrchr(str, ch); -#else // _ATL_MIN_CRT - LPTSTR lpsz = NULL; - while(*str != 0) - { - if(*str == ch) - lpsz = str; - str = ::CharNext(str); - } - return lpsz; -#endif // _ATL_MIN_CRT - } -}; // namespace MinCrtHelper - - -/////////////////////////////////////////////////////////////////////////////// -// CMessageFilter - Interface for message filter support - -class CMessageFilter -{ -public: - virtual BOOL PreTranslateMessage(MSG* pMsg) = 0; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CIdleHandler - Interface for idle processing - -class CIdleHandler -{ -public: - virtual BOOL OnIdle() = 0; -}; - -#ifndef _ATL_NO_OLD_NAMES - // for compatilibility with old names only - typedef CIdleHandler CUpdateUIObject; - #define DoUpdate OnIdle -#endif // !_ATL_NO_OLD_NAMES - - -/////////////////////////////////////////////////////////////////////////////// -// CMessageLoop - message loop implementation - -class CMessageLoop -{ -public: - ATL::CSimpleArray m_aMsgFilter; - ATL::CSimpleArray m_aIdleHandler; - MSG m_msg; - -// Message filter operations - BOOL AddMessageFilter(CMessageFilter* pMessageFilter) - { - return m_aMsgFilter.Add(pMessageFilter); - } - - BOOL RemoveMessageFilter(CMessageFilter* pMessageFilter) - { - return m_aMsgFilter.Remove(pMessageFilter); - } - -// Idle handler operations - BOOL AddIdleHandler(CIdleHandler* pIdleHandler) - { - return m_aIdleHandler.Add(pIdleHandler); - } - - BOOL RemoveIdleHandler(CIdleHandler* pIdleHandler) - { - return m_aIdleHandler.Remove(pIdleHandler); - } - -#ifndef _ATL_NO_OLD_NAMES - // for compatilibility with old names only - BOOL AddUpdateUI(CIdleHandler* pIdleHandler) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and AddUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); - return AddIdleHandler(pIdleHandler); - } - - BOOL RemoveUpdateUI(CIdleHandler* pIdleHandler) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and RemoveUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); - return RemoveIdleHandler(pIdleHandler); - } -#endif // !_ATL_NO_OLD_NAMES - -// message loop - int Run() - { - BOOL bDoIdle = TRUE; - int nIdleCount = 0; - BOOL bRet; - - for(;;) - { - while(bDoIdle && !::PeekMessage(&m_msg, NULL, 0, 0, PM_NOREMOVE)) - { - if(!OnIdle(nIdleCount++)) - bDoIdle = FALSE; - } - - bRet = ::GetMessage(&m_msg, NULL, 0, 0); - - if(bRet == -1) - { - ATLTRACE2(atlTraceUI, 0, _T("::GetMessage returned -1 (error)\n")); - continue; // error, don't process - } - else if(!bRet) - { - ATLTRACE2(atlTraceUI, 0, _T("CMessageLoop::Run - exiting\n")); - break; // WM_QUIT, exit message loop - } - - if(!PreTranslateMessage(&m_msg)) - { - ::TranslateMessage(&m_msg); - ::DispatchMessage(&m_msg); - } - - if(IsIdleMessage(&m_msg)) - { - bDoIdle = TRUE; - nIdleCount = 0; - } - } - - return (int)m_msg.wParam; - } - - static BOOL IsIdleMessage(MSG* pMsg) - { - // These messages should NOT cause idle processing - switch(pMsg->message) - { - case WM_MOUSEMOVE: -#ifndef _WIN32_WCE - case WM_NCMOUSEMOVE: -#endif // !_WIN32_WCE - case WM_PAINT: - case 0x0118: // WM_SYSTIMER (caret blink) - return FALSE; - } - - return TRUE; - } - -// Overrideables - // Override to change message filtering - virtual BOOL PreTranslateMessage(MSG* pMsg) - { - // loop backwards - for(int i = m_aMsgFilter.GetSize() - 1; i >= 0; i--) - { - CMessageFilter* pMessageFilter = m_aMsgFilter[i]; - if(pMessageFilter != NULL && pMessageFilter->PreTranslateMessage(pMsg)) - return TRUE; - } - return FALSE; // not translated - } - - // override to change idle processing - virtual BOOL OnIdle(int /*nIdleCount*/) - { - for(int i = 0; i < m_aIdleHandler.GetSize(); i++) - { - CIdleHandler* pIdleHandler = m_aIdleHandler[i]; - if(pIdleHandler != NULL) - pIdleHandler->OnIdle(); - } - return FALSE; // don't continue - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CStaticDataInitCriticalSectionLock and CWindowCreateCriticalSectionLock -// internal classes to manage critical sections for both ATL3 and ATL7 - -class CStaticDataInitCriticalSectionLock -{ -public: -#if (_ATL_VER >= 0x0700) - ATL::CComCritSecLock m_cslock; - - CStaticDataInitCriticalSectionLock() : m_cslock(ATL::_pAtlModule->m_csStaticDataInitAndTypeInfo, false) - { } -#endif // (_ATL_VER >= 0x0700) - - HRESULT Lock() - { -#if (_ATL_VER >= 0x0700) - return m_cslock.Lock(); -#else // !(_ATL_VER >= 0x0700) - ::EnterCriticalSection(&ATL::_pModule->m_csStaticDataInit); - return S_OK; -#endif // !(_ATL_VER >= 0x0700) - } - - void Unlock() - { -#if (_ATL_VER >= 0x0700) - m_cslock.Unlock(); -#else // !(_ATL_VER >= 0x0700) - ::LeaveCriticalSection(&ATL::_pModule->m_csStaticDataInit); -#endif // !(_ATL_VER >= 0x0700) - } -}; - - -class CWindowCreateCriticalSectionLock -{ -public: -#if (_ATL_VER >= 0x0700) - ATL::CComCritSecLock m_cslock; - - CWindowCreateCriticalSectionLock() : m_cslock(ATL::_AtlWinModule.m_csWindowCreate, false) - { } -#endif // (_ATL_VER >= 0x0700) - - HRESULT Lock() - { -#if (_ATL_VER >= 0x0700) - return m_cslock.Lock(); -#else // !(_ATL_VER >= 0x0700) - ::EnterCriticalSection(&ATL::_pModule->m_csWindowCreate); - return S_OK; -#endif // !(_ATL_VER >= 0x0700) - } - - void Unlock() - { -#if (_ATL_VER >= 0x0700) - m_cslock.Unlock(); -#else // !(_ATL_VER >= 0x0700) - ::LeaveCriticalSection(&ATL::_pModule->m_csWindowCreate); -#endif // !(_ATL_VER >= 0x0700) - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTempBuffer - helper class for stack allocations for ATL3 - -#ifndef _WTL_STACK_ALLOC_THRESHOLD - #define _WTL_STACK_ALLOC_THRESHOLD 512 -#endif - -#if (_ATL_VER >= 0x0700) - -using ATL::CTempBuffer; - -#else // !(_ATL_VER >= 0x0700) - -#ifndef SIZE_MAX - #ifdef _WIN64 - #define SIZE_MAX _UI64_MAX - #else - #define SIZE_MAX UINT_MAX - #endif -#endif - -#pragma warning(disable: 4284) // warning for operator -> - -template -class CTempBuffer -{ -public: - CTempBuffer() : m_p(NULL) - { - } - - CTempBuffer(size_t nElements) : m_p(NULL) - { - Allocate(nElements); - } - - ~CTempBuffer() - { - if(m_p != reinterpret_cast(m_abFixedBuffer)) - free(m_p); - } - - operator T*() const - { - return m_p; - } - - T* operator ->() const - { - ATLASSERT(m_p != NULL); - return m_p; - } - - T* Allocate(size_t nElements) - { - ATLASSERT(nElements <= (SIZE_MAX / sizeof(T))); - return AllocateBytes(nElements * sizeof(T)); - } - - T* AllocateBytes(size_t nBytes) - { - ATLASSERT(m_p == NULL); - if(nBytes > t_nFixedBytes) - m_p = static_cast(malloc(nBytes)); - else - m_p = reinterpret_cast(m_abFixedBuffer); - - return m_p; - } - -private: - T* m_p; - BYTE m_abFixedBuffer[t_nFixedBytes]; -}; - -#pragma warning(default: 4284) - -#endif // !(_ATL_VER >= 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// CAppModule - module class for an application - -class CAppModule : public ATL::CComModule -{ -public: - DWORD m_dwMainThreadID; - ATL::CSimpleMap* m_pMsgLoopMap; - ATL::CSimpleArray* m_pSettingChangeNotify; - -// Overrides of CComModule::Init and Term - HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) - { - HRESULT hRet = CComModule::Init(pObjMap, hInstance, pLibID); - if(FAILED(hRet)) - return hRet; - - m_dwMainThreadID = ::GetCurrentThreadId(); - typedef ATL::CSimpleMap _mapClass; - m_pMsgLoopMap = NULL; - ATLTRY(m_pMsgLoopMap = new _mapClass); - if(m_pMsgLoopMap == NULL) - return E_OUTOFMEMORY; - m_pSettingChangeNotify = NULL; - - return hRet; - } - - void Term() - { - TermSettingChangeNotify(); - delete m_pMsgLoopMap; - CComModule::Term(); - } - -// Message loop map methods - BOOL AddMessageLoop(CMessageLoop* pMsgLoop) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddMessageLoop.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - ATLASSERT(pMsgLoop != NULL); - ATLASSERT(m_pMsgLoopMap->Lookup(::GetCurrentThreadId()) == NULL); // not in map yet - - BOOL bRet = m_pMsgLoopMap->Add(::GetCurrentThreadId(), pMsgLoop); - - lock.Unlock(); - - return bRet; - } - - BOOL RemoveMessageLoop() - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveMessageLoop.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - BOOL bRet = m_pMsgLoopMap->Remove(::GetCurrentThreadId()); - - lock.Unlock(); - - return bRet; - } - - CMessageLoop* GetMessageLoop(DWORD dwThreadID = ::GetCurrentThreadId()) const - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::GetMessageLoop.\n")); - ATLASSERT(FALSE); - return NULL; - } - - CMessageLoop* pLoop = m_pMsgLoopMap->Lookup(dwThreadID); - - lock.Unlock(); - - return pLoop; - } - -// Setting change notify methods - // Note: Call this from the main thread for MSDI apps - BOOL InitSettingChangeNotify(DLGPROC pfnDlgProc = _SettingChangeDlgProc) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::InitSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - if(m_pSettingChangeNotify == NULL) - { - typedef ATL::CSimpleArray _notifyClass; - ATLTRY(m_pSettingChangeNotify = new _notifyClass); - ATLASSERT(m_pSettingChangeNotify != NULL); - } - - BOOL bRet = (m_pSettingChangeNotify != NULL); - if(bRet && m_pSettingChangeNotify->GetSize() == 0) - { - // init everything - _ATL_EMPTY_DLGTEMPLATE templ; - HWND hNtfWnd = ::CreateDialogIndirect(GetModuleInstance(), &templ, NULL, pfnDlgProc); - ATLASSERT(::IsWindow(hNtfWnd)); - if(::IsWindow(hNtfWnd)) - { -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, (LONG_PTR)this); -#else - ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, PtrToLong(this)); -#endif - bRet = m_pSettingChangeNotify->Add(hNtfWnd); - } - else - { - bRet = FALSE; - } - } - - lock.Unlock(); - - return bRet; - } - - void TermSettingChangeNotify() - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::TermSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return; - } - - if(m_pSettingChangeNotify != NULL && m_pSettingChangeNotify->GetSize() > 0) - ::DestroyWindow((*m_pSettingChangeNotify)[0]); - delete m_pSettingChangeNotify; - m_pSettingChangeNotify = NULL; - - lock.Unlock(); - } - - BOOL AddSettingChangeNotify(HWND hWnd) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - ATLASSERT(::IsWindow(hWnd)); - BOOL bRet = FALSE; - if(InitSettingChangeNotify() != FALSE) - bRet = m_pSettingChangeNotify->Add(hWnd); - - lock.Unlock(); - - return bRet; - } - - BOOL RemoveSettingChangeNotify(HWND hWnd) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - BOOL bRet = FALSE; - if(m_pSettingChangeNotify != NULL) - bRet = m_pSettingChangeNotify->Remove(hWnd); - - lock.Unlock(); - - return bRet; - } - -// Implementation - setting change notify dialog template and dialog procedure - struct _ATL_EMPTY_DLGTEMPLATE : DLGTEMPLATE - { - _ATL_EMPTY_DLGTEMPLATE() - { - memset(this, 0, sizeof(_ATL_EMPTY_DLGTEMPLATE)); - style = WS_POPUP; - } - WORD wMenu, wClass, wTitle; - }; - -#ifdef _WIN64 - static INT_PTR CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#else - static BOOL CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#endif - { - if(uMsg == WM_SETTINGCHANGE) - { -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - CAppModule* pModule = (CAppModule*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); -#else - CAppModule* pModule = (CAppModule*)LongToPtr(::GetWindowLongPtr(hWnd, GWLP_USERDATA)); -#endif - ATLASSERT(pModule != NULL); - ATLASSERT(pModule->m_pSettingChangeNotify != NULL); - const UINT uTimeout = 1500; // ms - for(int i = 1; i < pModule->m_pSettingChangeNotify->GetSize(); i++) - { -#if !defined(_WIN32_WCE) - ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_ABORTIFHUNG, uTimeout, NULL); -#elif(_WIN32_WCE >= 400) // CE specific - ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_NORMAL, uTimeout, NULL); -#else // _WIN32_WCE < 400 specific - uTimeout; - ::SendMessage((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam); -#endif - } - return TRUE; - } - return FALSE; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CServerAppModule - module class for a COM server application - -class CServerAppModule : public CAppModule -{ -public: - HANDLE m_hEventShutdown; - bool m_bActivity; - DWORD m_dwTimeOut; - DWORD m_dwPause; - -// Override of CAppModule::Init - HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) - { - m_dwTimeOut = 5000; - m_dwPause = 1000; - return CAppModule::Init(pObjMap, hInstance, pLibID); - } - - void Term() - { - if(m_hEventShutdown != NULL && ::CloseHandle(m_hEventShutdown)) - m_hEventShutdown = NULL; - CAppModule::Term(); - } - -// COM Server methods - LONG Unlock() - { - LONG lRet = CComModule::Unlock(); - if(lRet == 0) - { - m_bActivity = true; - ::SetEvent(m_hEventShutdown); // tell monitor that we transitioned to zero - } - return lRet; - } - - void MonitorShutdown() - { - for(;;) - { - ::WaitForSingleObject(m_hEventShutdown, INFINITE); - DWORD dwWait = 0; - do - { - m_bActivity = false; - dwWait = ::WaitForSingleObject(m_hEventShutdown, m_dwTimeOut); - } - while(dwWait == WAIT_OBJECT_0); - // timed out - if(!m_bActivity && m_nLockCnt == 0) // if no activity let's really bail - { -#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)) && defined(_ATL_FREE_THREADED) && !defined(_WIN32_WCE) - ::CoSuspendClassObjects(); - if(!m_bActivity && m_nLockCnt == 0) -#endif - break; - } - } - // This handle should be valid now. If it isn't, - // check if _Module.Term was called first (it shouldn't) - if(::CloseHandle(m_hEventShutdown)) - m_hEventShutdown = NULL; - ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0); - } - - bool StartMonitor() - { - m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL); - if(m_hEventShutdown == NULL) - return false; - DWORD dwThreadID = 0; -#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) - HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))MonitorProc, this, 0, (UINT*)&dwThreadID); -#else - HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID); -#endif - bool bRet = (hThread != NULL); - if(bRet) - ::CloseHandle(hThread); - return bRet; - } - - static DWORD WINAPI MonitorProc(void* pv) - { - CServerAppModule* p = (CServerAppModule*)pv; - p->MonitorShutdown(); - return 0; - } - -#if (_ATL_VER < 0x0700) - // search for an occurence of string p2 in string p1 - static LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2) - { - while(p1 != NULL && *p1 != NULL) - { - LPCTSTR p = p2; - while(p != NULL && *p != NULL) - { - if(*p1 == *p) - return ::CharNext(p1); - p = ::CharNext(p); - } - p1 = ::CharNext(p1); - } - return NULL; - } -#endif // (_ATL_VER < 0x0700) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CRegKeyEx - adds type-specific methods to ATL3 CRegKey - -#if (_ATL_VER < 0x0700) - -class CRegKeyEx : public ATL::CRegKey -{ -public: -// Constructors and operators - CRegKeyEx(HKEY hKey = NULL) - { - m_hKey = hKey; - } - - CRegKeyEx(CRegKeyEx& key) - { - Attach(key.Detach()); - } - - CRegKeyEx& operator =(CRegKeyEx& key) - { - Close(); - Attach(key.Detach()); - return *this; - } - -// Methods - LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void* pValue, ULONG nBytes) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, static_cast(pValue), nBytes); - } - - LONG SetGUIDValue(LPCTSTR pszValueName, REFGUID guidValue) - { - ATLASSERT(m_hKey != NULL); - - OLECHAR szGUID[64] = { 0 }; - ::StringFromGUID2(guidValue, szGUID, 64); - - USES_CONVERSION; - LPCTSTR lpstr = OLE2CT(szGUID); -#ifndef _UNICODE - if(lpstr == NULL) - return E_OUTOFMEMORY; -#endif - return SetStringValue(pszValueName, lpstr); - } - - LONG SetBinaryValue(LPCTSTR pszValueName, const void* pValue, ULONG nBytes) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_BINARY, reinterpret_cast(pValue), nBytes); - } - - LONG SetDWORDValue(LPCTSTR pszValueName, DWORD dwValue) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_DWORD, reinterpret_cast(&dwValue), sizeof(DWORD)); - } - -#ifndef _WIN32_WCE - LONG SetQWORDValue(LPCTSTR pszValueName, ULONGLONG qwValue) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_QWORD, reinterpret_cast(&qwValue), sizeof(ULONGLONG)); - } -#endif - - LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType = REG_SZ) - { - ATLASSERT(m_hKey != NULL); - if(pszValue == NULL) - { - ATLASSERT(FALSE); - return ERROR_INVALID_DATA; - } - ATLASSERT((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ)); - - return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, reinterpret_cast(pszValue), (lstrlen(pszValue) + 1) * sizeof(TCHAR)); - } - - LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue) - { - ATLASSERT(m_hKey != NULL); - if(pszValue == NULL) - { - ATLASSERT(FALSE); - return ERROR_INVALID_DATA; - } - - ULONG nBytes = 0; - ULONG nLength = 0; - LPCTSTR pszTemp = pszValue; - do - { - nLength = lstrlen(pszTemp) + 1; - pszTemp += nLength; - nBytes += nLength * sizeof(TCHAR); - } while (nLength != 1); - - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_MULTI_SZ, reinterpret_cast(pszValue), nBytes); - } - - LONG QueryValue(LPCTSTR pszValueName, DWORD* pdwType, void* pData, ULONG* pnBytes) - { - ATLASSERT(m_hKey != NULL); - return ::RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, static_cast(pData), pnBytes); - } - - LONG QueryGUIDValue(LPCTSTR pszValueName, GUID& guidValue) - { - ATLASSERT(m_hKey != NULL); - - guidValue = GUID_NULL; - - TCHAR szGUID[64] = { 0 }; - ULONG nCount = 64; - LONG lRes = QueryStringValue(pszValueName, szGUID, &nCount); - - if (lRes != ERROR_SUCCESS) - return lRes; - - if(szGUID[0] != _T('{')) - return ERROR_INVALID_DATA; - - USES_CONVERSION; - LPOLESTR lpstr = T2OLE(szGUID); -#ifndef _UNICODE - if(lpstr == NULL) - return E_OUTOFMEMORY; -#endif - - HRESULT hr = ::CLSIDFromString(lpstr, &guidValue); - if (FAILED(hr)) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryBinaryValue(LPCTSTR pszValueName, void* pValue, ULONG* pnBytes) - { - ATLASSERT(pnBytes != NULL); - ATLASSERT(m_hKey != NULL); - - DWORD dwType = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(pValue), pnBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_BINARY) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryDWORDValue(LPCTSTR pszValueName, DWORD& dwValue) - { - ATLASSERT(m_hKey != NULL); - - ULONG nBytes = sizeof(DWORD); - DWORD dwType = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(&dwValue), &nBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_DWORD) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryQWORDValue(LPCTSTR pszValueName, ULONGLONG& qwValue) - { - ATLASSERT(m_hKey != NULL); - - ULONG nBytes = sizeof(ULONGLONG); - DWORD dwType = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(&qwValue), &nBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_QWORD) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars) - { - ATLASSERT(m_hKey != NULL); - ATLASSERT(pnChars != NULL); - - ULONG nBytes = (*pnChars) * sizeof(TCHAR); - DWORD dwType = 0; - *pnChars = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(pszValue), &nBytes); - - if (lRes != ERROR_SUCCESS) - { - return lRes; - } - - if(dwType != REG_SZ && dwType != REG_EXPAND_SZ) - { - return ERROR_INVALID_DATA; - } - - if (pszValue != NULL) - { - if(nBytes != 0) - { - if ((nBytes % sizeof(TCHAR) != 0) || (pszValue[nBytes / sizeof(TCHAR) -1] != 0)) - return ERROR_INVALID_DATA; - } - else - { - pszValue[0] = _T('\0'); - } - } - - *pnChars = nBytes / sizeof(TCHAR); - - return ERROR_SUCCESS; - } - - LONG QueryMultiStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars) - { - ATLASSERT(m_hKey != NULL); - ATLASSERT(pnChars != NULL); - - if (pszValue != NULL && *pnChars < 2) - return ERROR_INSUFFICIENT_BUFFER; - - ULONG nBytes = (*pnChars) * sizeof(TCHAR); - DWORD dwType = 0; - *pnChars = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(pszValue), &nBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_MULTI_SZ) - return ERROR_INVALID_DATA; - if (pszValue != NULL && (nBytes % sizeof(TCHAR) != 0 || nBytes / sizeof(TCHAR) < 1 || pszValue[nBytes / sizeof(TCHAR) - 1] != 0 || ((nBytes / sizeof(TCHAR)) > 1 && pszValue[nBytes / sizeof(TCHAR) - 2] != 0))) - return ERROR_INVALID_DATA; - - *pnChars = nBytes / sizeof(TCHAR); - - return ERROR_SUCCESS; - } -}; - -#else // !(_ATL_VER < 0x0700) - -typedef ATL::CRegKey CRegKeyEx; - -#endif // !(_ATL_VER < 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// CString forward reference (enables CString use in atluser.h and atlgdi.h) - -#if defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) - #define _WTL_USE_CSTRING -#endif // defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) - -#ifdef _WTL_USE_CSTRING - class CString; // forward declaration (include atlmisc.h for the whole class) -#endif // _WTL_USE_CSTRING - -// CString namespace -#ifndef _CSTRING_NS - #ifdef __ATLSTR_H__ - #define _CSTRING_NS ATL - #else - #define _CSTRING_NS WTL - #endif -#endif // _CSTRING_NS - -// Type classes namespace -#ifndef _WTYPES_NS - #ifdef __ATLTYPES_H__ - #define _WTYPES_NS - #else - #define _WTYPES_NS WTL - #endif -#endif // _WTYPES_NS - -}; // namespace WTL - - -/////////////////////////////////////////////////////////////////////////////// -// General DLL version helpers -// (ATL3: excluded from atlbase.h if _ATL_DLL is defined; ATL11: removed) - -#if (((_ATL_VER < 0x0700) && defined(_ATL_DLL)) || (_ATL_VER >= 0x0B00)) && !defined(_WIN32_WCE) - -namespace ATL -{ - -inline HRESULT AtlGetDllVersion(HINSTANCE hInstDLL, DLLVERSIONINFO* pDllVersionInfo) -{ - ATLASSERT(pDllVersionInfo != NULL); - if(pDllVersionInfo == NULL) - return E_INVALIDARG; - - // We must get this function explicitly because some DLLs don't implement it. - DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC)::GetProcAddress(hInstDLL, "DllGetVersion"); - if(pfnDllGetVersion == NULL) - return E_NOTIMPL; - - return (*pfnDllGetVersion)(pDllVersionInfo); -} - -inline HRESULT AtlGetDllVersion(LPCTSTR lpstrDllName, DLLVERSIONINFO* pDllVersionInfo) -{ - HINSTANCE hInstDLL = ::LoadLibrary(lpstrDllName); - if(hInstDLL == NULL) - return E_FAIL; - HRESULT hRet = AtlGetDllVersion(hInstDLL, pDllVersionInfo); - ::FreeLibrary(hInstDLL); - return hRet; -} - -// Common Control Versions: -// Win95/WinNT 4.0 maj=4 min=00 -// IE 3.x maj=4 min=70 -// IE 4.0 maj=4 min=71 -inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) -{ - ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); - if(pdwMajor == NULL || pdwMinor == NULL) - return E_INVALIDARG; - - DLLVERSIONINFO dvi; - ::ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - HRESULT hRet = AtlGetDllVersion(_T("comctl32.dll"), &dvi); - - if(SUCCEEDED(hRet)) - { - *pdwMajor = dvi.dwMajorVersion; - *pdwMinor = dvi.dwMinorVersion; - } - else if(hRet == E_NOTIMPL) - { - // If DllGetVersion is not there, then the DLL is a version - // previous to the one shipped with IE 3.x - *pdwMajor = 4; - *pdwMinor = 0; - hRet = S_OK; - } - - return hRet; -} - -// Shell Versions: -// Win95/WinNT 4.0 maj=4 min=00 -// IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00 -// IE 4.0 with Web Integrated Desktop maj=4 min=71 -// IE 4.01 with Web Integrated Desktop maj=4 min=72 -inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) -{ - ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); - if(pdwMajor == NULL || pdwMinor == NULL) - return E_INVALIDARG; - - DLLVERSIONINFO dvi; - ::ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - HRESULT hRet = AtlGetDllVersion(_T("shell32.dll"), &dvi); - - if(SUCCEEDED(hRet)) - { - *pdwMajor = dvi.dwMajorVersion; - *pdwMinor = dvi.dwMinorVersion; - } - else if(hRet == E_NOTIMPL) - { - // If DllGetVersion is not there, then the DLL is a version - // previous to the one shipped with IE 4.x - *pdwMajor = 4; - *pdwMinor = 0; - hRet = S_OK; - } - - return hRet; -} - -}; // namespace ATL - -#endif // (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) - - -// These are always included -#include "atlwinx.h" -#include "atluser.h" -#include "atlgdi.h" - -#ifndef _WTL_NO_AUTOMATIC_NAMESPACE -using namespace WTL; -#endif // !_WTL_NO_AUTOMATIC_NAMESPACE - -#endif // __ATLAPP_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlcrack.h b/GLideN64/src/GLideNUI-wtl/WTL/atlcrack.h deleted file mode 100644 index 7f4a2ba..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlcrack.h +++ /dev/null @@ -1,2384 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCRACK_H__ -#define __ATLCRACK_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlcrack.h requires atlapp.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Message map macro for cracked handlers - -// Note about message maps with cracked handlers: -// For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX. -// For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes, -// but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl. - -#define BEGIN_MSG_MAP_EX(theClass) \ -public: \ - BOOL m_bMsgHandled; \ - /* "handled" management for cracked handlers */ \ - BOOL IsMsgHandled() const \ - { \ - return m_bMsgHandled; \ - } \ - void SetMsgHandled(BOOL bHandled) \ - { \ - m_bMsgHandled = bHandled; \ - } \ - BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \ - { \ - BOOL bOldMsgHandled = m_bMsgHandled; \ - BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \ - m_bMsgHandled = bOldMsgHandled; \ - return bRet; \ - } \ - BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \ - { \ - BOOL bHandled = TRUE; \ - hWnd; \ - uMsg; \ - wParam; \ - lParam; \ - lResult; \ - bHandled; \ - switch(dwMsgMapID) \ - { \ - case 0: - - -/////////////////////////////////////////////////////////////////////////////// -// Standard Windows message macros - -// int OnCreate(LPCREATESTRUCT lpCreateStruct) -#define MSG_WM_CREATE(func) \ - if (uMsg == WM_CREATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam) -#define MSG_WM_INITDIALOG(func) \ - if (uMsg == WM_INITDIALOG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct) -#define MSG_WM_COPYDATA(func) \ - if (uMsg == WM_COPYDATA) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDestroy() -#define MSG_WM_DESTROY(func) \ - if (uMsg == WM_DESTROY) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMove(CPoint ptPos) -#define MSG_WM_MOVE(func) \ - if (uMsg == WM_MOVE) \ - { \ - SetMsgHandled(TRUE); \ - func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSize(UINT nType, CSize size) -#define MSG_WM_SIZE(func) \ - if (uMsg == WM_SIZE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther) -#define MSG_WM_ACTIVATE(func) \ - if (uMsg == WM_ACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSetFocus(CWindow wndOld) -#define MSG_WM_SETFOCUS(func) \ - if (uMsg == WM_SETFOCUS) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnKillFocus(CWindow wndFocus) -#define MSG_WM_KILLFOCUS(func) \ - if (uMsg == WM_KILLFOCUS) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnable(BOOL bEnable) -#define MSG_WM_ENABLE(func) \ - if (uMsg == WM_ENABLE) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaint(CDCHandle dc) -#define MSG_WM_PAINT(func) \ - if (uMsg == WM_PAINT) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnClose() -#define MSG_WM_CLOSE(func) \ - if (uMsg == WM_CLOSE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnQueryEndSession(UINT nSource, UINT uLogOff) -#define MSG_WM_QUERYENDSESSION(func) \ - if (uMsg == WM_QUERYENDSESSION) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnQueryOpen() -#define MSG_WM_QUERYOPEN(func) \ - if (uMsg == WM_QUERYOPEN) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnEraseBkgnd(CDCHandle dc) -#define MSG_WM_ERASEBKGND(func) \ - if (uMsg == WM_ERASEBKGND) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysColorChange() -#define MSG_WM_SYSCOLORCHANGE(func) \ - if (uMsg == WM_SYSCOLORCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEndSession(BOOL bEnding, UINT uLogOff) -#define MSG_WM_ENDSESSION(func) \ - if (uMsg == WM_ENDSESSION) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (UINT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnShowWindow(BOOL bShow, UINT nStatus) -#define MSG_WM_SHOWWINDOW(func) \ - if (uMsg == WM_SHOWWINDOW) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (int)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit) -#define MSG_WM_CTLCOLOREDIT(func) \ - if (uMsg == WM_CTLCOLOREDIT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox) -#define MSG_WM_CTLCOLORLISTBOX(func) \ - if (uMsg == WM_CTLCOLORLISTBOX) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button) -#define MSG_WM_CTLCOLORBTN(func) \ - if (uMsg == WM_CTLCOLORBTN) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd) -#define MSG_WM_CTLCOLORDLG(func) \ - if (uMsg == WM_CTLCOLORDLG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) -#define MSG_WM_CTLCOLORSCROLLBAR(func) \ - if (uMsg == WM_CTLCOLORSCROLLBAR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic) -#define MSG_WM_CTLCOLORSTATIC(func) \ - if (uMsg == WM_CTLCOLORSTATIC) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSettingChange(UINT uFlags, LPCTSTR lpszSection) -#define MSG_WM_SETTINGCHANGE(func) \ - if (uMsg == WM_SETTINGCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPCTSTR)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDevModeChange(LPCTSTR lpDeviceName) -#define MSG_WM_DEVMODECHANGE(func) \ - if (uMsg == WM_DEVMODECHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((LPCTSTR)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnActivateApp(BOOL bActive, DWORD dwThreadID) -#define MSG_WM_ACTIVATEAPP(func) \ - if (uMsg == WM_ACTIVATEAPP) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (DWORD)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnFontChange() -#define MSG_WM_FONTCHANGE(func) \ - if (uMsg == WM_FONTCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnTimeChange() -#define MSG_WM_TIMECHANGE(func) \ - if (uMsg == WM_TIMECHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCancelMode() -#define MSG_WM_CANCELMODE(func) \ - if (uMsg == WM_CANCELMODE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message) -#define MSG_WM_SETCURSOR(func) \ - if (uMsg == WM_SETCURSOR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message) -#define MSG_WM_MOUSEACTIVATE(func) \ - if (uMsg == WM_MOUSEACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChildActivate() -#define MSG_WM_CHILDACTIVATE(func) \ - if (uMsg == WM_CHILDACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnGetMinMaxInfo(LPMINMAXINFO lpMMI) -#define MSG_WM_GETMINMAXINFO(func) \ - if (uMsg == WM_GETMINMAXINFO) \ - { \ - SetMsgHandled(TRUE); \ - func((LPMINMAXINFO)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnIconEraseBkgnd(CDCHandle dc) -#define MSG_WM_ICONERASEBKGND(func) \ - if (uMsg == WM_ICONERASEBKGND) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSpoolerStatus(UINT nStatus, UINT nJobs) -#define MSG_WM_SPOOLERSTATUS(func) \ - if (uMsg == WM_SPOOLERSTATUS) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (UINT)LOWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) -#define MSG_WM_DRAWITEM(func) \ - if (uMsg == WM_DRAWITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) -#define MSG_WM_MEASUREITEM(func) \ - if (uMsg == WM_MEASUREITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) -#define MSG_WM_DELETEITEM(func) \ - if (uMsg == WM_DELETEITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -//int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox) -#define MSG_WM_CHARTOITEM(func) \ - if (uMsg == WM_CHARTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) -#define MSG_WM_VKEYTOITEM(func) \ - if (uMsg == WM_VKEYTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HCURSOR OnQueryDragIcon() -#define MSG_WM_QUERYDRAGICON(func) \ - if (uMsg == WM_QUERYDRAGICON) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) -#define MSG_WM_COMPAREITEM(func) \ - if (uMsg == WM_COMPAREITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCompacting(UINT nCpuTime) -#define MSG_WM_COMPACTING(func) \ - if (uMsg == WM_COMPACTING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct) -#define MSG_WM_NCCREATE(func) \ - if (uMsg == WM_NCCREATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcDestroy() -#define MSG_WM_NCDESTROY(func) \ - if (uMsg == WM_NCDESTROY) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam) -#define MSG_WM_NCCALCSIZE(func) \ - if (uMsg == WM_NCCALCSIZE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((BOOL)wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// UINT OnNcHitTest(CPoint point) -#define MSG_WM_NCHITTEST(func) \ - if (uMsg == WM_NCHITTEST) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcPaint(CRgnHandle rgn) -#define MSG_WM_NCPAINT(func) \ - if (uMsg == WM_NCPAINT) \ - { \ - SetMsgHandled(TRUE); \ - func((HRGN)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnNcActivate(BOOL bActive) -#define MSG_WM_NCACTIVATE(func) \ - if (uMsg == WM_NCACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((BOOL)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// UINT OnGetDlgCode(LPMSG lpMsg) -#define MSG_WM_GETDLGCODE(func) \ - if (uMsg == WM_GETDLGCODE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPMSG)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMouseMove(UINT nHitTest, CPoint point) -#define MSG_WM_NCMOUSEMOVE(func) \ - if (uMsg == WM_NCMOUSEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcLButtonDown(UINT nHitTest, CPoint point) -#define MSG_WM_NCLBUTTONDOWN(func) \ - if (uMsg == WM_NCLBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcLButtonUp(UINT nHitTest, CPoint point) -#define MSG_WM_NCLBUTTONUP(func) \ - if (uMsg == WM_NCLBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcLButtonDblClk(UINT nHitTest, CPoint point) -#define MSG_WM_NCLBUTTONDBLCLK(func) \ - if (uMsg == WM_NCLBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcRButtonDown(UINT nHitTest, CPoint point) -#define MSG_WM_NCRBUTTONDOWN(func) \ - if (uMsg == WM_NCRBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcRButtonUp(UINT nHitTest, CPoint point) -#define MSG_WM_NCRBUTTONUP(func) \ - if (uMsg == WM_NCRBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcRButtonDblClk(UINT nHitTest, CPoint point) -#define MSG_WM_NCRBUTTONDBLCLK(func) \ - if (uMsg == WM_NCRBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMButtonDown(UINT nHitTest, CPoint point) -#define MSG_WM_NCMBUTTONDOWN(func) \ - if (uMsg == WM_NCMBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMButtonUp(UINT nHitTest, CPoint point) -#define MSG_WM_NCMBUTTONUP(func) \ - if (uMsg == WM_NCMBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMButtonDblClk(UINT nHitTest, CPoint point) -#define MSG_WM_NCMBUTTONDBLCLK(func) \ - if (uMsg == WM_NCMBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_KEYDOWN(func) \ - if (uMsg == WM_KEYDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_KEYUP(func) \ - if (uMsg == WM_KEYUP) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_CHAR(func) \ - if (uMsg == WM_CHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_DEADCHAR(func) \ - if (uMsg == WM_DEADCHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSKEYDOWN(func) \ - if (uMsg == WM_SYSKEYDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSKEYUP(func) \ - if (uMsg == WM_SYSKEYUP) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSCHAR(func) \ - if (uMsg == WM_SYSCHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSDEADCHAR(func) \ - if (uMsg == WM_SYSDEADCHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysCommand(UINT nID, CPoint point) -#define MSG_WM_SYSCOMMAND(func) \ - if (uMsg == WM_SYSCOMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnTCard(UINT idAction, DWORD dwActionData) -#define MSG_WM_TCARD(func) \ - if (uMsg == WM_TCARD) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (DWORD)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnTimer(UINT_PTR nIDEvent) -#define MSG_WM_TIMER(func) \ - if (uMsg == WM_TIMER) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT_PTR)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_WM_HSCROLL(func) \ - if (uMsg == WM_HSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_WM_VSCROLL(func) \ - if (uMsg == WM_VSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInitMenu(CMenuHandle menu) -#define MSG_WM_INITMENU(func) \ - if (uMsg == WM_INITMENU) \ - { \ - SetMsgHandled(TRUE); \ - func((HMENU)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInitMenuPopup(CMenuHandle menuPopup, UINT nIndex, BOOL bSysMenu) -#define MSG_WM_INITMENUPOPUP(func) \ - if (uMsg == WM_INITMENUPOPUP) \ - { \ - SetMsgHandled(TRUE); \ - func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMenuSelect(UINT nItemID, UINT nFlags, CMenuHandle menu) -#define MSG_WM_MENUSELECT(func) \ - if (uMsg == WM_MENUSELECT) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenuHandle menu) -#define MSG_WM_MENUCHAR(func) \ - if (uMsg == WM_MENUCHAR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotify(int idCtrl, LPNMHDR pnmh) -#define MSG_WM_NOTIFY(func) \ - if (uMsg == WM_NOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((int)wParam, (LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnterIdle(UINT nWhy, CWindow wndWho) -#define MSG_WM_ENTERIDLE(func) \ - if (uMsg == WM_ENTERIDLE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMouseMove(UINT nFlags, CPoint point) -#define MSG_WM_MOUSEMOVE(func) \ - if (uMsg == WM_MOUSEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -#define MSG_WM_MOUSEWHEEL(func) \ - if (uMsg == WM_MOUSEWHEEL) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnLButtonDown(UINT nFlags, CPoint point) -#define MSG_WM_LBUTTONDOWN(func) \ - if (uMsg == WM_LBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnLButtonUp(UINT nFlags, CPoint point) -#define MSG_WM_LBUTTONUP(func) \ - if (uMsg == WM_LBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnLButtonDblClk(UINT nFlags, CPoint point) -#define MSG_WM_LBUTTONDBLCLK(func) \ - if (uMsg == WM_LBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRButtonDown(UINT nFlags, CPoint point) -#define MSG_WM_RBUTTONDOWN(func) \ - if (uMsg == WM_RBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRButtonUp(UINT nFlags, CPoint point) -#define MSG_WM_RBUTTONUP(func) \ - if (uMsg == WM_RBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRButtonDblClk(UINT nFlags, CPoint point) -#define MSG_WM_RBUTTONDBLCLK(func) \ - if (uMsg == WM_RBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMButtonDown(UINT nFlags, CPoint point) -#define MSG_WM_MBUTTONDOWN(func) \ - if (uMsg == WM_MBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMButtonUp(UINT nFlags, CPoint point) -#define MSG_WM_MBUTTONUP(func) \ - if (uMsg == WM_MBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMButtonDblClk(UINT nFlags, CPoint point) -#define MSG_WM_MBUTTONDBLCLK(func) \ - if (uMsg == WM_MBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam) -#define MSG_WM_PARENTNOTIFY(func) \ - if (uMsg == WM_PARENTNOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate) -#define MSG_WM_MDIACTIVATE(func) \ - if (uMsg == WM_MDIACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRenderFormat(UINT nFormat) -#define MSG_WM_RENDERFORMAT(func) \ - if (uMsg == WM_RENDERFORMAT) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRenderAllFormats() -#define MSG_WM_RENDERALLFORMATS(func) \ - if (uMsg == WM_RENDERALLFORMATS) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDestroyClipboard() -#define MSG_WM_DESTROYCLIPBOARD(func) \ - if (uMsg == WM_DESTROYCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDrawClipboard() -#define MSG_WM_DRAWCLIPBOARD(func) \ - if (uMsg == WM_DRAWCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct) -#define MSG_WM_PAINTCLIPBOARD(func) \ - if (uMsg == WM_PAINTCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \ - ::GlobalUnlock((HGLOBAL)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) -#define MSG_WM_VSCROLLCLIPBOARD(func) \ - if (uMsg == WM_VSCROLLCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnContextMenu(CWindow wnd, CPoint point) -#define MSG_WM_CONTEXTMENU(func) \ - if (uMsg == WM_CONTEXTMENU) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect) -#define MSG_WM_SIZECLIPBOARD(func) \ - if (uMsg == WM_SIZECLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \ - ::GlobalUnlock((HGLOBAL)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString) -#define MSG_WM_ASKCBFORMATNAME(func) \ - if (uMsg == WM_ASKCBFORMATNAME) \ - { \ - SetMsgHandled(TRUE); \ - func((DWORD)wParam, (LPTSTR)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter) -#define MSG_WM_CHANGECBCHAIN(func) \ - if (uMsg == WM_CHANGECBCHAIN) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) -#define MSG_WM_HSCROLLCLIPBOARD(func) \ - if (uMsg == WM_HSCROLLCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnQueryNewPalette() -#define MSG_WM_QUERYNEWPALETTE(func) \ - if (uMsg == WM_QUERYNEWPALETTE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaletteChanged(CWindow wndFocus) -#define MSG_WM_PALETTECHANGED(func) \ - if (uMsg == WM_PALETTECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaletteIsChanging(CWindow wndPalChg) -#define MSG_WM_PALETTEISCHANGING(func) \ - if (uMsg == WM_PALETTEISCHANGING) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDropFiles(HDROP hDropInfo) -#define MSG_WM_DROPFILES(func) \ - if (uMsg == WM_DROPFILES) \ - { \ - SetMsgHandled(TRUE); \ - func((HDROP)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnWindowPosChanging(LPWINDOWPOS lpWndPos) -#define MSG_WM_WINDOWPOSCHANGING(func) \ - if (uMsg == WM_WINDOWPOSCHANGING) \ - { \ - SetMsgHandled(TRUE); \ - func((LPWINDOWPOS)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnWindowPosChanged(LPWINDOWPOS lpWndPos) -#define MSG_WM_WINDOWPOSCHANGED(func) \ - if (uMsg == WM_WINDOWPOSCHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((LPWINDOWPOS)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnExitMenuLoop(BOOL fIsTrackPopupMenu) -#define MSG_WM_EXITMENULOOP(func) \ - if (uMsg == WM_EXITMENULOOP) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnterMenuLoop(BOOL fIsTrackPopupMenu) -#define MSG_WM_ENTERMENULOOP(func) \ - if (uMsg == WM_ENTERMENULOOP) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct) -#define MSG_WM_STYLECHANGED(func) \ - if (uMsg == WM_STYLECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct) -#define MSG_WM_STYLECHANGING(func) \ - if (uMsg == WM_STYLECHANGING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSizing(UINT fwSide, LPRECT pRect) -#define MSG_WM_SIZING(func) \ - if (uMsg == WM_SIZING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPRECT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMoving(UINT fwSide, LPRECT pRect) -#define MSG_WM_MOVING(func) \ - if (uMsg == WM_MOVING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPRECT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCaptureChanged(CWindow wnd) -#define MSG_WM_CAPTURECHANGED(func) \ - if (uMsg == WM_CAPTURECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnDeviceChange(UINT nEventType, DWORD dwData) -#define MSG_WM_DEVICECHANGE(func) \ - if (uMsg == WM_DEVICECHANGE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl) -#define MSG_WM_COMMAND(func) \ - if (uMsg == WM_COMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen) -#define MSG_WM_DISPLAYCHANGE(func) \ - if (uMsg == WM_DISPLAYCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnterSizeMove() -#define MSG_WM_ENTERSIZEMOVE(func) \ - if (uMsg == WM_ENTERSIZEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnExitSizeMove() -#define MSG_WM_EXITSIZEMOVE(func) \ - if (uMsg == WM_EXITSIZEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HFONT OnGetFont() -#define MSG_WM_GETFONT(func) \ - if (uMsg == WM_GETFONT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnGetHotKey() -#define MSG_WM_GETHOTKEY(func) \ - if (uMsg == WM_GETHOTKEY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HICON OnGetIcon() -#define MSG_WM_GETICON(func) \ - if (uMsg == WM_GETICON) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnGetText(int cchTextMax, LPTSTR lpszText) -#define MSG_WM_GETTEXT(func) \ - if (uMsg == WM_GETTEXT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnGetTextLength() -#define MSG_WM_GETTEXTLENGTH(func) \ - if (uMsg == WM_GETTEXTLENGTH) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHelp(LPHELPINFO lpHelpInfo) -#define MSG_WM_HELP(func) \ - if (uMsg == WM_HELP) \ - { \ - SetMsgHandled(TRUE); \ - func((LPHELPINFO)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey) -#define MSG_WM_HOTKEY(func) \ - if (uMsg == WM_HOTKEY) \ - { \ - SetMsgHandled(TRUE); \ - func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout) -#define MSG_WM_INPUTLANGCHANGE(func) \ - if (uMsg == WM_INPUTLANGCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((DWORD)wParam, (HKL)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout) -#define MSG_WM_INPUTLANGCHANGEREQUEST(func) \ - if (uMsg == WM_INPUTLANGCHANGEREQUEST) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (HKL)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus) -#define MSG_WM_NEXTDLGCTL(func) \ - if (uMsg == WM_NEXTDLGCTL) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)LOWORD(lParam), wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu) -#define MSG_WM_NEXTMENU(func) \ - if (uMsg == WM_NEXTMENU) \ - { \ - SetMsgHandled(TRUE); \ - func((int)wParam, (LPMDINEXTMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnNotifyFormat(CWindow wndFrom, int nCommand) -#define MSG_WM_NOTIFYFORMAT(func) \ - if (uMsg == WM_NOTIFYFORMAT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (int)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData) -#define MSG_WM_POWERBROADCAST(func) \ - if (uMsg == WM_POWERBROADCAST) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPrint(CDCHandle dc, UINT uFlags) -#define MSG_WM_PRINT(func) \ - if (uMsg == WM_PRINT) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam, (UINT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPrintClient(CDCHandle dc, UINT uFlags) -#define MSG_WM_PRINTCLIENT(func) \ - if (uMsg == WM_PRINTCLIENT) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam, (UINT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError) -#define MSG_WM_RASDIALEVENT(func) \ - if (uMsg == WM_RASDIALEVENT) \ - { \ - SetMsgHandled(TRUE); \ - func((RASCONNSTATE)wParam, (DWORD)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSetFont(CFontHandle font, BOOL bRedraw) -#define MSG_WM_SETFONT(func) \ - if (uMsg == WM_SETFONT) \ - { \ - SetMsgHandled(TRUE); \ - func((HFONT)wParam, (BOOL)LOWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnSetHotKey(int nVirtKey, UINT uFlags) -#define MSG_WM_SETHOTKEY(func) \ - if (uMsg == WM_SETHOTKEY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HICON OnSetIcon(UINT uType, HICON hIcon) -#define MSG_WM_SETICON(func) \ - if (uMsg == WM_SETICON) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSetRedraw(BOOL bRedraw) -#define MSG_WM_SETREDRAW(func) \ - if (uMsg == WM_SETREDRAW) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnSetText(LPCTSTR lpstrText) -#define MSG_WM_SETTEXT(func) \ - if (uMsg == WM_SETTEXT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPCTSTR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUserChanged() -#define MSG_WM_USERCHANGED(func) \ - if (uMsg == WM_USERCHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// New NT4 & NT5 messages - -#if(_WIN32_WINNT >= 0x0400) - -// void OnMouseHover(WPARAM wParam, CPoint ptPos) -#define MSG_WM_MOUSEHOVER(func) \ - if (uMsg == WM_MOUSEHOVER) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMouseLeave() -#define MSG_WM_MOUSELEAVE(func) \ - if (uMsg == WM_MOUSELEAVE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if(WINVER >= 0x0500) - -// void OnMenuRButtonUp(WPARAM wParam, CMenuHandle menu) -#define MSG_WM_MENURBUTTONUP(func) \ - if (uMsg == WM_MENURBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, (HMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMenuDrag(WPARAM wParam, CMenuHandle menu) -#define MSG_WM_MENUDRAG(func) \ - if (uMsg == WM_MENUDRAG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(wParam, (HMENU)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info) -#define MSG_WM_MENUGETOBJECT(func) \ - if (uMsg == WM_MENUGETOBJECT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((PMENUGETOBJECTINFO)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUnInitMenuPopup(UINT nID, CMenuHandle menu) -#define MSG_WM_UNINITMENUPOPUP(func) \ - if (uMsg == WM_UNINITMENUPOPUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(lParam), (HMENU)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMenuCommand(WPARAM nIndex, CMenuHandle menu) -#define MSG_WM_MENUCOMMAND(func) \ - if (uMsg == WM_MENUCOMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, (HMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif /* WINVER >= 0x0500 */ - -#if(_WIN32_WINNT >= 0x0500) - -// BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys) -#define MSG_WM_APPCOMMAND(func) \ - if (uMsg == WM_APPCOMMAND) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos) -#define MSG_WM_NCXBUTTONDOWN(func) \ - if (uMsg == WM_NCXBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos) -#define MSG_WM_NCXBUTTONUP(func) \ - if (uMsg == WM_NCXBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos) -#define MSG_WM_NCXBUTTONDBLCLK(func) \ - if (uMsg == WM_NCXBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos) -#define MSG_WM_XBUTTONDOWN(func) \ - if (uMsg == WM_XBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos) -#define MSG_WM_XBUTTONUP(func) \ - if (uMsg == WM_XBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos) -#define MSG_WM_XBUTTONDBLCLK(func) \ - if (uMsg == WM_XBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChangeUIState(WORD nAction, WORD nState) -#define MSG_WM_CHANGEUISTATE(func) \ - if (uMsg == WM_CHANGEUISTATE) \ - { \ - SetMsgHandled(TRUE); \ - func(LOWORD(wParam), HIWORD(wParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUpdateUIState(WORD nAction, WORD nState) -#define MSG_WM_UPDATEUISTATE(func) \ - if (uMsg == WM_UPDATEUISTATE) \ - { \ - SetMsgHandled(TRUE); \ - func(LOWORD(wParam), HIWORD(wParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnQueryUIState() -#define MSG_WM_QUERYUISTATE(func) \ - if (uMsg == WM_QUERYUISTATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif // (_WIN32_WINNT >= 0x0500) - -#if(_WIN32_WINNT >= 0x0501) - -// void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput) -#define MSG_WM_INPUT(func) \ - if (uMsg == WM_INPUT) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_UNICHAR(func) \ - if (uMsg == WM_UNICHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - if(IsMsgHandled()) \ - { \ - lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \ - return TRUE; \ - } \ - } - -// void OnWTSSessionChange(WPARAM nStatusCode, PWTSSESSION_NOTIFICATION nSessionID) -#define MSG_WM_WTSSESSION_CHANGE(func) \ - if (uMsg == WM_WTSSESSION_CHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, (PWTSSESSION_NOTIFICATION)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// OnThemeChanged() -#define MSG_WM_THEMECHANGED(func) \ - if (uMsg == WM_THEMECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif /* _WIN32_WINNT >= 0x0501 */ - -/////////////////////////////////////////////////////////////////////////////// -// ATL defined messages - -// BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData) -#define MSG_WM_FORWARDMSG(func) \ - if (uMsg == WM_FORWARDMSG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Dialog specific messages - -// LRESULT OnDMGetDefID() -#define MSG_DM_GETDEFID(func) \ - if (uMsg == DM_GETDEFID) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDMSetDefID(UINT DefID) -#define MSG_DM_SETDEFID(func) \ - if (uMsg == DM_SETDEFID) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDMReposition() -#define MSG_DM_REPOSITION(func) \ - if (uMsg == DM_REPOSITION) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Reflected messages - -// void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl) -#define MSG_OCM_COMMAND(func) \ - if (uMsg == OCM_COMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh) -#define MSG_OCM_NOTIFY(func) \ - if (uMsg == OCM_NOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((int)wParam, (LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam) -#define MSG_OCM_PARENTNOTIFY(func) \ - if (uMsg == OCM_PARENTNOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) -#define MSG_OCM_DRAWITEM(func) \ - if (uMsg == OCM_DRAWITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) -#define MSG_OCM_MEASUREITEM(func) \ - if (uMsg == OCM_MEASUREITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) -#define MSG_OCM_COMPAREITEM(func) \ - if (uMsg == OCM_COMPAREITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) -#define MSG_OCM_DELETEITEM(func) \ - if (uMsg == OCM_DELETEITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) -#define MSG_OCM_VKEYTOITEM(func) \ - if (uMsg == OCM_VKEYTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -//int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox) -#define MSG_OCM_CHARTOITEM(func) \ - if (uMsg == OCM_CHARTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_OCM_HSCROLL(func) \ - if (uMsg == OCM_HSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_OCM_VSCROLL(func) \ - if (uMsg == OCM_VSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit) -#define MSG_OCM_CTLCOLOREDIT(func) \ - if (uMsg == OCM_CTLCOLOREDIT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox) -#define MSG_OCM_CTLCOLORLISTBOX(func) \ - if (uMsg == OCM_CTLCOLORLISTBOX) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button) -#define MSG_OCM_CTLCOLORBTN(func) \ - if (uMsg == OCM_CTLCOLORBTN) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd) -#define MSG_OCM_CTLCOLORDLG(func) \ - if (uMsg == OCM_CTLCOLORDLG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) -#define MSG_OCM_CTLCOLORSCROLLBAR(func) \ - if (uMsg == OCM_CTLCOLORSCROLLBAR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic) -#define MSG_OCM_CTLCOLORSTATIC(func) \ - if (uMsg == OCM_CTLCOLORSTATIC) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Edit specific messages - -// void OnClear() -#define MSG_WM_CLEAR(func) \ - if (uMsg == WM_CLEAR) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCopy() -#define MSG_WM_COPY(func) \ - if (uMsg == WM_COPY) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCut() -#define MSG_WM_CUT(func) \ - if (uMsg == WM_CUT) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaste() -#define MSG_WM_PASTE(func) \ - if (uMsg == WM_PASTE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUndo() -#define MSG_WM_UNDO(func) \ - if (uMsg == WM_UNDO) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Generic message handlers - -// LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) -#define MESSAGE_HANDLER_EX(msg, func) \ - if(uMsg == msg) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(uMsg, wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) -#define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \ - if(uMsg >= msgFirst && uMsg <= msgLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(uMsg, wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Commands and notifications - -// void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_HANDLER_EX(id, code, func) \ - if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_ID_HANDLER_EX(id, func) \ - if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_CODE_HANDLER_EX(code, func) \ - if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyHandlerEX(LPNMHDR pnmh) -#define NOTIFY_HANDLER_EX(id, cd, func) \ - if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh) -#define NOTIFY_ID_HANDLER_EX(id, func) \ - if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh) -#define NOTIFY_CODE_HANDLER_EX(cd, func) \ - if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh) -#define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh) -#define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \ - if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \ - if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \ - if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \ - if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \ - if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \ - if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif // __ATLCRACK_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlctrls.h b/GLideN64/src/GLideNUI-wtl/WTL/atlctrls.h deleted file mode 100644 index 776672b..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlctrls.h +++ /dev/null @@ -1,10071 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCTRLS_H__ -#define __ATLCTRLS_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlctrls.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlctrls.h requires atlwin.h to be included first -#endif - -#ifndef _WIN32_WCE - #include - #include -#elif defined(WIN32_PLATFORM_WFSP) && !defined(_WINUSERM_H_) - #include -#endif // !_WIN32_WCE - -// protect template members from windowsx.h macros -#ifdef _INC_WINDOWSX - #undef GetNextSibling - #undef GetPrevSibling -#endif // _INC_WINDOWSX - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CStaticT - CStatic -// CButtonT - CButton -// CListBoxT - CListBox -// CComboBoxT - CComboBox -// CEditT - CEdit -// CEditCommands -// CScrollBarT - CScrollBar -// -// CImageList -// CListViewCtrlT - CListViewCtrl -// CTreeViewCtrlT - CTreeViewCtrl -// CTreeItemT - CTreeItem -// CTreeViewCtrlExT - CTreeViewCtrlEx -// CHeaderCtrlT - CHeaderCtrl -// CToolBarCtrlT - CToolBarCtrl -// CStatusBarCtrlT - CStatusBarCtrl -// CTabCtrlT - CTabCtrl -// CToolInfo -// CToolTipCtrlT - CToolTipCtrl -// CTrackBarCtrlT - CTrackBarCtrl -// CUpDownCtrlT - CUpDownCtrl -// CProgressBarCtrlT - CProgressBarCtrl -// CHotKeyCtrlT - CHotKeyCtrl -// CAnimateCtrlT - CAnimateCtrl -// CRichEditCtrlT - CRichEditCtrl -// CRichEditCommands -// CDragListBoxT - CDragListBox -// CDragListNotifyImpl -// CReBarCtrlT - CReBarCtrl -// CComboBoxExT - CComboBoxEx -// CDateTimePickerCtrlT - CDateTimePickerCtrl -// CMonthCalendarCtrlT - CMonthCalendarCtrl -// CFlatScrollBarImpl -// CFlatScrollBarT - CFlatScrollBar -// CIPAddressCtrlT - CIPAddressCtrl -// CPagerCtrlT - CPagerCtrl -// CLinkCtrlT - CLinkCtrl -// -// CCustomDraw -// -// CCECommandBarCtrlT - CCECommandBarCtrl -// CCECommandBandsCtrlT - CCECommandBandsCtrl - - -namespace WTL -{ - -// These are wrapper classes for Windows standard and common controls. -// To implement a window based on a control, use following: -// Example: Implementing a window based on a list box -// -// class CMyListBox : CWindowImpl -// { -// public: -// BEGIN_MSG_MAP(CMyListBox) -// // put your message handler entries here -// END_MSG_MAP() -// }; - - - -// --- Standard Windows controls --- - -/////////////////////////////////////////////////////////////////////////////// -// CStatic - client side for a Windows STATIC control - -template -class CStaticT : public TBase -{ -public: -// Constructors - CStaticT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CStaticT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("STATIC"); - } - -#ifndef _WIN32_WCE - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); - } - - HENHMETAFILE GetEnhMetaFile() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HENHMETAFILE)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L); - } - - HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HENHMETAFILE)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); - } -#else // CE specific - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ICON, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - } -#endif // _WIN32_WCE - - CBitmapHandle GetBitmap() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L)); - } - - CBitmapHandle SetBitmap(HBITMAP hBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); - } - - HCURSOR GetCursor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L); - } - - HCURSOR SetCursor(HCURSOR hCursor) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); - } -}; - -typedef CStaticT CStatic; - - -/////////////////////////////////////////////////////////////////////////////// -// CButton - client side for a Windows BUTTON control - -template -class CButtonT : public TBase -{ -public: -// Constructors - CButtonT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CButtonT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("BUTTON"); - } - - UINT GetState() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, BM_GETSTATE, 0, 0L); - } - - void SetState(BOOL bHighlight) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETSTATE, bHighlight, 0L); - } - - int GetCheck() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0L); - } - - void SetCheck(int nCheck) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0L); - } - - UINT GetButtonStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::GetWindowLong(m_hWnd, GWL_STYLE) & 0xFFFF; - } - - void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); - } - -#ifndef _WIN32_WCE - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - } - - CBitmapHandle GetBitmap() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L)); - } - - CBitmapHandle SetBitmap(HBITMAP hBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); - } -#endif // !_WIN32_WCE - -#if (_WIN32_WINNT >= 0x0501) - BOOL GetIdealSize(LPSIZE lpSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize); - } - - BOOL GetImageList(PBUTTON_IMAGELIST pButtonImagelist) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist); - } - - BOOL SetImageList(PBUTTON_IMAGELIST pButtonImagelist) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist); - } - - BOOL GetTextMargin(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect); - } - - BOOL SetTextMargin(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (WINVER >= 0x0600) - void SetDontClick(BOOL bDontClick) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L); - } -#endif // (WINVER >= 0x0600) - -#if (_WIN32_WINNT >= 0x0600) - BOOL SetDropDownState(BOOL bDropDown) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L); - } - - BOOL GetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo); - } - - BOOL SetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo); - } - - int GetNoteLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (int)::SendMessage(m_hWnd, BCM_GETNOTELENGTH, 0, 0L); - } - - BOOL GetNote(LPWSTR lpstrNoteText, int cchNoteText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText); - } - - BOOL SetNote(LPCWSTR lpstrNoteText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText); - } - - LRESULT SetElevationRequiredState(BOOL bSet) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SendMessage(m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - void Click() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_CLICK, 0, 0L); - } -}; - -typedef CButtonT CButton; - - -/////////////////////////////////////////////////////////////////////////////// -// CListBox - client side for a Windows LISTBOX control - -template -class CListBoxT : public TBase -{ -public: -// Constructors - CListBoxT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CListBoxT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("LISTBOX"); - } - - // for entire listbox - int GetCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0L); - } - -#ifndef _WIN32_WCE - int SetCount(int cItems) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LBS_NODATA) != 0) && ((GetStyle() & LBS_HASSTRINGS) == 0)); - return (int)::SendMessage(m_hWnd, LB_SETCOUNT, cItems, 0L); - } -#endif // !_WIN32_WCE - - int GetHorizontalExtent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L); - } - - void SetHorizontalExtent(int cxExtent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L); - } - - int GetTopIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTOPINDEX, 0, 0L); - } - - int SetTopIndex(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETTOPINDEX, nIndex, 0L); - } - - LCID GetLocale() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, LB_GETLOCALE, 0, 0L); - } - - LCID SetLocale(LCID nNewLocale) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L); - } - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - DWORD GetListBoxInfo() const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_WINNT >= 0x0501) - return (DWORD)::SendMessage(m_hWnd, LB_GETLISTBOXINFO, 0, 0L); -#else // !(_WIN32_WINNT >= 0x0501) - return ::GetListBoxInfo(m_hWnd); -#endif // !(_WIN32_WINNT >= 0x0501) - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - - // for single-selection listboxes - int GetCurSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return (int)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0L); - } - - int SetCurSel(int nSelect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return (int)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0L); - } - - // for multiple-selection listboxes - int GetSel(int nIndex) const // also works for single-selection - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETSEL, nIndex, 0L); - } - - int SetSel(int nIndex, BOOL bSelect = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_SETSEL, bSelect, nIndex); - } - - int GetSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0L); - } - - int GetSelItems(int nMaxItems, LPINT rgIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); - } - - int GetAnchorIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETANCHORINDEX, 0, 0L); - } - - void SetAnchorIndex(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - ::SendMessage(m_hWnd, LB_SETANCHORINDEX, nIndex, 0L); - } - - int GetCaretIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETCARETINDEX, 0, 0); - } - - int SetCaretIndex(int nIndex, BOOL bScroll = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); - } - - // for listbox items - DWORD_PTR GetItemData(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD_PTR)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); - } - - int SetItemData(int nIndex, DWORD_PTR dwItemData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); - } - - void* GetItemDataPtr(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (void*)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); - } - - int SetItemDataPtr(int nIndex, void* pData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItemData(nIndex, (DWORD_PTR)pData); - } - - int GetItemRect(int nIndex, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); - } - - int GetText(int nIndex, LPTSTR lpszBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); - } - -#ifndef _ATL_NO_COM -#ifdef _OLEAUTO_H_ - BOOL GetTextBSTR(int nIndex, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - int nLen = GetTextLen(nIndex); - if(nLen == LB_ERR) - return FALSE; - - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLen + 1); - if(lpstrText == NULL) - return FALSE; - - if(GetText(nIndex, lpstrText) == LB_ERR) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpstrText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // _OLEAUTO_H_ -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetText(int nIndex, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int cchLen = GetTextLen(nIndex); - if(cchLen == LB_ERR) - return LB_ERR; - int nRet = LB_ERR; - LPTSTR lpstr = strText.GetBufferSetLength(cchLen); - if(lpstr != NULL) - { - nRet = GetText(nIndex, lpstr); - strText.ReleaseBuffer(); - } - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - int GetTextLen(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0L); - } - - int GetItemHeight(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); - } - - int SetItemHeight(int nIndex, UINT cyItemHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); - } - - // Settable only attributes - void SetColumnWidth(int cxWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); - } - - BOOL SetTabStops(int nTabStops, LPINT rgTabStops) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); - } - - BOOL SetTabStops() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 0, 0L); - } - - BOOL SetTabStops(const int& cxEachStop) // takes an 'int' - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); - } - -// Operations - int InitStorage(int nItems, UINT nBytes) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes); - } - - void ResetContent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_RESETCONTENT, 0, 0L); - } - - UINT ItemFromPoint(POINT pt, BOOL& bOutside) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dw = (DWORD)::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); - bOutside = (BOOL)HIWORD(dw); - return (UINT)LOWORD(dw); - } - - // manipulating listbox items - int AddString(LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); - } - - int AddStringW(LPCWSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessageW(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); - } - - int DeleteString(UINT nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_DELETESTRING, nIndex, 0L); - } - - int InsertString(int nIndex, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); - } - - int InsertStringW(int nIndex, LPCWSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessageW(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); - } - -#ifndef _WIN32_WCE - int Dir(UINT attr, LPCTSTR lpszWildCard) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); - } - - int AddFile(LPCTSTR lpstrFileName) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName); - } -#endif // !_WIN32_WCE - - // selection helpers - int FindString(int nStartAfter, LPCTSTR lpszItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem); - } - - int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); - } - - int SelectString(int nStartAfter, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem); - } - - int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - ATLASSERT(nFirstItem <= nLastItem); - return bSelect ? (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem); - } - -#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages - DWORD GetInputMode(BOOL bCurrentMode = TRUE) - { - return SendMessage(LB_GETINPUTMODE, 0, (LPARAM)bCurrentMode); - } - - BOOL SetInputMode(DWORD dwMode) - { - return SendMessage(LB_SETINPUTMODE, 0, (LPARAM)dwMode); - } -#endif // WIN32_PLATFORM_WFSP -}; - -typedef CListBoxT CListBox; - - -/////////////////////////////////////////////////////////////////////////////// -// CComboBox - client side for a Windows COMBOBOX control - -#ifndef WIN32_PLATFORM_WFSP // No COMBOBOX on SmartPhones - -template -class CComboBoxT : public TBase -{ -public: -// Constructors - CComboBoxT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CComboBoxT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("COMBOBOX"); - } - - // for entire combo box - int GetCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0L); - } - - int GetCurSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0L); - } - - int SetCurSel(int nSelect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0L); - } - - LCID GetLocale() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, CB_GETLOCALE, 0, 0L); - } - - LCID SetLocale(LCID nNewLocale) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L); - } - - int GetTopIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETTOPINDEX, 0, 0L); - } - - int SetTopIndex(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETTOPINDEX, nIndex, 0L); - } - - UINT GetHorizontalExtent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L); - } - - void SetHorizontalExtent(UINT nExtent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L); - } - - int GetDroppedWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L); - } - - int SetDroppedWidth(UINT nWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L); - } - -#if ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - BOOL GetComboBoxInfo(PCOMBOBOXINFO pComboBoxInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if ((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - return (BOOL)::SendMessage(m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo); -#else // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - return ::GetComboBoxInfo(m_hWnd, pComboBoxInfo); -#endif // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - } -#endif // ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - - // for edit control - DWORD GetEditSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CB_GETEDITSEL, 0, 0L); - } - - BOOL SetEditSel(int nStartChar, int nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); - } - - // for combobox item - DWORD_PTR GetItemData(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD_PTR)::SendMessage(m_hWnd, CB_GETITEMDATA, nIndex, 0L); - } - - int SetItemData(int nIndex, DWORD_PTR dwItemData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); - } - - void* GetItemDataPtr(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (void*)GetItemData(nIndex); - } - - int SetItemDataPtr(int nIndex, void* pData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItemData(nIndex, (DWORD_PTR)pData); - } - - int GetLBText(int nIndex, LPTSTR lpszText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); - } - -#ifndef _ATL_NO_COM - BOOL GetLBTextBSTR(int nIndex, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - int nLen = GetLBTextLen(nIndex); - if(nLen == CB_ERR) - return FALSE; - - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLen + 1); - if(lpstrText == NULL) - return FALSE; - - if(GetLBText(nIndex, lpstrText) == CB_ERR) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpstrText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetLBText(int nIndex, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int cchLen = GetLBTextLen(nIndex); - if(cchLen == CB_ERR) - return CB_ERR; - int nRet = CB_ERR; - LPTSTR lpstr = strText.GetBufferSetLength(cchLen); - if(lpstr != NULL) - { - nRet = GetLBText(nIndex, lpstr); - strText.ReleaseBuffer(); - } - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - int GetLBTextLen(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L); - } - - int GetItemHeight(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); - } - - int SetItemHeight(int nIndex, UINT cyItemHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); - } - - BOOL GetExtendedUI() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETEXTENDEDUI, 0, 0L); - } - - int SetExtendedUI(BOOL bExtended = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); - } - - void GetDroppedControlRect(LPRECT lprect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect); - } - - BOOL GetDroppedState() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); - } - -#if (_WIN32_WINNT >= 0x0501) - int GetMinVisible() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETMINVISIBLE, 0, 0L); - } - - BOOL SetMinVisible(int nMinVisible) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L); - } - - // Vista only - BOOL GetCueBannerText(LPWSTR lpwText, int cchText) const - { -#ifndef CB_GETCUEBANNER - const UINT CB_GETCUEBANNER = (CBM_FIRST + 4); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText); - } - - // Vista only - BOOL SetCueBannerText(LPCWSTR lpcwText) - { -#ifndef CB_SETCUEBANNER - const UINT CB_SETCUEBANNER = (CBM_FIRST + 3); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - int InitStorage(int nItems, UINT nBytes) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes); - } - - void ResetContent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0L); - } - - // for edit control - BOOL LimitText(int nMaxChars) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_LIMITTEXT, nMaxChars, 0L); - } - - // for drop-down combo boxes - void ShowDropDown(BOOL bShowIt = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L); - } - - // manipulating listbox items - int AddString(LPCTSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); - } - - int AddStringW(LPCWSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessageW(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); - } - - int DeleteString(UINT nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0L); - } - - int InsertString(int nIndex, LPCTSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); - } - -#ifndef _WIN32_WCE - int Dir(UINT attr, LPCTSTR lpszWildCard) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); - } -#endif // !_WIN32_WCE - - // selection helpers - int FindString(int nStartAfter, LPCTSTR lpszString) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString); - } - - int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); - } - - int SelectString(int nStartAfter, LPCTSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString); - } - - // Clipboard operations - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } -}; - -typedef CComboBoxT CComboBox; - -#endif // !WIN32_PLATFORM_WFSP - -/////////////////////////////////////////////////////////////////////////////// -// CEdit - client side for a Windows EDIT control - -template -class CEditT : public TBase -{ -public: -// Constructors - CEditT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CEditT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("EDIT"); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - int GetLineCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); - } - - void GetRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); - } - - DWORD GetSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); - } - - void GetSel(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - } - -#ifndef _WIN32_WCE - HLOCAL GetHandle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HLOCAL)::SendMessage(m_hWnd, EM_GETHANDLE, 0, 0L); - } - - void SetHandle(HLOCAL hBuffer) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L); - } -#endif // !_WIN32_WCE - - DWORD GetMargins() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L); - } - - void SetMargins(UINT nLeft, UINT nRight) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(nLeft, nRight)); - } - - UINT GetLimitText() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); - } - - void SetLimitText(UINT nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETLIMITTEXT, nMax, 0L); - } - - POINT PosFromChar(UINT nChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_POSFROMCHAR, nChar, 0); - POINT point = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; - return point; - } - - int CharFromPos(POINT pt, int* pLine = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)); - if(pLine != NULL) - *pLine = (int)(short)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - // NOTE: first word in lpszBuffer must contain the size of the buffer! - int GetLine(int nIndex, LPTSTR lpszBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - *(LPWORD)lpszBuffer = (WORD)nMaxLength; - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - TCHAR GetPasswordChar() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (TCHAR)::SendMessage(m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); - } - - void SetPasswordChar(TCHAR ch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPASSWORDCHAR, ch, 0L); - } - -#ifndef _WIN32_WCE - EDITWORDBREAKPROC GetWordBreakProc() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROC)::SendMessage(m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); - } - - void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); - } -#endif // !_WIN32_WCE - - int GetFirstVisibleLine() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); - } - -#ifndef _WIN32_WCE - int GetThumb() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & ES_MULTILINE) != 0); - return (int)::SendMessage(m_hWnd, EM_GETTHUMB, 0, 0L); - } -#endif // !_WIN32_WCE - - BOOL SetReadOnly(BOOL bReadOnly = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); - } - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - UINT GetImeStatus(UINT uStatus) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETIMESTATUS, uStatus, 0L); - } - - UINT SetImeStatus(UINT uStatus, UINT uData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETIMESTATUS, uStatus, uData); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - BOOL GetCueBannerText(LPCWSTR lpstrText, int cchText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText); - } - - // bKeepWithFocus - Vista only - BOOL SetCueBannerText(LPCWSTR lpstrText, BOOL bKeepWithFocus = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText)); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - void EmptyUndoBuffer() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); - } - - BOOL FmtLines(BOOL bAddEOL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_FMTLINES, bAddEOL, 0L); - } - - void LimitText(int nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_LIMITTEXT, nChars, 0L); - } - - int LineFromChar(int nIndex = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEFROMCHAR, nIndex, 0L); - } - - int LineIndex(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); - } - - int LineLength(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); - } - - void LineScroll(int nLines, int nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); - } - - void SetRect(LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); - } - - void SetRectNP(LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); - } - - void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection)); - if(!bNoScroll) - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar); - if(!bNoScroll) - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - void SetSelAll(BOOL bNoScroll = FALSE) - { - SetSel(0, -1, bNoScroll); - } - - void SetSelNone(BOOL bNoScroll = FALSE) - { - SetSel(-1, 0, bNoScroll); - } - - BOOL SetTabStops(int nTabStops, LPINT rgTabStops) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); - } - - BOOL SetTabStops() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); - } - - BOOL SetTabStops(const int& cxEachStop) // takes an 'int' - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); - } - - void ScrollCaret() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - int Scroll(int nScrollAction) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & ES_MULTILINE) != 0); - LRESULT lRet = ::SendMessage(m_hWnd, EM_SCROLL, nScrollAction, 0L); - if(!(BOOL)HIWORD(lRet)) - return -1; // failed - return (int)(short)LOWORD(lRet); - - } - - void InsertText(int nInsertAfterChar, LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) - { - SetSel(nInsertAfterChar, nInsertAfterChar, bNoScroll); - ReplaceSel(lpstrText, bCanUndo); - } - - void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) - { - InsertText(GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo); - } - -#if (_WIN32_WINNT >= 0x0501) - BOOL ShowBalloonTip(PEDITBALLOONTIP pEditBaloonTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip); - } - - BOOL HideBalloonTip() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_HIDEBALLOONTIP, 0, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - DWORD GetHilite() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); - } - - void GetHilite(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); - nStartChar = (int)(short)LOWORD(dwRet); - nEndChar = (int)(short)HIWORD(dwRet); - } - - void SetHilite(int nStartChar, int nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETHILITE, nStartChar, nEndChar); - } -#endif // (_WIN32_WINNT >= 0x0600) - - // Clipboard operations - BOOL Undo() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); - } - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } - -#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages - DWORD GetExtendedStyle() - { - return SendMessage(EM_GETEXTENDEDSTYLE); - } - - DWORD SetExtendedStyle(DWORD dwMask, DWORD dwExStyle) - { - return SendMessage(EM_SETEXTENDEDSTYLE, (WPARAM)dwMask, (LPARAM)dwExStyle); - } - - DWORD GetInputMode(BOOL bCurrentMode = TRUE) - { - return SendMessage(EM_GETINPUTMODE, 0, (LPARAM)bCurrentMode); - } - - BOOL SetInputMode(DWORD dwMode) - { - return SendMessage(EM_SETINPUTMODE, 0, (LPARAM)dwMode); - } - - BOOL SetSymbols(LPCTSTR szSymbols) - { - return SendMessage(EM_SETSYMBOLS, 0, (LPARAM)szSymbols); - } - - BOOL ResetSymbols() - { - return SendMessage(EM_SETSYMBOLS); - } -#endif // WIN32_PLATFORM_WFSP -}; - -typedef CEditT CEdit; - - -/////////////////////////////////////////////////////////////////////////////// -// CEditCommands - message handlers for standard EDIT commands - -// Chain to CEditCommands message map. Your class must also derive from CEdit. -// Example: -// class CMyEdit : public CWindowImpl, -// public CEditCommands -// { -// public: -// BEGIN_MSG_MAP(CMyEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CEditCommands, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CEditCommands -{ -public: - BEGIN_MSG_MAP(CEditCommands< T >) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR, OnEditClear) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, OnEditClearAll) - COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEditCopy) - COMMAND_ID_HANDLER(ID_EDIT_CUT, OnEditCut) - COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEditPaste) - COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, OnEditSelectAll) - COMMAND_ID_HANDLER(ID_EDIT_UNDO, OnEditUndo) - END_MSG_MAP() - - LRESULT OnEditClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Clear(); - return 0; - } - - LRESULT OnEditClearAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->SetSel(0, -1); - pT->Clear(); - return 0; - } - - LRESULT OnEditCopy(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Copy(); - return 0; - } - - LRESULT OnEditCut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Cut(); - return 0; - } - - LRESULT OnEditPaste(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Paste(); - return 0; - } - - LRESULT OnEditSelectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->SetSel(0, -1); - return 0; - } - - LRESULT OnEditUndo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Undo(); - return 0; - } - -// State (update UI) helpers - BOOL CanCut() const - { return HasSelection(); } - - BOOL CanCopy() const - { return HasSelection(); } - - BOOL CanClear() const - { return HasSelection(); } - - BOOL CanSelectAll() const - { return HasText(); } - - BOOL CanFind() const - { return HasText(); } - - BOOL CanRepeat() const - { return HasText(); } - - BOOL CanReplace() const - { return HasText(); } - - BOOL CanClearAll() const - { return HasText(); } - -// Implementation - BOOL HasSelection() const - { - const T* pT = static_cast(this); - int nMin, nMax; - ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nMin, (LPARAM)&nMax); - return (nMin != nMax); - } - - BOOL HasText() const - { - const T* pT = static_cast(this); - return (pT->GetWindowTextLength() > 0); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CScrollBar - client side for a Windows SCROLLBAR control - -template -class CScrollBarT : public TBase -{ -public: -// Constructors - CScrollBarT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CScrollBarT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("SCROLLBAR"); - } - -#ifndef _WIN32_WCE - int GetScrollPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::GetScrollPos(m_hWnd, SB_CTL); - } -#endif // !_WIN32_WCE - - int SetScrollPos(int nPos, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw); - } - -#ifndef _WIN32_WCE - void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos); - } -#endif // !_WIN32_WCE - - void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); - } - - BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::GetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo); - } - - int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo, bRedraw); - } - -#ifndef _WIN32_WCE - int GetScrollLimit() const - { - int nMin = 0, nMax = 0; - ::GetScrollRange(m_hWnd, SB_CTL, &nMin, &nMax); - SCROLLINFO info = { 0 }; - info.cbSize = sizeof(SCROLLINFO); - info.fMask = SIF_PAGE; - if(::GetScrollInfo(m_hWnd, SB_CTL, &info)) - nMax -= ((info.nPage - 1) > 0) ? (info.nPage - 1) : 0; - - return nMax; - } - -#if (WINVER >= 0x0500) - BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_WINNT >= 0x0501) - return (BOOL)::SendMessage(m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); -#else // !(_WIN32_WINNT >= 0x0501) - return ::GetScrollBarInfo(m_hWnd, OBJID_CLIENT, pScrollBarInfo); -#endif // !(_WIN32_WINNT >= 0x0501) - } -#endif // (WINVER >= 0x0500) - -// Operations - void ShowScrollBar(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::ShowScrollBar(m_hWnd, SB_CTL, bShow); - } - - BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags); - } -#endif // !_WIN32_WCE -}; - -typedef CScrollBarT CScrollBar; - - -// --- Windows Common Controls --- - -/////////////////////////////////////////////////////////////////////////////// -// CImageList - -class CImageList -{ -public: - HIMAGELIST m_hImageList; - -// Constructor - CImageList(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList) - { } - -// Operators, etc. - CImageList& operator =(HIMAGELIST hImageList) - { - m_hImageList = hImageList; - return *this; - } - - operator HIMAGELIST() const { return m_hImageList; } - - void Attach(HIMAGELIST hImageList) - { - ATLASSERT(m_hImageList == NULL); - ATLASSERT(hImageList != NULL); - m_hImageList = hImageList; - } - - HIMAGELIST Detach() - { - HIMAGELIST hImageList = m_hImageList; - m_hImageList = NULL; - return hImageList; - } - - bool IsNull() const { return (m_hImageList == NULL); } - -// Attributes - int GetImageCount() const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetImageCount(m_hImageList); - } - - COLORREF GetBkColor() const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetBkColor(m_hImageList); - } - - COLORREF SetBkColor(COLORREF cr) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetBkColor(m_hImageList, cr); - } - - BOOL GetImageInfo(int nImage, IMAGEINFO* pImageInfo) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetImageInfo(m_hImageList, nImage, pImageInfo); - } - - HICON GetIcon(int nIndex, UINT uFlags = ILD_NORMAL) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetIcon(m_hImageList, nIndex, uFlags); - } - - BOOL GetIconSize(int& cx, int& cy) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetIconSize(m_hImageList, &cx, &cy); - } - - BOOL GetIconSize(SIZE& size) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetIconSize(m_hImageList, (int*)&size.cx, (int*)&size.cy); - } - - BOOL SetIconSize(int cx, int cy) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetIconSize(m_hImageList, cx, cy); - } - - BOOL SetIconSize(SIZE size) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetIconSize(m_hImageList, size.cx, size.cy); - } - - BOOL SetImageCount(UINT uNewCount) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetImageCount(m_hImageList, uNewCount); - } - - BOOL SetOverlayImage(int nImage, int nOverlay) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetOverlayImage(m_hImageList, nImage, nOverlay); - } - -// Operations - BOOL Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_Create(cx, cy, nFlags, nInitial, nGrow); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - - BOOL Create(ATL::_U_STRINGorID bitmap, int cx, int nGrow, COLORREF crMask) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, cx, nGrow, crMask); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - - BOOL CreateFromImage(ATL::_U_STRINGorID image, int cx, int nGrow, COLORREF crMask, UINT uType, UINT uFlags = LR_DEFAULTCOLOR | LR_DEFAULTSIZE) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, cx, nGrow, crMask, uType, uFlags); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - - BOOL Merge(HIMAGELIST hImageList1, int nImage1, HIMAGELIST hImageList2, int nImage2, int dx, int dy) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_Merge(hImageList1, nImage1, hImageList2, nImage2, dx, dy); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - -#ifndef _WIN32_WCE -#ifdef __IStream_INTERFACE_DEFINED__ - BOOL CreateFromStream(LPSTREAM lpStream) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_Read(lpStream); - return (m_hImageList != NULL) ? TRUE : FALSE; - } -#endif // __IStream_INTERFACE_DEFINED__ -#endif // !_WIN32_WCE - - BOOL Destroy() - { - if (m_hImageList == NULL) - return FALSE; - BOOL bRet = ImageList_Destroy(m_hImageList); - if(bRet) - m_hImageList = NULL; - return bRet; - } - - int Add(HBITMAP hBitmap, HBITMAP hBitmapMask = NULL) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Add(m_hImageList, hBitmap, hBitmapMask); - } - - int Add(HBITMAP hBitmap, COLORREF crMask) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_AddMasked(m_hImageList, hBitmap, crMask); - } - - BOOL Remove(int nImage) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Remove(m_hImageList, nImage); - } - - BOOL RemoveAll() - { - ATLASSERT(m_hImageList != NULL); - return ImageList_RemoveAll(m_hImageList); - } - - BOOL Replace(int nImage, HBITMAP hBitmap, HBITMAP hBitmapMask) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Replace(m_hImageList, nImage, hBitmap, hBitmapMask); - } - - int AddIcon(HICON hIcon) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_AddIcon(m_hImageList, hIcon); - } - - int ReplaceIcon(int nImage, HICON hIcon) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_ReplaceIcon(m_hImageList, nImage, hIcon); - } - - HICON ExtractIcon(int nImage) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_ExtractIcon(NULL, m_hImageList, nImage); - } - - BOOL Draw(HDC hDC, int nImage, int x, int y, UINT nStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_Draw(m_hImageList, nImage, hDC, x, y, nStyle); - } - - BOOL Draw(HDC hDC, int nImage, POINT pt, UINT nStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_Draw(m_hImageList, nImage, hDC, pt.x, pt.y, nStyle); - } - - BOOL DrawEx(int nImage, HDC hDC, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_DrawEx(m_hImageList, nImage, hDC, x, y, dx, dy, rgbBk, rgbFg, fStyle); - } - - BOOL DrawEx(int nImage, HDC hDC, RECT& rect, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_DrawEx(m_hImageList, nImage, hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, rgbBk, rgbFg, fStyle); - } - - static BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp) - { - return ImageList_DrawIndirect(pimldp); - } - - BOOL Copy(int nSrc, int nDst, UINT uFlags = ILCF_MOVE) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Copy(m_hImageList, nDst, m_hImageList, nSrc, uFlags); - } - -#ifdef __IStream_INTERFACE_DEFINED__ -#ifndef _WIN32_WCE - static HIMAGELIST Read(LPSTREAM lpStream) - { - return ImageList_Read(lpStream); - } - - BOOL Write(LPSTREAM lpStream) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Write(m_hImageList, lpStream); - } -#endif // !_WIN32_WCE - -#if (_WIN32_WINNT >= 0x0501) - static HRESULT ReadEx(DWORD dwFlags, LPSTREAM lpStream, REFIID riid, PVOID* ppv) - { - return ImageList_ReadEx(dwFlags, lpStream, riid, ppv); - } - - HRESULT WriteEx(DWORD dwFlags, LPSTREAM lpStream) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_WriteEx(m_hImageList, dwFlags, lpStream); - } -#endif // (_WIN32_WINNT >= 0x0501) -#endif // __IStream_INTERFACE_DEFINED__ - - // Drag operations - BOOL BeginDrag(int nImage, POINT ptHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_BeginDrag(m_hImageList, nImage, ptHotSpot.x, ptHotSpot.y); - } - - BOOL BeginDrag(int nImage, int xHotSpot, int yHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_BeginDrag(m_hImageList, nImage, xHotSpot, yHotSpot); - } - - static void EndDrag() - { - ImageList_EndDrag(); - } - - static BOOL DragMove(POINT pt) - { - return ImageList_DragMove(pt.x, pt.y); - } - - static BOOL DragMove(int x, int y) - { - return ImageList_DragMove(x, y); - } - - BOOL SetDragCursorImage(int nDrag, POINT ptHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetDragCursorImage(m_hImageList, nDrag, ptHotSpot.x, ptHotSpot.y); - } - - BOOL SetDragCursorImage(int nDrag, int xHotSpot, int yHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetDragCursorImage(m_hImageList, nDrag, xHotSpot, yHotSpot); - } - - static BOOL DragShowNolock(BOOL bShow = TRUE) - { - return ImageList_DragShowNolock(bShow); - } - - static CImageList GetDragImage(LPPOINT lpPoint, LPPOINT lpPointHotSpot) - { - return CImageList(ImageList_GetDragImage(lpPoint, lpPointHotSpot)); - } - - static BOOL DragEnter(HWND hWnd, POINT point) - { - return ImageList_DragEnter(hWnd, point.x, point.y); - } - - static BOOL DragEnter(HWND hWnd, int x, int y) - { - return ImageList_DragEnter(hWnd, x, y); - } - - static BOOL DragLeave(HWND hWnd) - { - return ImageList_DragLeave(hWnd); - } - -#if (_WIN32_IE >= 0x0400) - CImageList Duplicate() const - { - ATLASSERT(m_hImageList != NULL); - return CImageList(ImageList_Duplicate(m_hImageList)); - } - - static CImageList Duplicate(HIMAGELIST hImageList) - { - ATLASSERT(hImageList != NULL); - return CImageList(ImageList_Duplicate(hImageList)); - } -#endif // (_WIN32_IE >= 0x0400) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CToolTipCtrl - -#ifndef _WIN32_WCE - -class CToolInfo : public TOOLINFO -{ -public: - CToolInfo(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) - { - Init(nFlags, hWnd, nIDTool, lpRect, lpstrText, lUserParam); - } - - operator LPTOOLINFO() { return this; } - - operator LPARAM() { return (LPARAM)this; } - - void Init(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) - { - ATLASSERT(::IsWindow(hWnd)); - memset(this, 0, sizeof(TOOLINFO)); - cbSize = sizeof(TOOLINFO); - uFlags = nFlags; - if(nIDTool == 0) - { - hwnd = ::GetParent(hWnd); - uFlags |= TTF_IDISHWND; - uId = (UINT_PTR)hWnd; - } - else - { - hwnd = hWnd; - uId = nIDTool; - } - if(lpRect != NULL) - rect = *lpRect; - hinst = ModuleHelper::GetResourceInstance(); - lpszText = lpstrText; - lParam = lUserParam; - } -}; - -template -class CToolTipCtrlT : public TBase -{ -public: -// Constructors - CToolTipCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CToolTipCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return TOOLTIPS_CLASS; - } - - void GetText(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo); - } - - void GetText(LPTSTR lpstrText, HWND hWnd, UINT nIDTool = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); - ::SendMessage(m_hWnd, TTM_GETTEXT, 0, ti); - } - - BOOL GetToolInfo(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo); - } - - BOOL GetToolInfo(HWND hWnd, UINT nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - ATLASSERT(puFlags != NULL); - ATLASSERT(lpRect != NULL); - CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); - BOOL bRet = (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, ti); - if(bRet != FALSE) - { - *puFlags = ti.uFlags; - *lpRect = ti.rect; - } - return bRet; - } - - void SetToolInfo(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo); - } - - void SetToolRect(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo); - } - - void SetToolRect(HWND hWnd, UINT nIDTool, LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - ATLASSERT(nIDTool != 0); - - CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRect, NULL); - ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, ti); - } - - int GetToolCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETTOOLCOUNT, 0, 0L); - } - - int GetDelayTime(DWORD dwType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETDELAYTIME, dwType, 0L); - } - - void SetDelayTime(DWORD dwType, int nTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0)); - } - - void GetMargin(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect); - } - - void SetMargin(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect); - } - - int GetMaxTipWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L); - } - - int SetMaxTipWidth(int nWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth); - } - - COLORREF GetTipBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L); - } - - void SetTipBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L); - } - - COLORREF GetTipTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L); - } - - void SetTipTextColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L); - } - - BOOL GetCurrentTool(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo); - } - -#if (_WIN32_IE >= 0x0500) - SIZE GetBubbleSize(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo); - SIZE size = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; - return size; - } - - BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle); - } -#endif // (_WIN32_IE >= 0x0500) - -#if (_WIN32_WINNT >= 0x0501) - void GetTitle(PTTGETTITLE pTTGetTitle) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle); - } - - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - void Activate(BOOL bActivate) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_ACTIVATE, bActivate, 0L); - } - - BOOL AddTool(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo); - } - - BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT nIDTool = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - // the toolrect and toolid must both be zero or both valid - ATLASSERT((lpRectTool != NULL && nIDTool != 0) || (lpRectTool == NULL && nIDTool == 0)); - - CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRectTool, (LPTSTR)text.m_lpstr); - return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, ti); - } - - void DelTool(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo); - } - - void DelTool(HWND hWnd, UINT nIDTool = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - - CToolInfo ti(0, hWnd, nIDTool, NULL, NULL); - ::SendMessage(m_hWnd, TTM_DELTOOL, 0, ti); - } - - BOOL HitTest(LPTTHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo); - } - - BOOL HitTest(HWND hWnd, POINT pt, LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - ATLASSERT(lpToolInfo != NULL); - - TTHITTESTINFO hti = { 0 }; - hti.ti.cbSize = sizeof(TOOLINFO); - hti.hwnd = hWnd; - hti.pt.x = pt.x; - hti.pt.y = pt.y; - if((BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE) - { - *lpToolInfo = hti.ti; - return TRUE; - } - return FALSE; - } - - void RelayEvent(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg); - } - - void UpdateTipText(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo); - } - - void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT nIDTool = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - - CToolInfo ti(0, hWnd, nIDTool, NULL, (LPTSTR)text.m_lpstr); - ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, ti); - } - - BOOL EnumTools(UINT nTool, LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo); - } - - void Pop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_POP, 0, 0L); - } - - void TrackActivate(LPTOOLINFO lpToolInfo, BOOL bActivate) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo); - } - - void TrackPosition(int xPos, int yPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos)); - } - -#if (_WIN32_IE >= 0x0400) - void Update() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_UPDATE, 0, 0L); - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - BOOL AdjustRect(LPRECT lpRect, BOOL bLarger /*= TRUE*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect); - } -#endif // (_WIN32_IE >= 0x0500) - -#if (_WIN32_WINNT >= 0x0501) - void Popup() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_POPUP, 0, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) -}; - -typedef CToolTipCtrlT CToolTipCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CHeaderCtrl - -template -class CHeaderCtrlT : public TBase -{ -public: -// Constructors - CHeaderCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHeaderCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_HEADER; - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETITEMCOUNT, 0, 0L); - } - - BOOL GetItem(int nIndex, LPHDITEM pHeaderItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem); - } - - BOOL SetItem(int nIndex, LPHDITEM pHeaderItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem); - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_GETIMAGELIST, 0, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList)); - } - - BOOL GetOrderArray(int nSize, int* lpnArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray); - } - - BOOL SetOrderArray(int nSize, int* lpnArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray); - } - - BOOL GetItemRect(int nIndex, LPRECT lpItemRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect); - } - - int SetHotDivider(BOOL bPos, DWORD dwInputValue) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int GetBitmapMargin() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L); - } - - int SetBitmapMargin(int nWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L); - } - - int SetFilterChangeTimeout(DWORD dwTimeOut) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0600) - BOOL GetItemDropDownRect(int nIndex, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); - } - - BOOL GetOverflowRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect); - } - - int GetFocusedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L); - } - - BOOL SetFocusedItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - int InsertItem(int nIndex, LPHDITEM phdi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi); - } - - int AddItem(LPHDITEM phdi) - { - return InsertItem(GetItemCount(), phdi); - } - - BOOL DeleteItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_DELETEITEM, nIndex, 0L); - } - - BOOL Layout(HD_LAYOUT* pHeaderLayout) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout); - } - - int HitTest(LPHDHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo); - } - - int OrderToIndex(int nOrder) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L); - } - - CImageList CreateDragImage(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L)); - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int EditFilter(int nColumn, BOOL bDiscardChanges) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0)); - } - - int ClearFilter(int nColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, nColumn, 0L); - } - - int ClearAllFilters() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CHeaderCtrlT CHeaderCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CListViewCtrl - -template -class CListViewCtrlT : public TBase -{ -public: -// Constructors - CListViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CListViewCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_LISTVIEW; - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETBKCOLOR, 0, 0L); - } - - BOOL SetBkColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETBKCOLOR, 0, cr); - } - - CImageList GetImageList(int nImageListType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList, int nImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList)); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETITEMCOUNT, 0, 0L); - } - - BOOL SetItemCount(int nItems) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, 0L); - } - - BOOL GetItem(LPLVITEM pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, - int nImage, UINT nState, UINT nStateMask, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.mask = nMask; - lvi.iItem = nItem; - lvi.iSubItem = nSubItem; - lvi.stateMask = nStateMask; - lvi.state = nState; - lvi.pszText = (LPTSTR) lpszItem; - lvi.iImage = nImage; - lvi.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi); - } - - UINT GetItemState(int nItem, UINT nMask) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETITEMSTATE, nItem, nMask); - } - - BOOL SetItemState(int nItem, UINT nState, UINT nStateMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.state = nState; - lvi.stateMask = nStateMask; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); - } - - BOOL SetItemState(int nItem, LPLVITEM pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem); - } - -#ifndef _ATL_NO_COM - BOOL GetItemText(int nItem, int nSubItem, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - LVITEM lvi = { 0 }; - lvi.iSubItem = nSubItem; - - LPTSTR lpstrText = NULL; - int nRes = 0; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - lpstrText[0] = NULL; - lvi.cchTextMax = nLen; - lvi.pszText = lpstrText; - nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); - if(nRes < nLen - 1) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(nRes != 0) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetItemText(int nItem, int nSubItem, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.iSubItem = nSubItem; - - strText.Empty(); - int nRes = 0; - for(int nLen = 256; ; nLen *= 2) - { - lvi.cchTextMax = nLen; - lvi.pszText = strText.GetBufferSetLength(nLen); - if(lvi.pszText == NULL) - { - nRes = 0; - break; - } - nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); - if(nRes < nLen - 1) - break; - } - strText.ReleaseBuffer(); - return nRes; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - int GetItemText(int nItem, int nSubItem, LPTSTR lpszText, int nLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.iSubItem = nSubItem; - lvi.cchTextMax = nLen; - lvi.pszText = lpszText; - return (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); - } - - BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(nItem, nSubItem, LVIF_TEXT, lpszText, 0, 0, 0, 0); - } - - DWORD_PTR GetItemData(int nItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.iItem = nItem; - lvi.mask = LVIF_PARAM; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi); - return (DWORD_PTR)(bRet ? lvi.lParam : NULL); - } - - BOOL SetItemData(int nItem, DWORD_PTR dwData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData); - } - - UINT GetCallbackMask() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETCALLBACKMASK, 0, 0L); - } - - BOOL SetCallbackMask(UINT nMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L); - } - - BOOL GetItemPosition(int nItem, LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint); - } - - BOOL SetItemPosition(int nItem, POINT pt) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); - } - - BOOL SetItemPosition(int nItem, int x, int y) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); - POINT pt = { x, y }; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); - } - - int GetStringWidth(LPCTSTR lpsz) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); - } - - CEdit GetEditControl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, LVM_GETEDITCONTROL, 0, 0L)); - } - - BOOL GetColumn(int nCol, LVCOLUMN* pColumn) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn); - } - - BOOL SetColumn(int nCol, const LVCOLUMN* pColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn); - } - - int GetColumnWidth(int nCol) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L); - } - - BOOL SetColumnWidth(int nCol, int cx) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); - } - - BOOL GetViewRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect); - } - - COLORREF GetTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTCOLOR, 0, 0L); - } - - BOOL SetTextColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTCOLOR, 0, cr); - } - - COLORREF GetTextBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L); - } - - BOOL SetTextBkColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr); - } - - int GetTopIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETTOPINDEX, 0, 0L); - } - - int GetCountPerPage() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L); - } - - BOOL GetOrigin(LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint); - } - - UINT GetSelectedCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L); - } - - BOOL GetItemRect(int nItem, LPRECT lpRect, UINT nCode) const - { - ATLASSERT(::IsWindow(m_hWnd)); - lpRect->left = nCode; - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); - } - -#ifndef _WIN32_WCE - HCURSOR GetHotCursor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, LVM_GETHOTCURSOR, 0, 0L); - } - - HCURSOR SetHotCursor(HCURSOR hHotCursor) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor); - } - - int GetHotItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETHOTITEM, 0, 0L); - } - - int SetHotItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETHOTITEM, nIndex, 0L); - } -#endif // !_WIN32_WCE - - BOOL GetColumnOrderArray(int nCount, int* lpnArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); - } - - BOOL SetColumnOrderArray(int nCount, int* lpnArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); - } - - CHeaderCtrl GetHeader() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CHeaderCtrl((HWND)::SendMessage(m_hWnd, LVM_GETHEADER, 0, 0L)); - } - - BOOL GetSubItemRect(int nItem, int nSubItem, int nFlag, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_REPORT); - ATLASSERT(lpRect != NULL); - lpRect->top = nSubItem; - lpRect->left = nFlag; - return (BOOL)::SendMessage(m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect); - } - - DWORD SetIconSpacing(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_ICON); - return (DWORD)::SendMessage(m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy)); - } - - int GetISearchString(LPTSTR lpstr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); - } - - void GetItemSpacing(SIZE& sizeSpacing, BOOL bSmallIconView = FALSE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L); - sizeSpacing.cx = GET_X_LPARAM(dwRet); - sizeSpacing.cy = GET_Y_LPARAM(dwRet); - } - -#if (_WIN32_WCE >= 410) - void SetItemSpacing(INT cySpacing) - { - ATLASSERT(::IsWindow(m_hWnd)); - ListView_SetItemSpacing(m_hWnd, cySpacing); - } -#endif // (_WIN32_WCE >= 410) - - // single-selection only - int GetSelectedIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); - return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); - } - - BOOL GetSelectedItem(LPLVITEM pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); - ATLASSERT(pItem != NULL); - pItem->iItem = (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); - if(pItem->iItem == -1) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); - } - - // extended list view styles - DWORD GetExtendedListViewStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L); - } - - // dwExMask = 0 means all styles - DWORD SetExtendedListViewStyle(DWORD dwExStyle, DWORD dwExMask = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle); - } - - // checkboxes only - BOOL GetCheckState(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetExtendedListViewStyle() & LVS_EX_CHECKBOXES) != 0); - UINT uRet = GetItemState(nIndex, LVIS_STATEIMAGEMASK); - return (uRet >> 12) - 1; - } - - BOOL SetCheckState(int nItem, BOOL bCheck) - { - int nCheck = bCheck ? 2 : 1; // one based index - return SetItemState(nItem, INDEXTOSTATEIMAGEMASK(nCheck), LVIS_STATEIMAGEMASK); - } - - // view type - DWORD GetViewType() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (GetStyle() & LVS_TYPEMASK); - } - - DWORD SetViewType(DWORD dwType) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(dwType == LVS_ICON || dwType == LVS_SMALLICON || dwType == LVS_LIST || dwType == LVS_REPORT); - DWORD dwOldType = GetViewType(); - if(dwType != dwOldType) - ModifyStyle(LVS_TYPEMASK, (dwType & LVS_TYPEMASK)); - return dwOldType; - } - -#if (_WIN32_IE >= 0x0400) -#ifndef _WIN32_WCE - BOOL GetBkImage(LPLVBKIMAGE plvbki) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki); - } - - BOOL SetBkImage(LPLVBKIMAGE plvbki) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki); - } -#endif // !_WIN32_WCE - - int GetSelectionMark() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSELECTIONMARK, 0, 0L); - } - - int SetSelectionMark(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex); - } - -#ifndef _WIN32_WCE - BOOL GetWorkAreas(int nWorkAreas, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect); - } - - BOOL SetWorkAreas(int nWorkAreas, LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect); - } - - DWORD GetHoverTime() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); - return (DWORD)::SendMessage(m_hWnd, LVM_GETHOVERTIME, 0, 0L); - } - - DWORD SetHoverTime(DWORD dwHoverTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); - return (DWORD)::SendMessage(m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime); - } - - BOOL GetNumberOfWorkAreas(int* pnWorkAreas) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas); - } -#endif // !_WIN32_WCE - - BOOL SetItemCountEx(int nItems, DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_OWNERDATA) != 0) && (((GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((GetStyle() & LVS_TYPEMASK) == LVS_LIST))); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_GETTOOLTIPS, 0, 0L)); - } - - CToolTipCtrl SetToolTips(HWND hWndTT) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0501) - int GetSelectedColumn() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L); - } - - void SetSelectedColumn(int nColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L); - } - - DWORD GetView() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_GETVIEW, 0, 0L); - } - - int SetView(DWORD dwView) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETVIEW, dwView, 0L); - } - - BOOL IsGroupViewEnabled() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L); - } - - int GetGroupInfo(int nGroupID, PLVGROUP pGroup) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup); - } - - int SetGroupInfo(int nGroupID, PLVGROUP pGroup) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup); - } - - void GetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); - } - - void SetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); - } - - void GetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); - } - - BOOL SetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); - } - - void GetTileInfo(PLVTILEINFO pTileInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo); - } - - BOOL SetTileInfo(PLVTILEINFO pTileInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo); - } - - BOOL GetInsertMark(LPLVINSERTMARK pInsertMark) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark); - } - - BOOL SetInsertMark(LPLVINSERTMARK pInsertMark) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark); - } - - int GetInsertMarkRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect); - } - - COLORREF GetInsertMarkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L); - } - - COLORREF SetInsertMarkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr); - } - - COLORREF GetOutlineColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L); - } - - COLORREF SetOutlineColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_SETOUTLINECOLOR, 0, clr); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - int GetGroupCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETGROUPCOUNT, 0, 0L); - } - - BOOL GetGroupInfoByIndex(int nIndex, PLVGROUP pGroup) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup); - } - - BOOL GetGroupRect(int nGroupID, int nType, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpRect != NULL); - if(lpRect != NULL) - lpRect->top = nType; - return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect); - } - - UINT GetGroupState(int nGroupID, UINT uMask) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask); - } - - int GetFocusedGroup() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L); - } - - BOOL GetEmptyText(LPWSTR lpstrText, int cchText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText); - } - - BOOL GetFooterRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect); - } - - BOOL GetFooterInfo(LPLVFOOTERINFO lpFooterInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo); - } - - BOOL GetFooterItemRect(int nItem, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect); - } - - BOOL GetFooterItem(int nItem, LPLVFOOTERITEM lpFooterItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem); - } - - BOOL GetItemIndexRect(PLVITEMINDEX pItemIndex, int nSubItem, int nType, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pItemIndex != NULL); - ATLASSERT(lpRect != NULL); - if(lpRect != NULL) - { - lpRect->top = nSubItem; - lpRect->left = nType; - } - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect); - } - - BOOL SetItemIndexState(PLVITEMINDEX pItemIndex, UINT uState, UINT dwMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.state = uState; - lvi.stateMask = dwMask; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi); - } - - BOOL GetNextItemIndex(PLVITEMINDEX pItemIndex, WORD wFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0)); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - int InsertColumn(int nCol, const LVCOLUMN* pColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); - } - - int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, - int nWidth = -1, int nSubItem = -1, int iImage = -1, int iOrder = -1) - { - LVCOLUMN column = { 0 }; - column.mask = LVCF_TEXT|LVCF_FMT; - column.pszText = (LPTSTR)lpszColumnHeading; - column.fmt = nFormat; - if (nWidth != -1) - { - column.mask |= LVCF_WIDTH; - column.cx = nWidth; - } - if (nSubItem != -1) - { - column.mask |= LVCF_SUBITEM; - column.iSubItem = nSubItem; - } - if (iImage != -1) - { - column.mask |= LVCF_IMAGE; - column.iImage = iImage; - } - if (iOrder != -1) - { - column.mask |= LVCF_ORDER; - column.iOrder = iOrder; - } - return InsertColumn(nCol, &column); - } - - BOOL DeleteColumn(int nCol) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETECOLUMN, nCol, 0L); - } - - int InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM item = { 0 }; - item.mask = nMask; - item.iItem = nItem; - item.iSubItem = 0; - item.pszText = (LPTSTR)lpszItem; - item.state = nState; - item.stateMask = nStateMask; - item.iImage = nImage; - item.lParam = lParam; - return InsertItem(&item); - } - - int InsertItem(const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem); - } - - int InsertItem(int nItem, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(LVIF_TEXT, nItem, lpszItem, 0, 0, 0, 0); - } - - int InsertItem(int nItem, LPCTSTR lpszItem, int nImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0); - } - - int GetNextItem(int nItem, int nFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0)); - } - - BOOL DeleteItem(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETEITEM, nItem, 0L); - } - - BOOL DeleteAllItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETEALLITEMS, 0, 0L); - } - - int FindItem(LVFINDINFO* pFindInfo, int nStart) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); - } - - int HitTest(LVHITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo); - } - - int HitTest(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVHITTESTINFO hti = { 0 }; - hti.pt = pt; - int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return nRes; - } - - BOOL EnsureVisible(int nItem, BOOL bPartialOK) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); - } - - BOOL Scroll(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SCROLL, size.cx, size.cy); - } - - BOOL RedrawItems(int nFirst, int nLast) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_REDRAWITEMS, nFirst, nLast); - } - - BOOL Arrange(UINT nCode) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ARRANGE, nCode, 0L); - } - - CEdit EditLabel(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, LVM_EDITLABEL, nItem, 0L)); - } - - BOOL Update(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_UPDATE, nItem, 0L); - } - - BOOL SortItems(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare); - } - - CImageList RemoveImageList(int nImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); - } - - CImageList CreateDragImage(int nItem, LPPOINT lpPoint) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint)); - } - - DWORD ApproximateViewRect(int cx = -1, int cy = -1, int nCount = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy)); - } - - int SubItemHitTest(LPLVHITTESTINFO lpInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo); - } - - int AddColumn(LPCTSTR strItem, int nItem, int nSubItem = -1, - int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM, - int nFmt = LVCFMT_LEFT) - { - const int cxOffset = 15; - ATLASSERT(::IsWindow(m_hWnd)); - LVCOLUMN lvc = { 0 }; - lvc.mask = nMask; - lvc.fmt = nFmt; - lvc.pszText = (LPTSTR)strItem; - lvc.cx = GetStringWidth(lvc.pszText) + cxOffset; - if(nMask & LVCF_SUBITEM) - lvc.iSubItem = (nSubItem != -1) ? nSubItem : nItem; - return InsertColumn(nItem, &lvc); - } - - int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvItem = { 0 }; - lvItem.mask = LVIF_TEXT; - lvItem.iItem = nItem; - lvItem.iSubItem = nSubItem; - lvItem.pszText = (LPTSTR)strItem; - if(nImageIndex != -1) - { - lvItem.mask |= LVIF_IMAGE; - lvItem.iImage = nImageIndex; - } - if(nSubItem == 0) - return InsertItem(&lvItem); - return SetItem(&lvItem) ? nItem : -1; - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - BOOL SortItemsEx(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - int InsertGroup(int nItem, PLVGROUP pGroup) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup); - } - - int AddGroup(PLVGROUP pGroup) - { - return InsertGroup(-1, pGroup); - } - - int RemoveGroup(int nGroupID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L); - } - - void MoveGroup(int nGroupID, int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_MOVEGROUP, nGroupID, nItem); - } - - void MoveItemToGroup(int nItem, int nGroupID) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID); - } - - int EnableGroupView(BOOL bEnable) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L); - } - - int SortGroups(PFNLVGROUPCOMPARE pCompareFunc, LPVOID lpVoid = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid); - } - - void InsertGroupSorted(PLVINSERTGROUPSORTED pInsertGroupSorted) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L); - } - - void RemoveAllGroups() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L); - } - - BOOL HasGroup(int nGroupID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_HASGROUP, nGroupID, 0L); - } - - BOOL InsertMarkHitTest(LPPOINT lpPoint, LPLVINSERTMARK pInsertMark) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark); - } - - BOOL SetInfoTip(PLVSETINFOTIP pSetInfoTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip); - } - - void CancelEditLabel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_CANCELEDITLABEL, 0, 0L); - } - - UINT MapIndexToID(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L); - } - - int MapIDToIndex(UINT uID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_MAPIDTOINDEX, uID, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - int HitTestEx(LPLVHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); - } - - int HitTestEx(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVHITTESTINFO hti = { 0 }; - hti.pt = pt; - int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return nRes; - } - - int SubItemHitTestEx(LPLVHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); - } -#endif // (_WIN32_WINNT >= 0x0600) - - // Note: selects only one item - BOOL SelectItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - - // multi-selection only: de-select all items - if((GetStyle() & LVS_SINGLESEL) == 0) - SetItemState(-1, 0, LVIS_SELECTED); - - BOOL bRet = SetItemState(nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); - if(bRet) - bRet = EnsureVisible(nIndex, FALSE); - - return bRet; - } -}; - -typedef CListViewCtrlT CListViewCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTreeViewCtrl - -template -class CTreeViewCtrlT : public TBase -{ -public: -// Constructors - CTreeViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTreeViewCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TREEVIEW; - } - - UINT GetCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETCOUNT, 0, 0L); - } - - UINT GetIndent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETINDENT, 0, 0L); - } - - void SetIndent(UINT nIndent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TVM_SETINDENT, nIndent, 0L); - } - - CImageList GetImageList(int nImageListType = TVSIL_NORMAL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList, int nImageListType = TVSIL_NORMAL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList)); - } - - BOOL GetItem(LPTVITEM pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(LPTVITEM pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = nMask; - item.pszText = (LPTSTR) lpszItem; - item.iImage = nImage; - item.iSelectedImage = nSelectedImage; - item.state = nState; - item.stateMask = nStateMask; - item.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&item); - } - - BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpstrText != NULL); - - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_TEXT; - item.pszText = lpstrText; - item.cchTextMax = nLen; - - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - } - -#ifndef _ATL_NO_COM - BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_TEXT; - - LPTSTR lpstrText = NULL; - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - lpstrText[0] = NULL; - item.pszText = lpstrText; - item.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if(!bRet || (lstrlen(item.pszText) < nLen - 1)) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(bRet) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetItemText(HTREEITEM hItem, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_TEXT; - - strText.Empty(); - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - item.pszText = strText.GetBufferSetLength(nLen); - if(item.pszText == NULL) - { - bRet = FALSE; - break; - } - item.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if(!bRet || (lstrlen(item.pszText) < nLen - 1)) - break; - } - strText.ReleaseBuffer(); - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_TEXT, lpszItem, 0, 0, 0, 0, NULL); - } - - BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE; - BOOL bRes = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if (bRes) - { - nImage = item.iImage; - nSelectedImage = item.iSelectedImage; - } - return bRes; - } - - BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_IMAGE|TVIF_SELECTEDIMAGE, NULL, nImage, nSelectedImage, 0, 0, NULL); - } - - UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - return (((UINT)::SendMessage(m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask); -#else // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_STATE; - item.state = 0; - item.stateMask = nStateMask; - ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return (item.state & nStateMask); -#endif // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) - } - - BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_STATE, NULL, 0, 0, nState, nStateMask, NULL); - } - - DWORD_PTR GetItemData(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_PARAM; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return (DWORD_PTR)(bRet ? item.lParam : NULL); - } - - BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_PARAM, NULL, 0, 0, 0, 0, (LPARAM)dwData); - } - - CEdit GetEditControl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, TVM_GETEDITCONTROL, 0, 0L)); - } - - UINT GetVisibleCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L); - } - - BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const - { - ATLASSERT(::IsWindow(m_hWnd)); - *(HTREEITEM*)lpRect = hItem; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect); - } - - BOOL ItemHasChildren(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_CHILDREN; - ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return item.cChildren; - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_GETTOOLTIPS, 0, 0L)); - } - - CToolTipCtrl SetToolTips(HWND hWndTT) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); - } -#endif // !_WIN32_WCE - - int GetISearchString(LPTSTR lpstr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); - } - - // checkboxes only - BOOL GetCheckState(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & TVS_CHECKBOXES) != 0); - UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK); - return (uRet >> 12) - 1; - } - - BOOL SetCheckState(HTREEITEM hItem, BOOL bCheck) - { - int nCheck = bCheck ? 2 : 1; // one based index - return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(nCheck), TVIS_STATEIMAGEMASK); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETBKCOLOR, 0, 0L); - } - - COLORREF SetBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr); - } - - COLORREF GetInsertMarkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L); - } - - COLORREF SetInsertMarkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr); - } - - int GetItemHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETITEMHEIGHT, 0, 0L); - } - - int SetItemHeight(int cyHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L); - } - - int GetScrollTime() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETSCROLLTIME, 0, 0L); - } - - int SetScrollTime(int nScrollTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L); - } - - COLORREF GetTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETTEXTCOLOR, 0, 0L); - } - - COLORREF SetTextColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - COLORREF GetLineColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETLINECOLOR, 0, 0L); - } - - COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetItem(LPTVITEMEX pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(LPTVITEMEX pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - DWORD GetExtendedStyle() const - { -#ifndef TVM_GETEXTENDEDSTYLE - const UINT TVM_GETEXTENDEDSTYLE = (TV_FIRST + 45); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) - { -#ifndef TVM_SETEXTENDEDSTYLE - const UINT TVM_SETEXTENDEDSTYLE = (TV_FIRST + 44); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle); - } - -#if (_WIN32_WINNT >= 0x0600) - BOOL SetAutoScrollInfo(UINT uPixPerSec, UINT uUpdateTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime); - } - - DWORD GetSelectedCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L); - } - - BOOL GetItemPartRect(HTREEITEM hItem, TVITEMPART partID, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVGETITEMPARTRECTINFO gipri = { hItem, lpRect, partID }; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - HTREEITEM InsertItem(LPTVINSERTSTRUCT lpInsertStruct) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); - } - - HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, - int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); - } - - HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); - } - - HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, - HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVINSERTSTRUCT tvis = { 0 }; - tvis.hParent = hParent; - tvis.hInsertAfter = hInsertAfter; - tvis.item.mask = nMask; - tvis.item.pszText = (LPTSTR) lpszItem; - tvis.item.iImage = nImage; - tvis.item.iSelectedImage = nSelectedImage; - tvis.item.state = nState; - tvis.item.stateMask = nStateMask; - tvis.item.lParam = lParam; - return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); - } - - HTREEITEM InsertItemW(UINT nMask, LPCWSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, - HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVINSERTSTRUCTW tvis = { 0 }; - tvis.hParent = hParent; - tvis.hInsertAfter = hInsertAfter; - tvis.item.mask = nMask; - tvis.item.pszText = (LPWSTR) lpszItem; - tvis.item.iImage = nImage; - tvis.item.iSelectedImage = nSelectedImage; - tvis.item.state = nState; - tvis.item.stateMask = nStateMask; - tvis.item.lParam = lParam; - return (HTREEITEM)::SendMessageW(m_hWnd, TVM_INSERTITEMW, 0, (LPARAM)&tvis); - } - - BOOL DeleteItem(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem); - } - - BOOL DeleteAllItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); - } - - BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem); - } - - HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); - } - - HTREEITEM GetChildItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); - } - - HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); - } - - HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); - } - - HTREEITEM GetParentItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); - } - - HTREEITEM GetFirstVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); - } - - HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); - } - - HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); - } - - HTREEITEM GetSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); - } - - HTREEITEM GetDropHilightItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); - } - - HTREEITEM GetRootItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); - } - -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - HTREEITEM GetLastVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); - } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0600) - HTREEITEM GetNextSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); - } -#endif // (_WIN32_IE >= 0x0600) - - BOOL Select(HTREEITEM hItem, UINT nCode) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem); - } - - BOOL SelectItem(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); - } - - BOOL SelectDropTarget(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem); - } - - BOOL SelectSetFirstVisible(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem); - } - - CEdit EditLabel(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem)); - } - - BOOL EndEditLabelNow(BOOL bCancel) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L); - } - - HTREEITEM HitTest(TVHITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); - } - - HTREEITEM HitTest(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVHITTESTINFO hti = { 0 }; - hti.pt = pt; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return hTreeItem; - } - - BOOL SortChildren(HTREEITEM hItem, BOOL bRecurse = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem); - } - - BOOL EnsureVisible(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem); - } - - BOOL SortChildrenCB(LPTVSORTCB pSort, BOOL bRecurse = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort); - } - - CImageList RemoveImageList(int nImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); - } - - CImageList CreateDragImage(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem)); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem); - } - - BOOL RemoveInsertMark() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, 0, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - HTREEITEM MapAccIDToHTREEITEM(UINT uID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); - } - - UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - void ShowInfoTip(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem); - } -#endif // (_WIN32_WINNT >= 0x0600) -}; - -typedef CTreeViewCtrlT CTreeViewCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTreeViewCtrlEx - -// forward declaration -template class CTreeViewCtrlExT; - -// Note: TBase here is for CTreeViewCtrlExT, and not for CTreeItemT itself -template -class CTreeItemT -{ -public: - HTREEITEM m_hTreeItem; - CTreeViewCtrlExT* m_pTreeView; - -// Construction - CTreeItemT(HTREEITEM hTreeItem = NULL, CTreeViewCtrlExT* pTreeView = NULL) : m_hTreeItem(hTreeItem), m_pTreeView(pTreeView) - { } - - CTreeItemT(const CTreeItemT& posSrc) - { - *this = posSrc; - } - - operator HTREEITEM() { return m_hTreeItem; } - - CTreeItemT& operator =(const CTreeItemT& itemSrc) - { - m_hTreeItem = itemSrc.m_hTreeItem; - m_pTreeView = itemSrc.m_pTreeView; - return *this; - } - -// Attributes - CTreeViewCtrlExT* GetTreeView() const { return m_pTreeView; } - - BOOL operator !() const { return m_hTreeItem == NULL; } - - BOOL IsNull() const { return m_hTreeItem == NULL; } - - BOOL GetRect(LPRECT lpRect, BOOL bTextOnly) const; - BOOL GetText(LPTSTR lpstrText, int nLen) const; -#ifndef _ATL_NO_COM - BOOL GetText(BSTR& bstrText) const; -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetText(_CSTRING_NS::CString& strText) const; -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL SetText(LPCTSTR lpszItem); - BOOL GetImage(int& nImage, int& nSelectedImage) const; - BOOL SetImage(int nImage, int nSelectedImage); - UINT GetState(UINT nStateMask) const; - BOOL SetState(UINT nState, UINT nStateMask); - DWORD_PTR GetData() const; - BOOL SetData(DWORD_PTR dwData); - BOOL SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam); - -// Operations - CTreeItemT InsertAfter(LPCTSTR lpstrItem, HTREEITEM hItemAfter, int nImageIndex) - { - return _Insert(lpstrItem, nImageIndex, hItemAfter); - } - - CTreeItemT AddHead(LPCTSTR lpstrItem, int nImageIndex) - { - return _Insert(lpstrItem, nImageIndex, TVI_FIRST); - } - - CTreeItemT AddTail(LPCTSTR lpstrItem, int nImageIndex) - { - return _Insert(lpstrItem, nImageIndex, TVI_LAST); - } - - CTreeItemT GetChild() const; - CTreeItemT GetNext(UINT nCode) const; - CTreeItemT GetNextSibling() const; - CTreeItemT GetPrevSibling() const; - CTreeItemT GetParent() const; - CTreeItemT GetFirstVisible() const; - CTreeItemT GetNextVisible() const; - CTreeItemT GetPrevVisible() const; - CTreeItemT GetSelected() const; - CTreeItemT GetDropHilight() const; - CTreeItemT GetRoot() const; -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - CTreeItemT GetLastVisible() const; -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0600) - CTreeItemT GetNextSelected() const; -#endif // (_WIN32_IE >= 0x0600) - BOOL HasChildren() const; - BOOL Delete(); - BOOL Expand(UINT nCode = TVE_EXPAND); - BOOL Select(UINT nCode); - BOOL Select(); - BOOL SelectDropTarget(); - BOOL SelectSetFirstVisible(); - HWND EditLabel(); - HIMAGELIST CreateDragImage(); - BOOL SortChildren(BOOL bRecurse = FALSE); - BOOL EnsureVisible(); - CTreeItemT _Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter); - int GetImageIndex() const; -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL SetInsertMark(BOOL bAfter); -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) - UINT MapHTREEITEMToAccID() const; -#endif // (_WIN32_WINNT >= 0x0501) -#if (_WIN32_WINNT >= 0x0600) - void ShowInfoTip(); - BOOL GetPartRect(TVITEMPART partID, LPRECT lpRect) const; -#endif // (_WIN32_WINNT >= 0x0600) -}; - -typedef CTreeItemT CTreeItem; - - -template -class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > -{ -public: -// Constructors - CTreeViewCtrlExT(HWND hWnd = NULL) : CTreeViewCtrlT< TBase >(hWnd) - { } - - CTreeViewCtrlExT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations (overides that return CTreeItem) - CTreeItemT InsertItem(LPTVINSERTSTRUCT lpInsertStruct) - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); - return CTreeItemT(hTreeItem, this); - } - - CTreeItemT InsertItem(LPCTSTR lpszItem, int nImage, - int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); - } - - CTreeItemT InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); - } - - CTreeItemT GetNextItem(HTREEITEM hItem, UINT nCode) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetChildItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetNextSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetPrevSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetParentItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetFirstVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetNextVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetPrevVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetDropHilightItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetRootItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - CTreeItemT GetLastVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0600) - CTreeItemT GetNextSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } -#endif // (_WIN32_IE >= 0x0600) - - CTreeItemT HitTest(TVHITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, - HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVINSERTSTRUCT tvis = { 0 }; - tvis.hParent = hParent; - tvis.hInsertAfter = hInsertAfter; - tvis.item.mask = nMask; - tvis.item.pszText = (LPTSTR) lpszItem; - tvis.item.iImage = nImage; - tvis.item.iSelectedImage = nSelectedImage; - tvis.item.state = nState; - tvis.item.stateMask = nStateMask; - tvis.item.lParam = lParam; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); - return CTreeItemT(hTreeItem, this); - } - - CTreeItemT HitTest(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVHITTESTINFO hti = { 0 }; - hti.pt = pt; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - -#if (_WIN32_WINNT >= 0x0501) - CTreeItemT MapAccIDToHTREEITEM(UINT uID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } -#endif // (_WIN32_WINNT >= 0x0501) -}; - -typedef CTreeViewCtrlExT CTreeViewCtrlEx; - - -// CTreeItem inline methods -template -inline BOOL CTreeItemT::GetRect(LPRECT lpRect, BOOL bTextOnly) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemRect(m_hTreeItem,lpRect,bTextOnly); -} - -template -inline CTreeItemT CTreeItemT::GetNext(UINT nCode) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextItem(m_hTreeItem,nCode); -} - -template -inline CTreeItemT CTreeItemT::GetChild() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetChildItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetNextSibling() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextSiblingItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetPrevSibling() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetPrevSiblingItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetParent() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetParentItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetFirstVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetFirstVisibleItem(); -} - -template -inline CTreeItemT CTreeItemT::GetNextVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextVisibleItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetPrevVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetPrevVisibleItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetSelected() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetSelectedItem(); -} - -template -inline CTreeItemT CTreeItemT::GetDropHilight() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetDropHilightItem(); -} - -template -inline CTreeItemT CTreeItemT::GetRoot() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetRootItem(); -} - -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -template -inline CTreeItemT CTreeItemT::GetLastVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetLastVisibleItem(); -} -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0600) -template -inline CTreeItemT CTreeItemT::GetNextSelected() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextSelectedItem(); -} -#endif // (_WIN32_IE >= 0x0600) - -template -inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemText(m_hTreeItem, lpstrText, nLen); -} - -#ifndef _ATL_NO_COM -#ifdef _OLEAUTO_H_ -template -inline BOOL CTreeItemT::GetText(BSTR& bstrText) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemText(m_hTreeItem, bstrText); -} -#endif // _OLEAUTO_H_ -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) -template -inline BOOL CTreeItemT::GetText(_CSTRING_NS::CString& strText) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemText(m_hTreeItem, strText); -} -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -template -inline BOOL CTreeItemT::GetImage(int& nImage, int& nSelectedImage) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemImage(m_hTreeItem,nImage,nSelectedImage); -} - -template -inline UINT CTreeItemT::GetState(UINT nStateMask) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemState(m_hTreeItem,nStateMask); -} - -template -inline DWORD_PTR CTreeItemT::GetData() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemData(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItem(m_hTreeItem, nMask, lpszItem, nImage, nSelectedImage, nState, nStateMask, lParam); -} - -template -inline BOOL CTreeItemT::SetText(LPCTSTR lpszItem) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemText(m_hTreeItem,lpszItem); -} - -template -inline BOOL CTreeItemT::SetImage(int nImage, int nSelectedImage) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemImage(m_hTreeItem,nImage,nSelectedImage); -} - -template -inline BOOL CTreeItemT::SetState(UINT nState, UINT nStateMask) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemState(m_hTreeItem,nState,nStateMask); -} - -template -inline BOOL CTreeItemT::SetData(DWORD_PTR dwData) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemData(m_hTreeItem,dwData); -} - -template -inline BOOL CTreeItemT::HasChildren() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->ItemHasChildren(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::Delete() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->DeleteItem(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::Expand(UINT nCode /*= TVE_EXPAND*/) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->Expand(m_hTreeItem,nCode); -} - -template -inline BOOL CTreeItemT::Select(UINT nCode) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->Select(m_hTreeItem,nCode); -} - -template -inline BOOL CTreeItemT::Select() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SelectItem(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SelectDropTarget() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SelectDropTarget(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SelectSetFirstVisible() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SelectSetFirstVisible(m_hTreeItem); -} - -template -inline HWND CTreeItemT::EditLabel() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->EditLabel(m_hTreeItem); -} - -template -inline HIMAGELIST CTreeItemT::CreateDragImage() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->CreateDragImage(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SortChildren(BOOL bRecurse /*= FALSE*/) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SortChildren(m_hTreeItem, bRecurse); -} - -template -inline BOOL CTreeItemT::EnsureVisible() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->EnsureVisible(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::_Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter) -{ - ATLASSERT(m_pTreeView != NULL); - TVINSERTSTRUCT ins = { 0 }; - ins.hParent = m_hTreeItem; - ins.hInsertAfter = hItemAfter; - ins.item.mask = TVIF_TEXT; - ins.item.pszText = (LPTSTR)lpstrItem; - if(nImageIndex != -1) - { - ins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; - ins.item.iImage = nImageIndex; - ins.item.iSelectedImage = nImageIndex; - } - return CTreeItemT(m_pTreeView->InsertItem(&ins), m_pTreeView); -} - -template -inline int CTreeItemT::GetImageIndex() const -{ - ATLASSERT(m_pTreeView != NULL); - TVITEM item = { 0 }; - item.mask = TVIF_HANDLE | TVIF_IMAGE; - item.hItem = m_hTreeItem; - m_pTreeView->GetItem(&item); - return item.iImage; -} - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -template -inline BOOL CTreeItemT::SetInsertMark(BOOL bAfter) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetInsertMark(m_hTreeItem, bAfter); -} -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) -template -inline UINT CTreeItemT::MapHTREEITEMToAccID() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->MapHTREEITEMToAccID(m_hTreeItem); -} -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) -template -inline void CTreeItemT::ShowInfoTip() -{ - ATLASSERT(m_pTreeView != NULL); - m_pTreeView->ShowInfoTip(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::GetPartRect(TVITEMPART partID, LPRECT lpRect) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemPartRect(m_hTreeItem, partID, lpRect); -} -#endif // (_WIN32_WINNT >= 0x0600) - - -/////////////////////////////////////////////////////////////////////////////// -// CToolBarCtrl - -template -class CToolBarCtrlT : public TBase -{ -public: -// Construction - CToolBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CToolBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return TOOLBARCLASSNAME; - } - - BOOL IsButtonEnabled(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONENABLED, nID, 0L); - } - - BOOL IsButtonChecked(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONCHECKED, nID, 0L); - } - - BOOL IsButtonPressed(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONPRESSED, nID, 0L); - } - - BOOL IsButtonHidden(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return(BOOL) ::SendMessage(m_hWnd, TB_ISBUTTONHIDDEN, nID, 0L); - } - - BOOL IsButtonIndeterminate(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONINDETERMINATE, nID, 0L); - } - - int GetState(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETSTATE, nID, 0L); - } - - BOOL SetState(int nID, UINT nState) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETSTATE, nID, MAKELPARAM(nState, 0)); - } - - BOOL GetButton(int nIndex, LPTBBUTTON lpButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETBUTTON, nIndex, (LPARAM)lpButton); - } - - int GetButtonCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_BUTTONCOUNT, 0, 0L); - } - - BOOL GetItemRect(int nIndex, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETITEMRECT, nIndex, (LPARAM)lpRect); - } - - void SetButtonStructSize(int nSize = sizeof(TBBUTTON)) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_BUTTONSTRUCTSIZE, nSize, 0L); - } - - BOOL SetButtonSize(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy)); - } - - BOOL SetButtonSize(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy)); - } - - BOOL SetBitmapSize(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy)); - } - - BOOL SetBitmapSize(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy)); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TB_GETTOOLTIPS, 0, 0L)); - } - - void SetToolTips(HWND hWndToolTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); - } -#endif // !_WIN32_WCE - - void SetNotifyWnd(HWND hWnd) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETPARENT, (WPARAM)hWnd, 0L); - } - - int GetRows() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETROWS, 0, 0L); - } - - void SetRows(int nRows, BOOL bLarger, LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); - } - - BOOL SetCmdID(int nIndex, UINT nID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETCMDID, nIndex, nID); - } - - DWORD GetBitmapFlags() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETBITMAPFLAGS, 0, 0L); - } - - int GetBitmap(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBITMAP, nID, 0L); - } - - int GetButtonText(int nID, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText); - } - - // nIndex - IE5 or higher only - CImageList GetImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETIMAGELIST, nIndex, 0L)); - } - - // nIndex - IE5 or higher only - CImageList SetImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList)); - } - - // nIndex - IE5 or higher only - CImageList GetDisabledImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETDISABLEDIMAGELIST, nIndex, 0L)); - } - - // nIndex - IE5 or higher only - CImageList SetDisabledImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList)); - } - -#ifndef _WIN32_WCE - // nIndex - IE5 or higher only - CImageList GetHotImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETHOTIMAGELIST, nIndex, 0L)); - } - - // nIndex - IE5 or higher only - CImageList SetHotImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList)); - } -#endif // !_WIN32_WCE - - DWORD GetStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETSTYLE, 0, 0L); - } - - void SetStyle(DWORD dwStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETSTYLE, 0, dwStyle); - } - - DWORD GetButtonSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); - } - - void GetButtonSize(SIZE& size) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); - size.cx = LOWORD(dwRet); - size.cy = HIWORD(dwRet); - } - - BOOL GetRect(int nID, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETRECT, nID, (LPARAM)lpRect); - } - - int GetTextRows() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETTEXTROWS, 0, 0L); - } - - BOOL SetButtonWidth(int cxMin, int cxMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); - } - - BOOL SetIndent(int nIndent) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETINDENT, nIndent, 0L); - } - - BOOL SetMaxTextRows(int nMaxTextRows) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETMAXTEXTROWS, nMaxTextRows, 0L); - } - -#if (_WIN32_IE >= 0x0400) -#ifndef _WIN32_WCE - BOOL GetAnchorHighlight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0L); - } - - BOOL SetAnchorHighlight(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETANCHORHIGHLIGHT, bEnable, 0L); - } -#endif // !_WIN32_WCE - - int GetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi); - } - - BOOL SetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi); - } - - BOOL SetButtonInfo(int nID, DWORD dwMask, BYTE Style, BYTE State, LPCTSTR lpszItem, - int iImage, WORD cx, int iCommand, DWORD_PTR lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = dwMask; - tbbi.idCommand = iCommand; - tbbi.iImage = iImage; - tbbi.fsState = State; - tbbi.fsStyle = Style; - tbbi.cx = cx; - tbbi.pszText = (LPTSTR) lpszItem; - tbbi.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi); - } - -#ifndef _WIN32_WCE - int GetHotItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETHOTITEM, 0, 0L); - } - - int SetHotItem(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_SETHOTITEM, nItem, 0L); - } -#endif // !_WIN32_WCE - - BOOL IsButtonHighlighted(int nButtonID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L); - } - - DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags); - } - -#ifndef _WIN32_WCE - BOOL GetColorScheme(LPCOLORSCHEME lpcs) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs); - } - - void SetColorScheme(LPCOLORSCHEME lpcs) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs); - } - - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwStyle); - } - - void GetInsertMark(LPTBINSERTMARK lptbim) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)lptbim); - } - - void SetInsertMark(LPTBINSERTMARK lptbim) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)lptbim); - } - - COLORREF GetInsertMarkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0L); - } - - COLORREF SetInsertMarkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr); - } - - BOOL GetMaxSize(LPSIZE lpSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)lpSize); - } - - void GetPadding(LPSIZE lpSizePadding) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpSizePadding != NULL); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETPADDING, 0, 0L); - lpSizePadding->cx = GET_X_LPARAM(dwRet); - lpSizePadding->cy = GET_Y_LPARAM(dwRet); - } - - void SetPadding(int cx, int cy, LPSIZE lpSizePadding = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_SETPADDING, 0, MAKELPARAM(cx, cy)); - if(lpSizePadding != NULL) - { - lpSizePadding->cx = GET_X_LPARAM(dwRet); - lpSizePadding->cy = GET_Y_LPARAM(dwRet); - } - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int GetString(int nString, LPTSTR lpstrString, int cchMaxLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString); - } - - int GetStringBSTR(int nString, BSTR& bstrString) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrString == NULL); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); - if(nLength != -1) - { - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLength + 1); - if(lpstrText != NULL) - { - nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstrText); - if(nLength != -1) - bstrString = ::SysAllocString(T2OLE(lpstrText)); - } - else - { - nLength = -1; - } - } - - return nLength; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetString(int nString, _CSTRING_NS::CString& str) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); - if(nLength != -1) - { - LPTSTR lpstr = str.GetBufferSetLength(nLength + 1); - if(lpstr != NULL) - nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr); - else - nLength = -1; - str.ReleaseBuffer(); - } - return nLength; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - void GetMetrics(LPTBMETRICS lptbm) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_GETMETRICS, 0, (LPARAM)lptbm); - } - - void SetMetrics(LPTBMETRICS lptbm) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETMETRICS, 0, (LPARAM)lptbm); - } - - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - CImageList GetPressedImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETPRESSEDIMAGELIST, nIndex, 0L)); - } - - CImageList SetPressedImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList)); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - BOOL EnableButton(int nID, BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); - } - - BOOL CheckButton(int nID, BOOL bCheck = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); - } - - BOOL PressButton(int nID, BOOL bPress = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); - } - - BOOL HideButton(int nID, BOOL bHide = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); - } - - BOOL Indeterminate(int nID, BOOL bIndeterminate = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); - } - - int AddBitmap(int nNumButtons, UINT nBitmapID) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBADDBITMAP tbab = { 0 }; - tbab.hInst = ModuleHelper::GetResourceInstance(); - ATLASSERT(tbab.hInst != NULL); - tbab.nID = nBitmapID; - return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); - } - - int AddBitmap(int nNumButtons, HBITMAP hBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBADDBITMAP tbab = { 0 }; - tbab.hInst = NULL; - tbab.nID = (UINT_PTR)hBitmap; - return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); - } - - BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); - } - - BOOL InsertButton(int nIndex, LPTBBUTTON lpButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); - } - - BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, - INT_PTR iString, DWORD_PTR lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBBUTTON tbb = { 0 }; - tbb.fsStyle = Style; - tbb.fsState = State; - tbb.idCommand = iCommand; - tbb.iBitmap = iBitmap; - tbb.iString = iString; - tbb.dwData = lParam; - return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb); - } - - BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, - LPCTSTR lpszItem, DWORD_PTR lParam) - { - return InsertButton(nIndex, iCommand, Style, State, iBitmap, (INT_PTR)lpszItem, lParam); - } - - BOOL AddButton(LPTBBUTTON lpButton) - { - return InsertButton(-1, lpButton); - } - - BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam) - { - return InsertButton(-1, iCommand, Style, State, iBitmap, iString, lParam); - } - - BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, LPCTSTR lpszItem, DWORD_PTR lParam) - { - return InsertButton(-1, iCommand, Style, State, iBitmap, lpszItem, lParam); - } - - BOOL DeleteButton(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_DELETEBUTTON, nIndex, 0L); - } - - UINT CommandToIndex(UINT nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TB_COMMANDTOINDEX, nID, 0L); - } - -#ifndef _WIN32_WCE - void SaveState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBSAVEPARAMS tbs = { 0 }; - tbs.hkr = hKeyRoot; - tbs.pszSubKey = lpszSubKey; - tbs.pszValueName = lpszValueName; - ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs); - } - - void RestoreState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBSAVEPARAMS tbs = { 0 }; - tbs.hkr = hKeyRoot; - tbs.pszSubKey = lpszSubKey; - tbs.pszValueName = lpszValueName; - ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs); - } - - void Customize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_CUSTOMIZE, 0, 0L); - } -#endif // !_WIN32_WCE - - int AddString(UINT nStringID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_ADDSTRING, (WPARAM)ModuleHelper::GetResourceInstance(), (LPARAM)nStringID); - } - - int AddStrings(LPCTSTR lpszStrings) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_ADDSTRING, 0, (LPARAM)lpszStrings); - } - - void AutoSize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_AUTOSIZE, 0, 0L); - } - - BOOL ChangeBitmap(int nID, int nBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0)); - } - - int LoadImages(int nBitmapID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)ModuleHelper::GetResourceInstance()); - } - - int LoadStdImages(int nBitmapID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL); - } - - BOOL ReplaceBitmap(LPTBREPLACEBITMAP ptbrb) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb); - } - -#if (_WIN32_IE >= 0x0400) - int HitTest(LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)lpPoint); - } - -#ifndef _WIN32_WCE - BOOL InsertMarkHitTest(LPPOINT lpPoint, LPTBINSERTMARK lptbim) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim); - } - - BOOL InsertMarkHitTest(int x, int y, LPTBINSERTMARK lptbim) const - { - ATLASSERT(::IsWindow(m_hWnd)); - POINT pt = { x, y }; - return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim); - } - - BOOL MapAccelerator(TCHAR chAccel, int& nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID); - } - - BOOL MarkButton(int nID, BOOL bHighlight = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); - } - - BOOL MoveButton(int nOldPos, int nNewPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); - } - - HRESULT GetObject(REFIID iid, LPVOID* ppvObject) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -}; - -typedef CToolBarCtrlT CToolBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CStatusBarCtrl - -template -class CStatusBarCtrlT : public TBase -{ -public: -// Constructors - CStatusBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CStatusBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Methods - static LPCTSTR GetWndClassName() - { - return STATUSCLASSNAME; - } - - int GetParts(int nParts, int* pParts) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, SB_GETPARTS, nParts, (LPARAM)pParts); - } - - BOOL SetParts(int nParts, int* pWidths) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths); - } - - int GetTextLength(int nPane, int* pType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L); - if (pType != NULL) - *pType = (int)(short)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - int GetText(int nPane, LPTSTR lpszText, int* pType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXT, (WPARAM)nPane, (LPARAM)lpszText); - if(pType != NULL) - *pType = (int)(short)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - -#ifndef _ATL_NO_COM - BOOL GetTextBSTR(int nPane, BSTR& bstrText, int* pType = NULL) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - ATLASSERT(bstrText == NULL); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); - if(nLength == 0) - return FALSE; - - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLength + 1); - if(lpstrText == NULL) - return FALSE; - - if(!GetText(nPane, lpstrText, pType)) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpstrText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetText(int nPane, _CSTRING_NS::CString& strText, int* pType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); - if(nLength == 0) - return 0; - - LPTSTR lpstr = strText.GetBufferSetLength(nLength); - if(lpstr == NULL) - return 0; - return GetText(nPane, lpstr, pType); - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL SetText(int nPane, LPCTSTR lpszText, int nType = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); - } - - BOOL GetRect(int nPane, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_GETRECT, nPane, (LPARAM)lpRect); - } - - BOOL GetBorders(int* pBorders) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)pBorders); - } - - BOOL GetBorders(int& nHorz, int& nVert, int& nSpacing) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int borders[3] = { 0, 0, 0 }; - BOOL bResult = (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); - if(bResult) - { - nHorz = borders[0]; - nVert = borders[1]; - nSpacing = borders[2]; - } - return bResult; - } - - void SetMinHeight(int nMin) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, SB_SETMINHEIGHT, nMin, 0L); - } - - BOOL SetSimple(BOOL bSimple = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SIMPLE, bSimple, 0L); - } - - BOOL IsSimple() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_ISSIMPLE, 0, 0L); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SETUNICODEFORMAT, bUnicode, 0L); - } - - void GetTipText(int nPane, LPTSTR lpstrText, int nSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - ::SendMessage(m_hWnd, SB_GETTIPTEXT, MAKEWPARAM(nPane, nSize), (LPARAM)lpstrText); - } - - void SetTipText(int nPane, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - ::SendMessage(m_hWnd, SB_SETTIPTEXT, nPane, (LPARAM)lpstrText); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) - COLORREF SetBkColor(COLORREF clrBk) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, SB_SETBKCOLOR, 0, (LPARAM)clrBk); - } - - HICON GetIcon(int nPane) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (HICON)::SendMessage(m_hWnd, SB_GETICON, nPane, 0L); - } - - BOOL SetIcon(int nPane, HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_SETICON, nPane, (LPARAM)hIcon); - } -#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) -}; - -typedef CStatusBarCtrlT CStatusBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTabCtrl - -template -class CTabCtrlT : public TBase -{ -public: -// Constructors - CTabCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTabCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TABCONTROL; - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_GETIMAGELIST, 0, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_SETIMAGELIST, 0, (LPARAM)hImageList)); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETITEMCOUNT, 0, 0L); - } - - BOOL GetItem(int nItem, LPTCITEM pTabCtrlItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); - } - - BOOL SetItem(int nItem, LPTCITEM pTabCtrlItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); - } - - int SetItem(int nItem, UINT mask, LPCTSTR lpszItem, DWORD dwState, DWORD dwStateMask, int iImage, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TCITEM tci = { 0 }; - tci.mask = mask; - tci.pszText = (LPTSTR) lpszItem; - tci.dwState = dwState; - tci.dwStateMask = dwStateMask; - tci.iImage = iImage; - tci.lParam = lParam; - return (int)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)&tci); - } - - BOOL GetItemRect(int nItem, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETITEMRECT, nItem, (LPARAM)lpRect); - } - - int GetCurSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETCURSEL, 0, 0L); - } - - int SetCurSel(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_SETCURSEL, nItem, 0L); - } - - SIZE SetItemSize(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwSize = (DWORD)::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(size.cx, size.cy)); - SIZE sizeRet = { GET_X_LPARAM(dwSize), GET_Y_LPARAM(dwSize) }; - return sizeRet; - } - - void SetItemSize(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(cx, cy)); - } - - void SetPadding(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETPADDING, 0, MAKELPARAM(size.cx, size.cy)); - } - - int GetRowCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETROWCOUNT, 0, 0L); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetTooltips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TCM_GETTOOLTIPS, 0, 0L)); - } - - void SetTooltips(HWND hWndToolTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); - } -#endif // !_WIN32_WCE - - int GetCurFocus() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETCURFOCUS, 0, 0L); - } - - void SetCurFocus(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETCURFOCUS, nItem, 0L); - } - - BOOL SetItemExtra(int cbExtra) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetItemCount() == 0); // must be empty - return (BOOL)::SendMessage(m_hWnd, TCM_SETITEMEXTRA, cbExtra, 0L); - } - - int SetMinTabWidth(int nWidth = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_SETMINTABWIDTH, 0, nWidth); - } - -#if (_WIN32_IE >= 0x0400) - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TCM_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TCM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); - } - -#ifndef _WIN32_WCE - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -// Operations - int InsertItem(int nItem, LPTCITEM pTabCtrlItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); - } - - int InsertItem(int nItem, UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TCITEM tci = { 0 }; - tci.mask = mask; - tci.pszText = (LPTSTR) lpszItem; - tci.iImage = iImage; - tci.lParam = lParam; - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); - } - - int InsertItem(int nItem, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - TCITEM tci = { 0 }; - tci.mask = TCIF_TEXT; - tci.pszText = (LPTSTR) lpszItem; - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); - } - - int AddItem(LPTCITEM pTabCtrlItem) - { - return InsertItem(GetItemCount(), pTabCtrlItem); - } - - int AddItem(UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) - { - return InsertItem(GetItemCount(), mask, lpszItem, iImage, lParam); - } - - int AddItem(LPCTSTR lpszItem) - { - return InsertItem(GetItemCount(), lpszItem); - } - - BOOL DeleteItem(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_DELETEITEM, nItem, 0L); - } - - BOOL DeleteAllItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_DELETEALLITEMS, 0, 0L); - } - - void AdjustRect(BOOL bLarger, LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_ADJUSTRECT, bLarger, (LPARAM)lpRect); - } - - void RemoveImage(int nImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_REMOVEIMAGE, nImage, 0L); - } - - int HitTest(TC_HITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)pHitTestInfo); - } - - void DeselectAll(BOOL bExcludeFocus = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_DESELECTALL, bExcludeFocus, 0L); - } - -#if (_WIN32_IE >= 0x0400) - BOOL HighlightItem(int nIndex, BOOL bHighlight = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_HIGHLIGHTITEM, nIndex, MAKELPARAM(bHighlight, 0)); - } -#endif // (_WIN32_IE >= 0x0400) -}; - -typedef CTabCtrlT CTabCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTrackBarCtrl - -template -class CTrackBarCtrlT : public TBase -{ -public: -// Constructors - CTrackBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTrackBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return TRACKBAR_CLASS; - } - - int GetLineSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETLINESIZE, 0, 0L); - } - - int SetLineSize(int nSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETLINESIZE, 0, nSize); - } - - int GetPageSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETPAGESIZE, 0, 0L); - } - - int SetPageSize(int nSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETPAGESIZE, 0, nSize); - } - - int GetRangeMin() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETRANGEMIN, 0, 0L); - } - - void SetRangeMin(int nMin, BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGEMIN, bRedraw, nMin); - } - - int GetRangeMax() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETRANGEMAX, 0, 0L); - } - - void SetRangeMax(int nMax, BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGEMAX, bRedraw, nMax); - } - - void GetRange(int& nMin, int& nMax) const - { - nMin = GetRangeMin(); - nMax = GetRangeMax(); - } - - void SetRange(int nMin, int nMax, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGE, bRedraw, MAKELPARAM(nMin, nMax)); - } - - int GetSelStart() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETSELSTART, 0, 0L); - } - - void SetSelStart(int nMin) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETSELSTART, 0, (LPARAM)nMin); - } - - int GetSelEnd() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETSELEND, 0, 0L); - } - - void SetSelEnd(int nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETSELEND, 0, (LPARAM)nMax); - } - - void GetSelection(int& nMin, int& nMax) const - { - nMin = GetSelStart(); - nMax = GetSelEnd(); - } - - void SetSelection(int nMin, int nMax) - { - SetSelStart(nMin); - SetSelEnd(nMax); - } - - void GetChannelRect(LPRECT lprc) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc); - } - - void GetThumbRect(LPRECT lprc) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc); - } - - int GetPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETPOS, 0, 0L); - } - - void SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETPOS, TRUE, nPos); - } - - UINT GetNumTics() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TBM_GETNUMTICS, 0, 0L); - } - - DWORD* GetTicArray() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD*)::SendMessage(m_hWnd, TBM_GETPTICS, 0, 0L); - } - - int GetTic(int nTic) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTIC, nTic, 0L); - } - - BOOL SetTic(int nTic) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_SETTIC, 0, nTic); - } - - int GetTicPos(int nTic) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTICPOS, nTic, 0L); - } - - void SetTicFreq(int nFreq) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTICFREQ, nFreq, 0L); - } - - int GetThumbLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTHUMBLENGTH, 0, 0L); - } - - void SetThumbLength(int nLength) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTHUMBLENGTH, nLength, 0L); - } - - void SetSel(int nStart, int nEnd, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & TBS_ENABLESELRANGE) != 0); - ::SendMessage(m_hWnd, TBM_SETSEL, bRedraw, MAKELPARAM(nStart, nEnd)); - } - - ATL::CWindow GetBuddy(BOOL bLeft = TRUE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_GETBUDDY, bLeft, 0L)); - } - - ATL::CWindow SetBuddy(HWND hWndBuddy, BOOL bLeft = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_SETBUDDY, bLeft, (LPARAM)hWndBuddy)); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TBM_GETTOOLTIPS, 0, 0L)); - } - - void SetToolTips(HWND hWndTT) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTOOLTIPS, (WPARAM)hWndTT, 0L); - } - - int SetTipSide(int nSide) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETTIPSIDE, nSide, 0L); - } -#endif // !_WIN32_WCE - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -// Operations - void ClearSel(BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_CLEARSEL, bRedraw, 0L); - } - - void VerifyPos() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETPOS, FALSE, 0L); - } - - void ClearTics(BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_CLEARTICS, bRedraw, 0L); - } -}; - -typedef CTrackBarCtrlT CTrackBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CUpDownCtrl - -template -class CUpDownCtrlT : public TBase -{ -public: -// Constructors - CUpDownCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CUpDownCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return UPDOWN_CLASS; - } - - UINT GetAccel(int nAccel, UDACCEL* pAccel) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)); - } - - BOOL SetAccel(int nAccel, UDACCEL* pAccel) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)LOWORD(::SendMessage(m_hWnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel)); - } - - UINT GetBase() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETBASE, 0, 0L)); - } - - int SetBase(int nBase) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, UDM_SETBASE, nBase, 0L); - } - - ATL::CWindow GetBuddy() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_GETBUDDY, 0, 0L)); - } - - ATL::CWindow SetBuddy(HWND hWndBuddy) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_SETBUDDY, (WPARAM)hWndBuddy, 0L)); - } - - int GetPos(LPBOOL lpbError = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETPOS, 0, 0L); - // Note: Seems that Windows always sets error to TRUE if - // UDS_SETBUDDYINT style is not used - if(lpbError != NULL) - *lpbError = (HIWORD(dwRet) != 0) ? TRUE : FALSE; - return (int)(short)LOWORD(dwRet); - } - - int SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))); - } - - DWORD GetRange() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); - } - - void GetRange(int& nLower, int& nUpper) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); - nLower = (int)(short)HIWORD(dwRet); - nUpper = (int)(short)LOWORD(dwRet); - } - - void SetRange(int nLower, int nUpper) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); - } - -#if (_WIN32_IE >= 0x0400) - void SetRange32(int nLower, int nUpper) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_SETRANGE32, nLower, nUpper); - } - - void GetRange32(int& nLower, int& nUpper) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_GETRANGE32, (WPARAM)&nLower, (LPARAM)&nUpper); - } - -#ifndef _WIN32_WCE - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, UDM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, UDM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int GetPos32(LPBOOL lpbError = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - // Note: Seems that Windows always sets error to TRUE if - // UDS_SETBUDDYINT style is not used - return (int)::SendMessage(m_hWnd, UDM_GETPOS32, 0, (LPARAM)lpbError); - } - - int SetPos32(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, UDM_SETPOS32, 0, (LPARAM)nPos); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CUpDownCtrlT CUpDownCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CProgressBarCtrl - -template -class CProgressBarCtrlT : public TBase -{ -public: -// Constructors - CProgressBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CProgressBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return PROGRESS_CLASS; - } - - DWORD SetRange(int nLower, int nUpper) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); - } - - int SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETPOS, nPos, 0L)); - } - - int OffsetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_DELTAPOS, nPos, 0L)); - } - - int SetStep(int nStep) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETSTEP, nStep, 0L)); - } - - UINT GetPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, PBM_GETPOS, 0, 0L); - } - - void GetRange(PPBRANGE pPBRange) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPBRange != NULL); - ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)pPBRange); - } - - void GetRange(int& nLower, int& nUpper) const - { - ATLASSERT(::IsWindow(m_hWnd)); - PBRANGE range = { 0 }; - ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)&range); - nLower = range.iLow; - nUpper = range.iHigh; - } - - int GetRangeLimit(BOOL bLowLimit) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETRANGE, bLowLimit, (LPARAM)NULL); - } - - DWORD SetRange32(int nMin, int nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE32, nMin, nMax); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - COLORREF SetBarColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_SETBARCOLOR, 0, (LPARAM)clr); - } - - COLORREF SetBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_SETBKCOLOR, 0, (LPARAM)clr); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) - BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime); - } -#endif // (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) - -#if (_WIN32_WINNT >= 0x0600) - int GetStep() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETSTEP, 0, 0L); - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_GETBKCOLOR, 0, 0L); - } - - COLORREF GetBarColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_GETBARCOLOR, 0, 0L); - } - - int GetState() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETSTATE, 0, 0L); - } - - int SetState(int nState) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_SETSTATE, nState, 0L); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - int StepIt() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_STEPIT, 0, 0L)); - } -}; - -typedef CProgressBarCtrlT CProgressBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CHotKeyCtrl - -#ifndef _WIN32_WCE - -template -class CHotKeyCtrlT : public TBase -{ -public: -// Constructors - CHotKeyCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHotKeyCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return HOTKEY_CLASS; - } - - DWORD GetHotKey() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); - } - - void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dw = (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); - wVirtualKeyCode = LOBYTE(LOWORD(dw)); - wModifiers = HIBYTE(LOWORD(dw)); - } - - void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, HKM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0L); - } - - void SetRules(WORD wInvalidComb, WORD wModifiers) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, HKM_SETRULES, wInvalidComb, MAKELPARAM(wModifiers, 0)); - } -}; - -typedef CHotKeyCtrlT CHotKeyCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CAnimateCtrl - -#ifndef _WIN32_WCE - -template -class CAnimateCtrlT : public TBase -{ -public: -// Constructors - CAnimateCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CAnimateCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return ANIMATE_CLASS; - } - -// Operations - BOOL Open(ATL::_U_STRINGorID FileName) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, (LPARAM)FileName.m_lpstr); - } - - BOOL Play(UINT nFrom, UINT nTo, UINT nRep) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, nRep, MAKELPARAM(nFrom, nTo)); - } - - BOOL Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_STOP, 0, 0L); - } - - BOOL Close() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, 0L); - } - - BOOL Seek(UINT nTo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, 0, MAKELPARAM(nTo, nTo)); - } - - // Vista only - BOOL IsPlaying() const - { -#ifndef ACM_ISPLAYING - const UINT ACM_ISPLAYING = (WM_USER+104); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_ISPLAYING, 0, 0L); - } -}; - -typedef CAnimateCtrlT CAnimateCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditCtrl - -#ifndef _WIN32_WCE - -#ifdef _UNICODE -#if (_RICHEDIT_VER == 0x0100) -#undef RICHEDIT_CLASS -#define RICHEDIT_CLASS L"RICHEDIT" -#endif // (_RICHEDIT_VER == 0x0100) -#endif // _UNICODE - -template -class CRichEditCtrlT : public TBase -{ -public: -// Constructors - CRichEditCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CRichEditCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return RICHEDIT_CLASS; - } - - static LPCTSTR GetLibraryName() - { -#if (_RICHEDIT_VER >= 0x0200) - return _T("RICHED20.DLL"); -#else - return _T("RICHED32.DLL"); -#endif - } - - int GetLineCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); - } - - void GetRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); - } - - DWORD GetOptions() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETOPTIONS, 0, 0L); - } - - DWORD SetOptions(WORD wOperation, DWORD dwOptions) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_SETOPTIONS, wOperation, dwOptions); - } - - // NOTE: first word in lpszBuffer must contain the size of the buffer! - int GetLine(int nIndex, LPTSTR lpszBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - *(LPWORD)lpszBuffer = (WORD)nMaxLength; - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - BOOL CanPaste(UINT nFormat = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, nFormat, 0L); - } - - void GetSel(LONG& nStartChar, LONG& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - nStartChar = cr.cpMin; - nEndChar = cr.cpMax; - } - - void GetSel(CHARRANGE &cr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - } - - int SetSel(LONG nStartChar, LONG nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - CHARRANGE cr = { nStartChar, nEndChar }; - return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); - } - - int SetSel(CHARRANGE &cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); - } - - int SetSelAll() - { - return SetSel(0, -1); - } - - int SetSelNone() - { - return SetSel(-1, 0); - } - - DWORD GetDefaultCharFormat(CHARFORMAT& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); - } - - DWORD GetSelectionCharFormat(CHARFORMAT& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); - } - - DWORD GetEventMask() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETEVENTMASK, 0, 0L); - } - - LONG GetLimitText() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); - } - - DWORD GetParaFormat(PARAFORMAT& pf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); - } - -#if (_RICHEDIT_VER >= 0x0200) - LONG GetSelText(LPTSTR lpstrBuff) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); - } -#else // !(_RICHEDIT_VER >= 0x0200) - // RichEdit 1.0 EM_GETSELTEXT is ANSI only - LONG GetSelText(LPSTR lpstrBuff) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); - } -#endif // !(_RICHEDIT_VER >= 0x0200) - -#ifndef _ATL_NO_COM - BOOL GetSelTextBSTR(BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - -#if (_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return FALSE; - if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) - return FALSE; - - bstrText = ::SysAllocString(T2W(lpstrText)); -#else // !(_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return FALSE; - if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) - return FALSE; - - bstrText = ::SysAllocString(A2W(lpstrText)); -#endif // !(_RICHEDIT_VER >= 0x0200) - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - LONG GetSelText(_CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - - CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - -#if (_RICHEDIT_VER >= 0x0200) - LONG lLen = 0; - LPTSTR lpstrText = strText.GetBufferSetLength(cr.cpMax - cr.cpMin); - if(lpstrText != NULL) - { - lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); - strText.ReleaseBuffer(); - } -#else // !(_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return 0; - LONG lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); - if(lLen == 0) - return 0; - - USES_CONVERSION; - strText = A2T(lpstrText); -#endif // !(_RICHEDIT_VER >= 0x0200) - - return lLen; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - WORD GetSelectionType() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (WORD)::SendMessage(m_hWnd, EM_SELECTIONTYPE, 0, 0L); - } - - COLORREF SetBackgroundColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 0, cr); - } - - COLORREF SetBackgroundColor() // sets to system background - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 1, 0); - } - - BOOL SetCharFormat(CHARFORMAT& cf, WORD wFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); - } - - BOOL SetDefaultCharFormat(CHARFORMAT& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); - } - - BOOL SetSelectionCharFormat(CHARFORMAT& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - - BOOL SetWordCharFormat(CHARFORMAT& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); - } - - DWORD SetEventMask(DWORD dwEventMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_SETEVENTMASK, 0, dwEventMask); - } - - BOOL SetParaFormat(PARAFORMAT& pf) - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); - } - - BOOL SetTargetDevice(HDC hDC, int cxLineWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTARGETDEVICE, (WPARAM)hDC, cxLineWidth); - } - - int GetTextLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); - } - - BOOL SetReadOnly(BOOL bReadOnly = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); - } - - int GetFirstVisibleLine() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); - } - - EDITWORDBREAKPROCEX GetWordBreakProcEx() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_GETWORDBREAKPROCEX, 0, 0L); - } - - EDITWORDBREAKPROCEX SetWordBreakProcEx(EDITWORDBREAKPROCEX pfnEditWordBreakProcEx) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_SETWORDBREAKPROCEX, 0, (LPARAM)pfnEditWordBreakProcEx); - } - - int GetTextRange(TEXTRANGE* pTextRange) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)pTextRange); - } - -#if (_RICHEDIT_VER >= 0x0200) - int GetTextRange(LONG nStartChar, LONG nEndChar, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TEXTRANGE tr = { 0 }; - tr.chrg.cpMin = nStartChar; - tr.chrg.cpMax = nEndChar; - tr.lpstrText = lpstrText; - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - } -#else // !(_RICHEDIT_VER >= 0x0200) - - int GetTextRange(LONG nStartChar, LONG nEndChar, LPSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TEXTRANGE tr = { 0 }; - tr.chrg.cpMin = nStartChar; - tr.chrg.cpMax = nEndChar; - tr.lpstrText = lpstrText; - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - } -#endif // !(_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0200) - DWORD GetDefaultCharFormat(CHARFORMAT2& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); - } - - BOOL SetCharFormat(CHARFORMAT2& cf, WORD wFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); - } - - BOOL SetDefaultCharFormat(CHARFORMAT2& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); - } - - DWORD GetSelectionCharFormat(CHARFORMAT2& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); - } - - BOOL SetSelectionCharFormat(CHARFORMAT2& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - - BOOL SetWordCharFormat(CHARFORMAT2& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); - } - - DWORD GetParaFormat(PARAFORMAT2& pf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); - } - - BOOL SetParaFormat(PARAFORMAT2& pf) - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); - } - - TEXTMODE GetTextMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (TEXTMODE)::SendMessage(m_hWnd, EM_GETTEXTMODE, 0, 0L); - } - - BOOL SetTextMode(TEXTMODE enumTextMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - return !(BOOL)::SendMessage(m_hWnd, EM_SETTEXTMODE, enumTextMode, 0L); - } - - UNDONAMEID GetUndoName() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETUNDONAME, 0, 0L); - } - - UNDONAMEID GetRedoName() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETREDONAME, 0, 0L); - } - - BOOL CanRedo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); - } - - BOOL GetAutoURLDetect() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETAUTOURLDETECT, 0, 0L); - } - - BOOL SetAutoURLDetect(BOOL bAutoDetect = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return !(BOOL)::SendMessage(m_hWnd, EM_AUTOURLDETECT, bAutoDetect, 0L); - } - - // this method is deprecated, please use SetAutoURLDetect - BOOL EnableAutoURLDetect(BOOL bEnable = TRUE) { return SetAutoURLDetect(bEnable); } - - UINT SetUndoLimit(UINT uUndoLimit) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETUNDOLIMIT, uUndoLimit, 0L); - } - - void SetPalette(HPALETTE hPalette) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPALETTE, (WPARAM)hPalette, 0L); - } - - int GetTextEx(GETTEXTEX* pGetTextEx, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)pGetTextEx, (LPARAM)lpstrText); - } - - int GetTextEx(LPTSTR lpstrText, int nTextLen, DWORD dwFlags = GT_DEFAULT, UINT uCodePage = CP_ACP, LPCSTR lpDefaultChar = NULL, LPBOOL lpUsedDefChar = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - GETTEXTEX gte = { 0 }; - gte.cb = nTextLen * sizeof(TCHAR); - gte.codepage = uCodePage; - gte.flags = dwFlags; - gte.lpDefaultChar = lpDefaultChar; - gte.lpUsedDefChar = lpUsedDefChar; - return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)>e, (LPARAM)lpstrText); - } - - int GetTextLengthEx(GETTEXTLENGTHEX* pGetTextLengthEx) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)pGetTextLengthEx, 0L); - } - - int GetTextLengthEx(DWORD dwFlags = GTL_DEFAULT, UINT uCodePage = CP_ACP) const - { - ATLASSERT(::IsWindow(m_hWnd)); - GETTEXTLENGTHEX gtle = { 0 }; - gtle.codepage = uCodePage; - gtle.flags = dwFlags; - return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)>le, 0L); - } -#endif // (_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0300) - int SetTextEx(SETTEXTEX* pSetTextEx, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)pSetTextEx, (LPARAM)lpstrText); - } - - int SetTextEx(LPCTSTR lpstrText, DWORD dwFlags = ST_DEFAULT, UINT uCodePage = CP_ACP) - { - ATLASSERT(::IsWindow(m_hWnd)); - SETTEXTEX ste = { 0 }; - ste.flags = dwFlags; - ste.codepage = uCodePage; - return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpstrText); - } - - int GetEditStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETEDITSTYLE, 0, 0L); - } - - int SetEditStyle(int nStyle, int nMask = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - if(nMask == -1) - nMask = nStyle; // set everything specified - return (int)::SendMessage(m_hWnd, EM_SETEDITSTYLE, nStyle, nMask); - } - - BOOL SetFontSize(int nFontSizeDelta) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nFontSizeDelta >= -1637 && nFontSizeDelta <= 1638); - return (BOOL)::SendMessage(m_hWnd, EM_SETFONTSIZE, nFontSizeDelta, 0L); - } - - void GetScrollPos(LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpPoint != NULL); - ::SendMessage(m_hWnd, EM_GETSCROLLPOS, 0, (LPARAM)lpPoint); - } - - void SetScrollPos(LPPOINT lpPoint) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpPoint != NULL); - ::SendMessage(m_hWnd, EM_SETSCROLLPOS, 0, (LPARAM)lpPoint); - } - - BOOL GetZoom(int& nNum, int& nDen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); - } - - BOOL SetZoom(int nNum, int nDen) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nNum >= 0 && nNum <= 64); - ATLASSERT(nDen >= 0 && nDen <= 64); - return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, nNum, nDen); - } - - BOOL SetZoomOff() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, 0, 0L); - } -#endif // (_RICHEDIT_VER >= 0x0300) - -// Operations - void LimitText(LONG nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EXLIMITTEXT, 0, nChars); - } - - int LineFromChar(LONG nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex); - } - - POINT PosFromChar(LONG nChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - POINT point = { 0, 0 }; - ::SendMessage(m_hWnd, EM_POSFROMCHAR, (WPARAM)&point, nChar); - return point; - } - - int CharFromPos(POINT pt) const - { - ATLASSERT(::IsWindow(m_hWnd)); - POINTL ptl = { pt.x, pt.y }; - return (int)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, (LPARAM)&ptl); - } - - void EmptyUndoBuffer() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); - } - - int LineIndex(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); - } - - int LineLength(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); - } - - BOOL LineScroll(int nLines, int nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); - } - - void SetRect(LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); - } - - BOOL DisplayBand(LPRECT pDisplayRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_DISPLAYBAND, 0, (LPARAM)pDisplayRect); - } - - LONG FindText(DWORD dwFlags, FINDTEXT& ft) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTW, dwFlags, (LPARAM)&ft); -#else - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXT, dwFlags, (LPARAM)&ft); -#endif - } - - LONG FindText(DWORD dwFlags, FINDTEXTEX& ft) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEXW, dwFlags, (LPARAM)&ft); -#else - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEX, dwFlags, (LPARAM)&ft); -#endif - } - - LONG FormatRange(FORMATRANGE& fr, BOOL bDisplay = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)&fr); - } - - LONG FormatRange(FORMATRANGE* pFormatRange, BOOL bDisplay = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)pFormatRange); - } - - void HideSelection(BOOL bHide = TRUE, BOOL bChangeStyle = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_HIDESELECTION, bHide, bChangeStyle); - } - - void PasteSpecial(UINT uClipFormat, DWORD dwAspect = 0, HMETAFILE hMF = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - REPASTESPECIAL reps = { dwAspect, (DWORD_PTR)hMF }; - ::SendMessage(m_hWnd, EM_PASTESPECIAL, uClipFormat, (LPARAM)&reps); - } - - void RequestResize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REQUESTRESIZE, 0, 0L); - } - - LONG StreamIn(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, uFormat, (LPARAM)&es); - } - - LONG StreamOut(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, uFormat, (LPARAM)&es); - } - - DWORD FindWordBreak(int nCode, LONG nStartChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_FINDWORDBREAK, nCode, nStartChar); - } - - // Additional operations - void ScrollCaret() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - int InsertText(long nInsertAfterChar, LPCTSTR lpstrText, BOOL bCanUndo = FALSE) - { - int nRet = SetSel(nInsertAfterChar, nInsertAfterChar); - ReplaceSel(lpstrText, bCanUndo); - return nRet; - } - - int AppendText(LPCTSTR lpstrText, BOOL bCanUndo = FALSE) - { - return InsertText(GetWindowTextLength(), lpstrText, bCanUndo); - } - - // Clipboard operations - BOOL Undo() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); - } - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } - - // OLE support - IRichEditOle* GetOleInterface() const - { - ATLASSERT(::IsWindow(m_hWnd)); - IRichEditOle *pRichEditOle = NULL; - ::SendMessage(m_hWnd, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle); - return pRichEditOle; - } - - BOOL SetOleCallback(IRichEditOleCallback* pCallback) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETOLECALLBACK, 0, (LPARAM)pCallback); - } - -#if (_RICHEDIT_VER >= 0x0200) - BOOL Redo() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_REDO, 0, 0L); - } - - void StopGroupTyping() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_STOPGROUPTYPING, 0, 0L); - } - - void ShowScrollBar(int nBarType, BOOL bVisible = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SHOWSCROLLBAR, nBarType, bVisible); - } -#endif // (_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0300) - BOOL SetTabStops(int nTabStops, LPINT rgTabStops) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); - } - - BOOL SetTabStops() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); - } - - BOOL SetTabStops(const int& cxEachStop) // takes an 'int' - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); - } -#endif // (_RICHEDIT_VER >= 0x0300) -}; - -typedef CRichEditCtrlT CRichEditCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditCommands - message handlers for standard EDIT commands - -#ifndef _WIN32_WCE - -// Chain to CRichEditCommands message map. Your class must also derive from CRichEditCtrl. -// Example: -// class CMyRichEdit : public CWindowImpl, -// public CRichEditCommands -// { -// public: -// BEGIN_MSG_MAP(CMyRichEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CRichEditCommands, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CRichEditCommands : public CEditCommands< T > -{ -public: - BEGIN_MSG_MAP(CRichEditCommands< T >) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR, CEditCommands< T >::OnEditClear) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, CEditCommands< T >::OnEditClearAll) - COMMAND_ID_HANDLER(ID_EDIT_COPY, CEditCommands< T >::OnEditCopy) - COMMAND_ID_HANDLER(ID_EDIT_CUT, CEditCommands< T >::OnEditCut) - COMMAND_ID_HANDLER(ID_EDIT_PASTE, CEditCommands< T >::OnEditPaste) - COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, CEditCommands< T >::OnEditSelectAll) - COMMAND_ID_HANDLER(ID_EDIT_UNDO, CEditCommands< T >::OnEditUndo) -#if (_RICHEDIT_VER >= 0x0200) - COMMAND_ID_HANDLER(ID_EDIT_REDO, OnEditRedo) -#endif // (_RICHEDIT_VER >= 0x0200) - END_MSG_MAP() - -#if (_RICHEDIT_VER >= 0x0200) - LRESULT OnEditRedo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Redo(); - return 0; - } -#endif // (_RICHEDIT_VER >= 0x0200) - -// State (update UI) helpers - BOOL CanCut() const - { return HasSelection(); } - - BOOL CanCopy() const - { return HasSelection(); } - - BOOL CanClear() const - { return HasSelection(); } - -// Implementation - BOOL HasSelection() const - { - const T* pT = static_cast(this); - return (pT->GetSelectionType() != SEL_EMPTY); - } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CDragListBox - -#ifndef _WIN32_WCE - -template -class CDragListBoxT : public CListBoxT< TBase > -{ -public: -// Constructors - CDragListBoxT(HWND hWnd = NULL) : CListBoxT< TBase >(hWnd) - { } - - CDragListBoxT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - if(hWnd != NULL) - MakeDragList(); - return hWnd; - } - -// Operations - BOOL MakeDragList() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return ::MakeDragList(m_hWnd); - } - - int LBItemFromPt(POINT pt, BOOL bAutoScroll = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::LBItemFromPt(m_hWnd, pt, bAutoScroll); - } - - void DrawInsert(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::DrawInsert(GetParent(), m_hWnd, nItem); - } - - static UINT GetDragListMessage() - { - static UINT uDragListMessage = 0; - if(uDragListMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDragListBox::GetDragListMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uDragListMessage == 0) - uDragListMessage = ::RegisterWindowMessage(DRAGLISTMSGSTRING); - - lock.Unlock(); - } - ATLASSERT(uDragListMessage != 0); - return uDragListMessage; - } -}; - -typedef CDragListBoxT CDragListBox; - -template -class CDragListNotifyImpl -{ -public: - BEGIN_MSG_MAP(CDragListNotifyImpl< T >) - MESSAGE_HANDLER(CDragListBox::GetDragListMessage(), OnDragListNotify) - END_MSG_MAP() - - LRESULT OnDragListNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - uMsg; // avoid level 4 warning - ATLASSERT(uMsg == CDragListBox::GetDragListMessage()); - T* pT = static_cast(this); - LPDRAGLISTINFO lpDragListInfo = (LPDRAGLISTINFO)lParam; - LRESULT lRet = 0; - switch(lpDragListInfo->uNotification) - { - case DL_BEGINDRAG: - lRet = (LPARAM)pT->OnBeginDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - case DL_CANCELDRAG: - pT->OnCancelDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - case DL_DRAGGING: - lRet = (LPARAM)pT->OnDragging((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - case DL_DROPPED: - pT->OnDropped((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown DragListBox notification\n")); - bHandled = FALSE; // don't handle it - break; - } - return lRet; - } - -// Overrideables - BOOL OnBeginDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - return TRUE; // allow dragging - } - - void OnCancelDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - // nothing to do - } - - int OnDragging(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - return 0; // don't change cursor - } - - void OnDropped(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - // nothing to do - } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CReBarCtrl - -template -class CReBarCtrlT : public TBase -{ -public: -// Constructors - CReBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CReBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return REBARCLASSNAME; - } - - UINT GetBandCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETBANDCOUNT, 0, 0L); - } - - BOOL GetBandInfo(int nBand, LPREBARBANDINFO lprbbi) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi); - } - - BOOL SetBandInfo(int nBand, LPREBARBANDINFO lprbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi); - } - - BOOL GetBarInfo(LPREBARINFO lprbi) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)lprbi); - } - - BOOL SetBarInfo(LPREBARINFO lprbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)lprbi); - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - REBARINFO rbi = { 0 }; - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = RBIM_IMAGELIST; - if( (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)&rbi) == FALSE ) return CImageList(); - return CImageList(rbi.himl); - } - - BOOL SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - REBARINFO rbi = { 0 }; - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = RBIM_IMAGELIST; - rbi.himl = hImageList; - return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)&rbi); - } - - UINT GetRowCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETROWCOUNT, 0, 0L); - } - - UINT GetRowHeight(int nBand) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETROWHEIGHT, nBand, 0L); - } - -#if (_WIN32_IE >= 0x0400) - COLORREF GetTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_GETTEXTCOLOR, 0, 0L); - } - - COLORREF SetTextColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_GETBKCOLOR, 0, 0L); - } - - COLORREF SetBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); - } - - UINT GetBarHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETBARHEIGHT, 0, 0L); - } - - BOOL GetRect(int nBand, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETRECT, nBand, (LPARAM)lpRect); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, RB_GETTOOLTIPS, 0, 0L)); - } - - void SetToolTips(HWND hwndToolTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L); - } -#endif // !_WIN32_WCE - - void GetBandBorders(int nBand, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpRect != NULL); - ::SendMessage(m_hWnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect); - } - -#ifndef _WIN32_WCE - BOOL GetColorScheme(LPCOLORSCHEME lpColorScheme) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpColorScheme != NULL); - return (BOOL)::SendMessage(m_hWnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme); - } - - void SetColorScheme(LPCOLORSCHEME lpColorScheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpColorScheme != NULL); - ::SendMessage(m_hWnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme); - } - - HPALETTE GetPalette() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPALETTE)::SendMessage(m_hWnd, RB_GETPALETTE, 0, 0L); - } - - HPALETTE SetPalette(HPALETTE hPalette) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPALETTE)::SendMessage(m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPalette); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0501) - // requires uxtheme.h to be included to use MARGINS struct -#ifndef _UXTHEME_H_ - typedef struct _MARGINS* PMARGINS; -#endif // !_UXTHEME_H_ - void GetBandMargins(PMARGINS pMargins) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins); - } - - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_IE >= 0x0600) - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, RB_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle); - } -#endif // (_WIN32_IE >= 0x0600) - -// Operations - BOOL InsertBand(int nBand, LPREBARBANDINFO lprbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_INSERTBAND, nBand, (LPARAM)lprbbi); - } - - BOOL AddBand(LPREBARBANDINFO lprbbi) - { - return InsertBand(-1, lprbbi); - } - - BOOL DeleteBand(int nBand) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_DELETEBAND, nBand, 0L); - } - - ATL::CWindow SetNotifyWnd(HWND hWnd) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, RB_SETPARENT, (WPARAM)hWnd, 0L)); - } - -#if (_WIN32_IE >= 0x0400) - void BeginDrag(int nBand, DWORD dwPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, dwPos); - } - - void BeginDrag(int nBand, int xPos, int yPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos)); - } - - void EndDrag() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_ENDDRAG, 0, 0L); - } - - void DragMove(DWORD dwPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, dwPos); - } - - void DragMove(int xPos, int yPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos)); - } - -#ifndef _WIN32_WCE - void GetDropTarget(IDropTarget** ppDropTarget) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget); - } -#endif // !_WIN32_WCE - - void MaximizeBand(int nBand, BOOL bIdeal = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_MAXIMIZEBAND, nBand, bIdeal); - } - - void MinimizeBand(int nBand) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_MINIMIZEBAND, nBand, 0L); - } - - BOOL SizeToRect(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SIZETORECT, 0, (LPARAM)lpRect); - } - - int IdToIndex(UINT uBandID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, RB_IDTOINDEX, uBandID, 0L); - } - - int HitTest(LPRBHITTESTINFO lprbht) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, RB_HITTEST, 0, (LPARAM)lprbht); - } - - BOOL ShowBand(int nBand, BOOL bShow) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SHOWBAND, nBand, bShow); - } - -#ifndef _WIN32_WCE - BOOL MoveBand(int nBand, int nNewPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nNewPos >= 0 && nNewPos <= ((int)GetBandCount() - 1)); - return (BOOL)::SendMessage(m_hWnd, RB_MOVEBAND, nBand, nNewPos); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - void PushChevron(int nBand, LPARAM lAppValue) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_PUSHCHEVRON, nBand, lAppValue); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Extra operations -#if (_WIN32_IE >= 0x0400) - void LockBands(bool bLock) - { - int nBandCount = GetBandCount(); - for(int i =0; i < nBandCount; i++) - { - REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; - rbbi.fMask = RBBIM_STYLE; - BOOL bRet = GetBandInfo(i, &rbbi); - ATLASSERT(bRet); - - if((rbbi.fStyle & RBBS_GRIPPERALWAYS) == 0) - { - rbbi.fStyle |= RBBS_GRIPPERALWAYS; - bRet = SetBandInfo(i, &rbbi); - ATLASSERT(bRet); - rbbi.fStyle &= ~RBBS_GRIPPERALWAYS; - } - - if(bLock) - rbbi.fStyle |= RBBS_NOGRIPPER; - else - rbbi.fStyle &= ~RBBS_NOGRIPPER; - - bRet = SetBandInfo(i, &rbbi); - ATLASSERT(bRet); - } - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0600) - BOOL SetBandWidth(int nBand, int cxWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBANDWIDTH, nBand, cxWidth); - } -#endif // (_WIN32_WINNT >= 0x0600) -}; - -typedef CReBarCtrlT CReBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CComboBoxEx - -#ifndef _WIN32_WCE - -template -class CComboBoxExT : public CComboBoxT< TBase > -{ -public: -// Constructors - CComboBoxExT(HWND hWnd = NULL) : CComboBoxT< TBase >(hWnd) - { } - - CComboBoxExT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_COMBOBOXEX; - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_GETIMAGELIST, 0, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)hImageList)); - } - -#if (_WIN32_IE >= 0x0400) - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CBEM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0501) - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CBEM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - int InsertItem(const COMBOBOXEXITEM* lpcCBItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem); - } - - int InsertItem(UINT nMask, int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, - int iIndent, int iOverlay, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = nMask; - cbex.iItem = nIndex; - cbex.pszText = (LPTSTR) lpszItem; - cbex.iImage = nImage; - cbex.iSelectedImage = nSelImage; - cbex.iIndent = iIndent; - cbex.iOverlay = iOverlay; - cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); - } - - int InsertItem(int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_INDENT | CBEIF_LPARAM; - cbex.iItem = nIndex; - cbex.pszText = (LPTSTR) lpszItem; - cbex.iImage = nImage; - cbex.iSelectedImage = nSelImage; - cbex.iIndent = iIndent; - cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); - } - - int AddItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) - { - return InsertItem(nMask, -1, lpszItem, nImage, nSelImage, iIndent, iOverlay, lParam); - } - - int AddItem(LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) - { - return InsertItem(-1, lpszItem, nImage, nSelImage, iIndent, lParam); - } - - int DeleteItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CBEM_DELETEITEM, nIndex, 0L); - } - - BOOL GetItem(PCOMBOBOXEXITEM pCBItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)pCBItem); - } - - BOOL SetItem(const COMBOBOXEXITEM* lpcCBItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)lpcCBItem); - } - - int SetItem(int nIndex, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, - int iIndent, int iOverlay, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = nMask; - cbex.iItem = nIndex; - cbex.pszText = (LPTSTR) lpszItem; - cbex.iImage = nImage; - cbex.iSelectedImage = nSelImage; - cbex.iIndent = iIndent; - cbex.iOverlay = iOverlay; - cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)&cbex); - } - - BOOL GetItemText(int nIndex, LPTSTR lpszItem, int nLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpszItem != NULL); - - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT; - cbex.iItem = nIndex; - cbex.pszText = lpszItem; - cbex.cchTextMax = nLen; - - return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - } - -#ifndef _ATL_NO_COM - BOOL GetItemText(int nIndex, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT; - cbex.iItem = nIndex; - - LPTSTR lpstrText = NULL; - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - lpstrText[0] = NULL; - cbex.pszText = lpstrText; - cbex.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(bRet) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetItemText(int nIndex, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT; - cbex.iItem = nIndex; - - strText.Empty(); - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - cbex.pszText = strText.GetBufferSetLength(nLen); - if(cbex.pszText == NULL) - { - bRet = FALSE; - break; - } - cbex.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) - break; - } - strText.ReleaseBuffer(); - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL SetItemText(int nIndex, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(nIndex, CBEIF_TEXT, lpszItem, 0, 0, 0, 0, 0); - } - - CComboBox GetComboCtrl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CComboBox((HWND)::SendMessage(m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0L)); - } - - CEdit GetEditCtrl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, CBEM_GETEDITCONTROL, 0, 0L)); - } - - BOOL HasEditChanged() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_HASEDITCHANGED, 0, 0L); - } - -// Non-functional - int AddString(LPCTSTR /*lpszItem*/) - { - ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem - return 0; - } - - int InsertString(int /*nIndex*/, LPCTSTR /*lpszString*/) - { - ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem - return 0; - } - - int Dir(UINT /*attr*/, LPCTSTR /*lpszWildCard*/) - { - ATLASSERT(FALSE); // Not available in CComboBoxEx - return 0; - } - - int FindString(int /*nStartAfter*/, LPCTSTR /*lpszString*/) const - { - ATLASSERT(FALSE); // Not available in CComboBoxEx; try FindStringExact - return 0; - } -}; - -typedef CComboBoxExT CComboBoxEx; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMonthCalendarCtrl - -template -class CMonthCalendarCtrlT : public TBase -{ -public: -// Constructors - CMonthCalendarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CMonthCalendarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return MONTHCAL_CLASS; - } - - COLORREF GetColor(int nColorType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, MCM_GETCOLOR, nColorType, 0L); - } - - COLORREF SetColor(int nColorType, COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, MCM_SETCOLOR, nColorType, clr); - } - - BOOL GetCurSel(LPSYSTEMTIME lpSysTime) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM)lpSysTime); - } - - BOOL SetCurSel(LPSYSTEMTIME lpSysTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM)lpSysTime); - } - - int GetFirstDayOfWeek(BOOL* pbLocaleVal = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0L); - if(pbLocaleVal != NULL) - *pbLocaleVal = (BOOL)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - int SetFirstDayOfWeek(int nDay, BOOL* pbLocaleVal = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, nDay); - if(pbLocaleVal != NULL) - *pbLocaleVal = (BOOL)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - int GetMaxSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMAXSELCOUNT, 0, 0L); - } - - BOOL SetMaxSelCount(int nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0L); - } - - int GetMonthDelta() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMONTHDELTA, 0, 0L); - } - - int SetMonthDelta(int nDelta) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_SETMONTHDELTA, nDelta, 0L); - } - - DWORD GetRange(LPSYSTEMTIME lprgSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM)lprgSysTimeArray); - } - - BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETRANGE, dwFlags, (LPARAM)lprgSysTimeArray); - } - - BOOL GetSelRange(LPSYSTEMTIME lprgSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM)lprgSysTimeArray); - } - - BOOL SetSelRange(LPSYSTEMTIME lprgSysTimeArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)lprgSysTimeArray); - } - - BOOL GetToday(LPSYSTEMTIME lpSysTime) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM)lpSysTime); - } - - void SetToday(LPSYSTEMTIME lpSysTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETTODAY, 0, (LPARAM)lpSysTime); - } - - BOOL GetMinReqRect(LPRECT lpRectInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM)lpRectInfo); - } - - int GetMaxTodayWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMAXTODAYWIDTH, 0, 0L); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - DWORD GetCurrentView() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETCURRENTVIEW, 0, 0L); - } - - BOOL SetCurrentView(DWORD dwView) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETCURRENTVIEW, 0, dwView); - } - - DWORD GetCalendarCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETCALENDARCOUNT, 0, 0L); - } - - BOOL GetCalendarGridInfo(PMCGRIDINFO pGridInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM)pGridInfo); - } - - CALID GetCALID() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (CALID)::SendMessage(m_hWnd, MCM_GETCALID, 0, 0L); - } - - void SetCALID(CALID calid) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETCALID, (LPARAM)calid, 0L); - } - - int GetCalendarBorder() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETCALENDARBORDER, 0, 0L); - } - - void SetCalendarBorder(int cxyBorder, BOOL bSet = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETCALENDARBORDER, (WPARAM)bSet, (LPARAM)cxyBorder); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - -// Operations - int GetMonthRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMONTHRANGE, dwFlags, (LPARAM)lprgSysTimeArray); - } - - BOOL SetDayState(int nMonths, LPMONTHDAYSTATE lpDayStateArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETDAYSTATE, nMonths, (LPARAM)lpDayStateArray); - } - - DWORD HitTest(PMCHITTESTINFO pMCHitTest) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_HITTEST, 0, (LPARAM)pMCHitTest); - } - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - void SizeRectToMin(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SIZERECTTOMIN, 0, (LPARAM)lpRect); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -}; - -typedef CMonthCalendarCtrlT CMonthCalendarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CDateTimePickerCtrl - -template -class CDateTimePickerCtrlT : public TBase -{ -public: -// Constructors - CDateTimePickerCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CDateTimePickerCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Operations - static LPCTSTR GetWndClassName() - { - return DATETIMEPICK_CLASS; - } - - BOOL SetFormat(LPCTSTR lpszFormat) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)lpszFormat); - } - - COLORREF GetMonthCalColor(int nColorType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, DTM_GETMCCOLOR, nColorType, 0L); - } - - COLORREF SetMonthCalColor(int nColorType, COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, DTM_SETMCCOLOR, nColorType, clr); - } - - DWORD GetRange(LPSYSTEMTIME lpSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM)lpSysTimeArray); - } - - BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lpSysTimeArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETRANGE, dwFlags, (LPARAM)lpSysTimeArray); - } - - DWORD GetSystemTime(LPSYSTEMTIME lpSysTime) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)lpSysTime); - } - - BOOL SetSystemTime(DWORD dwFlags, LPSYSTEMTIME lpSysTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, dwFlags, (LPARAM)lpSysTime); - } - - CMonthCalendarCtrl GetMonthCal() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CMonthCalendarCtrl((HWND)::SendMessage(m_hWnd, DTM_GETMONTHCAL, 0, 0L)); - } - -#if (_WIN32_IE >= 0x0400) - CFontHandle GetMonthCalFont() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CFontHandle((HFONT)::SendMessage(m_hWnd, DTM_GETMCFONT, 0, 0L)); - } - - void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_SETMCFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); - } -#endif // (_WIN32_IE >= 0x0400) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - DWORD GetMonthCalStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETMCSTYLE, 0, 0L); - } - - DWORD SetMonthCalStyle(DWORD dwStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); - } - - void GetDateTimePickerInfo(LPDATETIMEPICKERINFO lpPickerInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_GETDATETIMEPICKERINFO, 0, (LPARAM)lpPickerInfo); - } - - BOOL GetIdealSize(LPSIZE lpSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)lpSize); - } - - void CloseMonthCal() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_CLOSEMONTHCAL, 0, 0L); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -}; - -typedef CDateTimePickerCtrlT CDateTimePickerCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CFlatScrollBarImpl - support for flat scroll bars - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -template -class CFlatScrollBarImpl -{ -public: -// Initialization - BOOL FlatSB_Initialize() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::InitializeFlatSB(pT->m_hWnd); - } - - HRESULT FlatSB_Uninitialize() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::UninitializeFlatSB(pT->m_hWnd); - } - -// Flat scroll bar properties - BOOL FlatSB_GetScrollProp(UINT uIndex, LPINT lpnValue) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollProp(pT->m_hWnd, uIndex, lpnValue); - } - - BOOL FlatSB_SetScrollProp(UINT uIndex, int nValue, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollProp(pT->m_hWnd, uIndex, nValue, bRedraw); - } - -// Attributes - int FlatSB_GetScrollPos(int nBar) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollPos(pT->m_hWnd, nBar); - } - - int FlatSB_SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollPos(pT->m_hWnd, nBar, nPos, bRedraw); - } - - BOOL FlatSB_GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollRange(pT->m_hWnd, nBar, lpMinPos, lpMaxPos); - } - - BOOL FlatSB_SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollRange(pT->m_hWnd, nBar, nMinPos, nMaxPos, bRedraw); - } - - BOOL FlatSB_GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo); - } - - int FlatSB_SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo, bRedraw); - } - -// Operations - BOOL FlatSB_ShowScrollBar(UINT nBar, BOOL bShow = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_ShowScrollBar(pT->m_hWnd, nBar, bShow); - } - - BOOL FlatSB_EnableScrollBar(UINT uSBFlags, UINT uArrowFlags = ESB_ENABLE_BOTH) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_EnableScrollBar(pT->m_hWnd, uSBFlags, uArrowFlags); - } -}; - -template -class CFlatScrollBarT : public TBase, public CFlatScrollBarImpl > -{ -public: - CFlatScrollBarT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CFlatScrollBarT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } -}; - -typedef CFlatScrollBarT CFlatScrollBar; - -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CIPAddressCtrl - -#if (_WIN32_IE >= 0x0400) - -template -class CIPAddressCtrlT : public TBase -{ -public: -// Constructors - CIPAddressCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CIPAddressCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Atteributes - static LPCTSTR GetWndClassName() - { - return WC_IPADDRESS; - } - - BOOL IsBlank() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IPM_ISBLANK, 0, 0L); - } - - int GetAddress(LPDWORD lpdwAddress) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, IPM_GETADDRESS, 0, (LPARAM)lpdwAddress); - } - - void SetAddress(DWORD dwAddress) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETADDRESS, 0, dwAddress); - } - - void ClearAddress() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_CLEARADDRESS, 0, 0L); - } - - void SetRange(int nField, WORD wRange) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETRANGE, nField, wRange); - } - - void SetRange(int nField, BYTE nMin, BYTE nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETRANGE, nField, MAKEIPRANGE(nMin, nMax)); - } - - void SetFocus(int nField) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETFOCUS, nField, 0L); - } -}; - -typedef CIPAddressCtrlT CIPAddressCtrl; - -#endif // (_WIN32_IE >= 0x0400) - - -/////////////////////////////////////////////////////////////////////////////// -// CPagerCtrl - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -template -class CPagerCtrlT : public TBase -{ -public: -// Constructors - CPagerCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CPagerCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_PAGESCROLLER; - } - - int GetButtonSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETBUTTONSIZE, 0, 0L); - } - - int SetButtonSize(int nButtonSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETBUTTONSIZE, 0, nButtonSize); - } - - DWORD GetButtonState(int nButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nButton == PGB_TOPORLEFT || nButton == PGB_BOTTOMORRIGHT); - return (DWORD)::SendMessage(m_hWnd, PGM_GETBUTTONSTATE, 0, nButton); - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PGM_GETBKCOLOR, 0, 0L); - } - - COLORREF SetBkColor(COLORREF clrBk) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PGM_SETBKCOLOR, 0, (LPARAM)clrBk); - } - - int GetBorder() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETBORDER, 0, 0L); - } - - int SetBorder(int nBorderSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETBORDER, 0, nBorderSize); - } - - int GetPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETPOS, 0, 0L); - } - - int SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETPOS, 0, nPos); - } - -// Operations - void SetChild(HWND hWndChild) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_SETCHILD, 0, (LPARAM)hWndChild); - } - - void ForwardMouse(BOOL bForward = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_FORWARDMOUSE, bForward, 0L); - } - - void RecalcSize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_RECALCSIZE, 0, 0L); - } - - void GetDropTarget(IDropTarget** ppDropTarget) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDropTarget != NULL); - ::SendMessage(m_hWnd, PGM_GETDROPTARGET, 0, (LPARAM)ppDropTarget); - } -}; - -typedef CPagerCtrlT CPagerCtrl; - -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CLinkCtrl - Windows SYSLINK control - -#if (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) - -template -class CLinkCtrlT : public TBase -{ -public: -// Constructors - CLinkCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CLinkCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { -#ifdef _UNICODE - return WC_LINK; -#else // !_UNICODE - return "SysLink"; -#endif // !_UNICODE - } - - int GetIdealHeight(int cxMaxWidth = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); - } - - BOOL GetItem(PLITEM pLItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); - } - - BOOL SetItem(PLITEM pLItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); - } - - // Vista only - int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const - { -#ifndef LM_GETIDEALSIZE - const UINT LM_GETIDEALSIZE = LM_GETIDEALHEIGHT; -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); - } - -// Operations - BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); - } -}; - -typedef CLinkCtrlT CLinkCtrl; - -#endif // (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CCustomDraw - MI class for custom-draw support - -template -class CCustomDraw -{ -public: -#if (_ATL_VER < 0x0700) - BOOL m_bHandledCD; - - BOOL IsMsgHandled() const - { - return m_bHandledCD; - } - - void SetMsgHandled(BOOL bHandled) - { - m_bHandledCD = bHandled; - } -#endif // !(_ATL_VER < 0x0700) - -// Message map and handlers - BEGIN_MSG_MAP(CCustomDraw< T >) - NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) - ALT_MSG_MAP(1) - REFLECTED_NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) - END_MSG_MAP() - -// message handler - LRESULT OnCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - LPNMCUSTOMDRAW lpNMCustomDraw = (LPNMCUSTOMDRAW)pnmh; - DWORD dwRet = 0; - switch(lpNMCustomDraw->dwDrawStage) - { - case CDDS_PREPAINT: - dwRet = pT->OnPrePaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_POSTPAINT: - dwRet = pT->OnPostPaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_PREERASE: - dwRet = pT->OnPreErase(idCtrl, lpNMCustomDraw); - break; - case CDDS_POSTERASE: - dwRet = pT->OnPostErase(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPREPAINT: - dwRet = pT->OnItemPrePaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPOSTPAINT: - dwRet = pT->OnItemPostPaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPREERASE: - dwRet = pT->OnItemPreErase(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPOSTERASE: - dwRet = pT->OnItemPostErase(idCtrl, lpNMCustomDraw); - break; -#if (_WIN32_IE >= 0x0400) - case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): - dwRet = pT->OnSubItemPrePaint(idCtrl, lpNMCustomDraw); - break; -#endif // (_WIN32_IE >= 0x0400) - default: - pT->SetMsgHandled(FALSE); - break; - } - bHandled = pT->IsMsgHandled(); - return dwRet; - } - -// Overrideables - DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - -#if (_WIN32_IE >= 0x0400) - DWORD OnSubItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } -#endif // (_WIN32_IE >= 0x0400) -}; - - -// --- Windows CE common controls --- - -#ifdef _WIN32_WCE - -/////////////////////////////////////////////////////////////////////////////// -// CCECommandBarCtrl - -template -class CCECommandBarCtrlT : public TBase -{ -public: -// Constructors - CCECommandBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } - - CCECommandBarCtrlT< TBase >& operator=(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - BOOL IsVisible() const - { - return IsWindowVisible(); - } - - int GetHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_Height(m_hWnd); - } - - HMENU GetMenu(WORD wButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_GetMenu(m_hWnd, wButton); - } - -// Operations - HWND Create(HWND hWndParent, int nCmdBarID) - { - m_hWnd = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), hWndParent, nCmdBarID); - ATLASSERT(::IsWindow(m_hWnd)); - return m_hWnd; - } - - void Destroy() - { - DestroyWindow(); - } - - BOOL Show(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_Show(m_hWnd, bShow); - } - - BOOL DrawMenuBar(WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_DrawMenuBar(m_hWnd, wButton); - } - - BOOL AddAdornments(DWORD dwFlags = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_AddAdornments(m_hWnd, dwFlags, 0); - } - - int AddBitmap(int nBitmapID, int nNumImages) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_AddBitmap(m_hWnd, ModuleHelper::GetResourceInstance(), nBitmapID, nNumImages, 16, 16); - } - - BOOL AddButtons(UINT uNumButtons, LPTBBUTTON lpButtons) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_AddButtons(m_hWnd, uNumButtons, lpButtons); - } - - BOOL AddToolTips(UINT uNumToolTips, LPTSTR lpToolTips) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_AddToolTips(m_hWnd, uNumToolTips, lpToolTips); - } - - BOOL InsertButton(int nButton, LPTBBUTTON lpButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_InsertButton(m_hWnd, nButton, lpButton); - } - - HWND InsertComboBox(int nWidth, UINT dwStyle, WORD wComboBoxID, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertComboBox(m_hWnd, ModuleHelper::GetModuleInstance(), nWidth, dwStyle, wComboBoxID, wButton); - } - - BOOL InsertMenubar(WORD wMenuID, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertMenubar(m_hWnd, ModuleHelper::GetResourceInstance(), wMenuID, wButton); - } - - BOOL InsertMenubarEx(ATL::_U_STRINGorID menu, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertMenubarEx(m_hWnd, ModuleHelper::GetResourceInstance(), (LPTSTR)menu.m_lpstr, wButton); - } - - BOOL IsCommandBarMessage(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::IsCommandBarMessage(m_hWnd, lpMsg); - } -}; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC MenuBar - typedef CCECommandBarCtrlT CMenuBarCtrl; -#else - typedef CCECommandBarCtrlT CCECommandBarCtrl; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -/////////////////////////////////////////////////////////////////////////////// -// CCECommandBandsCtrl - -template -class CCECommandBandsCtrlT : public TBase -{ -public: -// Constructors - CCECommandBandsCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } - - CCECommandBandsCtrlT< TBase >& operator=(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - BOOL IsVisible() const - { - return IsWindowVisible(); - } - -#if (_WIN32_IE >= 0x0400) - UINT GetHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBands_Height(m_hWnd); - } -#endif // (_WIN32_IE >= 0x0400) - - HWND GetCommandBar(UINT uBand) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_GetCommandBar(m_hWnd, uBand); - } - - BOOL GetRestoreInformation(UINT uBand, LPCOMMANDBANDSRESTOREINFO pcbr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_GetRestoreInformation(m_hWnd, uBand, pcbr); - } - -// Operations - HWND Create(HWND hWndParent, UINT wID, DWORD dwStyles, HIMAGELIST hImageList = NULL) - { - m_hWnd = ::CommandBands_Create(ModuleHelper::GetModuleInstance(), hWndParent, wID, dwStyles, hImageList); - ATLASSERT(::IsWindow(m_hWnd)); - return m_hWnd; - } - - BOOL AddAdornments(DWORD dwFlags = 0, LPREBARBANDINFO prbbi = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_AddAdornments(m_hWnd, ModuleHelper::GetModuleInstance(), dwFlags, prbbi); - } - - BOOL AddBands(UINT uBandCount, LPREBARBANDINFO prbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_AddBands(m_hWnd, ModuleHelper::GetModuleInstance(), uBandCount, prbbi); - } - - BOOL Show(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_Show(m_hWnd, bShow); - } -}; - -typedef CCECommandBandsCtrlT CCECommandBandsCtrl; - -#endif // _WIN32_WCE - -}; // namespace WTL - -#endif // __ATLCTRLS_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlctrlw.h b/GLideN64/src/GLideNUI-wtl/WTL/atlctrlw.h deleted file mode 100644 index ade76d4..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlctrlw.h +++ /dev/null @@ -1,4157 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCTRLW_H__ -#define __ATLCTRLW_H__ - -#pragma once - -#ifdef _WIN32_WCE - #error atlctrlw.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atlctrlw.h requires atlapp.h to be included first -#endif - -#ifndef __ATLCTRLS_H__ - #error atlctrlw.h requires atlctrls.h to be included first -#endif - -#if (_WIN32_IE < 0x0400) - #error atlctrlw.h requires _WIN32_IE >= 0x0400 -#endif - -// Define _WTL_CMDBAR_VISTA_MENUS as 0 to exclude Vista menus support -#if !defined(_WTL_CMDBAR_VISTA_MENUS) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - #define _WTL_CMDBAR_VISTA_MENUS 1 -#endif - -#if _WTL_CMDBAR_VISTA_MENUS - #if !((_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501)) - #error _WTL_CMDBAR_VISTA_MENUS requires (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - #endif -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CCommandBarCtrlImpl -// CCommandBarCtrl -// CMDICommandBarCtrlImpl -// CMDICommandBarCtrl - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// Command Bars - -// Window Styles: -#define CBRWS_TOP CCS_TOP -#define CBRWS_BOTTOM CCS_BOTTOM -#define CBRWS_NORESIZE CCS_NORESIZE -#define CBRWS_NOPARENTALIGN CCS_NOPARENTALIGN -#define CBRWS_NODIVIDER CCS_NODIVIDER - -// Extended styles -#define CBR_EX_TRANSPARENT 0x00000001L -#define CBR_EX_SHAREMENU 0x00000002L -#define CBR_EX_ALTFOCUSMODE 0x00000004L -#define CBR_EX_TRACKALWAYS 0x00000008L -#define CBR_EX_NOVISTAMENUS 0x00000010L - -// standard command bar styles -#define ATL_SIMPLE_CMDBAR_PANE_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CBRWS_NODIVIDER | CBRWS_NORESIZE | CBRWS_NOPARENTALIGN) - -// Messages - support chevrons for frame windows -#define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND -#define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu -#define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu - -typedef struct tagCBRPOPUPMENU -{ - int cbSize; - HMENU hMenu; // popup menu do display - UINT uFlags; // TPM_* flags for ::TrackPopupMenuEx - int x; - int y; - LPTPMPARAMS lptpm; // ptr to TPMPARAMS for ::TrackPopupMenuEx -} CBRPOPUPMENU, *LPCBRPOPUPMENU; - -// helper class -template -class CSimpleStack : public ATL::CSimpleArray< T > -{ -public: - BOOL Push(T t) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-PUSH (%8.8X) size = %i\n"), t, GetSize()); -#endif - return Add(t); - } - - T Pop() - { - int nLast = GetSize() - 1; - if(nLast < 0) - return NULL; // must be able to convert to NULL - T t = m_aT[nLast]; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-POP (%8.8X) size = %i\n"), t, GetSize()); -#endif - if(!RemoveAt(nLast)) - return NULL; - return t; - } - - T GetCurrent() - { - int nLast = GetSize() - 1; - if(nLast < 0) - return NULL; // must be able to convert to NULL - return m_aT[nLast]; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CCommandBarCtrlBase - base class for the Command Bar implementation - -class CCommandBarCtrlBase : public CToolBarCtrl -{ -public: - struct _MsgHookData - { - HHOOK hMsgHook; - DWORD dwUsage; - - _MsgHookData() : hMsgHook(NULL), dwUsage(0) - { } - }; - - typedef ATL::CSimpleMap CMsgHookMap; - static CMsgHookMap* s_pmapMsgHook; - - static HHOOK s_hCreateHook; - static bool s_bW2K; // For animation flag - static CCommandBarCtrlBase* s_pCurrentBar; - static bool s_bStaticInit; - - CSimpleStack m_stackMenuWnd; - CSimpleStack m_stackMenuHandle; - - HWND m_hWndHook; - DWORD m_dwMagic; - - - CCommandBarCtrlBase() : m_hWndHook(NULL), m_dwMagic(1314) - { - // init static variables - if(!s_bStaticInit) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlBase::CCommandBarCtrlBase.\n")); - ATLASSERT(FALSE); - return; - } - - if(!s_bStaticInit) - { - // Just in case... - AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); - // Animation on Win2000 only - s_bW2K = !AtlIsOldWindows(); - // done - s_bStaticInit = true; - } - - lock.Unlock(); - } - } - - bool IsCommandBarBase() const { return m_dwMagic == 1314; } -}; - -__declspec(selectany) CCommandBarCtrlBase::CMsgHookMap* CCommandBarCtrlBase::s_pmapMsgHook = NULL; -__declspec(selectany) HHOOK CCommandBarCtrlBase::s_hCreateHook = NULL; -__declspec(selectany) CCommandBarCtrlBase* CCommandBarCtrlBase::s_pCurrentBar = NULL; -__declspec(selectany) bool CCommandBarCtrlBase::s_bW2K = false; -__declspec(selectany) bool CCommandBarCtrlBase::s_bStaticInit = false; - - -/////////////////////////////////////////////////////////////////////////////// -// CCommandBarCtrl - ATL implementation of Command Bars - -template -class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - -// Declarations - struct _MenuItemData // menu item data - { - DWORD dwMagic; - LPTSTR lpstrText; - UINT fType; - UINT fState; - int iButton; - - _MenuItemData() { dwMagic = 0x1313; } - bool IsCmdBarMenuItem() { return (dwMagic == 0x1313); } - }; - - struct _ToolBarData // toolbar resource data - { - WORD wVersion; - WORD wWidth; - WORD wHeight; - WORD wItemCount; - //WORD aItems[wItemCount] - - WORD* items() - { return (WORD*)(this+1); } - }; - -// Constants - enum _CmdBarDrawConstants - { - s_kcxGap = 1, - s_kcxTextMargin = 2, - s_kcxButtonMargin = 3, - s_kcyButtonMargin = 3 - }; - - enum - { - _nMaxMenuItemTextLength = 100, - _chChevronShortcut = _T('/') - }; - -#ifndef DT_HIDEPREFIX - enum { DT_HIDEPREFIX = 0x00100000 }; -#endif // !DT_HIDEPREFIX - -// Data members - HMENU m_hMenu; - HIMAGELIST m_hImageList; - ATL::CSimpleValArray m_arrCommand; - - DWORD m_dwExtendedStyle; // Command Bar specific extended styles - - ATL::CContainedWindow m_wndParent; - - bool m_bMenuActive:1; - bool m_bAttachedMenu:1; - bool m_bImagesVisible:1; - bool m_bPopupItem:1; - bool m_bContextMenu:1; - bool m_bEscapePressed:1; - bool m_bSkipMsg:1; - bool m_bParentActive:1; - bool m_bFlatMenus:1; - bool m_bUseKeyboardCues:1; - bool m_bShowKeyboardCues:1; - bool m_bAllowKeyboardCues:1; - bool m_bKeyboardInput:1; - bool m_bAlphaImages:1; - bool m_bLayoutRTL:1; - bool m_bSkipPostDown:1; - bool m_bVistaMenus:1; - - int m_nPopBtn; - int m_nNextPopBtn; - - SIZE m_szBitmap; - SIZE m_szButton; - - COLORREF m_clrMask; - CFont m_fontMenu; // used internally, only to measure text - - UINT m_uSysKey; - - HWND m_hWndFocus; // Alternate focus mode - - int m_cxExtraSpacing; - -#if _WTL_CMDBAR_VISTA_MENUS - ATL::CSimpleValArray m_arrVistaBitmap; // Bitmaps for Vista menus -#endif // _WTL_CMDBAR_VISTA_MENUS - -// Constructor/destructor - CCommandBarCtrlImpl() : - m_hMenu(NULL), - m_hImageList(NULL), - m_wndParent(this, 1), - m_bMenuActive(false), - m_bAttachedMenu(false), - m_nPopBtn(-1), - m_nNextPopBtn(-1), - m_bPopupItem(false), - m_bImagesVisible(true), - m_bSkipMsg(false), - m_uSysKey(0), - m_hWndFocus(NULL), - m_bContextMenu(false), - m_bEscapePressed(false), - m_clrMask(RGB(192, 192, 192)), - m_dwExtendedStyle(CBR_EX_TRANSPARENT | CBR_EX_SHAREMENU | CBR_EX_TRACKALWAYS), - m_bParentActive(true), - m_bFlatMenus(false), - m_bUseKeyboardCues(false), - m_bShowKeyboardCues(false), - m_bAllowKeyboardCues(true), - m_bKeyboardInput(false), - m_cxExtraSpacing(0), - m_bAlphaImages(false), - m_bLayoutRTL(false), - m_bSkipPostDown(false), - m_bVistaMenus(false) - { - SetImageSize(16, 15); // default - } - - ~CCommandBarCtrlImpl() - { - if(m_wndParent.IsWindow()) -/*scary!*/ m_wndParent.UnsubclassWindow(); - - if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) - ::DestroyMenu(m_hMenu); - - if(m_hImageList != NULL) - ::ImageList_Destroy(m_hImageList); - } - -// Attributes - DWORD GetCommandBarExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetCommandBarExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - CMenuHandle GetMenu() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_hMenu; - } - - COLORREF GetImageMaskColor() const - { - return m_clrMask; - } - - COLORREF SetImageMaskColor(COLORREF clrMask) - { - COLORREF clrOld = m_clrMask; - m_clrMask = clrMask; - return clrOld; - } - - bool GetImagesVisible() const - { - return m_bImagesVisible; - } - - bool SetImagesVisible(bool bVisible) - { - bool bOld = m_bImagesVisible; - m_bImagesVisible = bVisible; - return bOld; - } - - void GetImageSize(SIZE& size) const - { - size = m_szBitmap; - } - - bool SetImageSize(SIZE& size) - { - return SetImageSize(size.cx, size.cy); - } - - bool SetImageSize(int cx, int cy) - { - if(m_hImageList != NULL) - { - if(::ImageList_GetImageCount(m_hImageList) == 0) // empty - { - ::ImageList_Destroy(m_hImageList); - m_hImageList = NULL; - } - else - { - return false; // can't set, image list exists - } - } - - if(cx == 0 || cy == 0) - return false; - - m_szBitmap.cx = cx; - m_szBitmap.cy = cy; - m_szButton.cx = m_szBitmap.cx + 2 * s_kcxButtonMargin; - m_szButton.cy = m_szBitmap.cy + 2 * s_kcyButtonMargin; - - return true; - } - - bool GetAlphaImages() const - { - return m_bAlphaImages; - } - - bool SetAlphaImages(bool bAlphaImages) - { - if(m_hImageList != NULL) - { - if(::ImageList_GetImageCount(m_hImageList) == 0) // empty - { - ::ImageList_Destroy(m_hImageList); - m_hImageList = NULL; - } - else - { - return false; // can't set, image list exists - } - } - - m_bAlphaImages = bAlphaImages; - return true; - } - - HWND GetCmdBar() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); - } - -// Methods - HWND Create(HWND hWndParent, RECT& rcPos, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - UINT nID = 0, LPVOID lpCreateParam = NULL) - { - // These styles are required for command bars - dwStyle |= TBSTYLE_LIST | TBSTYLE_FLAT; -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) - } - - BOOL AttachToWindow(HWND hWnd) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - BOOL bRet = SubclassWindow(hWnd); - if(bRet) - { - m_bAttachedMenu = true; - T* pT = static_cast(this); - pT->GetSystemSettings(); - } - return bRet; - } - - BOOL LoadMenu(ATL::_U_STRINGorID menu) - { - ATLASSERT(::IsWindow(m_hWnd)); - - if(m_bAttachedMenu) // doesn't work in this mode - return FALSE; - if(menu.m_lpstr == NULL) - return FALSE; - - HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); - if(hMenu == NULL) - return FALSE; - - return AttachMenu(hMenu); - } - - BOOL AttachMenu(HMENU hMenu) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); - if(hMenu != NULL && !::IsMenu(hMenu)) - return FALSE; - -#if _WTL_CMDBAR_VISTA_MENUS - // remove Vista bitmaps if used - if(m_bVistaMenus && (m_hMenu != NULL)) - { - T* pT = static_cast(this); - pT->_RemoveVistaBitmapsFromMenu(); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - // destroy old menu, if needed, and set new one - if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) - ::DestroyMenu(m_hMenu); - - m_hMenu = hMenu; - - if(m_bAttachedMenu) // Nothing else in this mode - return TRUE; - - // Build buttons according to menu - SetRedraw(FALSE); - - // Clear all buttons - int nCount = GetButtonCount(); - for(int i = 0; i < nCount; i++) - ATLVERIFY(DeleteButton(0) != FALSE); - - // Add buttons for each menu item - if(m_hMenu != NULL) - { - int nItems = ::GetMenuItemCount(m_hMenu); - - T* pT = static_cast(this); - pT; // avoid level 4 warning - TCHAR szString[pT->_nMaxMenuItemTextLength]; - for(int i = 0; i < nItems; i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU; - mii.fType = MFT_STRING; - mii.dwTypeData = szString; - mii.cch = pT->_nMaxMenuItemTextLength; - BOOL bRet = ::GetMenuItemInfo(m_hMenu, i, TRUE, &mii); - ATLASSERT(bRet); - // If we have more than the buffer, we assume we have bitmaps bits - if(lstrlen(szString) > pT->_nMaxMenuItemTextLength - 1) - { - mii.fType = MFT_BITMAP; - ::SetMenuItemInfo(m_hMenu, i, TRUE, &mii); - szString[0] = 0; - } - - // NOTE: Command Bar currently supports only drop-down menu items - ATLASSERT(mii.hSubMenu != NULL); - - TBBUTTON btn = { 0 }; - btn.iBitmap = 0; - btn.idCommand = i; - btn.fsState = (BYTE)(((mii.fState & MFS_DISABLED) == 0) ? TBSTATE_ENABLED : 0); - btn.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE | TBSTYLE_DROPDOWN; - btn.dwData = 0; - btn.iString = 0; - - bRet = InsertButton(-1, &btn); - ATLASSERT(bRet); - - TBBUTTONINFO bi = { 0 }; - bi.cbSize = sizeof(TBBUTTONINFO); - bi.dwMask = TBIF_TEXT; - bi.pszText = szString; - - bRet = SetButtonInfo(i, &bi); - ATLASSERT(bRet); - } - } - - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); - - return TRUE; - } - - BOOL LoadImages(ATL::_U_STRINGorID image) - { - return _LoadImagesHelper(image, false); - } - - BOOL LoadMappedImages(UINT nIDImage, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) - { - return _LoadImagesHelper(nIDImage, true, nFlags , lpColorMap, nMapSize); - } - - BOOL _LoadImagesHelper(ATL::_U_STRINGorID image, bool bMapped, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); - - HRSRC hRsrc = ::FindResource(hInstance, image.m_lpstr, (LPTSTR)RT_TOOLBAR); - if(hRsrc == NULL) - return FALSE; - - HGLOBAL hGlobal = ::LoadResource(hInstance, hRsrc); - if(hGlobal == NULL) - return FALSE; - - _ToolBarData* pData = (_ToolBarData*)::LockResource(hGlobal); - if(pData == NULL) - return FALSE; - ATLASSERT(pData->wVersion == 1); - - WORD* pItems = pData->items(); - int nItems = pData->wItemCount; - - // Set internal data - SetImageSize(pData->wWidth, pData->wHeight); - - // Create image list if needed - if(m_hImageList == NULL) - { - // Check if the bitmap is 32-bit (alpha channel) bitmap (valid for Windows XP only) - T* pT = static_cast(this); - m_bAlphaImages = AtlIsAlphaBitmapResource(image); - - if(!pT->CreateInternalImageList(pData->wItemCount)) - return FALSE; - } - -#if _WTL_CMDBAR_VISTA_MENUS - int nOldImageCount = ::ImageList_GetImageCount(m_hImageList); -#endif // _WTL_CMDBAR_VISTA_MENUS - - // Add bitmap to our image list - CBitmap bmp; - if(bMapped) - { - ATLASSERT(HIWORD(PtrToUlong(image.m_lpstr)) == 0); // if mapped, must be a numeric ID - int nIDImage = (int)(short)LOWORD(PtrToUlong(image.m_lpstr)); - bmp.LoadMappedBitmap(nIDImage, (WORD)nFlags, lpColorMap, nMapSize); - } - else - { - if(m_bAlphaImages) - bmp = (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); - else - bmp.LoadBitmap(image.m_lpstr); - } - ATLASSERT(bmp.m_hBitmap != NULL); - if(bmp.m_hBitmap == NULL) - return FALSE; - if(::ImageList_AddMasked(m_hImageList, bmp, m_clrMask) == -1) - return FALSE; - - // Fill the array with command IDs - for(int i = 0; i < nItems; i++) - { - if(pItems[i] != 0) - m_arrCommand.Add(pItems[i]); - } - - int nImageCount = ::ImageList_GetImageCount(m_hImageList); - ATLASSERT(nImageCount == m_arrCommand.GetSize()); - if(nImageCount != m_arrCommand.GetSize()) - return FALSE; - -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - T* pT = static_cast(this); - pT->_AddVistaBitmapsFromImageList(nOldImageCount, nImageCount - nOldImageCount); - ATLASSERT(nImageCount == m_arrVistaBitmap.GetSize()); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - return TRUE; - } - - BOOL AddBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - CBitmap bmp; - bmp.LoadBitmap(bitmap.m_lpstr); - if(bmp.m_hBitmap == NULL) - return FALSE; - return AddBitmap(bmp, nCommandID); - } - - BOOL AddBitmap(HBITMAP hBitmap, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - // Create image list if it doesn't exist - if(m_hImageList == NULL) - { - if(!pT->CreateInternalImageList(1)) - return FALSE; - } - // check bitmap size - CBitmapHandle bmp = hBitmap; - SIZE size = { 0, 0 }; - bmp.GetSize(size); - if(size.cx != m_szBitmap.cx || size.cy != m_szBitmap.cy) - { - ATLASSERT(FALSE); // must match size! - return FALSE; - } - // add bitmap - int nRet = ::ImageList_AddMasked(m_hImageList, hBitmap, m_clrMask); - if(nRet == -1) - return FALSE; - BOOL bRet = m_arrCommand.Add((WORD)nCommandID); - ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); - ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - return bRet; - } - - BOOL AddIcon(ATL::_U_STRINGorID icon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); - if(hIcon == NULL) - return FALSE; - return AddIcon(hIcon, nCommandID); - } - - BOOL AddIcon(HICON hIcon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - // create image list if it doesn't exist - if(m_hImageList == NULL) - { - if(!pT->CreateInternalImageList(1)) - return FALSE; - } - - int nRet = ::ImageList_AddIcon(m_hImageList, hIcon); - if(nRet == -1) - return FALSE; - BOOL bRet = m_arrCommand.Add((WORD)nCommandID); - ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); - ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - return bRet; - } - - BOOL ReplaceBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - CBitmap bmp; - bmp.LoadBitmap(bitmap.m_lpstr); - if(bmp.m_hBitmap == NULL) - return FALSE; - return ReplaceBitmap(bmp, nCommandID); - } - - BOOL ReplaceBitmap(HBITMAP hBitmap, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - BOOL bRet = FALSE; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - if(m_arrCommand[i] == nCommandID) - { - bRet = ::ImageList_Remove(m_hImageList, i); - if(bRet) - { - m_arrCommand.RemoveAt(i); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - m_arrVistaBitmap.RemoveAt(i); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - } - break; - } - } - if(bRet) - bRet = AddBitmap(hBitmap, nCommandID); - return bRet; - } - - BOOL ReplaceIcon(ATL::_U_STRINGorID icon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); - if(hIcon == NULL) - return FALSE; - return ReplaceIcon(hIcon, nCommandID); - } - - BOOL ReplaceIcon(HICON hIcon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - BOOL bRet = FALSE; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - if(m_arrCommand[i] == nCommandID) - { - bRet = (::ImageList_ReplaceIcon(m_hImageList, i, hIcon) != -1); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista() && bRet != FALSE) - { - T* pT = static_cast(this); - pT->_ReplaceVistaBitmapFromImageList(i); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - break; - } - } - return bRet; - } - - BOOL RemoveImage(int nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - - BOOL bRet = FALSE; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - if(m_arrCommand[i] == nCommandID) - { - bRet = ::ImageList_Remove(m_hImageList, i); - if(bRet) - { - m_arrCommand.RemoveAt(i); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - m_arrVistaBitmap.RemoveAt(i); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - } - break; - } - } - return bRet; - } - - BOOL RemoveAllImages() - { - ATLASSERT(::IsWindow(m_hWnd)); - - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Removing all images\n")); - BOOL bRet = ::ImageList_RemoveAll(m_hImageList); - if(bRet) - { - m_arrCommand.RemoveAll(); -#if _WTL_CMDBAR_VISTA_MENUS - for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - } - m_arrVistaBitmap.RemoveAll(); -#endif // _WTL_CMDBAR_VISTA_MENUS - } - return bRet; - } - - BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsMenu(hMenu)); - if(!::IsMenu(hMenu)) - return FALSE; - m_bContextMenu = true; - if(m_bUseKeyboardCues) - m_bShowKeyboardCues = m_bKeyboardInput; - T* pT = static_cast(this); - return pT->DoTrackPopupMenu(hMenu, uFlags, x, y, lpParams); - } - - BOOL SetMDIClient(HWND /*hWndMDIClient*/) - { - // Use CMDICommandBarCtrl for MDI support - ATLASSERT(FALSE); - return FALSE; - } - -// Message map and handlers - BEGIN_MSG_MAP(CCommandBarCtrlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_INITMENU, OnInitMenu) - MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) - MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) - MESSAGE_HANDLER(GetAutoPopupMessage(), OnInternalAutoPopup) - MESSAGE_HANDLER(GetGetBarMessage(), OnInternalGetBar) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_MENUCHAR, OnMenuChar) - - MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) - MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) - MESSAGE_HANDLER(WM_CHAR, OnChar) - MESSAGE_HANDLER(WM_SYSKEYDOWN, OnSysKeyDown) - MESSAGE_HANDLER(WM_SYSKEYUP, OnSysKeyUp) - MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar) -// public API handlers - these stay to support chevrons in atlframe.h - MESSAGE_HANDLER(CBRM_GETMENU, OnAPIGetMenu) - MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnAPITrackPopupMenu) - MESSAGE_HANDLER(CBRM_GETCMDBAR, OnAPIGetCmdBar) - - MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) - MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) - - MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg) - ALT_MSG_MAP(1) // Parent window messages - NOTIFY_CODE_HANDLER(TBN_HOTITEMCHANGE, OnParentHotItemChange) - NOTIFY_CODE_HANDLER(TBN_DROPDOWN, OnParentDropDown) - MESSAGE_HANDLER(WM_INITMENUPOPUP, OnParentInitMenuPopup) - MESSAGE_HANDLER(GetGetBarMessage(), OnParentInternalGetBar) - MESSAGE_HANDLER(WM_SYSCOMMAND, OnParentSysCommand) - MESSAGE_HANDLER(CBRM_GETMENU, OnParentAPIGetMenu) - MESSAGE_HANDLER(WM_MENUCHAR, OnParentMenuChar) - MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnParentAPITrackPopupMenu) - MESSAGE_HANDLER(CBRM_GETCMDBAR, OnParentAPIGetCmdBar) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnParentSettingChange) - - MESSAGE_HANDLER(WM_DRAWITEM, OnParentDrawItem) - MESSAGE_HANDLER(WM_MEASUREITEM, OnParentMeasureItem) - - MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) - NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnParentCustomDraw) - ALT_MSG_MAP(2) // MDI client window messages - // Use CMDICommandBarCtrl for MDI support - ALT_MSG_MAP(3) // Message hook messages - MESSAGE_HANDLER(WM_MOUSEMOVE, OnHookMouseMove) - MESSAGE_HANDLER(WM_SYSKEYDOWN, OnHookSysKeyDown) - MESSAGE_HANDLER(WM_SYSKEYUP, OnHookSysKeyUp) - MESSAGE_HANDLER(WM_SYSCHAR, OnHookSysChar) - MESSAGE_HANDLER(WM_KEYDOWN, OnHookKeyDown) - MESSAGE_HANDLER(WM_NEXTMENU, OnHookNextMenu) - MESSAGE_HANDLER(WM_CHAR, OnHookChar) - END_MSG_MAP() - - LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - LPMSG pMsg = (LPMSG)lParam; - if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) - m_bKeyboardInput = false; - else if(pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) - m_bKeyboardInput = true; - LRESULT lRet = 0; - ProcessWindowMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam, lRet, 3); - return lRet; - } - - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - // Let the toolbar initialize itself - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - // get and use system settings - T* pT = static_cast(this); - pT->GetSystemSettings(); - // Parent init - ATL::CWindow wndParent = GetParent(); - ATL::CWindow wndTopLevelParent = wndParent.GetTopLevelParent(); - m_wndParent.SubclassWindow(wndTopLevelParent); - // Toolbar Init - SetButtonStructSize(); - SetImageList(NULL); - - // Create message hook if needed - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnCreate.\n")); - ATLASSERT(FALSE); - return -1; - } - - if(s_pmapMsgHook == NULL) - { - ATLTRY(s_pmapMsgHook = new CMsgHookMap); - ATLASSERT(s_pmapMsgHook != NULL); - } - - if(s_pmapMsgHook != NULL) - { - DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); - if(pData == NULL) - { - ATLTRY(pData = new _MsgHookData); - ATLASSERT(pData != NULL); - HHOOK hMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, MessageHookProc, ModuleHelper::GetModuleInstance(), dwThreadID); - ATLASSERT(hMsgHook != NULL); - if(pData != NULL && hMsgHook != NULL) - { - pData->hMsgHook = hMsgHook; - pData->dwUsage = 1; - BOOL bRet = s_pmapMsgHook->Add(dwThreadID, pData); - bRet; - ATLASSERT(bRet); - } - } - else - { - (pData->dwUsage)++; - } - } - lock.Unlock(); - - // Get layout -#if (WINVER >= 0x0500) - m_bLayoutRTL = ((GetExStyle() & WS_EX_LAYOUTRTL) != 0); -#endif // (WINVER >= 0x0500) - - return lRet; - } - - LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - -#if _WTL_CMDBAR_VISTA_MENUS - if(m_bVistaMenus && (m_hMenu != NULL)) - { - T* pT = static_cast(this); - pT->_RemoveVistaBitmapsFromMenu(); - } - - for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - if(m_bAttachedMenu) // nothing to do in this mode - return lRet; - - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnDestroy.\n")); - ATLASSERT(FALSE); - return lRet; - } - - if(s_pmapMsgHook != NULL) - { - DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); - if(pData != NULL) - { - (pData->dwUsage)--; - if(pData->dwUsage == 0) - { - BOOL bRet = ::UnhookWindowsHookEx(pData->hMsgHook); - ATLASSERT(bRet); - bRet = s_pmapMsgHook->Remove(dwThreadID); - ATLASSERT(bRet); - if(bRet) - delete pData; - } - - if(s_pmapMsgHook->GetSize() == 0) - { - delete s_pmapMsgHook; - s_pmapMsgHook = NULL; - } - } - } - - lock.Unlock(); - - return lRet; - } - - LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyDown\n")); -#endif - bHandled = FALSE; - // Simulate Alt+Space for the parent - if(wParam == VK_SPACE) - { - m_wndParent.PostMessage(WM_SYSKEYDOWN, wParam, lParam | (1 << 29)); - bHandled = TRUE; - } -#if (_WIN32_IE >= 0x0500) - else if(wParam == VK_LEFT || wParam == VK_RIGHT) - { - WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; - - if(!m_bMenuActive) - { - T* pT = static_cast(this); - int nBtn = GetHotItem(); - int nNextBtn = (wParam == wpNext) ? pT->GetNextMenuItem(nBtn) : pT->GetPreviousMenuItem(nBtn); - if(nNextBtn == -2) - { - SetHotItem(-1); - if(pT->DisplayChevronMenu()) - bHandled = TRUE; - } - } - } -#endif // (_WIN32_IE >= 0x0500) - return 0; - } - - LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyUp\n")); -#endif - if(wParam != VK_SPACE) - bHandled = FALSE; - return 0; - } - - LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnChar\n")); -#endif - if(wParam != VK_SPACE) - bHandled = FALSE; - else - return 0; - // Security - if(!m_wndParent.IsWindowEnabled() || ::GetFocus() != m_hWnd) - return 0; - - // Handle mnemonic press when we have focus - int nBtn = 0; - if(wParam != VK_RETURN && !MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) - { -#if (_WIN32_IE >= 0x0500) - if((TCHAR)LOWORD(wParam) != _chChevronShortcut) -#endif // (_WIN32_IE >= 0x0500) - ::MessageBeep(0); - } - else - { -#if (_WIN32_IE >= 0x0500) - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcBtn = { 0 }; - GetItemRect(nBtn, &rcBtn); - TBBUTTON tbb = { 0 }; - GetButton(nBtn, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) - { -#endif // (_WIN32_IE >= 0x0500) - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - if(wParam != VK_RETURN) - SetHotItem(nBtn); -#if (_WIN32_IE >= 0x0500) - } - else - { - ::MessageBeep(0); - bHandled = TRUE; - } -#endif // (_WIN32_IE >= 0x0500) - } - return 0; - } - - LRESULT OnSysKeyDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyDown\n")); -#endif - bHandled = FALSE; - return 0; - } - - LRESULT OnSysKeyUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyUp\n")); -#endif - bHandled = FALSE; - return 0; - } - - LRESULT OnSysChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysChar\n")); -#endif - bHandled = FALSE; - return 0; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bAttachedMenu || (m_dwExtendedStyle & CBR_EX_TRANSPARENT)) - { - bHandled = FALSE; - return 0; - } - - CDCHandle dc = (HDC)wParam; - RECT rect = { 0 }; - GetClientRect(&rect); - dc.FillRect(&rect, COLOR_MENU); - - return 1; // don't do the default erase - } - - LRESULT OnInitMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - int nIndex = GetHotItem(); - SendMessage(WM_MENUSELECT, MAKEWPARAM(nIndex, MF_POPUP|MF_HILITE), (LPARAM)m_hMenu); - bHandled = FALSE; - return 1; - } - - LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if((BOOL)HIWORD(lParam)) // System menu, do nothing - { - bHandled = FALSE; - return 1; - } - - if(!(m_bAttachedMenu || m_bMenuActive)) // Not attached or ours, do nothing - { - bHandled = FALSE; - return 1; - } - -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnInitMenuPopup\n")); -#endif - // forward to the parent or subclassed window, so it can handle update UI - LRESULT lRet = 0; - if(m_bAttachedMenu) - lRet = DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); - else - lRet = m_wndParent.DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); - -#if _WTL_CMDBAR_VISTA_MENUS - // If Vista menus are active, just set bitmaps and return - if(m_bVistaMenus) - { - CMenuHandle menu = (HMENU)wParam; - ATLASSERT(menu.m_hMenu != NULL); - - for(int i = 0; i < menu.GetMenuItemCount(); i++) - { - WORD nID = (WORD)menu.GetMenuItemID(i); - int nIndex = m_arrCommand.Find(nID); - - CMenuItemInfo mii; - mii.fMask = MIIM_BITMAP; - mii.hbmpItem = (m_bImagesVisible && (nIndex != -1)) ? m_arrVistaBitmap[nIndex] : NULL; - menu.SetMenuItemInfo(i, TRUE, &mii); - } - - return lRet; - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - // Convert menu items to ownerdraw, add our data - if(m_bImagesVisible) - { - CMenuHandle menuPopup = (HMENU)wParam; - ATLASSERT(menuPopup.m_hMenu != NULL); - - T* pT = static_cast(this); - pT; // avoid level 4 warning - TCHAR szString[pT->_nMaxMenuItemTextLength]; - BOOL bRet = FALSE; - for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) - { - CMenuItemInfo mii; - mii.cch = pT->_nMaxMenuItemTextLength; - mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; - mii.dwTypeData = szString; - bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - if(!(mii.fType & MFT_OWNERDRAW)) // Not already an ownerdraw item - { - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - _MenuItemData* pMI = NULL; - ATLTRY(pMI = new _MenuItemData); - ATLASSERT(pMI != NULL); - if(pMI != NULL) - { - pMI->fType = mii.fType; - pMI->fState = mii.fState; - mii.fType |= MFT_OWNERDRAW; - pMI->iButton = -1; - for(int j = 0; j < m_arrCommand.GetSize(); j++) - { - if(m_arrCommand[j] == mii.wID) - { - pMI->iButton = j; - break; - } - } - int cchLen = lstrlen(szString) + 1; - pMI->lpstrText = NULL; - ATLTRY(pMI->lpstrText = new TCHAR[cchLen]); - ATLASSERT(pMI->lpstrText != NULL); - if(pMI->lpstrText != NULL) - SecureHelper::strcpy_x(pMI->lpstrText, cchLen, szString); - mii.dwItemData = (ULONG_PTR)pMI; - bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - } - } - } - - // Add it to the list - m_stackMenuHandle.Push(menuPopup.m_hMenu); - } - - return lRet; - } - - LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if(!m_bAttachedMenu) // Not attached, do nothing, forward to parent - { - m_bPopupItem = (lParam != NULL) && ((HMENU)lParam != m_hMenu) && (HIWORD(wParam) & MF_POPUP); - if(m_wndParent.IsWindow()) - m_wndParent.SendMessage(uMsg, wParam, lParam); - bHandled = FALSE; - return 1; - } - - // Check if a menu is closing, do a cleanup - if(HIWORD(wParam) == 0xFFFF && lParam == NULL) // Menu closing - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuSelect - CLOSING!!!!\n")); -#endif - ATLASSERT(m_stackMenuWnd.GetSize() == 0); - // Restore the menu items to the previous state for all menus that were converted - if(m_bImagesVisible) - { - HMENU hMenu = NULL; - while((hMenu = m_stackMenuHandle.Pop()) != NULL) - { - CMenuHandle menuPopup = hMenu; - ATLASSERT(menuPopup.m_hMenu != NULL); - // Restore state and delete menu item data - BOOL bRet = FALSE; - for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_DATA | MIIM_TYPE; - bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; - if(pMI != NULL && pMI->IsCmdBarMenuItem()) - { - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - mii.fType = pMI->fType; - mii.dwTypeData = pMI->lpstrText; - mii.cch = lstrlen(pMI->lpstrText); - mii.dwItemData = NULL; - - bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - delete [] pMI->lpstrText; - pMI->dwMagic = 0x6666; - delete pMI; - } - } - } - } - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnInternalAutoPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - int nIndex = (int)wParam; - T* pT = static_cast(this); - pT->DoPopupMenu(nIndex, false); - return 0; - } - - LRESULT OnInternalGetBar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // Let's make sure we're not embedded in another process - if((LPVOID)wParam != NULL) - *((DWORD*)wParam) = GetCurrentProcessId(); - if(IsWindowVisible()) - return (LRESULT)static_cast(this); - else - return NULL; - } - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { -#ifndef SPI_GETKEYBOARDCUES - const UINT SPI_SETKEYBOARDCUES = 0x100B; -#endif // !SPI_GETKEYBOARDCUES -#ifndef SPI_GETFLATMENU - const UINT SPI_SETFLATMENU = 0x1023; -#endif // !SPI_GETFLATMENU - - if(wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETKEYBOARDCUES || wParam == SPI_SETFLATMENU) - { - T* pT = static_cast(this); - pT->GetSystemSettings(); - } - - return 0; - } - - LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - - LPWINDOWPOS lpWP = (LPWINDOWPOS)lParam; - int cyMin = ::GetSystemMetrics(SM_CYMENU); - if(lpWP->cy < cyMin) - lpWP->cy = cyMin; - - return lRet; - } - - LRESULT OnMenuChar(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuChar\n")); -#endif - bHandled = TRUE; - T* pT = static_cast(this); - - LRESULT lRet; - if(m_bMenuActive && LOWORD(wParam) != 0x0D) - lRet = 0; - else - lRet = MAKELRESULT(1, 1); - - if(m_bMenuActive && HIWORD(wParam) == MF_POPUP) - { - // Convert character to lower/uppercase and possibly Unicode, using current keyboard layout - TCHAR ch = (TCHAR)LOWORD(wParam); - CMenuHandle menu = (HMENU)lParam; - int nCount = ::GetMenuItemCount(menu); - int nRetCode = MNC_EXECUTE; - BOOL bRet = FALSE; - TCHAR szString[pT->_nMaxMenuItemTextLength]; - WORD wMnem = 0; - bool bFound = false; - for(int i = 0; i < nCount; i++) - { - CMenuItemInfo mii; - mii.cch = pT->_nMaxMenuItemTextLength; - mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; - mii.dwTypeData = szString; - bRet = menu.GetMenuItemInfo(i, TRUE, &mii); - if(!bRet || (mii.fType & MFT_SEPARATOR)) - continue; - _MenuItemData* pmd = (_MenuItemData*)mii.dwItemData; - if(pmd != NULL && pmd->IsCmdBarMenuItem()) - { - LPTSTR p = pmd->lpstrText; - - if(p != NULL) - { - while(*p && *p != _T('&')) - p = ::CharNext(p); - if(p != NULL && *p) - { - DWORD dwP = MAKELONG(*(++p), 0); - DWORD dwC = MAKELONG(ch, 0); - if(::CharLower((LPTSTR)ULongToPtr(dwP)) == ::CharLower((LPTSTR)ULongToPtr(dwC))) - { - if(!bFound) - { - wMnem = (WORD)i; - bFound = true; - } - else - { - nRetCode = MNC_SELECT; - break; - } - } - } - } - } - } - if(bFound) - { - if(nRetCode == MNC_EXECUTE) - { - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - pT->GiveFocusBack(); - } - bHandled = TRUE; - lRet = MAKELRESULT(wMnem, nRetCode); - } - } - else if(!m_bMenuActive) - { - int nBtn = 0; - if(!MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) - { - bHandled = FALSE; - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - pT->GiveFocusBack(); - -#if (_WIN32_IE >= 0x0500) - // check if we should display chevron menu - if((TCHAR)LOWORD(wParam) == pT->_chChevronShortcut) - { - if(pT->DisplayChevronMenu()) - bHandled = TRUE; - } -#endif // (_WIN32_IE >= 0x0500) - } - else if(m_wndParent.IsWindowEnabled()) - { -#if (_WIN32_IE >= 0x0500) - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcBtn = { 0 }; - GetItemRect(nBtn, &rcBtn); - TBBUTTON tbb = { 0 }; - GetButton(nBtn, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) - { -#endif // (_WIN32_IE >= 0x0500) - if(m_bUseKeyboardCues && !m_bShowKeyboardCues) - { - m_bAllowKeyboardCues = true; - ShowKeyboardCues(true); - } - pT->TakeFocus(); - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - SetHotItem(nBtn); -#if (_WIN32_IE >= 0x0500) - } - else - { - ::MessageBeep(0); - } -#endif // (_WIN32_IE >= 0x0500) - } - } - - return lRet; - } - - LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - LPDRAWITEMSTRUCT lpDrawItemStruct = (LPDRAWITEMSTRUCT)lParam; - _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - if(lpDrawItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) - { - T* pT = static_cast(this); - pT->DrawItem(lpDrawItemStruct); - } - else - { - bHandled = FALSE; - } - return (LRESULT)TRUE; - } - - LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - LPMEASUREITEMSTRUCT lpMeasureItemStruct = (LPMEASUREITEMSTRUCT)lParam; - _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; - if(lpMeasureItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) - { - T* pT = static_cast(this); - pT->MeasureItem(lpMeasureItemStruct); - } - else - { - bHandled = FALSE; - } - return (LRESULT)TRUE; - } - -// API message handlers - LRESULT OnAPIGetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hMenu; - } - - LRESULT OnAPITrackPopupMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - if(lParam == NULL) - return FALSE; - LPCBRPOPUPMENU lpCBRPopupMenu = (LPCBRPOPUPMENU)lParam; - if(lpCBRPopupMenu->cbSize != sizeof(CBRPOPUPMENU)) - return FALSE; - - T* pT = static_cast(this); - return pT->TrackPopupMenu(lpCBRPopupMenu->hMenu, lpCBRPopupMenu->uFlags, lpCBRPopupMenu->x, lpCBRPopupMenu->y, lpCBRPopupMenu->lptpm); - } - - LRESULT OnAPIGetCmdBar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hWnd; - } - -// Parent window message handlers - LRESULT OnParentHotItemChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LPNMTBHOTITEM lpNMHT = (LPNMTBHOTITEM)pnmh; - - // Check if this comes from us - if(pnmh->hwndFrom != m_hWnd) - { - bHandled = FALSE; - return 0; - } - - bool bBlockTracking = false; - if((m_dwExtendedStyle & CBR_EX_TRACKALWAYS) == 0) - { - DWORD dwProcessID; - ::GetWindowThreadProcessId(::GetActiveWindow(), &dwProcessID); - bBlockTracking = (::GetCurrentProcessId() != dwProcessID); - } - - if((!m_wndParent.IsWindowEnabled() || bBlockTracking) && (lpNMHT->dwFlags & HICF_MOUSE)) - { - return 1; - } - else - { -#ifndef HICF_LMOUSE - const DWORD HICF_LMOUSE = 0x00000080; // left mouse button selected -#endif - bHandled = FALSE; - - // Send WM_MENUSELECT to the app if it needs to display a status text - if(!(lpNMHT->dwFlags & HICF_MOUSE) - && !(lpNMHT->dwFlags & HICF_ACCELERATOR) - && !(lpNMHT->dwFlags & HICF_LMOUSE)) - { - if(lpNMHT->dwFlags & HICF_ENTERING) - m_wndParent.SendMessage(WM_MENUSELECT, 0, (LPARAM)m_hMenu); - if(lpNMHT->dwFlags & HICF_LEAVING) - m_wndParent.SendMessage(WM_MENUSELECT, MAKEWPARAM(0, 0xFFFF), NULL); - } - - return 0; - } - } - - LRESULT OnParentDropDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - // Check if this comes from us - if(pnmh->hwndFrom != m_hWnd) - { - bHandled = FALSE; - return 1; - } - - T* pT = static_cast(this); - if(::GetFocus() != m_hWnd) - pT->TakeFocus(); - LPNMTOOLBAR pNMToolBar = (LPNMTOOLBAR)pnmh; - int nIndex = CommandToIndex(pNMToolBar->iItem); - m_bContextMenu = false; - m_bEscapePressed = false; - pT->DoPopupMenu(nIndex, true); - - return TBDDRET_DEFAULT; - } - - LRESULT OnParentInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnInitMenuPopup(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentInternalGetBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnInternalGetBar(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; - if((m_uSysKey == VK_MENU - || (m_uSysKey == VK_F10 && !(::GetKeyState(VK_SHIFT) & 0x80)) - || m_uSysKey == VK_SPACE) - && wParam == SC_KEYMENU) - { - T* pT = static_cast(this); - if(::GetFocus() == m_hWnd) - { - pT->GiveFocusBack(); // exit menu "loop" - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - } - else if(m_uSysKey != VK_SPACE && !m_bSkipMsg) - { - if(m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) - ShowKeyboardCues(true); - - pT->TakeFocus(); // enter menu "loop" - bHandled = TRUE; - } - else if(m_uSysKey != VK_SPACE) - { - bHandled = TRUE; - } - } - m_bSkipMsg = false; - return 0; - } - - LRESULT OnParentAPIGetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnAPIGetMenu(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentMenuChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnMenuChar(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentAPITrackPopupMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnAPITrackPopupMenu(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentAPIGetCmdBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnAPIGetCmdBar(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - OnSettingChange(uMsg, wParam, lParam, bHandled); - bHandled = FALSE; - return 1; - } - - LRESULT OnParentDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnDrawItem(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnMeasureItem(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); - if(!m_bParentActive && m_bUseKeyboardCues && m_bShowKeyboardCues) - { - ShowKeyboardCues(false); // this will repaint our window - } - else - { - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnParentCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LRESULT lRet = CDRF_DODEFAULT; - bHandled = FALSE; - if(pnmh->hwndFrom == m_hWnd) - { - LPNMTBCUSTOMDRAW lpTBCustomDraw = (LPNMTBCUSTOMDRAW)pnmh; - if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_PREPAINT) - { - lRet = CDRF_NOTIFYITEMDRAW; - bHandled = TRUE; - } - else if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) - { - if(m_bFlatMenus) - { -#ifndef COLOR_MENUHILIGHT - const int COLOR_MENUHILIGHT = 29; -#endif // !COLOR_MENUHILIGHT - bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); - if(!bDisabled && ((lpTBCustomDraw->nmcd.uItemState & CDIS_HOT) == CDIS_HOT || - (lpTBCustomDraw->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)) - { - ::FillRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_MENUHILIGHT)); - ::FrameRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - lpTBCustomDraw->clrText = ::GetSysColor(m_bParentActive ? COLOR_HIGHLIGHTTEXT : COLOR_GRAYTEXT); - } - else if(bDisabled || !m_bParentActive) - { - lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); - } - CDCHandle dc = lpTBCustomDraw->nmcd.hdc; - dc.SetTextColor(lpTBCustomDraw->clrText); - dc.SetBkMode(lpTBCustomDraw->nStringBkMode); - HFONT hFont = GetFont(); - HFONT hFontOld = NULL; - if(hFont != NULL) - hFontOld = dc.SelectFont(hFont); - const int cchText = 200; - TCHAR szText[cchText] = { 0 }; - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = TBIF_TEXT; - tbbi.pszText = szText; - tbbi.cchText = cchText; - GetButtonInfo((int)lpTBCustomDraw->nmcd.dwItemSpec, &tbbi); - dc.DrawText(szText, -1, &lpTBCustomDraw->nmcd.rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - if(hFont != NULL) - dc.SelectFont(hFontOld); - lRet = CDRF_SKIPDEFAULT; - bHandled = TRUE; - } - else if(!m_bParentActive) - { - lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); - bHandled = TRUE; - } - } - } - return lRet; - } - -// Message hook handlers - LRESULT OnHookMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - static POINT s_point = { -1, -1 }; - DWORD dwPoint = ::GetMessagePos(); - POINT point = { GET_X_LPARAM(dwPoint), GET_Y_LPARAM(dwPoint) }; - - bHandled = FALSE; - if(m_bMenuActive) - { - if(::WindowFromPoint(point) == m_hWnd) - { - ScreenToClient(&point); - int nHit = HitTest(&point); - - if((point.x != s_point.x || point.y != s_point.y) && nHit >= 0 && nHit < ::GetMenuItemCount(m_hMenu) && nHit != m_nPopBtn && m_nPopBtn != -1) - { - TBBUTTON tbb = { 0 }; - GetButton(nHit, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0) - { - m_nNextPopBtn = nHit | 0xFFFF0000; - HWND hWndMenu = m_stackMenuWnd.GetCurrent(); - ATLASSERT(hWndMenu != NULL); - - // this one is needed to close a menu if mouse button was down - ::PostMessage(hWndMenu, WM_LBUTTONUP, 0, MAKELPARAM(point.x, point.y)); - // this one closes a popup menu - ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); - - bHandled = TRUE; - } - } - } - } - else - { - ScreenToClient(&point); - } - - s_point = point; - return 0; - } - - LRESULT OnHookSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYDOWN (0x%2.2X)\n"), wParam); -#endif - - if(wParam == VK_MENU && m_bParentActive && m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) - ShowKeyboardCues(true); - - if(wParam != VK_SPACE && !m_bMenuActive && ::GetFocus() == m_hWnd) - { - m_bAllowKeyboardCues = false; - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - T* pT = static_cast(this); - pT->GiveFocusBack(); - m_bSkipMsg = true; - } - else - { - if(wParam == VK_SPACE && m_bUseKeyboardCues && m_bShowKeyboardCues) - { - m_bAllowKeyboardCues = true; - ShowKeyboardCues(false); - } - m_uSysKey = (UINT)wParam; - } - return 0; - } - - LRESULT OnHookSysKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(!m_bAllowKeyboardCues) - m_bAllowKeyboardCues = true; - bHandled = FALSE; - wParam; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYUP (0x%2.2X)\n"), wParam); -#endif - return 0; - } - - LRESULT OnHookSysChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSCHAR (0x%2.2X)\n"), wParam); -#endif - - if(!m_bMenuActive && m_hWndHook != m_hWnd && wParam != VK_SPACE) - bHandled = TRUE; - return 0; - } - - LRESULT OnHookKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_KEYDOWN (0x%2.2X)\n"), wParam); -#endif - bHandled = FALSE; - T* pT = static_cast(this); - - if(wParam == VK_ESCAPE && m_stackMenuWnd.GetSize() <= 1) - { - if(m_bMenuActive && !m_bContextMenu) - { - int nHot = GetHotItem(); - if(nHot == -1) - nHot = m_nPopBtn; - if(nHot == -1) - nHot = 0; - SetHotItem(nHot); - bHandled = TRUE; - pT->TakeFocus(); - m_bEscapePressed = true; // To keep focus - m_bSkipPostDown = false; - } - else if(::GetFocus() == m_hWnd && m_wndParent.IsWindow()) - { - SetHotItem(-1); - pT->GiveFocusBack(); - bHandled = TRUE; - } - } - else if(wParam == VK_RETURN || wParam == VK_UP || wParam == VK_DOWN) - { - if(!m_bMenuActive && ::GetFocus() == m_hWnd && m_wndParent.IsWindow()) - { - int nHot = GetHotItem(); - if(nHot != -1) - { - if(wParam != VK_RETURN) - { - if(!m_bSkipPostDown) - { -// IE4 only: WM_KEYDOWN doesn't generate TBN_DROPDOWN, we need to simulate a mouse click -#if (_WIN32_IE < 0x0500) - DWORD dwMajor = 0, dwMinor = 0; - ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - if(dwMajor <= 4 || (dwMajor == 5 && dwMinor < 80)) - { - RECT rect; - GetItemRect(nHot, &rect); - PostMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(rect.left, rect.top)); - } -#endif // (_WIN32_IE < 0x0500) - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - m_bSkipPostDown = true; - } - else - { - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - skipping posting another VK_DOWN\n")); - m_bSkipPostDown = false; - } - } - } - else - { - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Can't find hot button\n")); - } - } - if(wParam == VK_RETURN && m_bMenuActive) - { - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - m_nNextPopBtn = -1; - pT->GiveFocusBack(); - } - } - else if(wParam == VK_LEFT || wParam == VK_RIGHT) - { - WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; - WPARAM wpPrev = m_bLayoutRTL ? VK_RIGHT : VK_LEFT; - - if(m_bMenuActive && !m_bContextMenu && !(wParam == wpNext && m_bPopupItem)) - { - bool bAction = false; - if(wParam == wpPrev && s_pCurrentBar->m_stackMenuWnd.GetSize() == 1) - { - m_nNextPopBtn = pT->GetPreviousMenuItem(m_nPopBtn); - if(m_nNextPopBtn != -1) - bAction = true; - } - else if(wParam == wpNext) - { - m_nNextPopBtn = pT->GetNextMenuItem(m_nPopBtn); - if(m_nNextPopBtn != -1) - bAction = true; - } - HWND hWndMenu = m_stackMenuWnd.GetCurrent(); - ATLASSERT(hWndMenu != NULL); - - // Close the popup menu - if(bAction) - { - ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); - if(wParam == wpNext) - { - int cItem = m_stackMenuWnd.GetSize() - 1; - while(cItem >= 0) - { - hWndMenu = m_stackMenuWnd[cItem]; - if(hWndMenu != NULL) - ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); - cItem--; - } - } -#if (_WIN32_IE >= 0x0500) - if(m_nNextPopBtn == -2) - { - m_nNextPopBtn = -1; - pT->DisplayChevronMenu(); - } -#endif // (_WIN32_IE >= 0x0500) - bHandled = TRUE; - } - } - } - return 0; - } - - LRESULT OnHookNextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_NEXTMENU\n")); -#endif - bHandled = FALSE; - return 1; - } - - LRESULT OnHookChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_CHAR (0x%2.2X)\n"), wParam); -#endif - bHandled = (wParam == VK_ESCAPE); - return 0; - } - -// Implementation - ownerdraw overrideables and helpers - void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - T* pT = static_cast(this); - if(m_bFlatMenus) - pT->DrawItemFlat(lpDrawItemStruct); - else - pT->DrawItem3D(lpDrawItemStruct); - - } - - void DrawItem3D(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - CDCHandle dc = lpDrawItemStruct->hDC; - const RECT& rcItem = lpDrawItemStruct->rcItem; - T* pT = static_cast(this); - - if(pmd->fType & MFT_SEPARATOR) - { - // draw separator - RECT rc = rcItem; - rc.top += (rc.bottom - rc.top) / 2; // vertical center - dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line - } - else // not a separator - { - BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; - BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; - BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; - BOOL bHasImage = FALSE; - - if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) - bSelected = FALSE; - RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect - ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically - - int iButton = pmd->iButton; - if(iButton >= 0) - { - bHasImage = TRUE; - - // calc drawing point - SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; - sz.cx /= 2; - sz.cy /= 2; - POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; - - // fill background depending on state - if(!bChecked || (bSelected && !bDisabled)) - { - if(!bDisabled) - dc.FillRect(&rcButn, (bChecked && !bSelected) ? COLOR_3DLIGHT : COLOR_MENU); - else - dc.FillRect(&rcButn, COLOR_MENU); - } - else - { - COLORREF crTxt = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); - COLORREF crBk = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); - CBrush hbr(CDCHandle::GetHalftoneBrush()); - dc.SetBrushOrg(rcButn.left, rcButn.top); - dc.FillRect(&rcButn, hbr); - dc.SetTextColor(crTxt); - dc.SetBkColor(crBk); - } - - // draw disabled or normal - if(!bDisabled) - { - // draw pushed-in or popped-out edge - if(bSelected || bChecked) - { - RECT rc2 = rcButn; - dc.DrawEdge(&rc2, bChecked ? BDR_SUNKENOUTER : BDR_RAISEDINNER, BF_RECT); - } - // draw the image - ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); - } - else - { - HBRUSH hBrushBackground = bChecked ? NULL : ::GetSysColorBrush(COLOR_MENU); - pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground); - } - } - else - { - // no image - look for custom checked/unchecked bitmaps - CMenuItemInfo info; - info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; - ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); - if(bChecked || info.hbmpUnchecked != NULL) - { - BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); - bHasImage = pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); - } - } - - // draw item text - int cxButn = m_szButton.cx; - COLORREF colorBG = ::GetSysColor(bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); - if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) - { - RECT rcBG = rcItem; - if(bHasImage) - rcBG.left += cxButn + s_kcxGap; - dc.FillRect(&rcBG, bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); - } - - // calc text rectangle and colors - RECT rcText = rcItem; - rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; - rcText.right -= cxButn; - dc.SetBkMode(TRANSPARENT); - COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); - - // font already selected by Windows - if(bDisabled && (!bSelected || colorText == colorBG)) - { - // disabled - draw shadow text shifted down and right 1 pixel (unles selected) - RECT rcDisabled = rcText; - ::OffsetRect(&rcDisabled, 1, 1); - pT->DrawMenuText(dc, rcDisabled, pmd->lpstrText, ::GetSysColor(COLOR_3DHILIGHT)); - } - pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! - } - } - - void DrawItemFlat(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - CDCHandle dc = lpDrawItemStruct->hDC; - const RECT& rcItem = lpDrawItemStruct->rcItem; - T* pT = static_cast(this); - -#ifndef COLOR_MENUHILIGHT - const int COLOR_MENUHILIGHT = 29; -#endif // !COLOR_MENUHILIGHT - - BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; - BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; - BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; - - // paint background - if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) - { - if(bSelected) - { - dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENUHILIGHT)); - dc.FrameRect(&rcItem, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - } - else - { - dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENU)); - } - } - - if(pmd->fType & MFT_SEPARATOR) - { - // draw separator - RECT rc = rcItem; - rc.top += (rc.bottom - rc.top) / 2; // vertical center - dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line - } - else // not a separator - { - if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) - bSelected = FALSE; - RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect - ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically - - // draw background and border for checked items - if(bChecked) - { - RECT rcCheck = rcButn; - ::InflateRect(&rcCheck, -1, -1); - if(bSelected) - dc.FillRect(&rcCheck, ::GetSysColorBrush(COLOR_MENU)); - dc.FrameRect(&rcCheck, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - } - - int iButton = pmd->iButton; - if(iButton >= 0) - { - // calc drawing point - SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; - sz.cx /= 2; - sz.cy /= 2; - POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; - - // draw disabled or normal - if(!bDisabled) - { - ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); - } - else - { - HBRUSH hBrushBackground = ::GetSysColorBrush((bSelected && !(bDisabled && bChecked)) ? COLOR_MENUHILIGHT : COLOR_MENU); - HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW); - pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground, hBrushBackground, hBrushDisabledImage); - } - } - else - { - // no image - look for custom checked/unchecked bitmaps - CMenuItemInfo info; - info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; - ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); - if(bChecked || info.hbmpUnchecked != NULL) - { - BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); - pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); - } - } - - // draw item text - int cxButn = m_szButton.cx; - // calc text rectangle and colors - RECT rcText = rcItem; - rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; - rcText.right -= cxButn; - dc.SetBkMode(TRANSPARENT); - COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); - - pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! - } - } - - void DrawMenuText(CDCHandle& dc, RECT& rc, LPCTSTR lpstrText, COLORREF color) - { - int nTab = -1; - for(int i = 0; i < lstrlen(lpstrText); i++) - { - if(lpstrText[i] == _T('\t')) - { - nTab = i; - break; - } - } - dc.SetTextColor(color); - dc.DrawText(lpstrText, nTab, &rc, DT_SINGLELINE | DT_LEFT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - if(nTab != -1) - dc.DrawText(&lpstrText[nTab + 1], -1, &rc, DT_SINGLELINE | DT_RIGHT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - } - - void DrawBitmapDisabled(CDCHandle& dc, int nImage, POINT point, - HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), - HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), - HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) - { -#if (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - if(m_bAlphaImages) - { - IMAGELISTDRAWPARAMS ildp = { 0 }; - ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); - ildp.himl = m_hImageList; - ildp.i = nImage; - ildp.hdcDst = dc; - ildp.x = point.x; - ildp.y = point.y; - ildp.cx = 0; - ildp.cy = 0; - ildp.xBitmap = 0; - ildp.yBitmap = 0; - ildp.fStyle = ILD_TRANSPARENT; - ildp.fState = ILS_SATURATE; - ildp.Frame = 0; - ::ImageList_DrawIndirect(&ildp); - } - else -#endif // (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - { - // create memory DC - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - // create mono or color bitmap - CBitmap bmp; - bmp.CreateCompatibleBitmap(dc, m_szBitmap.cx, m_szBitmap.cy); - ATLASSERT(bmp.m_hBitmap != NULL); - // draw image into memory DC--fill BG white first - HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); - dcMem.PatBlt(0, 0, m_szBitmap.cx, m_szBitmap.cy, WHITENESS); - // If white is the text color, we can't use the normal painting since - // it would blend with the WHITENESS, but the mask is OK - UINT uDrawStyle = (::GetSysColor(COLOR_BTNTEXT) == RGB(255, 255, 255)) ? ILD_MASK : ILD_NORMAL; - ::ImageList_Draw(m_hImageList, nImage, dcMem, 0, 0, uDrawStyle); - dc.DitherBlt(point.x, point.y, m_szBitmap.cx, m_szBitmap.cy, dcMem, NULL, 0, 0, hBrushBackground, hBrush3DEffect, hBrushDisabledImage); - dcMem.SelectBitmap(hBmpOld); // restore - } - } - - // old name - BOOL Draw3DCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) - { - return DrawCheckmark(dc, rc, bSelected, bDisabled, bRadio, hBmpCheck); - } - - BOOL DrawCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) - { - // get checkmark bitmap, if none, use Windows standard - SIZE size = { 0, 0 }; - CBitmapHandle bmp = hBmpCheck; - if(hBmpCheck != NULL) - { - bmp.GetSize(size); - } - else - { - size.cx = ::GetSystemMetrics(SM_CXMENUCHECK); - size.cy = ::GetSystemMetrics(SM_CYMENUCHECK); - bmp.CreateCompatibleBitmap(dc, size.cx, size.cy); - ATLASSERT(bmp.m_hBitmap != NULL); - } - // center bitmap in caller's rectangle - RECT rcDest = rc; - if((rc.right - rc.left) > size.cx) - { - rcDest.left = rc.left + (rc.right - rc.left - size.cx) / 2; - rcDest.right = rcDest.left + size.cx; - } - if((rc.bottom - rc.top) > size.cy) - { - rcDest.top = rc.top + (rc.bottom - rc.top - size.cy) / 2; - rcDest.bottom = rcDest.top + size.cy; - } - // paint background - if(!m_bFlatMenus) - { - if(bSelected && !bDisabled) - { - dc.FillRect(&rcDest, COLOR_MENU); - } - else - { - COLORREF clrTextOld = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); - COLORREF clrBkOld = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); - CBrush hbr(CDCHandle::GetHalftoneBrush()); - dc.SetBrushOrg(rcDest.left, rcDest.top); - dc.FillRect(&rcDest, hbr); - dc.SetTextColor(clrTextOld); - dc.SetBkColor(clrBkOld); - } - } - - // create source image - CDC dcSource; - dcSource.CreateCompatibleDC(dc); - HBITMAP hBmpOld = dcSource.SelectBitmap(bmp); - // set colors - const COLORREF clrBlack = RGB(0, 0, 0); - const COLORREF clrWhite = RGB(255, 255, 255); - COLORREF clrTextOld = dc.SetTextColor(clrBlack); - COLORREF clrBkOld = dc.SetBkColor(clrWhite); - // create mask - CDC dcMask; - dcMask.CreateCompatibleDC(dc); - CBitmap bmpMask; - bmpMask.CreateBitmap(size.cx, size.cy, 1, 1, NULL); - HBITMAP hBmpOld1 = dcMask.SelectBitmap(bmpMask); - - // draw the checkmark transparently - int cx = rcDest.right - rcDest.left; - int cy = rcDest.bottom - rcDest.top; - if(hBmpCheck != NULL) - { - // build mask based on transparent color - dcSource.SetBkColor(m_clrMask); - dcMask.SetBkColor(clrBlack); - dcMask.SetTextColor(clrWhite); - dcMask.BitBlt(0, 0, size.cx, size.cy, dcSource, 0, 0, SRCCOPY); - // draw bitmap using the mask - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, SRCAND); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); - } - else - { - const DWORD ROP_DSno = 0x00BB0226L; - const DWORD ROP_DSa = 0x008800C6L; - const DWORD ROP_DSo = 0x00EE0086L; - const DWORD ROP_DSna = 0x00220326L; - - // draw mask - RECT rcSource = { 0, 0, min(size.cx, rc.right - rc.left), min(size.cy, rc.bottom - rc.top) }; - dcMask.DrawFrameControl(&rcSource, DFC_MENU, bRadio ? DFCS_MENUBULLET : DFCS_MENUCHECK); - - // draw shadow if disabled - if(!m_bFlatMenus && bDisabled) - { - // offset by one pixel - int x = rcDest.left + 1; - int y = rcDest.top + 1; - // paint source bitmap - const int nColor = COLOR_3DHILIGHT; - dcSource.FillRect(&rcSource, nColor); - // draw checkmark - special case black and white colors - COLORREF clrCheck = ::GetSysColor(nColor); - if(clrCheck == clrWhite) - { - dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSno); - dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSa); - } - else - { - if(clrCheck != clrBlack) - { - ATLASSERT(dcSource.GetTextColor() == clrBlack); - ATLASSERT(dcSource.GetBkColor() == clrWhite); - dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); - } - dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSa); - dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSo); - } - } - - // paint source bitmap - const int nColor = bDisabled ? COLOR_BTNSHADOW : COLOR_MENUTEXT; - dcSource.FillRect(&rcSource, nColor); - // draw checkmark - special case black and white colors - COLORREF clrCheck = ::GetSysColor(nColor); - if(clrCheck == clrWhite) - { - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSno); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSa); - } - else - { - if(clrCheck != clrBlack) - { - ATLASSERT(dcSource.GetTextColor() == clrBlack); - ATLASSERT(dcSource.GetBkColor() == clrWhite); - dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); - } - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSa); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSo); - } - } - // restore all - dc.SetTextColor(clrTextOld); - dc.SetBkColor(clrBkOld); - dcSource.SelectBitmap(hBmpOld); - dcMask.SelectBitmap(hBmpOld1); - if(hBmpCheck == NULL) - bmp.DeleteObject(); - // draw pushed-in hilight - if(!m_bFlatMenus && !bDisabled) - { - if(rc.right - rc.left > size.cx) - ::InflateRect(&rcDest, 1,1); // inflate checkmark by one pixel all around - dc.DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT); - } - - return TRUE; - } - - void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) - { - _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; - - if(pmd->fType & MFT_SEPARATOR) // separator - use half system height and zero width - { - lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU) / 2; - lpMeasureItemStruct->itemWidth = 0; - } - else - { - // compute size of text - use DrawText with DT_CALCRECT - CWindowDC dc(NULL); - CFont fontBold; - HFONT hOldFont = NULL; - if(pmd->fState & MFS_DEFAULT) - { - // need bold version of font - LOGFONT lf = { 0 }; - m_fontMenu.GetLogFont(lf); - lf.lfWeight += 200; - fontBold.CreateFontIndirect(&lf); - ATLASSERT(fontBold.m_hFont != NULL); - hOldFont = dc.SelectFont(fontBold); - } - else - { - hOldFont = dc.SelectFont(m_fontMenu); - } - - RECT rcText = { 0, 0, 0, 0 }; - dc.DrawText(pmd->lpstrText, -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); - int cx = rcText.right - rcText.left; - dc.SelectFont(hOldFont); - - LOGFONT lf = { 0 }; - m_fontMenu.GetLogFont(lf); - int cy = lf.lfHeight; - if(cy < 0) - cy = -cy; - const int cyMargin = 8; - cy += cyMargin; - - // height of item is the bigger of these two - lpMeasureItemStruct->itemHeight = max(cy, (int)m_szButton.cy); - - // width is width of text plus a bunch of stuff - cx += 2 * s_kcxTextMargin; // L/R margin for readability - cx += s_kcxGap; // space between button and menu text - cx += 2 * m_szButton.cx; // button width (L=button; R=empty margin) - cx += m_cxExtraSpacing; // extra between item text and accelerator keys - - // Windows adds 1 to returned value - cx -= ::GetSystemMetrics(SM_CXMENUCHECK) - 1; - lpMeasureItemStruct->itemWidth = cx; // done deal - } - } - -// Implementation - Hook procs - static LRESULT CALLBACK CreateHookProc(int nCode, WPARAM wParam, LPARAM lParam) - { - const int cchClassName = 7; - TCHAR szClassName[cchClassName] = { 0 }; - - if(nCode == HCBT_CREATEWND) - { - HWND hWndMenu = (HWND)wParam; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_CREATEWND (HWND = %8.8X)\n"), hWndMenu); -#endif - - ::GetClassName(hWndMenu, szClassName, cchClassName); - if(!lstrcmp(_T("#32768"), szClassName)) - s_pCurrentBar->m_stackMenuWnd.Push(hWndMenu); - } - else if(nCode == HCBT_DESTROYWND) - { - HWND hWndMenu = (HWND)wParam; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_DESTROYWND (HWND = %8.8X)\n"), hWndMenu); -#endif - - ::GetClassName(hWndMenu, szClassName, cchClassName); - if(!lstrcmp(_T("#32768"), szClassName)) - { - ATLASSERT(hWndMenu == s_pCurrentBar->m_stackMenuWnd.GetCurrent()); - s_pCurrentBar->m_stackMenuWnd.Pop(); - } - } - - return ::CallNextHookEx(s_hCreateHook, nCode, wParam, lParam); - } - - static LRESULT CALLBACK MessageHookProc(int nCode, WPARAM wParam, LPARAM lParam) - { - LPMSG pMsg = (LPMSG)lParam; - - if(nCode == HC_ACTION && wParam == PM_REMOVE && pMsg->message != GetGetBarMessage() && pMsg->message != WM_FORWARDMSG) - { - CCommandBarCtrlBase* pCmdBar = NULL; - HWND hWnd = pMsg->hwnd; - DWORD dwPID = 0; - while(pCmdBar == NULL && hWnd != NULL) - { - pCmdBar = (CCommandBarCtrlBase*)::SendMessage(hWnd, GetGetBarMessage(), (WPARAM)&dwPID, 0L); - hWnd = ::GetParent(hWnd); - } - - if(pCmdBar != NULL && dwPID == GetCurrentProcessId()) - { - pCmdBar->m_hWndHook = pMsg->hwnd; - ATLASSERT(pCmdBar->IsCommandBarBase()); - - if(::IsWindow(pCmdBar->m_hWnd)) - pCmdBar->SendMessage(WM_FORWARDMSG, 0, (LPARAM)pMsg); - else - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook skipping message, can't find command bar!\n")); - } - } - - LRESULT lRet = 0; - ATLASSERT(s_pmapMsgHook != NULL); - if(s_pmapMsgHook != NULL) - { - DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); - if(pData != NULL) - { - lRet = ::CallNextHookEx(pData->hMsgHook, nCode, wParam, lParam); - } - } - return lRet; - } - -// Implementation - void DoPopupMenu(int nIndex, bool bAnimate) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - DoPopupMenu, bAnimate = %s\n"), bAnimate ? "true" : "false"); -#endif - - // Menu animation flags -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; -#endif -#ifndef TPM_NOANIMATION - const UINT TPM_NOANIMATION = 0x4000L; -#endif - T* pT = static_cast(this); - - // get popup menu and it's position - RECT rect = { 0 }; - GetItemRect(nIndex, &rect); - POINT pt = { rect.left, rect.bottom }; - MapWindowPoints(NULL, &pt, 1); - MapWindowPoints(NULL, &rect); - TPMPARAMS TPMParams = { 0 }; - TPMParams.cbSize = sizeof(TPMPARAMS); - TPMParams.rcExclude = rect; - HMENU hMenuPopup = ::GetSubMenu(m_hMenu, nIndex); - ATLASSERT(hMenuPopup != NULL); - - // get button ID - TBBUTTON tbb = { 0 }; - GetButton(nIndex, &tbb); - int nCmdID = tbb.idCommand; - - m_nPopBtn = nIndex; // remember current button's index - - // press button and display popup menu - PressButton(nCmdID, TRUE); - SetHotItem(nCmdID); - pT->DoTrackPopupMenu(hMenuPopup, TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | - (s_bW2K ? (bAnimate ? TPM_VERPOSANIMATION : TPM_NOANIMATION) : 0), pt.x, pt.y, &TPMParams); - PressButton(nCmdID, FALSE); - if(::GetFocus() != m_hWnd) - SetHotItem(-1); - - m_nPopBtn = -1; // restore - - // eat next message if click is on the same button - MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rect, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); - - // check if another popup menu should be displayed - if(m_nNextPopBtn != -1) - { - PostMessage(GetAutoPopupMessage(), m_nNextPopBtn & 0xFFFF); - if(!(m_nNextPopBtn & 0xFFFF0000) && !m_bPopupItem) - PostMessage(WM_KEYDOWN, VK_DOWN, 0); - m_nNextPopBtn = -1; - } - else - { - m_bContextMenu = false; - // If user didn't hit escape, give focus back - if(!m_bEscapePressed) - { - if(m_bUseKeyboardCues && m_bShowKeyboardCues) - m_bAllowKeyboardCues = false; - pT->GiveFocusBack(); - } - else - { - SetHotItem(nCmdID); - SetAnchorHighlight(TRUE); - } - } - } - - BOOL DoTrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) - { - CMenuHandle menuPopup = hMenu; - - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::DoTrackPopupMenu.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - ATLASSERT(s_hCreateHook == NULL); - - s_pCurrentBar = static_cast(this); - - s_hCreateHook = ::SetWindowsHookEx(WH_CBT, CreateHookProc, ModuleHelper::GetModuleInstance(), GetCurrentThreadId()); - ATLASSERT(s_hCreateHook != NULL); - - m_bPopupItem = false; - m_bMenuActive = true; - - BOOL bTrackRet = menuPopup.TrackPopupMenuEx(uFlags, x, y, m_hWnd, lpParams); - m_bMenuActive = false; - - ::UnhookWindowsHookEx(s_hCreateHook); - - s_hCreateHook = NULL; - s_pCurrentBar = NULL; - - lock.Unlock(); - - // cleanup - convert menus back to original state -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - TrackPopupMenu - cleanup\n")); -#endif - - ATLASSERT(m_stackMenuWnd.GetSize() == 0); - - UpdateWindow(); - ATL::CWindow wndTL = GetTopLevelParent(); - wndTL.UpdateWindow(); - - // restore the menu items to the previous state for all menus that were converted - if(m_bImagesVisible) - { - HMENU hMenuSav = NULL; - while((hMenuSav = m_stackMenuHandle.Pop()) != NULL) - { - menuPopup = hMenuSav; - BOOL bRet = FALSE; - // restore state and delete menu item data - for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID; - bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; - if(pMI != NULL && pMI->IsCmdBarMenuItem()) - { - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - mii.fType = pMI->fType; - mii.fState = pMI->fState; - mii.dwTypeData = pMI->lpstrText; - mii.cch = lstrlen(pMI->lpstrText); - mii.dwItemData = NULL; - - bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); - // this one triggers WM_MEASUREITEM - menuPopup.ModifyMenu(i, MF_BYPOSITION | mii.fType | mii.fState, mii.wID, pMI->lpstrText); - ATLASSERT(bRet); - - delete [] pMI->lpstrText; - delete pMI; - } - } - } - } - return bTrackRet; - } - - int GetPreviousMenuItem(int nBtn) const - { - if(nBtn == -1) - return -1; -#if (_WIN32_IE >= 0x0500) - RECT rcClient; - GetClientRect(&rcClient); -#endif // (_WIN32_IE >= 0x0500) - int nNextBtn; - for(nNextBtn = nBtn - 1; nNextBtn != nBtn; nNextBtn--) - { - if(nNextBtn < 0) - nNextBtn = ::GetMenuItemCount(m_hMenu) - 1; - TBBUTTON tbb = { 0 }; - GetButton(nNextBtn, &tbb); -#if (_WIN32_IE >= 0x0500) - RECT rcBtn; - GetItemRect(nNextBtn, &rcBtn); - if(rcBtn.right > rcClient.right) - { - nNextBtn = -2; // chevron - break; - } -#endif // (_WIN32_IE >= 0x0500) - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) - break; - } - return (nNextBtn != nBtn) ? nNextBtn : -1; - } - - int GetNextMenuItem(int nBtn) const - { - if(nBtn == -1) - return -1; -#if (_WIN32_IE >= 0x0500) - RECT rcClient = { 0 }; - GetClientRect(&rcClient); -#endif // (_WIN32_IE >= 0x0500) - int nNextBtn = 0; - int nCount = ::GetMenuItemCount(m_hMenu); - for(nNextBtn = nBtn + 1; nNextBtn != nBtn; nNextBtn++) - { - if(nNextBtn >= nCount) - nNextBtn = 0; - TBBUTTON tbb = { 0 }; - GetButton(nNextBtn, &tbb); -#if (_WIN32_IE >= 0x0500) - RECT rcBtn = { 0 }; - GetItemRect(nNextBtn, &rcBtn); - if(rcBtn.right > rcClient.right) - { - nNextBtn = -2; // chevron - break; - } -#endif // (_WIN32_IE >= 0x0500) - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) - break; - } - return (nNextBtn != nBtn) ? nNextBtn : -1; - } - -#if (_WIN32_IE >= 0x0500) - bool DisplayChevronMenu() - { - // assume we are in a rebar - HWND hWndReBar = GetParent(); - int nCount = (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); - bool bRet = false; - for(int i = 0; i < nCount; i++) - { - REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_STYLE }; - BOOL bRetBandInfo = (BOOL)::SendMessage(hWndReBar, RB_GETBANDINFO, i, (LPARAM)&rbbi); - if(bRetBandInfo && rbbi.hwndChild == m_hWnd) - { - if((rbbi.fStyle & RBBS_USECHEVRON) != 0) - { - ::PostMessage(hWndReBar, RB_PUSHCHEVRON, i, 0L); - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - bRet = true; - } - break; - } - } - return bRet; - } -#endif // (_WIN32_IE >= 0x0500) - - void GetSystemSettings() - { - // refresh our font - NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); - ATLASSERT(bRet); - if(bRet) - { - LOGFONT logfont = { 0 }; - if(m_fontMenu.m_hFont != NULL) - m_fontMenu.GetLogFont(logfont); - if(logfont.lfHeight != info.lfMenuFont.lfHeight || - logfont.lfWidth != info.lfMenuFont.lfWidth || - logfont.lfEscapement != info.lfMenuFont.lfEscapement || - logfont.lfOrientation != info.lfMenuFont.lfOrientation || - logfont.lfWeight != info.lfMenuFont.lfWeight || - logfont.lfItalic != info.lfMenuFont.lfItalic || - logfont.lfUnderline != info.lfMenuFont.lfUnderline || - logfont.lfStrikeOut != info.lfMenuFont.lfStrikeOut || - logfont.lfCharSet != info.lfMenuFont.lfCharSet || - logfont.lfOutPrecision != info.lfMenuFont.lfOutPrecision || - logfont.lfClipPrecision != info.lfMenuFont.lfClipPrecision || - logfont.lfQuality != info.lfMenuFont.lfQuality || - logfont.lfPitchAndFamily != info.lfMenuFont.lfPitchAndFamily || - lstrcmp(logfont.lfFaceName, info.lfMenuFont.lfFaceName) != 0) - { - HFONT hFontMenu = ::CreateFontIndirect(&info.lfMenuFont); - ATLASSERT(hFontMenu != NULL); - if(hFontMenu != NULL) - { - if(m_fontMenu.m_hFont != NULL) - m_fontMenu.DeleteObject(); - m_fontMenu.Attach(hFontMenu); - SetFont(m_fontMenu); - AddStrings(_T("NS\0")); // for proper item height - AutoSize(); - } - } - } - - // check if we need extra spacing for menu item text - CWindowDC dc(m_hWnd); - HFONT hFontOld = dc.SelectFont(m_fontMenu); - RECT rcText = { 0, 0, 0, 0 }; - dc.DrawText(_T("\t"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); - if((rcText.right - rcText.left) < 4) - { - ::SetRectEmpty(&rcText); - dc.DrawText(_T("x"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); - m_cxExtraSpacing = rcText.right - rcText.left; - } - else - { - m_cxExtraSpacing = 0; - } - dc.SelectFont(hFontOld); - - // get Windows version - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - ::GetVersionEx(&ovi); - - // query keyboard cues mode (Windows 2000 or later) - if(ovi.dwMajorVersion >= 5) - { -#ifndef SPI_GETKEYBOARDCUES - const UINT SPI_GETKEYBOARDCUES = 0x100A; -#endif // !SPI_GETKEYBOARDCUES - BOOL bRetVal = TRUE; - bRet = ::SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &bRetVal, 0); - m_bUseKeyboardCues = (bRet && !bRetVal); - m_bAllowKeyboardCues = true; - ShowKeyboardCues(!m_bUseKeyboardCues); - } - - // query flat menu mode (Windows XP or later) - if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) - { -#ifndef SPI_GETFLATMENU - const UINT SPI_GETFLATMENU = 0x1022; -#endif // !SPI_GETFLATMENU - BOOL bRetVal = FALSE; - bRet = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &bRetVal, 0); - m_bFlatMenus = (bRet && bRetVal); - } - -#if _WTL_CMDBAR_VISTA_MENUS - // check if we should use Vista menus - bool bVistaMenus = (RunTimeHelper::IsVista() && RunTimeHelper::IsCommCtrl6() && ((m_dwExtendedStyle & CBR_EX_NOVISTAMENUS) == 0)); - - if(bVistaMenus) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(hThemeDLL != NULL) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsThemeActive)(); - PFN_IsThemeActive pfnIsThemeActive = (PFN_IsThemeActive)::GetProcAddress(hThemeDLL, "IsThemeActive"); - ATLASSERT(pfnIsThemeActive != NULL); - bVistaMenus = bVistaMenus && (pfnIsThemeActive != NULL) && (pfnIsThemeActive() != FALSE); - - typedef BOOL (STDAPICALLTYPE *PFN_IsAppThemed)(); - PFN_IsAppThemed pfnIsAppThemed = (PFN_IsAppThemed)::GetProcAddress(hThemeDLL, "IsAppThemed"); - ATLASSERT(pfnIsAppThemed != NULL); - bVistaMenus = bVistaMenus && (pfnIsAppThemed != NULL) && (pfnIsAppThemed() != FALSE); - - ::FreeLibrary(hThemeDLL); - } - } - - if(!bVistaMenus && m_bVistaMenus && (m_hMenu != NULL) && (m_arrCommand.GetSize() > 0)) - { - T* pT = static_cast(this); - pT->_RemoveVistaBitmapsFromMenu(); - } - - m_bVistaMenus = bVistaMenus; -#endif // _WTL_CMDBAR_VISTA_MENUS - -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - GetSystemSettings:\n m_bFlatMenus = %s\n m_bUseKeyboardCues = %s m_bVistaMenus = %s\n"), - m_bFlatMenus ? "true" : "false", m_bUseKeyboardCues ? "true" : "false", m_bVistaMenus ? "true" : "false"); -#endif - } - -// Implementation - alternate focus mode support - void TakeFocus() - { - if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_hWndFocus == NULL) - m_hWndFocus = ::GetFocus(); - SetFocus(); - } - - void GiveFocusBack() - { - if(m_bParentActive) - { - if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && ::IsWindow(m_hWndFocus)) - ::SetFocus(m_hWndFocus); - else if(!(m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_wndParent.IsWindow()) - m_wndParent.SetFocus(); - } - m_hWndFocus = NULL; - SetAnchorHighlight(FALSE); - if(m_bUseKeyboardCues && m_bShowKeyboardCues) - ShowKeyboardCues(false); - m_bSkipPostDown = false; - } - - void ShowKeyboardCues(bool bShow) - { - m_bShowKeyboardCues = bShow; - SetDrawTextFlags(DT_HIDEPREFIX, m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX); - Invalidate(); - UpdateWindow(); - } - -// Implementation - internal message helpers - static UINT GetAutoPopupMessage() - { - static UINT uAutoPopupMessage = 0; - if(uAutoPopupMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetAutoPopupMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uAutoPopupMessage == 0) - uAutoPopupMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalAutoPopupMsg")); - - lock.Unlock(); - } - ATLASSERT(uAutoPopupMessage != 0); - return uAutoPopupMessage; - } - - static UINT GetGetBarMessage() - { - static UINT uGetBarMessage = 0; - if(uGetBarMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetGetBarMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uGetBarMessage == 0) - uGetBarMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalGetBarMsg")); - - lock.Unlock(); - } - ATLASSERT(uGetBarMessage != 0); - return uGetBarMessage; - } - -// Implementation - bool CreateInternalImageList(int cImages) - { - UINT uFlags = (m_bAlphaImages ? ILC_COLOR32 : ILC_COLOR24) | ILC_MASK; - m_hImageList = ::ImageList_Create(m_szBitmap.cx, m_szBitmap.cy, uFlags, cImages, 1); - ATLASSERT(m_hImageList != NULL); - return (m_hImageList != NULL); - } - -// Implementation - support for Vista menus -#if _WTL_CMDBAR_VISTA_MENUS - void _AddVistaBitmapsFromImageList(int nStartIndex, int nCount) - { - // Create display compatible memory DC - CClientDC dc(NULL); - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); - - T* pT = static_cast(this); - // Create bitmaps for all menu items - for(int i = 0; i < nCount; i++) - { - HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nStartIndex + i, dc, dcMem); - dcMem.SelectBitmap(hBitmapSave); - m_arrVistaBitmap.Add(hBitmap); - } - } - - void _AddVistaBitmapFromImageList(int nIndex) - { - // Create display compatible memory DC - CClientDC dc(NULL); - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); - - // Create bitmap for menu item - T* pT = static_cast(this); - HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, dc, dcMem); - - // Select saved bitmap back and add bitmap to the array - dcMem.SelectBitmap(hBitmapSave); - m_arrVistaBitmap.Add(hBitmap); - } - - void _ReplaceVistaBitmapFromImageList(int nIndex) - { - // Delete existing bitmap - if(m_arrVistaBitmap[nIndex] != NULL) - ::DeleteObject(m_arrVistaBitmap[nIndex]); - - // Create display compatible memory DC - CClientDC dc(NULL); - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); - - // Create bitmap for menu item - T* pT = static_cast(this); - HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, dc, dcMem); - - // Select saved bitmap back and replace bitmap in the array - dcMem.SelectBitmap(hBitmapSave); - m_arrVistaBitmap.SetAtIndex(nIndex, hBitmap); - } - - HBITMAP _CreateVistaBitmapHelper(int nIndex, HDC hDCSource, HDC hDCTarget) - { - // Create 32-bit bitmap - BITMAPINFO bi = { 0 }; - bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bi.bmiHeader.biWidth = m_szBitmap.cx; - bi.bmiHeader.biHeight = m_szBitmap.cy; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 32; - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biSizeImage = 0; - bi.bmiHeader.biXPelsPerMeter = 0; - bi.bmiHeader.biYPelsPerMeter = 0; - bi.bmiHeader.biClrUsed = 0; - bi.bmiHeader.biClrImportant = 0; - HBITMAP hBitmap = ::CreateDIBSection(hDCSource, &bi, DIB_RGB_COLORS, NULL, NULL, 0); - ATLASSERT(hBitmap != NULL); - - // Select bitmap into target DC and draw from image list to it - if(hBitmap != NULL) - { - ::SelectObject(hDCTarget, hBitmap); - - IMAGELISTDRAWPARAMS ildp = { 0 }; - ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); - ildp.himl = m_hImageList; - ildp.i = nIndex; - ildp.hdcDst = hDCTarget; - ildp.x = 0; - ildp.y = 0; - ildp.cx = 0; - ildp.cy = 0; - ildp.xBitmap = 0; - ildp.yBitmap = 0; - ildp.fStyle = ILD_TRANSPARENT; - ildp.fState = ILS_ALPHA; - ildp.Frame = 255; - ::ImageList_DrawIndirect(&ildp); - } - - return hBitmap; - } - - void _RemoveVistaBitmapsFromMenu() - { - CMenuHandle menu = m_hMenu; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_BITMAP; - mii.hbmpItem = NULL; - menu.SetMenuItemInfo(m_arrCommand[i], FALSE, &mii); - } - } -#endif // _WTL_CMDBAR_VISTA_MENUS -}; - - -class CCommandBarCtrl : public CCommandBarCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_CommandBar"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMDICommandBarCtrl - ATL implementation of Command Bars for MDI apps - -template -class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBase, TWinTraits> -{ -public: -// Data members - ATL::CContainedWindow m_wndMDIClient; - bool m_bChildMaximized; - HWND m_hWndChildMaximized; - HICON m_hIconChildMaximized; - int m_nBtnPressed; - int m_nBtnWasPressed; - - int m_cxyOffset; // offset between nonclient elements - int m_cxIconWidth; // small icon width - int m_cyIconHeight; // small icon height - int m_cxBtnWidth; // nonclient button width - int m_cyBtnHeight; // nonclient button height - int m_cxLeft; // left nonclient area width - int m_cxRight; // right nonclient area width - -// Theme declarations and data members -#ifndef _WTL_NO_AUTO_THEME -#ifndef _UXTHEME_H_ - typedef HANDLE HTHEME; -#endif // !_UXTHEME_H_ - typedef HTHEME (STDAPICALLTYPE *PFN_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList); - typedef HRESULT (STDAPICALLTYPE *PFN_CloseThemeData)(HTHEME hTheme); - typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); - typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeParentBackground)(HWND hwnd, HDC hdc, OPTIONAL RECT* prc); - - HMODULE m_hThemeDLL; - HTHEME m_hTheme; - PFN_DrawThemeBackground m_pfnDrawThemeBackground; - PFN_DrawThemeParentBackground m_pfnDrawThemeParentBackground; -#endif // !_WTL_NO_AUTO_THEME - -// Constructor/destructor - CMDICommandBarCtrlImpl() : - m_wndMDIClient(this, 2), m_bChildMaximized(false), - m_hWndChildMaximized(NULL), m_hIconChildMaximized(NULL), - m_nBtnPressed(-1), m_nBtnWasPressed(-1), -#ifndef _WTL_NO_AUTO_THEME - m_hThemeDLL(NULL), m_hTheme(NULL), m_pfnDrawThemeBackground(NULL), m_pfnDrawThemeParentBackground(NULL), -#endif // !_WTL_NO_AUTO_THEME - m_cxyOffset(2), - m_cxIconWidth(16), m_cyIconHeight(16), - m_cxBtnWidth(16), m_cyBtnHeight(14), - m_cxLeft(20), m_cxRight(55) - { } - - ~CMDICommandBarCtrlImpl() - { - if(m_wndMDIClient.IsWindow()) -/*scary!*/ m_wndMDIClient.UnsubclassWindow(); - } - -// Operations - BOOL SetMDIClient(HWND hWndMDIClient) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(hWndMDIClient)); - if(!::IsWindow(hWndMDIClient)) - return FALSE; - -#ifdef _DEBUG - // BLOCK: Test if the passed window is MDICLIENT - { - LPCTSTR lpszMDIClientClass = _T("MDICLIENT"); - const int nNameLen = 9 + 1; // "MDICLIENT" + NULL - TCHAR szClassName[nNameLen] = { 0 }; - ::GetClassName(hWndMDIClient, szClassName, nNameLen); - ATLASSERT(lstrcmpi(szClassName, lpszMDIClientClass) == 0); - } -#endif // _DEBUG - - if(m_wndMDIClient.IsWindow()) -/*scary!*/ m_wndMDIClient.UnsubclassWindow(); - - return m_wndMDIClient.SubclassWindow(hWndMDIClient); - } - -// Message maps - typedef CCommandBarCtrlImpl< T, TBase, TWinTraits > _baseClass; - BEGIN_MSG_MAP(CMDICommandBarCtrlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _WTL_NO_AUTO_THEME - MESSAGE_HANDLER(_GetThemeChangedMsg(), OnThemeChanged) -#endif // !_WTL_NO_AUTO_THEME - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_NCCALCSIZE, OnNcCalcSize) - MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) - MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) - MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - CHAIN_MSG_MAP(_baseClass) - ALT_MSG_MAP(1) // Parent window messages - MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) - CHAIN_MSG_MAP_ALT(_baseClass, 1) - ALT_MSG_MAP(2) // MDI client window messages - MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) - // no chaining needed since this was moved from the base class here - ALT_MSG_MAP(3) // Message hook messages - MESSAGE_RANGE_HANDLER(0, 0xFFFF, OnAllHookMessages) - CHAIN_MSG_MAP_ALT(_baseClass, 3) - END_MSG_MAP() - -// Additional MDI message handlers - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - LRESULT lRet = _baseClass::OnCreate(uMsg, wParam, lParam, bHandled); - if(lRet == (LRESULT)-1) - return lRet; - -#ifndef _WTL_NO_AUTO_THEME - // this will fail if theming is not supported - m_hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(m_hThemeDLL != NULL) - { - m_pfnDrawThemeBackground = (PFN_DrawThemeBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeBackground"); - ATLASSERT(m_pfnDrawThemeBackground != NULL); - if(m_pfnDrawThemeBackground != NULL) - { - T* pT = static_cast(this); - pT->_OpenThemeData(); - } - else - { - ::FreeLibrary(m_hThemeDLL); - m_hThemeDLL = NULL; - } - m_pfnDrawThemeParentBackground = (PFN_DrawThemeParentBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeParentBackground"); - ATLASSERT(m_pfnDrawThemeParentBackground != NULL); - } -#endif // !_WTL_NO_AUTO_THEME - - return lRet; - } - - LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - LRESULT lRet = _baseClass::OnDestroy(uMsg, wParam, lParam, bHandled); - -#ifndef _WTL_NO_AUTO_THEME - if(m_hThemeDLL != NULL) - { - T* pT = static_cast(this); - pT->_CloseThemeData(); - ::FreeLibrary(m_hThemeDLL); - m_hThemeDLL = NULL; - } -#endif // !_WTL_NO_AUTO_THEME - - return lRet; - } - -#ifndef _WTL_NO_AUTO_THEME - LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_hThemeDLL != NULL) - { - T* pT = static_cast(this); - pT->_CloseThemeData(); - pT->_OpenThemeData(); - } - return 0; - } -#endif // !_WTL_NO_AUTO_THEME - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - T* pT = static_cast(this); - pT->_AdjustBtnSize(GET_Y_LPARAM(lParam)); - return lRet; - } - - LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - - if(m_bChildMaximized && (BOOL)wParam) - { - LPNCCALCSIZE_PARAMS lpParams = (LPNCCALCSIZE_PARAMS)lParam; - if(m_bLayoutRTL) - { - lpParams->rgrc[0].left += m_cxRight; - lpParams->rgrc[0].right -= m_cxLeft; - } - else - { - lpParams->rgrc[0].left += m_cxLeft; - lpParams->rgrc[0].right -= m_cxRight; - } - } - - return lRet; - } - - LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - - if(!m_bChildMaximized) - return lRet; - - ATLASSERT(m_hWndChildMaximized != NULL && m_hIconChildMaximized != NULL); - - // get DC and window rectangle - CWindowDC dc(m_hWnd); - RECT rect; - GetWindowRect(&rect); - int cxWidth = rect.right - rect.left; - int cyHeight = rect.bottom - rect.top; - - // paint left side nonclient background and draw icon - ::SetRect(&rect, 0, 0, m_cxLeft, cyHeight); -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - if(m_pfnDrawThemeParentBackground != NULL) - m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); - else - dc.FillRect(&rect, COLOR_WINDOW); - } - else -#endif // !_WTL_NO_AUTO_THEME - { - if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) - dc.FillRect(&rect, COLOR_3DFACE); - else - dc.FillRect(&rect, COLOR_MENU); - } - - RECT rcIcon = { 0 }; - T* pT = static_cast(this); - pT->_CalcIconRect(cxWidth, cyHeight, rcIcon); - dc.DrawIconEx(rcIcon.left, rcIcon.top, m_hIconChildMaximized, m_cxIconWidth, m_cyIconHeight); - - // paint right side nonclient background - ::SetRect(&rect, cxWidth - m_cxRight, 0, cxWidth, cyHeight); -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - if(m_pfnDrawThemeParentBackground != NULL) - { - // this is to account for the left non-client area - POINT ptOrg = { 0, 0 }; - dc.GetViewportOrg(&ptOrg); - dc.SetViewportOrg(ptOrg.x + m_cxLeft, ptOrg.y); - ::OffsetRect(&rect, -m_cxLeft, 0); - - m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); - - // restore - dc.SetViewportOrg(ptOrg); - ::OffsetRect(&rect, m_cxLeft, 0); - } - else - { - dc.FillRect(&rect, COLOR_3DFACE); - } - } - else -#endif // !_WTL_NO_AUTO_THEME - { - if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) - dc.FillRect(&rect, COLOR_3DFACE); - else - dc.FillRect(&rect, COLOR_MENU); - } - - // draw buttons - RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(cxWidth, cyHeight, arrRect); - pT->_DrawMDIButton(dc, arrRect, -1); // draw all buttons - - return lRet; - } - - LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(m_bChildMaximized) - { - RECT rect = { 0 }; - GetWindowRect(&rect); - POINT pt = { GET_X_LPARAM(lParam) - rect.left, GET_Y_LPARAM(lParam) - rect.top }; - if(m_bLayoutRTL) - { - if((pt.x < m_cxRight) || (pt.x > ((rect.right - rect.left) - m_cxLeft))) - lRet = HTBORDER; - } - else - { - if((pt.x < m_cxLeft) || (pt.x > ((rect.right - rect.left) - m_cxRight))) - lRet = HTBORDER; - } - } - return lRet; - } - - LRESULT OnNcLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized) - { - bHandled = FALSE; - return 1; - } - - ATLASSERT(_DebugCheckChild()); - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - RECT rcIcon = { 0 }; - T* pT = static_cast(this); - pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); - RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - - if(::PtInRect(&rcIcon, pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: icon\n")); -#endif -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag -#endif - CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); - UINT uRet = (UINT)menu.TrackPopupMenu(TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | - (s_bW2K ? TPM_VERPOSANIMATION : 0), m_bLayoutRTL ? rect.right : rect.left, rect.bottom, m_hWndChildMaximized); - - // eat next message if click is on the same button - ::OffsetRect(&rcIcon, rect.left, rect.top); - MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rcIcon, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_REMOVE); - - if(uRet != 0) - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uRet, 0L); - } - else if(::PtInRect(&arrRect[0], pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: close button\n")); -#endif - m_nBtnWasPressed = m_nBtnPressed = 0; - } - else if(::PtInRect(&arrRect[1], pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: restore button\n")); -#endif - m_nBtnWasPressed = m_nBtnPressed = 1; - } - else if(::PtInRect(&arrRect[2], pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: minimize button\n")); -#endif - m_nBtnWasPressed = m_nBtnPressed = 2; - } - else - { - bHandled = FALSE; - } - - // draw the button state if it was pressed - if(m_nBtnPressed != -1) - { - SetCapture(); - CWindowDC dc(m_hWnd); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - pT->_DrawMDIButton(dc, arrRect, m_nBtnPressed); - } - - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) - { - bHandled = FALSE; - return 1; - } - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&pt); - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - RECT arrRect[3] = { 0 }; - T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - int nOldBtnPressed = m_nBtnPressed; - m_nBtnPressed = ::PtInRect(&arrRect[m_nBtnWasPressed], pt) ? m_nBtnWasPressed : -1; - if(nOldBtnPressed != m_nBtnPressed) - { - CWindowDC dc(m_hWnd); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - pT->_DrawMDIButton(dc, arrRect, (m_nBtnPressed != -1) ? m_nBtnPressed : nOldBtnPressed); - } - - return 0; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) - { - bHandled = FALSE; - return 1; - } - - ATLASSERT(_DebugCheckChild()); - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&pt); - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - int nBtn = m_nBtnWasPressed; - ReleaseCapture(); - - RECT arrRect[3] = { 0 }; - T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - if(::PtInRect(&arrRect[nBtn], pt)) - { - switch(nBtn) - { - case 0: // close -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: close button\n")); -#endif - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_CLOSE, 0L); - break; - case 1: // restore -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: restore button\n")); -#endif - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_RESTORE, 0L); - break; - case 2: // minimize -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: minimize button\n")); -#endif - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_MINIMIZE, 0L); - break; - default: - break; - } - } - - return 0; - } - - LRESULT OnNcLButtonDblClk(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized || m_nBtnWasPressed != -1) - { - bHandled = FALSE; - return 1; - } - - ATLASSERT(_DebugCheckChild()); - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - RECT rcIcon = { 0 }; - T* pT = static_cast(this); - pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); - RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - - if(::PtInRect(&rcIcon, pt)) - { - CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); - UINT uDefID = menu.GetMenuDefaultItem(); - if(uDefID == (UINT)-1) - uDefID = SC_CLOSE; - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uDefID, 0L); - } - - return 0; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bChildMaximized) - { - if(m_nBtnPressed != -1) - { - ATLASSERT(m_nBtnPressed == m_nBtnWasPressed); // must be - m_nBtnPressed = -1; - RECT rect = { 0 }; - GetWindowRect(&rect); - RECT arrRect[3] = { 0 }; - T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - CWindowDC dc(m_hWnd); - pT->_DrawMDIButton(dc, arrRect, m_nBtnWasPressed); - } - m_nBtnWasPressed = -1; - } - else - { - bHandled = FALSE; - } - return 0; - } - -// Parent window message handlers - LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); - RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); - bHandled = FALSE; - return 1; - } - -// MDI client window message handlers - LRESULT OnMDISetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - m_wndMDIClient.DefWindowProc(uMsg, NULL, lParam); - HMENU hOldMenu = GetMenu(); - BOOL bRet = AttachMenu((HMENU)wParam); - bRet; // avoid level 4 warning - ATLASSERT(bRet); - -#if (_WIN32_IE >= 0x0400) - T* pT = static_cast(this); - pT->UpdateRebarBandIdealSize(); -#endif // (_WIN32_IE >= 0x0400) - - return (LRESULT)hOldMenu; - } - -// All messages from the message hook - LRESULT OnAllHookMessages(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->_ProcessAllHookMessages(uMsg, wParam, lParam); - - bHandled = FALSE; - return 1; - } - -// Overrideables - // override this to provide different ideal size - void UpdateRebarBandIdealSize() - { - // assuming we are in a rebar, change ideal size to our size - // we hope that if we are not in a rebar, nCount will be 0 - int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); - for(int i = 0; i < nCount; i++) - { - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_IDEALSIZE; - rbi.cxIdeal = m_bChildMaximized ? m_cxLeft + m_cxRight : 0; - int nBtnCount = GetButtonCount(); - if(nBtnCount > 0) - { - RECT rect = { 0 }; - GetItemRect(nBtnCount - 1, &rect); - rbi.cxIdeal += rect.right; - } - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } - } - } - - // all hook messages - check for the maximized MDI child window change - void _ProcessAllHookMessages(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/) - { - if(uMsg == WM_MDIGETACTIVE || uMsg == WM_MDISETMENU) - return; - - BOOL bMaximized = FALSE; - HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - bool bMaxOld = m_bChildMaximized; - m_bChildMaximized = (hWndChild != NULL && bMaximized); - HICON hIconOld = m_hIconChildMaximized; - - if(m_bChildMaximized) - { - if(m_hWndChildMaximized != hWndChild) - { - ATL::CWindow wnd = m_hWndChildMaximized = hWndChild; - m_hIconChildMaximized = wnd.GetIcon(FALSE); - if(m_hIconChildMaximized == NULL) - { - m_hIconChildMaximized = wnd.GetIcon(TRUE); - if(m_hIconChildMaximized == NULL) - { - // no icon set with WM_SETICON, get the class one -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - m_hIconChildMaximized = (HICON)::GetClassLongPtr(wnd, GCLP_HICONSM); -#else - m_hIconChildMaximized = (HICON)LongToHandle(::GetClassLongPtr(wnd, GCLP_HICONSM)); -#endif - } - } - } - } - else - { - m_hWndChildMaximized = NULL; - m_hIconChildMaximized = NULL; - } - - if(bMaxOld != m_bChildMaximized) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - All messages hook change: m_bChildMaximized = %s\n"), m_bChildMaximized ? "true" : "false"); -#endif - // assuming we are in a rebar, change our size to accomodate new state - // we hope that if we are not in a rebar, nCount will be 0 - int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); - int cxDiff = (m_bChildMaximized ? 1 : -1) * (m_cxLeft + m_cxRight); - for(int i = 0; i < nCount; i++) - { -#if (_WIN32_IE >= 0x0500) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_STYLE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - if((rbi.fStyle & RBBS_USECHEVRON) != 0) - { - rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; - rbi.cxMinChild += cxDiff; - rbi.cxIdeal += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - } - break; - } -#elif (_WIN32_IE >= 0x0400) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; - rbi.cxMinChild += cxDiff; - rbi.cxIdeal += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } -#else // (_WIN32_IE < 0x0400) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_CHILDSIZE; - rbi.cxMinChild += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } -#endif // (_WIN32_IE < 0x0400) - } - } - - if(bMaxOld != m_bChildMaximized || hIconOld != m_hIconChildMaximized) - { - // force size change and redraw everything - RECT rect = { 0 }; - GetWindowRect(&rect); - ::MapWindowPoints(NULL, GetParent(), (LPPOINT)&rect, 2); - SetRedraw(FALSE); - SetWindowPos(NULL, 0, 0, 1, 1, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); - } - } - -// Implementation - void GetSystemSettings() - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - GetSystemSettings\n")); -#endif - _baseClass::GetSystemSettings(); - - NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); - ATLASSERT(bRet); - if(bRet) - { - m_cxIconWidth = ::GetSystemMetrics(SM_CXSMICON); - m_cyIconHeight = ::GetSystemMetrics(SM_CYSMICON); - m_cxLeft = m_cxIconWidth; - -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - m_cxBtnWidth = info.iCaptionWidth - 2 * m_cxyOffset; - m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; - m_cxRight = 3 * m_cxBtnWidth; - } - else -#endif // !_WTL_NO_AUTO_THEME - { - m_cxBtnWidth = info.iCaptionWidth - m_cxyOffset; - m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; - m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; - } - } - - RECT rect = { 0 }; - GetClientRect(&rect); - T* pT = static_cast(this); - pT->_AdjustBtnSize(rect.bottom); - } - - void _AdjustBtnSize(int cyHeight) - { - if(cyHeight > 1 && m_cyBtnHeight > cyHeight) - { -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - m_cyBtnHeight = cyHeight; - m_cxBtnWidth = cyHeight; - m_cxRight = 3 * m_cxBtnWidth; - } - else -#endif // !_WTL_NO_AUTO_THEME - { - m_cyBtnHeight = cyHeight; - m_cxBtnWidth = cyHeight + m_cxyOffset; - m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; - } - } - } - - void _CalcIconRect(int cxWidth, int cyHeight, RECT& rect, bool bInvertX = false) const - { - int xStart = (m_cxLeft - m_cxIconWidth) / 2; - if(xStart < 0) - xStart = 0; - int yStart = (cyHeight - m_cyIconHeight) / 2; - if(yStart < 0) - yStart = 0; - - if(bInvertX) - ::SetRect(&rect, cxWidth - (xStart + m_cxBtnWidth), yStart, cxWidth - xStart, yStart + m_cyBtnHeight); - else - ::SetRect(&rect, xStart, yStart, xStart + m_cxBtnWidth, yStart + m_cyBtnHeight); - } - - void _CalcBtnRects(int cxWidth, int cyHeight, RECT arrRect[3], bool bInvertX = false) const - { - int yStart = (cyHeight - m_cyBtnHeight) / 2; - if(yStart < 0) - yStart = 0; - - RECT rcBtn = { cxWidth - m_cxBtnWidth, yStart, cxWidth, yStart + m_cyBtnHeight }; - int nDirection = -1; - if(bInvertX) - { - ::SetRect(&rcBtn, 0, yStart, m_cxBtnWidth, yStart + m_cyBtnHeight); - nDirection = 1; - } - - arrRect[0] = rcBtn; -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); - else -#endif // !_WTL_NO_AUTO_THEME - ::OffsetRect(&rcBtn, nDirection * (m_cxBtnWidth + m_cxyOffset), 0); - arrRect[1] = rcBtn; - ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); - arrRect[2] = rcBtn; - } - - void _DrawMDIButton(CWindowDC& dc, LPRECT pRects, int nBtn) - { -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { -#ifndef TMSCHEMA_H - const int WP_MDICLOSEBUTTON = 20; - const int CBS_NORMAL = 1; - const int CBS_PUSHED = 3; - const int CBS_DISABLED = 4; - const int WP_MDIRESTOREBUTTON = 22; - const int RBS_NORMAL = 1; - const int RBS_PUSHED = 3; - const int RBS_DISABLED = 4; - const int WP_MDIMINBUTTON = 16; - const int MINBS_NORMAL = 1; - const int MINBS_PUSHED = 3; - const int MINBS_DISABLED = 4; -#endif // TMSCHEMA_H - if(nBtn == -1 || nBtn == 0) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDICLOSEBUTTON, m_bParentActive ? ((m_nBtnPressed == 0) ? CBS_PUSHED : CBS_NORMAL) : CBS_DISABLED, &pRects[0], NULL); - if(nBtn == -1 || nBtn == 1) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIRESTOREBUTTON, m_bParentActive ? ((m_nBtnPressed == 1) ? RBS_PUSHED : RBS_NORMAL) : RBS_DISABLED, &pRects[1], NULL); - if(nBtn == -1 || nBtn == 2) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIMINBUTTON, m_bParentActive ? ((m_nBtnPressed == 2) ? MINBS_PUSHED : MINBS_NORMAL) : MINBS_DISABLED, &pRects[2], NULL); - } - else -#endif // !_WTL_NO_AUTO_THEME - { - if(nBtn == -1 || nBtn == 0) - dc.DrawFrameControl(&pRects[0], DFC_CAPTION, DFCS_CAPTIONCLOSE | ((m_nBtnPressed == 0) ? DFCS_PUSHED : 0)); - if(nBtn == -1 || nBtn == 1) - dc.DrawFrameControl(&pRects[1], DFC_CAPTION, DFCS_CAPTIONRESTORE | ((m_nBtnPressed == 1) ? DFCS_PUSHED : 0)); - if(nBtn == -1 || nBtn == 2) - dc.DrawFrameControl(&pRects[2], DFC_CAPTION, DFCS_CAPTIONMIN | ((m_nBtnPressed == 2) ? DFCS_PUSHED : 0)); - } - } - -#ifndef _WTL_NO_AUTO_THEME - static UINT _GetThemeChangedMsg() - { -#ifndef WM_THEMECHANGED - static const UINT WM_THEMECHANGED = 0x031A; -#endif // !WM_THEMECHANGED - return WM_THEMECHANGED; - } - - void _OpenThemeData() - { - ATLASSERT(m_hThemeDLL != NULL); - - PFN_OpenThemeData pfnOpenThemeData = (PFN_OpenThemeData)::GetProcAddress(m_hThemeDLL, "OpenThemeData"); - ATLASSERT(pfnOpenThemeData != NULL); - if(pfnOpenThemeData != NULL) - m_hTheme = pfnOpenThemeData(m_hWnd, L"Window"); - } - - void _CloseThemeData() - { - ATLASSERT(m_hThemeDLL != NULL); - - if(m_hTheme == NULL) - return; // nothing to do - - PFN_CloseThemeData pfnCloseThemeData = (PFN_CloseThemeData)::GetProcAddress(m_hThemeDLL, "CloseThemeData"); - ATLASSERT(pfnCloseThemeData != NULL); - if(pfnCloseThemeData != NULL) - { - pfnCloseThemeData(m_hTheme); - m_hTheme = NULL; - } - } -#endif // !_WTL_NO_AUTO_THEME - - bool _DebugCheckChild() - { -#ifdef _DEBUG - BOOL bMaximized = FALSE; - HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - return (bMaximized && hWndChild == m_hWndChildMaximized); -#else // !_DEBUG - return true; -#endif // !_DEBUG - } -}; - -class CMDICommandBarCtrl : public CMDICommandBarCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_MDICommandBar"), GetWndClassName()) -}; - -}; // namespace WTL - -#endif // __ATLCTRLW_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlctrlx.h b/GLideN64/src/GLideNUI-wtl/WTL/atlctrlx.h deleted file mode 100644 index 2b94be7..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlctrlx.h +++ /dev/null @@ -1,4979 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCTRLX_H__ -#define __ATLCTRLX_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlctrlx.h requires atlapp.h to be included first -#endif - -#ifndef __ATLCTRLS_H__ - #error atlctrlx.h requires atlctrls.h to be included first -#endif - -#ifndef WM_UPDATEUISTATE - #define WM_UPDATEUISTATE 0x0128 -#endif // !WM_UPDATEUISTATE - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CBitmapButtonImpl -// CBitmapButton -// CCheckListViewCtrlImpl -// CCheckListViewCtrl -// CHyperLinkImpl -// CHyperLink -// CWaitCursor -// CCustomWaitCursor -// CMultiPaneStatusBarCtrlImpl -// CMultiPaneStatusBarCtrl -// CPaneContainerImpl -// CPaneContainer -// CSortListViewImpl -// CSortListViewCtrlImpl -// CSortListViewCtrl -// CTabViewImpl -// CTabView - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CBitmapButton - bitmap button implementation - -#ifndef _WIN32_WCE - -// bitmap button extended styles -#define BMPBTN_HOVER 0x00000001 -#define BMPBTN_AUTO3D_SINGLE 0x00000002 -#define BMPBTN_AUTO3D_DOUBLE 0x00000004 -#define BMPBTN_AUTOSIZE 0x00000008 -#define BMPBTN_SHAREIMAGELISTS 0x00000010 -#define BMPBTN_AUTOFIRE 0x00000020 - -template -class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinTraits> -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - - enum - { - _nImageNormal = 0, - _nImagePushed, - _nImageFocusOrHover, - _nImageDisabled, - - _nImageCount = 4, - }; - - enum - { - ID_TIMER_FIRST = 1000, - ID_TIMER_REPEAT = 1001 - }; - - // Bitmap button specific extended styles - DWORD m_dwExtendedStyle; - - CImageList m_ImageList; - int m_nImage[_nImageCount]; - - CToolTipCtrl m_tip; - LPTSTR m_lpstrToolTipText; - - // Internal states - unsigned m_fMouseOver:1; - unsigned m_fFocus:1; - unsigned m_fPressed:1; - - -// Constructor/Destructor - CBitmapButtonImpl(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : - m_ImageList(hImageList), m_dwExtendedStyle(dwExtendedStyle), - m_lpstrToolTipText(NULL), - m_fMouseOver(0), m_fFocus(0), m_fPressed(0) - { - m_nImage[_nImageNormal] = -1; - m_nImage[_nImagePushed] = -1; - m_nImage[_nImageFocusOrHover] = -1; - m_nImage[_nImageDisabled] = -1; - } - - ~CBitmapButtonImpl() - { - if((m_dwExtendedStyle & BMPBTN_SHAREIMAGELISTS) == 0) - m_ImageList.Destroy(); - delete [] m_lpstrToolTipText; - } - - // overridden to provide proper initialization - BOOL SubclassWindow(HWND hWnd) - { -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - Init(); - return bRet; - } - -// Attributes - DWORD GetBitmapButtonExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetBitmapButtonExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - HIMAGELIST GetImageList() const - { - return m_ImageList; - } - - HIMAGELIST SetImageList(HIMAGELIST hImageList) - { - HIMAGELIST hImageListPrev = m_ImageList; - m_ImageList = hImageList; - if((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0 && ::IsWindow(m_hWnd)) - SizeToImage(); - return hImageListPrev; - } - - int GetToolTipTextLength() const - { - return (m_lpstrToolTipText == NULL) ? -1 : lstrlen(m_lpstrToolTipText); - } - - bool GetToolTipText(LPTSTR lpstrText, int nLength) const - { - ATLASSERT(lpstrText != NULL); - if(m_lpstrToolTipText == NULL) - return false; - - errno_t nRet = SecureHelper::strncpy_x(lpstrText, nLength, m_lpstrToolTipText, _TRUNCATE); - - return (nRet == 0 || nRet == STRUNCATE); - } - - bool SetToolTipText(LPCTSTR lpstrText) - { - if(m_lpstrToolTipText != NULL) - { - delete [] m_lpstrToolTipText; - m_lpstrToolTipText = NULL; - } - - if(lpstrText == NULL) - { - if(m_tip.IsWindow()) - m_tip.Activate(FALSE); - return true; - } - - int cchLen = lstrlen(lpstrText) + 1; - ATLTRY(m_lpstrToolTipText = new TCHAR[cchLen]); - if(m_lpstrToolTipText == NULL) - return false; - - SecureHelper::strcpy_x(m_lpstrToolTipText, cchLen, lpstrText); - if(m_tip.IsWindow()) - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrToolTipText); - } - - return true; - } - -// Operations - void SetImages(int nNormal, int nPushed = -1, int nFocusOrHover = -1, int nDisabled = -1) - { - if(nNormal != -1) - m_nImage[_nImageNormal] = nNormal; - if(nPushed != -1) - m_nImage[_nImagePushed] = nPushed; - if(nFocusOrHover != -1) - m_nImage[_nImageFocusOrHover] = nFocusOrHover; - if(nDisabled != -1) - m_nImage[_nImageDisabled] = nDisabled; - } - - BOOL SizeToImage() - { - ATLASSERT(::IsWindow(m_hWnd) && m_ImageList.m_hImageList != NULL); - int cx = 0; - int cy = 0; - if(!m_ImageList.GetIconSize(cx, cy)) - return FALSE; - return ResizeClient(cx, cy); - } - -// Overrideables - void DoPaint(CDCHandle dc) - { - ATLASSERT(m_ImageList.m_hImageList != NULL); // image list must be set - ATLASSERT(m_nImage[0] != -1); // main bitmap must be set - - // set bitmap according to the current button state - int nImage = -1; - bool bHover = IsHoverMode(); - if(!IsWindowEnabled()) - nImage = m_nImage[_nImageDisabled]; - else if(m_fPressed == 1) - nImage = m_nImage[_nImagePushed]; - else if((!bHover && m_fFocus == 1) || (bHover && m_fMouseOver == 1)) - nImage = m_nImage[_nImageFocusOrHover]; - if(nImage == -1) // not there, use default one - nImage = m_nImage[_nImageNormal]; - - // draw the button image - int xyPos = 0; - if((m_fPressed == 1) && ((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) && (m_nImage[_nImagePushed] == -1)) - xyPos = 1; - m_ImageList.Draw(dc, nImage, xyPos, xyPos, ILD_NORMAL); - - // draw 3D border if required - if((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) - { - RECT rect; - GetClientRect(&rect); - - if(m_fPressed == 1) - dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_SUNKENOUTER : EDGE_SUNKEN, BF_RECT); - else if(!bHover || m_fMouseOver == 1) - dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_RAISEDINNER : EDGE_RAISED, BF_RECT); - - if(!bHover && m_fFocus == 1) - { - ::InflateRect(&rect, -2 * ::GetSystemMetrics(SM_CXEDGE), -2 * ::GetSystemMetrics(SM_CYEDGE)); - dc.DrawFocusRect(&rect); - } - } - } - -// Message map and handlers - BEGIN_MSG_MAP(CBitmapButtonImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) - MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - MESSAGE_HANDLER(WM_ENABLE, OnEnable) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) - MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) - MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) - MESSAGE_HANDLER(WM_TIMER, OnTimer) - MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - Init(); - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_tip.IsWindow()) - { - m_tip.DestroyWindow(); - m_tip.m_hWnd = NULL; - } - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - MSG msg = { m_hWnd, uMsg, wParam, lParam }; - if(m_tip.IsWindow()) - m_tip.RelayEvent(&msg); - bHandled = FALSE; - return 1; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - pT->DoPaint((HDC)wParam); - } - else - { - CPaintDC dc(m_hWnd); - pT->DoPaint(dc.m_hDC); - } - return 0; - } - - LRESULT OnFocus(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - m_fFocus = (uMsg == WM_SETFOCUS) ? 1 : 0; - Invalidate(); - UpdateWindow(); - bHandled = FALSE; - return 1; - } - - LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = 0; - if(IsHoverMode()) - SetCapture(); - else - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() == m_hWnd) - { - m_fPressed = 1; - Invalidate(); - UpdateWindow(); - } - if((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) - { - int nElapse = 250; - int nDelay = 0; - if(::SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &nDelay, 0)) - nElapse += nDelay * 250; // all milli-seconds - SetTimer(ID_TIMER_FIRST, nElapse); - } - return lRet; - } - - LRESULT OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = 0; - if(!IsHoverMode()) - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() != m_hWnd) - SetCapture(); - if(m_fPressed == 0) - { - m_fPressed = 1; - Invalidate(); - UpdateWindow(); - } - return lRet; - } - - LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = 0; - bool bHover = IsHoverMode(); - if(!bHover) - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() == m_hWnd) - { - if(bHover && m_fPressed == 1) - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - ::ReleaseCapture(); - } - return lRet; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_fPressed == 1) - { - m_fPressed = 0; - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - Invalidate(); - UpdateWindow(); - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(::GetCapture() == m_hWnd) - { - POINT ptCursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&ptCursor); - RECT rect = { 0 }; - GetWindowRect(&rect); - unsigned int uPressed = ::PtInRect(&rect, ptCursor) ? 1 : 0; - if(m_fPressed != uPressed) - { - m_fPressed = uPressed; - Invalidate(); - UpdateWindow(); - } - } - else if(IsHoverMode() && m_fMouseOver == 0) - { - m_fMouseOver = 1; - Invalidate(); - UpdateWindow(); - StartTrackMouseLeave(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_fMouseOver == 1) - { - m_fMouseOver = 0; - Invalidate(); - UpdateWindow(); - } - return 0; - } - - LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam == VK_SPACE && IsHoverMode()) - return 0; // ignore if in hover mode - if(wParam == VK_SPACE && m_fPressed == 0) - { - m_fPressed = 1; - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam == VK_SPACE && IsHoverMode()) - return 0; // ignore if in hover mode - if(wParam == VK_SPACE && m_fPressed == 1) - { - m_fPressed = 0; - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - ATLASSERT((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0); - switch(wParam) // timer ID - { - case ID_TIMER_FIRST: - KillTimer(ID_TIMER_FIRST); - if(m_fPressed == 1) - { - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - int nElapse = 250; - int nRepeat = 40; - if(::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &nRepeat, 0)) - nElapse = 10000 / (10 * nRepeat + 25); // milli-seconds, approximated - SetTimer(ID_TIMER_REPEAT, nElapse); - } - break; - case ID_TIMER_REPEAT: - if(m_fPressed == 1) - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - else if(::GetCapture() != m_hWnd) - KillTimer(ID_TIMER_REPEAT); - break; - default: // not our timer - break; - } - return 0; - } - - LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // If the control is subclassed or superclassed, this message can cause - // repainting without WM_PAINT. We don't use this state, so just do nothing. - return 0; - } - -// Implementation - void Init() - { - // We need this style to prevent Windows from painting the button - ModifyStyle(0, BS_OWNERDRAW); - - // create a tool tip - m_tip.Create(m_hWnd); - ATLASSERT(m_tip.IsWindow()); - if(m_tip.IsWindow() && m_lpstrToolTipText != NULL) - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrToolTipText); - } - - if(m_ImageList.m_hImageList != NULL && (m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0) - SizeToImage(); - } - - BOOL StartTrackMouseLeave() - { - TRACKMOUSEEVENT tme = { 0 }; - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_LEAVE; - tme.hwndTrack = m_hWnd; - return _TrackMouseEvent(&tme); - } - - bool IsHoverMode() const - { - return ((m_dwExtendedStyle & BMPBTN_HOVER) != 0); - } -}; - -class CBitmapButton : public CBitmapButtonImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName()) - - CBitmapButton(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : - CBitmapButtonImpl(dwExtendedStyle, hImageList) - { } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CCheckListCtrlView - list view control with check boxes - -template -class CCheckListViewCtrlImplTraits -{ -public: - static DWORD GetWndStyle(DWORD dwStyle) - { - return (dwStyle == 0) ? t_dwStyle : dwStyle; - } - - static DWORD GetWndExStyle(DWORD dwExStyle) - { - return (dwExStyle == 0) ? t_dwExStyle : dwExStyle; - } - - static DWORD GetExtendedLVStyle() - { - return t_dwExListViewStyle; - } -}; - -typedef CCheckListViewCtrlImplTraits CCheckListViewCtrlTraits; - -template -class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - -// Attributes - static DWORD GetExtendedLVStyle() - { - return TWinTraits::GetExtendedLVStyle(); - } - -// Operations - BOOL SubclassWindow(HWND hWnd) - { -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImplBaseT< TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImplBaseT< TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - { - T* pT = static_cast(this); - pT; - ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); - SetExtendedListViewStyle(pT->GetExtendedLVStyle()); - } - return bRet; - } - - void CheckSelectedItems(int nCurrItem) - { - // first check if this item is selected - LVITEM lvi = { 0 }; - lvi.iItem = nCurrItem; - lvi.iSubItem = 0; - lvi.mask = LVIF_STATE; - lvi.stateMask = LVIS_SELECTED; - GetItem(&lvi); - // if item is not selected, don't do anything - if(!(lvi.state & LVIS_SELECTED)) - return; - // new check state will be reverse of the current state, - BOOL bCheck = !GetCheckState(nCurrItem); - int nItem = -1; - int nOldItem = -1; - while((nItem = GetNextItem(nOldItem, LVNI_SELECTED)) != -1) - { - if(nItem != nCurrItem) - SetCheckState(nItem, bCheck); - nOldItem = nItem; - } - } - -// Implementation - BEGIN_MSG_MAP(CCheckListViewCtrlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDown) - MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) - END_MSG_MAP() - - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - // first let list view control initialize everything - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - T* pT = static_cast(this); - pT; - ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); - SetExtendedListViewStyle(pT->GetExtendedLVStyle()); - return lRet; - } - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - POINT ptMsg = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - LVHITTESTINFO lvh = { 0 }; - lvh.pt = ptMsg; - if(HitTest(&lvh) != -1 && lvh.flags == LVHT_ONITEMSTATEICON && ::GetKeyState(VK_CONTROL) >= 0) - { - T* pT = static_cast(this); - pT->CheckSelectedItems(lvh.iItem); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam == VK_SPACE) - { - int nCurrItem = GetNextItem(-1, LVNI_FOCUSED); - if(nCurrItem != -1 && ::GetKeyState(VK_CONTROL) >= 0) - { - T* pT = static_cast(this); - pT->CheckSelectedItems(nCurrItem); - } - } - bHandled = FALSE; - return 1; - } -}; - -class CCheckListViewCtrl : public CCheckListViewCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_CheckListView"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CHyperLink - hyper link control implementation - -#if (WINVER < 0x0500) && !defined(_WIN32_WCE) -__declspec(selectany) struct -{ - enum { cxWidth = 32, cyHeight = 32 }; - int xHotSpot; - int yHotSpot; - unsigned char arrANDPlane[cxWidth * cyHeight / 8]; - unsigned char arrXORPlane[cxWidth * cyHeight / 8]; -} _AtlHyperLink_CursorData = -{ - 5, 0, - { - 0xF9, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, - 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0x3F, 0xFF, 0xFF, 0xF0, 0x07, 0xFF, 0xFF, 0xF0, 0x01, 0xFF, 0xFF, - 0xF0, 0x00, 0xFF, 0xFF, 0x10, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, - 0x80, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xE0, 0x00, 0x7F, 0xFF, - 0xE0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, - 0xF8, 0x01, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }, - { - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x06, 0xD8, 0x00, 0x00, - 0x06, 0xDA, 0x00, 0x00, 0x06, 0xDB, 0x00, 0x00, 0x67, 0xFB, 0x00, 0x00, 0x77, 0xFF, 0x00, 0x00, - 0x37, 0xFF, 0x00, 0x00, 0x17, 0xFF, 0x00, 0x00, 0x1F, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, - 0x0F, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, - 0x03, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - } -}; -#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) - -#define HLINK_UNDERLINED 0x00000000 -#define HLINK_NOTUNDERLINED 0x00000001 -#define HLINK_UNDERLINEHOVER 0x00000002 -#define HLINK_COMMANDBUTTON 0x00000004 -#define HLINK_NOTIFYBUTTON 0x0000000C -#define HLINK_USETAGS 0x00000010 -#define HLINK_USETAGSBOLD 0x00000030 -#define HLINK_NOTOOLTIP 0x00000040 -#define HLINK_AUTOCREATELINKFONT 0x00000080 -#define HLINK_SINGLELINE 0x00000100 - -// Notes: -// - HLINK_USETAGS and HLINK_USETAGSBOLD are always left-aligned -// - When HLINK_USETAGSBOLD is used, the underlined styles will be ignored - -template -class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > -{ -public: - LPTSTR m_lpstrLabel; - LPTSTR m_lpstrHyperLink; - - HCURSOR m_hCursor; - HFONT m_hFontLink; - HFONT m_hFontNormal; - - RECT m_rcLink; -#ifndef _WIN32_WCE - CToolTipCtrl m_tip; -#endif // !_WIN32_WCE - - COLORREF m_clrLink; - COLORREF m_clrVisited; - - DWORD m_dwExtendedStyle; // Hyper Link specific extended styles - - bool m_bPaintLabel:1; - bool m_bVisited:1; - bool m_bHover:1; - bool m_bInternalLinkFont:1; - bool m_bInternalNormalFont:1; - - -// Constructor/Destructor - CHyperLinkImpl(DWORD dwExtendedStyle = HLINK_UNDERLINED) : - m_lpstrLabel(NULL), m_lpstrHyperLink(NULL), - m_hCursor(NULL), m_hFontLink(NULL), m_hFontNormal(NULL), - m_clrLink(RGB(0, 0, 255)), m_clrVisited(RGB(128, 0, 128)), - m_dwExtendedStyle(dwExtendedStyle), - m_bPaintLabel(true), m_bVisited(false), - m_bHover(false), m_bInternalLinkFont(false), m_bInternalNormalFont(false) - { - ::SetRectEmpty(&m_rcLink); - } - - ~CHyperLinkImpl() - { - delete [] m_lpstrLabel; - delete [] m_lpstrHyperLink; -#if (WINVER < 0x0500) && !defined(_WIN32_WCE) - // It was created, not loaded, so we have to destroy it - if(m_hCursor != NULL) - ::DestroyCursor(m_hCursor); -#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) - } - -// Attributes - DWORD GetHyperLinkExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetHyperLinkExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - bool GetLabel(LPTSTR lpstrBuffer, int nLength) const - { - if(m_lpstrLabel == NULL) - return false; - ATLASSERT(lpstrBuffer != NULL); - if(nLength <= lstrlen(m_lpstrLabel)) - return false; - - SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrLabel); - - return true; - } - - bool SetLabel(LPCTSTR lpstrLabel) - { - delete [] m_lpstrLabel; - m_lpstrLabel = NULL; - int cchLen = lstrlen(lpstrLabel) + 1; - ATLTRY(m_lpstrLabel = new TCHAR[cchLen]); - if(m_lpstrLabel == NULL) - return false; - - SecureHelper::strcpy_x(m_lpstrLabel, cchLen, lpstrLabel); - T* pT = static_cast(this); - pT->CalcLabelRect(); - - if(m_hWnd != NULL) - SetWindowText(lpstrLabel); // Set this for accessibility - - return true; - } - - bool GetHyperLink(LPTSTR lpstrBuffer, int nLength) const - { - if(m_lpstrHyperLink == NULL) - return false; - ATLASSERT(lpstrBuffer != NULL); - if(nLength <= lstrlen(m_lpstrHyperLink)) - return false; - - SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrHyperLink); - - return true; - } - - bool SetHyperLink(LPCTSTR lpstrLink) - { - delete [] m_lpstrHyperLink; - m_lpstrHyperLink = NULL; - int cchLen = lstrlen(lpstrLink) + 1; - ATLTRY(m_lpstrHyperLink = new TCHAR[cchLen]); - if(m_lpstrHyperLink == NULL) - return false; - - SecureHelper::strcpy_x(m_lpstrHyperLink, cchLen, lpstrLink); - if(m_lpstrLabel == NULL) - { - T* pT = static_cast(this); - pT->CalcLabelRect(); - } -#ifndef _WIN32_WCE - if(m_tip.IsWindow()) - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); - } -#endif // !_WIN32_WCE - return true; - } - - HFONT GetLinkFont() const - { - return m_hFontLink; - } - - void SetLinkFont(HFONT hFont) - { - if(m_bInternalLinkFont) - { - ::DeleteObject(m_hFontLink); - m_bInternalLinkFont = false; - } - - m_hFontLink = hFont; - - T* pT = static_cast(this); - pT->CalcLabelRect(); - } - - int GetIdealHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) - return -1; - if(!m_bPaintLabel) - return -1; - - UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - - CClientDC dc(m_hWnd); - RECT rect = { 0 }; - GetClientRect(&rect); - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - RECT rcText = rect; - dc.DrawText(_T("NS"), -1, &rcText, DT_LEFT | uFormat | DT_CALCRECT); - dc.SelectFont(m_hFontLink); - RECT rcLink = rect; - dc.DrawText(_T("NS"), -1, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); - dc.SelectFont(hFontOld); - return max(rcText.bottom - rcText.top, rcLink.bottom - rcLink.top); - } - - bool GetIdealSize(SIZE& size) const - { - int cx = 0, cy = 0; - bool bRet = GetIdealSize(cx, cy); - if(bRet) - { - size.cx = cx; - size.cy = cy; - } - return bRet; - } - - bool GetIdealSize(int& cx, int& cy) const - { - ATLASSERT(::IsWindow(m_hWnd)); - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) - return false; - if(!m_bPaintLabel) - return false; - - CClientDC dc(m_hWnd); - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcAll = rcClient; - - if(IsUsingTags()) - { - // find tags and label parts - LPTSTR lpstrLeft = NULL; - int cchLeft = 0; - LPTSTR lpstrLink = NULL; - int cchLink = 0; - LPTSTR lpstrRight = NULL; - int cchRight = 0; - - const T* pT = static_cast(this); - pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); - - // get label part rects - UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - RECT rcLeft = rcClient; - dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | uFormat | DT_CALCRECT); - - dc.SelectFont(m_hFontLink); - RECT rcLink = { rcLeft.right, rcLeft.top, rcClient.right, rcClient.bottom }; - dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); - - dc.SelectFont(m_hFontNormal); - RECT rcRight = { rcLink.right, rcLink.top, rcClient.right, rcClient.bottom }; - dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | uFormat | DT_CALCRECT); - - dc.SelectFont(hFontOld); - - int cyMax = max(rcLeft.bottom, max(rcLink.bottom, rcRight.bottom)); - ::SetRect(&rcAll, rcLeft.left, rcLeft.top, rcRight.right, cyMax); - } - else - { - HFONT hOldFont = NULL; - if(m_hFontLink != NULL) - hOldFont = dc.SelectFont(m_hFontLink); - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - DWORD dwStyle = GetStyle(); - UINT uFormat = DT_LEFT; - if (dwStyle & SS_CENTER) - uFormat = DT_CENTER; - else if (dwStyle & SS_RIGHT) - uFormat = DT_RIGHT; - uFormat |= IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - dc.DrawText(lpstrText, -1, &rcAll, uFormat | DT_CALCRECT); - if(m_hFontLink != NULL) - dc.SelectFont(hOldFont); - if (dwStyle & SS_CENTER) - { - int dx = (rcClient.right - rcAll.right) / 2; - ::OffsetRect(&rcAll, dx, 0); - } - else if (dwStyle & SS_RIGHT) - { - int dx = rcClient.right - rcAll.right; - ::OffsetRect(&rcAll, dx, 0); - } - } - - cx = rcAll.right - rcAll.left; - cy = rcAll.bottom - rcAll.top; - - return true; - } - - // for command buttons only - bool GetToolTipText(LPTSTR lpstrBuffer, int nLength) const - { - ATLASSERT(IsCommandButton()); - return GetHyperLink(lpstrBuffer, nLength); - } - - bool SetToolTipText(LPCTSTR lpstrToolTipText) - { - ATLASSERT(IsCommandButton()); - return SetHyperLink(lpstrToolTipText); - } - -// Operations - BOOL SubclassWindow(HWND hWnd) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - if(m_hFontNormal == NULL) - m_hFontNormal = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - { - T* pT = static_cast(this); - pT->Init(); - } - return bRet; - } - - bool Navigate() - { - ATLASSERT(::IsWindow(m_hWnd)); - bool bRet = true; - if(IsNotifyButton()) - { - NMHDR nmhdr = { m_hWnd, GetDlgCtrlID(), NM_CLICK }; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); - } - else if(IsCommandButton()) - { - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - } - else - { - ATLASSERT(m_lpstrHyperLink != NULL); -#ifndef _WIN32_WCE - DWORD_PTR dwRet = (DWORD_PTR)::ShellExecute(0, _T("open"), m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL); - bRet = (dwRet > 32); -#else // CE specific - SHELLEXECUTEINFO shExeInfo = { sizeof(SHELLEXECUTEINFO), 0, 0, L"open", m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL, 0, 0, 0, 0, 0, 0, 0 }; - ::ShellExecuteEx(&shExeInfo); - DWORD_PTR dwRet = (DWORD_PTR)shExeInfo.hInstApp; - bRet = (dwRet == 0) || (dwRet > 32); -#endif // _WIN32_WCE - ATLASSERT(bRet); - if(bRet) - { - m_bVisited = true; - Invalidate(); - } - } - return bRet; - } - - void CreateLinkFontFromNormal() - { - if(m_bInternalLinkFont) - { - ::DeleteObject(m_hFontLink); - m_bInternalLinkFont = false; - } - - CFontHandle font = (m_hFontNormal != NULL) ? m_hFontNormal : (HFONT)::GetStockObject(SYSTEM_FONT); - LOGFONT lf = { 0 }; - font.GetLogFont(&lf); - - if(IsUsingTagsBold()) - lf.lfWeight = FW_BOLD; - else if(!IsNotUnderlined()) - lf.lfUnderline = TRUE; - - m_hFontLink = ::CreateFontIndirect(&lf); - m_bInternalLinkFont = true; - ATLASSERT(m_hFontLink != NULL); - } - -// Message map and handlers - BEGIN_MSG_MAP(CHyperLinkImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) - MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_CHAR, OnChar) - MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode) - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_ENABLE, OnEnable) - MESSAGE_HANDLER(WM_GETFONT, OnGetFont) - MESSAGE_HANDLER(WM_SETFONT, OnSetFont) - MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) - MESSAGE_HANDLER(WM_SIZE, OnSize) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Init(); - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_tip.IsWindow()) - { - m_tip.DestroyWindow(); - m_tip.m_hWnd = NULL; - } - - if(m_bInternalLinkFont) - { - ::DeleteObject(m_hFontLink); - m_hFontLink = NULL; - m_bInternalLinkFont = false; - } - - if(m_bInternalNormalFont) - { - ::DeleteObject(m_hFontNormal); - m_hFontNormal = NULL; - m_bInternalNormalFont = false; - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - MSG msg = { m_hWnd, uMsg, wParam, lParam }; - if(m_tip.IsWindow() && IsUsingToolTip()) - m_tip.RelayEvent(&msg); - bHandled = FALSE; - return 1; - } -#endif // !_WIN32_WCE - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background painting needed (we do it all during WM_PAINT) - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(!m_bPaintLabel) - { - bHandled = FALSE; - return 1; - } - - T* pT = static_cast(this); - if(wParam != NULL) - { - pT->DoEraseBackground((HDC)wParam); - pT->DoPaint((HDC)wParam); - } - else - { - CPaintDC dc(m_hWnd); - pT->DoEraseBackground(dc.m_hDC); - pT->DoPaint(dc.m_hDC); - } - - return 0; - } - - LRESULT OnFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bPaintLabel) - Invalidate(); - else - bHandled = FALSE; - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) - { - ::SetCursor(m_hCursor); - if(IsUnderlineHover()) - { - if(!m_bHover) - { - m_bHover = true; - InvalidateRect(&m_rcLink); - UpdateWindow(); -#ifndef _WIN32_WCE - StartTrackMouseLeave(); -#endif // !_WIN32_WCE - } - } - } - else - { - if(IsUnderlineHover()) - { - if(m_bHover) - { - m_bHover = false; - InvalidateRect(&m_rcLink); - UpdateWindow(); - } - } - bHandled = FALSE; - } - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(IsUnderlineHover() && m_bHover) - { - m_bHover = false; - InvalidateRect(&m_rcLink); - UpdateWindow(); - } - return 0; - } -#endif // !_WIN32_WCE - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(::PtInRect(&m_rcLink, pt)) - { - SetFocus(); - SetCapture(); - } - return 0; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - if(GetCapture() == m_hWnd) - { - ReleaseCapture(); - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(::PtInRect(&m_rcLink, pt)) - { - T* pT = static_cast(this); - pT->Navigate(); - } - } - return 0; - } - - LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(wParam == VK_RETURN || wParam == VK_SPACE) - { - T* pT = static_cast(this); - pT->Navigate(); - } - return 0; - } - - LRESULT OnGetDlgCode(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return DLGC_WANTCHARS; - } - - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - POINT pt = { 0, 0 }; - GetCursorPos(&pt); - ScreenToClient(&pt); - if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) - { - return TRUE; - } - bHandled = FALSE; - return FALSE; - } - - LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - Invalidate(); - UpdateWindow(); - return 0; - } - - LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hFontNormal; - } - - LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - if(m_bInternalNormalFont) - { - ::DeleteObject(m_hFontNormal); - m_bInternalNormalFont = false; - } - - bool bCreateLinkFont = m_bInternalLinkFont; - - m_hFontNormal = (HFONT)wParam; - - if(bCreateLinkFont || IsAutoCreateLinkFont()) - CreateLinkFontFromNormal(); - - T* pT = static_cast(this); - pT->CalcLabelRect(); - - if((BOOL)lParam) - { - Invalidate(); - UpdateWindow(); - } - - return 0; - } - - LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // If the control is subclassed or superclassed, this message can cause - // repainting without WM_PAINT. We don't use this state, so just do nothing. - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->CalcLabelRect(); - pT->Invalidate(); - return 0; - } - -// Implementation - void Init() - { - ATLASSERT(::IsWindow(m_hWnd)); - - // Check if we should paint a label - const int cchBuff = 8; - TCHAR szBuffer[cchBuff] = { 0 }; - if(::GetClassName(m_hWnd, szBuffer, cchBuff)) - { - if(lstrcmpi(szBuffer, _T("static")) == 0) - { - ModifyStyle(0, SS_NOTIFY); // we need this - DWORD dwStyle = GetStyle() & 0x000000FF; -#ifndef _WIN32_WCE - if(dwStyle == SS_ICON || dwStyle == SS_BLACKRECT || dwStyle == SS_GRAYRECT || - dwStyle == SS_WHITERECT || dwStyle == SS_BLACKFRAME || dwStyle == SS_GRAYFRAME || - dwStyle == SS_WHITEFRAME || dwStyle == SS_OWNERDRAW || - dwStyle == SS_BITMAP || dwStyle == SS_ENHMETAFILE) -#else // CE specific - if(dwStyle == SS_ICON || dwStyle == SS_BITMAP) -#endif // _WIN32_WCE - m_bPaintLabel = false; - } - } - - // create or load a cursor -#if (WINVER >= 0x0500) || defined(_WIN32_WCE) - m_hCursor = ::LoadCursor(NULL, IDC_HAND); -#else - m_hCursor = ::CreateCursor(ModuleHelper::GetModuleInstance(), _AtlHyperLink_CursorData.xHotSpot, _AtlHyperLink_CursorData.yHotSpot, _AtlHyperLink_CursorData.cxWidth, _AtlHyperLink_CursorData.cyHeight, _AtlHyperLink_CursorData.arrANDPlane, _AtlHyperLink_CursorData.arrXORPlane); -#endif - ATLASSERT(m_hCursor != NULL); - - // set fonts - if(m_bPaintLabel) - { - if(m_hFontNormal == NULL) - { - m_hFontNormal = AtlCreateControlFont(); - m_bInternalNormalFont = true; - } - - if(m_hFontLink == NULL) - CreateLinkFontFromNormal(); - } - -#ifndef _WIN32_WCE - // create a tool tip - m_tip.Create(m_hWnd); - ATLASSERT(m_tip.IsWindow()); -#endif // !_WIN32_WCE - - // set label (defaults to window text) - if(m_lpstrLabel == NULL) - { - int nLen = GetWindowTextLength(); - if(nLen > 0) - { - ATLTRY(m_lpstrLabel = new TCHAR[nLen + 1]); - if(m_lpstrLabel != NULL) - ATLVERIFY(GetWindowText(m_lpstrLabel, nLen + 1) > 0); - } - } - - T* pT = static_cast(this); - pT->CalcLabelRect(); - - // set hyperlink (defaults to label), or just activate tool tip if already set - if(m_lpstrHyperLink == NULL && !IsCommandButton()) - { - if(m_lpstrLabel != NULL) - SetHyperLink(m_lpstrLabel); - } -#ifndef _WIN32_WCE - else - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); - } -#endif // !_WIN32_WCE - - // set link colors - if(m_bPaintLabel) - { - CRegKeyEx rk; - LONG lRet = rk.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\Settings")); - if(lRet == ERROR_SUCCESS) - { - const int cchValue = 12; - TCHAR szValue[cchValue] = { 0 }; - ULONG ulCount = cchValue; - lRet = rk.QueryStringValue(_T("Anchor Color"), szValue, &ulCount); - if(lRet == ERROR_SUCCESS) - { - COLORREF clr = pT->_ParseColorString(szValue); - ATLASSERT(clr != CLR_INVALID); - if(clr != CLR_INVALID) - m_clrLink = clr; - } - - ulCount = cchValue; - lRet = rk.QueryStringValue(_T("Anchor Color Visited"), szValue, &ulCount); - if(lRet == ERROR_SUCCESS) - { - COLORREF clr = pT->_ParseColorString(szValue); - ATLASSERT(clr != CLR_INVALID); - if(clr != CLR_INVALID) - m_clrVisited = clr; - } - } - } - } - - static COLORREF _ParseColorString(LPTSTR lpstr) - { - int c[3] = { -1, -1, -1 }; - LPTSTR p = NULL; - for(int i = 0; i < 2; i++) - { - for(p = lpstr; *p != _T('\0'); p = ::CharNext(p)) - { - if(*p == _T(',')) - { - *p = _T('\0'); - c[i] = MinCrtHelper::_atoi(lpstr); - lpstr = &p[1]; - break; - } - } - if(c[i] == -1) - return CLR_INVALID; - } - if(*lpstr == _T('\0')) - return CLR_INVALID; - c[2] = MinCrtHelper::_atoi(lpstr); - - return RGB(c[0], c[1], c[2]); - } - - bool CalcLabelRect() - { - if(!::IsWindow(m_hWnd)) - return false; - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) - return false; - - CClientDC dc(m_hWnd); - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - m_rcLink = rcClient; - if(!m_bPaintLabel) - return true; - - if(IsUsingTags()) - { - // find tags and label parts - LPTSTR lpstrLeft = NULL; - int cchLeft = 0; - LPTSTR lpstrLink = NULL; - int cchLink = 0; - LPTSTR lpstrRight = NULL; - int cchRight = 0; - - T* pT = static_cast(this); - pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); - ATLASSERT(lpstrLink != NULL); - ATLASSERT(cchLink > 0); - - // get label part rects - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - - UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - - RECT rcLeft = rcClient; - if(lpstrLeft != NULL) - dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | uFormat | DT_CALCRECT); - - dc.SelectFont(m_hFontLink); - RECT rcLink = rcClient; - if(lpstrLeft != NULL) - rcLink.left = rcLeft.right; - dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); - - dc.SelectFont(hFontOld); - - m_rcLink = rcLink; - } - else - { - HFONT hOldFont = NULL; - if(m_hFontLink != NULL) - hOldFont = dc.SelectFont(m_hFontLink); - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - DWORD dwStyle = GetStyle(); - UINT uFormat = DT_LEFT; - if (dwStyle & SS_CENTER) - uFormat = DT_CENTER; - else if (dwStyle & SS_RIGHT) - uFormat = DT_RIGHT; - uFormat |= IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - dc.DrawText(lpstrText, -1, &m_rcLink, uFormat | DT_CALCRECT); - if(m_hFontLink != NULL) - dc.SelectFont(hOldFont); - if (dwStyle & SS_CENTER) - { - int dx = (rcClient.right - m_rcLink.right) / 2; - ::OffsetRect(&m_rcLink, dx, 0); - } - else if (dwStyle & SS_RIGHT) - { - int dx = rcClient.right - m_rcLink.right; - ::OffsetRect(&m_rcLink, dx, 0); - } - } - - return true; - } - - void CalcLabelParts(LPTSTR& lpstrLeft, int& cchLeft, LPTSTR& lpstrLink, int& cchLink, LPTSTR& lpstrRight, int& cchRight) const - { - lpstrLeft = NULL; - cchLeft = 0; - lpstrLink = NULL; - cchLink = 0; - lpstrRight = NULL; - cchRight = 0; - - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - int cchText = lstrlen(lpstrText); - bool bOutsideLink = true; - for(int i = 0; i < cchText; i++) - { - if(lpstrText[i] != _T('<')) - continue; - - if(bOutsideLink) - { - if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 3, _T(""), 3) == CSTR_EQUAL) - { - if(i > 0) - { - lpstrLeft = lpstrText; - cchLeft = i; - } - lpstrLink = &lpstrText[i + 3]; - bOutsideLink = false; - } - } - else - { - if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 4, _T(""), 4) == CSTR_EQUAL) - { - cchLink = i - 3 - cchLeft; - if(lpstrText[i + 4] != 0) - { - lpstrRight = &lpstrText[i + 4]; - cchRight = cchText - (i + 4); - break; - } - } - } - } - - } - - void DoEraseBackground(CDCHandle dc) - { - HBRUSH hBrush = (HBRUSH)::SendMessage(GetParent(), WM_CTLCOLORSTATIC, (WPARAM)dc.m_hDC, (LPARAM)m_hWnd); - if(hBrush != NULL) - { - RECT rect = { 0 }; - GetClientRect(&rect); - dc.FillRect(&rect, hBrush); - } - } - - void DoPaint(CDCHandle dc) - { - if(IsUsingTags()) - { - // find tags and label parts - LPTSTR lpstrLeft = NULL; - int cchLeft = 0; - LPTSTR lpstrLink = NULL; - int cchLink = 0; - LPTSTR lpstrRight = NULL; - int cchRight = 0; - - T* pT = static_cast(this); - pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); - - // get label part rects - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - - dc.SetBkMode(TRANSPARENT); - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - - UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - - if(lpstrLeft != NULL) - dc.DrawText(lpstrLeft, cchLeft, &rcClient, DT_LEFT | uFormat); - - COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); - if(m_hFontLink != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) - dc.SelectFont(m_hFontLink); - else - dc.SelectFont(m_hFontNormal); - - dc.DrawText(lpstrLink, cchLink, &m_rcLink, DT_LEFT | uFormat); - - dc.SetTextColor(clrOld); - dc.SelectFont(m_hFontNormal); - if(lpstrRight != NULL) - { - RECT rcRight = { m_rcLink.right, m_rcLink.top, rcClient.right, rcClient.bottom }; - dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | uFormat); - } - - if(GetFocus() == m_hWnd) - dc.DrawFocusRect(&m_rcLink); - - dc.SelectFont(hFontOld); - } - else - { - dc.SetBkMode(TRANSPARENT); - COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); - - HFONT hFontOld = NULL; - if(m_hFontLink != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) - hFontOld = dc.SelectFont(m_hFontLink); - else - hFontOld = dc.SelectFont(m_hFontNormal); - - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - - DWORD dwStyle = GetStyle(); - UINT uFormat = DT_LEFT; - if (dwStyle & SS_CENTER) - uFormat = DT_CENTER; - else if (dwStyle & SS_RIGHT) - uFormat = DT_RIGHT; - uFormat |= IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - - dc.DrawText(lpstrText, -1, &m_rcLink, uFormat); - - if(GetFocus() == m_hWnd) - dc.DrawFocusRect(&m_rcLink); - - dc.SetTextColor(clrOld); - dc.SelectFont(hFontOld); - } - } - -#ifndef _WIN32_WCE - BOOL StartTrackMouseLeave() - { - TRACKMOUSEEVENT tme = { 0 }; - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_LEAVE; - tme.hwndTrack = m_hWnd; - return _TrackMouseEvent(&tme); - } -#endif // !_WIN32_WCE - -// Implementation helpers - bool IsUnderlined() const - { - return ((m_dwExtendedStyle & (HLINK_NOTUNDERLINED | HLINK_UNDERLINEHOVER)) == 0); - } - - bool IsNotUnderlined() const - { - return ((m_dwExtendedStyle & HLINK_NOTUNDERLINED) != 0); - } - - bool IsUnderlineHover() const - { - return ((m_dwExtendedStyle & HLINK_UNDERLINEHOVER) != 0); - } - - bool IsCommandButton() const - { - return ((m_dwExtendedStyle & HLINK_COMMANDBUTTON) != 0); - } - - bool IsNotifyButton() const - { - return ((m_dwExtendedStyle & HLINK_NOTIFYBUTTON) == HLINK_NOTIFYBUTTON); - } - - bool IsUsingTags() const - { - return ((m_dwExtendedStyle & HLINK_USETAGS) != 0); - } - - bool IsUsingTagsBold() const - { - return ((m_dwExtendedStyle & HLINK_USETAGSBOLD) == HLINK_USETAGSBOLD); - } - - bool IsUsingToolTip() const - { - return ((m_dwExtendedStyle & HLINK_NOTOOLTIP) == 0); - } - - bool IsAutoCreateLinkFont() const - { - return ((m_dwExtendedStyle & HLINK_AUTOCREATELINKFONT) == HLINK_AUTOCREATELINKFONT); - } - - bool IsSingleLine() const - { - return ((m_dwExtendedStyle & HLINK_SINGLELINE) == HLINK_SINGLELINE); - } -}; - -class CHyperLink : public CHyperLinkImpl -{ -public: - DECLARE_WND_CLASS(_T("WTL_HyperLink")) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWaitCursor - displays a wait cursor - -class CWaitCursor -{ -public: -// Data - HCURSOR m_hWaitCursor; - HCURSOR m_hOldCursor; - bool m_bInUse; - -// Constructor/destructor - CWaitCursor(bool bSet = true, LPCTSTR lpstrCursor = IDC_WAIT, bool bSys = true) : m_hOldCursor(NULL), m_bInUse(false) - { - HINSTANCE hInstance = bSys ? NULL : ModuleHelper::GetResourceInstance(); - m_hWaitCursor = ::LoadCursor(hInstance, lpstrCursor); - ATLASSERT(m_hWaitCursor != NULL); - - if(bSet) - Set(); - } - - ~CWaitCursor() - { - Restore(); - } - -// Methods - bool Set() - { - if(m_bInUse) - return false; - m_hOldCursor = ::SetCursor(m_hWaitCursor); - m_bInUse = true; - return true; - } - - bool Restore() - { - if(!m_bInUse) - return false; - ::SetCursor(m_hOldCursor); - m_bInUse = false; - return true; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CCustomWaitCursor - for custom and animated cursors - -class CCustomWaitCursor : public CWaitCursor -{ -public: -// Constructor/destructor - CCustomWaitCursor(ATL::_U_STRINGorID cursor, bool bSet = true, HINSTANCE hInstance = NULL) : - CWaitCursor(false, IDC_WAIT, true) - { - if(hInstance == NULL) - hInstance = ModuleHelper::GetResourceInstance(); - m_hWaitCursor = (HCURSOR)::LoadImage(hInstance, cursor.m_lpstr, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE); - - if(bSet) - Set(); - } - - ~CCustomWaitCursor() - { - Restore(); -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - ::DestroyCursor(m_hWaitCursor); -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMultiPaneStatusBarCtrl - Status Bar with multiple panes - -template -class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TBase > -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - -// Data - enum { m_cxPaneMargin = 3 }; - - int m_nPanes; - int* m_pPane; - -// Constructor/destructor - CMultiPaneStatusBarCtrlImpl() : m_nPanes(0), m_pPane(NULL) - { } - - ~CMultiPaneStatusBarCtrlImpl() - { - delete [] m_pPane; - } - -// Methods - HWND Create(HWND hWndParent, LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) - { -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase >::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); -#endif // !(_MSC_VER >= 1300) - } - - HWND Create(HWND hWndParent, UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) - { - const int cchMax = 128; // max text length is 127 for status bars (+1 for null) - TCHAR szText[cchMax]; - szText[0] = 0; - ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); - return Create(hWndParent, szText, dwStyle, nID); - } - - BOOL SetPanes(int* pPanes, int nPanes, bool bSetText = true) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPanes > 0); - - m_nPanes = nPanes; - delete [] m_pPane; - m_pPane = NULL; - - ATLTRY(m_pPane = new int[nPanes]); - ATLASSERT(m_pPane != NULL); - if(m_pPane == NULL) - return FALSE; - - CTempBuffer buff; - int* pPanesPos = buff.Allocate(nPanes); - ATLASSERT(pPanesPos != NULL); - if(pPanesPos == NULL) - return FALSE; - - SecureHelper::memcpy_x(m_pPane, nPanes * sizeof(int), pPanes, nPanes * sizeof(int)); - - // get status bar DC and set font - CClientDC dc(m_hWnd); - HFONT hOldFont = dc.SelectFont(GetFont()); - - // get status bar borders - int arrBorders[3] = { 0 }; - GetBorders(arrBorders); - - const int cchBuff = 128; - TCHAR szBuff[cchBuff] = { 0 }; - SIZE size = { 0, 0 }; - int cxLeft = arrBorders[0]; - - // calculate right edge of each part - for(int i = 0; i < nPanes; i++) - { - if(pPanes[i] == ID_DEFAULT_PANE) - { - // make very large, will be resized later - pPanesPos[i] = INT_MAX / 2; - } - else - { - ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); - dc.GetTextExtent(szBuff, lstrlen(szBuff), &size); - T* pT = static_cast(this); - pT; - pPanesPos[i] = cxLeft + size.cx + arrBorders[2] + 2 * pT->m_cxPaneMargin; - } - cxLeft = pPanesPos[i]; - } - - BOOL bRet = SetParts(nPanes, pPanesPos); - - if(bRet && bSetText) - { - for(int i = 0; i < nPanes; i++) - { - if(pPanes[i] != ID_DEFAULT_PANE) - { - ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); - SetPaneText(m_pPane[i], szBuff); - } - } - } - - dc.SelectFont(hOldFont); - return bRet; - } - - bool GetPaneTextLength(int nPaneID, int* pcchLength = NULL, int* pnType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return false; - - int nLength = GetTextLength(nIndex, pnType); - if(pcchLength != NULL) - *pcchLength = nLength; - - return true; - } - - BOOL GetPaneText(int nPaneID, LPTSTR lpstrText, int* pcchLength = NULL, int* pnType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - int nLength = GetText(nIndex, lpstrText, pnType); - if(pcchLength != NULL) - *pcchLength = nLength; - - return TRUE; - } - - BOOL SetPaneText(int nPaneID, LPCTSTR lpstrText, int nType = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - return SetText(nIndex, lpstrText, nType); - } - - BOOL GetPaneRect(int nPaneID, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - return GetRect(nIndex, lpRect); - } - - BOOL SetPaneWidth(int nPaneID, int cxWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPaneID != ID_DEFAULT_PANE); // Can't resize this one - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - // get pane positions - CTempBuffer buff; - int* pPanesPos = buff.Allocate(m_nPanes); - if(pPanesPos == NULL) - return FALSE; - GetParts(m_nPanes, pPanesPos); - // calculate offset - int cxPaneWidth = pPanesPos[nIndex] - ((nIndex == 0) ? 0 : pPanesPos[nIndex - 1]); - int cxOff = cxWidth - cxPaneWidth; - // find variable width pane - int nDef = m_nPanes; - for(int i = 0; i < m_nPanes; i++) - { - if(m_pPane[i] == ID_DEFAULT_PANE) - { - nDef = i; - break; - } - } - // resize - if(nIndex < nDef) // before default pane - { - for(int i = nIndex; i < nDef; i++) - pPanesPos[i] += cxOff; - - } - else // after default one - { - for(int i = nDef; i < nIndex; i++) - pPanesPos[i] -= cxOff; - } - // set pane postions - return SetParts(m_nPanes, pPanesPos); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetPaneTipText(int nPaneID, LPTSTR lpstrText, int nSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - GetTipText(nIndex, lpstrText, nSize); - return TRUE; - } - - BOOL SetPaneTipText(int nPaneID, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - SetTipText(nIndex, lpstrText); - return TRUE; - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) - BOOL GetPaneIcon(int nPaneID, HICON& hIcon) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - hIcon = GetIcon(nIndex); - return TRUE; - } - - BOOL SetPaneIcon(int nPaneID, HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - return SetIcon(nIndex, hIcon); - } -#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) - -// Message map and handlers - BEGIN_MSG_MAP(CMultiPaneStatusBarCtrlImpl< T >) - MESSAGE_HANDLER(WM_SIZE, OnSize) - END_MSG_MAP() - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(wParam != SIZE_MINIMIZED && m_nPanes > 0) - { - T* pT = static_cast(this); - pT->UpdatePanesLayout(); - } - return lRet; - } - -// Implementation - BOOL UpdatePanesLayout() - { - // get pane positions - CTempBuffer buff; - int* pPanesPos = buff.Allocate(m_nPanes); - ATLASSERT(pPanesPos != NULL); - if(pPanesPos == NULL) - return FALSE; - int nRet = GetParts(m_nPanes, pPanesPos); - ATLASSERT(nRet == m_nPanes); - if(nRet != m_nPanes) - return FALSE; - // calculate offset - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - int cxOff = rcClient.right - pPanesPos[m_nPanes - 1]; -#ifndef _WIN32_WCE - // Move panes left if size grip box is present - if((GetStyle() & SBARS_SIZEGRIP) != 0) - cxOff -= ::GetSystemMetrics(SM_CXVSCROLL) + ::GetSystemMetrics(SM_CXEDGE); -#endif // !_WIN32_WCE - // find variable width pane - int i; - for(i = 0; i < m_nPanes; i++) - { - if(m_pPane[i] == ID_DEFAULT_PANE) - break; - } - // resize all panes from the variable one to the right - if((i < m_nPanes) && (pPanesPos[i] + cxOff) > ((i == 0) ? 0 : pPanesPos[i - 1])) - { - for(; i < m_nPanes; i++) - pPanesPos[i] += cxOff; - } - // set pane postions - return SetParts(m_nPanes, pPanesPos); - } - - int GetPaneIndexFromID(int nPaneID) const - { - for(int i = 0; i < m_nPanes; i++) - { - if(m_pPane[i] == nPaneID) - return i; - } - - return -1; // not found - } -}; - -class CMultiPaneStatusBarCtrl : public CMultiPaneStatusBarCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_MultiPaneStatusBar"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPaneContainer - provides header with title and close button for panes - -// pane container extended styles -#define PANECNT_NOCLOSEBUTTON 0x00000001 -#define PANECNT_VERTICAL 0x00000002 -#define PANECNT_FLATBORDER 0x00000004 -#define PANECNT_NOBORDER 0x00000008 - -template -class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CCustomDraw< T > -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, -1) - -// Constants - enum - { - m_cxyBorder = 2, - m_cxyTextOffset = 4, - m_cxyBtnOffset = 1, - - m_cchTitle = 80, - - m_cxImageTB = 13, - m_cyImageTB = 11, - m_cxyBtnAddTB = 7, - - m_cxToolBar = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder + m_cxyBtnOffset, - - m_xBtnImageLeft = 6, - m_yBtnImageTop = 5, - m_xBtnImageRight = 12, - m_yBtnImageBottom = 11, - - m_nCloseBtnID = ID_PANE_CLOSE - }; - -// Data members - CToolBarCtrl m_tb; - ATL::CWindow m_wndClient; - int m_cxyHeader; - TCHAR m_szTitle[m_cchTitle]; - DWORD m_dwExtendedStyle; // Pane container specific extended styles - HFONT m_hFont; - bool m_bInternalFont; - - -// Constructor - CPaneContainerImpl() : m_cxyHeader(0), m_dwExtendedStyle(0), m_hFont(NULL), m_bInternalFont(false) - { - m_szTitle[0] = 0; - } - -// Attributes - DWORD GetPaneContainerExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetPaneContainerExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - if(m_hWnd != NULL) - { - T* pT = static_cast(this); - bool bUpdate = false; - - if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) != 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0)) // add close button - { - pT->CreateCloseButton(); - bUpdate = true; - } - else if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) == 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) != 0)) // remove close button - { - pT->DestroyCloseButton(); - bUpdate = true; - } - - if((dwPrevStyle & PANECNT_VERTICAL) != (m_dwExtendedStyle & PANECNT_VERTICAL)) // change orientation - { - pT->CalcSize(); - bUpdate = true; - } - - if((dwPrevStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER)) != - (m_dwExtendedStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER))) // change border - { - bUpdate = true; - } - - if(bUpdate) - pT->UpdateLayout(); - } - return dwPrevStyle; - } - - HWND GetClient() const - { - return m_wndClient; - } - - HWND SetClient(HWND hWndClient) - { - HWND hWndOldClient = m_wndClient; - m_wndClient = hWndClient; - if(m_hWnd != NULL) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - return hWndOldClient; - } - - BOOL GetTitle(LPTSTR lpstrTitle, int cchLength) const - { - ATLASSERT(lpstrTitle != NULL); - - errno_t nRet = SecureHelper::strncpy_x(lpstrTitle, cchLength, m_szTitle, _TRUNCATE); - - return (nRet == 0 || nRet == STRUNCATE); - } - - BOOL SetTitle(LPCTSTR lpstrTitle) - { - ATLASSERT(lpstrTitle != NULL); - - errno_t nRet = SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); - bool bRet = (nRet == 0 || nRet == STRUNCATE); - if(bRet && m_hWnd != NULL) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - - return bRet; - } - - int GetTitleLength() const - { - return lstrlen(m_szTitle); - } - -// Methods - HWND Create(HWND hWndParent, LPCTSTR lpstrTitle = NULL, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) - { - if(lpstrTitle != NULL) - SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) - } - - HWND Create(HWND hWndParent, UINT uTitleID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) - { - if(uTitleID != 0U) - ::LoadString(ModuleHelper::GetResourceInstance(), uTitleID, m_szTitle, m_cchTitle); -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) - } - - BOOL EnableCloseButton(BOOL bEnable) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT; // avoid level 4 warning - return (m_tb.m_hWnd != NULL) ? m_tb.EnableButton(pT->m_nCloseBtnID, bEnable) : FALSE; - } - - void UpdateLayout() - { - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - T* pT = static_cast(this); - pT->UpdateLayout(rcClient.right, rcClient.bottom); - } - -// Message map and handlers - BEGIN_MSG_MAP(CPaneContainerImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_GETFONT, OnGetFont) - MESSAGE_HANDLER(WM_SETFONT, OnSetFont) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - FORWARD_NOTIFICATIONS() - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_hFont == NULL) - { - // The same as AtlCreateControlFont() for horizontal pane -#ifndef _WIN32_WCE - LOGFONT lf = { 0 }; - ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); - if(IsVertical()) - lf.lfEscapement = 900; // 90 degrees - m_hFont = ::CreateFontIndirect(&lf); -#else // CE specific - m_hFont = (HFONT)::GetStockObject(SYSTEM_FONT); - if(IsVertical()) - { - CLogFont lf(m_hFont); - lf.lfEscapement = 900; // 90 degrees - m_hFont = ::CreateFontIndirect(&lf); - } -#endif // _WIN32_WCE - m_bInternalFont = true; - } - - T* pT = static_cast(this); - pT->CalcSize(); - - if((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0) - pT->CreateCloseButton(); - - return 0; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_bInternalFont) - { - ::DeleteObject(m_hFont); - m_hFont = NULL; - m_bInternalFont = false; - } - - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - return 0; - } - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetFocus(); - return 0; - } - - LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hFont; - } - - LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - if(m_bInternalFont) - { - ::DeleteObject(m_hFont); - m_bInternalFont = false; - } - - m_hFont = (HFONT)wParam; - - T* pT = static_cast(this); - pT->CalcSize(); - - if((BOOL)lParam != FALSE) - pT->UpdateLayout(); - - return 0; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - pT->DrawPaneTitle((HDC)wParam); - - if(m_wndClient.m_hWnd == NULL) // no client window - pT->DrawPane((HDC)wParam); - } - else - { - CPaintDC dc(m_hWnd); - pT->DrawPaneTitle(dc.m_hDC); - - if(m_wndClient.m_hWnd == NULL) // no client window - pT->DrawPane(dc.m_hDC); - } - - return 0; - } - - LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_tb.m_hWnd == NULL) - { - bHandled = FALSE; - return 1; - } - - T* pT = static_cast(this); - pT; - LPNMHDR lpnmh = (LPNMHDR)lParam; - LRESULT lRet = 0; - - // pass toolbar custom draw notifications to the base class - if(lpnmh->code == NM_CUSTOMDRAW && lpnmh->hwndFrom == m_tb.m_hWnd) - lRet = CCustomDraw< T >::OnCustomDraw(0, lpnmh, bHandled); -#ifndef _WIN32_WCE - // tooltip notifications come with the tooltip window handle and button ID, - // pass them to the parent if we don't handle them - else if(lpnmh->code == TTN_GETDISPINFO && lpnmh->idFrom == pT->m_nCloseBtnID) - bHandled = pT->GetToolTipText(lpnmh); -#endif // !_WIN32_WCE - // only let notifications not from the toolbar go to the parent - else if(lpnmh->hwndFrom != m_tb.m_hWnd && lpnmh->idFrom != pT->m_nCloseBtnID) - bHandled = FALSE; - - return lRet; - } - - LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - // if command comes from the close button, substitute HWND of the pane container instead - if(m_tb.m_hWnd != NULL && (HWND)lParam == m_tb.m_hWnd) - return ::SendMessage(GetParent(), WM_COMMAND, wParam, (LPARAM)m_hWnd); - - bHandled = FALSE; - return 1; - } - -// Custom draw overrides - DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_NOTIFYITEMDRAW; // we need per-item notifications - } - - DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) - { - CDCHandle dc = lpNMCustomDraw->hdc; -#if (_WIN32_IE >= 0x0400) - RECT& rc = lpNMCustomDraw->rc; -#else // !(_WIN32_IE >= 0x0400) - RECT rc; - m_tb.GetItemRect(0, &rc); -#endif // !(_WIN32_IE >= 0x0400) - - dc.FillRect(&rc, COLOR_3DFACE); - - return CDRF_NOTIFYPOSTPAINT; - } - - DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) - { - CDCHandle dc = lpNMCustomDraw->hdc; -#if (_WIN32_IE >= 0x0400) - RECT& rc = lpNMCustomDraw->rc; -#else // !(_WIN32_IE >= 0x0400) - RECT rc = { 0 }; - m_tb.GetItemRect(0, &rc); -#endif // !(_WIN32_IE >= 0x0400) - - RECT rcImage = { m_xBtnImageLeft, m_yBtnImageTop, m_xBtnImageRight + 1, m_yBtnImageBottom + 1 }; - ::OffsetRect(&rcImage, rc.left, rc.top); - T* pT = static_cast(this); - - if((lpNMCustomDraw->uItemState & CDIS_DISABLED) != 0) - { - RECT rcShadow = rcImage; - ::OffsetRect(&rcShadow, 1, 1); - CPen pen1; - pen1.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DHILIGHT)); - pT->DrawButtonImage(dc, rcShadow, pen1); - CPen pen2; - pen2.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DSHADOW)); - pT->DrawButtonImage(dc, rcImage, pen2); - } - else - { - if((lpNMCustomDraw->uItemState & CDIS_SELECTED) != 0) - ::OffsetRect(&rcImage, 1, 1); - CPen pen; - pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNTEXT)); - pT->DrawButtonImage(dc, rcImage, pen); - } - - return CDRF_DODEFAULT; // continue with the default item painting - } - -// Implementation - overrideable methods - void UpdateLayout(int cxWidth, int cyHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - RECT rect = { 0 }; - - if(IsVertical()) - { - ::SetRect(&rect, 0, 0, m_cxyHeader, cyHeight); - if(m_tb.m_hWnd != NULL) - m_tb.SetWindowPos(NULL, m_cxyBorder, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetWindowPos(NULL, m_cxyHeader, 0, cxWidth - m_cxyHeader, cyHeight, SWP_NOZORDER); - else - rect.right = cxWidth; - } - else - { - ::SetRect(&rect, 0, 0, cxWidth, m_cxyHeader); - if(m_tb.m_hWnd != NULL) - m_tb.SetWindowPos(NULL, rect.right - m_cxToolBar, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetWindowPos(NULL, 0, m_cxyHeader, cxWidth, cyHeight - m_cxyHeader, SWP_NOZORDER); - else - rect.bottom = cyHeight; - } - - InvalidateRect(&rect); - } - - void CreateCloseButton() - { - ATLASSERT(m_tb.m_hWnd == NULL); - // create toolbar for the "x" button - m_tb.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NOMOVEY | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, 0); - ATLASSERT(m_tb.IsWindow()); - - if(m_tb.m_hWnd != NULL) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - - m_tb.SetButtonStructSize(); - - TBBUTTON tbbtn = { 0 }; - tbbtn.idCommand = pT->m_nCloseBtnID; - tbbtn.fsState = TBSTATE_ENABLED; - tbbtn.fsStyle = TBSTYLE_BUTTON; - m_tb.AddButtons(1, &tbbtn); - - m_tb.SetBitmapSize(m_cxImageTB, m_cyImageTB); - m_tb.SetButtonSize(m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB); - - if(IsVertical()) - m_tb.SetWindowPos(NULL, m_cxyBorder + m_cxyBtnOffset, m_cxyBorder + m_cxyBtnOffset, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOACTIVATE); - else - m_tb.SetWindowPos(NULL, 0, 0, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); - } - } - - void DestroyCloseButton() - { - if(m_tb.m_hWnd != NULL) - m_tb.DestroyWindow(); - } - - void CalcSize() - { - T* pT = static_cast(this); - CFontHandle font = pT->GetTitleFont(); - if(font.IsNull()) - font = (HFONT)::GetStockObject(SYSTEM_FONT); - LOGFONT lf = { 0 }; - font.GetLogFont(lf); - if(IsVertical()) - { - m_cxyHeader = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder; - } - else - { - int cyFont = abs(lf.lfHeight) + m_cxyBorder + 2 * m_cxyTextOffset; - int cyBtn = m_cyImageTB + m_cxyBtnAddTB + m_cxyBorder + 2 * m_cxyBtnOffset; - m_cxyHeader = max(cyFont, cyBtn); - } - } - - HFONT GetTitleFont() const - { - return m_hFont; - } - -#ifndef _WIN32_WCE - BOOL GetToolTipText(LPNMHDR /*lpnmh*/) - { - return FALSE; - } -#endif // !_WIN32_WCE - - void DrawPaneTitle(CDCHandle dc) - { - RECT rect = { 0 }; - GetClientRect(&rect); - - UINT uBorder = BF_LEFT | BF_TOP | BF_ADJUST; - if(IsVertical()) - { - rect.right = rect.left + m_cxyHeader; - uBorder |= BF_BOTTOM; - } - else - { - rect.bottom = rect.top + m_cxyHeader; - uBorder |= BF_RIGHT; - } - - if((m_dwExtendedStyle & PANECNT_NOBORDER) == 0) - { - if((m_dwExtendedStyle & PANECNT_FLATBORDER) != 0) - uBorder |= BF_FLAT; - dc.DrawEdge(&rect, EDGE_ETCHED, uBorder); - } - dc.FillRect(&rect, COLOR_3DFACE); - - // draw title text - dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT)); - dc.SetBkMode(TRANSPARENT); - T* pT = static_cast(this); - HFONT hFontOld = dc.SelectFont(pT->GetTitleFont()); -#ifdef _WIN32_WCE - const UINT DT_END_ELLIPSIS = 0; -#endif // _WIN32_WCE - - if(IsVertical()) - { - rect.top += m_cxyTextOffset; - rect.bottom -= m_cxyTextOffset; - if(m_tb.m_hWnd != NULL) - rect.top += m_cxToolBar;; - - RECT rcCalc = { rect.left, rect.bottom, rect.right, rect.top }; - int cxFont = dc.DrawText(m_szTitle, -1, &rcCalc, DT_TOP | DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT); - RECT rcText = { 0 }; - rcText.left = (rect.right - rect.left - cxFont) / 2; - rcText.right = rcText.left + (rect.bottom - rect.top); - rcText.top = rect.bottom; - rcText.bottom = rect.top; - dc.DrawText(m_szTitle, -1, &rcText, DT_TOP | DT_SINGLELINE | DT_END_ELLIPSIS); - } - else - { - rect.left += m_cxyTextOffset; - rect.right -= m_cxyTextOffset; - if(m_tb.m_hWnd != NULL) - rect.right -= m_cxToolBar;; - - dc.DrawText(m_szTitle, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS); - } - - dc.SelectFont(hFontOld); - } - - // called only if pane is empty - void DrawPane(CDCHandle dc) - { - RECT rect = { 0 }; - GetClientRect(&rect); - if(IsVertical()) - rect.left += m_cxyHeader; - else - rect.top += m_cxyHeader; - if((GetExStyle() & WS_EX_CLIENTEDGE) == 0) - dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - dc.FillRect(&rect, COLOR_APPWORKSPACE); - } - - // drawing helper - draws "x" button image - void DrawButtonImage(CDCHandle dc, RECT& rcImage, HPEN hPen) - { -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - HPEN hPenOld = dc.SelectPen(hPen); - - dc.MoveTo(rcImage.left, rcImage.top); - dc.LineTo(rcImage.right, rcImage.bottom); - dc.MoveTo(rcImage.left + 1, rcImage.top); - dc.LineTo(rcImage.right + 1, rcImage.bottom); - - dc.MoveTo(rcImage.left, rcImage.bottom - 1); - dc.LineTo(rcImage.right, rcImage.top - 1); - dc.MoveTo(rcImage.left + 1, rcImage.bottom - 1); - dc.LineTo(rcImage.right + 1, rcImage.top - 1); - - dc.SelectPen(hPenOld); -#else // (_WIN32_WCE < 400) - rcImage; - hPen; - // no support for the "x" button image -#endif // (_WIN32_WCE < 400) - } - - bool IsVertical() const - { - return ((m_dwExtendedStyle & PANECNT_VERTICAL) != 0); - } -}; - -class CPaneContainer : public CPaneContainerImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_PaneContainer"), 0, -1) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSortListViewCtrl - implements sorting for a listview control - -// sort listview extended styles -#define SORTLV_USESHELLBITMAPS 0x00000001 - -// Notification sent to parent when sort column is changed by user clicking header. -#define SLVN_SORTCHANGED LVN_LAST - -// A LPNMSORTLISTVIEW is sent with the SLVN_SORTCHANGED notification -typedef struct tagNMSORTLISTVIEW -{ - NMHDR hdr; - int iNewSortColumn; - int iOldSortColumn; -} NMSORTLISTVIEW, *LPNMSORTLISTVIEW; - -// Column sort types. Can be set on a per-column basis with the SetColumnSortType method. -enum -{ - LVCOLSORT_NONE, - LVCOLSORT_TEXT, // default - LVCOLSORT_TEXTNOCASE, - LVCOLSORT_LONG, - LVCOLSORT_DOUBLE, - LVCOLSORT_DECIMAL, - LVCOLSORT_DATETIME, - LVCOLSORT_DATE, - LVCOLSORT_TIME, - LVCOLSORT_CUSTOM, - LVCOLSORT_LAST = LVCOLSORT_CUSTOM -}; - - -template -class CSortListViewImpl -{ -public: - enum - { - m_cchCmpTextMax = 32, // overrideable - m_cxSortImage = 16, - m_cySortImage = 15, - m_cxSortArrow = 11, - m_cySortArrow = 6, - m_iSortUp = 0, // index of sort bitmaps - m_iSortDown = 1, - m_nShellSortUpID = 133 - }; - - // passed to LVCompare functions as lParam1 and lParam2 - struct LVCompareParam - { - int iItem; - DWORD_PTR dwItemData; - union - { - long lValue; - double dblValue; - DECIMAL decValue; - LPCTSTR pszValue; - }; - }; - - // passed to LVCompare functions as the lParamSort parameter - struct LVSortInfo - { - T* pT; - int iSortCol; - bool bDescending; - }; - - bool m_bSortDescending; - bool m_bCommCtrl6; - int m_iSortColumn; - CBitmap m_bmSort[2]; - int m_fmtOldSortCol; - HBITMAP m_hbmOldSortCol; - DWORD m_dwSortLVExtendedStyle; - ATL::CSimpleArray m_arrColSortType; - bool m_bUseWaitCursor; - - CSortListViewImpl() : - m_bSortDescending(false), - m_bCommCtrl6(false), - m_iSortColumn(-1), - m_fmtOldSortCol(0), - m_hbmOldSortCol(NULL), - m_dwSortLVExtendedStyle(SORTLV_USESHELLBITMAPS), - m_bUseWaitCursor(true) - { -#ifndef _WIN32_WCE - DWORD dwMajor = 0; - DWORD dwMinor = 0; - HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - m_bCommCtrl6 = SUCCEEDED(hRet) && dwMajor >= 6; -#endif // !_WIN32_WCE - } - -// Attributes - void SetSortColumn(int iCol) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - CHeaderCtrl header = pT->GetHeader(); - ATLASSERT(header.m_hWnd != NULL); - ATLASSERT(iCol >= -1 && iCol < m_arrColSortType.GetSize()); - - int iOldSortCol = m_iSortColumn; - m_iSortColumn = iCol; - if(m_bCommCtrl6) - { -#ifndef HDF_SORTUP - const int HDF_SORTUP = 0x0400; -#endif // HDF_SORTUP -#ifndef HDF_SORTDOWN - const int HDF_SORTDOWN = 0x0200; -#endif // HDF_SORTDOWN - const int nMask = HDF_SORTUP | HDF_SORTDOWN; - HDITEM hditem = { HDI_FORMAT }; - if(iOldSortCol != iCol && iOldSortCol >= 0 && header.GetItem(iOldSortCol, &hditem)) - { - hditem.fmt &= ~nMask; - header.SetItem(iOldSortCol, &hditem); - } - if(iCol >= 0 && header.GetItem(iCol, &hditem)) - { - hditem.fmt &= ~nMask; - hditem.fmt |= m_bSortDescending ? HDF_SORTDOWN : HDF_SORTUP; - header.SetItem(iCol, &hditem); - } - return; - } - - if(m_bmSort[m_iSortUp].IsNull()) - pT->CreateSortBitmaps(); - - // restore previous sort column's bitmap, if any, and format - HDITEM hditem = { HDI_BITMAP | HDI_FORMAT }; - if(iOldSortCol != iCol && iOldSortCol >= 0) - { - hditem.hbm = m_hbmOldSortCol; - hditem.fmt = m_fmtOldSortCol; - header.SetItem(iOldSortCol, &hditem); - } - - // save new sort column's bitmap and format, and add our sort bitmap - if(iCol >= 0 && header.GetItem(iCol, &hditem)) - { - if(iOldSortCol != iCol) - { - m_fmtOldSortCol = hditem.fmt; - m_hbmOldSortCol = hditem.hbm; - } - hditem.fmt &= ~HDF_IMAGE; - hditem.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT; - int i = m_bSortDescending ? m_iSortDown : m_iSortUp; - hditem.hbm = m_bmSort[i]; - header.SetItem(iCol, &hditem); - } - } - - int GetSortColumn() const - { - return m_iSortColumn; - } - - void SetColumnSortType(int iCol, WORD wType) - { - ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); - ATLASSERT(wType >= LVCOLSORT_NONE && wType <= LVCOLSORT_LAST); - m_arrColSortType[iCol] = wType; - } - - WORD GetColumnSortType(int iCol) const - { - ATLASSERT((iCol >= 0) && iCol < m_arrColSortType.GetSize()); - return m_arrColSortType[iCol]; - } - - int GetColumnCount() const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - CHeaderCtrl header = pT->GetHeader(); - return header.m_hWnd != NULL ? header.GetItemCount() : 0; - } - - bool IsSortDescending() const - { - return m_bSortDescending; - } - - DWORD GetSortListViewExtendedStyle() const - { - return m_dwSortLVExtendedStyle; - } - - DWORD SetSortListViewExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwSortLVExtendedStyle; - if(dwMask == 0) - m_dwSortLVExtendedStyle = dwExtendedStyle; - else - m_dwSortLVExtendedStyle = (m_dwSortLVExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - -// Operations - bool DoSortItems(int iCol, bool bDescending = false) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); - - WORD wType = m_arrColSortType[iCol]; - if(wType == LVCOLSORT_NONE) - return false; - - int nCount = pT->GetItemCount(); - if(nCount < 2) - { - m_bSortDescending = bDescending; - SetSortColumn(iCol); - return true; - } - - CWaitCursor waitCursor(false); - if(m_bUseWaitCursor) - waitCursor.Set(); - - LVCompareParam* pParam = NULL; - ATLTRY(pParam = new LVCompareParam[nCount]); - PFNLVCOMPARE pFunc = NULL; - TCHAR pszTemp[pT->m_cchCmpTextMax]; - bool bStrValue = false; - - switch(wType) - { - case LVCOLSORT_TEXT: - pFunc = (PFNLVCOMPARE)pT->LVCompareText; - case LVCOLSORT_TEXTNOCASE: - if(pFunc == NULL) - pFunc = (PFNLVCOMPARE)pT->LVCompareTextNoCase; - case LVCOLSORT_CUSTOM: - { - if(pFunc == NULL) - pFunc = (PFNLVCOMPARE)pT->LVCompareCustom; - - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pParam[i].pszValue = new TCHAR[pT->m_cchCmpTextMax]; - pT->GetItemText(i, iCol, (LPTSTR)pParam[i].pszValue, pT->m_cchCmpTextMax); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - bStrValue = true; - } - break; - case LVCOLSORT_LONG: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareLong; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pParam[i].lValue = pT->StrToLong(pszTemp); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - case LVCOLSORT_DOUBLE: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pParam[i].dblValue = pT->StrToDouble(pszTemp); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - case LVCOLSORT_DECIMAL: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareDecimal; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pT->StrToDecimal(pszTemp, &pParam[i].decValue); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - case LVCOLSORT_DATETIME: - case LVCOLSORT_DATE: - case LVCOLSORT_TIME: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; - DWORD dwFlags = LOCALE_NOUSEROVERRIDE; - if(wType == LVCOLSORT_DATE) - dwFlags |= VAR_DATEVALUEONLY; - else if(wType == LVCOLSORT_TIME) - dwFlags |= VAR_TIMEVALUEONLY; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pParam[i].dblValue = pT->DateStrToDouble(pszTemp, dwFlags); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown value for sort type in CSortListViewImpl::DoSortItems()\n")); - break; - } // switch(wType) - - ATLASSERT(pFunc != NULL); - LVSortInfo lvsi = { pT, iCol, bDescending }; - bool bRet = ((BOOL)pT->DefWindowProc(LVM_SORTITEMS, (WPARAM)&lvsi, (LPARAM)pFunc) != FALSE); - for(int i = 0; i < nCount; i++) - { - DWORD_PTR dwItemData = pT->GetItemData(i); - LVCompareParam* p = (LVCompareParam*)dwItemData; - ATLASSERT(p != NULL); - if(bStrValue) - delete [] (TCHAR*)p->pszValue; - pT->SetItemData(i, p->dwItemData); - } - delete [] pParam; - - if(bRet) - { - m_bSortDescending = bDescending; - SetSortColumn(iCol); - } - - if(m_bUseWaitCursor) - waitCursor.Restore(); - - return bRet; - } - - void CreateSortBitmaps() - { - if((m_dwSortLVExtendedStyle & SORTLV_USESHELLBITMAPS) != 0) - { - bool bFree = false; - LPCTSTR pszModule = _T("shell32.dll"); - HINSTANCE hShell = ::GetModuleHandle(pszModule); - - if (hShell == NULL) - { - hShell = ::LoadLibrary(pszModule); - bFree = true; - } - - if (hShell != NULL) - { - bool bSuccess = true; - for(int i = m_iSortUp; i <= m_iSortDown; i++) - { - if(!m_bmSort[i].IsNull()) - m_bmSort[i].DeleteObject(); - m_bmSort[i] = (HBITMAP)::LoadImage(hShell, MAKEINTRESOURCE(m_nShellSortUpID + i), -#ifndef _WIN32_WCE - IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); -#else // CE specific - IMAGE_BITMAP, 0, 0, 0); -#endif // _WIN32_WCE - if(m_bmSort[i].IsNull()) - { - bSuccess = false; - break; - } - } - if(bFree) - ::FreeLibrary(hShell); - if(bSuccess) - return; - } - } - - T* pT = static_cast(this); - for(int i = m_iSortUp; i <= m_iSortDown; i++) - { - if(!m_bmSort[i].IsNull()) - m_bmSort[i].DeleteObject(); - - CDC dcMem; - CClientDC dc(::GetDesktopWindow()); - dcMem.CreateCompatibleDC(dc.m_hDC); - m_bmSort[i].CreateCompatibleBitmap(dc.m_hDC, m_cxSortImage, m_cySortImage); - HBITMAP hbmOld = dcMem.SelectBitmap(m_bmSort[i]); - RECT rc = {0,0,m_cxSortImage, m_cySortImage}; - pT->DrawSortBitmap(dcMem.m_hDC, i, &rc); - dcMem.SelectBitmap(hbmOld); - dcMem.DeleteDC(); - } - } - - void NotifyParentSortChanged(int iNewSortCol, int iOldSortCol) - { - T* pT = static_cast(this); - int nID = pT->GetDlgCtrlID(); - NMSORTLISTVIEW nm = { { pT->m_hWnd, nID, SLVN_SORTCHANGED }, iNewSortCol, iOldSortCol }; - ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nID, (LPARAM)&nm); - } - -// Overrideables - int CompareItemsCustom(LVCompareParam* /*pItem1*/, LVCompareParam* /*pItem2*/, int /*iSortCol*/) - { - // pItem1 and pItem2 contain valid iItem, dwItemData, and pszValue members. - // If item1 > item2 return 1, if item1 < item2 return -1, else return 0. - return 0; - } - - void DrawSortBitmap(CDCHandle dc, int iBitmap, LPRECT prc) - { - dc.FillRect(prc, ::GetSysColorBrush(COLOR_BTNFACE)); - HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); - CPen pen; - pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNSHADOW)); - HPEN hpenOld = dc.SelectPen(pen); - POINT ptOrg = { (m_cxSortImage - m_cxSortArrow) / 2, (m_cySortImage - m_cySortArrow) / 2 }; - if(iBitmap == m_iSortUp) - { - POINT pts[3] = - { - { ptOrg.x + m_cxSortArrow / 2, ptOrg.y }, - { ptOrg.x, ptOrg.y + m_cySortArrow - 1 }, - { ptOrg.x + m_cxSortArrow - 1, ptOrg.y + m_cySortArrow - 1 } - }; - dc.Polygon(pts, 3); - } - else - { - POINT pts[3] = - { - { ptOrg.x, ptOrg.y }, - { ptOrg.x + m_cxSortArrow / 2, ptOrg.y + m_cySortArrow - 1 }, - { ptOrg.x + m_cxSortArrow - 1, ptOrg.y } - }; - dc.Polygon(pts, 3); - } - dc.SelectBrush(hbrOld); - dc.SelectPen(hpenOld); - } - - double DateStrToDouble(LPCTSTR lpstr, DWORD dwFlags) - { - ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) - return 0; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - DATE dRet = 0; - if (FAILED(hRet = ::VarDateFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, dwFlags, &dRet))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarDateFromStr failed with result of 0x%8.8X\n"), hRet); - dRet = 0; - } - return dRet; - } - - long StrToLong(LPCTSTR lpstr) - { - ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) - return 0; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - long lRet = 0; - if (FAILED(hRet = ::VarI4FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &lRet))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarI4FromStr failed with result of 0x%8.8X\n"), hRet); - lRet = 0; - } - return lRet; - } - - double StrToDouble(LPCTSTR lpstr) - { - ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) - return 0; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - double dblRet = 0; - if (FAILED(hRet = ::VarR8FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &dblRet))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarR8FromStr failed with result of 0x%8.8X\n"), hRet); - dblRet = 0; - } - return dblRet; - } - - bool StrToDecimal(LPCTSTR lpstr, DECIMAL* pDecimal) - { - ATLASSERT(lpstr != NULL); - ATLASSERT(pDecimal != NULL); - if(lpstr == NULL || pDecimal == NULL) - return false; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - if (FAILED(hRet = ::VarDecFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, pDecimal))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarDecFromStr failed with result of 0x%8.8X\n"), hRet); - pDecimal->Lo64 = 0; - pDecimal->Hi32 = 0; - pDecimal->signscale = 0; - return false; - } - return true; - } - -// Overrideable PFNLVCOMPARE functions - static int CALLBACK LVCompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = lstrcmp(pParam1->pszValue, pParam2->pszValue); - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareTextNoCase(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = lstrcmpi(pParam1->pszValue, pParam2->pszValue); - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareLong(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = 0; - if(pParam1->lValue > pParam2->lValue) - nRet = 1; - else if(pParam1->lValue < pParam2->lValue) - nRet = -1; - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareDouble(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = 0; - if(pParam1->dblValue > pParam2->dblValue) - nRet = 1; - else if(pParam1->dblValue < pParam2->dblValue) - nRet = -1; - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareCustom(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = pInfo->pT->CompareItemsCustom(pParam1, pParam2, pInfo->iSortCol); - return pInfo->bDescending ? -nRet : nRet; - } - -#ifndef _WIN32_WCE - static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = (int)::VarDecCmp(&pParam1->decValue, &pParam2->decValue); - nRet--; - return pInfo->bDescending ? -nRet : nRet; - } -#else - // Compare mantissas, ignore sign and scale - static int CompareMantissas(const DECIMAL& decLeft, const DECIMAL& decRight) - { - if (decLeft.Hi32 < decRight.Hi32) - { - return -1; - } - if (decLeft.Hi32 > decRight.Hi32) - { - return 1; - } - // Here, decLeft.Hi32 == decRight.Hi32 - if (decLeft.Lo64 < decRight.Lo64) - { - return -1; - } - if (decLeft.Lo64 > decRight.Lo64) - { - return 1; - } - return 0; - } - - // return values: VARCMP_LT, VARCMP_EQ, VARCMP_GT, VARCMP_NULL - static HRESULT VarDecCmp(const DECIMAL* pdecLeft, const DECIMAL* pdecRight) - { - static const ULONG powersOfTen[] = - { - 10ul, - 100ul, - 1000ul, - 10000ul, - 100000ul, - 1000000ul, - 10000000ul, - 100000000ul, - 1000000000ul - }; - static const int largestPower = sizeof(powersOfTen) / sizeof(powersOfTen[0]); - if (!pdecLeft || !pdecRight) - { - return VARCMP_NULL; - } - - // Degenerate case - at least one comparand is of the form - // [+-]0*10^N (denormalized zero) - bool bLeftZero = (!pdecLeft->Lo64 && !pdecLeft->Hi32); - bool bRightZero = (!pdecRight->Lo64 && !pdecRight->Hi32); - if (bLeftZero && bRightZero) - { - return VARCMP_EQ; - } - bool bLeftNeg = ((pdecLeft->sign & DECIMAL_NEG) != 0); - bool bRightNeg = ((pdecRight->sign & DECIMAL_NEG) != 0); - if (bLeftZero) - { - return (bRightNeg ? VARCMP_GT : VARCMP_LT); - } - // This also covers the case where the comparands have different signs - if (bRightZero || bLeftNeg != bRightNeg) - { - return (bLeftNeg ? VARCMP_LT : VARCMP_GT); - } - - // Here both comparands have the same sign and need to be compared - // on mantissa and scale. The result is obvious when - // 1. Scales are equal (then compare mantissas) - // 2. A number with smaller scale is also the one with larger mantissa - // (then this number is obviously larger) - // In the remaining case, we would multiply the number with smaller - // scale by 10 and simultaneously increment its scale (which amounts to - // adding trailing zeros after decimal point), until the numbers fall under - // one of the two cases above - DECIMAL temp; - bool bInvert = bLeftNeg; // the final result needs to be inverted - if (pdecLeft->scale < pdecRight->scale) - { - temp = *pdecLeft; - } - else - { - temp = *pdecRight; - pdecRight = pdecLeft; - bInvert = !bInvert; - } - - // Now temp is the number with smaller (or equal) scale, and - // we can modify it freely without touching original parameters - int comp; - while ((comp = CompareMantissas(temp, *pdecRight)) < 0 && - temp.scale < pdecRight->scale) - { - // Multiply by an appropriate power of 10 - int scaleDiff = pdecRight->scale - temp.scale; - if (scaleDiff > largestPower) - { - // Keep the multiplier representable in 32bit - scaleDiff = largestPower; - } - DWORDLONG power = powersOfTen[scaleDiff - 1]; - // Multiply temp's mantissa by power - DWORDLONG product = temp.Lo32 * power; - ULONG carry = static_cast(product >> 32); - temp.Lo32 = static_cast(product); - product = temp.Mid32 * power + carry; - carry = static_cast(product >> 32); - temp.Mid32 = static_cast(product); - product = temp.Hi32 * power + carry; - if (static_cast(product >> 32)) - { - // Multiplication overflowed - pdecLeft is clearly larger - break; - } - temp.Hi32 = static_cast(product); - temp.scale = (BYTE)(temp.scale + scaleDiff); - } - if (temp.scale < pdecRight->scale) - { - comp = 1; - } - if (bInvert) - { - comp = -comp; - } - return (comp > 0 ? VARCMP_GT : comp < 0 ? VARCMP_LT : VARCMP_EQ); - } - - static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = (int)VarDecCmp(&pParam1->decValue, &pParam2->decValue); - nRet--; - return pInfo->bDescending ? -nRet : nRet; - } -#endif // !_WIN32_WCE - - BEGIN_MSG_MAP(CSortListViewImpl) - MESSAGE_HANDLER(LVM_INSERTCOLUMN, OnInsertColumn) - MESSAGE_HANDLER(LVM_DELETECOLUMN, OnDeleteColumn) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, OnHeaderItemClick) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, OnHeaderItemClick) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - END_MSG_MAP() - - LRESULT OnInsertColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == -1) - return -1; - - WORD wType = 0; - m_arrColSortType.Add(wType); - int nCount = m_arrColSortType.GetSize(); - ATLASSERT(nCount == GetColumnCount()); - - for(int i = nCount - 1; i > lRet; i--) - m_arrColSortType[i] = m_arrColSortType[i - 1]; - m_arrColSortType[(int)lRet] = LVCOLSORT_TEXT; - - if(lRet <= m_iSortColumn) - m_iSortColumn++; - - return lRet; - } - - LRESULT OnDeleteColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == 0) - return 0; - - int iCol = (int)wParam; - if(m_iSortColumn == iCol) - m_iSortColumn = -1; - else if(m_iSortColumn > iCol) - m_iSortColumn--; - m_arrColSortType.RemoveAt(iCol); - - return lRet; - } - - LRESULT OnHeaderItemClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LPNMHEADER p = (LPNMHEADER)pnmh; - if(p->iButton == 0) - { - int iOld = m_iSortColumn; - bool bDescending = (m_iSortColumn == p->iItem) ? !m_bSortDescending : false; - if(DoSortItems(p->iItem, bDescending)) - NotifyParentSortChanged(p->iItem, iOld); - } - bHandled = FALSE; - return 0; - } - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifndef _WIN32_WCE - if(wParam == SPI_SETNONCLIENTMETRICS) - GetSystemSettings(); -#else // CE specific - wParam; // avoid level 4 warning - GetSystemSettings(); -#endif // _WIN32_WCE - bHandled = FALSE; - return 0; - } - - void GetSystemSettings() - { - if(!m_bCommCtrl6 && !m_bmSort[m_iSortUp].IsNull()) - { - T* pT = static_cast(this); - pT->CreateSortBitmaps(); - if(m_iSortColumn != -1) - SetSortColumn(m_iSortColumn); - } - } - -}; - - -typedef ATL::CWinTraits CSortListViewCtrlTraits; - -template -class ATL_NO_VTABLE CSortListViewCtrlImpl: public ATL::CWindowImpl, public CSortListViewImpl -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - - bool SortItems(int iCol, bool bDescending = false) - { - return DoSortItems(iCol, bDescending); - } - - BEGIN_MSG_MAP(CSortListViewCtrlImpl) - MESSAGE_HANDLER(LVM_INSERTCOLUMN, CSortListViewImpl::OnInsertColumn) - MESSAGE_HANDLER(LVM_DELETECOLUMN, CSortListViewImpl::OnDeleteColumn) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, CSortListViewImpl::OnHeaderItemClick) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, CSortListViewImpl::OnHeaderItemClick) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CSortListViewImpl::OnSettingChange) - END_MSG_MAP() -}; - -class CSortListViewCtrl : public CSortListViewCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_SortListViewCtrl"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTabView - implements tab view window - -// TabView Notifications -#define TBVN_PAGEACTIVATED (0U-741) -#define TBVN_CONTEXTMENU (0U-742) - -// Notification data for TBVN_CONTEXTMENU -struct TBVCONTEXTMENUINFO -{ - NMHDR hdr; - POINT pt; -}; - -typedef TBVCONTEXTMENUINFO* LPTBVCONTEXTMENUINFO; - - -template -class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) - -// Declarations and enums - struct TABVIEWPAGE - { - HWND hWnd; - LPTSTR lpstrTitle; - LPVOID pData; - }; - - struct TCITEMEXTRA - { - TCITEMHEADER tciheader; - TABVIEWPAGE tvpage; - - operator LPTCITEM() { return (LPTCITEM)this; } - }; - - enum - { - m_nTabID = 1313, - m_cxMoveMark = 6, - m_cyMoveMark = 3, - m_nMenuItemsMax = (ID_WINDOW_TABLAST - ID_WINDOW_TABFIRST + 1) - }; - -// Data members - ATL::CContainedWindowT m_tab; - int m_cyTabHeight; - - int m_nActivePage; - - int m_nInsertItem; - POINT m_ptStartDrag; - - CMenuHandle m_menu; - - int m_cchTabTextLength; - - int m_nMenuItemsCount; - - ATL::CWindow m_wndTitleBar; - LPTSTR m_lpstrTitleBarBase; - int m_cchTitleBarLength; - - CImageList m_ilDrag; - - bool m_bDestroyPageOnRemove:1; - bool m_bDestroyImageList:1; - bool m_bActivePageMenuItem:1; - bool m_bActiveAsDefaultMenuItem:1; - bool m_bEmptyMenuItem:1; - bool m_bWindowsMenuItem:1; - bool m_bNoTabDrag:1; - // internal - bool m_bTabCapture:1; - bool m_bTabDrag:1; - bool m_bInternalFont:1; - -// Constructor/destructor - CTabViewImpl() : - m_nActivePage(-1), - m_cyTabHeight(0), - m_tab(this, 1), - m_nInsertItem(-1), - m_cchTabTextLength(30), - m_nMenuItemsCount(10), - m_lpstrTitleBarBase(NULL), - m_cchTitleBarLength(100), - m_bDestroyPageOnRemove(true), - m_bDestroyImageList(true), - m_bActivePageMenuItem(true), - m_bActiveAsDefaultMenuItem(false), - m_bEmptyMenuItem(false), - m_bWindowsMenuItem(false), - m_bNoTabDrag(false), - m_bTabCapture(false), - m_bTabDrag(false), - m_bInternalFont(false) - { - m_ptStartDrag.x = 0; - m_ptStartDrag.y = 0; - } - - ~CTabViewImpl() - { - delete [] m_lpstrTitleBarBase; - } - -// Message filter function - to be called from PreTranslateMessage of the main window - BOOL PreTranslateMessage(MSG* pMsg) - { - if(IsWindow() == FALSE) - return FALSE; - - BOOL bRet = FALSE; - - // Check for TabView built-in accelerators (Ctrl+Tab/Ctrl+Shift+Tab - next/previous page) - int nCount = GetPageCount(); - if(nCount > 0) - { - bool bControl = (::GetKeyState(VK_CONTROL) < 0); - if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) && bControl) - { - if(nCount > 1) - { - int nPage = m_nActivePage; - bool bShift = (::GetKeyState(VK_SHIFT) < 0); - if(bShift) - nPage = (nPage > 0) ? (nPage - 1) : (nCount - 1); - else - nPage = ((nPage >= 0) && (nPage < (nCount - 1))) ? (nPage + 1) : 0; - - SetActivePage(nPage); - T* pT = static_cast(this); - pT->OnPageActivated(m_nActivePage); - } - - bRet = TRUE; - } - } - - // If we are doing drag-drop, check for Escape key that cancels it - if(bRet == FALSE) - { - if(m_bTabCapture && pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) - { - ::ReleaseCapture(); - bRet = TRUE; - } - } - - // Pass the message to the active page - if(bRet == FALSE) - { - if(m_nActivePage != -1) - bRet = (BOOL)::SendMessage(GetPageHWND(m_nActivePage), WM_FORWARDMSG, 0, (LPARAM)pMsg); - } - - return bRet; - } - -// Attributes - int GetPageCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_tab.GetItemCount(); - } - - int GetActivePage() const - { - return m_nActivePage; - } - - void SetActivePage(int nPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - SetRedraw(FALSE); - - if(m_nActivePage != -1) - ::ShowWindow(GetPageHWND(m_nActivePage), FALSE); - m_nActivePage = nPage; - m_tab.SetCurSel(m_nActivePage); - ::ShowWindow(GetPageHWND(m_nActivePage), TRUE); - - pT->UpdateLayout(); - - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - - if(::GetFocus() != m_tab.m_hWnd) - ::SetFocus(GetPageHWND(m_nActivePage)); - - pT->UpdateTitleBar(); - pT->UpdateMenu(); - } - - HIMAGELIST GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_tab.GetImageList(); - } - - HIMAGELIST SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_tab.SetImageList(hImageList); - } - - void SetWindowMenu(HMENU hMenu) - { - ATLASSERT(::IsWindow(m_hWnd)); - - m_menu = hMenu; - - T* pT = static_cast(this); - pT->UpdateMenu(); - } - - void SetTitleBarWindow(HWND hWnd) - { - ATLASSERT(::IsWindow(m_hWnd)); - - delete [] m_lpstrTitleBarBase; - m_lpstrTitleBarBase = NULL; - - m_wndTitleBar = hWnd; - if(hWnd == NULL) - return; - - int cchLen = m_wndTitleBar.GetWindowTextLength() + 1; - ATLTRY(m_lpstrTitleBarBase = new TCHAR[cchLen]); - if(m_lpstrTitleBarBase != NULL) - { - m_wndTitleBar.GetWindowText(m_lpstrTitleBarBase, cchLen); - T* pT = static_cast(this); - pT->UpdateTitleBar(); - } - } - -// Page attributes - HWND GetPageHWND(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - m_tab.GetItem(nPage, tcix); - - return tcix.tvpage.hWnd; - } - - LPCTSTR GetPageTitle(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - if(m_tab.GetItem(nPage, tcix) == FALSE) - return NULL; - - return tcix.tvpage.lpstrTitle; - } - - bool SetPageTitle(int nPage, LPCTSTR lpstrTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - int cchBuff = lstrlen(lpstrTitle) + 1; - LPTSTR lpstrBuff = NULL; - ATLTRY(lpstrBuff = new TCHAR[cchBuff]); - if(lpstrBuff == NULL) - return false; - - SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - if(m_tab.GetItem(nPage, tcix) == FALSE) - return false; - - CTempBuffer buff; - LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); - if(lpstrTabText == NULL) - return false; - - delete [] tcix.tvpage.lpstrTitle; - - pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); - - tcix.tciheader.mask = TCIF_TEXT | TCIF_PARAM; - tcix.tciheader.pszText = lpstrTabText; - tcix.tvpage.lpstrTitle = lpstrBuff; - if(m_tab.SetItem(nPage, tcix) == FALSE) - return false; - - pT->UpdateTitleBar(); - pT->UpdateMenu(); - - return true; - } - - LPVOID GetPageData(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - m_tab.GetItem(nPage, tcix); - - return tcix.tvpage.pData; - } - - LPVOID SetPageData(int nPage, LPVOID pData) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - m_tab.GetItem(nPage, tcix); - LPVOID pDataOld = tcix.tvpage.pData; - - tcix.tvpage.pData = pData; - m_tab.SetItem(nPage, tcix); - - return pDataOld; - } - - int GetPageImage(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_IMAGE; - m_tab.GetItem(nPage, tcix); - - return tcix.tciheader.iImage; - } - - int SetPageImage(int nPage, int nImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_IMAGE; - m_tab.GetItem(nPage, tcix); - int nImageOld = tcix.tciheader.iImage; - - tcix.tciheader.iImage = nImage; - m_tab.SetItem(nPage, tcix); - - return nImageOld; - } - -// Operations - bool AddPage(HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) - { - return InsertPage(GetPageCount(), hWndView, lpstrTitle, nImage, pData); - } - - bool InsertPage(int nPage, HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPage == GetPageCount() || IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - int cchBuff = lstrlen(lpstrTitle) + 1; - LPTSTR lpstrBuff = NULL; - ATLTRY(lpstrBuff = new TCHAR[cchBuff]); - if(lpstrBuff == NULL) - return false; - - SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); - - CTempBuffer buff; - LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); - if(lpstrTabText == NULL) - return false; - - pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); - - SetRedraw(FALSE); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; - tcix.tciheader.pszText = lpstrTabText; - tcix.tciheader.iImage = nImage; - tcix.tvpage.hWnd = hWndView; - tcix.tvpage.lpstrTitle = lpstrBuff; - tcix.tvpage.pData = pData; - int nItem = m_tab.InsertItem(nPage, tcix); - if(nItem == -1) - { - delete [] lpstrBuff; - SetRedraw(TRUE); - return false; - } - - SetActivePage(nItem); - pT->OnPageActivated(m_nActivePage); - - if(GetPageCount() == 1) - pT->ShowTabControl(true); - - pT->UpdateLayout(); - - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - - return true; - } - - void RemovePage(int nPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - SetRedraw(FALSE); - - if(GetPageCount() == 1) - pT->ShowTabControl(false); - - if(m_bDestroyPageOnRemove) - ::DestroyWindow(GetPageHWND(nPage)); - else - ::ShowWindow(GetPageHWND(nPage), FALSE); - LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(nPage); - delete [] lpstrTitle; - - ATLVERIFY(m_tab.DeleteItem(nPage) != FALSE); - - if(m_nActivePage == nPage) - { - m_nActivePage = -1; - - if(nPage > 0) - { - SetActivePage(nPage - 1); - } - else if(GetPageCount() > 0) - { - SetActivePage(nPage); - } - else - { - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); - pT->UpdateTitleBar(); - pT->UpdateMenu(); - } - } - else - { - nPage = (nPage < m_nActivePage) ? (m_nActivePage - 1) : m_nActivePage; - m_nActivePage = -1; - SetActivePage(nPage); - } - - pT->OnPageActivated(m_nActivePage); - } - - void RemoveAllPages() - { - ATLASSERT(::IsWindow(m_hWnd)); - - if(GetPageCount() == 0) - return; - - T* pT = static_cast(this); - - SetRedraw(FALSE); - - pT->ShowTabControl(false); - - for(int i = 0; i < GetPageCount(); i++) - { - if(m_bDestroyPageOnRemove) - ::DestroyWindow(GetPageHWND(i)); - else - ::ShowWindow(GetPageHWND(i), FALSE); - LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(i); - delete [] lpstrTitle; - } - m_tab.DeleteAllItems(); - - m_nActivePage = -1; - pT->OnPageActivated(m_nActivePage); - - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); - - pT->UpdateTitleBar(); - pT->UpdateMenu(); - } - - int PageIndexFromHwnd(HWND hWnd) const - { - int nIndex = -1; - - for(int i = 0; i < GetPageCount(); i++) - { - if(GetPageHWND(i) == hWnd) - { - nIndex = i; - break; - } - } - - return nIndex; - } - - void BuildWindowMenu(HMENU hMenu, int nMenuItemsCount = 10, bool bEmptyMenuItem = true, bool bWindowsMenuItem = true, bool bActivePageMenuItem = true, bool bActiveAsDefaultMenuItem = false) - { - ATLASSERT(::IsWindow(m_hWnd)); - - CMenuHandle menu = hMenu; - T* pT = static_cast(this); - pT; // avoid level 4 warning - int nFirstPos = 0; - - // Find first menu item in our range -#ifndef _WIN32_WCE - for(nFirstPos = 0; nFirstPos < menu.GetMenuItemCount(); nFirstPos++) - { - UINT nID = menu.GetMenuItemID(nFirstPos); - if((nID >= ID_WINDOW_TABFIRST && nID <= ID_WINDOW_TABLAST) || nID == ID_WINDOW_SHOWTABLIST) - break; - } -#else // CE specific - for(nFirstPos = 0; ; nFirstPos++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_ID; - BOOL bRet = menu.GetMenuItemInfo(nFirstPos, TRUE, &mii); - if(bRet == FALSE) - break; - if((mii.wID >= ID_WINDOW_TABFIRST && mii.wID <= ID_WINDOW_TABLAST) || mii.wID == ID_WINDOW_SHOWTABLIST) - break; - } -#endif // _WIN32_WCE - - // Remove all menu items for tab pages - BOOL bRet = TRUE; - while(bRet != FALSE) - bRet = menu.DeleteMenu(nFirstPos, MF_BYPOSITION); - - // Add separator if it's not already there - int nPageCount = GetPageCount(); - if((bWindowsMenuItem || (nPageCount > 0)) && (nFirstPos > 0)) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE; - menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); - if((nFirstPos <= 0) || ((mii.fType & MFT_SEPARATOR) == 0)) - { - menu.AppendMenu(MF_SEPARATOR); - nFirstPos++; - } - } - - // Add menu items for all pages - if(nPageCount > 0) - { - // Append menu items for all pages - const int cchPrefix = 3; // 2 digits + space - nMenuItemsCount = min(min(nPageCount, nMenuItemsCount), (int)m_nMenuItemsMax); - ATLASSERT(nMenuItemsCount < 100); // 2 digits only - if(nMenuItemsCount >= 100) - nMenuItemsCount = 99; - - for(int i = 0; i < nMenuItemsCount; i++) - { - LPCTSTR lpstrTitle = GetPageTitle(i); - int nLen = lstrlen(lpstrTitle); - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(cchPrefix + nLen + 1); - ATLASSERT(lpstrText != NULL); - if(lpstrText != NULL) - { - LPCTSTR lpstrFormat = (i < 9) ? _T("&%i %s") : _T("%i %s"); - SecureHelper::wsprintf_x(lpstrText, cchPrefix + nLen + 1, lpstrFormat, i + 1, lpstrTitle); - menu.AppendMenu(MF_STRING, ID_WINDOW_TABFIRST + i, lpstrText); - } - } - - // Mark active page - if(bActivePageMenuItem && (m_nActivePage != -1)) - { -#ifndef _WIN32_WCE - if(bActiveAsDefaultMenuItem) - { - menu.SetMenuDefaultItem((UINT)-1, TRUE); - menu.SetMenuDefaultItem(nFirstPos + m_nActivePage, TRUE); - } - else -#else // CE specific - bActiveAsDefaultMenuItem; // avoid level 4 warning -#endif // _WIN32_WCE - { - menu.CheckMenuRadioItem(nFirstPos, nFirstPos + nMenuItemsCount, nFirstPos + m_nActivePage, MF_BYPOSITION); - } - } - } - else - { - if(bEmptyMenuItem) - { - menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_TABFIRST, pT->GetEmptyListText()); - menu.EnableMenuItem(ID_WINDOW_TABFIRST, MF_GRAYED); - } - - // Remove separator if nothing else is there - if(!bEmptyMenuItem && !bWindowsMenuItem && (nFirstPos > 0)) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE; - menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); - if((mii.fType & MFT_SEPARATOR) != 0) - menu.DeleteMenu(nFirstPos - 1, MF_BYPOSITION); - } - } - - // Add "Windows..." menu item - if(bWindowsMenuItem) - menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_SHOWTABLIST, pT->GetWindowsMenuItemText()); - } - -// Message map and handlers - BEGIN_MSG_MAP(CTabViewImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_GETFONT, OnGetFont) - MESSAGE_HANDLER(WM_SETFONT, OnSetFont) - NOTIFY_HANDLER(m_nTabID, TCN_SELCHANGE, OnTabChanged) - NOTIFY_ID_HANDLER(m_nTabID, OnTabNotification) -#ifndef _WIN32_WCE - NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, OnTabGetDispInfo) -#endif // !_WIN32_WCE - FORWARD_NOTIFICATIONS() - ALT_MSG_MAP(1) // tab control - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnTabLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnTabLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnTabCaptureChanged) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnTabMouseMove) - MESSAGE_HANDLER(WM_RBUTTONUP, OnTabRButtonUp) - MESSAGE_HANDLER(WM_SYSKEYDOWN, OnTabSysKeyDown) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->CreateTabControl(); - - return 0; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - RemoveAllPages(); - - if(m_bDestroyImageList) - { - CImageList il = m_tab.SetImageList(NULL); - if(il.m_hImageList != NULL) - il.Destroy(); - } - - if(m_bInternalFont) - { - HFONT hFont = m_tab.GetFont(); - m_tab.SetFont(NULL, FALSE); - ::DeleteObject(hFont); - m_bInternalFont = false; - } - - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - return 0; - } - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_nActivePage != -1) - ::SetFocus(GetPageHWND(m_nActivePage)); - return 0; - } - - LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return m_tab.SendMessage(WM_GETFONT); - } - - LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - if(m_bInternalFont) - { - HFONT hFont = m_tab.GetFont(); - m_tab.SetFont(NULL, FALSE); - ::DeleteObject(hFont); - m_bInternalFont = false; - } - - m_tab.SendMessage(WM_SETFONT, wParam, lParam); - - T* pT = static_cast(this); - m_cyTabHeight = pT->CalcTabHeight(); - - if((BOOL)lParam != FALSE) - pT->UpdateLayout(); - - return 0; - } - - LRESULT OnTabChanged(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - SetActivePage(m_tab.GetCurSel()); - T* pT = static_cast(this); - pT->OnPageActivated(m_nActivePage); - - return 0; - } - - LRESULT OnTabNotification(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - // nothing to do - this just blocks all tab control - // notifications from being propagated further - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnTabGetDispInfo(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LPNMTTDISPINFO pTTDI = (LPNMTTDISPINFO)pnmh; - if(pTTDI->hdr.hwndFrom == m_tab.GetTooltips()) - { - T* pT = static_cast(this); - pT->UpdateTooltipText(pTTDI); - } - else - { - bHandled = FALSE; - } - - return 0; - } -#endif // !_WIN32_WCE - -// Tab control message handlers - LRESULT OnTabLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bNoTabDrag && (m_tab.GetItemCount() > 1)) - { - m_bTabCapture = true; - m_tab.SetCapture(); - - m_ptStartDrag.x = GET_X_LPARAM(lParam); - m_ptStartDrag.y = GET_Y_LPARAM(lParam); - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnTabLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_bTabCapture) - { - if(m_bTabDrag) - { - TCHITTESTINFO hti = { 0 }; - hti.pt.x = GET_X_LPARAM(lParam); - hti.pt.y = GET_Y_LPARAM(lParam); - int nItem = m_tab.HitTest(&hti); - if(nItem != -1) - MovePage(m_nActivePage, nItem); - } - - ::ReleaseCapture(); - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnTabCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bTabCapture) - { - m_bTabCapture = false; - - if(m_bTabDrag) - { - m_bTabDrag = false; - T* pT = static_cast(this); - pT->DrawMoveMark(-1); - -#ifndef _WIN32_WCE - m_ilDrag.DragLeave(GetDesktopWindow()); -#endif // !_WIN32_WCE - m_ilDrag.EndDrag(); - - m_ilDrag.Destroy(); - m_ilDrag.m_hImageList = NULL; - } - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnTabMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - bHandled = FALSE; - - if(m_bTabCapture) - { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - - if(!m_bTabDrag) - { -#ifndef _WIN32_WCE - if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CXDRAG) || - abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CYDRAG)) -#else // CE specific - if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= 4 || - abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= 4) -#endif // _WIN32_WCE - { - T* pT = static_cast(this); - pT->GenerateDragImage(m_nActivePage); - - int cxCursor = ::GetSystemMetrics(SM_CXCURSOR); - int cyCursor = ::GetSystemMetrics(SM_CYCURSOR); - m_ilDrag.BeginDrag(0, -(cxCursor / 2), -(cyCursor / 2)); -#ifndef _WIN32_WCE - POINT ptEnter = m_ptStartDrag; - m_tab.ClientToScreen(&ptEnter); - m_ilDrag.DragEnter(GetDesktopWindow(), ptEnter); -#endif // !_WIN32_WCE - - m_bTabDrag = true; - } - } - - if(m_bTabDrag) - { - TCHITTESTINFO hti = { 0 }; - hti.pt = pt; - int nItem = m_tab.HitTest(&hti); - - T* pT = static_cast(this); - pT->SetMoveCursor(nItem != -1); - - if(m_nInsertItem != nItem) - pT->DrawMoveMark(nItem); - - m_ilDrag.DragShowNolock((nItem != -1) ? TRUE : FALSE); - m_tab.ClientToScreen(&pt); - m_ilDrag.DragMove(pt); - - bHandled = TRUE; - } - } - - return 0; - } - - LRESULT OnTabRButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - TCHITTESTINFO hti = { 0 }; - hti.pt.x = GET_X_LPARAM(lParam); - hti.pt.y = GET_Y_LPARAM(lParam); - int nItem = m_tab.HitTest(&hti); - if(nItem != -1) - { - T* pT = static_cast(this); - pT->OnContextMenu(nItem, hti.pt); - } - - return 0; - } - - LRESULT OnTabSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bool bShift = (::GetKeyState(VK_SHIFT) < 0); - if(wParam == VK_F10 && bShift) - { - if(m_nActivePage != -1) - { - RECT rect = { 0 }; - m_tab.GetItemRect(m_nActivePage, &rect); - POINT pt = { rect.left, rect.bottom }; - T* pT = static_cast(this); - pT->OnContextMenu(m_nActivePage, pt); - } - } - else - { - bHandled = FALSE; - } - - return 0; - } - -// Implementation helpers - bool IsValidPageIndex(int nPage) const - { - return (nPage >= 0 && nPage < GetPageCount()); - } - - bool MovePage(int nMovePage, int nInsertBeforePage) - { - ATLASSERT(IsValidPageIndex(nMovePage)); - ATLASSERT(IsValidPageIndex(nInsertBeforePage)); - - if(!IsValidPageIndex(nMovePage) || !IsValidPageIndex(nInsertBeforePage)) - return false; - - if(nMovePage == nInsertBeforePage) - return true; // nothing to do - - CTempBuffer buff; - LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); - if(lpstrTabText == NULL) - return false; - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; - tcix.tciheader.pszText = lpstrTabText; - tcix.tciheader.cchTextMax = m_cchTabTextLength + 1; - BOOL bRet = m_tab.GetItem(nMovePage, tcix); - ATLASSERT(bRet != FALSE); - if(bRet == FALSE) - return false; - - int nInsertItem = (nInsertBeforePage > nMovePage) ? nInsertBeforePage + 1 : nInsertBeforePage; - int nNewItem = m_tab.InsertItem(nInsertItem, tcix); - ATLASSERT(nNewItem == nInsertItem); - if(nNewItem != nInsertItem) - { - ATLVERIFY(m_tab.DeleteItem(nNewItem)); - return false; - } - - if(nMovePage > nInsertBeforePage) - ATLVERIFY(m_tab.DeleteItem(nMovePage + 1) != FALSE); - else if(nMovePage < nInsertBeforePage) - ATLVERIFY(m_tab.DeleteItem(nMovePage) != FALSE); - - SetActivePage(nInsertBeforePage); - T* pT = static_cast(this); - pT->OnPageActivated(m_nActivePage); - - return true; - } - -// Implementation overrideables - bool CreateTabControl() - { -#ifndef _WIN32_WCE - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_TOOLTIPS, 0, m_nTabID); -#else // CE specific - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, m_nTabID); -#endif // _WIN32_WCE - ATLASSERT(m_tab.m_hWnd != NULL); - if(m_tab.m_hWnd == NULL) - return false; - - m_tab.SetFont(AtlCreateControlFont()); - m_bInternalFont = true; - - m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); - - T* pT = static_cast(this); - m_cyTabHeight = pT->CalcTabHeight(); - - return true; - } - - int CalcTabHeight() - { - int nCount = m_tab.GetItemCount(); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT; - tcix.tciheader.pszText = _T("NS"); - int nIndex = m_tab.InsertItem(nCount, tcix); - - RECT rect = { 0, 0, 1000, 1000 }; - m_tab.AdjustRect(FALSE, &rect); - - RECT rcWnd = { 0, 0, 1000, rect.top }; - ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); - - int nHeight = rcWnd.bottom - rcWnd.top; - - m_tab.DeleteItem(nIndex); - - return nHeight; - } - - void ShowTabControl(bool bShow) - { - m_tab.ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE); - } - - void UpdateLayout() - { - RECT rect; - GetClientRect(&rect); - - if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) - m_tab.SetWindowPos(NULL, 0, 0, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER); - - if(m_nActivePage != -1) - ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, m_cyTabHeight, rect.right - rect.left, rect.bottom - rect.top - m_cyTabHeight, SWP_NOZORDER); - } - - void UpdateMenu() - { - if(m_menu.m_hMenu != NULL) - BuildWindowMenu(m_menu, m_nMenuItemsCount, m_bEmptyMenuItem, m_bWindowsMenuItem, m_bActivePageMenuItem, m_bActiveAsDefaultMenuItem); - } - - void UpdateTitleBar() - { - if(!m_wndTitleBar.IsWindow() || m_lpstrTitleBarBase == NULL) - return; // nothing to do - - if(m_nActivePage != -1) - { - T* pT = static_cast(this); - LPCTSTR lpstrTitle = pT->GetPageTitle(m_nActivePage); - LPCTSTR lpstrDivider = pT->GetTitleDividerText(); - int cchBuffer = m_cchTitleBarLength + lstrlen(lpstrDivider) + lstrlen(m_lpstrTitleBarBase) + 1; - CTempBuffer buff; - LPTSTR lpstrPageTitle = buff.Allocate(cchBuffer); - ATLASSERT(lpstrPageTitle != NULL); - if(lpstrPageTitle != NULL) - { - pT->ShortenTitle(lpstrTitle, lpstrPageTitle, m_cchTitleBarLength + 1); - SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, lpstrDivider); - SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, m_lpstrTitleBarBase); - } - else - { - lpstrPageTitle = m_lpstrTitleBarBase; - } - - m_wndTitleBar.SetWindowText(lpstrPageTitle); - } - else - { - m_wndTitleBar.SetWindowText(m_lpstrTitleBarBase); - } - } - - void DrawMoveMark(int nItem) - { - T* pT = static_cast(this); - - if(m_nInsertItem != -1) - { - RECT rect = { 0 }; - pT->GetMoveMarkRect(rect); - m_tab.InvalidateRect(&rect); - } - - m_nInsertItem = nItem; - - if(m_nInsertItem != -1) - { - CClientDC dc(m_tab.m_hWnd); - - RECT rect = { 0 }; - pT->GetMoveMarkRect(rect); - - CPen pen; - pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_WINDOWTEXT)); - CBrush brush; - brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOWTEXT)); - - HPEN hPenOld = dc.SelectPen(pen); - HBRUSH hBrushOld = dc.SelectBrush(brush); - - int x = rect.left; - int y = rect.top; - POINT ptsTop[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y + m_cyMoveMark } }; - dc.Polygon(ptsTop, 3); - - y = rect.bottom - 1; - POINT ptsBottom[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y - m_cyMoveMark } }; - dc.Polygon(ptsBottom, 3); - - dc.SelectPen(hPenOld); - dc.SelectBrush(hBrushOld); - } - } - - void GetMoveMarkRect(RECT& rect) const - { - m_tab.GetClientRect(&rect); - - RECT rcItem = { 0 }; - m_tab.GetItemRect(m_nInsertItem, &rcItem); - - if(m_nInsertItem <= m_nActivePage) - { - rect.left = rcItem.left - m_cxMoveMark / 2 - 1; - rect.right = rcItem.left + m_cxMoveMark / 2; - } - else - { - rect.left = rcItem.right - m_cxMoveMark / 2 - 1; - rect.right = rcItem.right + m_cxMoveMark / 2; - } - } - - void SetMoveCursor(bool bCanMove) - { - ::SetCursor(::LoadCursor(NULL, bCanMove ? IDC_ARROW : IDC_NO)); - } - - void GenerateDragImage(int nItem) - { - ATLASSERT(IsValidPageIndex(nItem)); - -#ifndef _WIN32_WCE - RECT rcItem = { 0 }; - m_tab.GetItemRect(nItem, &rcItem); - ::InflateRect(&rcItem, 2, 2); // make bigger to cover selected item -#else // CE specific - nItem; // avoid level 4 warning - RECT rcItem = { 0, 0, 40, 20 }; -#endif // _WIN32_WCE - - ATLASSERT(m_ilDrag.m_hImageList == NULL); - m_ilDrag.Create(rcItem.right - rcItem.left, rcItem.bottom - rcItem.top, ILC_COLORDDB | ILC_MASK, 1, 1); - - CClientDC dc(m_hWnd); - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - ATLASSERT(dcMem.m_hDC != NULL); - dcMem.SetViewportOrg(-rcItem.left, -rcItem.top); - - CBitmap bmp; - bmp.CreateCompatibleBitmap(dc, rcItem.right - rcItem.left, rcItem.bottom - rcItem.top); - ATLASSERT(bmp.m_hBitmap != NULL); - - HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); -#ifndef _WIN32_WCE - m_tab.SendMessage(WM_PRINTCLIENT, (WPARAM)dcMem.m_hDC); -#else // CE specific - dcMem.Rectangle(&rcItem); -#endif // _WIN32_WCE - dcMem.SelectBitmap(hBmpOld); - - ATLVERIFY(m_ilDrag.Add(bmp.m_hBitmap, RGB(255, 0, 255)) != -1); - } - - void ShortenTitle(LPCTSTR lpstrTitle, LPTSTR lpstrShortTitle, int cchShortTitle) - { - if(lstrlen(lpstrTitle) >= cchShortTitle) - { - LPCTSTR lpstrEllipsis = _T("..."); - int cchEllipsis = lstrlen(lpstrEllipsis); - SecureHelper::strncpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle, cchShortTitle - cchEllipsis - 1); - SecureHelper::strcat_x(lpstrShortTitle, cchShortTitle, lpstrEllipsis); - } - else - { - SecureHelper::strcpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle); - } - } - -#ifndef _WIN32_WCE - void UpdateTooltipText(LPNMTTDISPINFO pTTDI) - { - ATLASSERT(pTTDI != NULL); - pTTDI->lpszText = (LPTSTR)GetPageTitle((int)pTTDI->hdr.idFrom); - } -#endif // !_WIN32_WCE - -// Text for menu items and title bar - override to provide different strings - static LPCTSTR GetEmptyListText() - { - return _T("(Empty)"); - } - - static LPCTSTR GetWindowsMenuItemText() - { - return _T("&Windows..."); - } - - static LPCTSTR GetTitleDividerText() - { - return _T(" - "); - } - -// Notifications - override to provide different behavior - void OnPageActivated(int nPage) - { - NMHDR nmhdr = { 0 }; - nmhdr.hwndFrom = m_hWnd; - nmhdr.idFrom = nPage; - nmhdr.code = TBVN_PAGEACTIVATED; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); - } - - void OnContextMenu(int nPage, POINT pt) - { - m_tab.ClientToScreen(&pt); - - TBVCONTEXTMENUINFO cmi = { 0 }; - cmi.hdr.hwndFrom = m_hWnd; - cmi.hdr.idFrom = nPage; - cmi.hdr.code = TBVN_CONTEXTMENU; - cmi.pt = pt; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&cmi); - } -}; - -class CTabView : public CTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_TabView"), 0, COLOR_APPWORKSPACE) -}; - -}; // namespace WTL - -#endif // __ATLCTRLX_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlddx.h b/GLideN64/src/GLideNUI-wtl/WTL/atlddx.h deleted file mode 100644 index 2d54ca5..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlddx.h +++ /dev/null @@ -1,685 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLDDX_H__ -#define __ATLDDX_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlddx.h requires atlapp.h to be included first -#endif - -#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) - #error Cannot use floating point DDX with _ATL_MIN_CRT defined -#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) - -#ifdef _ATL_USE_DDX_FLOAT - #include -#endif // _ATL_USE_DDX_FLOAT - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CWinDataExchange - - -namespace WTL -{ - -// Constants -#define DDX_LOAD FALSE -#define DDX_SAVE TRUE - -// DDX map macros -#define BEGIN_DDX_MAP(thisClass) \ - BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \ - { \ - bSaveAndValidate; \ - nCtlID; - -#define DDX_TEXT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_TEXT_LEN(nID, var, len) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \ - return FALSE; \ - } - -#define DDX_INT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_INT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \ - return FALSE; \ - } - -#define DDX_UINT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_UINT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \ - return FALSE; \ - } - -#ifdef _ATL_USE_DDX_FLOAT -#define DDX_FLOAT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_FLOAT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \ - return FALSE; \ - } -#define DDX_FLOAT_P(nID, var, precision) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \ - return FALSE; \ - } - -#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \ - return FALSE; \ - } -#endif // _ATL_USE_DDX_FLOAT - -#define DDX_CONTROL(nID, obj) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Control(nID, obj, bSaveAndValidate); - -#define DDX_CONTROL_HANDLE(nID, obj) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Control_Handle(nID, obj, bSaveAndValidate); - -#define DDX_CHECK(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Check(nID, var, bSaveAndValidate); - -#define DDX_RADIO(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Radio(nID, var, bSaveAndValidate); - -#define END_DDX_MAP() \ - return TRUE; \ - } - -// DDX support for Tab, Combo, ListBox and ListView selection index -// Note: Specialized versions require atlctrls.h to be included first -#if (_MSC_VER >= 1300) - -#define DDX_INDEX(CtrlClass, nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Index(nID, var, bSaveAndValidate); - -#ifdef __ATLCTRLS_H__ - #define DDX_TAB_INDEX(nID, var) DDX_INDEX(WTL::CTabCtrl, nID, var) - #define DDX_COMBO_INDEX(nID, var) DDX_INDEX(WTL::CComboBox, nID, var) - #define DDX_LISTBOX_INDEX(nID, var) DDX_INDEX(WTL::CListBox, nID, var) - #define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var) -#endif // __ATLCTRLS_H__ - -#endif // (_MSC_VER >= 1300) - - -/////////////////////////////////////////////////////////////////////////////// -// CWinDataExchange - provides support for DDX - -template -class CWinDataExchange -{ -public: -// Data exchange method - override in your derived class - BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1) - { - // this one should never be called, override it in - // your derived class by implementing DDX map - ATLASSERT(FALSE); - return FALSE; - } - -// Helpers for validation error reporting - enum _XDataType - { - ddxDataNull = 0, - ddxDataText = 1, - ddxDataInt = 2, - ddxDataFloat = 3, - ddxDataDouble = 4 - }; - - struct _XTextData - { - int nLength; - int nMaxLength; - }; - - struct _XIntData - { - long nVal; - long nMin; - long nMax; - }; - - struct _XFloatData - { - double nVal; - double nMin; - double nMax; - }; - - struct _XData - { - _XDataType nDataType; - union - { - _XTextData textData; - _XIntData intData; - _XFloatData floatData; - }; - }; - -// Text exchange - BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - HWND hWndCtrl = pT->GetDlgItem(nID); - int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR)); - if(nRetLen < ::GetWindowTextLength(hWndCtrl)) - bSuccess = FALSE; - } - else - { - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); - bSuccess = pT->SetDlgItemText(nID, lpstrText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if(lstrlen(lpstrText) > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = lstrlen(lpstrText); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - - BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - bSuccess = pT->GetDlgItemText(nID, bstrText); - } - else - { - USES_CONVERSION; - LPTSTR lpstrText = OLE2T(bstrText); - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); - bSuccess = pT->SetDlgItemText(nID, lpstrText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if((int)::SysStringLen(bstrText) > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = (int)::SysStringLen(bstrText); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - - BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText); - } - else - { - USES_CONVERSION; - LPTSTR lpstrText = OLE2T(bstrText); - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); - bSuccess = pT->SetDlgItemText(nID, lpstrText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if((int)bstrText.Length() > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = (int)bstrText.Length(); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - HWND hWndCtrl = pT->GetDlgItem(nID); - int nLen = ::GetWindowTextLength(hWndCtrl); - int nRetLen = -1; - LPTSTR lpstr = strText.GetBufferSetLength(nLen); - if(lpstr != NULL) - { - nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1); - strText.ReleaseBuffer(); - } - if(nRetLen < nLen) - bSuccess = FALSE; - } - else - { - bSuccess = pT->SetDlgItemText(nID, strText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if(strText.GetLength() > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = strText.GetLength(); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Numeric exchange - template - BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned); - } - else - { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) - { - _XData data = { ddxDataInt }; - data.intData.nVal = (long)nVal; - data.intData.nMin = (long)nMin; - data.intData.nMax = (long)nMax; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - -// Float exchange -#ifdef _ATL_USE_DDX_FLOAT - static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d) - { - ATLASSERT(lpszText != NULL); - while (*lpszText == _T(' ') || *lpszText == _T('\t')) - lpszText++; - - TCHAR chFirst = lpszText[0]; - d = _tcstod(lpszText, (LPTSTR*)&lpszText); - if (d == 0.0 && chFirst != _T('0')) - return FALSE; // could not convert - while (*lpszText == _T(' ') || *lpszText == _T('\t')) - lpszText++; - - if (*lpszText != _T('\0')) - return FALSE; // not terminated properly - - return TRUE; - } - - BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - const int cchBuff = 32; - TCHAR szBuff[cchBuff] = { 0 }; - - if(bSave) - { - pT->GetDlgItemText(nID, szBuff, cchBuff); - double d = 0; - if(_AtlSimpleFloatParse(szBuff, d)) - nVal = (float)d; - else - bSuccess = FALSE; - } - else - { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); - bSuccess = pT->SetDlgItemText(nID, szBuff); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) - { - _XData data = { ddxDataFloat }; - data.floatData.nVal = (double)nVal; - data.floatData.nMin = (double)nMin; - data.floatData.nMax = (double)nMax; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - - BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - const int cchBuff = 32; - TCHAR szBuff[cchBuff] = { 0 }; - - if(bSave) - { - pT->GetDlgItemText(nID, szBuff, cchBuff); - double d = 0; - if(_AtlSimpleFloatParse(szBuff, d)) - nVal = d; - else - bSuccess = FALSE; - } - else - { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); - bSuccess = pT->SetDlgItemText(nID, szBuff); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) - { - _XData data = { ddxDataFloat }; - data.floatData.nVal = nVal; - data.floatData.nMin = nMin; - data.floatData.nMax = nMax; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } -#endif // _ATL_USE_DDX_FLOAT - -// Full control subclassing (for CWindowImpl derived controls) - template - void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave) - { - if(!bSave && ctrl.m_hWnd == NULL) - { - T* pT = static_cast(this); - ctrl.SubclassWindow(pT->GetDlgItem(nID)); - } - } - -// Simple control attaching (for HWND wrapper controls) - template - void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave) - { - if(!bSave && ctrl.m_hWnd == NULL) - { - T* pT = static_cast(this); - ctrl = pT->GetDlgItem(nID); - } - } - -// Control state - void DDX_Check(UINT nID, int& nValue, BOOL bSave) - { - T* pT = static_cast(this); - HWND hWndCtrl = pT->GetDlgItem(nID); - if(bSave) - { - nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L); - ATLASSERT(nValue >= 0 && nValue <= 2); - } - else - { - if(nValue < 0 || nValue > 2) - { - ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue); - nValue = 0; // default to off - } - ::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L); - } - } - - // variant that supports bool (checked/not-checked, no intermediate state) - void DDX_Check(UINT nID, bool& bCheck, BOOL bSave) - { - int nValue = bCheck ? 1 : 0; - DDX_Check(nID, nValue, bSave); - - if(bSave) - { - if(nValue == 2) - ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue); - bCheck = (nValue == 1); - } - } - - void DDX_Radio(UINT nID, int& nValue, BOOL bSave) - { - T* pT = static_cast(this); - HWND hWndCtrl = pT->GetDlgItem(nID); - ATLASSERT(hWndCtrl != NULL); - - // must be first in a group of auto radio buttons - ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP); - ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON); - - if(bSave) - nValue = -1; // value if none found - - // walk all children in group - int nButton = 0; - do - { - if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON) - { - // control in group is a radio button - if(bSave) - { - if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0) - { - ATLASSERT(nValue == -1); // only set once - nValue = nButton; - } - } - else - { - // select button - ::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L); - } - nButton++; - } - else - { - ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n")); - } - hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); - } - while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); - } - -// DDX support for Tab, Combo, ListBox and ListView selection index -#if (_MSC_VER >= 1300) - template - INT _getSel(TCtrl& tCtrl) - { - return tCtrl.GetCurSel(); - } - - template - void _setSel(TCtrl& tCtrl, INT iSel) - { - if(iSel < 0) - tCtrl.SetCurSel(-1); - else - tCtrl.SetCurSel(iSel); - } - -#ifdef __ATLCTRLS_H__ - // ListViewCtrl specialization - template <> - INT _getSel(WTL::CListViewCtrl& tCtrl) - { - return tCtrl.GetSelectedIndex(); - } - - template <> - void _setSel(WTL::CListViewCtrl& tCtrl, INT iSel) - { - if(iSel < 0) - tCtrl.SelectItem(-1); - else - tCtrl.SelectItem(iSel); - } -#endif // __ATLCTRLS_H__ - - template - void DDX_Index(UINT nID, INT& nVal, BOOL bSave) - { - T* pT = static_cast(this); - TCtrl ctrl(pT->GetDlgItem(nID)); - - if(bSave) - nVal = _getSel(ctrl); - else - _setSel(ctrl, nVal); - } -#endif // (_MSC_VER >= 1300) - -// Overrideables - void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/) - { - // Override to display an error message - ::MessageBeep((UINT)-1); - T* pT = static_cast(this); - ::SetFocus(pT->GetDlgItem(nCtrlID)); - } - - void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/) - { - // Override to display an error message - ::MessageBeep((UINT)-1); - T* pT = static_cast(this); - ::SetFocus(pT->GetDlgItem(nCtrlID)); - } -}; - -}; // namespace WTL - -#endif // __ATLDDX_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atldlgs.h b/GLideN64/src/GLideNUI-wtl/WTL/atldlgs.h deleted file mode 100644 index 7923b95..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atldlgs.h +++ /dev/null @@ -1,6386 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLDLGS_H__ -#define __ATLDLGS_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atldlgs.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atldlgs.h requires atlwin.h to be included first -#endif - -#include -#include - -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - #include -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CFileDialogImpl -// CFileDialog -// CFileDialogEx -// CMultiFileDialogImpl -// CMultiFileDialog -// CShellFileDialogImpl -// CShellFileOpenDialogImpl -// CShellFileOpenDialog -// CShellFileSaveDialogImpl -// CShellFileSaveDialog -// CFolderDialogImpl -// CFolderDialog -// CFontDialogImpl -// CFontDialog -// CRichEditFontDialogImpl -// CRichEditFontDialog -// CColorDialogImpl -// CColorDialog -// CPrintDialogImpl -// CPrintDialog -// CPrintDialogExImpl -// CPrintDialogEx -// CPageSetupDialogImpl -// CPageSetupDialog -// CFindReplaceDialogImpl -// CFindReplaceDialog -// -// CDialogBaseUnits -// CMemDlgTemplate -// CIndirectDialogImpl -// -// CPropertySheetWindow -// CPropertySheetImpl -// CPropertySheet -// CPropertyPageWindow -// CPropertyPageImpl -// CPropertyPage -// CAxPropertyPageImpl -// CAxPropertyPage -// -// CWizard97SheetWindow -// CWizard97SheetImpl -// CWizard97Sheet -// CWizard97PageWindow -// CWizard97PageImpl -// CWizard97ExteriorPageImpl -// CWizard97InteriorPageImpl -// -// CAeroWizardFrameWindow -// CAeroWizardFrameImpl -// CAeroWizardFrame -// CAeroWizardPageWindow -// CAeroWizardPageImpl -// CAeroWizardPage -// CAeroWizardAxPageImpl -// CAeroWizardAxPage -// -// CTaskDialogConfig -// CTaskDialogImpl -// CTaskDialog -// -// Global functions: -// AtlTaskDialog() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CFileDialogImpl - used for File Open or File Save As - -// compatibility with the old (vc6.0) headers -#if (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) - #ifndef CDSIZEOF_STRUCT - #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) - #endif - #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName) - #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName) - #ifdef UNICODE - #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400W - #else - #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A - #endif // !UNICODE -#endif // (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) - -#if !defined(_WIN32_WCE) && !defined(CDN_INCLUDEITEM) - #define CDN_INCLUDEITEM (CDN_FIRST - 0x0007) -#endif - -template -class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase -{ -public: -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - OPENFILENAMEEX m_ofn; -#else - OPENFILENAME m_ofn; -#endif - BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save - TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return - TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return - - CFileDialogImpl(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - { - memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL - m_szFileName[0] = _T('\0'); - m_szFileTitle[0] = _T('\0'); - - m_bOpenFileDialog = bOpenFileDialog; - -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - m_ofn.lStructSize = bOpenFileDialog ? sizeof(m_ofn) : sizeof(OPENFILENAME); -#else - m_ofn.lStructSize = sizeof(m_ofn); -#endif - -#if (_WIN32_WINNT >= 0x0500) - // adjust struct size if running on older version of Windows - if(AtlIsOldWindows()) - { - ATLASSERT(sizeof(m_ofn) > OPENFILENAME_SIZE_VERSION_400); // must be - m_ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - } -#endif // (_WIN32_WINNT >= 0x0500) - m_ofn.lpstrFile = m_szFileName; - m_ofn.nMaxFile = _MAX_PATH; - m_ofn.lpstrDefExt = lpszDefExt; - m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; - m_ofn.nMaxFileTitle = _MAX_FNAME; -#ifndef _WIN32_WCE - m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_ENABLESIZING; -#else // CE specific - m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK; -#endif // !_WIN32_WCE - m_ofn.lpstrFilter = lpszFilter; - m_ofn.hInstance = ModuleHelper::GetResourceInstance(); - m_ofn.lpfnHook = (LPOFNHOOKPROC)T::StartDialogProc; - m_ofn.hwndOwner = hWndParent; - - // setup initial file name - if(lpszFileName != NULL) - SecureHelper::strncpy_x(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_ofn.Flags & OFN_ENABLEHOOK) != 0); - ATLASSERT(m_ofn.lpfnHook != NULL); // can still be a user hook - - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - if(m_ofn.hwndOwner == NULL) // set only if not specified before - m_ofn.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (ATL::CDialogImplBase*)this); - - BOOL bRet; - if(m_bOpenFileDialog) -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - bRet = ::GetOpenFileNameEx(&m_ofn); - else - bRet = ::GetSaveFileName((LPOPENFILENAME)&m_ofn); -#else - bRet = ::GetOpenFileName(&m_ofn); - else - bRet = ::GetSaveFileName(&m_ofn); -#endif - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - -// Attributes - ATL::CWindow GetFileDialogWindow() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow(GetParent()); - } - - int GetFilePath(LPTSTR lpstrFilePath, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETFILEPATH, nLength, (LPARAM)lpstrFilePath); - } - - int GetFolderIDList(LPVOID lpBuff, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERIDLIST, nLength, (LPARAM)lpBuff); - } - - int GetFolderPath(LPTSTR lpstrFolderPath, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERPATH, nLength, (LPARAM)lpstrFolderPath); - } - - int GetSpec(LPTSTR lpstrSpec, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETSPEC, nLength, (LPARAM)lpstrSpec); - } - - void SetControlText(int nCtrlID, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - GetFileDialogWindow().SendMessage(CDM_SETCONTROLTEXT, nCtrlID, (LPARAM)lpstrText); - } - - void SetDefExt(LPCTSTR lpstrExt) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - GetFileDialogWindow().SendMessage(CDM_SETDEFEXT, 0, (LPARAM)lpstrExt); - } - - BOOL GetReadOnlyPref() const // return TRUE if readonly checked - { - return ((m_ofn.Flags & OFN_READONLY) != 0) ? TRUE : FALSE; - } - -// Operations - void HideControl(int nCtrlID) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - GetFileDialogWindow().SendMessage(CDM_HIDECONTROL, nCtrlID); - } - -// Special override for common dialogs - BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - GetFileDialogWindow().SendMessage(WM_COMMAND, MAKEWPARAM(IDCANCEL, 0)); - return TRUE; - } - -// Message map and handlers - BEGIN_MSG_MAP(CFileDialogImpl) - NOTIFY_CODE_HANDLER(CDN_FILEOK, _OnFileOK) - NOTIFY_CODE_HANDLER(CDN_FOLDERCHANGE, _OnFolderChange) - NOTIFY_CODE_HANDLER(CDN_HELP, _OnHelp) - NOTIFY_CODE_HANDLER(CDN_INITDONE, _OnInitDone) - NOTIFY_CODE_HANDLER(CDN_SELCHANGE, _OnSelChange) - NOTIFY_CODE_HANDLER(CDN_SHAREVIOLATION, _OnShareViolation) - NOTIFY_CODE_HANDLER(CDN_TYPECHANGE, _OnTypeChange) -#ifndef _WIN32_WCE - NOTIFY_CODE_HANDLER(CDN_INCLUDEITEM, _OnIncludeItem) -#endif // !_WIN32_WCE - END_MSG_MAP() - - LRESULT _OnFileOK(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - return !pT->OnFileOK((LPOFNOTIFY)pnmh); - } - - LRESULT _OnFolderChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnFolderChange((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnHelp(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnHelp((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnInitDone(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnInitDone((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnSelChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnSelChange((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnShareViolation(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - return pT->OnShareViolation((LPOFNOTIFY)pnmh); - } - - LRESULT _OnTypeChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnTypeChange((LPOFNOTIFY)pnmh); - return 0; - } - -#ifndef _WIN32_WCE - LRESULT _OnIncludeItem(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - return pT->OnIncludeItem((LPOFNOTIFYEX)pnmh); - } -#endif // !_WIN32_WCE - -// Overrideables - BOOL OnFileOK(LPOFNOTIFY /*lpon*/) - { - return TRUE; - } - - void OnFolderChange(LPOFNOTIFY /*lpon*/) - { - } - - void OnHelp(LPOFNOTIFY /*lpon*/) - { - } - - void OnInitDone(LPOFNOTIFY /*lpon*/) - { - } - - void OnSelChange(LPOFNOTIFY /*lpon*/) - { - } - - int OnShareViolation(LPOFNOTIFY /*lpon*/) - { - return 0; - } - - void OnTypeChange(LPOFNOTIFY /*lpon*/) - { - } - -#ifndef _WIN32_WCE - BOOL OnIncludeItem(LPOFNOTIFYEX /*lponex*/) - { - return TRUE; // include item - } -#endif // !_WIN32_WCE -}; - -class CFileDialog : public CFileDialogImpl -{ -public: - CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) - { } - - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() -}; - -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) -class CFileDialogEx : public CFileDialogImpl -{ -public: - CFileDialogEx( // Supports only FileOpen - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - OFN_EXFLAG ExFlags = OFN_EXFLAG_THUMBNAILVIEW, - OFN_SORTORDER dwSortOrder = OFN_SORTORDER_AUTO, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) - { - m_ofn.ExFlags = ExFlags; - m_ofn.dwSortOrder = dwSortOrder; - } - - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() -}; -#endif // defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - - -/////////////////////////////////////////////////////////////////////////////// -// Multi File Dialog - Multi-select File Open dialog - -#ifndef _WIN32_WCE - -// The class dynamically resizes the buffer as the file selection changes -// (as described in Knowledge Base article 131462). It also expands selected -// shortcut files to take into account the full path of the target file. -// Note that this doesn't work on Win9x for the old style dialogs, as well as -// on NT for non-Unicode builds. - -#ifndef _WTL_FIXED_OFN_BUFFER_LENGTH - #define _WTL_FIXED_OFN_BUFFER_LENGTH 0x10000 -#endif - -template -class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > -{ -public: - mutable LPCTSTR m_pNextFile; -#ifndef _UNICODE - bool m_bIsNT; -#endif - - CMultiFileDialogImpl( - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent), - m_pNextFile(NULL) - { - m_ofn.Flags |= OFN_ALLOWMULTISELECT; // Force multiple selection mode - -#ifndef _UNICODE - OSVERSIONINFO ovi = { sizeof(ovi) }; - ::GetVersionEx(&ovi); - m_bIsNT = (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT); - if (m_bIsNT) - { - // On NT platforms, GetOpenFileNameA thunks to GetOpenFileNameW and there - // is absolutely nothing we can do except to start off with a large buffer. - ATLVERIFY(ResizeFilenameBuffer(_WTL_FIXED_OFN_BUFFER_LENGTH)); - } -#endif - } - - ~CMultiFileDialogImpl() - { - if (m_ofn.lpstrFile != m_szFileName) // Free the buffer if we allocated it - delete[] m_ofn.lpstrFile; - } - -// Operations - // Get the directory that the files were chosen from. - // The function returns the number of characters copied, not including the terminating zero. - // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. - // If the function fails, the return value is zero. - int GetDirectory(LPTSTR pBuffer, int nBufLen) const - { - if (m_ofn.lpstrFile == NULL) - return 0; - - LPCTSTR pStr = m_ofn.lpstrFile; - int nLength = lstrlen(pStr); - if (pStr[nLength + 1] == 0) - { - // The OFN buffer contains a single item so extract its path. - LPCTSTR pSep = MinCrtHelper::_strrchr(pStr, _T('\\')); - if (pSep != NULL) - nLength = (int)(DWORD_PTR)(pSep - pStr); - } - - int nRet = 0; - if (pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLength + 1; - } - else if (nBufLen > nLength) - { - SecureHelper::strncpy_x(pBuffer, nBufLen, pStr, nLength); - nRet = nLength; - } - - return nRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetDirectory(_CSTRING_NS::CString& strDir) const - { - bool bRet = false; - - int nLength = GetDirectory(NULL, 0); - if (nLength > 0) - { - bRet = (GetDirectory(strDir.GetBuffer(nLength), nLength) > 0); - strDir.ReleaseBuffer(nLength - 1); - } - - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - // Get the first filename as a pointer into the buffer. - LPCTSTR GetFirstFileName() const - { - if (m_ofn.lpstrFile == NULL) - return NULL; - - m_pNextFile = NULL; // Reset internal buffer pointer - - LPCTSTR pStr = m_ofn.lpstrFile; - int nLength = lstrlen(pStr); - if (pStr[nLength + 1] != 0) - { - // Multiple items were selected. The first string is the directory, - // so skip forwards to the second string. - pStr += nLength + 1; - - // Set up m_pNext so it points to the second item (or null). - m_pNextFile = pStr; - GetNextFileName(); - } - else - { - // A single item was selected. Skip forward past the path. - LPCTSTR pSep = MinCrtHelper::_strrchr(pStr, _T('\\')); - if (pSep != NULL) - pStr = pSep + 1; - } - - return pStr; - } - - // Get the next filename as a pointer into the buffer. - LPCTSTR GetNextFileName() const - { - if (m_pNextFile == NULL) - return NULL; - - LPCTSTR pStr = m_pNextFile; - // Set "m_pNextFile" to point to the next file name, or null if we - // have reached the last file in the list. - int nLength = lstrlen(pStr); - m_pNextFile = (pStr[nLength + 1] != 0) ? &pStr[nLength + 1] : NULL; - - return pStr; - } - - // Get the first filename as a full path. - // The function returns the number of characters copied, not including the terminating zero. - // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. - // If the function fails, the return value is zero. - int GetFirstPathName(LPTSTR pBuffer, int nBufLen) const - { - LPCTSTR pStr = GetFirstFileName(); - int nLengthDir = GetDirectory(NULL, 0); - if((pStr == NULL) || (nLengthDir == 0)) - return 0; - - // Figure out the required length. - int nLengthTotal = nLengthDir + lstrlen(pStr); - - int nRet = 0; - if(pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLengthTotal + 1; - } - else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path - { - GetDirectory(pBuffer, nBufLen); - SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); - SecureHelper::strcat_x(pBuffer, nBufLen, pStr); - nRet = nLengthTotal; - } - - return nRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetFirstPathName(_CSTRING_NS::CString& strPath) const - { - bool bRet = false; - - int nLength = GetFirstPathName(NULL, 0); - if (nLength > 0) - { - bRet = (GetFirstPathName(strPath.GetBuffer(nLength), nLength) > 0); - strPath.ReleaseBuffer(nLength - 1); - } - - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - // Get the next filename as a full path. - // The function returns the number of characters copied, not including the terminating zero. - // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. - // If the function fails, the return value is zero. - // The internal position marker is moved forward only if the function succeeds and the buffer was large enough. - int GetNextPathName(LPTSTR pBuffer, int nBufLen) const - { - if (m_pNextFile == NULL) - return 0; - - int nRet = 0; - LPCTSTR pStr = m_pNextFile; - // Does the filename contain a backslash? - if (MinCrtHelper::_strrchr(pStr, _T('\\')) != NULL) - { - // Yes, so we'll assume it's a full path. - int nLength = lstrlen(pStr); - - if (pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLength + 1; - } - else if (nBufLen > nLength) // The buffer is big enough, so go ahead and copy the filename - { - SecureHelper::strcpy_x(pBuffer, nBufLen, GetNextFileName()); - nRet = nBufLen; - } - } - else - { - // The filename is relative, so construct the full path. - int nLengthDir = GetDirectory(NULL, 0); - if (nLengthDir > 0) - { - // Calculate the required space. - int nLengthTotal = nLengthDir + lstrlen(pStr); - - if(pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLengthTotal + 1; - } - else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path - { - GetDirectory(pBuffer, nBufLen); - SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); - SecureHelper::strcat_x(pBuffer, nBufLen, GetNextFileName()); - nRet = nLengthTotal; - } - } - } - - return nRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetNextPathName(_CSTRING_NS::CString& strPath) const - { - bool bRet = false; - - int nLength = GetNextPathName(NULL, 0); - if (nLength > 0) - { - bRet = (GetNextPathName(strPath.GetBuffer(nLength), nLength) > 0); - strPath.ReleaseBuffer(nLength - 1); - } - - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Implementation - bool ResizeFilenameBuffer(DWORD dwLength) - { - if (dwLength > m_ofn.nMaxFile) - { - // Free the old buffer. - if (m_ofn.lpstrFile != m_szFileName) - { - delete[] m_ofn.lpstrFile; - m_ofn.lpstrFile = NULL; - m_ofn.nMaxFile = 0; - } - - // Allocate the new buffer. - LPTSTR lpstrBuff = NULL; - ATLTRY(lpstrBuff = new TCHAR[dwLength]); - if (lpstrBuff != NULL) - { - m_ofn.lpstrFile = lpstrBuff; - m_ofn.lpstrFile[0] = 0; - m_ofn.nMaxFile = dwLength; - } - } - - return (m_ofn.lpstrFile != NULL); - } - - void OnSelChange(LPOFNOTIFY /*lpon*/) - { -#ifndef _UNICODE - // There is no point resizing the buffer in ANSI builds running on NT. - if (m_bIsNT) - return; -#endif - - // Get the buffer length required to hold the spec. - int nLength = GetSpec(NULL, 0); - if (nLength <= 1) - return; // no files are selected, presumably - - // Add room for the directory, and an extra terminating zero. - nLength += GetFolderPath(NULL, 0) + 1; - - if (!ResizeFilenameBuffer(nLength)) - { - ATLASSERT(FALSE); - return; - } - - // If we are not following links then our work is done. - if ((m_ofn.Flags & OFN_NODEREFERENCELINKS) != 0) - return; - - // Get the file spec, which is the text in the edit control. - if (GetSpec(m_ofn.lpstrFile, m_ofn.nMaxFile) <= 0) - return; - - // Get the ID-list of the current folder. - int nBytes = GetFolderIDList(NULL, 0); - CTempBuffer idlist; - idlist.AllocateBytes(nBytes); - if ((nBytes <= 0) || (GetFolderIDList(idlist, nBytes) <= 0)) - return; - - // First bind to the desktop folder, then to the current folder. - ATL::CComPtr pDesktop, pFolder; - if (FAILED(::SHGetDesktopFolder(&pDesktop))) - return; - if (FAILED(pDesktop->BindToObject(idlist, NULL, IID_IShellFolder, (void**)&pFolder))) - return; - - // Work through the file spec, looking for quoted filenames. If we find a shortcut file, then - // we need to add enough extra buffer space to hold its target path. - DWORD nExtraChars = 0; - bool bInsideQuotes = false; - LPCTSTR pAnchor = m_ofn.lpstrFile; - LPCTSTR pChar = m_ofn.lpstrFile; - for ( ; *pChar; ++pChar) - { - // Look for quotation marks. - if (*pChar == _T('\"')) - { - // We are either entering or leaving a passage of quoted text. - bInsideQuotes = !bInsideQuotes; - - // Is it an opening or closing quote? - if (bInsideQuotes) - { - // We found an opening quote, so set "pAnchor" to the following character. - pAnchor = pChar + 1; - } - else // closing quote - { - // Each quoted entity should be shorter than MAX_PATH. - if (pChar - pAnchor >= MAX_PATH) - return; - - // Get the ID-list and attributes of the file. - USES_CONVERSION; - int nFileNameLength = (int)(DWORD_PTR)(pChar - pAnchor); - TCHAR szFileName[MAX_PATH]; - SecureHelper::strncpy_x(szFileName, MAX_PATH, pAnchor, nFileNameLength); - LPITEMIDLIST pidl = NULL; - DWORD dwAttrib = SFGAO_LINK; - if (SUCCEEDED(pFolder->ParseDisplayName(NULL, NULL, T2W(szFileName), NULL, &pidl, &dwAttrib))) - { - // Is it a shortcut file? - if (dwAttrib & SFGAO_LINK) - { - // Bind to its IShellLink interface. - ATL::CComPtr pLink; - if (SUCCEEDED(pFolder->BindToObject(pidl, NULL, IID_IShellLink, (void**)&pLink))) - { - // Get the shortcut's target path. - TCHAR szPath[MAX_PATH]; - if (SUCCEEDED(pLink->GetPath(szPath, MAX_PATH, NULL, 0))) - { - // If the target path is longer than the shortcut name, then add on the number - // of extra characters that are required. - int nNewLength = lstrlen(szPath); - if (nNewLength > nFileNameLength) - nExtraChars += nNewLength - nFileNameLength; - } - } - } - - // Free the ID-list returned by ParseDisplayName. - ::CoTaskMemFree(pidl); - } - } - } - } - - // If we need more space for shortcut targets, then reallocate. - if (nExtraChars > 0) - ATLVERIFY(ResizeFilenameBuffer(m_ofn.nMaxFile + nExtraChars)); - } -}; - -class CMultiFileDialog : public CMultiFileDialogImpl -{ -public: - CMultiFileDialog( - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CMultiFileDialogImpl(lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) - { } - - BEGIN_MSG_MAP(CMultiFileDialog) - CHAIN_MSG_MAP(CMultiFileDialogImpl) - END_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// Shell File Dialog - new Shell File Open and Save dialogs in Vista - -// Note: Use GetPtr() to access dialog interface methods. -// Example: -// CShellFileOpenDialog dlg; -// dlg.GetPtr()->SetTitle(L"MyFileOpenDialog"); - -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileDialogImpl - base class for CShellFileOpenDialogImpl and CShellFileSaveDialogImpl - -template -class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents -{ -public: -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - INT_PTR nRet = -1; - - T* pT = static_cast(this); - if(pT->m_spFileDlg == NULL) - { - ATLASSERT(FALSE); - return nRet; - } - - DWORD dwCookie = 0; - pT->_Advise(dwCookie); - - HRESULT hRet = pT->m_spFileDlg->Show(hWndParent); - if(SUCCEEDED(hRet)) - nRet = IDOK; - else if(hRet == HRESULT_FROM_WIN32(ERROR_CANCELLED)) - nRet = IDCANCEL; - else - ATLASSERT(FALSE); // error - - pT->_Unadvise(dwCookie); - - return nRet; - } - - bool IsNull() const - { - const T* pT = static_cast(this); - return (pT->m_spFileDlg == NULL); - } - -// Operations - get file path after dialog returns - HRESULT GetFilePath(LPWSTR lpstrFilePath, int cchLength) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, lpstrFilePath, cchLength); - - return hRet; - } - - HRESULT GetFileTitle(LPWSTR lpstrFileTitle, int cchLength) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, lpstrFileTitle, cchLength); - - return hRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - HRESULT GetFilePath(_CSTRING_NS::CString& strFilePath) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, strFilePath); - - return hRet; - } - - HRESULT GetFileTitle(_CSTRING_NS::CString& strFileTitle) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, strFileTitle); - - return hRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Helpers for IShellItem - static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, LPWSTR lpstr, int cchLength) - { - ATLASSERT(pShellItem != NULL); - - LPWSTR lpstrName = NULL; - HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); - - if(SUCCEEDED(hRet)) - { - if(lstrlenW(lpstrName) < cchLength) - { - SecureHelper::strcpyW_x(lpstr, cchLength, lpstrName); - } - else - { - ATLASSERT(FALSE); - hRet = DISP_E_BUFFERTOOSMALL; - } - - ::CoTaskMemFree(lpstrName); - } - - return hRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, _CSTRING_NS::CString& str) - { - ATLASSERT(pShellItem != NULL); - - LPWSTR lpstrName = NULL; - HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); - - if(SUCCEEDED(hRet)) - { - str = lpstrName; - ::CoTaskMemFree(lpstrName); - } - - return hRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Implementation - void _Advise(DWORD& dwCookie) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - HRESULT hRet = pT->m_spFileDlg->Advise((IFileDialogEvents*)this, &dwCookie); - ATLVERIFY(SUCCEEDED(hRet)); - } - - void _Unadvise(DWORD dwCookie) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - HRESULT hRet = pT->m_spFileDlg->Unadvise(dwCookie); - ATLVERIFY(SUCCEEDED(hRet)); - } - - void _Init(LPCWSTR lpszFileName, DWORD dwOptions, LPCWSTR lpszDefExt, const COMDLG_FILTERSPEC* arrFilterSpec, UINT uFilterSpecCount) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - HRESULT hRet = E_FAIL; - - if(lpszFileName != NULL) - { - hRet = pT->m_spFileDlg->SetFileName(lpszFileName); - ATLASSERT(SUCCEEDED(hRet)); - } - - hRet = pT->m_spFileDlg->SetOptions(dwOptions); - ATLASSERT(SUCCEEDED(hRet)); - - if(lpszDefExt != NULL) - { - hRet = pT->m_spFileDlg->SetDefaultExtension(lpszDefExt); - ATLASSERT(SUCCEEDED(hRet)); - } - - if(arrFilterSpec != NULL && uFilterSpecCount != 0U) - { - hRet = pT->m_spFileDlg->SetFileTypes(uFilterSpecCount, arrFilterSpec); - ATLASSERT(SUCCEEDED(hRet)); - } - } - -// Implementation - IUnknown interface - STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) - { - if(ppvObject == NULL) - return E_POINTER; - - T* pT = static_cast(this); - if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IFileDialogEvents)) - { - *ppvObject = (IFileDialogEvents*)pT; - // AddRef() not needed - return S_OK; - } - - return E_NOINTERFACE; - } - - virtual ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - virtual ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - -// Implementation - IFileDialogEvents interface - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFileOk(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnFileOk(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChanging(IFileDialog* pfd, IShellItem* psiFolder) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnFolderChanging(psiFolder); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChange(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnFolderChange(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnSelectionChange(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnSelectionChange(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnShareViolation(IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnShareViolation(psi, pResponse); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnTypeChange(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnTypeChange(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnOverwrite(IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnOverwrite(psi, pResponse); - } - -// Overrideables - Event handlers - HRESULT OnFileOk() - { - return E_NOTIMPL; - } - - HRESULT OnFolderChanging(IShellItem* /*psiFolder*/) - { - return E_NOTIMPL; - } - - HRESULT OnFolderChange() - { - return E_NOTIMPL; - } - - HRESULT OnSelectionChange() - { - return E_NOTIMPL; - } - - HRESULT OnShareViolation(IShellItem* /*psi*/, FDE_SHAREVIOLATION_RESPONSE* /*pResponse*/) - { - return E_NOTIMPL; - } - - HRESULT OnTypeChange() - { - return E_NOTIMPL; - } - - HRESULT OnOverwrite(IShellItem* /*psi*/, FDE_OVERWRITE_RESPONSE* /*pResponse*/) - { - return E_NOTIMPL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileOpenDialogImpl - implements new Shell File Open dialog - -template -class ATL_NO_VTABLE CShellFileOpenDialogImpl : public CShellFileDialogImpl< T > -{ -public: - ATL::CComPtr m_spFileDlg; - - CShellFileOpenDialogImpl(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) - { - HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileOpenDialog); - - if(SUCCEEDED(hRet)) - _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); - } - - IFileOpenDialog* GetPtr() - { - return m_spFileDlg; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileOpenDialog - new Shell File Open dialog without events - -class CShellFileOpenDialog : public CShellFileOpenDialogImpl -{ -public: - CShellFileOpenDialog(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) : CShellFileOpenDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) - { } - -// Implementation (remove _Advise/_Unadvise code using template magic) - void _Advise(DWORD& /*dwCookie*/) - { } - - void _Unadvise(DWORD /*dwCookie*/) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileSaveDialogImpl - implements new Shell File Save dialog - -template -class ATL_NO_VTABLE CShellFileSaveDialogImpl : public CShellFileDialogImpl< T > -{ -public: - ATL::CComPtr m_spFileDlg; - - CShellFileSaveDialogImpl(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) - { - HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileSaveDialog); - - if(SUCCEEDED(hRet)) - _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); - } - - IFileSaveDialog* GetPtr() - { - return m_spFileDlg; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileSaveDialog - new Shell File Save dialog without events - -class CShellFileSaveDialog : public CShellFileSaveDialogImpl -{ -public: - CShellFileSaveDialog(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) : CShellFileSaveDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) - { } - -// Implementation (remove _Advise/_Unadvise code using template magic) - void _Advise(DWORD& /*dwCookie*/) - { } - - void _Unadvise(DWORD /*dwCookie*/) - { } -}; - -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CFolderDialogImpl - used for browsing for a folder - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CFolderDialogImpl -{ -public: - BROWSEINFO m_bi; - LPCTSTR m_lpstrInitialFolder; - LPCITEMIDLIST m_pidlInitialSelection; - bool m_bExpandInitialSelection; - TCHAR m_szFolderDisplayName[MAX_PATH]; - TCHAR m_szFolderPath[MAX_PATH]; - LPITEMIDLIST m_pidlSelected; - HWND m_hWnd; // used only in the callback function - -// Constructor - CFolderDialogImpl(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) : - m_lpstrInitialFolder(NULL), m_pidlInitialSelection(NULL), m_bExpandInitialSelection(false), m_pidlSelected(NULL), m_hWnd(NULL) - { - memset(&m_bi, 0, sizeof(m_bi)); // initialize structure to 0/NULL - - m_bi.hwndOwner = hWndParent; - m_bi.pidlRoot = NULL; - m_bi.pszDisplayName = m_szFolderDisplayName; - m_bi.lpszTitle = lpstrTitle; - m_bi.ulFlags = uFlags; - m_bi.lpfn = BrowseCallbackProc; - m_bi.lParam = (LPARAM)static_cast(this); - - m_szFolderPath[0] = 0; - m_szFolderDisplayName[0] = 0; - } - - ~CFolderDialogImpl() - { - ::CoTaskMemFree(m_pidlSelected); - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - if(m_bi.hwndOwner == NULL) // set only if not specified before - m_bi.hwndOwner = hWndParent; - - // Clear out any previous results - m_szFolderPath[0] = 0; - m_szFolderDisplayName[0] = 0; - ::CoTaskMemFree(m_pidlSelected); - - INT_PTR nRet = IDCANCEL; - m_pidlSelected = ::SHBrowseForFolder(&m_bi); - - if(m_pidlSelected != NULL) - { - nRet = IDOK; - - // If BIF_RETURNONLYFSDIRS is set, we try to get the filesystem path. - // Otherwise, the caller must handle the ID-list directly. - if((m_bi.ulFlags & BIF_RETURNONLYFSDIRS) != 0) - { - if(::SHGetPathFromIDList(m_pidlSelected, m_szFolderPath) == FALSE) - nRet = IDCANCEL; - } - } - - return nRet; - } - - // Methods to call before DoModal - void SetInitialFolder(LPCTSTR lpstrInitialFolder, bool bExpand = true) - { - // lpstrInitialFolder may be a file if BIF_BROWSEINCLUDEFILES is specified - m_lpstrInitialFolder = lpstrInitialFolder; - m_bExpandInitialSelection = bExpand; - } - - void SetInitialSelection(LPCITEMIDLIST pidl, bool bExpand = true) - { - m_pidlInitialSelection = pidl; - m_bExpandInitialSelection = bExpand; - } - - // Methods to call after DoModal - LPITEMIDLIST GetSelectedItem(bool bDetach = false) - { - LPITEMIDLIST pidl = m_pidlSelected; - if(bDetach) - m_pidlSelected = NULL; - - return pidl; - } - - LPCTSTR GetFolderPath() const - { - return m_szFolderPath; - } - - LPCTSTR GetFolderDisplayName() const - { - return m_szFolderDisplayName; - } - - int GetFolderImageIndex() const - { - return m_bi.iImage; - } - -// Callback function and overrideables - static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData) - { -#ifndef BFFM_VALIDATEFAILED - #ifdef UNICODE - const int BFFM_VALIDATEFAILED = 4; - #else - const int BFFM_VALIDATEFAILED = 3; - #endif -#endif // !BFFM_VALIDATEFAILED -#ifndef BFFM_IUNKNOWN - const int BFFM_IUNKNOWN = 5; -#endif // !BFFM_IUNKNOWN -#ifndef BIF_NEWDIALOGSTYLE - const UINT BIF_NEWDIALOGSTYLE = 0x0040; -#endif // !BIF_NEWDIALOGSTYLE - - int nRet = 0; - T* pT = (T*)lpData; - bool bClear = false; - if(pT->m_hWnd == NULL) - { - pT->m_hWnd = hWnd; - bClear = true; - } - else - { - ATLASSERT(pT->m_hWnd == hWnd); - } - - switch(uMsg) - { - case BFFM_INITIALIZED: - // Set initial selection - // Note that m_pidlInitialSelection, if set, takes precedence over m_lpstrInitialFolder - if(pT->m_pidlInitialSelection != NULL) - pT->SetSelection(pT->m_pidlInitialSelection); - else if(pT->m_lpstrInitialFolder != NULL) - pT->SetSelection(pT->m_lpstrInitialFolder); - - // Expand initial selection if appropriate - if(pT->m_bExpandInitialSelection && ((pT->m_bi.ulFlags & BIF_NEWDIALOGSTYLE) != 0)) - { - if(pT->m_pidlInitialSelection != NULL) - pT->SetExpanded(pT->m_pidlInitialSelection); - else if(pT->m_lpstrInitialFolder != NULL) - pT->SetExpanded(pT->m_lpstrInitialFolder); - } - pT->OnInitialized(); - break; - case BFFM_SELCHANGED: - pT->OnSelChanged((LPITEMIDLIST)lParam); - break; - case BFFM_VALIDATEFAILED: - nRet = pT->OnValidateFailed((LPCTSTR)lParam); - break; - case BFFM_IUNKNOWN: - pT->OnIUnknown((IUnknown*)lParam); - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown message received in CFolderDialogImpl::BrowseCallbackProc\n")); - break; - } - - if(bClear) - pT->m_hWnd = NULL; - return nRet; - } - - void OnInitialized() - { - } - - void OnSelChanged(LPITEMIDLIST /*pItemIDList*/) - { - } - - int OnValidateFailed(LPCTSTR /*lpstrFolderPath*/) - { - return 1; // 1=continue, 0=EndDialog - } - - void OnIUnknown(IUnknown* /*pUnknown*/) - { - } - - // Commands - valid to call only from handlers - void EnableOK(BOOL bEnable) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_ENABLEOK, 0, bEnable); - } - - void SetSelection(LPCITEMIDLIST pItemIDList) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETSELECTION, FALSE, (LPARAM)pItemIDList); - } - - void SetSelection(LPCTSTR lpstrFolderPath) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)lpstrFolderPath); - } - - void SetStatusText(LPCTSTR lpstrText) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)lpstrText); - } - - void SetOKText(LPCTSTR lpstrOKText) - { -#ifndef BFFM_SETOKTEXT - const UINT BFFM_SETOKTEXT = WM_USER + 105; -#endif - ATLASSERT(m_hWnd != NULL); - USES_CONVERSION; - LPCWSTR lpstr = T2CW(lpstrOKText); - ::SendMessage(m_hWnd, BFFM_SETOKTEXT, 0, (LPARAM)lpstr); - } - - void SetExpanded(LPCITEMIDLIST pItemIDList) - { -#ifndef BFFM_SETEXPANDED - const UINT BFFM_SETEXPANDED = WM_USER + 106; -#endif - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETEXPANDED, FALSE, (LPARAM)pItemIDList); - } - - void SetExpanded(LPCTSTR lpstrFolderPath) - { -#ifndef BFFM_SETEXPANDED - const UINT BFFM_SETEXPANDED = WM_USER + 106; -#endif - ATLASSERT(m_hWnd != NULL); - USES_CONVERSION; - LPCWSTR lpstr = T2CW(lpstrFolderPath); - ::SendMessage(m_hWnd, BFFM_SETEXPANDED, TRUE, (LPARAM)lpstr); - } -}; - -class CFolderDialog : public CFolderDialogImpl -{ -public: - CFolderDialog(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) - : CFolderDialogImpl(hWndParent, lpstrTitle, uFlags) - { } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CCommonDialogImplBase - base class for common dialog classes - -class ATL_NO_VTABLE CCommonDialogImplBase : public ATL::CWindowImplBase -{ -public: - static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - if(uMsg != WM_INITDIALOG) - return 0; - CCommonDialogImplBase* pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); - ATLASSERT(pT != NULL); - ATLASSERT(pT->m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - // subclass dialog's window - if(!pT->SubclassWindow(hWnd)) - { - ATLTRACE2(atlTraceUI, 0, _T("Subclassing a common dialog failed\n")); - return 0; - } - // check message map for WM_INITDIALOG handler - LRESULT lRes = 0; - if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) - return 0; - return lRes; - } - -// Special override for common dialogs - BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); - return TRUE; - } - -// Implementation - try to override these, to prevent errors - HWND Create(HWND, ATL::_U_RECT, LPCTSTR, DWORD, DWORD, ATL::_U_MENUorID, ATOM, LPVOID) - { - ATLASSERT(FALSE); // should not be called - return NULL; - } - - static LRESULT CALLBACK StartWindowProc(HWND /*hWnd*/, UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) - { - ATLASSERT(FALSE); // should not be called - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CFontDialogImpl - font selection dialog - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase -{ -public: - enum { _cchStyleName = 64 }; - - CHOOSEFONT m_cf; - TCHAR m_szStyleName[_cchStyleName]; // contains style name after return - LOGFONT m_lf; // default LOGFONT to store the info - -// Constructors - CFontDialogImpl(LPLOGFONT lplfInitial = NULL, - DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - { - memset(&m_cf, 0, sizeof(m_cf)); - memset(&m_lf, 0, sizeof(m_lf)); - memset(&m_szStyleName, 0, sizeof(m_szStyleName)); - - m_cf.lStructSize = sizeof(m_cf); - m_cf.hwndOwner = hWndParent; - m_cf.rgbColors = RGB(0, 0, 0); - m_cf.lpszStyle = (LPTSTR)&m_szStyleName; - m_cf.Flags = dwFlags | CF_ENABLEHOOK; - m_cf.lpfnHook = (LPCFHOOKPROC)T::HookProc; - - if(lplfInitial != NULL) - { - m_cf.lpLogFont = lplfInitial; - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - m_lf = *lplfInitial; - } - else - { - m_cf.lpLogFont = &m_lf; - } - - if(hDCPrinter != NULL) - { - m_cf.hDC = hDCPrinter; - m_cf.Flags |= CF_PRINTERFONTS; - } - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_cf.Flags & CF_ENABLEHOOK) != 0); - ATLASSERT(m_cf.lpfnHook != NULL); // can still be a user hook - - if(m_cf.hwndOwner == NULL) // set only if not specified before - m_cf.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::ChooseFont(&m_cf); - - m_hWnd = NULL; - - if(bRet) // copy logical font from user's initialization buffer (if needed) - SecureHelper::memcpy_x(&m_lf, sizeof(m_lf), m_cf.lpLogFont, sizeof(m_lf)); - - return bRet ? IDOK : IDCANCEL; - } - - // works only when the dialog is dislayed or after - void GetCurrentFont(LPLOGFONT lplf) const - { - ATLASSERT(lplf != NULL); - - if(m_hWnd != NULL) - ::SendMessage(m_hWnd, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM)lplf); - else - *lplf = m_lf; - } - - // works only when the dialog is dislayed or before -#ifndef _WIN32_WCE - void SetLogFont(LPLOGFONT lplf) - { - ATLASSERT(lplf != NULL); -#ifndef WM_CHOOSEFONT_SETLOGFONT - const UINT WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101); -#endif - if(m_hWnd != NULL) - { - ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETLOGFONT, 0, (LPARAM)lplf); - } - else - { - m_lf = *lplf; - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - } - } - - void SetFlags(DWORD dwFlags) - { -#ifndef WM_CHOOSEFONT_SETFLAGS - const UINT WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102); -#endif - if(m_hWnd != NULL) - { - CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; - cf.Flags = dwFlags; - ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETFLAGS, 0, (LPARAM)&cf); - } - else - { - m_cf.Flags = dwFlags; - } - } -#endif // !_WIN32_WCE - - // Helpers for parsing information after successful return - LPCTSTR GetFaceName() const // return the face name of the font - { - return (LPCTSTR)m_cf.lpLogFont->lfFaceName; - } - - LPCTSTR GetStyleName() const // return the style name of the font - { - return m_cf.lpszStyle; - } - - int GetSize() const // return the pt size of the font - { - return m_cf.iPointSize; - } - - COLORREF GetColor() const // return the color of the font - { - return m_cf.rgbColors; - } - - int GetWeight() const // return the chosen font weight - { - return (int)m_cf.lpLogFont->lfWeight; - } - - BOOL IsStrikeOut() const // return TRUE if strikeout - { - return (m_cf.lpLogFont->lfStrikeOut) ? TRUE : FALSE; - } - - BOOL IsUnderline() const // return TRUE if underline - { - return (m_cf.lpLogFont->lfUnderline) ? TRUE : FALSE; - } - - BOOL IsBold() const // return TRUE if bold font - { - return (m_cf.lpLogFont->lfWeight == FW_BOLD) ? TRUE : FALSE; - } - - BOOL IsItalic() const // return TRUE if italic font - { - return m_cf.lpLogFont->lfItalic ? TRUE : FALSE; - } -}; - -class CFontDialog : public CFontDialogImpl -{ -public: - CFontDialog(LPLOGFONT lplfInitial = NULL, - DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - : CFontDialogImpl(lplfInitial, dwFlags, hDCPrinter, hWndParent) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditFontDialogImpl - font selection for the Rich Edit ctrl - -#if defined(_RICHEDIT_) && !defined(_WIN32_WCE) - -template -class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > -{ -public: - CRichEditFontDialogImpl(const CHARFORMAT& charformat, - DWORD dwFlags = CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - : CFontDialogImpl< T >(NULL, dwFlags, hDCPrinter, hWndParent) - { - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - m_cf.Flags |= FillInLogFont(charformat); - m_cf.lpLogFont = &m_lf; - - if((charformat.dwMask & CFM_COLOR) != 0) - m_cf.rgbColors = charformat.crTextColor; - } - - void GetCharFormat(CHARFORMAT& cf) const - { - USES_CONVERSION; - cf.dwEffects = 0; - cf.dwMask = 0; - if((m_cf.Flags & CF_NOSTYLESEL) == 0) - { - cf.dwMask |= CFM_BOLD | CFM_ITALIC; - cf.dwEffects |= IsBold() ? CFE_BOLD : 0; - cf.dwEffects |= IsItalic() ? CFE_ITALIC : 0; - } - if((m_cf.Flags & CF_NOSIZESEL) == 0) - { - cf.dwMask |= CFM_SIZE; - // GetSize() returns in tenths of points so mulitply by 2 to get twips - cf.yHeight = GetSize() * 2; - } - - if((m_cf.Flags & CF_NOFACESEL) == 0) - { - cf.dwMask |= CFM_FACE; - cf.bPitchAndFamily = m_cf.lpLogFont->lfPitchAndFamily; -#if (_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(cf.szFaceName, _countof(cf.szFaceName), GetFaceName()); -#else // !(_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpyA_x(cf.szFaceName, _countof(cf.szFaceName), T2A((LPTSTR)(LPCTSTR)GetFaceName())); -#endif // !(_RICHEDIT_VER >= 0x0200) - } - - if((m_cf.Flags & CF_EFFECTS) != 0) - { - cf.dwMask |= CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR; - cf.dwEffects |= IsUnderline() ? CFE_UNDERLINE : 0; - cf.dwEffects |= IsStrikeOut() ? CFE_STRIKEOUT : 0; - cf.crTextColor = GetColor(); - } - if((m_cf.Flags & CF_NOSCRIPTSEL) == 0) - { - cf.bCharSet = m_cf.lpLogFont->lfCharSet; - cf.dwMask |= CFM_CHARSET; - } - cf.yOffset = 0; - } - - DWORD FillInLogFont(const CHARFORMAT& cf) - { - USES_CONVERSION; - DWORD dwFlags = 0; - if((cf.dwMask & CFM_SIZE) != 0) - { - HDC hDC = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL); - LONG yPerInch = ::GetDeviceCaps(hDC, LOGPIXELSY); - m_lf.lfHeight = -(int)((cf.yHeight * yPerInch) / 1440); - } - else - m_lf.lfHeight = 0; - - m_lf.lfWidth = 0; - m_lf.lfEscapement = 0; - m_lf.lfOrientation = 0; - - if((cf.dwMask & (CFM_ITALIC | CFM_BOLD)) == (CFM_ITALIC | CFM_BOLD)) - { - m_lf.lfWeight = ((cf.dwEffects & CFE_BOLD) != 0) ? FW_BOLD : FW_NORMAL; - m_lf.lfItalic = (BYTE)(((cf.dwEffects & CFE_ITALIC) != 0) ? TRUE : FALSE); - } - else - { - dwFlags |= CF_NOSTYLESEL; - m_lf.lfWeight = FW_DONTCARE; - m_lf.lfItalic = FALSE; - } - - if((cf.dwMask & (CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR)) == (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) - { - dwFlags |= CF_EFFECTS; - m_lf.lfUnderline = (BYTE)(((cf.dwEffects & CFE_UNDERLINE) != 0) ? TRUE : FALSE); - m_lf.lfStrikeOut = (BYTE)(((cf.dwEffects & CFE_STRIKEOUT) != 0) ? TRUE : FALSE); - } - else - { - m_lf.lfUnderline = (BYTE)FALSE; - m_lf.lfStrikeOut = (BYTE)FALSE; - } - - if((cf.dwMask & CFM_CHARSET) != 0) - m_lf.lfCharSet = cf.bCharSet; - else - dwFlags |= CF_NOSCRIPTSEL; - m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS; - m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; - m_lf.lfQuality = DEFAULT_QUALITY; - if((cf.dwMask & CFM_FACE) != 0) - { - m_lf.lfPitchAndFamily = cf.bPitchAndFamily; -#if (_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), cf.szFaceName); -#else // !(_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), A2T((LPSTR)cf.szFaceName)); -#endif // !(_RICHEDIT_VER >= 0x0200) - } - else - { - m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; - m_lf.lfFaceName[0] = (TCHAR)0; - } - return dwFlags; - } -}; - -class CRichEditFontDialog : public CRichEditFontDialogImpl -{ -public: - CRichEditFontDialog(const CHARFORMAT& charformat, - DWORD dwFlags = CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - : CRichEditFontDialogImpl(charformat, dwFlags, hDCPrinter, hWndParent) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // defined(_RICHEDIT_) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CColorDialogImpl - color selection - -#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) - -#ifdef _WIN32_WCE - #pragma comment(lib, "commdlg.lib") - - #ifndef SETRGBSTRING - #define SETRGBSTRING _T("commdlg_SetRGBColor") - #endif - - #ifndef COLOROKSTRING - #define COLOROKSTRING _T("commdlg_ColorOK") - #endif -#endif - -template -class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase -{ -public: - CHOOSECOLOR m_cc; - -// Constructor - CColorDialogImpl(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) - { - memset(&m_cc, 0, sizeof(m_cc)); - - m_cc.lStructSize = sizeof(m_cc); - m_cc.lpCustColors = GetCustomColors(); - m_cc.hwndOwner = hWndParent; - m_cc.Flags = dwFlags | CC_ENABLEHOOK; - m_cc.lpfnHook = (LPCCHOOKPROC)T::HookProc; - - if(clrInit != 0) - { - m_cc.rgbResult = clrInit; - m_cc.Flags |= CC_RGBINIT; - } - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_cc.Flags & CC_ENABLEHOOK) != 0); - ATLASSERT(m_cc.lpfnHook != NULL); // can still be a user hook - - if(m_cc.hwndOwner == NULL) // set only if not specified before - m_cc.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::ChooseColor(&m_cc); - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - - // Set the current color while dialog is displayed - void SetCurrentColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - SendMessage(_GetSetRGBMessage(), 0, (LPARAM)clr); - } - - // Get the selected color after DoModal returns, or in OnColorOK - COLORREF GetColor() const - { - return m_cc.rgbResult; - } - -// Special override for the color dialog - static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - if(uMsg != WM_INITDIALOG && uMsg != _GetColorOKMessage()) - return 0; - - LPCHOOSECOLOR lpCC = (LPCHOOSECOLOR)lParam; - CCommonDialogImplBase* pT = NULL; - - if(uMsg == WM_INITDIALOG) - { - pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); - lpCC->lCustData = (LPARAM)pT; - ATLASSERT(pT != NULL); - ATLASSERT(pT->m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - // subclass dialog's window - if(!pT->SubclassWindow(hWnd)) - { - ATLTRACE2(atlTraceUI, 0, _T("Subclassing a Color common dialog failed\n")); - return 0; - } - } - else if(uMsg == _GetColorOKMessage()) - { - pT = (CCommonDialogImplBase*)lpCC->lCustData; - ATLASSERT(pT != NULL); - ATLASSERT(::IsWindow(pT->m_hWnd)); - } - - // pass to the message map - LRESULT lRes; - if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) - return 0; - return lRes; - } - -// Helpers - static COLORREF* GetCustomColors() - { - static COLORREF rgbCustomColors[16] = - { - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - }; - - return rgbCustomColors; - } - - static UINT _GetSetRGBMessage() - { - static UINT uSetRGBMessage = 0; - if(uSetRGBMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetSetRGBMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uSetRGBMessage == 0) - uSetRGBMessage = ::RegisterWindowMessage(SETRGBSTRING); - - lock.Unlock(); - } - ATLASSERT(uSetRGBMessage != 0); - return uSetRGBMessage; - } - - static UINT _GetColorOKMessage() - { - static UINT uColorOKMessage = 0; - if(uColorOKMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetColorOKMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uColorOKMessage == 0) - uColorOKMessage = ::RegisterWindowMessage(COLOROKSTRING); - - lock.Unlock(); - } - ATLASSERT(uColorOKMessage != 0); - return uColorOKMessage; - } - -// Message map and handlers - BEGIN_MSG_MAP(CColorDialogImpl) - MESSAGE_HANDLER(_GetColorOKMessage(), _OnColorOK) - END_MSG_MAP() - - LRESULT _OnColorOK(UINT, WPARAM, LPARAM, BOOL&) - { - T* pT = static_cast(this); - return pT->OnColorOK(); - } - -// Overrideable - BOOL OnColorOK() // validate color - { - return FALSE; - } -}; - -class CColorDialog : public CColorDialogImpl -{ -public: - CColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) - : CColorDialogImpl(clrInit, dwFlags, hWndParent) - { } - - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintDialogImpl - used for Print... and PrintSetup... - -#ifndef _WIN32_WCE - -// global helper -static HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) -{ - if(hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDevNames = (LPDEVNAMES)::GlobalLock(hDevNames); - LPDEVMODE lpDevMode = (hDevMode != NULL) ? (LPDEVMODE)::GlobalLock(hDevMode) : NULL; - - if(lpDevNames == NULL) - return NULL; - - HDC hDC = ::CreateDC((LPCTSTR)lpDevNames + lpDevNames->wDriverOffset, - (LPCTSTR)lpDevNames + lpDevNames->wDeviceOffset, - (LPCTSTR)lpDevNames + lpDevNames->wOutputOffset, - lpDevMode); - - ::GlobalUnlock(hDevNames); - if(hDevMode != NULL) - ::GlobalUnlock(hDevMode); - return hDC; -} - -template -class ATL_NO_VTABLE CPrintDialogImpl : public CCommonDialogImplBase -{ -public: - // print dialog parameter block (note this is a reference) - PRINTDLG& m_pd; - -// Constructors - CPrintDialogImpl(BOOL bPrintSetupOnly = FALSE, // TRUE for Print Setup, FALSE for Print Dialog - DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, - HWND hWndParent = NULL) - : m_pd(m_pdActual) - { - memset(&m_pdActual, 0, sizeof(m_pdActual)); - - m_pd.lStructSize = sizeof(m_pdActual); - m_pd.hwndOwner = hWndParent; - m_pd.Flags = (dwFlags | PD_ENABLEPRINTHOOK | PD_ENABLESETUPHOOK); - m_pd.lpfnPrintHook = (LPPRINTHOOKPROC)T::HookProc; - m_pd.lpfnSetupHook = (LPSETUPHOOKPROC)T::HookProc; - - if(bPrintSetupOnly) - m_pd.Flags |= PD_PRINTSETUP; - else - m_pd.Flags |= PD_RETURNDC; - - m_pd.Flags &= ~PD_RETURNIC; // do not support information context - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_pd.Flags & PD_ENABLEPRINTHOOK) != 0); - ATLASSERT((m_pd.Flags & PD_ENABLESETUPHOOK) != 0); - ATLASSERT(m_pd.lpfnPrintHook != NULL); // can still be a user hook - ATLASSERT(m_pd.lpfnSetupHook != NULL); // can still be a user hook - ATLASSERT((m_pd.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this - - if(m_pd.hwndOwner == NULL) // set only if not specified before - m_pd.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::PrintDlg(&m_pd); - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - - // GetDefaults will not display a dialog but will get device defaults - BOOL GetDefaults() - { - m_pd.Flags |= PD_RETURNDEFAULT; - ATLASSERT(m_pd.hDevMode == NULL); // must be NULL - ATLASSERT(m_pd.hDevNames == NULL); // must be NULL - - return ::PrintDlg(&m_pd); - } - - // Helpers for parsing information after successful return num. copies requested - int GetCopies() const - { - if((m_pd.Flags & PD_USEDEVMODECOPIES) != 0) - { - LPDEVMODE lpDevMode = GetDevMode(); - return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; - } - - return m_pd.nCopies; - } - - BOOL PrintCollate() const // TRUE if collate checked - { - return ((m_pd.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; - } - - BOOL PrintSelection() const // TRUE if printing selection - { - return ((m_pd.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; - } - - BOOL PrintAll() const // TRUE if printing all pages - { - return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; - } - - BOOL PrintRange() const // TRUE if printing page range - { - return ((m_pd.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; - } - - BOOL PrintToFile() const // TRUE if printing to a file - { - return ((m_pd.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; - } - - int GetFromPage() const // starting page if valid - { - return PrintRange() ? m_pd.nFromPage : -1; - } - - int GetToPage() const // ending page if valid - { - return PrintRange() ? m_pd.nToPage : -1; - } - - LPDEVMODE GetDevMode() const // return DEVMODE - { - if(m_pd.hDevMode == NULL) - return NULL; - - return (LPDEVMODE)::GlobalLock(m_pd.hDevMode); - } - - LPCTSTR GetDriverName() const // return driver name - { - if(m_pd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDriverOffset; - } - - LPCTSTR GetDeviceName() const // return device name - { - if(m_pd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDeviceOffset; - } - - LPCTSTR GetPortName() const // return output port name - { - if(m_pd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wOutputOffset; - } - - HDC GetPrinterDC() const // return HDC (caller must delete) - { - ATLASSERT((m_pd.Flags & PD_RETURNDC) != 0); - return m_pd.hDC; - } - - // This helper creates a DC based on the DEVNAMES and DEVMODE structures. - // This DC is returned, but also stored in m_pd.hDC as though it had been - // returned by CommDlg. It is assumed that any previously obtained DC - // has been/will be deleted by the user. This may be - // used without ever invoking the print/print setup dialogs. - HDC CreatePrinterDC() - { - m_pd.hDC = _AtlCreateDC(m_pd.hDevNames, m_pd.hDevMode); - return m_pd.hDC; - } - -// Implementation - PRINTDLG m_pdActual; // the Print/Print Setup need to share this - - // The following handle the case of print setup... from the print dialog - CPrintDialogImpl(PRINTDLG& pdInit) : m_pd(pdInit) - { } - - BEGIN_MSG_MAP(CPrintDialogImpl) -#ifdef psh1 - COMMAND_ID_HANDLER(psh1, OnPrintSetup) // print setup button when print is displayed -#else // !psh1 - COMMAND_ID_HANDLER(0x0400, OnPrintSetup) // value from dlgs.h -#endif // !psh1 - END_MSG_MAP() - - LRESULT OnPrintSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/) - { - T dlgSetup(m_pd); - ModuleHelper::AddCreateWndData(&dlgSetup.m_thunk.cd, (CCommonDialogImplBase*)&dlgSetup); - return DefWindowProc(WM_COMMAND, MAKEWPARAM(wID, wNotifyCode), (LPARAM)hWndCtl); - } -}; - -class CPrintDialog : public CPrintDialogImpl -{ -public: - CPrintDialog(BOOL bPrintSetupOnly = FALSE, - DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, - HWND hWndParent = NULL) - : CPrintDialogImpl(bPrintSetupOnly, dwFlags, hWndParent) - { } - - CPrintDialog(PRINTDLG& pdInit) : CPrintDialogImpl(pdInit) - { } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintDialogExImpl - new print dialog for Windows 2000 - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - -}; // namespace WTL - -#include - -extern "C" const __declspec(selectany) IID IID_IPrintDialogCallback = {0x5852a2c3, 0x6530, 0x11d1, {0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; -extern "C" const __declspec(selectany) IID IID_IPrintDialogServices = {0x509aaeda, 0x5639, 0x11d1, {0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; - -namespace WTL -{ - -template -class ATL_NO_VTABLE CPrintDialogExImpl : - public ATL::CWindow, - public ATL::CMessageMap, - public IPrintDialogCallback, - public ATL::IObjectWithSiteImpl< T > -{ -public: - PRINTDLGEX m_pdex; - -// Constructor - CPrintDialogExImpl(DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, - HWND hWndParent = NULL) - { - memset(&m_pdex, 0, sizeof(m_pdex)); - - m_pdex.lStructSize = sizeof(PRINTDLGEX); - m_pdex.hwndOwner = hWndParent; - m_pdex.Flags = dwFlags; - m_pdex.nStartPage = START_PAGE_GENERAL; - // callback object will be set in DoModal - - m_pdex.Flags &= ~PD_RETURNIC; // do not support information context - } - -// Operations - HRESULT DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT((m_pdex.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this - - if(m_pdex.hwndOwner == NULL) // set only if not specified before - m_pdex.hwndOwner = hWndParent; - - T* pT = static_cast(this); - m_pdex.lpCallback = (IUnknown*)(IPrintDialogCallback*)pT; - - HRESULT hResult = ::PrintDlgEx(&m_pdex); - - m_hWnd = NULL; - - return hResult; - } - - BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); - return TRUE; - } - - // GetDefaults will not display a dialog but will get device defaults - HRESULT GetDefaults() - { - m_pdex.Flags |= PD_RETURNDEFAULT; - ATLASSERT(m_pdex.hDevMode == NULL); // must be NULL - ATLASSERT(m_pdex.hDevNames == NULL); // must be NULL - - return ::PrintDlgEx(&m_pdex); - } - - // Helpers for parsing information after successful return num. copies requested - int GetCopies() const - { - if((m_pdex.Flags & PD_USEDEVMODECOPIES) != 0) - { - LPDEVMODE lpDevMode = GetDevMode(); - return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; - } - - return m_pdex.nCopies; - } - - BOOL PrintCollate() const // TRUE if collate checked - { - return ((m_pdex.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; - } - - BOOL PrintSelection() const // TRUE if printing selection - { - return ((m_pdex.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; - } - - BOOL PrintAll() const // TRUE if printing all pages - { - return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; - } - - BOOL PrintRange() const // TRUE if printing page range - { - return ((m_pdex.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; - } - - BOOL PrintToFile() const // TRUE if printing to a file - { - return ((m_pdex.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; - } - - LPDEVMODE GetDevMode() const // return DEVMODE - { - if(m_pdex.hDevMode == NULL) - return NULL; - - return (LPDEVMODE)::GlobalLock(m_pdex.hDevMode); - } - - LPCTSTR GetDriverName() const // return driver name - { - if(m_pdex.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDriverOffset; - } - - LPCTSTR GetDeviceName() const // return device name - { - if(m_pdex.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDeviceOffset; - } - - LPCTSTR GetPortName() const // return output port name - { - if(m_pdex.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wOutputOffset; - } - - HDC GetPrinterDC() const // return HDC (caller must delete) - { - ATLASSERT((m_pdex.Flags & PD_RETURNDC) != 0); - return m_pdex.hDC; - } - - // This helper creates a DC based on the DEVNAMES and DEVMODE structures. - // This DC is returned, but also stored in m_pdex.hDC as though it had been - // returned by CommDlg. It is assumed that any previously obtained DC - // has been/will be deleted by the user. This may be - // used without ever invoking the print/print setup dialogs. - HDC CreatePrinterDC() - { - m_pdex.hDC = _AtlCreateDC(m_pdex.hDevNames, m_pdex.hDevMode); - return m_pdex.hDC; - } - -// Implementation - interfaces - -// IUnknown - STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) - { - if(ppvObject == NULL) - return E_POINTER; - - T* pT = static_cast(this); - if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IPrintDialogCallback)) - { - *ppvObject = (IPrintDialogCallback*)pT; - // AddRef() not needed - return S_OK; - } - else if(IsEqualGUID(riid, IID_IObjectWithSite)) - { - *ppvObject = (IObjectWithSite*)pT; - // AddRef() not needed - return S_OK; - } - - return E_NOINTERFACE; - } - - virtual ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - virtual ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - -// IPrintDialogCallback - STDMETHOD(InitDone)() - { - return S_FALSE; - } - - STDMETHOD(SelectionChange)() - { - return S_FALSE; - } - - STDMETHOD(HandleMessage)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* plResult) - { - // set up m_hWnd the first time - if(m_hWnd == NULL) - Attach(hWnd); - - // call message map - HRESULT hRet = ProcessWindowMessage(hWnd, uMsg, wParam, lParam, *plResult, 0) ? S_OK : S_FALSE; - if(hRet == S_OK && uMsg == WM_NOTIFY) // return in DWLP_MSGRESULT - ::SetWindowLongPtr(GetParent(), DWLP_MSGRESULT, (LONG_PTR)*plResult); - - if(uMsg == WM_INITDIALOG && hRet == S_OK && (BOOL)*plResult != FALSE) - hRet = S_FALSE; - - return hRet; - } -}; - -class CPrintDialogEx : public CPrintDialogExImpl -{ -public: - CPrintDialogEx( - DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, - HWND hWndParent = NULL) - : CPrintDialogExImpl(dwFlags, hWndParent) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CPageSetupDialogImpl - Page Setup dialog - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase -{ -public: - PAGESETUPDLG m_psd; - ATL::CWndProcThunk m_thunkPaint; - -// Constructors - CPageSetupDialogImpl(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) - { - memset(&m_psd, 0, sizeof(m_psd)); - - m_psd.lStructSize = sizeof(m_psd); - m_psd.hwndOwner = hWndParent; - m_psd.Flags = (dwFlags | PSD_ENABLEPAGESETUPHOOK | PSD_ENABLEPAGEPAINTHOOK); - m_psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)T::HookProc; - m_thunkPaint.Init((WNDPROC)T::PaintHookProc, this); -#if (_ATL_VER >= 0x0700) - m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)m_thunkPaint.GetWNDPROC(); -#else - m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)&(m_thunkPaint.thunk); -#endif - } - - DECLARE_EMPTY_MSG_MAP() - -// Attributes - LPDEVMODE GetDevMode() const // return DEVMODE - { - if(m_psd.hDevMode == NULL) - return NULL; - - return (LPDEVMODE)::GlobalLock(m_psd.hDevMode); - } - - LPCTSTR GetDriverName() const // return driver name - { - if(m_psd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); - return (LPCTSTR)lpDev + lpDev->wDriverOffset; - } - - LPCTSTR GetDeviceName() const // return device name - { - if(m_psd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); - return (LPCTSTR)lpDev + lpDev->wDeviceOffset; - } - - LPCTSTR GetPortName() const // return output port name - { - if(m_psd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); - return (LPCTSTR)lpDev + lpDev->wOutputOffset; - } - - HDC CreatePrinterDC() - { - return _AtlCreateDC(m_psd.hDevNames, m_psd.hDevMode); - } - - SIZE GetPaperSize() const - { - SIZE size; - size.cx = m_psd.ptPaperSize.x; - size.cy = m_psd.ptPaperSize.y; - return size; - } - - void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const - { - if(lpRectMargins != NULL) - *lpRectMargins = m_psd.rtMargin; - if(lpRectMinMargins != NULL) - *lpRectMinMargins = m_psd.rtMinMargin; - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_psd.Flags & PSD_ENABLEPAGESETUPHOOK) != 0); - ATLASSERT((m_psd.Flags & PSD_ENABLEPAGEPAINTHOOK) != 0); - ATLASSERT(m_psd.lpfnPageSetupHook != NULL); // can still be a user hook - ATLASSERT(m_psd.lpfnPagePaintHook != NULL); // can still be a user hook - - if(m_psd.hwndOwner == NULL) // set only if not specified before - m_psd.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::PageSetupDlg(&m_psd); - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - -// Implementation - static UINT_PTR CALLBACK PaintHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - T* pT = (T*)hWnd; - UINT_PTR uRet = 0; - switch(uMsg) - { - case WM_PSD_PAGESETUPDLG: - uRet = pT->PreDrawPage(LOWORD(wParam), HIWORD(wParam), (LPPAGESETUPDLG)lParam); - break; - case WM_PSD_FULLPAGERECT: - case WM_PSD_MINMARGINRECT: - case WM_PSD_MARGINRECT: - case WM_PSD_GREEKTEXTRECT: - case WM_PSD_ENVSTAMPRECT: - case WM_PSD_YAFULLPAGERECT: - uRet = pT->OnDrawPage(uMsg, (HDC)wParam, (LPRECT)lParam); - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("CPageSetupDialogImpl::PaintHookProc - unknown message received\n")); - break; - } - return uRet; - } - -// Overridables - UINT_PTR PreDrawPage(WORD /*wPaper*/, WORD /*wFlags*/, LPPAGESETUPDLG /*pPSD*/) - { - // return 1 to prevent any more drawing - return 0; - } - - UINT_PTR OnDrawPage(UINT /*uMsg*/, HDC /*hDC*/, LPRECT /*lpRect*/) - { - return 0; // do the default - } -}; - -class CPageSetupDialog : public CPageSetupDialogImpl -{ -public: - CPageSetupDialog(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) - : CPageSetupDialogImpl(dwFlags, hWndParent) - { } - - // override PaintHookProc and references to handlers - static UINT_PTR CALLBACK PaintHookProc(HWND, UINT, WPARAM, LPARAM) - { - return 0; - } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFindReplaceDialogImpl - Find/FindReplace modeless dialogs - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CFindReplaceDialogImpl : public CCommonDialogImplBase -{ -public: - enum { _cchFindReplaceBuffer = 128 }; - - FINDREPLACE m_fr; - TCHAR m_szFindWhat[_cchFindReplaceBuffer]; - TCHAR m_szReplaceWith[_cchFindReplaceBuffer]; - -// Constructors - CFindReplaceDialogImpl() - { - memset(&m_fr, 0, sizeof(m_fr)); - m_szFindWhat[0] = _T('\0'); - m_szReplaceWith[0] = _T('\0'); - - m_fr.lStructSize = sizeof(m_fr); - m_fr.Flags = FR_ENABLEHOOK; - m_fr.lpfnHook = (LPFRHOOKPROC)T::HookProc; - m_fr.lpstrFindWhat = (LPTSTR)m_szFindWhat; - m_fr.wFindWhatLen = _cchFindReplaceBuffer; - m_fr.lpstrReplaceWith = (LPTSTR)m_szReplaceWith; - m_fr.wReplaceWithLen = _cchFindReplaceBuffer; - } - - // Note: You must allocate the object on the heap. - // If you do not, you must override OnFinalMessage() - virtual void OnFinalMessage(HWND /*hWnd*/) - { - delete this; - } - - HWND Create(BOOL bFindDialogOnly, // TRUE for Find, FALSE for FindReplace - LPCTSTR lpszFindWhat, - LPCTSTR lpszReplaceWith = NULL, - DWORD dwFlags = FR_DOWN, - HWND hWndParent = NULL) - { - ATLASSERT((m_fr.Flags & FR_ENABLEHOOK) != 0); - ATLASSERT(m_fr.lpfnHook != NULL); - - m_fr.Flags |= dwFlags; - - if(hWndParent == NULL) - m_fr.hwndOwner = ::GetActiveWindow(); - else - m_fr.hwndOwner = hWndParent; - ATLASSERT(m_fr.hwndOwner != NULL); // must have an owner for modeless dialog - - if(lpszFindWhat != NULL) - SecureHelper::strncpy_x(m_szFindWhat, _countof(m_szFindWhat), lpszFindWhat, _TRUNCATE); - - if(lpszReplaceWith != NULL) - SecureHelper::strncpy_x(m_szReplaceWith, _countof(m_szReplaceWith), lpszReplaceWith, _TRUNCATE); - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - HWND hWnd = NULL; - if(bFindDialogOnly) - hWnd = ::FindText(&m_fr); - else - hWnd = ::ReplaceText(&m_fr); - - ATLASSERT(m_hWnd == hWnd); - return hWnd; - } - - static const UINT GetFindReplaceMsg() - { - static const UINT nMsgFindReplace = ::RegisterWindowMessage(FINDMSGSTRING); - return nMsgFindReplace; - } - // call while handling FINDMSGSTRING registered message - // to retreive the object - static T* PASCAL GetNotifier(LPARAM lParam) - { - ATLASSERT(lParam != NULL); - T* pDlg = (T*)(lParam - offsetof(T, m_fr)); - return pDlg; - } - -// Operations - // Helpers for parsing information after successful return - LPCTSTR GetFindString() const // get find string - { - return (LPCTSTR)m_fr.lpstrFindWhat; - } - - LPCTSTR GetReplaceString() const // get replacement string - { - return (LPCTSTR)m_fr.lpstrReplaceWith; - } - - BOOL SearchDown() const // TRUE if search down, FALSE is up - { - return ((m_fr.Flags & FR_DOWN) != 0) ? TRUE : FALSE; - } - - BOOL FindNext() const // TRUE if command is find next - { - return ((m_fr.Flags & FR_FINDNEXT) != 0) ? TRUE : FALSE; - } - - BOOL MatchCase() const // TRUE if matching case - { - return ((m_fr.Flags & FR_MATCHCASE) != 0) ? TRUE : FALSE; - } - - BOOL MatchWholeWord() const // TRUE if matching whole words only - { - return ((m_fr.Flags & FR_WHOLEWORD) != 0) ? TRUE : FALSE; - } - - BOOL ReplaceCurrent() const // TRUE if replacing current string - { - return ((m_fr. Flags & FR_REPLACE) != 0) ? TRUE : FALSE; - } - - BOOL ReplaceAll() const // TRUE if replacing all occurrences - { - return ((m_fr.Flags & FR_REPLACEALL) != 0) ? TRUE : FALSE; - } - - BOOL IsTerminating() const // TRUE if terminating dialog - { - return ((m_fr.Flags & FR_DIALOGTERM) != 0) ? TRUE : FALSE ; - } -}; - -class CFindReplaceDialog : public CFindReplaceDialogImpl -{ -public: - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -///////////////////////////////////////////////////////////////////////// -// CDialogBaseUnits - Dialog Units helper -// - -class CDialogBaseUnits -{ -public: - SIZE m_sizeUnits; - -// Constructors - CDialogBaseUnits() - { - // The base units of the out-dated System Font - LONG nDlgBaseUnits = ::GetDialogBaseUnits(); - m_sizeUnits.cx = LOWORD(nDlgBaseUnits); - m_sizeUnits.cy = HIWORD(nDlgBaseUnits); - } - - CDialogBaseUnits(HWND hWnd) - { - if(!InitDialogBaseUnits(hWnd)) { - LONG nDlgBaseUnits = ::GetDialogBaseUnits(); - m_sizeUnits.cx = LOWORD(nDlgBaseUnits); - m_sizeUnits.cy = HIWORD(nDlgBaseUnits); - } - } - - CDialogBaseUnits(HFONT hFont, HWND hWnd = NULL) - { - if(!InitDialogBaseUnits(hFont, hWnd)) { - LONG nDlgBaseUnits = ::GetDialogBaseUnits(); - m_sizeUnits.cx = LOWORD(nDlgBaseUnits); - m_sizeUnits.cy = HIWORD(nDlgBaseUnits); - } - } - - CDialogBaseUnits(LOGFONT lf, HWND hWnd = NULL) - { - if(!InitDialogBaseUnits(lf, hWnd)) { - LONG nDlgBaseUnits = ::GetDialogBaseUnits(); - m_sizeUnits.cx = LOWORD(nDlgBaseUnits); - m_sizeUnits.cy = HIWORD(nDlgBaseUnits); - } - } - -// Operations - BOOL InitDialogBaseUnits(HWND hWnd) - { - ATLASSERT(::IsWindow(hWnd)); - RECT rc = { 0, 0, 4, 8 }; - if(!::MapDialogRect(hWnd, &rc)) return FALSE; - m_sizeUnits.cx = rc.right; - m_sizeUnits.cy = rc.bottom; - return TRUE; - } - - BOOL InitDialogBaseUnits(LOGFONT lf, HWND hWnd = NULL) - { - CFont font; - font.CreateFontIndirect(&lf); - if(font.IsNull()) return FALSE; - return InitDialogBaseUnits(font, hWnd); - } - - BOOL InitDialogBaseUnits(HFONT hFont, HWND hWnd = NULL) - { - ATLASSERT(hFont != NULL); - CWindowDC dc = hWnd; - TEXTMETRIC tmText = { 0 }; - SIZE sizeText = { 0 }; - HFONT hFontOld = dc.SelectFont(hFont); - dc.GetTextMetrics(&tmText); - m_sizeUnits.cy = tmText.tmHeight + tmText.tmExternalLeading; - dc.GetTextExtent(_T("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"), 52, &sizeText); - m_sizeUnits.cx = (sizeText.cx + 26) / 52; - dc.SelectFont(hFontOld); - return TRUE; - } - - SIZE GetDialogBaseUnits() const - { - return m_sizeUnits; - } - - INT MapDialogPixelsX(INT x) const - { - return ::MulDiv(x, 4, m_sizeUnits.cx); // Pixels X to DLU - } - - INT MapDialogPixelsY(INT y) const - { - return ::MulDiv(y, 8, m_sizeUnits.cy); // Pixels Y to DLU - } - - POINT MapDialogPixels(POINT pt) const - { - POINT out = { MapDialogPixelsX(pt.x), MapDialogPixelsY(pt.y) }; - return out; - } - - SIZE MapDialogPixels(SIZE input) const - { - SIZE out = { MapDialogPixelsX(input.cx), MapDialogPixelsY(input.cy) }; - return out; - } - - RECT MapDialogPixels(RECT input) const - { - RECT out = { MapDialogPixelsX(input.left), MapDialogPixelsY(input.top), MapDialogPixelsX(input.right), MapDialogPixelsY(input.bottom) }; - return out; - } - - INT MapDialogUnitsX(INT x) const - { - return ::MulDiv(x, m_sizeUnits.cx, 4); // DLU to Pixels X - } - - INT MapDialogUnitsY(INT y) const - { - return ::MulDiv(y, m_sizeUnits.cx, 8); // DLU to Pixels Y - } - - POINT MapDialogUnits(POINT pt) const - { - POINT out = { MapDialogUnitsX(pt.x), MapDialogUnitsY(pt.y) }; - return out; - } - - SIZE MapDialogUnits(SIZE input) const - { - SIZE out = { MapDialogUnitsX(input.cx), MapDialogUnitsY(input.cy) }; - return out; - } - - RECT MapDialogUnits(RECT input) const - { - RECT out = { MapDialogUnitsX(input.left), MapDialogUnitsY(input.top), MapDialogUnitsX(input.right), MapDialogUnitsY(input.bottom) }; - return out; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMemDlgTemplate - in-memory dialog template - DLGTEMPLATE or DLGTEMPLATEEX - -#if (_ATL_VER >= 0x800) - typedef ATL::_DialogSplitHelper::DLGTEMPLATEEX DLGTEMPLATEEX; - typedef ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX DLGITEMTEMPLATEEX; -#else // (_ATL_VER >= 0x800) - typedef ATL::_DialogSizeHelper::_ATL_DLGTEMPLATEEX DLGTEMPLATEEX; - #pragma pack(push, 4) - struct DLGITEMTEMPLATEEX - { - DWORD helpID; - DWORD exStyle; - DWORD style; - short x; - short y; - short cx; - short cy; - DWORD id; - }; - #pragma pack(pop) -#endif // (_ATL_VER >= 0x800) - - -class CMemDlgTemplate -{ -public: - enum StdCtrlType - { - CTRL_BUTTON = 0x0080, - CTRL_EDIT = 0x0081, - CTRL_STATIC = 0x0082, - CTRL_LISTBOX = 0x0083, - CTRL_SCROLLBAR = 0x0084, - CTRL_COMBOBOX = 0x0085 - }; - - CMemDlgTemplate() : m_hData(NULL), m_pData(NULL), m_pPtr(NULL), m_cAllocated(0) - { } - - ~CMemDlgTemplate() - { - Reset(); - } - - bool IsValid() const - { - return (m_pData != NULL); - } - - bool IsTemplateEx() const - { - return (IsValid() && ((DLGTEMPLATEEX*)m_pData)->signature == 0xFFFF); - } - - LPDLGTEMPLATE GetTemplatePtr() - { - return reinterpret_cast(m_pData); - } - - DLGTEMPLATEEX* GetTemplateExPtr() - { - return reinterpret_cast(m_pData); - } - - void Reset() - { - if (IsValid()) { -#ifndef UNDER_CE - ::GlobalUnlock(m_pData); -#endif - ATLVERIFY(::GlobalFree(m_hData) == NULL); - } - - m_hData = NULL; - m_pData = NULL; - m_pPtr = NULL; - m_cAllocated = 0; - } - - void Create(bool bDlgEx, LPCTSTR lpszCaption, RECT rc, DWORD dwStyle = 0, DWORD dwExStyle = 0, - LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, - ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) - { - Create(bDlgEx, lpszCaption, (short) rc.left, (short) rc.top, (short) (rc.right - rc.left), (short) (rc.bottom - rc.top), dwStyle, dwExStyle, - lpstrFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName.m_lpstr, Menu.m_lpstr); - } - - void Create(bool bDlgEx, LPCTSTR lpszCaption, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle = 0, DWORD dwExStyle = 0, - LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, - ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) - { - // Should have DS_SETFONT style to set the dialog font name and size - if (lpstrFontName != NULL) - { - dwStyle |= DS_SETFONT; - } - else - { - dwStyle &= ~DS_SETFONT; - } - - if (bDlgEx) - { - DLGTEMPLATEEX dlg = {1, 0xFFFF, dwHelpID, dwExStyle, dwStyle, 0, nX, nY, nWidth, nHeight}; - AddData(&dlg, sizeof(dlg)); - } - else - { - DLGTEMPLATE dlg = {dwStyle, dwExStyle, 0, nX, nY, nWidth, nHeight}; - AddData(&dlg, sizeof(dlg)); - } - -#ifndef _WIN32_WCE - if (Menu.m_lpstr == NULL) - { - WORD menuData = 0; - AddData(&menuData, sizeof(WORD)); - } - else if (IS_INTRESOURCE(Menu.m_lpstr)) - { - WORD menuData[] = {0xFFFF, (WORD)Menu.m_lpstr}; - AddData(menuData, sizeof(menuData)); - } - else - { - AddString(Menu.m_lpstr); - } -#else // _WIN32_WCE - // Windows CE doesn't support the addition of menus to a dialog box - ATLASSERT(Menu.m_lpstr == NULL); - Menu.m_lpstr; // avoid level 4 warning - WORD menuData = 0; - AddData(&menuData, sizeof(WORD)); -#endif // _WIN32_WCE - - if (ClassName.m_lpstr == NULL) - { - WORD classData = 0; - AddData(&classData, sizeof(WORD)); - } - else if (IS_INTRESOURCE(ClassName.m_lpstr)) - { - WORD classData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; - AddData(classData, sizeof(classData)); - } - else - { - AddString(ClassName.m_lpstr); - } - - // Set dialog caption - AddString(lpszCaption); - - if (lpstrFontName != NULL) - { - AddData(&wFontSize, sizeof(wFontSize)); - - if (bDlgEx) - { - AddData(&wWeight, sizeof(wWeight)); - AddData(&bItalic, sizeof(bItalic)); - AddData(&bCharset, sizeof(bCharset)); - } - - AddString(lpstrFontName); - } - } - - void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, RECT rc, DWORD dwStyle, DWORD dwExStyle, - ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) - { - AddControl(ClassName.m_lpstr, wId, (short) rc.left, (short) rc.top, (short) (rc.right - rc.left), (short) (rc.bottom - rc.top), dwStyle, dwExStyle, - Text.m_lpstr, pCreationData, nCreationData, dwHelpID); - } - - void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle, DWORD dwExStyle, - ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) - { - ATLASSERT(IsValid()); - - // DWORD align data - m_pPtr = (LPBYTE)(DWORD_PTR)((DWORD)(DWORD_PTR)(m_pPtr + 3) & (~3)); - - if (IsTemplateEx()) - { - DLGTEMPLATEEX* dlg = (DLGTEMPLATEEX*)m_pData; - dlg->cDlgItems++; - - DLGITEMTEMPLATEEX item = {dwHelpID, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, nX, nY, nWidth, nHeight, wId}; - AddData(&item, sizeof(item)); - } - else - { - LPDLGTEMPLATE dlg = (LPDLGTEMPLATE)m_pData; - dlg->cdit++; - - DLGITEMTEMPLATE item = {ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, nX, nY, nWidth, nHeight, wId}; - AddData(&item, sizeof(item)); - } - - ATLASSERT(ClassName.m_lpstr != NULL); - if (IS_INTRESOURCE(ClassName.m_lpstr)) - { - WORD wData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; - AddData(wData, sizeof(wData)); - } - else - { - AddString(ClassName.m_lpstr); - } - - if (Text.m_lpstr == NULL) - { - WORD classData = 0; - AddData(&classData, sizeof(WORD)); - } - else if (IS_INTRESOURCE(Text.m_lpstr)) - { - WORD wData[] = {0xFFFF, (WORD)Text.m_lpstr}; - AddData(wData, sizeof(wData)); - } - else - { - AddString(Text.m_lpstr); - } - - AddData(&nCreationData, sizeof(nCreationData)); - - if ((nCreationData != 0)) - { - ATLASSERT(pCreationData != NULL); - AddData(pCreationData, nCreationData * sizeof(WORD)); - } - } - - void AddStdControl(StdCtrlType CtrlType, WORD wId, short nX, short nY, short nWidth, short nHeight, - DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) - { - AddControl(CtrlType, wId, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, Text, pCreationData, nCreationData, dwHelpID); - } - - void AddData(LPCVOID pData, size_t nData) - { - ATLASSERT(pData != NULL); - - const SIZE_T ALLOCATION_INCREMENT = 1024; - - if (m_pData == NULL) - { - m_cAllocated = ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; - m_hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, m_cAllocated); - ATLASSERT(m_hData != NULL); -#ifndef UNDER_CE - m_pPtr = m_pData = static_cast(::GlobalLock(m_hData)); -#else - m_pPtr = m_pData = static_cast(m_hData); -#endif - ATLASSERT(m_pData != NULL); - } - else if (((m_pPtr - m_pData) + nData) > m_cAllocated) - { - SIZE_T ptrPos = (m_pPtr - m_pData); - m_cAllocated += ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; -#ifndef UNDER_CE - ::GlobalUnlock(m_pData); -#endif - m_hData = ::GlobalReAlloc(m_hData, m_cAllocated, GMEM_MOVEABLE | GMEM_ZEROINIT); - ATLASSERT(m_hData != NULL); -#ifndef UNDER_CE - m_pData = static_cast(::GlobalLock(m_hData)); -#else - m_pData = static_cast(m_hData); -#endif - ATLASSERT(m_pData != NULL); - m_pPtr = m_pData + ptrPos; - } - - SecureHelper::memcpy_x(m_pPtr, m_cAllocated - (m_pPtr - m_pData), pData, nData); - - m_pPtr += nData; - } - - void AddString(LPCTSTR lpszStr) - { - if (lpszStr == NULL) - { - WCHAR szEmpty = 0; - AddData(&szEmpty, sizeof(szEmpty)); - } - else - { - USES_CONVERSION; - LPCWSTR lpstr = T2CW(lpszStr); - int nSize = lstrlenW(lpstr) + 1; - AddData(lpstr, nSize * sizeof(WCHAR)); - } - } - - HANDLE m_hData; - LPBYTE m_pData; - LPBYTE m_pPtr; - SIZE_T m_cAllocated; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Dialog and control macros for indirect dialogs - -// for DLGTEMPLATE -#define BEGIN_DIALOG(x, y, width, height) \ - void DoInitTemplate() \ - { \ - bool bExTemplate = false; \ - short nX = x, nY = y, nWidth = width, nHeight = height; \ - LPCTSTR szCaption = NULL; \ - DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ - DWORD dwExStyle = 0; \ - LPCTSTR szFontName = NULL; \ - WORD wFontSize = 0; \ - WORD wWeight = 0; \ - BYTE bItalic = 0; \ - BYTE bCharset = 0; \ - DWORD dwHelpID = 0; \ - ATL::_U_STRINGorID Menu = 0U; \ - ATL::_U_STRINGorID ClassName = 0U; - -// for DLGTEMPLATEEX -#define BEGIN_DIALOG_EX(x, y, width, height, helpID) \ - void DoInitTemplate() \ - { \ - bool bExTemplate = true; \ - short nX = x, nY = y, nWidth = width, nHeight = height; \ - LPCTSTR szCaption = NULL; \ - DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ - DWORD dwExStyle = 0; \ - LPCTSTR szFontName = NULL; \ - WORD wFontSize = 0; \ - WORD wWeight = 0; \ - BYTE bItalic = 0; \ - BYTE bCharset = 0; \ - DWORD dwHelpID = helpID; \ - ATL::_U_STRINGorID Menu = 0U; \ - ATL::_U_STRINGorID ClassName = 0U; - -#define END_DIALOG() \ - m_Template.Create(bExTemplate, szCaption, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, szFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName, Menu); \ - }; - -#define DIALOG_CAPTION(caption) \ - szCaption = caption; -#define DIALOG_STYLE(style) \ - dwStyle = style; -#define DIALOG_EXSTYLE(exStyle) \ - dwExStyle = exStyle; -#define DIALOG_FONT(pointSize, typeFace) \ - wFontSize = pointSize; \ - szFontName = typeFace; -#define DIALOG_FONT_EX(pointsize, typeface, weight, italic, charset) \ - ATLASSERT(bExTemplate); \ - wFontSize = pointsize; \ - szFontName = typeface; \ - wWeight = weight; \ - bItalic = italic; \ - bCharset = charset; -#define DIALOG_MENU(menuName) \ - Menu = menuName; -#define DIALOG_CLASS(className) \ - ClassName = className; - -#define BEGIN_CONTROLS_MAP() \ - void DoInitControls() \ - { - -#define END_CONTROLS_MAP() \ - }; - - -#define CONTROL_LTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_LEFT | WS_GROUP, exStyle, text, NULL, 0); -#define CONTROL_CTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_CENTER | WS_GROUP, exStyle, text, NULL, 0); -#define CONTROL_RTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_RIGHT | WS_GROUP, exStyle, text, NULL, 0); -#define CONTROL_PUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_DEFPUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_DEFPUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#ifndef _WIN32_WCE -#define CONTROL_PUSHBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#endif // !_WIN32_WCE -#define CONTROL_STATE3(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_3STATE | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_AUTO3STATE(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTO3STATE | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_CHECKBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_CHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_AUTOCHECKBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTOCHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_RADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_RADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_AUTORADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTORADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_COMBOBOX(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_COMBOBOX, (WORD)id, x, y, width, height, style | CBS_DROPDOWN | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_EDITTEXT(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_EDIT, (WORD)id, x, y, width, height, style | ES_LEFT | WS_BORDER | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_GROUPBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_GROUPBOX, exStyle, text, NULL, 0); -#define CONTROL_LISTBOX(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_LISTBOX, (WORD)id, x, y, width, height, style | LBS_NOTIFY | WS_BORDER, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_SCROLLBAR(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_SCROLLBAR, (WORD)id, x, y, width, height, style | SBS_HORZ, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_ICON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_ICON, exStyle, text, NULL, 0); -#define CONTROL_CONTROL(text, id, className, style, x, y, width, height, exStyle) \ - m_Template.AddControl(className, (WORD)id, x, y, width, height, style, exStyle, text, NULL, 0); - - -/////////////////////////////////////////////////////////////////////////////// -// CIndirectDialogImpl - dialogs with template in memory - -template > -class ATL_NO_VTABLE CIndirectDialogImpl : public TBase -{ -public: - enum { IDD = 0 }; // no dialog template resource - - TDlgTemplate m_Template; - - void CreateTemplate() - { - T* pT = static_cast(this); - pT->DoInitTemplate(); - pT->DoInitControls(); - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_hWnd == NULL); - - if (!m_Template.IsValid()) - CreateTemplate(); - -#if (_ATL_VER >= 0x0800) - // Allocate the thunk structure here, where we can fail gracefully. - BOOL result = m_thunk.Init(NULL, NULL); - if (result == FALSE) - { - SetLastError(ERROR_OUTOFMEMORY); - return -1; - } -#endif // (_ATL_VER >= 0x0800) - - ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); - -#ifdef _DEBUG - m_bModal = true; -#endif // _DEBUG - - return ::DialogBoxIndirectParam(ModuleHelper::GetResourceInstance(), m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); - } - - HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_hWnd == NULL); - - if (!m_Template.IsValid()) - CreateTemplate(); - -#if (_ATL_VER >= 0x0800) - // Allocate the thunk structure here, where we can fail gracefully. - BOOL result = m_thunk.Init(NULL, NULL); - if (result == FALSE) - { - SetLastError(ERROR_OUTOFMEMORY); - return NULL; - } -#endif // (_ATL_VER >= 0x0800) - - ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); - -#ifdef _DEBUG - m_bModal = false; -#endif // _DEBUG - - HWND hWnd = ::CreateDialogIndirectParam(ModuleHelper::GetResourceInstance(), (LPCDLGTEMPLATE)m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); - ATLASSERT(m_hWnd == hWnd); - - return hWnd; - } - - // for CComControl - HWND Create(HWND hWndParent, RECT&, LPARAM dwInitParam = NULL) - { - return Create(hWndParent, dwInitParam); - } - - void DoInitTemplate() - { - ATLASSERT(FALSE); // MUST be defined in derived class - } - - void DoInitControls() - { - ATLASSERT(FALSE); // MUST be defined in derived class - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CPropertySheetWindow - client side for a property sheet - -class CPropertySheetWindow : public ATL::CWindow -{ -public: -// Constructors - CPropertySheetWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) - { } - - CPropertySheetWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - int GetPageCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HWND hWndTabCtrl = GetTabControl(); - ATLASSERT(hWndTabCtrl != NULL); - return (int)::SendMessage(hWndTabCtrl, TCM_GETITEMCOUNT, 0, 0L); - } - - HWND GetActivePage() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0L); - } - - int GetActiveIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HWND hWndTabCtrl = GetTabControl(); - ATLASSERT(hWndTabCtrl != NULL); - return (int)::SendMessage(hWndTabCtrl, TCM_GETCURSEL, 0, 0L); - } - - BOOL SetActivePage(int nPageIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, nPageIndex, 0L); - } - - BOOL SetActivePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, 0, (LPARAM)hPage); - } - - BOOL SetActivePageByID(int nPageID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSELID, 0, nPageID); - } - - void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid - ATLASSERT(lpszText != NULL); - ::SendMessage(m_hWnd, PSM_SETTITLE, nStyle, (LPARAM)lpszText); - } - - HWND GetTabControl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, PSM_GETTABCONTROL, 0, 0L); - } - - void SetFinishText(LPCTSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETFINISHTEXT, 0, (LPARAM)lpszText); - } - - void SetWizardButtons(DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::PostMessage(m_hWnd, PSM_SETWIZBUTTONS, 0, dwFlags); - } - -// Operations - BOOL AddPage(HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); - } - - BOOL AddPage(LPCPROPSHEETPAGE pPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); - } - -#ifndef _WIN32_WCE - BOOL InsertPage(int nNewPageIndex, HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); - } - - BOOL InsertPage(int nNewPageIndex, LPCPROPSHEETPAGE pPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); - } - - BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); - } - - BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, LPCPROPSHEETPAGE pPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); - } -#endif // !_WIN32_WCE - - void RemovePage(int nPageIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_REMOVEPAGE, nPageIndex, 0L); - } - - void RemovePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - ::SendMessage(m_hWnd, PSM_REMOVEPAGE, 0, (LPARAM)hPage); - } - - BOOL PressButton(int nButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_PRESSBUTTON, nButton, 0L); - } - - BOOL Apply() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_APPLY, 0, 0L); - } - - void CancelToClose() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_CANCELTOCLOSE, 0, 0L); - } - - void SetModified(HWND hWndPage, BOOL bChanged = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(hWndPage)); - UINT uMsg = bChanged ? PSM_CHANGED : PSM_UNCHANGED; - ::SendMessage(m_hWnd, uMsg, (WPARAM)hWndPage, 0L); - } - - LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SendMessage(m_hWnd, PSM_QUERYSIBLINGS, wParam, lParam); - } - - void RebootSystem() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_REBOOTSYSTEM, 0, 0L); - } - - void RestartWindows() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_RESTARTWINDOWS, 0, 0L); - } - - BOOL IsDialogMessage(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_ISDIALOGMESSAGE, 0, (LPARAM)lpMsg); - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int HwndToIndex(HWND hWnd) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_HWNDTOINDEX, (WPARAM)hWnd, 0L); - } - - HWND IndexToHwnd(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, PSM_INDEXTOHWND, nIndex, 0L); - } - - int PageToIndex(HPROPSHEETPAGE hPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_PAGETOINDEX, 0, (LPARAM)hPage); - } - - HPROPSHEETPAGE IndexToPage(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPROPSHEETPAGE)::SendMessage(m_hWnd, PSM_INDEXTOPAGE, nIndex, 0L); - } - - int IdToIndex(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_IDTOINDEX, 0, nID); - } - - int IndexToId(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_INDEXTOID, nIndex, 0L); - } - - int GetResult() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_GETRESULT, 0, 0L); - } - - BOOL RecalcPageSizes() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_RECALCPAGESIZES, 0, 0L); - } - - void SetHeaderTitle(int nIndex, LPCTSTR lpstrHeaderTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETHEADERTITLE, nIndex, (LPARAM)lpstrHeaderTitle); - } - - void SetHeaderSubTitle(int nIndex, LPCTSTR lpstrHeaderSubTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETHEADERSUBTITLE, nIndex, (LPARAM)lpstrHeaderSubTitle); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Implementation - override to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CPropertySheetImpl - implements a property sheet - -template -class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > -{ -public: - PROPSHEETHEADER m_psh; - ATL::CSimpleArray m_arrPages; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - #ifndef PROPSHEET_LINK_SIZE - #define PROPSHEET_LINK_SIZE 128 - #endif // PROPSHEET_LINK_SIZE - TCHAR m_szLink[PROPSHEET_LINK_SIZE]; - static LPCTSTR m_pszTitle; - static LPCTSTR m_pszLink; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -// Construction/Destruction - CPropertySheetImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) - { - memset(&m_psh, 0, sizeof(PROPSHEETHEADER)); - m_psh.dwSize = sizeof(PROPSHEETHEADER); - m_psh.dwFlags = PSH_USECALLBACK; - m_psh.hInstance = ModuleHelper::GetResourceInstance(); - m_psh.phpage = NULL; // will be set later - m_psh.nPages = 0; // will be set later - m_psh.pszCaption = title.m_lpstr; - m_psh.nStartPage = uStartPage; - m_psh.hwndParent = hWndParent; // if NULL, will be set in DoModal/Create - m_psh.pfnCallback = T::PropSheetCallback; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - m_psh.dwFlags |= PSH_MAXIMIZE; - m_szLink[0] = 0; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - } - - ~CPropertySheetImpl() - { - if(m_arrPages.GetSize() > 0) // sheet never created, destroy all pages - { - for(int i = 0; i < m_arrPages.GetSize(); i++) - ::DestroyPropertySheetPage((HPROPSHEETPAGE)m_arrPages[i]); - } - } - -// Callback function and overrideables - static int CALLBACK PropSheetCallback(HWND hWnd, UINT uMsg, LPARAM lParam) - { - lParam; // avoid level 4 warning - int nRet = 0; - - if(uMsg == PSCB_INITIALIZED) - { - ATLASSERT(hWnd != NULL); - T* pT = (T*)ModuleHelper::ExtractCreateWndData(); - // subclass the sheet window - pT->SubclassWindow(hWnd); - // remove page handles array - pT->_CleanUpPages(); - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - m_pszTitle = pT->m_psh.pszCaption; - if(*pT->m_szLink != 0) - m_pszLink = pT->m_szLink; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - - pT->OnSheetInitialized(); - } -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific uMsg - else - { - switch(uMsg) - { - case PSCB_GETVERSION : - nRet = COMCTL32_VERSION; - break; - case PSCB_GETTITLE : - if(m_pszTitle != NULL) - { - lstrcpy((LPTSTR)lParam, m_pszTitle); - m_pszTitle = NULL; - } - break; - case PSCB_GETLINKTEXT: - if(m_pszLink != NULL) - { - lstrcpy((LPTSTR)lParam, m_pszLink); - m_pszLink = NULL; - } - break; - default: - break; - } - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - - return nRet; - } - - void OnSheetInitialized() - { - } - -// Create method - HWND Create(HWND hWndParent = NULL) - { - ATLASSERT(m_hWnd == NULL); - - m_psh.dwFlags |= PSH_MODELESS; - if(m_psh.hwndParent == NULL) - m_psh.hwndParent = hWndParent; - m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); - m_psh.nPages = m_arrPages.GetSize(); - - T* pT = static_cast(this); - ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); - - HWND hWnd = (HWND)::PropertySheet(&m_psh); - _CleanUpPages(); // ensure clean-up, required if call failed - - ATLASSERT(m_hWnd == hWnd); - - return hWnd; - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT(m_hWnd == NULL); - - m_psh.dwFlags &= ~PSH_MODELESS; - if(m_psh.hwndParent == NULL) - m_psh.hwndParent = hWndParent; - m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); - m_psh.nPages = m_arrPages.GetSize(); - - T* pT = static_cast(this); - ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); - - INT_PTR nRet = ::PropertySheet(&m_psh); - _CleanUpPages(); // ensure clean-up, required if call failed - - return nRet; - } - - // implementation helper - clean up pages array - void _CleanUpPages() - { - m_psh.nPages = 0; - m_psh.phpage = NULL; - m_arrPages.RemoveAll(); - } - -// Attributes (extended overrides of client class methods) -// These now can be called before the sheet is created -// Note: Calling these after the sheet is created gives unpredictable results - int GetPageCount() const - { - if(m_hWnd == NULL) // not created yet - return m_arrPages.GetSize(); - return TBase::GetPageCount(); - } - - int GetActiveIndex() const - { - if(m_hWnd == NULL) // not created yet - return m_psh.nStartPage; - return TBase::GetActiveIndex(); - } - - HPROPSHEETPAGE GetPage(int nPageIndex) const - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - return (HPROPSHEETPAGE)m_arrPages[nPageIndex]; - } - - int GetPageIndex(HPROPSHEETPAGE hPage) const - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - return m_arrPages.Find((HPROPSHEETPAGE&)hPage); - } - - BOOL SetActivePage(int nPageIndex) - { - if(m_hWnd == NULL) // not created yet - { - ATLASSERT(nPageIndex >= 0 && nPageIndex < m_arrPages.GetSize()); - m_psh.nStartPage = nPageIndex; - return TRUE; - } - return TBase::SetActivePage(nPageIndex); - } - - BOOL SetActivePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(hPage != NULL); - if (m_hWnd == NULL) // not created yet - { - int nPageIndex = GetPageIndex(hPage); - if(nPageIndex == -1) - return FALSE; - - return SetActivePage(nPageIndex); - } - return TBase::SetActivePage(hPage); - - } - - void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) - { - ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid - ATLASSERT(lpszText != NULL); - - if(m_hWnd == NULL) - { - // set internal state - m_psh.pszCaption = lpszText; // must exist until sheet is created - m_psh.dwFlags &= ~PSH_PROPTITLE; - m_psh.dwFlags |= nStyle; - } - else - { - // set external state - TBase::SetTitle(lpszText, nStyle); - } - } - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific Link field - void SetLinkText(LPCTSTR lpszText) - { - ATLASSERT(lpszText != NULL); - ATLASSERT(lstrlen(lpszText) < PROPSHEET_LINK_SIZE); - lstrcpy(m_szLink, lpszText); - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - - void SetWizardMode() - { - m_psh.dwFlags |= PSH_WIZARD; - } - - void EnableHelp() - { - m_psh.dwFlags |= PSH_HASHELP; - } - -// Operations - BOOL AddPage(HPROPSHEETPAGE hPage) - { - ATLASSERT(hPage != NULL); - BOOL bRet = FALSE; - if(m_hWnd != NULL) - bRet = TBase::AddPage(hPage); - else // sheet not created yet, use internal data - bRet = m_arrPages.Add((HPROPSHEETPAGE&)hPage); - return bRet; - } - - BOOL AddPage(LPCPROPSHEETPAGE pPage) - { - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - BOOL bRet = AddPage(hPage); - if(!bRet) - ::DestroyPropertySheetPage(hPage); - return bRet; - } - - BOOL RemovePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(hPage != NULL); - if (m_hWnd == NULL) // not created yet - { - int nPage = GetPageIndex(hPage); - if(nPage == -1) - return FALSE; - return RemovePage(nPage); - } - TBase::RemovePage(hPage); - return TRUE; - - } - - BOOL RemovePage(int nPageIndex) - { - BOOL bRet = TRUE; - if(m_hWnd != NULL) - TBase::RemovePage(nPageIndex); - else // sheet not created yet, use internal data - bRet = m_arrPages.RemoveAt(nPageIndex); - return bRet; - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - void SetHeader(LPCTSTR szbmHeader) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= (PSH_HEADER | PSH_WIZARD97); - m_psh.pszbmHeader = szbmHeader; - } - - void SetHeader(HBITMAP hbmHeader) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= (PSH_HEADER | PSH_USEHBMHEADER | PSH_WIZARD97); - m_psh.hbmHeader = hbmHeader; - } - - void SetWatermark(LPCTSTR szbmWatermark, HPALETTE hplWatermark = NULL) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= PSH_WATERMARK | PSH_WIZARD97; - m_psh.pszbmWatermark = szbmWatermark; - - if (hplWatermark != NULL) - { - m_psh.dwFlags |= PSH_USEHPLWATERMARK; - m_psh.hplWatermark = hplWatermark; - } - } - - void SetWatermark(HBITMAP hbmWatermark, HPALETTE hplWatermark = NULL) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= (PSH_WATERMARK | PSH_USEHBMWATERMARK | PSH_WIZARD97); - m_psh.hbmWatermark = hbmWatermark; - - if (hplWatermark != NULL) - { - m_psh.dwFlags |= PSH_USEHPLWATERMARK; - m_psh.hplWatermark = hplWatermark; - } - } - - void StretchWatermark(bool bStretchWatermark) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - if (bStretchWatermark) - m_psh.dwFlags |= PSH_STRETCHWATERMARK; - else - m_psh.dwFlags &= ~PSH_STRETCHWATERMARK; - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -// Message map and handlers - BEGIN_MSG_MAP(CPropertySheetImpl) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand) - END_MSG_MAP() - - LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) && - ((m_psh.dwFlags & PSH_MODELESS) != 0) && (GetActivePage() == NULL)) - DestroyWindow(); - return lRet; - } - - LRESULT OnSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(((m_psh.dwFlags & PSH_MODELESS) == PSH_MODELESS) && ((wParam & 0xFFF0) == SC_CLOSE)) - SendMessage(WM_CLOSE); - else - bHandled = FALSE; - return 0; - } -}; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC static pointers -template < class T, class TBase > -LPCWSTR CPropertySheetImpl::m_pszTitle = NULL; -template < class T, class TBase> -LPCWSTR CPropertySheetImpl::m_pszLink = NULL; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -// for non-customized sheets -class CPropertySheet : public CPropertySheetImpl -{ -public: - CPropertySheet(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) - : CPropertySheetImpl(title, uStartPage, hWndParent) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPropertyPageWindow - client side for a property page - -class CPropertyPageWindow : public ATL::CWindow -{ -public: -// Constructors - CPropertyPageWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) - { } - - CPropertyPageWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - CPropertySheetWindow GetPropertySheet() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CPropertySheetWindow(GetParent()); - } - -// Operations - BOOL Apply() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - return GetPropertySheet().Apply(); - } - - void CancelToClose() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().CancelToClose(); - } - - void SetModified(BOOL bChanged = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().SetModified(m_hWnd, bChanged); - } - - LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - return GetPropertySheet().QuerySiblings(wParam, lParam); - } - - void RebootSystem() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().RebootSystem(); - } - - void RestartWindows() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().RestartWindows(); - } - - void SetWizardButtons(DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().SetWizardButtons(dwFlags); - } - -// Implementation - overrides to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CPropertyPageImpl - implements a property page - -template -class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > -{ -public: - PROPSHEETPAGE m_psp; - - operator PROPSHEETPAGE*() { return &m_psp; } - -// Construction - CPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) - { - // initialize PROPSHEETPAGE struct - memset(&m_psp, 0, sizeof(PROPSHEETPAGE)); - m_psp.dwSize = sizeof(PROPSHEETPAGE); - m_psp.dwFlags = PSP_USECALLBACK; - m_psp.hInstance = ModuleHelper::GetResourceInstance(); - T* pT = static_cast(this); - m_psp.pszTemplate = MAKEINTRESOURCE(pT->IDD); - m_psp.pfnDlgProc = (DLGPROC)T::StartDialogProc; - m_psp.pfnCallback = T::PropPageCallback; - m_psp.lParam = (LPARAM)pT; - - if(title.m_lpstr != NULL) - SetTitle(title); - } - -// Callback function and overrideables - static UINT CALLBACK PropPageCallback(HWND hWnd, UINT uMsg, LPPROPSHEETPAGE ppsp) - { - hWnd; // avoid level 4 warning - ATLASSERT(hWnd == NULL); - T* pT = (T*)ppsp->lParam; - UINT uRet = 0; - - switch(uMsg) - { - case PSPCB_CREATE: - { - ATL::CDialogImplBaseT< TBase >* pPage = (ATL::CDialogImplBaseT< TBase >*)pT; - ModuleHelper::AddCreateWndData(&pPage->m_thunk.cd, pPage); - uRet = pT->OnPageCreate() ? 1 : 0; - } - break; -#if (_WIN32_IE >= 0x0500) - case PSPCB_ADDREF: - pT->OnPageAddRef(); - break; -#endif // (_WIN32_IE >= 0x0500) - case PSPCB_RELEASE: - pT->OnPageRelease(); - break; - default: - break; - } - - return uRet; - } - - bool OnPageCreate() - { - return true; // true - allow page to be created, false - prevent creation - } - -#if (_WIN32_IE >= 0x0500) - void OnPageAddRef() - { - } -#endif // (_WIN32_IE >= 0x0500) - - void OnPageRelease() - { - } - -// Create method - HPROPSHEETPAGE Create() - { - return ::CreatePropertySheetPage(&m_psp); - } - -// Attributes - void SetTitle(ATL::_U_STRINGorID title) - { - m_psp.pszTitle = title.m_lpstr; - m_psp.dwFlags |= PSP_USETITLE; - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - void SetHeaderTitle(LPCTSTR lpstrHeaderTitle) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psp.dwFlags |= PSP_USEHEADERTITLE; - m_psp.pszHeaderTitle = lpstrHeaderTitle; - } - - void SetHeaderSubTitle(LPCTSTR lpstrHeaderSubTitle) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psp.dwFlags |= PSP_USEHEADERSUBTITLE; - m_psp.pszHeaderSubTitle = lpstrHeaderSubTitle; - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Operations - void EnableHelp() - { - m_psp.dwFlags |= PSP_HASHELP; - } - -// Message map and handlers - BEGIN_MSG_MAP(CPropertyPageImpl) - MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - END_MSG_MAP() - - // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification - // handlers that return direct values without any restrictions - LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { -#ifndef _WIN32_WCE - // This notification is sometimes received on Windows CE after the window is already destroyed - ATLASSERT(::IsWindow(m_hWnd)); -#endif - NMHDR* pNMHDR = (NMHDR*)lParam; - - // don't handle messages not from the page/sheet itself - if(pNMHDR->hwndFrom != m_hWnd && pNMHDR->hwndFrom != ::GetParent(m_hWnd)) - { - bHandled = FALSE; - return 1; - } -#ifdef _WIN32_WCE - ATLASSERT(::IsWindow(m_hWnd)); -#endif - - T* pT = static_cast(this); - LRESULT lResult = 0; - switch(pNMHDR->code) - { -#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - case PSN_SETACTIVE: - lResult = pT->OnSetActive(); - break; - case PSN_KILLACTIVE: - lResult = pT->OnKillActive(); - break; - case PSN_APPLY: - lResult = pT->OnApply(); - break; - case PSN_RESET: - pT->OnReset(); - break; - case PSN_QUERYCANCEL: - lResult = pT->OnQueryCancel(); - break; - case PSN_WIZNEXT: - lResult = pT->OnWizardNext(); - break; - case PSN_WIZBACK: - lResult = pT->OnWizardBack(); - break; - case PSN_WIZFINISH: - lResult = pT->OnWizardFinish(); - break; - case PSN_HELP: - pT->OnHelp(); - break; -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - case PSN_GETOBJECT: - if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) - bHandled = FALSE; - break; -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - case PSN_TRANSLATEACCELERATOR: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam); - } - break; - case PSN_QUERYINITIALFOCUS: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); - } - break; -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - case PSN_SETACTIVE: - lResult = pT->OnSetActive() ? 0 : -1; - break; - case PSN_KILLACTIVE: - lResult = !pT->OnKillActive(); - break; - case PSN_APPLY: - lResult = pT->OnApply() ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE; - break; - case PSN_RESET: - pT->OnReset(); - break; - case PSN_QUERYCANCEL: - lResult = !pT->OnQueryCancel(); - break; - case PSN_WIZNEXT: - lResult = pT->OnWizardNext(); - break; - case PSN_WIZBACK: - lResult = pT->OnWizardBack(); - break; - case PSN_WIZFINISH: - lResult = !pT->OnWizardFinish(); - break; - case PSN_HELP: - pT->OnHelp(); - break; -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - case PSN_GETOBJECT: - if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) - bHandled = FALSE; - break; -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - case PSN_TRANSLATEACCELERATOR: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; - } - break; - case PSN_QUERYINITIALFOCUS: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); - } - break; -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - default: - bHandled = FALSE; // not handled - } - - return lResult; - } - -// Overridables - // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification - // handlers that return direct values without any restrictions -#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - int OnSetActive() - { - // 0 = allow activate - // -1 = go back that was active - // page ID = jump to page - return 0; - } - - BOOL OnKillActive() - { - // FALSE = allow deactivate - // TRUE = prevent deactivation - return FALSE; - } - - int OnApply() - { - // PSNRET_NOERROR = apply OK - // PSNRET_INVALID = apply not OK, return to this page - // PSNRET_INVALID_NOCHANGEPAGE = apply not OK, don't change focus - return PSNRET_NOERROR; - } - - void OnReset() - { - } - - BOOL OnQueryCancel() - { - // FALSE = allow cancel - // TRUE = prevent cancel - return FALSE; - } - - int OnWizardBack() - { - // 0 = goto previous page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - int OnWizardNext() - { - // 0 = goto next page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - INT_PTR OnWizardFinish() - { - // FALSE = allow finish - // TRUE = prevent finish - // HWND = prevent finish and set focus to HWND (CommCtrl 5.80 only) - return FALSE; - } - - void OnHelp() - { - } - -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) - { - return FALSE; // not processed - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - int OnTranslateAccelerator(LPMSG /*lpMsg*/) - { - // PSNRET_NOERROR - message not handled - // PSNRET_MESSAGEHANDLED - message handled - return PSNRET_NOERROR; - } - - HWND OnQueryInitialFocus(HWND /*hWndFocus*/) - { - // NULL = set focus to default control - // HWND = set focus to HWND - return NULL; - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - BOOL OnSetActive() - { - return TRUE; - } - - BOOL OnKillActive() - { - return TRUE; - } - - BOOL OnApply() - { - return TRUE; - } - - void OnReset() - { - } - - BOOL OnQueryCancel() - { - return TRUE; // ok to cancel - } - - int OnWizardBack() - { - // 0 = goto previous page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - int OnWizardNext() - { - // 0 = goto next page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - BOOL OnWizardFinish() - { - return TRUE; - } - - void OnHelp() - { - } - -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) - { - return FALSE; // not processed - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - BOOL OnTranslateAccelerator(LPMSG /*lpMsg*/) - { - return FALSE; // not translated - } - - HWND OnQueryInitialFocus(HWND /*hWndFocus*/) - { - return NULL; // default - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS -}; - -// for non-customized pages -template -class CPropertyPage : public CPropertyPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -/////////////////////////////////////////////////////////////////////////////// -// CAxPropertyPageImpl - property page that hosts ActiveX controls - -#ifndef _ATL_NO_HOSTING - -// Note: You must #include to use these classes - -template -class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > -{ -public: -// Data members - HGLOBAL m_hInitData; - HGLOBAL m_hDlgRes; - HGLOBAL m_hDlgResSplit; - -// Constructor/destructor - CAxPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : - CPropertyPageImpl< T, TBase >(title), - m_hInitData(NULL), m_hDlgRes(NULL), m_hDlgResSplit(NULL) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - - // initialize ActiveX hosting and modify dialog template - ATL::AtlAxWinInit(); - - HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); - LPCTSTR lpTemplateName = MAKEINTRESOURCE(pT->IDD); - HRSRC hDlg = ::FindResource(hInstance, lpTemplateName, (LPTSTR)RT_DIALOG); - if(hDlg != NULL) - { - HRSRC hDlgInit = ::FindResource(hInstance, lpTemplateName, (LPTSTR)_ATL_RT_DLGINIT); - - BYTE* pInitData = NULL; - if(hDlgInit != NULL) - { - m_hInitData = ::LoadResource(hInstance, hDlgInit); - pInitData = (BYTE*)::LockResource(m_hInitData); - } - - m_hDlgRes = ::LoadResource(hInstance, hDlg); - DLGTEMPLATE* pDlg = (DLGTEMPLATE*)::LockResource(m_hDlgRes); - LPCDLGTEMPLATE lpDialogTemplate = ATL::_DialogSplitHelper::SplitDialogTemplate(pDlg, pInitData); - if(lpDialogTemplate != pDlg) - m_hDlgResSplit = GlobalHandle(lpDialogTemplate); - - // set up property page to use in-memory dialog template - if(lpDialogTemplate != NULL) - { - m_psp.dwFlags |= PSP_DLGINDIRECT; - m_psp.pResource = lpDialogTemplate; - } - else - { - ATLASSERT(FALSE && _T("CAxPropertyPageImpl - ActiveX initializtion failed!")); - } - } - else - { - ATLASSERT(FALSE && _T("CAxPropertyPageImpl - Cannot find dialog template!")); - } - } - - ~CAxPropertyPageImpl() - { - if(m_hInitData != NULL) - { - UnlockResource(m_hInitData); - FreeResource(m_hInitData); - } - if(m_hDlgRes != NULL) - { - UnlockResource(m_hDlgRes); - FreeResource(m_hDlgRes); - } - if(m_hDlgResSplit != NULL) - { - ::GlobalFree(m_hDlgResSplit); - } - } - -// Methods - // call this one to handle keyboard message for ActiveX controls - BOOL PreTranslateMessage(LPMSG pMsg) - { - if ((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) && - (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST)) - return FALSE; - // find a direct child of the dialog from the window that has focus - HWND hWndCtl = ::GetFocus(); - if (IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd) - { - do - { - hWndCtl = ::GetParent(hWndCtl); - } - while (::GetParent(hWndCtl) != m_hWnd); - } - // give controls a chance to translate this message - return (BOOL)::SendMessage(hWndCtl, WM_FORWARDMSG, 0, (LPARAM)pMsg); - } - -// Overridables -#if (_WIN32_IE >= 0x0500) - // new default implementation for ActiveX hosting pages -#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - int OnTranslateAccelerator(LPMSG lpMsg) - { - T* pT = static_cast(this); - return (pT->PreTranslateMessage(lpMsg) != FALSE) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; - } -#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - BOOL OnTranslateAccelerator(LPMSG lpMsg) - { - T* pT = static_cast(this); - return pT->PreTranslateMessage(lpMsg); - } -#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS -#endif // (_WIN32_IE >= 0x0500) - -// Support for new stuff in ATL7 -#if (_ATL_VER >= 0x0700) - int GetIDD() - { - return( static_cast(this)->IDD ); - } - - virtual DLGPROC GetDialogProc() - { - return DialogProc; - } - - static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - CAxPropertyPageImpl< T, TBase >* pThis = (CAxPropertyPageImpl< T, TBase >*)hWnd; - if (uMsg == WM_INITDIALOG) - { - HRESULT hr; - if (FAILED(hr = pThis->CreateActiveXControls(pThis->GetIDD()))) - { - ATLASSERT(FALSE); - return FALSE; - } - } - return CPropertyPageImpl< T, TBase >::DialogProc(hWnd, uMsg, wParam, lParam); - } - -// ActiveX controls creation - virtual HRESULT CreateActiveXControls(UINT nID) - { - // Load dialog template and InitData - HRSRC hDlgInit = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)_ATL_RT_DLGINIT); - BYTE* pInitData = NULL; - HGLOBAL hData = NULL; - HRESULT hr = S_OK; - if (hDlgInit != NULL) - { - hData = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlgInit); - if (hData != NULL) - pInitData = (BYTE*) ::LockResource(hData); - } - - HRSRC hDlg = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)RT_DIALOG); - if (hDlg != NULL) - { - HGLOBAL hResource = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlg); - DLGTEMPLATE* pDlg = NULL; - if (hResource != NULL) - { - pDlg = (DLGTEMPLATE*) ::LockResource(hResource); - if (pDlg != NULL) - { - // Get first control on the template - BOOL bDialogEx = ATL::_DialogSplitHelper::IsDialogEx(pDlg); - WORD nItems = ATL::_DialogSplitHelper::DlgTemplateItemCount(pDlg); - - // Get first control on the dialog - DLGITEMTEMPLATE* pItem = ATL::_DialogSplitHelper::FindFirstDlgItem(pDlg); - HWND hWndPrev = GetWindow(GW_CHILD); - - // Create all ActiveX cotnrols in the dialog template and place them in the correct tab order (z-order) - for (WORD nItem = 0; nItem < nItems; nItem++) - { - DWORD wID = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : pItem->id; - if (ATL::_DialogSplitHelper::IsActiveXControl(pItem, bDialogEx)) - { - BYTE* pData = NULL; - DWORD dwLen = ATL::_DialogSplitHelper::FindCreateData(wID, pInitData, &pData); - ATL::CComPtr spStream; - if (dwLen != 0) - { - HGLOBAL h = GlobalAlloc(GHND, dwLen); - if (h != NULL) - { - BYTE* pBytes = (BYTE*) GlobalLock(h); - BYTE* pSource = pData; - SecureHelper::memcpy_x(pBytes, dwLen, pSource, dwLen); - GlobalUnlock(h); - CreateStreamOnHGlobal(h, TRUE, &spStream); - } - else - { - hr = E_OUTOFMEMORY; - break; - } - } - - ATL::CComBSTR bstrLicKey; - hr = ATL::_DialogSplitHelper::ParseInitData(spStream, &bstrLicKey.m_str); - if (SUCCEEDED(hr)) - { - ATL::CAxWindow2 wnd; - // Get control caption. - LPWSTR pszClassName = - bDialogEx ? - (LPWSTR)(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem) + 1) : - (LPWSTR)(pItem + 1); - // Get control rect. - RECT rect; - rect.left = - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->x : - pItem->x; - rect.top = - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->y : - pItem->y; - rect.right = rect.left + - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cx : - pItem->cx); - rect.bottom = rect.top + - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cy : - pItem->cy); - - // Convert from dialog units to screen units - MapDialogRect(&rect); - - // Create AxWindow with a NULL caption. - wnd.Create(m_hWnd, - &rect, - NULL, - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->style : - pItem->style) | WS_TABSTOP, - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->exStyle : - 0, - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : - pItem->id, - NULL); - - if (wnd != NULL) - { -#ifndef _WIN32_WCE - // Set the Help ID - if (bDialogEx && ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID != 0) - wnd.SetWindowContextHelpId(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID); -#endif // !_WIN32_WCE - // Try to create the ActiveX control. - hr = wnd.CreateControlLic(pszClassName, spStream, NULL, bstrLicKey); - if (FAILED(hr)) - break; - // Set the correct tab position. - if (nItem == 0) - hWndPrev = HWND_TOP; - wnd.SetWindowPos(hWndPrev, 0,0,0,0,SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); - hWndPrev = wnd; - } - else - { - hr = ATL::AtlHresultFromLastError(); - } - } - } - else - { - if (nItem != 0) - hWndPrev = ::GetWindow(hWndPrev, GW_HWNDNEXT); - } - pItem = ATL::_DialogSplitHelper::FindNextDlgItem(pItem, bDialogEx); - } - } - else - hr = ATL::AtlHresultFromLastError(); - } - else - hr = ATL::AtlHresultFromLastError(); - } - return hr; - } - -// Event handling support - HRESULT AdviseSinkMap(bool bAdvise) - { - if(!bAdvise && m_hWnd == NULL) - { - // window is gone, controls are already unadvised - ATLTRACE2(atlTraceUI, 0, _T("CAxPropertyPageImpl::AdviseSinkMap called after the window was destroyed\n")); - return S_OK; - } - HRESULT hRet = E_NOTIMPL; - __if_exists(T::_GetSinkMapFinder) - { - T* pT = static_cast(this); - hRet = AtlAdviseSinkMap(pT, bAdvise); - } - return hRet; - } - -// Message map and handlers - typedef CPropertyPageImpl< T, TBase> _baseClass; - BEGIN_MSG_MAP(CAxPropertyPageImpl) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - // initialize controls in dialog with DLGINIT resource section - ExecuteDlgInit(static_cast(this)->IDD); - AdviseSinkMap(true); - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - AdviseSinkMap(false); - bHandled = FALSE; - return 1; - } -#endif // (_ATL_VER >= 0x0700) -}; - -// for non-customized pages -template -class CAxPropertyPage : public CAxPropertyPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CAxPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl(title) - { } - -#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) - // not empty so we handle accelerators/create controls - BEGIN_MSG_MAP(CAxPropertyPage) - CHAIN_MSG_MAP(CAxPropertyPageImpl >) - END_MSG_MAP() -#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) - DECLARE_EMPTY_MSG_MAP() -#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) -}; - -#endif // _ATL_NO_HOSTING - - -/////////////////////////////////////////////////////////////////////////////// -// Wizard97 Support - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Sample wizard dialog resources: -// -// IDD_WIZ97_INTERIOR_BLANK DIALOG 0, 0, 317, 143 -// STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -// CAPTION "Wizard97 Property Page - Interior" -// FONT 8, "MS Shell Dlg" -// BEGIN -// END -// -// IDD_WIZ97_EXTERIOR_BLANK DIALOGEX 0, 0, 317, 193 -// STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -// CAPTION "Wizard97 Property Page - Welcome/Complete" -// FONT 8, "MS Shell Dlg", 0, 0, 0x0 -// BEGIN -// LTEXT "Welcome to the X Wizard",IDC_WIZ97_EXTERIOR_TITLE,115,8, -// 195,24 -// LTEXT "Wizard Explanation\r\n(The height of the static text should be in multiples of 8 dlus)", -// IDC_STATIC,115,40,195,16 -// LTEXT "h",IDC_WIZ97_BULLET1,118,64,8,8 -// LTEXT "List Item 1 (the h is turned into a bullet)",IDC_STATIC, -// 127,63,122,8 -// LTEXT "h",IDC_WIZ97_BULLET2,118,79,8,8 -// LTEXT "List Item 2. Keep 7 dlus between paragraphs",IDC_STATIC, -// 127,78,33,8 -// CONTROL "&Do not show this Welcome page again", -// IDC_WIZ97_WELCOME_NOTAGAIN,"Button",BS_AUTOCHECKBOX | -// WS_TABSTOP,115,169,138,10 -// END -// -// GUIDELINES DESIGNINFO -// BEGIN -// IDD_WIZ97_INTERIOR_BLANK, DIALOG -// BEGIN -// LEFTMARGIN, 7 -// RIGHTMARGIN, 310 -// VERTGUIDE, 21 -// VERTGUIDE, 31 -// VERTGUIDE, 286 -// VERTGUIDE, 296 -// TOPMARGIN, 7 -// BOTTOMMARGIN, 136 -// HORZGUIDE, 8 -// END -// -// IDD_WIZ97_EXTERIOR_BLANK, DIALOG -// BEGIN -// RIGHTMARGIN, 310 -// VERTGUIDE, 115 -// VERTGUIDE, 118 -// VERTGUIDE, 127 -// TOPMARGIN, 7 -// BOTTOMMARGIN, 186 -// HORZGUIDE, 8 -// HORZGUIDE, 32 -// HORZGUIDE, 40 -// HORZGUIDE, 169 -// END -// END - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97SheetWindow - client side for a Wizard 97 style wizard sheet - -class CWizard97SheetWindow : public CPropertySheetWindow -{ -public: -// Constructors - CWizard97SheetWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) - { } - - CWizard97SheetWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations - HFONT GetExteriorPageTitleFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HFONT)::SendMessage(m_hWnd, GetMessage_GetExteriorPageTitleFont(), 0, 0L); - } - - HFONT GetBulletFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HFONT)::SendMessage(m_hWnd, GetMessage_GetBulletFont(), 0, 0L); - } - -// Helpers - static UINT GetMessage_GetExteriorPageTitleFont() - { - static UINT uGetExteriorPageTitleFont = 0; - if(uGetExteriorPageTitleFont == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont().\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uGetExteriorPageTitleFont == 0) - uGetExteriorPageTitleFont = ::RegisterWindowMessage(_T("GetExteriorPageTitleFont_531AF056-B8BE-4c4c-B786-AC608DF0DF12")); - - lock.Unlock(); - } - ATLASSERT(uGetExteriorPageTitleFont != 0); - return uGetExteriorPageTitleFont; - } - - static UINT GetMessage_GetBulletFont() - { - static UINT uGetBulletFont = 0; - if(uGetBulletFont == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetBulletFont().\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uGetBulletFont == 0) - uGetBulletFont = ::RegisterWindowMessage(_T("GetBulletFont_AD347D08-8F65-45ef-982E-6352E8218AD5")); - - lock.Unlock(); - } - ATLASSERT(uGetBulletFont != 0); - return uGetBulletFont; - } - -// Implementation - override to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97SheetImpl - implements a Wizard 97 style wizard sheet - -template -class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97SheetImpl< T, TBase > thisClass; - typedef CPropertySheetImpl< T, TBase > baseClass; - -// Member variables - CFont m_fontExteriorPageTitle; // Welcome and Completion page title font - CFont m_fontBullet; // Bullet font (used on static text 'h' to produce a small bullet) - bool m_bReceivedFirstSizeMessage; - -public: - CWizard97SheetImpl(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : - baseClass(title, uStartPage, hWndParent), - m_bReceivedFirstSizeMessage(false) - { - m_psh.dwFlags &= ~(PSH_NOCONTEXTHELP); - m_psh.dwFlags &= ~(PSH_WIZARD | PSH_WIZARD_LITE); - - m_psh.dwFlags |= (PSH_HASHELP | PSH_WIZARDCONTEXTHELP); - m_psh.dwFlags |= PSH_WIZARD97; - - baseClass::SetHeader(headerBitmap.m_lpstr); - baseClass::SetWatermark(watermarkBitmap.m_lpstr); - } - -// Overrides from base class - void OnSheetInitialized() - { - T* pT = static_cast(this); - pT->_InitializeFonts(); - - // We'd like to center the wizard here, but its too early. - // Instead, we'll do CenterWindow upon our first WM_SIZE message - } - -// Initialization - void _InitializeFonts() - { - // Setup the Title and Bullet Font - // (Property pages can send the "get external page title font" and "get bullet font" messages) - // The derived class needs to do the actual SetFont for the dialog items) - - CFontHandle fontThisDialog = this->GetFont(); - CClientDC dcScreen(NULL); - - LOGFONT titleLogFont = {0}; - LOGFONT bulletLogFont = {0}; - fontThisDialog.GetLogFont(&titleLogFont); - fontThisDialog.GetLogFont(&bulletLogFont); - - // The Wizard 97 Spec recommends to do the Title Font - // as Verdana Bold, 12pt. - titleLogFont.lfCharSet = DEFAULT_CHARSET; - titleLogFont.lfWeight = FW_BOLD; - SecureHelper::strcpy_x(titleLogFont.lfFaceName, _countof(titleLogFont.lfFaceName), _T("Verdana Bold")); - INT titleFontPointSize = 12; - titleLogFont.lfHeight = -::MulDiv(titleFontPointSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); - m_fontExteriorPageTitle.CreateFontIndirect(&titleLogFont); - - // The Wizard 97 Spec recommends to do Bullets by having - // static text of "h" in the Marlett font. - bulletLogFont.lfCharSet = DEFAULT_CHARSET; - bulletLogFont.lfWeight = FW_NORMAL; - SecureHelper::strcpy_x(bulletLogFont.lfFaceName, _countof(bulletLogFont.lfFaceName), _T("Marlett")); - INT bulletFontSize = 8; - bulletLogFont.lfHeight = -::MulDiv(bulletFontSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); - m_fontBullet.CreateFontIndirect(&bulletLogFont); - } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont(), OnGetExteriorPageTitleFont) - MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetBulletFont(), OnGetBulletFont) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() - - LRESULT OnGetExteriorPageTitleFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)(HFONT)m_fontExteriorPageTitle; - } - - LRESULT OnGetBulletFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)(HFONT)m_fontBullet; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(!m_bReceivedFirstSizeMessage) - { - m_bReceivedFirstSizeMessage = true; - this->CenterWindow(); - } - - bHandled = FALSE; - return 0; - } -}; - -// for non-customized sheets -class CWizard97Sheet : public CWizard97SheetImpl -{ -protected: -// Typedefs - typedef CWizard97Sheet thisClass; - typedef CWizard97SheetImpl baseClass; - -public: - CWizard97Sheet(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : - baseClass(title, headerBitmap, watermarkBitmap, uStartPage, hWndParent) - { } - - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97PageWindow - client side for a Wizard 97 style wizard page - -#define WIZARD97_EXTERIOR_CXDLG 317 -#define WIZARD97_EXTERIOR_CYDLG 193 - -#define WIZARD97_INTERIOR_CXDLG 317 -#define WIZARD97_INTERIOR_CYDLG 143 - -class CWizard97PageWindow : public CPropertyPageWindow -{ -public: -// Constructors - CWizard97PageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) - { } - - CWizard97PageWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - CWizard97SheetWindow GetPropertySheet() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CWizard97SheetWindow(GetParent()); - } - -// Operations - HFONT GetExteriorPageTitleFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return GetPropertySheet().GetExteriorPageTitleFont(); - } - - HFONT GetBulletFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return GetPropertySheet().GetBulletFont(); - } - -// Implementation - overrides to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } - -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97PageImpl - implements a Wizard 97 style wizard page - -template -class ATL_NO_VTABLE CWizard97PageImpl : public CPropertyPageImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97PageImpl< T, TBase > thisClass; - typedef CPropertyPageImpl< T, TBase > baseClass; - -public: - CWizard97PageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) - { } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97ExteriorPageImpl - implements a Wizard 97 style exterior wizard page - -template -class ATL_NO_VTABLE CWizard97ExteriorPageImpl : public CPropertyPageImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97ExteriorPageImpl< T, TBase > thisClass; - typedef CPropertyPageImpl< T, TBase > baseClass; - -public: -// Constructors - CWizard97ExteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) - { - m_psp.dwFlags |= PSP_HASHELP; - m_psp.dwFlags |= PSP_HIDEHEADER; - } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97InteriorPageImpl - implements a Wizard 97 style interior wizard page - -template -class ATL_NO_VTABLE CWizard97InteriorPageImpl : public CPropertyPageImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97InteriorPageImpl< T, TBase > thisClass; - typedef CPropertyPageImpl< T, TBase > baseClass; - -public: -// Constructors - CWizard97InteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) - { - m_psp.dwFlags |= PSP_HASHELP; - m_psp.dwFlags &= ~PSP_HIDEHEADER; - m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - - // Be sure to have the derived class define this in the constructor. - // We'll default it to something obvious in case its forgotten. - baseClass::SetHeaderTitle(_T("Call SetHeaderTitle in Derived Class")); - baseClass::SetHeaderSubTitle(_T("Call SetHeaderSubTitle in the constructor of the Derived Class.")); - } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// Aero Wizard support - -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardFrameWindow - client side for an Aero Wizard frame window - -class CAeroWizardFrameWindow : public CPropertySheetWindow -{ -public: -// Constructors - CAeroWizardFrameWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) - { } - - CAeroWizardFrameWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations - new, Aero Wizard only - void SetNextText(LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETNEXTTEXT, 0, (LPARAM)lpszText); - } - - void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::PostMessage(m_hWnd, PSM_SHOWWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); - } - - void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::PostMessage(m_hWnd, PSM_ENABLEWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); - } - - void SetButtonText(DWORD dwButton, LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETBUTTONTEXT, (WPARAM)dwButton, (LPARAM)lpszText); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardFrameImpl - implements an Aero Wizard frame - -template -class ATL_NO_VTABLE CAeroWizardFrameImpl : public CPropertySheetImpl -{ -public: -// Constructor - CAeroWizardFrameImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : - CPropertySheetImpl(title, uStartPage, hWndParent) - { - m_psh.dwFlags |= PSH_WIZARD | PSH_AEROWIZARD; - } - -// Operations - void EnableResizing() - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_RESIZABLE; - } - - void UseHeaderBitmap() - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_HEADERBITMAP; - } - - void SetNoMargin() - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_NOMARGIN; - } - -// Override to prevent use - HWND Create(HWND /*hWndParent*/ = NULL) - { - ATLASSERT(FALSE); // not supported for Aero Wizard - return NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardFrame - for non-customized frames - -class CAeroWizardFrame : public CAeroWizardFrameImpl -{ -public: - CAeroWizardFrame(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) - : CAeroWizardFrameImpl(title, uStartPage, hWndParent) - { } - - BEGIN_MSG_MAP(CAeroWizardFrame) - MESSAGE_HANDLER(WM_COMMAND, CAeroWizardFrameImpl::OnCommand) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardPageWindow - client side for an Aero Wizard page - -class CAeroWizardPageWindow : public CPropertyPageWindow -{ -public: -// Constructors - CAeroWizardPageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) - { } - - CAeroWizardPageWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - CAeroWizardFrameWindow GetAeroWizardFrame() const - { - ATLASSERT(::IsWindow(m_hWnd)); - // This is not really top-level frame window, but it processes all frame messages - return CAeroWizardFrameWindow(GetParent()); - } - -// Operations - new, Aero Wizard only - void SetNextText(LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().SetNextText(lpszText); - } - - void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().ShowWizardButtons(dwButtons, dwStates); - } - - void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().EnableWizardButtons(dwButtons, dwStates); - } - - void SetButtonText(DWORD dwButton, LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().SetButtonText(dwButton, lpszText); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardPageImpl - implements an Aero Wizard page - -template -class ATL_NO_VTABLE CAeroWizardPageImpl : public CPropertyPageImpl -{ -public: - CAeroWizardPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardPage - for non-customized pages - -template -class CAeroWizardPage : public CAeroWizardPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CAeroWizardPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardPageImpl(title) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - - -#ifndef _ATL_NO_HOSTING - -// Note: You must #include to use these classes - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardAxPageImpl - Aero Wizard page that hosts ActiveX controls - -template -class ATL_NO_VTABLE CAeroWizardAxPageImpl : public CAxPropertyPageImpl< T, TBase > -{ -public: - CAeroWizardAxPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl< T, TBase >(title) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardAxPage - for non-customized pages - -template -class CAeroWizardAxPage : public CAeroWizardAxPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CAeroWizardAxPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardAxPageImpl(title) - { } - -#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) - // not empty so we handle accelerators/create controls - BEGIN_MSG_MAP(CAeroWizardAxPage) - CHAIN_MSG_MAP(CAeroWizardAxPageImpl >) - END_MSG_MAP() -#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) - DECLARE_EMPTY_MSG_MAP() -#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) -}; - -#endif // _ATL_NO_HOSTING - -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// TaskDialog support - -#if ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) - -/////////////////////////////////////////////////////////////////////////////// -// AtlTaskDialog - support for TaskDialog() function - -inline int AtlTaskDialog(HWND hWndParent, - ATL::_U_STRINGorID WindowTitle, ATL::_U_STRINGorID MainInstructionText, ATL::_U_STRINGorID ContentText, - TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons = 0U, ATL::_U_STRINGorID Icon = (LPCTSTR)NULL) -{ - int nRet = -1; - -#ifdef _WTL_TASKDIALOG_DIRECT - USES_CONVERSION; - HRESULT hRet = ::TaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), - IS_INTRESOURCE(WindowTitle.m_lpstr) ? (LPCWSTR) WindowTitle.m_lpstr : T2CW(WindowTitle.m_lpstr), - IS_INTRESOURCE(MainInstructionText.m_lpstr) ? (LPCWSTR) MainInstructionText.m_lpstr : T2CW(MainInstructionText.m_lpstr), - IS_INTRESOURCE(ContentText.m_lpstr) ? (LPCWSTR) ContentText.m_lpstr : T2CW(ContentText.m_lpstr), - dwCommonButtons, - IS_INTRESOURCE(Icon.m_lpstr) ? (LPCWSTR) Icon.m_lpstr : T2CW(Icon.m_lpstr), - &nRet); - ATLVERIFY(SUCCEEDED(hRet)); -#else - // This allows apps to run on older versions of Windows - typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialog)(HWND hwndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle, PCWSTR pszMainInstruction, PCWSTR pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon, int* pnButton); - - HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - if(m_hCommCtrlDLL != NULL) - { - PFN_TaskDialog pfnTaskDialog = (PFN_TaskDialog)::GetProcAddress(m_hCommCtrlDLL, "TaskDialog"); - if(pfnTaskDialog != NULL) - { - USES_CONVERSION; - HRESULT hRet = pfnTaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), - IS_INTRESOURCE(WindowTitle.m_lpstr) ? (LPCWSTR) WindowTitle.m_lpstr : T2CW(WindowTitle.m_lpstr), - IS_INTRESOURCE(MainInstructionText.m_lpstr) ? (LPCWSTR) MainInstructionText.m_lpstr : T2CW(MainInstructionText.m_lpstr), - IS_INTRESOURCE(ContentText.m_lpstr) ? (LPCWSTR) ContentText.m_lpstr : T2CW(ContentText.m_lpstr), - dwCommonButtons, - IS_INTRESOURCE(Icon.m_lpstr) ? (LPCWSTR) Icon.m_lpstr : T2CW(Icon.m_lpstr), - &nRet); - ATLVERIFY(SUCCEEDED(hRet)); - } - - ::FreeLibrary(m_hCommCtrlDLL); - } -#endif - - return nRet; -} - - -/////////////////////////////////////////////////////////////////////////////// -// CTaskDialogConfig - TASKDIALOGCONFIG wrapper - -class CTaskDialogConfig : public TASKDIALOGCONFIG -{ -public: -// Constructor - CTaskDialogConfig() - { - Init(); - } - - void Init() - { - memset(this, 0, sizeof(TASKDIALOGCONFIG)); // initialize structure to 0/NULL - this->cbSize = sizeof(TASKDIALOGCONFIG); - this->hInstance = ModuleHelper::GetResourceInstance(); - } - -// Operations - setting values - // common buttons - void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) - { - this->dwCommonButtons = dwCommonButtons; - } - - // window title text - void SetWindowTitle(UINT nID) - { - this->pszWindowTitle = MAKEINTRESOURCEW(nID); - } - - void SetWindowTitle(LPCWSTR lpstrWindowTitle) - { - this->pszWindowTitle = lpstrWindowTitle; - } - - // main icon - void SetMainIcon(HICON hIcon) - { - this->dwFlags |= TDF_USE_HICON_MAIN; - this->hMainIcon = hIcon; - } - - void SetMainIcon(UINT nID) - { - this->dwFlags &= ~TDF_USE_HICON_MAIN; - this->pszMainIcon = MAKEINTRESOURCEW(nID); - } - - void SetMainIcon(LPCWSTR lpstrMainIcon) - { - this->dwFlags &= ~TDF_USE_HICON_MAIN; - this->pszMainIcon = lpstrMainIcon; - } - - // main instruction text - void SetMainInstructionText(UINT nID) - { - this->pszMainInstruction = MAKEINTRESOURCEW(nID); - } - - void SetMainInstructionText(LPCWSTR lpstrMainInstruction) - { - this->pszMainInstruction = lpstrMainInstruction; - } - - // content text - void SetContentText(UINT nID) - { - this->pszContent = MAKEINTRESOURCEW(nID); - } - - void SetContentText(LPCWSTR lpstrContent) - { - this->pszContent = lpstrContent; - } - - // buttons - void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) - { - this->pButtons = pButtons; - this->cButtons = cButtons; - if(nDefaultButton != 0) - this->nDefaultButton = nDefaultButton; - } - - void SetDefaultButton(int nDefaultButton) - { - this->nDefaultButton = nDefaultButton; - } - - // radio buttons - void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) - { - this->pRadioButtons = pRadioButtons; - this->cRadioButtons = cRadioButtons; - if(nDefaultRadioButton != 0) - this->nDefaultRadioButton = nDefaultRadioButton; - } - - void SetDefaultRadioButton(int nDefaultRadioButton) - { - this->nDefaultRadioButton = nDefaultRadioButton; - } - - // verification text - void SetVerificationText(UINT nID) - { - this->pszVerificationText = MAKEINTRESOURCEW(nID); - } - - void SetVerificationText(LPCWSTR lpstrVerificationText) - { - this->pszVerificationText = lpstrVerificationText; - } - - // expanded information text - void SetExpandedInformationText(UINT nID) - { - this->pszExpandedInformation = MAKEINTRESOURCEW(nID); - } - - void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) - { - this->pszExpandedInformation = lpstrExpandedInformation; - } - - // expanded control text - void SetExpandedControlText(UINT nID) - { - this->pszExpandedControlText = MAKEINTRESOURCEW(nID); - } - - void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) - { - this->pszExpandedControlText = lpstrExpandedControlText; - } - - // collapsed control text - void SetCollapsedControlText(UINT nID) - { - this->pszCollapsedControlText = MAKEINTRESOURCEW(nID); - } - - void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) - { - this->pszCollapsedControlText = lpstrCollapsedControlText; - } - - // footer icon - void SetFooterIcon(HICON hIcon) - { - this->dwFlags |= TDF_USE_HICON_FOOTER; - this->hFooterIcon = hIcon; - } - - void SetFooterIcon(UINT nID) - { - this->dwFlags &= ~TDF_USE_HICON_FOOTER; - this->pszFooterIcon = MAKEINTRESOURCEW(nID); - } - - void SetFooterIcon(LPCWSTR lpstrFooterIcon) - { - this->dwFlags &= ~TDF_USE_HICON_FOOTER; - this->pszFooterIcon = lpstrFooterIcon; - } - - // footer text - void SetFooterText(UINT nID) - { - this->pszFooter = MAKEINTRESOURCEW(nID); - } - - void SetFooterText(LPCWSTR lpstrFooterText) - { - this->pszFooter = lpstrFooterText; - } - - // width (in DLUs) - void SetWidth(UINT cxWidth) - { - this->cxWidth = cxWidth; - } - - // modify flags - void ModifyFlags(DWORD dwRemove, DWORD dwAdd) - { - this->dwFlags = (this->dwFlags & ~dwRemove) | dwAdd; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTaskDialogImpl - implements a Task Dialog - -template -class ATL_NO_VTABLE CTaskDialogImpl -{ -public: - CTaskDialogConfig m_tdc; - HWND m_hWnd; // used only in callback functions - -// Constructor - CTaskDialogImpl(HWND hWndParent = NULL) : m_hWnd(NULL) - { - m_tdc.hwndParent = hWndParent; - m_tdc.pfCallback = T::TaskDialogCallback; - m_tdc.lpCallbackData = (LONG_PTR)static_cast(this); - } - -// Operations - HRESULT DoModal(HWND hWndParent = ::GetActiveWindow(), int* pnButton = NULL, int* pnRadioButton = NULL, BOOL* pfVerificationFlagChecked = NULL) - { - if(m_tdc.hwndParent == NULL) - m_tdc.hwndParent = hWndParent; - -#ifdef _WTL_TASKDIALOG_DIRECT - return ::TaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); -#else - - // This allows apps to run on older versions of Windows - typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialogIndirect)(const TASKDIALOGCONFIG* pTaskConfig, int* pnButton, int* pnRadioButton, BOOL* pfVerificationFlagChecked); - - HRESULT hRet = E_UNEXPECTED; - HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - if(m_hCommCtrlDLL != NULL) - { - PFN_TaskDialogIndirect pfnTaskDialogIndirect = (PFN_TaskDialogIndirect)::GetProcAddress(m_hCommCtrlDLL, "TaskDialogIndirect"); - if(pfnTaskDialogIndirect != NULL) - hRet = pfnTaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); - - ::FreeLibrary(m_hCommCtrlDLL); - } - - return hRet; -#endif - } - -// Operations - setting values of TASKDIALOGCONFIG - // common buttons - void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) - { m_tdc.SetCommonButtons(dwCommonButtons); } - // window title text - void SetWindowTitle(UINT nID) - { m_tdc.SetWindowTitle(nID); } - void SetWindowTitle(LPCWSTR lpstrWindowTitle) - { m_tdc.SetWindowTitle(lpstrWindowTitle); } - // main icon - void SetMainIcon(HICON hIcon) - { m_tdc.SetMainIcon(hIcon); } - void SetMainIcon(UINT nID) - { m_tdc.SetMainIcon(nID); } - void SetMainIcon(LPCWSTR lpstrMainIcon) - { m_tdc.SetMainIcon(lpstrMainIcon); } - // main instruction text - void SetMainInstructionText(UINT nID) - { m_tdc.SetMainInstructionText(nID); } - void SetMainInstructionText(LPCWSTR lpstrMainInstruction) - { m_tdc.SetMainInstructionText(lpstrMainInstruction); } - // content text - void SetContentText(UINT nID) - { m_tdc.SetContentText(nID); } - void SetContentText(LPCWSTR lpstrContent) - { m_tdc.SetContentText(lpstrContent); } - // buttons - void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) - { m_tdc.SetButtons(pButtons, cButtons, nDefaultButton); } - void SetDefaultButton(int nDefaultButton) - { m_tdc.SetDefaultButton(nDefaultButton); } - // radio buttons - void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) - { m_tdc.SetRadioButtons(pRadioButtons, cRadioButtons, nDefaultRadioButton); } - void SetDefaultRadioButton(int nDefaultRadioButton) - { m_tdc.SetDefaultRadioButton(nDefaultRadioButton); } - // verification text - void SetVerificationText(UINT nID) - { m_tdc.SetVerificationText(nID); } - void SetVerificationText(LPCWSTR lpstrVerificationText) - { m_tdc.SetVerificationText(lpstrVerificationText); } - // expanded information text - void SetExpandedInformationText(UINT nID) - { m_tdc.SetExpandedInformationText(nID); } - void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) - { m_tdc.SetExpandedInformationText(lpstrExpandedInformation); } - // expanded control text - void SetExpandedControlText(UINT nID) - { m_tdc.SetExpandedControlText(nID); } - void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) - { m_tdc.SetExpandedControlText(lpstrExpandedControlText); } - // collapsed control text - void SetCollapsedControlText(UINT nID) - { m_tdc.SetCollapsedControlText(nID); } - void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) - { m_tdc.SetCollapsedControlText(lpstrCollapsedControlText); } - // footer icon - void SetFooterIcon(HICON hIcon) - { m_tdc.SetFooterIcon(hIcon); } - void SetFooterIcon(UINT nID) - { m_tdc.SetFooterIcon(nID); } - void SetFooterIcon(LPCWSTR lpstrFooterIcon) - { m_tdc.SetFooterIcon(lpstrFooterIcon); } - // footer text - void SetFooterText(UINT nID) - { m_tdc.SetFooterText(nID); } - void SetFooterText(LPCWSTR lpstrFooterText) - { m_tdc.SetFooterText(lpstrFooterText); } - // width (in DLUs) - void SetWidth(UINT cxWidth) - { m_tdc.SetWidth(cxWidth); } - // modify flags - void ModifyFlags(DWORD dwRemove, DWORD dwAdd) - { m_tdc.ModifyFlags(dwRemove, dwAdd); } - -// Implementation - static HRESULT CALLBACK TaskDialogCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) - { - T* pT = (T*)lpRefData; - ATLASSERT(pT->m_hWnd == NULL || pT->m_hWnd == hWnd); - - BOOL bRet = FALSE; - switch(uMsg) - { - case TDN_DIALOG_CONSTRUCTED: - pT->m_hWnd = hWnd; - pT->OnDialogConstructed(); - break; - case TDN_CREATED: - pT->OnCreated(); - break; - case TDN_BUTTON_CLICKED: - bRet = pT->OnButtonClicked((int)wParam); - break; - case TDN_RADIO_BUTTON_CLICKED: - pT->OnRadioButtonClicked((int)wParam); - break; - case TDN_HYPERLINK_CLICKED: - pT->OnHyperlinkClicked((LPCWSTR)lParam); - break; - case TDN_EXPANDO_BUTTON_CLICKED: - pT->OnExpandoButtonClicked((wParam != 0)); - break; - case TDN_VERIFICATION_CLICKED: - pT->OnVerificationClicked((wParam != 0)); - break; - case TDN_HELP: - pT->OnHelp(); - break; - case TDN_TIMER: - bRet = pT->OnTimer((DWORD)wParam); - break; - case TDN_NAVIGATED: - pT->OnNavigated(); - break; - case TDN_DESTROYED: - pT->OnDestroyed(); - pT->m_hWnd = NULL; - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown notification received in CTaskDialogImpl::TaskDialogCallback\n")); - break; - } - - return (HRESULT)bRet; - } - -// Overrideables - notification handlers - void OnDialogConstructed() - { - } - - void OnCreated() - { - } - - BOOL OnButtonClicked(int /*nButton*/) - { - return FALSE; // don't prevent dialog to close - } - - void OnRadioButtonClicked(int /*nRadioButton*/) - { - } - - void OnHyperlinkClicked(LPCWSTR /*pszHREF*/) - { - } - - void OnExpandoButtonClicked(bool /*bExpanded*/) - { - } - - void OnVerificationClicked(bool /*bChecked*/) - { - } - - void OnHelp() - { - } - - BOOL OnTimer(DWORD /*dwTickCount*/) - { - return FALSE; // don't reset counter - } - - void OnNavigated() - { - } - - void OnDestroyed() - { - } - -// Commands - valid to call only from handlers - void NavigatePage(TASKDIALOGCONFIG& tdc) - { - ATLASSERT(m_hWnd != NULL); - - tdc.cbSize = sizeof(TASKDIALOGCONFIG); - if(tdc.hwndParent == NULL) - tdc.hwndParent = m_tdc.hwndParent; - tdc.pfCallback = m_tdc.pfCallback; - tdc.lpCallbackData = m_tdc.lpCallbackData; - (TASKDIALOGCONFIG)m_tdc = tdc; - - ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&tdc); - } - - // modify TASKDIALOGCONFIG values, then call this to update task dialog - void NavigatePage() - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&m_tdc); - } - - void ClickButton(int nButton) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_CLICK_BUTTON, nButton, 0L); - } - - void SetMarqueeProgressBar(BOOL bMarquee) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_SET_MARQUEE_PROGRESS_BAR, bMarquee, 0L); - } - - BOOL SetProgressBarState(int nNewState) - { - ATLASSERT(m_hWnd != NULL); - return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_STATE, nNewState, 0L); - } - - DWORD SetProgressBarRange(int nMinRange, int nMaxRange) - { - ATLASSERT(m_hWnd != NULL); - return (DWORD)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(nMinRange, nMaxRange)); - } - - int SetProgressBarPos(int nNewPos) - { - ATLASSERT(m_hWnd != NULL); - return (int)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_POS, nNewPos, 0L); - } - - BOOL SetProgressBarMarquee(BOOL bMarquee, UINT uSpeed) - { - ATLASSERT(m_hWnd != NULL); - return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_MARQUEE, bMarquee, uSpeed); - } - - void SetElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_SET_ELEMENT_TEXT, element, (LPARAM)lpstrText); - } - - void ClickRadioButton(int nRadioButton) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_CLICK_RADIO_BUTTON, nRadioButton, 0L); - } - - void EnableButton(int nButton, BOOL bEnable) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_ENABLE_BUTTON, nButton, bEnable); - } - - void EnableRadioButton(int nButton, BOOL bEnable) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_ENABLE_RADIO_BUTTON, nButton, bEnable); - } - - void ClickVerification(BOOL bCheck, BOOL bFocus) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_CLICK_VERIFICATION, bCheck, bFocus); - } - - void UpdateElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_UPDATE_ELEMENT_TEXT, element, (LPARAM)lpstrText); - } - - void SetButtonElevationRequiredState(int nButton, BOOL bElevation) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, nButton, bElevation); - } - - void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, HICON hIcon) - { - ATLASSERT(m_hWnd != NULL); -#ifdef _DEBUG - if(element == TDIE_ICON_MAIN) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) != 0); - else if(element == TDIE_ICON_FOOTER) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) != 0); -#endif // _DEBUG - ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)hIcon); - } - - void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, LPCWSTR lpstrIcon) - { - ATLASSERT(m_hWnd != NULL); -#ifdef _DEBUG - if(element == TDIE_ICON_MAIN) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) == 0); - else if(element == TDIE_ICON_FOOTER) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) == 0); -#endif // _DEBUG - ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)lpstrIcon); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTaskDialog - for non-customized task dialogs - -class CTaskDialog : public CTaskDialogImpl -{ -public: - CTaskDialog(HWND hWndParent = NULL) : CTaskDialogImpl(hWndParent) - { - m_tdc.pfCallback = NULL; - } -}; - -#endif // ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) - -}; // namespace WTL - -#endif // __ATLDLGS_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atldwm.h b/GLideN64/src/GLideNUI-wtl/WTL/atldwm.h deleted file mode 100644 index e6377f4..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atldwm.h +++ /dev/null @@ -1,461 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLDWM_H__ -#define __ATLDWM_H__ - -#pragma once - -#ifdef _WIN32_WCE - #error atldwm.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atldwm.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atldwm.h requires atlwin.h to be included first -#endif - -#if (_WIN32_WINNT < 0x0600) - #error atldwm.h requires _WIN32_WINNT >= 0x0600 -#endif // (_WIN32_WINNT < 0x0600) - -#ifndef _DWMAPI_H_ -#include -#endif // _DWMAPI_H_ -#pragma comment(lib, "dwmapi.lib") - -// Note: To create an application that also runs on older versions of Windows, -// use delay load of dwmapi.dll and ensure that no calls to the DWM API are -// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, -// and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the -// project properties. -#if (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD) - #pragma comment(lib, "delayimp.lib") - #pragma comment(linker, "/delayload:dwmapi.dll") -#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD) - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CDwm -// CDwmImpl -// CDwmWindowT - CDwmWindow -// CDwmThumbnailT -// CDwmThumbnail -// CDwmThumbnailHandle -// CAeroControlImpl - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CDwm - wrapper for DWM handle - -class CDwm -{ -public: -// Data members - static int m_nIsDwmSupported; - -// Constructor - CDwm() - { - IsDwmSupported(); - } - -// Dwm support helper - static bool IsDwmSupported() - { - if(m_nIsDwmSupported == -1) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDwm::IsDwmSupported.\n")); - ATLASSERT(FALSE); - return false; - } - - if(m_nIsDwmSupported == -1) - { - HMODULE hDwmDLL = ::LoadLibrary(_T("dwmapi.dll")); - m_nIsDwmSupported = (hDwmDLL != NULL) ? 1 : 0; - if(hDwmDLL != NULL) - ::FreeLibrary(hDwmDLL); - } - - lock.Unlock(); - } - - ATLASSERT(m_nIsDwmSupported != -1); - return (m_nIsDwmSupported == 1); - } - -// Operations - BOOL DwmIsCompositionEnabled() const - { - if(!IsDwmSupported()) return FALSE; - BOOL bRes = FALSE; - return SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes; - } - - BOOL DwmEnableComposition(UINT fEnable) - { - if(!IsDwmSupported()) return FALSE; - return SUCCEEDED(::DwmEnableComposition(fEnable)); - } - - BOOL DwmEnableMMCSS(BOOL fEnableMMCSS) - { - if(!IsDwmSupported()) return FALSE; - return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)); - } - - HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend) - { - if(!IsDwmSupported()) return E_NOTIMPL; - return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend); - } - - HRESULT DwmFlush() - { - if(!IsDwmSupported()) return E_NOTIMPL; - return ::DwmFlush(); - } -}; - -__declspec(selectany) int CDwm::m_nIsDwmSupported = -1; - - -/////////////////////////////////////////////////////////////////////////////// -// CDwmImpl - DWM window support - -template -class CDwmImpl : public TBase -{ -public: - HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB); - } - - HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins); - } - - HRESULT DwmExtendFrameIntoEntireClientArea() - { - MARGINS margins = { -1 }; - return DwmExtendFrameIntoClientArea(&margins); - } - - HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo); - } - - HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); - } - - HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative); - } - - HRESULT DwmSetDxFrameDuration(INT cRefreshes) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes); - } - - HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams); - } - - HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute) - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); - } - - HRESULT DwmAttachMilContent() - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmAttachMilContent(pT->m_hWnd); - } - - HRESULT DwmDetachMilContent() - { - if(!IsDwmSupported()) return E_NOTIMPL; - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DwmDetachMilContent(pT->m_hWnd); - } -}; - -template -class CDwmWindowT : public TBase, public CDwmImpl > -{ -public: - CDwmWindowT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CDwmWindowT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } -}; - -typedef CDwmWindowT CDwmWindow; - - -/////////////////////////////////////////////////////////////////////////////// -// CDwmThumbnail - provides DWM thumbnail support - -template -class CDwmThumbnailT : public TBase -{ -public: -// Data members - HTHUMBNAIL m_hThumbnail; - -// Constructor - CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail) - { - } - - ~CDwmThumbnailT() - { - if(t_bManaged && m_hThumbnail != NULL) - Unregister(); - } - -// Operations - CDwmThumbnailT& operator =(HTHUMBNAIL hThumbnail) - { - Attach(hThumbnail); - return *this; - } - - void Attach(HTHUMBNAIL hThumbnailNew) - { - if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew) - Unregister(); - m_hThumbnail = hThumbnailNew; - } - - HTHUMBNAIL Detach() - { - HTHUMBNAIL hThumbnail = m_hThumbnail; - m_hThumbnail = NULL; - return hThumbnail; - } - - HRESULT Register(HWND hwndDestination, HWND hwndSource) - { - ATLASSERT(::IsWindow(hwndDestination)); - ATLASSERT(::IsWindow(hwndSource)); - ATLASSERT(m_hThumbnail==NULL); - if(!IsDwmSupported()) return E_NOTIMPL; - return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail); - } - - HRESULT Unregister() - { - if(!IsDwmSupported()) return E_NOTIMPL; - if(m_hThumbnail == NULL) return S_FALSE; - HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail); - if(SUCCEEDED(Hr)) m_hThumbnail = NULL; - return Hr; - } - - operator HTHUMBNAIL() const { return m_hThumbnail; } - - bool IsNull() const { return (m_hThumbnail == NULL); } - - HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties) - { - if(!IsDwmSupported()) return E_NOTIMPL; - ATLASSERT(m_hThumbnail != NULL); - return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties); - } - -// Attributes - HRESULT QuerySourceSize(PSIZE pSize) - { - if(!IsDwmSupported()) return E_NOTIMPL; - ATLASSERT(m_hThumbnail != NULL); - return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize); - } -}; - -typedef CDwmThumbnailT CDwmThumbnail; -typedef CDwmThumbnailT CDwmThumbnailHandle; - - -#ifdef __ATLTHEME_H__ - -/////////////////////////////////////////////////////////////////////////////// -// CAeroControlImpl - Base class for controls on Glass - -template -class CAeroControlImpl : - public CThemeImpl, - public CBufferedPaintImpl, - public ATL::CWindowImpl -{ -public: - typedef CThemeImpl _themeClass; - typedef CBufferedPaintImpl _baseClass; - typedef ATL::CWindowImpl _windowClass; - - CAeroControlImpl() - { - m_PaintParams.dwFlags = BPPF_ERASE; - } - - static LPCWSTR GetThemeName() - { -#ifdef _UNICODE - return TBase::GetWndClassName(); -#else - ATLASSERT(!_T("Return UNICODE string of window classname / theme class")); - return NULL; -#endif // _UNICODE - } - -// Message map and handlers - BEGIN_MSG_MAP(CAeroControlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) - CHAIN_MSG_MAP(_themeClass) - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->Init(); - bHandled = FALSE; - return 0; - } - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(IsThemingSupported()) Invalidate(FALSE); - bHandled = FALSE; - return 0; - } - -// Operations - BOOL SubclassWindow(HWND hWnd) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - BOOL bRet = _windowClass::SubclassWindow(hWnd); - if(bRet) { - T* pT = static_cast(this); - pT->Init(); - } - return bRet; - } - -// Implementation - LRESULT DefWindowProc() - { - const _ATL_MSG* pMsg = m_pCurrentMsg; - LRESULT lRes = 0; - if(pMsg != NULL) - lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); - return lRes; - } - - LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) - { - T* pT = static_cast(this); - LRESULT lRes = 0; - if( ::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) ) return lRes; - return _windowClass::DefWindowProc(uMsg, wParam, lParam); - } - - void DoBufferedPaint(HDC hDC, RECT& rcPaint) - { - T* pT = static_cast(this); - HDC hDCPaint = NULL; - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint); - ATLASSERT(hDCPaint != NULL); - pT->DoAeroPaint(hDCPaint, rcClient, rcPaint); - m_BufferedPaint.End(); - } - - void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/) - { - DefWindowProc(); - } - -// Overridables - void Init() - { - T* pT = static_cast(this); - SetThemeClassList(pT->GetThemeName()); - if(m_lpstrThemeClassList != NULL) - OpenThemeData(); - } - - void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint) - { - DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L); - m_BufferedPaint.MakeOpaque(&rcPaint); - } -}; - -#endif // __ATLTHEME_H__ - - -}; // namespace WTL - - -#endif // __ATLDWM_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlfind.h b/GLideN64/src/GLideNUI-wtl/WTL/atlfind.h deleted file mode 100644 index 4f82824..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlfind.h +++ /dev/null @@ -1,1032 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLFIND_H__ -#define __ATLFIND_H__ - -#pragma once - -#ifdef _WIN32_WCE - #error atlfind.h is not supported on Windows CE -#endif - -#ifndef __ATLCTRLS_H__ - #error atlfind.h requires atlctrls.h to be included first -#endif - -#ifndef __ATLDLGS_H__ - #error atlfind.h requires atldlgs.h to be included first -#endif - -#if !((defined(__ATLMISC_H__) && defined(_WTL_USE_CSTRING)) || defined(__ATLSTR_H__)) - #error atlfind.h requires CString (either from ATL's atlstr.h or WTL's atlmisc.h with _WTL_USE_CSTRING) -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CEditFindReplaceImplBase -// CEditFindReplaceImpl -// CRichEditFindReplaceImpl - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CEditFindReplaceImplBase - Base class for mixin classes that -// help implement Find/Replace for CEdit or CRichEditCtrl based window classes. - -template -class CEditFindReplaceImplBase -{ -protected: -// Typedefs - typedef CEditFindReplaceImplBase thisClass; - -// Data members - TFindReplaceDialog* m_pFindReplaceDialog; - _CSTRING_NS::CString m_sFindNext, m_sReplaceWith; - BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown; - LONG m_nInitialSearchPos; - HCURSOR m_hOldCursor; - -// Enumerations - enum TranslationTextItem - { - eText_OnReplaceAllMessage = 0, - eText_OnReplaceAllTitle = 1, - eText_OnTextNotFoundMessage = 2, - eText_OnTextNotFoundTitle = 3 - }; - -public: -// Constructors - CEditFindReplaceImplBase() : - m_pFindReplaceDialog(NULL), - m_bFindOnly(TRUE), - m_bFirstSearch(TRUE), - m_bMatchCase(FALSE), - m_bWholeWord(FALSE), - m_bFindDown(TRUE), - m_nInitialSearchPos(0), - m_hOldCursor(NULL) - { - } - -// Message Handlers - BEGIN_MSG_MAP(thisClass) - ALT_MSG_MAP(1) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd) - COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind) - COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat) - COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace) - END_MSG_MAP() - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_pFindReplaceDialog != NULL) - { - m_pFindReplaceDialog->SendMessage(WM_CLOSE); - ATLASSERT(m_pFindReplaceDialog == NULL); - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnFindReplaceCmd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - - TFindReplaceDialog* pDialog = TFindReplaceDialog::GetNotifier(lParam); - if(pDialog == NULL) - { - ATLASSERT(FALSE); - ::MessageBeep(MB_ICONERROR); - return 1; - } - ATLASSERT(pDialog == m_pFindReplaceDialog); - - LPFINDREPLACE findReplace = (LPFINDREPLACE)lParam; - if((m_pFindReplaceDialog != NULL) && (findReplace != NULL)) - { - if(pDialog->FindNext()) - { - pT->OnFindNext(pDialog->GetFindString(), pDialog->SearchDown(), - pDialog->MatchCase(), pDialog->MatchWholeWord()); - } - else if(pDialog->ReplaceCurrent()) - { - pT->OnReplaceSel(pDialog->GetFindString(), - pDialog->SearchDown(), pDialog->MatchCase(), pDialog->MatchWholeWord(), - pDialog->GetReplaceString()); - } - else if(pDialog->ReplaceAll()) - { - pT->OnReplaceAll(pDialog->GetFindString(), pDialog->GetReplaceString(), - pDialog->MatchCase(), pDialog->MatchWholeWord()); - } - else if(pDialog->IsTerminating()) - { - // Dialog is going away (but hasn't gone away yet) - // OnFinalMessage will "delete this" - pT->OnTerminatingFindReplaceDialog(m_pFindReplaceDialog); - m_pFindReplaceDialog = NULL; - } - } - - return 0; - } - - LRESULT OnEditFind(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->FindReplace(TRUE); - - return 0; - } - - LRESULT OnEditRepeat(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - - // If the user is holding down SHIFT when hitting F3, we'll - // search in reverse. Otherwise, we'll search forward. - // (be sure to have an accelerator mapped to ID_EDIT_REPEAT - // for both F3 and Shift+F3) - m_bFindDown = !((::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000); - - if(m_sFindNext.IsEmpty()) - { - pT->FindReplace(TRUE); - } - else - { - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - pT->TextNotFound(m_sFindNext); - } - - return 0; - } - - LRESULT OnEditReplace(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled) - { - T* pT = static_cast(this); - - DWORD style = pT->GetStyle(); - if((style & ES_READONLY) != ES_READONLY) - { - pT->FindReplace(FALSE); - } - else - { - // Don't allow replace when the edit control is read only - bHandled = FALSE; - } - - return 0; - } - -// Operations (overrideable) - TFindReplaceDialog* CreateFindReplaceDialog(BOOL bFindOnly, // TRUE for Find, FALSE for FindReplace - LPCTSTR lpszFindWhat, - LPCTSTR lpszReplaceWith = NULL, - DWORD dwFlags = FR_DOWN, - HWND hWndParent = NULL) - { - // You can override all of this in a derived class - - TFindReplaceDialog* findReplaceDialog = new TFindReplaceDialog(); - if(findReplaceDialog == NULL) - { - ::MessageBeep(MB_ICONHAND); - } - else - { - HWND hWndFindReplace = findReplaceDialog->Create(bFindOnly, - lpszFindWhat, lpszReplaceWith, dwFlags, hWndParent); - if(hWndFindReplace == NULL) - { - delete findReplaceDialog; - findReplaceDialog = NULL; - } - else - { - findReplaceDialog->SetActiveWindow(); - findReplaceDialog->ShowWindow(SW_SHOW); - } - } - - return findReplaceDialog; - } - - void AdjustDialogPosition(HWND hWndDialog) - { - ATLASSERT((hWndDialog != NULL) && ::IsWindow(hWndDialog)); - - T* pT = static_cast(this); - LONG nStartChar = 0, nEndChar = 0; - // Send EM_GETSEL so we can use both Edit and RichEdit - // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) - ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - POINT point = pT->PosFromChar(nStartChar); - ::ClientToScreen(pT->GetParent(), &point); - CRect rect; - ::GetWindowRect(hWndDialog, &rect); - if(rect.PtInRect(point)) - { - if(point.y > rect.Height()) - { - rect.OffsetRect(0, point.y - rect.bottom - 20); - } - else - { - int nVertExt = GetSystemMetrics(SM_CYSCREEN); - if(point.y + rect.Height() < nVertExt) - rect.OffsetRect(0, 40 + point.y - rect.top); - } - - ::MoveWindow(hWndDialog, rect.left, rect.top, rect.Width(), rect.Height(), TRUE); - } - } - - DWORD GetFindReplaceDialogFlags(void) const - { - DWORD dwFlags = 0; - - if(m_bFindDown) - dwFlags |= FR_DOWN; - if(m_bMatchCase) - dwFlags |= FR_MATCHCASE; - if(m_bWholeWord) - dwFlags |= FR_WHOLEWORD; - - return dwFlags; - } - - void FindReplace(BOOL bFindOnly) - { - T* pT = static_cast(this); - m_bFirstSearch = TRUE; - if(m_pFindReplaceDialog != NULL) - { - if(m_bFindOnly == bFindOnly) - { - m_pFindReplaceDialog->SetActiveWindow(); - m_pFindReplaceDialog->ShowWindow(SW_SHOW); - return; - } - else - { - m_pFindReplaceDialog->SendMessage(WM_CLOSE); - ATLASSERT(m_pFindReplaceDialog == NULL); - } - } - - ATLASSERT(m_pFindReplaceDialog == NULL); - - _CSTRING_NS::CString findNext; - pT->GetSelText(findNext); - // if selection is empty or spans multiple lines use old find text - if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1)) - findNext = m_sFindNext; - _CSTRING_NS::CString replaceWith = m_sReplaceWith; - DWORD dwFlags = pT->GetFindReplaceDialogFlags(); - - m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly, - findNext, replaceWith, dwFlags, pT->operator HWND()); - ATLASSERT(m_pFindReplaceDialog != NULL); - if(m_pFindReplaceDialog != NULL) - m_bFindOnly = bFindOnly; - } - - BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bMatchCase, BOOL /*bWholeWord*/) - { - T* pT = static_cast(this); - - // check length first - size_t nLen = lstrlen(lpszCompare); - LONG nStartChar = 0, nEndChar = 0; - // Send EM_GETSEL so we can use both Edit and RichEdit - // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) - ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - if(nLen != (size_t)(nEndChar - nStartChar)) - return FALSE; - - // length is the same, check contents - _CSTRING_NS::CString selectedText; - pT->GetSelText(selectedText); - - return (bMatchCase && selectedText.Compare(lpszCompare) == 0) || - (!bMatchCase && selectedText.CompareNoCase(lpszCompare) == 0); - } - - void TextNotFound(LPCTSTR lpszFind) - { - T* pT = static_cast(this); - m_bFirstSearch = TRUE; - pT->OnTextNotFound(lpszFind); - } - - _CSTRING_NS::CString GetTranslationText(enum TranslationTextItem eItem) const - { - _CSTRING_NS::CString text; - switch(eItem) - { - case eText_OnReplaceAllMessage: - text = _T("Replaced %d occurances of \"%s\" with \"%s\""); - break; - case eText_OnReplaceAllTitle: - text = _T("Replace All"); - break; - case eText_OnTextNotFoundMessage: - text = _T("Unable to find the text \"%s\""); - break; - case eText_OnTextNotFoundTitle: - text = _T("Text not found"); - break; - } - - return text; - } - -// Overrideable Handlers - void OnFindNext(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord) - { - T* pT = static_cast(this); - - m_sFindNext = lpszFind; - m_bMatchCase = bMatchCase; - m_bWholeWord = bWholeWord; - m_bFindDown = bFindDown; - - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - pT->TextNotFound(m_sFindNext); - else - pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); - } - - void OnReplaceSel(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord, LPCTSTR lpszReplace) - { - T* pT = static_cast(this); - - m_sFindNext = lpszFind; - m_sReplaceWith = lpszReplace; - m_bMatchCase = bMatchCase; - m_bWholeWord = bWholeWord; - m_bFindDown = bFindDown; - - if(pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) - pT->ReplaceSel(m_sReplaceWith); - - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - pT->TextNotFound(m_sFindNext); - else - pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); - } - - void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace, BOOL bMatchCase, BOOL bWholeWord) - { - T* pT = static_cast(this); - - m_sFindNext = lpszFind; - m_sReplaceWith = lpszReplace; - m_bMatchCase = bMatchCase; - m_bWholeWord = bWholeWord; - m_bFindDown = TRUE; - - // no selection or different than what looking for - if(!pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) - { - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - { - pT->TextNotFound(m_sFindNext); - return; - } - } - - pT->OnReplaceAllCoreBegin(); - - int replaceCount=0; - do - { - ++replaceCount; - pT->ReplaceSel(m_sReplaceWith); - } while(pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)); - - pT->OnReplaceAllCoreEnd(replaceCount); - } - - void OnReplaceAllCoreBegin() - { - T* pT = static_cast(this); - - m_hOldCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT)); - - pT->HideSelection(TRUE, FALSE); - - } - - void OnReplaceAllCoreEnd(int replaceCount) - { - T* pT = static_cast(this); - pT->HideSelection(FALSE, FALSE); - - ::SetCursor(m_hOldCursor); - - _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage); - if(message.GetLength() > 0) - { - _CSTRING_NS::CString formattedMessage; - formattedMessage.Format(message, - replaceCount, m_sFindNext, m_sReplaceWith); - if(m_pFindReplaceDialog != NULL) - { - m_pFindReplaceDialog->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnReplaceAllTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - else - { - pT->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnReplaceAllTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - } - } - - void OnTextNotFound(LPCTSTR lpszFind) - { - T* pT = static_cast(this); - _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage); - if(message.GetLength() > 0) - { - _CSTRING_NS::CString formattedMessage; - formattedMessage.Format(message, lpszFind); - if(m_pFindReplaceDialog != NULL) - { - m_pFindReplaceDialog->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnTextNotFoundTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - else - { - pT->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnTextNotFoundTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - } - else - { - ::MessageBeep(MB_ICONHAND); - } - } - - void OnTerminatingFindReplaceDialog(TFindReplaceDialog*& /*findReplaceDialog*/) - { - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CEditFindReplaceImpl - Mixin class for implementing Find/Replace for CEdit -// based window classes. - -// Chain to CEditFindReplaceImpl message map. Your class must also derive from CEdit. -// Example: -// class CMyEdit : public CWindowImpl, -// public CEditFindReplaceImpl -// { -// public: -// BEGIN_MSG_MAP(CMyEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CEditFindReplaceImpl, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CEditFindReplaceImpl : public CEditFindReplaceImplBase -{ -protected: - typedef CEditFindReplaceImpl thisClass; - typedef CEditFindReplaceImplBase baseClass; - -// Data members - LPTSTR m_pShadowBuffer; // Special shadow buffer only used in some cases. - UINT m_nShadowSize; - int m_bShadowBufferNeeded; // TRUE, FALSE, < 0 => Need to check - -public: -// Constructors - CEditFindReplaceImpl() : - m_pShadowBuffer(NULL), - m_nShadowSize(0), - m_bShadowBufferNeeded(-1) - { - } - - virtual ~CEditFindReplaceImpl() - { - if(m_pShadowBuffer != NULL) - { - delete [] m_pShadowBuffer; - m_pShadowBuffer = NULL; - } - } - -// Message Handlers - BEGIN_MSG_MAP(thisClass) - ALT_MSG_MAP(1) - CHAIN_MSG_MAP_ALT(baseClass, 1) - END_MSG_MAP() - -// Operations - // Supported only for RichEdit, so this does nothing for Edit - void HideSelection(BOOL /*bHide*/ = TRUE, BOOL /*bChangeStyle*/ = FALSE) - { - } - -// Operations (overrideable) - BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) - { - T* pT = static_cast(this); - - ATLASSERT(lpszFind != NULL); - ATLASSERT(*lpszFind != _T('\0')); - - UINT nLen = pT->GetBufferLength(); - int nStartChar = 0, nEndChar = 0; - pT->GetSel(nStartChar, nEndChar); - UINT nStart = nStartChar; - int iDir = bFindDown ? +1 : -1; - - // can't find a match before the first character - if(nStart == 0 && iDir < 0) - return FALSE; - - LPCTSTR lpszText = pT->LockBuffer(); - - bool isDBCS = false; -#ifdef _MBCS - CPINFO info = { 0 }; - ::GetCPInfo(::GetOEMCP(), &info); - isDBCS = (info.MaxCharSize > 1); -#endif - - if(iDir < 0) - { - // always go back one for search backwards - nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); - } - else if(nStartChar != nEndChar && pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord)) - { - // easy to go backward/forward with SBCS -#ifndef _UNICODE - if(::IsDBCSLeadByte(lpszText[nStart])) - nStart++; -#endif - nStart += iDir; - } - - // handle search with nStart past end of buffer - UINT nLenFind = ::lstrlen(lpszFind); - if(nStart + nLenFind - 1 >= nLen) - { - if(iDir < 0 && nLen >= nLenFind) - { - if(isDBCS) - { - // walk back to previous character n times - nStart = nLen; - int n = nLenFind; - while(n--) - { - nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); - } - } - else - { - // single-byte character set is easy and fast - nStart = nLen - nLenFind; - } - ATLASSERT(nStart + nLenFind - 1 <= nLen); - } - else - { - pT->UnlockBuffer(); - return FALSE; - } - } - - // start the search at nStart - LPCTSTR lpsz = lpszText + nStart; - typedef int (WINAPI* CompareProc)(LPCTSTR str1, LPCTSTR str2); - CompareProc pfnCompare = bMatchCase ? lstrcmp : lstrcmpi; - - if(isDBCS) - { - // double-byte string search - LPCTSTR lpszStop = NULL; - if(iDir > 0) - { - // start at current and find _first_ occurrance - lpszStop = lpszText + nLen - nLenFind + 1; - } - else - { - // start at top and find _last_ occurrance - lpszStop = lpsz; - lpsz = lpszText; - } - - LPCTSTR lpszFound = NULL; - while(lpsz <= lpszStop) - { -#ifndef _UNICODE - if(!bMatchCase || (*lpsz == *lpszFind && (!::IsDBCSLeadByte(*lpsz) || lpsz[1] == lpszFind[1]))) -#else - if(!bMatchCase || (*lpsz == *lpszFind && lpsz[1] == lpszFind[1])) -#endif - { - LPTSTR lpch = (LPTSTR)(lpsz + nLenFind); - TCHAR chSave = *lpch; - *lpch = _T('\0'); - int nResult = (*pfnCompare)(lpsz, lpszFind); - *lpch = chSave; - if(nResult == 0) - { - lpszFound = lpsz; - if(iDir > 0) - break; - } - } - lpsz = ::CharNext(lpsz); - } - pT->UnlockBuffer(); - - if(lpszFound != NULL) - { - int n = (int)(lpszFound - lpszText); - pT->SetSel(n, n + nLenFind); - return TRUE; - } - } - else - { - // single-byte string search - UINT nCompare; - if(iDir < 0) - nCompare = (UINT)(lpsz - lpszText) + 1; - else - nCompare = nLen - (UINT)(lpsz - lpszText) - nLenFind + 1; - - while(nCompare > 0) - { - ATLASSERT(lpsz >= lpszText); - ATLASSERT(lpsz + nLenFind - 1 <= lpszText + nLen - 1); - - LPSTR lpch = (LPSTR)(lpsz + nLenFind); - char chSave = *lpch; - *lpch = '\0'; - int nResult = (*pfnCompare)(lpsz, lpszFind); - *lpch = chSave; - if(nResult == 0) - { - pT->UnlockBuffer(); - int n = (int)(lpsz - lpszText); - pT->SetSel(n, n + nLenFind); - return TRUE; - } - - // restore character at end of search - *lpch = chSave; - - // move on to next substring - nCompare--; - lpsz += iDir; - } - pT->UnlockBuffer(); - } - - return FALSE; - } - - LPCTSTR LockBuffer() const - { - const T* pT = static_cast(this); - - ATLASSERT(pT->m_hWnd != NULL); - - BOOL useShadowBuffer = pT->UseShadowBuffer(); - if(useShadowBuffer) - { - if(m_pShadowBuffer == NULL || pT->GetModify()) - { - ATLASSERT(m_pShadowBuffer != NULL || m_nShadowSize == 0); - UINT nSize = pT->GetWindowTextLength() + 1; - if(nSize > m_nShadowSize) - { - // need more room for shadow buffer - T* pThisNoConst = const_cast(pT); - delete[] m_pShadowBuffer; - pThisNoConst->m_pShadowBuffer = NULL; - pThisNoConst->m_nShadowSize = 0; - pThisNoConst->m_pShadowBuffer = new TCHAR[nSize]; - pThisNoConst->m_nShadowSize = nSize; - } - - // update the shadow buffer with GetWindowText - ATLASSERT(m_nShadowSize >= nSize); - ATLASSERT(m_pShadowBuffer != NULL); - pT->GetWindowText(m_pShadowBuffer, nSize); - } - - return m_pShadowBuffer; - } - - HLOCAL hLocal = pT->GetHandle(); - ATLASSERT(hLocal != NULL); - LPCTSTR lpszText = (LPCTSTR)::LocalLock(hLocal); - ATLASSERT(lpszText != NULL); - - return lpszText; - } - - void UnlockBuffer() const - { - const T* pT = static_cast(this); - - ATLASSERT(pT->m_hWnd != NULL); - - BOOL useShadowBuffer = pT->UseShadowBuffer(); - if(!useShadowBuffer) - { - HLOCAL hLocal = pT->GetHandle(); - ATLASSERT(hLocal != NULL); - ::LocalUnlock(hLocal); - } - } - - UINT GetBufferLength() const - { - const T* pT = static_cast(this); - - ATLASSERT(pT->m_hWnd != NULL); - UINT nLen = 0; - LPCTSTR lpszText = pT->LockBuffer(); - if(lpszText != NULL) - nLen = ::lstrlen(lpszText); - pT->UnlockBuffer(); - - return nLen; - } - - LONG EndOfLine(LPCTSTR lpszText, UINT nLen, UINT nIndex) const - { - LPCTSTR lpsz = lpszText + nIndex; - LPCTSTR lpszStop = lpszText + nLen; - while(lpsz < lpszStop && *lpsz != _T('\r')) - ++lpsz; - return LONG(lpsz - lpszText); - } - - LONG GetSelText(_CSTRING_NS::CString& strText) const - { - const T* pT = static_cast(this); - - int nStartChar = 0, nEndChar = 0; - pT->GetSel(nStartChar, nEndChar); - ATLASSERT((UINT)nEndChar <= pT->GetBufferLength()); - LPCTSTR lpszText = pT->LockBuffer(); - LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar; - SecureHelper::memcpy_x(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR)); - strText.ReleaseBuffer(nLen); - pT->UnlockBuffer(); - - return nLen; - } - - BOOL UseShadowBuffer(void) const - { - const T* pT = static_cast(this); - - if(pT->m_bShadowBufferNeeded < 0) - { - T* pThisNoConst = const_cast(pT); - - OSVERSIONINFO ovi = { 0 }; - ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - ::GetVersionEx(&ovi); - - bool bWin9x = (ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); - if(bWin9x) - { - // Windows 95, 98, ME - // Under Win9x, it is necessary to maintain a shadow buffer. - // It is only updated when the control contents have been changed. - pThisNoConst->m_bShadowBufferNeeded = TRUE; - } - else - { - // Windows NT, 2000, XP, etc. - pThisNoConst->m_bShadowBufferNeeded = FALSE; - -#ifndef _UNICODE - // On Windows XP (or later), if common controls version 6 is in use - // (such as via theming), then EM_GETHANDLE will always return a UNICODE string. - // If theming is enabled and Common Controls version 6 is in use, - // you're really not suppose to superclass or subclass common controls - // with an ANSI windows procedure (so its best to only theme if you use UNICODE). - // Using a shadow buffer uses GetWindowText instead, so it solves - // this problem for us (although it makes it a little less efficient). - - if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) - { - // We use DLLVERSIONINFO_private so we don't have to depend on shlwapi.h - typedef struct _DLLVERSIONINFO_private - { - DWORD cbSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformID; - } DLLVERSIONINFO_private; - - HMODULE hModule = ::LoadLibrary("comctl32.dll"); - if(hModule != NULL) - { - typedef HRESULT (CALLBACK *LPFN_DllGetVersion)(DLLVERSIONINFO_private *); - LPFN_DllGetVersion fnDllGetVersion = (LPFN_DllGetVersion)::GetProcAddress(hModule, "DllGetVersion"); - if(fnDllGetVersion != NULL) - { - DLLVERSIONINFO_private version = { 0 }; - version.cbSize = sizeof(DLLVERSIONINFO_private); - if(SUCCEEDED(fnDllGetVersion(&version))) - { - if(version.dwMajorVersion >= 6) - { - pThisNoConst->m_bShadowBufferNeeded = TRUE; - - ATLTRACE2(atlTraceUI, 0, _T("Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later (likely through a manifest file).\r\n")); - ATLTRACE2(atlTraceUI, 0, _T("If you use common controls version 6 or later, you should only do so for UNICODE builds.\r\n")); - } - } - } - - ::FreeLibrary(hModule); - hModule = NULL; - } - } -#endif // !_UNICODE - } - } - - return (pT->m_bShadowBufferNeeded != FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditFindReplaceImpl - Mixin class for implementing Find/Replace for CRichEditCtrl -// based window classes. - -// Chain to CRichEditFindReplaceImpl message map. Your class must also derive from CRichEditCtrl. -// Example: -// class CMyRichEdit : public CWindowImpl, -// public CRichEditFindReplaceImpl -// { -// public: -// BEGIN_MSG_MAP(CMyRichEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CRichEditFindReplaceImpl, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CRichEditFindReplaceImpl : public CEditFindReplaceImplBase -{ -protected: - typedef CRichEditFindReplaceImpl thisClass; - typedef CEditFindReplaceImplBase baseClass; - -public: - BEGIN_MSG_MAP(thisClass) - ALT_MSG_MAP(1) - CHAIN_MSG_MAP_ALT(baseClass, 1) - END_MSG_MAP() - -// Operations (overrideable) - BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) - { - T* pT = static_cast(this); - - ATLASSERT(lpszFind != NULL); - FINDTEXTEX ft = { 0 }; - - pT->GetSel(ft.chrg); - if(m_bFirstSearch) - { - if(bFindDown) - m_nInitialSearchPos = ft.chrg.cpMin; - else - m_nInitialSearchPos = ft.chrg.cpMax; - m_bFirstSearch = FALSE; - } - -#if (_RICHEDIT_VER >= 0x0200) - ft.lpstrText = (LPTSTR)lpszFind; -#else // !(_RICHEDIT_VER >= 0x0200) - USES_CONVERSION; - ft.lpstrText = T2A((LPTSTR)lpszFind); -#endif // !(_RICHEDIT_VER >= 0x0200) - - if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection - { - if(bFindDown) - { - ft.chrg.cpMin++; - } - else - { - // won't wraparound backwards - ft.chrg.cpMin = max(ft.chrg.cpMin, 0); - } - } - - DWORD dwFlags = bMatchCase ? FR_MATCHCASE : 0; - dwFlags |= bWholeWord ? FR_WHOLEWORD : 0; - - ft.chrg.cpMax = pT->GetTextLength() + m_nInitialSearchPos; - - if(bFindDown) - { - if(m_nInitialSearchPos >= 0) - ft.chrg.cpMax = pT->GetTextLength(); - - dwFlags |= FR_DOWN; - ATLASSERT(ft.chrg.cpMax >= ft.chrg.cpMin); - } - else - { - if(m_nInitialSearchPos >= 0) - ft.chrg.cpMax = 0; - - dwFlags &= ~FR_DOWN; - ATLASSERT(ft.chrg.cpMax <= ft.chrg.cpMin); - } - - BOOL bRet = FALSE; - - if(pT->FindAndSelect(dwFlags, ft) != -1) - { - bRet = TRUE; // we found the text - } - else if(m_nInitialSearchPos > 0) - { - // if the original starting point was not the beginning - // of the buffer and we haven't already been here - if(bFindDown) - { - ft.chrg.cpMin = 0; - ft.chrg.cpMax = m_nInitialSearchPos; - } - else - { - ft.chrg.cpMin = pT->GetTextLength(); - ft.chrg.cpMax = m_nInitialSearchPos; - } - m_nInitialSearchPos = m_nInitialSearchPos - pT->GetTextLength(); - - bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE; - } - - return bRet; - } - - long FindAndSelect(DWORD dwFlags, FINDTEXTEX& ft) - { - T* pT = static_cast(this); - LONG index = pT->FindText(dwFlags, ft); - if(index != -1) // i.e. we found something - pT->SetSel(ft.chrgText); - - return index; - } -}; - -}; // namespace WTL - -#endif // __ATLFIND_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlframe.h b/GLideN64/src/GLideNUI-wtl/WTL/atlframe.h deleted file mode 100644 index 96f15c5..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlframe.h +++ /dev/null @@ -1,3688 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLFRAME_H__ -#define __ATLFRAME_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlframe.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlframe.h requires atlwin.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CFrameWindowImpl -// CMDIWindow -// CMDIFrameWindowImpl -// CMDIChildWindowImpl -// COwnerDraw -// CUpdateUIBase -// CUpdateUI -// CDynamicUpdateUI -// CAutoUpdateUI -// CDialogResize -// CDoubleBufferImpl -// CDoubleBufferWindowImpl -// -// Global functions: -// AtlCreateSimpleToolBar() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CFrameWndClassInfo - Manages frame window Windows class information - -class CFrameWndClassInfo -{ -public: -#ifndef _WIN32_WCE - enum { cchAutoName = 5 + sizeof(void*) * 2 }; // sizeof(void*) * 2 is the number of digits %p outputs - WNDCLASSEX m_wc; -#else // CE specific - enum { cchAutoName = MAX_PATH }; // MAX_PATH because this can be set in the wizard generated CMainFrame::ActivatePreviousInstance to a user defined string. - WNDCLASS m_wc; -#endif // !_WIN32_WCE - LPCTSTR m_lpszOrigName; - WNDPROC pWndProc; - LPCTSTR m_lpszCursorID; - BOOL m_bSystemCursor; - ATOM m_atom; - TCHAR m_szAutoName[cchAutoName]; - UINT m_uCommonResourceID; - -#ifndef _WIN32_WCE - ATOM Register(WNDPROC* pProc) - { - if (m_atom == 0) - { - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(m_atom == 0) - { - HINSTANCE hInst = ModuleHelper::GetModuleInstance(); - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - LPCTSTR lpsz = m_wc.lpszClassName; - WNDPROC proc = m_wc.lpfnWndProc; - - WNDCLASSEX wc = { 0 }; - wc.cbSize = sizeof(WNDCLASSEX); - // try process local class first - if(!::GetClassInfoEx(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) - { - // try global class - if(!::GetClassInfoEx(NULL, m_lpszOrigName, &wc)) - { - lock.Unlock(); - return 0; - } - } - m_wc = wc; - pWndProc = m_wc.lpfnWndProc; - m_wc.lpszClassName = lpsz; - m_wc.lpfnWndProc = proc; - } - else - { - m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); - } - - m_wc.hInstance = hInst; - m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes - if (m_wc.lpszClassName == NULL) - { -#if (_WIN32_WINNT >= 0x0500) || defined(_WIN64) - SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%p"), &m_wc); -#else // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) - SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); -#endif // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) - m_wc.lpszClassName = m_szAutoName; - } - - WNDCLASSEX wcTemp = m_wc; - m_atom = (ATOM)::GetClassInfoEx(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); - if (m_atom == 0) - { - if(m_uCommonResourceID != 0) // use it if not zero - { - m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - m_wc.hIconSm = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - } - m_atom = ::RegisterClassEx(&m_wc); - } - } - - lock.Unlock(); - } - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - ATLASSERT(pWndProc != NULL); - *pProc = pWndProc; - } - - return m_atom; - } -#else // CE specific - ATOM Register(WNDPROC* pProc) - { - if (m_atom == 0) - { - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(m_atom == 0) - { - HINSTANCE hInst = ModuleHelper::GetModuleInstance(); - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - LPCTSTR lpsz = m_wc.lpszClassName; - WNDPROC proc = m_wc.lpfnWndProc; - - WNDCLASS wc = { 0 }; - // try process local class first - if(!::GetClassInfo(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) - { - // try global class - if(!::GetClassInfo(NULL, m_lpszOrigName, &wc)) - { - lock.Unlock(); - return 0; - } - } - m_wc = wc; - pWndProc = m_wc.lpfnWndProc; - m_wc.lpszClassName = lpsz; - m_wc.lpfnWndProc = proc; - } - else - { -#if defined(GWES_CURSOR) || defined(GWES_MCURSOR) - m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); -#else // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) - m_wc.hCursor = NULL; -#endif // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) - } - - m_wc.hInstance = hInst; - m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes - if (m_wc.lpszClassName == NULL) - { - wsprintf(m_szAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); - m_wc.lpszClassName = m_szAutoName; - } - - WNDCLASS wcTemp = m_wc; - m_atom = (ATOM)::GetClassInfo(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); - if (m_atom == 0) - { - if(m_uCommonResourceID != 0) // use it if not zero - m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - m_atom = ::RegisterClass(&m_wc); - } - } - - lock.Unlock(); - } - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - ATLASSERT(pWndProc != NULL); - *pProc = pWndProc; - } - - return m_atom; - } -#endif // _WIN32_WCE -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Macros for declaring frame window WNDCLASS - -#ifndef _WIN32_WCE - -#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { sizeof(WNDCLASSEX), 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName, NULL }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { sizeof(WNDCLASSEX), style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { sizeof(WNDCLASSEX), 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \ - OrigWndClassName, NULL, NULL, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#else // CE specific - -#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { NULL, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName }, \ - OrigWndClassName, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFrameWindowImpl - -// Client window command chaining macro (only for frame windows) -#define CHAIN_CLIENT_COMMANDS() \ - if(uMsg == WM_COMMAND && m_hWndClient != NULL) \ - ::SendMessage(m_hWndClient, uMsg, wParam, lParam); - -// standard toolbar styles -#define ATL_SIMPLE_TOOLBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS) -// toolbar in a rebar pane -#define ATL_SIMPLE_TOOLBAR_PANE_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT) -// standard rebar styles -#if (_WIN32_IE >= 0x0400) - #define ATL_SIMPLE_REBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE) -#else - #define ATL_SIMPLE_REBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS) -#endif // !(_WIN32_IE >= 0x0400) -// rebar without borders -#if (_WIN32_IE >= 0x0400) - #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE | CCS_NODIVIDER) -#else - #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | CCS_NODIVIDER) -#endif // !(_WIN32_IE >= 0x0400) - -// command bar support -#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - -#define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND -#define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu -#define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu - -struct _AtlFrameWnd_CmdBarPopupMenu -{ - int cbSize; - HMENU hMenu; - UINT uFlags; - int x; - int y; - LPTPMPARAMS lptpm; -}; - -#define CBRPOPUPMENU _AtlFrameWnd_CmdBarPopupMenu - -#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - - -template -class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, TWinTraits > -{ -public: - DECLARE_FRAME_WND_CLASS(NULL, 0) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - struct _ChevronMenuInfo - { - HMENU hMenu; - LPNMREBARCHEVRON lpnm; - bool bCmdBar; - }; -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Data members - HWND m_hWndToolBar; - HWND m_hWndStatusBar; - HWND m_hWndClient; - -#ifdef _WIN32_WCE - HWND m_hWndCECommandBar; -#endif // _WIN32_WCE - - HACCEL m_hAccel; - -// Constructor - CFrameWindowImplBase() : - m_hWndToolBar(NULL), - m_hWndStatusBar(NULL), - m_hWndClient(NULL), -#ifdef _WIN32_WCE - m_hWndCECommandBar(NULL), -#endif // _WIN32_WCE - m_hAccel(NULL) - { } - -// Methods - HWND Create(HWND hWndParent, ATL::_U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, ATL::_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam) - { - ATLASSERT(m_hWnd == NULL); - - if(atom == 0) - return NULL; - - ModuleHelper::AddCreateWndData(&m_thunk.cd, this); - - if(MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD)) - MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this; - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - HWND hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, - dwStyle, rect.m_lpRect->left, rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, - rect.m_lpRect->bottom - rect.m_lpRect->top, hWndParent, MenuOrID.m_hMenu, - ModuleHelper::GetModuleInstance(), lpCreateParam); - - ATLASSERT(hWnd == NULL || m_hWnd == hWnd); - - return hWnd; - } - - static HWND CreateSimpleToolBarCtrl(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, - DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - HINSTANCE hInst = ModuleHelper::GetResourceInstance(); - HRSRC hRsrc = ::FindResource(hInst, MAKEINTRESOURCE(nResourceID), RT_TOOLBAR); - if (hRsrc == NULL) - return NULL; - - HGLOBAL hGlobal = ::LoadResource(hInst, hRsrc); - if (hGlobal == NULL) - return NULL; - - _AtlToolBarData* pData = (_AtlToolBarData*)::LockResource(hGlobal); - if (pData == NULL) - return NULL; - ATLASSERT(pData->wVersion == 1); - - WORD* pItems = pData->items(); - int nItems = pData->wItemCount + (bInitialSeparator ? 1 : 0); - CTempBuffer buff; - TBBUTTON* pTBBtn = buff.Allocate(nItems); - ATLASSERT(pTBBtn != NULL); - if(pTBBtn == NULL) - return NULL; - - const int cxSeparator = 8; - - // set initial separator (half width) - if(bInitialSeparator) - { - pTBBtn[0].iBitmap = cxSeparator / 2; - pTBBtn[0].idCommand = 0; - pTBBtn[0].fsState = 0; - pTBBtn[0].fsStyle = TBSTYLE_SEP; - pTBBtn[0].dwData = 0; - pTBBtn[0].iString = 0; - } - - int nBmp = 0; - for(int i = 0, j = bInitialSeparator ? 1 : 0; i < pData->wItemCount; i++, j++) - { - if(pItems[i] != 0) - { - pTBBtn[j].iBitmap = nBmp++; - pTBBtn[j].idCommand = pItems[i]; - pTBBtn[j].fsState = TBSTATE_ENABLED; - pTBBtn[j].fsStyle = TBSTYLE_BUTTON; - pTBBtn[j].dwData = 0; - pTBBtn[j].iString = 0; - } - else - { - pTBBtn[j].iBitmap = cxSeparator; - pTBBtn[j].idCommand = 0; - pTBBtn[j].fsState = 0; - pTBBtn[j].fsStyle = TBSTYLE_SEP; - pTBBtn[j].dwData = 0; - pTBBtn[j].iString = 0; - } - } - -#ifndef _WIN32_WCE - HWND hWnd = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); - if(hWnd == NULL) - { - ATLASSERT(FALSE); - return NULL; - } -#else // CE specific - dwStyle; - nID; - // The toolbar must go onto the existing CommandBar or MenuBar - HWND hWnd = hWndParent; -#endif // _WIN32_WCE - - ::SendMessage(hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0L); - - // check if font is taller than our bitmaps - CFontHandle font = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); - if(font.IsNull()) - font = (HFONT)::GetStockObject(SYSTEM_FONT); - LOGFONT lf = { 0 }; - font.GetLogFont(lf); - WORD cyFontHeight = (WORD)abs(lf.lfHeight); - -#ifndef _WIN32_WCE - WORD bitsPerPixel = AtlGetBitmapResourceBitsPerPixel(nResourceID); - if(bitsPerPixel > 4) - { - COLORREF crMask = CLR_DEFAULT; - if(bitsPerPixel == 32) - { - // 32-bit color bitmap with alpha channel (valid for Windows XP and later) - crMask = CLR_NONE; - } - HIMAGELIST hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nResourceID), pData->wWidth, 1, crMask, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); - ATLASSERT(hImageList != NULL); - ::SendMessage(hWnd, TB_SETIMAGELIST, 0, (LPARAM)hImageList); - } - else -#endif // !_WIN32_WCE - { - TBADDBITMAP tbab = { 0 }; - tbab.hInst = hInst; - tbab.nID = nResourceID; - ::SendMessage(hWnd, TB_ADDBITMAP, nBmp, (LPARAM)&tbab); - } - - ::SendMessage(hWnd, TB_ADDBUTTONS, nItems, (LPARAM)pTBBtn); - ::SendMessage(hWnd, TB_SETBITMAPSIZE, 0, MAKELONG(pData->wWidth, max(pData->wHeight, cyFontHeight))); - const int cxyButtonMargin = 7; - ::SendMessage(hWnd, TB_SETBUTTONSIZE, 0, MAKELONG(pData->wWidth + cxyButtonMargin, max(pData->wHeight, cyFontHeight) + cxyButtonMargin)); - - return hWnd; - } - -#ifndef _WIN32_WCE - static HWND CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - // Ensure style combinations for proper rebar painting - if(dwStyle & CCS_NODIVIDER && dwStyle & WS_BORDER) - dwStyle &= ~WS_BORDER; - else if(!(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER)) - dwStyle |= CCS_NODIVIDER; - - // Create rebar window - HWND hWndReBar = ::CreateWindowEx(0, REBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); - if(hWndReBar == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Failed to create rebar.\n")); - return NULL; - } - - // Initialize and send the REBARINFO structure - REBARINFO rbi = { 0 }; - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = 0; - if(!::SendMessage(hWndReBar, RB_SETBARINFO, 0, (LPARAM)&rbi)) - { - ATLTRACE2(atlTraceUI, 0, _T("Failed to initialize rebar.\n")); - ::DestroyWindow(hWndReBar); - return NULL; - } - - return hWndReBar; - } - - BOOL CreateSimpleReBar(DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - ATLASSERT(!::IsWindow(m_hWndToolBar)); - m_hWndToolBar = CreateSimpleReBarCtrl(m_hWnd, dwStyle, nID); - return (m_hWndToolBar != NULL); - } - - static BOOL AddSimpleReBarBandCtrl(HWND hWndReBar, HWND hWndBand, int nID = 0, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) - { - ATLASSERT(::IsWindow(hWndReBar)); // must be already created -#ifdef _DEBUG - // block - check if this is really a rebar - { - TCHAR lpszClassName[sizeof(REBARCLASSNAME)] = { 0 }; - ::GetClassName(hWndReBar, lpszClassName, sizeof(REBARCLASSNAME)); - ATLASSERT(lstrcmp(lpszClassName, REBARCLASSNAME) == 0); - } -#endif // _DEBUG - ATLASSERT(::IsWindow(hWndBand)); // must be already created - - // Get number of buttons on the toolbar - int nBtnCount = (int)::SendMessage(hWndBand, TB_BUTTONCOUNT, 0, 0L); - - // Set band info structure - REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; -#if (_WIN32_IE >= 0x0400) - rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE | RBBIM_IDEALSIZE; -#else - rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE; -#endif // !(_WIN32_IE >= 0x0400) - if(lpstrTitle != NULL) - rbBand.fMask |= RBBIM_TEXT; - rbBand.fStyle = RBBS_CHILDEDGE; -#if (_WIN32_IE >= 0x0500) - if(nBtnCount > 0) // add chevron style for toolbar with buttons - rbBand.fStyle |= RBBS_USECHEVRON; -#endif // (_WIN32_IE >= 0x0500) - if(bNewRow) - rbBand.fStyle |= RBBS_BREAK; - - rbBand.lpText = (LPTSTR)lpstrTitle; - rbBand.hwndChild = hWndBand; - if(nID == 0) // calc band ID - nID = ATL_IDW_BAND_FIRST + (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); - rbBand.wID = nID; - - // Calculate the size of the band - BOOL bRet = FALSE; - RECT rcTmp = { 0 }; - if(nBtnCount > 0) - { - bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, nBtnCount - 1, (LPARAM)&rcTmp); - ATLASSERT(bRet); - rbBand.cx = (cxWidth != 0) ? cxWidth : rcTmp.right; - rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; - if(bFullWidthAlways) - { - rbBand.cxMinChild = rbBand.cx; - } - else if(lpstrTitle == NULL) - { - bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, 0, (LPARAM)&rcTmp); - ATLASSERT(bRet); - rbBand.cxMinChild = rcTmp.right; - } - else - { - rbBand.cxMinChild = 0; - } - } - else // no buttons, either not a toolbar or really has no buttons - { - bRet = ::GetWindowRect(hWndBand, &rcTmp); - ATLASSERT(bRet); - rbBand.cx = (cxWidth != 0) ? cxWidth : (rcTmp.right - rcTmp.left); - rbBand.cxMinChild = bFullWidthAlways ? rbBand.cx : 0; - rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; - } - -#if (_WIN32_IE >= 0x0400) - rbBand.cxIdeal = rbBand.cx; -#endif // (_WIN32_IE >= 0x0400) - - // Add the band - LRESULT lRes = ::SendMessage(hWndReBar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); - if(lRes == 0) - { - ATLTRACE2(atlTraceUI, 0, _T("Failed to add a band to the rebar.\n")); - return FALSE; - } - -#if (_WIN32_IE >= 0x0501) - DWORD dwExStyle = (DWORD)::SendMessage(hWndBand, TB_GETEXTENDEDSTYLE, 0, 0L); - ::SendMessage(hWndBand, TB_SETEXTENDEDSTYLE, 0, dwExStyle | TBSTYLE_EX_HIDECLIPPEDBUTTONS); -#endif // (_WIN32_IE >= 0x0501) - - return TRUE; - } - - BOOL AddSimpleReBarBand(HWND hWndBand, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) - { - ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar - ATLASSERT(::IsWindow(hWndBand)); // must be created - return AddSimpleReBarBandCtrl(m_hWndToolBar, hWndBand, 0, lpstrTitle, bNewRow, cxWidth, bFullWidthAlways); - } - -#if (_WIN32_IE >= 0x0400) - void SizeSimpleReBarBands() - { - ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar - - int nCount = (int)::SendMessage(m_hWndToolBar, RB_GETBANDCOUNT, 0, 0L); - - for(int i = 0; i < nCount; i++) - { - REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; - rbBand.fMask = RBBIM_SIZE; - BOOL bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_GETBANDINFO, i, (LPARAM)&rbBand); - ATLASSERT(bRet); - RECT rect = { 0, 0, 0, 0 }; - ::SendMessage(m_hWndToolBar, RB_GETBANDBORDERS, i, (LPARAM)&rect); - rbBand.cx += rect.left + rect.right; - bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_SETBANDINFO, i, (LPARAM)&rbBand); - ATLASSERT(bRet); - } - } -#endif // (_WIN32_IE >= 0x0400) -#endif // _WIN32_WCE - -#ifndef _WIN32_WCE - BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) -#else // CE specific - BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) -#endif // _WIN32_WCE - { - ATLASSERT(!::IsWindow(m_hWndStatusBar)); - m_hWndStatusBar = ::CreateStatusWindow(dwStyle, lpstrText, m_hWnd, nID); - return (m_hWndStatusBar != NULL); - } - -#ifndef _WIN32_WCE - BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) -#else // CE specific - BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) -#endif // _WIN32_WCE - { - const int cchMax = 128; // max text length is 127 for status bars (+1 for null) - TCHAR szText[cchMax]; - szText[0] = 0; - ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); - return CreateSimpleStatusBar(szText, dwStyle, nID); - } - -#ifdef _WIN32_WCE - BOOL CreateSimpleCECommandBar(LPTSTR pszMenu = NULL, WORD iButton = 0, DWORD dwFlags = 0, int nCmdBarID = 1) - { - ATLASSERT(m_hWndCECommandBar == NULL); - ATLASSERT(m_hWndToolBar == NULL); - - m_hWndCECommandBar = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), m_hWnd, nCmdBarID); - if(m_hWndCECommandBar == NULL) - return FALSE; - - m_hWndToolBar = m_hWndCECommandBar; - - BOOL bRet = TRUE; - - if(pszMenu != NULL) - bRet &= ::CommandBar_InsertMenubarEx(m_hWndCECommandBar, IS_INTRESOURCE(pszMenu) ? ModuleHelper::GetResourceInstance() : NULL, pszMenu, iButton); - - bRet &= ::CommandBar_AddAdornments(m_hWndCECommandBar, dwFlags, 0); - - return bRet; - } - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - BOOL CreateSimpleCEMenuBar(UINT nToolBarId = ATL_IDW_MENU_BAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0) - { - ATLASSERT(m_hWndCECommandBar == NULL); - - SHMENUBARINFO mbi = { 0 }; - mbi.cbSize = sizeof(mbi); - mbi.hwndParent = m_hWnd; - mbi.dwFlags = dwFlags; - mbi.nToolBarId = nToolBarId; - mbi.hInstRes = ModuleHelper::GetResourceInstance(); - mbi.nBmpId = nBmpId; - mbi.cBmpImages = cBmpImages; - mbi.hwndMB = NULL; // This gets set by SHCreateMenuBar - - BOOL bRet = ::SHCreateMenuBar(&mbi); - if(bRet != FALSE) - { - m_hWndCECommandBar = mbi.hwndMB; - SizeToMenuBar(); - } - - return bRet; - } - - void SizeToMenuBar() // for menu bar only - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(m_hWndCECommandBar)); - - RECT rect = { 0 }; - GetWindowRect(&rect); - RECT rectMB = { 0 }; - ::GetWindowRect(m_hWndCECommandBar, &rectMB); - int cy = ::IsWindowVisible(m_hWndCECommandBar) ? rectMB.top - rect.top : rectMB.bottom - rect.top; - SetWindowPos(NULL, 0, 0, rect.right - rect.left, cy, SWP_NOZORDER | SWP_NOMOVE); - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) -#endif // _WIN32_WCE - - void UpdateLayout(BOOL bResizeBars = TRUE) - { - RECT rect = { 0 }; - GetClientRect(&rect); - - // position bars and offset their dimensions - UpdateBarsPosition(rect, bResizeBars); - - // resize client window - if(m_hWndClient != NULL) - ::SetWindowPos(m_hWndClient, NULL, rect.left, rect.top, - rect.right - rect.left, rect.bottom - rect.top, - SWP_NOZORDER | SWP_NOACTIVATE); - } - - void UpdateBarsPosition(RECT& rect, BOOL bResizeBars = TRUE) - { - // resize toolbar - if(m_hWndToolBar != NULL && ((DWORD)::GetWindowLong(m_hWndToolBar, GWL_STYLE) & WS_VISIBLE)) - { - if(bResizeBars != FALSE) - { - ::SendMessage(m_hWndToolBar, WM_SIZE, 0, 0); - ::InvalidateRect(m_hWndToolBar, NULL, TRUE); - } - RECT rectTB = { 0 }; - ::GetWindowRect(m_hWndToolBar, &rectTB); - rect.top += rectTB.bottom - rectTB.top; - } - - // resize status bar - if(m_hWndStatusBar != NULL && ((DWORD)::GetWindowLong(m_hWndStatusBar, GWL_STYLE) & WS_VISIBLE)) - { - if(bResizeBars != FALSE) - ::SendMessage(m_hWndStatusBar, WM_SIZE, 0, 0); - RECT rectSB = { 0 }; - ::GetWindowRect(m_hWndStatusBar, &rectSB); - rect.bottom -= rectSB.bottom - rectSB.top; - } - } - - BOOL PreTranslateMessage(MSG* pMsg) - { - if(m_hAccel != NULL && ::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) - return TRUE; - return FALSE; - } - - BEGIN_MSG_MAP(CFrameWindowImplBase) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _WIN32_WCE - NOTIFY_CODE_HANDLER(TTN_GETDISPINFOA, OnToolTipTextA) - NOTIFY_CODE_HANDLER(TTN_GETDISPINFOW, OnToolTipTextW) -#endif // !_WIN32_WCE - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_hWndClient != NULL) // view will paint itself instead - return 1; - - bHandled = FALSE; - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnMenuSelect(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - bHandled = FALSE; - - if(m_hWndStatusBar == NULL) - return 1; - - WORD wFlags = HIWORD(wParam); - if(wFlags == 0xFFFF && lParam == NULL) // menu closing - { - ::SendMessage(m_hWndStatusBar, SB_SIMPLE, FALSE, 0L); - } - else - { - const int cchBuff = 256; - TCHAR szBuff[cchBuff]; - szBuff[0] = 0; - if(!(wFlags & MF_POPUP)) - { - WORD wID = LOWORD(wParam); - // check for special cases - if(wID >= 0xF000 && wID < 0xF1F0) // system menu IDs - wID = (WORD)(((wID - 0xF000) >> 4) + ATL_IDS_SCFIRST); - else if(wID >= ID_FILE_MRU_FIRST && wID <= ID_FILE_MRU_LAST) // MRU items - wID = ATL_IDS_MRU_FILE; - else if(wID >= ATL_IDM_FIRST_MDICHILD && wID <= ATL_IDM_LAST_MDICHILD) // MDI child windows - wID = ATL_IDS_MDICHILD; - - int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), wID, szBuff, cchBuff); - for(int i = 0; i < nRet; i++) - { - if(szBuff[i] == _T('\n')) - { - szBuff[i] = 0; - break; - } - } - } - ::SendMessage(m_hWndStatusBar, SB_SIMPLE, TRUE, 0L); - ::SendMessage(m_hWndStatusBar, SB_SETTEXT, (255 | SBT_NOBORDERS), (LPARAM)szBuff); - } - - return 1; - } -#endif // !_WIN32_WCE - - LRESULT OnSetFocus(UINT, WPARAM, LPARAM, BOOL& bHandled) - { - if(m_hWndClient != NULL) - ::SetFocus(m_hWndClient); - - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL& bHandled) - { - if((GetStyle() & (WS_CHILD | WS_POPUP)) == 0) - ::PostQuitMessage(1); - - bHandled = FALSE; - return 1; - } - -#ifndef _WIN32_WCE - LRESULT OnToolTipTextA(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - LPNMTTDISPINFOA pDispInfo = (LPNMTTDISPINFOA)pnmh; - pDispInfo->szText[0] = 0; - - if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) - { - const int cchBuff = 256; - char szBuff[cchBuff]; - szBuff[0] = 0; - int nRet = ::LoadStringA(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); - for(int i = 0; i < nRet; i++) - { - if(szBuff[i] == '\n') - { - SecureHelper::strncpyA_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); - break; - } - } -#if (_WIN32_IE >= 0x0300) - if(nRet > 0) // string was loaded, save it - pDispInfo->uFlags |= TTF_DI_SETITEM; -#endif // (_WIN32_IE >= 0x0300) - } - - return 0; - } - - LRESULT OnToolTipTextW(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - LPNMTTDISPINFOW pDispInfo = (LPNMTTDISPINFOW)pnmh; - pDispInfo->szText[0] = 0; - - if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) - { - const int cchBuff = 256; - wchar_t szBuff[cchBuff]; - szBuff[0] = 0; - int nRet = ::LoadStringW(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); - for(int i = 0; i < nRet; i++) - { - if(szBuff[i] == L'\n') - { - SecureHelper::strncpyW_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); - break; - } - } -#if (_WIN32_IE >= 0x0300) - if(nRet > 0) // string was loaded, save it - pDispInfo->uFlags |= TTF_DI_SETITEM; -#endif // (_WIN32_IE >= 0x0300) - } - - return 0; - } -#endif // !_WIN32_WCE - -// Implementation - chevron menu support -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - bool PrepareChevronMenu(_ChevronMenuInfo& cmi) - { - // get rebar and toolbar - REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; - rbbi.fMask = RBBIM_CHILD; - BOOL bRet = (BOOL)::SendMessage(cmi.lpnm->hdr.hwndFrom, RB_GETBANDINFO, cmi.lpnm->uBand, (LPARAM)&rbbi); - ATLASSERT(bRet); - - // assume the band is a toolbar - ATL::CWindow wnd = rbbi.hwndChild; - int nCount = (int)wnd.SendMessage(TB_BUTTONCOUNT); - if(nCount <= 0) // probably not a toolbar - return false; - - // check if it's a command bar - CMenuHandle menuCmdBar = (HMENU)wnd.SendMessage(CBRM_GETMENU); - cmi.bCmdBar = (menuCmdBar.m_hMenu != NULL); - - // build a menu from hidden items - CMenuHandle menu; - bRet = menu.CreatePopupMenu(); - ATLASSERT(bRet); - RECT rcClient = { 0 }; - bRet = wnd.GetClientRect(&rcClient); - ATLASSERT(bRet); - for(int i = 0; i < nCount; i++) - { - TBBUTTON tbb = { 0 }; - bRet = (BOOL)wnd.SendMessage(TB_GETBUTTON, i, (LPARAM)&tbb); - ATLASSERT(bRet); - // skip hidden buttons - if((tbb.fsState & TBSTATE_HIDDEN) != 0) - continue; - RECT rcButton = { 0 }; - bRet = (BOOL)wnd.SendMessage(TB_GETITEMRECT, i, (LPARAM)&rcButton); - ATLASSERT(bRet); - bool bEnabled = ((tbb.fsState & TBSTATE_ENABLED) != 0); - if(rcButton.right > rcClient.right) - { - if(tbb.fsStyle & BTNS_SEP) - { - if(menu.GetMenuItemCount() > 0) - menu.AppendMenu(MF_SEPARATOR); - } - else if(cmi.bCmdBar) - { - const int cchBuff = 200; - TCHAR szBuff[cchBuff] = { 0 }; - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE | MIIM_SUBMENU; - mii.dwTypeData = szBuff; - mii.cch = cchBuff; - bRet = menuCmdBar.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - // Note: CmdBar currently supports only drop-down items - ATLASSERT(::IsMenu(mii.hSubMenu)); - bRet = menu.AppendMenu(MF_STRING | MF_POPUP | (bEnabled ? MF_ENABLED : MF_GRAYED), (UINT_PTR)mii.hSubMenu, mii.dwTypeData); - ATLASSERT(bRet); - } - else - { - // get button's text - const int cchBuff = 200; - TCHAR szBuff[cchBuff] = { 0 }; - LPTSTR lpstrText = szBuff; - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = TBIF_TEXT; - tbbi.pszText = szBuff; - tbbi.cchText = cchBuff; - if(wnd.SendMessage(TB_GETBUTTONINFO, tbb.idCommand, (LPARAM)&tbbi) == -1 || lstrlen(szBuff) == 0) - { - // no text for this button, try a resource string - lpstrText = _T(""); - int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), tbb.idCommand, szBuff, cchBuff); - for(int n = 0; n < nRet; n++) - { - if(szBuff[n] == _T('\n')) - { - lpstrText = &szBuff[n + 1]; - break; - } - } - } - bRet = menu.AppendMenu(MF_STRING | (bEnabled ? MF_ENABLED : MF_GRAYED), tbb.idCommand, lpstrText); - ATLASSERT(bRet); - } - } - } - - if(menu.GetMenuItemCount() == 0) // no hidden buttons after all - { - menu.DestroyMenu(); - ::MessageBeep((UINT)-1); - return false; - } - - cmi.hMenu = menu; - return true; - } - - void DisplayChevronMenu(_ChevronMenuInfo& cmi) - { -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag -#endif - // convert chevron rect to screen coordinates - ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; - POINT pt = { cmi.lpnm->rc.left, cmi.lpnm->rc.bottom }; - wndFrom.MapWindowPoints(NULL, &pt, 1); - RECT rc = cmi.lpnm->rc; - wndFrom.MapWindowPoints(NULL, &rc); - // set up flags and rect - UINT uMenuFlags = TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | (!AtlIsOldWindows() ? TPM_VERPOSANIMATION : 0); - TPMPARAMS TPMParams = { 0 }; - TPMParams.cbSize = sizeof(TPMPARAMS); - TPMParams.rcExclude = rc; - // check if this window has a command bar - HWND hWndCmdBar = (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); - if(::IsWindow(hWndCmdBar)) - { - CBRPOPUPMENU CBRPopupMenu = { sizeof(CBRPOPUPMENU), cmi.hMenu, uMenuFlags, pt.x, pt.y, &TPMParams }; - ::SendMessage(hWndCmdBar, CBRM_TRACKPOPUPMENU, 0, (LPARAM)&CBRPopupMenu); - } - else - { - CMenuHandle menu = cmi.hMenu; - menu.TrackPopupMenuEx(uMenuFlags, pt.x, pt.y, m_hWnd, &TPMParams); - } - } - - void CleanupChevronMenu(_ChevronMenuInfo& cmi) - { - CMenuHandle menu = cmi.hMenu; - // if menu is from a command bar, detach submenus so they are not destroyed - if(cmi.bCmdBar) - { - for(int i = menu.GetMenuItemCount() - 1; i >=0; i--) - menu.RemoveMenu(i, MF_BYPOSITION); - } - // destroy menu - menu.DestroyMenu(); - // convert chevron rect to screen coordinates - ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; - RECT rc = cmi.lpnm->rc; - wndFrom.MapWindowPoints(NULL, &rc); - // eat next message if click is on the same button - MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rc, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -}; - - -template -class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinTraits > -{ -public: - HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) - { - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); - - dwStyle = T::GetWndStyle(dwStyle); - dwExStyle = T::GetWndExStyle(dwExStyle); - - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - return CFrameWindowImplBase< TBase, TWinTraits >::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); - } - - HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) - { - const int cchName = 256; - TCHAR szWindowName[cchName]; - szWindowName[0] = 0; -#ifndef _WIN32_WCE - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); -#else // CE specific - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - - // This always needs to be NULL for Windows CE. - // Frame Window menus have to go onto the CommandBar. - // Use CreateSimpleCECommandBar - HMENU hMenu = NULL; -#endif // _WIN32_WCE - - T* pT = static_cast(this); - HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); - - if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - return hWnd; - } - - BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; -#ifndef _WIN32_WCE - ATLASSERT(!::IsWindow(m_hWndToolBar)); - m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); - return (m_hWndToolBar != NULL); -#else // CE specific - HWND hWnd= T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); - return (hWnd != NULL); -#endif // _WIN32_WCE - } - -#ifdef _WIN32_WCE - // CE specific variant that returns the handle of the toolbar - HWND CreateSimpleCEToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - - return T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); - } -#endif // _WIN32_WCE - -// message map and handlers - typedef CFrameWindowImplBase< TBase, TWinTraits > _baseClass; - - BEGIN_MSG_MAP(CFrameWindowImpl) - MESSAGE_HANDLER(WM_SIZE, OnSize) -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -#endif // !_ATL_NO_REBAR_SUPPORT - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam != SIZE_MINIMIZED) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - bHandled = FALSE; - return 1; - } - -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(FALSE); - return 0; - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; - if(!pT->PrepareChevronMenu(cmi)) - { - bHandled = FALSE; - return 1; - } - // display a popup menu with hidden items - pT->DisplayChevronMenu(cmi); - // cleanup - pT->CleanupChevronMenu(cmi); - return 0; - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -#endif // !_ATL_NO_REBAR_SUPPORT -}; - - -/////////////////////////////////////////////////////////////////////////////// -// AtlCreateSimpleToolBar - helper for creating simple toolbars - -#ifndef _WIN32_WCE - -inline HWND AtlCreateSimpleToolBar(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, - DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) -{ - return CFrameWindowImplBase<>::CreateSimpleToolBarCtrl(hWndParent, nResourceID, bInitialSeparator, dwStyle, nID); -} - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMDIWindow - -#ifndef _WIN32_WCE - -#ifndef _WTL_MDIWINDOWMENU_TEXT -#define _WTL_MDIWINDOWMENU_TEXT _T("&Window") -#endif - -class CMDIWindow : public ATL::CWindow -{ -public: -// Data members - HWND m_hWndMDIClient; - HMENU m_hMenu; - -// Constructors - CMDIWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd), m_hWndMDIClient(NULL), m_hMenu(NULL) - { } - - CMDIWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations - HWND MDIGetActive(BOOL* lpbMaximized = NULL) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (HWND)::SendMessage(m_hWndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)lpbMaximized); - } - - void MDIActivate(HWND hWndChildToActivate) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToActivate)); - ::SendMessage(m_hWndMDIClient, WM_MDIACTIVATE, (WPARAM)hWndChildToActivate, 0); - } - - void MDINext(HWND hWndChild, BOOL bPrevious = FALSE) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(hWndChild == NULL || ::IsWindow(hWndChild)); - ::SendMessage(m_hWndMDIClient, WM_MDINEXT, (WPARAM)hWndChild, (LPARAM)bPrevious); - } - - void MDIMaximize(HWND hWndChildToMaximize) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToMaximize)); - ::SendMessage(m_hWndMDIClient, WM_MDIMAXIMIZE, (WPARAM)hWndChildToMaximize, 0); - } - - void MDIRestore(HWND hWndChildToRestore) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToRestore)); - ::SendMessage(m_hWndMDIClient, WM_MDIRESTORE, (WPARAM)hWndChildToRestore, 0); - } - - void MDIDestroy(HWND hWndChildToDestroy) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToDestroy)); - ::SendMessage(m_hWndMDIClient, WM_MDIDESTROY, (WPARAM)hWndChildToDestroy, 0); - } - - BOOL MDICascade(UINT uFlags = 0) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDICASCADE, (WPARAM)uFlags, 0); - } - - BOOL MDITile(UINT uFlags = MDITILE_HORIZONTAL) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDITILE, (WPARAM)uFlags, 0); - } - - void MDIIconArrange() - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ::SendMessage(m_hWndMDIClient, WM_MDIICONARRANGE, 0, 0); - } - - HMENU MDISetMenu(HMENU hMenuFrame, HMENU hMenuWindow) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDISETMENU, (WPARAM)hMenuFrame, (LPARAM)hMenuWindow); - } - - HMENU MDIRefreshMenu() - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0); - } - -// Additional operations - static HMENU GetStandardWindowMenu(HMENU hMenu) - { - int nCount = ::GetMenuItemCount(hMenu); - if(nCount == -1) - return NULL; - int nLen = ::GetMenuString(hMenu, nCount - 2, NULL, 0, MF_BYPOSITION); - if(nLen == 0) - return NULL; - CTempBuffer buff; - LPTSTR lpszText = buff.Allocate(nLen + 1); - if(lpszText == NULL) - return NULL; - if(::GetMenuString(hMenu, nCount - 2, lpszText, nLen + 1, MF_BYPOSITION) != nLen) - return NULL; - if(lstrcmp(lpszText, _WTL_MDIWINDOWMENU_TEXT) != 0) - return NULL; - return ::GetSubMenu(hMenu, nCount - 2); - } - - void SetMDIFrameMenu() - { - HMENU hWindowMenu = GetStandardWindowMenu(m_hMenu); - MDISetMenu(m_hMenu, hWindowMenu); - MDIRefreshMenu(); - ::DrawMenuBar(GetMDIFrame()); - } - - HWND GetMDIFrame() const - { - return ::GetParent(m_hWndMDIClient); - } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMDIFrameWindowImpl - -#ifndef _WIN32_WCE - -// MDI child command chaining macro (only for MDI frame windows) -#define CHAIN_MDI_CHILD_COMMANDS() \ - if(uMsg == WM_COMMAND) \ - { \ - HWND hWndChild = MDIGetActive(); \ - if(hWndChild != NULL) \ - ::SendMessage(hWndChild, uMsg, wParam, lParam); \ - } - -template -class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBase -{ -public: - HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) - { - m_hMenu = hMenu; - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); - - dwStyle = T::GetWndStyle(dwStyle); - dwExStyle = T::GetWndExStyle(dwExStyle); - - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - return CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); - } - - HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) - { - const int cchName = 256; - TCHAR szWindowName[cchName]; - szWindowName[0] = 0; - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - T* pT = static_cast(this); - HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); - - if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - return hWnd; - } - - BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - ATLASSERT(!::IsWindow(m_hWndToolBar)); - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); - return (m_hWndToolBar != NULL); - } - - virtual WNDPROC GetWindowProc() - { - return MDIFrameWindowProc; - } - - static LRESULT CALLBACK MDIFrameWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - CMDIFrameWindowImpl< T, TBase, TWinTraits >* pThis = (CMDIFrameWindowImpl< T, TBase, TWinTraits >*)hWnd; - // set a ptr to this message and save the old value -#if (_ATL_VER >= 0x0700) - ATL::_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam); - const ATL::_ATL_MSG* pOldMsg = pThis->m_pCurrentMsg; -#else // !(_ATL_VER >= 0x0700) - MSG msg = { pThis->m_hWnd, uMsg, wParam, lParam, 0, { 0, 0 } }; - const MSG* pOldMsg = pThis->m_pCurrentMsg; -#endif // !(_ATL_VER >= 0x0700) - pThis->m_pCurrentMsg = &msg; - // pass to the message map to process - LRESULT lRes = 0; - BOOL bRet = pThis->ProcessWindowMessage(pThis->m_hWnd, uMsg, wParam, lParam, lRes, 0); - // restore saved value for the current message - ATLASSERT(pThis->m_pCurrentMsg == &msg); - pThis->m_pCurrentMsg = pOldMsg; - // do the default processing if message was not handled - if(!bRet) - { - if(uMsg != WM_NCDESTROY) - lRes = pThis->DefWindowProc(uMsg, wParam, lParam); - else - { - // unsubclass, if needed - LONG_PTR pfnWndProc = ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC); - lRes = pThis->DefWindowProc(uMsg, wParam, lParam); - if(pThis->m_pfnSuperWindowProc != ::DefWindowProc && ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc) - ::SetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc); -#if (_ATL_VER >= 0x0700) - // mark window as destryed - pThis->m_dwState |= WINSTATE_DESTROYED; -#else // !(_ATL_VER >= 0x0700) - // clear out window handle - HWND hWnd = pThis->m_hWnd; - pThis->m_hWnd = NULL; - // clean up after window is destroyed - pThis->OnFinalMessage(hWnd); -#endif // !(_ATL_VER >= 0x0700) - } - } -#if (_ATL_VER >= 0x0700) - if(pThis->m_dwState & WINSTATE_DESTROYED && pThis->m_pCurrentMsg == NULL) - { - // clear out window handle - HWND hWnd = pThis->m_hWnd; - pThis->m_hWnd = NULL; - pThis->m_dwState &= ~WINSTATE_DESTROYED; - // clean up after window is destroyed - pThis->OnFinalMessage(hWnd); - } -#endif // (_ATL_VER >= 0x0700) - return lRes; - } - - // Overriden to call DefWindowProc which uses DefFrameProc - LRESULT DefWindowProc() - { - const MSG* pMsg = m_pCurrentMsg; - LRESULT lRes = 0; - if (pMsg != NULL) - lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); - return lRes; - } - - LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) - { - return ::DefFrameProc(m_hWnd, m_hWndMDIClient, uMsg, wParam, lParam); - } - - BOOL PreTranslateMessage(MSG* pMsg) - { - if(CFrameWindowImplBase::PreTranslateMessage(pMsg)) - return TRUE; - return ::TranslateMDISysAccel(m_hWndMDIClient, pMsg); - } - - HWND CreateMDIClient(HMENU hWindowMenu = NULL, UINT nID = ATL_IDW_CLIENT, UINT nFirstChildID = ATL_IDM_FIRST_MDICHILD) - { - DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MDIS_ALLCHILDSTYLES; - DWORD dwExStyle = WS_EX_CLIENTEDGE; - - CLIENTCREATESTRUCT ccs = { 0 }; - ccs.hWindowMenu = hWindowMenu; - ccs.idFirstChild = nFirstChildID; - - if((GetStyle() & (WS_HSCROLL | WS_VSCROLL)) != 0) - { - // parent MDI frame's scroll styles move to the MDICLIENT - dwStyle |= (GetStyle() & (WS_HSCROLL | WS_VSCROLL)); - - // fast way to turn off the scrollbar bits (without a resize) - ModifyStyle(WS_HSCROLL | WS_VSCROLL, 0, SWP_NOREDRAW | SWP_FRAMECHANGED); - } - - // Create MDICLIENT window - m_hWndClient = ::CreateWindowEx(dwExStyle, _T("MDIClient"), NULL, - dwStyle, 0, 0, 1, 1, m_hWnd, (HMENU)LongToHandle(nID), - ModuleHelper::GetModuleInstance(), (LPVOID)&ccs); - if (m_hWndClient == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("MDI Frame failed to create MDICLIENT.\n")); - return NULL; - } - - // Move it to the top of z-order - ::BringWindowToTop(m_hWndClient); - - // set as MDI client window - m_hWndMDIClient = m_hWndClient; - - // update to proper size - T* pT = static_cast(this); - pT->UpdateLayout(); - - return m_hWndClient; - } - - typedef CFrameWindowImplBase _baseClass; - - BEGIN_MSG_MAP(CMDIFrameWindowImpl) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(wParam != SIZE_MINIMIZED) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - // message must be handled, otherwise DefFrameProc would resize the client again - return 0; - } - - LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - // don't allow CFrameWindowImplBase to handle this one - return DefWindowProc(uMsg, wParam, lParam); - } - - LRESULT OnMDISetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - SetMDIFrameMenu(); - return 0; - } - -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(FALSE); - return 0; - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; - if(!pT->PrepareChevronMenu(cmi)) - { - bHandled = FALSE; - return 1; - } - // display a popup menu with hidden items - pT->DisplayChevronMenu(cmi); - // cleanup - pT->CleanupChevronMenu(cmi); - return 0; - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMDIChildWindowImpl - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase -{ -public: - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - UINT nMenuID = 0, LPVOID lpCreateParam = NULL) - { - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); - - if(nMenuID != 0) - m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nMenuID)); - - dwStyle = T::GetWndStyle(dwStyle); - dwExStyle = T::GetWndExStyle(dwExStyle); - - dwExStyle |= WS_EX_MDICHILD; // force this one - m_pfnSuperWindowProc = ::DefMDIChildProc; - m_hWndMDIClient = hWndParent; - ATLASSERT(::IsWindow(m_hWndMDIClient)); - - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - // If the currently active MDI child is maximized, we want to create this one maximized too - ATL::CWindow wndParent = hWndParent; - BOOL bMaximized = FALSE; - wndParent.SendMessage(WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - if(bMaximized) - wndParent.SetRedraw(FALSE); - - HWND hWnd = CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, (UINT)0U, atom, lpCreateParam); - - if(bMaximized) - { - // Maximize and redraw everything - if(hWnd != NULL) - MDIMaximize(hWnd); - wndParent.SetRedraw(TRUE); - wndParent.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); - ::SetFocus(GetMDIFrame()); // focus will be set back to this window - } - else if(hWnd != NULL && ::IsWindowVisible(m_hWnd) && !::IsChild(hWnd, ::GetFocus())) - { - ::SetFocus(hWnd); - } - - return hWnd; - } - - HWND CreateEx(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR lpcstrWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) - { - const int cchName = 256; - TCHAR szWindowName[cchName]; - szWindowName[0] = 0; - if(lpcstrWindowName == NULL) - { - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - lpcstrWindowName = szWindowName; - } - - T* pT = static_cast(this); - HWND hWnd = pT->Create(hWndParent, rect, lpcstrWindowName, dwStyle, dwExStyle, T::GetWndClassInfo().m_uCommonResourceID, lpCreateParam); - - if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - return hWnd; - } - - BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - ATLASSERT(!::IsWindow(m_hWndToolBar)); - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); - return (m_hWndToolBar != NULL); - } - - BOOL UpdateClientEdge(LPRECT lpRect = NULL) - { - // only adjust for active MDI child window - HWND hWndChild = MDIGetActive(); - if(hWndChild != NULL && hWndChild != m_hWnd) - return FALSE; - - // need to adjust the client edge style as max/restore happens - DWORD dwStyle = ::GetWindowLong(m_hWndMDIClient, GWL_EXSTYLE); - DWORD dwNewStyle = dwStyle; - if(hWndChild != NULL && ((GetExStyle() & WS_EX_CLIENTEDGE) == 0) && ((GetStyle() & WS_MAXIMIZE) != 0)) - dwNewStyle &= ~(WS_EX_CLIENTEDGE); - else - dwNewStyle |= WS_EX_CLIENTEDGE; - - if(dwStyle != dwNewStyle) - { - // SetWindowPos will not move invalid bits - ::RedrawWindow(m_hWndMDIClient, NULL, NULL, - RDW_INVALIDATE | RDW_ALLCHILDREN); - // remove/add WS_EX_CLIENTEDGE to MDI client area - ::SetWindowLong(m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); - ::SetWindowPos(m_hWndMDIClient, NULL, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | - SWP_NOZORDER | SWP_NOCOPYBITS); - - // return new client area - if (lpRect != NULL) - ::GetClientRect(m_hWndMDIClient, lpRect); - - return TRUE; - } - - return FALSE; - } - - typedef CFrameWindowImplBase _baseClass; - BEGIN_MSG_MAP(CMDIChildWindowImpl) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged) - MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) - MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) - MESSAGE_HANDLER(WM_MDIACTIVATE, OnMDIActivate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - DefWindowProc(uMsg, wParam, lParam); // needed for MDI children - if(wParam != SIZE_MINIMIZED) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - return 0; - } - - LRESULT OnWindowPosChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - // update MDI client edge and adjust MDI child rect - LPWINDOWPOS lpWndPos = (LPWINDOWPOS)lParam; - - if(!(lpWndPos->flags & SWP_NOSIZE)) - { - RECT rectClient; - if(UpdateClientEdge(&rectClient) && ((GetStyle() & WS_MAXIMIZE) != 0)) - { - ::AdjustWindowRectEx(&rectClient, GetStyle(), FALSE, GetExStyle()); - lpWndPos->x = rectClient.left; - lpWndPos->y = rectClient.top; - lpWndPos->cx = rectClient.right - rectClient.left; - lpWndPos->cy = rectClient.bottom - rectClient.top; - } - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRes = DefWindowProc(uMsg, wParam, lParam); - - // Activate this MDI window if needed - if(lRes == MA_ACTIVATE || lRes == MA_ACTIVATEANDEAT) - { - if(MDIGetActive() != m_hWnd) - MDIActivate(m_hWnd); - } - - return lRes; - } - - LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - return ::SendMessage(GetMDIFrame(), uMsg, wParam, lParam); - } - - LRESULT OnMDIActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if((HWND)lParam == m_hWnd && m_hMenu != NULL) - SetMDIFrameMenu(); - else if((HWND)lParam == NULL) - ::SendMessage(GetMDIFrame(), WM_MDISETMENU, 0, 0); - - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_hMenu != NULL) - { - ::DestroyMenu(m_hMenu); - m_hMenu = NULL; - } - UpdateClientEdge(); - bHandled = FALSE; - return 1; - } - -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(FALSE); - return 0; - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; - if(!pT->PrepareChevronMenu(cmi)) - { - bHandled = FALSE; - return 1; - } - // display a popup menu with hidden items - pT->DisplayChevronMenu(cmi); - // cleanup - pT->CleanupChevronMenu(cmi); - return 0; - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// COwnerDraw - MI class for owner-draw support - -template -class COwnerDraw -{ -public: -#if (_ATL_VER < 0x0700) - BOOL m_bHandledOD; - - BOOL IsMsgHandled() const - { - return m_bHandledOD; - } - void SetMsgHandled(BOOL bHandled) - { - m_bHandledOD = bHandled; - } -#endif // (_ATL_VER < 0x0700) - -// Message map and handlers - BEGIN_MSG_MAP(COwnerDraw< T >) - MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) - MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) - MESSAGE_HANDLER(WM_COMPAREITEM, OnCompareItem) - MESSAGE_HANDLER(WM_DELETEITEM, OnDeleteItem) - ALT_MSG_MAP(1) - MESSAGE_HANDLER(OCM_DRAWITEM, OnDrawItem) - MESSAGE_HANDLER(OCM_MEASUREITEM, OnMeasureItem) - MESSAGE_HANDLER(OCM_COMPAREITEM, OnCompareItem) - MESSAGE_HANDLER(OCM_DELETEITEM, OnDeleteItem) - END_MSG_MAP() - - LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - pT->DrawItem((LPDRAWITEMSTRUCT)lParam); - bHandled = pT->IsMsgHandled(); - return (LRESULT)TRUE; - } - - LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - pT->MeasureItem((LPMEASUREITEMSTRUCT)lParam); - bHandled = pT->IsMsgHandled(); - return (LRESULT)TRUE; - } - - LRESULT OnCompareItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - bHandled = pT->IsMsgHandled(); - return (LRESULT)pT->CompareItem((LPCOMPAREITEMSTRUCT)lParam); - } - - LRESULT OnDeleteItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - pT->DeleteItem((LPDELETEITEMSTRUCT)lParam); - bHandled = pT->IsMsgHandled(); - return (LRESULT)TRUE; - } - -// Overrideables - void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/) - { - // must be implemented - ATLASSERT(FALSE); - } - - void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) - { - if(lpMeasureItemStruct->CtlType != ODT_MENU) - { - // return default height for a system font - T* pT = static_cast(this); - HWND hWnd = pT->GetDlgItem(lpMeasureItemStruct->CtlID); - CClientDC dc(hWnd); - TEXTMETRIC tm = { 0 }; - dc.GetTextMetrics(&tm); - - lpMeasureItemStruct->itemHeight = tm.tmHeight; - } - else - lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU); - } - - int CompareItem(LPCOMPAREITEMSTRUCT /*lpCompareItemStruct*/) - { - // all items are equal - return 0; - } - - void DeleteItem(LPDELETEITEMSTRUCT /*lpDeleteItemStruct*/) - { - // default - nothing - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Update UI macros - -// these build the Update UI map inside a class definition -#define BEGIN_UPDATE_UI_MAP(thisClass) \ - static const CUpdateUIBase::_AtlUpdateUIMap* GetUpdateUIMap() \ - { \ - static const _AtlUpdateUIMap theMap[] = \ - { - -#define UPDATE_ELEMENT(nID, wType) \ - { nID, wType }, - -#define END_UPDATE_UI_MAP() \ - { (WORD)-1, 0 } \ - }; \ - return theMap; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// CUpdateUI - manages UI elements updating - -class CUpdateUIBase -{ -public: - // constants - enum - { - // UI element type - UPDUI_MENUPOPUP = 0x0001, - UPDUI_MENUBAR = 0x0002, - UPDUI_CHILDWINDOW = 0x0004, - UPDUI_TOOLBAR = 0x0008, - UPDUI_STATUSBAR = 0x0010, - // state - UPDUI_ENABLED = 0x0000, - UPDUI_DISABLED = 0x0100, - UPDUI_CHECKED = 0x0200, - UPDUI_CHECKED2 = 0x0400, - UPDUI_RADIO = 0x0800, - UPDUI_DEFAULT = 0x1000, - UPDUI_TEXT = 0x2000, - // internal state - UPDUI_CLEARDEFAULT = 0x4000, - }; - - // element data - struct _AtlUpdateUIElement - { - HWND m_hWnd; - WORD m_wType; - - bool operator ==(const _AtlUpdateUIElement& e) const - { return (m_hWnd == e.m_hWnd && m_wType == e.m_wType); } - }; - - // map data - struct _AtlUpdateUIMap - { - WORD m_nID; - WORD m_wType; - - bool operator ==(const _AtlUpdateUIMap& e) const - { return (m_nID == e.m_nID && m_wType == e.m_wType); } - }; - - // instance data - struct _AtlUpdateUIData - { - WORD m_wState; - union - { - void* m_lpData; - LPTSTR m_lpstrText; - struct - { - WORD m_nIDFirst; - WORD m_nIDLast; - }; - }; - - bool operator ==(const _AtlUpdateUIData& e) const - { return (m_wState == e.m_wState && m_lpData == e.m_lpData); } - }; - - ATL::CSimpleArray<_AtlUpdateUIElement> m_UIElements; // elements data - const _AtlUpdateUIMap* m_pUIMap; // static UI data - _AtlUpdateUIData* m_pUIData; // instance UI data - WORD m_wDirtyType; // global dirty flag - - bool m_bBlockAccelerators; - - -// Constructor, destructor - CUpdateUIBase() : m_pUIMap(NULL), m_pUIData(NULL), m_wDirtyType(0), m_bBlockAccelerators(false) - { } - - ~CUpdateUIBase() - { - if(m_pUIMap != NULL && m_pUIData != NULL) - { - const _AtlUpdateUIMap* pUIMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - while(pUIMap->m_nID != (WORD)-1) - { - if(pUIData->m_wState & UPDUI_TEXT) - delete [] pUIData->m_lpstrText; - pUIMap++; - pUIData++; - } - delete [] m_pUIData; - } - } - -// Check for disabled commands - bool UIGetBlockAccelerators() const - { - return m_bBlockAccelerators; - } - - bool UISetBlockAccelerators(bool bBlock) - { - bool bOld = m_bBlockAccelerators; - m_bBlockAccelerators = bBlock; - return bOld; - } - -// Add elements - BOOL UIAddMenuBar(HWND hWnd) // menu bar (main menu) - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_MENUBAR; - return m_UIElements.Add(e); - } - - BOOL UIAddToolBar(HWND hWnd) // toolbar - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_TOOLBAR; - return m_UIElements.Add(e); - } - - BOOL UIAddStatusBar(HWND hWnd) // status bar - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_STATUSBAR; - return m_UIElements.Add(e); - } - - BOOL UIAddChildWindowContainer(HWND hWnd) // child window - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_CHILDWINDOW; - return m_UIElements.Add(e); - } - -// Message map for popup menu updates and accelerator blocking - BEGIN_MSG_MAP(CUpdateUIBase) - MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - END_MSG_MAP() - - LRESULT OnInitMenuPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; - HMENU hMenu = (HMENU)wParam; - if(hMenu == NULL) - return 1; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return 1; - const _AtlUpdateUIMap* pMap = m_pUIMap; - while(pMap->m_nID != (WORD)-1) - { - if(pMap->m_wType & UPDUI_MENUPOPUP) - { - UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); - - if((pUIData->m_wState & UPDUI_RADIO) != 0) - ::CheckMenuRadioItem(hMenu, pUIData->m_nIDFirst, pUIData->m_nIDLast, pMap->m_nID, MF_BYCOMMAND); - } - pMap++; - pUIData++; - } - return 0; - } - - LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; - if(m_bBlockAccelerators && HIWORD(wParam) == 1) // accelerators only - { - int nID = LOWORD(wParam); - if((UIGetState(nID) & UPDUI_DISABLED) == UPDUI_DISABLED) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIBase::OnCommand - blocked disabled command 0x%4.4X\n"), nID); - bHandled = TRUE; // eat the command, UI item is disabled - } - } - return 0; - } - -// methods for setting UI element state - BOOL UIEnable(int nID, BOOL bEnable, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(bEnable) - { - if(pUIData->m_wState & UPDUI_DISABLED) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_DISABLED; - } - } - else - { - if(!(pUIData->m_wState & UPDUI_DISABLED)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_DISABLED; - } - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - BOOL UISetCheck(int nID, int nCheck, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - switch(nCheck) - { - case 0: - if((pUIData->m_wState & UPDUI_CHECKED) || (pUIData->m_wState & UPDUI_CHECKED2)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~(UPDUI_CHECKED | UPDUI_CHECKED2); - } - break; - case 1: - if(!(pUIData->m_wState & UPDUI_CHECKED)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_CHECKED2; - pUIData->m_wState |= UPDUI_CHECKED; - } - break; - case 2: - if(!(pUIData->m_wState & UPDUI_CHECKED2)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_CHECKED; - pUIData->m_wState |= UPDUI_CHECKED2; - } - break; - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - // variant that supports bool (checked/not-checked, no intermediate state) - BOOL UISetCheck(int nID, bool bCheck, BOOL bForceUpdate = FALSE) - { - return UISetCheck(nID, bCheck ? 1 : 0, bForceUpdate); - } - - BOOL UISetRadio(int nID, BOOL bRadio, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(bRadio) - { - if(!(pUIData->m_wState & UPDUI_RADIO)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_RADIO; - } - } - else - { - if(pUIData->m_wState & UPDUI_RADIO) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_RADIO; - } - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - // for menu items - BOOL UISetRadioMenuItem(int nID, int nIDFirst, int nIDLast, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_RADIO; - pUIData->m_nIDFirst = (WORD)nIDFirst; - pUIData->m_nIDLast = (WORD)nIDLast; - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - } - else if(pMap->m_nID >= nIDFirst && pMap->m_nID <= nIDLast) - { - if(pUIData->m_wState & UPDUI_RADIO) - { - pUIData->m_wState &= ~pMap->m_wType; - pUIData->m_wState &= ~UPDUI_RADIO; - pUIData->m_nIDFirst = 0; - pUIData->m_nIDLast = 0; - } - } - - if(pMap->m_nID == nIDLast) - break; - } - - return TRUE; - } - - BOOL UISetText(int nID, LPCTSTR lpstrText, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - if(lpstrText == NULL) - lpstrText = _T(""); - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(pUIData->m_lpstrText == NULL || lstrcmp(pUIData->m_lpstrText, lpstrText)) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - int nStrLen = lstrlen(lpstrText); - ATLTRY(pUIData->m_lpstrText = new TCHAR[nStrLen + 1]); - if(pUIData->m_lpstrText == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("UISetText - memory allocation failed\n")); - break; - } - SecureHelper::strcpy_x(pUIData->m_lpstrText, nStrLen + 1, lpstrText); - pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); - } - - if(bForceUpdate) - pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - BOOL UISetDefault(int nID, BOOL bDefault, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(bDefault) - { - if((pUIData->m_wState & UPDUI_DEFAULT) == 0) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_DEFAULT; - } - } - else - { - if((pUIData->m_wState & UPDUI_DEFAULT) != 0) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_DEFAULT; - pUIData->m_wState |= UPDUI_CLEARDEFAULT; - } - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - -// methods for complete state set/get - BOOL UISetState(int nID, DWORD dwState) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - pUIData->m_wState = (WORD)(dwState | pMap->m_wType); - m_wDirtyType |= pMap->m_wType; - break; // found - } - } - return TRUE; - } - - DWORD UIGetState(int nID) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return 0; - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - return pUIData->m_wState; - } - return 0; - } - -// methods for updating UI -#ifndef _WIN32_WCE - BOOL UIUpdateMenuBar(BOOL bForceUpdate = FALSE, BOOL bMainMenu = FALSE) - { - if(!(m_wDirtyType & UPDUI_MENUBAR) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_MENUBAR) - { - HMENU hMenu = ::GetMenu(m_UIElements[i].m_hWnd); - if(hMenu != NULL && (pUIData->m_wState & UPDUI_MENUBAR) && (pMap->m_wType & UPDUI_MENUBAR)) - UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); - } - if(bMainMenu) - ::DrawMenuBar(m_UIElements[i].m_hWnd); - } - pMap++; - pUIData->m_wState &= ~UPDUI_MENUBAR; - if(pUIData->m_wState & UPDUI_TEXT) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - pUIData->m_wState &= ~UPDUI_TEXT; - } - pUIData++; - } - - m_wDirtyType &= ~UPDUI_MENUBAR; - return TRUE; - } -#endif // !_WIN32_WCE - - BOOL UIUpdateToolBar(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_TOOLBAR) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_TOOLBAR) - { - if((pUIData->m_wState & UPDUI_TOOLBAR) && (pMap->m_wType & UPDUI_TOOLBAR)) - UIUpdateToolBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); - } - } - pMap++; - pUIData->m_wState &= ~UPDUI_TOOLBAR; - pUIData++; - } - - m_wDirtyType &= ~UPDUI_TOOLBAR; - return TRUE; - } - - BOOL UIUpdateStatusBar(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_STATUSBAR) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_STATUSBAR) - { - if((pUIData->m_wState & UPDUI_STATUSBAR) && (pMap->m_wType & UPDUI_STATUSBAR)) - UIUpdateStatusBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); - } - } - pMap++; - pUIData->m_wState &= ~UPDUI_STATUSBAR; - if(pUIData->m_wState & UPDUI_TEXT) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - pUIData->m_wState &= ~UPDUI_TEXT; - } - pUIData++; - } - - m_wDirtyType &= ~UPDUI_STATUSBAR; - return TRUE; - } - - BOOL UIUpdateChildWindows(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_CHILDWINDOW) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_CHILDWINDOW) - { - if((pUIData->m_wState & UPDUI_CHILDWINDOW) && (pMap->m_wType & UPDUI_CHILDWINDOW)) - UIUpdateChildWindow(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); - } - } - pMap++; - pUIData->m_wState &= ~UPDUI_CHILDWINDOW; - if(pUIData->m_wState & UPDUI_TEXT) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - pUIData->m_wState &= ~UPDUI_TEXT; - } - pUIData++; - } - - m_wDirtyType &= ~UPDUI_CHILDWINDOW; - return TRUE; - } - -// internal element specific methods - static void UIUpdateMenuBarElement(int nID, _AtlUpdateUIData* pUIData, HMENU hMenu) - { -#ifndef _WIN32_WCE - if((pUIData->m_wState & UPDUI_CLEARDEFAULT) != 0) - { - ::SetMenuDefaultItem(hMenu, (UINT)-1, 0); - pUIData->m_wState &= ~UPDUI_CLEARDEFAULT; - } -#endif // !_WIN32_WCE - - CMenuItemInfo mii; - mii.fMask = MIIM_STATE; - mii.wID = nID; - -#ifndef _WIN32_WCE - if((pUIData->m_wState & UPDUI_DISABLED) != 0) - mii.fState |= MFS_DISABLED | MFS_GRAYED; - else - mii.fState |= MFS_ENABLED; - - if((pUIData->m_wState & UPDUI_CHECKED) != 0) - mii.fState |= MFS_CHECKED; - else - mii.fState |= MFS_UNCHECKED; - - if((pUIData->m_wState & UPDUI_DEFAULT) != 0) - mii.fState |= MFS_DEFAULT; -#else // CE specific - // ::SetMenuItemInfo() can't disable or check menu items - // on Windows CE, so we have to do that directly - UINT uEnable = MF_BYCOMMAND; - if((pUIData->m_wState & UPDUI_DISABLED) != 0) - uEnable |= MF_GRAYED; - else - uEnable |= MF_ENABLED; - ::EnableMenuItem(hMenu, nID, uEnable); - - UINT uCheck = MF_BYCOMMAND; - if((pUIData->m_wState & UPDUI_CHECKED) != 0) - uCheck |= MF_CHECKED; - else - uCheck |= MF_UNCHECKED; - ::CheckMenuItem(hMenu, nID, uCheck); -#endif // _WIN32_WCE - - if((pUIData->m_wState & UPDUI_TEXT) != 0) - { - CMenuItemInfo miiNow; - miiNow.fMask = MIIM_TYPE; - miiNow.wID = nID; - if(::GetMenuItemInfo(hMenu, nID, FALSE, &miiNow)) - { - mii.fMask |= MIIM_TYPE; - // MFT_BITMAP and MFT_SEPARATOR don't go together with MFT_STRING -#ifndef _WIN32_WCE - mii.fType |= (miiNow.fType & ~(MFT_BITMAP | MFT_SEPARATOR)) | MFT_STRING; -#else // CE specific - mii.fType |= (miiNow.fType & ~(MFT_SEPARATOR)) | MFT_STRING; -#endif // _WIN32_WCE - mii.dwTypeData = pUIData->m_lpstrText; - } - } - - ::SetMenuItemInfo(hMenu, nID, FALSE, &mii); - } - - static void UIUpdateToolBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndToolBar) - { - // Note: only handles enabled/disabled, checked state, and radio (press) - ::SendMessage(hWndToolBar, TB_ENABLEBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); - ::SendMessage(hWndToolBar, TB_CHECKBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED) ? TRUE : FALSE); - ::SendMessage(hWndToolBar, TB_INDETERMINATE, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED2) ? TRUE : FALSE); - ::SendMessage(hWndToolBar, TB_PRESSBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_RADIO) ? TRUE : FALSE); - } - - static void UIUpdateStatusBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndStatusBar) - { - // Note: only handles text - if(pUIData->m_wState & UPDUI_TEXT) - ::SendMessage(hWndStatusBar, SB_SETTEXT, nID, (LPARAM)pUIData->m_lpstrText); - } - - static void UIUpdateChildWindow(int nID, _AtlUpdateUIData* pUIData, HWND hWnd) - { - HWND hChild = ::GetDlgItem(hWnd, nID); - - ::EnableWindow(hChild, (pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); - // for check and radio, assume that window is a button - int nCheck = BST_UNCHECKED; - if(pUIData->m_wState & UPDUI_CHECKED || pUIData->m_wState & UPDUI_RADIO) - nCheck = BST_CHECKED; - else if(pUIData->m_wState & UPDUI_CHECKED2) - nCheck = BST_INDETERMINATE; - ::SendMessage(hChild, BM_SETCHECK, nCheck, 0L); - if(pUIData->m_wState & UPDUI_DEFAULT) - { - DWORD dwRet = (DWORD)::SendMessage(hWnd, DM_GETDEFID, 0, 0L); - if(HIWORD(dwRet) == DC_HASDEFID) - { - HWND hOldDef = ::GetDlgItem(hWnd, (int)(short)LOWORD(dwRet)); - // remove BS_DEFPUSHBUTTON - ::SendMessage(hOldDef, BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); - } - ::SendMessage(hWnd, DM_SETDEFID, nID, 0L); - } - if(pUIData->m_wState & UPDUI_TEXT) - ::SetWindowText(hChild, pUIData->m_lpstrText); - } -}; - -template -class CUpdateUI : public CUpdateUIBase -{ -public: - CUpdateUI() - { - T* pT = static_cast(this); - pT; - const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); - m_pUIMap = pMap; - ATLASSERT(m_pUIMap != NULL); - int nCount; - for(nCount = 1; pMap->m_nID != (WORD)-1; nCount++) - pMap++; - - // check for duplicates (debug only) -#ifdef _DEBUG - for(int i = 0; i < nCount; i++) - { - for(int j = 0; j < nCount; j++) - { - // shouldn't have duplicates in the update UI map - if(i != j) - ATLASSERT(m_pUIMap[j].m_nID != m_pUIMap[i].m_nID); - } - } -#endif // _DEBUG - - ATLTRY(m_pUIData = new _AtlUpdateUIData[nCount]); - ATLASSERT(m_pUIData != NULL); - - if(m_pUIData != NULL) - memset(m_pUIData, 0, sizeof(_AtlUpdateUIData) * nCount); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDynamicUpdateUI - allows update elements to dynamically added and removed -// in addition to a static update UI map - -template -class CDynamicUpdateUI : public CUpdateUIBase -{ -public: -// Data members - ATL::CSimpleArray<_AtlUpdateUIMap> m_arrUIMap; // copy of the static UI data - ATL::CSimpleArray<_AtlUpdateUIData> m_arrUIData; // instance UI data - -// Constructor/destructor - CDynamicUpdateUI() - { - T* pT = static_cast(this); - pT; - const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); - ATLASSERT(pMap != NULL); - - for(;;) - { - BOOL bRet = m_arrUIMap.Add(*(_AtlUpdateUIMap*)pMap); - ATLASSERT(bRet); - - if(bRet != FALSE) - { - _AtlUpdateUIData data = { 0, NULL }; - bRet = m_arrUIData.Add(data); - ATLASSERT(bRet); - } - - if(pMap->m_nID == (WORD)-1) - break; - - pMap++; - } - - ATLASSERT(m_arrUIMap.GetSize() == m_arrUIData.GetSize()); - -#ifdef _DEBUG - // check for duplicates (debug only) - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - for(int j = 0; j < m_arrUIMap.GetSize(); j++) - { - // shouldn't have duplicates in the update UI map - if(i != j) - ATLASSERT(m_arrUIMap[j].m_nID != m_arrUIMap[i].m_nID); - } - } -#endif // _DEBUG - - // Set internal data pointers to point to the new data arrays - m_pUIMap = m_arrUIMap.m_aT; - m_pUIData = m_arrUIData.m_aT; - } - - ~CDynamicUpdateUI() - { - for(int i = 0; i < m_arrUIData.GetSize(); i++) - { - if((m_arrUIData[i].m_wState & UPDUI_TEXT) != 0) - delete [] m_arrUIData[i].m_lpstrText; - } - - // Reset internal data pointers (memory will be released by CSimpleArray d-tor) - m_pUIMap = NULL; - m_pUIData = NULL; - } - -// Methods for dynamically adding and removing update elements - bool UIAddUpdateElement(WORD nID, WORD wType) - { - // check for duplicates - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - // shouldn't have duplicates in the update UI map - ATLASSERT(m_arrUIMap[i].m_nID != nID); - if(m_arrUIMap[i].m_nID == nID) - return false; - } - - bool bRetVal = false; - - // Add new end element - _AtlUpdateUIMap uumEnd = { (WORD)-1, 0 }; - BOOL bRet = m_arrUIMap.Add(uumEnd); - ATLASSERT(bRet); - - if(bRet != FALSE) - { - _AtlUpdateUIData uud = { 0, NULL }; - bRet = m_arrUIData.Add(uud); - ATLASSERT(bRet); - - // Set new data to the previous end element - if(bRet != FALSE) - { - int nSize = m_arrUIMap.GetSize(); - _AtlUpdateUIMap uum = { nID, wType }; - m_arrUIMap.SetAtIndex(nSize - 2, uum); - m_arrUIData.SetAtIndex(nSize - 2, uud); - - // Set internal data pointers again, just in case that memory moved - m_pUIMap = m_arrUIMap.m_aT; - m_pUIData = m_arrUIData.m_aT; - - bRetVal = true; - } - } - - return bRetVal; - } - - bool UIRemoveUpdateElement(WORD nID) - { - bool bRetVal = false; - - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - if(m_arrUIMap[i].m_nID == nID) - { - BOOL bRet = m_arrUIMap.RemoveAt(i); - ATLASSERT(bRet); - bRet = m_arrUIData.RemoveAt(i); - ATLASSERT(bRet); - - bRetVal = true; - break; - } - } - - return bRetVal; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAutoUpdateUI : Automatic mapping of UI elements - -template -class CAutoUpdateUI : public CDynamicUpdateUI -{ -public: - LPCTSTR UIGetText(int nID) - { - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - if(m_arrUIMap[i].m_nID == nID) - return m_arrUIData[i].m_lpstrText; - } - - return NULL; - } - -// Element - template - bool UIAddElement(UINT nID) - { - // check for existing UI map element - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - if(m_arrUIMap[i].m_nID == nID) - { - // set requested type - m_arrUIMap[i].m_wType |= t_wType; - return true; - } - } - - // Add element to UI map with requested type - return UIAddUpdateElement((WORD)nID, t_wType); - } - - template - bool UIRemoveElement(UINT nID) - { - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - if(m_arrUIMap[i].m_nID == nID) // matching UI map element - { - WORD wType = m_arrUIMap[i].m_wType & ~t_wType; - if (wType) // has other types - { - m_arrUIMap[i].m_wType = wType; // keep other types - return true; - } - else - { - return UIRemoveUpdateElement((WORD)nID); - } - } - } - - return false; - } - -// Menu - bool UIAddMenu(HMENU hMenu, bool bSetText = false) - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - using ATL::GetMenuString; -#endif - ATLASSERT(::IsMenu(hMenu)); - MENUITEMINFO mii = {sizeof(MENUITEMINFO), MIIM_TYPE | MIIM_ID | MIIM_SUBMENU}; - - // Complete the UI map - for (INT uItem = 0; CMenuHandle(hMenu).GetMenuItemInfo(uItem, TRUE, &mii); uItem++) - { - if(mii.hSubMenu) - { - // Add submenu to UI map - UIAddMenu(mii.hSubMenu, bSetText); - } - else if (mii.wID) - { - // Add element to UI map - UIAddElement(mii.wID); -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - if (bSetText) - { - TCHAR sText[64] = { 0 }; - if (GetMenuString(hMenu, uItem, sText, 64, MF_BYPOSITION)) - UISetText(mii.wID, sText); - } -#else - bSetText; -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - } - } - - return true; - } - - bool UIAddMenu(UINT uID, bool bSetText = false) - { - CMenu menu; - ATLVERIFY(menu.LoadMenu(uID)); - return UIAddMenu(menu, bSetText); - } - -// ToolBar -#ifndef BTNS_SEP - #define BTNS_SEP TBSTYLE_SEP -#endif // BTNS_SEP compatibility - -#if !defined(_WIN32_WCE) || (defined(_AUTOUI_CE_TOOLBAR) && defined(TBIF_BYINDEX)) - bool UIAddToolBar(HWND hWndToolBar) - { - ATLASSERT(::IsWindow(hWndToolBar)); - TBBUTTONINFO tbbi = {sizeof TBBUTTONINFO, TBIF_COMMAND | TBIF_STYLE | TBIF_BYINDEX}; - - // Add toolbar buttons - for (int uItem = 0; ::SendMessage(hWndToolBar, TB_GETBUTTONINFO, uItem, (LPARAM)&tbbi) != -1; uItem++) - { - if (tbbi.fsStyle ^ BTNS_SEP) - UIAddElement(tbbi.idCommand); - } - - // Add embedded controls if any - if (::GetWindow(hWndToolBar, GW_CHILD)) - UIAddChildWindowContainer(hWndToolBar); - - return (CUpdateUIBase::UIAddToolBar(hWndToolBar) != FALSE); - } -#endif // !defined(_WIN32_WCE) || (defined(_AUTOUI_CE_TOOLBAR) && defined(TBIF_BYINDEX)) - -// Container - bool UIAddChildWindowContainer(HWND hWnd) - { - ATLASSERT(::IsWindow(hWnd)); - - // Add children controls if any - for (ATL::CWindow wCtl = ::GetWindow(hWnd, GW_CHILD); wCtl.IsWindow(); wCtl = wCtl.GetWindow(GW_HWNDNEXT)) - { - if (int id = wCtl.GetDlgCtrlID()) - UIAddElement(id); - } - - return (CUpdateUIBase::UIAddChildWindowContainer(hWnd) != FALSE); - } - -// StatusBar - BOOL UIUpdateStatusBar(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_STATUSBAR) && !bForceUpdate) - return TRUE; - - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - for(int e = 0; e < m_UIElements.GetSize(); e++) - { - if((m_UIElements[e].m_wType == UPDUI_STATUSBAR) && - (m_arrUIMap[i].m_wType & UPDUI_STATUSBAR) && - (m_arrUIData[i].m_wState & UPDUI_STATUSBAR)) - { - UIUpdateStatusBarElement(m_arrUIMap[i].m_nID, &m_arrUIData[i], m_UIElements[e].m_hWnd); - m_arrUIData[i].m_wState &= ~UPDUI_STATUSBAR; - if(m_arrUIData[i].m_wState & UPDUI_TEXT) - m_arrUIData[i].m_wState &= ~UPDUI_TEXT; - } - } - } - - m_wDirtyType &= ~UPDUI_STATUSBAR; - return TRUE; - } - - bool UIAddStatusBar(HWND hWndStatusBar, INT nPanes = 1) - { - ATLASSERT(::IsWindow(hWndStatusBar)); - - // Add StatusBar panes - for (int iPane = 0; iPane < nPanes; iPane++) - UIAddElement(ID_DEFAULT_PANE + iPane); - - return (CUpdateUIBase::UIAddStatusBar(hWndStatusBar) != FALSE); - } - -// UI Map used if derived class has none - BEGIN_UPDATE_UI_MAP(CAutoUpdateUI) - END_UPDATE_UI_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDialogResize - provides support for resizing dialog controls -// (works for any window that has child controls) - -// Put CDialogResize in the list of base classes for a dialog (or even plain window), -// then implement DLGRESIZE map by specifying controls and groups of control -// and using DLSZ_* values to specify how are they supposed to be resized. -// -// Notes: -// - Resizeable border (WS_THICKFRAME style) should be set in the dialog template -// for top level dialogs (popup or overlapped), so that users can resize the dialog. -// - Some flags cannot be combined; for instance DLSZ_CENTER_X overrides DLSZ_SIZE_X, -// DLSZ_SIZE_X overrides DLSZ_MOVE_X. X and Y flags can be combined. -// - Order of controls is important - group controls are resized and moved based -// on the position of the previous control in a group. - -// dialog resize map macros -#define BEGIN_DLGRESIZE_MAP(thisClass) \ - static const _AtlDlgResizeMap* GetDlgResizeMap() \ - { \ - static const _AtlDlgResizeMap theMap[] = \ - { - -#define END_DLGRESIZE_MAP() \ - { -1, 0 }, \ - }; \ - return theMap; \ - } - -#define DLGRESIZE_CONTROL(id, flags) \ - { id, flags }, - -#define BEGIN_DLGRESIZE_GROUP() \ - { -1, _DLSZ_BEGIN_GROUP }, - -#define END_DLGRESIZE_GROUP() \ - { -1, _DLSZ_END_GROUP }, - - -template -class CDialogResize -{ -public: -// Data declarations and members - enum - { - DLSZ_SIZE_X = 0x00000001, - DLSZ_SIZE_Y = 0x00000002, - DLSZ_MOVE_X = 0x00000004, - DLSZ_MOVE_Y = 0x00000008, - DLSZ_REPAINT = 0x00000010, - DLSZ_CENTER_X = 0x00000020, - DLSZ_CENTER_Y = 0x00000040, - - // internal use only - _DLSZ_BEGIN_GROUP = 0x00001000, - _DLSZ_END_GROUP = 0x00002000, - _DLSZ_GRIPPER = 0x00004000 - }; - - struct _AtlDlgResizeMap - { - int m_nCtlID; - DWORD m_dwResizeFlags; - }; - - struct _AtlDlgResizeData - { - int m_nCtlID; - DWORD m_dwResizeFlags; - RECT m_rect; - - int GetGroupCount() const - { - return (int)LOBYTE(HIWORD(m_dwResizeFlags)); - } - - void SetGroupCount(int nCount) - { - ATLASSERT(nCount > 0 && nCount < 256); - DWORD dwCount = (DWORD)MAKELONG(0, MAKEWORD(nCount, 0)); - m_dwResizeFlags &= 0xFF00FFFF; - m_dwResizeFlags |= dwCount; - } - - bool operator ==(const _AtlDlgResizeData& r) const - { return (m_nCtlID == r.m_nCtlID && m_dwResizeFlags == r.m_dwResizeFlags); } - }; - - ATL::CSimpleArray<_AtlDlgResizeData> m_arrData; - SIZE m_sizeDialog; - POINT m_ptMinTrackSize; - bool m_bGripper; - - -// Constructor - CDialogResize() : m_bGripper(false) - { - m_sizeDialog.cx = 0; - m_sizeDialog.cy = 0; - m_ptMinTrackSize.x = -1; - m_ptMinTrackSize.y = -1; - } - -// Operations - void DlgResize_Init(bool bAddGripper = true, bool bUseMinTrackSize = true, DWORD dwForceStyle = WS_CLIPCHILDREN) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - DWORD dwStyle = pT->GetStyle(); - -#ifdef _DEBUG - // Debug only: Check if top level dialogs have a resizeable border. - if(((dwStyle & WS_CHILD) == 0) && ((dwStyle & WS_THICKFRAME) == 0)) - ATLTRACE2(atlTraceUI, 0, _T("DlgResize_Init - warning: top level dialog without the WS_THICKFRAME style - user cannot resize it\n")); -#endif // _DEBUG - - // Force specified styles (default WS_CLIPCHILDREN reduces flicker) - if((dwStyle & dwForceStyle) != dwForceStyle) - pT->ModifyStyle(0, dwForceStyle); - - // Adding this style removes an empty icon that dialogs with WS_THICKFRAME have. - // Setting icon to NULL is required when XP themes are active. - // Note: This will not prevent adding an icon for the dialog using SetIcon() - if((dwStyle & WS_CHILD) == 0) - { - pT->ModifyStyleEx(0, WS_EX_DLGMODALFRAME); - if(pT->GetIcon(FALSE) == NULL) - pT->SetIcon(NULL, FALSE); - } - - // Cleanup in case of multiple initialization - // block: first check for the gripper control, destroy it if needed - { - ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); - if(wndGripper.IsWindow() && m_arrData.GetSize() > 0 && (m_arrData[0].m_dwResizeFlags & _DLSZ_GRIPPER) != 0) - wndGripper.DestroyWindow(); - } - // clear out everything else - m_arrData.RemoveAll(); - m_sizeDialog.cx = 0; - m_sizeDialog.cy = 0; - m_ptMinTrackSize.x = -1; - m_ptMinTrackSize.y = -1; - - // Get initial dialog client size - RECT rectDlg = { 0 }; - pT->GetClientRect(&rectDlg); - m_sizeDialog.cx = rectDlg.right; - m_sizeDialog.cy = rectDlg.bottom; - -#ifndef _WIN32_WCE - // Create gripper if requested - m_bGripper = false; - if(bAddGripper) - { - // shouldn't exist already - ATLASSERT(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))); - if(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))) - { - ATL::CWindow wndGripper; - wndGripper.Create(_T("SCROLLBAR"), pT->m_hWnd, rectDlg, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEBOX | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN, 0, ATL_IDW_STATUS_BAR); - ATLASSERT(wndGripper.IsWindow()); - if(wndGripper.IsWindow()) - { - m_bGripper = true; - RECT rectCtl = { 0 }; - wndGripper.GetWindowRect(&rectCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - _AtlDlgResizeData data = { ATL_IDW_STATUS_BAR, DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | _DLSZ_GRIPPER, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; - m_arrData.Add(data); - } - } - } -#else // CE specific - bAddGripper; // avoid level 4 warning -#endif // _WIN32_WCE - - // Get min track position if requested - if(bUseMinTrackSize) - { - if((dwStyle & WS_CHILD) != 0) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - m_ptMinTrackSize.x = rect.right - rect.left; - m_ptMinTrackSize.y = rect.bottom - rect.top; - } - else - { - RECT rect = { 0 }; - pT->GetWindowRect(&rect); - m_ptMinTrackSize.x = rect.right - rect.left; - m_ptMinTrackSize.y = rect.bottom - rect.top; - } - } - - // Walk the map and initialize data - const _AtlDlgResizeMap* pMap = pT->GetDlgResizeMap(); - ATLASSERT(pMap != NULL); - int nGroupStart = -1; - for(int nCount = 1; !(pMap->m_nCtlID == -1 && pMap->m_dwResizeFlags == 0); nCount++, pMap++) - { - if(pMap->m_nCtlID == -1) - { - switch(pMap->m_dwResizeFlags) - { - case _DLSZ_BEGIN_GROUP: - ATLASSERT(nGroupStart == -1); - nGroupStart = m_arrData.GetSize(); - break; - case _DLSZ_END_GROUP: - { - ATLASSERT(nGroupStart != -1); - int nGroupCount = m_arrData.GetSize() - nGroupStart; - m_arrData[nGroupStart].SetGroupCount(nGroupCount); - nGroupStart = -1; - } - break; - default: - ATLASSERT(FALSE && _T("Invalid DLGRESIZE Map Entry")); - break; - } - } - else - { - // this ID conflicts with the default gripper one - ATLASSERT(m_bGripper ? (pMap->m_nCtlID != ATL_IDW_STATUS_BAR) : TRUE); - - ATL::CWindow ctl = pT->GetDlgItem(pMap->m_nCtlID); - ATLASSERT(ctl.IsWindow()); - RECT rectCtl = { 0 }; - ctl.GetWindowRect(&rectCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - - DWORD dwGroupFlag = (nGroupStart != -1 && m_arrData.GetSize() == nGroupStart) ? _DLSZ_BEGIN_GROUP : 0; - _AtlDlgResizeData data = { pMap->m_nCtlID, pMap->m_dwResizeFlags | dwGroupFlag, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; - m_arrData.Add(data); - } - } - ATLASSERT((nGroupStart == -1) && _T("No End Group Entry in the DLGRESIZE Map")); - } - - void DlgResize_UpdateLayout(int cxWidth, int cyHeight) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - // Restrict minimum size if requested - if(((pT->GetStyle() & WS_CHILD) != 0) && m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) - { - if(cxWidth < m_ptMinTrackSize.x) - cxWidth = m_ptMinTrackSize.x; - if(cyHeight < m_ptMinTrackSize.y) - cyHeight = m_ptMinTrackSize.y; - } - - BOOL bVisible = pT->IsWindowVisible(); - if(bVisible) - pT->SetRedraw(FALSE); - - for(int i = 0; i < m_arrData.GetSize(); i++) - { - if((m_arrData[i].m_dwResizeFlags & _DLSZ_BEGIN_GROUP) != 0) // start of a group - { - int nGroupCount = m_arrData[i].GetGroupCount(); - ATLASSERT(nGroupCount > 0 && i + nGroupCount - 1 < m_arrData.GetSize()); - RECT rectGroup = m_arrData[i].m_rect; - - int j = 1; - for(j = 1; j < nGroupCount; j++) - { - rectGroup.left = min(rectGroup.left, m_arrData[i + j].m_rect.left); - rectGroup.top = min(rectGroup.top, m_arrData[i + j].m_rect.top); - rectGroup.right = max(rectGroup.right, m_arrData[i + j].m_rect.right); - rectGroup.bottom = max(rectGroup.bottom, m_arrData[i + j].m_rect.bottom); - } - - for(j = 0; j < nGroupCount; j++) - { - _AtlDlgResizeData* pDataPrev = NULL; - if(j > 0) - pDataPrev = &(m_arrData[i + j - 1]); - pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i + j], true, pDataPrev); - } - - i += nGroupCount - 1; // increment to skip all group controls - } - else // one control entry - { - RECT rectGroup = { 0, 0, 0, 0 }; - pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i], false); - } - } - - if(bVisible) - pT->SetRedraw(TRUE); - - pT->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - } - -// Message map and handlers - BEGIN_MSG_MAP(CDialogResize) - MESSAGE_HANDLER(WM_SIZE, OnSize) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo) -#endif // _WIN32_WCE - END_MSG_MAP() - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); -#ifndef _WIN32_WCE - if(m_bGripper) - { - ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); - if(wParam == SIZE_MAXIMIZED) - wndGripper.ShowWindow(SW_HIDE); - else if(wParam == SIZE_RESTORED) - wndGripper.ShowWindow(SW_SHOW); - } -#endif // _WIN32_WCE - if(wParam != SIZE_MINIMIZED) - { - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DlgResize_UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - } - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - if(m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) - { - LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; - lpMMI->ptMinTrackSize = m_ptMinTrackSize; - } - return 0; - } -#endif // _WIN32_WCE - -// Implementation - bool DlgResize_PositionControl(int cxWidth, int cyHeight, RECT& rectGroup, _AtlDlgResizeData& data, bool bGroup, - _AtlDlgResizeData* pDataPrev = NULL) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATL::CWindow ctl; - RECT rectCtl = { 0 }; - - ctl = pT->GetDlgItem(data.m_nCtlID); - if(!ctl.GetWindowRect(&rectCtl)) - return false; - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - - if(bGroup) - { - if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) - { - int cxRight = rectGroup.right + cxWidth - m_sizeDialog.cx; - int cxCtl = data.m_rect.right - data.m_rect.left; - rectCtl.left = rectGroup.left + (cxRight - rectGroup.left - cxCtl) / 2; - rectCtl.right = rectCtl.left + cxCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) - { - rectCtl.left = rectGroup.left + ::MulDiv(data.m_rect.left - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); - - if((data.m_dwResizeFlags & DLSZ_SIZE_X) != 0) - { - rectCtl.right = rectGroup.left + ::MulDiv(data.m_rect.right - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); - - if(pDataPrev != NULL) - { - ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); - RECT rcPrev = { 0 }; - ctlPrev.GetWindowRect(&rcPrev); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); - int dxAdjust = (rectCtl.left - rcPrev.right) - (data.m_rect.left - pDataPrev->m_rect.right); - rcPrev.right += dxAdjust; - ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); - } - } - else - { - rectCtl.right = rectCtl.left + (data.m_rect.right - data.m_rect.left); - } - } - - if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) - { - int cyBottom = rectGroup.bottom + cyHeight - m_sizeDialog.cy; - int cyCtl = data.m_rect.bottom - data.m_rect.top; - rectCtl.top = rectGroup.top + (cyBottom - rectGroup.top - cyCtl) / 2; - rectCtl.bottom = rectCtl.top + cyCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) - { - rectCtl.top = rectGroup.top + ::MulDiv(data.m_rect.top - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); - - if((data.m_dwResizeFlags & DLSZ_SIZE_Y) != 0) - { - rectCtl.bottom = rectGroup.top + ::MulDiv(data.m_rect.bottom - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); - - if(pDataPrev != NULL) - { - ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); - RECT rcPrev = { 0 }; - ctlPrev.GetWindowRect(&rcPrev); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); - int dxAdjust = (rectCtl.top - rcPrev.bottom) - (data.m_rect.top - pDataPrev->m_rect.bottom); - rcPrev.bottom += dxAdjust; - ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); - } - } - else - { - rectCtl.bottom = rectCtl.top + (data.m_rect.bottom - data.m_rect.top); - } - } - } - else // no group - { - if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) - { - int cxCtl = data.m_rect.right - data.m_rect.left; - rectCtl.left = (cxWidth - cxCtl) / 2; - rectCtl.right = rectCtl.left + cxCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) - { - rectCtl.right = data.m_rect.right + (cxWidth - m_sizeDialog.cx); - - if((data.m_dwResizeFlags & DLSZ_MOVE_X) != 0) - rectCtl.left = rectCtl.right - (data.m_rect.right - data.m_rect.left); - } - - if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) - { - int cyCtl = data.m_rect.bottom - data.m_rect.top; - rectCtl.top = (cyHeight - cyCtl) / 2; - rectCtl.bottom = rectCtl.top + cyCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) - { - rectCtl.bottom = data.m_rect.bottom + (cyHeight - m_sizeDialog.cy); - - if((data.m_dwResizeFlags & DLSZ_MOVE_Y) != 0) - rectCtl.top = rectCtl.bottom - (data.m_rect.bottom - data.m_rect.top); - } - } - - if((data.m_dwResizeFlags & DLSZ_REPAINT) != 0) - ctl.Invalidate(); - - if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_SIZE_Y | DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | DLSZ_CENTER_X | DLSZ_CENTER_Y)) != 0) - ctl.SetWindowPos(NULL, &rectCtl, SWP_NOZORDER | SWP_NOACTIVATE); - - return true; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDoubleBufferImpl - Provides double-buffer painting support to any window - -template -class CDoubleBufferImpl -{ -public: -// Overrideables - void DoPaint(CDCHandle /*dc*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } - -// Message map and handlers - BEGIN_MSG_MAP(CDoubleBufferImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background painting needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - if(wParam != NULL) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - CMemoryDC dcMem((HDC)wParam, rect); - pT->DoPaint(dcMem.m_hDC); - } - else - { - CPaintDC dc(pT->m_hWnd); - CMemoryDC dcMem(dc.m_hDC, dc.m_ps.rcPaint); - pT->DoPaint(dcMem.m_hDC); - } - - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDoubleBufferWindowImpl - Implements a double-buffer painting window - -template -class ATL_NO_VTABLE CDoubleBufferWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CDoubleBufferImpl< T > -{ -public: - BEGIN_MSG_MAP(CDoubleBufferWindowImpl) - CHAIN_MSG_MAP(CDoubleBufferImpl< T >) - END_MSG_MAP() -}; - - -// command bar support -#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - #undef CBRM_GETMENU - #undef CBRM_TRACKPOPUPMENU - #undef CBRM_GETCMDBAR - #undef CBRPOPUPMENU -#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - -}; // namespace WTL - -#endif // __ATLFRAME_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlgdi.h b/GLideN64/src/GLideNUI-wtl/WTL/atlgdi.h deleted file mode 100644 index 71892d8..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlgdi.h +++ /dev/null @@ -1,3891 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLGDI_H__ -#define __ATLGDI_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlgdi.h requires atlapp.h to be included first -#endif - - -// protect template members from windowsx.h macros -#ifdef _INC_WINDOWSX - #undef CopyRgn - #undef CreateBrush - #undef CreatePen - #undef SelectBrush - #undef SelectPen - #undef SelectFont - #undef SelectBitmap -#endif // _INC_WINDOWSX - -// required libraries -#if !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) - #pragma comment(lib, "msimg32.lib") -#endif // !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) -#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - #pragma comment(lib, "opengl32.lib") -#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CPenT -// CBrushT -// CLogFont -// CFontT -// CBitmapT -// CPaletteT -// CRgnT -// CDCT -// CPaintDC -// CClientDC -// CWindowDC -// CMemoryDC -// CEnhMetaFileInfo -// CEnhMetaFileT -// CEnhMetaFileDC -// -// Global functions: -// AtlGetBitmapResourceInfo() -// AtlGetBitmapResourceBitsPerPixel() -// AtlIsAlphaBitmapResource() -// AtlIsDib16() -// AtlGetDibColorTableSize() -// AtlGetDibNumColors(), -// AtlGetDibBitmap() -// AtlCopyBitmap() -// AtlCreatePackedDib16() -// AtlSetClipboardDib16() -// AtlGetClipboardDib() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// Bitmap resource helpers to extract bitmap information for a bitmap resource - -inline LPBITMAPINFOHEADER AtlGetBitmapResourceInfo(HMODULE hModule, ATL::_U_STRINGorID image) -{ - HRSRC hResource = ::FindResource(hModule, image.m_lpstr, RT_BITMAP); - ATLASSERT(hResource != NULL); - HGLOBAL hGlobal = ::LoadResource(hModule, hResource); - ATLASSERT(hGlobal != NULL); - LPBITMAPINFOHEADER pBitmapInfoHeader = (LPBITMAPINFOHEADER)::LockResource(hGlobal); - ATLASSERT(pBitmapInfoHeader != NULL); - return pBitmapInfoHeader; -} - -inline WORD AtlGetBitmapResourceBitsPerPixel(HMODULE hModule, ATL::_U_STRINGorID image) -{ - LPBITMAPINFOHEADER pBitmapInfoHeader = AtlGetBitmapResourceInfo(hModule, image); - ATLASSERT(pBitmapInfoHeader != NULL); - return pBitmapInfoHeader->biBitCount; -} - -inline WORD AtlGetBitmapResourceBitsPerPixel(ATL::_U_STRINGorID image) -{ - return AtlGetBitmapResourceBitsPerPixel(ModuleHelper::GetResourceInstance(), image); -} - -/////////////////////////////////////////////////////////////////////////////// -// 32-bit (alpha channel) bitmap resource helper - -// Note: 32-bit (alpha channel) images work only on Windows XP with Common Controls version 6. -// If you want your app to work on older version of Windows, load non-alpha images if Common -// Controls version is less than 6. - -inline bool AtlIsAlphaBitmapResource(ATL::_U_STRINGorID image) -{ - return (AtlGetBitmapResourceBitsPerPixel(image) == 32); -} - - -/////////////////////////////////////////////////////////////////////////////// -// CPen - -template -class CPenT -{ -public: -// Data members - HPEN m_hPen; - -// Constructor/destructor/operators - CPenT(HPEN hPen = NULL) : m_hPen(hPen) - { } - - ~CPenT() - { - if(t_bManaged && m_hPen != NULL) - DeleteObject(); - } - - CPenT& operator =(HPEN hPen) - { - Attach(hPen); - return *this; - } - - void Attach(HPEN hPen) - { - if(t_bManaged && m_hPen != NULL && m_hPen != hPen) - ::DeleteObject(m_hPen); - m_hPen = hPen; - } - - HPEN Detach() - { - HPEN hPen = m_hPen; - m_hPen = NULL; - return hPen; - } - - operator HPEN() const { return m_hPen; } - - bool IsNull() const { return (m_hPen == NULL); } - -// Create methods - HPEN CreatePen(int nPenStyle, int nWidth, COLORREF crColor) - { - ATLASSERT(m_hPen == NULL); - m_hPen = ::CreatePen(nPenStyle, nWidth, crColor); - return m_hPen; - } - -#ifndef _WIN32_WCE - HPEN CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL) - { - ATLASSERT(m_hPen == NULL); - m_hPen = ::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount, lpStyle); - return m_hPen; - } -#endif // !_WIN32_WCE - - HPEN CreatePenIndirect(LPLOGPEN lpLogPen) - { - ATLASSERT(m_hPen == NULL); - m_hPen = ::CreatePenIndirect(lpLogPen); - return m_hPen; - } - - BOOL DeleteObject() - { - ATLASSERT(m_hPen != NULL); - BOOL bRet = ::DeleteObject(m_hPen); - if(bRet) - m_hPen = NULL; - return bRet; - } - -// Attributes - int GetLogPen(LOGPEN* pLogPen) const - { - ATLASSERT(m_hPen != NULL); - return ::GetObject(m_hPen, sizeof(LOGPEN), pLogPen); - } - - bool GetLogPen(LOGPEN& LogPen) const - { - ATLASSERT(m_hPen != NULL); - return (::GetObject(m_hPen, sizeof(LOGPEN), &LogPen) == sizeof(LOGPEN)); - } - -#ifndef _WIN32_WCE - int GetExtLogPen(EXTLOGPEN* pLogPen) const - { - ATLASSERT(m_hPen != NULL); - return ::GetObject(m_hPen, sizeof(EXTLOGPEN), pLogPen); - } - - bool GetExtLogPen(EXTLOGPEN& ExtLogPen) const - { - ATLASSERT(m_hPen != NULL); - return (::GetObject(m_hPen, sizeof(EXTLOGPEN), &ExtLogPen) == sizeof(EXTLOGPEN)); - } -#endif // !_WIN32_WCE -}; - -typedef CPenT CPenHandle; -typedef CPenT CPen; - - -/////////////////////////////////////////////////////////////////////////////// -// CBrush - -template -class CBrushT -{ -public: -// Data members - HBRUSH m_hBrush; - -// Constructor/destructor/operators - CBrushT(HBRUSH hBrush = NULL) : m_hBrush(hBrush) - { } - - ~CBrushT() - { - if(t_bManaged && m_hBrush != NULL) - DeleteObject(); - } - - CBrushT& operator =(HBRUSH hBrush) - { - Attach(hBrush); - return *this; - } - - void Attach(HBRUSH hBrush) - { - if(t_bManaged && m_hBrush != NULL && m_hBrush != hBrush) - ::DeleteObject(m_hBrush); - m_hBrush = hBrush; - } - - HBRUSH Detach() - { - HBRUSH hBrush = m_hBrush; - m_hBrush = NULL; - return hBrush; - } - - operator HBRUSH() const { return m_hBrush; } - - bool IsNull() const { return (m_hBrush == NULL); } - -// Create methods - HBRUSH CreateSolidBrush(COLORREF crColor) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreateSolidBrush(crColor); - return m_hBrush; - } - -#ifndef _WIN32_WCE - HBRUSH CreateHatchBrush(int nIndex, COLORREF crColor) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreateHatchBrush(nIndex, crColor); - return m_hBrush; - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - HBRUSH CreateBrushIndirect(const LOGBRUSH* lpLogBrush) - { - ATLASSERT(m_hBrush == NULL); -#ifndef _WIN32_WCE - m_hBrush = ::CreateBrushIndirect(lpLogBrush); -#else // CE specific - m_hBrush = ATL::CreateBrushIndirect(lpLogBrush); -#endif // _WIN32_WCE - return m_hBrush; - } -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - - HBRUSH CreatePatternBrush(HBITMAP hBitmap) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreatePatternBrush(hBitmap); - return m_hBrush; - } - - HBRUSH CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage) - { - ATLASSERT(hPackedDIB != NULL); - const void* lpPackedDIB = GlobalLock(hPackedDIB); - ATLASSERT(lpPackedDIB != NULL); - m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); - GlobalUnlock(hPackedDIB); - return m_hBrush; - } - - HBRUSH CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); - return m_hBrush; - } - - HBRUSH CreateSysColorBrush(int nIndex) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::GetSysColorBrush(nIndex); - return m_hBrush; - } - - BOOL DeleteObject() - { - ATLASSERT(m_hBrush != NULL); - BOOL bRet = ::DeleteObject(m_hBrush); - if(bRet) - m_hBrush = NULL; - return bRet; - } - -// Attributes - int GetLogBrush(LOGBRUSH* pLogBrush) const - { - ATLASSERT(m_hBrush != NULL); - return ::GetObject(m_hBrush, sizeof(LOGBRUSH), pLogBrush); - } - - bool GetLogBrush(LOGBRUSH& LogBrush) const - { - ATLASSERT(m_hBrush != NULL); - return (::GetObject(m_hBrush, sizeof(LOGBRUSH), &LogBrush) == sizeof(LOGBRUSH)); - } -}; - -typedef CBrushT CBrushHandle; -typedef CBrushT CBrush; - - -/////////////////////////////////////////////////////////////////////////////// -// CFont - -class CLogFont : public LOGFONT -{ -public: - CLogFont() - { - memset(this, 0, sizeof(LOGFONT)); - } - - CLogFont(const LOGFONT& lf) - { - Copy(&lf); - } - - CLogFont(HFONT hFont) - { - ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); - ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); - } - - HFONT CreateFontIndirect() - { - return ::CreateFontIndirect(this); - } - - void SetBold() - { - lfWeight = FW_BOLD; - } - - bool IsBold() const - { - return (lfWeight >= FW_BOLD); - } - - void MakeBolder(int iScale = 1) - { - lfWeight += FW_BOLD * iScale; - } - - void MakeLarger(int iScale) - { - if(lfHeight > 0) - lfHeight += iScale; - else - lfHeight -= iScale; - } - - void SetHeight(LONG nPointSize, HDC hDC = NULL) - { - HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); - // For MM_TEXT mapping mode - lfHeight = -::MulDiv(nPointSize, ::GetDeviceCaps(hDC1, LOGPIXELSY), 72); - if(hDC == NULL) - ::ReleaseDC(NULL, hDC1); - } - - LONG GetHeight(HDC hDC = NULL) const - { - HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); - // For MM_TEXT mapping mode - LONG nPointSize = ::MulDiv(-lfHeight, 72, ::GetDeviceCaps(hDC1, LOGPIXELSY)); - if(hDC == NULL) - ::ReleaseDC(NULL, hDC1); - - return nPointSize; - } - - LONG GetDeciPointHeight(HDC hDC = NULL) const - { - HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); -#ifndef _WIN32_WCE - POINT ptOrg = { 0, 0 }; - ::DPtoLP(hDC1, &ptOrg, 1); - POINT pt = { 0, 0 }; - pt.y = abs(lfHeight) + ptOrg.y; - ::LPtoDP(hDC1, &pt,1); - LONG nDeciPoint = ::MulDiv(pt.y, 720, ::GetDeviceCaps(hDC1, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point -#else // CE specific - // DP and LP are always the same on CE - LONG nDeciPoint = ::MulDiv(abs(lfHeight), 720, ::GetDeviceCaps(hDC1, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE - if(hDC == NULL) - ::ReleaseDC(NULL, hDC1); - - return nDeciPoint; - } - - void SetHeightFromDeciPoint(LONG nDeciPtHeight, HDC hDC = NULL) - { - HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); -#ifndef _WIN32_WCE - POINT pt = { 0, 0 }; - pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), nDeciPtHeight, 720); // 72 points/inch, 10 decipoints/point - ::DPtoLP(hDC1, &pt, 1); - POINT ptOrg = { 0, 0 }; - ::DPtoLP(hDC1, &ptOrg, 1); - lfHeight = -abs(pt.y - ptOrg.y); -#else // CE specific - // DP and LP are always the same on CE - lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), nDeciPtHeight, 720)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE - if(hDC == NULL) - ::ReleaseDC(NULL, hDC1); - } - -#ifndef _WIN32_WCE - void SetCaptionFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfCaptionFont); - } - - void SetMenuFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfMenuFont); - } - - void SetStatusFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfStatusFont); - } - - void SetMessageBoxFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfMessageFont); - } -#endif // !_WIN32_WCE - - void Copy(const LOGFONT* pLogFont) - { - ATLASSERT(pLogFont != NULL); - *(LOGFONT*)this = *pLogFont; - } - - CLogFont& operator =(const CLogFont& src) - { - Copy(&src); - return *this; - } - - CLogFont& operator =(const LOGFONT& src) - { - Copy(&src); - return *this; - } - - CLogFont& operator =(HFONT hFont) - { - ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); - ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); - return *this; - } - - bool operator ==(const LOGFONT& logfont) const - { - return(logfont.lfHeight == lfHeight && - logfont.lfWidth == lfWidth && - logfont.lfEscapement == lfEscapement && - logfont.lfOrientation == lfOrientation && - logfont.lfWeight == lfWeight && - logfont.lfItalic == lfItalic && - logfont.lfUnderline == lfUnderline && - logfont.lfStrikeOut == lfStrikeOut && - logfont.lfCharSet == lfCharSet && - logfont.lfOutPrecision == lfOutPrecision && - logfont.lfClipPrecision == lfClipPrecision && - logfont.lfQuality == lfQuality && - logfont.lfPitchAndFamily == lfPitchAndFamily && - lstrcmp(logfont.lfFaceName, lfFaceName) == 0); - } -}; - - -template -class CFontT -{ -public: -// Data members - HFONT m_hFont; - -// Constructor/destructor/operators - CFontT(HFONT hFont = NULL) : m_hFont(hFont) - { } - - ~CFontT() - { - if(t_bManaged && m_hFont != NULL) - DeleteObject(); - } - - CFontT& operator =(HFONT hFont) - { - Attach(hFont); - return *this; - } - - void Attach(HFONT hFont) - { - if(t_bManaged && m_hFont != NULL && m_hFont != hFont) - ::DeleteObject(m_hFont); - m_hFont = hFont; - } - - HFONT Detach() - { - HFONT hFont = m_hFont; - m_hFont = NULL; - return hFont; - } - - operator HFONT() const { return m_hFont; } - - bool IsNull() const { return (m_hFont == NULL); } - -// Create methods - HFONT CreateFontIndirect(const LOGFONT* lpLogFont) - { - ATLASSERT(m_hFont == NULL); - m_hFont = ::CreateFontIndirect(lpLogFont); - return m_hFont; - } - -#if !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) - HFONT CreateFontIndirectEx(CONST ENUMLOGFONTEXDV* penumlfex) - { - ATLASSERT(m_hFont == NULL); - m_hFont = ::CreateFontIndirectEx(penumlfex); - return m_hFont; - } -#endif // !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) - -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - HFONT CreateFont(int nHeight, int nWidth, int nEscapement, - int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, - BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, - BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, - LPCTSTR lpszFacename) - { - ATLASSERT(m_hFont == NULL); -#ifndef _WIN32_WCE - m_hFont = ::CreateFont(nHeight, nWidth, nEscapement, - nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, - nCharSet, nOutPrecision, nClipPrecision, nQuality, - nPitchAndFamily, lpszFacename); -#else // CE specific - m_hFont = ATL::CreateFont(nHeight, nWidth, nEscapement, - nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, - nCharSet, nOutPrecision, nClipPrecision, nQuality, - nPitchAndFamily, lpszFacename); -#endif // _WIN32_WCE - return m_hFont; - } -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - - HFONT CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, HDC hDC = NULL, bool bBold = false, bool bItalic = false) - { - LOGFONT logFont = { 0 }; - logFont.lfCharSet = DEFAULT_CHARSET; - logFont.lfHeight = nPointSize; - SecureHelper::strncpy_x(logFont.lfFaceName, _countof(logFont.lfFaceName), lpszFaceName, _TRUNCATE); - - if(bBold) - logFont.lfWeight = FW_BOLD; - if(bItalic) - logFont.lfItalic = (BYTE)TRUE; - - return CreatePointFontIndirect(&logFont, hDC); - } - - HFONT CreatePointFontIndirect(const LOGFONT* lpLogFont, HDC hDC = NULL) - { - HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); - - // convert nPointSize to logical units based on hDC - LOGFONT logFont = *lpLogFont; -#ifndef _WIN32_WCE - POINT pt = { 0, 0 }; - pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720); // 72 points/inch, 10 decipoints/point - ::DPtoLP(hDC1, &pt, 1); - POINT ptOrg = { 0, 0 }; - ::DPtoLP(hDC1, &ptOrg, 1); - logFont.lfHeight = -abs(pt.y - ptOrg.y); -#else // CE specific - // DP and LP are always the same on CE - logFont.lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE - - if(hDC == NULL) - ::ReleaseDC(NULL, hDC1); - - return CreateFontIndirect(&logFont); - } - - BOOL DeleteObject() - { - ATLASSERT(m_hFont != NULL); - BOOL bRet = ::DeleteObject(m_hFont); - if(bRet) - m_hFont = NULL; - return bRet; - } - -// Attributes - int GetLogFont(LOGFONT* pLogFont) const - { - ATLASSERT(m_hFont != NULL); - return ::GetObject(m_hFont, sizeof(LOGFONT), pLogFont); - } - - bool GetLogFont(LOGFONT& LogFont) const - { - ATLASSERT(m_hFont != NULL); - return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT)); - } -}; - -typedef CFontT CFontHandle; -typedef CFontT CFont; - - -/////////////////////////////////////////////////////////////////////////////// -// CBitmap - -template -class CBitmapT -{ -public: -// Data members - HBITMAP m_hBitmap; - -// Constructor/destructor/operators - CBitmapT(HBITMAP hBitmap = NULL) : m_hBitmap(hBitmap) - { } - - ~CBitmapT() - { - if(t_bManaged && m_hBitmap != NULL) - DeleteObject(); - } - - CBitmapT& operator =(HBITMAP hBitmap) - { - Attach(hBitmap); - return *this; - } - - void Attach(HBITMAP hBitmap) - { - if(t_bManaged && m_hBitmap != NULL&& m_hBitmap != hBitmap) - ::DeleteObject(m_hBitmap); - m_hBitmap = hBitmap; - } - - HBITMAP Detach() - { - HBITMAP hBitmap = m_hBitmap; - m_hBitmap = NULL; - return hBitmap; - } - - operator HBITMAP() const { return m_hBitmap; } - - bool IsNull() const { return (m_hBitmap == NULL); } - -// Create and load methods - HBITMAP LoadBitmap(ATL::_U_STRINGorID bitmap) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); - return m_hBitmap; - } - - HBITMAP LoadOEMBitmap(UINT nIDBitmap) // for OBM_/OCR_/OIC_ - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::LoadBitmap(NULL, MAKEINTRESOURCE(nIDBitmap)); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - HBITMAP LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateMappedBitmap(ModuleHelper::GetResourceInstance(), nIDBitmap, (WORD)nFlags, lpColorMap, nMapSize); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - HBITMAP CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitsPerPixel, const void* lpBits) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateBitmap(nWidth, nHeight, nPlanes, nBitsPerPixel, lpBits); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - HBITMAP CreateBitmapIndirect(LPBITMAP lpBitmap) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateBitmapIndirect(lpBitmap); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - HBITMAP CreateCompatibleBitmap(HDC hDC, int nWidth, int nHeight) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateCompatibleBitmap(hDC, nWidth, nHeight); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - HBITMAP CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateDiscardableBitmap(hDC, nWidth, nHeight); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - BOOL DeleteObject() - { - ATLASSERT(m_hBitmap != NULL); - BOOL bRet = ::DeleteObject(m_hBitmap); - if(bRet) - m_hBitmap = NULL; - return bRet; - } - -// Attributes - int GetBitmap(BITMAP* pBitMap) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetObject(m_hBitmap, sizeof(BITMAP), pBitMap); - } - - bool GetBitmap(BITMAP& bm) const - { - ATLASSERT(m_hBitmap != NULL); - return (::GetObject(m_hBitmap, sizeof(BITMAP), &bm) == sizeof(BITMAP)); - } - - bool GetSize(SIZE& size) const - { - ATLASSERT(m_hBitmap != NULL); - BITMAP bm = { 0 }; - if(!GetBitmap(&bm)) - return false; - size.cx = bm.bmWidth; - size.cy = bm.bmHeight; - return true; - } - -#ifndef _WIN32_WCE - DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetBitmapBits(m_hBitmap, dwCount, lpBits); - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - DWORD SetBitmapBits(DWORD dwCount, const void* lpBits) - { - ATLASSERT(m_hBitmap != NULL); - return ::SetBitmapBits(m_hBitmap, dwCount, lpBits); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - -#ifndef _WIN32_WCE - BOOL GetBitmapDimension(LPSIZE lpSize) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetBitmapDimensionEx(m_hBitmap, lpSize); - } - - BOOL SetBitmapDimension(int nWidth, int nHeight, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hBitmap != NULL); - return ::SetBitmapDimensionEx(m_hBitmap, nWidth, nHeight, lpSize); - } - -// DIB support - HBITMAP CreateDIBitmap(HDC hDC, CONST BITMAPINFOHEADER* lpbmih, DWORD dwInit, CONST VOID* lpbInit, CONST BITMAPINFO* lpbmi, UINT uColorUse) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateDIBitmap(hDC, lpbmih, dwInit, lpbInit, lpbmi, uColorUse); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - HBITMAP CreateDIBSection(HDC hDC, CONST BITMAPINFO* lpbmi, UINT uColorUse, VOID** ppvBits, HANDLE hSection, DWORD dwOffset) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateDIBSection(hDC, lpbmi, uColorUse, ppvBits, hSection, dwOffset); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - int GetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT uColorUse) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); - } - - int SetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) - { - ATLASSERT(m_hBitmap != NULL); - return ::SetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); - } -#endif // !_WIN32_WCE -}; - -typedef CBitmapT CBitmapHandle; -typedef CBitmapT CBitmap; - - -/////////////////////////////////////////////////////////////////////////////// -// CPalette - -template -class CPaletteT -{ -public: -// Data members - HPALETTE m_hPalette; - -// Constructor/destructor/operators - CPaletteT(HPALETTE hPalette = NULL) : m_hPalette(hPalette) - { } - - ~CPaletteT() - { - if(t_bManaged && m_hPalette != NULL) - DeleteObject(); - } - - CPaletteT& operator =(HPALETTE hPalette) - { - Attach(hPalette); - return *this; - } - - void Attach(HPALETTE hPalette) - { - if(t_bManaged && m_hPalette != NULL && m_hPalette != hPalette) - ::DeleteObject(m_hPalette); - m_hPalette = hPalette; - } - - HPALETTE Detach() - { - HPALETTE hPalette = m_hPalette; - m_hPalette = NULL; - return hPalette; - } - - operator HPALETTE() const { return m_hPalette; } - - bool IsNull() const { return (m_hPalette == NULL); } - -// Create methods - HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette) - { - ATLASSERT(m_hPalette == NULL); - m_hPalette = ::CreatePalette(lpLogPalette); - return m_hPalette; - } - -#ifndef _WIN32_WCE - HPALETTE CreateHalftonePalette(HDC hDC) - { - ATLASSERT(m_hPalette == NULL); - ATLASSERT(hDC != NULL); - m_hPalette = ::CreateHalftonePalette(hDC); - return m_hPalette; - } -#endif // !_WIN32_WCE - - BOOL DeleteObject() - { - ATLASSERT(m_hPalette != NULL); - BOOL bRet = ::DeleteObject(m_hPalette); - if(bRet) - m_hPalette = NULL; - return bRet; - } - -// Attributes - int GetEntryCount() const - { - ATLASSERT(m_hPalette != NULL); - WORD nEntries = 0; - ::GetObject(m_hPalette, sizeof(WORD), &nEntries); - return (int)nEntries; - } - - UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) const - { - ATLASSERT(m_hPalette != NULL); - return ::GetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); - } - - UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) - { - ATLASSERT(m_hPalette != NULL); - return ::SetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); - } - -// Operations -#ifndef _WIN32_WCE - void AnimatePalette(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) - { - ATLASSERT(m_hPalette != NULL); - ::AnimatePalette(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); - } - - BOOL ResizePalette(UINT nNumEntries) - { - ATLASSERT(m_hPalette != NULL); - return ::ResizePalette(m_hPalette, nNumEntries); - } -#endif // !_WIN32_WCE - - UINT GetNearestPaletteIndex(COLORREF crColor) const - { - ATLASSERT(m_hPalette != NULL); - return ::GetNearestPaletteIndex(m_hPalette, crColor); - } -}; - -typedef CPaletteT CPaletteHandle; -typedef CPaletteT CPalette; - - -/////////////////////////////////////////////////////////////////////////////// -// CRgn - -template -class CRgnT -{ -public: -// Data members - HRGN m_hRgn; - -// Constructor/destructor/operators - CRgnT(HRGN hRgn = NULL) : m_hRgn(hRgn) - { } - - ~CRgnT() - { - if(t_bManaged && m_hRgn != NULL) - DeleteObject(); - } - - CRgnT& operator =(HRGN hRgn) - { - Attach(hRgn); - return *this; - } - - void Attach(HRGN hRgn) - { - if(t_bManaged && m_hRgn != NULL && m_hRgn != hRgn) - ::DeleteObject(m_hRgn); - m_hRgn = hRgn; - } - - HRGN Detach() - { - HRGN hRgn = m_hRgn; - m_hRgn = NULL; - return hRgn; - } - - operator HRGN() const { return m_hRgn; } - - bool IsNull() const { return (m_hRgn == NULL); } - -// Create methods - HRGN CreateRectRgn(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateRectRgn(x1, y1, x2, y2); - return m_hRgn; - } - - HRGN CreateRectRgnIndirect(LPCRECT lpRect) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateRectRgnIndirect(lpRect); - return m_hRgn; - } - -#ifndef _WIN32_WCE - HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateEllipticRgn(x1, y1, x2, y2); - return m_hRgn; - } - - HRGN CreateEllipticRgnIndirect(LPCRECT lpRect) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateEllipticRgnIndirect(lpRect); - return m_hRgn; - } - - HRGN CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreatePolygonRgn(lpPoints, nCount, nMode); - return m_hRgn; - } - - HRGN CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode); - return m_hRgn; - } - - HRGN CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3); - return m_hRgn; - } - - HRGN CreateFromPath(HDC hDC) - { - ATLASSERT(m_hRgn == NULL); - ATLASSERT(hDC != NULL); - m_hRgn = ::PathToRegion(hDC); - return m_hRgn; - } - - HRGN CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::ExtCreateRegion(lpXForm, nCount, pRgnData); - return m_hRgn; - } -#endif // !_WIN32_WCE - - BOOL DeleteObject() - { - ATLASSERT(m_hRgn != NULL); - BOOL bRet = ::DeleteObject(m_hRgn); - if(bRet) - m_hRgn = NULL; - return bRet; - } - -// Operations - void SetRectRgn(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hRgn != NULL); - ::SetRectRgn(m_hRgn, x1, y1, x2, y2); - } - - void SetRectRgn(LPCRECT lpRect) - { - ATLASSERT(m_hRgn != NULL); - ::SetRectRgn(m_hRgn, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - - int CombineRgn(HRGN hRgnSrc1, HRGN hRgnSrc2, int nCombineMode) - { - ATLASSERT(m_hRgn != NULL); - return ::CombineRgn(m_hRgn, hRgnSrc1, hRgnSrc2, nCombineMode); - } - - int CombineRgn(HRGN hRgnSrc, int nCombineMode) - { - ATLASSERT(m_hRgn != NULL); - return ::CombineRgn(m_hRgn, m_hRgn, hRgnSrc, nCombineMode); - } - - int CopyRgn(HRGN hRgnSrc) - { - ATLASSERT(m_hRgn != NULL); - return ::CombineRgn(m_hRgn, hRgnSrc, NULL, RGN_COPY); - } - - BOOL EqualRgn(HRGN hRgn) const - { - ATLASSERT(m_hRgn != NULL); - return ::EqualRgn(m_hRgn, hRgn); - } - - int OffsetRgn(int x, int y) - { - ATLASSERT(m_hRgn != NULL); - return ::OffsetRgn(m_hRgn, x, y); - } - - int OffsetRgn(POINT point) - { - ATLASSERT(m_hRgn != NULL); - return ::OffsetRgn(m_hRgn, point.x, point.y); - } - - int GetRgnBox(LPRECT lpRect) const - { - ATLASSERT(m_hRgn != NULL); - return ::GetRgnBox(m_hRgn, lpRect); - } - - BOOL PtInRegion(int x, int y) const - { - ATLASSERT(m_hRgn != NULL); - return ::PtInRegion(m_hRgn, x, y); - } - - BOOL PtInRegion(POINT point) const - { - ATLASSERT(m_hRgn != NULL); - return ::PtInRegion(m_hRgn, point.x, point.y); - } - - BOOL RectInRegion(LPCRECT lpRect) const - { - ATLASSERT(m_hRgn != NULL); - return ::RectInRegion(m_hRgn, lpRect); - } - - int GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const - { - ATLASSERT(m_hRgn != NULL); - return (int)::GetRegionData(m_hRgn, nDataSize, lpRgnData); - } -}; - -typedef CRgnT CRgnHandle; -typedef CRgnT CRgn; - - -/////////////////////////////////////////////////////////////////////////////// -// CDC - The device context class - -template -class CDCT -{ -public: -// Data members - HDC m_hDC; - -// Constructor/destructor/operators - CDCT(HDC hDC = NULL) : m_hDC(hDC) - { - } - - ~CDCT() - { - if(t_bManaged && m_hDC != NULL) - ::DeleteDC(Detach()); - } - - CDCT& operator =(HDC hDC) - { - Attach(hDC); - return *this; - } - - void Attach(HDC hDC) - { - if(t_bManaged && m_hDC != NULL && m_hDC != hDC) - ::DeleteDC(m_hDC); - m_hDC = hDC; - } - - HDC Detach() - { - HDC hDC = m_hDC; - m_hDC = NULL; - return hDC; - } - - operator HDC() const { return m_hDC; } - - bool IsNull() const { return (m_hDC == NULL); } - -// Operations -#ifndef _WIN32_WCE - HWND WindowFromDC() const - { - ATLASSERT(m_hDC != NULL); - return ::WindowFromDC(m_hDC); - } -#endif // !_WIN32_WCE - - CPenHandle GetCurrentPen() const - { - ATLASSERT(m_hDC != NULL); - return CPenHandle((HPEN)::GetCurrentObject(m_hDC, OBJ_PEN)); - } - - CBrushHandle GetCurrentBrush() const - { - ATLASSERT(m_hDC != NULL); - return CBrushHandle((HBRUSH)::GetCurrentObject(m_hDC, OBJ_BRUSH)); - } - - CPaletteHandle GetCurrentPalette() const - { - ATLASSERT(m_hDC != NULL); - return CPaletteHandle((HPALETTE)::GetCurrentObject(m_hDC, OBJ_PAL)); - } - - CFontHandle GetCurrentFont() const - { - ATLASSERT(m_hDC != NULL); - return CFontHandle((HFONT)::GetCurrentObject(m_hDC, OBJ_FONT)); - } - - CBitmapHandle GetCurrentBitmap() const - { - ATLASSERT(m_hDC != NULL); - return CBitmapHandle((HBITMAP)::GetCurrentObject(m_hDC, OBJ_BITMAP)); - } - - HDC CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName, LPCTSTR lpszOutput, const DEVMODE* lpInitData) - { - ATLASSERT(m_hDC == NULL); - m_hDC = ::CreateDC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData); - return m_hDC; - } - - HDC CreateCompatibleDC(HDC hDC = NULL) - { - ATLASSERT(m_hDC == NULL); - m_hDC = ::CreateCompatibleDC(hDC); - return m_hDC; - } - - BOOL DeleteDC() - { - if(m_hDC == NULL) - return FALSE; - BOOL bRet = ::DeleteDC(m_hDC); - if(bRet) - m_hDC = NULL; - return bRet; - } - -// Device-Context Functions - int SaveDC() - { - ATLASSERT(m_hDC != NULL); - return ::SaveDC(m_hDC); - } - - BOOL RestoreDC(int nSavedDC) - { - ATLASSERT(m_hDC != NULL); - return ::RestoreDC(m_hDC, nSavedDC); - } - - int GetDeviceCaps(int nIndex) const - { - ATLASSERT(m_hDC != NULL); - return ::GetDeviceCaps(m_hDC, nIndex); - } - -#ifndef _WIN32_WCE - UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags) - { - ATLASSERT(m_hDC != NULL); - return ::SetBoundsRect(m_hDC, lpRectBounds, flags); - } - - UINT GetBoundsRect(LPRECT lpRectBounds, UINT flags) const - { - ATLASSERT(m_hDC != NULL); - return ::GetBoundsRect(m_hDC, lpRectBounds, flags); - } - - BOOL ResetDC(const DEVMODE* lpDevMode) - { - ATLASSERT(m_hDC != NULL); - return ::ResetDC(m_hDC, lpDevMode) != NULL; - } - -// Drawing-Tool Functions - BOOL GetBrushOrg(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetBrushOrgEx(m_hDC, lpPoint); - } -#endif // !_WIN32_WCE - - BOOL SetBrushOrg(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetBrushOrgEx(m_hDC, x, y, lpPoint); - } - - BOOL SetBrushOrg(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetBrushOrgEx(m_hDC, point.x, point.y, lpPointRet); - } - -#ifndef _WIN32_WCE - int EnumObjects(int nObjectType, int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData) - { - ATLASSERT(m_hDC != NULL); -#ifdef STRICT - return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, lpData); -#else - return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, (LPVOID)lpData); -#endif - } -#endif // !_WIN32_WCE - -// Type-safe selection helpers - HPEN SelectPen(HPEN hPen) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN || ::GetObjectType(hPen) == OBJ_EXTPEN); -#else // CE specific - ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN); -#endif // _WIN32_WCE - return (HPEN)::SelectObject(m_hDC, hPen); - } - - HBRUSH SelectBrush(HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hBrush == NULL || ::GetObjectType(hBrush) == OBJ_BRUSH); - return (HBRUSH)::SelectObject(m_hDC, hBrush); - } - - HFONT SelectFont(HFONT hFont) - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hFont == NULL || ::GetObjectType(hFont) == OBJ_FONT); - return (HFONT)::SelectObject(m_hDC, hFont); - } - - HBITMAP SelectBitmap(HBITMAP hBitmap) - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hBitmap == NULL || ::GetObjectType(hBitmap) == OBJ_BITMAP); - return (HBITMAP)::SelectObject(m_hDC, hBitmap); - } - - int SelectRgn(HRGN hRgn) // special return for regions - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hRgn == NULL || ::GetObjectType(hRgn) == OBJ_REGION); - return PtrToInt(::SelectObject(m_hDC, hRgn)); - } - -// Type-safe selection helpers for stock objects - HPEN SelectStockPen(int nPen) - { - ATLASSERT(m_hDC != NULL); -#if (_WIN32_WINNT >= 0x0500) - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); -#else - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); -#endif // !(_WIN32_WINNT >= 0x0500) - return SelectPen((HPEN)::GetStockObject(nPen)); - } - - HBRUSH SelectStockBrush(int nBrush) - { -#if (_WIN32_WINNT >= 0x0500) - ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); -#else - ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); -#endif // !(_WIN32_WINNT >= 0x0500) - return SelectBrush((HBRUSH)::GetStockObject(nBrush)); - } - - HFONT SelectStockFont(int nFont) - { -#ifndef _WIN32_WCE - ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); -#else // CE specific - ATLASSERT(nFont == SYSTEM_FONT); -#endif // _WIN32_WCE - return SelectFont((HFONT)::GetStockObject(nFont)); - } - - HPALETTE SelectStockPalette(int nPalette, BOOL bForceBackground) - { - ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported - return SelectPalette((HPALETTE)::GetStockObject(nPalette), bForceBackground); - } - -// Color and Color Palette Functions - COLORREF GetNearestColor(COLORREF crColor) const - { - ATLASSERT(m_hDC != NULL); - return ::GetNearestColor(m_hDC, crColor); - } - - HPALETTE SelectPalette(HPALETTE hPalette, BOOL bForceBackground) - { - ATLASSERT(m_hDC != NULL); - - return ::SelectPalette(m_hDC, hPalette, bForceBackground); - } - - UINT RealizePalette() - { - ATLASSERT(m_hDC != NULL); - return ::RealizePalette(m_hDC); - } - -#ifndef _WIN32_WCE - void UpdateColors() - { - ATLASSERT(m_hDC != NULL); - ::UpdateColors(m_hDC); - } -#endif // !_WIN32_WCE - -// Drawing-Attribute Functions - COLORREF GetBkColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetBkColor(m_hDC); - } - - int GetBkMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetBkMode(m_hDC); - } - -#ifndef _WIN32_WCE - int GetPolyFillMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetPolyFillMode(m_hDC); - } - - int GetROP2() const - { - ATLASSERT(m_hDC != NULL); - return ::GetROP2(m_hDC); - } - - int GetStretchBltMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetStretchBltMode(m_hDC); - } -#endif // !_WIN32_WCE - - COLORREF GetTextColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextColor(m_hDC); - } - - COLORREF SetBkColor(COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetBkColor(m_hDC, crColor); - } - - int SetBkMode(int nBkMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetBkMode(m_hDC, nBkMode); - } - -#ifndef _WIN32_WCE - int SetPolyFillMode(int nPolyFillMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetPolyFillMode(m_hDC, nPolyFillMode); - } -#endif // !_WIN32_WCE - - int SetROP2(int nDrawMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetROP2(m_hDC, nDrawMode); - } - -#ifndef _WIN32_WCE - int SetStretchBltMode(int nStretchMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetStretchBltMode(m_hDC, nStretchMode); - } -#endif // !_WIN32_WCE - - COLORREF SetTextColor(COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextColor(m_hDC, crColor); - } - -#ifndef _WIN32_WCE - BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const - { - ATLASSERT(m_hDC != NULL); - return ::GetColorAdjustment(m_hDC, lpColorAdjust); - } - - BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust) - { - ATLASSERT(m_hDC != NULL); - return ::SetColorAdjustment(m_hDC, lpColorAdjust); - } - -// Mapping Functions - int GetMapMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetMapMode(m_hDC); - } - - BOOL GetViewportOrg(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetViewportOrgEx(m_hDC, lpPoint); - } - - int SetMapMode(int nMapMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetMapMode(m_hDC, nMapMode); - } -#endif // !_WIN32_WCE - - // Viewport Origin - BOOL SetViewportOrg(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetViewportOrgEx(m_hDC, x, y, lpPoint); - } - - BOOL SetViewportOrg(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetViewportOrg(point.x, point.y, lpPointRet); - } - -#ifndef _WIN32_WCE - BOOL OffsetViewportOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetViewportOrgEx(m_hDC, nWidth, nHeight, lpPoint); - } - - // Viewport Extent - BOOL GetViewportExt(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetViewportExtEx(m_hDC, lpSize); - } - - BOOL SetViewportExt(int x, int y, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetViewportExtEx(m_hDC, x, y, lpSize); - } - - BOOL SetViewportExt(SIZE size, LPSIZE lpSizeRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetViewportExt(size.cx, size.cy, lpSizeRet); - } - - BOOL ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::ScaleViewportExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); - } -#endif // !_WIN32_WCE - - // Window Origin -#ifndef _WIN32_WCE - BOOL GetWindowOrg(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetWindowOrgEx(m_hDC, lpPoint); - } - - BOOL SetWindowOrg(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetWindowOrgEx(m_hDC, x, y, lpPoint); - } - - BOOL SetWindowOrg(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetWindowOrg(point.x, point.y, lpPointRet); - } - - BOOL OffsetWindowOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetWindowOrgEx(m_hDC, nWidth, nHeight, lpPoint); - } - - // Window extent - BOOL GetWindowExt(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetWindowExtEx(m_hDC, lpSize); - } - - BOOL SetWindowExt(int x, int y, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetWindowExtEx(m_hDC, x, y, lpSize); - } - - BOOL SetWindowExt(SIZE size, LPSIZE lpSizeRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetWindowExt(size.cx, size.cy, lpSizeRet); - } - - BOOL ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::ScaleWindowExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); - } - -// Coordinate Functions - BOOL DPtoLP(LPPOINT lpPoints, int nCount = 1) const - { - ATLASSERT(m_hDC != NULL); - return ::DPtoLP(m_hDC, lpPoints, nCount); - } - - BOOL DPtoLP(LPRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::DPtoLP(m_hDC, (LPPOINT)lpRect, 2); - } - - BOOL DPtoLP(LPSIZE lpSize) const - { - SIZE sizeWinExt = { 0, 0 }; - if(!GetWindowExt(&sizeWinExt)) - return FALSE; - SIZE sizeVpExt = { 0, 0 }; - if(!GetViewportExt(&sizeVpExt)) - return FALSE; - lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeWinExt.cx), abs(sizeVpExt.cx)); - lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeWinExt.cy), abs(sizeVpExt.cy)); - return TRUE; - } - - BOOL LPtoDP(LPPOINT lpPoints, int nCount = 1) const - { - ATLASSERT(m_hDC != NULL); - return ::LPtoDP(m_hDC, lpPoints, nCount); - } - - BOOL LPtoDP(LPRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::LPtoDP(m_hDC, (LPPOINT)lpRect, 2); - } - - BOOL LPtoDP(LPSIZE lpSize) const - { - SIZE sizeWinExt = { 0, 0 }; - if(!GetWindowExt(&sizeWinExt)) - return FALSE; - SIZE sizeVpExt = { 0, 0 }; - if(!GetViewportExt(&sizeVpExt)) - return FALSE; - lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeVpExt.cx), abs(sizeWinExt.cx)); - lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeVpExt.cy), abs(sizeWinExt.cy)); - return TRUE; - } - -// Special Coordinate Functions (useful for dealing with metafiles and OLE) - #define HIMETRIC_INCH 2540 // HIMETRIC units per inch - - void DPtoHIMETRIC(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - int nMapMode; - if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) - { - // when using a constrained map mode, map against physical inch - ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); - DPtoLP(lpSize); - ((CDCHandle*)this)->SetMapMode(nMapMode); - } - else - { - // map against logical inch for non-constrained mapping modes - int cxPerInch = GetDeviceCaps(LOGPIXELSX); - int cyPerInch = GetDeviceCaps(LOGPIXELSY); - ATLASSERT(cxPerInch != 0 && cyPerInch != 0); - lpSize->cx = ::MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch); - lpSize->cy = ::MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch); - } - } - - void HIMETRICtoDP(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - int nMapMode; - if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) - { - // when using a constrained map mode, map against physical inch - ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); - LPtoDP(lpSize); - ((CDCHandle*)this)->SetMapMode(nMapMode); - } - else - { - // map against logical inch for non-constrained mapping modes - int cxPerInch = GetDeviceCaps(LOGPIXELSX); - int cyPerInch = GetDeviceCaps(LOGPIXELSY); - ATLASSERT(cxPerInch != 0 && cyPerInch != 0); - lpSize->cx = ::MulDiv(lpSize->cx, cxPerInch, HIMETRIC_INCH); - lpSize->cy = ::MulDiv(lpSize->cy, cyPerInch, HIMETRIC_INCH); - } - } - - void LPtoHIMETRIC(LPSIZE lpSize) const - { - LPtoDP(lpSize); - DPtoHIMETRIC(lpSize); - } - - void HIMETRICtoLP(LPSIZE lpSize) const - { - HIMETRICtoDP(lpSize); - DPtoLP(lpSize); - } -#endif // !_WIN32_WCE - -// Region Functions - BOOL FillRgn(HRGN hRgn, HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - return ::FillRgn(m_hDC, hRgn, hBrush); - } - -#ifndef _WIN32_WCE - BOOL FrameRgn(HRGN hRgn, HBRUSH hBrush, int nWidth, int nHeight) - { - ATLASSERT(m_hDC != NULL); - return ::FrameRgn(m_hDC, hRgn, hBrush, nWidth, nHeight); - } - - BOOL InvertRgn(HRGN hRgn) - { - ATLASSERT(m_hDC != NULL); - return ::InvertRgn(m_hDC, hRgn); - } - - BOOL PaintRgn(HRGN hRgn) - { - ATLASSERT(m_hDC != NULL); - return ::PaintRgn(m_hDC, hRgn); - } -#endif // !_WIN32_WCE - -// Clipping Functions - int GetClipBox(LPRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::GetClipBox(m_hDC, lpRect); - } - - int GetClipRgn(CRgn& region) const - { - ATLASSERT(m_hDC != NULL); - if(region.IsNull()) - region.CreateRectRgn(0, 0, 0, 0); - - int nRet = ::GetClipRgn(m_hDC, region); - if(nRet != 1) - region.DeleteObject(); - - return nRet; - } - -#ifndef _WIN32_WCE - BOOL PtVisible(int x, int y) const - { - ATLASSERT(m_hDC != NULL); - return ::PtVisible(m_hDC, x, y); - } - - BOOL PtVisible(POINT point) const - { - ATLASSERT(m_hDC != NULL); - return ::PtVisible(m_hDC, point.x, point.y); - } -#endif // !_WIN32_WCE - - BOOL RectVisible(LPCRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::RectVisible(m_hDC, lpRect); - } - - int SelectClipRgn(HRGN hRgn) - { - ATLASSERT(m_hDC != NULL); - return ::SelectClipRgn(m_hDC, (HRGN)hRgn); - } - - int ExcludeClipRect(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::ExcludeClipRect(m_hDC, x1, y1, x2, y2); - } - - int ExcludeClipRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::ExcludeClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - -#ifndef _WIN32_WCE - int ExcludeUpdateRgn(HWND hWnd) - { - ATLASSERT(m_hDC != NULL); - return ::ExcludeUpdateRgn(m_hDC, hWnd); - } -#endif // !_WIN32_WCE - - int IntersectClipRect(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::IntersectClipRect(m_hDC, x1, y1, x2, y2); - } - - int IntersectClipRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::IntersectClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - -#ifndef _WIN32_WCE - int OffsetClipRgn(int x, int y) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetClipRgn(m_hDC, x, y); - } - - int OffsetClipRgn(SIZE size) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetClipRgn(m_hDC, size.cx, size.cy); - } - - int SelectClipRgn(HRGN hRgn, int nMode) - { - ATLASSERT(m_hDC != NULL); - return ::ExtSelectClipRgn(m_hDC, hRgn, nMode); - } -#endif // !_WIN32_WCE - -// Line-Output Functions -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - BOOL GetCurrentPosition(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCurrentPositionEx(m_hDC, lpPoint); - } - - BOOL MoveTo(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::MoveToEx(m_hDC, x, y, lpPoint); - } - - BOOL MoveTo(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return MoveTo(point.x, point.y, lpPointRet); - } - - BOOL LineTo(int x, int y) - { - ATLASSERT(m_hDC != NULL); - return ::LineTo(m_hDC, x, y); - } - - BOOL LineTo(POINT point) - { - ATLASSERT(m_hDC != NULL); - return LineTo(point.x, point.y); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - -#ifndef _WIN32_WCE - BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ::Arc(m_hDC, lpRect->left, lpRect->top, - lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, - ptEnd.x, ptEnd.y); - } -#endif // !_WIN32_WCE - - BOOL Polyline(LPPOINT lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::Polyline(m_hDC, lpPoints, nCount); - } - -#ifndef _WIN32_WCE - BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle) - { - ATLASSERT(m_hDC != NULL); - return ::AngleArc(m_hDC, x, y, nRadius, fStartAngle, fSweepAngle); - } - - BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::ArcTo(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ArcTo(lpRect->left, lpRect->top, lpRect->right, - lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); - } - - int GetArcDirection() const - { - ATLASSERT(m_hDC != NULL); - return ::GetArcDirection(m_hDC); - } - - int SetArcDirection(int nArcDirection) - { - ATLASSERT(m_hDC != NULL); - return ::SetArcDirection(m_hDC, nArcDirection); - } - - BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyDraw(m_hDC, lpPoints, lpTypes, nCount); - } - - BOOL PolylineTo(const POINT* lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolylineTo(m_hDC, lpPoints, nCount); - } - - BOOL PolyPolyline(const POINT* lpPoints, - const DWORD* lpPolyPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyPolyline(m_hDC, lpPoints, lpPolyPoints, nCount); - } - - BOOL PolyBezier(const POINT* lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyBezier(m_hDC, lpPoints, nCount); - } - - BOOL PolyBezierTo(const POINT* lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyBezierTo(m_hDC, lpPoints, nCount); - } -#endif // !_WIN32_WCE - -// Simple Drawing Functions - BOOL FillRect(LPCRECT lpRect, HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - return ::FillRect(m_hDC, lpRect, hBrush); - } - - BOOL FillRect(LPCRECT lpRect, int nColorIndex) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - return ::FillRect(m_hDC, lpRect, (HBRUSH)LongToPtr(nColorIndex + 1)); -#else // CE specific - return ::FillRect(m_hDC, lpRect, ::GetSysColorBrush(nColorIndex)); -#endif // _WIN32_WCE - } - -#ifndef _WIN32_WCE - BOOL FrameRect(LPCRECT lpRect, HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - return ::FrameRect(m_hDC, lpRect, hBrush); - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - BOOL InvertRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::InvertRect(m_hDC, lpRect); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - - BOOL DrawIcon(int x, int y, HICON hIcon) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(m_hDC, x, y, hIcon); -#else // CE specific - return ::DrawIconEx(m_hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIcon(POINT point, HICON hIcon) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(m_hDC, point.x, point.y, hIcon); -#else // CE specific - return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIconEx(int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawIconEx(m_hDC, x, y, hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - - BOOL DrawIconEx(POINT point, HICON hIcon, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - -#ifndef _WIN32_WCE - BOOL DrawState(POINT pt, SIZE size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hBitmap, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_BITMAP); - } - - BOOL DrawState(POINT pt, SIZE size, HICON hIcon, UINT nFlags, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_ICON); - } - - BOOL DrawState(POINT pt, SIZE size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags | (bPrefixText ? DST_PREFIXTEXT : DST_TEXT)); - } - - BOOL DrawState(POINT pt, SIZE size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_COMPLEX); - } -#endif // !_WIN32_WCE - -// Ellipse and Polygon Functions -#ifndef _WIN32_WCE - BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ::Chord(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); - } -#endif // !_WIN32_WCE - - void DrawFocusRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - ::DrawFocusRect(m_hDC, lpRect); - } - - BOOL Ellipse(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::Ellipse(m_hDC, x1, y1, x2, y2); - } - - BOOL Ellipse(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::Ellipse(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - -#ifndef _WIN32_WCE - BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ::Pie(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); - } -#endif // !_WIN32_WCE - - BOOL Polygon(LPPOINT lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::Polygon(m_hDC, lpPoints, nCount); - } - -#ifndef _WIN32_WCE - BOOL PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); - } -#endif // !_WIN32_WCE - - BOOL Rectangle(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::Rectangle(m_hDC, x1, y1, x2, y2); - } - - BOOL Rectangle(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::Rectangle(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - - BOOL RoundRect(int x1, int y1, int x2, int y2, int x3, int y3) - { - ATLASSERT(m_hDC != NULL); - return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3); - } - - BOOL RoundRect(LPCRECT lpRect, POINT point) - { - ATLASSERT(m_hDC != NULL); - return ::RoundRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, point.x, point.y); - } - -// Bitmap Functions - BOOL PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop); - } - - BOOL BitBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, - int xSrc, int ySrc, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::BitBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, dwRop); - } - - BOOL StretchBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::StretchBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwRop); - } - - COLORREF GetPixel(int x, int y) const - { - ATLASSERT(m_hDC != NULL); - return ::GetPixel(m_hDC, x, y); - } - - COLORREF GetPixel(POINT point) const - { - ATLASSERT(m_hDC != NULL); - return ::GetPixel(m_hDC, point.x, point.y); - } - - COLORREF SetPixel(int x, int y, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixel(m_hDC, x, y, crColor); - } - - COLORREF SetPixel(POINT point, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixel(m_hDC, point.x, point.y, crColor); - } - -#ifndef _WIN32_WCE - BOOL FloodFill(int x, int y, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::FloodFill(m_hDC, x, y, crColor); - } - - BOOL ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType) - { - ATLASSERT(m_hDC != NULL); - return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); - } -#endif // !_WIN32_WCE - - BOOL MaskBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, HBITMAP hMaskBitmap, int xMask, int yMask, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, hMaskBitmap, xMask, yMask, dwRop); - } - -#ifndef _WIN32_WCE - BOOL PlgBlt(LPPOINT lpPoint, HDC hSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, HBITMAP hMaskBitmap, int xMask, int yMask) - { - ATLASSERT(m_hDC != NULL); - return ::PlgBlt(m_hDC, lpPoint, hSrcDC, xSrc, ySrc, nWidth, nHeight, hMaskBitmap, xMask, yMask); - } - - BOOL SetPixelV(int x, int y, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixelV(m_hDC, x, y, crColor); - } - - BOOL SetPixelV(POINT point, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixelV(m_hDC, point.x, point.y, crColor); - } -#endif // !_WIN32_WCE - -#if !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) -#ifndef _WIN32_WCE - BOOL TransparentBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) - { - ATLASSERT(m_hDC != NULL); - return ::TransparentBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); - } -#else // CE specific - BOOL TransparentImage(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) - { - ATLASSERT(m_hDC != NULL); - return ::TransparentImage(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); - } -#endif // _WIN32_WCE - -#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420)) - BOOL GradientFill(const PTRIVERTEX pVertices, DWORD nVertices, void* pMeshElements, DWORD nMeshElements, DWORD dwMode) - { - ATLASSERT(m_hDC != NULL); - return ::GradientFill(m_hDC, pVertices, nVertices, pMeshElements, nMeshElements, dwMode); - } - - BOOL GradientFillRect(RECT& rect, COLORREF clr1, COLORREF clr2, bool bHorizontal) - { - ATLASSERT(m_hDC != NULL); - - TRIVERTEX arrTvx[2] = { { 0 }, { 0 } }; - - arrTvx[0].x = rect.left; - arrTvx[0].y = rect.top; - arrTvx[0].Red = MAKEWORD(0, GetRValue(clr1)); - arrTvx[0].Green = MAKEWORD(0, GetGValue(clr1)); - arrTvx[0].Blue = MAKEWORD(0, GetBValue(clr1)); - arrTvx[0].Alpha = 0; - - arrTvx[1].x = rect.right; - arrTvx[1].y = rect.bottom; - arrTvx[1].Red = MAKEWORD(0, GetRValue(clr2)); - arrTvx[1].Green = MAKEWORD(0, GetGValue(clr2)); - arrTvx[1].Blue = MAKEWORD(0, GetBValue(clr2)); - arrTvx[1].Alpha = 0; - - GRADIENT_RECT gr = { 0, 1 }; - - return ::GradientFill(m_hDC, arrTvx, 2, &gr, 1, bHorizontal ? GRADIENT_FILL_RECT_H : GRADIENT_FILL_RECT_V); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - -#if !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) - BOOL AlphaBlend(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BLENDFUNCTION bf) - { - ATLASSERT(m_hDC != NULL); - return ::AlphaBlend(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) -#endif // !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) - -// Extra bitmap functions - // Helper function for painting a disabled toolbar or menu bitmap - // This function can take either an HBITMAP (for SS) or a DC with - // the bitmap already painted (for cmdbar) - BOOL DitherBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, HBITMAP hBitmap, int xSrc, int ySrc, - HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), - HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), - HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) - { - ATLASSERT(m_hDC != NULL || hBitmap != NULL); - ATLASSERT(nWidth > 0 && nHeight > 0); - - // Create a generic DC for all BitBlts - CDCHandle dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC); - ATLASSERT(dc.m_hDC != NULL); - if(dc.m_hDC == NULL) - return FALSE; - - // Create a DC for the monochrome DIB section - CDC dcBW = ::CreateCompatibleDC(m_hDC); - ATLASSERT(dcBW.m_hDC != NULL); - if(dcBW.m_hDC == NULL) - { - if(hSrcDC == NULL) - dc.DeleteDC(); - return FALSE; - } - - // Create the monochrome DIB section with a black and white palette - struct RGBBWBITMAPINFO - { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[2]; - }; - - RGBBWBITMAPINFO rgbBWBitmapInfo = - { - { sizeof(BITMAPINFOHEADER), nWidth, nHeight, 1, 1, BI_RGB, 0, 0, 0, 0, 0 }, - { { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 } } - }; - - VOID* pbitsBW; - CBitmap bmpBW = ::CreateDIBSection(dcBW, (LPBITMAPINFO)&rgbBWBitmapInfo, DIB_RGB_COLORS, &pbitsBW, NULL, 0); - ATLASSERT(bmpBW.m_hBitmap != NULL); - if(bmpBW.m_hBitmap == NULL) - { - if(hSrcDC == NULL) - dc.DeleteDC(); - return FALSE; - } - - // Attach the monochrome DIB section and the bitmap to the DCs - HBITMAP hbmOldBW = dcBW.SelectBitmap(bmpBW); - HBITMAP hbmOldDC = NULL; - if(hBitmap != NULL) - hbmOldDC = dc.SelectBitmap(hBitmap); - - // Block: Dark gray removal: we want (128, 128, 128) pixels to become black and not white - { - CDC dcTemp1 = ::CreateCompatibleDC(m_hDC); - CDC dcTemp2 = ::CreateCompatibleDC(m_hDC); - CBitmap bmpTemp1; - bmpTemp1.CreateCompatibleBitmap(dc, nWidth, nHeight); - CBitmap bmpTemp2; - bmpTemp2.CreateBitmap(nWidth, nHeight, 1, 1, NULL); - HBITMAP hOldBmp1 = dcTemp1.SelectBitmap(bmpTemp1); - HBITMAP hOldBmp2 = dcTemp2.SelectBitmap(bmpTemp2); - // Let's copy our image, it will be altered - dcTemp1.BitBlt(0, 0, nWidth, nHeight, dc, xSrc, ySrc, SRCCOPY); - - // All dark gray pixels will become white, the others black - dcTemp1.SetBkColor(RGB(128, 128, 128)); - dcTemp2.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); - // Do an XOR to set to black these white pixels - dcTemp1.BitBlt(0, 0, nWidth, nHeight, dcTemp2, 0, 0, SRCINVERT); - - // BitBlt the bitmap into the monochrome DIB section - // The DIB section will do a true monochrome conversion - // The magenta background being closer to white will become white - dcBW.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); - - // Cleanup - dcTemp1.SelectBitmap(hOldBmp1); - dcTemp2.SelectBitmap(hOldBmp2); - } - - // Paint the destination rectangle using hBrushBackground - if(hBrushBackground != NULL) - { - RECT rc = { x, y, x + nWidth, y + nHeight }; - FillRect(&rc, hBrushBackground); - } - - // BitBlt the black bits in the monochrome bitmap into hBrush3DEffect color in the destination DC - // The magic ROP comes from the Charles Petzold's book - HBRUSH hOldBrush = SelectBrush(hBrush3DEffect); - BitBlt(x + 1, y + 1, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); - - // BitBlt the black bits in the monochrome bitmap into hBrushDisabledImage color in the destination DC - SelectBrush(hBrushDisabledImage); - BitBlt(x, y, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); - - SelectBrush(hOldBrush); - dcBW.SelectBitmap(hbmOldBW); - dc.SelectBitmap(hbmOldDC); - - if(hSrcDC == NULL) - dc.DeleteDC(); - - return TRUE; - } - -// Text Functions -#ifndef _WIN32_WCE - BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount = -1) - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::TextOut(m_hDC, x, y, lpszString, nCount); - } -#endif // !_WIN32_WCE - - BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, UINT nCount = -1, LPINT lpDxWidths = NULL) - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect, lpszString, nCount, lpDxWidths); - } - -#ifndef _WIN32_WCE - SIZE TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL, int nTabOrigin = 0) - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - LONG lRes = ::TabbedTextOut(m_hDC, x, y, lpszString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin); - SIZE size = { GET_X_LPARAM(lRes), GET_Y_LPARAM(lRes) }; - return size; - } -#endif // !_WIN32_WCE - - int DrawText(LPCTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - ATLASSERT((uFormat & DT_MODIFYSTRING) == 0); -#endif // !_WIN32_WCE - return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); - } - - int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) - { - ATLASSERT(m_hDC != NULL); - return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); - } - -#ifndef _WIN32_WCE - int DrawTextEx(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawTextEx(m_hDC, lpstrText, cchText, lpRect, uFormat, lpDTParams); - } -#endif // !_WIN32_WCE - -#if (_WIN32_WINNT >= 0x0501) - int DrawShadowText(LPCWSTR lpstrText, int cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset) - { - ATLASSERT(m_hDC != NULL); - // This function is present only if comctl32.dll version 6 is loaded; - // we use LoadLibrary/GetProcAddress to allow apps compiled with - // _WIN32_WINNT >= 0x0501 to run on older Windows/CommCtrl - int nRet = 0; - HMODULE hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - ATLASSERT(hCommCtrlDLL != NULL); - if(hCommCtrlDLL != NULL) - { - typedef int (WINAPI *PFN_DrawShadowText)(HDC hDC, LPCWSTR lpstrText, UINT cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset); - PFN_DrawShadowText pfnDrawShadowText = (PFN_DrawShadowText)::GetProcAddress(hCommCtrlDLL, "DrawShadowText"); - ATLASSERT(pfnDrawShadowText != NULL); // this function requires CommCtrl6 - if(pfnDrawShadowText != NULL) - nRet = pfnDrawShadowText(m_hDC, lpstrText, cchText, lpRect, dwFlags, clrText, clrShadow, xOffset, yOffset); - ::FreeLibrary(hCommCtrlDLL); - } - return nRet; - } -#endif // (_WIN32_WINNT >= 0x0501) - - BOOL GetTextExtent(LPCTSTR lpszString, int nCount, LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::GetTextExtentPoint32(m_hDC, lpszString, nCount, lpSize); - } - - BOOL GetTextExtentExPoint(LPCTSTR lpszString, int cchString, LPSIZE lpSize, int nMaxExtent, LPINT lpnFit = NULL, LPINT alpDx = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::GetTextExtentExPoint(m_hDC, lpszString, cchString, nMaxExtent, lpnFit, alpDx, lpSize); - } - -#ifndef _WIN32_WCE - DWORD GetTabbedTextExtent(LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL) const - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::GetTabbedTextExtent(m_hDC, lpszString, nCount, nTabPositions, lpnTabStopPositions); - } - - BOOL GrayString(HBRUSH hBrush, BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int), LPARAM lpData, int nCount, int x, int y, int nWidth, int nHeight) - { - ATLASSERT(m_hDC != NULL); - return ::GrayString(m_hDC, hBrush, (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - UINT GetTextAlign() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextAlign(m_hDC); - } - - UINT SetTextAlign(UINT nFlags) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextAlign(m_hDC, nFlags); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - - int GetTextFace(LPTSTR lpszFacename, int nCount) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextFace(m_hDC, nCount, lpszFacename); - } - - int GetTextFaceLen() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextFace(m_hDC, 0, NULL); - } - -#ifndef _ATL_NO_COM -#ifdef _OLEAUTO_H_ - BOOL GetTextFace(BSTR& bstrFace) const - { - USES_CONVERSION; - ATLASSERT(m_hDC != NULL); - ATLASSERT(bstrFace == NULL); - - int nLen = GetTextFaceLen(); - if(nLen == 0) - return FALSE; - - CTempBuffer buff; - LPTSTR lpszText = buff.Allocate(nLen); - if(lpszText == NULL) - return FALSE; - - if(!GetTextFace(lpszText, nLen)) - return FALSE; - - bstrFace = ::SysAllocString(T2OLE(lpszText)); - return (bstrFace != NULL) ? TRUE : FALSE; - } -#endif -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetTextFace(_CSTRING_NS::CString& strFace) const - { - ATLASSERT(m_hDC != NULL); - - int nLen = GetTextFaceLen(); - if(nLen == 0) - return 0; - - LPTSTR lpstr = strFace.GetBufferSetLength(nLen); - if(lpstr == NULL) - return 0; - int nRet = GetTextFace(lpstr, nLen); - strFace.ReleaseBuffer(); - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL GetTextMetrics(LPTEXTMETRIC lpMetrics) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextMetrics(m_hDC, lpMetrics); - } - -#ifndef _WIN32_WCE - int SetTextJustification(int nBreakExtra, int nBreakCount) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextJustification(m_hDC, nBreakExtra, nBreakCount); - } - - int GetTextCharacterExtra() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextCharacterExtra(m_hDC); - } - - int SetTextCharacterExtra(int nCharExtra) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextCharacterExtra(m_hDC, nCharExtra); - } -#endif // !_WIN32_WCE - -// Advanced Drawing - BOOL DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags) - { - ATLASSERT(m_hDC != NULL); - return ::DrawEdge(m_hDC, lpRect, nEdge, nFlags); - } - - BOOL DrawFrameControl(LPRECT lpRect, UINT nType, UINT nState) - { - ATLASSERT(m_hDC != NULL); - return ::DrawFrameControl(m_hDC, lpRect, nType, nState); - } - -// Scrolling Functions - BOOL ScrollDC(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate) - { - ATLASSERT(m_hDC != NULL); - return ::ScrollDC(m_hDC, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate); - } - -// Font Functions -#ifndef _WIN32_WCE - BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidth(m_hDC, nFirstChar, nLastChar, lpBuffer); - } - - // GetCharWidth32 is not supported under Win9x - BOOL GetCharWidth32(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidth32(m_hDC, nFirstChar, nLastChar, lpBuffer); - } - - DWORD SetMapperFlags(DWORD dwFlag) - { - ATLASSERT(m_hDC != NULL); - return ::SetMapperFlags(m_hDC, dwFlag); - } - - BOOL GetAspectRatioFilter(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetAspectRatioFilterEx(m_hDC, lpSize); - } - - BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABC lpabc) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharABCWidths(m_hDC, nFirstChar, nLastChar, lpabc); - } - - DWORD GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData, DWORD cbData) const - { - ATLASSERT(m_hDC != NULL); - return ::GetFontData(m_hDC, dwTable, dwOffset, lpData, cbData); - } - - int GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const - { - ATLASSERT(m_hDC != NULL); - return ::GetKerningPairs(m_hDC, nPairs, lpkrnpair); - } - - UINT GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const - { - ATLASSERT(m_hDC != NULL); - return ::GetOutlineTextMetrics(m_hDC, cbData, lpotm); - } - - DWORD GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpBuffer, const MAT2* lpmat2) const - { - ATLASSERT(m_hDC != NULL); - return ::GetGlyphOutline(m_hDC, nChar, nFormat, lpgm, cbBuffer, lpBuffer, lpmat2); - } - - BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABCFLOAT lpABCF) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharABCWidthsFloat(m_hDC, nFirstChar, nLastChar, lpABCF); - } - - BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, float* lpFloatBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidthFloat(m_hDC, nFirstChar, nLastChar, lpFloatBuffer); - } -#endif // !_WIN32_WCE - -// Printer/Device Escape Functions -#ifndef _WIN32_WCE - int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData) - { - ATLASSERT(m_hDC != NULL); - return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData); - } -#endif // !_WIN32_WCE - - int Escape(int nEscape, int nInputSize, LPCSTR lpszInputData, - int nOutputSize, LPSTR lpszOutputData) - { - ATLASSERT(m_hDC != NULL); - return ::ExtEscape(m_hDC, nEscape, nInputSize, lpszInputData, nOutputSize, lpszOutputData); - } - -#ifndef _WIN32_WCE - int DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData) - { - ATLASSERT(m_hDC != NULL); - return ::DrawEscape(m_hDC, nEscape, nInputSize, lpszInputData); - } -#endif // !_WIN32_WCE - - // Escape helpers -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) - int StartDoc(LPCTSTR lpszDocName) // old Win3.0 version - { - DOCINFO di = { 0 }; - di.cbSize = sizeof(DOCINFO); - di.lpszDocName = lpszDocName; - return StartDoc(&di); - } - - int StartDoc(LPDOCINFO lpDocInfo) - { - ATLASSERT(m_hDC != NULL); - return ::StartDoc(m_hDC, lpDocInfo); - } - - int StartPage() - { - ATLASSERT(m_hDC != NULL); - return ::StartPage(m_hDC); - } - - int EndPage() - { - ATLASSERT(m_hDC != NULL); - return ::EndPage(m_hDC); - } - - int SetAbortProc(BOOL (CALLBACK* lpfn)(HDC, int)) - { - ATLASSERT(m_hDC != NULL); - return ::SetAbortProc(m_hDC, (ABORTPROC)lpfn); - } - - int AbortDoc() - { - ATLASSERT(m_hDC != NULL); - return ::AbortDoc(m_hDC); - } - - int EndDoc() - { - ATLASSERT(m_hDC != NULL); - return ::EndDoc(m_hDC); - } -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) - -// MetaFile Functions -#ifndef _WIN32_WCE - BOOL PlayMetaFile(HMETAFILE hMF) - { - ATLASSERT(m_hDC != NULL); - if(::GetDeviceCaps(m_hDC, TECHNOLOGY) == DT_METAFILE) - { - // playing metafile in metafile, just use core windows API - return ::PlayMetaFile(m_hDC, hMF); - } - - // for special playback, lParam == pDC - return ::EnumMetaFile(m_hDC, hMF, EnumMetaFileProc, (LPARAM)this); - } - - BOOL PlayMetaFile(HENHMETAFILE hEnhMetaFile, LPCRECT lpBounds) - { - ATLASSERT(m_hDC != NULL); - return ::PlayEnhMetaFile(m_hDC, hEnhMetaFile, lpBounds); - } - - BOOL AddMetaFileComment(UINT nDataSize, const BYTE* pCommentData) // can be used for enhanced metafiles only - { - ATLASSERT(m_hDC != NULL); - return ::GdiComment(m_hDC, nDataSize, pCommentData); - } - - // Special handling for metafile playback - static int CALLBACK EnumMetaFileProc(HDC hDC, HANDLETABLE* pHandleTable, METARECORD* pMetaRec, int nHandles, LPARAM lParam) - { - CDCHandle* pDC = (CDCHandle*)lParam; - - switch (pMetaRec->rdFunction) - { - case META_SETMAPMODE: - pDC->SetMapMode((int)(short)pMetaRec->rdParm[0]); - break; - case META_SETWINDOWEXT: - pDC->SetWindowExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SETWINDOWORG: - pDC->SetWindowOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SETVIEWPORTEXT: - pDC->SetViewportExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SETVIEWPORTORG: - pDC->SetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SCALEWINDOWEXT: - pDC->ScaleWindowExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], - (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SCALEVIEWPORTEXT: - pDC->ScaleViewportExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], - (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_OFFSETVIEWPORTORG: - pDC->OffsetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SAVEDC: - pDC->SaveDC(); - break; - case META_RESTOREDC: - pDC->RestoreDC((int)(short)pMetaRec->rdParm[0]); - break; - case META_SETBKCOLOR: - pDC->SetBkColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); - break; - case META_SETTEXTCOLOR: - pDC->SetTextColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); - break; - - // need to watch out for SelectObject(HFONT), for custom font mapping - case META_SELECTOBJECT: - { - HGDIOBJ hObject = pHandleTable->objectHandle[pMetaRec->rdParm[0]]; - UINT nObjType = ::GetObjectType(hObject); - if(nObjType == 0) - { - // object type is unknown, determine if it is a font - HFONT hStockFont = (HFONT)::GetStockObject(SYSTEM_FONT); - HFONT hFontOld = (HFONT)::SelectObject(pDC->m_hDC, hStockFont); - HGDIOBJ hObjOld = ::SelectObject(pDC->m_hDC, hObject); - if(hObjOld == hStockFont) - { - // got the stock object back, so must be selecting a font - pDC->SelectFont((HFONT)hObject); - break; // don't play the default record - } - else - { - // didn't get the stock object back, so restore everything - ::SelectObject(pDC->m_hDC, hFontOld); - ::SelectObject(pDC->m_hDC, hObjOld); - } - // and fall through to PlayMetaFileRecord... - } - else if(nObjType == OBJ_FONT) - { - // play back as CDCHandle::SelectFont(HFONT) - pDC->SelectFont((HFONT)hObject); - break; // don't play the default record - } - } - // fall through... - - default: - ::PlayMetaFileRecord(hDC, pHandleTable, pMetaRec, nHandles); - break; - } - - return 1; - } -#endif // !_WIN32_WCE - -// Path Functions -#ifndef _WIN32_WCE - BOOL AbortPath() - { - ATLASSERT(m_hDC != NULL); - return ::AbortPath(m_hDC); - } - - BOOL BeginPath() - { - ATLASSERT(m_hDC != NULL); - return ::BeginPath(m_hDC); - } - - BOOL CloseFigure() - { - ATLASSERT(m_hDC != NULL); - return ::CloseFigure(m_hDC); - } - - BOOL EndPath() - { - ATLASSERT(m_hDC != NULL); - return ::EndPath(m_hDC); - } - - BOOL FillPath() - { - ATLASSERT(m_hDC != NULL); - return ::FillPath(m_hDC); - } - - BOOL FlattenPath() - { - ATLASSERT(m_hDC != NULL); - return ::FlattenPath(m_hDC); - } - - BOOL StrokeAndFillPath() - { - ATLASSERT(m_hDC != NULL); - return ::StrokeAndFillPath(m_hDC); - } - - BOOL StrokePath() - { - ATLASSERT(m_hDC != NULL); - return ::StrokePath(m_hDC); - } - - BOOL WidenPath() - { - ATLASSERT(m_hDC != NULL); - return ::WidenPath(m_hDC); - } - - BOOL GetMiterLimit(PFLOAT pfMiterLimit) const - { - ATLASSERT(m_hDC != NULL); - return ::GetMiterLimit(m_hDC, pfMiterLimit); - } - - BOOL SetMiterLimit(float fMiterLimit) - { - ATLASSERT(m_hDC != NULL); - return ::SetMiterLimit(m_hDC, fMiterLimit, NULL); - } - - int GetPath(LPPOINT lpPoints, LPBYTE lpTypes, int nCount) const - { - ATLASSERT(m_hDC != NULL); - return ::GetPath(m_hDC, lpPoints, lpTypes, nCount); - } - - BOOL SelectClipPath(int nMode) - { - ATLASSERT(m_hDC != NULL); - return ::SelectClipPath(m_hDC, nMode); - } -#endif // !_WIN32_WCE - -// Misc Helper Functions - static CBrushHandle PASCAL GetHalftoneBrush() - { - HBRUSH halftoneBrush = NULL; - WORD grayPattern[8]; - for(int i = 0; i < 8; i++) - grayPattern[i] = (WORD)(0x5555 << (i & 1)); - HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern); - if(grayBitmap != NULL) - { - halftoneBrush = ::CreatePatternBrush(grayBitmap); - DeleteObject(grayBitmap); - } - return CBrushHandle(halftoneBrush); - } - - void DrawDragRect(LPCRECT lpRect, SIZE size, LPCRECT lpRectLast, SIZE sizeLast, HBRUSH hBrush = NULL, HBRUSH hBrushLast = NULL) - { - // first, determine the update region and select it - CRgn rgnOutside; - rgnOutside.CreateRectRgnIndirect(lpRect); - RECT rect = *lpRect; - ::InflateRect(&rect, -size.cx, -size.cy); - ::IntersectRect(&rect, &rect, lpRect); - CRgn rgnInside; - rgnInside.CreateRectRgnIndirect(&rect); - CRgn rgnNew; - rgnNew.CreateRectRgn(0, 0, 0, 0); - rgnNew.CombineRgn(rgnOutside, rgnInside, RGN_XOR); - - HBRUSH hBrushOld = NULL; - CBrush brushHalftone; - if(hBrush == NULL) - brushHalftone = hBrush = CDCHandle::GetHalftoneBrush(); - if(hBrushLast == NULL) - hBrushLast = hBrush; - - CRgn rgnLast; - CRgn rgnUpdate; - if(lpRectLast != NULL) - { - // find difference between new region and old region - rgnLast.CreateRectRgn(0, 0, 0, 0); - rgnOutside.SetRectRgn(lpRectLast->left, lpRectLast->top, lpRectLast->right, lpRectLast->bottom); - rect = *lpRectLast; - ::InflateRect(&rect, -sizeLast.cx, -sizeLast.cy); - ::IntersectRect(&rect, &rect, lpRectLast); - rgnInside.SetRectRgn(rect.left, rect.top, rect.right, rect.bottom); - rgnLast.CombineRgn(rgnOutside, rgnInside, RGN_XOR); - - // only diff them if brushes are the same - if(hBrush == hBrushLast) - { - rgnUpdate.CreateRectRgn(0, 0, 0, 0); - rgnUpdate.CombineRgn(rgnLast, rgnNew, RGN_XOR); - } - } - if(hBrush != hBrushLast && lpRectLast != NULL) - { - // brushes are different -- erase old region first - SelectClipRgn(rgnLast); - GetClipBox(&rect); - hBrushOld = SelectBrush(hBrushLast); - PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); - SelectBrush(hBrushOld); - hBrushOld = NULL; - } - - // draw into the update/new region - SelectClipRgn(rgnUpdate.IsNull() ? rgnNew : rgnUpdate); - GetClipBox(&rect); - hBrushOld = SelectBrush(hBrush); - PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); - - // cleanup DC - if(hBrushOld != NULL) - SelectBrush(hBrushOld); - SelectClipRgn(NULL); - } - - void FillSolidRect(LPCRECT lpRect, COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - - COLORREF clrOld = ::SetBkColor(m_hDC, clr); - ATLASSERT(clrOld != CLR_INVALID); - if(clrOld != CLR_INVALID) - { - ::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL); - ::SetBkColor(m_hDC, clrOld); - } - } - - void FillSolidRect(int x, int y, int cx, int cy, COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - - RECT rect = { x, y, x + cx, y + cy }; - FillSolidRect(&rect, clr); - } - - void Draw3dRect(LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight) - { - Draw3dRect(lpRect->left, lpRect->top, lpRect->right - lpRect->left, - lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight); - } - - void Draw3dRect(int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight) - { - FillSolidRect(x, y, cx - 1, 1, clrTopLeft); - FillSolidRect(x, y, 1, cy - 1, clrTopLeft); - FillSolidRect(x + cx, y, -1, cy, clrBottomRight); - FillSolidRect(x, y + cy, cx, -1, clrBottomRight); - } - -// DIB support -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - int SetDIBitsToDevice(int x, int y, DWORD dwWidth, DWORD dwHeight, int xSrc, int ySrc, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) - { - ATLASSERT(m_hDC != NULL); - return ::SetDIBitsToDevice(m_hDC, x, y, dwWidth, dwHeight, xSrc, ySrc, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - int StretchDIBits(int x, int y, int nWidth, int nHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::StretchDIBits(m_hDC, x, y, nWidth, nHeight, xSrc, ySrc, nSrcWidth, nSrcHeight, lpvBits, lpbmi, uColorUse, dwRop); - } - - UINT GetDIBColorTable(UINT uStartIndex, UINT cEntries, RGBQUAD* pColors) const - { - ATLASSERT(m_hDC != NULL); - return ::GetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); - } - - UINT SetDIBColorTable(UINT uStartIndex, UINT cEntries, CONST RGBQUAD* pColors) - { - ATLASSERT(m_hDC != NULL); - return ::SetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - -// OpenGL support -#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - int ChoosePixelFormat(CONST PIXELFORMATDESCRIPTOR* ppfd) - { - ATLASSERT(m_hDC != NULL); - return ::ChoosePixelFormat(m_hDC, ppfd); - } - - int DescribePixelFormat(int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd) - { - ATLASSERT(m_hDC != NULL); - return ::DescribePixelFormat(m_hDC, iPixelFormat, nBytes, ppfd); - } - - int GetPixelFormat() const - { - ATLASSERT(m_hDC != NULL); - return ::GetPixelFormat(m_hDC); - } - - BOOL SetPixelFormat(int iPixelFormat, CONST PIXELFORMATDESCRIPTOR* ppfd) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixelFormat(m_hDC, iPixelFormat, ppfd); - } - - BOOL SwapBuffers() - { - ATLASSERT(m_hDC != NULL); - return ::SwapBuffers(m_hDC); - } - - HGLRC wglCreateContext() - { - ATLASSERT(m_hDC != NULL); - return ::wglCreateContext(m_hDC); - } - - HGLRC wglCreateLayerContext(int iLayerPlane) - { - ATLASSERT(m_hDC != NULL); - return ::wglCreateLayerContext(m_hDC, iLayerPlane); - } - - BOOL wglMakeCurrent(HGLRC hglrc) - { - ATLASSERT(m_hDC != NULL); - return ::wglMakeCurrent(m_hDC, hglrc); - } - - BOOL wglUseFontBitmaps(DWORD dwFirst, DWORD dwCount, DWORD listBase) - { - ATLASSERT(m_hDC != NULL); - return ::wglUseFontBitmaps(m_hDC, dwFirst, dwCount, listBase); - } - - BOOL wglUseFontOutlines(DWORD dwFirst, DWORD dwCount, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf) - { - ATLASSERT(m_hDC != NULL); - return ::wglUseFontOutlines(m_hDC, dwFirst, dwCount, listBase, deviation, extrusion, format, lpgmf); - } - - BOOL wglDescribeLayerPlane(int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd) - { - ATLASSERT(m_hDC != NULL); - return ::wglDescribeLayerPlane(m_hDC, iPixelFormat, iLayerPlane, nBytes, plpd); - } - - int wglSetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, CONST COLORREF* pclr) - { - ATLASSERT(m_hDC != NULL); - return ::wglSetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); - } - - int wglGetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, COLORREF* pclr) - { - ATLASSERT(m_hDC != NULL); - return ::wglGetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); - } - - BOOL wglRealizeLayerPalette(int iLayerPlane, BOOL bRealize) - { - ATLASSERT(m_hDC != NULL); - return ::wglRealizeLayerPalette(m_hDC, iLayerPlane, bRealize); - } - - BOOL wglSwapLayerBuffers(UINT uPlanes) - { - ATLASSERT(m_hDC != NULL); - return ::wglSwapLayerBuffers(m_hDC, uPlanes); - } -#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - -// New for Windows 2000 only -#if (_WIN32_WINNT >= 0x0500) - COLORREF GetDCPenColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetDCPenColor(m_hDC); - } - - COLORREF SetDCPenColor(COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - return ::SetDCPenColor(m_hDC, clr); - } - - COLORREF GetDCBrushColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetDCBrushColor(m_hDC); - } - - COLORREF SetDCBrushColor(COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - return ::SetDCBrushColor(m_hDC, clr); - } - -#ifndef _WIN32_WCE - DWORD GetFontUnicodeRanges(LPGLYPHSET lpgs) const - { - ATLASSERT(m_hDC != NULL); - return ::GetFontUnicodeRanges(m_hDC, lpgs); - } -#endif // !_WIN32_WCE - - DWORD GetGlyphIndices(LPCTSTR lpstr, int cch, LPWORD pgi, DWORD dwFlags) const - { - ATLASSERT(m_hDC != NULL); - return ::GetGlyphIndices(m_hDC, lpstr, cch, pgi, dwFlags); - } - - BOOL GetTextExtentPointI(LPWORD pgiIn, int cgi, LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextExtentPointI(m_hDC, pgiIn, cgi, lpSize); - } - - BOOL GetTextExtentExPointI(LPWORD pgiIn, int cgi, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextExtentExPointI(m_hDC, pgiIn, cgi, nMaxExtent, lpnFit, alpDx, lpSize); - } - - BOOL GetCharWidthI(UINT giFirst, UINT cgi, LPWORD pgi, LPINT lpBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidthI(m_hDC, giFirst, cgi, pgi, lpBuffer); - } - - BOOL GetCharABCWidthsI(UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharABCWidthsI(m_hDC, giFirst, cgi, pgi, lpabc); - } -#endif // (_WIN32_WINNT >= 0x0500) - -// New for Windows 2000 and Windows 98 -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - BOOL ColorCorrectPalette(HPALETTE hPalette, DWORD dwFirstEntry, DWORD dwNumOfEntries) - { - ATLASSERT(m_hDC != NULL); - return ::ColorCorrectPalette(m_hDC, hPalette, dwFirstEntry, dwNumOfEntries); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CDCT CDCHandle; -typedef CDCT CDC; - - -/////////////////////////////////////////////////////////////////////////////// -// CDC Helpers - -class CPaintDC : public CDC -{ -public: -// Data members - HWND m_hWnd; - PAINTSTRUCT m_ps; - -// Constructor/destructor - CPaintDC(HWND hWnd) - { - ATLASSERT(::IsWindow(hWnd)); - m_hWnd = hWnd; - m_hDC = ::BeginPaint(hWnd, &m_ps); - } - - ~CPaintDC() - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(::IsWindow(m_hWnd)); - ::EndPaint(m_hWnd, &m_ps); - Detach(); - } -}; - -class CClientDC : public CDC -{ -public: -// Data members - HWND m_hWnd; - -// Constructor/destructor - CClientDC(HWND hWnd) - { - ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); - m_hWnd = hWnd; - m_hDC = ::GetDC(hWnd); - } - - ~CClientDC() - { - ATLASSERT(m_hDC != NULL); - ::ReleaseDC(m_hWnd, Detach()); - } -}; - -class CWindowDC : public CDC -{ -public: -// Data members - HWND m_hWnd; - -// Constructor/destructor - CWindowDC(HWND hWnd) - { - ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); - m_hWnd = hWnd; - m_hDC = ::GetWindowDC(hWnd); - } - - ~CWindowDC() - { - ATLASSERT(m_hDC != NULL); - ::ReleaseDC(m_hWnd, Detach()); - } -}; - -class CMemoryDC : public CDC -{ -public: -// Data members - HDC m_hDCOriginal; - RECT m_rcPaint; - CBitmap m_bmp; - HBITMAP m_hBmpOld; - -// Constructor/destructor - CMemoryDC(HDC hDC, RECT& rcPaint) : m_hDCOriginal(hDC), m_hBmpOld(NULL) - { - m_rcPaint = rcPaint; - CreateCompatibleDC(m_hDCOriginal); - ATLASSERT(m_hDC != NULL); - m_bmp.CreateCompatibleBitmap(m_hDCOriginal, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top); - ATLASSERT(m_bmp.m_hBitmap != NULL); - m_hBmpOld = SelectBitmap(m_bmp); - SetViewportOrg(-m_rcPaint.left, -m_rcPaint.top); - } - - ~CMemoryDC() - { - ::BitBlt(m_hDCOriginal, m_rcPaint.left, m_rcPaint.top, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top, m_hDC, m_rcPaint.left, m_rcPaint.top, SRCCOPY); - SelectBitmap(m_hBmpOld); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Enhanced metafile support - -#ifndef _WIN32_WCE - -class CEnhMetaFileInfo -{ -public: -// Data members - HENHMETAFILE m_hEMF; - BYTE* m_pBits; - TCHAR* m_pDesc; - ENHMETAHEADER m_header; - PIXELFORMATDESCRIPTOR m_pfd; - -// Constructor/destructor - CEnhMetaFileInfo(HENHMETAFILE hEMF) : m_pBits(NULL), m_pDesc(NULL), m_hEMF(hEMF) - { } - - ~CEnhMetaFileInfo() - { - delete [] m_pBits; - delete [] m_pDesc; - } - -// Operations - BYTE* GetEnhMetaFileBits() - { - ATLASSERT(m_hEMF != NULL); - UINT nBytes = ::GetEnhMetaFileBits(m_hEMF, 0, NULL); - delete [] m_pBits; - m_pBits = NULL; - ATLTRY(m_pBits = new BYTE[nBytes]); - if (m_pBits != NULL) - ::GetEnhMetaFileBits(m_hEMF, nBytes, m_pBits); - return m_pBits; - } - - LPTSTR GetEnhMetaFileDescription() - { - ATLASSERT(m_hEMF != NULL); - UINT nLen = ::GetEnhMetaFileDescription(m_hEMF, 0, NULL); - delete [] m_pDesc; - m_pDesc = NULL; - ATLTRY(m_pDesc = new TCHAR[nLen]); - if (m_pDesc != NULL) - nLen = ::GetEnhMetaFileDescription(m_hEMF, nLen, m_pDesc); - return m_pDesc; - } - - ENHMETAHEADER* GetEnhMetaFileHeader() - { - ATLASSERT(m_hEMF != NULL); - memset(&m_header, 0, sizeof(m_header)); - m_header.iType = EMR_HEADER; - m_header.nSize = sizeof(ENHMETAHEADER); - UINT n = ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), &m_header); - return (n != 0) ? &m_header : NULL; - } - - PIXELFORMATDESCRIPTOR* GetEnhMetaFilePixelFormat() - { - ATLASSERT(m_hEMF != NULL); - memset(&m_pfd, 0, sizeof(m_pfd)); - UINT n = ::GetEnhMetaFilePixelFormat(m_hEMF, sizeof(m_pfd), &m_pfd); - return (n != 0) ? &m_pfd : NULL; - } -}; - - -template -class CEnhMetaFileT -{ -public: -// Data members - HENHMETAFILE m_hEMF; - -// Constructor/destructor - CEnhMetaFileT(HENHMETAFILE hEMF = NULL) : m_hEMF(hEMF) - { - } - - ~CEnhMetaFileT() - { - if(t_bManaged && m_hEMF != NULL) - DeleteObject(); - } - -// Operations - CEnhMetaFileT& operator =(HENHMETAFILE hEMF) - { - Attach(hEMF); - return *this; - } - - void Attach(HENHMETAFILE hEMF) - { - if(t_bManaged && m_hEMF != NULL && m_hEMF != hEMF) - DeleteObject(); - m_hEMF = hEMF; - } - - HENHMETAFILE Detach() - { - HENHMETAFILE hEMF = m_hEMF; - m_hEMF = NULL; - return hEMF; - } - - operator HENHMETAFILE() const { return m_hEMF; } - - bool IsNull() const { return (m_hEMF == NULL); } - - BOOL DeleteObject() - { - ATLASSERT(m_hEMF != NULL); - BOOL bRet = ::DeleteEnhMetaFile(m_hEMF); - m_hEMF = NULL; - return bRet; - } - - UINT GetEnhMetaFileBits(UINT cbBuffer, LPBYTE lpbBuffer) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFileBits(m_hEMF, cbBuffer, lpbBuffer); - } - - UINT GetEnhMetaFileDescription(UINT cchBuffer, LPTSTR lpszDescription) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFileDescription(m_hEMF, cchBuffer, lpszDescription); - } - - UINT GetEnhMetaFileHeader(LPENHMETAHEADER lpemh) const - { - ATLASSERT(m_hEMF != NULL); - lpemh->iType = EMR_HEADER; - lpemh->nSize = sizeof(ENHMETAHEADER); - return ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), lpemh); - } - - UINT GetEnhMetaFilePaletteEntries(UINT cEntries, LPPALETTEENTRY lppe) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFilePaletteEntries(m_hEMF, cEntries, lppe); - } - - UINT GetEnhMetaFilePixelFormat(DWORD cbBuffer, PIXELFORMATDESCRIPTOR* ppfd) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFilePixelFormat(m_hEMF, cbBuffer, ppfd); - } -}; - -typedef CEnhMetaFileT CEnhMetaFileHandle; -typedef CEnhMetaFileT CEnhMetaFile; - - -class CEnhMetaFileDC : public CDC -{ -public: -// Constructor/destructor - CEnhMetaFileDC() - { - } - - CEnhMetaFileDC(HDC hdc, LPCRECT lpRect) - { - Create(hdc, NULL, lpRect, NULL); - ATLASSERT(m_hDC != NULL); - } - - CEnhMetaFileDC(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) - { - Create(hdcRef, lpFilename, lpRect, lpDescription); - ATLASSERT(m_hDC != NULL); - } - - ~CEnhMetaFileDC() - { - HENHMETAFILE hEMF = Close(); - if (hEMF != NULL) - ::DeleteEnhMetaFile(hEMF); - } - -// Operations - void Create(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) - { - ATLASSERT(m_hDC == NULL); - m_hDC = ::CreateEnhMetaFile(hdcRef, lpFilename, lpRect, lpDescription); - } - - HENHMETAFILE Close() - { - HENHMETAFILE hEMF = NULL; - if (m_hDC != NULL) - { - hEMF = ::CloseEnhMetaFile(m_hDC); - m_hDC = NULL; - } - return hEMF; - } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// WinCE compatible clipboard CF_DIB format support functions - -#ifndef _WTL_NO_DIB16 - -#define DIBINFO16_BITFIELDS { 31744, 992, 31 } - -// DIBINFO16 - To avoid color table problems in WinCE we only create this type of Dib -struct DIBINFO16 // a BITMAPINFO with 2 additional color bitfields -{ - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[3]; - - DIBINFO16(SIZE size) - { - BITMAPINFOHEADER bmih = { sizeof(BITMAPINFOHEADER), size.cx, size.cy, - 1, 16, BI_BITFIELDS, 2 * size.cx * size.cy , 0, 0, 3 }; - DWORD dw[3] = DIBINFO16_BITFIELDS ; - - bmiHeader = bmih; - SecureHelper::memcpy_x(bmiColors, sizeof(bmiColors), dw, 3 * sizeof(DWORD)); - } -}; - - -// AtlxxxDibxxx minimal packed DIB implementation and helpers to copy and paste CF_DIB - -inline bool AtlIsDib16(LPBITMAPINFOHEADER pbmih) -{ - return (pbmih->biBitCount == 16) && (pbmih->biCompression == BI_BITFIELDS); -} - -inline int AtlGetDibColorTableSize(LPBITMAPINFOHEADER pbmih) -{ - switch (pbmih->biBitCount) - { - case 2: - case 4: - case 8: - return pbmih->biClrUsed ? pbmih->biClrUsed : 1 << pbmih->biBitCount; - case 24: - break; - case 16: - case 32: - return pbmih->biCompression == BI_BITFIELDS ? 3 : 0; - default: - ATLASSERT(FALSE); // should never come here - } - - return 0; -} - -inline int AtlGetDibNumColors(LPBITMAPINFOHEADER pbmih) -{ - switch (pbmih->biBitCount) - { - case 2: - case 4: - case 8: - if (pbmih->biClrUsed) - return pbmih->biClrUsed; - else - break; - case 16: - if (pbmih->biCompression == BI_BITFIELDS ) - return 1 << 15; - else - break; - case 24: - break; - case 32: - if (pbmih->biCompression == BI_BITFIELDS ) - return 1 << 24; - else - break; - default: - ATLASSERT(FALSE); - } - - return 1 << pbmih->biBitCount; -} - -inline HBITMAP AtlGetDibBitmap(LPBITMAPINFO pbmi) -{ - CDC dc(NULL); - void* pBits = NULL; - - LPBYTE pDibBits = (LPBYTE)pbmi + sizeof(BITMAPINFOHEADER) + AtlGetDibColorTableSize(&pbmi->bmiHeader) * sizeof(RGBQUAD); - HBITMAP hbm = CreateDIBSection(dc, pbmi, DIB_RGB_COLORS, &pBits, NULL, NULL); - if (hbm != NULL) - { - int cbBits = pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biHeight * pbmi->bmiHeader.biBitCount / 8; - SecureHelper::memcpy_x(pBits, cbBits, pDibBits, pbmi->bmiHeader.biSizeImage); - } - - return hbm; -} - -inline HBITMAP AtlCopyBitmap(HBITMAP hbm, SIZE sizeDst, bool bAsBitmap = false) -{ - CDC hdcSrc = CreateCompatibleDC(NULL); - CDC hdcDst = CreateCompatibleDC(NULL); - - CBitmapHandle hbmOld = NULL, hbmOld2 = NULL, bmSrc = hbm; - - CBitmap bmNew = NULL; - - SIZE sizeSrc = { 0 }; - bmSrc.GetSize(sizeSrc); - - hbmOld = hdcSrc.SelectBitmap(bmSrc); - - if (bAsBitmap) - { - bmNew.CreateCompatibleBitmap(hdcSrc, sizeDst.cx, sizeDst.cy); - } - else - { - DIBINFO16 dib16(sizeDst); - LPVOID pBits = NULL; - bmNew = CreateDIBSection(hdcDst, (const BITMAPINFO*)&dib16, DIB_RGB_COLORS, &pBits, NULL, NULL); - } - - ATLASSERT(!bmNew.IsNull()); - - hbmOld2 = hdcDst.SelectBitmap(bmNew); - BOOL bOK = FALSE; - - if ((sizeDst.cx == sizeSrc.cx) && (sizeDst.cy == sizeSrc.cy)) - bOK = hdcDst.BitBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, SRCCOPY); - else - bOK = hdcDst.StretchBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, sizeSrc.cx, sizeSrc.cy, SRCCOPY); - - hdcSrc.SelectBitmap(hbmOld); - hdcDst.SelectBitmap(hbmOld2); - - if (bOK == FALSE) - bmNew.DeleteObject(); - - return bmNew.Detach(); -} - -inline HLOCAL AtlCreatePackedDib16(HBITMAP hbm, SIZE size) -{ - DIBSECTION ds = { 0 }; - LPBYTE pDib = NULL; - bool bCopied = false; - - bool bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); - if ((bOK == FALSE) || (ds.dsBm.bmBits == NULL) || (AtlIsDib16(&ds.dsBmih) == FALSE) || - (ds.dsBmih.biWidth != size.cx ) || (ds.dsBmih.biHeight != size.cy )) - { - if ((hbm = AtlCopyBitmap(hbm, size)) != NULL) - { - bCopied = true; - bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); - } - else - { - bOK = FALSE; - } - } - - if((bOK != FALSE) && (AtlIsDib16(&ds.dsBmih) != FALSE) && (ds.dsBm.bmBits != NULL)) - { - pDib = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, sizeof(DIBINFO16) + ds.dsBmih.biSizeImage); - if (pDib != NULL) - { - SecureHelper::memcpy_x(pDib, sizeof(DIBINFO16) + ds.dsBmih.biSizeImage, &ds.dsBmih, sizeof(DIBINFO16)); - SecureHelper::memcpy_x(pDib + sizeof(DIBINFO16), ds.dsBmih.biSizeImage, ds.dsBm.bmBits, ds.dsBmih.biSizeImage); - } - } - - if (bCopied == true) - DeleteObject(hbm); - - return (HLOCAL)pDib; -} - -inline bool AtlSetClipboardDib16(HBITMAP hbm, SIZE size, HWND hWnd) -{ - ATLASSERT(::IsWindow(hWnd)); - BOOL bOK = OpenClipboard(hWnd); - if (bOK != FALSE) - { - bOK = EmptyClipboard(); - if (bOK != FALSE) - { - HLOCAL hDib = AtlCreatePackedDib16(hbm, size); - if (hDib != NULL) - { - bOK = SetClipboardData(CF_DIB, hDib) != NULL; - if (bOK == FALSE) - LocalFree(hDib); - } - else - { - bOK = FALSE; - } - } - CloseClipboard(); - } - - return (bOK != FALSE); -} - -inline HBITMAP AtlGetClipboardDib(HWND hWnd) -{ - ATLASSERT(::IsWindow(hWnd) != FALSE); - HBITMAP hbm = NULL; - if (OpenClipboard(hWnd) != FALSE) - { - LPBITMAPINFO pbmi = (LPBITMAPINFO)GetClipboardData(CF_DIB); - if (pbmi != NULL) - hbm = AtlGetDibBitmap(pbmi); - CloseClipboard(); - } - - return hbm; -} - -#endif // _WTL_NO_DIB16 - -}; // namespace WTL - -#endif // __ATLGDI_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlmisc.h b/GLideN64/src/GLideNUI-wtl/WTL/atlmisc.h deleted file mode 100644 index 0ee6d75..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlmisc.h +++ /dev/null @@ -1,3746 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLMISC_H__ -#define __ATLMISC_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlmisc.h requires atlapp.h to be included first -#endif - - -#ifdef _ATL_TMP_NO_CSTRING - #define _WTL_NO_CSTRING -#endif - -#if defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) - #error Conflicting options - both _WTL_USE_CSTRING and _WTL_NO_CSTRING are defined -#endif // defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) - -#if !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) - #define _WTL_USE_CSTRING -#endif // !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) - -#ifndef _WTL_NO_CSTRING - #if defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) - #error Cannot use CString floating point formatting with _ATL_MIN_CRT defined - #endif // defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) -#endif // !_WTL_NO_CSTRING - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CSize -// CPoint -// CRect -// CString -// -// CRecentDocumentListBase -// CRecentDocumentList -// CFindFile -// -// Global functions: -// AtlGetStockPen() -// AtlGetStockBrush() -// AtlGetStockFont() -// AtlGetStockPalette() -// -// AtlCompactPath() - - -namespace WTL -{ - -#ifndef _WTL_NO_WTYPES - -// forward declarations -class CSize; -class CPoint; -class CRect; - -/////////////////////////////////////////////////////////////////////////////// -// CSize - Wrapper for Windows SIZE structure. - -class CSize : public SIZE -{ -public: -// Constructors - CSize() - { - cx = 0; - cy = 0; - } - - CSize(int initCX, int initCY) - { - cx = initCX; - cy = initCY; - } - - CSize(SIZE initSize) - { - *(SIZE*)this = initSize; - } - - CSize(POINT initPt) - { - *(POINT*)this = initPt; - } - - CSize(DWORD dwSize) - { - cx = (short)LOWORD(dwSize); - cy = (short)HIWORD(dwSize); - } - -// Operations - BOOL operator ==(SIZE size) const - { - return (cx == size.cx && cy == size.cy); - } - - BOOL operator !=(SIZE size) const - { - return (cx != size.cx || cy != size.cy); - } - - void operator +=(SIZE size) - { - cx += size.cx; - cy += size.cy; - } - - void operator -=(SIZE size) - { - cx -= size.cx; - cy -= size.cy; - } - - void SetSize(int CX, int CY) - { - cx = CX; - cy = CY; - } - -// Operators returning CSize values - CSize operator +(SIZE size) const - { - return CSize(cx + size.cx, cy + size.cy); - } - - CSize operator -(SIZE size) const - { - return CSize(cx - size.cx, cy - size.cy); - } - - CSize operator -() const - { - return CSize(-cx, -cy); - } - -// Operators returning CPoint values - CPoint operator +(POINT point) const; - CPoint operator -(POINT point) const; - -// Operators returning CRect values - CRect operator +(const RECT* lpRect) const; - CRect operator -(const RECT* lpRect) const; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPoint - Wrapper for Windows POINT structure. - -class CPoint : public POINT -{ -public: -// Constructors - CPoint() - { - x = 0; - y = 0; - } - - CPoint(int initX, int initY) - { - x = initX; - y = initY; - } - - CPoint(POINT initPt) - { - *(POINT*)this = initPt; - } - - CPoint(SIZE initSize) - { - *(SIZE*)this = initSize; - } - - CPoint(DWORD dwPoint) - { - x = (short)LOWORD(dwPoint); - y = (short)HIWORD(dwPoint); - } - -// Operations - void Offset(int xOffset, int yOffset) - { - x += xOffset; - y += yOffset; - } - - void Offset(POINT point) - { - x += point.x; - y += point.y; - } - - void Offset(SIZE size) - { - x += size.cx; - y += size.cy; - } - - BOOL operator ==(POINT point) const - { - return (x == point.x && y == point.y); - } - - BOOL operator !=(POINT point) const - { - return (x != point.x || y != point.y); - } - - void operator +=(SIZE size) - { - x += size.cx; - y += size.cy; - } - - void operator -=(SIZE size) - { - x -= size.cx; - y -= size.cy; - } - - void operator +=(POINT point) - { - x += point.x; - y += point.y; - } - - void operator -=(POINT point) - { - x -= point.x; - y -= point.y; - } - - void SetPoint(int X, int Y) - { - x = X; - y = Y; - } - -// Operators returning CPoint values - CPoint operator +(SIZE size) const - { - return CPoint(x + size.cx, y + size.cy); - } - - CPoint operator -(SIZE size) const - { - return CPoint(x - size.cx, y - size.cy); - } - - CPoint operator -() const - { - return CPoint(-x, -y); - } - - CPoint operator +(POINT point) const - { - return CPoint(x + point.x, y + point.y); - } - -// Operators returning CSize values - CSize operator -(POINT point) const - { - return CSize(x - point.x, y - point.y); - } - -// Operators returning CRect values - CRect operator +(const RECT* lpRect) const; - CRect operator -(const RECT* lpRect) const; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CRect - Wrapper for Windows RECT structure. - -class CRect : public RECT -{ -public: -// Constructors - CRect() - { - left = 0; - top = 0; - right = 0; - bottom = 0; - } - - CRect(int l, int t, int r, int b) - { - left = l; - top = t; - right = r; - bottom = b; - } - - CRect(const RECT& srcRect) - { - ::CopyRect(this, &srcRect); - } - - CRect(LPCRECT lpSrcRect) - { - ::CopyRect(this, lpSrcRect); - } - - CRect(POINT point, SIZE size) - { - right = (left = point.x) + size.cx; - bottom = (top = point.y) + size.cy; - } - - CRect(POINT topLeft, POINT bottomRight) - { - left = topLeft.x; - top = topLeft.y; - right = bottomRight.x; - bottom = bottomRight.y; - } - -// Attributes (in addition to RECT members) - int Width() const - { - return right - left; - } - - int Height() const - { - return bottom - top; - } - - CSize Size() const - { - return CSize(right - left, bottom - top); - } - - CPoint& TopLeft() - { - return *((CPoint*)this); - } - - CPoint& BottomRight() - { - return *((CPoint*)this + 1); - } - - const CPoint& TopLeft() const - { - return *((CPoint*)this); - } - - const CPoint& BottomRight() const - { - return *((CPoint*)this + 1); - } - - CPoint CenterPoint() const - { - return CPoint((left + right) / 2, (top + bottom) / 2); - } - - // convert between CRect and LPRECT/LPCRECT (no need for &) - operator LPRECT() - { - return this; - } - - operator LPCRECT() const - { - return this; - } - - BOOL IsRectEmpty() const - { - return ::IsRectEmpty(this); - } - - BOOL IsRectNull() const - { - return (left == 0 && right == 0 && top == 0 && bottom == 0); - } - - BOOL PtInRect(POINT point) const - { - return ::PtInRect(this, point); - } - -// Operations - void SetRect(int x1, int y1, int x2, int y2) - { - ::SetRect(this, x1, y1, x2, y2); - } - - void SetRect(POINT topLeft, POINT bottomRight) - { - ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); - } - - void SetRectEmpty() - { - ::SetRectEmpty(this); - } - - void CopyRect(LPCRECT lpSrcRect) - { - ::CopyRect(this, lpSrcRect); - } - - BOOL EqualRect(LPCRECT lpRect) const - { - return ::EqualRect(this, lpRect); - } - - void InflateRect(int x, int y) - { - ::InflateRect(this, x, y); - } - - void InflateRect(SIZE size) - { - ::InflateRect(this, size.cx, size.cy); - } - - void InflateRect(LPCRECT lpRect) - { - left -= lpRect->left; - top -= lpRect->top; - right += lpRect->right; - bottom += lpRect->bottom; - } - - void InflateRect(int l, int t, int r, int b) - { - left -= l; - top -= t; - right += r; - bottom += b; - } - - void DeflateRect(int x, int y) - { - ::InflateRect(this, -x, -y); - } - - void DeflateRect(SIZE size) - { - ::InflateRect(this, -size.cx, -size.cy); - } - - void DeflateRect(LPCRECT lpRect) - { - left += lpRect->left; - top += lpRect->top; - right -= lpRect->right; - bottom -= lpRect->bottom; - } - - void DeflateRect(int l, int t, int r, int b) - { - left += l; - top += t; - right -= r; - bottom -= b; - } - - void OffsetRect(int x, int y) - { - ::OffsetRect(this, x, y); - } - void OffsetRect(SIZE size) - { - ::OffsetRect(this, size.cx, size.cy); - } - - void OffsetRect(POINT point) - { - ::OffsetRect(this, point.x, point.y); - } - - void NormalizeRect() - { - int nTemp; - if (left > right) - { - nTemp = left; - left = right; - right = nTemp; - } - if (top > bottom) - { - nTemp = top; - top = bottom; - bottom = nTemp; - } - } - - // absolute position of rectangle - void MoveToY(int y) - { - bottom = Height() + y; - top = y; - } - - void MoveToX(int x) - { - right = Width() + x; - left = x; - } - - void MoveToXY(int x, int y) - { - MoveToX(x); - MoveToY(y); - } - - void MoveToXY(POINT pt) - { - MoveToX(pt.x); - MoveToY(pt.y); - } - - // operations that fill '*this' with result - BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2) - { - return ::IntersectRect(this, lpRect1, lpRect2); - } - - BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2) - { - return ::UnionRect(this, lpRect1, lpRect2); - } - - BOOL SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2) - { - return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); - } - -// Additional Operations - void operator =(const RECT& srcRect) - { - ::CopyRect(this, &srcRect); - } - - BOOL operator ==(const RECT& rect) const - { - return ::EqualRect(this, &rect); - } - - BOOL operator !=(const RECT& rect) const - { - return !::EqualRect(this, &rect); - } - - void operator +=(POINT point) - { - ::OffsetRect(this, point.x, point.y); - } - - void operator +=(SIZE size) - { - ::OffsetRect(this, size.cx, size.cy); - } - - void operator +=(LPCRECT lpRect) - { - InflateRect(lpRect); - } - - void operator -=(POINT point) - { - ::OffsetRect(this, -point.x, -point.y); - } - - void operator -=(SIZE size) - { - ::OffsetRect(this, -size.cx, -size.cy); - } - - void operator -=(LPCRECT lpRect) - { - DeflateRect(lpRect); - } - - void operator &=(const RECT& rect) - { - ::IntersectRect(this, this, &rect); - } - - void operator |=(const RECT& rect) - { - ::UnionRect(this, this, &rect); - } - -// Operators returning CRect values - CRect operator +(POINT pt) const - { - CRect rect(*this); - ::OffsetRect(&rect, pt.x, pt.y); - return rect; - } - - CRect operator -(POINT pt) const - { - CRect rect(*this); - ::OffsetRect(&rect, -pt.x, -pt.y); - return rect; - } - - CRect operator +(LPCRECT lpRect) const - { - CRect rect(this); - rect.InflateRect(lpRect); - return rect; - } - - CRect operator +(SIZE size) const - { - CRect rect(*this); - ::OffsetRect(&rect, size.cx, size.cy); - return rect; - } - - CRect operator -(SIZE size) const - { - CRect rect(*this); - ::OffsetRect(&rect, -size.cx, -size.cy); - return rect; - } - - CRect operator -(LPCRECT lpRect) const - { - CRect rect(this); - rect.DeflateRect(lpRect); - return rect; - } - - CRect operator &(const RECT& rect2) const - { - CRect rect; - ::IntersectRect(&rect, this, &rect2); - return rect; - } - - CRect operator |(const RECT& rect2) const - { - CRect rect; - ::UnionRect(&rect, this, &rect2); - return rect; - } - - CRect MulDiv(int nMultiplier, int nDivisor) const - { - return CRect( - ::MulDiv(left, nMultiplier, nDivisor), - ::MulDiv(top, nMultiplier, nDivisor), - ::MulDiv(right, nMultiplier, nDivisor), - ::MulDiv(bottom, nMultiplier, nDivisor)); - } -}; - - -// CSize implementation - -inline CPoint CSize::operator +(POINT point) const -{ return CPoint(cx + point.x, cy + point.y); } - -inline CPoint CSize::operator -(POINT point) const -{ return CPoint(cx - point.x, cy - point.y); } - -inline CRect CSize::operator +(const RECT* lpRect) const -{ return CRect(lpRect) + *this; } - -inline CRect CSize::operator -(const RECT* lpRect) const -{ return CRect(lpRect) - *this; } - - -// CPoint implementation - -inline CRect CPoint::operator +(const RECT* lpRect) const -{ return CRect(lpRect) + *this; } - -inline CRect CPoint::operator -(const RECT* lpRect) const -{ return CRect(lpRect) - *this; } - -#endif // !_WTL_NO_WTYPES - - -// WTL::CSize or ATL::CSize scalar operators - -#if !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) - -template -inline CSize operator *(SIZE s, Num n) -{ - return CSize((int)(s.cx * n), (int)(s.cy * n)); -}; - -template -inline void operator *=(SIZE & s, Num n) -{ - s = s * n; -}; - -template -inline CSize operator /(SIZE s, Num n) -{ - return CSize((int)(s.cx / n), (int)(s.cy / n)); -}; - -template -inline void operator /=(SIZE & s, Num n) -{ - s = s / n; -}; - -#endif // !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) - - -/////////////////////////////////////////////////////////////////////////////// -// CString - String class - -#ifndef _WTL_NO_CSTRING - -struct CStringData -{ - long nRefs; // reference count - int nDataLength; - int nAllocLength; - // TCHAR data[nAllocLength] - - TCHAR* data() - { return (TCHAR*)(this + 1); } -}; - -// Globals - -// For an empty string, m_pchData will point here -// (note: avoids special case of checking for NULL m_pchData) -// empty string data (and locked) -_declspec(selectany) int rgInitData[] = { -1, 0, 0, 0 }; -_declspec(selectany) CStringData* _atltmpDataNil = (CStringData*)&rgInitData; -_declspec(selectany) LPCTSTR _atltmpPchNil = (LPCTSTR)(((BYTE*)&rgInitData) + sizeof(CStringData)); - - -class CString -{ -public: -// Constructors - CString() - { - Init(); - } - - CString(const CString& stringSrc) - { - ATLASSERT(stringSrc.GetData()->nRefs != 0); - if (stringSrc.GetData()->nRefs >= 0) - { - ATLASSERT(stringSrc.GetData() != _atltmpDataNil); - m_pchData = stringSrc.m_pchData; - InterlockedIncrement(&GetData()->nRefs); - } - else - { - Init(); - *this = stringSrc.m_pchData; - } - } - - CString(TCHAR ch, int nRepeat = 1) - { - ATLASSERT(!_istlead(ch)); // can't create a lead byte string - Init(); - if (nRepeat >= 1) - { - if(AllocBuffer(nRepeat)) - { -#ifdef _UNICODE - for (int i = 0; i < nRepeat; i++) - m_pchData[i] = ch; -#else - memset(m_pchData, ch, nRepeat); -#endif - } - } - } - - CString(LPCTSTR lpsz) - { - Init(); - if (lpsz != NULL && HIWORD(lpsz) == NULL) - { - UINT nID = LOWORD((DWORD_PTR)lpsz); - if (!LoadString(nID)) - ATLTRACE2(atlTraceUI, 0, _T("Warning: implicit LoadString(%u) in CString failed\n"), nID); - } - else - { - int nLen = SafeStrlen(lpsz); - if (nLen != 0) - { - if(AllocBuffer(nLen)) - SecureHelper::memcpy_x(m_pchData, (nLen + 1) * sizeof(TCHAR), lpsz, nLen * sizeof(TCHAR)); - } - } - } - -#ifdef _UNICODE - CString(LPCSTR lpsz) - { - Init(); -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; -#else - int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; -#endif - if (nSrcLen != 0) - { - if(AllocBuffer(nSrcLen)) - { - _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); - ReleaseBuffer(); - } - } - } -#else // !_UNICODE - CString(LPCWSTR lpsz) - { - Init(); - int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; - if (nSrcLen != 0) - { - if(AllocBuffer(nSrcLen * 2)) - { - _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); - ReleaseBuffer(); - } - } - } -#endif // !_UNICODE - - CString(LPCTSTR lpch, int nLength) - { - Init(); - if (nLength != 0) - { - if(AllocBuffer(nLength)) - SecureHelper::memcpy_x(m_pchData, (nLength + 1) * sizeof(TCHAR), lpch, nLength * sizeof(TCHAR)); - } - } - -#ifdef _UNICODE - CString(LPCSTR lpsz, int nLength) - { - Init(); - if (nLength != 0) - { - if(AllocBuffer(nLength)) - { - int n = ::MultiByteToWideChar(CP_ACP, 0, lpsz, nLength, m_pchData, nLength + 1); - ReleaseBuffer((n >= 0) ? n : -1); - } - } - } -#else // !_UNICODE - CString(LPCWSTR lpsz, int nLength) - { - Init(); - if (nLength != 0) - { - if(((nLength * 2) > nLength) && AllocBuffer(nLength * 2)) - { - int n = ::WideCharToMultiByte(CP_ACP, 0, lpsz, nLength, m_pchData, (nLength * 2) + 1, NULL, NULL); - ReleaseBuffer((n >= 0) ? n : -1); - } - } - } -#endif // !_UNICODE - - CString(const unsigned char* lpsz) - { - Init(); - *this = (LPCSTR)lpsz; - } - -// Attributes & Operations - int GetLength() const // as an array of characters - { - return GetData()->nDataLength; - } - - BOOL IsEmpty() const - { - return GetData()->nDataLength == 0; - } - - void Empty() // free up the data - { - if (GetData()->nDataLength == 0) - return; - - if (GetData()->nRefs >= 0) - Release(); - else - *this = _T(""); - - ATLASSERT(GetData()->nDataLength == 0); - ATLASSERT(GetData()->nRefs < 0 || GetData()->nAllocLength == 0); - } - - TCHAR GetAt(int nIndex) const // 0 based - { - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - return m_pchData[nIndex]; - } - - TCHAR operator [](int nIndex) const // same as GetAt - { - // same as GetAt - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - return m_pchData[nIndex]; - } - - void SetAt(int nIndex, TCHAR ch) - { - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - - CopyBeforeWrite(); - m_pchData[nIndex] = ch; - } - - operator LPCTSTR() const // as a C string - { - return m_pchData; - } - - // overloaded assignment - CString& operator =(const CString& stringSrc) - { - if (m_pchData != stringSrc.m_pchData) - { - if ((GetData()->nRefs < 0 && GetData() != _atltmpDataNil) || stringSrc.GetData()->nRefs < 0) - { - // actual copy necessary since one of the strings is locked - AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData); - } - else - { - // can just copy references around - Release(); - ATLASSERT(stringSrc.GetData() != _atltmpDataNil); - m_pchData = stringSrc.m_pchData; - InterlockedIncrement(&GetData()->nRefs); - } - } - return *this; - } - - CString& operator =(TCHAR ch) - { - ATLASSERT(!_istlead(ch)); // can't set single lead byte - AssignCopy(1, &ch); - return *this; - } - -#ifdef _UNICODE - CString& operator =(char ch) - { - *this = (TCHAR)ch; - return *this; - } -#endif - - CString& operator =(LPCTSTR lpsz) - { - ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); - AssignCopy(SafeStrlen(lpsz), lpsz); - return *this; - } - -#ifdef _UNICODE - CString& operator =(LPCSTR lpsz) - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; -#else - int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; -#endif - if(AllocBeforeWrite(nSrcLen)) - { - _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); - ReleaseBuffer(); - } - return *this; - } -#else // !_UNICODE - CString& operator =(LPCWSTR lpsz) - { - int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; - if(AllocBeforeWrite(nSrcLen * 2)) - { - _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); - ReleaseBuffer(); - } - return *this; - } -#endif // !_UNICODE - - CString& operator =(const unsigned char* lpsz) - { - *this = (LPCSTR)lpsz; - return *this; - } - - // string concatenation - CString& operator +=(const CString& string) - { - ConcatInPlace(string.GetData()->nDataLength, string.m_pchData); - return *this; - } - - CString& operator +=(TCHAR ch) - { - ConcatInPlace(1, &ch); - return *this; - } - -#ifdef _UNICODE - CString& operator +=(char ch) - { - *this += (TCHAR)ch; - return *this; - } -#endif - - CString& operator +=(LPCTSTR lpsz) - { - ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); - ConcatInPlace(SafeStrlen(lpsz), lpsz); - return *this; - } - - friend CString __stdcall operator +(const CString& string1, const CString& string2); - friend CString __stdcall operator +(const CString& string, TCHAR ch); - friend CString __stdcall operator +(TCHAR ch, const CString& string); -#ifdef _UNICODE - friend CString __stdcall operator +(const CString& string, char ch); - friend CString __stdcall operator +(char ch, const CString& string); -#endif - friend CString __stdcall operator +(const CString& string, LPCTSTR lpsz); - friend CString __stdcall operator +(LPCTSTR lpsz, const CString& string); - - // string comparison - int Compare(LPCTSTR lpsz) const // straight character (MBCS/Unicode aware) - { - return _cstrcmp(m_pchData, lpsz); - } - - int CompareNoCase(LPCTSTR lpsz) const // ignore case (MBCS/Unicode aware) - { - return _cstrcmpi(m_pchData, lpsz); - } - -#ifndef _WIN32_WCE - // CString::Collate is often slower than Compare but is MBSC/Unicode - // aware as well as locale-sensitive with respect to sort order. - int Collate(LPCTSTR lpsz) const // NLS aware - { - return _cstrcoll(m_pchData, lpsz); - } - - int CollateNoCase(LPCTSTR lpsz) const // ignore case - { - return _cstrcolli(m_pchData, lpsz); - } -#endif // !_WIN32_WCE - - // simple sub-string extraction - CString Mid(int nFirst, int nCount) const - { - // out-of-bounds requests return sensible things - if (nFirst < 0) - nFirst = 0; - if (nCount < 0) - nCount = 0; - - if (nFirst + nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength - nFirst; - if (nFirst > GetData()->nDataLength) - nCount = 0; - - CString dest; - AllocCopy(dest, nCount, nFirst, 0); - return dest; - } - - CString Mid(int nFirst) const - { - return Mid(nFirst, GetData()->nDataLength - nFirst); - } - - CString Left(int nCount) const - { - if (nCount < 0) - nCount = 0; - else if (nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength; - - CString dest; - AllocCopy(dest, nCount, 0, 0); - return dest; - } - - CString Right(int nCount) const - { - if (nCount < 0) - nCount = 0; - else if (nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength; - - CString dest; - AllocCopy(dest, nCount, GetData()->nDataLength-nCount, 0); - return dest; - } - - CString SpanIncluding(LPCTSTR lpszCharSet) const // strspn equivalent - { - ATLASSERT(_IsValidString(lpszCharSet)); - return Left(_cstrspn(m_pchData, lpszCharSet)); - } - - CString SpanExcluding(LPCTSTR lpszCharSet) const // strcspn equivalent - { - ATLASSERT(_IsValidString(lpszCharSet)); - return Left(_cstrcspn(m_pchData, lpszCharSet)); - } - - // upper/lower/reverse conversion - void MakeUpper() - { - CopyBeforeWrite(); - CharUpper(m_pchData); - } - - void MakeLower() - { - CopyBeforeWrite(); - CharLower(m_pchData); - } - - void MakeReverse() - { - CopyBeforeWrite(); - _cstrrev(m_pchData); - } - - // trimming whitespace (either side) - void TrimRight() - { - CopyBeforeWrite(); - - // find beginning of trailing spaces by starting at beginning (DBCS aware) - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - while (*lpsz != _T('\0')) - { - if (_cstrisspace(*lpsz)) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - lpsz = ::CharNext(lpsz); - } - - if (lpszLast != NULL) - { - // truncate at trailing space start - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - void TrimLeft() - { - CopyBeforeWrite(); - - // find first non-space character - LPCTSTR lpsz = m_pchData; - while (_cstrisspace(*lpsz)) - lpsz = ::CharNext(lpsz); - - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - - // remove continuous occurrences of chTarget starting from right - void TrimRight(TCHAR chTarget) - { - // find beginning of trailing matches - // by starting at beginning (DBCS aware) - - CopyBeforeWrite(); - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - - while (*lpsz != _T('\0')) - { - if (*lpsz == chTarget) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - lpszLast = NULL; - lpsz = ::CharNext(lpsz); - } - - if (lpszLast != NULL) - { - // truncate at left-most matching character - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - // remove continuous occcurrences of characters in passed string, starting from right - void TrimRight(LPCTSTR lpszTargetList) - { - // find beginning of trailing matches by starting at beginning (DBCS aware) - - CopyBeforeWrite(); - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - - while (*lpsz != _T('\0')) - { - TCHAR* pNext = ::CharNext(lpsz); - if(pNext > lpsz + 1) - { - if (_cstrchr_db(lpszTargetList, *lpsz, *(lpsz + 1)) != NULL) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - } - else - { - if (_cstrchr(lpszTargetList, *lpsz) != NULL) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - } - - lpsz = pNext; - } - - if (lpszLast != NULL) - { - // truncate at left-most matching character - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - // remove continuous occurrences of chTarget starting from left - void TrimLeft(TCHAR chTarget) - { - // find first non-matching character - - CopyBeforeWrite(); - LPCTSTR lpsz = m_pchData; - - while (chTarget == *lpsz) - lpsz = ::CharNext(lpsz); - - if (lpsz != m_pchData) - { - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - } - - // remove continuous occcurrences of characters in passed string, starting from left - void TrimLeft(LPCTSTR lpszTargets) - { - // if we're not trimming anything, we're not doing any work - if (SafeStrlen(lpszTargets) == 0) - return; - - CopyBeforeWrite(); - LPCTSTR lpsz = m_pchData; - - while (*lpsz != _T('\0')) - { - TCHAR* pNext = ::CharNext(lpsz); - if(pNext > lpsz + 1) - { - if (_cstrchr_db(lpszTargets, *lpsz, *(lpsz + 1)) == NULL) - break; - } - else - { - if (_cstrchr(lpszTargets, *lpsz) == NULL) - break; - } - lpsz = pNext; - } - - if (lpsz != m_pchData) - { - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - } - - // advanced manipulation - // replace occurrences of chOld with chNew - int Replace(TCHAR chOld, TCHAR chNew) - { - int nCount = 0; - - // short-circuit the nop case - if (chOld != chNew) - { - // otherwise modify each character that matches in the string - CopyBeforeWrite(); - LPTSTR psz = m_pchData; - LPTSTR pszEnd = psz + GetData()->nDataLength; - while (psz < pszEnd) - { - // replace instances of the specified character only - if (*psz == chOld) - { - *psz = chNew; - nCount++; - } - psz = ::CharNext(psz); - } - } - return nCount; - } - - // replace occurrences of substring lpszOld with lpszNew; - // empty lpszNew removes instances of lpszOld - int Replace(LPCTSTR lpszOld, LPCTSTR lpszNew) - { - // can't have empty or NULL lpszOld - - int nSourceLen = SafeStrlen(lpszOld); - if (nSourceLen == 0) - return 0; - int nReplacementLen = SafeStrlen(lpszNew); - - // loop once to figure out the size of the result string - int nCount = 0; - LPTSTR lpszStart = m_pchData; - LPTSTR lpszEnd = m_pchData + GetData()->nDataLength; - LPTSTR lpszTarget = NULL; - while (lpszStart < lpszEnd) - { - while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) - { - nCount++; - lpszStart = lpszTarget + nSourceLen; - } - lpszStart += lstrlen(lpszStart) + 1; - } - - // if any changes were made, make them - if (nCount > 0) - { - CopyBeforeWrite(); - - // if the buffer is too small, just allocate a new buffer (slow but sure) - int nOldLength = GetData()->nDataLength; - int nNewLength = nOldLength + (nReplacementLen - nSourceLen) * nCount; - if (GetData()->nAllocLength < nNewLength || GetData()->nRefs > 1) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, pOldData->nDataLength * sizeof(TCHAR)); - CString::Release(pOldData); - } - // else, we just do it in-place - lpszStart = m_pchData; - lpszEnd = m_pchData + GetData()->nDataLength; - - // loop again to actually do the work - while (lpszStart < lpszEnd) - { - while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) - { - int nBalance = nOldLength - ((int)(DWORD_PTR)(lpszTarget - m_pchData) + nSourceLen); - int cchBuffLen = GetData()->nAllocLength - (int)(DWORD_PTR)(lpszTarget - m_pchData); - SecureHelper::memmove_x(lpszTarget + nReplacementLen, (cchBuffLen - nReplacementLen + 1) * sizeof(TCHAR), lpszTarget + nSourceLen, nBalance * sizeof(TCHAR)); - SecureHelper::memcpy_x(lpszTarget, (cchBuffLen + 1) * sizeof(TCHAR), lpszNew, nReplacementLen * sizeof(TCHAR)); - lpszStart = lpszTarget + nReplacementLen; - lpszStart[nBalance] = _T('\0'); - nOldLength += (nReplacementLen - nSourceLen); - } - lpszStart += lstrlen(lpszStart) + 1; - } - ATLASSERT(m_pchData[nNewLength] == _T('\0')); - GetData()->nDataLength = nNewLength; - } - - return nCount; - } - - // remove occurrences of chRemove - int Remove(TCHAR chRemove) - { - CopyBeforeWrite(); - - LPTSTR pstrSource = m_pchData; - LPTSTR pstrDest = m_pchData; - LPTSTR pstrEnd = m_pchData + GetData()->nDataLength; - - while (pstrSource < pstrEnd) - { - if (*pstrSource != chRemove) - { - *pstrDest = *pstrSource; - pstrDest = ::CharNext(pstrDest); - } - pstrSource = ::CharNext(pstrSource); - } - *pstrDest = _T('\0'); - int nCount = (int)(DWORD_PTR)(pstrSource - pstrDest); - GetData()->nDataLength -= nCount; - - return nCount; - } - - // insert character at zero-based index; concatenates if index is past end of string - int Insert(int nIndex, TCHAR ch) - { - CopyBeforeWrite(); - - if (nIndex < 0) - nIndex = 0; - - int nNewLength = GetData()->nDataLength; - if (nIndex > nNewLength) - nIndex = nNewLength; - nNewLength++; - - if (GetData()->nAllocLength < nNewLength) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); - CString::Release(pOldData); - } - - // move existing bytes down - SecureHelper::memmove_x(m_pchData + nIndex + 1, (GetData()->nAllocLength - nIndex) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex) * sizeof(TCHAR)); - m_pchData[nIndex] = ch; - GetData()->nDataLength = nNewLength; - - return nNewLength; - } - - // insert substring at zero-based index; concatenates if index is past end of string - int Insert(int nIndex, LPCTSTR pstr) - { - if (nIndex < 0) - nIndex = 0; - - int nInsertLength = SafeStrlen(pstr); - int nNewLength = GetData()->nDataLength; - if (nInsertLength > 0) - { - CopyBeforeWrite(); - if (nIndex > nNewLength) - nIndex = nNewLength; - nNewLength += nInsertLength; - - if (GetData()->nAllocLength < nNewLength) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); - CString::Release(pOldData); - } - - // move existing bytes down - SecureHelper::memmove_x(m_pchData + nIndex + nInsertLength, (GetData()->nAllocLength + 1 - nIndex - nInsertLength) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex - nInsertLength + 1) * sizeof(TCHAR)); - SecureHelper::memcpy_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), pstr, nInsertLength * sizeof(TCHAR)); - GetData()->nDataLength = nNewLength; - } - - return nNewLength; - } - - // delete nCount characters starting at zero-based index - int Delete(int nIndex, int nCount = 1) - { - if (nIndex < 0) - nIndex = 0; - int nLength = GetData()->nDataLength; - if (nCount > 0 && nIndex < nLength) - { - if((nIndex + nCount) > nLength) - nCount = nLength - nIndex; - CopyBeforeWrite(); - int nBytesToCopy = nLength - (nIndex + nCount) + 1; - - SecureHelper::memmove_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), m_pchData + nIndex + nCount, nBytesToCopy * sizeof(TCHAR)); - nLength -= nCount; - GetData()->nDataLength = nLength; - } - - return nLength; - } - - // searching (return starting index, or -1 if not found) - // look for a single character match - int Find(TCHAR ch) const // like "C" strchr - { - return Find(ch, 0); - } - - int ReverseFind(TCHAR ch) const - { - // find last single character - LPCTSTR lpsz = _cstrrchr(m_pchData, (_TUCHAR)ch); - - // return -1 if not found, distance from beginning otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - int Find(TCHAR ch, int nStart) const // starting at index - { - int nLength = GetData()->nDataLength; - if (nStart < 0 || nStart >= nLength) - return -1; - - // find first single character - LPCTSTR lpsz = _cstrchr(m_pchData + nStart, (_TUCHAR)ch); - - // return -1 if not found and index otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - int FindOneOf(LPCTSTR lpszCharSet) const - { - ATLASSERT(_IsValidString(lpszCharSet)); - LPCTSTR lpsz = _cstrpbrk(m_pchData, lpszCharSet); - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - // look for a specific sub-string - // find a sub-string (like strstr) - int Find(LPCTSTR lpszSub) const // like "C" strstr - { - return Find(lpszSub, 0); - } - - int Find(LPCTSTR lpszSub, int nStart) const // starting at index - { - ATLASSERT(_IsValidString(lpszSub)); - - int nLength = GetData()->nDataLength; - if (nStart < 0 || nStart > nLength) - return -1; - - // find first matching substring - LPCTSTR lpsz = _cstrstr(m_pchData + nStart, lpszSub); - - // return -1 for not found, distance from beginning otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - // Concatentation for non strings - CString& Append(int n) - { - const int cchBuff = 12; - TCHAR szBuffer[cchBuff] = { 0 }; - SecureHelper::wsprintf_x(szBuffer, cchBuff, _T("%d"), n); - ConcatInPlace(SafeStrlen(szBuffer), szBuffer); - return *this; - } - - // simple formatting - // formatting (using wsprintf style formatting) - BOOL __cdecl Format(LPCTSTR lpszFormat, ...) - { - ATLASSERT(_IsValidString(lpszFormat)); - - va_list argList; - va_start(argList, lpszFormat); - BOOL bRet = FormatV(lpszFormat, argList); - va_end(argList); - return bRet; - } - - BOOL __cdecl Format(UINT nFormatID, ...) - { - CString strFormat; - BOOL bRet = strFormat.LoadString(nFormatID); - ATLASSERT(bRet != 0); - - va_list argList; - va_start(argList, nFormatID); - bRet = FormatV(strFormat, argList); - va_end(argList); - return bRet; - } - - BOOL FormatV(LPCTSTR lpszFormat, va_list argList) - { - ATLASSERT(_IsValidString(lpszFormat)); - - enum _FormatModifiers - { - FORCE_ANSI = 0x10000, - FORCE_UNICODE = 0x20000, - FORCE_INT64 = 0x40000 - }; - - va_list argListSave = argList; - - // make a guess at the maximum length of the resulting string - int nMaxLen = 0; - for (LPCTSTR lpsz = lpszFormat; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) - { - // handle '%' character, but watch out for '%%' - if (*lpsz != _T('%') || *(lpsz = ::CharNext(lpsz)) == _T('%')) - { - nMaxLen += (int)(::CharNext(lpsz) - lpsz); - continue; - } - - int nItemLen = 0; - - // handle '%' character with format - int nWidth = 0; - for (; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) - { - // check for valid flags - if (*lpsz == _T('#')) - nMaxLen += 2; // for '0x' - else if (*lpsz == _T('*')) - nWidth = va_arg(argList, int); - else if (*lpsz == _T('-') || *lpsz == _T('+') || *lpsz == _T('0') || *lpsz == _T(' ')) - ; - else // hit non-flag character - break; - } - // get width and skip it - if (nWidth == 0) - { - // width indicated by - nWidth = _cstrtoi(lpsz); - for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) - ; - } - ATLASSERT(nWidth >= 0); - - int nPrecision = 0; - if (*lpsz == _T('.')) - { - // skip past '.' separator (width.precision) - lpsz = ::CharNext(lpsz); - - // get precision and skip it - if (*lpsz == _T('*')) - { - nPrecision = va_arg(argList, int); - lpsz = ::CharNext(lpsz); - } - else - { - nPrecision = _cstrtoi(lpsz); - for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) - ; - } - ATLASSERT(nPrecision >= 0); - } - - // should be on type modifier or specifier - int nModifier = 0; - if(lpsz[0] == _T('I') && lpsz[1] == _T('6') && lpsz[2] == _T('4')) - { - lpsz += 3; - nModifier = FORCE_INT64; - } - else - { - switch (*lpsz) - { - // modifiers that affect size - case _T('h'): - nModifier = FORCE_ANSI; - lpsz = ::CharNext(lpsz); - break; - case _T('l'): - nModifier = FORCE_UNICODE; - lpsz = ::CharNext(lpsz); - break; - - // modifiers that do not affect size - case _T('F'): - case _T('N'): - case _T('L'): - lpsz = ::CharNext(lpsz); - break; - } - } - - // now should be on specifier - switch (*lpsz | nModifier) - { - // single characters - case _T('c'): - case _T('C'): - nItemLen = 2; - va_arg(argList, TCHAR); - break; - case _T('c') | FORCE_ANSI: - case _T('C') | FORCE_ANSI: - nItemLen = 2; - va_arg(argList, char); - break; - case _T('c') | FORCE_UNICODE: - case _T('C') | FORCE_UNICODE: - nItemLen = 2; - va_arg(argList, WCHAR); - break; - - // strings - case _T('s'): - { - LPCTSTR pstrNextArg = va_arg(argList, LPCTSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = lstrlen(pstrNextArg); - nItemLen = max(1, nItemLen); - } - break; - } - - case _T('S'): - { -#ifndef _UNICODE - LPWSTR pstrNextArg = va_arg(argList, LPWSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = (int)wcslen(pstrNextArg); - nItemLen = max(1, nItemLen); - } -#else // _UNICODE - LPCSTR pstrNextArg = va_arg(argList, LPCSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - nItemLen = ATL::lstrlenA(pstrNextArg); -#else - nItemLen = lstrlenA(pstrNextArg); -#endif - nItemLen = max(1, nItemLen); - } -#endif // _UNICODE - break; - } - - case _T('s') | FORCE_ANSI: - case _T('S') | FORCE_ANSI: - { - LPCSTR pstrNextArg = va_arg(argList, LPCSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - nItemLen = ATL::lstrlenA(pstrNextArg); -#else - nItemLen = lstrlenA(pstrNextArg); -#endif - nItemLen = max(1, nItemLen); - } - break; - } - - case _T('s') | FORCE_UNICODE: - case _T('S') | FORCE_UNICODE: - { - LPWSTR pstrNextArg = va_arg(argList, LPWSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = (int)wcslen(pstrNextArg); - nItemLen = max(1, nItemLen); - } - break; - } - } - - // adjust nItemLen for strings - if (nItemLen != 0) - { - nItemLen = max(nItemLen, nWidth); - if (nPrecision != 0) - nItemLen = min(nItemLen, nPrecision); - } - else - { - switch (*lpsz) - { - // integers - case _T('d'): - case _T('i'): - case _T('u'): - case _T('x'): - case _T('X'): - case _T('o'): - if (nModifier & FORCE_INT64) - va_arg(argList, __int64); - else - va_arg(argList, int); - nItemLen = 32; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - -#ifndef _ATL_USE_CSTRING_FLOAT - case _T('e'): - case _T('E'): - case _T('f'): - case _T('g'): - case _T('G'): - ATLASSERT(!"Floating point (%%e, %%E, %%f, %%g, and %%G) is not supported by the WTL::CString class."); -#ifndef _DEBUG - ::OutputDebugString(_T("Floating point (%%e, %%f, %%g, and %%G) is not supported by the WTL::CString class.")); -#ifndef _WIN32_WCE - ::DebugBreak(); -#else // CE specific - DebugBreak(); -#endif // _WIN32_WCE -#endif // !_DEBUG - break; -#else // _ATL_USE_CSTRING_FLOAT - case _T('e'): - case _T('E'): - case _T('g'): - case _T('G'): - va_arg(argList, double); - nItemLen = 128; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - case _T('f'): - { - double f = va_arg(argList, double); - // 312 == strlen("-1+(309 zeroes).") - // 309 zeroes == max precision of a double - // 6 == adjustment in case precision is not specified, - // which means that the precision defaults to 6 - int cchLen = max(nWidth, 312 + nPrecision + 6); - CTempBuffer buff; - LPTSTR pszTemp = buff.Allocate(cchLen); - if(pszTemp != NULL) - { - SecureHelper::sprintf_x(pszTemp, cchLen, _T("%*.*f"), nWidth, nPrecision + 6, f); - nItemLen = (int)_tcslen(pszTemp); - } - else - { - nItemLen = cchLen; - } - } - break; -#endif // _ATL_USE_CSTRING_FLOAT - - case _T('p'): - va_arg(argList, void*); - nItemLen = 32; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - - // no output - case _T('n'): - va_arg(argList, int*); - break; - - default: - ATLASSERT(FALSE); // unknown formatting option - } - } - - // adjust nMaxLen for output nItemLen - nMaxLen += nItemLen; - } - - if(GetBuffer(nMaxLen) == NULL) - return FALSE; -#ifndef _ATL_USE_CSTRING_FLOAT - int nRet = SecureHelper::wvsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); -#else // _ATL_USE_CSTRING_FLOAT - int nRet = SecureHelper::vsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); -#endif // _ATL_USE_CSTRING_FLOAT - nRet; // ref - ATLASSERT(nRet <= GetAllocLength()); - ReleaseBuffer(); - - va_end(argListSave); - return TRUE; - } - - // formatting for localization (uses FormatMessage API) - // formatting (using FormatMessage style formatting) - BOOL __cdecl FormatMessage(LPCTSTR lpszFormat, ...) - { - // format message into temporary buffer lpszTemp - va_list argList; - va_start(argList, lpszFormat); - LPTSTR lpszTemp; - BOOL bRet = TRUE; - - if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, - lpszFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) - bRet = FALSE; - - // assign lpszTemp into the resulting string and free the temporary - *this = lpszTemp; - LocalFree(lpszTemp); - va_end(argList); - return bRet; - } - - BOOL __cdecl FormatMessage(UINT nFormatID, ...) - { - // get format string from string table - CString strFormat; - BOOL bRetTmp = strFormat.LoadString(nFormatID); - bRetTmp; // ref - ATLASSERT(bRetTmp != 0); - - // format message into temporary buffer lpszTemp - va_list argList; - va_start(argList, nFormatID); - LPTSTR lpszTemp; - BOOL bRet = TRUE; - - if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, - strFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) - bRet = FALSE; - - // assign lpszTemp into the resulting string and free lpszTemp - *this = lpszTemp; - LocalFree(lpszTemp); - va_end(argList); - return bRet; - } - - // Windows support - BOOL LoadString(UINT nID) // load from string resource (255 chars max.) - { -#ifdef _UNICODE - const int CHAR_FUDGE = 1; // one TCHAR unused is good enough -#else - const int CHAR_FUDGE = 2; // two BYTES unused for case of DBC last char -#endif - - // try fixed buffer first (to avoid wasting space in the heap) - TCHAR szTemp[256]; - int nCount = sizeof(szTemp) / sizeof(szTemp[0]); - int nLen = _LoadString(nID, szTemp, nCount); - if (nCount - nLen > CHAR_FUDGE) - { - *this = szTemp; - return (nLen > 0); - } - - // try buffer size of 512, then larger size until entire string is retrieved - int nSize = 256; - do - { - nSize += 256; - LPTSTR lpstr = GetBuffer(nSize - 1); - if(lpstr == NULL) - { - nLen = 0; - break; - } - nLen = _LoadString(nID, lpstr, nSize); - } while (nSize - nLen <= CHAR_FUDGE); - ReleaseBuffer(); - - return (nLen > 0); - } - -#ifndef _UNICODE - // ANSI <-> OEM support (convert string in place) - void AnsiToOem() - { - CopyBeforeWrite(); - ::AnsiToOem(m_pchData, m_pchData); - } - - void OemToAnsi() - { - CopyBeforeWrite(); - ::OemToAnsi(m_pchData, m_pchData); - } -#endif - -#ifndef _ATL_NO_COM - // OLE BSTR support (use for OLE automation) - BSTR AllocSysString() const - { -#if defined(_UNICODE) || defined(OLE2ANSI) - BSTR bstr = ::SysAllocStringLen(m_pchData, GetData()->nDataLength); -#else - int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, - GetData()->nDataLength, NULL, NULL); - BSTR bstr = ::SysAllocStringLen(NULL, nLen); - if(bstr != NULL) - MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, bstr, nLen); -#endif - return bstr; - } - - BSTR SetSysString(BSTR* pbstr) const - { -#if defined(_UNICODE) || defined(OLE2ANSI) - ::SysReAllocStringLen(pbstr, m_pchData, GetData()->nDataLength); -#else - int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, - GetData()->nDataLength, NULL, NULL); - if(::SysReAllocStringLen(pbstr, NULL, nLen)) - MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, *pbstr, nLen); -#endif - ATLASSERT(*pbstr != NULL); - return *pbstr; - } -#endif // !_ATL_NO_COM - - // Access to string implementation buffer as "C" character array - LPTSTR GetBuffer(int nMinBufLength) - { - ATLASSERT(nMinBufLength >= 0); - - if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength) - { - // we have to grow the buffer - CStringData* pOldData = GetData(); - int nOldLen = GetData()->nDataLength; // AllocBuffer will tromp it - if (nMinBufLength < nOldLen) - nMinBufLength = nOldLen; - - if(!AllocBuffer(nMinBufLength)) - return NULL; - - SecureHelper::memcpy_x(m_pchData, (nMinBufLength + 1) * sizeof(TCHAR), pOldData->data(), (nOldLen + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nOldLen; - CString::Release(pOldData); - } - ATLASSERT(GetData()->nRefs <= 1); - - // return a pointer to the character storage for this string - ATLASSERT(m_pchData != NULL); - return m_pchData; - } - - void ReleaseBuffer(int nNewLength = -1) - { - CopyBeforeWrite(); // just in case GetBuffer was not called - - if (nNewLength == -1) - nNewLength = lstrlen(m_pchData); // zero terminated - - ATLASSERT(nNewLength <= GetData()->nAllocLength); - GetData()->nDataLength = nNewLength; - m_pchData[nNewLength] = _T('\0'); - } - - LPTSTR GetBufferSetLength(int nNewLength) - { - ATLASSERT(nNewLength >= 0); - - if(GetBuffer(nNewLength) == NULL) - return NULL; - - GetData()->nDataLength = nNewLength; - m_pchData[nNewLength] = _T('\0'); - return m_pchData; - } - - void FreeExtra() - { - ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); - if (GetData()->nDataLength != GetData()->nAllocLength) - { - CStringData* pOldData = GetData(); - if(AllocBuffer(GetData()->nDataLength)) - { - SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pOldData->data(), pOldData->nDataLength * sizeof(TCHAR)); - ATLASSERT(m_pchData[GetData()->nDataLength] == _T('\0')); - CString::Release(pOldData); - } - } - ATLASSERT(GetData() != NULL); - } - - // Use LockBuffer/UnlockBuffer to turn refcounting off - LPTSTR LockBuffer() - { - LPTSTR lpsz = GetBuffer(0); - if(lpsz != NULL) - GetData()->nRefs = -1; - return lpsz; - } - - void UnlockBuffer() - { - ATLASSERT(GetData()->nRefs == -1); - if (GetData() != _atltmpDataNil) - GetData()->nRefs = 1; - } - -// Implementation -public: - ~CString() // free any attached data - { - if (GetData() != _atltmpDataNil) - { - if (InterlockedDecrement(&GetData()->nRefs) <= 0) - delete[] (BYTE*)GetData(); - } - } - - int GetAllocLength() const - { - return GetData()->nAllocLength; - } - - static BOOL __stdcall _IsValidString(LPCTSTR lpsz, int /*nLength*/ = -1) - { - return (lpsz != NULL) ? TRUE : FALSE; - } - -protected: - LPTSTR m_pchData; // pointer to ref counted string data - - // implementation helpers - CStringData* GetData() const - { - ATLASSERT(m_pchData != NULL); - return ((CStringData*)m_pchData) - 1; - } - - void Init() - { - m_pchData = _GetEmptyString().m_pchData; - } - - BOOL AllocCopy(CString& dest, int nCopyLen, int nCopyIndex, int nExtraLen) const - { - // will clone the data attached to this string - // allocating 'nExtraLen' characters - // Places results in uninitialized string 'dest' - // Will copy the part or all of original data to start of new string - - BOOL bRet = FALSE; - int nNewLen = nCopyLen + nExtraLen; - if (nNewLen == 0) - { - dest.Init(); - bRet = TRUE; - } - else if(nNewLen >= nCopyLen) - { - if(dest.AllocBuffer(nNewLen)) - { - SecureHelper::memcpy_x(dest.m_pchData, (nNewLen + 1) * sizeof(TCHAR), m_pchData + nCopyIndex, nCopyLen * sizeof(TCHAR)); - bRet = TRUE; - } - } - - return bRet; - } - - // always allocate one extra character for '\0' termination - // assumes [optimistically] that data length will equal allocation length - BOOL AllocBuffer(int nLen) - { - ATLASSERT(nLen >= 0); - ATLASSERT(nLen <= INT_MAX - 1); // max size (enough room for 1 extra) - - if (nLen == 0) - { - Init(); - } - else - { - CStringData* pData = NULL; - ATLTRY(pData = (CStringData*)new BYTE[sizeof(CStringData) + (nLen + 1) * sizeof(TCHAR)]); - if(pData == NULL) - return FALSE; - - pData->nRefs = 1; - pData->data()[nLen] = _T('\0'); - pData->nDataLength = nLen; - pData->nAllocLength = nLen; - m_pchData = pData->data(); - } - - return TRUE; - } - - // Assignment operators - // All assign a new value to the string - // (a) first see if the buffer is big enough - // (b) if enough room, copy on top of old buffer, set size and type - // (c) otherwise free old string data, and create a new one - // - // All routines return the new string (but as a 'const CString&' so that - // assigning it again will cause a copy, eg: s1 = s2 = "hi there". - // - void AssignCopy(int nSrcLen, LPCTSTR lpszSrcData) - { - if(AllocBeforeWrite(nSrcLen)) - { - SecureHelper::memcpy_x(m_pchData, (nSrcLen + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); - GetData()->nDataLength = nSrcLen; - m_pchData[nSrcLen] = _T('\0'); - } - } - - // Concatenation - // NOTE: "operator +" is done as friend functions for simplicity - // There are three variants: - // CString + CString - // and for ? = TCHAR, LPCTSTR - // CString + ? - // ? + CString - BOOL ConcatCopy(int nSrc1Len, LPCTSTR lpszSrc1Data, int nSrc2Len, LPCTSTR lpszSrc2Data) - { - // -- master concatenation routine - // Concatenate two sources - // -- assume that 'this' is a new CString object - - BOOL bRet = TRUE; - int nNewLen = nSrc1Len + nSrc2Len; - if(nNewLen < nSrc1Len || nNewLen < nSrc2Len) - { - bRet = FALSE; - } - else if(nNewLen != 0) - { - bRet = AllocBuffer(nNewLen); - if (bRet) - { - SecureHelper::memcpy_x(m_pchData, (nNewLen + 1) * sizeof(TCHAR), lpszSrc1Data, nSrc1Len * sizeof(TCHAR)); - SecureHelper::memcpy_x(m_pchData + nSrc1Len, (nNewLen + 1 - nSrc1Len) * sizeof(TCHAR), lpszSrc2Data, nSrc2Len * sizeof(TCHAR)); - } - } - return bRet; - } - - void ConcatInPlace(int nSrcLen, LPCTSTR lpszSrcData) - { - // -- the main routine for += operators - - // concatenating an empty string is a no-op! - if (nSrcLen == 0) - return; - - // if the buffer is too small, or we have a width mis-match, just - // allocate a new buffer (slow but sure) - if (GetData()->nRefs > 1 || GetData()->nDataLength + nSrcLen > GetData()->nAllocLength) - { - // we have to grow the buffer, use the ConcatCopy routine - CStringData* pOldData = GetData(); - if (ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData)) - { - ATLASSERT(pOldData != NULL); - CString::Release(pOldData); - } - } - else - { - // fast concatenation when buffer big enough - SecureHelper::memcpy_x(m_pchData + GetData()->nDataLength, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); - GetData()->nDataLength += nSrcLen; - ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); - m_pchData[GetData()->nDataLength] = _T('\0'); - } - } - - void CopyBeforeWrite() - { - if (GetData()->nRefs > 1) - { - CStringData* pData = GetData(); - Release(); - if(AllocBuffer(pData->nDataLength)) - SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pData->data(), (pData->nDataLength + 1) * sizeof(TCHAR)); - } - ATLASSERT(GetData()->nRefs <= 1); - } - - BOOL AllocBeforeWrite(int nLen) - { - BOOL bRet = TRUE; - if (GetData()->nRefs > 1 || nLen > GetData()->nAllocLength) - { - Release(); - bRet = AllocBuffer(nLen); - } - ATLASSERT(GetData()->nRefs <= 1); - return bRet; - } - - void Release() - { - if (GetData() != _atltmpDataNil) - { - ATLASSERT(GetData()->nRefs != 0); - if (InterlockedDecrement(&GetData()->nRefs) <= 0) - delete[] (BYTE*)GetData(); - Init(); - } - } - - static void PASCAL Release(CStringData* pData) - { - if (pData != _atltmpDataNil) - { - ATLASSERT(pData->nRefs != 0); - if (InterlockedDecrement(&pData->nRefs) <= 0) - delete[] (BYTE*)pData; - } - } - - static int PASCAL SafeStrlen(LPCTSTR lpsz) - { - return (lpsz == NULL) ? 0 : lstrlen(lpsz); - } - - static int __stdcall _LoadString(UINT nID, LPTSTR lpszBuf, UINT nMaxBuf) - { -#ifdef _DEBUG - // LoadString without annoying warning from the Debug kernel if the - // segment containing the string is not present - if (::FindResource(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE((nID >> 4) + 1), RT_STRING) == NULL) - { - lpszBuf[0] = _T('\0'); - return 0; // not found - } -#endif // _DEBUG - - int nLen = ::LoadString(ModuleHelper::GetResourceInstance(), nID, lpszBuf, nMaxBuf); - if (nLen == 0) - lpszBuf[0] = _T('\0'); - - return nLen; - } - - static const CString& __stdcall _GetEmptyString() - { - return *(CString*)&_atltmpPchNil; - } - -// CString conversion helpers - static int __cdecl _wcstombsz(char* mbstr, const wchar_t* wcstr, size_t count) - { - if (count == 0 && mbstr != NULL) - return 0; - - int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1, mbstr, (int)count, NULL, NULL); - ATLASSERT(mbstr == NULL || result <= (int)count); - if (result > 0) - mbstr[result - 1] = 0; - return result; - } - - static int __cdecl _mbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count) - { - if (count == 0 && wcstr != NULL) - return 0; - - int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wcstr, (int)count); - ATLASSERT(wcstr == NULL || result <= (int)count); - if (result > 0) - wcstr[result - 1] = 0; - return result; - } - -// Helpers to avoid CRT startup code -#ifdef _ATL_MIN_CRT - static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) - { - // strchr for '\0' should succeed - while (*p != 0) - { - if (*p == ch) - break; - p = ::CharNext(p); - } - return (*p == ch) ? p : NULL; - } - - static TCHAR* _cstrrev(TCHAR* pStr) - { - // optimize NULL, zero-length, and single-char case - if ((pStr == NULL) || (pStr[0] == _T('\0')) || (pStr[1] == _T('\0'))) - return pStr; - - TCHAR* p = pStr; - - while (*p != 0) - { - TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - char p1 = *(char*)p; - *(char*)p = *(char*)(p + 1); - *(char*)(p + 1) = p1; - } - p = pNext; - } - - p--; - TCHAR* q = pStr; - - while (q < p) - { - TCHAR t = *q; - *q = *p; - *p = t; - q++; - p--; - } - return pStr; - } - - static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nLen = lstrlen(pCharSet); - if (nLen == 0) - return (TCHAR*)pStr; - - const TCHAR* pRet = NULL; - const TCHAR* pCur = pStr; - while((pCur = _cstrchr(pCur, *pCharSet)) != NULL) - { - if(memcmp(pCur, pCharSet, nLen * sizeof(TCHAR)) == 0) - { - pRet = pCur; - break; - } - pCur = ::CharNext(pCur); - } - return pRet; - } - - static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nRet = 0; - const TCHAR* p = pStr; - while (*p != 0) - { - const TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - if(_cstrchr_db(pCharSet, *p, *(p + 1)) == NULL) - break; - nRet += 2; - } - else - { - if(_cstrchr(pCharSet, *p) == NULL) - break; - nRet++; - } - p = pNext; - } - return nRet; - } - - static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nRet = 0; - TCHAR* p = (TCHAR*)pStr; - while (*p != 0) - { - TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - if(_cstrchr_db(pCharSet, *p, *(p + 1)) != NULL) - break; - nRet += 2; - } - else - { - if(_cstrchr(pCharSet, *p) != NULL) - break; - nRet++; - } - p = pNext; - } - return nRet; - } - - static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) - { - int n = _cstrcspn(p, lpszCharSet); - return (p[n] != 0) ? &p[n] : NULL; - } - - static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return lstrcmp(pstrOne, pstrOther); - } - - static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return lstrcmpi(pstrOne, pstrOther); - } - - static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - int nRet = CompareString(GetThreadLocale(), 0, pstrOne, -1, pstrOther, -1); - ATLASSERT(nRet != 0); - return nRet - 2; // convert to strcmp convention - } - - static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - int nRet = CompareString(GetThreadLocale(), NORM_IGNORECASE, pstrOne, -1, pstrOther, -1); - ATLASSERT(nRet != 0); - return nRet - 2; // convert to strcmp convention - } -#else // !_ATL_MIN_CRT - static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) - { - return _tcschr(p, ch); - } - - static TCHAR* _cstrrev(TCHAR* pStr) - { - return _tcsrev(pStr); - } - - static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) - { - return _tcsstr(pStr, pCharSet); - } - - static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - return (int)_tcsspn(pStr, pCharSet); - } - - static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - return (int)_tcscspn(pStr, pCharSet); - } - - static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) - { - return _tcspbrk(p, lpszCharSet); - } - - static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcscmp(pstrOne, pstrOther); - } - - static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcsicmp(pstrOne, pstrOther); - } - -#ifndef _WIN32_WCE - static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcscoll(pstrOne, pstrOther); - } - - static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcsicoll(pstrOne, pstrOther); - } -#endif // !_WIN32_WCE -#endif // !_ATL_MIN_CRT - - static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) - { - return MinCrtHelper::_strrchr(p, ch); - } - - static int _cstrisdigit(TCHAR ch) - { - return MinCrtHelper::_isdigit(ch); - } - - static int _cstrisspace(TCHAR ch) - { - return MinCrtHelper::_isspace(ch); - } - - static int _cstrtoi(const TCHAR* nptr) - { - return MinCrtHelper::_atoi(nptr); - } - - static const TCHAR* _cstrchr_db(const TCHAR* p, TCHAR ch1, TCHAR ch2) - { - const TCHAR* lpsz = NULL; - while (*p != 0) - { - if (*p == ch1 && *(p + 1) == ch2) - { - lpsz = p; - break; - } - p = ::CharNext(p); - } - return lpsz; - } -}; - - -// Compare helpers - -inline bool __stdcall operator ==(const CString& s1, const CString& s2) -{ return s1.Compare(s2) == 0; } - -inline bool __stdcall operator ==(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) == 0; } - -inline bool __stdcall operator ==(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) == 0; } - -inline bool __stdcall operator !=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) != 0; } - -inline bool __stdcall operator !=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) != 0; } - -inline bool __stdcall operator !=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) != 0; } - -inline bool __stdcall operator <(const CString& s1, const CString& s2) -{ return s1.Compare(s2) < 0; } - -inline bool __stdcall operator <(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) < 0; } - -inline bool __stdcall operator <(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) > 0; } - -inline bool __stdcall operator >(const CString& s1, const CString& s2) -{ return s1.Compare(s2) > 0; } - -inline bool __stdcall operator >(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) > 0; } - -inline bool __stdcall operator >(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) < 0; } - -inline bool __stdcall operator <=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) <= 0; } - -inline bool __stdcall operator <=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) <= 0; } - -inline bool __stdcall operator <=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) >= 0; } - -inline bool __stdcall operator >=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) >= 0; } - -inline bool __stdcall operator >=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) >= 0; } - -inline bool __stdcall operator >=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) <= 0; } - - -// CString "operator +" functions - -inline CString __stdcall operator +(const CString& string1, const CString& string2) -{ - CString s; - s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData, string2.GetData()->nDataLength, string2.m_pchData); - return s; -} - -inline CString __stdcall operator +(const CString& string, TCHAR ch) -{ - CString s; - s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch); - return s; -} - -inline CString __stdcall operator +(TCHAR ch, const CString& string) -{ - CString s; - s.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData); - return s; -} - -#ifdef _UNICODE -inline CString __stdcall operator +(const CString& string, char ch) -{ - return string + (TCHAR)ch; -} - -inline CString __stdcall operator +(char ch, const CString& string) -{ - return (TCHAR)ch + string; -} -#endif // _UNICODE - -inline CString __stdcall operator +(const CString& string, LPCTSTR lpsz) -{ - ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); - CString s; - s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, CString::SafeStrlen(lpsz), lpsz); - return s; -} - -inline CString __stdcall operator +(LPCTSTR lpsz, const CString& string) -{ - ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); - CString s; - s.ConcatCopy(CString::SafeStrlen(lpsz), lpsz, string.GetData()->nDataLength, string.m_pchData); - return s; -} - -#endif // !_WTL_NO_CSTRING - - -/////////////////////////////////////////////////////////////////////////////// -// CRecentDocumentList - MRU List Support - -#ifndef _WIN32_WCE - -#ifndef _WTL_MRUEMPTY_TEXT - #define _WTL_MRUEMPTY_TEXT _T("(empty)") -#endif - -// forward declaration -inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen); - -template -class CRecentDocumentListBase -{ -public: -// Declarations - struct _DocEntry - { - TCHAR szDocName[t_cchItemLen]; - bool operator ==(const _DocEntry& de) const - { return (lstrcmpi(szDocName, de.szDocName) == 0); } - }; - - enum - { - m_nMaxEntries_Min = 2, - m_nMaxEntries_Max = t_nLastID - t_nFirstID + 1, - m_cchMaxItemLen_Min = 6, - m_cchMaxItemLen_Max = t_cchItemLen, - m_cchItemNameLen = 11 - }; - -// Data members - ATL::CSimpleArray<_DocEntry> m_arrDocs; - int m_nMaxEntries; // default is 4 - HMENU m_hMenu; - - TCHAR m_szNoEntries[t_cchItemLen]; - - int m_cchMaxItemLen; - -// Constructor - CRecentDocumentListBase() : m_hMenu(NULL), m_nMaxEntries(4), m_cchMaxItemLen(-1) - { - // These ASSERTs verify values of the template arguments - ATLASSERT(t_cchItemLen > m_cchMaxItemLen_Min); - ATLASSERT(m_nMaxEntries_Max > m_nMaxEntries_Min); - } - -// Attributes - HMENU GetMenuHandle() const - { - return m_hMenu; - } - - void SetMenuHandle(HMENU hMenu) - { - ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); - m_hMenu = hMenu; - if(m_hMenu == NULL || (::GetMenuString(m_hMenu, t_nFirstID, m_szNoEntries, t_cchItemLen, MF_BYCOMMAND) == 0)) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - SecureHelper::strncpy_x(m_szNoEntries, _countof(m_szNoEntries), pT->GetMRUEmptyText(), _TRUNCATE); - } - } - - int GetMaxEntries() const - { - return m_nMaxEntries; - } - - void SetMaxEntries(int nMaxEntries) - { - ATLASSERT(nMaxEntries >= m_nMaxEntries_Min && nMaxEntries <= m_nMaxEntries_Max); - if(nMaxEntries < m_nMaxEntries_Min) - nMaxEntries = m_nMaxEntries_Min; - else if(nMaxEntries > m_nMaxEntries_Max) - nMaxEntries = m_nMaxEntries_Max; - m_nMaxEntries = nMaxEntries; - } - - int GetMaxItemLength() const - { - return m_cchMaxItemLen; - } - - void SetMaxItemLength(int cchMaxLen) - { - ATLASSERT((cchMaxLen >= m_cchMaxItemLen_Min && cchMaxLen <= m_cchMaxItemLen_Max) || cchMaxLen == -1); - if(cchMaxLen != -1) - { - if(cchMaxLen < m_cchMaxItemLen_Min) - cchMaxLen = m_cchMaxItemLen_Min; - else if(cchMaxLen > m_cchMaxItemLen_Max) - cchMaxLen = m_cchMaxItemLen_Max; - } - m_cchMaxItemLen = cchMaxLen; - T* pT = static_cast(this); - pT->UpdateMenu(); - } - -// Operations - BOOL AddToList(LPCTSTR lpstrDocName) - { - _DocEntry de; - errno_t nRet = SecureHelper::strncpy_x(de.szDocName, _countof(de.szDocName), lpstrDocName, _TRUNCATE); - if(nRet != 0 && nRet != STRUNCATE) - return FALSE; - - for(int i = 0; i < m_arrDocs.GetSize(); i++) - { - if(lstrcmpi(m_arrDocs[i].szDocName, lpstrDocName) == 0) - { - m_arrDocs.RemoveAt(i); - break; - } - } - - if(m_arrDocs.GetSize() == m_nMaxEntries) - m_arrDocs.RemoveAt(0); - - BOOL bRet = m_arrDocs.Add(de); - if(bRet) - { - T* pT = static_cast(this); - bRet = pT->UpdateMenu(); - } - return bRet; - } - - // This function is deprecated because it is not safe. - // Use the version below that accepts the buffer length. -#if (_MSC_VER >= 1300) - __declspec(deprecated) -#endif - BOOL GetFromList(int /*nItemID*/, LPTSTR /*lpstrDocName*/) - { - ATLASSERT(FALSE); - return FALSE; - } - - BOOL GetFromList(int nItemID, LPTSTR lpstrDocName, int cchLength) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) - return FALSE; - if(lstrlen(m_arrDocs[nIndex].szDocName) >= cchLength) - return FALSE; - SecureHelper::strcpy_x(lpstrDocName, cchLength, m_arrDocs[nIndex].szDocName); - - return TRUE; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetFromList(int nItemID, _CSTRING_NS::CString& strDocName) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) - return FALSE; - strDocName = m_arrDocs[nIndex].szDocName; - return TRUE; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL RemoveFromList(int nItemID) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - BOOL bRet = m_arrDocs.RemoveAt(nIndex); - if(bRet) - { - T* pT = static_cast(this); - bRet = pT->UpdateMenu(); - } - return bRet; - } - - BOOL MoveToTop(int nItemID) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) - return FALSE; - _DocEntry de; - de = m_arrDocs[nIndex]; - m_arrDocs.RemoveAt(nIndex); - BOOL bRet = m_arrDocs.Add(de); - if(bRet) - { - T* pT = static_cast(this); - bRet = pT->UpdateMenu(); - } - return bRet; - } - - BOOL ReadFromRegistry(LPCTSTR lpstrRegKey) - { - T* pT = static_cast(this); - CRegKeyEx rkParent; - CRegKeyEx rk; - - LONG lRet = rkParent.Open(HKEY_CURRENT_USER, lpstrRegKey); - if(lRet != ERROR_SUCCESS) - return FALSE; - lRet = rk.Open(rkParent, pT->GetRegKeyName()); - if(lRet != ERROR_SUCCESS) - return FALSE; - - DWORD dwRet = 0; - lRet = rk.QueryDWORDValue(pT->GetRegCountName(), dwRet); - if(lRet != ERROR_SUCCESS) - return FALSE; - SetMaxEntries(dwRet); - - m_arrDocs.RemoveAll(); - - TCHAR szRetString[t_cchItemLen] = { 0 }; - _DocEntry de; - - for(int nItem = m_nMaxEntries; nItem > 0; nItem--) - { - TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); - ULONG ulCount = t_cchItemLen; - lRet = rk.QueryStringValue(szBuff, szRetString, &ulCount); - if(lRet == ERROR_SUCCESS) - { - SecureHelper::strcpy_x(de.szDocName, _countof(de.szDocName), szRetString); - m_arrDocs.Add(de); - } - } - - rk.Close(); - rkParent.Close(); - - return pT->UpdateMenu(); - } - - BOOL WriteToRegistry(LPCTSTR lpstrRegKey) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - CRegKeyEx rkParent; - CRegKeyEx rk; - - LONG lRet = rkParent.Create(HKEY_CURRENT_USER, lpstrRegKey); - if(lRet != ERROR_SUCCESS) - return FALSE; - lRet = rk.Create(rkParent, pT->GetRegKeyName()); - if(lRet != ERROR_SUCCESS) - return FALSE; - - lRet = rk.SetDWORDValue(pT->GetRegCountName(), m_nMaxEntries); - ATLASSERT(lRet == ERROR_SUCCESS); - - // set new values - int nItem; - for(nItem = m_arrDocs.GetSize(); nItem > 0; nItem--) - { - TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); - TCHAR szDocName[t_cchItemLen] = { 0 }; - GetFromList(t_nFirstID + nItem - 1, szDocName, t_cchItemLen); - lRet = rk.SetStringValue(szBuff, szDocName); - ATLASSERT(lRet == ERROR_SUCCESS); - } - - // delete unused keys - for(nItem = m_arrDocs.GetSize() + 1; nItem < m_nMaxEntries_Max; nItem++) - { - TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); - rk.DeleteValue(szBuff); - } - - rk.Close(); - rkParent.Close(); - - return TRUE; - } - -// Implementation - BOOL UpdateMenu() - { - if(m_hMenu == NULL) - return FALSE; - ATLASSERT(::IsMenu(m_hMenu)); - - int nItems = ::GetMenuItemCount(m_hMenu); - int nInsertPoint; - for(nInsertPoint = 0; nInsertPoint < nItems; nInsertPoint++) - { - CMenuItemInfo mi; - mi.fMask = MIIM_ID; - ::GetMenuItemInfo(m_hMenu, nInsertPoint, TRUE, &mi); - if (mi.wID == t_nFirstID) - break; - } - ATLASSERT(nInsertPoint < nItems && "You need a menu item with an ID = t_nFirstID"); - - int nItem; - for(nItem = t_nFirstID; nItem < t_nFirstID + m_nMaxEntries; nItem++) - { - // keep the first one as an insertion point - if (nItem != t_nFirstID) - ::DeleteMenu(m_hMenu, nItem, MF_BYCOMMAND); - } - - TCHAR szItemText[t_cchItemLen + 6] = { 0 }; // add space for &, 2 digits, and a space - int nSize = m_arrDocs.GetSize(); - nItem = 0; - if(nSize > 0) - { - for(nItem = 0; nItem < nSize; nItem++) - { - if(m_cchMaxItemLen == -1) - { - SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, m_arrDocs[nSize - 1 - nItem].szDocName); - } - else - { - TCHAR szBuff[t_cchItemLen] = { 0 }; - T* pT = static_cast(this); - pT; // avoid level 4 warning - bool bRet = pT->CompactDocumentName(szBuff, m_arrDocs[nSize - 1 - nItem].szDocName, m_cchMaxItemLen); - bRet; // avoid level 4 warning - ATLASSERT(bRet); - SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, szBuff); - } - ::InsertMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION | MF_STRING, t_nFirstID + nItem, szItemText); - } - } - else // empty - { - ::InsertMenu(m_hMenu, nInsertPoint, MF_BYPOSITION | MF_STRING, t_nFirstID, m_szNoEntries); - ::EnableMenuItem(m_hMenu, t_nFirstID, MF_GRAYED); - nItem++; - } - ::DeleteMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION); - - return TRUE; - } - -// Overrideables - // override to provide a different method of compacting document names - static bool CompactDocumentName(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) - { - return AtlCompactPath(lpstrOut, lpstrIn, cchLen); - } - - static LPCTSTR GetRegKeyName() - { - return _T("Recent Document List"); - } - - static LPCTSTR GetRegCountName() - { - return _T("DocumentCount"); - } - - static LPCTSTR GetRegItemName() - { - // Note: This string is a format string used with wsprintf(). - // Resulting formatted string must be m_cchItemNameLen or less - // characters long, including the terminating null character. - return _T("Document%i"); - } - - static LPCTSTR GetMRUEmptyText() - { - return _WTL_MRUEMPTY_TEXT; - } -}; - -class CRecentDocumentList : public CRecentDocumentListBase -{ -public: -// nothing here -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFindFile - file search helper class - -class CFindFile -{ -public: -// Data members - WIN32_FIND_DATA m_fd; - TCHAR m_lpszRoot[MAX_PATH]; - TCHAR m_chDirSeparator; - HANDLE m_hFind; - BOOL m_bFound; - -// Constructor/destructor - CFindFile() : m_hFind(NULL), m_chDirSeparator(_T('\\')), m_bFound(FALSE) - { } - - ~CFindFile() - { - Close(); - } - -// Attributes - ULONGLONG GetFileSize() const - { - ATLASSERT(m_hFind != NULL); - - ULARGE_INTEGER nFileSize = { 0 }; - - if(m_bFound) - { - nFileSize.LowPart = m_fd.nFileSizeLow; - nFileSize.HighPart = m_fd.nFileSizeHigh; - } - else - { - nFileSize.QuadPart = 0; - } - - return nFileSize.QuadPart; - } - - BOOL GetFileName(LPTSTR lpstrFileName, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - if(lstrlen(m_fd.cFileName) >= cchLength) - return FALSE; - - if(m_bFound) - SecureHelper::strcpy_x(lpstrFileName, cchLength, m_fd.cFileName); - - return m_bFound; - } - - BOOL GetFilePath(LPTSTR lpstrFilePath, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - - int nLen = lstrlen(m_lpszRoot); -#ifndef _WIN32_WCE - ATLASSERT(nLen > 0); - if(nLen == 0) - return FALSE; - - bool bAddSep = (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/')); -#else // CE specific - // allow diskless devices (nLen == 0) - bool bAddSep = ((nLen == 0) || (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/'))); -#endif // _WIN32_WCE - - if((lstrlen(m_lpszRoot) + (bAddSep ? 1 : 0)) >= cchLength) - return FALSE; - - SecureHelper::strcpy_x(lpstrFilePath, cchLength, m_lpszRoot); - - if(bAddSep) - { - TCHAR szSeparator[2] = { m_chDirSeparator, 0 }; - SecureHelper::strcat_x(lpstrFilePath, cchLength, szSeparator); - } - - SecureHelper::strcat_x(lpstrFilePath, cchLength, m_fd.cFileName); - - return TRUE; - } - -#ifndef _WIN32_WCE - BOOL GetFileTitle(LPTSTR lpstrFileTitle, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - - TCHAR szBuff[MAX_PATH] = { 0 }; - if(!GetFileName(szBuff, MAX_PATH)) - return FALSE; - - if(lstrlen(szBuff) >= cchLength || cchLength < 1) - return FALSE; - - // find the last dot - LPTSTR pstrDot = MinCrtHelper::_strrchr(szBuff, _T('.')); - if(pstrDot != NULL) - *pstrDot = 0; - - SecureHelper::strcpy_x(lpstrFileTitle, cchLength, szBuff); - - return TRUE; - } -#endif // !_WIN32_WCE - - BOOL GetFileURL(LPTSTR lpstrFileURL, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - - TCHAR szBuff[MAX_PATH] = { 0 }; - if(!GetFilePath(szBuff, MAX_PATH)) - return FALSE; - LPCTSTR lpstrFileURLPrefix = _T("file://"); - if(lstrlen(szBuff) + lstrlen(lpstrFileURLPrefix) >= cchLength) - return FALSE; - SecureHelper::strcpy_x(lpstrFileURL, cchLength, lpstrFileURLPrefix); - SecureHelper::strcat_x(lpstrFileURL, cchLength, szBuff); - - return TRUE; - } - - BOOL GetRoot(LPTSTR lpstrRoot, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - if(lstrlen(m_lpszRoot) >= cchLength) - return FALSE; - - SecureHelper::strcpy_x(lpstrRoot, cchLength, m_lpszRoot); - - return TRUE; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - _CSTRING_NS::CString GetFileName() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString ret; - - if(m_bFound) - ret = m_fd.cFileName; - return ret; - } - - _CSTRING_NS::CString GetFilePath() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString strResult = m_lpszRoot; - int nLen = strResult.GetLength(); -#ifndef _WIN32_WCE - ATLASSERT(nLen > 0); - if(nLen == 0) - return strResult; - - if((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/'))) -#else // CE specific - // allow diskless devices (nLen == 0) - if((nLen == 0) || ((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/')))) -#endif // _WIN32_WCE - strResult += m_chDirSeparator; - strResult += GetFileName(); - return strResult; - } - -#ifndef _WIN32_WCE - _CSTRING_NS::CString GetFileTitle() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString strResult; - GetFileTitle(strResult.GetBuffer(MAX_PATH), MAX_PATH); - strResult.ReleaseBuffer(); - - return strResult; - } -#endif // !_WIN32_WCE - - _CSTRING_NS::CString GetFileURL() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString strResult("file://"); - strResult += GetFilePath(); - return strResult; - } - - _CSTRING_NS::CString GetRoot() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString str = m_lpszRoot; - return str; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL GetLastWriteTime(FILETIME* pTimeStamp) const - { - ATLASSERT(m_hFind != NULL); - ATLASSERT(pTimeStamp != NULL); - - if(m_bFound && pTimeStamp != NULL) - { - *pTimeStamp = m_fd.ftLastWriteTime; - return TRUE; - } - - return FALSE; - } - - BOOL GetLastAccessTime(FILETIME* pTimeStamp) const - { - ATLASSERT(m_hFind != NULL); - ATLASSERT(pTimeStamp != NULL); - - if(m_bFound && pTimeStamp != NULL) - { - *pTimeStamp = m_fd.ftLastAccessTime; - return TRUE; - } - - return FALSE; - } - - BOOL GetCreationTime(FILETIME* pTimeStamp) const - { - ATLASSERT(m_hFind != NULL); - - if(m_bFound && pTimeStamp != NULL) - { - *pTimeStamp = m_fd.ftCreationTime; - return TRUE; - } - - return FALSE; - } - - BOOL MatchesMask(DWORD dwMask) const - { - ATLASSERT(m_hFind != NULL); - - if(m_bFound) - return ((m_fd.dwFileAttributes & dwMask) != 0); - - return FALSE; - } - - BOOL IsDots() const - { - ATLASSERT(m_hFind != NULL); - - // return TRUE if the file name is "." or ".." and - // the file is a directory - - BOOL bResult = FALSE; - if(m_bFound && IsDirectory()) - { - if(m_fd.cFileName[0] == _T('.') && (m_fd.cFileName[1] == _T('\0') || (m_fd.cFileName[1] == _T('.') && m_fd.cFileName[2] == _T('\0')))) - bResult = TRUE; - } - - return bResult; - } - - BOOL IsReadOnly() const - { - return MatchesMask(FILE_ATTRIBUTE_READONLY); - } - - BOOL IsDirectory() const - { - return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); - } - - BOOL IsCompressed() const - { - return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); - } - - BOOL IsSystem() const - { - return MatchesMask(FILE_ATTRIBUTE_SYSTEM); - } - - BOOL IsHidden() const - { - return MatchesMask(FILE_ATTRIBUTE_HIDDEN); - } - - BOOL IsTemporary() const - { - return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); - } - - BOOL IsNormal() const - { - return MatchesMask(FILE_ATTRIBUTE_NORMAL); - } - - BOOL IsArchived() const - { - return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); - } - -// Operations - BOOL FindFile(LPCTSTR pstrName = NULL) - { - Close(); - - if(pstrName == NULL) - { - pstrName = _T("*.*"); - } - else if(lstrlen(pstrName) >= MAX_PATH) - { - ATLASSERT(FALSE); - return FALSE; - } - - SecureHelper::strcpy_x(m_fd.cFileName, _countof(m_fd.cFileName), pstrName); - - m_hFind = ::FindFirstFile(pstrName, &m_fd); - - if(m_hFind == INVALID_HANDLE_VALUE) - return FALSE; - -#ifndef _WIN32_WCE - bool bFullPath = (::GetFullPathName(pstrName, MAX_PATH, m_lpszRoot, NULL) != 0); -#else // CE specific - errno_t nRet = SecureHelper::strncpy_x(m_lpszRoot, _countof(m_lpszRoot), pstrName, _TRUNCATE); - bool bFullPath = (nRet == 0 || nRet == STRUNCATE); -#endif // _WIN32_WCE - - // passed name isn't a valid path but was found by the API - ATLASSERT(bFullPath); - if(!bFullPath) - { - Close(); - ::SetLastError(ERROR_INVALID_NAME); - return FALSE; - } - else - { - // find the last forward or backward whack - LPTSTR pstrBack = MinCrtHelper::_strrchr(m_lpszRoot, _T('\\')); - LPTSTR pstrFront = MinCrtHelper::_strrchr(m_lpszRoot, _T('/')); - - if(pstrFront != NULL || pstrBack != NULL) - { - if(pstrFront == NULL) - pstrFront = m_lpszRoot; - if(pstrBack == NULL) - pstrBack = m_lpszRoot; - - // from the start to the last whack is the root - - if(pstrFront >= pstrBack) - *pstrFront = _T('\0'); - else - *pstrBack = _T('\0'); - } - } - - m_bFound = TRUE; - - return TRUE; - } - - BOOL FindNextFile() - { - ATLASSERT(m_hFind != NULL); - - if(m_hFind == NULL) - return FALSE; - - if(!m_bFound) - return FALSE; - - m_bFound = ::FindNextFile(m_hFind, &m_fd); - - return m_bFound; - } - - void Close() - { - m_bFound = FALSE; - - if(m_hFind != NULL && m_hFind != INVALID_HANDLE_VALUE) - { - ::FindClose(m_hFind); - m_hFind = NULL; - } - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Global functions for stock GDI objects - -inline HPEN AtlGetStockPen(int nPen) -{ -#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); -#else - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); -#endif - return (HPEN)::GetStockObject(nPen); -} - -inline HBRUSH AtlGetStockBrush(int nBrush) -{ -#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) - ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); -#else - ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); -#endif - return (HBRUSH)::GetStockObject(nBrush); -} - -inline HFONT AtlGetStockFont(int nFont) -{ -#ifndef _WIN32_WCE - ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); -#else // CE specific - ATLASSERT(nFont == SYSTEM_FONT); -#endif // _WIN32_WCE - return (HFONT)::GetStockObject(nFont); -} - -inline HPALETTE AtlGetStockPalette(int nPalette) -{ - ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported - return (HPALETTE)::GetStockObject(nPalette); -} - - -/////////////////////////////////////////////////////////////////////////////// -// Global function for compacting a path by replacing parts with ellipsis - -// helper for multi-byte character sets -inline bool _IsDBCSTrailByte(LPCTSTR lpstr, int nChar) -{ -#ifndef _UNICODE - int i = nChar; - for( ; i > 0; i--) - { - if(!::IsDBCSLeadByte(lpstr[i - 1])) - break; - } - return ((nChar > 0) && (((nChar - i) & 1) != 0)); -#else // _UNICODE - lpstr; nChar; - return false; -#endif // _UNICODE -} - -inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) -{ - ATLASSERT(lpstrOut != NULL); - ATLASSERT(lpstrIn != NULL); - ATLASSERT(cchLen > 0); - - LPCTSTR szEllipsis = _T("..."); - const int cchEndEllipsis = 3; - const int cchMidEllipsis = 4; - - if(lstrlen(lpstrIn) < cchLen) - { - SecureHelper::strcpy_x(lpstrOut, cchLen, lpstrIn); - return true; - } - - lpstrOut[0] = 0; - - // check if the separator is a slash or a backslash - TCHAR chSlash = _T('\\'); - for(LPTSTR lpstr = (LPTSTR)lpstrIn; *lpstr != 0; lpstr = ::CharNext(lpstr)) - { - if((*lpstr == _T('/')) || (*lpstr == _T('\\'))) - chSlash = *lpstr; - } - - // find the filename portion of the path - LPCTSTR lpstrFileName = lpstrIn; - for(LPCTSTR pPath = lpstrIn; *pPath; pPath = ::CharNext(pPath)) - { - if((pPath[0] == _T('\\') || pPath[0] == _T(':') || pPath[0] == _T('/')) - && pPath[1] && pPath[1] != _T('\\') && pPath[1] != _T('/')) - lpstrFileName = pPath + 1; - } - int cchFileName = lstrlen(lpstrFileName); - - // handle just the filename without a path - if(lpstrFileName == lpstrIn && cchLen > cchEndEllipsis) - { - bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchLen - cchEndEllipsis - 1) == 0); - if(bRet) - { -#ifndef _UNICODE - if(_IsDBCSTrailByte(lpstrIn, cchLen - cchEndEllipsis)) - lpstrOut[cchLen - cchEndEllipsis - 1] = 0; -#endif // _UNICODE - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - } - return bRet; - } - - // handle just ellipsis - if((cchLen < (cchMidEllipsis + cchEndEllipsis))) - { - for(int i = 0; i < cchLen - 1; i++) - lpstrOut[i] = ((i + 1) == cchMidEllipsis) ? chSlash : _T('.'); - lpstrOut[cchLen - 1] = 0; - return true; - } - - // calc how much we have to copy - int cchToCopy = cchLen - (cchMidEllipsis + cchFileName) - 1; - - if(cchToCopy < 0) - cchToCopy = 0; - -#ifndef _UNICODE - if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrIn, cchToCopy)) - cchToCopy--; -#endif // _UNICODE - - bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchToCopy) == 0); - if(!bRet) - return false; - - // add ellipsis - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - if(!bRet) - return false; - TCHAR szSlash[2] = { chSlash, 0 }; - SecureHelper::strcat_x(lpstrOut, cchLen, szSlash); - if(!bRet) - return false; - - // add filename (and ellipsis, if needed) - if(cchLen > (cchMidEllipsis + cchFileName)) - { - SecureHelper::strcat_x(lpstrOut, cchLen, lpstrFileName); - } - else - { - cchToCopy = cchLen - cchMidEllipsis - cchEndEllipsis - 1; -#ifndef _UNICODE - if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrFileName, cchToCopy)) - cchToCopy--; -#endif // _UNICODE - bRet = (SecureHelper::strncpy_x(&lpstrOut[cchMidEllipsis], cchLen - cchMidEllipsis, lpstrFileName, cchToCopy) == 0); - if(bRet) - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - } - - return bRet; -} - -}; // namespace WTL - -#endif // __ATLMISC_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlprint.h b/GLideN64/src/GLideNUI-wtl/WTL/atlprint.h deleted file mode 100644 index 03971a0..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlprint.h +++ /dev/null @@ -1,1109 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLPRINT_H__ -#define __ATLPRINT_H__ - -#pragma once - -#ifdef _WIN32_WCE - #error atlprint.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atlprint.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlprint.h requires atlwin.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CPrinterInfo -// CPrinterT -// CDevModeT -// CPrinterDC -// CPrintJobInfo -// CPrintJob -// CPrintPreview -// CPrintPreviewWindowImpl -// CPrintPreviewWindow -// CZoomPrintPreviewWindowImpl -// CZoomPrintPreviewWindow - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CPrinterInfo - This class wraps all of the PRINTER_INFO_* structures -// and provided by ::GetPrinter. - -template -class _printer_info -{ -public: - typedef void infotype; -}; - -template <> class _printer_info<1> { public: typedef PRINTER_INFO_1 infotype; }; -template <> class _printer_info<2> { public: typedef PRINTER_INFO_2 infotype; }; -template <> class _printer_info<3> { public: typedef PRINTER_INFO_3 infotype; }; -template <> class _printer_info<4> { public: typedef PRINTER_INFO_4 infotype; }; -template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; }; -template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; }; -template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; }; -// these are not in the old (vc6.0) headers -#ifdef _ATL_USE_NEW_PRINTER_INFO -template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; }; -template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; }; -#endif // _ATL_USE_NEW_PRINTER_INFO - - -template -class CPrinterInfo -{ -public: -// Data members - typename _printer_info::infotype* m_pi; - -// Constructor/destructor - CPrinterInfo() : m_pi(NULL) - { } - - CPrinterInfo(HANDLE hPrinter) : m_pi(NULL) - { - GetPrinterInfo(hPrinter); - } - - ~CPrinterInfo() - { - Cleanup(); - } - -// Operations - bool GetPrinterInfo(HANDLE hPrinter) - { - Cleanup(); - return GetPrinterInfoHelper(hPrinter, (BYTE**)&m_pi, t_nInfo); - } - -// Implementation - void Cleanup() - { - delete [] (BYTE*)m_pi; - m_pi = NULL; - } - - static bool GetPrinterInfoHelper(HANDLE hPrinter, BYTE** pi, int nIndex) - { - ATLASSERT(pi != NULL); - DWORD dw = 0; - BYTE* pb = NULL; - ::GetPrinter(hPrinter, nIndex, NULL, 0, &dw); - if (dw > 0) - { - ATLTRY(pb = new BYTE[dw]); - if (pb != NULL) - { - memset(pb, 0, dw); - DWORD dwNew; - if (!::GetPrinter(hPrinter, nIndex, pb, dw, &dwNew)) - { - delete [] pb; - pb = NULL; - } - } - } - *pi = pb; - return (pb != NULL); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrinter - Wrapper class for a HANDLE to a printer - -template -class CPrinterT -{ -public: -// Data members - HANDLE m_hPrinter; - -// Constructor/destructor - CPrinterT(HANDLE hPrinter = NULL) : m_hPrinter(hPrinter) - { } - - ~CPrinterT() - { - ClosePrinter(); - } - -// Operations - CPrinterT& operator =(HANDLE hPrinter) - { - if (hPrinter != m_hPrinter) - { - ClosePrinter(); - m_hPrinter = hPrinter; - } - return *this; - } - - bool IsNull() const { return (m_hPrinter == NULL); } - - bool OpenPrinter(HANDLE hDevNames, const DEVMODE* pDevMode = NULL) - { - bool b = false; - DEVNAMES* pdn = (DEVNAMES*)::GlobalLock(hDevNames); - if (pdn != NULL) - { - LPTSTR lpszPrinterName = (LPTSTR)pdn + pdn->wDeviceOffset; - b = OpenPrinter(lpszPrinterName, pDevMode); - ::GlobalUnlock(hDevNames); - } - return b; - } - - bool OpenPrinter(LPCTSTR lpszPrinterName, const DEVMODE* pDevMode = NULL) - { - ClosePrinter(); - PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; - ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); - - return (m_hPrinter != NULL); - } - - bool OpenPrinter(LPCTSTR lpszPrinterName, PRINTER_DEFAULTS* pprintdefs) - { - ClosePrinter(); - ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, pprintdefs); - return (m_hPrinter != NULL); - } - - bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL) - { - ClosePrinter(); - const int cchBuff = 512; - TCHAR buffer[cchBuff]; - buffer[0] = 0; - ::GetProfileString(_T("windows"), _T("device"), _T(",,,"), buffer, cchBuff); - int nLen = lstrlen(buffer); - if (nLen != 0) - { - LPTSTR lpsz = buffer; - while (*lpsz) - { - if (*lpsz == _T(',')) - { - *lpsz = 0; - break; - } - lpsz = CharNext(lpsz); - } - PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; - ::OpenPrinter(buffer, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); - } - return m_hPrinter != NULL; - } - - void ClosePrinter() - { - if (m_hPrinter != NULL) - { - if (t_bManaged) - ::ClosePrinter(m_hPrinter); - m_hPrinter = NULL; - } - } - - bool PrinterProperties(HWND hWnd = NULL) - { - if (hWnd == NULL) - hWnd = ::GetActiveWindow(); - return !!::PrinterProperties(hWnd, m_hPrinter); - } - - HANDLE CopyToHDEVNAMES() const - { - HANDLE h = NULL; - CPrinterInfo<5> pinfon5; - CPrinterInfo<2> pinfon2; - LPTSTR lpszPrinterName = NULL; - // Some printers fail for PRINTER_INFO_5 in some situations - if (pinfon5.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfon5.m_pi->pPrinterName; - else if (pinfon2.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfon2.m_pi->pPrinterName; - if (lpszPrinterName != NULL) - { - int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR); - h = ::GlobalAlloc(GMEM_MOVEABLE, nLen); - BYTE* pv = (BYTE*)::GlobalLock(h); - DEVNAMES* pdev = (DEVNAMES*)pv; - if (pv != NULL) - { - memset(pv, 0, nLen); - pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR); - pv = pv + sizeof(DEVNAMES); // now points to end - SecureHelper::strcpy_x((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName); - ::GlobalUnlock(h); - } - } - return h; - } - - HDC CreatePrinterDC(const DEVMODE* pdm = NULL) const - { - CPrinterInfo<5> pinfo5; - CPrinterInfo<2> pinfo2; - HDC hDC = NULL; - LPTSTR lpszPrinterName = NULL; - // Some printers fail for PRINTER_INFO_5 in some situations - if (pinfo5.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo5.m_pi->pPrinterName; - else if (pinfo2.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo2.m_pi->pPrinterName; - if (lpszPrinterName != NULL) - hDC = ::CreateDC(NULL, lpszPrinterName, NULL, pdm); - return hDC; - } - - HDC CreatePrinterIC(const DEVMODE* pdm = NULL) const - { - CPrinterInfo<5> pinfo5; - CPrinterInfo<2> pinfo2; - HDC hDC = NULL; - LPTSTR lpszPrinterName = NULL; - // Some printers fail for PRINTER_INFO_5 in some situations - if (pinfo5.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo5.m_pi->pPrinterName; - else if (pinfo2.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo2.m_pi->pPrinterName; - if (lpszPrinterName != NULL) - hDC = ::CreateIC(NULL, lpszPrinterName, NULL, pdm); - return hDC; - } - - void Attach(HANDLE hPrinter) - { - ClosePrinter(); - m_hPrinter = hPrinter; - } - - HANDLE Detach() - { - HANDLE hPrinter = m_hPrinter; - m_hPrinter = NULL; - return hPrinter; - } - - operator HANDLE() const { return m_hPrinter; } -}; - -typedef CPrinterT CPrinterHandle; -typedef CPrinterT CPrinter; - - -/////////////////////////////////////////////////////////////////////////////// -// CDevMode - Wrapper class for DEVMODE - -template -class CDevModeT -{ -public: -// Data members - HANDLE m_hDevMode; - DEVMODE* m_pDevMode; - -// Constructor/destructor - CDevModeT(HANDLE hDevMode = NULL) : m_hDevMode(hDevMode) - { - m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; - } - - ~CDevModeT() - { - Cleanup(); - } - -// Operations - CDevModeT& operator =(HANDLE hDevMode) - { - Attach(hDevMode); - return *this; - } - - void Attach(HANDLE hDevModeNew) - { - Cleanup(); - m_hDevMode = hDevModeNew; - m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; - } - - HANDLE Detach() - { - if (m_hDevMode != NULL) - ::GlobalUnlock(m_hDevMode); - HANDLE hDevMode = m_hDevMode; - m_hDevMode = NULL; - return hDevMode; - } - - bool IsNull() const { return (m_hDevMode == NULL); } - - bool CopyFromPrinter(HANDLE hPrinter) - { - CPrinterInfo<2> pinfo; - bool b = pinfo.GetPrinterInfo(hPrinter); - if (b) - b = CopyFromDEVMODE(pinfo.m_pi->pDevMode); - return b; - } - - bool CopyFromDEVMODE(const DEVMODE* pdm) - { - if (pdm == NULL) - return false; - int nSize = pdm->dmSize + pdm->dmDriverExtra; - HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); - if (h != NULL) - { - void* p = ::GlobalLock(h); - SecureHelper::memcpy_x(p, nSize, pdm, nSize); - ::GlobalUnlock(h); - } - Attach(h); - return (h != NULL); - } - - bool CopyFromHDEVMODE(HANDLE hdm) - { - bool b = false; - if (hdm != NULL) - { - DEVMODE* pdm = (DEVMODE*)::GlobalLock(hdm); - b = CopyFromDEVMODE(pdm); - ::GlobalUnlock(hdm); - } - return b; - } - - HANDLE CopyToHDEVMODE() - { - if ((m_hDevMode == NULL) || (m_pDevMode == NULL)) - return NULL; - int nSize = m_pDevMode->dmSize + m_pDevMode->dmDriverExtra; - HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); - if (h != NULL) - { - void* p = ::GlobalLock(h); - SecureHelper::memcpy_x(p, nSize, m_pDevMode, nSize); - ::GlobalUnlock(h); - } - return h; - } - - // If this devmode was for another printer, this will create a new devmode - // based on the existing devmode, but retargeted at the new printer - bool UpdateForNewPrinter(HANDLE hPrinter) - { - bool bRet = false; - LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0); - CTempBuffer buff; - DEVMODE* pdm = buff.AllocateBytes(nLen); - if(pdm != NULL) - { - memset(pdm, 0, nLen); - LONG l = ::DocumentProperties(NULL, hPrinter, NULL, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER); - if (l == IDOK) - bRet = CopyFromDEVMODE(pdm); - } - - return bRet; - } - - bool DocumentProperties(HANDLE hPrinter, HWND hWnd = NULL) - { - CPrinterInfo<1> pi; - pi.GetPrinterInfo(hPrinter); - if (hWnd == NULL) - hWnd = ::GetActiveWindow(); - - bool bRet = false; - LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0); - CTempBuffer buff; - DEVMODE* pdm = buff.AllocateBytes(nLen); - if(pdm != NULL) - { - memset(pdm, 0, nLen); - LONG l = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER | DM_PROMPT); - if (l == IDOK) - bRet = CopyFromDEVMODE(pdm); - } - - return bRet; - } - - operator HANDLE() const { return m_hDevMode; } - - operator DEVMODE*() const { return m_pDevMode; } - -// Implementation - void Cleanup() - { - if (m_hDevMode != NULL) - { - ::GlobalUnlock(m_hDevMode); - if(t_bManaged) - ::GlobalFree(m_hDevMode); - m_hDevMode = NULL; - } - } -}; - -typedef CDevModeT CDevModeHandle; -typedef CDevModeT CDevMode; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrinterDC - -class CPrinterDC : public CDC -{ -public: -// Constructors/destructor - CPrinterDC() - { - CPrinter printer; - printer.OpenDefaultPrinter(); - Attach(printer.CreatePrinterDC()); - ATLASSERT(m_hDC != NULL); - } - - CPrinterDC(HANDLE hPrinter, const DEVMODE* pdm = NULL) - { - CPrinterHandle p; - p.Attach(hPrinter); - Attach(p.CreatePrinterDC(pdm)); - ATLASSERT(m_hDC != NULL); - } - - ~CPrinterDC() - { - DeleteDC(); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintJob - Wraps a set of tasks for a specific printer (StartDoc/EndDoc) -// Handles aborting, background printing - -// Defines callbacks used by CPrintJob (not a COM interface) -class ATL_NO_VTABLE IPrintJobInfo -{ -public: - virtual void BeginPrintJob(HDC hDC) = 0; // allocate handles needed, etc. - virtual void EndPrintJob(HDC hDC, bool bAborted) = 0; // free handles, etc. - virtual void PrePrintPage(UINT nPage, HDC hDC) = 0; - virtual bool PrintPage(UINT nPage, HDC hDC) = 0; - virtual void PostPrintPage(UINT nPage, HDC hDC) = 0; - // If you want per page devmodes, return the DEVMODE* to use for nPage. - // You can optimize by only returning a new DEVMODE* when it is different - // from the one for nLastPage, otherwise return NULL. - // When nLastPage==0, the current DEVMODE* will be the default passed to - // StartPrintJob. - // Note: During print preview, nLastPage will always be "0". - virtual DEVMODE* GetNewDevModeForPage(UINT nLastPage, UINT nPage) = 0; - virtual bool IsValidPage(UINT nPage) = 0; -}; - -// Provides a default implementatin for IPrintJobInfo -// Typically, MI'd into a document or view class -class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo -{ -public: - virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc - { - } - - virtual void EndPrintJob(HDC /*hDC*/, bool /*bAborted*/) // free handles, etc - { - } - - virtual void PrePrintPage(UINT /*nPage*/, HDC hDC) - { - m_nPJState = ::SaveDC(hDC); - } - - virtual bool PrintPage(UINT /*nPage*/, HDC /*hDC*/) = 0; - - virtual void PostPrintPage(UINT /*nPage*/, HDC hDC) - { - RestoreDC(hDC, m_nPJState); - } - - virtual DEVMODE* GetNewDevModeForPage(UINT /*nLastPage*/, UINT /*nPage*/) - { - return NULL; - } - - virtual bool IsValidPage(UINT /*nPage*/) - { - return true; - } - -// Implementation - data - int m_nPJState; -}; - - -class CPrintJob -{ -public: -// Data members - CPrinterHandle m_printer; - IPrintJobInfo* m_pInfo; - DEVMODE* m_pDefDevMode; - DOCINFO m_docinfo; - int m_nJobID; - bool m_bCancel; - bool m_bComplete; - unsigned long m_nStartPage; - unsigned long m_nEndPage; - -// Constructor/destructor - CPrintJob() : m_nJobID(0), m_bCancel(false), m_bComplete(true) - { } - - ~CPrintJob() - { - ATLASSERT(IsJobComplete()); // premature destruction? - } - -// Operations - bool IsJobComplete() const - { - return m_bComplete; - } - - bool StartPrintJob(bool bBackground, HANDLE hPrinter, DEVMODE* pDefaultDevMode, - IPrintJobInfo* pInfo, LPCTSTR lpszDocName, - unsigned long nStartPage, unsigned long nEndPage, - bool bPrintToFile = false, LPCTSTR lpstrOutputFile = NULL) - { - ATLASSERT(m_bComplete); // previous job not done yet? - if (pInfo == NULL) - return false; - - memset(&m_docinfo, 0, sizeof(m_docinfo)); - m_docinfo.cbSize = sizeof(m_docinfo); - m_docinfo.lpszDocName = lpszDocName; - m_pInfo = pInfo; - m_nStartPage = nStartPage; - m_nEndPage = nEndPage; - m_printer.Attach(hPrinter); - m_pDefDevMode = pDefaultDevMode; - m_bComplete = false; - - if(bPrintToFile) - m_docinfo.lpszOutput = (lpstrOutputFile != NULL) ? lpstrOutputFile : _T("FILE:"); - - if (!bBackground) - { - m_bComplete = true; - return StartHelper(); - } - - // Create a thread and return - DWORD dwThreadID = 0; -#if !defined(_ATL_MIN_CRT) && defined(_MT) - HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID); -#else - HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID); -#endif - if (hThread == NULL) - return false; - - ::CloseHandle(hThread); - - return true; - } - -// Implementation - static DWORD WINAPI StartProc(void* p) - { - CPrintJob* pThis = (CPrintJob*)p; - pThis->StartHelper(); - pThis->m_bComplete = true; - return 0; - } - - bool StartHelper() - { - CDC dcPrinter; - dcPrinter.Attach(m_printer.CreatePrinterDC(m_pDefDevMode)); - if (dcPrinter.IsNull()) - return false; - - m_nJobID = ::StartDoc(dcPrinter, &m_docinfo); - if (m_nJobID <= 0) - return false; - - m_pInfo->BeginPrintJob(dcPrinter); - - // print all the pages now - unsigned long nLastPage = 0; - for (unsigned long nPage = m_nStartPage; nPage <= m_nEndPage; nPage++) - { - if (!m_pInfo->IsValidPage(nPage)) - break; - DEVMODE* pdm = m_pInfo->GetNewDevModeForPage(nLastPage, nPage); - if (pdm != NULL) - dcPrinter.ResetDC(pdm); - dcPrinter.StartPage(); - m_pInfo->PrePrintPage(nPage, dcPrinter); - if (!m_pInfo->PrintPage(nPage, dcPrinter)) - m_bCancel = true; - m_pInfo->PostPrintPage(nPage, dcPrinter); - dcPrinter.EndPage(); - if (m_bCancel) - break; - nLastPage = nPage; - } - - m_pInfo->EndPrintJob(dcPrinter, m_bCancel); - if (m_bCancel) - ::AbortDoc(dcPrinter); - else - ::EndDoc(dcPrinter); - m_nJobID = 0; - return true; - } - - // Cancels a print job. Can be called asynchronously. - void CancelPrintJob() - { - m_bCancel = true; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintPreview - Adds print preview support to an existing window - -class CPrintPreview -{ -public: -// Data members - IPrintJobInfo* m_pInfo; - CPrinterHandle m_printer; - CEnhMetaFile m_meta; - DEVMODE* m_pDefDevMode; - DEVMODE* m_pCurDevMode; - SIZE m_sizeCurPhysOffset; - -// Constructor - CPrintPreview() : m_pInfo(NULL), m_pDefDevMode(NULL), m_pCurDevMode(NULL) - { - m_sizeCurPhysOffset.cx = 0; - m_sizeCurPhysOffset.cy = 0; - } - -// Operations - void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, IPrintJobInfo* pji) - { - m_printer.Attach(hPrinter); - m_pDefDevMode = pDefaultDevMode; - m_pInfo = pji; - m_nCurPage = 0; - m_pCurDevMode = NULL; - } - - void SetEnhMetaFile(HENHMETAFILE hEMF) - { - m_meta = hEMF; - } - - void SetPage(int nPage) - { - if (!m_pInfo->IsValidPage(nPage)) - return; - m_nCurPage = nPage; - m_pCurDevMode = m_pInfo->GetNewDevModeForPage(0, nPage); - if (m_pCurDevMode == NULL) - m_pCurDevMode = m_pDefDevMode; - CDC dcPrinter = m_printer.CreatePrinterDC(m_pCurDevMode); - - int iWidth = dcPrinter.GetDeviceCaps(PHYSICALWIDTH); - int iHeight = dcPrinter.GetDeviceCaps(PHYSICALHEIGHT); - int nLogx = dcPrinter.GetDeviceCaps(LOGPIXELSX); - int nLogy = dcPrinter.GetDeviceCaps(LOGPIXELSY); - - RECT rcMM = { 0, 0, ::MulDiv(iWidth, 2540, nLogx), ::MulDiv(iHeight, 2540, nLogy) }; - - m_sizeCurPhysOffset.cx = dcPrinter.GetDeviceCaps(PHYSICALOFFSETX); - m_sizeCurPhysOffset.cy = dcPrinter.GetDeviceCaps(PHYSICALOFFSETY); - - CEnhMetaFileDC dcMeta(dcPrinter, &rcMM); - m_pInfo->PrePrintPage(nPage, dcMeta); - m_pInfo->PrintPage(nPage, dcMeta); - m_pInfo->PostPrintPage(nPage, dcMeta); - m_meta.Attach(dcMeta.Close()); - } - - void GetPageRect(RECT& rc, LPRECT prc) - { - int x1 = rc.right-rc.left; - int y1 = rc.bottom - rc.top; - if ((x1 < 0) || (y1 < 0)) - return; - - CEnhMetaFileInfo emfinfo(m_meta); - ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - - // Compute whether we are OK vertically or horizontally - int x2 = pmh->szlDevice.cx; - int y2 = pmh->szlDevice.cy; - int y1p = MulDiv(x1, y2, x2); - int x1p = MulDiv(y1, x2, y2); - ATLASSERT((x1p <= x1) || (y1p <= y1)); - if (x1p <= x1) - { - prc->left = rc.left + (x1 - x1p) / 2; - prc->right = prc->left + x1p; - prc->top = rc.top; - prc->bottom = rc.bottom; - } - else - { - prc->left = rc.left; - prc->right = rc.right; - prc->top = rc.top + (y1 - y1p) / 2; - prc->bottom = prc->top + y1p; - } - } - -// Painting helpers - void DoPaint(CDCHandle dc) - { - // this one is not used - } - - void DoPaint(CDCHandle dc, RECT& rc) - { - CEnhMetaFileInfo emfinfo(m_meta); - ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); - int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); - - dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); - dc.PlayMetaFile(m_meta, &rc); - } - -// Implementation - data - int m_nCurPage; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintPreviewWindow - Implements a print preview window - -template -class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImpl, public CPrintPreview -{ -public: - DECLARE_WND_CLASS_EX(NULL, CS_VREDRAW | CS_HREDRAW, -1) - - enum { m_cxOffset = 10, m_cyOffset = 10 }; - -// Constructor - CPrintPreviewWindowImpl() : m_nMaxPage(0), m_nMinPage(0) - { } - -// Operations - void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, - IPrintJobInfo* pji, int nMinPage, int nMaxPage) - { - CPrintPreview::SetPrintPreviewInfo(hPrinter, pDefaultDevMode, pji); - m_nMinPage = nMinPage; - m_nMaxPage = nMaxPage; - } - - bool NextPage() - { - if (m_nCurPage == m_nMaxPage) - return false; - SetPage(m_nCurPage + 1); - Invalidate(); - return true; - } - - bool PrevPage() - { - if (m_nCurPage == m_nMinPage) - return false; - if (m_nCurPage == 0) - return false; - SetPage(m_nCurPage - 1); - Invalidate(); - return true; - } - -// Message map and handlers - BEGIN_MSG_MAP(CPrintPreviewWindowImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - END_MSG_MAP() - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no need for the background - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - RECT rc = { 0 }; - - if(wParam != NULL) - { - pT->DoPrePaint((HDC)wParam, rc); - pT->DoPaint((HDC)wParam, rc); - } - else - { - CPaintDC dc(m_hWnd); - pT->DoPrePaint(dc.m_hDC, rc); - pT->DoPaint(dc.m_hDC, rc); - } - - return 0; - } - -// Painting helper - void DoPrePaint(CDCHandle dc, RECT& rc) - { - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcArea = rcClient; - T* pT = static_cast(this); - pT; // avoid level 4 warning - ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); - if (rcArea.left > rcArea.right) - rcArea.right = rcArea.left; - if (rcArea.top > rcArea.bottom) - rcArea.bottom = rcArea.top; - GetPageRect(rcArea, &rc); - CRgn rgn1, rgn2; - rgn1.CreateRectRgnIndirect(&rc); - rgn2.CreateRectRgnIndirect(&rcClient); - rgn2.CombineRgn(rgn1, RGN_DIFF); - dc.SelectClipRgn(rgn2); - dc.FillRect(&rcClient, COLOR_BTNSHADOW); - dc.SelectClipRgn(NULL); - dc.FillRect(&rc, (HBRUSH)::GetStockObject(WHITE_BRUSH)); - } - -// Implementation - data - int m_nMinPage; - int m_nMaxPage; -}; - - -class CPrintPreviewWindow : public CPrintPreviewWindowImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_PrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CZoomPrintPreviewWindowImpl - Implements print preview window with zooming - -#ifdef __ATLSCRL_H__ - -template -class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > -{ -public: - bool m_bSized; - - CZoomPrintPreviewWindowImpl() - { - SetScrollExtendedStyle(SCRL_DISABLENOSCROLL); - InitZoom(); - } - - // should be called to reset data members before recreating window - void InitZoom() - { - m_bSized = false; - m_nZoomMode = ZOOMMODE_OFF; - m_fZoomScaleMin = 1.0; - m_fZoomScale = 1.0; - } - - BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl) - MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; - POINT ptOffset = m_ptOffset; - SIZE sizeAll = m_sizeAll; - SetScrollSize(sizeClient); - if(sizeAll.cx > 0) - ptOffset.x = ::MulDiv(ptOffset.x, m_sizeAll.cx, sizeAll.cx); - if(sizeAll.cy > 0) - ptOffset.y = ::MulDiv(ptOffset.y, m_sizeAll.cy, sizeAll.cy); - SetScrollOffset(ptOffset); - CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled); - if(!m_bSized) - { - m_bSized = true; - T* pT = static_cast(this); - pT->ShowScrollBar(SB_HORZ, TRUE); - pT->ShowScrollBar(SB_VERT, TRUE); - } - return 0; - } - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - RECT rc = { 0 }; - - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - int nMapModeSav = dc.GetMapMode(); - dc.SetMapMode(MM_ANISOTROPIC); - SIZE szWindowExt = { 0, 0 }; - dc.SetWindowExt(m_sizeLogAll, &szWindowExt); - SIZE szViewportExt = { 0, 0 }; - dc.SetViewportExt(m_sizeAll, &szViewportExt); - POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - - pT->DoPrePaint(dc, rc); - pT->DoPaint(dc, rc); - - dc.SetMapMode(nMapModeSav); - dc.SetWindowExt(szWindowExt); - dc.SetViewportExt(szViewportExt); - dc.SetViewportOrg(ptViewportOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - pT->DoPrePaint(dc.m_hDC, rc); - pT->DoPaint(dc.m_hDC, rc); - } - - return 0; - } - - // Painting helpers - void DoPaint(CDCHandle dc) - { - // this one is not used - } - - void DoPrePaint(CDCHandle dc, RECT& rc) - { - RECT rcClient; - GetClientRect(&rcClient); - RECT rcArea = rcClient; - T* pT = static_cast(this); - pT; // avoid level 4 warning - ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); - if (rcArea.left > rcArea.right) - rcArea.right = rcArea.left; - if (rcArea.top > rcArea.bottom) - rcArea.bottom = rcArea.top; - GetPageRect(rcArea, &rc); - HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); - dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY); - dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY); - dc.PatBlt(rc.right, rcClient.top, rcClient.right - rc.right, rcClient.bottom - rcClient.top, PATCOPY); - dc.PatBlt(rc.left, rc.bottom, rc.right - rc.left, rcClient.bottom - rc.bottom, PATCOPY); - dc.SelectBrush((HBRUSH)::GetStockObject(WHITE_BRUSH)); - dc.PatBlt(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); - dc.SelectBrush(::GetSysColorBrush(COLOR_3DDKSHADOW)); - dc.PatBlt(rc.right, rc.top + 4, 4, rc.bottom - rc.top, PATCOPY); - dc.PatBlt(rc.left + 4, rc.bottom, rc.right - rc.left, 4, PATCOPY); - dc.SelectBrush(hbrOld); - } - - void DoPaint(CDCHandle dc, RECT& rc) - { - CEnhMetaFileInfo emfinfo(m_meta); - ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); - int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); - - dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); - dc.PlayMetaFile(m_meta, &rc); - } -}; - -class CZoomPrintPreviewWindow : public CZoomPrintPreviewWindowImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_ZoomPrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) -}; - -#endif // __ATLSCRL_H__ - -}; // namespace WTL - -#endif // __ATLPRINT_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlres.h b/GLideN64/src/GLideNUI-wtl/WTL/atlres.h deleted file mode 100644 index 4a5d8af..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlres.h +++ /dev/null @@ -1,263 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRES_H__ -#define __ATLRES_H__ - -#pragma once - -#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__) - #error Use atlresCE.h instead of atlres.h for Windows CE -#endif - - -#ifdef RC_INVOKED -#ifndef _INC_WINDOWS - - #define _INC_WINDOWS - - #ifndef _WIN32_WCE - #define VS_VERSION_INFO 1 - - #ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED - - #ifndef WINVER - #define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER - - #include - - // operation messages sent to DLGINIT - #define LB_ADDSTRING (WM_USER+1) - #define CB_ADDSTRING (WM_USER+3) - #endif // !_WIN32_WCE - - #ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS - #endif // APSTUDIO_INVOKED - - #ifdef IDC_STATIC - #undef IDC_STATIC - #endif // IDC_STATIC - #define IDC_STATIC (-1) - -#endif // !_INC_WINDOWS -#endif // RC_INVOKED - -#ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// ATL resource types - -#ifndef RC_INVOKED - #define RT_DLGINIT MAKEINTRESOURCE(240) - #define RT_TOOLBAR MAKEINTRESOURCE(241) -#endif // RC_INVOKED - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// Standard window components - -#define ID_SEPARATOR 0 // special separator value -#define ID_DEFAULT_PANE 0 // default status bar pane - -#ifndef RC_INVOKED // code only -// standard control bars (IDW = window ID) - #define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window - #define ATL_IDW_STATUS_BAR 0xE801 // Status bar window - #define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window - -// parts of a frame window - #define ATL_IDW_CLIENT 0xE900 - #define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) - #define ATL_IDW_PANE_LAST 0xE9FF - #define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) - #define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) - - #define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters - #define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST - -// bands for a rebar - #define ATL_IDW_BAND_FIRST 0xEB00 - #define ATL_IDW_BAND_LAST 0xEBFF -#endif // !RC_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// Standard Commands - -// File commands -#define ID_FILE_NEW 0xE100 -#define ID_FILE_OPEN 0xE101 -#define ID_FILE_CLOSE 0xE102 -#define ID_FILE_SAVE 0xE103 -#define ID_FILE_SAVE_AS 0xE104 -#define ID_FILE_PAGE_SETUP 0xE105 -#define ID_FILE_PRINT_SETUP 0xE106 -#define ID_FILE_PRINT 0xE107 -#define ID_FILE_PRINT_DIRECT 0xE108 -#define ID_FILE_PRINT_PREVIEW 0xE109 -#define ID_FILE_UPDATE 0xE10A -#define ID_FILE_SAVE_COPY_AS 0xE10B -#define ID_FILE_SEND_MAIL 0xE10C - -#define ID_FILE_MRU_FIRST 0xE110 -#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max -#define ID_FILE_MRU_FILE2 0xE111 -#define ID_FILE_MRU_FILE3 0xE112 -#define ID_FILE_MRU_FILE4 0xE113 -#define ID_FILE_MRU_FILE5 0xE114 -#define ID_FILE_MRU_FILE6 0xE115 -#define ID_FILE_MRU_FILE7 0xE116 -#define ID_FILE_MRU_FILE8 0xE117 -#define ID_FILE_MRU_FILE9 0xE118 -#define ID_FILE_MRU_FILE10 0xE119 -#define ID_FILE_MRU_FILE11 0xE11A -#define ID_FILE_MRU_FILE12 0xE11B -#define ID_FILE_MRU_FILE13 0xE11C -#define ID_FILE_MRU_FILE14 0xE11D -#define ID_FILE_MRU_FILE15 0xE11E -#define ID_FILE_MRU_FILE16 0xE11F -#define ID_FILE_MRU_LAST 0xE11F - -// Edit commands -#define ID_EDIT_CLEAR 0xE120 -#define ID_EDIT_CLEAR_ALL 0xE121 -#define ID_EDIT_COPY 0xE122 -#define ID_EDIT_CUT 0xE123 -#define ID_EDIT_FIND 0xE124 -#define ID_EDIT_PASTE 0xE125 -#define ID_EDIT_PASTE_LINK 0xE126 -#define ID_EDIT_PASTE_SPECIAL 0xE127 -#define ID_EDIT_REPEAT 0xE128 -#define ID_EDIT_REPLACE 0xE129 -#define ID_EDIT_SELECT_ALL 0xE12A -#define ID_EDIT_UNDO 0xE12B -#define ID_EDIT_REDO 0xE12C - -// Window commands -#define ID_WINDOW_NEW 0xE130 -#define ID_WINDOW_ARRANGE 0xE131 -#define ID_WINDOW_CASCADE 0xE132 -#define ID_WINDOW_TILE_HORZ 0xE133 -#define ID_WINDOW_TILE_VERT 0xE134 -#define ID_WINDOW_SPLIT 0xE135 -#ifndef RC_INVOKED // code only - #define ATL_IDM_WINDOW_FIRST 0xE130 - #define ATL_IDM_WINDOW_LAST 0xE13F - #define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here - #define ATL_IDM_LAST_MDICHILD 0xFFFD -#endif // !RC_INVOKED -// TabView -#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD -#define ID_WINDOW_TABLAST 0xFFFD -#define ID_WINDOW_SHOWTABLIST 0xFFFE - -// Help and App commands -#define ID_APP_ABOUT 0xE140 -#define ID_APP_EXIT 0xE141 -#define ID_HELP_INDEX 0xE142 -#define ID_HELP_FINDER 0xE143 -#define ID_HELP_USING 0xE144 -#define ID_CONTEXT_HELP 0xE145 // shift-F1 -// special commands for processing help -#define ID_HELP 0xE146 // first attempt for F1 -#define ID_DEFAULT_HELP 0xE147 // last attempt - -// Misc -#define ID_NEXT_PANE 0xE150 -#define ID_PREV_PANE 0xE151 -#define ID_PANE_CLOSE 0xE152 - -// Format -#define ID_FORMAT_FONT 0xE160 - -// Scroll -#define ID_SCROLL_UP 0xE170 -#define ID_SCROLL_DOWN 0xE171 -#define ID_SCROLL_PAGE_UP 0xE172 -#define ID_SCROLL_PAGE_DOWN 0xE173 -#define ID_SCROLL_TOP 0xE174 -#define ID_SCROLL_BOTTOM 0xE175 -#define ID_SCROLL_LEFT 0xE176 -#define ID_SCROLL_RIGHT 0xE177 -#define ID_SCROLL_PAGE_LEFT 0xE178 -#define ID_SCROLL_PAGE_RIGHT 0xE179 -#define ID_SCROLL_ALL_LEFT 0xE17A -#define ID_SCROLL_ALL_RIGHT 0xE17B - -// OLE commands -#define ID_OLE_INSERT_NEW 0xE200 -#define ID_OLE_EDIT_LINKS 0xE201 -#define ID_OLE_EDIT_CONVERT 0xE202 -#define ID_OLE_EDIT_CHANGE_ICON 0xE203 -#define ID_OLE_EDIT_PROPERTIES 0xE204 -#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max -#ifndef RC_INVOKED // code only - #define ID_OLE_VERB_LAST 0xE21F -#endif // !RC_INVOKED - -// View commands (same number used as IDW used for toolbar and status bar) -#define ID_VIEW_TOOLBAR 0xE800 -#define ID_VIEW_STATUS_BAR 0xE801 -#define ID_VIEW_REFRESH 0xE803 -#define ID_VIEW_RIBBON 0xE804 // Ribbon - -/////////////////////////////////////////////////////////////////////////////// -// Standard control IDs - -#ifdef IDC_STATIC - #undef IDC_STATIC -#endif // IDC_STATIC -#define IDC_STATIC (-1) // all static controls - -/////////////////////////////////////////////////////////////////////////////// -// Standard string error/warnings - -// idle status bar message -#define ATL_IDS_IDLEMESSAGE 0xE001 - -#ifndef RC_INVOKED // code only - #define ATL_IDS_SCFIRST 0xEF00 -#endif // !RC_INVOKED - -#define ATL_IDS_SCSIZE 0xEF00 -#define ATL_IDS_SCMOVE 0xEF01 -#define ATL_IDS_SCMINIMIZE 0xEF02 -#define ATL_IDS_SCMAXIMIZE 0xEF03 -#define ATL_IDS_SCNEXTWINDOW 0xEF04 -#define ATL_IDS_SCPREVWINDOW 0xEF05 -#define ATL_IDS_SCCLOSE 0xEF06 -#define ATL_IDS_SCRESTORE 0xEF12 -#define ATL_IDS_SCTASKLIST 0xEF13 - -#define ATL_IDS_MDICHILD 0xEF1F -#define ATL_IDS_MRU_FILE 0xEFDA - -/////////////////////////////////////////////////////////////////////////////// -// Misc. control IDs - -// Property Sheet control id's (determined with Spy++) -#define ID_APPLY_NOW 0x3021 -#define ID_WIZBACK 0x3023 -#define ID_WIZNEXT 0x3024 -#define ID_WIZFINISH 0x3025 -#define ATL_IDC_TAB_CONTROL 0x3020 - -#endif // __ATLRES_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlresce.h b/GLideN64/src/GLideNUI-wtl/WTL/atlresce.h deleted file mode 100644 index 96211ee..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlresce.h +++ /dev/null @@ -1,93 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRESCE_H__ -#define __ATLRESCE_H__ - -#pragma once - -#ifndef _WIN32_WCE - #error atlresCE.h is only for Windows CE -#endif - - -#ifdef RC_INVOKED -#ifndef _INC_WINDOWS - - #define VS_VERSION_INFO 1 - - #ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED - - #ifndef WINVER - #define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER - - #if !defined(WCEOLE_ENABLE_DIALOGEX) - #define DIALOGEX DIALOG DISCARDABLE - #endif - - #include - #define SHMENUBAR RCDATA - - #if defined(SHELLSDK_MODULES_AYGSHELL) - #include - #else - #define NOMENU 0xFFFF - #define IDS_SHNEW 1 - #define IDM_SHAREDNEW 10 - #define IDM_SHAREDNEWDEFAULT 11 - #endif - #ifndef I_IMAGENONE - #define I_IMAGENONE (-2) - #endif - - #include - -#endif // !_INC_WINDOWS -#endif // RC_INVOKED - -#include "atlres.h" - -#ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -// Visual Studio dialog editor bug fix -#ifndef DS_FIXEDSYS - #define DS_FIXEDSYS 0 -#endif - -#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1 - -/////////////////////////////////////////////////////////////////////////////// -// Smartphone and PPC 2005 Resource IDs - -// Command and associated string resource IDs -#define ID_MENU_OK 0xE790 -#define ID_MENU_CANCEL 0xE791 -#define ID_MENU 0xE792 -#define ID_ACTION 0xE793 -#define ID_VIEW_FULLSCREEN 0xE802 - -// MenuBar resource IDs -#define ATL_IDM_MENU_DONE 0xE701 -#define ATL_IDM_MENU_CANCEL 0xE702 -#define ATL_IDM_MENU_DONECANCEL 0xE703 - -// Default device MenuBar control ID and MenuBar resource ID -#define ATL_IDW_MENU_BAR 0xE802 - -// SmartPhone spinned controls ID offset for CSpinCtrl -#define ATL_IDW_SPIN_ID 9999 - -#endif // __ATLRESCE_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlribbon.h b/GLideN64/src/GLideNUI-wtl/WTL/atlribbon.h deleted file mode 100644 index c1dfd0f..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlribbon.h +++ /dev/null @@ -1,3446 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRIBBON_H__ -#define __ATLRIBBON_H__ - -#pragma once - -#if (_MSC_VER < 1500) - #error atlribbon.h requires Visual C++ 2008 compiler or higher -#endif - -#ifndef _UNICODE - #error atlribbon.h requires the Unicode character set -#endif - -#if !defined(NTDDI_WIN7) || (NTDDI_VERSION < NTDDI_WIN7) - #error atlribbon.h requires the Windows 7 SDK or higher -#endif - -#ifdef _WIN32_WCE - #error atlribbon.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atlribbon.h requires atlapp.h to be included first -#endif - -#if (_ATL_VER < 0x0700) - #include - #pragma comment(lib, "shlwapi.lib") -#endif - -#include // for RecentDocumentList classes -#include // for Frame and UpdateUI classes -#include // required for atlctrlw.h -#include // for CCommandBarCtrl - -#if !defined(_WTL_USE_CSTRING) && !defined(__ATLSTR_H__) - #pragma warning(disable : 4530) // unwind semantics not enabled - #include - #pragma warning(default : 4530) -#endif - -#include -#pragma comment(lib, "dwmapi.lib") - -#include -#include -#pragma comment(lib, "propsys.lib") - -#include // for CHARFORMAT2 - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CRibbonUpdateUI : Automatic mapping of ribbon UI elements -// -// RibbonUI::Text -// RibbonUI::CharFormat -// RibbonUI::ICtrl -// RibbonUI::CtrlImpl -// RibbonUI::CommandCtrlImpl -// RibbonUI::ItemProperty -// RibbonUI::CollectionImplBase -// RibbonUI::CollectionImpl -// RibbonUI::TextCollectionImpl -// RibbonUI::ItemCollectionImpl -// RibbonUI::ComboCollectionImpl -// RibbonUI::CommandCollectionImpl -// RibbonUI::ToolbarCollectionImpl -// RibbonUI::SimpleCollectionImpl -// RibbonUI::CollectionCtrlImpl -// RibbonUI::ToolbarGalleryCtrlImpl -// RibbonUI::SimpleCollectionCtrlImpl -// RibbonUI::RecentItemsCtrlImpl -// RibbonUI::FontCtrlImpl -// RibbonUI::ColorCtrlImpl -// RibbonUI::SpinnerCtrlImpl -// -// RibbonUI::CRibbonImpl -// CRibbonImpl::CRibbonComboCtrl -// CRibbonImpl::CRibbonItemGalleryCtrl -// CRibbonImpl::CRibbonCommandGalleryCtrl -// CRibbonImpl::CRibbonToolbarGalleryCtrl -// CRibbonImpl::CRibbonSimpleComboCtrl -// CRibbonImpl::CRibbonSimpleGalleryCtrl -// CRibbonImpl::CRibbonRecentItemsCtrl -// CRibbonImpl::CRibbonColorCtrl -// CRibbonImpl::CRibbonFontCtrl -// CRibbonImpl::CRibbonSpinnerCtrl -// CRibbonImpl::CRibbonFloatSpinnerCtrl -// CRibbonImpl::CRibbonCommandCtrl -// -// CRibbonFrameWindowImplBase -// CRibbonFrameWindowImpl -// CRibbonMDIFrameWindowImpl -// CRibbonPersist -// -// Global functions: -// RibbonUI::SetPropertyVal() -// RibbonUI::GetImage() - - -// Constants - -#ifndef RIBBONUI_MAX_TEXT - #define RIBBONUI_MAX_TEXT 128 -#endif - -#define TWIPS_PER_POINT 20 // For font size - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CRibbonUpdateUI : Automatic mapping of ribbon UI elements - -template -class CRibbonUpdateUI : public CAutoUpdateUI -{ -public: - enum - { - UPDUI_RIBBON = 0x0080, - UPDUI_PERSIST = 0x0020 - }; - - bool IsRibbonElement(const _AtlUpdateUIMap& UIMap) - { - return (UIMap.m_wType & UPDUI_RIBBON) != 0; - } - - bool IsRibbonID(UINT nID) - { - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - if(m_arrUIMap[i].m_nID == nID) - return IsRibbonElement(m_arrUIMap[i]); - } - - return false; - } - -// Element - bool UIAddRibbonElement(UINT nID) - { - return UIAddElement(nID); - } - - bool UIRemoveRibbonElement(UINT nID) - { - return UIRemoveElement(nID); - } - - bool UIPersistElement(UINT nID, bool bPersist = true) - { - return bPersist ? - UIAddElement(nID) : - UIRemoveElement(nID); - } - -// methods for Ribbon elements - BOOL UISetText(int nID, LPCWSTR sText, BOOL bForceUpdate = FALSE) - { - T* pT = static_cast(this); - BOOL bRes = CUpdateUIBase::UISetText(nID, sText, bForceUpdate); - if (pT->IsRibbonUI() && IsRibbonID(nID)) - bRes = SUCCEEDED(pT->InvalidateProperty(nID, UI_PKEY_Label)); - return bRes; - } - - BOOL UISetText(int nID, UINT uIdResource, BOOL bForceUpdate = FALSE) - { - CTempBuffer sText(RIBBONUI_MAX_TEXT); - return AtlLoadString(uIdResource, sText, RIBBONUI_MAX_TEXT) ? - UISetText(nID, sText, bForceUpdate) : - E_FAIL; - } - - LPCTSTR UIGetText(int nID) - { - T* pT = static_cast(this); - LPCTSTR sUI = CAutoUpdateUI::UIGetText(nID); - - // replace 'tab' by 'space' for RibbonUI elements - if (sUI && pT->IsRibbonUI() && IsRibbonID(nID) && wcschr(sUI, L'\t')) - { - static WCHAR sText[RIBBONUI_MAX_TEXT] = { 0 }; - wcscpy_s(sText, sUI); - *wcschr(sText, L'\t') = L' '; - return sText; - } - else - { - return sUI; - } - } - - BOOL UIEnable(int nID, BOOL bEnable, BOOL bForceUpdate = FALSE) - { - T* pT = static_cast(this); - BOOL bRes = CUpdateUIBase::UIEnable(nID, bEnable, bForceUpdate); - if (pT->IsRibbonUI() && IsRibbonID(nID)) - bRes = SUCCEEDED(pT->SetProperty((WORD)nID, UI_PKEY_Enabled, bEnable)); - return bRes; - } - - BOOL UISetCheck(int nID, INT nCheck, BOOL bForceUpdate = FALSE) - { - if ((nCheck == 0) || (nCheck == 1)) - return UISetCheck(nID, nCheck != 0, bForceUpdate); - else - return CUpdateUIBase::UISetCheck(nID, nCheck, bForceUpdate); - } - - BOOL UISetCheck(int nID, bool bCheck, BOOL bForceUpdate = FALSE) - { - T* pT = static_cast(this); - BOOL bRes = CUpdateUIBase::UISetCheck(nID, bCheck, bForceUpdate); - if (bRes && pT->IsRibbonUI() && IsRibbonID(nID)) - bRes = SUCCEEDED(pT->SetProperty((WORD)nID, UI_PKEY_BooleanValue, bCheck)); - return bRes; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// RibbonUI namespace -// - -namespace RibbonUI -{ - -// Minimal string allocation support for various PROPERTYKEY values -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - typedef _CSTRING_NS::CString Text; -#else - class Text : public std::wstring - { - public: - Text(std::wstring& s) : std::wstring(s) - { } - Text(LPCWSTR s) : std::wstring(s) - { } - Text() - { } - bool IsEmpty() - { - return empty(); - } - operator LPCWSTR() - { - return c_str(); - } - Text& operator =(LPCWSTR s) - { - return static_cast(std::wstring::operator =(s)); - } - }; -#endif - -// PROPERTYKEY enum and helpers -enum k_KEY -{ - // state - k_Enabled = 1, k_BooleanValue = 200, - // text properties - k_LabelDescription = 2, k_Keytip = 3, k_Label = 4, k_TooltipDescription = 5, k_TooltipTitle = 6, - // image properties - k_LargeImage = 7, k_LargeHighContrastImage = 8, k_SmallImage = 9, k_SmallHighContrastImage = 10, - // collection properties - k_ItemsSource = 101, k_Categories = 102, k_SelectedItem = 104, - // collection item properties - k_CommandId = 100, k_CategoryId = 103, k_CommandType = 105, k_ItemImage = 106, - // combo control property - k_StringValue = 202, - // spinner control properties - k_DecimalValue = 201, k_MaxValue = 203, k_MinValue, k_Increment, k_DecimalPlaces, k_FormatString, k_RepresentativeString = 208, - // font control properties - k_FontProperties = 300, k_FontProperties_Family, k_FontProperties_Size, k_FontProperties_Bold, k_FontProperties_Italic = 304, - k_FontProperties_Underline = 305, k_FontProperties_Strikethrough, k_FontProperties_VerticalPositioning, k_FontProperties_ForegroundColor = 308, - k_FontProperties_BackgroundColor = 309, k_FontProperties_ForegroundColorType, k_FontProperties_BackgroundColorType, k_FontProperties_ChangedProperties = 312, - k_FontProperties_DeltaSize = 313, - // recent items properties - k_RecentItems = 350, k_Pinned = 351, - // color control properties - k_Color = 400, k_ColorType = 401, k_ColorMode, - k_ThemeColorsCategoryLabel = 403, k_StandardColorsCategoryLabel, k_RecentColorsCategoryLabel = 405, k_AutomaticColorLabel = 406, - k_NoColorLabel = 407, k_MoreColorsLabel = 408, - k_ThemeColors = 409, k_StandardColors = 410, k_ThemeColorsTooltips = 411, k_StandardColorsTooltips = 412, - // Ribbon state - k_Viewable = 1000, k_Minimized = 1001, k_QuickAccessToolbarDock = 1002, k_ContextAvailable = 1100, - // Ribbon UI colors - k_GlobalBackgroundColor = 2000, k_GlobalHighlightColor, k_GlobalTextColor = 2002 -}; - -inline k_KEY k_(REFPROPERTYKEY key) -{ - return (k_KEY)key.fmtid.Data1; -} - -// PROPERTYKEY value assignment and specializations -// -template -HRESULT SetPropertyVal(REFPROPERTYKEY key, V val, PROPVARIANT* ppv) -{ - switch (k_(key)) - { - case k_Enabled: - case k_BooleanValue: - return InitPropVariantFromBoolean(val, ppv); - default: - return UIInitPropertyFromUInt32(key, val, ppv); - } -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, DOUBLE val, PROPVARIANT* ppv) -{ - return SetPropertyVal(key, (LONG)val, ppv); -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, IUIImage* val, PROPVARIANT* ppv) -{ - HRESULT hr = UIInitPropertyFromImage(key, val, ppv); - ATLVERIFY(val->Release() == 1); - return hr; -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, IUnknown* val, PROPVARIANT* ppv) -{ - return UIInitPropertyFromInterface(key, val, ppv); -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, IPropertyStore* val, PROPVARIANT* ppv) -{ - return UIInitPropertyFromInterface(key, val, ppv); -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, SAFEARRAY* val, PROPVARIANT* ppv) -{ - return UIInitPropertyFromIUnknownArray(key, val, ppv); -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, DECIMAL* val, PROPVARIANT* ppv) -{ - return UIInitPropertyFromDecimal(key, *val, ppv); -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, bool val, PROPVARIANT* ppv) -{ - return UIInitPropertyFromBoolean(key, val, ppv); -} - -inline HRESULT SetPropertyVal(REFPROPERTYKEY key, LPCWSTR val, PROPVARIANT* ppv) -{ - return UIInitPropertyFromString(key, val, ppv); -} - -// CharFormat helper struct for RibbonUI font control -// -struct CharFormat : CHARFORMAT2 -{ - // Default constructor - CharFormat() - { - cbSize = sizeof CHARFORMAT2; - Reset(); - } - - // Copy constructor - CharFormat(const CharFormat& cf) - { - CopyMemory(this, &cf, sizeof CHARFORMAT2); - } - - // Assign operator - CharFormat& operator =(const CharFormat& cf) - { - CopyMemory(this, &cf, sizeof CHARFORMAT2); - return (*this); - } - - void Reset() - { - uValue = dwMask = dwEffects = 0; - PropVariantInit(&propvar); - } - - void operator <<(IPropertyStore* pStore) - { - if (pStore == NULL) - { - ATLASSERT(FALSE); - return; - } - - static void (CharFormat::*Getk_[])(IPropertyStore*) = - { - &CharFormat::Getk_Family, - &CharFormat::Getk_FontProperties_Size, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_VerticalPositioning, - &CharFormat::Getk_Color, - &CharFormat::Getk_Color, - &CharFormat::Getk_ColorType, - &CharFormat::Getk_ColorType, - }; - - DWORD nProps = 0; - Reset(); - - ATLVERIFY(SUCCEEDED(pStore->GetCount(&nProps))); - for (DWORD iProp = 0; iProp < nProps; iProp++) - { - PROPERTYKEY key; - ATLVERIFY(SUCCEEDED(pStore->GetAt(iProp, &key))); - ATLASSERT(k_(key) >= k_FontProperties_Family); - - if (k_(key) <= k_FontProperties_BackgroundColorType) - (this->*Getk_[k_(key) - k_FontProperties_Family])(pStore); - } - } - - void operator >>(IPropertyStore* pStore) - { - if (pStore == NULL) - { - ATLASSERT(FALSE); - return; - } - - PutFace(pStore); - PutSize(pStore); - PutMaskEffect(CFM_BOLD, CFE_BOLD, UI_PKEY_FontProperties_Bold, pStore); - PutMaskEffect(CFM_ITALIC, CFE_ITALIC, UI_PKEY_FontProperties_Italic, pStore); - PutMaskEffect(CFM_UNDERLINE, CFE_UNDERLINE, UI_PKEY_FontProperties_Underline, pStore); - PutMaskEffect(CFM_STRIKEOUT, CFE_STRIKEOUT, UI_PKEY_FontProperties_Strikethrough, pStore); - PutVerticalPos(pStore); - PutColor(pStore); - PutBackColor(pStore); - } - -private: - PROPVARIANT propvar; - UINT uValue; - - // Getk_ functions - void Getk_Family(IPropertyStore* pStore) - { - if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_Family, &propvar))) - { - PropVariantToString(propvar, szFaceName, LF_FACESIZE); - if (*szFaceName) - dwMask |= CFM_FACE; - } - } - - void Getk_FontProperties_Size(IPropertyStore* pStore) - { - if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_Size, &propvar))) - { - DECIMAL decSize; - UIPropertyToDecimal(UI_PKEY_FontProperties_Size, propvar, &decSize); - DOUBLE dSize; - VarR8FromDec(&decSize, &dSize); - if (dSize > 0) - { - dwMask |= CFM_SIZE; - yHeight = (LONG)(dSize * TWIPS_PER_POINT); - } - } - } - - template - void Getk_MaskEffect(IPropertyStore* pStore) - { - if (SUCCEEDED(pStore->GetValue(key, &propvar))) - { - UIPropertyToUInt32(key, propvar, &uValue); - if ((UI_FONTPROPERTIES)uValue != UI_FONTPROPERTIES_NOTAVAILABLE) - { - dwMask |= t_dwMask; - dwEffects |= ((UI_FONTPROPERTIES) uValue == UI_FONTPROPERTIES_SET) ? t_dwEffects : 0; - } - } - } - - void Getk_VerticalPositioning(IPropertyStore* pStore) - { - if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_VerticalPositioning, &propvar))) - { - UIPropertyToUInt32(UI_PKEY_FontProperties_VerticalPositioning, propvar, &uValue); - UI_FONTVERTICALPOSITION uVerticalPosition = (UI_FONTVERTICALPOSITION) uValue; - if ((uVerticalPosition != UI_FONTVERTICALPOSITION_NOTAVAILABLE)) - { - dwMask |= (CFM_SUPERSCRIPT | CFM_SUBSCRIPT); - if (uVerticalPosition != UI_FONTVERTICALPOSITION_NOTSET) - { - dwEffects |= (uVerticalPosition == UI_FONTVERTICALPOSITION_SUPERSCRIPT) ? CFE_SUPERSCRIPT : CFE_SUBSCRIPT; - } - } - } - } - - template - void Getk_Color(IPropertyStore* pStore) - { - UINT32 color; - if (SUCCEEDED(pStore->GetValue(key, &propvar))) - { - UIPropertyToUInt32(key, propvar, &color); - dwMask |= t_dwMask; - - if (t_dwMask == CFM_COLOR) - crTextColor = color; - else - crBackColor = color; - } - } - - template - void Getk_ColorType(IPropertyStore* pStore) - { - if (SUCCEEDED(pStore->GetValue(key, &propvar))) - { - UIPropertyToUInt32(key, propvar, &uValue); - if (t_type == (UI_SWATCHCOLORTYPE)uValue) - { - dwMask |= t_dwMask; - dwEffects |= t_dwEffects; - } - } - } - - // Put functions - void PutMaskEffect(WORD dwMaskVal, WORD dwEffectVal, REFPROPERTYKEY key, IPropertyStore* pStore) - { - PROPVARIANT propvar; - UI_FONTPROPERTIES uProp = UI_FONTPROPERTIES_NOTAVAILABLE; - if ((dwMask & dwMaskVal) != 0) - uProp = dwEffects & dwEffectVal ? UI_FONTPROPERTIES_SET : UI_FONTPROPERTIES_NOTSET; - SetPropertyVal(key, uProp, &propvar); - pStore->SetValue(key, propvar); - } - - void PutVerticalPos(IPropertyStore* pStore) - { - PROPVARIANT propvar; - UI_FONTVERTICALPOSITION uProp = UI_FONTVERTICALPOSITION_NOTAVAILABLE; - - if ((dwMask & CFE_SUBSCRIPT) != 0) - { - if ((dwMask & CFM_SUBSCRIPT) && (dwEffects & CFE_SUBSCRIPT)) - uProp = UI_FONTVERTICALPOSITION_SUBSCRIPT; - else - uProp = UI_FONTVERTICALPOSITION_SUPERSCRIPT; - } - else if ((dwMask & CFM_OFFSET) != 0) - { - if (yOffset > 0) - uProp = UI_FONTVERTICALPOSITION_SUPERSCRIPT; - else if (yOffset < 0) - uProp = UI_FONTVERTICALPOSITION_SUBSCRIPT; - } - - SetPropertyVal(UI_PKEY_FontProperties_VerticalPositioning, uProp, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_VerticalPositioning, propvar); - } - - void PutFace(IPropertyStore* pStore) - { - PROPVARIANT propvar; - SetPropertyVal(UI_PKEY_FontProperties_Family, - dwMask & CFM_FACE ? szFaceName : L"", &propvar); - pStore->SetValue(UI_PKEY_FontProperties_Family, propvar); - } - - void PutSize(IPropertyStore* pStore) - { - PROPVARIANT propvar; - DECIMAL decVal; - - if ((dwMask & CFM_SIZE) != 0) - VarDecFromR8((DOUBLE)yHeight / TWIPS_PER_POINT, &decVal); - else - VarDecFromI4(0, &decVal); - - SetPropertyVal(UI_PKEY_FontProperties_Size, &decVal, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_Size, propvar); - } - - void PutColor(IPropertyStore* pStore) - { - if ((dwMask & CFM_COLOR) != 0) - if ((dwEffects & CFE_AUTOCOLOR) == 0) - { - SetPropertyVal(UI_PKEY_FontProperties_ForegroundColorType, UI_SWATCHCOLORTYPE_RGB, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_ForegroundColorType, propvar); - - SetPropertyVal(UI_PKEY_FontProperties_ForegroundColor, crTextColor, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_ForegroundColor, propvar); - } - else - { - SetPropertyVal(UI_PKEY_FontProperties_ForegroundColorType, UI_SWATCHCOLORTYPE_AUTOMATIC, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_ForegroundColorType, propvar); - } - } - - void PutBackColor(IPropertyStore* pStore) - { - if (((dwMask & CFM_BACKCOLOR) != 0) && ((dwEffects & CFE_AUTOBACKCOLOR) == 0)) - { - SetPropertyVal(UI_PKEY_FontProperties_BackgroundColorType, UI_SWATCHCOLORTYPE_RGB, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_BackgroundColorType, propvar); - - SetPropertyVal(UI_PKEY_FontProperties_BackgroundColor, crBackColor, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_BackgroundColor, propvar); - } - else - { - SetPropertyVal(UI_PKEY_FontProperties_BackgroundColorType, UI_SWATCHCOLORTYPE_NOCOLOR, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_BackgroundColorType, propvar); - } - } -}; - -// IUIImage helper -// -inline IUIImage* GetImage(HBITMAP hbm, UI_OWNERSHIP owner) -{ - ATLASSERT(hbm); - IUIImage* pIUII = NULL; - ATL::CComPtr pIFB; - - if SUCCEEDED(pIFB.CoCreateInstance(CLSID_UIRibbonImageFromBitmapFactory)) - ATLVERIFY(SUCCEEDED(pIFB->CreateImage(hbm, owner, &pIUII))); - - return pIUII; -} - - -/////////////////////////////////////////////////////////////////////////////// -// Ribbon control classes - -// RibbonUI::ICtrl abstract interface of RibbonUI::CRibbonImpl and all RibbonUI control classes -// -struct ICtrl -{ - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* pCommandExecutionProperties) = 0; - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) = 0; -}; - -// RibbonUI::CtrlImpl base class for all ribbon controls -// -template -class ATL_NO_VTABLE CtrlImpl : public ICtrl -{ -protected: - T* m_pWndRibbon; - -public: - typedef T WndRibbon; - - CtrlImpl() : m_pWndRibbon(T::pWndRibbon) - { } - - WndRibbon& GetWndRibbon() - { - return *m_pWndRibbon; - } - - static WORD GetID() - { - return t_ID; - } - - Text m_sTxt[5]; - - // Operations - HRESULT Invalidate() - { - return GetWndRibbon().InvalidateCtrl(GetID()); - } - - HRESULT Invalidate(REFPROPERTYKEY key, UI_INVALIDATIONS flags = UI_INVALIDATIONS_PROPERTY) - { - return GetWndRibbon().InvalidateProperty(GetID(), key, flags); - } - - HRESULT SetText(REFPROPERTYKEY key, LPCWSTR sTxt, bool bUpdate = false) - { - ATLASSERT((k_(key) <= k_TooltipTitle) && (k_(key) >= k_LabelDescription)); - - m_sTxt[k_(key) - k_LabelDescription] = sTxt; - - return bUpdate ? - GetWndRibbon().InvalidateProperty(GetID(), key) : - S_OK; - } - - // Implementation - template - HRESULT SetProperty(REFPROPERTYKEY key, V val) - { - return GetWndRibbon().SetProperty(GetID(), key, val); - } - - HRESULT OnGetText(REFPROPERTYKEY key, PROPVARIANT* ppv) - { - ATLASSERT((k_(key) <= k_TooltipTitle) && (k_(key) >= k_LabelDescription)); - - const INT iText = k_(key) - k_LabelDescription; - if (m_sTxt[iText].IsEmpty()) - if (LPCWSTR sText = GetWndRibbon().OnRibbonQueryText(GetID(), key)) - m_sTxt[iText] = sText; - - return !m_sTxt[iText].IsEmpty() ? - SetPropertyVal(key, (LPCWSTR)m_sTxt[iText], ppv) : - S_OK; - } - - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* pCommandExecutionProperties) - { - ATLASSERT(nCmdID == t_ID); - return GetWndRibbon().DoExecute(nCmdID, verb, key, ppropvarValue, pCommandExecutionProperties); - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT(nCmdID == t_ID); - - const INT iMax = k_TooltipTitle - k_LabelDescription; - const INT iVal = k_(key) - k_LabelDescription; - - return (iVal <= iMax) && (iVal >= 0) ? - OnGetText(key, ppropvarNewValue) : - GetWndRibbon().DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - } -}; - -// CommandCtrlImpl base class for most ribbon controls -// -template -class CommandCtrlImpl : public CtrlImpl -{ -public: - CBitmap m_hbm[4]; - - HRESULT SetImage(REFPROPERTYKEY key, HBITMAP hbm, bool bUpdate = false) - { - ATLASSERT((k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage)); - - m_hbm[k_(key) - k_LargeImage].Attach(hbm); - - return bUpdate ? - GetWndRibbon().InvalidateProperty(GetID(), key) : - S_OK; - } - - HRESULT OnGetImage(REFPROPERTYKEY key, PROPVARIANT* ppv) - { - ATLASSERT((k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage)); - - const INT iImage = k_(key) - k_LargeImage; - - if (m_hbm[iImage].IsNull()) - m_hbm[iImage] = GetWndRibbon().OnRibbonQueryImage(GetID(), key); - - return m_hbm[iImage].IsNull() ? - E_NOTIMPL : - SetPropertyVal(key, GetImage(m_hbm[iImage], UI_OWNERSHIP_COPY), ppv); - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT (nCmdID == GetID()); - - return (k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage) ? - OnGetImage(key, ppropvarNewValue) : - CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Ribbon collection base classes - -// ItemProperty class: ribbon callback for each item in a collection -// -template -class ItemProperty : public IUISimplePropertySet -{ -public: - ItemProperty(UINT i, TCollection* pCollection) : m_Index(i), m_pCollection(pCollection) - { } - - const UINT m_Index; - TCollection* m_pCollection; - - // IUISimplePropertySet method. - STDMETHODIMP GetValue(REFPROPERTYKEY key, PROPVARIANT *value) - { - return m_pCollection->OnGetItem(m_Index, key, value); - } - - // IUnknown methods. - STDMETHODIMP_(ULONG) AddRef() - { - return 1; - } - - STDMETHODIMP_(ULONG) Release() - { - return 1; - } - - STDMETHODIMP QueryInterface(REFIID iid, void** ppv) - { - if ((iid == __uuidof(IUnknown)) || (iid == __uuidof(IUISimplePropertySet))) - { - *ppv = this; - return S_OK; - } - else - { - return E_NOINTERFACE; - } - } -}; - - -// CollectionImplBase: base class for all RibbonUI collections -// -template -class CollectionImplBase -{ - typedef CollectionImplBase thisClass; - -public: - CollectionImplBase() - { - for (int i = 0; i < t_size; i++) - m_apItems[i] = new ItemProperty(i, static_cast(this)); - } - - ~CollectionImplBase() - { - for (int i = 0; i < t_size; i++) - delete m_apItems[i]; - } - -// Data members - ItemProperty* m_apItems[t_size]; -}; - -// CollectionImpl: handles categories and collecton resizing -// -template -class CollectionImpl : public CollectionImplBase, t_items + t_categories> -{ - typedef CollectionImpl thisClass; -public: - typedef thisClass Collection; - - CollectionImpl() : m_size(t_items) - { - FillMemory(m_auItemCat, sizeof m_auItemCat, 0xff); // UI_COLLECTION_INVALIDINDEX - } - - UINT32 m_auItemCat[t_items]; - Text m_asCatName[max(t_categories, 1)]; - size_t m_size; - -// Operations - HRESULT SetItemCategory(UINT uItem, UINT uCat, bool bUpdate = false) - { - ATLASSERT((uItem < t_items) && (uCat < t_categories)); - - m_auItemCat[uItem] = uCat; - - return bUpdate ? InvalidateItems() : S_OK; - } - - HRESULT SetCategoryText(UINT uCat, LPCWSTR sText, bool bUpdate = false) - { - ATLASSERT(uCat < t_categories); - - m_asCatName[uCat] = sText; - - return bUpdate ? InvalidateCategories() : S_OK; - } - - HRESULT Resize(size_t size, bool bUpdate = false) - { - ATLASSERT(size <= t_items); - - m_size = size; - - return bUpdate ? InvalidateItems() : S_OK; - } - -// Implementation - HRESULT OnGetItem(UINT uIndex, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(uIndex < t_items + t_categories); - TCtrl* pCtrl = static_cast(this); - - return uIndex < t_items ? - pCtrl->DoGetItem(uIndex, key, value) : - pCtrl->DoGetCategory(uIndex - t_items, key, value); - } - - HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(k_(key) == k_CategoryId); - UINT32 uCat = UI_COLLECTION_INVALIDINDEX; - - if (t_categories != 0) - { - if (m_auItemCat[uItem] == UI_COLLECTION_INVALIDINDEX) - { - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - m_auItemCat[uItem] = ribbon.OnRibbonQueryItemCategory(TCtrl::GetID(), uItem); - } - uCat = m_auItemCat[uItem]; - } - - return SetPropertyVal(key, uCat, value); - } - - HRESULT DoGetCategory(UINT uCat, REFPROPERTYKEY key, PROPVARIANT *value) - { - HRESULT hr = S_OK; - - switch (k_(key)) - { - case k_Label: - if (m_asCatName[uCat].IsEmpty()) - { - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - m_asCatName[uCat] = ribbon.OnRibbonQueryCategoryText(TCtrl::GetID(), uCat); - } - hr = SetPropertyVal(key, (LPCWSTR)m_asCatName[uCat], value); - break; - case k_CategoryId: - hr = SetPropertyVal(key, uCat, value); - break; - default: - ATLASSERT(FALSE); - break; - } - - return hr; - } - - HRESULT InvalidateItems() - { - return static_cast(this)->Invalidate(UI_PKEY_ItemsSource); - } - - HRESULT InvalidateCategories() - { - return static_cast(this)->Invalidate(UI_PKEY_Categories); - } - - HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* /*ppropvarNewValue*/) - { - ATLASSERT(nCmdID == TCtrl::GetID()); - nCmdID; // avoid level 4 warning - - HRESULT hr = E_NOTIMPL; - switch (k_(key)) - { - case k_ItemsSource: - { - ATL::CComQIPtr pIUICollection(ppropvarCurrentValue->punkVal); - ATLASSERT(pIUICollection); - hr = pIUICollection->Clear(); - for (UINT i = 0; i < m_size; i++) - { - if FAILED(hr = pIUICollection->Add(m_apItems[i])) - break; - } - ATLASSERT(SUCCEEDED(hr)); - } - break; - case k_Categories: - if (t_categories != 0) - { - ATL::CComQIPtr pIUICategory(ppropvarCurrentValue->punkVal); - ATLASSERT(pIUICategory.p); - hr = pIUICategory->Clear(); - for (UINT i = t_items; i < t_items + t_categories; i++) - { - if FAILED(hr = pIUICategory->Add(m_apItems[i])) - break; - } - ATLASSERT(SUCCEEDED(hr)); - } - break; - } - - return hr; - } -}; - -// TextCollectionImpl: handles item labels and selection -// -template -class TextCollectionImpl : public CollectionImpl -{ - typedef TextCollectionImpl thisClass; -public: - typedef thisClass TextCollection; - - TextCollectionImpl() : m_uSelected(UI_COLLECTION_INVALIDINDEX) - { } - - Text m_asText[t_items]; - UINT m_uSelected; - - // Operations - HRESULT SetItemText(UINT uItem, LPCWSTR sText, bool bUpdate = false) - { - ATLASSERT(uItem < t_items); - - m_asText[uItem] = sText; - - return bUpdate ? InvalidateItems() : S_OK; - } - - UINT GetSelected() - { - return m_uSelected; - } - - HRESULT Select(UINT uItem, bool bUpdate = false) - { - ATLASSERT((uItem < t_items) || (uItem == UI_COLLECTION_INVALIDINDEX)); - - m_uSelected = uItem; - - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - return bUpdate ? - ribbon.SetProperty(TCtrl::GetID(), UI_PKEY_SelectedItem, uItem) : - S_OK; - } - -// Implementation - HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(uItem < t_items); - - if (k_(key) == k_Label) - { - if (m_asText[uItem].IsEmpty()) - { - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - m_asText[uItem] = ribbon.OnRibbonQueryItemText(TCtrl::GetID(), uItem); - } - return SetPropertyVal(key, (LPCWSTR)m_asText[uItem], value); - } - else - { - return Collection::DoGetItem(uItem, key, value); - } - } - - HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT(nCmdID == TCtrl::GetID()); - - if (k_(key) == k_SelectedItem) - { - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - UINT uSel = UI_COLLECTION_INVALIDINDEX; - if ((m_uSelected == UI_COLLECTION_INVALIDINDEX) && - ribbon.OnRibbonQuerySelectedItem(TCtrl::GetID(), uSel)) - m_uSelected = uSel; - - return SetPropertyVal(key, m_uSelected, ppropvarNewValue); - } - else - { - return Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - } - } -}; - -// ItemCollectionImpl: handles item image -// -template -class ItemCollectionImpl : public TextCollectionImpl -{ - typedef ItemCollectionImpl thisClass; -public: - typedef thisClass ItemCollection; - - ItemCollectionImpl() - { - ZeroMemory(m_aBitmap, sizeof m_aBitmap); - } - - CBitmap m_aBitmap[t_items]; - - // Operations - HRESULT SetItemImage(UINT uIndex, HBITMAP hbm, bool bUpdate = false) - { - ATLASSERT(uIndex < t_items); - - m_aBitmap[uIndex] = hbm; - - return bUpdate ? InvalidateItems() : S_OK; - } - -// Implementation - HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(uItem < t_items); - - if (k_(key) == k_ItemImage) - { - if (m_aBitmap[uItem].IsNull()) - { - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - m_aBitmap[uItem] = ribbon.OnRibbonQueryItemImage(TCtrl::GetID(), uItem); - } - return m_aBitmap[uItem].IsNull() ? - E_NOTIMPL : - SetPropertyVal(key, GetImage(m_aBitmap[uItem], UI_OWNERSHIP_COPY), value); - } - else - { - return TextCollection::DoGetItem(uItem, key, value); - } - } -}; - -// ComboCollectionImpl: handles combo text -// -template -class ComboCollectionImpl : public ItemCollectionImpl -{ - typedef ComboCollectionImpl thisClass; -public: - typedef thisClass ComboCollection; - - // Operations - HRESULT SetComboText(LPCWSTR sText) - { - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - return ribbon.IsRibbonUI() ? - ribbon.SetProperty(TCtrl::GetID(), UI_PKEY_StringValue, sText) : - S_OK; - } - - LPCWSTR GetComboText() - { - static WCHAR sCombo[RIBBONUI_MAX_TEXT] = { 0 }; - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - PROPVARIANT var; - if (ribbon.IsRibbonUI()) - { - HRESULT hr = ribbon.GetIUIFrameworkPtr()->GetUICommandProperty(TCtrl::GetID(), UI_PKEY_StringValue, &var); - hr = PropVariantToString(var, sCombo, RIBBONUI_MAX_TEXT); - return sCombo; - } - return NULL; - } -}; - -// CommandCollectionImpl: handles RibbonUI command collection controls -// -template -class CommandCollectionImpl : public CollectionImpl -{ - typedef CommandCollectionImpl thisClass; -public: - typedef thisClass CommandCollection; - - CommandCollectionImpl() - { - ZeroMemory(m_auCmd, sizeof m_auCmd); - ZeroMemory(m_aCmdType, sizeof m_aCmdType); - } - - UINT32 m_auCmd[t_items]; - BYTE m_aCmdType[t_items]; - - // Operations - HRESULT SetItemCommand(UINT uItem, UINT32 uCommandID, bool bUpdate = false) - { - ATLASSERT(uItem < t_items); - - if (uCommandID == m_auCmd[uItem]) - return S_OK; - - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - - m_auCmd[uItem] = uCommandID; - if (uCommandID != 0) - ribbon.UIAddRibbonElement(uCommandID); - - return bUpdate ? InvalidateItems() : S_OK; - } - - HRESULT SetItemCommandType(UINT uItem, UI_COMMANDTYPE type, bool bUpdate = false) - { - ATLASSERT(uItem < t_items); - - m_aCmdType[uItem] = (BYTE)type; - - return bUpdate ? InvalidateItems() : S_OK; - } - -// Implementation - HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(uItem < t_items); - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - - HRESULT hr = E_FAIL; - switch (k_(key)) - { - case k_CommandId: - if (m_auCmd[uItem] == 0) - SetItemCommand(uItem, ribbon.OnRibbonQueryItemCommand(TCtrl::GetID(), uItem)); - hr = SetPropertyVal(key, m_auCmd[uItem], value); - break; - case k_CommandType: - if (m_aCmdType[uItem] == UI_COMMANDTYPE_UNKNOWN) - SetItemCommandType(uItem, ribbon.OnRibbonQueryItemCommandType(TCtrl::GetID(), uItem)); - hr = SetPropertyVal(key, UINT32(m_aCmdType[uItem]), value); - break; - case k_CategoryId: - default: - hr = Collection::DoGetItem(uItem, key, value); - break; - } - - return hr; - } - - HRESULT Select(UINT /*uItem*/, bool /*bUpdate*/ = false) - { - ATLASSERT(FALSE); - return S_OK; - } -}; - -// SimpleCollectionImpl: collection class for ribbon simple collection controls -// -template -class SimpleCollectionImpl : public CollectionImplBase, t_size> -{ - typedef SimpleCollectionImpl thisClass; -public: - typedef CollectionImplBase CollectionBase; - typedef thisClass SimpleCollection; - -// Implementation - HRESULT OnGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(uItem < t_size); - TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); - - HRESULT hr = E_NOTIMPL; - switch (k_(key)) - { - case k_ItemImage: - if (HBITMAP hbm = ribbon.DefRibbonQueryItemImage(TCtrl::GetID(), uItem)) - hr = SetPropertyVal(key, GetImage(hbm, UI_OWNERSHIP_TRANSFER), value); - break; - case k_Label: - if (LPCWSTR sText = ribbon.DefRibbonQueryItemText(TCtrl::GetID(), uItem)) - hr = SetPropertyVal(key, (LPCWSTR)sText, value); - break; - case k_CommandType: - hr = SetPropertyVal(key, t_CommandType, value); - break; - case k_CommandId: - hr = SetPropertyVal(key, ribbon.DefRibbonQueryItemCommand(TCtrl::GetID(), uItem), value); - break; - case k_CategoryId: - hr = SetPropertyVal(key, UI_COLLECTION_INVALIDINDEX, value); - break; - default: - ATLASSERT(FALSE); - break; - } - - return hr; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Ribbon collection control classes - -// CollectionCtrlImpl: specializable class for ribbon collection controls -// -template -class CollectionCtrlImpl : public CommandCtrlImpl, public TCollection -{ - typedef CollectionCtrlImpl thisClass; -public: - typedef CommandCtrlImpl CommandCtrl; - typedef TCollection Collection; - - // Implementation - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT(nCmdID == GetID()); - ATLASSERT(ppropvarNewValue); - - HRESULT hr = Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - if FAILED(hr) - hr = CommandCtrl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - - return hr; - } - - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* /*pCommandExecutionProperties*/) - { - ATLASSERT (nCmdID == GetID()); - nCmdID; // avoid level4 warning - - if (key == NULL) // gallery button pressed - { - GetWndRibbon().OnRibbonItemSelected(GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); - return S_OK; - } - - ATLASSERT(k_(*key) == k_SelectedItem); - ATLASSERT(ppropvarValue); - - HRESULT hr = S_OK; - UINT32 uSel = 0xffff; - hr = UIPropertyToUInt32(*key, *ppropvarValue, &uSel); - - if (SUCCEEDED(hr)) - { - if (GetWndRibbon().OnRibbonItemSelected(GetID(), verb, uSel)) - TCollection::Select(uSel); - } - - return hr; - } -}; - -// ToolbarGalleryCtrlImpl: base class for ribbon toolbar gallery controls -// -template -class ToolbarGalleryCtrlImpl : public CollectionCtrlImpl, t_size>> -{ -public: - ToolbarGalleryCtrlImpl() - { - CResource tbres; - ATLVERIFY(tbres.Load(RT_TOOLBAR, t_idTB)); - _AtlToolBarData* pData = (_AtlToolBarData*)tbres.Lock(); - ATLASSERT(pData); - ATLASSERT(pData->wVersion == 1); - - WORD* pItems = pData->items(); - INT j = 0; - for (int i = 0; (i < pData->wItemCount) && (j < t_size); i++) - { - if (pItems[i] != 0) - { - m_aCmdType[j] = UI_COMMANDTYPE_ACTION; - m_auCmd[j++] = pItems[i]; - } - } - - if (j < t_size) - Resize(j); - } - - HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT(uItem < m_size); - ATLASSERT(m_auCmd[uItem]); - - HRESULT hr = E_FAIL; - switch (k_(key)) - { - case k_CommandId: - hr = SetPropertyVal(key, m_auCmd[uItem], value); - break; - case k_CommandType: - hr = SetPropertyVal(key, UINT32(m_aCmdType[uItem]), value); - break; - case k_CategoryId: - hr = SetPropertyVal(key, UI_COLLECTION_INVALIDINDEX, value); - break; - default: - ATLASSERT(FALSE); - break; - } - - return hr; - } -}; - - -// SimpleCollectionCtrlImpl: base class for simple gallery and listbox controls -// -template -class SimpleCollectionCtrlImpl : - public CommandCtrlImpl, - public SimpleCollectionImpl, t_size, t_CommandType> -{ - typedef SimpleCollectionCtrlImpl thisClass; -public: - typedef thisClass SimpleCollection; - - SimpleCollectionCtrlImpl() : m_uSelected(0) - { } - - UINT m_uSelected; - - HRESULT Select(UINT uItem, bool bUpdate = false) - { - ATLASSERT((uItem < t_size) || (uItem == UI_COLLECTION_INVALIDINDEX)); - - m_uSelected = uItem; - - return bUpdate ? - GetWndRibbon().SetProperty(GetID(), UI_PKEY_SelectedItem, uItem) : - S_OK; - } - - // Implementation - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT(nCmdID == GetID()); - ATLASSERT(ppropvarNewValue != NULL); - - HRESULT hr = S_OK; - switch (k_(key)) - { - case k_ItemsSource: - { - ATL::CComQIPtr pIUICollection(ppropvarCurrentValue->punkVal); - ATLASSERT(pIUICollection.p); - hr = pIUICollection->Clear(); - for (UINT i = 0; i < t_size; i++) - { - if FAILED(hr = pIUICollection->Add(m_apItems[i])) - break; - } - ATLASSERT(SUCCEEDED(hr)); - } - break; - case k_SelectedItem: - hr = SetPropertyVal(UI_PKEY_SelectedItem, m_uSelected, ppropvarNewValue); - break; - default: - hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - break; - } - - return hr; - } - - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* /*pCommandExecutionProperties*/) - { - ATLASSERT (nCmdID == GetID()); - nCmdID; // avoid level 4 warning - - HRESULT hr = S_OK; - if (key == NULL) // gallery button pressed - { - GetWndRibbon().OnRibbonItemSelected(GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); - return hr; - } - ATLASSERT(k_(*key) == k_SelectedItem); - ATLASSERT(ppropvarValue); - - if SUCCEEDED(hr = UIPropertyToUInt32(*key, *ppropvarValue, &m_uSelected)) - GetWndRibbon().OnRibbonItemSelected(GetID(), verb, m_uSelected); - - return hr; - } -}; - -// RecentItemsCtrlImpl -// -template -class RecentItemsCtrlImpl : - public CtrlImpl, - public CollectionImplBase, TDocList::m_nMaxEntries_Max>, - public TDocList -{ - typedef RecentItemsCtrlImpl thisClass; -public: - typedef thisClass RecentItems; - - // Implementation - HRESULT OnGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) - { - ATLASSERT((INT)uItem < GetMaxEntries()); - - LPCWSTR sPath = m_arrDocs[uItem].szDocName; - HRESULT hr = E_NOTIMPL; - switch (k_(key)) - { - case k_Label: - hr = SetPropertyVal(key, GetWndRibbon().OnRibbonQueryRecentItemName(sPath), value); - break; - case k_LabelDescription: - hr = SetPropertyVal(key, sPath, value); - break; - default: - ATLASSERT(FALSE); - break; - } - - return hr; - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT(nCmdID == GetID()); - ATLASSERT(ppropvarNewValue); - - HRESULT hr = S_OK; - switch (k_(key)) - { - case k_RecentItems: - if (SAFEARRAY* psa = SafeArrayCreateVector(VT_UNKNOWN, 0, m_arrDocs.GetSize())) - { - const int iLastIndex = m_arrDocs.GetSize() - 1; - for (LONG i = 0; i <= iLastIndex; i++) - SafeArrayPutElement(psa, &i, m_apItems[iLastIndex - i]); // reverse order - - hr = SetPropertyVal(key, psa, ppropvarNewValue); - SafeArrayDestroy(psa); - } - break; - default: - hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - break; - } - - return hr; - } - - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* /*pCommandExecutionProperties*/) - { - ATLASSERT(nCmdID == GetID()); - nCmdID; // avoid level 4 warning - ATLASSERT(verb == UI_EXECUTIONVERB_EXECUTE); - verb; // avoid level 4 warning - ATLASSERT((key) && (k_(*key) == k_SelectedItem)); - ATLASSERT(ppropvarValue); - - UINT32 uSel = 0xffff; - HRESULT hr = UIPropertyToUInt32(*key, *ppropvarValue, &uSel); - if SUCCEEDED(hr) - { - ATLASSERT(uSel < (UINT)GetMaxEntries()); - GetWndRibbon().DefCommandExecute(ID_FILE_MRU_FIRST + uSel); - } - - return hr; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Ribbon stand-alone control classes - -// FontCtrlImpl -// -template -class FontCtrlImpl : public CtrlImpl -{ -public: - - CharFormat m_cf; - -// Implementation - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* pCommandExecutionProperties) - { - ATLASSERT (nCmdID == GetID()); - nCmdID; // avoid level 4 warning - ATLASSERT ((key) && (k_(*key) == k_FontProperties)); - key; // avoid level 4 warning - - HRESULT hr = E_INVALIDARG; - switch (verb) - { - case UI_EXECUTIONVERB_PREVIEW: - case UI_EXECUTIONVERB_EXECUTE: - ATLASSERT(pCommandExecutionProperties); - PROPVARIANT propvar; - - if (SUCCEEDED(hr = pCommandExecutionProperties->GetValue(UI_PKEY_FontProperties_ChangedProperties, &propvar))) - m_cf << ATL::CComQIPtr(propvar.punkVal); - break; - - case UI_EXECUTIONVERB_CANCELPREVIEW: - ATLASSERT(ppropvarValue); - ATL::CComPtr pStore; - - if (SUCCEEDED(hr = UIPropertyToInterface(UI_PKEY_FontProperties, *ppropvarValue, &pStore))) - m_cf << pStore; - break; - } - - if (SUCCEEDED(hr)) - GetWndRibbon().OnRibbonFontCtrlExecute(GetID(), verb, &m_cf); - else - ATLASSERT(FALSE); - - return hr; - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - if ((k_(key) == k_FontProperties) && (GetWndRibbon().OnRibbonQueryFont(t_ID, m_cf))) - { - ATL::CComQIPtr pStore(ppropvarCurrentValue->punkVal); - m_cf >> pStore; - return SetPropertyVal(key, pStore.p, ppropvarNewValue); - } - else - { - return CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - } - } -}; - -// ColorCtrlImpl -// -template -class ColorCtrlImpl : public CommandCtrlImpl -{ -public: - ColorCtrlImpl() : m_colorType(UI_SWATCHCOLORTYPE_NOCOLOR), m_color(0x800080) /*MAGENTA*/ - { } - - COLORREF m_color; - UINT32 m_colorType; // value in UI_SWATCHCOLORTYPE - Text m_sLabels[6]; // k_MoreColorsLabel to k_ThemeColorsCategoryLabel - ATL::CSimpleArray m_aColors[2]; - ATL::CSimpleArray m_aTooltips[2]; - - // Operations - HRESULT SetColor(COLORREF color, bool bUpdate = false) - { - if (m_colorType != UI_SWATCHCOLORTYPE_RGB) - SetColorType(UI_SWATCHCOLORTYPE_RGB, bUpdate); - m_color = color; - return bUpdate ? SetProperty(UI_PKEY_Color, color) : S_OK; - } - - HRESULT SetColorType(UI_SWATCHCOLORTYPE type, bool bUpdate = false) - { - m_colorType = type; - return bUpdate ? SetProperty(UI_PKEY_ColorType, type) : S_OK; - } - - HRESULT SetColorLabel(REFPROPERTYKEY key, LPCWSTR sLabel, bool bUpdate = false) - { - ATLASSERT((k_(key) >= k_ThemeColorsCategoryLabel) && (k_(key) <= k_MoreColorsLabel)); - m_sLabels[k_(key) - k_ThemeColorsCategoryLabel] = sLabel; - return bUpdate ? SetProperty(key, sLabel) : S_OK; - } - - HRESULT SetColorArray(REFPROPERTYKEY key, COLORREF* pColor, bool bUpdate = false) - { - ATLASSERT((k_(key) == k_ThemeColors) || (k_(key) == k_StandardColors)); - - const INT ic = k_(key) - k_ThemeColors; - m_aColors[ic].RemoveAll(); - while (*pColor != 0x800080) /*MAGENTA*/ - m_aColors[ic].Add(*pColor++); - - if (bUpdate) - { - PROPVARIANT var; - if SUCCEEDED(InitPropVariantFromUInt32Vector(m_aColors[ic].GetData(), m_aColors[ic].GetSize(), &var)) - return SetProperty(key, var); - else - return E_INVALIDARG; - } - else - { - return S_OK; - } - } - - HRESULT SetColorTooltips(REFPROPERTYKEY key, LPCWSTR* ppsTT, bool bUpdate = false) - { - ATLASSERT((k_(key) == k_ThemeColorsTooltips) || (k_(key) == k_StandardColorsTooltips)); - - const INT ic = k_(key) - k_ThemeColorsTooltips; - m_aTooltips[ic].RemoveAll(); - while (*ppsTT) - m_aTooltips[ic].Add(*ppsTT++); - - if (bUpdate) - { - PROPVARIANT var; - if SUCCEEDED(InitPropVariantFromStringVector(m_aTooltips[ic].GetData(), m_aTooltips[ic].GetSize(), &var)) - return SetProperty(key, var); - else - return E_INVALIDARG; - } - else - { - return S_OK; - } - } - - // Implementation - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* pCommandExecutionProperties) - { - ATLASSERT (nCmdID == GetID()); - nCmdID; // avoid level 4 warning - ATLASSERT (key && (k_(*key) == k_ColorType)); - key; // avoid level 4 warning - ATLASSERT (ppropvarValue); - - HRESULT hr = PropVariantToUInt32(*ppropvarValue, &m_colorType); - ATLASSERT(SUCCEEDED(hr)); - - if (SUCCEEDED(hr) && (m_colorType == UI_SWATCHCOLORTYPE_RGB)) - { - ATLASSERT(pCommandExecutionProperties); - PROPVARIANT var; - if SUCCEEDED(hr = pCommandExecutionProperties->GetValue(UI_PKEY_Color, &var)) - hr = PropVariantToUInt32(var, &m_color); - } - - if SUCCEEDED(hr) - GetWndRibbon().OnRibbonColorCtrlExecute(GetID(), verb, (UI_SWATCHCOLORTYPE)m_colorType/*uType*/, m_color); - else - ATLASSERT(FALSE); // something was wrong - - return hr; - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT (nCmdID == GetID()); - - HRESULT hr = E_NOTIMPL; - - switch (k_(key)) - { - case k_ColorType: - hr = SetPropertyVal(key, m_colorType, ppropvarNewValue); - break; - case k_Color: - if (m_color == 0x800080) /*MAGENTA*/ - m_color = GetWndRibbon().OnRibbonQueryColor(GetID()); - hr = SetPropertyVal(key, m_color, ppropvarNewValue); - break; - case k_ColorMode: - break; - case k_ThemeColorsCategoryLabel: - case k_StandardColorsCategoryLabel: - case k_RecentColorsCategoryLabel: - case k_AutomaticColorLabel: - case k_NoColorLabel: - case k_MoreColorsLabel: - { - const UINT iLabel = k_(key) - k_ThemeColorsCategoryLabel; - if (m_sLabels[iLabel].IsEmpty()) - if (LPCWSTR psLabel = GetWndRibbon().OnRibbonQueryColorLabel(GetID(), key)) - m_sLabels[iLabel] = psLabel; - if (!m_sLabels[iLabel].IsEmpty()) - hr = SetPropertyVal(key, (LPCWSTR)m_sLabels[iLabel], ppropvarNewValue); - } - break; - case k_ThemeColors: - case k_StandardColors: - { - const INT ic = k_(key) - k_ThemeColors; - if (!m_aColors[ic].GetSize()) - if (COLORREF* pColor = GetWndRibbon().OnRibbonQueryColorArray(GetID(), key)) - SetColorArray(key, pColor); - if (INT iMax = m_aColors[ic].GetSize()) - hr = InitPropVariantFromUInt32Vector(m_aColors[ic].GetData(), iMax, ppropvarNewValue); - } - break; - case k_ThemeColorsTooltips: - case k_StandardColorsTooltips: - { - const INT ic = k_(key) - k_ThemeColorsTooltips; - if (m_aTooltips[ic].GetSize() == 0) - if (LPCWSTR* ppsTT = GetWndRibbon().OnRibbonQueryColorTooltips(GetID(), key)) - SetColorTooltips(key, ppsTT); - if (INT iMax = m_aTooltips[ic].GetSize()) - hr = InitPropVariantFromStringVector(m_aTooltips[ic].GetData(), iMax, ppropvarNewValue); - } - break; - default: - hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - break; - } - - return hr; - } -}; - -// SpinnerCtrlImpl -// -template -class SpinnerCtrlImpl : public CtrlImpl -{ -public: - SpinnerCtrlImpl() - { - m_Values[0] = m_Values[2] = m_Values[4] = 0; - m_Values[1] = 100; - m_Values[3] = 1; - } - - V m_Values[5]; - // k_DecimalValue = 201, k_MaxValue = 203, k_MinValue, k_Increment, k_DecimalPlaces - - Text m_FormatString; - Text m_RepresentativeString; - - // Operations - HRESULT SetDecimalPlaces(V vPlaces, bool bUpdate = false) - { - return SetValue(UI_PKEY_DecimalPlaces, vPlaces, bUpdate); - } - - HRESULT SetMin(V vMin, bool bUpdate = false) - { - return SetValue(UI_PKEY_MinValue, vMin, bUpdate); - } - - HRESULT SetMax(V vMax, bool bUpdate = false) - { - return SetValue(UI_PKEY_MaxValue, vMax, bUpdate); - } - - HRESULT SetVal(V vVal, bool bUpdate = false) - { - return SetValue(UI_PKEY_DecimalValue, vVal, bUpdate); - } - - HRESULT SetIncrement(V vIncrement, bool bUpdate = false) - { - return SetValue(UI_PKEY_Increment, vIncrement, bUpdate); - } - - HRESULT SetFormatString(LPCWSTR sFormat, bool bUpdate = false) - { - return SetText(UI_PKEY_FormatString, sFormat, bUpdate); - } - - HRESULT SetRepresentativeString(LPCWSTR sRepresentative, bool bUpdate = false) - { - return SetText(UI_PKEY_RepresentativeString, sRepresentative, bUpdate); - } - - // Implementation - HRESULT SetText(REFPROPERTYKEY key, LPCWSTR sText, bool bUpdate = false) - { - switch (k_(key)) - { - case k_FormatString: - m_FormatString = sText; - break; - case k_RepresentativeString: - m_RepresentativeString = sText; - break; - default: - return CtrlImpl::SetText(key, sText, bUpdate); - } - - return bUpdate ? - GetWndRibbon().InvalidateProperty(GetID(), key) : - S_OK; - } - - HRESULT SetValue(REFPROPERTYKEY key, V val, bool bUpdate = false) - { - ATLASSERT((k_(key) <= k_DecimalPlaces) && (k_(key) >= k_DecimalValue)); - - const INT iVal = k_(key) == k_DecimalValue ? 0 : k_(key) - k_StringValue; - m_Values[iVal] = val; - - if (bUpdate) - { - if(k_(key) == k_DecimalValue) - { - DECIMAL decVal; - InitDecimal(val, &decVal); - return SetProperty(key, &decVal); - } - else - { - return GetWndRibbon().InvalidateProperty(GetID(), key); - } - } - else - { - return S_OK; - } - } - - HRESULT QueryValue(REFPROPERTYKEY key, LONG* plVal) - { - return GetWndRibbon().OnRibbonQuerySpinnerValue(GetID(), key, plVal); - } - - HRESULT QueryValue(REFPROPERTYKEY key, DOUBLE* pdVal) - { - return GetWndRibbon().OnRibbonQueryFloatSpinnerValue(GetID(), key, pdVal); - } - - HRESULT OnGetValue(REFPROPERTYKEY key, PROPVARIANT* ppv) - { - ATLASSERT((k_(key) <= k_DecimalPlaces) && (k_(key) >= k_DecimalValue)); - - const INT iVal = k_(key) == k_DecimalValue ? 0 : k_(key) - k_StringValue; - - QueryValue(key, m_Values + iVal); - - if (k_(key) == k_DecimalPlaces) - { - return SetPropertyVal(key, m_Values[iVal], ppv); - } - else - { - DECIMAL decVal; - InitDecimal(m_Values[iVal], &decVal); - return SetPropertyVal(key, &decVal, ppv); - } - } - - HRESULT OnGetText(REFPROPERTYKEY key, Text& sVal, PROPVARIANT* ppv) - { - if (LPCWSTR sNew = GetWndRibbon().OnRibbonQueryText(GetID(), key)) - sVal = sNew; - return SetPropertyVal(key, (LPCWSTR)sVal, ppv); - } - - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* /*pCommandExecutionProperties*/) - { - ATLASSERT (nCmdID == GetID()); - nCmdID; // avoid level 4 warning - ATLASSERT (key && (k_(*key) == k_DecimalValue)); - key; // avoid level 4 warning - ATLASSERT (verb == UI_EXECUTIONVERB_EXECUTE); - verb; // avoid level 4 warning - - DECIMAL decVal; - - HRESULT hr = UIPropertyToDecimal(UI_PKEY_DecimalValue, *ppropvarValue, &decVal); - hr = InitVal(m_Values[0], &decVal); - - GetWndRibbon().OnRibbonSpinnerCtrlExecute(GetID(), &m_Values[0]); - - return hr; - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - ATLASSERT (nCmdID == GetID()); - - HRESULT hr = E_NOTIMPL; - switch (k_(key)) - { - case k_DecimalPlaces: - case k_DecimalValue: - case k_Increment: - case k_MaxValue: - case k_MinValue: - hr = OnGetValue(key, ppropvarNewValue); - break; - case k_FormatString: - if (m_FormatString.IsEmpty()) - return OnGetText(key, m_FormatString, ppropvarNewValue); - break; - case k_RepresentativeString: - if (m_RepresentativeString.IsEmpty()) - return OnGetText(key, m_RepresentativeString, ppropvarNewValue); - break; - default: - hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - break; - } - - return hr; - } - - // decimal conversion helpers - static HRESULT InitDecimal(LONG& val, DECIMAL* pDecimal) - { - return ::VarDecFromI4(val, pDecimal); - } - - static HRESULT InitDecimal(DOUBLE& val, DECIMAL* pDecimal) - { - return ::VarDecFromR8(val, pDecimal); - } - - static HRESULT InitVal(LONG& val, const DECIMAL* pDecimal) - { - return ::VarI4FromDec(pDecimal, &val); - } - - static HRESULT InitVal(DOUBLE& val, const DECIMAL* pDecimal) - { - return ::VarR8FromDec(pDecimal, &val); - } -}; - -// CRibbonImpl Ribbon implementation class -// -template -class CRibbonImpl : - public CRibbonUpdateUI, - public ICtrl, - public IUIApplication, - public IUICommandHandler -{ - typedef CRibbonImpl thisClass; -public: - typedef thisClass Ribbon; - typedef T WndRibbon; - - CRibbonImpl() : m_bRibbonUI(false), m_hgRibbonSettings(NULL) - { -#ifdef _DEBUG - m_cRef = 1; -#endif - pWndRibbon = static_cast(this); - HRESULT hr = ::CoInitialize(NULL); - if(SUCCEEDED(hr)) - if (RunTimeHelper::IsRibbonUIAvailable()) - hr = m_pIUIFramework.CoCreateInstance(CLSID_UIRibbonFramework); - else - ATLTRACE(L"Ribbon UI not available\n"); - - if FAILED(hr) - ATLTRACE(L"Ribbon construction failed\n"); - - ATLASSERT(SUCCEEDED(hr)); - } - - ~CRibbonImpl() - { - ::GlobalFree(m_hgRibbonSettings); - m_pIUIFramework.Release(); - ::CoUninitialize(); - } - - ICtrl& GetRibbonCtrl(UINT) - { - return static_cast(*this); - } - - ATL::CComPtr m_pIUIFramework; - HGLOBAL m_hgRibbonSettings; - bool m_bRibbonUI; - - bool IsRibbonUI() - { - return m_bRibbonUI; - } - - IUIFramework* GetIUIFrameworkPtr() - { - return m_pIUIFramework; - } - - template - I* GetRibbonViewPtr(UINT32 uID) - { - ATLASSERT(m_pIUIFramework); - ATL::CComPtr pI; - return m_pIUIFramework->GetView(uID, __uuidof(I), (void**) &pI) == S_OK ? - pI : - NULL; - } - - IUIRibbon* GetRibbonPtr() - { - return GetRibbonViewPtr(0); - } - - IUIContextualUI* GetMenuPtr(UINT32 uID) - { - ATLASSERT(uID); - return GetRibbonViewPtr(uID); - } - - UINT GetRibbonHeight() - { - ATLASSERT(IsRibbonUI()); - - UINT32 cy = 0; - if (ATL::CComPtr pIUIRibbon = GetRibbonPtr()) - pIUIRibbon->GetHeight(&cy); - return cy; - } - - HRESULT CreateRibbon(LPCWSTR sResName = L"APPLICATION_RIBBON") - { - T* pT = static_cast(this); - ATLASSERT(GetIUIFrameworkPtr() && !IsRibbonUI()); - ATLASSERT(pT->IsWindow()); - - HRESULT hr = m_pIUIFramework->Initialize(pT->m_hWnd, this); - - if (hr == S_OK) - hr = m_pIUIFramework->LoadUI(ModuleHelper::GetResourceInstance(), sResName); - - return hr; - } - - HRESULT DestroyRibbon() - { - T* pT = static_cast(this); - ATLASSERT(GetIUIFrameworkPtr() && IsRibbonUI()); - ATLASSERT(pT->IsWindow()); - - HRESULT hRes = m_pIUIFramework->Destroy(); - if (!RunTimeHelper::IsWin7()) - pT->SetWindowRgn(NULL, TRUE); // Vista Basic bug workaround - return hRes; - } - -// Ribbon persistency - HRESULT operator >>(IStream* pIStream) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(pIStream); - - HRESULT hr = E_FAIL; - if (ATL::CComPtr pIUIRibbon = GetRibbonPtr()) - { - const LARGE_INTEGER li0 = { 0 }; - pIStream->Seek(li0, STREAM_SEEK_SET, NULL); - hr = pIUIRibbon->SaveSettingsToStream(pIStream); - pIStream->Commit(STGC_DEFAULT); - } - - return hr; - } - - HRESULT operator <<(IStream* pIStream) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(pIStream); - - HRESULT hr = E_FAIL; - if (ATL::CComPtr pIUIRibbon = GetRibbonPtr()) - { - const LARGE_INTEGER li0 = { 0 }; - pIStream->Seek(li0, STREAM_SEEK_SET, NULL); - hr = pIUIRibbon->LoadSettingsFromStream(pIStream); - } - - return hr; - } - - void ResetRibbonSettings() - { - if (m_hgRibbonSettings != NULL) - { - ::GlobalFree(m_hgRibbonSettings); - m_hgRibbonSettings = NULL; - } - } - - HRESULT SaveRibbonSettings() - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(static_cast(this)->IsWindow()); - - HRESULT hr = E_FAIL; - ATL::CComPtr pIStream; - - if SUCCEEDED(hr = ::CreateStreamOnHGlobal(m_hgRibbonSettings, FALSE, &pIStream)) - hr = *this >> pIStream; - - if (SUCCEEDED(hr) && (m_hgRibbonSettings == NULL)) - hr = ::GetHGlobalFromStream(pIStream, &m_hgRibbonSettings); - - if FAILED(hr) - ResetRibbonSettings(); - - return hr; - } - - HRESULT RestoreRibbonSettings() - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(m_hgRibbonSettings); - ATLASSERT(static_cast(this)->IsWindow()); - - HRESULT hr = E_FAIL; - ATL::CComPtr pIStream; - - if SUCCEEDED(hr = ::CreateStreamOnHGlobal(m_hgRibbonSettings, FALSE, &pIStream)) - hr = *this << pIStream; - - if FAILED(hr) - ResetRibbonSettings(); - - return hr; - } - -// QAT dock states - UI_CONTROLDOCK GetQATDock() - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(IsRibbonUI()); - - UINT32 uDock = 0; - PROPVARIANT propvar; - ATL::CComQIPtrpIPS(GetRibbonPtr()); - - if ((pIPS != NULL) && SUCCEEDED(pIPS->GetValue(UI_PKEY_QuickAccessToolbarDock, &propvar)) && - SUCCEEDED(UIPropertyToUInt32(UI_PKEY_QuickAccessToolbarDock, propvar, &uDock))) - return (UI_CONTROLDOCK)uDock; - - ATLASSERT(FALSE); // something was wrong - return (UI_CONTROLDOCK)0; - } - - bool SetQATDock(UI_CONTROLDOCK dockState) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(IsRibbonUI()); - - PROPVARIANT propvar; - ATLVERIFY(SUCCEEDED(SetPropertyVal(UI_PKEY_QuickAccessToolbarDock, dockState, &propvar))); - - ATL::CComQIPtrpIPS(GetRibbonPtr()); - if ((pIPS != NULL) && SUCCEEDED(pIPS->SetValue(UI_PKEY_QuickAccessToolbarDock, propvar))) - { - pIPS->Commit(); - return true; - } - - ATLASSERT(FALSE); // something was wrong - return false; - } - -// Ribbon display states - bool GetRibbonDisplayState(REFPROPERTYKEY key) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(IsRibbonUI()); - ATLASSERT((k_(key) == k_Viewable) || (k_(key) == k_Minimized)); - - PROPVARIANT propvar; - ATL::CComQIPtrpIPS(GetRibbonPtr()); - - if ((pIPS != NULL) && SUCCEEDED(pIPS->GetValue(key, &propvar))) - { - BOOL bState = FALSE; - if SUCCEEDED(UIPropertyToBoolean(key, propvar, &bState)) - return (bState != FALSE); - } - - ATLASSERT(FALSE); // something was wrong - return false; - } - - bool SetRibbonDisplayState(REFPROPERTYKEY key, bool bState = true) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(IsRibbonUI()); - ATLASSERT((k_(key) == k_Viewable) || (k_(key) == k_Minimized)); - - PROPVARIANT propvar; - ATLVERIFY(SUCCEEDED(SetPropertyVal(key, bState, &propvar))); - - ATL::CComQIPtrpIPS(GetRibbonPtr()); - - if ((pIPS != NULL) && SUCCEEDED(pIPS->SetValue(key, propvar))) - { - pIPS->Commit(); - return true; - } - - ATLASSERT(FALSE); // something was wrong - return false; - } - - bool IsRibbonMinimized() - { - return GetRibbonDisplayState(UI_PKEY_Minimized); - } - - bool MinimizeRibbon(bool bMinimize = true) - { - return SetRibbonDisplayState(UI_PKEY_Minimized, bMinimize); - } - - bool IsRibbonHidden() - { - return !GetRibbonDisplayState(UI_PKEY_Viewable); - } - - bool HideRibbon(bool bHide = true) - { - return SetRibbonDisplayState(UI_PKEY_Viewable, !bHide); - } - -// Ribbon colors - UI_HSBCOLOR GetRibbonColor(REFPROPERTYKEY key) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(IsRibbonUI()); - ATLASSERT((k_(key) >= k_GlobalBackgroundColor) && (k_(key) <= k_GlobalTextColor)); - - PROPVARIANT propvar; - ATL::CComQIPtrpIPS(GetIUIFrameworkPtr()); - - if ((pIPS != NULL) && SUCCEEDED(pIPS->GetValue(key, &propvar))) - { - UINT32 color = 0; - if SUCCEEDED(UIPropertyToUInt32(key, propvar, &color)) - return color; - } - - ATLASSERT(FALSE); // something was wrong - return 0; - } - - bool SetRibbonColor(REFPROPERTYKEY key, UI_HSBCOLOR color) - { - ATLASSERT(GetIUIFrameworkPtr()); - ATLASSERT(IsRibbonUI()); - ATLASSERT((k_(key) >= k_GlobalBackgroundColor) && (k_(key) <= k_GlobalTextColor)); - - PROPVARIANT propvar; - ATLVERIFY(SUCCEEDED(SetPropertyVal(key, color, &propvar))); - - ATL::CComQIPtrpIPS(GetIUIFrameworkPtr()); - - if ((pIPS != NULL) && SUCCEEDED(pIPS->SetValue(key, propvar))) - { - pIPS->Commit(); - return true; - } - - ATLASSERT(FALSE); // something was wrong - return false; - } - -// Ribbon modes - HRESULT SetRibbonModes(INT32 iModes) - { - ATLASSERT(IsRibbonUI()); - return GetIUIFrameworkPtr()->SetModes(iModes); - } - -// Ribbon contextual tab - UI_CONTEXTAVAILABILITY GetRibbonContextAvail(UINT32 uID) - { - ATLASSERT(GetIUIFrameworkPtr()); - - PROPVARIANT propvar; - if (IsRibbonUI() && - SUCCEEDED(GetIUIFrameworkPtr()->GetUICommandProperty(uID, UI_PKEY_ContextAvailable, &propvar))) - { - UINT uav; - if (SUCCEEDED(PropVariantToUInt32(propvar, &uav))) - { - CUpdateUIBase::UIEnable(uID, uav != UI_CONTEXTAVAILABILITY_NOTAVAILABLE); - CUpdateUIBase::UISetCheck(uID, uav == UI_CONTEXTAVAILABILITY_ACTIVE); - return (UI_CONTEXTAVAILABILITY)uav; - } - } - - return UI_CONTEXTAVAILABILITY_NOTAVAILABLE; - } - - HRESULT SetRibbonContextAvail(UINT32 uID, UI_CONTEXTAVAILABILITY cav) - { - CUpdateUIBase::UIEnable(uID, cav != UI_CONTEXTAVAILABILITY_NOTAVAILABLE); - CUpdateUIBase::UISetCheck(uID, cav == UI_CONTEXTAVAILABILITY_ACTIVE); - - return SetProperty((WORD)uID, UI_PKEY_ContextAvailable, UINT32(cav)); - } - -// Ribbon context menu - bool HasRibbonMenu(UINT32 uID) - { - ATL::CComPtr pI = GetMenuPtr(uID); - return pI != NULL; - } - - HRESULT TrackRibbonMenu(UINT32 uID, INT32 x, INT32 y) - { - ATLASSERT(HasRibbonMenu(uID)); - - return IsRibbonUI() ? - ATL::CComPtr(GetMenuPtr(uID))->ShowAtLocation(x, y) : - E_FAIL; - } - - HRESULT TrackRibbonMenu(UINT32 uID, LPARAM lParam) - { - return TrackRibbonMenu(uID, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - } - -// Overrideables - HBITMAP OnRibbonQueryImage(UINT nCmdID, REFPROPERTYKEY /*key*/) - { - return DefRibbonQueryImage(nCmdID); - } - - LPCWSTR OnRibbonQueryText(UINT nCmdID, REFPROPERTYKEY key) - { - return DefRibbonQueryText(nCmdID, key); - } - - bool OnRibbonQueryState(UINT nCmdID, REFPROPERTYKEY key) - { - return DefRibbonQueryState(nCmdID, key); - } - - UI_CONTEXTAVAILABILITY OnRibbonQueryTabAvail(UINT nCmdID) - { - DWORD dwState = UIGetState(nCmdID); - return ((dwState & UPDUI_DISABLED) == UPDUI_DISABLED) ? - UI_CONTEXTAVAILABILITY_NOTAVAILABLE : - (((dwState & UPDUI_CHECKED) == UPDUI_CHECKED) ? - UI_CONTEXTAVAILABILITY_ACTIVE : - UI_CONTEXTAVAILABILITY_AVAILABLE); - } - - LPCWSTR OnRibbonQueryComboText(UINT32 /*uCtrlID*/) - { - return NULL; - } - - LPCWSTR OnRibbonQueryCategoryText(UINT32 /*uCtrlID*/, UINT32 /*uCat*/) - { - return L"Category"; - } - - UINT32 OnRibbonQueryItemCategory(UINT32 /*uCtrlID*/, UINT32 /*uItem*/) - { - return 0; - } - - LPCWSTR OnRibbonQueryItemText(UINT32 uCtrlID, UINT32 uItem) - { - return DefRibbonQueryItemText(uCtrlID, uItem); - } - - bool OnRibbonQuerySelectedItem(UINT32 /*uCtrlID*/, UINT32& /*uSel*/) - { - return false; - } - - HBITMAP OnRibbonQueryItemImage(UINT32 uCtrlID, UINT32 uItem) - { - return DefRibbonQueryItemImage(uCtrlID, uItem); - } - - UINT32 OnRibbonQueryItemCommand(UINT32 uCtrlID, UINT32 uItem) - { - return DefRibbonQueryItemCommand(uCtrlID, uItem); - } - - UI_COMMANDTYPE OnRibbonQueryItemCommandType(UINT32 /*uCtrlID*/, UINT32 /*uItem*/) - { - return UI_COMMANDTYPE_ACTION; - } - - LPCWSTR OnRibbonQueryRecentItemName(LPCWSTR sPath) - { - return ::PathFindFileName(sPath); - } - - bool OnRibbonQueryFont(UINT /*nId*/, CHARFORMAT2& /*cf*/) - { - return false; - } - - bool OnRibbonQuerySpinnerValue(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/, LONG* /*pVal*/) - { - return false; - } - - bool OnRibbonQueryFloatSpinnerValue(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/, DOUBLE* /*pVal*/) - { - return false; - } - - COLORREF OnRibbonQueryColor(UINT /*nCmdID*/) - { - return 0x800080; /*MAGENTA*/ - } - - LPCWSTR OnRibbonQueryColorLabel(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/) - { - return NULL; - } - - COLORREF* OnRibbonQueryColorArray(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/) - { - return NULL; - } - - LPCWSTR* OnRibbonQueryColorTooltips(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/) - { - return NULL; - } - - bool OnRibbonItemSelected(UINT32 uCtrlID, UI_EXECUTIONVERB verb, UINT32 uItem) - { - DefCommandExecute(MAKELONG(uCtrlID, verb), uItem); - return true; - } - - void OnRibbonColorCtrlExecute(UINT32 uCtrlID, UI_EXECUTIONVERB verb, UI_SWATCHCOLORTYPE uType, COLORREF color) - { - DefRibbonColorCtrlExecute(uCtrlID, verb, uType, color); - } - - void OnRibbonFontCtrlExecute(UINT32 uCtrlID, UI_EXECUTIONVERB verb, CHARFORMAT2* pcf) - { - DefCommandExecute(MAKELONG(uCtrlID, verb), (LPARAM)pcf); - } - - void OnRibbonSpinnerCtrlExecute(UINT32 uCtrlID, LONG* pVal) - { - DefCommandExecute(uCtrlID, *pVal); - } - - void OnRibbonSpinnerCtrlExecute(UINT32 uCtrlID, DOUBLE* pVal) - { - DefCommandExecute(uCtrlID, (LPARAM)pVal); - } - - void OnRibbonCommandExecute(UINT32 uCmdID) - { - DefCommandExecute(uCmdID); - } - -// Default implementations - HBITMAP DefRibbonQueryImage(UINT nCmdID) - { - return AtlLoadBitmapImage(nCmdID, LR_CREATEDIBSECTION); - } - - bool DefRibbonQueryState(UINT nCmdID, REFPROPERTYKEY key) - { - DWORD dwState = UIGetState(nCmdID); - bool bRet = false; - switch (k_(key)) - { - case k_BooleanValue: - bRet = (dwState & UPDUI_CHECKED) == UPDUI_CHECKED; - break; - case k_Enabled: - bRet = (dwState & UPDUI_DISABLED) != UPDUI_DISABLED; - break; - default: - ATLASSERT(FALSE); - break; - } - - return bRet; - } - - LPCTSTR DefRibbonQueryText(UINT nCmdID, REFPROPERTYKEY key) - { - static WCHAR sText[RIBBONUI_MAX_TEXT] = { 0 }; - - if (k_(key) == k_Label) - return UIGetText(nCmdID); - - if (AtlLoadString(nCmdID, sText, RIBBONUI_MAX_TEXT)) - { - PWCHAR pTitle = wcschr(sText, L'\n'); - switch (k_(key)) - { - case k_Keytip: - if (PWCHAR pAmp = wcschr(sText, L'&')) - pTitle = pAmp; - if (pTitle != NULL) - *(pTitle + 2) = NULL; // fall through - case k_TooltipTitle: - return pTitle ? ++pTitle : NULL; - case k_TooltipDescription: - case k_LabelDescription: - if (pTitle != NULL) - *pTitle = NULL; - return sText; - } - } - - return NULL; - } - - LPCWSTR DefRibbonQueryItemText(UINT32 uCtrlID, UINT32 uItem) - { - return DefRibbonQueryText(uCtrlID + 1 + uItem, UI_PKEY_LabelDescription); - } - - HBITMAP DefRibbonQueryItemImage(UINT32 uCtrlID, UINT32 uItem) - { - return DefRibbonQueryImage(uCtrlID + 1 + uItem); - } - - UINT32 DefRibbonQueryItemCommand(UINT32 uCtrlID, UINT32 uItem) - { - return uCtrlID + 1 + uItem; - } - - void DefRibbonColorCtrlExecute(UINT32 uCtrlID, UI_EXECUTIONVERB verb, UI_SWATCHCOLORTYPE uType, COLORREF color) - { - switch(uType) - { - case UI_SWATCHCOLORTYPE_RGB: - break; - case UI_SWATCHCOLORTYPE_AUTOMATIC: - color = ::GetSysColor(COLOR_WINDOWTEXT); - break; - case UI_SWATCHCOLORTYPE_NOCOLOR: - color = ::GetSysColor(COLOR_WINDOW); - break; - default: - ATLASSERT(FALSE); - break; - } - - DefCommandExecute(MAKELONG(uCtrlID, verb), color); - } - - void DefCommandExecute(UINT32 uCmd, LPARAM lParam = 0) - { - static_cast(this)->PostMessage(WM_COMMAND, uCmd, lParam); - } - -// Elements setting helpers - HRESULT InvalidateCtrl(UINT32 nID) - { - return IsRibbonUI() ? - GetIUIFrameworkPtr()->InvalidateUICommand(nID, UI_INVALIDATIONS_ALLPROPERTIES, NULL) : - E_FAIL; - } - - HRESULT InvalidateProperty(UINT32 nID, REFPROPERTYKEY key, UI_INVALIDATIONS flags = UI_INVALIDATIONS_PROPERTY) - { - return IsRibbonUI() ? - GetIUIFrameworkPtr()->InvalidateUICommand(nID, flags, &key) : - E_FAIL; - } - - template - HRESULT SetProperty(WORD wID, REFPROPERTYKEY key, V val) - { - if (IsRibbonUI()) - { - PROPVARIANT var; - if (SUCCEEDED(RibbonUI::SetPropertyVal(key, val, &var))) - { - return SetProperty(wID, key, var); - } - return E_INVALIDARG; - } - else - { - return E_FAIL; - } - } - - template <> - HRESULT SetProperty(WORD nID, REFPROPERTYKEY key, PROPVARIANT var) - { - return IsRibbonUI() ? - GetIUIFrameworkPtr()->SetUICommandProperty(nID, key, var) : - E_FAIL; - } - -// Interfaces - // IUIApplication - STDMETHODIMP OnViewChanged(UINT32, UI_VIEWTYPE, IUnknown*, UI_VIEWVERB verb, INT32) - { - switch (verb) - { - case UI_VIEWVERB_CREATE: - m_bRibbonUI = true; - if (m_hgRibbonSettings != NULL) - RestoreRibbonSettings(); - break; - case UI_VIEWVERB_SIZE: - static_cast(this)->UpdateLayout(FALSE); - break; - case UI_VIEWVERB_DESTROY: - SaveRibbonSettings(); - m_bRibbonUI = false; - break; - } - - return S_OK; - } - - STDMETHODIMP OnCreateUICommand(UINT32 nCmdID, UI_COMMANDTYPE typeID, IUICommandHandler** ppCommandHandler) - { - UIAddRibbonElement(nCmdID); - if (typeID == UI_COMMANDTYPE_CONTEXT) - CUpdateUIBase::UIEnable(nCmdID, false); - *ppCommandHandler = this; - return S_OK; - } - - STDMETHODIMP OnDestroyUICommand(UINT32 nCmdID, UI_COMMANDTYPE, IUICommandHandler*) - { - UIRemoveRibbonElement(nCmdID); - return S_OK; - } - - // IUICommandHandler - STDMETHODIMP Execute(UINT nCmdID, - UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, - const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* pCommandExecutionProperties) - { - T* pT =static_cast(this); - return pT->GetRibbonCtrl(nCmdID).DoExecute(nCmdID, verb, key, ppropvarValue, pCommandExecutionProperties); - } - - STDMETHODIMP UpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) - { - T* pT =static_cast(this); - return pT->GetRibbonCtrl(nCmdID).DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); - } - -#ifdef _DEBUG - // IUnknown methods (heavyweight) - STDMETHODIMP_(ULONG) AddRef() - { - return InterlockedIncrement(&m_cRef); - } - - STDMETHODIMP_(ULONG) Release() - { - LONG cRef = InterlockedDecrement(&m_cRef); - if (cRef == 0) // NoOp for breakpoint - { - cRef = 0; - } - - return cRef; - } - - STDMETHODIMP QueryInterface(REFIID iid, void** ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - else if ((iid == __uuidof(IUnknown)) || - (iid == __uuidof(IUICommandHandler)) || - (iid == __uuidof(IUIApplication))) - { - *ppv = this; - AddRef(); - return S_OK; - } - else - { - return E_NOINTERFACE; - } - } - - LONG m_cRef; -#else - // IUnknown methods (lightweight) - STDMETHODIMP QueryInterface(REFIID iid, void** ppv) - { - if ((iid == __uuidof(IUnknown)) || - (iid == __uuidof(IUICommandHandler)) || - (iid == __uuidof(IUIApplication))) - { - *ppv = this; - return S_OK; - } - return E_NOINTERFACE; - } - ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - ULONG STDMETHODCALLTYPE Release() - { - return 1; - } -#endif - -// CRibbonImpl ICtrl implementation - virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, - const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, - IUISimplePropertySet* /*pCommandExecutionProperties*/) - { - if (key != NULL) - { - if(k_(*key) != k_BooleanValue) - { - ATLTRACE(L"Control ID %d is not handled\n", nCmdID); - return E_NOTIMPL; - } - BOOL bChecked = FALSE; - ATLVERIFY(SUCCEEDED(PropVariantToBoolean(*ppropvarValue, &bChecked))); - CUpdateUIBase::UISetCheck(nCmdID, bChecked); - } - - ATLASSERT(verb == UI_EXECUTIONVERB_EXECUTE); - verb; // avoid level 4 warning - - static_cast(this)->OnRibbonCommandExecute(nCmdID); - - return S_OK; - } - - virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, - const PROPVARIANT* /*ppropvarCurrentValue*/, PROPVARIANT* ppropvarNewValue) - { - T* pT = static_cast(this); - HRESULT hr = E_NOTIMPL; - switch (k_(key)) - { - case k_LargeImage: - case k_LargeHighContrastImage: - case k_SmallImage: - case k_SmallHighContrastImage: - if (HBITMAP hbm = pT->OnRibbonQueryImage(nCmdID, key)) - hr = SetPropertyVal(key, GetImage(hbm, UI_OWNERSHIP_TRANSFER), ppropvarNewValue); - break; - case k_Label: - case k_Keytip: - case k_TooltipTitle: - case k_TooltipDescription: - case k_LabelDescription: - if (LPCWSTR sText = pT->OnRibbonQueryText(nCmdID, key)) - hr = SetPropertyVal(key, sText, ppropvarNewValue); - break; - case k_BooleanValue: - case k_Enabled: - hr = SetPropertyVal(key, pT->OnRibbonQueryState(nCmdID, key), ppropvarNewValue); - break; - case k_ContextAvailable: - hr = SetPropertyVal(key, pT->OnRibbonQueryTabAvail(nCmdID), ppropvarNewValue); - break; - } - - return hr; - } - -// CRibbonImpl::CRibbonXXXCtrl specialized classes - //CRibbonComboCtrl - template - class CRibbonComboCtrl : public CollectionCtrlImpl, t_items, t_categories>> - { - public: - CRibbonComboCtrl() - { } - }; - - // CRibbonItemGalleryCtrl - template - class CRibbonItemGalleryCtrl : public CollectionCtrlImpl, t_items, t_categories>> - { - public: - CRibbonItemGalleryCtrl() - { } - }; - - // CRibbonCommandGalleryCtrl - template - class CRibbonCommandGalleryCtrl : public CollectionCtrlImpl, t_items, t_categories>> - { - public: - CRibbonCommandGalleryCtrl() - { } - }; - - // CRibbonToolbarGalleryCtrl - template - class CRibbonToolbarGalleryCtrl : public ToolbarGalleryCtrlImpl - { }; - - // CRibbonSimpleComboCtrl - template - class CRibbonSimpleComboCtrl : public SimpleCollectionCtrlImpl - { }; - - // CRibbonSimpleGalleryCtrl - template - class CRibbonSimpleGalleryCtrl : public SimpleCollectionCtrlImpl - { }; - - //CRibbonRecentItemsCtrl - template - class CRibbonRecentItemsCtrl : public RecentItemsCtrlImpl - { - public: - CRibbonRecentItemsCtrl() - { } - }; - - // CRibbonColorCtrl - template - class CRibbonColorCtrl : public ColorCtrlImpl - { - public: - CRibbonColorCtrl() - { } - }; - - //CRibbonFontCtrl - template - class CRibbonFontCtrl : public FontCtrlImpl - { - public: - CRibbonFontCtrl() - { } - }; - - // CRibbonSpinnerCtrl - template - class CRibbonSpinnerCtrl : public SpinnerCtrlImpl - { - public: - CRibbonSpinnerCtrl() - { } - }; - - // CRibbonFloatSpinnerCtrl - template - class CRibbonFloatSpinnerCtrl : public SpinnerCtrlImpl - { - public: - CRibbonFloatSpinnerCtrl() - { - m_Values[4] = 1; // 1 decimal - } - }; - - // CRibbonCommandCtrl - template - class CRibbonCommandCtrl : public CommandCtrlImpl - { - public: - CRibbonCommandCtrl() - { } - }; - -// Control classes access to T instance (re-initialized in constructor) - static T* pWndRibbon; -}; - -template -__declspec(selectany) T* CRibbonImpl::pWndRibbon; - -// Control map element -#pragma warning (disable : 4510 610) // missing default constructor -typedef struct -{ - UINT uID; - ICtrl& ctrl; -} _ribbonCtrl; -#pragma warning (default : 4510 610) // missing default constructor - -}; // namespace RibbonUI - - -/////////////////////////////////////////////////////////////////////////////// -// RibbonUI Control map - -// Control map macros -#define BEGIN_RIBBON_CONTROL_MAP(theClass) \ - RibbonUI::ICtrl& GetRibbonCtrl(UINT id) \ - { \ - RibbonUI::_ribbonCtrl _ctrls[] = \ - { - -#define RIBBON_CONTROL(member) {member.GetID(), static_cast(member)}, - -#define END_RIBBON_CONTROL_MAP() \ - {0, *this} \ - }; \ - int i = 0; \ - for(; i < _countof(_ctrls) - 1; i++) \ - if (_ctrls[i].uID == id) \ - break; \ - return _ctrls[i].ctrl; \ -} - -// Control message map macros -#define RIBBON_GALLERY_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (UINT)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define RIBBON_COMBO_CONTROL_HANDLER(id, func) \ - RIBBON_GALLERY_CONTROL_HANDLER(id, func) - -#define RIBBON_FONT_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (CHARFORMAT2*)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define RIBBON_COLOR_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (COLORREF)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define RIBBON_SPINNER_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == wParam) \ - { \ - bHandled = TRUE; \ - lResult = func((WORD)wParam, (LONG)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define RIBBON_FLOATSPINNER_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == wParam) \ - { \ - bHandled = TRUE; \ - lResult = func((WORD)wParam, (DOUBLE*)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -// Handler prototypes -/* - LRESULT OnRibbonGalleryCtrl(UI_EXECUTIONVERB verb, WORD wID, UINT uSel, BOOL& bHandled); - LRESULT OnRibbonComboCtrl(UI_EXECUTIONVERB verb, WORD wID, UINT uSel, BOOL& bHandled); - LRESULT OnRibbonFontCtrl(UI_EXECUTIONVERB verb, WORD wID, CHARFORMAT2* pcf, BOOL& bHandled); - LRESULT OnRibbonColorCtrl(UI_EXECUTIONVERB verb, WORD wID, COLORREF color, BOOL& bHandled); - LRESULT OnRibbonSpinnerCtrl(WORD wID, LONG lVal, BOOL& bHandled); - LRESULT OnRibbonFloatSpinnerCtrl(WORD wID, DOUBLE* pdVal, BOOL& bHandled); -*/ - - -/////////////////////////////////////////////////////////////////////////////// -// Ribbon frame classes - -// CRibbonFrameWindowImplBase -// -template -class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public RibbonUI::CRibbonImpl -{ - typedef TFrameImpl baseFrame; - bool m_bUseCommandBarBitmaps; - bool m_bWin7Fix; - -public: -// Construction - CRibbonFrameWindowImplBase(bool bUseCommandBarBitmaps = true) : - m_bUseCommandBarBitmaps(bUseCommandBarBitmaps), m_bWin7Fix(false) - { - __if_not_exists(T::m_CmdBar) - { - m_bUseCommandBarBitmaps = false; - } - } - -// Win7 Aero fix helpers - void ResetFrame() - { - const MARGINS margins = { 0 }; - ::DwmExtendFrameIntoClientArea(m_hWnd, &margins); - } - - INT CalcWin7Fix() - { - ResetFrame(); - RECT rc = { 0 }; - ::AdjustWindowRectEx(&rc, T::GetWndStyle(0), GetMenu() != NULL, T::GetWndExStyle(0)); - return -rc.top; - } - - bool NeedWin7Fix() - { - BOOL bComp = FALSE; - return m_bWin7Fix && RunTimeHelper::IsWin7() && SUCCEEDED(DwmIsCompositionEnabled(&bComp)) && bComp; - } - -// Operations - bool UseCommandBarBitmaps(bool bUse) - { - __if_exists(T::m_CmdBar) - { - return m_bUseCommandBarBitmaps = bUse; - } - __if_not_exists(T::m_CmdBar) - { - bUse; // avoid level 4 warning - return false; - } - } - - bool ShowRibbonUI(bool bShow, INT32 imodes = UI_MAKEAPPMODE(0), LPCWSTR sResName = L"APPLICATION_RIBBON") - { - if (!RunTimeHelper::IsRibbonUIAvailable()) - return false; - - ATLASSERT(GetIUIFrameworkPtr()); - - if (IsRibbonUI() == bShow) - return bShow; - - bool bVisible = (IsWindowVisible() != FALSE); - if(bVisible && !bShow) - SetRedraw(FALSE); - - if (bShow && ::IsWindow(m_hWndToolBar)) - { - ::ShowWindow(m_hWndToolBar, SW_HIDE); - UpdateLayout(); - } - - m_bWin7Fix = !bShow; - - HRESULT hr = bShow ? CreateRibbon(sResName) : DestroyRibbon(); - - m_bWin7Fix = SUCCEEDED(hr) && !bShow; - - if (SUCCEEDED(hr)) - { - if(::IsWindow(m_hWndToolBar) && !bShow) - { - ::ShowWindow(m_hWndToolBar, SW_SHOWNA); - UpdateLayout(); - } - else if (bShow) - { - PostMessage(WM_SIZE); - SetRibbonModes(imodes); - } - } - - if(bVisible && !bShow) - { - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - } - - return SUCCEEDED(hr) ? bShow : !bShow; - } - -// Overrideables - HBITMAP OnRibbonQueryImage(UINT nCmdID, REFPROPERTYKEY key) - { - if ((key == UI_PKEY_SmallImage) && m_bUseCommandBarBitmaps) - { - if (HBITMAP hbm = GetCommandBarBitmap(nCmdID)) - return (HBITMAP)::CopyImage(hbm, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); - } - - return DefRibbonQueryImage(nCmdID); - } - - BEGIN_MSG_MAP(CRibbonFrameWindowImplBase) - if (!IsRibbonUI() && NeedWin7Fix()) - { - MESSAGE_HANDLER(WM_SIZING, OnSizing) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) - MESSAGE_HANDLER(WM_NCCALCSIZE, OnNCCalcSize) - } - CHAIN_MSG_MAP(CRibbonUpdateUI) - CHAIN_MSG_MAP(baseFrame) - END_MSG_MAP() - -// Message handlers for Win7 Aero - LRESULT OnSizing(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - switch (wParam) - { - case WMSZ_TOP: - case WMSZ_TOPLEFT: - case WMSZ_TOPRIGHT: - SetWindowPos(NULL, (LPRECT)lParam, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); - break; - default: - DefWindowProc(); - break; - } - - return 1; // handled - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if (wParam != SIZE_MINIMIZED) - SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); - - bHandled = FALSE; - return 1; - } - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam != WA_INACTIVE) - SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); - - bHandled = FALSE; - return 1; - } - - LRESULT OnNCCalcSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - ATLASSERT(!IsRibbonUI() && NeedWin7Fix()); - - LRESULT lRet = DefWindowProc(); - - if(wParam) - { - LPNCCALCSIZE_PARAMS pParams = (LPNCCALCSIZE_PARAMS)lParam; - pParams->rgrc[0].top = pParams->rgrc[1].top + CalcWin7Fix(); - } - - return lRet; - } - -// Overrides - void UpdateLayout(BOOL bResizeBars = TRUE) - { - RECT rect = { 0 }; - GetClientRect(&rect); - - if (IsRibbonUI() && !IsRibbonHidden()) - { - rect.top += GetRibbonHeight(); - } - else if (!IsRibbonUI() && NeedWin7Fix()) - { - ResetFrame(); - } - - // position bars and offset their dimensions - UpdateBarsPosition(rect, bResizeBars); - - // resize client window - if(m_hWndClient != NULL) - ::SetWindowPos(m_hWndClient, NULL, rect.left, rect.top, - rect.right - rect.left, rect.bottom - rect.top, - SWP_NOZORDER | SWP_NOACTIVATE); - } - - // Implementation - HBITMAP GetCommandBarBitmap(UINT nCmdID) - { - __if_exists (T::m_CmdBar) - { - ATLASSERT(RunTimeHelper::IsVista()); - T* pT =static_cast(this); - int nIndex = pT->m_CmdBar.m_arrCommand.Find((WORD&)nCmdID); - return (nIndex == -1) ? NULL : pT->m_CmdBar.m_arrVistaBitmap[nIndex]; - } - __if_not_exists (T::m_CmdBar) - { - nCmdID; // avoid level 4 warning - return NULL; - } - } -}; - -// CRibbonFrameWindowImpl -// -template -class ATL_NO_VTABLE CRibbonFrameWindowImpl : public CRibbonFrameWindowImplBase> -{ }; - -// CRibbonMDIFrameWindowImpl -// -template -class ATL_NO_VTABLE CRibbonMDIFrameWindowImpl : public CRibbonFrameWindowImplBase> -{ }; - - -/////////////////////////////////////////////////////////////////////////////// -// CRibbonPersist helper for RibbonUI persistency - -class CRibbonPersist -{ -public: - CRibbonPersist(LPCWSTR sAppKey) - { - ATLASSERT(sAppKey && *sAppKey); - m_Key.Create(HKEY_CURRENT_USER, sAppKey); - ATLASSERT(m_Key.m_hKey); - } - - CRegKeyEx m_Key; - - LONG Save(bool bRibbonUI, HGLOBAL hgSettings = NULL) - { - CRegKeyEx key; - const DWORD dwUI = bRibbonUI; - - LONG lRet = key.Create(m_Key, L"Ribbon"); - if(lRet != ERROR_SUCCESS) - return lRet; - - lRet = key.SetDWORDValue(L"UI", dwUI); - if(lRet != ERROR_SUCCESS) - return lRet; - - if (hgSettings != NULL) - { - LPBYTE pVal = (LPBYTE)::GlobalLock(hgSettings); - if (pVal != NULL) - { - lRet = key.SetBinaryValue(L"Settings", pVal, (ULONG)::GlobalSize(hgSettings)); - ::GlobalUnlock(hgSettings); - } - else - { - lRet = GetLastError(); - } - } - - return lRet; - } - - LONG Restore(bool& bRibbonUI, HGLOBAL& hgSettings) - { - ATLASSERT(hgSettings == NULL); - - CRegKeyEx key; - - LONG lRet = key.Open(m_Key, L"Ribbon"); - if(lRet != ERROR_SUCCESS) - return lRet; - - DWORD dwUI = 0xffff; - lRet = key.QueryDWORDValue(L"UI", dwUI); - if(lRet == ERROR_SUCCESS) - bRibbonUI = dwUI == 1; - else - return lRet; - - ULONG ulSize = 0; - lRet = key.QueryBinaryValue(L"Settings", NULL, &ulSize); - if (lRet == ERROR_SUCCESS) - { - ATLASSERT(ulSize != 0); - - hgSettings = ::GlobalAlloc(GHND, ulSize); - if (hgSettings != NULL) - { - LPBYTE pData = (LPBYTE)::GlobalLock(hgSettings); - if (pData != NULL) - { - lRet = key.QueryBinaryValue(L"Settings", pData, &ulSize); - } - else - { - lRet = GetLastError(); - ::GlobalFree(hgSettings); - hgSettings = NULL; - } - } - else - { - lRet = GetLastError(); - } - } - return lRet; - } - - LONG Delete() - { - return m_Key.DeleteSubKey(L"Ribbon"); - } -}; - -} // namespace WTL - -#endif // __ATLRIBBON_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlscrl.h b/GLideN64/src/GLideNUI-wtl/WTL/atlscrl.h deleted file mode 100644 index e93d07b..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlscrl.h +++ /dev/null @@ -1,2007 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLSCRL_H__ -#define __ATLSCRL_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlscrl.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlscrl.h requires atlwin.h to be included first -#endif - -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - #include -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - -#ifndef GET_WHEEL_DELTA_WPARAM - #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CScrollImpl -// CScrollWindowImpl -// CMapScrollImpl -// CMapScrollWindowImpl -// CFSBWindowT -// CZoomScrollImpl -// CZoomScrollWindowImpl -// CScrollContainerImpl -// CScrollContainer - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CScrollImpl - Provides scrolling support to any window - -// Scroll extended styles -#define SCRL_SCROLLCHILDREN 0x00000001 -#define SCRL_ERASEBACKGROUND 0x00000002 -#define SCRL_NOTHUMBTRACKING 0x00000004 -#if (WINVER >= 0x0500) -#define SCRL_SMOOTHSCROLL 0x00000008 -#endif // (WINVER >= 0x0500) -#define SCRL_DISABLENOSCROLLV 0x00000010 -#define SCRL_DISABLENOSCROLLH 0x00000020 -#define SCRL_DISABLENOSCROLL (SCRL_DISABLENOSCROLLV | SCRL_DISABLENOSCROLLH) - - -template -class CScrollImpl -{ -public: - enum { uSCROLL_FLAGS = SW_INVALIDATE }; - - POINT m_ptOffset; - SIZE m_sizeAll; - SIZE m_sizeLine; - SIZE m_sizePage; - SIZE m_sizeClient; - int m_zDelta; // current wheel value - int m_nWheelLines; // number of lines to scroll on wheel -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - // Note that this message must be forwarded from a top level window - UINT m_uMsgMouseWheel; // MSH_MOUSEWHEEL -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - int m_zHDelta; // current horizontal wheel value - int m_nHWheelChars; // number of chars to scroll on horizontal wheel - UINT m_uScrollFlags; - DWORD m_dwExtendedStyle; // scroll specific extended styles - -// Constructor - CScrollImpl() : m_zDelta(0), m_nWheelLines(3), -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - m_uMsgMouseWheel(0U), -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - m_zHDelta(0), m_nHWheelChars(3), - m_uScrollFlags(0U), m_dwExtendedStyle(0) - { - m_ptOffset.x = 0; - m_ptOffset.y = 0; - m_sizeAll.cx = 0; - m_sizeAll.cy = 0; - m_sizePage.cx = 0; - m_sizePage.cy = 0; - m_sizeLine.cx = 0; - m_sizeLine.cy = 0; - m_sizeClient.cx = 0; - m_sizeClient.cy = 0; - - SetScrollExtendedStyle(SCRL_SCROLLCHILDREN | SCRL_ERASEBACKGROUND); - } - -// Attributes & Operations - DWORD GetScrollExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetScrollExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - // cache scroll flags - T* pT = static_cast(this); - pT; // avoid level 4 warning - m_uScrollFlags = pT->uSCROLL_FLAGS | (IsScrollingChildren() ? SW_SCROLLCHILDREN : 0) | (IsErasingBackground() ? SW_ERASE : 0); -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - m_uScrollFlags |= (IsSmoothScroll() ? SW_SMOOTHSCROLL : 0); -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - return dwPrevStyle; - } - - // offset operations - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - pT->AdjustScrollOffset(x, y); - - int dx = m_ptOffset.x - x; - int dy = m_ptOffset.y - y; - m_ptOffset.x = x; - m_ptOffset.y = y; - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, bRedraw); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, bRedraw); - } - - // Move all children if needed - if(IsScrollingChildren() && (dx != 0 || dy != 0)) - { - for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) - { - RECT rect = { 0 }; - ::GetWindowRect(hWndChild, &rect); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); - ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - } - } - - if(bRedraw) - pT->Invalidate(); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) const - { - ptOffset = m_ptOffset; - } - - // size operations - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - m_sizeAll.cx = cx; - m_sizeAll.cy = cy; - - int x = 0; - int y = 0; - if(!bResetOffset) - { - x = m_ptOffset.x; - y = m_ptOffset.y; - pT->AdjustScrollOffset(x, y); - } - - int dx = m_ptOffset.x - x; - int dy = m_ptOffset.y - y; - m_ptOffset.x = x; - m_ptOffset.y = y; - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = m_sizeAll.cx - 1; - si.nPage = m_sizeClient.cx; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, bRedraw); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = m_sizeAll.cy - 1; - si.nPage = m_sizeClient.cy; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, bRedraw); - } - - // Move all children if needed - if(IsScrollingChildren() && (dx != 0 || dy != 0)) - { - for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) - { - RECT rect = { 0 }; - ::GetWindowRect(hWndChild, &rect); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); - ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - } - } - - SetScrollLine(0, 0); - SetScrollPage(0, 0); - - if(bRedraw) - pT->Invalidate(); - } - - void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(size.cx, size.cy, bRedraw, bResetOffset); - } - - void GetScrollSize(SIZE& sizeWnd) const - { - sizeWnd = m_sizeAll; - } - - // line operations - void SetScrollLine(int cxLine, int cyLine) - { - ATLASSERT(cxLine >= 0 && cyLine >= 0); - ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); - - m_sizeLine.cx = T::CalcLineOrPage(cxLine, m_sizeAll.cx, 100); - m_sizeLine.cy = T::CalcLineOrPage(cyLine, m_sizeAll.cy, 100); - } - - void SetScrollLine(SIZE sizeLine) - { - SetScrollLine(sizeLine.cx, sizeLine.cy); - } - - void GetScrollLine(SIZE& sizeLine) const - { - sizeLine = m_sizeLine; - } - - // page operations - void SetScrollPage(int cxPage, int cyPage) - { - ATLASSERT(cxPage >= 0 && cyPage >= 0); - ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); - - m_sizePage.cx = T::CalcLineOrPage(cxPage, m_sizeAll.cx, 10); - m_sizePage.cy = T::CalcLineOrPage(cyPage, m_sizeAll.cy, 10); - } - - void SetScrollPage(SIZE sizePage) - { - SetScrollPage(sizePage.cx, sizePage.cy); - } - - void GetScrollPage(SIZE& sizePage) const - { - sizePage = m_sizePage; - } - - // commands - void ScrollLineDown() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_LINEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollLineUp() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_LINEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollPageDown() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_PAGEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollPageUp() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_PAGEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollTop() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_TOP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollBottom() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_BOTTOM, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollLineRight() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_LINEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollLineLeft() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_LINEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollPageRight() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_PAGEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollPageLeft() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_PAGEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollAllLeft() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_TOP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollAllRight() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_BOTTOM, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - // scroll to make point/view/window visible - void ScrollToView(POINT pt) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - RECT rect = { pt.x, pt.y, pt.x, pt.y }; - pT->ScrollToView(rect); - } - - void ScrollToView(RECT& rect) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - RECT rcClient = { 0 }; - pT->GetClientRect(&rcClient); - - int x = m_ptOffset.x; - if(rect.left < m_ptOffset.x) - x = rect.left; - else if(rect.right > (m_ptOffset.x + rcClient.right)) - x = rect.right - rcClient.right; - - int y = m_ptOffset.y; - if(rect.top < m_ptOffset.y) - y = rect.top; - else if(rect.bottom > (m_ptOffset.y + rcClient.bottom)) - y = rect.bottom - rcClient.bottom; - - SetScrollOffset(x, y); - } - - void ScrollToView(HWND hWnd) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - RECT rect = { 0 }; - ::GetWindowRect(hWnd, &rect); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); - ScrollToView(rect); - } - - BEGIN_MSG_MAP(CScrollImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_VSCROLL, OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(m_uMsgMouseWheel, OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - // standard scroll commands - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - GetSystemSettings(); - bHandled = FALSE; - return 1; - } - - LRESULT OnVScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, (int)(short)LOWORD(wParam), (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - return 0; - } - - LRESULT OnHScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, (int)(short)LOWORD(wParam), (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - return 0; - } - - LRESULT OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - -#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE) - uMsg; - int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); -#else - int zDelta = (uMsg == WM_MOUSEWHEEL) ? (int)GET_WHEEL_DELTA_WPARAM(wParam) : (int)wParam; -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE)) - int nScrollCode = (m_nWheelLines == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGEUP : SB_PAGEDOWN) : ((zDelta > 0) ? SB_LINEUP : SB_LINEDOWN); - m_zDelta += zDelta; // cumulative - int zTotal = (m_nWheelLines == WHEEL_PAGESCROLL) ? abs(m_zDelta) : abs(m_zDelta) * m_nWheelLines; - if(m_sizeAll.cy > m_sizeClient.cy) - { - for(int i = 0; i < zTotal; i += WHEEL_DELTA) - { - pT->DoScroll(SB_VERT, nScrollCode, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - pT->UpdateWindow(); - } - } - else // can't scroll vertically, scroll horizontally - { - for(int i = 0; i < zTotal; i += WHEEL_DELTA) - { - pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - pT->UpdateWindow(); - } - } - m_zDelta %= WHEEL_DELTA; - - return 0; - } - - LRESULT OnMouseHWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); - int nScrollCode = (m_nHWheelChars == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGERIGHT : SB_PAGELEFT) : ((zDelta > 0) ? SB_LINERIGHT : SB_LINELEFT); - m_zHDelta += zDelta; // cumulative - int zTotal = (m_nHWheelChars == WHEEL_PAGESCROLL) ? abs(m_zHDelta) : abs(m_zHDelta) * m_nHWheelChars; - if(m_sizeAll.cx > m_sizeClient.cx) - { - for(int i = 0; i < zTotal; i += WHEEL_DELTA) - { - pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - pT->UpdateWindow(); - } - } - m_zHDelta %= WHEEL_DELTA; - - return 0; - } - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - GetSystemSettings(); - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - m_sizeClient.cx = GET_X_LPARAM(lParam); - m_sizeClient.cy = GET_Y_LPARAM(lParam); - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - si.nMin = 0; - si.nMax = m_sizeAll.cx - 1; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPage = m_sizeClient.cx; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, TRUE); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - si.nMin = 0; - si.nMax = m_sizeAll.cy - 1; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPage = m_sizeClient.cy; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, TRUE); - } - - int x = m_ptOffset.x; - int y = m_ptOffset.y; - if(pT->AdjustScrollOffset(x, y)) - { - // Children will be moved in SetScrollOffset, if needed - pT->ScrollWindowEx(m_ptOffset.x - x, m_ptOffset.y - y, (m_uScrollFlags & ~SCRL_SCROLLCHILDREN)); - SetScrollOffset(x, y, FALSE); - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - pT->DoPaint(dc); - dc.SetViewportOrg(ptViewportOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); - pT->DoPaint(dc.m_hDC); - } - return 0; - } - - // scrolling handlers - LRESULT OnScrollUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineUp(); - return 0; - } - - LRESULT OnScrollDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineDown(); - return 0; - } - - LRESULT OnScrollPageUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageUp(); - return 0; - } - - LRESULT OnScrollPageDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageDown(); - return 0; - } - - LRESULT OnScrollTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollTop(); - return 0; - } - - LRESULT OnScrollBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollBottom(); - return 0; - } - - LRESULT OnScrollLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineLeft(); - return 0; - } - - LRESULT OnScrollRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineRight(); - return 0; - } - - LRESULT OnScrollPageLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageLeft(); - return 0; - } - - LRESULT OnScrollPageRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageRight(); - return 0; - } - - LRESULT OnScrollAllLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollAllLeft(); - return 0; - } - - LRESULT OnScrollAllRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollAllRight(); - return 0; - } - -// Overrideables - void DoPaint(CDCHandle /*dc*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } - -// Implementation - void DoScroll(int nType, int nScrollCode, int& cxyOffset, int cxySizeAll, int cxySizePage, int cxySizeLine) - { - T* pT = static_cast(this); - RECT rect = { 0 }; - pT->GetClientRect(&rect); - int cxyClient = (nType == SB_VERT) ? rect.bottom : rect.right; - int cxyMax = cxySizeAll - cxyClient; - - if(cxyMax < 0) // can't scroll, client area is bigger - return; - - bool bUpdate = true; - int cxyScroll = 0; - - switch(nScrollCode) - { - case SB_TOP: // top or all left - cxyScroll = cxyOffset; - cxyOffset = 0; - break; - case SB_BOTTOM: // bottom or all right - cxyScroll = cxyOffset - cxyMax; - cxyOffset = cxyMax; - break; - case SB_LINEUP: // line up or line left - if(cxyOffset >= cxySizeLine) - { - cxyScroll = cxySizeLine; - cxyOffset -= cxySizeLine; - } - else - { - cxyScroll = cxyOffset; - cxyOffset = 0; - } - break; - case SB_LINEDOWN: // line down or line right - if(cxyOffset < cxyMax - cxySizeLine) - { - cxyScroll = -cxySizeLine; - cxyOffset += cxySizeLine; - } - else - { - cxyScroll = cxyOffset - cxyMax; - cxyOffset = cxyMax; - } - break; - case SB_PAGEUP: // page up or page left - if(cxyOffset >= cxySizePage) - { - cxyScroll = cxySizePage; - cxyOffset -= cxySizePage; - } - else - { - cxyScroll = cxyOffset; - cxyOffset = 0; - } - break; - case SB_PAGEDOWN: // page down or page right - if(cxyOffset < cxyMax - cxySizePage) - { - cxyScroll = -cxySizePage; - cxyOffset += cxySizePage; - } - else - { - cxyScroll = cxyOffset - cxyMax; - cxyOffset = cxyMax; - } - break; - case SB_THUMBTRACK: - if(IsNoThumbTracking()) - break; - // else fall through - case SB_THUMBPOSITION: - { - SCROLLINFO si = { sizeof(SCROLLINFO), SIF_TRACKPOS }; - if(pT->GetScrollInfo(nType, &si)) - { - cxyScroll = cxyOffset - si.nTrackPos; - cxyOffset = si.nTrackPos; - } - } - break; - case SB_ENDSCROLL: - default: - bUpdate = false; - break; - } - - if(bUpdate && cxyScroll != 0) - { - pT->SetScrollPos(nType, cxyOffset, TRUE); - if(nType == SB_VERT) - pT->ScrollWindowEx(0, cxyScroll, m_uScrollFlags); - else - pT->ScrollWindowEx(cxyScroll, 0, m_uScrollFlags); - } - } - - static int CalcLineOrPage(int nVal, int nMax, int nDiv) - { - if(nVal == 0) - { - nVal = nMax / nDiv; - if(nVal < 1) - nVal = 1; - } - else if(nVal > nMax) - { - nVal = nMax; - } - - return nVal; - } - - bool AdjustScrollOffset(int& x, int& y) - { - int xOld = x; - int yOld = y; - - int cxMax = m_sizeAll.cx - m_sizeClient.cx; - if(x > cxMax) - x = (cxMax >= 0) ? cxMax : 0; - else if(x < 0) - x = 0; - - int cyMax = m_sizeAll.cy - m_sizeClient.cy; - if(y > cyMax) - y = (cyMax >= 0) ? cyMax : 0; - else if(y < 0) - y = 0; - - return (x != xOld || y != yOld); - } - - void GetSystemSettings() - { -#ifndef _WIN32_WCE -#ifndef SPI_GETWHEELSCROLLLINES - const UINT SPI_GETWHEELSCROLLLINES = 104; -#endif // !SPI_GETWHEELSCROLLLINES - ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &m_nWheelLines, 0); - -#ifndef SPI_GETWHEELSCROLLCHARS - const UINT SPI_GETWHEELSCROLLCHARS = 0x006C; -#endif // !SPI_GETWHEELSCROLLCHARS - ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &m_nHWheelChars, 0); - -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - if(m_uMsgMouseWheel != 0) - m_uMsgMouseWheel = ::RegisterWindowMessage(MSH_MOUSEWHEEL); - - HWND hWndWheel = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE); - if(::IsWindow(hWndWheel)) - { - UINT uMsgScrollLines = ::RegisterWindowMessage(MSH_SCROLL_LINES); - if(uMsgScrollLines != 0) - m_nWheelLines = (int)::SendMessage(hWndWheel, uMsgScrollLines, 0, 0L); - } -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) -#endif // !_WIN32_WCE - } - - bool IsScrollingChildren() const - { - return (m_dwExtendedStyle & SCRL_SCROLLCHILDREN) != 0; - } - - bool IsErasingBackground() const - { - return (m_dwExtendedStyle & SCRL_ERASEBACKGROUND) != 0; - } - - bool IsNoThumbTracking() const - { - return (m_dwExtendedStyle & SCRL_NOTHUMBTRACKING) != 0; - } - -#if (WINVER >= 0x0500) - bool IsSmoothScroll() const - { - return (m_dwExtendedStyle & SCRL_SMOOTHSCROLL) != 0; - } -#endif // (WINVER >= 0x0500) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CScrollWindowImpl - Implements a scrollable window - -template -class ATL_NO_VTABLE CScrollWindowImpl : public ATL::CWindowImpl, public CScrollImpl< T > -{ -public: - BEGIN_MSG_MAP(CScrollWindowImpl) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, CScrollImpl< T >::OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, CScrollImpl< T >::OnPaint) -#endif // !_WIN32_WCE - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMapScrollImpl - Provides mapping and scrolling support to any window - -#ifndef _WIN32_WCE - -template -class CMapScrollImpl : public CScrollImpl< T > -{ -public: - int m_nMapMode; - RECT m_rectLogAll; - SIZE m_sizeLogLine; - SIZE m_sizeLogPage; - -// Constructor - CMapScrollImpl() : m_nMapMode(MM_TEXT) - { - ::SetRectEmpty(&m_rectLogAll); - m_sizeLogPage.cx = 0; - m_sizeLogPage.cy = 0; - m_sizeLogLine.cx = 0; - m_sizeLogLine.cy = 0; - } - -// Attributes & Operations - // mapping mode operations - void SetScrollMapMode(int nMapMode) - { - ATLASSERT(nMapMode >= MM_MIN && nMapMode <= MM_MAX_FIXEDSCALE); - m_nMapMode = nMapMode; - } - - int GetScrollMapMode() const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - return m_nMapMode; - } - - // offset operations - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - POINT ptOff = { x, y }; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&ptOff); - } - CScrollImpl< T >::SetScrollOffset(ptOff, bRedraw); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - ptOffset = m_ptOffset; - // block: convert device to logical units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.DPtoLP(&ptOffset); - } - } - - // size operations - void SetScrollSize(int xMin, int yMin, int xMax, int yMax, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - ATLASSERT(xMax > xMin && yMax > yMin); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - - ::SetRect(&m_rectLogAll, xMin, yMin, xMax, yMax); - - SIZE sizeAll = { 0 }; - sizeAll.cx = xMax - xMin + 1; - sizeAll.cy = yMax - yMin + 1; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&sizeAll); - } - CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); - SetScrollLine(0, 0); - SetScrollPage(0, 0); - } - - void SetScrollSize(RECT& rcScroll, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(rcScroll.left, rcScroll.top, rcScroll.right, rcScroll.bottom, bRedraw, bResetOffset); - } - - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(0, 0, cx, cy, bRedraw, bResetOffset); - } - - void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(0, 0, size.cx, size.cy, bRedraw, bResetOffset); - } - - void GetScrollSize(RECT& rcScroll) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - rcScroll = m_rectLogAll; - } - - // line operations - void SetScrollLine(int cxLine, int cyLine) - { - ATLASSERT(cxLine >= 0 && cyLine >= 0); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - - m_sizeLogLine.cx = cxLine; - m_sizeLogLine.cy = cyLine; - SIZE sizeLine = m_sizeLogLine; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&sizeLine); - } - CScrollImpl< T >::SetScrollLine(sizeLine); - } - - void SetScrollLine(SIZE sizeLine) - { - SetScrollLine(sizeLine.cx, sizeLine.cy); - } - - void GetScrollLine(SIZE& sizeLine) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - sizeLine = m_sizeLogLine; - } - - // page operations - void SetScrollPage(int cxPage, int cyPage) - { - ATLASSERT(cxPage >= 0 && cyPage >= 0); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - - m_sizeLogPage.cx = cxPage; - m_sizeLogPage.cy = cyPage; - SIZE sizePage = m_sizeLogPage; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&sizePage); - } - CScrollImpl< T >::SetScrollPage(sizePage); - } - - void SetScrollPage(SIZE sizePage) - { - SetScrollPage(sizePage.cx, sizePage.cy); - } - - void GetScrollPage(SIZE& sizePage) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - sizePage = m_sizeLogPage; - } - - BEGIN_MSG_MAP(CMapScrollImpl) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - int nMapModeSav = dc.GetMapMode(); - dc.SetMapMode(m_nMapMode); - POINT ptViewportOrg = { 0, 0 }; - if(m_nMapMode == MM_TEXT) - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - else - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy, &ptViewportOrg); - POINT ptWindowOrg = { 0, 0 }; - dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top, &ptWindowOrg); - - pT->DoPaint(dc); - - dc.SetMapMode(nMapModeSav); - dc.SetViewportOrg(ptViewportOrg); - dc.SetWindowOrg(ptWindowOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - dc.SetMapMode(m_nMapMode); - if(m_nMapMode == MM_TEXT) - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); - else - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy); - dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top); - pT->DoPaint(dc.m_hDC); - } - return 0; - } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMapScrollWindowImpl - Implements scrolling window with mapping - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CMapScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CMapScrollImpl< T > -{ -public: - BEGIN_MSG_MAP(CMapScrollWindowImpl) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, CMapScrollImpl< T >::OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, CMapScrollImpl< T >::OnPaint) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFSBWindow - Use as a base instead of CWindow to get flat scroll bar support - -#if defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -template -class CFSBWindowT : public TBase, public CFlatScrollBarImpl > -{ -public: -// Constructors - CFSBWindowT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CFSBWindowT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// CWindow overrides that use flat scroll bar API -// (only those methods that are used by scroll window classes) - int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_SetScrollPos(nBar, nPos, bRedraw); - } - - BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_GetScrollInfo(nBar, lpScrollInfo); - } - - BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_SetScrollInfo(nBar, lpScrollInfo, bRedraw); - } -}; - -typedef CFSBWindowT CFSBWindow; - -#endif // defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollImpl - Provides zooming and scrolling support to any window - -#ifndef _WIN32_WCE - -// The zoom modes that can be set with the SetZoomMode method -enum -{ - ZOOMMODE_OFF, - ZOOMMODE_IN, // If left mouse button is clicked or dragged, zoom in on point clicked or rectangle dragged. - ZOOMMODE_OUT // If left mouse button clicked, zoom out on point clicked. -}; - -// Notification to parent that zoom scale changed as a result of user mouse action. -#define ZSN_ZOOMCHANGED (NM_FIRST - 50) - -template -class CZoomScrollImpl : public CScrollImpl< T > -{ -public: - enum { m_cxyMinZoomRect = 12 }; // min rect size to zoom in on rect. - -// Data members - SIZE m_sizeLogAll; - SIZE m_sizeLogLine; - SIZE m_sizeLogPage; - float m_fZoomScale; - float m_fZoomScaleMin; - float m_fZoomDelta; // Used in ZOOMMODE_IN and ZOOMMODE_OUT on left-button click. - int m_nZoomMode; - RECT m_rcTrack; - bool m_bTracking; - -// Constructor - CZoomScrollImpl(): - m_fZoomScale(1.0), - m_fZoomScaleMin(0.5), - m_fZoomDelta(0.5), - m_nZoomMode(ZOOMMODE_OFF), - m_bTracking(false) - { - m_sizeLogAll.cx = 0; - m_sizeLogAll.cy = 0; - m_sizeLogPage.cx = 0; - m_sizeLogPage.cy = 0; - m_sizeLogLine.cx = 0; - m_sizeLogLine.cy = 0; - ::SetRectEmpty(&m_rcTrack); - } - -// Attributes & Operations - - // size operations - void SetScrollSize(int cxLog, int cyLog, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - ATLASSERT(cxLog >= 0 && cyLog >= 0); - - // Set up the defaults - if (cxLog == 0 && cyLog == 0) - { - cxLog = 1; - cyLog = 1; - } - - m_sizeLogAll.cx = cxLog; - m_sizeLogAll.cy = cyLog; - SIZE sizeAll = { 0 }; - sizeAll.cx = (int)((float)m_sizeLogAll.cx * m_fZoomScale); - sizeAll.cy = (int)((float)m_sizeLogAll.cy * m_fZoomScale); - - CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); - } - - void SetScrollSize(SIZE sizeLog, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(sizeLog.cx, sizeLog.cy, bRedraw, bResetOffset); - } - - void GetScrollSize(SIZE& sizeLog) const - { - sizeLog = m_sizeLogAll; - } - - // line operations - void SetScrollLine(int cxLogLine, int cyLogLine) - { - ATLASSERT(cxLogLine >= 0 && cyLogLine >= 0); - - m_sizeLogLine.cx = cxLogLine; - m_sizeLogLine.cy = cyLogLine; - - SIZE sizeLine = { 0 }; - sizeLine.cx = (int)((float)m_sizeLogLine.cx * m_fZoomScale); - sizeLine.cy = (int)((float)m_sizeLogLine.cy * m_fZoomScale); - CScrollImpl< T >::SetScrollLine(sizeLine); - } - - void SetScrollLine(SIZE sizeLogLine) - { - SetScrollLine(sizeLogLine.cx, sizeLogLine.cy); - } - - void GetScrollLine(SIZE& sizeLogLine) const - { - sizeLogLine = m_sizeLogLine; - } - - // page operations - void SetScrollPage(int cxLogPage, int cyLogPage) - { - ATLASSERT(cxLogPage >= 0 && cyLogPage >= 0); - - m_sizeLogPage.cx = cxLogPage; - m_sizeLogPage.cy = cyLogPage; - - SIZE sizePage = { 0 }; - sizePage.cx = (int)((float)m_sizeLogPage.cx * m_fZoomScale); - sizePage.cy = (int)((float)m_sizeLogPage.cy * m_fZoomScale); - - CScrollImpl< T >::SetScrollPage(sizePage); - } - - void SetScrollPage(SIZE sizeLogPage) - { - SetScrollPage(sizeLogPage.cx, sizeLogPage.cy); - } - - void GetScrollPage(SIZE& sizeLogPage) const - { - sizeLogPage = m_sizeLogPage; - } - - void SetZoomScale(float fZoomScale) - { - ATLASSERT(fZoomScale > 0); - - if(fZoomScale > 0 && fZoomScale >= m_fZoomScaleMin) - m_fZoomScale = fZoomScale; - } - - float GetZoomScale() const - { - return m_fZoomScale; - } - - void SetZoomScaleMin(float fZoomScaleMin) - { - m_fZoomScaleMin = fZoomScaleMin; - } - - float GetZoomScaleMin() const - { - return m_fZoomScaleMin; - } - - void SetZoomDelta(float fZoomDelta) - { - ATLASSERT(fZoomDelta >= 0); - - if(fZoomDelta >= 0) - m_fZoomDelta = fZoomDelta; - } - - float GetZoomDelta() const - { - return m_fZoomDelta; - } - - void SetZoomMode(int nZoomMode) - { - m_nZoomMode = nZoomMode; - } - - int GetZoomMode() const - { - return m_nZoomMode; - } - - void Zoom(int x, int y, float fZoomScale) - { - if(fZoomScale <= 0) - return; - - fZoomScale = max(fZoomScale, m_fZoomScaleMin); - - T* pT = static_cast(this); - POINT pt = { x, y }; - if(!pT->PtInDevRect(pt)) - return; - - pT->ViewDPtoLP(&pt); - pT->Zoom(fZoomScale, false); - pT->CenterOnLogicalPoint(pt); - } - - void Zoom(POINT pt, float fZoomScale) - { - T* pT = static_cast(this); - pT->Zoom(pt.x, pt.y, fZoomScale); - } - - void Zoom(RECT& rc) - { - T* pT = static_cast(this); - RECT rcZoom = rc; - pT->NormalizeRect(rcZoom); - SIZE size = { rcZoom.right - rcZoom.left, rcZoom.bottom - rcZoom.top }; - POINT pt = { rcZoom.left + size.cx / 2, rcZoom.top + size.cy / 2 }; - if(size.cx < m_cxyMinZoomRect || size.cy < m_cxyMinZoomRect) - { - pT->Zoom(pt, m_fZoomScale + m_fZoomDelta); - return; - } - - ATLASSERT(size.cx > 0 && size.cy > 0); - - float fScaleH = (float)(m_sizeClient.cx + 1) / (float)size.cx; - float fScaleV = (float)(m_sizeClient.cy + 1) / (float)size.cy; - float fZoomScale = min(fScaleH, fScaleV) * m_fZoomScale; - pT->Zoom(pt, fZoomScale); - } - - void Zoom(float fZoomScale, bool bCenter = true) - { - if(fZoomScale <= 0) - return; - - fZoomScale = max(fZoomScale, m_fZoomScaleMin); - - - T* pT = static_cast(this); - POINT pt = { 0 }; - if(bCenter) - { - RECT rc; - ::GetClientRect(pT->m_hWnd, &rc); - pt.x = rc.right / 2; - pt.y = rc.bottom / 2; - pT->ViewDPtoLP(&pt); - } - - // Modify the Viewport extent - m_fZoomScale = fZoomScale; - SIZE sizeAll = { 0 }; - sizeAll.cx = (int)((float)m_sizeLogAll.cx * fZoomScale); - sizeAll.cy = (int)((float)m_sizeLogAll.cy * fZoomScale); - - // Update scroll bars and window - CScrollImpl< T >::SetScrollSize(sizeAll); - - if(bCenter) - pT->CenterOnLogicalPoint(pt); - } - - // Helper functions - void PrepareDC(CDCHandle dc) - { - ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); - dc.SetMapMode(MM_ANISOTROPIC); - dc.SetWindowExt(m_sizeLogAll); - dc.SetViewportExt(m_sizeAll); - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); - } - - void ViewDPtoLP(LPPOINT lpPoints, int nCount = 1) - { - ATLASSERT(lpPoints); - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - CWindowDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - dc.DPtoLP(lpPoints, nCount); - } - - void ViewLPtoDP(LPPOINT lpPoints, int nCount = 1) - { - ATLASSERT(lpPoints); - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - CWindowDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - dc.LPtoDP(lpPoints, nCount); - } - - void ClientToDevice(POINT &pt) - { - pt.x += m_ptOffset.x; - pt.y += m_ptOffset.y; - } - - void DeviceToClient(POINT &pt) - { - pt.x -= m_ptOffset.x; - pt.y -= m_ptOffset.y; - } - - void CenterOnPoint(POINT pt) - { - T* pT = static_cast(this); - RECT rect; - pT->GetClientRect(&rect); - - int xOfs = pt.x - (rect.right / 2) + m_ptOffset.x; - if(xOfs < 0) - { - xOfs = 0; - } - else - { - int xMax = max((int)(m_sizeAll.cx - rect.right), 0); - if(xOfs > xMax) - xOfs = xMax; - } - - int yOfs = pt.y - (rect.bottom / 2) + m_ptOffset.y; - if(yOfs < 0) - { - yOfs = 0; - } - else - { - int yMax = max((int)(m_sizeAll.cy - rect.bottom), 0); - if(yOfs > yMax) - yOfs = yMax; - } - - CScrollImpl< T >::SetScrollOffset(xOfs, yOfs); - } - - void CenterOnLogicalPoint(POINT ptLog) - { - T* pT = static_cast(this); - pT->ViewLPtoDP(&ptLog); - pT->DeviceToClient(ptLog); - pT->CenterOnPoint(ptLog); - } - - BOOL PtInDevRect(POINT pt) - { - RECT rc = { 0, 0, m_sizeAll.cx, m_sizeAll.cy }; - ::OffsetRect(&rc, -m_ptOffset.x, -m_ptOffset.y); - return ::PtInRect(&rc, pt); - } - - void NormalizeRect(RECT& rc) - { - if(rc.left > rc.right) - { - int r = rc.right; - rc.right = rc.left; - rc.left = r; - } - if(rc.top > rc.bottom) - { - int b = rc.bottom; - rc.bottom = rc.top; - rc.top = b; - } - } - - void DrawTrackRect() - { - T* pT = static_cast(this); - const SIZE sizeLines = { 2, 2 }; - RECT rc = m_rcTrack; - pT->NormalizeRect(rc); - if(!::IsRectEmpty(&rc)) - { - ::MapWindowPoints(pT->m_hWnd, NULL, (LPPOINT)&rc, 2); - CWindowDC dc(NULL); - dc.DrawDragRect(&rc, sizeLines, NULL, sizeLines); - } - } - - void NotifyParentZoomChanged() - { - T* pT = static_cast(this); - int nId = pT->GetDlgCtrlID(); - NMHDR nmhdr = { pT->m_hWnd, nId, ZSN_ZOOMCHANGED }; - ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nId, (LPARAM)&nmhdr); - } - - BEGIN_MSG_MAP(CZoomScrollImpl) - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_sizeLogAll.cx >= 0 && m_sizeLogAll.cy >= 0); - ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); - - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - int nMapModeSav = dc.GetMapMode(); - dc.SetMapMode(MM_ANISOTROPIC); - SIZE szWindowExt = { 0, 0 }; - dc.SetWindowExt(m_sizeLogAll, &szWindowExt); - SIZE szViewportExt = { 0, 0 }; - dc.SetViewportExt(m_sizeAll, &szViewportExt); - POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - - pT->DoPaint(dc); - - dc.SetMapMode(nMapModeSav); - dc.SetWindowExt(szWindowExt); - dc.SetViewportExt(szViewportExt); - dc.SetViewportOrg(ptViewportOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - pT->DoPaint(dc.m_hDC); - } - return 0; - } - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_nZoomMode == ZOOMMODE_IN && !m_bTracking) - { - T* pT = static_cast(this); - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(pT->PtInDevRect(pt)) - { - pT->SetCapture(); - m_bTracking = true; - ::SetRect(&m_rcTrack, pt.x, pt.y, pt.x, pt.y); - } - } - bHandled = FALSE; - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_bTracking) - { - T* pT = static_cast(this); - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(pT->PtInDevRect(pt)) - { - pT->DrawTrackRect(); - m_rcTrack.right = pt.x; - m_rcTrack.bottom = pt.y; - pT->DrawTrackRect(); - } - } - bHandled = FALSE; - return 0; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - ::ReleaseCapture(); - if(m_nZoomMode == ZOOMMODE_OUT) - { - T* pT = static_cast(this); - pT->Zoom(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), m_fZoomScale - m_fZoomDelta); - pT->NotifyParentZoomChanged(); - } - bHandled = FALSE; - return 0; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bTracking) - { - m_bTracking = false; - T* pT = static_cast(this); - pT->DrawTrackRect(); - pT->Zoom(m_rcTrack); - pT->NotifyParentZoomChanged(); - ::SetRectEmpty(&m_rcTrack); - } - bHandled = FALSE; - return 0; - } - - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if(LOWORD(lParam) == HTCLIENT && m_nZoomMode != ZOOMMODE_OFF) - { - T* pT = static_cast(this); - if((HWND)wParam == pT->m_hWnd) - { - DWORD dwPos = ::GetMessagePos(); - POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&pt); - if(pT->PtInDevRect(pt)) - { - ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); - return 1; - } - } - } - bHandled = FALSE; - return 0; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollWindowImpl - Implements scrolling window with zooming - -template -class ATL_NO_VTABLE CZoomScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > -{ -public: - BEGIN_MSG_MAP(CZoomScrollWindowImpl) - MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, CZoomScrollImpl< T >::OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, CZoomScrollImpl< T >::OnPaint) - MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CScrollContainer - -template -class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, TWinTraits > -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, -1) - - typedef CScrollWindowImpl< T, TBase, TWinTraits > _baseClass; - -// Data members - ATL::CWindow m_wndClient; - bool m_bAutoSizeClient; - bool m_bDrawEdgeIfEmpty; - -// Constructor - CScrollContainerImpl() : m_bAutoSizeClient(true), m_bDrawEdgeIfEmpty(false) - { - // Set CScrollWindowImpl extended style - SetScrollExtendedStyle(SCRL_SCROLLCHILDREN); - } - -// Attributes - HWND GetClient() const - { - return m_wndClient; - } - - HWND SetClient(HWND hWndClient, bool bClientSizeAsMin = true) - { - ATLASSERT(::IsWindow(m_hWnd)); - - HWND hWndOldClient = m_wndClient; - m_wndClient = hWndClient; - - SetRedraw(FALSE); - SetScrollSize(1, 1, FALSE); - - if(m_wndClient.m_hWnd != NULL) - { - m_wndClient.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - - if(bClientSizeAsMin) - { - RECT rect = { 0 }; - m_wndClient.GetWindowRect(&rect); - if((rect.right - rect.left) > 0 && (rect.bottom - rect.top) > 0) - SetScrollSize(rect.right - rect.left, rect.bottom - rect.top, FALSE); - } - - T* pT = static_cast(this); - pT->UpdateLayout(); - } - - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - - return hWndOldClient; - } - -// Message map and handlers - BEGIN_MSG_MAP(CScrollContainerImpl) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(_baseClass) - FORWARD_NOTIFICATIONS() - ALT_MSG_MAP(1) - CHAIN_MSG_MAP_ALT(_baseClass, 1) - END_MSG_MAP() - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetFocus(); - - return 0; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - BOOL bTmp = TRUE; - LRESULT lRet = _baseClass::OnSize(uMsg, wParam, lParam, bTmp); - - T* pT = static_cast(this); - pT->UpdateLayout(); - - return lRet; - } - -// Overrides for CScrollWindowImpl - void DoPaint(CDCHandle dc) - { - if(!m_bAutoSizeClient || m_wndClient.m_hWnd == NULL) - { - T* pT = static_cast(this); - RECT rect = { 0 }; - pT->GetContainerRect(rect); - - if(m_bDrawEdgeIfEmpty && m_wndClient.m_hWnd == NULL) - dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - - dc.FillRect(&rect, COLOR_APPWORKSPACE); - } - } - - void ScrollToView(POINT pt) - { - CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(pt); - } - - void ScrollToView(RECT& rect) - { - CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(rect); - } - - void ScrollToView(HWND hWnd) // client window coordinates - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_wndClient.IsWindow()); - - RECT rect = { 0 }; - ::GetWindowRect(hWnd, &rect); - ::MapWindowPoints(NULL, m_wndClient.m_hWnd, (LPPOINT)&rect, 2); - ScrollToView(rect); - } - -// Implementation - overrideable methods - void UpdateLayout() - { - ATLASSERT(::IsWindow(m_hWnd)); - - if(m_bAutoSizeClient && m_wndClient.m_hWnd != NULL) - { - T* pT = static_cast(this); - RECT rect = { 0 }; - pT->GetContainerRect(rect); - - m_wndClient.SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); - } - else - { - Invalidate(); - } - } - - void GetContainerRect(RECT& rect) - { - GetClientRect(&rect); - - if(rect.right < m_sizeAll.cx) - rect.right = m_sizeAll.cx; - - if(rect.bottom < m_sizeAll.cy) - rect.bottom = m_sizeAll.cy; - } -}; - -class CScrollContainer : public CScrollContainerImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_ScrollContainer"), 0, -1) -}; - -}; // namespace WTL - -#endif // __ATLSCRL_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlsplit.h b/GLideN64/src/GLideNUI-wtl/WTL/atlsplit.h deleted file mode 100644 index 8afffda..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlsplit.h +++ /dev/null @@ -1,917 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLSPLIT_H__ -#define __ATLSPLIT_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlsplit.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlsplit.h requires atlwin.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CSplitterImpl -// CSplitterWindowImpl -// CSplitterWindowT - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CSplitterImpl - Provides splitter support to any window - -// Splitter panes constants -#define SPLIT_PANE_LEFT 0 -#define SPLIT_PANE_RIGHT 1 -#define SPLIT_PANE_TOP SPLIT_PANE_LEFT -#define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT -#define SPLIT_PANE_NONE -1 - -// Splitter extended styles -#define SPLIT_PROPORTIONAL 0x00000001 -#define SPLIT_NONINTERACTIVE 0x00000002 -#define SPLIT_RIGHTALIGNED 0x00000004 -#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED -#define SPLIT_GRADIENTBAR 0x00000008 -#define SPLIT_FIXEDBARSIZE 0x00000010 - -// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are -// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL - - -template -class CSplitterImpl -{ -public: - enum { m_nPanesCount = 2, m_nPropMax = 10000 }; - - HWND m_hWndPane[m_nPanesCount]; - RECT m_rcSplitter; - int m_xySplitterPos; - int m_nDefActivePane; - int m_cxySplitBar; // splitter bar width/height - static HCURSOR m_hCursor; - int m_cxyMin; // minimum pane size - int m_cxyBarEdge; // splitter bar edge - bool m_bFullDrag; - int m_cxyDragOffset; - int m_nProportionalPos; - bool m_bUpdateProportionalPos; - DWORD m_dwExtendedStyle; // splitter specific extended styles - int m_nSinglePane; // single pane mode - -// Constructor - CSplitterImpl() : - m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE), - m_cxySplitBar(4), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true), - m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true), - m_dwExtendedStyle(SPLIT_PROPORTIONAL), - m_nSinglePane(SPLIT_PANE_NONE) - { - m_hWndPane[SPLIT_PANE_LEFT] = NULL; - m_hWndPane[SPLIT_PANE_RIGHT] = NULL; - - ::SetRectEmpty(&m_rcSplitter); - - if(m_hCursor == NULL) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CSplitterImpl::CSplitterImpl.\n")); - ATLASSERT(FALSE); - return; - } - - if(m_hCursor == NULL) - m_hCursor = ::LoadCursor(NULL, t_bVertical ? IDC_SIZEWE : IDC_SIZENS); - - lock.Unlock(); - } - } - -// Attributes - void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true) - { - if(lpRect == NULL) - { - T* pT = static_cast(this); - pT->GetClientRect(&m_rcSplitter); - } - else - { - m_rcSplitter = *lpRect; - } - - if(IsProportional()) - UpdateProportionalPos(); - else if(IsRightAligned()) - UpdateRightAlignPos(); - - if(bUpdate) - UpdateSplitterLayout(); - } - - void GetSplitterRect(LPRECT lpRect) const - { - ATLASSERT(lpRect != NULL); - *lpRect = m_rcSplitter; - } - - bool SetSplitterPos(int xyPos = -1, bool bUpdate = true) - { - if(xyPos == -1) // -1 == middle - { - if(t_bVertical) - xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; - else - xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; - } - - // Adjust if out of valid range - int cxyMax = 0; - if(t_bVertical) - cxyMax = m_rcSplitter.right - m_rcSplitter.left; - else - cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; - - if(xyPos < m_cxyMin + m_cxyBarEdge) - xyPos = m_cxyMin; - else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) - xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; - - // Set new position and update if requested - bool bRet = (m_xySplitterPos != xyPos); - m_xySplitterPos = xyPos; - - if(m_bUpdateProportionalPos) - { - if(IsProportional()) - StoreProportionalPos(); - else if(IsRightAligned()) - StoreRightAlignPos(); - } - else - { - m_bUpdateProportionalPos = true; - } - - if(bUpdate && bRet) - UpdateSplitterLayout(); - - return bRet; - } - - void SetSplitterPosPct(int nPct, bool bUpdate = true) - { - ATLASSERT(nPct >= 0 && nPct <= 100); - - m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100); - UpdateProportionalPos(); - - if(bUpdate) - UpdateSplitterLayout(); - } - - int GetSplitterPos() const - { - return m_xySplitterPos; - } - - bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE); - if(!(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE)) - return false; - - if(nPane != SPLIT_PANE_NONE) - { - if(!::IsWindowVisible(m_hWndPane[nPane])) - ::ShowWindow(m_hWndPane[nPane], SW_SHOW); - int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; - ::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE); - if(m_nDefActivePane != nPane) - m_nDefActivePane = nPane; - } - else if(m_nSinglePane != SPLIT_PANE_NONE) - { - int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; - ::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW); - } - - m_nSinglePane = nPane; - UpdateSplitterLayout(); - return true; - } - - int GetSinglePaneMode() const - { - return m_nSinglePane; - } - - DWORD GetSplitterExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); -#ifdef _DEBUG - if(IsProportional() && IsRightAligned()) - ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n")); -#endif // _DEBUG - return dwPrevStyle; - } - -// Splitter operations - void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true) - { - m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop; - m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom; - ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); - if(bUpdate) - UpdateSplitterLayout(); - } - - bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - m_hWndPane[nPane] = hWnd; - ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); - if(bUpdate) - UpdateSplitterLayout(); - return true; - } - - HWND GetSplitterPane(int nPane) const - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - return m_hWndPane[nPane]; - } - - bool SetActivePane(int nPane) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - if(m_nSinglePane != SPLIT_PANE_NONE && nPane != m_nSinglePane) - return false; - ::SetFocus(m_hWndPane[nPane]); - m_nDefActivePane = nPane; - return true; - } - - int GetActivePane() const - { - int nRet = SPLIT_PANE_NONE; - HWND hWndFocus = ::GetFocus(); - if(hWndFocus != NULL) - { - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus)) - { - nRet = nPane; - break; - } - } - } - return nRet; - } - - bool ActivateNextPane(bool bNext = true) - { - int nPane = m_nSinglePane; - if(nPane == SPLIT_PANE_NONE) - { - switch(GetActivePane()) - { - case SPLIT_PANE_LEFT: - nPane = SPLIT_PANE_RIGHT; - break; - case SPLIT_PANE_RIGHT: - nPane = SPLIT_PANE_LEFT; - break; - default: - nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT; - break; - } - } - return SetActivePane(nPane); - } - - bool SetDefaultActivePane(int nPane) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - m_nDefActivePane = nPane; - return true; - } - - bool SetDefaultActivePane(HWND hWnd) - { - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(hWnd == m_hWndPane[nPane]) - { - m_nDefActivePane = nPane; - return true; - } - } - return false; // not found - } - - int GetDefaultActivePane() const - { - return m_nDefActivePane; - } - - void DrawSplitter(CDCHandle dc) - { - ATLASSERT(dc.m_hDC != NULL); - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) - return; - - T* pT = static_cast(this); - if(m_nSinglePane == SPLIT_PANE_NONE) - { - pT->DrawSplitterBar(dc); - - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(m_hWndPane[nPane] == NULL) - pT->DrawSplitterPane(dc, nPane); - } - } - else - { - if(m_hWndPane[m_nSinglePane] == NULL) - pT->DrawSplitterPane(dc, m_nSinglePane); - } - } - -// Overrideables - void DrawSplitterBar(CDCHandle dc) - { - RECT rect = { 0 }; - if(GetSplitterBarRect(&rect)) - { - dc.FillRect(&rect, COLOR_3DFACE); - -#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420)) - if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0) - { - RECT rect2 = rect; - if(t_bVertical) - rect2.left = (rect.left + rect.right) / 2 - 1; - else - rect2.top = (rect.top + rect.bottom) / 2 - 1; - - dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), t_bVertical); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - - // draw 3D edge if needed - T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) - dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM)); - } - } - - // called only if pane is empty - void DrawSplitterPane(CDCHandle dc, int nPane) - { - RECT rect = { 0 }; - if(GetSplitterPaneRect(nPane, &rect)) - { - T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0) - dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - dc.FillRect(&rect, COLOR_APPWORKSPACE); - } - } - -// Message map and handlers - BEGIN_MSG_MAP(CSplitterImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - if(IsInteractive()) - { - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - } - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->GetSystemSettings(false); - - bHandled = FALSE; - return 1; - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - // try setting position if not set - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) - pT->SetSplitterPos(); - // do painting - CPaintDC dc(pT->m_hWnd); - pT->DrawSplitter(dc.m_hDC); - return 0; - } - - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - if((HWND)wParam == pT->m_hWnd && LOWORD(lParam) == HTCLIENT) - { - DWORD dwPos = ::GetMessagePos(); - POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&ptPos); - if(IsOverSplitterBar(ptPos.x, ptPos.y)) - return 1; - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - int xPos = GET_X_LPARAM(lParam); - int yPos = GET_Y_LPARAM(lParam); - if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd) - { - int xyNewSplitPos = 0; - if(t_bVertical) - xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset; - else - xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset; - - if(xyNewSplitPos == -1) // avoid -1, that means middle - xyNewSplitPos = -2; - - if(m_xySplitterPos != xyNewSplitPos) - { - if(m_bFullDrag) - { - if(pT->SetSplitterPos(xyNewSplitPos, true)) - pT->UpdateWindow(); - } - else - { - DrawGhostBar(); - pT->SetSplitterPos(xyNewSplitPos, false); - DrawGhostBar(); - } - } - } - else // not dragging, just set cursor - { - if(IsOverSplitterBar(xPos, yPos)) - ::SetCursor(m_hCursor); - bHandled = FALSE; - } - - return 0; - } - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - int xPos = GET_X_LPARAM(lParam); - int yPos = GET_Y_LPARAM(lParam); - if(IsOverSplitterBar(xPos, yPos)) - { - T* pT = static_cast(this); - pT->SetCapture(); - ::SetCursor(m_hCursor); - if(!m_bFullDrag) - DrawGhostBar(); - if(t_bVertical) - m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos; - else - m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos; - } - bHandled = FALSE; - return 1; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - ::ReleaseCapture(); - bHandled = FALSE; - return 1; - } - - LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->SetSplitterPos(); // middle - return 0; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(!m_bFullDrag) - { - DrawGhostBar(); - UpdateSplitterLayout(); - T* pT = static_cast(this); - pT->UpdateWindow(); - } - return 0; - } - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled) - { - if(m_nSinglePane == SPLIT_PANE_NONE) - { - if(m_nDefActivePane == SPLIT_PANE_LEFT || m_nDefActivePane == SPLIT_PANE_RIGHT) - ::SetFocus(m_hWndPane[m_nDefActivePane]); - } - else - { - ::SetFocus(m_hWndPane[m_nSinglePane]); - } - bHandled = FALSE; - return 1; - } - -#ifndef _WIN32_WCE - LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT) - { - DWORD dwPos = ::GetMessagePos(); - POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&pt); - RECT rcPane = { 0 }; - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt)) - { - m_nDefActivePane = nPane; - break; - } - } - } - return lRet; - } -#endif // !_WIN32_WCE - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->GetSystemSettings(true); - - return 0; - } - -// Implementation - internal helpers - void UpdateSplitterLayout() - { - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) - return; - - T* pT = static_cast(this); - RECT rect = { 0 }; - if(m_nSinglePane == SPLIT_PANE_NONE) - { - if(GetSplitterBarRect(&rect)) - pT->InvalidateRect(&rect); - - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(GetSplitterPaneRect(nPane, &rect)) - { - if(m_hWndPane[nPane] != NULL) - ::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); - else - pT->InvalidateRect(&rect); - } - } - } - else - { - if(GetSplitterPaneRect(m_nSinglePane, &rect)) - { - if(m_hWndPane[m_nSinglePane] != NULL) - ::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); - else - pT->InvalidateRect(&rect); - } - } - } - - bool GetSplitterBarRect(LPRECT lpRect) const - { - ATLASSERT(lpRect != NULL); - if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1) - return false; - - if(t_bVertical) - { - lpRect->left = m_rcSplitter.left + m_xySplitterPos; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - lpRect->bottom = m_rcSplitter.bottom; - } - else - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top + m_xySplitterPos; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - } - - return true; - } - - bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - ATLASSERT(lpRect != NULL); - bool bRet = true; - if(m_nSinglePane != SPLIT_PANE_NONE) - { - if(nPane == m_nSinglePane) - *lpRect = m_rcSplitter; - else - bRet = false; - } - else if(nPane == SPLIT_PANE_LEFT) - { - if(t_bVertical) - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.left + m_xySplitterPos; - lpRect->bottom = m_rcSplitter.bottom; - } - else - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.top + m_xySplitterPos; - } - } - else if(nPane == SPLIT_PANE_RIGHT) - { - if(t_bVertical) - { - lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.bottom; - } - else - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.bottom; - } - } - else - { - bRet = false; - } - return bRet; - } - - bool IsOverSplitterRect(int x, int y) const - { - // -1 == don't check - return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) && - (y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom))); - } - - bool IsOverSplitterBar(int x, int y) const - { - if(m_nSinglePane != SPLIT_PANE_NONE) - return false; - if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y)) - return false; - int xy = t_bVertical ? x : y; - int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top; - return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)); - } - - void DrawGhostBar() - { - RECT rect = { 0 }; - if(GetSplitterBarRect(&rect)) - { - // convert client to window coordinates - T* pT = static_cast(this); - RECT rcWnd = { 0 }; - pT->GetWindowRect(&rcWnd); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2); - ::OffsetRect(&rect, -rcWnd.left, -rcWnd.top); - - // invert the brush pattern (looks just like frame window sizing) - CWindowDC dc(pT->m_hWnd); - CBrush brush = CDCHandle::GetHalftoneBrush(); - if(brush.m_hBrush != NULL) - { - CBrushHandle brushOld = dc.SelectBrush(brush); - dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); - dc.SelectBrush(brushOld); - } - } - } - - void GetSystemSettings(bool bUpdate) - { - if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0) - { -#ifndef _WIN32_WCE - m_cxySplitBar = ::GetSystemMetrics(t_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME); -#else // CE specific - m_cxySplitBar = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); -#endif // _WIN32_WCE - } - - T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE)) - { - m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); - m_cxyMin = 0; - } - else - { - m_cxyBarEdge = 0; - m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); - } - -#ifndef _WIN32_WCE - ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0); -#endif // !_WIN32_WCE - - if(bUpdate) - UpdateSplitterLayout(); - } - - bool IsProportional() const - { - return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0); - } - - void StoreProportionalPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal); - else - m_nProportionalPos = 0; - ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos); - } - - void UpdateProportionalPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - { - int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax); - m_bUpdateProportionalPos = false; - T* pT = static_cast(this); - pT->SetSplitterPos(xyNewPos, false); - } - } - - bool IsRightAligned() const - { - return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0); - } - - void StoreRightAlignPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - m_nProportionalPos = cxyTotal - m_xySplitterPos; - else - m_nProportionalPos = 0; - ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos); - } - - void UpdateRightAlignPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - { - m_bUpdateProportionalPos = false; - T* pT = static_cast(this); - pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false); - } - } - - bool IsInteractive() const - { - return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0); - } -}; - -template HCURSOR CSplitterImpl< T, t_bVertical>::m_hCursor = NULL; - - -/////////////////////////////////////////////////////////////////////////////// -// CSplitterWindowImpl - Implements a splitter window - -template -class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical > -{ -public: - DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW) - - typedef CSplitterImpl< T , t_bVertical > _baseClass; - - BEGIN_MSG_MAP(CSplitterWindowImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(_baseClass) - FORWARD_NOTIFICATIONS() - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // handled, no background painting needed - return 1; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam != SIZE_MINIMIZED) - SetSplitterRect(); - - bHandled = FALSE; - return 1; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSplitterWindow - Implements a splitter window to be used as is - -template -class CSplitterWindowT : public CSplitterWindowImpl, t_bVertical> -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW) -}; - -typedef CSplitterWindowT CSplitterWindow; -typedef CSplitterWindowT CHorSplitterWindow; - -}; // namespace WTL - -#endif // __ATLSPLIT_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atltheme.h b/GLideN64/src/GLideNUI-wtl/WTL/atltheme.h deleted file mode 100644 index a5168b9..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atltheme.h +++ /dev/null @@ -1,1218 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLTHEME_H__ -#define __ATLTHEME_H__ - -#pragma once - -#ifdef _WIN32_WCE - #error atltheme.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atltheme.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atltheme.h requires atlwin.h to be included first -#endif - -#if (_WIN32_WINNT < 0x0501) - #error atltheme.h requires _WIN32_WINNT >= 0x0501 -#endif // (_WIN32_WINNT < 0x0501) - -#if defined(_WTL_USE_VSSYM32) || (defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)) - #include -#else - #ifndef TMSCHEMA_H - #include - #endif -#endif - -#ifndef _UXTHEME_H_ -#include -#endif -#pragma comment(lib, "uxtheme.lib") - -// Note: To create an application that also runs on older versions of Windows, -// use delay load of uxtheme.dll and ensure that no calls to the Theme API are -// made if theming is not supported. It is enough to check if m_hTheme is NULL. -// Example: -// if(m_hTheme != NULL) -// { -// DrawThemeBackground(dc, BP_PUSHBUTTON, PBS_NORMAL, &rect, NULL); -// DrawThemeText(dc, BP_PUSHBUTTON, PBS_NORMAL, L"Button", -1, DT_SINGLELINE | DT_CENTER | DT_VCENTER, 0, &rect); -// } -// else -// { -// dc.DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH); -// dc.DrawText(_T("Button"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); -// } -// -// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, -// and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the -// project properties. -#if (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) - #pragma comment(lib, "delayimp.lib") - #pragma comment(linker, "/delayload:uxtheme.dll") -#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) - -// Hack: Signatures in uxtheme.h changed - the only way to check which variant of uxtheme.h -// is included is to check for presence of new defines MAX_THEMECOLOR and MAX_THEMESIZE -#ifndef _WTL_NEW_UXTHEME - #if defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) - #define _WTL_NEW_UXTHEME - #endif // defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) -#endif // _WTL_NEW_UXTHEME - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CTheme -// CThemeImpl -// -// CBufferedPaint -// CBufferedPaintImpl -// CBufferedPaintWindowImpl -// CBufferedAnimation -// CBufferedAnimationImpl -// CBufferedAnimationWindowImpl -// -// Global functions: -// AtlDrawThemeClientEdge() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CTheme - wrapper for theme handle - -class CTheme -{ -public: -// Data members - HTHEME m_hTheme; - static int m_nIsThemingSupported; - -// Constructor - CTheme(HTHEME hTheme = NULL) : m_hTheme(hTheme) - { - IsThemingSupported(); - } - -// Operators and helpers - bool IsThemeNull() const - { - return (m_hTheme == NULL); - } - - CTheme& operator =(HTHEME hTheme) - { - m_hTheme = hTheme; - return *this; - } - - operator HTHEME() const - { - return m_hTheme; - } - - void Attach(HTHEME hTheme) - { - m_hTheme = hTheme; - } - - HTHEME Detach() - { - HTHEME hTheme = m_hTheme; - m_hTheme = NULL; - return hTheme; - } - -// Theme support helper - static bool IsThemingSupported() - { - if(m_nIsThemingSupported == -1) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CTheme::IsThemingSupported.\n")); - ATLASSERT(FALSE); - return false; - } - - if(m_nIsThemingSupported == -1) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - m_nIsThemingSupported = (hThemeDLL != NULL) ? 1 : 0; - if(hThemeDLL != NULL) - ::FreeLibrary(hThemeDLL); - } - - lock.Unlock(); - } - - ATLASSERT(m_nIsThemingSupported != -1); - return (m_nIsThemingSupported == 1); - } - -// Operations and theme properties - HTHEME OpenThemeData(HWND hWnd, LPCWSTR pszClassList) - { - if(!IsThemingSupported()) - return NULL; - - ATLASSERT(m_hTheme == NULL); - m_hTheme = ::OpenThemeData(hWnd, pszClassList); - return m_hTheme; - } - - HRESULT CloseThemeData() - { - HRESULT hRet = S_FALSE; - if(m_hTheme != NULL) - { - hRet = ::CloseThemeData(m_hTheme); - if(SUCCEEDED(hRet)) - m_hTheme = NULL; - } - return hRet; - } - - HRESULT DrawThemeBackground(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, LPCRECT pClipRect = NULL) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect); - } - - HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions); - } - - HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeText(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, dwTextFlags2, pRect); - } - - HRESULT GetThemeBackgroundContentRect(HDC hDC, int nPartID, int nStateID, LPCRECT pBoundingRect, LPRECT pContentRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBackgroundContentRect(m_hTheme, hDC, nPartID, nStateID, pBoundingRect, pContentRect); - } - - HRESULT GetThemeBackgroundExtent(HDC hDC, int nPartID, int nStateID, LPCRECT pContentRect, LPRECT pExtentRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect); - } - - HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize); - } - - HRESULT GetThemeTextExtent(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, LPCRECT pBoundingRect, LPRECT pExtentRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeTextExtent(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, pBoundingRect, pExtentRect); - } - - HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to PTEXTMETRIC is because uxtheme.h incorrectly uses it instead of PTEXTMETRICW - return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, (PTEXTMETRIC)pTextMetric); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBackgroundRegion(m_hTheme, hDC, nPartID, nStateID, pRect, pRegion); - } - - HRESULT HitTestThemeBackground(HDC hDC, int nPartID, int nStateID, DWORD dwOptions, LPCRECT pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) const - { - ATLASSERT(m_hTheme != NULL); - return ::HitTestThemeBackground(m_hTheme, hDC, nPartID, nStateID, dwOptions, pRect, hrgn, ptTest, pwHitTestCode); - } - - HRESULT DrawThemeEdge(HDC hDC, int nPartID, int nStateID, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect = NULL) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeEdge(m_hTheme, hDC, nPartID, nStateID, pDestRect, uEdge, uFlags, pContentRect); - } - - HRESULT DrawThemeIcon(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HIMAGELIST himl, int nImageIndex) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeIcon(m_hTheme, hDC, nPartID, nStateID, pRect, himl, nImageIndex); - } - - BOOL IsThemePartDefined(int nPartID, int nStateID) const - { - ATLASSERT(m_hTheme != NULL); - return ::IsThemePartDefined(m_hTheme, nPartID, nStateID); - } - - BOOL IsThemeBackgroundPartiallyTransparent(int nPartID, int nStateID) const - { - ATLASSERT(m_hTheme != NULL); - return ::IsThemeBackgroundPartiallyTransparent(m_hTheme, nPartID, nStateID); - } - - HRESULT GetThemeColor(int nPartID, int nStateID, int nPropID, COLORREF* pColor) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeColor(m_hTheme, nPartID, nStateID, nPropID, pColor); - } - - HRESULT GetThemeMetric(HDC hDC, int nPartID, int nStateID, int nPropID, int* pnVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeMetric(m_hTheme, hDC, nPartID, nStateID, nPropID, pnVal); - } - - HRESULT GetThemeString(int nPartID, int nStateID, int nPropID, LPWSTR pszBuff, int cchMaxBuffChars) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeString(m_hTheme, nPartID, nStateID, nPropID, pszBuff, cchMaxBuffChars); - } - - HRESULT GetThemeBool(int nPartID, int nStateID, int nPropID, BOOL* pfVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBool(m_hTheme, nPartID, nStateID, nPropID, pfVal); - } - - HRESULT GetThemeInt(int nPartID, int nStateID, int nPropID, int* pnVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeInt(m_hTheme, nPartID, nStateID, nPropID, pnVal); - } - - HRESULT GetThemeEnumValue(int nPartID, int nStateID, int nPropID, int* pnVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeEnumValue(m_hTheme, nPartID, nStateID, nPropID, pnVal); - } - - HRESULT GetThemePosition(int nPartID, int nStateID, int nPropID, LPPOINT pPoint) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemePosition(m_hTheme, nPartID, nStateID, nPropID, pPoint); - } - - // deprecated - HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeRect(m_hTheme, nPartID, nStateID, nPropID, pRect); - } - - HRESULT GetThemeMargins(HDC hDC, int nPartID, int nStateID, int nPropID, LPRECT pRect, PMARGINS pMargins) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeMargins(m_hTheme, hDC, nPartID, nStateID, nPropID, pRect, pMargins); - } - - HRESULT GetThemeIntList(int nPartID, int nStateID, int nPropID, INTLIST* pIntList) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeIntList(m_hTheme, nPartID, nStateID, nPropID, pIntList); - } - - HRESULT GetThemePropertyOrigin(int nPartID, int nStateID, int nPropID, enum PROPERTYORIGIN* pOrigin) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemePropertyOrigin(m_hTheme, nPartID, nStateID, nPropID, pOrigin); - } - - HRESULT GetThemeFilename(int nPartID, int nStateID, int nPropID, LPWSTR pszThemeFileName, int cchMaxBuffChars) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeFilename(m_hTheme, nPartID, nStateID, nPropID, pszThemeFileName, cchMaxBuffChars); - } - - COLORREF GetThemeSysColor(int nColorID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysColor(m_hTheme, nColorID); - } - - HBRUSH GetThemeSysColorBrush(int nColorID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysColorBrush(m_hTheme, nColorID); - } - - int GetThemeSysSize(int nSizeID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysSize(m_hTheme, nSizeID); - } - - BOOL GetThemeSysBool(int nBoolID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysBool(m_hTheme, nBoolID); - } - - HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeSysFont(m_hTheme, nFontID, plf); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeSysFont(m_hTheme, nFontID, (LOGFONT*)plf); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysString(m_hTheme, nStringID, pszStringBuff, cchMaxStringChars); - } - - HRESULT GetThemeSysInt(int nIntID, int* pnValue) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysInt(m_hTheme, nIntID, pnValue); - } - -#ifdef _WTL_NEW_UXTHEME - HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags) - { - if(!IsThemingSupported()) - return NULL; - - ATLASSERT(m_hTheme == NULL); - m_hTheme = ::OpenThemeDataEx(hWnd, pszClassList, dwFlags); - return m_hTheme; - } - - HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeTextEx(m_hTheme, hDC, nPartID, nStateID, pszText, cchText, dwTextFlags, lpRect, pOptions); - } - - HRESULT GetThemeTransitionDuration(int nPartID, int nFromStateID, int nToStateID, int nPropID, DWORD& dwDuration) - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration); - } -#endif // _WTL_NEW_UXTHEME - -#if (_WIN32_WINNT >= 0x0600) - HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap) - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBitmap(m_hTheme, nPartID, nStateID, nPropID, uFlags, &hBitmap); - } - - HRESULT GetThemeStream(int nPartID, int nStateID, int nPropID, VOID** ppvStream, DWORD* pcbStream, HINSTANCE hInstance) - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance); - } -#endif // (_WIN32_WINNT >= 0x0600) -}; - -__declspec(selectany) int CTheme::m_nIsThemingSupported = -1; - - -/////////////////////////////////////////////////////////////////////////////// -// CThemeImpl - theme support implementation - -// Derive from this class to implement window with theme support. -// Example: -// class CMyThemeWindow : public CWindowImpl, public CThemeImpl -// { -// ... -// BEGIN_MSG_MAP(CMyThemeWindow) -// CHAIN_MSG_MAP(CThemeImpl) -// ... -// END_MSG_MAP() -// ... -// }; -// -// If you set theme class list, the class will automaticaly open/close/reopen theme data. - - -// Helper for drawing theme client edge -inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = NULL, HBRUSH hBrush = NULL, int nPartID = 0, int nStateID = 0) -{ - ATLASSERT(hTheme != NULL); - ATLASSERT(::IsWindow(hWnd)); - - CWindowDC dc(hWnd); - if(dc.IsNull()) - return false; - - // Get border size - int cxBorder = GetSystemMetrics(SM_CXBORDER); - int cyBorder = GetSystemMetrics(SM_CYBORDER); - if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder))) - cyBorder = cxBorder; - - RECT rect; - ::GetWindowRect(hWnd, &rect); - - // Remove the client edge from the update region - int cxEdge = GetSystemMetrics(SM_CXEDGE); - int cyEdge = GetSystemMetrics(SM_CYEDGE); - ::InflateRect(&rect, -cxEdge, -cyEdge); - CRgn rgn; - rgn.CreateRectRgnIndirect(&rect); - if(rgn.IsNull()) - return false; - - if(hRgnUpdate != NULL) - rgn.CombineRgn(hRgnUpdate, rgn, RGN_AND); - - ::OffsetRect(&rect, -rect.left, -rect.top); - - ::OffsetRect(&rect, cxEdge, cyEdge); - dc.ExcludeClipRect(&rect); - ::InflateRect(&rect, cxEdge, cyEdge); - - ::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL); - - // Use background brush too, since theme border might not cover everything - if(cxBorder < cxEdge && cyBorder < cyEdge) - { - if(hBrush == NULL) -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND); -#else - hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND)); -#endif - - ::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge); - dc.FillRect(&rect, hBrush); - } - - ::DefWindowProc(hWnd, WM_NCPAINT, (WPARAM)rgn.m_hRgn, 0L); - - return true; -} - - -// Theme extended styles -#define THEME_EX_3DCLIENTEDGE 0x00000001 -#define THEME_EX_THEMECLIENTEDGE 0x00000002 - -template -class CThemeImpl : public TBase -{ -public: -// Data members - LPWSTR m_lpstrThemeClassList; - DWORD m_dwExtendedStyle; // theme specific extended styles - -// Constructor & destructor - CThemeImpl() : m_lpstrThemeClassList(NULL), m_dwExtendedStyle(0) - { } - - ~CThemeImpl() - { - delete [] m_lpstrThemeClassList; - } - -// Attributes - bool SetThemeClassList(LPCWSTR lpstrThemeClassList) - { - if(m_lpstrThemeClassList != NULL) - { - delete [] m_lpstrThemeClassList; - m_lpstrThemeClassList = NULL; - } - - if(lpstrThemeClassList == NULL) - return true; - - int cchLen = lstrlenW(lpstrThemeClassList) + 1; - ATLTRY(m_lpstrThemeClassList = new WCHAR[cchLen]); - if(m_lpstrThemeClassList == NULL) - return false; - - SecureHelper::strcpyW_x(m_lpstrThemeClassList, cchLen, lpstrThemeClassList); - - return true; - } - - bool GetThemeClassList(LPWSTR lpstrThemeClassList, int cchListBuffer) const - { - int cchLen = lstrlenW(m_lpstrThemeClassList) + 1; - if(cchListBuffer < cchLen) - return false; - - SecureHelper::strcpyW_x(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList); - - return true; - } - - LPCWSTR GetThemeClassList() const - { - return m_lpstrThemeClassList; - } - - DWORD SetThemeExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - DWORD GetThemeExtendedStyle() const - { - return m_dwExtendedStyle; - } - -// Operations - HTHEME OpenThemeData() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_lpstrThemeClassList != NULL); - if(m_lpstrThemeClassList == NULL) - return NULL; - CloseThemeData(); - return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList); - } - - HTHEME OpenThemeData(LPCWSTR pszClassList) - { - if(!SetThemeClassList(pszClassList)) - return NULL; - return OpenThemeData(); - } - - HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::SetWindowTheme(pT->m_hWnd, pszSubAppName, pszSubIDList); - } - - HTHEME GetWindowTheme() const - { - if(!IsThemingSupported()) - return NULL; - - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::GetWindowTheme(pT->m_hWnd); - } - - HRESULT EnableThemeDialogTexture(DWORD dwFlags) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::EnableThemeDialogTexture(pT->m_hWnd, dwFlags); - } - - BOOL IsThemeDialogTextureEnabled() const - { - if(!IsThemingSupported()) - return FALSE; - - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::IsThemeDialogTextureEnabled(pT->m_hWnd); - } - - HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); -#ifdef _WTL_NEW_UXTHEME - return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect); -#else - return ::DrawThemeParentBackground(pT->m_hWnd, hDC, (RECT*)pRect); -#endif - } - -#ifdef _WTL_NEW_UXTHEME - HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::SetWindowThemeAttribute(pT->m_hWnd, type, pvAttribute, cbAttribute); - } - - HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - WTA_OPTIONS opt = { dwAttributes, dwMask }; - return ::SetWindowThemeAttribute(pT->m_hWnd, WTA_NONCLIENT, (PVOID)&opt, sizeof(opt)); - } - - HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect); - } -#endif // _WTL_NEW_UXTHEME - -// Message map and handlers - // Note: If you handle any of these messages in your derived class, - // it is better to put CHAIN_MSG_MAP at the start of your message map. - BEGIN_MSG_MAP(CThemeImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) - MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_lpstrThemeClassList != NULL) - OpenThemeData(); - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - CloseThemeData(); - bHandled = FALSE; - return 1; - } - - LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - CloseThemeData(); - if(m_lpstrThemeClassList != NULL) - OpenThemeData(); - bHandled = FALSE; - return 1; - } - - LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - LRESULT lRet = 0; - bHandled = FALSE; - if(IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)) - { - if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0) - { - lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam); - bHandled = TRUE; - } - else if((m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0)) - { - HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL; - if(pT->DrawThemeClientEdge(hRgn)) - bHandled = TRUE; - } - } - return lRet; - } - -// Drawing helper - bool DrawThemeClientEdge(HRGN hRgnUpdate) - { - T* pT = static_cast(this); - return AtlDrawThemeClientEdge(m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Buffered Paint and Animation - -#ifdef _WTL_NEW_UXTHEME - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaintBase - Buffered Paint support for othe classes - -class CBufferedPaintBase -{ -public: - static int m_nIsBufferedPaintSupported; - - CBufferedPaintBase() - { - if(IsBufferedPaintSupported()) - ATLVERIFY(SUCCEEDED(::BufferedPaintInit())); - } - - ~CBufferedPaintBase() - { - if(IsBufferedPaintSupported()) - ATLVERIFY(SUCCEEDED(::BufferedPaintUnInit())); - } - - static bool IsBufferedPaintSupported() - { - if(m_nIsBufferedPaintSupported == -1) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CBufferedPaintBase::IsBufferedPaintSupported.\n")); - ATLASSERT(FALSE); - return false; - } - - if(m_nIsBufferedPaintSupported == -1) - m_nIsBufferedPaintSupported = RunTimeHelper::IsVista() ? 1 : 0; - - lock.Unlock(); - } - - ATLASSERT(m_nIsBufferedPaintSupported != -1); - return (m_nIsBufferedPaintSupported == 1); - } -}; - -__declspec(selectany) int CBufferedPaintBase::m_nIsBufferedPaintSupported = -1; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaint - support for buffered paint functions - -class CBufferedPaint -{ -public: - HPAINTBUFFER m_hPaintBuffer; - - CBufferedPaint() : m_hPaintBuffer(NULL) - { } - - ~CBufferedPaint() - { - ATLVERIFY(SUCCEEDED(End())); - } - - bool IsNull() const - { - return (m_hPaintBuffer == NULL); - } - - HPAINTBUFFER Begin(HDC hdcTarget, const RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, HDC* phdcPaint) - { - ATLASSERT(m_hPaintBuffer == NULL); - m_hPaintBuffer = ::BeginBufferedPaint(hdcTarget, prcTarget, dwFormat, pPaintParams, phdcPaint); - return m_hPaintBuffer; - } - - HRESULT End(BOOL bUpdate = TRUE) - { - HRESULT hRet = S_FALSE; - if(m_hPaintBuffer != NULL) - { - hRet = ::EndBufferedPaint(m_hPaintBuffer, bUpdate); - m_hPaintBuffer = NULL; - } - return hRet; - } - - HRESULT GetTargetRect(LPRECT pRect) const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintTargetRect(m_hPaintBuffer, pRect); - } - - HDC GetTargetDC() const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintTargetDC(m_hPaintBuffer); - } - - HDC GetPaintDC() const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintDC(m_hPaintBuffer); - } - - HRESULT GetBits(RGBQUAD** ppbBuffer, int* pcxRow) const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintBits(m_hPaintBuffer, ppbBuffer, pcxRow); - } - - HRESULT Clear(const RECT* pRect = NULL) - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::BufferedPaintClear(m_hPaintBuffer, pRect); - } - - HRESULT SetAlpha(BYTE alpha, const RECT* pRect = NULL) - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, alpha); - } - - HRESULT MakeOpaque(const RECT* pRect = NULL) - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, 255); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaintImpl - provides buffered paint for any window - -template -class ATL_NO_VTABLE CBufferedPaintImpl : public CBufferedPaintBase -{ -public: - CBufferedPaint m_BufferedPaint; - BP_BUFFERFORMAT m_dwFormat; - BP_PAINTPARAMS m_PaintParams; - - CBufferedPaintImpl() : m_dwFormat(BPBF_TOPDOWNDIB) - { - memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); - m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); - } - -// Message map and handlers - BEGIN_MSG_MAP(CBufferedPaintImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - pT->DoPaint((HDC)wParam, rect); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->DoBufferedPaint(dc.m_hDC, dc.m_ps.rcPaint); - } - - return 0; - } - -// Overrideables - void DoBufferedPaint(CDCHandle dc, RECT& rect) - { - HDC hDCPaint = NULL; - if(IsBufferedPaintSupported()) - m_BufferedPaint.Begin(dc, &rect, m_dwFormat, &m_PaintParams, &hDCPaint); - - T* pT = static_cast(this); - if(hDCPaint != NULL) - pT->DoPaint(hDCPaint, rect); - else - pT->DoPaint(dc.m_hDC, rect); - - if(IsBufferedPaintSupported()) - m_BufferedPaint.End(); - } - - void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaintWindowImpl - implements a window that uses buffered paint - -template -class ATL_NO_VTABLE CBufferedPaintWindowImpl : - public ATL::CWindowImpl, - public CBufferedPaintImpl< T > -{ -public: - BEGIN_MSG_MAP(CBufferedPaintWindowImpl) - CHAIN_MSG_MAP(CBufferedPaintImpl< T >) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedAnimation - support for buffered animation - -class CBufferedAnimation -{ -public: - HANIMATIONBUFFER m_hAnimationBuffer; - - CBufferedAnimation() : m_hAnimationBuffer(NULL) - { } - - ~CBufferedAnimation() - { - ATLVERIFY(SUCCEEDED(End())); - } - - bool IsNull() const - { - return (m_hAnimationBuffer == NULL); - } - - HANIMATIONBUFFER Begin(HWND hWnd, HDC hDCTarget, const RECT* pRectTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, BP_ANIMATIONPARAMS* pAnimationParams, HDC* phdcFrom, HDC* phdcTo) - { - ATLASSERT(m_hAnimationBuffer == NULL); - m_hAnimationBuffer = ::BeginBufferedAnimation(hWnd, hDCTarget, pRectTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo); - return m_hAnimationBuffer; - } - - HRESULT End(BOOL bUpdate = TRUE) - { - HRESULT hRet = S_FALSE; - if(m_hAnimationBuffer != NULL) - { - hRet = ::EndBufferedAnimation(m_hAnimationBuffer, bUpdate); - m_hAnimationBuffer = NULL; - } - return hRet; - } - - static bool IsRendering(HWND hWnd, HDC hDC) - { - return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedAnimationImpl - provides buffered animation support for any window - -// Note: You can either use m_State and m_NewState to store the state information -// for the animation change, or map your state to those data members. DoPaint() -// should only rely on the state information that is passed to it. - -template -class ATL_NO_VTABLE CBufferedAnimationImpl : public CBufferedPaintBase -{ -public: - BP_BUFFERFORMAT m_dwFormat; - BP_PAINTPARAMS m_PaintParams; - BP_ANIMATIONPARAMS m_AnimationParams; - - TState m_State; - TState m_NewState; - - CBufferedAnimationImpl(TState InitialState) : m_dwFormat(BPBF_TOPDOWNDIB) - { - memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); - m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); - - memset(&m_AnimationParams, 0, sizeof(BP_ANIMATIONPARAMS)); - m_AnimationParams.cbSize = sizeof(BP_ANIMATIONPARAMS); - m_AnimationParams.style = BPAS_LINEAR; - m_AnimationParams.dwDuration = 500; - - T* pT = static_cast(this); - pT->SetState(InitialState); - pT->SetNewState(InitialState); - } - - DWORD GetDuration() const - { - return m_AnimationParams.dwDuration; - } - - void SetDuration(DWORD dwDuration) - { - m_AnimationParams.dwDuration = dwDuration; - } - - void DoAnimation(TState NewState, const RECT* pRect = NULL) - { - T* pT = static_cast(this); - pT->SetNewState(NewState); - - pT->InvalidateRect(pRect, FALSE); - pT->UpdateWindow(); - - pT->SetState(NewState); - } - -// Message map and handlers - BEGIN_MSG_MAP(CBufferedAnimationImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - pT->DoPaint((HDC)wParam, rect, m_NewState); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->DoAnimationPaint(dc.m_hDC, dc.m_ps.rcPaint); - } - - return 0; - } - -// Overrideables - void SetState(TState State) - { - m_State = State; - } - - void SetNewState(TState State) - { - m_NewState = State; - } - - bool AreStatesEqual() const - { - return (m_State == m_NewState); - } - - void DoAnimationPaint(CDCHandle dc, RECT& rect) - { - T* pT = static_cast(this); - if(IsBufferedPaintSupported() && CBufferedAnimation::IsRendering(pT->m_hWnd, dc)) - return; - - DWORD dwDurationSave = m_AnimationParams.dwDuration; - if(pT->AreStatesEqual()) - m_AnimationParams.dwDuration = 0; - - HDC hdcFrom = NULL, hdcTo = NULL; - CBufferedAnimation ba; - if(IsBufferedPaintSupported()) - ba.Begin(pT->m_hWnd, dc, &rect, m_dwFormat, &m_PaintParams, &m_AnimationParams, &hdcFrom, &hdcTo); - - if(!ba.IsNull()) - { - if(hdcFrom != NULL) - pT->DoPaint(hdcFrom, rect, m_State); - - if (hdcTo != NULL) - pT->DoPaint(hdcTo, rect, m_NewState); - } - else - { - pT->DoPaint(dc.m_hDC, rect, m_NewState); - } - - m_AnimationParams.dwDuration = dwDurationSave; - } - - void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/, TState /*State*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedAnimationWindowImpl - implements a window that uses buffered animation - -template -class ATL_NO_VTABLE CBufferedAnimationWindowImpl : - public ATL::CWindowImpl, - public CBufferedAnimationImpl< T, TState > -{ -public: - CBufferedAnimationWindowImpl(TState InitialState) : CBufferedAnimationImpl< T, TState >(InitialState) - { } - - typedef CBufferedAnimationImpl< T, TState > _baseBufferedAnimation; - BEGIN_MSG_MAP(CBufferedAnimationWindowImpl) - CHAIN_MSG_MAP(_baseBufferedAnimation) - END_MSG_MAP() -}; - -#endif // _WTL_NEW_UXTHEME - -}; // namespace WTL - -#endif // __ATLTHEME_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atluser.h b/GLideN64/src/GLideNUI-wtl/WTL/atluser.h deleted file mode 100644 index 31dd38f..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atluser.h +++ /dev/null @@ -1,1391 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLUSER_H__ -#define __ATLUSER_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atluser.h requires atlapp.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CMenuItemInfo -// CMenuT -// CAcceleratorT -// CIconT -// CCursorT -// CResource -// -// Global functions: -// AtlMessageBox() -// -// AtlLoadAccelerators() -// AtlLoadMenu() -// AtlLoadBitmap() -// AtlLoadSysBitmap() -// AtlLoadCursor() -// AtlLoadSysCursor() -// AtlLoadIcon() -// AtlLoadSysIcon() -// AtlLoadBitmapImage() -// AtlLoadCursorImage() -// AtlLoadIconImage() -// AtlLoadSysBitmapImage() -// AtlLoadSysCursorImage() -// AtlLoadSysIconImage() -// AtlLoadString() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// AtlMessageBox - accepts both memory and resource based strings - -inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION) -{ - ATLASSERT(hWndOwner == NULL || ::IsWindow(hWndOwner)); - - LPTSTR lpstrMessage = NULL; - if(IS_INTRESOURCE(message.m_lpstr)) - { - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrMessage = new TCHAR[nLen]); - if(lpstrMessage == NULL) - { - ATLASSERT(FALSE); - return 0; - } - int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(message.m_lpstr), lpstrMessage, nLen); - if(nRes < nLen - 1) - break; - delete [] lpstrMessage; - lpstrMessage = NULL; - } - - message.m_lpstr = lpstrMessage; - } - - LPTSTR lpstrTitle = NULL; - if(IS_INTRESOURCE(title.m_lpstr) && LOWORD(title.m_lpstr) != 0) - { - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrTitle = new TCHAR[nLen]); - if(lpstrTitle == NULL) - { - ATLASSERT(FALSE); - return 0; - } - int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(title.m_lpstr), lpstrTitle, nLen); - if(nRes < nLen - 1) - break; - delete [] lpstrTitle; - lpstrTitle = NULL; - } - - title.m_lpstr = lpstrTitle; - } - - int nRet = ::MessageBox(hWndOwner, message.m_lpstr, title.m_lpstr, uType); - - delete [] lpstrMessage; - delete [] lpstrTitle; - - return nRet; -} - - -/////////////////////////////////////////////////////////////////////////////// -// CMenu - -#if (WINVER >= 0x0500) - #ifndef MII_SIZEOF_STRUCT - #define MII_SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) - #endif - #define MENUITEMINFO_SIZE_VERSION_400A MII_SIZEOF_STRUCT(MENUITEMINFOA, cch) - #define MENUITEMINFO_SIZE_VERSION_400W MII_SIZEOF_STRUCT(MENUITEMINFOW, cch) - #ifdef UNICODE - #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400W - #else - #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400A - #endif // !UNICODE -#endif // (WINVER >= 0x0500) - -class CMenuItemInfo : public MENUITEMINFO -{ -public: - CMenuItemInfo() - { - memset(this, 0, sizeof(MENUITEMINFO)); - cbSize = sizeof(MENUITEMINFO); -#if (WINVER >= 0x0500) - // adjust struct size if running on older version of Windows - if(AtlIsOldWindows()) - { - ATLASSERT(cbSize > MENUITEMINFO_SIZE_VERSION_400); // must be - cbSize = MENUITEMINFO_SIZE_VERSION_400; - } -#endif // (WINVER >= 0x0500) - } -}; - - -// forward declarations -template class CMenuT; -typedef CMenuT CMenuHandle; -typedef CMenuT CMenu; - - -template -class CMenuT -{ -public: -// Data members - HMENU m_hMenu; - -// Constructor/destructor/operators - CMenuT(HMENU hMenu = NULL) : m_hMenu(hMenu) - { } - - ~CMenuT() - { - if(t_bManaged && m_hMenu != NULL) - DestroyMenu(); - } - - CMenuT& operator =(HMENU hMenu) - { - Attach(hMenu); - return *this; - } - - void Attach(HMENU hMenuNew) - { - ATLASSERT(::IsMenu(hMenuNew)); - if(t_bManaged && m_hMenu != NULL && m_hMenu != hMenuNew) - ::DestroyMenu(m_hMenu); - m_hMenu = hMenuNew; - } - - HMENU Detach() - { - HMENU hMenu = m_hMenu; - m_hMenu = NULL; - return hMenu; - } - - operator HMENU() const { return m_hMenu; } - - bool IsNull() const { return (m_hMenu == NULL); } - - BOOL IsMenu() const - { - return ::IsMenu(m_hMenu); - } - -// Create/destroy methods - BOOL CreateMenu() - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::CreateMenu(); - return (m_hMenu != NULL) ? TRUE : FALSE; - } - - BOOL CreatePopupMenu() - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::CreatePopupMenu(); - return (m_hMenu != NULL) ? TRUE : FALSE; - } - - BOOL LoadMenu(ATL::_U_STRINGorID menu) - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); - return (m_hMenu != NULL) ? TRUE : FALSE; - } - -#ifndef _WIN32_WCE - BOOL LoadMenuIndirect(const void* lpMenuTemplate) - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::LoadMenuIndirect(lpMenuTemplate); - return (m_hMenu != NULL) ? TRUE : FALSE; - } -#endif // !_WIN32_WCE - - BOOL DestroyMenu() - { - if (m_hMenu == NULL) - return FALSE; - BOOL bRet = ::DestroyMenu(m_hMenu); - if(bRet) - m_hMenu = NULL; - return bRet; - } - -// Menu Operations - BOOL DeleteMenu(UINT nPosition, UINT nFlags) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::DeleteMenu(m_hMenu, nPosition, nFlags); - } - - BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); -#ifndef _WIN32_WCE -#if (WINVER >= 0x0500) - x = _FixTrackMenuPopupX(x, y); -#endif // !(WINVER >= 0x0500) - return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect); -#else // CE specific - lpRect; - return ::TrackPopupMenuEx(m_hMenu, nFlags, x, y, hWnd, NULL); -#endif // _WIN32_WCE - } - - BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - x = _FixTrackMenuPopupX(x, y); -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm); - } - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - // helper that fixes popup menu X position when it's off-screen - static int _FixTrackMenuPopupX(int x, int y) - { - POINT pt = { x, y }; - HMONITOR hMonitor = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); - if(hMonitor == NULL) - { - HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); - if(hMonitorNear != NULL) - { - MONITORINFO mi = { 0 }; - mi.cbSize = sizeof(MONITORINFO); - if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE) - { - if(x < mi.rcWork.left) - x = mi.rcWork.left; - else if(x > mi.rcWork.right) - x = mi.rcWork.right; - } - } - } - - return x; - } - - BOOL GetMenuInfo(LPMENUINFO lpMenuInfo) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuInfo(m_hMenu, lpMenuInfo); - } - - BOOL SetMenuInfo(LPCMENUINFO lpMenuInfo) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuInfo(m_hMenu, lpMenuInfo); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - -// Menu Item Operations - BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, lpszNewItem); - } - - BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); - } - -#ifndef _WIN32_WCE - BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::AppendMenu(m_hMenu, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); - } - - BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); - } -#endif // !_WIN32_WCE - - UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck) - { - ATLASSERT(::IsMenu(m_hMenu)); - return (UINT)::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); - } - - UINT EnableMenuItem(UINT nIDEnableItem, UINT nEnable) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); - } - -#ifndef _WIN32_WCE - BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::HiliteMenuItem(hWnd, m_hMenu, uIDHiliteItem, uHilite); - } - - int GetMenuItemCount() const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuItemCount(m_hMenu); - } - - UINT GetMenuItemID(int nPos) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuItemID(m_hMenu, nPos); - } - - UINT GetMenuState(UINT nID, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuState(m_hMenu, nID, nFlags); - } - - int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); - } - - int GetMenuStringLen(UINT nIDItem, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); - } - -#ifndef _ATL_NO_COM - BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const - { - USES_CONVERSION; - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(bstrText == NULL); - - int nLen = GetMenuStringLen(nIDItem, nFlags); - if(nLen == 0) - { - bstrText = ::SysAllocString(OLESTR("")); - return (bstrText != NULL) ? TRUE : FALSE; - } - - nLen++; // increment to include terminating NULL char - CTempBuffer buff; - LPTSTR lpszText = buff.Allocate(nLen); - if(lpszText == NULL) - return FALSE; - - if(!GetMenuString(nIDItem, lpszText, nLen, nFlags)) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpszText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#elif (_ATL_VER >= 0x0800) - int GetMenuItemCount() const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuItemCount(m_hMenu); - } - - UINT GetMenuItemID(int nPos) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuItemID(m_hMenu, nPos); - } - - UINT GetMenuState(UINT nID, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuState(m_hMenu, nID, nFlags); - } - - int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); - } - - int GetMenuStringLen(UINT nIDItem, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); - } -#endif // (_ATL_VER >= 0x0800) - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetMenuString(UINT nIDItem, _CSTRING_NS::CString& strText, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - - int nLen = GetMenuStringLen(nIDItem, nFlags); - if(nLen == 0) - return 0; - - nLen++; // increment to include terminating NULL char - LPTSTR lpstr = strText.GetBufferSetLength(nLen); - if(lpstr == NULL) - return 0; - int nRet = GetMenuString(nIDItem, lpstr, nLen, nFlags); - strText.ReleaseBuffer(); - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - CMenuHandle GetSubMenu(int nPos) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return CMenuHandle(::GetSubMenu(m_hMenu, nPos)); - } - - BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); - } - - BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); - } - -#ifndef _WIN32_WCE - BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); - } - - BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); - } -#endif // !_WIN32_WCE - - BOOL RemoveMenu(UINT nPosition, UINT nFlags) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::RemoveMenu(m_hMenu, nPosition, nFlags); - } - -#ifndef _WIN32_WCE - BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked); - } -#endif // !_WIN32_WCE - - BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::CheckMenuRadioItem(m_hMenu, nIDFirst, nIDLast, nIDItem, nFlags); - } - - BOOL GetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return (BOOL)::GetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); - } - - BOOL SetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) - { - ATLASSERT(::IsMenu(m_hMenu)); - return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); - } - -#ifndef _WIN32_WCE - BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) - { - ATLASSERT(::IsMenu(m_hMenu)); - return (BOOL)::InsertMenuItem(m_hMenu, uItem, bByPosition, lpmii); - } - - UINT GetMenuDefaultItem(BOOL bByPosition = FALSE, UINT uFlags = 0U) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuDefaultItem(m_hMenu, (UINT)bByPosition, uFlags); - } - - BOOL SetMenuDefaultItem(UINT uItem = (UINT)-1, BOOL bByPosition = FALSE) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuDefaultItem(m_hMenu, uItem, (UINT)bByPosition); - } - - BOOL GetMenuItemRect(HWND hWnd, UINT uItem, LPRECT lprcItem) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuItemRect(hWnd, m_hMenu, uItem, lprcItem); - } - - int MenuItemFromPoint(HWND hWnd, POINT point) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::MenuItemFromPoint(hWnd, m_hMenu, point); - } - -// Context Help Functions - BOOL SetMenuContextHelpId(DWORD dwContextHelpId) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuContextHelpId(m_hMenu, dwContextHelpId); - } - - DWORD GetMenuContextHelpId() const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuContextHelpId(m_hMenu); - } -#endif // !_WIN32_WCE -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAccelerator - -template -class CAcceleratorT -{ -public: - HACCEL m_hAccel; - -// Constructor/destructor/operators - CAcceleratorT(HACCEL hAccel = NULL) : m_hAccel(hAccel) - { } - - ~CAcceleratorT() - { - if(t_bManaged && m_hAccel != NULL) - ::DestroyAcceleratorTable(m_hAccel); - } - - CAcceleratorT& operator =(HACCEL hAccel) - { - Attach(hAccel); - return *this; - } - - void Attach(HACCEL hAccel) - { - if(t_bManaged && m_hAccel != NULL) - ::DestroyAcceleratorTable(m_hAccel); - m_hAccel = hAccel; - } - - HACCEL Detach() - { - HACCEL hAccel = m_hAccel; - m_hAccel = NULL; - return hAccel; - } - - operator HACCEL() const { return m_hAccel; } - - bool IsNull() const { return m_hAccel == NULL; } - -// Create/destroy methods - HACCEL LoadAccelerators(ATL::_U_STRINGorID accel) - { - ATLASSERT(m_hAccel == NULL); - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), accel.m_lpstr); - return m_hAccel; - } - - HACCEL CreateAcceleratorTable(LPACCEL pAccel, int cEntries) - { - ATLASSERT(m_hAccel == NULL); - ATLASSERT(pAccel != NULL); - m_hAccel = ::CreateAcceleratorTable(pAccel, cEntries); - return m_hAccel; - } - - void DestroyObject() - { - if(m_hAccel != NULL) - { - ::DestroyAcceleratorTable(m_hAccel); - m_hAccel = NULL; - } - } - -// Operations -#ifndef _WIN32_WCE - int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries) - { - ATLASSERT(m_hAccel != NULL); - ATLASSERT(lpAccelDst != NULL); - return ::CopyAcceleratorTable(m_hAccel, lpAccelDst, cEntries); - } - - int GetEntriesCount() const - { - ATLASSERT(m_hAccel != NULL); - return ::CopyAcceleratorTable(m_hAccel, NULL, 0); - } -#endif // !_WIN32_WCE - - BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg) - { - ATLASSERT(m_hAccel != NULL); - ATLASSERT(::IsWindow(hWnd)); - ATLASSERT(pMsg != NULL); - return ::TranslateAccelerator(hWnd, m_hAccel, pMsg); - } -}; - -typedef CAcceleratorT CAcceleratorHandle; -typedef CAcceleratorT CAccelerator; - - -/////////////////////////////////////////////////////////////////////////////// -// CIcon - -template -class CIconT -{ -public: - HICON m_hIcon; - -// Constructor/destructor/operators - CIconT(HICON hIcon = NULL) : m_hIcon(hIcon) - { } - - ~CIconT() - { - if(t_bManaged && m_hIcon != NULL) - ::DestroyIcon(m_hIcon); - } - - CIconT& operator =(HICON hIcon) - { - Attach(hIcon); - return *this; - } - - void Attach(HICON hIcon) - { - if(t_bManaged && m_hIcon != NULL) - ::DestroyIcon(m_hIcon); - m_hIcon = hIcon; - } - - HICON Detach() - { - HICON hIcon = m_hIcon; - m_hIcon = NULL; - return hIcon; - } - - operator HICON() const { return m_hIcon; } - - bool IsNull() const { return m_hIcon == NULL; } - -// Create/destroy methods - HICON LoadIcon(ATL::_U_STRINGorID icon) - { - ATLASSERT(m_hIcon == NULL); - m_hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); - return m_hIcon; - } - - HICON LoadIcon(ATL::_U_STRINGorID icon, int cxDesired, int cyDesired, UINT fuLoad = 0) - { - ATLASSERT(m_hIcon == NULL); - m_hIcon = (HICON) ::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); - return m_hIcon; - } - -#ifndef _WIN32_WCE - HICON LoadOEMIcon(LPCTSTR lpstrIconName) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(IsOEMIcon(lpstrIconName)); - m_hIcon = ::LoadIcon(NULL, lpstrIconName); - return m_hIcon; - } - - HICON CreateIcon(int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, CONST BYTE* lpbANDbits, CONST BYTE *lpbXORbits) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(lpbANDbits != NULL); - ATLASSERT(lpbXORbits != NULL); - m_hIcon = ::CreateIcon(ModuleHelper::GetResourceInstance(), nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits); - return m_hIcon; - } - - HICON CreateIconFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(pBits != NULL); - m_hIcon = ::CreateIconFromResource(pBits, dwResSize, TRUE, dwVersion); - return m_hIcon; - } - - HICON CreateIconFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(pbBits != NULL); - ATLASSERT(cbBits > 0); - m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags); - return m_hIcon; - } -#endif // !_WIN32_WCE - - HICON CreateIconIndirect(PICONINFO pIconInfo) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(pIconInfo != NULL); - m_hIcon = ::CreateIconIndirect(pIconInfo); - return m_hIcon; - } - -#ifndef _WIN32_WCE - HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(lpszExeFileName != NULL); - m_hIcon = ::ExtractIcon(ModuleHelper::GetModuleInstance(), lpszExeFileName, nIconIndex); - return m_hIcon; - } - - HICON ExtractAssociatedIcon(HINSTANCE hInst, LPTSTR lpIconPath, LPWORD lpiIcon) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(lpIconPath != NULL); - ATLASSERT(lpiIcon != NULL); - m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon); - return m_hIcon; - } -#endif // !_WIN32_WCE - - BOOL DestroyIcon() - { - ATLASSERT(m_hIcon != NULL); - BOOL bRet = ::DestroyIcon(m_hIcon); - if(bRet != FALSE) - m_hIcon = NULL; - return bRet; - } - -// Operations -#ifndef _WIN32_WCE - HICON CopyIcon() - { - ATLASSERT(m_hIcon != NULL); - return ::CopyIcon(m_hIcon); - } - - HICON DuplicateIcon() - { - ATLASSERT(m_hIcon != NULL); - return ::DuplicateIcon(NULL, m_hIcon); - } -#endif // !_WIN32_WCE - - BOOL DrawIcon(HDC hDC, int x, int y) - { - ATLASSERT(m_hIcon != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(hDC, x, y, m_hIcon); -#else // CE specific - return ::DrawIconEx(hDC, x, y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIcon(HDC hDC, POINT pt) - { - ATLASSERT(m_hIcon != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon); -#else // CE specific - return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hIcon != NULL); - return ::DrawIconEx(hDC, x, y, m_hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - - BOOL DrawIconEx(HDC hDC, POINT pt, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hIcon != NULL); - return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - -#ifndef _WIN32_WCE - BOOL GetIconInfo(PICONINFO pIconInfo) const - { - ATLASSERT(m_hIcon != NULL); - ATLASSERT(pIconInfo != NULL); - return ::GetIconInfo(m_hIcon, pIconInfo); - } - -#if (_WIN32_WINNT >= 0x0600) - BOOL GetIconInfoEx(PICONINFOEX pIconInfo) const - { - ATLASSERT(m_hIcon != NULL); - ATLASSERT(pIconInfo != NULL); - return ::GetIconInfoEx(m_hIcon, pIconInfo); - } -#endif // (_WIN32_WINNT >= 0x0600) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - HRESULT LoadIconMetric(ATL::_U_STRINGorID icon, int lims) - { - ATLASSERT(m_hIcon == NULL); - USES_CONVERSION; - return ::LoadIconMetric(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), lims, &m_hIcon); - } - - HRESULT LoadIconWithScaleDown(ATL::_U_STRINGorID icon, int cx, int cy) - { - ATLASSERT(m_hIcon == NULL); - USES_CONVERSION; - return ::LoadIconWithScaleDown(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), cx, cy, &m_hIcon); - } - - HRESULT LoadOEMIconMetric(LPCTSTR lpstrIconName, int lims) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(IsOEMIcon(lpstrIconName)); - return ::LoadIconMetric(NULL, (LPCWSTR)lpstrIconName, lims, &m_hIcon); - } - - HRESULT LoadOEMIconWithScaleDown(LPCTSTR lpstrIconName, int cx, int cy) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(IsOEMIcon(lpstrIconName)); - USES_CONVERSION; - return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -#endif // !_WIN32_WCE - - // Helper -#ifndef _WIN32_WCE - static bool IsOEMIcon(LPCTSTR lpstrIconName) - { -#if (WINVER >= 0x0600) - return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || - lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO || - lpstrIconName == IDI_SHIELD); -#else // !(WINVER >= 0x0600) - return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || - lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO); -#endif // !(WINVER >= 0x0600) - } -#endif // !_WIN32_WCE -}; - -typedef CIconT CIconHandle; -typedef CIconT CIcon; - - -/////////////////////////////////////////////////////////////////////////////// -// CCursor - -// protect template member from a winuser.h macro -#ifdef CopyCursor - #undef CopyCursor -#endif - -template -class CCursorT -{ -public: - HCURSOR m_hCursor; - -// Constructor/destructor/operators - CCursorT(HCURSOR hCursor = NULL) : m_hCursor(hCursor) - { } - - ~CCursorT() - { - if(t_bManaged && m_hCursor != NULL) - DestroyCursor(); - } - - CCursorT& operator =(HCURSOR hCursor) - { - Attach(hCursor); - return *this; - } - - void Attach(HCURSOR hCursor) - { - if(t_bManaged && m_hCursor != NULL) - DestroyCursor(); - m_hCursor = hCursor; - } - - HCURSOR Detach() - { - HCURSOR hCursor = m_hCursor; - m_hCursor = NULL; - return hCursor; - } - - operator HCURSOR() const { return m_hCursor; } - - bool IsNull() const { return m_hCursor == NULL; } - -// Create/destroy methods - HCURSOR LoadCursor(ATL::_U_STRINGorID cursor) - { - ATLASSERT(m_hCursor == NULL); - m_hCursor = ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); - return m_hCursor; - } - - HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName) - { - ATLASSERT(m_hCursor == NULL); -#if (WINVER >= 0x0500) - ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || - lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || - lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || - lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || - lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP || - lpstrCursorName == IDC_HAND); -#else // !(WINVER >= 0x0500) - ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || - lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || - lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || - lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || - lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP); -#endif // !(WINVER >= 0x0500) - m_hCursor = ::LoadCursor(NULL, lpstrCursorName); - return m_hCursor; - } - - // deprecated - HCURSOR LoadOEMCursor(LPCTSTR lpstrCursorName) - { - return LoadSysCursor(lpstrCursorName); - } - - HCURSOR LoadCursor(ATL::_U_STRINGorID cursor, int cxDesired, int cyDesired, UINT fuLoad = 0) - { - ATLASSERT(m_hCursor == NULL); - m_hCursor = (HCURSOR) ::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); - return m_hCursor; - } - -#ifndef _WIN32_WCE - HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename) - { - ATLASSERT(m_hCursor == NULL); - ATLASSERT(pstrFilename != NULL); - m_hCursor = ::LoadCursorFromFile(pstrFilename); - return m_hCursor; - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane) - { - ATLASSERT(m_hCursor == NULL); - m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane); - return m_hCursor; - } -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - -#ifndef _WIN32_WCE - HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) - { - ATLASSERT(m_hCursor == NULL); - ATLASSERT(pBits != NULL); - m_hCursor = (HCURSOR)::CreateIconFromResource(pBits, dwResSize, FALSE, dwVersion); - return m_hCursor; - } - - HCURSOR CreateCursorFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) - { - ATLASSERT(m_hCursor == NULL); - ATLASSERT(pbBits != NULL); - ATLASSERT(cbBits > 0); - m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags); - return m_hCursor; - } -#endif // !_WIN32_WCE - - BOOL DestroyCursor() - { - ATLASSERT(m_hCursor != NULL); -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - BOOL bRet = ::DestroyCursor(m_hCursor); - if(bRet != FALSE) - m_hCursor = NULL; - return bRet; -#else // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) - ATLTRACE2(atlTraceUI, 0, _T("Warning: This version of Windows CE does not have ::DestroyCursor()\n")); - return FALSE; -#endif // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) - } - -// Operations -#ifndef _WIN32_WCE - HCURSOR CopyCursor() - { - ATLASSERT(m_hCursor != NULL); - return (HCURSOR)::CopyIcon((HICON)m_hCursor); - } -#endif // !_WIN32_WCE - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - BOOL GetCursorInfo(LPCURSORINFO pCursorInfo) - { - ATLASSERT(m_hCursor != NULL); - ATLASSERT(pCursorInfo != NULL); - return ::GetCursorInfo(pCursorInfo); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CCursorT CCursorHandle; -typedef CCursorT CCursor; - - -/////////////////////////////////////////////////////////////////////////////// -// CResource - Wraps a generic Windows resource. -// Use it with custom resource types other than the -// standard RT_CURSOR, RT_BITMAP, etc. - -class CResource -{ -public: - HGLOBAL m_hGlobal; - HRSRC m_hResource; - -// Constructor/destructor - CResource() : m_hGlobal(NULL), m_hResource(NULL) - { } - - ~CResource() - { - Release(); - } - -// Load methods - bool Load(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID) - { - ATLASSERT(m_hResource == NULL); - ATLASSERT(m_hGlobal == NULL); - - m_hResource = ::FindResource(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr); - if(m_hResource == NULL) - return false; - - m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); - if(m_hGlobal == NULL) - { - m_hResource = NULL; - return false; - } - - return true; - } - -#ifndef _WIN32_WCE - bool LoadEx(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID, WORD wLanguage) - { - ATLASSERT(m_hResource == NULL); - ATLASSERT(m_hGlobal == NULL); - - m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr, wLanguage); - if(m_hResource == NULL) - return false; - - m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); - if(m_hGlobal == NULL) - { - m_hResource = NULL; - return false; - } - - return true; - } -#endif // !_WIN32_WCE - -// Misc. operations - DWORD GetSize() const - { - ATLASSERT(m_hResource != NULL); - return ::SizeofResource(ModuleHelper::GetResourceInstance(), m_hResource); - } - - LPVOID Lock() - { - ATLASSERT(m_hResource != NULL); - ATLASSERT(m_hGlobal != NULL); - LPVOID pVoid = ::LockResource(m_hGlobal); - ATLASSERT(pVoid != NULL); - return pVoid; - } - - void Release() - { - if(m_hGlobal != NULL) - { - FreeResource(m_hGlobal); - m_hGlobal = NULL; - m_hResource = NULL; - } - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Toolbar resource descriptor - -struct _AtlToolBarData -{ - WORD wVersion; - WORD wWidth; - WORD wHeight; - WORD wItemCount; - - WORD* items() - { return (WORD*)(this+1); } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Global functions for loading resources - -inline HACCEL AtlLoadAccelerators(ATL::_U_STRINGorID table) -{ - return ::LoadAccelerators(ModuleHelper::GetResourceInstance(), table.m_lpstr); -} - -inline HMENU AtlLoadMenu(ATL::_U_STRINGorID menu) -{ - return ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); -} - -inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap) -{ - return ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); -} - -#ifdef OEMRESOURCE -inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap) -{ -#ifdef _DEBUG - WORD wID = (WORD)bitmap.m_lpstr; - ATLASSERT(wID >= 32734 && wID <= 32767); -#endif // _DEBUG - return ::LoadBitmap(NULL, bitmap.m_lpstr); -} -#endif // OEMRESOURCE - -inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor) -{ - return ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); -} - -inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName) -{ -#if (WINVER >= 0x0500) - ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || - lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || - lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || - lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || - lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP || - lpCursorName == IDC_HAND); -#else // !(WINVER >= 0x0500) - ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || - lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || - lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || - lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || - lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP); -#endif // !(WINVER >= 0x0500) - return ::LoadCursor(NULL, lpCursorName); -} - -inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon) -{ - return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); -} - -#ifndef _WIN32_WCE -inline HICON AtlLoadSysIcon(LPCTSTR lpIconName) -{ -#if (WINVER >= 0x0600) - ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || - lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO || - lpIconName == IDI_SHIELD); -#else // !(WINVER >= 0x0600) - ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || - lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO); -#endif // !(WINVER >= 0x0600) - return ::LoadIcon(NULL, lpIconName); -} -#endif // !_WIN32_WCE - -inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR) -{ - return (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, IMAGE_BITMAP, 0, 0, fuLoad); -} - -inline HCURSOR AtlLoadCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ - return (HCURSOR)::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); -} - -inline HICON AtlLoadIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ - return (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); -} - -#ifdef OEMRESOURCE -inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR) -{ - ATLASSERT(wBitmapID >= 32734 && wBitmapID <= 32767); - ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file - return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad); -} -#endif // OEMRESOURCE - -inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ -#ifdef _DEBUG - WORD wID = (WORD)cursor.m_lpstr; - ATLASSERT((wID >= 32512 && wID <= 32516) || (wID >= 32640 && wID <= 32648) || (wID == 32650) || (wID == 32651)); - ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file -#endif // _DEBUG - return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); -} - -inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ -#ifdef _DEBUG - WORD wID = (WORD)icon.m_lpstr; - ATLASSERT(wID >= 32512 && wID <= 32517); - ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file -#endif // _DEBUG - return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); -} - -#if (_ATL_VER < 0x0700) -inline int AtlLoadString(UINT uID, LPTSTR lpBuffer, int nBufferMax) -{ - return ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpBuffer, nBufferMax); -} -#else - -using ATL::AtlLoadString; - -#endif // (_ATL_VER < 0x0700) - -#ifdef _WIN32_WCE // CE only direct access to the resource -inline LPCTSTR AtlLoadString(UINT uID) -{ - LPCTSTR s = (LPCTSTR)::LoadString(ModuleHelper::GetResourceInstance(), uID, NULL, 0); -#ifdef DEBUG // Check for null-termination - if(s != NULL) - // Note: RC -n compiles null-terminated resource strings - ATLASSERT(s[*((WORD*)s -1) - 1] == L'\0'); -#endif - return s; -} -#endif // _WIN32_WCE - -inline bool AtlLoadString(UINT uID, BSTR& bstrText) -{ - USES_CONVERSION; - ATLASSERT(bstrText == NULL); - - LPTSTR lpstrText = NULL; - int nRes = 0; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - nRes = ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpstrText, nLen); - if(nRes < nLen - 1) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(nRes != 0) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? true : false; -} - -}; // namespace WTL - -#endif // __ATLUSER_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlwince.h b/GLideN64/src/GLideNUI-wtl/WTL/atlwince.h deleted file mode 100644 index a06bcdd..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlwince.h +++ /dev/null @@ -1,2987 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLWINCE_H__ -#define __ATLWINCE_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlwince.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlwince.h requires atlwin.h to be included first -#endif - -#ifndef _WIN32_WCE - #error atlwince.h compiles under Windows CE only -#endif - -#if (_WIN32_WCE < 300) - #error atlwince.h requires Windows CE 3.0 or higher. -#endif - -#if defined(WIN32_PLATFORM_WFSP) && _MSC_VER < 1400 // EVC compiling SmartPhone code - #if (WIN32_PLATFORM_WFSP < 200) - #error atlwince.h requires Smartphone 2003 or higher - #endif -#endif // WIN32_PLATFORM_WFSP - -#if defined(WIN32_PLATFORM_PSPC) && _MSC_VER < 1400 // EVC compiling Pocket PC code - #if (WIN32_PLATFORM_PSPC < 310) - #error atlwince.h requires Pocket PC 2002 or higher - #endif -#endif // WIN32_PLATFORM_PSPC - -#if !defined(_AYGSHELL_H_) && !defined(__AYGSHELL_H__) - #error atlwince.h requires aygshell.h to be included first -#else - #if defined(WIN32_PLATFORM_WFSP) && !defined(_TPCSHELL_H_) - #error SmartPhone dialog classes require tpcshell.h to be included first - #endif -#endif - -#if (_MSC_VER >= 1400) // VS2005 - #include - #define _WTL_CE_DRA -#endif // (_MSC_VER >= 1400) - -#if !defined(_WTL_CE_NO_DIALOGS) && !defined(__ATLFRAME_H__) - #error Orientation aware dialog classes require atlframe.h to be included first -#endif - -#if !defined(_WTL_CE_NO_APPWINDOW) && !defined(__ATLFRAME_H__) - #error Application window class require atlframe.h to be included first -#endif - -#if !defined(_WTL_CE_NO_ZOOMSCROLL) && !defined(__ATLSCRL_H__) - #error ZoomScroll implementation requires atlscrl.h to be included first -#endif - -#if !defined(_WTL_CE_NO_ZOOMSCROLL) - #if !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) - #error ZoomScroll requires _WTL_NO_WTYPES not to be defined and either atlmisc.h or atltypes.h to be included first - #endif // !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) -#endif // !defined(_WTL_CE_NO_ZOOMSCROLL) - -#if !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) - #define _WTL_CE_NO_CONTROLS -#endif // !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) - -#ifndef _WTL_CE_NO_CONTROLS - #ifndef __ATLCTRLS_H__ - #error The PPC/SmartPhone controls classes require atlctrls.h to be included first - #endif - - #include - #pragma comment(lib, "htmlview.lib") - - #include - #pragma comment(lib, "voicectl.lib") - - #ifdef WIN32_PLATFORM_PSPC - #include - #pragma comment(lib, "richink.lib") - - #include - #pragma comment(lib, "inkx.lib") - - #include - #pragma comment(lib, "doclist.lib") - #endif -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CStdDialogBase : Standard PPC/SmartPhone dialog base class -// CStdDialogImplBase - Base implementation of standard dialog -// CStdDialogImpl : Standard dialog implementation -// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog -// CStdAxDialogImpl : Standard AxDialog implementation -// CStdSimpleDialog : Standard simple dialog -// CStdDialogResizeImplBase - Base implementation of orientation resizing standard dialog -// CStdDialogResizeImpl : Orientation resizing standard dialog implementation -// CStdAxDialogResizeImpl - implementation of orientation resizing standard AxDialog -// CStdSimpleDialogResizeImpl : Standard resizing simple dialog implementation -// CStdOrientedDialogBase - Oriented PPC standard dialog base class -// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation -// CStdOrientedDialogImpl : Oriented PPC standard dialog implementation -// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation -// CStdSimpleOrientedDialog : Standard simple orientable dialog -// -// CAppInfoBase : Helper for application state save/restore to registry -// CAppInfoT : CAppInfoBase constructed from a CAppWindow -// CAppWindowBase : Base class for PPC/SmartPhone well-behaved application window or dialog -// CAppWindow : PPC/SmartPhone well-behaved application window class -// CAppDialog : PPC/SmartPhone well-behaved application dialog class -// CAppStdDialogImplBase - Base implementation of standard application dialogs -// CAppStdDialogImpl : Implementation of standard application dialog -// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog -// CAppStdAxDialogImpl - Implementation of standard application AxDialog -// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog -// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog -// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog -// -// CFullScreenFrame : Full screen frame class -// -// CZoomScrollImpl : WinCE zooming implementation -// -// CBottomTabViewImpl - CBottomTabView -// CHtmlCtrlT - CHtmlCtrl -// CRichInkCtrlT - CRichInkCtrl -// CInkXCtrlT - CInkXCtrl -// CVoiceRecorderCtrlT - CVoiceRecorderCtrl -// CDocListCtrlT - CDocListCtrl -// CCapEditT - CCapEdit -// CTTStaticT - CTTStatic -// CTTButtonT - CTTButton -// -// CSpinCtrlT - CSpinCtrl : SmartPhone specific UpDown control -// CSpinned : SmartPhone association of control and Spin -// CSpinListBox : SmartPhone spinned ListBox control -// CExpandListBox : SmartPhone expandable ListBox control -// CExpandEdit : SmartPhone expandable Edit control -// CExpandCapEdit : SmartPhone expandable CapEdit control -// -// Global functions: -// AtlCreateMenuBar() -// AtlCreateEmptyMenuBar() -// AtlIsEditFocus() -// AtlActivateBackKey() - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// MenuBar creation functions for property sheets and dialogs -// Frame windows use CreateSimpleCEMenuBar - -inline HWND AtlCreateMenuBar(SHMENUBARINFO& mbi) -{ - ATLASSERT(::IsWindow(mbi.hwndParent)); - ATLVERIFY(::SHCreateMenuBar(&mbi) != FALSE); - return mbi.hwndMB; -}; - -inline HWND AtlCreateMenuBar(HWND hWnd, UINT nToolBarId = ATL_IDW_TOOLBAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0, COLORREF clrBk = 0) -{ - SHMENUBARINFO mbi = { sizeof(mbi), hWnd, dwFlags, nToolBarId, ModuleHelper::GetResourceInstance(), nBmpId, cBmpImages, 0, clrBk }; - return AtlCreateMenuBar(mbi); -} - -inline HWND AtlCreateEmptyMenuBar(HWND hWnd, bool bSip = true) -{ - SHMENUBARINFO embi = { sizeof(SHMENUBARINFO), hWnd, SHCMBF_EMPTYBAR }; - if (!bSip) - embi.dwFlags |= SHCMBF_HIDESIPBUTTON; - - return AtlCreateMenuBar(embi); -} - -/////////////////////////////////////////////////////////////////////////////// -// Helper functions for SmartPhone back key handling - -inline bool AtlIsEditFocus() -{ - ATL::CWindow wCtrl = GetFocus(); - if (wCtrl.IsWindow()) - { - TCHAR szClassName[8] = {0}; - ATLVERIFY(::GetClassName(wCtrl.m_hWnd, szClassName, 8)); - return !_tcscmp(szClassName, _T("Edit")) || !_tcscmp(szClassName, WC_CAPEDIT); - } - return false; -} - -#if defined WIN32_PLATFORM_WFSP -inline void AtlActivateBackKey(HWND hMenuBar) -{ - ATLASSERT(::IsWindow(hMenuBar)); - ::SendMessage(hMenuBar, SHCMBM_OVERRIDEKEY, VK_TBACK, - MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); -} -#endif // WIN32_PLATFORM_WFSP - -// --- Standard PPC/SmartPhone dialogs --- - -#ifndef _WTL_CE_NO_DIALOGS - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogBase - base class for standard PPC/SmartPhone dialogs - -#define WTL_STD_SHIDIF SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN -#define WTL_SP_SHIDIF SHIDIF_SIZEDLGFULLSCREEN - -// Title setting macros -#define WTL_DLG_TITLEHEIGHT(iHeight) static const int GetTitleHeight(){return iHeight;} -#define WTL_DLG_NOTITLE WTL_DLG_TITLEHEIGHT(0) - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogBase - Base class for standard PPC/SmartPhone dialog - -template -class CStdDialogBase -{ -public: -#ifdef WIN32_PLATFORM_PSPC -// Pocket PC only Dialog title handling - const int nTitleHeight; - - CStdDialogBase() : nTitleHeight(T::GetTitleHeight()) - { } - -// Overloads - BOOL GetClientRect(LPRECT lpRect) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - BOOL bRes = ::GetClientRect(pT->m_hWnd, lpRect); - if (nTitleHeight) - lpRect->top += nTitleHeight + 1; - return bRes; - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - BOOL bRes = ::SetWindowText(pT->m_hWnd, lpszString); - if (nTitleHeight != 0) - pT->DoPaintTitle(); - return bRes; - } - -// Overrideables - static const int GetTitleHeight() - { - #ifdef _WTL_CE_DRA - return DRA::SCALEY(24); - #else // !_WTL_CE_DRA - CWindowDC dc(NULL); - return dc.GetDeviceCaps(LOGPIXELSY) >> 2; // LOGPIXELSY * 24 / 96, - #endif // !_WTL_CE_DRA - } - - // Title painting - bool DoPaintTitle() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - TCHAR sTitle[48]; - - // Preparation - CPaintDC dc(pT->m_hWnd); - CFont fontTitle = AtlCreateBoldFont(); - CFontHandle fontOld = dc.SelectFont(fontTitle); - dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHT)); - int nLen = pT->GetWindowText(sTitle, 48); - int nWidth = dc.GetDeviceCaps(HORZRES); - - // Display title text - RECT rTitle = { 0, 0, nWidth, nTitleHeight }; - dc.FillRect(&rTitle, COLOR_3DHIGHLIGHT); - #ifdef _WTL_CE_DRA - rTitle.left = DRA::SCALEX(8); - #else // !_WTL_CE_DRA - rTitle.left = nTitleHeight / 3; // 8 == 24 / 3 - #endif // !_WTL_CE_DRA - dc.DrawText(sTitle, nLen, &rTitle, DT_VCENTER | DT_SINGLELINE); - dc.SelectFont(fontOld); - - // Draw bottom line, 2 pixels thick if HI_RES_AWARE - CPenHandle penOld = dc.SelectStockPen(BLACK_PEN); - POINT line[4] = {{0, nTitleHeight}, {nWidth, nTitleHeight}, {0, nTitleHeight - 1}, {nWidth, nTitleHeight - 1}}; - - #ifdef _WTL_CE_DRA - int nSeg = DRA::SCALEY(1); - #else // !_WTL_CE_DRA - int nSeg = nTitleHeight / 24; - #endif // !_WTL_CE_DRA - - dc.Polyline(line, nSeg <= 2 ? nSeg * 2 : 4); - dc.SelectPen(penOld); - - return false; - } - - // Title preparation: move the dialog controls down to make room for title - void DialogTitleInit() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); - while (wCtl.IsWindow()) - { - RECT rCtl = { 0 }; - wCtl.GetWindowRect(&rCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rCtl, 2); - ::OffsetRect(&rCtl, 0, nTitleHeight); - wCtl.MoveWindow(&rCtl, FALSE); - wCtl = wCtl.GetWindow(GW_HWNDNEXT); - } - } - - // SIP management - void DoSipInfo() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - SIPINFO si = {sizeof(SIPINFO)}; - SipGetInfo(&si); - if ((si.fdwFlags & SIPF_ON) ^ SIPF_ON) - si.rcVisibleDesktop.bottom = si.rcSipRect.bottom; - pT->MoveWindow(&si.rcVisibleDesktop, FALSE); - } - -// Title painting handler - LRESULT OnPaintTitle(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - return bHandled = nTitleHeight ? pT->DoPaintTitle() : FALSE; - } - -// SIP handler - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - if (wParam == SPI_SETSIPINFO) - { - pT->DoSipInfo(); - return TRUE; - } - return bHandled = FALSE; - } - -#elif defined WIN32_PLATFORM_WFSP -// SmartPhone VK_TBACK key standard management - LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - const UINT uModif = (UINT)LOWORD(lParam); - const UINT uVirtKey = (UINT)HIWORD(lParam); - - if(uVirtKey == VK_TBACK) - if (AtlIsEditFocus()) - ::SHSendBackToFocusWindow(uMsg, wParam, lParam); - else if (uModif & MOD_KEYUP) - pT->StdCloseDialog(IDCANCEL); - return 1; - } - - // SmartPhone MenuBar and VK_TBACK key initialization - void StdSPInit() - { - T* pT = static_cast(this); - HWND hMenuBar = ::SHFindMenuBar(pT->m_hWnd); - - if (!hMenuBar && (t_shidiFlags & SHIDIF_DONEBUTTON)) - hMenuBar = CreateMenuBar(ATL_IDM_MENU_DONE); - - if(hMenuBar != NULL) - AtlActivateBackKey(hMenuBar); - } - - void SetStaticBold() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - CFontHandle fontBold = AtlCreateBoldFont(pT->GetFont()); - - ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); - - while (wCtl.IsWindow()) - { - if ((short int)wCtl.GetDlgCtrlID() == IDC_STATIC) - wCtl.SetFont(fontBold); - wCtl = wCtl.GetWindow(GW_HWNDNEXT); - } - } -#endif // WIN32_PLATFORM_WFSP - -// Platform dependant initialization - void StdPlatformInit() - { - T* pT = static_cast(this); -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title initialization - if (nTitleHeight != 0) - pT->DialogTitleInit(); -#elif defined(WIN32_PLATFORM_WFSP) - pT->StdSPInit(); - SetStaticBold(); -#endif // WIN32_PLATFORM_WFSP - } - - // Menu bar creation - HWND CreateMenuBar(UINT uiMB = T::IDD, int nBmpImages = 0) - { - T* pT = static_cast(this); - return AtlCreateMenuBar(pT->m_hWnd, uiMB, 0, nBmpImages ? uiMB : 0, nBmpImages); - } - - // Dialog closing - void StdCloseDialog(WORD wID) - { - T* pT = static_cast(this); - if (t_bModal) - ::EndDialog(pT->m_hWnd, wID); - else - pT->DestroyWindow(); - } - - // Shell dialog layout initialization - void StdShidInit() - { - T* pT = static_cast(this); - SHINITDLGINFO shidi = { SHIDIM_FLAGS, pT->m_hWnd, t_shidiFlags }; - ::SHInitDialog(&shidi); - } - -// IDC_INFOSTATIC background setting - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if (::GetDlgCtrlID((HWND)lParam) == IDC_INFOSTATIC) - { - ::SetBkMode((HDC)wParam, TRANSPARENT); - return (LRESULT)::GetSysColorBrush(COLOR_INFOBK); - } - return bHandled = FALSE; - } - -// Menu dialog ending - LRESULT OnMenuClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog((WORD)(wID - ID_MENU_OK + IDOK)); - return 0; - } - -// Standard dialog ending: may be used with any command - LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog(wID); - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogImplBase - Base implementation of standard PPC/SmartPhone dialog - -template > -class ATL_NO_VTABLE CStdDialogImplBase : - public TBase, - public CStdDialogBase -{ -public: -#ifdef WIN32_PLATFORM_PSPC - BOOL GetClientRect(LPRECT lpRect) - { - return CStdDialogBase::GetClientRect(lpRect); - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - return CStdDialogBase::SetWindowText(lpszString); - } -#endif - - BEGIN_MSG_MAP(CStdDialogImplBase) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _DEBUG - T* pT = static_cast(this); - ATLASSERT(t_bModal == pT->m_bModal); -#endif - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogImpl - implementation of standard PPC/SmartPhone dialog - -template -class ATL_NO_VTABLE CStdDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog - -#if defined __ATLDLGS_H__ - -template -class ATL_NO_VTABLE CStdIndirectDialogImpl : - public CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > -{ -public: - typedef CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > _baseClass; - typedef CStdDialogImpl _baseStd; - - void CheckStyle() - { - // Mobile devices don't support DLGTEMPLATEEX - ATLASSERT(!m_Template.IsTemplateEx()); - - // Standard dialogs need only DS_CENTER - DWORD &dwStyle = m_Template.GetTemplatePtr()->style; - if (dwStyle & DS_CENTER) - if(t_bModal) - { - ATLASSERT((dwStyle & WS_CHILD) != WS_CHILD); - dwStyle |= WS_POPUP; - } - else - { - if((dwStyle & WS_CHILD) != WS_CHILD) - dwStyle |= WS_POPUP; - } - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) - { - ATLASSERT(t_bModal); - - if (!m_Template.IsValid()) - CreateTemplate(); - - CheckStyle(); - - return _baseClass::DoModal(hWndParent, dwInitParam); - } - - HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) - { - ATLASSERT(!t_bModal); - - if (!m_Template.IsValid()) - CreateTemplate(); - - CheckStyle(); - - return _baseClass::Create(hWndParent, dwInitParam); - } - - BEGIN_MSG_MAP(CStdIndirectDialogImpl) - CHAIN_MSG_MAP(_baseStd) - END_MSG_MAP() - -}; - -#endif // defined __ATLDLGS_H__ - -#ifndef _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdAxDialogImpl - implementation of standard PPC/SmartPhone AxDialog - -template -class ATL_NO_VTABLE CStdAxDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl< T > > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleDialog - standard PPC/SmartPhone simple dialog with SHIDIF_xxx flags - -template -class CStdSimpleDialog : - public ATL::CSimpleDialog, - public CStdDialogBase, t_shidiFlags> -{ -public: - typedef CStdDialogBase, t_shidiFlags> baseClass; - -#ifdef WIN32_PLATFORM_PSPC - BOOL GetClientRect(LPRECT lpRect) - { - return baseClass::GetClientRect(lpRect); - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - return baseClass::SetWindowText(lpszString); - } -#endif - - BEGIN_MSG_MAP(CStdSimpleDialog) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogResizeImplBase - Base implementation of orientation resizing standard PPC/SmartPhone dialog - -template > -class ATL_NO_VTABLE CStdDialogResizeImplBase : - public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, - public CDialogResize -{ -public: - // Note: BEGIN_DLGRESIZE_MAP is required in the derived class. - - BEGIN_MSG_MAP(CStdResizeDialogImplBase) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - CHAIN_MSG_MAP(CDialogResize< T >) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _DEBUG - T* pT = static_cast(this); - ATLASSERT(t_bModal == pT->m_bModal); -#endif - StdPlatformInit(); - DlgResize_Init(FALSE); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone dialog - -template -class ATL_NO_VTABLE CStdDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdAxDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone AxDialog - -template -class ATL_NO_VTABLE CStdAxDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleDialogResizeImpl - implementation of standard resizing simple dialog with SHIDIF_xxx flags - -// Usage: -// class CMyDlg : public CStdSimpleDialogResize -// { -// public: -// BEGIN_DLGRESIZE_MAP(CMyDlg) -// ... -// END_DLGRESIZE_MAP() -// }; - -template -class ATL_NO_VTABLE CStdSimpleDialogResizeImpl : - public CStdSimpleDialog, - public CDialogResize< T > -{ -public: - typedef CStdSimpleDialog::baseClass baseClass; - - BEGIN_MSG_MAP(CStdSimpleDialogResizeImpl) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - CHAIN_MSG_MAP(CDialogResize< T >) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - StdPlatformInit(); - DlgResize_Init(FALSE); - StdShidInit(); - return bHandled = FALSE; - } -}; - -#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogBase - Oriented PPC standard dialog base class - -template -class CStdOrientedDialogBase -{ -public: -// Operation - BOOL SetOrientation(DRA::DisplayMode mode) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - ATLASSERT(mode == DRA::GetDisplayMode()); - - // Derived dialog must enumerate TWO dialog templates with the same control ids and types ie: - // enum { IDD = IDD_MYDLG, IDD_LANDSCAPE = IDD_MYDLG_L }; - UINT iResource = (mode == DRA::Landscape)? T::IDD_LANDSCAPE : T::IDD; - - BOOL bRes = DRA::RelayoutDialog(ModuleHelper::GetResourceInstance(), pT->m_hWnd, MAKEINTRESOURCE(iResource)); - pT->OnOrientation(mode); - return bRes; - } - -// Override - void OnOrientation(DRA::DisplayMode /*mode*/) - {} - -// Message handlers - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - if (wParam == SETTINGCHANGE_RESET) - { - SetOrientation(DRA::GetDisplayMode()); - pT->StdPlatformInit(); - pT->StdShidInit(); - } - else if (wParam == SPI_SETSIPINFO) - { - pT->DoSipInfo(); - return TRUE; - } - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation - -template > -class ATL_NO_VTABLE CStdOrientedDialogImplBase : - public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, - public CStdOrientedDialogBase -{ -public: - BEGIN_MSG_MAP(CStdOrientedDialogImpl) - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CStdOrientedDialogBase::OnSettingChange) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); -#ifdef _DEBUG - ATLASSERT(t_bModal == pT->m_bModal); -#endif - if (DRA::GetDisplayMode() == DRA::Landscape) - SetOrientation(DRA::Landscape); - pT->StdPlatformInit(); - pT->StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogImpl - Oriented PPC standard dialog implementation - -template -class ATL_NO_VTABLE CStdOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation - -template -class ATL_NO_VTABLE CStdAxOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleOrientedDialog - Standard simple orientable dialog - -template -class CStdSimpleOrientedDialog : - public CStdSimpleDialog, - public CStdOrientedDialogBase > -{ -public: - typedef CStdSimpleDialog::baseClass baseClass; - typedef CStdOrientedDialogBase > baseOriented; - - enum {IDD = t_wDlgTemplateID, IDD_LANDSCAPE = t_wDlgLandscapeID}; - - BEGIN_MSG_MAP(CStdSimpleDialog) - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_SETTINGCHANGE, baseOriented::OnSettingChange) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if (DRA::GetDisplayMode() == DRA::Landscape) - SetOrientation(DRA::Landscape); - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -#endif // _WTL_CE_DRA - - -#endif // _WTL_CE_NO_DIALOGS - - -// --- PPC/SmartPhone application window and helpers --- - -#ifndef _WTL_CE_NO_APPWINDOW - -/////////////////////////////////////////////////////////////////////////////// -// CAppInfoBase - Helper for application state save/restore to registry - -class CAppInfoBase -{ -public: - CRegKeyEx m_Key; - - CAppInfoBase(ATL::_U_STRINGorID sAppKey) - { - m_Key.Create(HKEY_CURRENT_USER, sAppKey.m_lpstr); - ATLASSERT(m_Key.m_hKey); - } - - template - LONG Save(V& val, ATL::_U_STRINGorID sName) - { - return m_Key.SetBinaryValue(sName.m_lpstr, &val, sizeof(V)); - } - - template - LONG Save(int nb, V& val0, ATL::_U_STRINGorID sName) - { - return m_Key.SetBinaryValue(sName.m_lpstr, &val0, nb * sizeof(V)); - } - - template - LONG Restore(V& val, ATL::_U_STRINGorID sName) - { - ULONG bufSize = sizeof(V); - return m_Key.QueryBinaryValue(sName.m_lpstr, &val, &bufSize); - } - - template - LONG Restore(int nb, V& val0, ATL::_U_STRINGorID sName) - { - ULONG bufSize = nb * sizeof(V); - return m_Key.QueryBinaryValue(sName.m_lpstr, &val0, &bufSize); - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - LONG Save(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetStringValue(sName.m_lpstr, sval); - } - - LONG Restore(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - DWORD size = MAX_PATH; - LONG res = m_Key.QueryStringValue(sName.m_lpstr, sval.GetBuffer(size), &size); - sval.ReleaseBuffer(); - return res; - } -#else - #pragma message("Warning: CAppInfoBase compiles without CString support. Do not use CString in Save or Restore.") -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - LONG Save(LPCTSTR sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetStringValue(sName.m_lpstr, sval); - } - - LONG Restore(LPTSTR sval, ATL::_U_STRINGorID sName, DWORD *plength) - { - return m_Key.QueryStringValue(sName.m_lpstr, sval, plength); - } - - LONG Delete(ATL::_U_STRINGorID sName) - { - return m_Key.DeleteValue(sName.m_lpstr); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppInfoT - CAppInfoBase constructed from a class with T::GetAppKey() - -// Macro for declaring AppKey -#define DECLARE_APPKEY(uAppKey) \ - static LPCTSTR GetAppKey() \ - { \ - static LPCTSTR sAppKey = ATL::_U_STRINGorID(uAppKey).m_lpstr; \ - return sAppKey; \ - } - -template -class CAppInfoT : public CAppInfoBase -{ -public: - CAppInfoT() : CAppInfoBase(T::GetAppKey()){} -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppWindowBase - Base class for PPC/SmartPhone "well-behaved" application window or dialog - -// Macros for declaring frame WNDCLASS and AppKey -#define DECLARE_APP_FRAME_CLASS(WndClassName, uCommonResourceID, uAppKey) \ - DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ - DECLARE_APPKEY(uAppKey) - -#define DECLARE_APP_FRAME_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd, uAppKey) \ - DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ - DECLARE_APPKEY(uAppKey) - -template -class CAppWindowBase -{ -public: - typedef class CAppInfoT< T > CAppInfo; - -#ifndef WIN32_PLATFORM_WFSP - SHACTIVATEINFO m_sai; // NoOp on SmartPhones -#endif // WIN32_PLATFORM_WFSP - - bool m_bHibernate; - - CAppWindowBase< T >() : m_bHibernate(false) - { -#ifndef WIN32_PLATFORM_WFSP - SHACTIVATEINFO sai = { sizeof(SHACTIVATEINFO) }; - m_sai = sai; -#endif // WIN32_PLATFORM_WFSP - }; - - // Same as WTL 7.1 AppWizard generated ActivatePreviousInstance + SendMessage WM_COPYDATA - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine, bool bDialog) - { - // requires T does DECLARE_APP_FRAME_CLASS, DECLARE_APP_FRAME_CLASS_EX or DECLARE_APP_DLG_CLASS - CFrameWndClassInfo& classInfo = T::GetWndClassInfo(); - - ATLVERIFY(::LoadString(hInstance, classInfo.m_uCommonResourceID, classInfo.m_szAutoName, sizeof(classInfo.m_szAutoName)/sizeof(classInfo.m_szAutoName[0])) != 0); - - classInfo.m_wc.lpszClassName = classInfo.m_szAutoName; - - const TCHAR* pszClass = classInfo.m_wc.lpszClassName; - - if(NULL == pszClass || '\0' == *pszClass) - { - return E_FAIL; - } - - const DWORD dRetryInterval = 100; - const int iMaxRetries = 25; - - for(int i = 0; i < iMaxRetries; ++i) - { - HANDLE hMutex = CreateMutex(NULL, FALSE, pszClass); - - DWORD dw = GetLastError(); - - if(NULL == hMutex) - { - HRESULT hr; - - switch(dw) - { - case ERROR_INVALID_HANDLE: - // A non-mutext object with this name already exists. - hr = E_INVALIDARG; - break; - default: - // This should never happen... - hr = E_FAIL; - } - - return hr; - } - - // If the mutex already exists, then there should be another instance running - if(dw == ERROR_ALREADY_EXISTS) - { - CloseHandle(hMutex); - - HWND hwnd = NULL; - if (bDialog) - hwnd = FindWindow(NULL, pszClass); - else - hwnd = FindWindow(pszClass, NULL); - - if(hwnd == NULL) - { - Sleep(dRetryInterval); - continue; - } - else - { - // Transmit our params to previous instance - if (lpstrCmdLine && *lpstrCmdLine) - { - COPYDATASTRUCT cd = { NULL, sizeof(TCHAR) * (wcslen(lpstrCmdLine) + 1), (PVOID)lpstrCmdLine }; - ::SendMessage(hwnd, WM_COPYDATA, NULL, (LPARAM)&cd); - } - // Set the previous instance as the foreground window - if(0 != SetForegroundWindow(reinterpret_cast(reinterpret_cast(hwnd) | 0x1))) - return S_FALSE; - } - } - else - { - return S_OK; - } - } - return S_OK; - } - -// Operations overriden in derived class - bool AppHibernate(bool /*bHibernate*/) - { - return false; - } - - bool AppNewInstance(LPCTSTR /*lpstrCmdLine*/) - { - return false; - } - - void AppSave() - { - } - -#ifdef WIN32_PLATFORM_WFSP - void AppBackKey() - { - ::SHNavigateBack(); - } -#endif - -// Message map and handlers - BEGIN_MSG_MAP(CAppWindowBase) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) -#ifdef WIN32_PLATFORM_WFSP - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#else - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#endif // WIN32_PLATFORM_WFSP - MESSAGE_HANDLER(WM_HIBERNATE, OnHibernate) - MESSAGE_HANDLER(WM_COPYDATA, OnNewInstance) - MESSAGE_HANDLER(WM_CLOSE, OnClose) - END_MSG_MAP() - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - if (m_bHibernate) - m_bHibernate = pT->AppHibernate(false); -#ifndef WIN32_PLATFORM_WFSP - ::SHHandleWMActivate(pT->m_hWnd, wParam, lParam, &m_sai, 0); -#else - wParam; - lParam; -#endif // WIN32_PLATFORM_WFSP - return bHandled = FALSE; - } - -#ifdef WIN32_PLATFORM_WFSP -// SmartPhone VK_TBACK key standard management - LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - const UINT uModif = (UINT)LOWORD(lParam); - const UINT uVirtKey = (UINT)HIWORD(lParam); - if(uVirtKey == VK_TBACK) - if (AtlIsEditFocus()) - ::SHSendBackToFocusWindow(uMsg, wParam, lParam); - else if (uModif & MOD_KEYUP) - pT->AppBackKey(); - return 1; - } - -#else // !WIN32_PLATFORM_WFSP -// PPC SIP handling - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - bHandled = FALSE; - return ::SHHandleWMSettingChange(pT->m_hWnd, wParam, lParam, &m_sai); - } -#endif // !WIN32_PLATFORM_WFSP - - LRESULT OnHibernate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - return m_bHibernate = pT->AppHibernate(true); - } - - LRESULT OnNewInstance(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam; - return pT->AppNewInstance((LPCTSTR)pcds->lpData); - } - - LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->AppSave(); - bHandled = FALSE; - return 1; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppWindow - PPC/SmartPhone "well-behaved" application window class - -template -class CAppWindow : public CAppWindowBase< T > -{ -public: - // Same as WTL 7.1 AppWizard generated Run + lpstrCmdLine in CreateEx - static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) - { - CMessageLoop theLoop; - _Module.AddMessageLoop(&theLoop); - - T wndMain; - - if(wndMain.CreateEx(NULL, NULL, 0, 0, lpstrCmdLine) == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Main window creation failed!\n")); - return 0; - } - - wndMain.ShowWindow(nCmdShow); - - int nRet = theLoop.Run(); - - _Module.RemoveMessageLoop(); - return nRet; - } - - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) - { - return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, false); - } -}; - - -#ifndef _WTL_CE_NO_DIALOGS - -/////////////////////////////////////////////////////////////////////////////// -// CAppDialog - PPC/SmartPhone "well-behaved" dialog application class - -// Macro for declaring dialog WNDCLASS and AppKey -#define DECLARE_APP_DLG_CLASS(WndClassName, uCommonResourceID, uAppKey) \ - static WTL::CFrameWndClassInfo& GetWndClassInfo() \ - { \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { 0, (WNDPROC)StartDialogProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ - }; \ - DECLARE_APPKEY(uAppKey) - -template -class CAppDialog : public CAppWindowBase< T > -{ -public: - static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) - { - CMessageLoop theLoop; - _Module.AddMessageLoop(&theLoop); - - T dlgMain; - - if(dlgMain.Create(NULL, (LPARAM)lpstrCmdLine) == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Main dialog creation failed!\n")); - return 0; - } - - dlgMain.ShowWindow(nCmdShow); - - int nRet = theLoop.Run(); - - _Module.RemoveMessageLoop(); - return nRet; - } - - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) - { - return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, true); - }; -}; - -// PPC/SmartPhone standard application dialogs - -#ifdef WIN32_PLATFORM_WFSP -#define WTL_APP_SHIDIF WTL_SP_SHIDIF -#else -#define WTL_APP_SHIDIF WTL_STD_SHIDIF -#endif - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogImplBase - Base implementation of standard application dialogs - -template -class ATL_NO_VTABLE CAppStdDialogImplBase : - public TImplBase, - public CAppDialog< T > -{ -public: - WTL_DLG_NOTITLE; - - void StdCloseDialog(int nVal) - { - T* pT = static_cast(this); - if (nVal != IDCANCEL) - pT->AppSave(); - if (t_bModal == false) - { - pT->DestroyWindow(); - ::PostQuitMessage(nVal); - } - else - ::EndDialog(pT->m_hWnd, nVal); - } - - BEGIN_MSG_MAP(CAppStdDialogImplBase) - MESSAGE_HANDLER(WM_CLOSE, OnSystemClose) - CHAIN_MSG_MAP(TImplBase) - CHAIN_MSG_MAP(CAppDialog< T >) - END_MSG_MAP() - - LRESULT OnSystemClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog(IDCANCEL); - return 0; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogImpl - Implementation of standard application dialog - -template -class ATL_NO_VTABLE CAppStdDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog - -template -class ATL_NO_VTABLE CAppStdDialogResizeImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxDialogImpl - Implementation of standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxDialogResizeImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; -#endif // _ATL_NO_HOSTING - -#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) -/////////////////////////////////////////////////////////////////////////////// -// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog - -template -class ATL_NO_VTABLE CAppStdOrientedDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxOrientedDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; -#endif // _ATL_NO_HOSTING - -#endif // defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) - -#endif // _WTL_CE_NO_DIALOGS - -#endif // _WTL_CE_NO_APPWINDOW - - -// --- Full screen support --- - -#ifndef _WTL_CE_NO_FULLSCREEN - -/////////////////////////////////////////////////////////////////////////////// -// CFullScreenFrame - full screen frame implementation - -template -class CFullScreenFrame -{ -public: - bool m_bFullScreen; - - CFullScreenFrame() : m_bFullScreen(false) - { } - -// Operation - void SetFullScreen(bool bFull) - { - m_bFullScreen = bFull; - ShowTaskBar(!bFull, false); - ShowMenuBar(!bFull); - } - -// Manage TaskBar for modal dialogs and property sheets - template - int FSDoModal(D& dlg) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - ATLASSERT(pT->IsWindow()); - if (m_bFullScreen) // Show taskbar if hidden - ShowTaskBar(true, false); - int iRet = dlg.DoModal(); - if (m_bFullScreen) // Hide taskbar if restored - ShowTaskBar(false); - return iRet; - } - -// Implementation - void ShowMenuBar(bool bShow) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - ATL::CWindow MenuBar = pT->m_hWndCECommandBar; - ATLASSERT(MenuBar.IsWindow()); - MenuBar.ShowWindow(bShow ? SW_SHOWNORMAL : SW_HIDE); - pT->SizeToMenuBar(); - } - - void ShowTaskBar(bool bShow, bool bRepaint = true) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - RECT rect = { 0 }; - SystemParametersInfo(SPI_GETWORKAREA, NULL, &rect, FALSE); - if (!bShow) - rect.top = 0; - -#ifdef WIN32_PLATFORM_PSPC // Pocket PC code - UINT uShow = t_bHasSip ? SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON : SHFS_SHOWTASKBAR | SHFS_HIDESIPBUTTON; - SHFullScreen(pT->m_hWnd, bShow ? uShow : SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); -#elif _WIN32_WCE > 0x500 // Smartphone 2005 code - SHFullScreen(pT->m_hWnd, bShow ? SHFS_SHOWTASKBAR : SHFS_HIDETASKBAR); -#else // Smartphone 2003 - HWND hTaskBar = FindWindow(_T("tray"), NULL); - ATLASSERT(::IsWindow(hTaskBar)); - ::ShowWindow(hTaskBar, bShow ? SW_SHOW : SW_HIDE); -#endif // WIN32_PLATFORM_PSPC - - pT->MoveWindow(&rect, bRepaint); - } - -// Message map and handler - BEGIN_MSG_MAP(CFullScreenFrame) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) - END_MSG_MAP() - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifndef SETTINGCHANGE_RESET // not defined for PPC 2002 - #define SETTINGCHANGE_RESET SPI_SETWORKAREA -#endif - if (m_bFullScreen && (wParam == SETTINGCHANGE_RESET)) - SetFullScreen(m_bFullScreen); - return bHandled = FALSE; - } - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if (m_bFullScreen) - { - ShowTaskBar(!wParam); - ShowMenuBar(!wParam); - } - return bHandled = FALSE; - } -}; - -#endif // _WTL_CE_NO_FULLSCREEN - - -// --- WinCE zoom support --- - -#ifndef _WTL_CE_NO_ZOOMSCROLL - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollImpl - WinCE zooming implementation on top of CScrollImpl - -template -class CZoomScrollImpl: public CScrollImpl< T > -{ -public: -// Data members - _WTYPES_NS::CSize m_sizeTrue; - double m_fzoom; - -// Creation - CZoomScrollImpl() : m_sizeTrue(0), m_fzoom(1.) - { } - -// Zoom operations and access - void SetZoomScrollSize(_WTYPES_NS::CSize sizeTrue, double fzoom = 1., BOOL bRedraw = TRUE) - { - ATLASSERT(fzoom > 0.); - m_sizeTrue = sizeTrue; - m_fzoom = fzoom; - - CScrollImpl< T >::SetScrollSize(sizeTrue / fzoom, bRedraw); - } - - void SetZoomScrollSize(int cx, int cy, double fzoom=1., BOOL bRedraw = TRUE) - { - SetZoomScrollSize(_WTYPES_NS::CSize(cx, cy), fzoom, bRedraw); - } - - void SetZoom(double fzoom, BOOL bRedraw = TRUE) - { - _WTYPES_NS::CPoint ptCenter = WndtoTrue(m_sizeClient / 2); - _WTYPES_NS::CSize sizePage = GetScrollPage(); - _WTYPES_NS::CSize sizeLine = GetScrollLine(); - - SetZoomScrollSize(GetScrollSize(), fzoom, bRedraw); - - SetScrollLine(sizeLine); - SetScrollPage(sizePage); - _WTYPES_NS::CPoint ptOffset = ptCenter - (m_sizeClient / 2) * fzoom; - SetScrollOffset(ptOffset, bRedraw); - } - - double GetZoom() - { - return m_fzoom; - } - -// CScrollImpl overrides - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - CScrollImpl< T >::SetScrollOffset((int)(x / m_fzoom), (int)(y / m_fzoom), bRedraw); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) - { - ptOffset.x = (LONG)(m_ptOffset.x * m_fzoom); - ptOffset.y = (LONG)(m_ptOffset.y * m_fzoom); - } - - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE) - { - SetZoomScrollSize(cx, cy, GetZoom(), bRedraw); - } - - void SetScrollSize(SIZE sizeTrue, BOOL bRedraw = TRUE) - { - SetZoomScrollSize(sizeTrue, GetZoom(), bRedraw); - } - - void GetScrollSize(SIZE& sizeTrue) const - { - sizeTrue = m_sizeTrue; - } - - void SetScrollPage(int cxPage, int cyPage) - { - SetScrollPage(_WTYPES_NS::CSize(cxPage, cyPage)); - } - - void SetScrollPage(SIZE sizePage) - { - CScrollImpl< T >::SetScrollPage(sizePage / m_fzoom); - } - - void GetScrollPage(SIZE& sizePage) const - { - sizePage = m_sizePage * m_fzoom; - } - - void SetScrollLine(int cxLine, int cyLine) - { - SetScrollLine(_WTYPES_NS::CSize(cxLine, cyLine)); - } - - void SetScrollLine(SIZE sizeLine) - { - CScrollImpl< T >::SetScrollLine(sizeLine / m_fzoom); - } - - void GetScrollLine(SIZE& sizeLine) const - { - sizeLine = m_sizeLine * m_fzoom; - } - -// Data access complements - _WTYPES_NS::CSize GetScrollSize() - { - return m_sizeTrue; - } - - _WTYPES_NS::CSize GetScrollPage() - { - return m_sizePage * m_fzoom; - } - - _WTYPES_NS::CSize GetScrollLine() - { - return m_sizeLine * m_fzoom; - } - - _WTYPES_NS::CPoint GetScrollOffset() - { - return (_WTYPES_NS::CSize)m_ptOffset * m_fzoom; - } - -// Helper coordinate functions - _WTYPES_NS::CPoint WndtoTrue(CPoint ptW) - { - return (_WTYPES_NS::CSize)ptW * GetZoom() + GetScrollOffset(); - } - - void WndtoTrue(LPPOINT aptW, int nPts) // in place coord transformation - { - for (int i = 0 ; i < nPts ; i++) - aptW[i] = WndtoTrue(aptW[i]); - } - - void WndtoTrue(LPRECT prectW) // in place coord transformation - { - WndtoTrue((LPPOINT)prectW, 2); - } - - _WTYPES_NS::CPoint TruetoWnd(CPoint ptT) - { - return (ptT - GetScrollOffset()) / GetZoom(); - } - - void TruetoWnd(LPPOINT aptT, int nPts) // in place coord transformation - { - for (int i = 0 ; i < nPts ; i++) - aptT[i] = TruetoWnd(aptT[i]); - } - - void TruetoWnd(LPRECT prectT) // in place coord transformation - { - TruetoWnd((LPPOINT)prectT, 2); - } - -// Drawing operations : assume adequate setting of data members - BOOL Draw(HBITMAP hbm, HDC hdestDC, DWORD dwROP = SRCCOPY) - { - CDC memDC = CreateCompatibleDC(hdestDC); - CBitmapHandle bmpOld = memDC.SelectBitmap(hbm); - BOOL bRes = Draw(memDC, hdestDC, dwROP); - memDC.SelectBitmap(bmpOld); - return bRes; - } - - BOOL Draw(HDC hsourceDC, HDC hdestDC, DWORD dwROP = SRCCOPY) - { - CDCHandle destDC = hdestDC; - destDC.SetViewportOrg(0,0); - _WTYPES_NS::CPoint ptOffset = GetScrollOffset(); - _WTYPES_NS::CSize sizeZClient = m_sizeClient * GetZoom(); - return destDC.StretchBlt(0, 0, m_sizeClient.cx, m_sizeClient.cy, hsourceDC, ptOffset.x, ptOffset.y, sizeZClient.cx, sizeZClient.cy, dwROP); - } - -#ifdef _IMAGING_H - BOOL Draw(IImage* pIImage, HDC hdestDC) - { - CDCHandle destDC = hdestDC; - destDC.SetViewportOrg(0,0); - return SUCCEEDED(pIImage->Draw(destDC, _WTYPES_NS::CRect(-_WTYPES_NS::CPoint(m_ptOffset), m_sizeAll), NULL)); - } -#endif - -// Message map and handlers - BEGIN_MSG_MAP(CZoomScrollImpl< T >) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - CHAIN_MSG_MAP(CScrollImpl< T >) - END_MSG_MAP() - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if ((GetScrollExtendedStyle() & SCRL_ERASEBACKGROUND)) - { - _WTYPES_NS::CRect rect; - pT->GetClientRect(rect); - _WTYPES_NS::CSize sizeClient=rect.Size(); - - if (m_sizeAll.cx < sizeClient.cx || m_sizeAll.cy < sizeClient.cy) - { - CDCHandle hdc = (HDC)wParam; - HBRUSH hbr = GetSysColorBrush((int)T::GetWndClassInfo().m_wc.hbrBackground - 1); - - if (m_sizeAll.cx < sizeClient.cx) - { - _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(m_sizeAll.cx, 0), sizeClient); - hdc.FillRect(rectBG, hbr); - } - - if (m_sizeAll.cy < sizeClient.cy) - { - _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(0, m_sizeAll.cy), sizeClient); - hdc.FillRect(rectBG, hbr); - } - } - } - else - { - bHandled = FALSE; - } - - return 1; - } -}; - -#endif // _WTL_CE_NO_ZOOMSCROLL - -#ifndef _WTL_CE_NO_CONTROLS - -// --- PPC bottom TabView control --- - -#if defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) - -/////////////////////////////////////////////////////////////////////////////// -// CBottomTabViewImpl - -template -class ATL_NO_VTABLE CBottomTabViewImpl : public CTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) - -// Implementation overrideables - bool CreateTabControl() - { - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | TCS_BOTTOM, 0, m_nTabID); - - ATLASSERT(m_tab.m_hWnd != NULL); - if(m_tab.m_hWnd == NULL) - return false; - - m_tab.SendMessage(CCM_SETVERSION, COMCTL32_VERSION); - m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); - - T* pT = static_cast(this); - m_cyTabHeight = pT->CalcTabHeight(); - - return true; - } - - int CalcTabHeight() - { - int nCount = m_tab.GetItemCount(); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT; - tcix.tciheader.pszText = _T("NS"); - int nIndex = m_tab.InsertItem(nCount, tcix); - - RECT rect = { 0 }; - SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); - RECT rcWnd = rect; - - m_tab.AdjustRect(FALSE, &rect); - rcWnd.top = rect.bottom; - ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); - m_tab.DeleteItem(nIndex); - - return rcWnd.bottom - rcWnd.top; - } - - void UpdateLayout() - { - RECT rect; - GetClientRect(&rect); - - if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) - m_tab.SetWindowPos(NULL, 0, rect.bottom - m_cyTabHeight, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER /*| SWP_SHOWWINDOW*/); - - if(m_nActivePage != -1) - ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, 0, rect.right - rect.left, rect.bottom - m_cyTabHeight, SWP_NOZORDER); - } - -}; - -class CBottomTabView : public CBottomTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_BottomTabView"), 0, COLOR_APPWORKSPACE) -}; - -#endif // defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) - - -// --- PPC/SmartPhone controls --- - -//////////////////////////////////////////////////////////////////////////////// -// These are wrapper classes for the Pocket PC 2002/2003 and SmartPhone 2003 controls -// To implement a window based on a control, use following: -// Example: Implementing a window based on a Html control -// -// class CMyHtml : CWindowImpl -// { -// public: -// BEGIN_MSG_MAP(CMyHtml) -// // put your message handler entries here -// END_MSG_MAP() -// }; -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// CHtmlCtrl - -template -class CHtmlCtrlT : public TBase -{ -public: -// Constructors - CHtmlCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHtmlCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitHTMLControl(hInstance) ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_HTML; - } - -#if (_WIN32_WCE >= 400) - void AddStyle(LPCWSTR pszStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDSTYLE, 0, (LPARAM)pszStyle); - } -#endif // (_WIN32_WCE >= 400) - - void AddText(BOOL bPlainText, LPCSTR pszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)bPlainText, (LPARAM)pszText); - } - - void AddHTML(LPCSTR pszHTML) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)FALSE, (LPARAM)pszHTML); - } - - void AddText(BOOL bPlainText, LPCWSTR pszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)bPlainText, (LPARAM)pszText); - } - - void AddHTML(LPCWSTR pszHTML) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)FALSE, (LPARAM)pszHTML); - } - - void Anchor(LPCSTR pszAnchor) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ANCHOR, 0, (LPARAM)pszAnchor); - } - - void Anchor(LPCWSTR pszAnchor) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ANCHORW, 0, (LPARAM)pszAnchor); - } - -#if (_WIN32_WCE >= 420) - void GetBrowserDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_BROWSERDISPATCH, 0, (LPARAM)ppDispatch); - } - void GetDocumentDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_DOCUMENTDISPATCH , 0, (LPARAM)ppDispatch); - } -#endif // (_WIN32_WCE >= 420) - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_CLEAR, 0, 0L); - } - - void EnableClearType(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLECLEARTYPE, 0, (LPARAM)bEnable); - } - - void EnableContextMenu(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLECONTEXTMENU, 0, (LPARAM)bEnable); - } - - void EnableScripting(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLESCRIPTING, 0, (LPARAM)bEnable); - } - - void EnableShrink(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLESHRINK, 0, (LPARAM)bEnable); - } - - void EndOfSource() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENDOFSOURCE, 0, 0L); - } - - void ImageFail(DWORD dwCookie) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_IMAGEFAIL, 0, (LPARAM)dwCookie); - } - - int GetLayoutHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DTM_LAYOUTHEIGHT, 0, 0L); - } - - int GetLayoutWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DTM_LAYOUTWIDTH, 0, 0L); - } - - void Navigate(LPCTSTR pstrURL, UINT uFlags = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrURL); - ::SendMessage(m_hWnd, DTM_NAVIGATE, (WPARAM)uFlags, (LPARAM)pstrURL); - } - - void SelectAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_SELECTALL, 0, 0L); - } - - void SetImage(INLINEIMAGEINFO* pImageInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pImageInfo); - ::SendMessage(m_hWnd, DTM_SETIMAGE, 0, (LPARAM)pImageInfo); - } - - void ZoomLevel(int iLevel) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ZOOMLEVEL, 0, (LPARAM)iLevel); - } - -#if (_WIN32_WCE >= 400) - void Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_STOP, 0, 0L); - } -#endif // (_WIN32_WCE >= 400) - - void GetScriptDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_SCRIPTDISPATCH, 0, (LPARAM)ppDispatch); - } -}; - -typedef CHtmlCtrlT CHtmlCtrl; - - -#ifdef WIN32_PLATFORM_PSPC - -/////////////////////////////////////////////////////////////////////////////// -// CRichInkCtrl - -template -class CRichInkCtrlT : public TBase -{ -public: -// Constructors - CRichInkCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CRichInkCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitRichInkDLL() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_RICHINK; - } - - BOOL CanPaste(UINT uFormat = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, (WPARAM)uFormat, 0L); - } - - BOOL CanRedo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - void ClearAll(BOOL bRepaint = TRUE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_CLEARALL, (WPARAM)bRepaint, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - UINT GetPageStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETPAGESTYLE, 0, 0L); - } - - UINT GetPenMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETPENMODE, 0, 0L); - } - - UINT GetViewStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETVIEW, 0, 0L); - } - - UINT GetWrapMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETWRAPMODE, 0, 0L); - } - - UINT GetZoomPercent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETZOOMPERCENT, 0, 0L); - } - - void InsertLinks(LPWSTR lpString, int cchLength = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - if(cchLength == -1) - cchLength = lstrlen(lpString); - ::SendMessage(m_hWnd, EM_INSERTLINKS, (WPARAM)cchLength, (LPARAM)lpString); - } - - void RedoEvent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REDOEVENT, 0, 0L); - } - - UINT SetInkLayer(UINT uLayer) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETINKLAYER, (WPARAM)uLayer, 0L); - } - - void SetPageStyle(UINT uStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPAGESTYLE, (WPARAM)uStyle, 0L); - } - - void SetPenMode(UINT uMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPENMODE, (WPARAM)uMode, 0L); - } - - void SetViewStyle(UINT uStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETVIEW, (WPARAM)uStyle, 0L); - } - - void SetViewAttributes(VIEWATTRIBUTES* pAttribs) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pAttribs); - ::SendMessage(m_hWnd, EM_SETVIEWATTRIBUTES, 0, (LPARAM)pAttribs); - } - - void SetWrapMode(UINT uMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETWRAPMODE, (WPARAM)uMode, 0L); - } - - void SetZoomPercent(UINT uPercent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETZOOMPERCENT, (WPARAM)uPercent, 0L); - } - - LONG StreamIn(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, (WPARAM)uFormat, (LPARAM)&es); - } - - LONG StreamOut(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, (WPARAM)uFormat, (LPARAM)&es); - } - - void UndoEvent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_UNDOEVENT, 0, 0L); - } - - void Undo() - { - UndoEvent(); - } - -// Standard EM_xxx messages - DWORD GetSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); - } - - void GetSel(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - } - - void SetSel(int nStartChar, int nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)lpszNewText); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, (WPARAM)bModified, 0L); - } - - int GetTextLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); - } - -// Clipboard operations - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } -}; - -typedef CRichInkCtrlT CRichInkCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CInkXCtrl - -template -class CInkXCtrlT : public TBase -{ -public: -// Constructors - CInkXCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CInkXCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitInkX() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_INKX; - } - - static UINT GetHotRecordingMessage() - { - return ::RegisterWindowMessage(szHotRecording); - } - - void ClearAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_CLEARALL, 0, 0L); - } - - int GetData(BYTE* lpBuffer, INT cbBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpBuffer); - return (int)::SendMessage(m_hWnd, IM_GETDATA, (WPARAM)cbBuffer, (LPARAM)lpBuffer); - } - - int GetDataLen() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, IM_GETDATALEN, 0, 0L); - } - - CRichInkCtrl GetRichInk() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, IM_GETRICHINK, 0, 0L); - } - - BOOL IsRecording() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_RECORDING, 0, 0L); - } - - void ReInit() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_REINIT, 0, 0L); - } - - void SetData(const BYTE* lpInkData, INT cbInkData) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpInkData); - ::SendMessage(m_hWnd, IM_SETDATA, (WPARAM)cbInkData, (LPARAM)lpInkData); - } - - void VoicePlay() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICE_PLAY, 0, 0L); - } - - BOOL IsVoicePlaying() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_VOICE_PLAYING, 0, 0L); - } - - BOOL VoiceRecord() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_VOICE_RECORD, 0, 0L); - } - - void VoiceStop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICE_STOP, 0, 0L); - } - - void ShowVoiceBar(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICEBAR, (WPARAM)bShow, 0L); - } -}; - -typedef CInkXCtrlT CInkXCtrl; - -#endif // WIN32_PLATFORM_PSPC - - -/////////////////////////////////////////////////////////////////////////////// -// CVoiceRecorderCtrl - -template -class CVoiceRecorderCtrlT : public TBase -{ -public: -// Constructors - CVoiceRecorderCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CVoiceRecorderCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, const POINT pt, LPTSTR pstrFileName, UINT nID, DWORD dwStyle = 0) - { - ATLASSERT(pstrFileName != NULL); - CM_VOICE_RECORDER cmvr = { 0 }; - cmvr.cb = sizeof(CM_VOICE_RECORDER); - cmvr.dwStyle = dwStyle; - cmvr.xPos = pt.x; - cmvr.yPos = pt.y; - cmvr.hwndParent = hWndParent; - cmvr.id = nID; - cmvr.lpszRecordFileName = pstrFileName; - m_hWnd = VoiceRecorder_Create(&cmvr); - return m_hWnd; - } - - HWND Create(LPCM_VOICE_RECORDER pAttribs) - { - ATLASSERT(pAttribs); - m_hWnd = VoiceRecorder_Create(pAttribs); - return m_hWnd; - } - -// Attributes - void Record() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_RECORD, 0, 0L); - } - - void Play() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_PLAY, 0, 0L); - } - - void Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_STOP, 0, 0L); - } - - void Cancel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_CANCEL, 0, 0L); - } - - void Done() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_OK, 0, 0L); - } -}; - -typedef CVoiceRecorderCtrlT CVoiceRecorderCtrl; - - -#ifdef WIN32_PLATFORM_PSPC - -/////////////////////////////////////////////////////////////////////////////// -// CDocListCtrl - -template -class CDocListCtrlT : public TBase -{ -public: -// Attributes - DOCLISTCREATE m_dlc; - TCHAR m_szPath[MAX_PATH]; - -// Constructors - CDocListCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CDocListCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, WORD wId, LPCTSTR pszFolder = NULL, LPCTSTR pstrFilter = NULL, - WORD wFilterIndex = 0, DWORD dwFlags = DLF_SHOWEXTENSION) - { - ATLASSERT(pstrFilter != NULL); // It seems to need a filter badly!! - ::ZeroMemory(&m_dlc, sizeof(DOCLISTCREATE)); - ::ZeroMemory(m_szPath, sizeof(m_szPath)); - if(pszFolder != NULL) - SecureHelper::strncpy_x(m_szPath, MAX_PATH, pszFolder, MAX_PATH - 1); - m_dlc.dwStructSize = sizeof(DOCLISTCREATE); - m_dlc.hwndParent = hWndParent; - m_dlc.pszFolder = m_szPath; - m_dlc.pstrFilter = pstrFilter; - m_dlc.wFilterIndex = wFilterIndex; - m_dlc.wId = wId; - m_dlc.dwFlags = dwFlags; - m_hWnd = DocList_Create(&m_dlc); - return m_hWnd; - } - - HWND Create(DOCLISTCREATE* pDlc) - { - m_dlc = *pDlc; - m_hWnd = DocList_Create(&m_dlc); - return m_hWnd; - } - -// Attributes - void DeleteSel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_DELETESEL, 0, 0L); - } - - void DisableUpdates() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_DISABLEUPDATES, 0, 0L); - } - - void EnableUpdates() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_ENABLEUPDATES, 0, 0L); - } - - int GetFilterIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETFILTERINDEX, 0, 0L); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETITEMCOUNT, 0, 0L); - } - - int GetNextItem(int iIndex, DWORD dwRelation = LVNI_ALL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)iIndex, (LPARAM)dwRelation); - } - - int GetFirstItem(DWORD dwRelation = LVNI_ALL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)-1, (LPARAM)dwRelation); - } - - BOOL GetNextWave(int* pIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pIndex); - return (BOOL)::SendMessage(m_hWnd, DLM_GETNEXTWAVE, 0, (LPARAM)pIndex); - } - - BOOL GetPrevWave(int* pIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pIndex); - return (BOOL)::SendMessage(m_hWnd, DLM_GETPREVWAVE, 0, (LPARAM)pIndex); - } - - int GetSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETSELCOUNT, 0, 0L); - } - - BOOL GetSelPathName(LPTSTR pstrPath, int cchMax) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - return (BOOL)::SendMessage(m_hWnd, DLM_GETSELPATHNAME, (WPARAM)cchMax, (LPARAM)pstrPath); - } - - void ReceiveIR(LPCTSTR pstrPath) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_RECEIVEIR, 0, (LPARAM)pstrPath); - } - - void Refresh() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_REFRESH, 0, 0L); - } - - BOOL RenameMoveSelectedItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_RENAMEMOVE, 0, 0L); - } - - int SelectAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_SELECTALL, 0, 0L); - } - - HRESULT SelectItem(LPCTSTR pstrPath, BOOL bVisible = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - return (HRESULT)::SendMessage(m_hWnd, DLM_SELECTITEM, (WPARAM)bVisible, (LPARAM)pstrPath); - } - - void SendEMail(LPCTSTR pstrAttachment) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SENDEMAIL, 0, (LPARAM)pstrAttachment); - } - - void SendIR(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SENDIR, 0, (LPARAM)pstrPath); - } - - HRESULT SetFilterIndex(int iIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, DLM_SETFILTERINDEX, (WPARAM)iIndex, 0L); - } - - void SetFolder(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_SETFOLDER, 0, (LPARAM)pstrPath); - } - - BOOL SetItemState(int iIndex, const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pItem); - return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)pItem); - } - - BOOL SetItemState(int iIndex, UINT uState, UINT uMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LV_ITEM lvi = { 0 }; - lvi.stateMask = uMask; - lvi.state = uState; - return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)&lvi); - } - - void SetOneItem(int iIndex, LPCVOID pPA) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SETONEITEM, (WPARAM)iIndex, (LPARAM)pPA); - } - - void SetSelect(int iIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SETSELECT, (WPARAM)iIndex, 0L); - } - - void SetSelPathName(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_SETSELPATHNAME, 0, (LPARAM)pstrPath); - } - - BOOL SetSortOrder() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_SETSORTORDER, 0, 0L); - } - - HRESULT Update() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, DLM_UPDATE, 0, 0L); - } - - BOOL ValidateFolder() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_VALIDATEFOLDER, 0, 0L); - } - -// Functions - BOOL GetFirstSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - return DocList_GetFirstSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); - } - - BOOL GetNextSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - return DocList_GetNextSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); - } -}; - -typedef CDocListCtrlT CDocListCtrl; - -#endif // WIN32_PLATFORM_PSPC - - -/////////////////////////////////////////////////////////////////////////////// -// CCapEdit - -template -class CCapEditT : public TBase -{ -public: -// Constructors - CCapEditT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CCapEditT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = /*TBase*/CWindow::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_CAPEDIT; - } -}; - -typedef CCapEditT CCapEdit; - -/////////////////////////////////////////////////////////////////////////////// -// CTTStatic - -#ifndef WIN32_PLATFORM_WFSP // Tooltips not supported on SmartPhone - -template -class CTTStaticT : public TBase -{ -public: -// Constructors - CTTStaticT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTTStaticT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TSTATIC; - } - -// Operations - BOOL SetToolTipText(LPCTSTR pstrTipText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrTipText); - ATLASSERT(lstrlen(pstrTipText) <= 253); - CTempBuffer buff; - int cchLen = lstrlen(pstrTipText) + 3; - LPTSTR pstr = buff.Allocate(cchLen); - if(pstr == NULL) - return FALSE; - SecureHelper::strcpy_x(pstr, cchLen, _T("~~")); - SecureHelper::strcat_x(pstr, cchLen, pstrTipText); - return SetWindowText(pstr); - } -}; - -typedef CTTStaticT CTTStatic; - - -/////////////////////////////////////////////////////////////////////////////// -// CTTButton - -template -class CTTButtonT : public TBase -{ -public: -// Constructors - CTTButtonT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTTButtonT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TBUTTON; - } - -// Operations - BOOL SetToolTipText(LPCTSTR pstrTipText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrTipText); - ATLASSERT(lstrlen(pstrTipText) <= 253); - CTempBuffer buff; - int cchLen = lstrlen(pstrTipText) + 3; - LPTSTR pstr = buff.Allocate(cchLen); - if(pstr == NULL) - return FALSE; - SecureHelper::strcpy_x(pstr, cchLen, _T("~~")); - SecureHelper::strcat_x(pstr, cchLen, pstrTipText); - return SetWindowText(pstr); - } -}; - -typedef CTTButtonT CTTButton; - -#endif // !WIN32_PLATFORM_WFSP - - -// --- SmartPhone specific controls --- - -#ifdef WIN32_PLATFORM_WFSP - -/////////////////////////////////////////////////////////////////////////////// -// CSpinCtrlT - CSpinCtrl : SmartPhone adapted UpDown control - -template -class CSpinCtrlT : public CUpDownCtrlT< TBase > -{ -public: -// Constructors - CSpinCtrlT(HWND hWnd = NULL) : CUpDownCtrlT< TBase >(hWnd) - { } - - CSpinCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, HWND hBuddy, DWORD dwStyle, int nID, LPCTSTR szExpandedName = NULL) - { - ATLASSERT(::IsWindow(hWndParent)); - CUpDownCtrlT< TBase >::Create(hWndParent, NULL, szExpandedName, dwStyle, 0, nID, NULL); - ATLASSERT(m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? - if (hBuddy != NULL) - { - ATLASSERT(::IsWindow(hBuddy)); - SetBuddy(hBuddy); - } - return m_hWnd; - } -}; - -typedef CSpinCtrlT CSpinCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CSpinned - SmartPhone association of control and Spin - -template -class CSpinned : public TBase -{ -public: - CSpinCtrl m_SpinCtrl; - DWORD m_dwSpinnedStyle; - -// Constructors - CSpinned(HWND hWnd = NULL) : TBase(hWnd) - { - m_dwSpinnedStyle = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_EXPANDABLE; - - if (t_bExpandOnly == true) - m_dwSpinnedStyle |= UDS_NOSCROLL; - else - m_dwSpinnedStyle |= UDS_HORZ | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_WRAP; - - if (hWnd != NULL) - AttachOrCreateSpinCtrl(); - } - - CSpinned& operator =(HWND hWnd) - { - Attach(hWnd); - return *this; - } - - void Attach(HWND hWnd) - { - ATLASSERT(!IsWindow()); - TBase* pT = static_cast(this); - pT->m_hWnd = hWnd; - if (hWnd != NULL) - AttachOrCreateSpinCtrl(); - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szExpandedName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - - TBase* pT = static_cast(this); - TBase::Create(hWndParent, rect, NULL, dwStyle, dwExStyle, MenuOrID, lpCreateParam); - ATLASSERT(pT->m_hWnd != NULL); - - m_SpinCtrl.Create(hWndParent, pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + (int)MenuOrID.m_hMenu, szExpandedName); - - ATLASSERT(m_SpinCtrl.m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? - - return pT->m_hWnd; - } - -// Attributes - CSpinCtrl& GetSpinCtrl() - { - return m_SpinCtrl; - } - -// Implementation - // Attach our existing SpinCtrl or create one - bool AttachOrCreateSpinCtrl() - { - TBase* pT = static_cast(this); - - HWND hSpin = ::GetDlgItem(pT->GetParent(), ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); - - if (hSpin != NULL) - { - m_SpinCtrl.Attach(hSpin); -#ifdef DEBUG - TCHAR sClassName[16]; - ::GetClassName(hSpin, sClassName, 16); - ATLASSERT(!_tcscmp(sClassName, UPDOWN_CLASS)); - ATLASSERT(m_SpinCtrl.GetBuddy().m_hWnd == pT->m_hWnd); -#endif // DEBUG - } - else - { - m_SpinCtrl.Create(pT->GetParent(), pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); - } - - return m_SpinCtrl.m_hWnd != NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSpinListBox - SmartPhone spinned ListBox control -// CExpandListBox - SmartPhone expandable ListBox control -// CExpandEdit - SmartPhone expandable Edit control -// CExpandCapEdit - SmartPhone expandable CapEdit control - -typedef CSpinned CSpinListBox; -typedef CSpinned CExpandListBox; -typedef CSpinned CExpandEdit; -typedef CSpinned CExpandCapEdit; - -#endif // WIN32_PLATFORM_WFSP - -#endif // _WTL_CE_NO_CONTROLS - -}; // namespace WTL - -#endif // __ATLWINCE_H__ diff --git a/GLideN64/src/GLideNUI-wtl/WTL/atlwinx.h b/GLideN64/src/GLideNUI-wtl/WTL/atlwinx.h deleted file mode 100644 index 0e55bce..0000000 --- a/GLideN64/src/GLideNUI-wtl/WTL/atlwinx.h +++ /dev/null @@ -1,595 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLWINX_H__ -#define __ATLWINX_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlwinx.h requires atlapp.h to be included first -#endif - -#if (_ATL_VER >= 0x0700) - #include -#endif // (_ATL_VER >= 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// _U_RECT -// _U_MENUorID -// _U_STRINGorID - - -/////////////////////////////////////////////////////////////////////////////// -// Command Chaining Macros - -#define CHAIN_COMMANDS(theChainClass) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP(theChainClass) - -#define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP_ALT(theChainClass, msgMapID) - -#define CHAIN_COMMANDS_MEMBER(theChainMember) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP_MEMBER(theChainMember) - -#define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID) - - -/////////////////////////////////////////////////////////////////////////////// -// Macros for parent message map to selectively reflect control messages - -// NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot -// (and overridden in 2 cases - CContainedWindowT and CAxHostWindow) -// Since we can't modify ATL, we'll provide the needed additions -// in a separate function (that is not a member of CWindowImplRoot) - -namespace WTL -{ - -inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, - UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL) -{ - if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg)) - { - // The notification message doesn't match the filter. - bHandled = FALSE; - return 1; - } - - HWND hWndChild = NULL; - UINT_PTR idFrom = 0; - - switch(uMsg) - { - case WM_COMMAND: - if(lParam != NULL) // not from a menu - { - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)LOWORD(wParam); - } - break; - case WM_NOTIFY: - hWndChild = ((LPNMHDR)lParam)->hwndFrom; - idFrom = ((LPNMHDR)lParam)->idFrom; - break; -#ifndef _WIN32_WCE - case WM_PARENTNOTIFY: - switch(LOWORD(wParam)) - { - case WM_CREATE: - case WM_DESTROY: - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)HIWORD(wParam); - break; - default: - hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam)); - idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); - break; - } - break; -#endif // !_WIN32_WCE - case WM_DRAWITEM: - if(wParam) // not from a menu - { - hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem; - idFrom = (UINT_PTR)wParam; - } - break; - case WM_MEASUREITEM: - if(wParam) // not from a menu - { - hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID); - idFrom = (UINT_PTR)wParam; - } - break; - case WM_COMPAREITEM: - if(wParam) // not from a menu - { - hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem; - idFrom = (UINT_PTR)wParam; - } - break; - case WM_DELETEITEM: - if(wParam) // not from a menu - { - hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem; - idFrom = (UINT_PTR)wParam; - } - break; - case WM_VKEYTOITEM: - case WM_CHARTOITEM: - case WM_HSCROLL: - case WM_VSCROLL: - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); - break; - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); - break; - default: - break; - } - - if((hWndChild == NULL) || - ((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild))) - { - // Either hWndChild isn't valid, or - // hWndChild doesn't match the filter. - bHandled = FALSE; - return 1; - } - - if((idFromFilter != 0) && (idFromFilter != idFrom)) - { - // The dialog control id doesn't match the filter. - bHandled = FALSE; - return 1; - } - - ATLASSERT(::IsWindow(hWndChild)); - LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam); - if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) - { - // Try to prevent problems with WM_CTLCOLOR* messages when - // the message wasn't really handled - bHandled = FALSE; - } - - return lResult; -} - -}; // namespace WTL - -// Try to prevent problems with WM_CTLCOLOR* messages when -// the message wasn't really handled -#define REFLECT_NOTIFICATIONS_EX() \ -{ \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \ - bHandled = FALSE; \ - if(bHandled) \ - return TRUE; \ -} - -#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND(id, code) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_ID(id) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_CODE(code) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_RANGE(idFirst, idLast) \ - if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY(id, cd) \ - if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_ID(id) \ - if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_CODE(cd) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \ - if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - - -/////////////////////////////////////////////////////////////////////////////// -// Reflected message handler macros for message maps (for ATL 3.0) - -#if (_ATL_VER < 0x0700) - -#define REFLECTED_COMMAND_HANDLER(id, code, func) \ - if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_ID_HANDLER(id, func) \ - if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \ - if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \ - if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \ - if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \ - if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#endif // (_ATL_VER < 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// Dual argument helper classes (for ATL 3.0) - -#if (_ATL_VER < 0x0700) - -namespace ATL -{ - -class _U_RECT -{ -public: - _U_RECT(LPRECT lpRect) : m_lpRect(lpRect) - { } - _U_RECT(RECT& rc) : m_lpRect(&rc) - { } - LPRECT m_lpRect; -}; - -class _U_MENUorID -{ -public: - _U_MENUorID(HMENU hMenu) : m_hMenu(hMenu) - { } - _U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID)) - { } - HMENU m_hMenu; -}; - -class _U_STRINGorID -{ -public: - _U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString) - { } - _U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID)) - { } - LPCTSTR m_lpstr; -}; - -}; // namespace ATL - -#endif // (_ATL_VER < 0x0700) - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// Forward notifications support for message maps (for ATL 3.0) - -#if (_ATL_VER < 0x0700) - -// forward notifications support -#define FORWARD_NOTIFICATIONS() \ - { \ - bHandled = TRUE; \ - lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - LRESULT lResult = 0; - switch(uMsg) - { - case WM_COMMAND: - case WM_NOTIFY: -#ifndef _WIN32_WCE - case WM_PARENTNOTIFY: -#endif // !_WIN32_WCE - case WM_DRAWITEM: - case WM_MEASUREITEM: - case WM_COMPAREITEM: - case WM_DELETEITEM: - case WM_VKEYTOITEM: - case WM_CHARTOITEM: - case WM_HSCROLL: - case WM_VSCROLL: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam); - break; - default: - bHandled = FALSE; - break; - } - return lResult; -} - -#endif // (_ATL_VER < 0x0700) - -#define DEFAULT_DPI 96.0 - -typedef struct tagSIZEF -{ - FLOAT cx; - FLOAT cy; -} SIZEF, *PSIZEF, *LPSIZEF; - -inline ATLAPI_(SIZE) Dpi() -{ - SIZE dpi; - int nPixelsPerInchX; // Pixels per logical inch along width - int nPixelsPerInchY; // Pixels per logical inch along height - - HDC hDCScreen = GetDC(NULL); // Gets DC of virtual display - ATLASSUME(hDCScreen != NULL); - nPixelsPerInchX = GetDeviceCaps(hDCScreen, LOGPIXELSX); - nPixelsPerInchY = GetDeviceCaps(hDCScreen, LOGPIXELSY); - ReleaseDC(NULL, hDCScreen); - - dpi.cx = nPixelsPerInchX; - dpi.cy = nPixelsPerInchY; - - return dpi; -} - -inline ATLAPI_(SIZEF) DpiScale() -{ - SIZE dpi = Dpi(); - SIZEF dpiScale = { (FLOAT)dpi.cx, (FLOAT)dpi.cy }; - - dpiScale.cx /= DEFAULT_DPI; - dpiScale.cy /= DEFAULT_DPI; - - return dpiScale; -} - -inline ATLAPI_(SIZE) Dpi( - _In_ const HWND &hWnd) -{ - ATLENSURE_THROW(hWnd != NULL, E_POINTER); - SIZE dpi; - int nPixelsPerInchX; // Pixels per logical inch along width - int nPixelsPerInchY; // Pixels per logical inch along height - - HDC hDCWindow = GetDC(hWnd); - ATLASSUME(hDCWindow != NULL); - nPixelsPerInchX = GetDeviceCaps(hDCWindow, LOGPIXELSX); - nPixelsPerInchY = GetDeviceCaps(hDCWindow, LOGPIXELSY); - ReleaseDC(hWnd, hDCWindow); - - dpi.cx = nPixelsPerInchX; - dpi.cy = nPixelsPerInchY; - - return dpi; -} - -inline ATLAPI_(SIZEF) DpiScale( - _In_ const HWND &hWnd) -{ - ATLENSURE_THROW(hWnd != NULL, E_POINTER); - SIZE dpi = Dpi(hWnd); - SIZEF dpiScale = { (FLOAT)dpi.cx, (FLOAT)dpi.cy }; - - dpiScale.cx /= DEFAULT_DPI; - dpiScale.cy /= DEFAULT_DPI; - - return dpiScale; -} - -}; // namespace WTL - -#endif // __ATLWINX_H__ diff --git a/GLideN64/src/GLideNUI-wtl/config-debug.cpp b/GLideN64/src/GLideNUI-wtl/config-debug.cpp deleted file mode 100644 index c56343d..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-debug.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "config-debug.h" -#include "../Config.h" -#include "../DebugDump.h" -#include "Language.h" -#include "resource.h" - -CDebugTab::CDebugTab() : - CConfigTab(IDD_TAB_DEBUG) -{ -} - -BOOL CDebugTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) { - return true; -} - -void CDebugTab::ApplyLanguage(void) { - SetDlgItemTextW(IDC_CHK_DUMP_LOW, wGS(DEBUG_DUMP_LOWLEVEL_INFO).c_str()); - SetDlgItemTextW(IDC_CHK_DUMP_NORMAL, wGS(DEBUG_DUMP_DISPLAY_LIST).c_str()); - SetDlgItemTextW(IDC_CHK_DUMP_DETAIL, wGS(DEBUG_DUMP_DETAILED_INFO).c_str()); -} - -LRESULT CDebugTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -void CDebugTab::LoadSettings(bool /*blockCustomSettings*/) { - CButton(GetDlgItem(IDC_CHK_DUMP_LOW)).SetCheck((config.debug.dumpMode & DEBUG_LOW) != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_DUMP_NORMAL)).SetCheck((config.debug.dumpMode & DEBUG_NORMAL) != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_DUMP_DETAIL)).SetCheck((config.debug.dumpMode & DEBUG_DETAIL) != 0 ? BST_CHECKED : BST_UNCHECKED); -} - -void CDebugTab::SaveSettings() { - config.debug.dumpMode = 0; - if (CButton(GetDlgItem(IDC_CHK_DUMP_LOW)).GetCheck() == BST_CHECKED) - config.debug.dumpMode |= DEBUG_LOW; - if (CButton(GetDlgItem(IDC_CHK_DUMP_NORMAL)).GetCheck() == BST_CHECKED) - config.debug.dumpMode |= DEBUG_NORMAL; - if (CButton(GetDlgItem(IDC_CHK_DUMP_DETAIL)).GetCheck() == BST_CHECKED) - config.debug.dumpMode |= DEBUG_DETAIL; -} diff --git a/GLideN64/src/GLideNUI-wtl/config-debug.h b/GLideN64/src/GLideNUI-wtl/config-debug.h deleted file mode 100644 index 5e84587..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-debug.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "config-tab.h" - -class CDebugTab : - public CConfigTab -{ -public: - BEGIN_MSG_MAP(CEmulationTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - END_MSG_MAP() - - CDebugTab(); - - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - void ApplyLanguage(void); - void LoadSettings(bool /*blockCustomSettings*/); - void SaveSettings(); -}; diff --git a/GLideN64/src/GLideNUI-wtl/config-emulation.cpp b/GLideN64/src/GLideNUI-wtl/config-emulation.cpp deleted file mode 100644 index 1538e36..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-emulation.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include "config-emulation.h" -#include "util/util.h" -#include "../Config.h" -#include "resource.h" -#include "ConfigDlg.h" - -CEmulationTab::CEmulationTab(CConfigDlg & Dlg) : - CConfigTab(IDD_TAB_EMULATION), - m_Dlg(Dlg) -{ -} - -BOOL CEmulationTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) -{ - TTInit(); - TTSize(400); - - CComboBox nativeRes2DComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D)); - nativeRes2DComboBox.ResetContent(); - nativeRes2DComboBox.AddString(wGS(EMULATION_RENDER_DISABLE).c_str()); - nativeRes2DComboBox.AddString(wGS(EMULATION_RENDER_ENABLE_OPTIMIZED).c_str()); - nativeRes2DComboBox.AddString(wGS(EMULATION_RENDER_ENABLE_UNOPTIMIZED).c_str()); - - m_GammaTxt.Attach(GetDlgItem(IDC_GAMMA_VALUE)); - m_GammaSpin.Attach(GetDlgItem(IDC_GAMMA_SPIN)); - m_GammaSpin.SetBase(10); - m_GammaSpin.SetRange(10, 40); - m_GammaSpin.SetPos(20); - m_GammaSpin.SetBuddy(m_GammaTxt); - - m_N64ResMultiplerTxt.Attach(GetDlgItem(IDC_N64_RES_MULTIPLER_TXT)); - m_N64ResMultiplerSpin.Attach(GetDlgItem(IDC_N64_RES_MULTIPLER_SPIN)); - m_N64ResMultiplerSpin.SetBase(10); - m_N64ResMultiplerSpin.SetRange(2, 16); - m_N64ResMultiplerSpin.SetPos(2); - m_N64ResMultiplerSpin.SetBuddy(m_N64ResMultiplerTxt); - - SIZE iconSz = { ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON) }; - m_GammaIcon.SubclassWindow(GetDlgItem(IDC_GAMMA_ICON)); - m_GammaIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_INFO), iconSz.cx, iconSz.cy); - m_GammaIcon.SetWindowPos(HWND_TOP, 0, 0, iconSz.cx, iconSz.cy, SWP_NOMOVE | SWP_NOZORDER); - m_GammaIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH)); - return true; -} - -LRESULT CEmulationTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -void CEmulationTab::OnGammaCorrection(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - CButton OverScan(GetDlgItem(IDC_CHK_GAMMA_CORRECTION)); - if (OverScan.GetCheck() == BST_CHECKED) { - GetDlgItem(IDC_GAMMA_ICON).ShowWindow(SW_SHOW); - GetDlgItem(IDC_GAMMA_INFO).ShowWindow(SW_SHOW); - } else { - GetDlgItem(IDC_GAMMA_ICON).ShowWindow(SW_HIDE); - GetDlgItem(IDC_GAMMA_INFO).ShowWindow(SW_HIDE); - } -} - -void CEmulationTab::OnPerGameSettings(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - m_Dlg.OnCustomSettingsToggled(CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED); -} - -void CEmulationTab::ApplyLanguage(void) -{ - SetDlgItemTextW(IDC_CHK_USE_PER_GAME, wGS(EMULATION_USE_PER_GAME).c_str()); - SetDlgItemTextW(IDC_CHK_N64_STYLE_MIP_MAPPING, wGS(EMULATION_N64_STYLE_MIP_MAPPING).c_str()); - SetDlgItemTextW(IDC_CHK_HWLIGHTING, wGS(EMULATION_HWLIGHTING).c_str()); - SetDlgItemTextW(IDC_CHK_PIXEL_COVERAGE, wGS(EMULATION_PIXEL_COVERAGE).c_str()); - SetDlgItemTextW(IDC_CHK_SHADERS_STORAGE, wGS(EMULATION_SHADERS_STORAGE).c_str()); - SetDlgItemTextW(IDC_INTERNAL_RES_GROUP, wGS(EMULATION_INTERNAL_RES).c_str()); - SetDlgItemTextW(IDC_FACTOR0X_RADIO, wGS(EMULATION_FACTOR0X).c_str()); - SetDlgItemTextW(IDC_FACTOR1X_RADIO, wGS(EMULATION_FACTOR1X).c_str()); - SetDlgItemTextW(IDC_FACTORXX_RADIO, wGS(EMULATION_FACTORXX).c_str()); - SetDlgItemTextW(IDC_GAMMA_GROUP, wGS(EMULATION_GAMMA).c_str()); - SetDlgItemTextW(IDC_CHK_GAMMA_CORRECTION, wGS(EMULATION_GAMMA_CORRECTION).c_str()); - SetDlgItemTextW(IDC_GAMMA_INFO, wGS(EMULATION_GAMMA_INFO).c_str()); - SetDlgItemTextW(IDC_2D_ELEMENTS_GROUP, wGS(EMULATION_2D_ELEMENTS).c_str()); - SetDlgItemTextW(IDC_RENDER_2D_ELEMENTS, wGS(EMULATION_RENDER_2D_ELEMENTS).c_str()); - SetDlgItemTextW(IDC_CHK_HALOS_REMOVAL, wGS(EMULATION_HALOS_REMOVAL).c_str()); - SetDlgItemTextW(IDC_TXT_FIXBLACK_LINES, wGS(EMULATION_FIX_BLACK_LINES).c_str()); - SetDlgItemTextW(IDC_FIXTEXRECT_SMART, wGS(EMULATION_ADJACENT_2D_ELEMENTS).c_str()); - SetDlgItemTextW(IDC_FIXTEXRECT_FORCE, wGS(EMULATION_ALWAYS).c_str()); - SetDlgItemTextW(IDC_FIXTEXRECT_NEVER, wGS(EMULATION_NEVER).c_str()); - SetDlgItemTextW(IDC_TXT_BACKGROUND_RENDERING, wGS(EMULATION_BACKGROUND).c_str()); - SetDlgItemTextW(IDC_BGMODE_ONEPIECE, wGS(EMULATION_ONE_PIECE).c_str()); - SetDlgItemTextW(IDC_BGMODE_STRIPPED, wGS(EMULATION_STRIPPED).c_str()); - - std::wstring tooltip = wGS(EMULATION_USE_PER_GAME_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_USE_PER_GAME), tooltip.c_str()); - tooltip = wGS(EMULATION_N64_STYLE_MIP_MAPPING_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING), tooltip.c_str()); - tooltip = wGS(EMULATION_HWLIGHTING_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_HWLIGHTING), tooltip.c_str()); - tooltip = wGS(EMULATION_PIXEL_COVERAGE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_PIXEL_COVERAGE), tooltip.c_str()); - tooltip = wGS(EMULATION_SHADERS_STORAGE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_SHADERS_STORAGE), tooltip.c_str()); - tooltip = wGS(EMULATION_INTERNAL_RES_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_INTERNAL_RES_GROUP), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FACTOR0X_RADIO), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FACTOR1X_RADIO), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FACTORXX_RADIO), tooltip.c_str()); - tooltip = wGS(EMULATION_GAMMA_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_GAMMA_GROUP), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CHK_GAMMA_CORRECTION), tooltip.c_str()); - tooltip = wGS(EMULATION_RENDER_2D_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_RENDER_2D_ELEMENTS), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_NATIVE_RES_2D), tooltip.c_str()); - tooltip = wGS(EMULATION_FIX_BLACK_LINES_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_FIXBLACK_LINES), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FIXTEXRECT_SMART), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FIXTEXRECT_FORCE), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FIXTEXRECT_NEVER), tooltip.c_str()); - tooltip = wGS(EMULATION_BACKGROUND_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_BACKGROUND_RENDERING), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_BGMODE_ONEPIECE), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_BGMODE_STRIPPED), tooltip.c_str()); - - CComboBox nativeRes2DComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D)); - int selectedIndx = nativeRes2DComboBox.GetCurSel(); - nativeRes2DComboBox.ResetContent(); - nativeRes2DComboBox.AddString(wGS(EMULATION_RENDER_DISABLE).c_str()); - nativeRes2DComboBox.AddString(wGS(EMULATION_RENDER_ENABLE_OPTIMIZED).c_str()); - nativeRes2DComboBox.AddString(wGS(EMULATION_RENDER_ENABLE_UNOPTIMIZED).c_str()); - if (selectedIndx >= 0) - nativeRes2DComboBox.SetCurSel(selectedIndx); -} - -void CEmulationTab::LoadSettings(bool blockCustomSettings) -{ - if (!blockCustomSettings) { - CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).SetCheck(config.generalEmulation.enableCustomSettings != 0 ? BST_CHECKED : BST_UNCHECKED); - m_Dlg.OnCustomSettingsToggled(config.generalEmulation.enableCustomSettings != 0); - } - CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).SetCheck(config.generalEmulation.enableLOD != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_HWLIGHTING)).SetCheck(config.generalEmulation.enableHWLighting != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_PIXEL_COVERAGE)).SetCheck(config.generalEmulation.enableCoverage != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_SHADERS_STORAGE)).SetCheck(config.generalEmulation.enableShadersStorage != 0 ? BST_CHECKED : BST_UNCHECKED); - - CButton(GetDlgItem(IDC_CHK_HALOS_REMOVAL)).SetCheck(config.texture.enableHalosRemoval != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_FIXTEXRECT_NEVER)).SetCheck(config.graphics2D.correctTexrectCoords == Config::tcDisable ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_FIXTEXRECT_SMART)).SetCheck(config.graphics2D.correctTexrectCoords == Config::tcSmart ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_FIXTEXRECT_FORCE)).SetCheck(config.graphics2D.correctTexrectCoords == Config::tcForce ? BST_CHECKED : BST_UNCHECKED); - - CButton(GetDlgItem(IDC_BGMODE_ONEPIECE)).SetCheck(config.graphics2D.bgMode == Config::BGMode::bgOnePiece ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_BGMODE_STRIPPED)).SetCheck(config.graphics2D.bgMode == Config::BGMode::bgStripped ? BST_CHECKED : BST_UNCHECKED); - - CComboBox nativeRes2DComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D)); - nativeRes2DComboBox.SetCurSel(config.graphics2D.enableNativeResTexrects); - - CButton(GetDlgItem(IDC_CHK_GAMMA_CORRECTION)).SetCheck(config.gammaCorrection.force != 0 ? BST_CHECKED : BST_UNCHECKED); - int GammaPos = (int)(config.gammaCorrection.force != 0 ? config.gammaCorrection.level : 2.0) * 10; - m_GammaSpin.SetPos(GammaPos); - m_GammaTxt.SetWindowText(FormatStrW(L"%0.1f", (float)GammaPos / 10.0f).c_str()); - GetDlgItem(IDC_GAMMA_ICON).ShowWindow(config.gammaCorrection.force != 0 ? SW_SHOW : SW_HIDE); - GetDlgItem(IDC_GAMMA_INFO).ShowWindow(config.gammaCorrection.force != 0 ? SW_SHOW : SW_HIDE); - - CButton(GetDlgItem(IDC_FACTOR0X_RADIO)).SetCheck(config.frameBufferEmulation.nativeResFactor == 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_FACTOR1X_RADIO)).SetCheck(config.frameBufferEmulation.nativeResFactor == 1 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_FACTORXX_RADIO)).SetCheck(config.frameBufferEmulation.nativeResFactor > 1 ? BST_CHECKED : BST_UNCHECKED); - m_N64ResMultiplerSpin.SetPos(config.frameBufferEmulation.nativeResFactor > 1 ? config.frameBufferEmulation.nativeResFactor : 2); - m_N64ResMultiplerTxt.SetWindowText(FormatStrW(L"%dx", m_N64ResMultiplerSpin.GetPos()).c_str()); -} - -void CEmulationTab::SaveSettings() -{ - config.generalEmulation.enableCustomSettings = CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED ? 1 : 0; - config.generalEmulation.enableLOD = CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).GetCheck() == BST_CHECKED ? 1 : 0; - config.generalEmulation.enableHWLighting = CButton(GetDlgItem(IDC_CHK_HWLIGHTING)).GetCheck() == BST_CHECKED ? 1 : 0; - config.generalEmulation.enableCoverage = CButton(GetDlgItem(IDC_CHK_PIXEL_COVERAGE)).GetCheck() == BST_CHECKED ? 1 : 0; - config.generalEmulation.enableShadersStorage = CButton(GetDlgItem(IDC_CHK_SHADERS_STORAGE)).GetCheck() == BST_CHECKED ? 1 : 0; - - if (CButton(GetDlgItem(IDC_FACTOR0X_RADIO)).GetCheck() == BST_CHECKED) { - config.frameBufferEmulation.nativeResFactor = 0; - } else if (CButton(GetDlgItem(IDC_FACTOR1X_RADIO)).GetCheck() == BST_CHECKED) { - config.frameBufferEmulation.nativeResFactor = 1; - } else if (CButton(GetDlgItem(IDC_FACTORXX_RADIO)).GetCheck() == BST_CHECKED) { - config.frameBufferEmulation.nativeResFactor = m_N64ResMultiplerSpin.GetPos(); - } - config.gammaCorrection.force = CButton(GetDlgItem(IDC_CHK_GAMMA_CORRECTION)).GetCheck() == BST_CHECKED ? 1 : 0; - config.gammaCorrection.level = ((float)m_GammaSpin.GetPos()) / 10; - config.graphics2D.enableNativeResTexrects = CComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D)).GetCurSel(); - config.texture.enableHalosRemoval = CButton(GetDlgItem(IDC_CHK_HALOS_REMOVAL)).GetCheck() == BST_CHECKED ? 1 : 0; - - if (CButton(GetDlgItem(IDC_FIXTEXRECT_NEVER)).GetCheck() == BST_CHECKED) { - config.graphics2D.correctTexrectCoords = Config::tcDisable; - } else if (CButton(GetDlgItem(IDC_FIXTEXRECT_SMART)).GetCheck() == BST_CHECKED) { - config.graphics2D.correctTexrectCoords = Config::tcSmart; - } else if (CButton(GetDlgItem(IDC_FIXTEXRECT_FORCE)).GetCheck() == BST_CHECKED) { - config.graphics2D.correctTexrectCoords = Config::tcForce; - } - - if (CButton(GetDlgItem(IDC_BGMODE_ONEPIECE)).GetCheck() == BST_CHECKED) { - config.graphics2D.bgMode = Config::BGMode::bgOnePiece; - } else if (CButton(GetDlgItem(IDC_BGMODE_STRIPPED)).GetCheck() == BST_CHECKED) { - config.graphics2D.bgMode = Config::BGMode::bgStripped; - } -} - -LRESULT CEmulationTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) -{ - LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID); - if (CtrlId == IDC_GAMMA_SPIN) { - int Pos = m_GammaSpin.GetPos(); - m_GammaTxt.SetWindowText(FormatStrW(L"%0.1f", (float)Pos / 10.0f).c_str()); - } else if (CtrlId == IDC_N64_RES_MULTIPLER_SPIN) { - int Pos = m_N64ResMultiplerSpin.GetPos(); - m_N64ResMultiplerTxt.SetWindowText(FormatStrW(L"%dx", Pos).c_str()); - } - return 0; -} diff --git a/GLideN64/src/GLideNUI-wtl/config-emulation.h b/GLideN64/src/GLideNUI-wtl/config-emulation.h deleted file mode 100644 index 1983eeb..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-emulation.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -#include "config-tab.h" -#include "wtl-BitmapPicture.h" -#include "wtl-tooltip.h" -#include "resource.h" - -class CConfigDlg; - -class CEmulationTab : - public CConfigTab, - public CToolTipDialog -{ -public: - BEGIN_MSG_MAP(CEmulationTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_VSCROLL, OnScroll) - COMMAND_HANDLER_EX(IDC_CHK_GAMMA_CORRECTION, BN_CLICKED, OnGammaCorrection) - COMMAND_HANDLER_EX(IDC_CHK_USE_PER_GAME, BN_CLICKED, OnPerGameSettings) - CHAIN_MSG_MAP(CToolTipDialog) - REFLECT_NOTIFICATIONS() - END_MSG_MAP() - - CEmulationTab(CConfigDlg & Dlg); - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - void OnGammaCorrection(UINT /*Code*/, int id, HWND /*ctl*/); - void OnPerGameSettings(UINT /*Code*/, int id, HWND /*ctl*/); - void ApplyLanguage(void); - void LoadSettings(bool /*blockCustomSettings*/); - void SaveSettings(); - -private: - LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); - - CEdit m_GammaTxt, m_N64ResMultiplerTxt; - CUpDownCtrl m_GammaSpin, m_N64ResMultiplerSpin; - CBitmapPicture m_GammaIcon; - CConfigDlg & m_Dlg; -}; diff --git a/GLideN64/src/GLideNUI-wtl/config-framebuffer.cpp b/GLideN64/src/GLideNUI-wtl/config-framebuffer.cpp deleted file mode 100644 index 1346c8b..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-framebuffer.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "config-framebuffer.h" -#include "resource.h" -#include "../Config.h" -#include "Language.h" - -CFrameBufferTab::CFrameBufferTab() : - CConfigTab(IDD_TAB_FRAME_BUFFER) -{ -} - -BOOL CFrameBufferTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) -{ - TTInit(); - TTSize(400); - - SIZE iconSz = { ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON) }; - m_EmulateFBIcon.SubclassWindow(GetDlgItem(IDC_EMULATE_FB_ICON)); - m_EmulateFBIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_WARNING), iconSz.cx, iconSz.cy); - m_EmulateFBIcon.SetWindowPos(HWND_TOP, 0, 0, iconSz.cx, iconSz.cy, SWP_NOMOVE | SWP_NOZORDER); - m_EmulateFBIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH)); - - CComboBox frameBufferSwapComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)); - frameBufferSwapComboBox.AddString(wGS(FRAMEBUFFER_VERTICAL_INTERRUPT).c_str()); - frameBufferSwapComboBox.AddString(wGS(FRAMEBUFFER_VI_ORIGIN_CHANGE).c_str()); - frameBufferSwapComboBox.AddString(wGS(FRAMEBUFFER_COLOR_BUFFER_CHANGE).c_str()); - - CComboBox copyColorBufferComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)); - copyColorBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_NEVER).c_str()); - copyColorBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_SYNCHRONOUS).c_str()); - copyColorBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_ASYNCHRONOUS).c_str()); - - CComboBox copyDepthBufferComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)); - copyDepthBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_DEPTH_NEVER).c_str()); - copyDepthBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_DEPTH_VRAM).c_str()); - copyDepthBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_DEPTH_SOFTWARE).c_str()); - - CComboBox n64DepthCompareComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)); - n64DepthCompareComboBox.AddString(wGS(FRAMEBUFFER_N64_DEPTH_DISABLE).c_str()); - n64DepthCompareComboBox.AddString(wGS(FRAMEBUFFER_N64_DEPTH_FAST).c_str()); - n64DepthCompareComboBox.AddString(wGS(FRAMEBUFFER_N64_DEPTH_COMPATIBLE).c_str()); - return true; -} - -void CFrameBufferTab::ApplyLanguage(void) -{ - SetDlgItemTextW(IDC_CHK_ENABLE_FRAMEBUFFER, wGS(FRAMEBUFFER_ENABLE).c_str()); - SetDlgItemTextW(IDC_FRAME_BUFFER_INFO, wGS(FRAMEBUFFER_ENABLE_INFO).c_str()); - SetDlgItemTextW(IDC_CHK_COPY_AUX_BUFFERS, wGS(FRAMEBUFFER_COPY_AUX_BUFFERS).c_str()); - SetDlgItemTextW(IDC_TXT_FRAMEBUFFER_SWAP, wGS(FRAMEBUFFER_SWAP).c_str()); - SetDlgItemTextW(IDC_CHK_FB_INFO_ENABLE, wGS(FRAMEBUFFER_INFO_ENABLE).c_str()); - SetDlgItemTextW(IDC_CHK_READ_COLOR_CHUNK, wGS(FRAMEBUFFER_READ_COLOR_CHUNK).c_str()); - SetDlgItemTextW(IDC_CHK_READ_DEPTH_CHUNK, wGS(FRAMEBUFFER_READ_DEPTH_CHUNK).c_str()); - SetDlgItemTextW(IDC_TXT_COPY_COLOR_BUFFER, wGS(FRAMEBUFFER_COPY_COLOR_BUFFER).c_str()); - SetDlgItemTextW(IDC_TXT_COPY_DEPTH_BUFFER, wGS(FRAMEBUFFER_COPY_DEPTH_BUFFER).c_str()); - SetDlgItemTextW(IDC_TXT_N64_DEPTH_COMPARE, wGS(FRAMEBUFFER_N64_DEPTH_COMPARE).c_str()); - SetDlgItemTextW(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR, wGS(FRAMEBUFFER_FORCE_DEPTH_BUFFER_CLEAR).c_str()); - SetDlgItemTextW(IDC_CHK_RENDER_FRAMEBUFFER, wGS(FRAMEBUFFER_RENDER_FRAMEBUFFER).c_str()); - SetDlgItemTextW(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER, wGS(FRAMEBUFFER_COPY_DEPTH_TO_MAIN).c_str()); - - std::wstring tooltip = wGS(FRAMEBUFFER_COPY_AUX_BUFFERS_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_SWAP_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_FRAMEBUFFER_SWAP), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_INFO_ENABLE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_FB_INFO_ENABLE), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_READ_COLOR_CHUNK_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_READ_DEPTH_CHUNK_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_COPY_COLOR_BUFFER_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_COPY_COLOR_BUFFER), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_COPY_DEPTH_BUFFER_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_COPY_COLOR_BUFFER), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_N64_DEPTH_COMPARE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_N64_DEPTH_COMPARE), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_FORCE_DEPTH_BUFFER_CLEAR_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_RENDER_FRAMEBUFFER_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER), tooltip.c_str()); - tooltip = wGS(FRAMEBUFFER_COPY_DEPTH_TO_MAIN_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER), tooltip.c_str()); - - CComboBox frameBufferSwapComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)); - int selectedIndx = frameBufferSwapComboBox.GetCurSel(); - frameBufferSwapComboBox.ResetContent(); - frameBufferSwapComboBox.AddString(wGS(FRAMEBUFFER_VERTICAL_INTERRUPT).c_str()); - frameBufferSwapComboBox.AddString(wGS(FRAMEBUFFER_VI_ORIGIN_CHANGE).c_str()); - frameBufferSwapComboBox.AddString(wGS(FRAMEBUFFER_COLOR_BUFFER_CHANGE).c_str()); - if (selectedIndx >= 0) - frameBufferSwapComboBox.SetCurSel(selectedIndx); - - CComboBox copyColorBufferComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)); - selectedIndx = copyColorBufferComboBox.GetCurSel(); - copyColorBufferComboBox.ResetContent(); - copyColorBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_NEVER).c_str()); - copyColorBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_SYNCHRONOUS).c_str()); - copyColorBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_ASYNCHRONOUS).c_str()); - if (selectedIndx >= 0) - copyColorBufferComboBox.SetCurSel(selectedIndx); - - CComboBox copyDepthBufferComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)); - selectedIndx = copyDepthBufferComboBox.GetCurSel(); - copyDepthBufferComboBox.ResetContent(); - copyDepthBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_DEPTH_NEVER).c_str()); - copyDepthBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_DEPTH_VRAM).c_str()); - copyDepthBufferComboBox.AddString(wGS(FRAMEBUFFER_COPY_DEPTH_SOFTWARE).c_str()); - if (selectedIndx >= 0) - copyDepthBufferComboBox.SetCurSel(selectedIndx); - - CComboBox n64DepthCompareComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)); - selectedIndx = n64DepthCompareComboBox.GetCurSel(); - n64DepthCompareComboBox.ResetContent(); - n64DepthCompareComboBox.AddString(wGS(FRAMEBUFFER_N64_DEPTH_DISABLE).c_str()); - n64DepthCompareComboBox.AddString(wGS(FRAMEBUFFER_N64_DEPTH_FAST).c_str()); - n64DepthCompareComboBox.AddString(wGS(FRAMEBUFFER_N64_DEPTH_COMPATIBLE).c_str()); - if (selectedIndx >= 0) - n64DepthCompareComboBox.SetCurSel(selectedIndx); -} - -LRESULT CFrameBufferTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -LRESULT CFrameBufferTab::OnEnableFramebuffer(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - bool fbEmulationEnabled = CButton(GetDlgItem(IDC_CHK_ENABLE_FRAMEBUFFER)).GetCheck() == BST_CHECKED; - bool fbInfoEnabled = CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).GetCheck() == BST_CHECKED; - CButton(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER)).EnableWindow(fbEmulationEnabled); - CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).EnableWindow(fbEmulationEnabled && fbInfoEnabled); - CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).EnableWindow(fbEmulationEnabled && fbInfoEnabled); - return 0; -} - - -LRESULT CFrameBufferTab::OnFbInfoEnable(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - bool fbInfoEnabled = CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).GetCheck() == BST_CHECKED; - CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).EnableWindow(fbInfoEnabled); - CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).EnableWindow(fbInfoEnabled); - return 0; -} - -void CFrameBufferTab::LoadSettings(bool /*blockCustomSettings*/) -{ - const bool fbEmulationEnabled = config.frameBufferEmulation.enable != 0; - CButton(GetDlgItem(IDC_CHK_ENABLE_FRAMEBUFFER)).SetCheck(fbEmulationEnabled != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS)).SetCheck(config.frameBufferEmulation.copyAuxToRDRAM != 0 ? BST_CHECKED : BST_UNCHECKED); - CComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)).SetCurSel(config.frameBufferEmulation.bufferSwapMode); - CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).SetCheck(config.frameBufferEmulation.fbInfoDisabled == 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).SetCheck(config.frameBufferEmulation.fbInfoReadColorChunk != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).SetCheck(config.frameBufferEmulation.fbInfoReadDepthChunk != 0 ? BST_CHECKED : BST_UNCHECKED); - CComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)).SetCurSel(config.frameBufferEmulation.copyToRDRAM); - CComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)).SetCurSel(config.frameBufferEmulation.copyDepthToRDRAM); - CComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).SetCurSel(config.frameBufferEmulation.N64DepthCompare); - CButton(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR)).SetCheck(config.frameBufferEmulation.forceDepthBufferClear != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER)).SetCheck(config.frameBufferEmulation.copyFromRDRAM != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER)).SetCheck(config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0 ? BST_CHECKED : BST_UNCHECKED); - - OnFbInfoEnable(0, 0, NULL); - OnEnableFramebuffer(0, 0, NULL); -} - -void CFrameBufferTab::SaveSettings() -{ - config.frameBufferEmulation.enable = CButton(GetDlgItem(IDC_CHK_ENABLE_FRAMEBUFFER)).GetCheck() == BST_CHECKED ? 1 : 0; - config.frameBufferEmulation.copyAuxToRDRAM = CButton(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS)).GetCheck() == BST_CHECKED ? 1 : 0; - config.frameBufferEmulation.bufferSwapMode = CComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)).GetCurSel(); - config.frameBufferEmulation.fbInfoDisabled = CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).GetCheck() == BST_CHECKED ? 0 : 1; - config.frameBufferEmulation.fbInfoReadColorChunk = CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).GetCheck() == BST_CHECKED ? 1 : 0; - config.frameBufferEmulation.fbInfoReadDepthChunk = CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).GetCheck() == BST_CHECKED ? 1 : 0; - config.frameBufferEmulation.copyToRDRAM = CComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)).GetCurSel(); - config.frameBufferEmulation.copyDepthToRDRAM = CComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)).GetCurSel(); - config.frameBufferEmulation.N64DepthCompare = CComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).GetCurSel(); - config.frameBufferEmulation.forceDepthBufferClear = CButton(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR)).GetCheck() == BST_CHECKED ? 1 : 0; - config.frameBufferEmulation.copyFromRDRAM = CButton(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER)).GetCheck() == BST_CHECKED ? 1 : 0; - config.frameBufferEmulation.copyDepthToMainDepthBuffer = CButton(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER)).GetCheck() == BST_CHECKED ? 1 : 0; -} diff --git a/GLideN64/src/GLideNUI-wtl/config-framebuffer.h b/GLideN64/src/GLideNUI-wtl/config-framebuffer.h deleted file mode 100644 index 937dbbf..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-framebuffer.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#include "config-tab.h" -#include "wtl-BitmapPicture.h" -#include "wtl-tooltip.h" -#include "resource.h" - -class CFrameBufferTab : - public CConfigTab, - public CToolTipDialog -{ -public: - BEGIN_MSG_MAP(CFrameBufferTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - COMMAND_HANDLER_EX(IDC_CHK_ENABLE_FRAMEBUFFER, BN_CLICKED, OnEnableFramebuffer) - COMMAND_HANDLER_EX(IDC_CHK_FB_INFO_ENABLE, BN_CLICKED, OnFbInfoEnable) - CHAIN_MSG_MAP(CToolTipDialog) - END_MSG_MAP() - - CFrameBufferTab(); - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnEnableFramebuffer(UINT /*Code*/, int id, HWND /*ctl*/); - LRESULT OnFbInfoEnable(UINT /*Code*/, int id, HWND /*ctl*/); - void ApplyLanguage(void); - void LoadSettings(bool blockCustomSettings); - void SaveSettings(); - -private: - CBitmapPicture m_EmulateFBIcon; -}; - diff --git a/GLideN64/src/GLideNUI-wtl/config-osd.cpp b/GLideN64/src/GLideNUI-wtl/config-osd.cpp deleted file mode 100644 index 7117edc..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-osd.cpp +++ /dev/null @@ -1,307 +0,0 @@ -#include "config-osd.h" -#include "resource.h" -#include "util/util.h" -#include "../Config.h" -#include "FontInfo.h" -#include "Language.h" - -COsdTab::COsdTab() : - CConfigTab(IDD_TAB_OSD), - m_PosTopLeft(IDI_OSD_TOP_LEFT), - m_PosTop(IDI_OSD_TOP), - m_PosTopRight(IDI_OSD_TOP_RIGHT), - m_PosCenterLeft(IDI_OSD_LEFT), - m_PosCenter(0), - m_PosCenterRight(IDI_OSD_RIGHT), - m_PosBottomLeft(IDI_OSD_BOTTOM_LEFT), - m_PosBottom(IDI_OSD_BOTTOM), - m_PosBottomRight(IDI_OSD_BOTTOM_RIGHT) -{ - m_FontsLoaded = false; -} - -BOOL COsdTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) -{ - m_PosTopLeft.SubclassWindow(GetDlgItem(IDC_OSD_TOP_LEFT)); - m_PosTop.SubclassWindow(GetDlgItem(IDC_OSD_TOP)); - m_PosTopRight.SubclassWindow(GetDlgItem(IDC_OSD_TOP_RIGHT)); - m_PosCenterLeft.SubclassWindow(GetDlgItem(IDC_OSD_CENTER_LEFT)); - m_PosCenter.SubclassWindow(GetDlgItem(IDC_OSD_CENTER)); - m_PosCenterRight.SubclassWindow(GetDlgItem(IDC_OSD_CENTER_RIGHT)); - m_PosBottomLeft.SubclassWindow(GetDlgItem(IDC_OSD_BOTTOM_LEFT)); - m_PosBottom.SubclassWindow(GetDlgItem(IDC_OSD_BOTTOM)); - m_PosBottomRight.SubclassWindow(GetDlgItem(IDC_OSD_BOTTOM_RIGHT)); - m_Fonts.Attach(GetDlgItem(IDC_FONTS)); - m_OsdColor.SubclassWindow(GetDlgItem(IDC_OSD_COLOR)); - m_OsdPreview.SubclassWindow(GetDlgItem(IDC_OSD_PREVIEW)); - - m_FontSizeTxt.Attach(GetDlgItem(IDC_FONT_SIZE_TXT)); - m_FontSizeSpin.Attach(GetDlgItem(IDC_FONT_SIZE_SPIN)); - m_FontSizeSpin.SetBase(10); - m_FontSizeSpin.SetRange(6, 99); - m_FontSizeSpin.SetBuddy(m_FontSizeTxt); - - m_PosCenterLeft.EnableWindow(false); - m_PosCenter.EnableWindow(false); - m_PosCenterRight.EnableWindow(false); - - return true; -} - -void COsdTab::LoadFonts(void) -{ - FontList fonts = GetFontFiles(); - HTREEITEM hCurrentItem = TVI_ROOT; - for (FontList::const_iterator itr = fonts.begin(); itr != fonts.end(); itr++) { - std::wstring FontFile = ToUTF16(itr->first.c_str()); - std::wstring FontName = ToUTF16(itr->second.c_str()); - - TVINSERTSTRUCT tv = { 0 }; - wchar_t Item[500]; - tv.item.mask = TVIF_TEXT; - tv.item.pszText = Item; - tv.item.cchTextMax = sizeof(Item) / sizeof(Item[0]); - tv.item.hItem = m_Fonts.GetChildItem(TVI_ROOT); - HTREEITEM hParent = TVI_ROOT; - while (tv.item.hItem) { - m_Fonts.GetItem(&tv.item); - if (wcscmp(FontName.c_str(), Item) == 0) { - hParent = tv.item.hItem; - break; - } - tv.item.hItem = m_Fonts.GetNextSiblingItem(tv.item.hItem); - } - - if (hParent == TVI_ROOT) { - tv.item.mask = TVIF_TEXT; - tv.item.pszText = (LPWSTR)FontName.c_str(); - tv.item.cchTextMax = static_cast(FontName.length()); - tv.hInsertAfter = TVI_SORT; - tv.hParent = TVI_ROOT; - hParent = m_Fonts.InsertItem(&tv); - } - tv.item.mask = TVIF_TEXT; - tv.item.pszText = (LPWSTR)FontFile.c_str(); - tv.item.cchTextMax = static_cast(FontFile.length()); - tv.hInsertAfter = TVI_SORT; - tv.hParent = hParent; - m_Fonts.InsertItem(&tv); - } - if (hCurrentItem != TVI_ROOT) { - m_Fonts.SelectItem(hCurrentItem); - m_Fonts.SetItemState(hCurrentItem, TVIF_STATE | TVIS_SELECTED, TVIF_STATE | TVIS_SELECTED); - m_Fonts.SetFocus(); - } - m_FontsLoaded = true; - SelCurrentFont(); -} - -void COsdTab::SelCurrentFont(void) -{ - std::wstring CurrentFile = ToUTF16(config.font.name.c_str()); - TVINSERTSTRUCT tv = { 0 }; - wchar_t Item[500]; - tv.item.mask = TVIF_TEXT; - tv.item.pszText = Item; - tv.item.cchTextMax = sizeof(Item) / sizeof(Item[0]); - tv.item.hItem = m_Fonts.GetChildItem(TVI_ROOT); - HTREEITEM hCurrentItem = NULL; - while (tv.item.hItem) { - m_Fonts.GetItem(&tv.item); - m_Fonts.SetItemState(tv.item.hItem, 0, TVIF_STATE | TVIS_SELECTED); - HTREEITEM hChild = m_Fonts.GetChildItem(tv.item.hItem); - HTREEITEM NextItem = m_Fonts.GetNextSiblingItem(tv.item.hItem); - if (hChild != NULL) { - tv.item.hItem = hChild; - while (tv.item.hItem) { - m_Fonts.GetItem(&tv.item); - m_Fonts.SetItemState(tv.item.hItem, 0, TVIF_STATE | TVIS_SELECTED); - if (Item == CurrentFile) - hCurrentItem = tv.item.hItem; - tv.item.hItem = m_Fonts.GetNextSiblingItem(tv.item.hItem); - } - } - tv.item.hItem = NextItem; - } - if (hCurrentItem != TVI_ROOT) { - m_Fonts.SelectItem(hCurrentItem); - m_Fonts.SetItemState(hCurrentItem, TVIF_STATE | TVIS_SELECTED, TVIF_STATE | TVIS_SELECTED); - m_Fonts.SetFocus(); - } -} - -void COsdTab::ApplyLanguage(void) -{ - SetDlgItemTextW(IDC_POSITION, wGS(OSD_POSITION).c_str()); - SetDlgItemTextW(IDC_CHK_FPS, wGS(OSD_DISPLAY_FPS).c_str()); - SetDlgItemTextW(IDC_CHK_VIS, wGS(OSD_DISPLAY_VI).c_str()); - SetDlgItemTextW(IDC_CHK_PERCENT, wGS(OSD_DISPLAY_PERCENTAGE).c_str()); - SetDlgItemTextW(IDC_INTERNAL_RESOLUTION, wGS(OSD_DISPLAY_INTERNAL_RESOLUTION).c_str()); - SetDlgItemTextW(IDC_RENDERING_RESOLUTION, wGS(OSD_DISPLAY_RENDERING_RESOLUTION).c_str()); - SetDlgItemTextW(IDC_FONT, wGS(OSD_FONT).c_str()); - SetDlgItemTextW(IDC_TXT_SIZE, wGS(OSD_SIZE).c_str()); - SetDlgItemTextW(IDC_PX, wGS(OSD_PX).c_str()); - SetDlgItemTextW(IDC_COLOR, wGS(OSD_COLOR).c_str()); -} - -LRESULT COsdTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) -{ - LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID); - if (CtrlId == IDC_FONT_SIZE_SPIN) - m_OsdPreview.SetFontSize(m_FontSizeSpin.GetPos()); - return 0; -} - -void COsdTab::ClearOsdChecked() -{ - m_PosTopLeft.SetChecked(false); - m_PosTopLeft.Invalidate(); - m_PosTop.SetChecked(false); - m_PosTop.Invalidate(); - m_PosTopRight.SetChecked(false); - m_PosTopRight.Invalidate(); - m_PosBottomLeft.SetChecked(false); - m_PosBottomLeft.Invalidate(); - m_PosBottom.SetChecked(false); - m_PosBottom.Invalidate(); - m_PosBottomRight.SetChecked(false); - m_PosBottomRight.Invalidate(); -} - -LRESULT COsdTab::OnOsdTopLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - ClearOsdChecked(); - m_PosTopLeft.SetChecked(true); - return 0; -} - -LRESULT COsdTab::OnOsdTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - ClearOsdChecked(); - m_PosTop.SetChecked(true); - return 0; -} - -LRESULT COsdTab::OnOsdTopRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - ClearOsdChecked(); - m_PosTopRight.SetChecked(true); - return 0; -} - -LRESULT COsdTab::OnOsdBottomLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - ClearOsdChecked(); - m_PosBottomLeft.SetChecked(true); - return 0; -} - -LRESULT COsdTab::OnOsdBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - ClearOsdChecked(); - m_PosBottom.SetChecked(true); - return 0; -} - -LRESULT COsdTab::OnOsdBottomRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - ClearOsdChecked(); - m_PosBottomRight.SetChecked(true); - return 0; -} - -LRESULT COsdTab::OnFontItemChanged(NMHDR* /*phdr*/) -{ - m_OsdPreview.SetFont(GetSelectedFont()); - return 0; -} - -LRESULT COsdTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -LRESULT COsdTab::OnNotifyOsdColor(LPNMHDR /*pnmh*/) -{ - m_OsdPreview.SetColor(m_OsdColor.Red(), m_OsdColor.Green(), m_OsdColor.Blue()); - m_OsdPreview.Invalidate(); - return 0; -} - -void COsdTab::LoadSettings(bool /*blockCustomSettings*/) -{ - m_FontSizeTxt.SetWindowText(FormatStrW(L"%d", config.font.size).c_str()); - if (config.font.size > 0) { - m_FontSizeSpin.SetPos(config.font.size); - m_OsdPreview.SetFontSize(config.font.size); - } - if (!(config.font.color[0] == NULL && config.font.color[1] == NULL && config.font.color[2] == NULL)) { - m_OsdColor.SetColor(config.font.color[0], config.font.color[1], config.font.color[2]); - m_OsdPreview.SetColor(config.font.color[0], config.font.color[1], config.font.color[2]); - } - - m_PosTopLeft.SetChecked(config.onScreenDisplay.pos == Config::posTopLeft); - m_PosTop.SetChecked(config.onScreenDisplay.pos == Config::posTopCenter); - m_PosTopRight.SetChecked(config.onScreenDisplay.pos == Config::posTopRight); - m_PosBottomLeft.SetChecked(config.onScreenDisplay.pos == Config::posBottomLeft); - m_PosBottom.SetChecked(config.onScreenDisplay.pos == Config::posBottomCenter); - m_PosBottomRight.SetChecked(config.onScreenDisplay.pos == Config::posBottomRight); - - CButton(GetDlgItem(IDC_CHK_FPS)).SetCheck(config.onScreenDisplay.fps != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_VIS)).SetCheck(config.onScreenDisplay.vis != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_PERCENT)).SetCheck(config.onScreenDisplay.percent != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_INTERNAL_RESOLUTION)).SetCheck(config.onScreenDisplay.internalResolution != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_RENDERING_RESOLUTION)).SetCheck(config.onScreenDisplay.renderingResolution != 0 ? BST_CHECKED : BST_UNCHECKED); - - if (m_FontsLoaded) - SelCurrentFont(); -} - -void COsdTab::SaveSettings() -{ - if (m_PosTopLeft.isChecked()) { config.onScreenDisplay.pos = Config::posTopLeft; } - else if (m_PosTop.isChecked()) { config.onScreenDisplay.pos = Config::posTopCenter; } - else if (m_PosTopRight.isChecked()) { config.onScreenDisplay.pos = Config::posTopRight; } - else if (m_PosBottomLeft.isChecked()) { config.onScreenDisplay.pos = Config::posBottomLeft; } - else if (m_PosBottom.isChecked()) { config.onScreenDisplay.pos = Config::posBottomCenter; } - else if (m_PosBottomRight.isChecked()) { config.onScreenDisplay.pos = Config::posBottomRight; } - - config.onScreenDisplay.fps = CButton(GetDlgItem(IDC_CHK_FPS)).GetCheck() == BST_CHECKED ? 1 : 0; - config.onScreenDisplay.vis = CButton(GetDlgItem(IDC_CHK_VIS)).GetCheck() == BST_CHECKED ? 1 : 0; - config.onScreenDisplay.percent = CButton(GetDlgItem(IDC_CHK_PERCENT)).GetCheck() == BST_CHECKED ? 1 : 0; - config.onScreenDisplay.internalResolution = CButton(GetDlgItem(IDC_INTERNAL_RESOLUTION)).GetCheck() == BST_CHECKED ? 1 : 0; - config.onScreenDisplay.renderingResolution = CButton(GetDlgItem(IDC_RENDERING_RESOLUTION)).GetCheck() == BST_CHECKED ? 1 : 0; - - std::string SelectedFont = FromUTF16(GetSelectedFont().c_str()); - if (!SelectedFont.empty()) - config.font.name = SelectedFont; - if (config.font.name.empty()) - config.font.name = "arial.ttf"; - config.font.size = m_FontSizeSpin.GetPos(); - - config.font.color[0] = m_OsdColor.Red(); - config.font.color[1] = m_OsdColor.Green(); - config.font.color[2] = m_OsdColor.Blue(); - config.font.color[3] = 0; - config.font.colorf[0] = (float)m_OsdColor.Red(); - config.font.colorf[1] = (float)m_OsdColor.Green(); - config.font.colorf[2] = (float)m_OsdColor.Blue(); - config.font.colorf[3] = 0.0f; -} - -std::wstring COsdTab::GetSelectedFont() -{ - if (!m_FontsLoaded) - return ToUTF16(config.font.name.c_str()); - HTREEITEM hItem = m_Fonts.GetSelectedItem(); - if (hItem == NULL) - return L""; - HTREEITEM hChild = m_Fonts.GetChildItem(hItem); - if (hChild != NULL) - hItem = hChild; - - wchar_t ItemText[MAX_PATH]; - if (!m_Fonts.GetItemText(hItem, ItemText, sizeof(ItemText) / sizeof(ItemText[0]))) - return L""; - return std::wstring(ItemText); -} \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/config-osd.h b/GLideN64/src/GLideNUI-wtl/config-osd.h deleted file mode 100644 index c637e00..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-osd.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -#include "config-tab.h" -#include "wtl-OsdButton.h" -#include "wtl-ColorButton.h" -#include "wtl-OsdPreview.h" -#include "resource.h" -#include - -class COsdTab : - public CConfigTab -{ -public: - BEGIN_MSG_MAP(COsdTab) - MSG_WM_INITDIALOG(OnInitDialog) - NOTIFY_HANDLER_EX(IDC_FONTS, TVN_SELCHANGED, OnFontItemChanged) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_VSCROLL, OnScroll) - COMMAND_ID_HANDLER(IDC_OSD_TOP_LEFT, OnOsdTopLeft) - COMMAND_ID_HANDLER(IDC_OSD_TOP, OnOsdTop) - COMMAND_ID_HANDLER(IDC_OSD_TOP_RIGHT, OnOsdTopRight) - COMMAND_ID_HANDLER(IDC_OSD_BOTTOM_LEFT, OnOsdBottomLeft) - COMMAND_ID_HANDLER(IDC_OSD_BOTTOM, OnOsdBottom) - COMMAND_ID_HANDLER(IDC_OSD_BOTTOM_RIGHT, OnOsdBottomRight) - NOTIFY_HANDLER_EX(IDC_OSD_COLOR, CColorButton::CPN_SELCHANGE, OnNotifyOsdColor) - REFLECT_NOTIFICATIONS() - END_MSG_MAP() - - COsdTab(); - - bool m_FontsLoaded; - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); - LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); - void ClearOsdChecked(); - LRESULT OnOsdTopLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnOsdTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnOsdTopRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnOsdBottomLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnOsdBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnOsdBottomRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnFontItemChanged(NMHDR* /*phdr*/); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnNotifyOsdColor(LPNMHDR pnmh); - void ApplyLanguage(void); - void LoadFonts(void); - void SelCurrentFont(void); - void LoadSettings(bool blockCustomSettings); - void SaveSettings(); - -private: - std::wstring GetSelectedFont(); - - COSDButton m_PosTopLeft, m_PosTop, m_PosTopRight; - COSDButton m_PosCenterLeft, m_PosCenter, m_PosCenterRight; - COSDButton m_PosBottomLeft, m_PosBottom, m_PosBottomRight; - CTreeViewCtrl m_Fonts; - CEdit m_FontSizeTxt; - CUpDownCtrl m_FontSizeSpin; - CColorButton m_OsdColor; - COsdPreview m_OsdPreview; -}; diff --git a/GLideN64/src/GLideNUI-wtl/config-overscan.cpp b/GLideN64/src/GLideNUI-wtl/config-overscan.cpp deleted file mode 100644 index a401951..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-overscan.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "config-overscan.h" -#include "util/util.h" -#include "resource.h" - -COverScanTab::COverScanTab() -{ - IDD = IDD_TAB_OVERSCAN; -} - -BOOL COverScanTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) -{ - m_LeftTxt.Attach(GetDlgItem(IDC_OVERSCAN_LEFT_TXT)); - m_LeftSpin.Attach(GetDlgItem(IDC_OVERSCAN_LEFT_SPIN)); - m_LeftSpin.SetBase(10); - m_LeftSpin.SetRange(-99, 99); - m_LeftSpin.SetBuddy(m_LeftTxt); - - m_RightTxt.Attach(GetDlgItem(IDC_OVERSCAN_RIGHT_TXT)); - m_RightSpin.Attach(GetDlgItem(IDC_OVERSCAN_RIGHT_SPIN)); - m_RightSpin.SetBase(10); - m_RightSpin.SetRange(-99, 99); - m_RightSpin.SetBuddy(m_RightTxt); - - m_TopTxt.Attach(GetDlgItem(IDC_OVERSCAN_TOP_TXT)); - m_TopSpin.Attach(GetDlgItem(IDC_OVERSCAN_TOP_SPIN)); - m_TopSpin.SetBase(10); - m_TopSpin.SetRange(-99, 99); - m_TopSpin.SetBuddy(m_TopTxt); - - m_BottomTxt.Attach(GetDlgItem(IDC_OVERSCAN_BOTTOM_TXT)); - m_BottomSpin.Attach(GetDlgItem(IDC_OVERSCAN_BOTTOM_SPIN)); - m_BottomSpin.SetBase(10); - m_BottomSpin.SetRange(-99, 99); - m_BottomSpin.SetBuddy(m_BottomTxt); - return true; -} - -void COverScanTab::SetValue(int32_t Left, int32_t Right, int32_t Top, int32_t Bottom) -{ - m_LeftTxt.SetWindowText(FormatStrW(L"%d", Left).c_str()); - m_LeftSpin.SetPos(Left); - m_RightTxt.SetWindowText(FormatStrW(L"%d", Right).c_str()); - m_RightSpin.SetPos(Right); - m_TopTxt.SetWindowText(FormatStrW(L"%d", Top).c_str()); - m_TopSpin.SetPos(Top); - m_BottomTxt.SetWindowText(FormatStrW(L"%d", Bottom).c_str()); - m_BottomSpin.SetPos(Bottom); -} - -void COverScanTab::GetValue(int32_t & Left, int32_t & Right, int32_t & Top, int32_t & Bottom) -{ - Left = m_LeftSpin.GetPos(); - Right = m_RightSpin.GetPos(); - Top = m_TopSpin.GetPos(); - Bottom = m_BottomSpin.GetPos(); -} - -LRESULT COverScanTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - return (LRESULT)GetStockObject(WHITE_BRUSH); -} diff --git a/GLideN64/src/GLideNUI-wtl/config-overscan.h b/GLideN64/src/GLideNUI-wtl/config-overscan.h deleted file mode 100644 index ccc2d8b..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-overscan.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include -#include "wtl.h" - -class COverScanTab : - public CDialogImpl -{ -public: - uint32_t IDD; - - BEGIN_MSG_MAP(CAboutCreditsTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - END_MSG_MAP() - - COverScanTab(); - BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); - void SetValue(int32_t Left, int32_t Right, int32_t Top, int32_t Bottom); - void GetValue(int32_t & Left, int32_t & Right, int32_t & Top, int32_t & Bottom); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - -private: - CEdit m_LeftTxt, m_RightTxt, m_TopTxt, m_BottomTxt; - CUpDownCtrl m_LeftSpin, m_RightSpin, m_TopSpin, m_BottomSpin; -}; - diff --git a/GLideN64/src/GLideNUI-wtl/config-tab.cpp b/GLideN64/src/GLideNUI-wtl/config-tab.cpp deleted file mode 100644 index 55fb78e..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-tab.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "config-tab.h" - -CConfigTab::CConfigTab(uint32_t _IDD) : - IDD(_IDD) -{ -} - -CConfigTab::~CConfigTab() -{ -} - diff --git a/GLideN64/src/GLideNUI-wtl/config-tab.h b/GLideN64/src/GLideNUI-wtl/config-tab.h deleted file mode 100644 index b97a887..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-tab.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include -#include "wtl.h" - -class CConfigTab : - public CDialogImpl -{ -public: - CConfigTab(uint32_t _IDD); - virtual ~CConfigTab(); - - BEGIN_MSG_MAP(CConfigTab) - END_MSG_MAP() - - virtual void ApplyLanguage() = 0; - virtual void LoadSettings(bool blockCustomSettings) = 0; - virtual void SaveSettings() = 0; - - uint32_t IDD; -}; diff --git a/GLideN64/src/GLideNUI-wtl/config-texture.cpp b/GLideN64/src/GLideNUI-wtl/config-texture.cpp deleted file mode 100644 index 0551c40..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-texture.cpp +++ /dev/null @@ -1,305 +0,0 @@ -#include "config-texture.h" -#include "resource.h" -#include "util/util.h" -#include "../Config.h" -#include "Language.h" -#include - -CTextureEnhancementTab::CTextureEnhancementTab() : - CConfigTab(IDD_TAB_TEXTURE_ENHANCEMENT) -{ -} - -BOOL CTextureEnhancementTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) -{ - TTInit(); - TTSize(400); - - CComboBox filterComboBox(GetDlgItem(IDC_CMB_FILTER)); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_NONE).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH1).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH2).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH3).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH4).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SHARP1).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SHARP2).c_str()); - - CComboBox enhancementComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT)); - enhancementComboBox.AddString(wGS(TEXTURE_ENHANCEMENT_NONE).c_str()); - enhancementComboBox.AddString(wGS(TEXTURE_ENHANCEMENT_STORE).c_str()); - enhancementComboBox.AddString(L"X2"); - enhancementComboBox.AddString(L"X2SAI"); - enhancementComboBox.AddString(L"HQ2X"); - enhancementComboBox.AddString(L"HQ2XS"); - enhancementComboBox.AddString(L"LQ2X"); - enhancementComboBox.AddString(L"LQ2XS"); - enhancementComboBox.AddString(L"HQ4X"); - enhancementComboBox.AddString(L"2xBRZ"); - enhancementComboBox.AddString(L"3xBRZ"); - enhancementComboBox.AddString(L"4xBRZ"); - enhancementComboBox.AddString(L"5xBRZ"); - enhancementComboBox.AddString(L"6xBRZ"); - - m_TextureFilterCacheTxt.Attach(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_EDIT)); - m_TextureFilterCacheSpin.Attach(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_SPIN)); - m_TextureFilterCacheSpin.SetBase(10); - m_TextureFilterCacheSpin.SetRange(0, 20); - m_TextureFilterCacheSpin.SetPos(0); - m_TextureFilterCacheSpin.SetBuddy(m_TextureFilterCacheTxt); - return true; -} - -void CTextureEnhancementTab::ApplyLanguage(void) -{ - SetDlgItemTextW(IDC_TXT_N64_TEXTURE, wGS(TEXTURE_N64_TEXTURES_GROUP).c_str()); - SetDlgItemTextW(IDC_TXT_TEXTURE_FILTER, wGS(TEXTURE_N64_FILTER).c_str()); - SetDlgItemTextW(IDC_TXT_ENHANCEMENT, wGS(TEXTURE_ENHANCEMENT).c_str()); - SetDlgItemTextW(IDC_CHK_DECREASE_COLOR, wGS(TEXTURE_DECREASE_COLOR).c_str()); - SetDlgItemTextW(IDC_CHK_IGNORE_BACKGROUNDS, wGS(TEXTURE_IGNORE_BACKGROUNDS).c_str()); - SetDlgItemTextW(IDC_CHK_ENHANCED_TEX_FILE_STORAGE, wGS(TEXTURE_USE_FILE_STORAGE).c_str()); - SetDlgItemTextW(IDC_TEX_PACK_PATH_STATIC, wGS(TEXTURE_TEXTURE_PACK).c_str()); - SetDlgItemTextW(IDC_TEX_CACHE_PATH_STATIC, wGS(TEXTURE_CACHE_PATH).c_str()); - SetDlgItemTextW(IDC_TEX_DUMP_PATH_STATIC, wGS(TEXTURE_DUMP_PATH).c_str()); - SetDlgItemTextW(IDC_CHK_ALPHA_CHANNEL, wGS(TEXTURE_USE_FULL_TRANSPARENCIES).c_str()); - SetDlgItemTextW(IDC_CHK_ALTERNATIVE_CRC, wGS(TEXTURE_ALTERNATIVE_CRC).c_str()); - SetDlgItemTextW(IDC_CHK_HIRES_TEX_FILESTORAGE, wGS(TEXTURE_USE_FILE_STORAGE).c_str()); - SetDlgItemTextW(IDC_TEXTURE_FILTER_CACHE_STATIC, wGS(TEXTURE_SIZE_OF_MEMORY_CACHE).c_str()); - SetDlgItemTextW(IDC_CHK_SAVE_TEXTURE_CACHE, wGS(TEXTURE_SAVE_ENHANCED).c_str()); - SetDlgItemTextW(IDC_CHK_COMPRESS_CACHE, wGS(TEXTURE_COMPRESS_CACHE).c_str()); - SetDlgItemTextW(IDC_CHK_FORCE_16BPP, wGS(TEXTURE_CONVERT_16BPP).c_str()); - - std::wstring tooltip = wGS(TEXTURE_N64_FILTER_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_TEXTURE_FILTER), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_FILTER), tooltip.c_str()); - tooltip = wGS(TEXTURE_ENHANCEMENT_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_ENHANCEMENT), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_ENHANCEMENT), tooltip.c_str()); - tooltip = wGS(TEXTURE_DECREASE_COLOR_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_DECREASE_COLOR), tooltip.c_str()); - tooltip = wGS(TEXTURE_IGNORE_BACKGROUNDS_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_IGNORE_BACKGROUNDS), tooltip.c_str()); - tooltip = wGS(TEXTURE_TEXTURE_PACK_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TEX_PACK_PATH_STATIC), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_TEX_PACK_PATH_EDIT), tooltip.c_str()); - tooltip = wGS(TEXTURE_USE_FULL_TRANSPARENCIES_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_ALPHA_CHANNEL), tooltip.c_str()); - tooltip = wGS(TEXTURE_ALTERNATIVE_CRC_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC), tooltip.c_str()); - tooltip = wGS(TEXTURE_USE_FILE_STORAGE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE), tooltip.c_str()); - tooltip = wGS(TEXTURE_SIZE_OF_MEMORY_CACHE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_STATIC), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_EDIT), tooltip.c_str()); - tooltip = wGS(TEXTURE_SAVE_ENHANCED_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_SAVE_TEXTURE_CACHE), tooltip.c_str()); - tooltip = wGS(TEXTURE_COMPRESS_CACHE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_COMPRESS_CACHE), tooltip.c_str()); - tooltip = wGS(TEXTURE_CONVERT_16BPP_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_FORCE_16BPP), tooltip.c_str()); - - CComboBox filterComboBox(GetDlgItem(IDC_CMB_FILTER)); - int selectedIndx = filterComboBox.GetCurSel(); - filterComboBox.ResetContent(); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_NONE).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH1).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH2).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH3).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SMOOTH4).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SHARP1).c_str()); - filterComboBox.AddString(wGS(TEXTURE_N64_FILTER_SHARP2).c_str()); - if (selectedIndx >= 0) - filterComboBox.SetCurSel(selectedIndx); - - CComboBox enhancementComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT)); - selectedIndx = enhancementComboBox.GetCurSel(); - enhancementComboBox.ResetContent(); - enhancementComboBox.AddString(wGS(TEXTURE_ENHANCEMENT_NONE).c_str()); - enhancementComboBox.AddString(wGS(TEXTURE_ENHANCEMENT_STORE).c_str()); - enhancementComboBox.AddString(L"X2"); - enhancementComboBox.AddString(L"X2SAI"); - enhancementComboBox.AddString(L"HQ2X"); - enhancementComboBox.AddString(L"HQ2XS"); - enhancementComboBox.AddString(L"LQ2X"); - enhancementComboBox.AddString(L"LQ2XS"); - enhancementComboBox.AddString(L"HQ4X"); - enhancementComboBox.AddString(L"2xBRZ"); - enhancementComboBox.AddString(L"3xBRZ"); - enhancementComboBox.AddString(L"4xBRZ"); - enhancementComboBox.AddString(L"5xBRZ"); - enhancementComboBox.AddString(L"6xBRZ"); - if (selectedIndx >= 0) - enhancementComboBox.SetCurSel(selectedIndx); -} - -LRESULT CTextureEnhancementTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -void CTextureEnhancementTab::OnFileStorage(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - bool UseFileStorage = !CButton(GetDlgItem(IDC_CHK_ENHANCED_TEX_FILE_STORAGE)).GetCheck() == BST_CHECKED; - CButton(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_STATIC)).EnableWindow(UseFileStorage); - CButton(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_EDIT)).EnableWindow(UseFileStorage); - CButton(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_SPIN)).EnableWindow(UseFileStorage); -} - -void CTextureEnhancementTab::OnTexturePack(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - bool UseTextPack = CButton(GetDlgItem(IDC_CHK_TEXTURE_PACK)).GetCheck() == BST_CHECKED; - CButton(GetDlgItem(IDC_TEX_PACK_PATH_STATIC)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_PACK_PATH_EDIT)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_PACK_PATH_BTN)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_CACHE_PATH_STATIC)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_CACHE_PATH_EDIT)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_CACHE_PATH_BTN)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_DUMP_PATH_STATIC)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_DUMP_PATH_EDIT)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_TEX_DUMP_PATH_BTN)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_CHK_ALPHA_CHANNEL)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC)).EnableWindow(UseTextPack); - CButton(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE)).EnableWindow(UseTextPack); -} - -LRESULT CTextureEnhancementTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) -{ - LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID); - if (CtrlId == IDC_TEXTURE_FILTER_CACHE_SPIN) { - int Pos = m_TextureFilterCacheSpin.GetPos(); - m_TextureFilterCacheTxt.SetWindowText(FormatStrW(L"%d MB", Pos == 20 ? 999 : Pos * 50).c_str()); - } - return 0; -} - -void CTextureEnhancementTab::LoadSettings(bool /*blockCustomSettings*/) -{ - CComboBox(GetDlgItem(IDC_CMB_FILTER)).SetCurSel(config.textureFilter.txFilterMode); - CComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT)).SetCurSel(config.textureFilter.txEnhancementMode); - CButton(GetDlgItem(IDC_CHK_DEPOSTERIZE)).SetCheck(config.textureFilter.txDeposterize != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_IGNORE_BACKGROUNDS)).SetCheck(config.textureFilter.txFilterIgnoreBG != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_ENHANCED_TEX_FILE_STORAGE)).SetCheck(config.textureFilter.txEnhancedTextureFileStorage != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_TEXTURE_PACK)).SetCheck(config.textureFilter.txHiresEnable != 0 ? BST_CHECKED : BST_UNCHECKED); - - GetDlgItem(IDC_TEX_PACK_PATH_EDIT).SetWindowText(config.textureFilter.txPath); - GetDlgItem(IDC_TEX_CACHE_PATH_EDIT).SetWindowText(config.textureFilter.txCachePath); - GetDlgItem(IDC_TEX_DUMP_PATH_EDIT).SetWindowText(config.textureFilter.txDumpPath); - - CButton(GetDlgItem(IDC_CHK_ALPHA_CHANNEL)).SetCheck(config.textureFilter.txHiresFullAlphaChannel != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC)).SetCheck(config.textureFilter.txHresAltCRC != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE)).SetCheck(config.textureFilter.txHiresTextureFileStorage != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_SAVE_TEXTURE_CACHE)).SetCheck(config.textureFilter.txSaveCache != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_COMPRESS_CACHE)).SetCheck(config.textureFilter.txCacheCompression != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_FORCE_16BPP)).SetCheck(config.textureFilter.txForce16bpp != 0 ? BST_CHECKED : BST_UNCHECKED); - - m_TextureFilterCacheSpin.SetPos((config.textureFilter.txCacheSize / gc_uMegabyte) / 50); - - OnFileStorage(0, 0, NULL); - OnTexturePack(0, 0, NULL); - BOOL bHandled; - OnScroll(0, 0, (LPARAM)(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_SPIN).Detach()), bHandled); -} - -void CTextureEnhancementTab::SaveDirectory(int EditCtrl, wchar_t * txPath) -{ - CWindow EditWnd = GetDlgItem(EditCtrl); - int TxtLen = EditWnd.GetWindowTextLength(); - std::wstring Path; - Path.resize(TxtLen + 1); - EditWnd.GetWindowTextW((wchar_t *)Path.data(), static_cast(Path.size())); - - bool exists = osal_path_existsW(Path.data()); - - if (!exists) { - if (osal_mkdirp(Path.data()) != 0) { - switch (EditCtrl) { - case IDC_TEX_PACK_PATH_EDIT: - MessageBox(L"Failed to create the texture pack folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING); - return; - case IDC_TEX_CACHE_PATH_EDIT: - MessageBox(L"Failed to create the texture pack cache folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING); - return; - case IDC_TEX_DUMP_PATH_EDIT: - MessageBox(L"Failed to create the texture dump folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING); - return; - default: - return; - } - } - } - wcscpy(txPath, Path.c_str()); -} - -void CTextureEnhancementTab::SaveSettings() -{ - config.textureFilter.txFilterMode = CComboBox(GetDlgItem(IDC_CMB_FILTER)).GetCurSel(); - config.textureFilter.txEnhancementMode = CComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT)).GetCurSel(); - config.textureFilter.txDeposterize = CButton(GetDlgItem(IDC_CHK_DEPOSTERIZE)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txFilterIgnoreBG = CButton(GetDlgItem(IDC_CHK_IGNORE_BACKGROUNDS)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txEnhancedTextureFileStorage = CButton(GetDlgItem(IDC_CHK_ENHANCED_TEX_FILE_STORAGE)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txHiresEnable = CButton(GetDlgItem(IDC_CHK_TEXTURE_PACK)).GetCheck() == BST_CHECKED ? 1 : 0; - - SaveDirectory(IDC_TEX_PACK_PATH_EDIT, config.textureFilter.txPath); - SaveDirectory(IDC_TEX_CACHE_PATH_EDIT, config.textureFilter.txCachePath); - SaveDirectory(IDC_TEX_DUMP_PATH_EDIT, config.textureFilter.txDumpPath); - - config.textureFilter.txHiresFullAlphaChannel = CButton(GetDlgItem(IDC_CHK_ALPHA_CHANNEL)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txHresAltCRC = CButton(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txHiresTextureFileStorage = CButton(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txCacheSize = m_TextureFilterCacheSpin.GetPos() * gc_uMegabyte * 50; - config.textureFilter.txSaveCache = CButton(GetDlgItem(IDC_CHK_SAVE_TEXTURE_CACHE)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txCacheCompression = CButton(GetDlgItem(IDC_CHK_COMPRESS_CACHE)).GetCheck() == BST_CHECKED ? 1 : 0; - config.textureFilter.txForce16bpp = CButton(GetDlgItem(IDC_CHK_FORCE_16BPP)).GetCheck() == BST_CHECKED ? 1 : 0; -} - -void CTextureEnhancementTab::OnSelectTexPackPath(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - SelectDir(L"Select directory for texture pack path", IDC_TEX_PACK_PATH_EDIT); -} - -void CTextureEnhancementTab::OnSelectTexCachePath(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - SelectDir(L"Select directory for texture cache path", IDC_TEX_CACHE_PATH_EDIT); -} - -void CTextureEnhancementTab::OnSelectTexDumpPath(UINT /*Code*/, int /*id*/, HWND /*ctl*/) -{ - SelectDir(L"Select directory for texture dump path", IDC_TEX_DUMP_PATH_EDIT); -} - -void CTextureEnhancementTab::SelectDir(wchar_t * Title, int EditCtrl) -{ - wchar_t Buffer[MAX_PATH], Directory[MAX_PATH]; - LPITEMIDLIST pidl; - BROWSEINFOW bi; - - CWindow EditWnd = GetDlgItem(EditCtrl); - int TxtLen = EditWnd.GetWindowTextLength(); - std::wstring EditText; - EditText.resize(TxtLen + 1); - EditWnd.GetWindowText((wchar_t *)EditText.data(), static_cast(EditText.size())); - - bi.hwndOwner = m_hWnd; - bi.pidlRoot = NULL; - bi.pszDisplayName = Buffer; - bi.lpszTitle = Title; - bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; - bi.lpfn = (BFFCALLBACK)SelectDirCallBack; - bi.lParam = (DWORD)EditText.c_str(); - if ((pidl = SHBrowseForFolderW(&bi)) != NULL && SHGetPathFromIDListW(pidl, Directory)) - EditWnd.SetWindowText(Directory); -} - -int CALLBACK CTextureEnhancementTab::SelectDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t /*lp*/, uint32_t lpData) -{ - switch (uMsg) - { - case BFFM_INITIALIZED: - // WParam is TRUE since you are passing a path. - // It would be FALSE if you were passing a pidl. - if (lpData) - SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData); - break; - } - return 0; -} - diff --git a/GLideN64/src/GLideNUI-wtl/config-texture.h b/GLideN64/src/GLideNUI-wtl/config-texture.h deleted file mode 100644 index 34799d2..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-texture.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once -#include "config-tab.h" -#include "wtl-tooltip.h" -#include "resource.h" -#include "../osal/osal_files.h" - -class CTextureEnhancementTab : - public CConfigTab, - public CToolTipDialog -{ -public: - BEGIN_MSG_MAP(CTextureEnhancementTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - COMMAND_HANDLER_EX(IDC_CHK_ENHANCED_TEX_FILE_STORAGE, BN_CLICKED, OnFileStorage) - COMMAND_HANDLER_EX(IDC_CHK_TEXTURE_PACK, BN_CLICKED, OnTexturePack) - COMMAND_ID_HANDLER_EX(IDC_TEX_PACK_PATH_BTN, OnSelectTexPackPath) - COMMAND_ID_HANDLER_EX(IDC_TEX_CACHE_PATH_BTN, OnSelectTexCachePath) - COMMAND_ID_HANDLER_EX(IDC_TEX_DUMP_PATH_BTN, OnSelectTexDumpPath) - MESSAGE_HANDLER(WM_VSCROLL, OnScroll) - CHAIN_MSG_MAP(CToolTipDialog) - END_MSG_MAP() - - CTextureEnhancementTab(); - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); - void OnFileStorage(UINT /*Code*/, int id, HWND /*ctl*/); - void OnTexturePack(UINT /*Code*/, int id, HWND /*ctl*/); - void ApplyLanguage(void); - void LoadSettings(bool blockCustomSettings); - void SaveSettings(); - -private: - static int CALLBACK SelectDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t lp, uint32_t lpData); - - void SaveDirectory(int EditCtrl, wchar_t * txPath); - void SelectDir(wchar_t * Title, int EditCtrl); - void OnSelectTexPackPath(UINT Code, int id, HWND ctl); - void OnSelectTexCachePath(UINT Code, int id, HWND ctl); - void OnSelectTexDumpPath(UINT Code, int id, HWND ctl); - - CEdit m_TextureFilterCacheTxt; - CUpDownCtrl m_TextureFilterCacheSpin; -}; - diff --git a/GLideN64/src/GLideNUI-wtl/config-video.cpp b/GLideN64/src/GLideNUI-wtl/config-video.cpp deleted file mode 100644 index efcc30d..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-video.cpp +++ /dev/null @@ -1,557 +0,0 @@ -#include "config-video.h" -#include "FullscreenResolutions.h" -#include "util/util.h" -#include "Language.h" -#include "ConfigDlg.h" -#include "../Config.h" -#include "wtl-tooltip.h" - -static struct { - unsigned short width, height; - LPCTSTR description; -} -WindowedModes[] = { - { 320, 240, _T("320 x 240") }, - { 400, 300, _T("400 x 300") }, - { 480, 360, _T("480 x 360") }, - { 640, 480, _T("640 x 480") }, - { 800, 600, _T("800 x 600") }, - { 960, 720, _T("960 x 720") }, - { 1024, 768, _T("1024 x 768") }, - { 1152, 864, _T("1152 x 864") }, - { 1280, 960, _T("1280 x 960") }, - { 1280, 1024, _T("1280 x 1024") }, - { 1440, 1080, _T("1440 x 1080") }, - { 1600, 1024, _T("1600 x 1024") }, - { 1600, 1200, _T("1600 x 1200") } -}; -static const unsigned int numWindowedModes = sizeof(WindowedModes) / sizeof(WindowedModes[0]); - -static u32 pow2(u32 dim) -{ - if (dim == 0) return 0; - - return (1 << dim); -} - -static u32 powof(u32 dim) -{ - if (dim == 0) return 0; - - u32 num = 2; u32 i = 1; - while (num < dim) { - num <<= 1; - i++; - } - return i; -} - -CVideoTab::CVideoTab(CConfigDlg & Dlg, CFrameBufferTab & FrameBufferTab, const char * strIniPath) : - CConfigTab(IDD_TAB_VIDEO), - m_strIniPath(strIniPath), - m_LangList(GetLanguageList(strIniPath)), - m_Dlg(Dlg), - m_FrameBufferTab(FrameBufferTab) -{ - m_AAInfoWarning = false; -} - -CVideoTab::~CVideoTab() { - for (size_t i = 0; i < m_OverscanTabs.size(); i++) - delete m_OverscanTabs[i]; - m_OverscanTabs.clear(); -} - -BOOL CVideoTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) { - TTInit(); - TTSize(400); - - m_OverScanTab.Attach(GetDlgItem(IDC_TAB_OVERSCAN)); - AddOverScanTab(VIDEO_NTSC); - AddOverScanTab(VIDEO_PAL); - - m_AliasingSlider.Attach(GetDlgItem(IDC_ALIASING_SLIDER)); - m_AliasingSlider.SetTicFreq(1); - m_AliasingSlider.SetRangeMin(0); - m_AliasingSlider.SetRangeMax(3); - - m_AnisotropicSlider.Attach(GetDlgItem(IDC_ANISOTROPIC_SLIDER)); - m_AnisotropicSlider.SetTicFreq(2); - m_AnisotropicSlider.SetRangeMin(0); - m_AnisotropicSlider.SetRangeMax(16); - - CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO)); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_4_3).c_str()); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_16_19).c_str()); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_STRETCH).c_str()); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_ADJUST).c_str()); - - CComboBox ditheringModeComboBox(GetDlgItem(IDC_CMB_PATTERN)); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_DISABLE).c_str()); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BAYER).c_str()); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_MAGIC_SQUARE).c_str()); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BLUE_NOISE).c_str()); - - SIZE iconSz = { ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON) }; - m_AAInfoIcon.SubclassWindow(GetDlgItem(IDC_AA_INFO_ICON)); - m_AAInfoIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_INFO), iconSz.cx, iconSz.cy); - m_AAInfoIcon.SetWindowPos(HWND_TOP, 0, 0, iconSz.cx, iconSz.cy, SWP_NOMOVE | SWP_NOZORDER); - m_AAInfoIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH)); - - CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE)); - translationsComboBox.SetItemData(translationsComboBox.AddString((LPCTSTR)_T("English")), (DWORD_PTR)""); - for (LanguageList::const_iterator itr = m_LangList.begin(); itr != m_LangList.end(); itr++) { - int indx = translationsComboBox.AddString(ToUTF16(itr->LanguageName.c_str()).c_str()); - translationsComboBox.SetItemData(indx, (DWORD_PTR)itr->Filename.c_str()); - } - return true; -} - -void CVideoTab::ApplyLanguage(void) { - SetDlgItemTextW(IDC_VIDEO_GROUP, wGS(VIDEO_GROUP).c_str()); - SetDlgItemTextW(IDC_TXT_FULL_SCREEN_RES, wGS(VIDEO_FULL_SCREEN_RES).c_str()); - SetDlgItemTextW(IDC_TXT_REFRESH_RATE, wGS(VIDEO_REFRESH_RATE).c_str()); - SetDlgItemTextW(IDC_TXT_WINDOWED_RESOLUTION, wGS(VIDEO_WINDOWED_RESOLUTION).c_str()); - SetDlgItemTextW(IDC_TXT_ASPECT_RATIO, wGS(VIDEO_ASPECT_RATIO).c_str()); - SetDlgItemTextW(IDC_CHK_VERTICAL_SYNC, wGS(VIDEO_VSYNC).c_str()); - SetDlgItemTextW(IDC_CHK_THREADED_VIDEO, wGS(VIDEO_THREADED_VIDEO).c_str()); - SetDlgItemTextW(IDC_CHK_OVERSCAN, wGS(VIDEO_OVERSCAN).c_str()); - SetDlgItemTextW(IDC_AA_GROUP, wGS(VIDEO_ANTI_ALIASING).c_str()); - SetDlgItemTextW(IDC_NOAA_RADIO, wGS(VIDEO_NO_ANTI_ALIASING).c_str()); - SetDlgItemTextW(IDC_FXAA_RADIO, wGS(VIDEO_FAST_ANTI_ALIASING).c_str()); - SetDlgItemTextW(IDC_MSAA_RADIO, wGS(VIDEO_MULTISAMPLE_ANTI_ALIASING).c_str()); - SetDlgItemTextW(IDC_AA_OFF, wGS(VIDEO_AA_OFF).c_str()); - SetDlgItemTextW(IDC_AA_HIGH, wGS(VIDEO_AA_HIGH).c_str()); - SetDlgItemTextW(IDC_AA_INFO, wGS(VIDEO_AA_INFO).c_str()); - SetDlgItemTextW(IDC_FILTERING_GROUP, wGS(VIDEO_FILTERING_GROUP).c_str()); - SetDlgItemTextW(IDC_ANISOTROPIC, wGS(VIDEO_ANISOTROPIC).c_str()); - SetDlgItemTextW(IDC_ANISOTROPIC_OFF, wGS(VIDEO_ANISOTROPIC_OFF).c_str()); - SetDlgItemTextW(IDC_ANISOTROPIC_HIGH, wGS(VIDEO_ANISOTROPIC_HIGH).c_str()); - SetDlgItemTextW(IDC_BILINEAR, wGS(VIDEO_BILINEAR).c_str()); - SetDlgItemTextW(IDC_BILINEAR_STANDARD, wGS(VIDEO_BILINEAR_STANDARD).c_str()); - SetDlgItemTextW(IDC_BILINEAR_3POINT, wGS(VIDEO_BILINEAR_3POINT).c_str()); - - SetDlgItemTextW(IDC_DITHERING_GROUP, wGS(VIDEO_DITHERING_GROUP).c_str()); - SetDlgItemTextW(IDC_PATTERN, wGS(VIDEO_PATTERN).c_str()); - SetDlgItemTextW(IDC_CHK_APPLY_TO_OUTPUT, wGS(VIDEO_DITHERING_APPLY_TO_OUTPUT).c_str()); - SetDlgItemTextW(IDC_CHK_5BIT_QUANTIZATION, wGS(VIDEO_DITHERING_5BIT_QUANTIZATION).c_str()); - SetDlgItemTextW(IDC_CHK_HIRES_NOISE, wGS(VIDEO_DITHERING_HIRES_NOISE).c_str()); - SetDlgItemTextW(IDC_LANGUAGE, wGS(VIDEO_LANGUAGE).c_str()); - - std::wstring tooltip = wGS(VIDEO_FULL_SCREEN_RES_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_FULL_SCREEN_RES), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_FULL_SCREEN_RES), tooltip.c_str()); - tooltip = wGS(VIDEO_REFRESH_RATE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_REFRESH_RATE), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_REFRESH_RATE), tooltip.c_str()); - tooltip = wGS(VIDEO_WINDOWED_RESOLUTION_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_WINDOWED_RESOLUTION), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION), tooltip.c_str()); - tooltip = wGS(VIDEO_ASPECT_RATIO_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_TXT_ASPECT_RATIO), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_CMB_ASPECT_RATIO), tooltip.c_str()); - tooltip = wGS(VIDEO_VSYNC_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_VERTICAL_SYNC), tooltip.c_str()); - tooltip = wGS(VIDEO_THREADED_VIDEO_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_THREADED_VIDEO), tooltip.c_str()); - tooltip = wGS(VIDEO_OVERSCAN_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_OVERSCAN), tooltip.c_str()); - tooltip = wGS(VIDEO_AA_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_AA_GROUP), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_NOAA_RADIO), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_FXAA_RADIO), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_MSAA_RADIO), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_ALIASING_SLIDER), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_AA_OFF), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_AA_HIGH), tooltip.c_str()); - tooltip = wGS(VIDEO_BILINEAR_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_BILINEAR), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_BILINEAR_STANDARD), tooltip.c_str()); - TTSetTxt(GetDlgItem(IDC_BILINEAR_3POINT), tooltip.c_str()); - tooltip = wGS(VIDEO_DITHERING_APPLY_TO_OUTPUT_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_APPLY_TO_OUTPUT), tooltip.c_str()); - tooltip = wGS(VIDEO_DITHERING_5BIT_QUANTIZATION_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_5BIT_QUANTIZATION), tooltip.c_str()); - tooltip = wGS(VIDEO_DITHERING_HIRES_NOISE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CHK_HIRES_NOISE), tooltip.c_str()); - tooltip = wGS(VIDEO_DITHERING_MODE_TOOLTIP); - TTSetTxt(GetDlgItem(IDC_CMB_PATTERN), tooltip.c_str()); - - CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO)); - int selectedIndx = aspectComboBox.GetCurSel(); - aspectComboBox.ResetContent(); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_4_3).c_str()); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_16_19).c_str()); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_STRETCH).c_str()); - aspectComboBox.AddString(wGS(VIDEO_ASPECT_ADJUST).c_str()); - if (selectedIndx >= 0) - aspectComboBox.SetCurSel(selectedIndx); - - CComboBox ditheringModeComboBox(GetDlgItem(IDC_CMB_PATTERN)); - selectedIndx = ditheringModeComboBox.GetCurSel(); - ditheringModeComboBox.ResetContent(); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_DISABLE).c_str()); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BAYER).c_str()); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_MAGIC_SQUARE).c_str()); - ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BLUE_NOISE).c_str()); - if (selectedIndx >= 0) - ditheringModeComboBox.SetCurSel(selectedIndx); - - for (int i = 0, n = m_OverScanTab.GetItemCount(); i < n; i++) { - TCITEM tci = { 0 }; - tci.mask = TCIF_PARAM; - m_OverScanTab.GetItem(i, &tci); - if (tci.lParam != 0) { - tci.mask = TCIF_TEXT; - std::wstring caption = wGS((languageStringID)tci.lParam); - tci.pszText = (LPWSTR)caption.c_str(); - m_OverScanTab.SetItem(i, &tci); - } - } - -} - -LRESULT CVideoTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { - LONG SliderId = CWindow((HWND)lParam).GetWindowLong(GWL_ID); - if (SliderId == IDC_ALIASING_SLIDER) { - int32_t multisampling = m_AliasingSlider.GetPos(); - std::wstring AliasingText = FormatStrW(L"%dx", pow2(multisampling)); - CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str()); - CButton(GetDlgItem(multisampling != 0 ? IDC_MSAA_RADIO : IDC_NOAA_RADIO)).SetCheck(BST_CHECKED); - CButton(GetDlgItem(multisampling != 0 ? IDC_NOAA_RADIO : IDC_MSAA_RADIO)).SetCheck(BST_UNCHECKED); - CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(BST_UNCHECKED); - } else if (SliderId == IDC_ANISOTROPIC_SLIDER) { - CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str()); - } - return 0; -} - -void CVideoTab::OnOverscan(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { - CButton OverScan(GetDlgItem(IDC_CHK_OVERSCAN)); - if (OverScan.GetCheck() == BST_CHECKED) { - GetDlgItem(IDC_TAB_OVERSCAN).ShowWindow(SW_SHOW); - ShowOverScanTab(m_OverScanTab.GetCurSel()); - } else { - GetDlgItem(IDC_TAB_OVERSCAN).ShowWindow(SW_HIDE); - m_OverscanTabs[m_OverScanTab.GetCurSel()]->ShowWindow(SW_HIDE); - } -} - -LRESULT CVideoTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - return (LRESULT)GetStockObject(WHITE_BRUSH); -} - -LRESULT CVideoTab::OnOverscanTabChange(NMHDR* /*pNMHDR*/) { - ShowOverScanTab(m_OverScanTab.GetCurSel()); - return FALSE; -} - -void CVideoTab::OnFullScreenChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { - CComboBox fullScreenResolutionComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES)); - int32_t index = fullScreenResolutionComboBox.GetCurSel(); - StringList fullscreenRatesList; - int fullscreenRate; - fillFullscreenRefreshRateList(index, fullscreenRatesList, fullscreenRate); - - CComboBox RefreshRateComboBox(GetDlgItem(IDC_CMB_REFRESH_RATE)); - RefreshRateComboBox.ResetContent(); - for (size_t i = 0, n = fullscreenRatesList.size(); i < n; i++) { - std::wstring fullscreenRateStr(fullscreenRatesList[i].begin(), fullscreenRatesList[i].end()); - int index = RefreshRateComboBox.AddString(fullscreenRateStr.c_str()); - if (fullscreenRate == i) - RefreshRateComboBox.SetCurSel(index); - } -} - -LRESULT CVideoTab::OnLanguageChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/) { - CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE)); - std::string currentLang = (const char *)translationsComboBox.GetItemDataPtr(translationsComboBox.GetCurSel()); - m_Dlg.SetLanguage(currentLang); - return 0; -} - -void CVideoTab::HideMSAADepthWarning(bool hide) -{ - int nID[] = { - IDC_AA_INFO, - IDC_AA_INFO_ICON, - IDC_FILTERING_GROUP, - IDC_ANISOTROPIC, - IDC_ANISOTROPIC_OFF, - IDC_ANISOTROPIC_HIGH, - IDC_ANISOTROPIC_SLIDER, - IDC_ANISOTROPIC_LABEL, - IDC_BILINEAR, - IDC_BILINEAR_STANDARD, - IDC_BILINEAR_3POINT, - IDC_DITHERING_GROUP, - IDC_PATTERN, - IDC_CMB_PATTERN, - IDC_CHK_APPLY_TO_OUTPUT, - IDC_CHK_5BIT_QUANTIZATION, - IDC_CHK_HIRES_NOISE - }; - - RECT Rect; RECT groupRect; - GetDlgItem(nID[0]).GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - int32_t Move = Rect.bottom - Rect.top + 2; - - GetDlgItem(nID[0]).ShowWindow(hide ? SW_HIDE : SW_SHOWNORMAL); - GetDlgItem(nID[1]).ShowWindow(hide ? SW_HIDE : SW_SHOWNORMAL); - - CWindow AAgroup = GetDlgItem(IDC_AA_GROUP); - AAgroup.GetWindowRect(&groupRect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&groupRect, 2); - SIZE AAgroupSz = { groupRect.right - groupRect.left, hide ? groupRect.bottom - groupRect.top - Move - 1 : groupRect.bottom - groupRect.top + Move + 1 }; - AAgroup.SetWindowPos(HWND_TOP, 0, 0, AAgroupSz.cx, AAgroupSz.cy, SWP_NOMOVE | SWP_NOZORDER); - - for (size_t i = 2, n = sizeof(nID) / sizeof(nID[0]); i < n; i++) { - CWindow window = GetDlgItem(nID[i]); - window.GetWindowRect(&Rect); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2); - - Rect.top -= hide ? Move : -Move; - Rect.bottom -= hide ? Move : -Move; - window.MoveWindow(&Rect); - } - - m_AAInfoWarning = hide; -} - -void CVideoTab::DisallowMSAA(bool disallow) -{ - GetDlgItem(IDC_MSAA_RADIO).EnableWindow(!disallow); - GetDlgItem(IDC_ALIASING_SLIDER).EnableWindow(!disallow); - GetDlgItem(IDC_ALIASING_LABEL).EnableWindow(!disallow); - GetDlgItem(IDC_AA_HIGH).EnableWindow(!disallow); - GetDlgItem(IDC_AA_OFF).EnableWindow(!disallow); -} - - -void CVideoTab::AddOverScanTab(languageStringID caption) { - m_OverScanTab.AddItem(TCIF_TEXT | TCIF_PARAM, wGS(caption).c_str(), 0, caption); - - COverScanTab * tab = new COverScanTab; - tab->Create(m_hWnd, 0); - tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW); - m_OverscanTabs.push_back(tab); - - if (m_OverscanTabs.size() == 1) - ShowOverScanTab(0); -} - -void CVideoTab::ShowOverScanTab(int nTab) { - for (size_t i = 0; i < m_OverscanTabs.size(); i++) - m_OverscanTabs[i]->ShowWindow(SW_HIDE); - - CRect TabRect; - m_OverScanTab.GetWindowRect(&TabRect); - ScreenToClient(&TabRect); - m_OverScanTab.AdjustRect(FALSE, &TabRect); - - m_OverscanTabs[nTab]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW); - - CRect WinRect, ClientRect; - m_OverscanTabs[nTab]->GetWindowRect(WinRect); - m_OverscanTabs[nTab]->GetClientRect(ClientRect); - - m_OverScanTab.RedrawWindow(); -} - -void CVideoTab::LoadSettings(bool /*blockCustomSettings*/) { - CComboBox WindowedResolutionComboBox(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION)); - if (WindowedResolutionComboBox.GetCount() == 0) { - for (unsigned int i = 0; i < numWindowedModes; ++i) { - int index = WindowedResolutionComboBox.AddString(WindowedModes[i].description); - WindowedResolutionComboBox.SetItemData(index, i); - if (WindowedModes[i].width == config.video.windowedWidth && WindowedModes[i].height == config.video.windowedHeight) - WindowedResolutionComboBox.SetCurSel(index); - } - if (WindowedResolutionComboBox.GetCount() > 0 && WindowedResolutionComboBox.GetCurSel() < 0) { - WindowedResolutionComboBox.AddString(FormatStrW(L"%d x %d", config.video.windowedWidth, config.video.windowedHeight).c_str()); - WindowedResolutionComboBox.SetCurSel(numWindowedModes); - } - } - - CButton overscanCheckBox(GetDlgItem(IDC_CHK_OVERSCAN)); - overscanCheckBox.SetCheck(config.frameBufferEmulation.enableOverscan != 0 ? BST_CHECKED : BST_UNCHECKED); - OnOverscan(0, 0, NULL); - - m_OverscanTabs[0]->SetValue( - config.frameBufferEmulation.overscanNTSC.left, - config.frameBufferEmulation.overscanNTSC.right, - config.frameBufferEmulation.overscanNTSC.top, - config.frameBufferEmulation.overscanNTSC.bottom - ); - - m_OverscanTabs[1]->SetValue( - config.frameBufferEmulation.overscanPAL.left, - config.frameBufferEmulation.overscanPAL.right, - config.frameBufferEmulation.overscanPAL.top, - config.frameBufferEmulation.overscanPAL.bottom - ); - - StringList fullscreenModesList, fullscreenRatesList; - int fullscreenMode, fullscreenRate; - fillFullscreenResolutionsList(fullscreenModesList, fullscreenMode, fullscreenRatesList, fullscreenRate); - - CComboBox fullScreenResolutionComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES)); - fullScreenResolutionComboBox.ResetContent(); - for (size_t i = 0, n = fullscreenModesList.size(); i < n; i++) { - std::wstring fullscreenModeStr(fullscreenModesList[i].begin(), fullscreenModesList[i].end()); - int index = fullScreenResolutionComboBox.AddString(fullscreenModeStr.c_str()); - if (fullscreenMode == i) - fullScreenResolutionComboBox.SetCurSel(index); - } - CComboBox RefreshRateComboBox(GetDlgItem(IDC_CMB_REFRESH_RATE)); - RefreshRateComboBox.ResetContent(); - for (size_t i = 0, n = fullscreenRatesList.size(); i < n; i++) { - std::wstring fullscreenRateStr(fullscreenRatesList[i].begin(), fullscreenRatesList[i].end()); - int index = RefreshRateComboBox.AddString(fullscreenRateStr.c_str()); - if (fullscreenRate == i) - RefreshRateComboBox.SetCurSel(index); - } - - u32 maxMSAALevel = m_Dlg.getMSAALevel(); - if (maxMSAALevel == 0 && config.video.maxMultiSampling == 0) { - // default value - maxMSAALevel = 8; - } else if (maxMSAALevel == 0 && config.video.maxMultiSampling != 0) { - // use cached value - maxMSAALevel = config.video.maxMultiSampling; - } else { - // assign cached value - config.video.maxMultiSampling = maxMSAALevel; - } - const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0 - ? min(config.video.multisampling, maxMSAALevel) - : maxMSAALevel; - m_AliasingSlider.SetRangeMax(powof(maxMSAALevel)); - m_AliasingSlider.SetPos(powof(multisampling)); - std::wstring AliasingText = FormatStrW(L"%dx", multisampling); - CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str()); - - if (config.frameBufferEmulation.N64DepthCompare == 0) { - if (!m_AAInfoWarning) { - HideMSAADepthWarning(true); - RedrawWindow(); - } - DisallowMSAA(false); - } else { - if (m_AAInfoWarning) { - HideMSAADepthWarning(false); - RedrawWindow(); - } - DisallowMSAA(true); - } - - CButton(GetDlgItem(IDC_NOAA_RADIO)).SetCheck(config.video.multisampling == 0 && config.video.fxaa == 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(config.video.fxaa != 0 && config.video.multisampling == 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_MSAA_RADIO)).SetCheck(config.video.fxaa == 0 && config.video.multisampling != 0 ? BST_CHECKED : BST_UNCHECKED); - m_AnisotropicSlider.SetPos(config.texture.maxAnisotropy); - CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str()); - - CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).SetCheck(config.video.verticalSync != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_THREADED_VIDEO)).SetCheck(config.video.threadedVideo != 0 ? BST_CHECKED : BST_UNCHECKED); - - CButton(GetDlgItem(IDC_BILINEAR_3POINT)).SetCheck(config.texture.bilinearMode == BILINEAR_3POINT ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_BILINEAR_STANDARD)).SetCheck(config.texture.bilinearMode == BILINEAR_STANDARD ? BST_CHECKED : BST_UNCHECKED); - - CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO)); - switch (config.frameBufferEmulation.aspect) { - case Config::aStretch: aspectComboBox.SetCurSel(2); break; - case Config::a43: aspectComboBox.SetCurSel(0); break; - case Config::a169: aspectComboBox.SetCurSel(1); break; - case Config::aAdjust: aspectComboBox.SetCurSel(3); break; - } - - CComboBox(GetDlgItem(IDC_CMB_PATTERN)).SetCurSel(config.generalEmulation.rdramImageDitheringMode); - CButton(GetDlgItem(IDC_CHK_APPLY_TO_OUTPUT)).SetCheck(config.generalEmulation.enableDitheringPattern != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_5BIT_QUANTIZATION)).SetCheck(config.generalEmulation.enableDitheringQuantization != 0 ? BST_CHECKED : BST_UNCHECKED); - CButton(GetDlgItem(IDC_CHK_HIRES_NOISE)).SetCheck(config.generalEmulation.enableHiresNoiseDithering != 0 ? BST_CHECKED : BST_UNCHECKED); - - CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE)); - translationsComboBox.SetCurSel(-1); - for (int i = 0, n = translationsComboBox.GetCount(); i < n; i++) { - const char * translations = (const char *)translationsComboBox.GetItemDataPtr(i); - - if (config.translationFile == translations) { - translationsComboBox.SetCurSel(i); - break; - } - } - if (translationsComboBox.GetCurSel() < 0) - translationsComboBox.SetCurSel(translationsComboBox.FindString(-1, (LPCTSTR)_T("English"))); -} - -void CVideoTab::SaveSettings() -{ - getFullscreenResolutions(CComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES)).GetCurSel(), config.video.fullscreenWidth, config.video.fullscreenHeight); - getFullscreenRefreshRate(CComboBox(GetDlgItem(IDC_CMB_REFRESH_RATE)).GetCurSel(), config.video.fullscreenRefresh); - - CComboBox WindowResCB(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION)); - CString WindowResStr; - WindowResCB.GetWindowText(WindowResStr); - std::string resolution(CW2A(WindowResStr.GetString())); - std::regex parseRes("(\\d+) ?x ?(\\d+)"); - std::smatch tokens; - if (std::regex_search(resolution, tokens, parseRes) && tokens.size() > 1) { - // matches w x h where w is 300-7999 and h is 200-3999 - if (range<300, 8000>::contains(std::stoi(tokens[1])) && range<200, 4000>::contains(std::stoi(tokens[2]))) { - config.video.windowedWidth = std::stoi(tokens[1]); - config.video.windowedHeight = std::stoi(tokens[2]); - } - } - - int AspectIndx = CComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO)).GetCurSel(); - if (AspectIndx == 2) { config.frameBufferEmulation.aspect = Config::aStretch; } - else if (AspectIndx == 0) { config.frameBufferEmulation.aspect = Config::a43; } - else if (AspectIndx == 1) { config.frameBufferEmulation.aspect = Config::a169; } - else if (AspectIndx == 3) { config.frameBufferEmulation.aspect = Config::aAdjust; } - - config.video.verticalSync = CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).GetCheck() == BST_CHECKED; - config.video.threadedVideo = CButton(GetDlgItem(IDC_CHK_THREADED_VIDEO)).GetCheck() == BST_CHECKED; - config.frameBufferEmulation.enableOverscan = CButton(GetDlgItem(IDC_CHK_OVERSCAN)).GetCheck() == BST_CHECKED; - - m_OverscanTabs[0]->GetValue( - config.frameBufferEmulation.overscanNTSC.left, - config.frameBufferEmulation.overscanNTSC.right, - config.frameBufferEmulation.overscanNTSC.top, - config.frameBufferEmulation.overscanNTSC.bottom - ); - - m_OverscanTabs[1]->GetValue( - config.frameBufferEmulation.overscanPAL.left, - config.frameBufferEmulation.overscanPAL.right, - config.frameBufferEmulation.overscanPAL.top, - config.frameBufferEmulation.overscanPAL.bottom - ); - - config.video.fxaa = CButton(GetDlgItem(IDC_FXAA_RADIO)).GetCheck() == BST_CHECKED ? 1 : 0; - if (CButton(GetDlgItem(IDC_FXAA_RADIO)).GetCheck() == BST_CHECKED - || CButton(GetDlgItem(IDC_NOAA_RADIO)).GetCheck() == BST_CHECKED - || CComboBox(m_FrameBufferTab.GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).GetCurSel() != 0) { - config.video.multisampling = 0; - } else { - config.video.multisampling = pow2(m_AliasingSlider.GetPos()); - } - if (CButton(GetDlgItem(IDC_MSAA_RADIO)).GetCheck() == BST_CHECKED - && CComboBox(m_FrameBufferTab.GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).GetCurSel() != 0) { - config.video.fxaa = 1; - } - config.texture.maxAnisotropy = m_AnisotropicSlider.GetPos(); - - if (CButton(GetDlgItem(IDC_BILINEAR_3POINT)).GetCheck() == BST_CHECKED) - config.texture.bilinearMode = BILINEAR_3POINT; - if (CButton(GetDlgItem(IDC_BILINEAR_STANDARD)).GetCheck() == BST_CHECKED) - config.texture.bilinearMode = BILINEAR_STANDARD; - - config.generalEmulation.rdramImageDitheringMode = CComboBox(GetDlgItem(IDC_CMB_PATTERN)).GetCurSel(); - config.generalEmulation.enableDitheringPattern = CButton(GetDlgItem(IDC_CHK_APPLY_TO_OUTPUT)).GetCheck() == BST_CHECKED ? 1 : 0; - config.generalEmulation.enableDitheringQuantization = CButton(GetDlgItem(IDC_CHK_5BIT_QUANTIZATION)).GetCheck() == BST_CHECKED ? 1 : 0; - config.generalEmulation.enableHiresNoiseDithering = CButton(GetDlgItem(IDC_CHK_HIRES_NOISE)).GetCheck() == BST_CHECKED ? 1 : 0; - - CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE)); - config.translationFile = (const char *)translationsComboBox.GetItemDataPtr(translationsComboBox.GetCurSel()); -} diff --git a/GLideN64/src/GLideNUI-wtl/config-video.h b/GLideN64/src/GLideNUI-wtl/config-video.h deleted file mode 100644 index 882940e..0000000 --- a/GLideN64/src/GLideNUI-wtl/config-video.h +++ /dev/null @@ -1,66 +0,0 @@ -#define _WTL_NO_CSTRING - -#pragma once -#include "config-tab.h" -#include "config-overscan.h" -#include "config-framebuffer.h" -#include "wtl-BitmapPicture.h" -#include "wtl-tooltip.h" -#include "resource.h" -#include "Language.h" -#include -#include -#include - -class CConfigDlg; -class CFrameBufferTab; - -class CVideoTab : - public CConfigTab, - public CToolTipDialog -{ -public: - BEGIN_MSG_MAP(CVideoTab) - MSG_WM_INITDIALOG(OnInitDialog) - MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnColorStatic) - NOTIFY_HANDLER_EX(IDC_TAB_OVERSCAN, TCN_SELCHANGE, OnOverscanTabChange) - COMMAND_HANDLER_EX(IDC_CMB_FULL_SCREEN_RES, CBN_SELCHANGE, OnFullScreenChanged) - COMMAND_HANDLER_EX(IDC_CHK_OVERSCAN, BN_CLICKED, OnOverscan) - COMMAND_HANDLER(IDC_CMB_LANGUAGE, CBN_SELCHANGE, OnLanguageChanged) - MESSAGE_HANDLER(WM_HSCROLL, OnScroll) - MESSAGE_HANDLER(WM_VSCROLL, OnScroll) - CHAIN_MSG_MAP(CToolTipDialog) - REFLECT_NOTIFICATIONS() - END_MSG_MAP() - - CVideoTab(CConfigDlg & Dlg, CFrameBufferTab & FrameBufferTab, const char * strIniPath); - ~CVideoTab(); - - bool m_AAInfoWarning; - BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); - LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); - void OnOverscan(UINT /*Code*/, int id, HWND /*ctl*/); - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnOverscanTabChange(NMHDR* /*pNMHDR*/); - void OnFullScreenChanged(UINT /*Code*/, int id, HWND /*ctl*/); - LRESULT OnLanguageChanged(WORD wNotifyCode, WORD wID, HWND hwnd, BOOL& bHandled); - void HideMSAADepthWarning(bool hide); - void DisallowMSAA(bool disallow); - void AddOverScanTab(languageStringID caption); - void ShowOverScanTab(int nTab); - void ApplyLanguage(void); - void LoadSettings(bool blockCustomSettings); - void SaveSettings(); - - CTabCtrl m_OverScanTab; - std::vector m_OverscanTabs; - CTrackBarCtrl m_AliasingSlider; - CTrackBarCtrl m_AnisotropicSlider; - CBitmapPicture m_AAInfoIcon; - std::string m_strIniPath; - LanguageList m_LangList; - CConfigDlg & m_Dlg; - CFrameBufferTab & m_FrameBufferTab; -}; diff --git a/GLideN64/src/GLideNUI-wtl/fullscreenresolutions_windows.cpp b/GLideN64/src/GLideNUI-wtl/fullscreenresolutions_windows.cpp deleted file mode 100644 index bef0d4f..0000000 --- a/GLideN64/src/GLideNUI-wtl/fullscreenresolutions_windows.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#include -#include -#include "FullscreenResolutions.h" -#include "../Config.h" - -#if defined(_MSC_VER) && _MSC_VER < 1900 - -#define snprintf c99_snprintf -#define vsnprintf c99_vsnprintf - -__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) -{ - int count = -1; - - if (size != 0) - count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); - if (count == -1) - count = _vscprintf(format, ap); - - return count; -} - -__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) -{ - int count; - va_list ap; - - va_start(ap, format); - count = c99_vsnprintf(outBuf, size, format, ap); - va_end(ap); - - return count; -} - -#endif - -static -struct -{ - struct - { - DWORD width, height, refreshRate; - } selected; - - struct - { - DWORD width, height; - } resolution[32]; - - DWORD refreshRate[32]; - - DWORD numResolutions; - DWORD numRefreshRates; -} fullscreen; - -static -void _fillFullscreenRefreshRateList(StringList & _listRefreshRates, int & _rateIdx) -{ - memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate)); - fullscreen.numRefreshRates = 0; - _rateIdx = 0; - - int i = 0; - DEVMODE deviceMode; - char text[128]; - - while (EnumDisplaySettings(NULL, i++, &deviceMode) != 0) - { - if (deviceMode.dmBitsPerPel != 32) - continue; - - DWORD j = 0; - for (; j < fullscreen.numRefreshRates; ++j) { - if ((deviceMode.dmDisplayFrequency == fullscreen.refreshRate[j])) - break; - } - if ((deviceMode.dmDisplayFrequency != fullscreen.refreshRate[j]) && - (deviceMode.dmPelsWidth == fullscreen.selected.width) && - (deviceMode.dmPelsHeight == fullscreen.selected.height)) { - - fullscreen.refreshRate[j] = deviceMode.dmDisplayFrequency; - //: Abbreviation for Hertz; include a leading space if appropriate - snprintf(text, sizeof(text), "%d Hz", deviceMode.dmDisplayFrequency); - _listRefreshRates.push_back(text); - - if (fullscreen.selected.refreshRate == deviceMode.dmDisplayFrequency) - _rateIdx = fullscreen.numRefreshRates; - - ++fullscreen.numRefreshRates; - } - } -} - -void fillFullscreenResolutionsList(StringList & _listResolutions, int & _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx) -{ - fullscreen.selected.width = config.video.fullscreenWidth; - fullscreen.selected.height = config.video.fullscreenHeight; - fullscreen.selected.refreshRate = config.video.fullscreenRefresh; - - memset(&fullscreen.resolution, 0, sizeof(fullscreen.resolution)); - memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate)); - fullscreen.numResolutions = 0; - fullscreen.numRefreshRates = 0; - _resolutionIdx = 0; - - static - struct - { - unsigned short x, y; - const char *description; - } ratios[] = { - { 3, 2, "3:2" }, - { 4, 3, "4:3" }, - { 5, 4, "5:4" }, - { 16, 9, "16:9" }, - { 8, 5, "16:10" }, - { 21, 9, "21:9" } - }; - const int numRatios = sizeof(ratios); - - int i = 0; - char text[128]; - DEVMODE deviceMode; - while (EnumDisplaySettings(NULL, i++, &deviceMode) != 0) - { - if (deviceMode.dmBitsPerPel != 32) - continue; - - DWORD j = 0; - for (; j < fullscreen.numResolutions; ++j) { - if ((deviceMode.dmPelsWidth == fullscreen.resolution[j].width) && - (deviceMode.dmPelsHeight == fullscreen.resolution[j].height)) { - break; - } - } - if ((deviceMode.dmPelsWidth != fullscreen.resolution[j].width) || - (deviceMode.dmPelsHeight != fullscreen.resolution[j].height)) { - - fullscreen.resolution[fullscreen.numResolutions].width = deviceMode.dmPelsWidth; - fullscreen.resolution[fullscreen.numResolutions].height = deviceMode.dmPelsHeight; - snprintf(text, 128, "%i x %i", deviceMode.dmPelsWidth, deviceMode.dmPelsHeight); - - for (int j = 0; j < numRatios; ++j) - if (fabs((float)deviceMode.dmPelsWidth / (float)deviceMode.dmPelsHeight - - (float)ratios[j].x / (float)ratios[j].y) < 0.005f) { - snprintf(text, 128, "%s (%s)", text, ratios[j].description); - break; - } - - _listResolutions.push_back(text); - - if ((fullscreen.selected.width == deviceMode.dmPelsWidth) && - (fullscreen.selected.height == deviceMode.dmPelsHeight)) - _resolutionIdx = fullscreen.numResolutions; - - ++fullscreen.numResolutions; - } - } - - _fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx); -} - -void fillFullscreenRefreshRateList(int _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx) -{ - fullscreen.selected.width = fullscreen.resolution[_resolutionIdx].width; - fullscreen.selected.height = fullscreen.resolution[_resolutionIdx].height; - _fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx); - _rateIdx = fullscreen.numRefreshRates - 1; -} - -void getFullscreenResolutions(int _idx, unsigned int & _width, unsigned int & _height) -{ - _width = fullscreen.resolution[_idx].width; - _height = fullscreen.resolution[_idx].height; -} - -void getFullscreenRefreshRate(int _idx, unsigned int & _rate) -{ - _rate = fullscreen.refreshRate[_idx]; -} diff --git a/GLideN64/src/GLideNUI-wtl/resource.h b/GLideN64/src/GLideNUI-wtl/resource.h deleted file mode 100644 index 9426d66..0000000 Binary files a/GLideN64/src/GLideNUI-wtl/resource.h and /dev/null differ diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/ticpp.cpp b/GLideN64/src/GLideNUI-wtl/ticpp/ticpp.cpp deleted file mode 100644 index 5d06542..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/ticpp.cpp +++ /dev/null @@ -1,1084 +0,0 @@ -/* -http://code.google.com/p/ticpp/ -Copyright (c) 2006 Ryan Pusztai, Ryan Mulder - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -#ifdef TIXML_USE_TICPP - -#include "ticpp.h" - -using namespace ticpp; - -Attribute::Attribute() -{ - SetTiXmlPointer( new TiXmlAttribute() ); - m_impRC->InitRef(); -} - -Attribute::Attribute( TiXmlAttribute* attribute ) -{ - SetTiXmlPointer( attribute ); - m_impRC->IncRef(); -} - -Attribute::Attribute( const std::string& name, const std::string& value ) -{ - SetTiXmlPointer( new TiXmlAttribute( name, value ) ); - m_impRC->InitRef(); -} - -void Attribute::operator=( const Attribute& copy ) -{ - // Dropping the reference to the old object - this->m_impRC->DecRef(); - - // Pointing to the new Object - SetTiXmlPointer( copy.m_tiXmlPointer ); - - // The internal tixml pointer changed in the above line - this->m_impRC->IncRef(); -} - -Attribute::~Attribute() -{ - m_impRC->DecRef(); -} - -std::string Attribute::Value() const -{ - ValidatePointer(); - return m_tiXmlPointer->ValueStr(); -} - -std::string Attribute::Name() const -{ - ValidatePointer(); - return m_tiXmlPointer->Name(); -} - -Attribute* Attribute::Next( bool throwIfNoAttribute ) const -{ - ValidatePointer(); - TiXmlAttribute* attribute = m_tiXmlPointer->Next(); - if ( 0 == attribute ) - { - if ( throwIfNoAttribute ) - { - TICPPTHROW( "No more attributes found" ) - } - else - { - return 0; - } - } - - Attribute* temp = new Attribute( attribute ); - attribute->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Attribute* Attribute::Previous( bool throwIfNoAttribute ) const -{ - ValidatePointer(); - TiXmlAttribute* attribute = m_tiXmlPointer->Previous(); - if ( 0 == attribute ) - { - if ( throwIfNoAttribute ) - { - TICPPTHROW( "No more attributes found" ) - } - else - { - return 0; - } - } - - Attribute* temp = new Attribute( attribute ); - attribute->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -void Attribute::IterateNext( const std::string&, Attribute** next ) const -{ - *next = Next( false ); -} - -void Attribute::IteratePrevious( const std::string&, Attribute** previous ) const -{ - *previous = Previous( false ); -} - -void Attribute::Print( FILE* file, int depth ) const -{ - ValidatePointer(); - m_tiXmlPointer->Print( file, depth ); -} - -void Attribute::SetTiXmlPointer( TiXmlAttribute* newPointer ) -{ - m_tiXmlPointer = newPointer; - SetImpRC( newPointer ); -} - -//***************************************************************************** - -Node* Node::NodeFactory( TiXmlNode* tiXmlNode, bool throwIfNull, bool rememberSpawnedWrapper ) const -{ - if ( 0 == tiXmlNode ) - { - if ( throwIfNull ) - { - TICPPTHROW( "tiXmlNode is NULL" ) - } - else - { - return 0; - } - } - - Node* temp; - switch ( tiXmlNode->Type() ) - { - case TiXmlNode::DOCUMENT: - temp = new Document( tiXmlNode->ToDocument() ); - break; - - case TiXmlNode::ELEMENT: - temp = new Element( tiXmlNode->ToElement() ); - break; - - case TiXmlNode::COMMENT: - temp = new Comment( tiXmlNode->ToComment() ); - break; - - case TiXmlNode::TEXT: - temp = new Text( tiXmlNode->ToText() ); - break; - - case TiXmlNode::DECLARATION: - temp = new Declaration( tiXmlNode->ToDeclaration() ); - break; - - case TiXmlNode::STYLESHEETREFERENCE: - temp = new StylesheetReference( tiXmlNode->ToStylesheetReference() ); - break; - - default: - TICPPTHROW( "Type is unsupported" ) - } - - if ( rememberSpawnedWrapper ) - { - tiXmlNode->m_spawnedWrappers.push_back( temp ); - } - return temp; -} - - -std::string Node::Value() const -{ - return GetTiXmlPointer()->ValueStr(); -} - -void Node::Clear() -{ - GetTiXmlPointer()->Clear(); -} - -Node* Node::Parent( bool throwIfNoParent ) const -{ - TiXmlNode* parent = GetTiXmlPointer()->Parent(); - if ( ( 0 == parent ) && throwIfNoParent ) - { - TICPPTHROW( "No parent exists" ); - } - - return NodeFactory( parent, false ); -} - -Node* Node::FirstChild( bool throwIfNoChildren ) const -{ - return FirstChild( "", throwIfNoChildren ); -} - -Node* Node::FirstChild( const std::string& value, bool throwIfNoChildren ) const -{ - return FirstChild( value.c_str(), throwIfNoChildren ); -} - -Node* Node::FirstChild( const char* value, bool throwIfNoChildren ) const -{ - TiXmlNode* childNode; - if ( 0 == strlen( value ) ) - { - childNode = GetTiXmlPointer()->FirstChild(); - } - else - { - childNode = GetTiXmlPointer()->FirstChild( value ); - } - - if ( ( 0 == childNode ) && throwIfNoChildren ) - { - TICPPTHROW( "Child with the value of \"" << value << "\" not found" ); - } - - return NodeFactory( childNode, false ); -} - -Node* Node::LastChild( bool throwIfNoChildren ) const -{ - return LastChild( "", throwIfNoChildren ); -} - -Node* Node::LastChild( const std::string& value, bool throwIfNoChildren ) const -{ - return LastChild( value.c_str(), throwIfNoChildren ); -} - -Node* Node::LastChild( const char* value, bool throwIfNoChildren ) const -{ - TiXmlNode* childNode; - if ( 0 == strlen( value ) ) - { - childNode = GetTiXmlPointer()->LastChild(); - } - else - { - childNode = GetTiXmlPointer()->LastChild( value ); - } - - if ( ( 0 == childNode ) && throwIfNoChildren ) - { - TICPPTHROW( "Child with the value of \"" << value << "\" not found" ); - } - - return NodeFactory( childNode, false ); -} - -Node* Node::IterateChildren ( Node* previous ) const -{ - TiXmlNode* pointer; - if ( 0 == previous ) - { - pointer = GetTiXmlPointer()->IterateChildren( 0 ); - } - else - { - pointer = GetTiXmlPointer()->IterateChildren( previous->GetTiXmlPointer() ); - } - - return NodeFactory( pointer, false ); -} - -Node* Node::IterateChildren( const std::string& value, Node* previous ) const -{ - TiXmlNode* pointer; - if ( 0 == previous ) - { - pointer = GetTiXmlPointer()->IterateChildren( value, 0 ); - } - else - { - pointer = GetTiXmlPointer()->IterateChildren( value, previous->GetTiXmlPointer() ); - } - - return NodeFactory( pointer, false ); -} - -Node* Node::InsertEndChild( const Node& addThis ) -{ - if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - TICPPTHROW( "Node is a Document and can't be inserted" ); - } - - TiXmlNode* pointer = GetTiXmlPointer()->InsertEndChild( *addThis.GetTiXmlPointer() ); - if ( 0 == pointer ) - { - TICPPTHROW( "Node can't be inserted" ); - } - - return NodeFactory( pointer ); -} - -Node* Node::LinkEndChild( Node* childNode ) -{ - if ( childNode->Type() == TiXmlNode::DOCUMENT ) - { - TICPPTHROW( "Node is a Document and can't be linked" ); - } - - // Increment reference count when adding to the tree - childNode->m_impRC->IncRef(); - - if ( 0 == GetTiXmlPointer()->LinkEndChild( childNode->GetTiXmlPointer() ) ) - { - TICPPTHROW( "Node can't be linked" ); - } - - return childNode; -} - -Node* Node::InsertBeforeChild( Node* beforeThis, const Node& addThis ) -{ - if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - TICPPTHROW( "Node is a Document and can't be inserted" ); - } - - // Increment reference count when adding to the tree - addThis.m_impRC->IncRef(); - - TiXmlNode* pointer = GetTiXmlPointer()->InsertBeforeChild( beforeThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() ); - if ( 0 == pointer ) - { - TICPPTHROW( "Node can't be inserted" ); - } - - return NodeFactory( pointer ); -} - -Node* Node::InsertAfterChild( Node* afterThis, const Node& addThis ) -{ - if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - TICPPTHROW( "Node is a Document and can't be inserted" ); - } - - // Increment reference count when adding to the tree - addThis.m_impRC->IncRef(); - - TiXmlNode* pointer = GetTiXmlPointer()->InsertAfterChild( afterThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() ); - if ( 0 == pointer ) - { - TICPPTHROW( "Node can't be inserted" ); - } - - return NodeFactory( pointer ); -} - -Node* Node::ReplaceChild( Node* replaceThis, const Node& withThis ) -{ - if ( withThis.Type() == TiXmlNode::DOCUMENT ) - { - TICPPTHROW( "Node is a Document and can't be inserted" ); - } - - // Increment reference count when adding to the tree - withThis.m_impRC->IncRef(); - - TiXmlNode* pointer = GetTiXmlPointer()->ReplaceChild( replaceThis->GetTiXmlPointer(), *withThis.GetTiXmlPointer() ); - if ( 0 == pointer ) - { - TICPPTHROW( "Node can't be inserted" ); - } - - return NodeFactory( pointer ); -} - -void Node::RemoveChild( Node* removeThis ) -{ - if ( !GetTiXmlPointer()->RemoveChild( removeThis->GetTiXmlPointer() ) ) - { - TICPPTHROW( "Node to remove (" << removeThis->Value() << ") is not a child of this Node (" << Value() << ")" ) - } -} - -Node* Node::PreviousSibling( bool throwIfNoSiblings ) const -{ - return PreviousSibling( "", throwIfNoSiblings ); -} - -Node* Node::PreviousSibling( const std::string& value, bool throwIfNoSiblings ) const -{ - return PreviousSibling( value.c_str(), throwIfNoSiblings ); -} - -Node* Node::PreviousSibling( const char* value, bool throwIfNoSiblings ) const -{ - TiXmlNode* sibling; - if ( 0 == strlen( value ) ) - { - sibling = GetTiXmlPointer()->PreviousSibling(); - } - else - { - sibling = GetTiXmlPointer()->PreviousSibling( value ); - } - - if ( ( 0 == sibling ) && throwIfNoSiblings ) - { - TICPPTHROW( "No Siblings found with value, '" << value << "', Prior to this Node (" << Value() << ")" ) - } - - return NodeFactory( sibling, false ); -} - -Node* Node::NextSibling( bool throwIfNoSiblings ) const -{ - return NextSibling( "", throwIfNoSiblings ); -} - -Node* Node::NextSibling( const std::string& value, bool throwIfNoSiblings ) const -{ - return NextSibling( value.c_str(), throwIfNoSiblings ); -} - -Node* Node::NextSibling( const char* value, bool throwIfNoSiblings ) const -{ - TiXmlNode* sibling; - if ( 0 == strlen( value ) ) - { - sibling = GetTiXmlPointer()->NextSibling(); - } - else - { - sibling = GetTiXmlPointer()->NextSibling( value ); - } - - if ( ( 0 == sibling ) && throwIfNoSiblings ) - { - TICPPTHROW( "No Siblings found with value, '" << value << "', After this Node (" << Value() << ")" ) - } - - return NodeFactory( sibling, false ); -} - -Element* Node::NextSiblingElement( bool throwIfNoSiblings ) const -{ - return NextSiblingElement( "", throwIfNoSiblings ); -} - -Element* Node::NextSiblingElement( const std::string& value, bool throwIfNoSiblings ) const -{ - return NextSiblingElement( value.c_str(), throwIfNoSiblings ); -} - -Element* Node::NextSiblingElement( const char* value, bool throwIfNoSiblings ) const -{ - TiXmlElement* sibling; - if ( 0 == strlen( value ) ) - { - sibling = GetTiXmlPointer()->NextSiblingElement(); - } - else - { - sibling = GetTiXmlPointer()->NextSiblingElement( value ); - } - - if ( 0 == sibling ) - { - if ( throwIfNoSiblings ) - { - TICPPTHROW( "No Element Siblings found with value, '" << value << "', After this Node (" << Value() << ")" ) - } - else - { - return 0; - } - } - - Element* temp = new Element( sibling ); - sibling->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Element* Node::FirstChildElement( bool throwIfNoChildren ) const -{ - return FirstChildElement( "", throwIfNoChildren ); -} - -Element* Node::FirstChildElement( const std::string& value, bool throwIfNoChildren ) const -{ - return FirstChildElement( value.c_str(), throwIfNoChildren ); -} - -Element* Node::FirstChildElement( const char* value, bool throwIfNoChildren ) const -{ - TiXmlElement* element; - if ( 0 == strlen( value ) ) - { - element = GetTiXmlPointer()->FirstChildElement(); - } - else - { - element = GetTiXmlPointer()->FirstChildElement( value ); - } - - if ( 0 == element ) - { - if( throwIfNoChildren ) - { - TICPPTHROW( "Element (" << Value() << ") does NOT contain a child with the value of '" << value << "'" ) - } - else - { - return 0; - } - } - - Element* temp = new Element( element ); - element->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -int Node::Type() const -{ - return GetTiXmlPointer()->Type(); -} - -Document* Node::GetDocument( bool throwIfNoDocument ) const -{ - TiXmlDocument* doc = GetTiXmlPointer()->GetDocument(); - if ( 0 == doc ) - { - if( throwIfNoDocument ) - { - TICPPTHROW( "This node (" << Value() << ") is not linked under a document" ) - } - else - { - return 0; - } - } - Document* temp = new Document( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -bool Node::NoChildren() const -{ - return GetTiXmlPointer()->NoChildren(); -} - -Document* Node::ToDocument() const -{ - TiXmlDocument* doc = GetTiXmlPointer()->ToDocument(); - if ( 0 == doc ) - { - TICPPTHROW( "This node (" << Value() << ") is not a Document" ) - } - Document* temp = new Document( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Element* Node::ToElement() const -{ - TiXmlElement* doc = GetTiXmlPointer()->ToElement(); - if ( 0 == doc ) - { - TICPPTHROW( "This node (" << Value() << ") is not a Element" ) - } - Element* temp = new Element( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Comment* Node::ToComment() const -{ - TiXmlComment* doc = GetTiXmlPointer()->ToComment(); - if ( 0 == doc ) - { - TICPPTHROW( "This node (" << Value() << ") is not a Comment" ) - } - Comment* temp = new Comment( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Text* Node::ToText() const -{ - TiXmlText* doc = GetTiXmlPointer()->ToText(); - if ( 0 == doc ) - { - TICPPTHROW( "This node (" << Value() << ") is not a Text" ) - } - Text* temp = new Text( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Declaration* Node::ToDeclaration() const -{ - TiXmlDeclaration* doc = GetTiXmlPointer()->ToDeclaration(); - if ( 0 == doc ) - { - TICPPTHROW( "This node (" << Value() << ") is not a Declaration" ) - } - Declaration* temp = new Declaration( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -StylesheetReference* Node::ToStylesheetReference() const -{ - TiXmlStylesheetReference* doc = GetTiXmlPointer()->ToStylesheetReference(); - if ( 0 == doc ) - { - TICPPTHROW( "This node (" << Value() << ") is not a StylesheetReference" ) - } - StylesheetReference* temp = new StylesheetReference( doc ); - doc->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -std::unique_ptr< Node > Node::Clone() const -{ - TiXmlNode* node = GetTiXmlPointer()->Clone(); - if ( 0 == node ) - { - TICPPTHROW( "Node could not be cloned" ); - } - std::unique_ptr< Node > temp( NodeFactory( node, false, false ) ); - - // Take ownership of the memory from TiXml - temp->m_impRC->InitRef(); - - return temp; -} - -bool Node::Accept( TiXmlVisitor* visitor ) const -{ - return GetTiXmlPointer()->Accept( visitor ); -} - -//***************************************************************************** - -Comment::Comment() -: NodeImp< TiXmlComment >( new TiXmlComment() ) -{ - m_impRC->InitRef(); -} - -Comment::Comment( TiXmlComment* comment ) -: NodeImp< TiXmlComment >( comment ) -{ -} - -Comment::Comment( const std::string& comment ) -: NodeImp< TiXmlComment >( new TiXmlComment() ) -{ - m_impRC->InitRef(); - m_tiXmlPointer->SetValue( comment ); -} - -//***************************************************************************** - -Text::Text() -: NodeImp< TiXmlText >( new TiXmlText("") ) -{ - m_impRC->InitRef(); -} - - -Text::Text( const std::string& value ) -: NodeImp< TiXmlText >( new TiXmlText( value ) ) -{ - m_impRC->InitRef(); -} - -Text::Text( TiXmlText* text ) -: NodeImp< TiXmlText >( text ) -{ -} - - -//***************************************************************************** - -Document::Document() -: NodeImp< TiXmlDocument >( new TiXmlDocument() ) -{ - m_impRC->InitRef(); -} - -Document::Document( TiXmlDocument* document ) -: NodeImp< TiXmlDocument >( document ) -{ -} - -Document::Document( const char* documentName ) -: NodeImp< TiXmlDocument >( new TiXmlDocument( documentName ) ) -{ - m_impRC->InitRef(); -} - -Document::Document( const std::string& documentName ) -: NodeImp< TiXmlDocument >( new TiXmlDocument( documentName ) ) -{ - m_impRC->InitRef(); -} - -void Document::LoadFile( TiXmlEncoding encoding ) -{ - if ( !m_tiXmlPointer->LoadFile( encoding ) ) - { - TICPPTHROW( "Couldn't load " << m_tiXmlPointer->Value() ); - } -} - -void Document::SaveFile() const { - if ( !m_tiXmlPointer->SaveFile() ) - { - TICPPTHROW( "Couldn't save " << m_tiXmlPointer->Value() ); - } -} - -void Document::LoadFile( const std::string& filename, TiXmlEncoding encoding ) -{ - if ( !m_tiXmlPointer->LoadFile( filename.c_str(), encoding ) ) - { - TICPPTHROW( "Couldn't load " << filename ); - } -} - -void Document::LoadFile( const char* filename, TiXmlEncoding encoding ) -{ - if ( !m_tiXmlPointer->LoadFile( filename, encoding ) ) - { - TICPPTHROW( "Couldn't load " << filename ); - } -} - -void Document::SaveFile( const std::string& filename ) const -{ - if ( !m_tiXmlPointer->SaveFile( filename.c_str() ) ) - { - TICPPTHROW( "Couldn't save " << filename ); - } -} - -void Document::Parse( const std::string& xml, bool throwIfParseError, TiXmlEncoding encoding ) -{ - m_tiXmlPointer->Parse( xml.c_str(), 0, encoding ); - if( throwIfParseError && m_tiXmlPointer->Error() ) - { - TICPPTHROW( "Error parsing xml." ); - } -} - -//***************************************************************************** - -Element::Element() -: NodeImp< TiXmlElement >( new TiXmlElement( "DefaultValueCausedByCreatingAnElementWithNoParameters" ) ) -{ - m_impRC->InitRef(); -} - -Element::Element( const std::string& value ) -: NodeImp< TiXmlElement >( new TiXmlElement( value ) ) -{ - m_impRC->InitRef(); -} - -Element::Element( const char* value ) -: NodeImp< TiXmlElement >( new TiXmlElement( value ) ) -{ - m_impRC->InitRef(); -} - -Element::Element( TiXmlElement* element ) -: NodeImp< TiXmlElement >( element ) -{ -} - -Attribute* Element::FirstAttribute( bool throwIfNoAttributes ) const -{ - ValidatePointer(); - TiXmlAttribute* attribute = m_tiXmlPointer->FirstAttribute(); - if ( ( 0 == attribute ) && throwIfNoAttributes ) - { - TICPPTHROW( "This Element (" << Value() << ") has no attributes" ) - } - - if ( 0 == attribute ) - { - if( throwIfNoAttributes ) - { - TICPPTHROW( "Element (" << Value() << ") has no attributes" ) - } - else - { - return 0; - } - } - - Attribute* temp = new Attribute( attribute ); - attribute->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -Attribute* Element::LastAttribute( bool throwIfNoAttributes ) const -{ - ValidatePointer(); - TiXmlAttribute* attribute = m_tiXmlPointer->LastAttribute(); - if ( ( 0 == attribute ) && throwIfNoAttributes ) - { - TICPPTHROW( "This Element (" << Value() << ") has no attributes" ) - } - - if ( 0 == attribute ) - { - if( throwIfNoAttributes ) - { - TICPPTHROW( "Element (" << Value() << ") has no attributes" ) - } - else - { - return 0; - } - } - - Attribute* temp = new Attribute( attribute ); - attribute->m_spawnedWrappers.push_back( temp ); - - return temp; -} - -std::string Element::GetAttributeOrDefault( const std::string& name, const std::string& defaultValue ) const -{ - std::string value; - if ( !GetAttributeImp( name, &value ) ) - { - return defaultValue; - } - return value; -} - -std::string Element::GetAttribute( const std::string& name ) const -{ - return GetAttributeOrDefault( name, std::string() ); -} - -bool Element::HasAttribute( const std::string& name ) const -{ - ValidatePointer(); - return ( 0 != m_tiXmlPointer->Attribute( name.c_str() ) ); -} - -void Element::RemoveAttribute( const std::string& name ) -{ - ValidatePointer(); - m_tiXmlPointer->RemoveAttribute( name.c_str() ); -} - -bool Element::GetAttributeImp( const std::string& name, std::string* value ) const -{ - ValidatePointer(); - - // Get value from TinyXML, if the attribute exists - const char* retVal = m_tiXmlPointer->Attribute( name.c_str() ); - - // TinyXML returns NULL if the attribute doesn't exist - if ( 0 == retVal ) - { - return false; - } - else - { - *value = retVal; - return true; - } -} - -bool Element::GetTextImp( std::string* value ) const -{ - ValidatePointer(); - - // Get value from TinyXML, if the attribute exists - const char* retVal = m_tiXmlPointer->GetText(); - - // TinyXML returns NULL if the attribute doesn't exist - if ( 0 == retVal ) - { - return false; - } - else - { - *value = retVal; - return true; - } -} - -//***************************************************************************** - -Declaration::Declaration() -: NodeImp< TiXmlDeclaration >( new TiXmlDeclaration() ) -{ - m_impRC->InitRef(); -} - -Declaration::Declaration( TiXmlDeclaration* declaration ) -: NodeImp< TiXmlDeclaration >( declaration ) -{ -} - -Declaration::Declaration( const std::string& version, const std::string& encoding, const std::string& standalone ) -: NodeImp< TiXmlDeclaration >( new TiXmlDeclaration( version, encoding, standalone ) ) -{ - m_impRC->InitRef(); -} - -std::string Declaration::Version() const -{ - return m_tiXmlPointer->Version(); -} - -std::string Declaration::Encoding() const -{ - return m_tiXmlPointer->Encoding(); -} - -std::string Declaration::Standalone() const -{ - return m_tiXmlPointer->Standalone(); -} - -//***************************************************************************** - -StylesheetReference::StylesheetReference() -: NodeImp< TiXmlStylesheetReference >( new TiXmlStylesheetReference() ) -{ - m_impRC->InitRef(); -} - -StylesheetReference::StylesheetReference( TiXmlStylesheetReference* stylesheetReference ) -: NodeImp< TiXmlStylesheetReference >( stylesheetReference ) -{ -} - -StylesheetReference::StylesheetReference( const std::string& type, const std::string& href ) -: NodeImp< TiXmlStylesheetReference >( new TiXmlStylesheetReference( type, href ) ) -{ - m_impRC->InitRef(); -} - -std::string StylesheetReference::Type() const -{ - return m_tiXmlPointer->Type(); -} - -std::string StylesheetReference::Href() const -{ - return m_tiXmlPointer->Href(); -} - -//***************************************************************************** - -Exception::Exception(const std::string &details) -: -m_details( details ) -{ - -} - -Exception::~Exception() throw() -{ -} - -const char* Exception::what() const throw() -{ - return m_details.c_str(); -} - -//***************************************************************************** - -TiCppRC::TiCppRC() -{ - // Spawn reference counter for this object - m_tiRC = new TiCppRCImp( this ); -} - -void TiCppRC::DeleteSpawnedWrappers() -{ - std::vector< Base* >::reverse_iterator wrapper; - for ( wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend(); ++wrapper ) - { - delete *wrapper; - } - m_spawnedWrappers.clear(); -} - -TiCppRC::~TiCppRC() -{ - DeleteSpawnedWrappers(); - - // Set pointer held by reference counter to NULL - this->m_tiRC->Nullify(); - - // Decrement reference - so reference counter will delete itself if necessary - this->m_tiRC->DecRef(); -} - -//***************************************************************************** - -TiCppRCImp::TiCppRCImp( TiCppRC* tiCppRC ) - : m_count( 1 ), m_tiCppRC ( tiCppRC ) -{ -} - -void TiCppRCImp::IncRef() -{ - m_count++; -} - -void TiCppRCImp::DecRef() -{ - m_count--; - if ( 0 == m_count ) - { - delete m_tiCppRC; - delete this; - } -} - -void TiCppRCImp::InitRef() -{ - m_count = 1; -} - -void TiCppRCImp::Nullify() -{ - m_tiCppRC = 0; -} - -TiCppRC* TiCppRCImp::Get() -{ - return m_tiCppRC; -} - -bool TiCppRCImp::IsNull() -{ - return 0 == m_tiCppRC; -} - -#endif // TIXML_USE_TICPP diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/ticpp.h b/GLideN64/src/GLideNUI-wtl/ticpp/ticpp.h deleted file mode 100644 index ebc2133..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/ticpp.h +++ /dev/null @@ -1,1862 +0,0 @@ -/* -http://code.google.com/p/ticpp/ -Copyright (c) 2006 Ryan Pusztai, Ryan Mulder - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** -@copydoc ticpp -@file -@author Ryan Pusztai -@author Ryan Mulder -@date 04/11/2006 - -@version 0.04a by edam@waxworlds.org: based Exception based on std::exception; added stream - << and >> support; added Document::Parse(); bug fix; improved THROW() macro. -@version 0.04 Added NodeImp class. Also made all the classes inherit from NodeImp. -@version 0.03 Added Declaration class -@version 0.02 Added Element class -@version 0.01 Added Exception class, Document class - -@todo add UNKNOWN support. See ticpp::NodeFactory. -@todo add TYPECOUNT support. See ticpp::NodeFactory. -@todo Add a quick reference -*/ - - /* - * THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012. - * - * - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X - */ - -#ifndef TIXML_USE_TICPP - #define TIXML_USE_TICPP -#endif - -#ifndef TICPP_INCLUDED -#define TICPP_INCLUDED - -#include "tinyxml.h" - -#include - -/** -@subpage ticpp is a TinyXML wrapper that uses a lot more C++ ideals. -It throws exceptions, uses templates, is in its own name space, and -requires STL (Standard Template Library). This is done to ease the use -of getting values in and out of the xml. - -If you don't perfer to use some of the concepts just don't use it. -It is just a wrapper that extends TinyXML. It doesn't actually change -any of TinyXML. -*/ -namespace ticpp -{ - /** - This is a ticpp exception class - */ - class TICPP_API Exception : public std::exception - { - public: - /** - Construct an exception with a message - */ - Exception( const std::string& details ); - ~Exception() throw(); - - /// Override std::exception::what() to return m_details - const char* what() const throw(); - - std::string m_details; /**< Exception Details */ - }; - - /** - This allows you to stream your exceptions in. - It will take care of the conversion and throwing the exception. - */ - #define TICPPTHROW( message ) \ - { \ - std::ostringstream full_message; \ - std::string file( __FILE__ ); \ - file = file.substr( file.find_last_of( "\\/" ) + 1 ); \ - full_message << message << " <" << file << "@" << __LINE__ << ">"; \ - full_message << BuildDetailedErrorString(); \ - throw Exception( full_message.str() ); \ - } - - // Forward Declarations for Visitor, and others. - class TICPP_API Document; - class TICPP_API Element; - class TICPP_API Declaration; - class TICPP_API StylesheetReference; - class TICPP_API Text; - class TICPP_API Comment; - class TICPP_API Attribute; - - /** Wrapper around TiXmlBase */ - class TICPP_API Base - { - public: - - /** - Converts any class with a proper overload of the << opertor to a std::string - @param value The value to be converted - @throws Exception When value cannot be converted to a std::string - */ - template < class T > - std::string ToString( const T& value ) const - { - std::stringstream convert; - convert << value; - if ( convert.fail() ) - { - TICPPTHROW( "Could not convert value to text" ); - } - return convert.str(); - } - - std::string ToString( const std::string& value ) const - { - return value; - } - - /** - Converts a std::string to any class with a proper overload of the >> opertor - @param temp The string to be converted - @param out [OUT] The container for the returned value - @throws Exception When temp cannot be converted to the target type - */ - template < class T > - void FromString( const std::string& temp, T* out ) const - { - std::istringstream val( temp ); - val >> *out; - - if ( val.fail() ) - { - TICPPTHROW( "Could not convert \"" << temp << "\" to target type" ); - } - } - - /** - Specialization for std::string - */ - void FromString( const std::string& temp, std::string* out ) const - { - *out = temp; - } - - /** - Return the position, in the original source file, of this node or attribute. - Wrapper around TiXmlBase::Row() - */ - int Row() const - { - return GetBasePointer()->Row(); - } - - /** - Return the position, in the original source file, of this node or attribute. - Wrapper around TiXmlBase::Row() - */ - int Column() const - { - return GetBasePointer()->Column(); - } - - /** - Compare internal TiXml pointers to determine is both are wrappers around the same node - */ - bool operator == ( const Base& rhs ) const - { - return ( GetBasePointer() == rhs.GetBasePointer() ); - } - - /** - Compare internal TiXml pointers to determine is both are wrappers around the same node - */ - bool operator != ( const Base& rhs ) const - { - return ( GetBasePointer() != rhs.GetBasePointer() ); - } - - /** - Builds detailed error string using TiXmlDocument::Error() and others - */ - std::string BuildDetailedErrorString() const - { - std::ostringstream full_message; - #ifndef TICPP_NO_RTTI - TiXmlNode* node = dynamic_cast< TiXmlNode* >( GetBasePointer() ); - if ( node != 0 ) - { - TiXmlDocument* doc = node->GetDocument(); - if ( doc != 0 ) - { - if ( doc->Error() ) - { - full_message << "\nDescription: " << doc->ErrorDesc() - << "\nFile: " << (strlen( doc->Value() ) > 0 ? doc->Value() : "") - << "\nLine: " << doc->ErrorRow() - << "\nColumn: " << doc->ErrorCol(); - } - } - } - #endif - return full_message.str(); - } - - /** - Destructor - */ - virtual ~Base() - { - } - - protected: - mutable TiCppRCImp* m_impRC; /**< Holds status of internal TiXmlPointer - use this to determine if object has been deleted already */ - - /** - @internal - Updates the pointer to the reference counter to point at the counter in the new node. - - @param node TiXmlBase containing the new reference counter - */ - void SetImpRC( TiXmlBase* node ) - { - m_impRC = node->m_tiRC; - } - - void ValidatePointer() const - { - if ( m_impRC->IsNull() ) - { - TICPPTHROW( "Internal TiXml Pointer is NULL" ); - } - } - - /** - @internal - Get internal TiXmlBase* - */ - virtual TiXmlBase* GetBasePointer() const = 0; - }; - - /** - Wrapper around TiXmlAttribute - */ - class TICPP_API Attribute : public Base - { - private: - TiXmlAttribute* m_tiXmlPointer; - TiXmlBase* GetBasePointer() const - { - ValidatePointer(); - return m_tiXmlPointer; - } - - public: - /** - Construct an empty attribute. - */ - Attribute(); - - /** - Construct an attribute with @a name and @a value - - @param name The name of the attribute - @param value The value of the attribute - */ - Attribute( const std::string& name, const std::string& value ); - - /** - @internal - Construct an attribute with the internal pointer - - @param attribute The internal pointer - */ - Attribute( TiXmlAttribute* attribute ); - - /** - Get the value of this attribute - Uses Base::FromString to convert TiXmlAttribute::ValueStr from a std::string, - and puts it in the passed pointer. - - @param value [OUT] A pointer to fill with the value - */ - template < class T > - void GetValue( T* value ) const - { - ValidatePointer(); - FromString( m_tiXmlPointer->ValueStr(), value ); - } - - /** - Get the value of this attribute. - Simple wrapper for TiXmlAttribute::ValueStr. - - @see GetValue - */ - std::string Value() const; - - /** - Set the value of this node. - Uses Base::ToString to convert value to a std::string, then calls TiXmlAttribute::SetValue. - - @param value The value to set - */ - template < class T > - void SetValue( const T& value ) - { - ValidatePointer(); - m_tiXmlPointer->SetValue( ToString( value ) ); - } - - /** - Get the value of this attribute - Uses Base::FromString to convert TiXmlAttribute::Name from a std::string, - and puts it in the passed pointer. - - @param name [OUT] A pointer to fill with the name - */ - template < class T > - void GetName( T* name ) const - { - ValidatePointer(); - FromString( m_tiXmlPointer->Name(), name ); - } - - /** - Get the value of this attribute. - Simple wrapper for TiXmlAttribute::Name. - - @see GetName - */ - std::string Name() const; - - /** - Set the value of this attribute. - Uses Base::ToString to convert @a name to a std::string, then calls TiXmlAttribute::SetName. - - @param name The name to set - */ - template < class T > - void SetName( const T& name ) - { - ValidatePointer(); - m_tiXmlPointer->SetName( ToString( name ) ); - } - - /** - @internal - Updates the reference count for the old and new pointers. - */ - void operator=( const Attribute& copy ); - - Attribute( const Attribute& copy ) = delete; - - /* - Decrements reference count. - */ - ~Attribute(); - - /** - Get the next sibling attribute in the DOM. - */ - Attribute* Next( bool throwIfNoAttribute = true ) const; - - /** - Get the previous sibling attribute in the DOM. - */ - Attribute* Previous( bool throwIfNoAttribute = true ) const; - - /** - @internal - Just for Iterator<> - - @param next [OUT] The pointer to the next valid attribute - @return true if there is a next attribute, false if not - */ - void IterateNext( const std::string&, Attribute** next ) const; - - /** - @internal - Just for Iterator<> - - @param previous [OUT] The pointer to the previous valid attribute - @return true if there is a previous attribute, false if not - */ - void IteratePrevious( const std::string&, Attribute** previous ) const; - - /** - All TinyXml classes can print themselves to a filestream. - */ - virtual void Print( FILE* file, int depth ) const; - - private: - - /** - @internal - Sets the internal pointer. - Saves a copy of the pointer to the RC object. - - @param newPointer TiXmlAttribute* to set. - */ - void SetTiXmlPointer( TiXmlAttribute* newPointer ); - }; - - /** - Wrapper around TiXmlNode - */ - class TICPP_API Node : public Base - { - public: - - /** - Get the value of this node - Uses Base::FromString to convert TiXmlNode::ValueStr from a std::string, - and puts it in the passed pointer. - - @param value [OUT] A pointer to fill with the value - */ - template < class T > - void GetValue( T* value) const - { - FromString( GetTiXmlPointer()->ValueStr(), value ); - } - - /** - Get the value of this node. - Simple wrapper for TiXmlNode::ValueStr. - - @see GetValue - */ - std::string Value() const; - - /** - Set the value of this node. - Uses Base::ToString to convert value to a std::string, then calls TiXmlNode::SetValue. - - @param value The value to set - */ - template < class T > - void SetValue( const T& value ) - { - GetTiXmlPointer()->SetValue( ToString( value ) ); - } - - /** - Clear all Nodes below this. - Simple wrapper for TiXmlNode::Clear. - */ - void Clear(); - - /** - The Parent of this Node. - Simple wrapper for TiXmlNode::Parent. - - @param throwIfNoParent [DEF] If true, throws when Parent = NULL. - @return The parent of this node, NULL if there is no Parent. - @throws Exception When throwIfNoParent is true, and TiXmlNode::Parent returns Null. - */ - Node* Parent( bool throwIfNoParent = true ) const; - - /** - The first child of this node. - - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no children. - @return Pointer to child, Null if no children and 'throwIfNoChildren' is false. - @throws Exception When throwIfNoChildren is true, and TiXmlNode::FirstChild returns Null. - - @see TiXmlNode::FirstChild - */ - Node* FirstChild( bool throwIfNoChildren = true ) const; - - /** - @internal - The first child of this node with the matching @a value. - - @overload - @param value Value to match. - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no children. - - @see FirstChild( bool throwIfNoChildren = true ) - */ - Node* FirstChild( const char* value, bool throwIfNoChildren = true ) const; - - /** - The first child of this node with the matching @a value. - - @overload - @param value Value to match. - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no children. - - @see FirstChild( const char* value, bool throwIfNoChildren = true ) - */ - Node* FirstChild( const std::string& value, bool throwIfNoChildren = true ) const; - - /** - The last child of this node. - - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no children. - @return Pointer to child, Null if no children and 'throwIfNoChildren' is false. - @throws Exception When throwIfNoChildren is true, and TiXmlNode::LastChild returns Null. - - @see TiXmlNode::LastChild - */ - Node* LastChild( bool throwIfNoChildren = true ) const; - - /** - @internal - The last child of this node with the matching @a value. - - @overload - @param value Value to match. - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no children. - - @see LastChild( bool throwIfNoChildren = true ) - */ - Node* LastChild( const char* value, bool throwIfNoChildren = true ) const; - - /** - The last child of this node with the matching @a value. - - @overload - @param value Value to match. - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no children. - - @see LastChild( const char* value, bool throwIfNoChildren = true ) - */ - Node* LastChild( const std::string& value, bool throwIfNoChildren = true ) const; - - /** - An alternate way to walk the children of a node. - Simple wrapper for TiXmlNode::IterateChildren. - - @param previous The previous Node* that was returned from IterateChildren. - @return NULL When there are no more children. - */ - Node* IterateChildren( Node* previous ) const; - - /** - This flavor of IterateChildren searches for children with a particular @a value. - Simple wrapper for TiXmlNode::IterateChildren. - - @param value The value you want to search for. - @param previous The previous Node* that was returned from IterateChildren. - @return NULL When there are no more children. - */ - Node* IterateChildren( const std::string& value, Node* previous ) const; - - /** - Adds a child past the LastChild. - Throws if you try to insert a document. - - @note This takes a copy of @a addThis so it is not as efficiant as LinkEndChild. - @param addThis Node to insert. - @throws Exception When TiXmlNode::InsertEndChild returns Null - - @see LinkEndChild - @see TiXmlNode::InsertEndChild - */ - Node* InsertEndChild( const Node& addThis ); - - /** - Adds a child past the LastChild. - Throws if you try to link a document. - - @param childNode Node to link. - @throws Exception When TiXmlNode::LinkEndChild returns Null. - - @see InsertEndChild - @see TiXmlNode::LinkEndChild - */ - Node* LinkEndChild( Node* childNode ); - - /** - Adds a child before the specified child. - Throws if you try to insert a document. - - @param beforeThis Node that will have @a addThis linked before. - @param addThis Node to insert before. - @throws Exception When TiXmlNode::InsertBeforeChild returns Null. - - @see InsertAfterChild - @see TiXmlNode::InsertBeforeChild - */ - Node* InsertBeforeChild( Node* beforeThis, const Node& addThis ); - - /** - Adds a child after the specified child. - Throws if you try to insert a document. - - @param afterThis Node that will have @a addThis linked after. - @param addThis Node to insert after. - @throws Exception When TiXmlNode::InsertAfterChild returns Null. - - @see InsertBeforeChild - @see TiXmlNode::InsertAfterChild - */ - Node* InsertAfterChild( Node* afterThis, const Node& addThis ); - - /** - Replace a child of this node. - Throws if you try to replace with a document. - - @param replaceThis Node to replace. - @param withThis Node that is replacing @a replaceThis. - @throws Exception When TiXmlNode::ReplaceChild returns Null. - - @see TiXmlNode::ReplaceChild - */ - Node* ReplaceChild( Node* replaceThis, const Node& withThis ); - - /** - Delete a child of this node. - - @param removeThis Node to delete. - @throws Exception When removeThis is not a child of this Node. - - @see TiXmlNode::RemoveChild - */ - void RemoveChild( Node* removeThis ); - - /** - Navigate to a sibling node. - Wrapper around TiXmlNode::PreviousSibling. - - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no siblings. - @return Pointer to sibling, Null if no siblings and 'throwIfNoSiblings' is false. - @throws Exception When TiXmlNode::PreviousSibling returns Null and 'throwIfNoSiblings' is true. - */ - Node* PreviousSibling( bool throwIfNoSiblings = true ) const; - - /** - Navigate to a sibling node with the given @a value. - - @overload - @param value The value of the node to look for. - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no siblings. - - @see PreviousSibling( bool throwIfNoSiblings ) - */ - Node* PreviousSibling( const std::string& value, bool throwIfNoSiblings = true ) const; - - /** - @internal - Navigate to a sibling node with the given @a value. - - @overload - @param value The value of the node to look for. - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no siblings. - - @see PreviousSibling( const std::string& value, bool throwIfNoSiblings ) - */ - Node* PreviousSibling( const char* value, bool throwIfNoSiblings = true ) const; - - /** - Navigate to a sibling node. - Wrapper around TiXmlNode::NextSibling. - - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no siblings. - @return Pointer to sibling, Null if no siblings and 'throwIfNoSiblings' is false. - @throws Exception When TiXmlNode::NextSibling returns Null and 'throwIfNoSiblings' is true. - */ - Node* NextSibling( bool throwIfNoSiblings = true ) const; - - /** - Navigate to a sibling node with the given @a value. - - @overload - @param value The value of the node to look for. - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no siblings. - - @see NextSibling( bool throwIfNoSiblings ) - */ - Node* NextSibling( const std::string& value, bool throwIfNoSiblings = true ) const; - - /** - @internal - Navigate to a sibling node with the given @a value. - - @overload - @param value The value of the node to look for. - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no siblings. - - @see NextSibling( const std::string& value, bool throwIfNoSiblings ) - */ - Node* NextSibling( const char* value, bool throwIfNoSiblings = true ) const; - - /** - @internal - Just for Iterator<> - - @param value The value of nodes to iterate through - @param next [OUT] The pointer to the first valid node - */ - template < class T > - void IterateFirst( const std::string& value, T** first ) const - { - *first = 0; - for( Node* child = FirstChild( value, false ); child; child = child->NextSibling( value, false ) ) - { - *first = dynamic_cast< T* >( child ); - if ( 0 != *first ) - { - return; - } - } - } - - virtual void IterateFirst( const std::string&, Attribute** ) const - { - TICPPTHROW( "Attributes can only be iterated with Elements." ) - } - - /** - @internal - Just for Iterator<> - - @param value The value of nodes to iterate through - @param next [OUT] The pointer to the next valid node - */ - template < class T > - void IterateNext( const std::string& value, T** next ) const - { - Node* sibling = NextSibling( value, false ); - *next = dynamic_cast< T* >( sibling ); - - while ( ( 0 != sibling ) && ( 0 == *next ) ) - { - sibling = sibling->NextSibling( value, false ); - *next = dynamic_cast< T* >( sibling ); - } - } - - /** - @internal - Just for Iterator<> - - @param value The value of nodes to iterate through - @param previous [OUT] The pointer to the previous valid node - */ - template < class T > - void IteratePrevious( const std::string& value, T** previous ) const - { - Node* sibling = PreviousSibling( value, false ); - *previous = dynamic_cast< T* >( sibling ); - - while ( ( 0 != sibling ) && ( 0 == *previous ) ) - { - sibling = sibling->PreviousSibling( value, false ); - *previous = dynamic_cast< T* >( sibling ); - } - } - - /** - Navigate to a sibling element. - Wrapper around TiXmlNode::NextSibling. - - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no sibling element. - @return Pointer to sibling, Null if no siblings and 'throwIfNoSiblings' is false. - @throws Exception When TiXmlNode::NextSibling returns Null and 'throwIfNoSiblings' is true. - */ - Element* NextSiblingElement( bool throwIfNoSiblings = true ) const; - - /** - Navigate to a sibling element with the given @a value. - - @overload - @param value The value of the element to look for. - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no sibling elements. - @see NextSiblingElement( bool throwIfNoSiblings ) - */ - Element* NextSiblingElement( const std::string& value, bool throwIfNoSiblings = true ) const; - - /** - @internal - Navigate to a sibling element with the given @a value. - - @overload - @param value The value of the element to look for. - @param throwIfNoSiblings [DEF] If true, will throw an exception if there are no sibling elements. - - @see NextSiblingElement( const std::string& value, bool throwIfNoSiblings ) - */ - Element* NextSiblingElement( const char* value, bool throwIfNoSiblings = true ) const; - - /** - The first child element of this node. - - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no element children. - @return Pointer to child, Null if no element children and 'throwIfNoChildren' is false. - @throws Exception When throwIfNoChildren is true, and TiXmlNode::FirstChildElement returns Null. - - @see TiXmlNode::FirstChildElement - */ - Element* FirstChildElement( bool throwIfNoChildren = true ) const; - - /** - @internal - The first child element of this node with the matching @a value. - - @overload - @param value Value to match. - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no element children. - - @see FirstChildElement( bool throwIfNoChildren = true ) - */ - Element* FirstChildElement( const char* value, bool throwIfNoChildren = true ) const; - - /** - The first child element of this node with the matching @a value. - - @overload - @param value Value to match. - @param throwIfNoChildren [DEF] If true, will throw an exception if there are no element children. - - @see FirstChildElement( const char* value, bool throwIfNoChildren = true ) - */ - Element* FirstChildElement( const std::string& value, bool throwIfNoChildren = true ) const; - - /** - Query the type (as TiXmlNode::NodeType ) of this node. - */ - int Type() const; - - /** - Return a pointer to the Document this node lives in. - - @param throwIfNoDocument [DEF] If true, will throw an exception if this node is not linked under a Document. - @return A pointer to the Document this node lives in, NULL if not linked under a Document, and 'throwIfNoDocument' is false. - @throws Exception When this node is not linked under a Document and 'throwIfNoDocument' is true. - */ - Document* GetDocument( bool throwIfNoDocument = true ) const; - - /** - Check if this node has no children. - - @return true if this node has no children. - */ - bool NoChildren() const; - - #ifndef TICPP_NO_RTTI - /** - Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc. - - @throws Exception When the target is not an object of class T - @warning Some ancient compilers do not support explicit specification of member template arguments, which this depends on ( e.g. VC6 ). - */ - template < class T > - T* To() const - { - T* pointer = dynamic_cast< T* >( this ); - if ( 0 == pointer ) - { - std::string thisType = typeid( this ).name(); - std::string targetType = typeid( T ).name(); - std::string thatType = typeid( *this ).name(); - TICPPTHROW( "The " << thisType.substr( 6 ) << " could not be casted to a " << targetType.substr( 6 ) - << " *, because the target object is not a " << targetType.substr( 6 ) << ". (It is a " << thatType.substr( 6 ) << ")" ); - } - return pointer; - } - #endif - - /** - Pointer conversion - replaces TiXmlNode::ToDocument. - - @throws Exception When this node is not a Document. - */ - Document* ToDocument() const; - - /** - Pointer conversion - replaces TiXmlNode::ToElement. - - @throws Exception When this node is not a Element. - */ - Element* ToElement() const; - - /** - Pointer conversion - replaces TiXmlNode::ToComment. - - @throws Exception When this node is not a Comment. - */ - Comment* ToComment() const; - - /** - Pointer conversion - replaces TiXmlNode::ToText. - - @throws Exception When this node is not a Text. - */ - Text* ToText() const; - - /** - Pointer conversion - replaces TiXmlNode::ToDeclaration. - - @throws Exception When this node is not a Declaration. - */ - Declaration* ToDeclaration() const; - - /** - Pointer conversion - replaces TiXmlNode::ToStylesheetReference. - - @throws Exception When this node is not a StylesheetReference. - */ - StylesheetReference* ToStylesheetReference() const; - - /** - Create an exact duplicate of this node and return it. - - @note Using unique_ptr to manage the memory declared on the heap by TiXmlNode::Clone. - @code - // Now using clone - ticpp::Document doc( "C:\\Test.xml" ); - ticpp::Node* sectionToClone; - sectionToClone = doc.FirstChild( "settings" ); - std::unique_ptr< ticpp::Node > clonedNode = sectionToClone->Clone(); - // Now you can use the clone. - ticpp::Node* node2 = clonedNode->FirstChildElement()->FirstChild(); - ... - // After the variable clonedNode goes out of scope it will automatically be cleaned up. - @endcode - @return Pointer the duplicate node. - */ - std::unique_ptr< Node > Clone() const; - - /** - Accept a hierchical visit the nodes in the TinyXML DOM. - @return The boolean returned by the visitor. - */ - bool Accept( TiXmlVisitor* visitor ) const; - - /** - Stream input operator. - */ - friend std::istream& operator >>( std::istream& in, Node& base ) - { - in >> *base.GetTiXmlPointer(); - return in; - } - - /** - Stream output operator. - */ - friend std::ostream& operator <<( std::ostream& out, const Node& base ) - { - out << *base.GetTiXmlPointer(); - return out; - } - - protected: - /** - @internal - Allows NodeImp to use Node*'s. - */ - virtual TiXmlNode* GetTiXmlPointer() const = 0; - - TiXmlBase* GetBasePointer() const - { - return GetTiXmlPointer(); - } - - /** - @internal - Constructs the correct child of Node, based on the Type of the TiXmlNode*. - */ - Node* NodeFactory( TiXmlNode* tiXmlNode, bool throwIfNull = true, bool rememberSpawnedWrapper = true ) const; - - }; - - /** Iterator for conveniently stepping through Nodes and Attributes. - TinyXML++ introduces iterators: - @code - ticpp::Iterator< ticpp::Node > child; - for ( child = child.begin( parent ); child != child.end(); child++ ) - @endcode - - Iterators have the added advantage of filtering by type: - @code - // Only iterates through Comment nodes - ticpp::Iterator< ticpp::Comment > child; - for ( child = child.begin( parent ); child != child.end(); child++ ) - @endcode - - @code - // Only iterates through Element nodes with value "ElementValue" - ticpp::Iterator< ticpp::Element > child( "ElementValue" ); - for ( child = child.begin( parent ); child != child.end(); child++ ) - @endcode - - Finally, Iterators also work with Attributes - @code - ticpp::Iterator< ticpp::Attribute > attribute; - for ( attribute = attribute.begin( element ); attribute != attribute.end(); attribute++ ) - @endcode - */ - template < class T = Node > - class Iterator - { - private: - T* m_p; /**< Internal Pointer */ - std::string m_value; /**< Value for NextSibling calls */ - - public: - - /** - For for loop comparisons. - @param parent The parent of the nodes to iterate. - @return The first child of type T. - @code - ticpp::Iterator< ticpp::Node > child; - for ( child = child.begin( parent ); child != child.end(); child++ ) - @endcode - */ - T* begin( const Node* parent ) const - { - T* pointer; - parent->IterateFirst( m_value, &pointer ); - return pointer; - } - - /** - For for loop comparisons. - @return NULL - @code - ticpp::Iterator< ticpp::Node > child; - for ( child = child.begin( parent ); child != child.end(); child++ ) - @endcode - */ - T* end() const - { - return 0; - } - - /** Constructor. - @param value If not empty, this iterator will only visit nodes with matching value. - @code - // Only iterates through Element nodes with value "ElementValue" - ticpp::Iterator< ticpp::Element > child( "ElementValue" ); - for ( child = child.begin( parent ); child != child.end(); child++ ) - @endcode - */ - Iterator( const std::string& value = "" ) - : m_p( 0 ), m_value( value ) - { - } - - /// Constructor - Iterator( T* node, const std::string& value = "" ) - : m_p( node ), m_value( value ) - { - } - - /// Constructor - Iterator( const Iterator& it ) - : m_p( it.m_p ), m_value( it.m_value ) - { - } - - /** - Gets internal pointer. - @return The internal pointer. - */ - T* Get() const - { - return m_p; - } - - /** Sets internal pointer */ - Iterator& operator=( const Iterator& it ) - { - m_p = it.m_p; - m_value = it.m_value; - return *this; - } - - /** Sets internal pointer */ - Iterator& operator=( T* p ) - { - m_p = p; - return *this; - } - - /** Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings */ - Iterator& operator++() - { - m_p->IterateNext( m_value, &m_p ); - return *this; - } - - /** Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings */ - Iterator operator++(int) - { - Iterator tmp(*this); - ++(*this); - return tmp; - } - - /** Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings */ - Iterator& operator--() - { - m_p->IteratePrevious( m_value, &m_p ); - return *this; - } - - /** Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings */ - Iterator operator--(int) - { - Iterator tmp(*this); - --(*this); - return tmp; - } - - /** Compares internal pointer */ - bool operator!=( const T* p ) const - { - if ( m_p == p ) - { - return false; - } - if ( 0 == m_p || 0 == p ) - { - return true; - } - return *m_p != *p; - } - - /** Compares internal pointer */ - bool operator!=( const Iterator& it ) const - { - return operator!=( it.m_p ); - } - - /** Compares internal pointer* */ - bool operator==( T* p ) const - { - if ( m_p == p ) - { - return true; - } - if ( 0 == m_p || 0 == p ) - { - return false; - } - return *m_p == *p; - } - - /** Compares internal pointer */ - bool operator==( const Iterator& it ) const - { - return operator==( it.m_p ); - } - - /** So Iterator behaves like a STL iterator */ - T* operator->() const - { - return m_p; - } - - /** So Iterator behaves like a STL iterator */ - T& operator*() const - { - return *m_p; - } - }; - - /** Implementation of Node wrapper */ - template < class T > - class NodeImp : public Node - { - protected: - - T* m_tiXmlPointer; /**< Internal pointer to the TiXml Class which is being wrapped */ - - /** - @internal - Gets the internal TinyXML pointer. - - @returns The internal TiXmlNode*. - */ - TiXmlNode* GetTiXmlPointer() const - { - ValidatePointer(); - return m_tiXmlPointer; - } - - /** - @internal - Sets the internal pointer. - Saves a copy of the pointer to the RC object. - - @param newPointer TiXmlNode* to set. - */ - void SetTiXmlPointer( T* newPointer ) - { - m_tiXmlPointer = newPointer; - SetImpRC( newPointer ); - } - - /** - @internal - Constructor used by child classes. - */ - NodeImp( T* tiXmlPointer ) - { - // Check for NULL pointers - if ( 0 == tiXmlPointer ) - { - #ifdef TICPP_NO_RTTI - TICPPTHROW( "Can not create TinyXML objext" ); - #else - TICPPTHROW( "Can not create a " << typeid( T ).name() ); - #endif - } - SetTiXmlPointer( tiXmlPointer ); - m_impRC->IncRef(); - } - - /** - @internal - Updates the reference count for the old and new pointers. - In addition, the spawnedWrappers must be cleared out before a new TiXml object is loaded in. - */ - virtual void operator=( const NodeImp& copy ) - { - // Dropping the reference to the old object - this->m_impRC->DecRef(); - - // Pointing to the new Object - SetTiXmlPointer( copy.m_tiXmlPointer ); - - // The internal tixml pointer changed in the above line - this->m_impRC->IncRef(); - } - - /** - @internal - Updates the reference count for the old and new pointers. - In addition, the spawnedWrappers must be cleared out before a new TiXml object is loaded in - */ - NodeImp( const NodeImp& copy ) : Node( copy ) - { - // Pointing to the new Object - SetTiXmlPointer( copy.m_tiXmlPointer ); - - // The internal tixml pointer changed in the above line - this->m_impRC->IncRef(); - } - - public: - - /* - Deletes the spawned wrapper objects. - Decrements reference count. - */ - virtual ~NodeImp() - { - m_impRC->DecRef(); - } - }; - - /** Wrapper around TiXmlComment */ - class TICPP_API Comment : public NodeImp< TiXmlComment > - { - public: - - /** - Constructor. - */ - Comment(); - - /** - Constructor. - */ - Comment( TiXmlComment* comment ); - - /** - Constructor. - */ - Comment( const std::string& comment ); - }; - - /** Wrapper around TiXmlText */ - class TICPP_API Text : public NodeImp< TiXmlText > - { - public: - - /** - Constructor. - */ - Text(); - - /** - Constructor. - @overload - */ - Text( TiXmlText* text ); - - /** - Constructor. - @overload - */ - Text( const std::string& value ); - - /** - Streams value into a string and creates a Text with it. - Uses ToString to covert the parameter to a string. - - @param value The value of the Text node. - @throws Exception - - @see TiXmlText - */ - template < class T > - Text( const T& value ) - : NodeImp< TiXmlText >( new TiXmlText( ToString( value ) ) ) - { - m_impRC->InitRef(); - } - }; - - /** Wrapper around TiXmlDocument */ - class TICPP_API Document : public NodeImp< TiXmlDocument > - { - public: - /** - Default Constructor. - Create an empty document, that has no name. - */ - Document(); - - /** - Constructor. - */ - Document( TiXmlDocument* document ); - - /** - Constructor. - */ - Document( const char* documentName ); - - /** - * Constructor. - * Create a document with a name. The name of the document is also the filename of the xml. - * @param documentName Name to set in the Document. - * @note LoadFile() needs to be called to actually load the data from the file specified by documentName - * SaveFile() needs to be called to save data to file specified by documentName. - */ - Document( const std::string& documentName ); - - /** - Load a file using the current document value. Throws if load is unsuccessful. - - @param encoding Sets the documents encoding. - @see TiXmlEncoding - @throws Exception - */ - void LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** - Save a file using the current document value. Throws if it can't save the file. - - @throws Exception - */ - void SaveFile() const; - - /** - Load a file using the given filename. Throws if load is unsuccessful. - - @param filename File to load. - @param encoding Sets the documents encoding. - @see TiXmlEncoding - @throws Exception - */ - void LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** - @copydoc Document::LoadFile( const std::string&, TiXmlEncoding ) - */ - void LoadFile( const char* filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** - Save a file using the given filename. Throws if it can't save the file. - - @param filename File to save. - @throws Exception - */ - void SaveFile( const std::string& filename ) const; - - /** - Parse the given xml data. - - @param xml Xml to parse. - @param throwIfParseError [DEF] If true, throws when there is a parse error. - @param encoding Sets the documents encoding. - @throws Exception - */ - void Parse( const std::string& xml, bool throwIfParseError = true, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - }; - - /** Wrapper around TiXmlElement */ - class TICPP_API Element : public NodeImp< TiXmlElement > - { - public: - /** - Default Constructor. - */ - Element(); - - /** - Default Constructor. Initializes all the variables. - @param value The value of the element. - */ - Element( const std::string& value ); - - /** - Default Constructor. Initializes all the variables. - @param value The value of the element. - */ - Element( const char* value ); - - /** - Constructor. - */ - Element( TiXmlElement* element ); - - /** - Constructor that allows you to set the element text - @param value The value of the element. - @param text The text to set. - */ - template < class T > - Element( const std::string& value, const T& text ) - : NodeImp< TiXmlElement >( new TiXmlElement( value ) ) - { - m_impRC->InitRef(); - SetText( text ); - } - - /** - Access the first attribute in this element. - - @param throwIfNoAttributes [DEF] If true, throws when there are no attributes - @return The first attribute, NULL if there are none and @a throwIfNoAttributes is true - */ - Attribute* FirstAttribute( bool throwIfNoAttributes = true ) const; - - /** - Access the last attribute in this element. - - @param throwIfNoAttributes [DEF] If true, throws when there are no attributes - @return The last attribute, NULL if there are none and @a throwIfNoAttributes is true - */ - Attribute* LastAttribute( bool throwIfNoAttributes = true ) const; - - /** - @internal - Just for Iterator<> - - @param value The value of nodes to iterate through - @param next [OUT] The pointer to the first valid node - */ - void IterateFirst( const std::string&, Attribute** first ) const - { - *first = 0; - for( Attribute* child = FirstAttribute( false ); child; child = child->Next( false ) ) - { - *first = dynamic_cast< Attribute* >( child ); - if ( 0 != *first ) - { - return; - } - } - } - - /** - Sets an attribute of name to a given value. - The attribute will be created if it does not exist, or changed if it does. - Uses ToString to convert the @a value to a string, so there is no need to use any other SetAttribute methods. - - @see GetAttribute - */ - template < class T > - void SetAttribute ( const std::string& name, const T& value ) - { - ValidatePointer(); - m_tiXmlPointer->SetAttribute( name, ToString( value ) ); - } - - /** - Gets the text of an Element. - - @param throwIfNotFound [DEF] If true, will throw an exception if there is no text in this element - @note This only works if the Text is the FirstChild node - @throws Exception When there is no text and throwIfNotFound is true - - @see GetText( T* value, bool throwIfNotFound = false ) - @see GetTextOrDefault - @see GetTextOrDefault( T* value, const DefaultT& defaultValue ) - @see TiXmlElement::GetText - */ - std::string GetText( bool throwIfNotFound = true ) const - { - // Get the element's text value as a std::string - std::string temp; - if ( !GetTextImp( &temp ) ) - { - if ( throwIfNotFound ) - { - TICPPTHROW( "Text does not exists in the current element" ); - } - } - - return temp; - } - - /** - Gets the text of an Element, if it doesn't exist it will return the defaultValue. - - @param defaultValue What to put in 'value' if there is no text in this element - @note This only works if the Text is the FirstChild node - - @see GetText - @see GetText( T* value, bool throwIfNotFound = false ) - @see GetTextOrDefault( T* value, const DefaultT& defaultValue ) - @see TiXmlElement::GetText - */ - std::string GetTextOrDefault( const std::string& defaultValue ) const - { - // Get the element's text value as a std::string - std::string temp; - if ( !GetTextImp( &temp ) ) - { - return defaultValue; - } - - return temp; - } - - /** - Gets the text value of an Element, if it doesn't exist it will return the defaultValue. - Uses FromString to convert the string to the type of choice - - @param value [OUT] The container for the returned value - @param defaultValue What to put in 'value' if there is no text in this element - @note This is different than GetText() in that it will covert the text to what ever type you want. - @note This only works if the Text is the FirstChild node - - @see GetText - @see GetText( T* value, bool throwIfNotFound = false ) - @see GetTextOrDefault( const std::string& defaultValue ) - @see TiXmlElement::GetText - */ - template < class T, class DefaultT > - void GetTextOrDefault( T* value, const DefaultT& defaultValue ) const - { - // Get the element's text value as a std::string - std::string temp; - if ( !GetTextImp( &temp ) ) - { - // The text value does not exist - set value to the default - *value = defaultValue; - return; - } - - // Stream the value from the string to T - FromString( temp, value ); - } - - /** - Gets the text of an Element. - Uses FromString to convert the string to the type of choice. - - @param value [OUT] The container for the returned value - @param throwIfNotFound [DEF] If true, will throw an exception if there is no text in this element - @note This is different than GetText() in that it will covert the text to what ever type you want - @note This only works if the Text is the FirstChild node - @throws Exception When there is no text and throwIfNotFound is true - - @see GetText - @see GetTextOrDefault - @see GetTextOrDefault( T* value, const DefaultT& defaultValue ) - @see TiXmlElement::GetText - */ - template< class T > - void GetText( T* value, bool throwIfNotFound = true ) const - { - // Get the element's text value as a std::string - std::string temp; - if ( !GetTextImp( &temp ) ) - { - if ( throwIfNotFound ) - { - TICPPTHROW( "Text does not exists in the current element" ); - } - else - { - return; - } - } - - // Stream the value from the string to T - FromString( temp, value ); - } - - /** - Convenience function to set the text of an element. - Creates a Text node and inserts it as the first child. - Uses ToString to convert the parameter to a string. - - @param value The text to set. - */ - template < class T > - void SetText( const T& value ) - { - ValidatePointer(); - std::string temp = ToString( value ); - - if ( m_tiXmlPointer->NoChildren() ) - { - m_tiXmlPointer->LinkEndChild( new TiXmlText( temp ) ); - } - else - { - if ( 0 == m_tiXmlPointer->GetText() ) - { - m_tiXmlPointer->InsertBeforeChild( m_tiXmlPointer->FirstChild(), TiXmlText( temp ) ); - } - else - { - // There already is text, so change it - m_tiXmlPointer->FirstChild()->SetValue( temp ); - } - } - } - - /** - Gets an attribute of @a name from an element, if it doesn't exist it will return the defaultValue. - Uses FromString to convert the string to the type of choice. - - @param name The name of the attribute you are querying. - @param value [OUT] The container for the returned value. - @param defaultValue What to put in @a value if there is no attribute in this element. - @throws Exception - - @see GetAttribute - */ - template < class T, class DefaulT > - void GetAttributeOrDefault( const std::string& name, T* value, const DefaulT& defaultValue ) const - { - // Get the attribute's value as a std::string - std::string temp; - if ( !GetAttributeImp( name, &temp ) ) - { - // The attribute does not exist - set value to the default - *value = defaultValue; - return; - } - - // Stream the value from the string to T - FromString( temp, value ); - } - - /** - Gets an attribute of @a name from an element, if it doesn't exist it will return the defaultValue. - - @param name The name of the attribute you are querying. - @param defaultValue What to put in @a value if there is no attribute in this element. - - @see GetAttribute - */ - std::string GetAttributeOrDefault( const std::string& name, const std::string& defaultValue ) const; - - /** - Returns an attribute of @a name from an element. - Uses FromString to convert the string to the type of choice. - - @param name The name of the attribute you are querying. - @param throwIfNotFound [DEF] If true, will throw an exception if the attribute doesn't exist - @throws Exception When the attribute doesn't exist and throwIfNotFound is true - @see GetAttributeOrDefault - */ - template < class T > - T GetAttribute( const std::string& name, bool throwIfNotFound = true ) const - { - // Get the attribute's value as a std::string - std::string temp; - T value; - if ( !GetAttributeImp( name, &temp ) ) - { - if ( throwIfNotFound ) - { - const std::string error( std::string( "Attribute '" ) + name + std::string( "' does not exist" ) ); - TICPPTHROW( error ); - } - } - else - { - // Stream the value from the string to T - FromString( temp, &value ); - } - - return value; - } - - /** - Gets an attribute of @a name from an element. - Uses FromString to convert the string to the type of choice. - - @param name The name of the attribute you are querying. - @param value [OUT] The container for the returned value - @param throwIfNotFound [DEF] If true, will throw an exception if the attribute doesn't exist - @throws Exception When the attribute doesn't exist and throwIfNotFound is true - - @see GetAttributeOrDefault - */ - template< class T > - void GetAttribute( const std::string& name, T* value, bool throwIfNotFound = true ) const - { - // Get the attribute's value as a std::string - std::string temp; - if ( !GetAttributeImp( name, &temp ) ) - { - if ( throwIfNotFound ) - { - const std::string error( std::string( "Attribute '" ) + name + std::string( "' does not exist" ) ); - TICPPTHROW( error ); - } - else - { - return; - } - } - - // Stream the value from the string to T - FromString( temp, value ); - } - - /** - Gets an attribute of @a name from an element. - Returns an empty string if the attribute does not exist. - - @param name The name of the attribute you are querying. - @return The value of the attribute, or an empty string if it does not exist. - - @see GetAttributeOrDefault - */ - std::string GetAttribute( const std::string& name ) const; - - /** - Returns true, if attribute exists - - @param name The name of the attribute you are checking. - @return Existence of attribute - */ - bool HasAttribute( const std::string& name ) const; - - /** - Removes attribute from element. - - @param name The name of the attribute to remove. - */ - void RemoveAttribute( const std::string& name ); - - private: - - /** - @internal - Implimentation of the GetAttribute and GetAttributeOrDefault template methods. - */ - bool GetAttributeImp( const std::string& name, std::string* value ) const; - - /** - @internal - Implimentation of the GetText, GetTextOrDefault, GetTextValue, and GetTextValueOrDefault template methods. - */ - bool GetTextImp( std::string* value ) const; - }; - - /** Wrapper around TiXmlDeclaration */ - class TICPP_API Declaration : public NodeImp< TiXmlDeclaration > - { - public: - /** - Default Constructor. Construct an empty declaration. - */ - Declaration(); - - /** - Constructor. - */ - Declaration( TiXmlDeclaration* declaration ); - - /** - Constructor. - */ - Declaration( const std::string& version, const std::string& encoding, const std::string& standalone ); - - /** - Version. Will return an empty string if none was found. - */ - std::string Version() const; - - /** - Encoding. Will return an empty string if none was found. - */ - std::string Encoding() const; - - /** - StandAlone. Is this a standalone document? - */ - std::string Standalone() const; - }; - - /** Wrapper around TiXmlStylesheetReference */ - class TICPP_API StylesheetReference : public NodeImp< TiXmlStylesheetReference > - { - public: - /** - Default Constructor. Construct an empty declaration. - */ - StylesheetReference(); - - /** - Constructor. - */ - StylesheetReference( TiXmlStylesheetReference* stylesheetReference ); - - /** - Constructor. - */ - StylesheetReference( const std::string& type, const std::string& href ); - - /** - Type. Will return an empty string if none was found. - */ - std::string Type() const; - - /** - Href. Will return an empty string if none was found. - */ - std::string Href() const; - }; -} - -#endif // TICPP_INCLUDED diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/ticppapi.h b/GLideN64/src/GLideNUI-wtl/ticpp/ticppapi.h deleted file mode 100644 index aa46b8f..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/ticppapi.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright (c) 2012 Matt Janisz - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef TICPP_API_INCLUDED -#define TICPP_API_INCLUDED - -#undef TICPP_API - -#if defined(_WIN32) | defined(WIN32) | defined(WINDOWS) | defined(_WINDOWS) - // define BUILD_TICPP_DLL when building TiCPP dll. - #ifdef BUILD_TICPP_DLL - #define TICPP_API __declspec(dllexport) - #endif - - // define TICPP_DLL when linking TiCPP dll. - #ifdef TICPP_DLL - #define TICPP_API __declspec(dllimport) - #endif - - // Disable dll-interface warning - #ifdef TICPP_API - #pragma warning( push ) - #pragma warning( disable : 4251 ) // X needs to have dll-interface to be used by clients of class Y - #pragma warning( disable : 4275 ) // X is derived from class Y but only X is exported - #endif - -#endif - -#ifndef TICPP_API - //linux or windows-static library defines - #define TICPP_API -#endif - -#endif // TICPP_API_INCLUDED diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/ticpprc.h b/GLideN64/src/GLideNUI-wtl/ticpp/ticpprc.h deleted file mode 100644 index fc1d287..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/ticpprc.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -http://code.google.com/p/ticpp/ -Copyright (c) 2006 Ryan Pusztai, Ryan Mulder - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - - /* - * THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012. - * - * - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X - */ - -#ifdef TIXML_USE_TICPP - -#ifndef TICPPRC_INCLUDED -#define TICPPRC_INCLUDED - -#include "ticppapi.h" -#include - -// Forward declare ticpp::Node, so it can be made a friend of TiCppRC -namespace ticpp -{ - class TICPP_API Base; -} - -// Forward declare TiCppRCImp so TiCppRC can hold a pointer to it -class TICPP_API TiCppRCImp; - -/** -Base class for reference counting functionality -*/ -class TICPP_API TiCppRC -{ - // Allow ticpp::Node to directly modify reference count - friend class ticpp::Base; - -private: - - TiCppRCImp* m_tiRC; /**< Pointer to reference counter */ - -public: - - /** - Constructor - Spawns new reference counter with a pointer to this - */ - TiCppRC(); - - /** - Destructor - Nullifies the pointer to this held by the reference counter - Decrements reference count - */ - virtual ~TiCppRC(); - - std::vector< ticpp::Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/ - - /** - Delete all container objects we've spawned with 'new'. - */ - void DeleteSpawnedWrappers(); -}; - -class TICPP_API TiCppRCImp -{ -private: - - int m_count; /**< Holds reference count to me, and to the node I point to */ - - TiCppRC* m_tiCppRC; /**< Holds pointer to an object inheriting TiCppRC */ - -public: - - /** - Initializes m_tiCppRC pointer, and set reference count to 1 - */ - TiCppRCImp( TiCppRC* tiCppRC ); - - /** - Allows the TiCppRC object to set the pointer to itself ( m_tiCppRc ) to NULL when the TiCppRC object is deleted - */ - void Nullify(); - - /** - Increment Reference Count - */ - void IncRef(); - - /** - Decrement Reference Count - */ - void DecRef(); - - /** - Set Reference Count to 1 - dangerous! - Use only if you are sure of the consequences - */ - void InitRef(); - - /** - Get internal pointer to the TiCppRC object - not reference counted, use at your own risk - */ - TiCppRC* Get(); - - /** - Returns state of internal pointer - will be null if the object was deleted - */ - bool IsNull(); -}; - -#endif // TICPP_INCLUDED - -#endif // TIXML_USE_TICPP diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/tinystr.cpp b/GLideN64/src/GLideNUI-wtl/ticpp/tinystr.cpp deleted file mode 100644 index 6812507..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/tinystr.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original file by Yves Berquin. - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -/* - * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005. - */ - - -#ifndef TIXML_USE_STL - -#include "tinystr.h" - -// Error value for find primitive -const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); - - -// Null rep. -TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; - - -void TiXmlString::reserve (size_type cap) -{ - if (cap > capacity()) - { - TiXmlString tmp; - tmp.init(length(), cap); - memcpy(tmp.start(), data(), length()); - swap(tmp); - } -} - - -TiXmlString& TiXmlString::assign(const char* str, size_type len) -{ - size_type cap = capacity(); - if (len > cap || cap > 3*(len + 8)) - { - TiXmlString tmp; - tmp.init(len); - memcpy(tmp.start(), str, len); - swap(tmp); - } - else - { - memmove(start(), str, len); - set_size(len); - } - return *this; -} - - -TiXmlString& TiXmlString::append(const char* str, size_type len) -{ - size_type newsize = length() + len; - if (newsize > capacity()) - { - reserve (newsize + capacity()); - } - memmove(finish(), str, len); - set_size(newsize); - return *this; -} - - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) -{ - TiXmlString tmp; - tmp.reserve(a.length() + b.length()); - tmp += a; - tmp += b; - return tmp; -} - -TiXmlString operator + (const TiXmlString & a, const char* b) -{ - TiXmlString tmp; - TiXmlString::size_type b_len = static_cast( strlen(b) ); - tmp.reserve(a.length() + b_len); - tmp += a; - tmp.append(b, b_len); - return tmp; -} - -TiXmlString operator + (const char* a, const TiXmlString & b) -{ - TiXmlString tmp; - TiXmlString::size_type a_len = static_cast( strlen(a) ); - tmp.reserve(a_len + b.length()); - tmp.append(a, a_len); - tmp += b; - return tmp; -} - - -#endif // TIXML_USE_STL diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/tinystr.h b/GLideN64/src/GLideNUI-wtl/ticpp/tinystr.h deleted file mode 100644 index 83117dc..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/tinystr.h +++ /dev/null @@ -1,326 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original file by Yves Berquin. - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -/* - * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005. - * - * - completely rewritten. compact, clean, and fast implementation. - * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems) - * - fixed reserve() to work as per specification. - * - fixed buggy compares operator==(), operator<(), and operator>() - * - fixed operator+=() to take a const ref argument, following spec. - * - added "copy" constructor with length, and most compare operators. - * - added swap(), clear(), size(), capacity(), operator+(). - */ - - /* - * THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012. - * - * - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X - */ - -#ifndef TIXML_USE_STL - -#ifndef TIXML_STRING_INCLUDED -#define TIXML_STRING_INCLUDED - -#include "ticppapi.h" -#include -#include - -/* The support for explicit isn't that universal, and it isn't really - required - it is used to check that the TiXmlString class isn't incorrectly - used. Be nice to old compilers and macro it here: -*/ -#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - #define TIXML_EXPLICIT explicit -#elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - #define TIXML_EXPLICIT explicit -#else - #define TIXML_EXPLICIT -#endif - - -/* - TiXmlString is an emulation of a subset of the std::string template. - Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. - Only the member functions relevant to the TinyXML project have been implemented. - The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase - a string and there's no more room, we allocate a buffer twice as big as we need. -*/ -class TICPP_API TiXmlString -{ - public : - // The size type used - typedef size_t size_type; - - // Error value for find primitive - static const size_type npos; // = -1; - - - // TiXmlString empty constructor - TiXmlString () : rep_(&nullrep_) - { - } - - // TiXmlString copy constructor - TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast( strlen(copy) )); - memcpy(start(), copy, length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } - - // TiXmlString destructor - ~TiXmlString () - { - quit(); - } - - // = operator - TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } - - // = operator - TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } - - - // += operator. Maps to append - TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast( strlen(suffix) )); - } - - // += operator. Maps to append - TiXmlString& operator += (char single) - { - return append(&single, 1); - } - - // += operator. Maps to append - TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } - - - // Convert a TiXmlString into a null-terminated char * - const char * c_str () const { return rep_->str; } - - // Convert a TiXmlString into a char * (need not be null terminated). - const char * data () const { return rep_->str; } - - // Return the length of a TiXmlString - size_type length () const { return rep_->size; } - - // Alias for length() - size_type size () const { return rep_->size; } - - // Checks if a TiXmlString is empty - bool empty () const { return rep_->size == 0; } - - // Return capacity of string - size_type capacity () const { return rep_->capacity; } - - - // single char extraction - const char& at (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // [] operator - char& operator [] (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // find a char in a string. Return TiXmlString::npos if not found - size_type find (char lookup) const - { - return find(lookup, 0); - } - - // find a char in a string from an offset. Return TiXmlString::npos if not found - size_type find (char tofind, size_type offset) const - { - if (offset >= length()) return npos; - - for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } - return npos; - } - - void clear () - { - //Lee: - //The original was just too strange, though correct: - // TiXmlString().swap(*this); - //Instead use the quit & re-init: - quit(); - init(0,0); - } - - /* Function to reserve a big amount of data when we know we'll need it. Be aware that this - function DOES NOT clear the content of the TiXmlString if any exists. - */ - void reserve (size_type cap); - - TiXmlString& assign (const char* str, size_type len); - - TiXmlString& append (const char* str, size_type len); - - void swap (TiXmlString& other) - { - Rep* r = rep_; - rep_ = other.rep_; - other.rep_ = r; - } - - private: - - void init(size_type sz) { init(sz, sz); } - void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } - char* start() const { return rep_->str; } - char* finish() const { return rep_->str + rep_->size; } - - struct Rep - { - size_type size, capacity; - char str[1]; - }; - - void init(size_type sz, size_type cap) - { - if (cap) - { - // Lee: the original form: - // rep_ = static_cast(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } - else - { - rep_ = &nullrep_; - } - } - - void quit() - { - if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast( rep_ ) ); - } - } - - Rep * rep_; - static Rep nullrep_; - -} ; - - -inline bool operator == (const TiXmlString & a, const TiXmlString & b) -{ - return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare -} -inline bool operator < (const TiXmlString & a, const TiXmlString & b) -{ - return strcmp(a.c_str(), b.c_str()) < 0; -} - -inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } -inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } -inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } -inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } - -inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } -inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } -inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } -inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); -TiXmlString operator + (const TiXmlString & a, const char* b); -TiXmlString operator + (const char* a, const TiXmlString & b); - - -/* - TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. - Only the operators that we need for TinyXML have been developped. -*/ -class TICPP_API TiXmlOutStream : public TiXmlString -{ -public : - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } - -} ; - -#endif // TIXML_STRING_INCLUDED -#endif // TIXML_USE_STL diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/tinyxml.cpp b/GLideN64/src/GLideNUI-wtl/ticpp/tinyxml.cpp deleted file mode 100644 index 5b1bc4b..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/tinyxml.cpp +++ /dev/null @@ -1,1969 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ -#include "tinyxml.h" - -#include -#include - -#ifdef TIXML_USE_STL -#include -#include -#endif - - -bool TiXmlBase::condenseWhiteSpace = true; - -// Microsoft compiler security -FILE* TiXmlFOpen( const char* filename, const char* mode ) -{ - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filename, mode ); - if ( !err && fp ) - return fp; - return 0; - #else - return fopen( filename, mode ); - #endif -} - -void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) -{ - int i=0; - - while( i<(int)str.length() ) - { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) - { - // Hexadecimal character reference. - // Pass through unchanged. - // © -- copyright symbol, for example. - // - // The -1 is a bug fix from Rob Laveaux. It keeps - // an overflow from happening if there is no ';'. - // There are actually 2 ways to exit this loop - - // while fails (error case) and break (semicolon found). - // However, there is no mechanism (currently) for - // this function to return an error. - while ( i<(int)str.length()-1 ) - { - outString->append( str.c_str() + i, 1 ); - ++i; - if ( str[i] == ';' ) - break; - } - } - else if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); - #else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif - - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } - } -} - -TiXmlNode::TiXmlNode(NodeType _type) { - parent = 0; - type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; -} - - -TiXmlNode::~TiXmlNode() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } -} - - -void TiXmlNode::CopyTo( TiXmlNode* target ) const -{ - target->SetValue (value.c_str() ); - target->userData = userData; -} - - -void TiXmlNode::Clear() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } - - firstChild = 0; - lastChild = 0; -} - - -TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) -{ - assert( node->parent == 0 || node->parent == this ); - assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); - - if ( node->Type() == TiXmlNode::DOCUMENT ) - { - delete node; - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - node->parent = this; - - node->prev = lastChild; - node->next = 0; - - if ( lastChild ) - lastChild->next = node; - else - firstChild = node; // it was an empty list. - - lastChild = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) -{ - if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - - return LinkEndChild( node ); -} - - -TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ - if ( !beforeThis || beforeThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->next = beforeThis; - node->prev = beforeThis->prev; - if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } - else - { - assert( firstChild == beforeThis ); - firstChild = node; - } - beforeThis->prev = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) -{ - if ( !afterThis || afterThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->prev = afterThis; - node->next = afterThis->next; - if ( afterThis->next ) - { - afterThis->next->prev = node; - } - else - { - assert( lastChild == afterThis ); - lastChild = node; - } - afterThis->next = node; - return node; -} - - -TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) -{ - if ( replaceThis->parent != this ) - return 0; - - TiXmlNode* node = withThis.Clone(); - if ( !node ) - return 0; - - node->next = replaceThis->next; - node->prev = replaceThis->prev; - - if ( replaceThis->next ) - replaceThis->next->prev = node; - else - lastChild = node; - - if ( replaceThis->prev ) - replaceThis->prev->next = node; - else - firstChild = node; - - delete replaceThis; - node->parent = this; - return node; -} - - -bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) -{ - if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } - - if ( removeThis->next ) - removeThis->next->prev = removeThis->prev; - else - lastChild = removeThis->prev; - - if ( removeThis->prev ) - removeThis->prev->next = removeThis->next; - else - firstChild = removeThis->next; - - delete removeThis; - return true; -} - -const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild(); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild( val ); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } -} - - -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -void TiXmlElement::RemoveAttribute( const char * name ) -{ - #ifdef TIXML_USE_STL - TIXML_STRING str( name ); - TiXmlAttribute* node = attributeSet.Find( str ); - #else - TiXmlAttribute* node = attributeSet.Find( name ); - #endif - if ( node ) - { - attributeSet.Remove( node ); - delete node; - } -} - -const TiXmlElement* TiXmlNode::FirstChildElement() const -{ - const TiXmlNode* node; - - for ( node = FirstChild(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = FirstChild( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement() const -{ - const TiXmlNode* node; - - for ( node = NextSibling(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = NextSibling( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlDocument* TiXmlNode::GetDocument() const -{ - const TiXmlNode* node; - - for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - return node->ToDocument(); - } - return 0; -} - - -TiXmlElement::TiXmlElement (const char * _value) - : TiXmlNode( TiXmlNode::ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} - - -#ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) - : TiXmlNode( TiXmlNode::ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} -#endif - - -TiXmlElement::TiXmlElement( const TiXmlElement& copy) - : TiXmlNode( TiXmlNode::ELEMENT ) -{ - firstChild = lastChild = 0; - copy.CopyTo( this ); -} - - -void TiXmlElement::operator=( const TiXmlElement& base ) -{ - ClearThis(); - base.CopyTo( this ); -} - - -TiXmlElement::~TiXmlElement() -{ - ClearThis(); -} - - -void TiXmlElement::ClearThis() -{ - Clear(); - while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } -} - - -const char* TiXmlElement::Attribute( const char* name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - return node->Value(); - return 0; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - return &node->ValueStr(); - return 0; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, int* i ) const -{ - const char* s = Attribute( name ); - if ( i ) - { - if ( s ) { - *i = atoi( s ); - } - else { - *i = 0; - } - } - return s; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const -{ - const std::string* s = Attribute( name ); - if ( i ) - { - if ( s ) { - *i = atoi( s->c_str() ); - } - else { - *i = 0; - } - } - return s; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, double* d ) const -{ - const char* s = Attribute( name ); - if ( d ) - { - if ( s ) { - *d = atof( s ); - } - else { - *d = 0; - } - } - return s; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const -{ - const std::string* s = Attribute( name ); - if ( d ) - { - if ( s ) { - *d = atof( s->c_str() ); - } - else { - *d = 0; - } - } - return s; -} -#endif - - -int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - return node->QueryIntValue( ival ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - return node->QueryIntValue( ival ); -} -#endif - - -int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - return node->QueryDoubleValue( dval ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - return node->QueryDoubleValue( dval ); -} -#endif - - -void TiXmlElement::SetAttribute( const char * name, int val ) -{ - char buf[64]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%d", val ); - #else - sprintf( buf, "%d", val ); - #endif - SetAttribute( name, buf ); -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ - std::ostringstream oss; - oss << val; - SetAttribute( name, oss.str() ); -} -#endif - - -void TiXmlElement::SetDoubleAttribute( const char * name, double val ) -{ - char buf[256]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%f", val ); - #else - sprintf( buf, "%f", val ); - #endif - SetAttribute( name, buf ); -} - - -void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) -{ - #ifdef TIXML_USE_STL - TIXML_STRING _name( cname ); - TIXML_STRING _value( cvalue ); - #else - const char* _name = cname; - const char* _value = cvalue; - #endif - - TiXmlAttribute* node = attributeSet.Find( _name ); - if ( node ) - { - node->SetValue( _value ); - return; - } - - TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue ); - if ( attrib ) - { - attributeSet.Add( attrib ); - } - else - { - TiXmlDocument* document = GetDocument(); - if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, const std::string& _value ) -{ - TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - { - node->SetValue( _value ); - return; - } - - TiXmlAttribute* attrib = new TiXmlAttribute( name, _value ); - if ( attrib ) - { - attributeSet.Add( attrib ); - } - else - { - TiXmlDocument* document = GetDocument(); - if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } -} -#endif - - -void TiXmlElement::Print( FILE* cfile, int depth ) const -{ - int i; - assert( cfile ); - for ( i=0; iNext() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } - - // There are 3 different formatting approaches: - // 1) An element without children is printed as a node - // 2) An element with only a text child is printed as text - // 3) An element with children is printed on multiple lines. - TiXmlNode* node; - if ( !firstChild ) - { - fprintf( cfile, " />" ); - } - else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "", value.c_str() ); - } - else - { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - node->Print( cfile, depth+1 ); - } - fprintf( cfile, "\n" ); - for( i=0; i", value.c_str() ); - } -} - - -void TiXmlElement::CopyTo( TiXmlElement* target ) const -{ - // superclass: - TiXmlNode::CopyTo( target ); - - // Element class: - // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; - for( attribute = attributeSet.First(); - attribute; - attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - -bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -TiXmlNode* TiXmlElement::Clone() const -{ - TiXmlElement* clone = new TiXmlElement( Value() ); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -const char* TiXmlElement::GetText() const -{ - const TiXmlNode* child = this->FirstChild(); - if ( child ) { - const TiXmlText* childText = child->ToText(); - if ( childText ) { - return childText->Value(); - } - } - return 0; -} - - -TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - ClearError(); -} - -TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} - - -#ifdef TIXML_USE_STL -TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} -#endif - - -TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT ) -{ - copy.CopyTo( this ); -} - - -void TiXmlDocument::operator=( const TiXmlDocument& copy ) -{ - Clear(); - copy.CopyTo( this ); -} - - -bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) -{ - // See STL_STRING_BUG below. - //StringToBuffer buf( value ); - - return LoadFile( Value(), encoding ); -} - - -bool TiXmlDocument::SaveFile() const -{ - // See STL_STRING_BUG below. -// StringToBuffer buf( value ); -// -// if ( buf.buffer && SaveFile( buf.buffer ) ) -// return true; -// -// return false; - return SaveFile( Value() ); -} - -bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) -{ - // There was a really terrifying little bug here. The code: - // value = filename - // in the STL case, cause the assignment method of the std::string to - // be called. What is strange, is that the std::string had the same - // address as it's c_str() method, and so bad things happen. Looks - // like a bug in the Microsoft STL implementation. - // Add an extra string to avoid the crash. - TIXML_STRING filename( _filename ); - value = filename; - - // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = TiXmlFOpen( value.c_str (), "rb" ); - - if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } - else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } -} - -bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) -{ - if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Delete the existing data: - Clear(); - location.Clear(); - - // Get the file size, so we can pre-allocate the string. HUGE speed impact. - long length = 0; - fseek( file, 0, SEEK_END ); - length = ftell( file ); - fseek( file, 0, SEEK_SET ); - - // Strange case, but good to handle up front. - if ( length <= 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // If we have a file, assume it is all one big XML file, and read it in. - // The document parser may decide the document ends sooner than the entire file, however. - TIXML_STRING data; - data.reserve( length ); - - // Subtle bug here. TinyXml did use fgets. But from the XML spec: - // 2.11 End-of-Line Handling - // - // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to - // a single #xA character. - // - // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. - // Generally, you expect fgets to translate from the convention of the OS to the c/unix - // convention, and not work generally. - - /* - while( fgets( buf, sizeof(buf), file ) ) - { - data += buf; - } - */ - - char* buf = new char[ length+1 ]; - buf[0] = 0; - - if ( fread( buf, length, 1, file ) != 1 ) { - delete [] buf; - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - const char* lastPos = buf; - const char* p = buf; - - buf[length] = 0; - while( *p ) { - assert( p < (buf+length) ); - if ( *p == 0xa ) { - // Newline character. No special rules for this. Append all the characters - // since the last string, and include the newline. - data.append( lastPos, (p-lastPos+1) ); // append, include the newline - ++p; // move past the newline - lastPos = p; // and point to the new buffer (may be 0) - assert( p <= (buf+length) ); - } - else if ( *p == 0xd ) { - // Carriage return. Append what we have so far, then - // handle moving forward in the buffer. - if ( (p-lastPos) > 0 ) { - data.append( lastPos, p-lastPos ); // do not add the CR - } - data += (char)0xa; // a proper newline - - if ( *(p+1) == 0xa ) { - // Carriage return - new line sequence - p += 2; - lastPos = p; - assert( p <= (buf+length) ); - } - else { - // it was followed by something else...that is presumably characters again. - ++p; - lastPos = p; - assert( p <= (buf+length) ); - } - } - else { - ++p; - } - } - // Handle any left over characters. - if ( p-lastPos ) { - data.append( lastPos, p-lastPos ); - } - delete [] buf; - buf = 0; - - Parse( data.c_str(), 0, encoding ); - - if ( Error() ) - return false; - else - return true; -} - - -bool TiXmlDocument::SaveFile( const char * filename ) const -{ - // The old c stuff lives on... - FILE* fp = TiXmlFOpen( filename, "w" ); - if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } - return false; -} - - -bool TiXmlDocument::SaveFile( FILE* fp ) const -{ - if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } - Print( fp, 0 ); - return (ferror(fp) == 0); -} - - -void TiXmlDocument::CopyTo( TiXmlDocument* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->error = error; - target->errorId = errorId; - target->errorDesc = errorDesc; - target->tabsize = tabsize; - target->errorLocation = errorLocation; - target->useMicrosoftBOM = useMicrosoftBOM; - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - - -TiXmlNode* TiXmlDocument::Clone() const -{ - TiXmlDocument* clone = new TiXmlDocument(); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlDocument::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } -} - - -bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -const TiXmlAttribute* TiXmlAttribute::Next() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} - -/* -TiXmlAttribute* TiXmlAttribute::Next() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} -*/ - -const TiXmlAttribute* TiXmlAttribute::Previous() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} - -/* -TiXmlAttribute* TiXmlAttribute::Previous() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} -*/ - -void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - TIXML_STRING n, v; - - EncodeString( name, &n ); - EncodeString( value, &v ); - - if (value.find ('\"') == TIXML_STRING::npos) { - if ( cfile ) { - fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; - } - } - else { - if ( cfile ) { - fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; - } - } -} - - -int TiXmlAttribute::QueryIntValue( int* ival ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -int TiXmlAttribute::QueryDoubleValue( double* dval ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -void TiXmlAttribute::SetIntValue( int _value ) -{ - char buf [64]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); - #else - sprintf (buf, "%d", _value); - #endif - SetValue (buf); -} - -void TiXmlAttribute::SetDoubleValue( double _value ) -{ - char buf [256]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value); - #else - sprintf (buf, "%lf", _value); - #endif - SetValue (buf); -} - -int TiXmlAttribute::IntValue() const -{ - return atoi (value.c_str ()); -} - -double TiXmlAttribute::DoubleValue() const -{ - return atof (value.c_str ()); -} - - -TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT ) -{ - copy.CopyTo( this ); -} - - -void TiXmlComment::operator=( const TiXmlComment& base ) -{ - Clear(); - base.CopyTo( this ); -} - - -void TiXmlComment::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlComment::CopyTo( TiXmlComment* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlComment::Clone() const -{ - TiXmlComment* clone = new TiXmlComment(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlText::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - for ( i=0; i\n", value.c_str() ); // unformatted output - } - else - { - TIXML_STRING buffer; - EncodeString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } -} - - -void TiXmlText::CopyTo( TiXmlText* target ) const -{ - TiXmlNode::CopyTo( target ); - target->cdata = cdata; -} - - -bool TiXmlText::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlText::Clone() const -{ - TiXmlText* clone = 0; - clone = new TiXmlText( "" ); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlDeclaration::TiXmlDeclaration( const char * _version, - const char * _encoding, - const char * _standalone ) - : TiXmlNode( TiXmlNode::DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} - - -#ifdef TIXML_USE_STL -TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ) - : TiXmlNode( TiXmlNode::DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} -#endif - - -TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) - : TiXmlNode( TiXmlNode::DECLARATION ) -{ - copy.CopyTo( this ); -} - - -void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) -{ - Clear(); - copy.CopyTo( this ); -} - - -void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) fprintf( cfile, "" ); - if ( str ) (*str) += "?>"; -} - - -void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->version = version; - target->encoding = encoding; - target->standalone = standalone; -} - - -bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlDeclaration::Clone() const -{ - TiXmlDeclaration* clone = new TiXmlDeclaration(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - -TiXmlStylesheetReference::TiXmlStylesheetReference( const char * _type, - const char * _href ) - : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE ) -{ - type = _type; - href = _href; -} - - -#ifdef TIXML_USE_STL -TiXmlStylesheetReference::TiXmlStylesheetReference( const std::string& _type, - const std::string& _href ) - : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE ) -{ - type = _type; - href = _href; -} -#endif - - -TiXmlStylesheetReference::TiXmlStylesheetReference( const TiXmlStylesheetReference& copy ) - : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE ) -{ - copy.CopyTo( this ); -} - - -void TiXmlStylesheetReference::operator=( const TiXmlStylesheetReference& copy ) -{ - Clear(); - copy.CopyTo( this ); -} - - -void TiXmlStylesheetReference::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) fprintf( cfile, ""); - if ( str ) (*str) += "?>"; -} - -void TiXmlStylesheetReference::CopyTo( TiXmlStylesheetReference* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->type = type; - target->href = href; -} - -bool TiXmlStylesheetReference::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - -TiXmlNode* TiXmlStylesheetReference::Clone() const -{ - TiXmlStylesheetReference* clone = new TiXmlStylesheetReference(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlUnknown::Print( FILE* cfile, int depth ) const -{ - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlUnknown::Clone() const -{ - TiXmlUnknown* clone = new TiXmlUnknown(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlAttributeSet::TiXmlAttributeSet() -{ - sentinel.next = &sentinel; - sentinel.prev = &sentinel; -} - - -TiXmlAttributeSet::~TiXmlAttributeSet() -{ - assert( sentinel.next == &sentinel ); - assert( sentinel.prev == &sentinel ); -} - - -void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) -{ - #ifdef TIXML_USE_STL - assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. - #else - assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. - #endif - - addMe->next = &sentinel; - addMe->prev = sentinel.prev; - - sentinel.prev->next = addMe; - sentinel.prev = addMe; -} - -void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) -{ - assert(removeMe); - TiXmlAttribute* node; - - for( node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } - } - assert( 0 ); // we tried to remove a non-linked attribute. -} - - -#ifdef TIXML_USE_STL -const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const -{ - for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } - return 0; -} - -/* -TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } - return 0; -} -*/ -#endif - - -const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const -{ - for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } - return 0; -} - -/* -TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } - return 0; -} -*/ - -#ifdef TIXML_USE_STL -std::istream& operator>> (std::istream & in, TiXmlNode & base) -{ - TIXML_STRING tag; - tag.reserve( 8 * 1000 ); - base.StreamIn( &in, &tag ); - - base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); - return in; -} -#endif - - -#ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out << printer.Str(); - - return out; -} - - -std::string& operator<< (std::string& out, const TiXmlNode& base ) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out.append( printer.Str() ); - - return out; -} -#endif - - -TiXmlHandle TiXmlHandle::FirstChild() const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement() const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild(); - for ( i=0; - child && iNextSibling(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild( value ); - for ( i=0; - child && iNextSibling( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement(); - for ( i=0; - child && iNextSiblingElement(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement( value ); - for ( i=0; - child && iNextSiblingElement( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) -{ - DoIndent(); - buffer += "<"; - buffer += element.Value(); - - for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } - - if ( !element.FirstChild() ) - { - buffer += " />"; - DoLineBreak(); - } - else - { - buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } - } - ++depth; - return true; -} - - -bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) -{ - --depth; - if ( !element.FirstChild() ) - { - // nothing. - } - else - { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - buffer += ""; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlText& text ) -{ - if ( text.CDATA() ) - { - DoIndent(); - buffer += ""; - DoLineBreak(); - } - else if ( simpleTextPrint ) - { - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - } - else - { - DoIndent(); - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) -{ - DoIndent(); - declaration.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlComment& comment ) -{ - DoIndent(); - buffer += ""; - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) -{ - DoIndent(); - buffer += "<"; - buffer += unknown.Value(); - buffer += ">"; - DoLineBreak(); - return true; -} - -bool TiXmlPrinter::Visit( const TiXmlStylesheetReference& stylesheet ) -{ - DoIndent(); - stylesheet.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} diff --git a/GLideN64/src/GLideNUI-wtl/ticpp/tinyxml.h b/GLideN64/src/GLideNUI-wtl/ticpp/tinyxml.h deleted file mode 100644 index bf2c7f8..0000000 --- a/GLideN64/src/GLideNUI-wtl/ticpp/tinyxml.h +++ /dev/null @@ -1,1889 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - /* - * THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012. - * - * - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X - */ - -#ifndef TINYXML_INCLUDED -#define TINYXML_INCLUDED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4530 ) -#pragma warning( disable : 4786 ) -#endif - -#include "ticppapi.h" -#include -#include -#include -#include - -// Help out windows: -#if defined( _DEBUG ) && !defined( DEBUG ) -#define DEBUG -#endif - -#ifdef TIXML_USE_TICPP - #ifndef TIXML_USE_STL - #define TIXML_USE_STL - #endif -#endif - -#ifdef TIXML_USE_STL - #include - #include - #include - #define TIXML_STRING std::string -#else - #include "tinystr.h" - #define TIXML_STRING TiXmlString -#endif - -// Deprecated library function hell. Compilers want to use the -// new safe versions. This probably doesn't fully address the problem, -// but it gets closer. There are too many compilers for me to fully -// test. If you get compilation troubles, undefine TIXML_SAFE -#define TIXML_SAFE - -#ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SNSCANF _snscanf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SNSCANF _snscanf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SNSCANF snscanf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SSCANF sscanf - #endif -#endif - -class TICPP_API TiXmlDocument; -class TICPP_API TiXmlElement; -class TICPP_API TiXmlComment; -class TICPP_API TiXmlUnknown; -class TICPP_API TiXmlAttribute; -class TICPP_API TiXmlText; -class TICPP_API TiXmlDeclaration; -class TICPP_API TiXmlStylesheetReference; -class TICPP_API TiXmlParsingData; - -const int TIXML_MAJOR_VERSION = 2; -const int TIXML_MINOR_VERSION = 5; -const int TIXML_PATCH_VERSION = 3; - -/* Internal structure for tracking location of items - in the XML file. -*/ -struct TICPP_API TiXmlCursor -{ - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } - - int row; // 0 based. - int col; // 0 based. -}; - - -/** - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simple called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - - You should never change the document from a callback. - - @sa TiXmlNode::Accept() -*/ -class TICPP_API TiXmlVisitor -{ -public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a stylesheet reference - virtual bool Visit( const TiXmlStylesheetReference& /*stylesheet*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknow node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } -}; - -// Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE -}; - - -// Used by the parsing routines. -enum TiXmlEncoding -{ - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY -}; - -const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; - -/** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. - - In XML, the document and elements can contain - other elements and other types of nodes. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - A Decleration contains: Attributes (not on tree) - @endverbatim -*/ -#ifdef TIXML_USE_TICPP -#include "ticpprc.h" -class TICPP_API TiXmlBase : public TiCppRC -#else -class TICPP_API TiXmlBase -#endif -{ - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; - -public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() - - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_OUT_OF_MEMORY, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; - -protected: - - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } - - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - - TiXmlCursor location; - - /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - -private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; -}; - - -/** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. -*/ -class TICPP_API TiXmlNode : public TiXmlBase -{ - friend class TiXmlDocument; - friend class TiXmlElement; - -public: - #ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - - #endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - DOCUMENT, - ELEMENT, - COMMENT, - UNKNOWN, - TEXT, - DECLARATION, - STYLESHEETREFERENCE, - TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } - - #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif - - const TIXML_STRING& ValueTStr() const { return value; } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } - - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } - - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif - - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - - - /** Add a new node related to this. Adds a child past the LastChild. - - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. - - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: DOCUMENT, ELEMENT, COMMENT, - UNKNOWN, TEXT, and DECLARATION. - */ - int Type() const { return type; } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } - - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } - - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlStylesheetReference* ToStylesheetReference() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlStylesheetReference* ToStylesheetReference() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; - - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. - - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; - -protected: - TiXmlNode( NodeType _type ); - - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; - - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif - - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - - TiXmlNode* parent; - NodeType type; - - TiXmlNode* firstChild; - TiXmlNode* lastChild; - - TIXML_STRING value; - - TiXmlNode* prev; - TiXmlNode* next; - -private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. -*/ -class TICPP_API TiXmlAttribute : public TiXmlBase -{ - friend class TiXmlAttributeSet; - -public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } - - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } - - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } - - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } - -private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; -}; - - -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. - - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. -*/ -class TICPP_API TiXmlAttributeSet -{ -public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); - - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); - - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - - const TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* Find( const char* _name ) { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); - } - #ifdef TIXML_USE_STL - const TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* Find( const std::string& _name ) { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); - } - - #endif - -private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - - TiXmlAttribute sentinel; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TICPP_API TiXmlElement : public TiXmlNode -{ -public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - void operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } - - #ifdef TIXML_USE_STL - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types. - - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } - /* - This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string" - but template specialization is hard to get working cross-compiler. Leaving the bug for now. - - // The above will fail for std::string because the space character is used as a seperator. - // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string - template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - */ - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); - - #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); - #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif - - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well - - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - -private: - - TiXmlAttributeSet attributeSet; -}; - - -/** An XML comment. -*/ -class TICPP_API TiXmlComment : public TiXmlNode -{ -public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - void operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlComment* target ) const; - - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; - -private: - -}; - - -/** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). -*/ -class TICPP_API TiXmlText : public TiXmlNode -{ - friend class TiXmlElement; -public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif - - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); } - void operator=( const TiXmlText& base ) { base.CopyTo( this ); } - - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; - - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - bool cdata; // true if this should be input and output as a CDATA style text element -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. -*/ -class TICPP_API TiXmlDeclaration : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); -#endif - - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - void operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; -}; - -/** A stylesheet reference looks like this: - @verbatim - - @endverbatim - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 2 and they are always the same. -*/ -class TICPP_API TiXmlStylesheetReference : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlStylesheetReference() : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlStylesheetReference( const std::string& _type, - const std::string& _href ); -#endif - - /// Construct. - TiXmlStylesheetReference( const char* _type, - const char* _href ); - - TiXmlStylesheetReference( const TiXmlStylesheetReference& copy ); - void operator=( const TiXmlStylesheetReference& copy ); - - virtual ~TiXmlStylesheetReference() {} - - /// Type. Will return an empty string if none was found. - const char *Type() const { return type.c_str (); } - /// Href. Will return an empty string if none was found. - const char *Href() const { return href.c_str (); } - - /// Creates a copy of this StylesheetReference and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlStylesheetReference* ToStylesheetReference() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlStylesheetReference* ToStylesheetReference() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlStylesheetReference* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - - TIXML_STRING type; - TIXML_STRING href; -}; - -/** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into TiXmlUnknowns. -*/ -class TICPP_API TiXmlUnknown : public TiXmlNode -{ -public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {} - virtual ~TiXmlUnknown() {} - - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); } - void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); } - - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected: - void CopyTo( TiXmlUnknown* target ) const; - - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - -}; - - -/** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. -*/ -class TICPP_API TiXmlDocument : public TiXmlNode -{ -public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif - - TiXmlDocument( const TiXmlDocument& copy ); - void operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { -// StringToBuffer f( filename ); -// return ( f.buffer && LoadFile( f.buffer, encoding )); - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { -// StringToBuffer f( filename ); -// return ( f.buffer && SaveFile( f.buffer )); - return SaveFile( filename.c_str() ); - } - #endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } - - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - - int TabSize() const { return tabsize; } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. -}; - - -/** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim - - What they should not be used for is iteration: - - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim - - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: - - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim -*/ -class TICPP_API TiXmlHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } - -private: - TiXmlNode* node; -}; - - -/** Print to memory functionality. The TiXmlPrinter is useful when you need to: - - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) - - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. - - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); - - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim -*/ -class TICPP_API TiXmlPrinter : public TiXmlVisitor -{ -public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - virtual bool Visit( const TiXmlStylesheetReference& stylesheet ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } - - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif - -private: - void DoIndent() { - for( int i=0; i - -//#define DEBUG_PARSER -#if defined( DEBUG_PARSER ) -# if defined( DEBUG ) && defined( _MSC_VER ) -# include -# define TIXML_LOG OutputDebugString -# else -# define TIXML_LOG printf -# endif -#endif - -// Note tha "PutString" hardcodes the same list. This -// is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = -{ - { "&", 5, '&' }, - { "<", 4, '<' }, - { ">", 4, '>' }, - { """, 6, '\"' }, - { "'", 6, '\'' } -}; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// Including the basic of this table, which determines the #bytes in the -// sequence from the lead byte. 1 placed for invalid sequences -- -// although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: -// ef bb bf (Microsoft "lead bytes") -// ef bf be -// ef bf bf - -const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -const int TiXmlBase::utf8ByteTable[256] = -{ - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid -}; - - -void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) - *length = 1; - else if ( input < 0x800 ) - *length = 2; - else if ( input < 0x10000 ) - *length = 3; - else if ( input < 0x200000 ) - *length = 4; - else - { *length = 0; return; } // This code won't covert this correctly anyway. - - output += *length; - - switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } -} - - -/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalpha( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalpha( anyByte ); -// } -} - - -/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalnum( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalnum( anyByte ); -// } -} - - -class TiXmlParsingData -{ - friend class TiXmlDocument; - public: - void Stamp( const char* now, TiXmlEncoding encoding ); - - const TiXmlCursor& Cursor() { return cursor; } - - private: - // Only used by the document! - TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } - - TiXmlCursor cursor; - const char* stamp; - int tabsize; -}; - - -void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) -{ - assert( now ); - - // Do nothing if the tabsize is 0. - if ( tabsize < 1 ) - { - return; - } - - // Get the current row, column. - int row = cursor.row; - int col = cursor.col; - const char* p = stamp; - assert( p ); - - while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; - - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; - - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') { - ++p; - } - break; - - case '\n': - // bump down to the next line - ++row; - col = 0; - - // Eat the character - ++p; - - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') { - ++p; - } - break; - - case '\t': - // Eat the character - ++p; - - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; - - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else - { p +=3; ++col; } // A normal character. - } - } - else - { - ++p; - ++col; - } - break; - - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; - } - } - cursor.row = row; - cursor.col = col; - assert( cursor.row >= -1 ); - assert( cursor.col >= -1 ); - stamp = p; - assert( stamp ); -} - - -const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) -{ - if ( !p || !*p ) - { - return 0; - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space. - ++p; - else - break; - } - } - else - { - while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' ) - ++p; - } - - return p; -} - -#ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) -{ - for( ;; ) - { - if ( !in->good() ) return false; - - int c = in->peek(); - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - return true; - - *tag += (char) in->get(); - } -} - -/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) -{ - //assert( character > 0 && character < 128 ); // else it won't work in utf-8 - while ( in->good() ) - { - int c = in->peek(); - if ( c == character ) - return true; - if ( c <= 0 ) // Silent failure: can't get document at this scope - return false; - - in->get(); - *tag += (char) c; - } - return false; -} -#endif - -// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The -// "assign" optimization removes over 10% of the execution time. -// -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) -{ - // Oddly, not supported on some comilers, - //name->clear(); - // So use this: - *name = ""; - assert( p ); - - // Names start with letters or underscores. - // Of course, in unicode, tinyxml has no idea what a letter *is*. The - // algorithm is generous. - // - // After that, they can be letters, underscores, numbers, - // hyphens, or colons. (Colons are valid ony for namespaces, - // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - if ( p-start > 0 ) { - name->assign( start, p-start ); - } - return p; - } - return 0; -} - -const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) -{ - // Presume an entity, and pull it out. - TIXML_STRING ent; - int i; - *length = 0; - - if ( *(p+1) && *(p+1) == '#' && *(p+2) ) - { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) return 0; - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else if ( *q >= 'a' && *q <= 'f' ) - ucs += mult * (*q - 'a' + 10); - else if ( *q >= 'A' && *q <= 'F' ) - ucs += mult * (*q - 'A' + 10 ); - else - return 0; - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) return 0; - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else - return 0; - mult *= 10; - --q; - } - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - return p + delta + 1; - } - - // Now try to match it. - for( i=0; iappend( cArr, len ); - } - } - else - { - bool whitespace = false; - - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) - { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - if ( len == 1 ) - (*text) += cArr[0]; // more efficient - else - text->append( cArr, len ); - } - } - } - if ( p ) - p += strlen( endTag ); - return p; -} - -#ifdef TIXML_USE_STL - -void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - // The basic issue with a document is that we don't know what we're - // streaming. Read something presumed to be a tag (and hope), then - // identify it, and call the appropriate stream method on the tag. - // - // This "pre-streaming" will never read the closing ">" so the - // sub-tag can orient itself. - - if ( !StreamTo( in, '<', tag ) ) - { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - while ( in->good() ) - { - int tagIndex = (int) tag->length(); - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - (*tag) += (char) c; - } - - if ( in->good() ) - { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - } - } - // We should have returned sooner. - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); -} - -#endif - -const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) -{ - ClearError(); - - // Parse away, at the document level. Since a document - // contains nothing but other tags, most of what happens - // here is skipping white space. - if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - // Note that, for a document, this needs to come - // before the while space skip, so that parsing - // starts from the pointer we are given. - location.Clear(); - if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } - else - { - location.row = 0; - location.col = 0; - } - TiXmlParsingData data( p, TabSize(), location.row, location.col ); - location = data.Cursor(); - - if ( encoding == TIXML_ENCODING_UNKNOWN ) - { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } - } - - p = SkipWhiteSpace( p, encoding ); - if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - while ( p && *p ) - { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } - - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else - encoding = TIXML_ENCODING_LEGACY; - } - - p = SkipWhiteSpace( p, encoding ); - } - - // Was this empty? - if ( !firstChild ) { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); - return 0; - } - - // All is well. - return p; -} - -void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - // The first error in a chain is more accurate - don't set again! - if ( error ) - return; - - assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); - error = true; - errorId = err; - errorDesc = errorString[ errorId ]; - - errorLocation.Clear(); - if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } -} - - -TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) -{ - TiXmlNode* returnNode = 0; - - p = SkipWhiteSpace( p, encoding ); - if( !p || !*p || *p != '<' ) - { - return 0; - } - - TiXmlDocument* doc = GetDocument(); - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - // What is this thing? - // - Elements start with a letter or underscore, but xml is reserved. - // - Comments: "; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // [ 1475201 ] TinyXML parses entities in comments - // Oops - ReadText doesn't work, because we don't want to parse the entities. - // p = ReadText( p, &value, false, endTag, false, encoding ); - // - // from the XML spec: - /* - [Definition: Comments may appear anywhere in a document outside other markup; in addition, - they may appear within the document type declaration at places allowed by the grammar. - They are not part of the document's character data; an XML processor MAY, but need not, - make it possible for an application to retrieve the text of comments. For compatibility, - the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity - references MUST NOT be recognized within comments. - - An example of a comment: - - - */ - - value = ""; - // Keep all the white space. - while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) - { - value.append( p, 1 ); - ++p; - } - if ( p ) - p += strlen( endTag ); - - return p; -} - - -const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) return 0; - -// int tabsize = 4; -// if ( document ) -// tabsize = document->TabSize(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - // Read the name, the '=' and the value. - const char* pErr = p; - p = ReadName( p, &name, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p || *p != '=' ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - ++p; // skip '=' - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - const char* end; - const char SINGLE_QUOTE = '\''; - const char DOUBLE_QUOTE = '\"'; - - if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - while ( p && *p // existence - && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - value += *p; - ++p; - } - } - return p; -} - -#ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->peek(); - if ( !cdata && (c == '<' ) ) - { - return; - } - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - (*tag) += (char) c; - in->get(); // "commits" the peek made above - - if ( cdata && c == '>' && tag->size() >= 3 ) { - size_t len = tag->size(); - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { - // terminator of cdata. - return; - } - } - } -} -#endif - -const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - value = ""; - TiXmlDocument* document = GetDocument(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - const char* const startTag = ""; - - if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } - - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; - } - else - { - bool ignoreWhite = true; - - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - if ( p ) - return p-1; // don't truncate the '<' - return 0; - } -} - -#ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - p += 5; - - version = ""; - encoding = ""; - standalone = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } - } - return 0; -} - -bool TiXmlText::Blank() const -{ - for ( unsigned i=0; igood() ) - { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlStylesheetReference::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - p += 5; - - type = ""; - href = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "type", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - type = attrib.Value(); - } - else if ( StringEqual( p, "href", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - href = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } - } - return 0; -} diff --git a/GLideN64/src/GLideNUI-wtl/util/StdString.cpp b/GLideN64/src/GLideNUI-wtl/util/StdString.cpp deleted file mode 100644 index bd633c4..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/StdString.cpp +++ /dev/null @@ -1,283 +0,0 @@ -#include "StdString.h" -#include -#include -#ifdef _WIN32 -#include -#endif - -stdstr::stdstr() -{ -} - -stdstr::stdstr(const std::string & str) : - std::string(str) -{ -} - -stdstr::stdstr(const stdstr & str) : - std::string((const std::string &)str) -{ -} - -stdstr::stdstr(const char * str) : - std::string(str ? str : "") -{ -} - -strvector stdstr::Tokenize(const char * delimiter) const -{ - strvector tokens; - - stdstr::size_type lastPos = find_first_not_of(delimiter, 0); - stdstr::size_type pos = find_first_of(delimiter, lastPos); - while (stdstr::npos != pos) - { - tokens.push_back(substr(lastPos, pos - lastPos)); - lastPos = pos + 1; - pos = find_first_of(delimiter, lastPos); - } - if (stdstr::npos != lastPos) - { - tokens.push_back(substr(lastPos)); - } - return tokens; -} - -strvector stdstr::Tokenize(char delimiter) const -{ - strvector tokens; - - stdstr::size_type lastPos = find_first_not_of(delimiter, 0); - stdstr::size_type pos = find_first_of(delimiter, lastPos); - while (stdstr::npos != pos) - { - tokens.push_back(substr(lastPos, pos - lastPos)); - lastPos = pos + 1; - pos = find_first_of(delimiter, lastPos); - } - if (stdstr::npos != lastPos) - { - tokens.push_back(substr(lastPos)); - } - return tokens; -} - -void stdstr::ArgFormat(const char * strFormat, va_list & args) -{ -#pragma warning(push) -#pragma warning(disable:4996) - - size_t nlen = _vscprintf(strFormat, args) + 1; - char * buffer = (char *)alloca(nlen * sizeof(char)); - buffer[nlen - 1] = 0; - if (buffer != NULL) - { - vsprintf(buffer, strFormat, args); - *this = buffer; - } -#pragma warning(pop) -} - -void stdstr::Format(const char * strFormat, ...) -{ - va_list args; - va_start(args, strFormat); - ArgFormat(strFormat, args); - va_end(args); -} - -stdstr& stdstr::ToLower(void) -{ - std::transform(begin(), end(), begin(), (int(*)(int)) tolower); - return *this; -} - -stdstr& stdstr::ToUpper(void) -{ - std::transform(begin(), end(), begin(), (int(*)(int)) toupper); - return *this; -} - -void stdstr::Replace(const char search, const char replace) -{ - std::string& str = *this; - std::string::size_type pos = str.find(search); - while (pos != std::string::npos) - { - str.replace(pos, 1, &replace); - pos = str.find(search, pos + 1); - } -} - -void stdstr::Replace(const char * search, const char replace) -{ - std::string& str = *this; - std::string::size_type pos = str.find(search); - size_t SearchSize = strlen(search); - while (pos != std::string::npos) - { - str.replace(pos, SearchSize, &replace); - pos = str.find(search, pos + 1); - } -} - -void stdstr::Replace(const std::string& search, const std::string& replace) -{ - std::string& str = *this; - std::string::size_type pos = str.find(search); - size_t SearchSize = search.size(); - while (pos != std::string::npos) - { - str.replace(pos, SearchSize, replace); - pos = str.find(search, pos + replace.length()); - } -} - -stdstr & stdstr::TrimLeft(const char * chars2remove) -{ - if (!empty()) - { - std::string::size_type pos = find_first_not_of(chars2remove); - if (pos != std::string::npos) - { - erase(0, pos); - } - else - { - erase(begin(), end()); // make empty - } - } - return *this; -} - -stdstr & stdstr::TrimRight(const char * chars2remove) -{ - if (!empty()) - { - std::string::size_type pos = find_last_not_of(chars2remove); - if (pos != std::string::npos) - { - erase(pos + 1); - } - else - { - erase(begin(), end()); // make empty - } - } - return *this; -} - -stdstr & stdstr::Trim(const char * chars2remove) -{ - if (!empty()) - { - std::string::size_type pos = find_first_not_of(chars2remove); - if (pos != std::string::npos) - { - erase(0, pos); - } - else - { - erase(begin(), end()); // make empty - } - - pos = find_last_not_of(chars2remove); - if (pos != std::string::npos) - { - erase(pos + 1); - } - else - { - erase(begin(), end()); // make empty - } - } - return *this; -} - -#ifdef _WIN32 -stdstr & stdstr::FromUTF16(const wchar_t * UTF16Source, bool * bSuccess) -{ - bool bConverted = false; - - if (UTF16Source == NULL) - { - *this = ""; - bConverted = true; - } - else if (wcslen(UTF16Source) > 0) - { - uint32_t nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, NULL, 0, NULL, NULL); - if (nNeeded > 0) - { - char * buf = (char *)alloca(nNeeded + 1); - if (buf != NULL) - { - memset(buf, 0, nNeeded + 1); - - nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, buf, nNeeded, NULL, NULL); - if (nNeeded) - { - *this = buf; - bConverted = true; - } - } - } - } - if (bSuccess) - { - *bSuccess = bConverted; - } - return *this; -} - -std::wstring stdstr::ToUTF16(unsigned int CodePage, bool * bSuccess) -{ - bool bConverted = false; - std::wstring res; - - DWORD nNeeded = MultiByteToWideChar(CodePage, 0, this->c_str(), (int)this->length(), NULL, 0); - if (nNeeded > 0) - { - wchar_t * buf = (wchar_t *)alloca((nNeeded + 1) * sizeof(wchar_t)); - if (buf != NULL) - { - memset(buf, 0, (nNeeded + 1) * sizeof(wchar_t)); - - nNeeded = MultiByteToWideChar(CodePage, 0, this->c_str(), (int)this->length(), buf, nNeeded); - if (nNeeded) - { - res = buf; - bConverted = true; - } - } - } - if (bSuccess) - { - *bSuccess = bConverted; - } - return res; -} -#endif - -stdstr_f::stdstr_f(const char * strFormat, ...) -{ - va_list args; - va_start(args, strFormat); - ArgFormat(strFormat, args); - va_end(args); -} - -#ifdef _WIN32 -stdwstr_f::stdwstr_f(const wchar_t * strFormat, ...) -{ - va_list args; - va_start(args, strFormat); - - wchar_t Msg[1000]; - _vsnwprintf(Msg, sizeof(Msg) - 1, strFormat, args); - - va_end(args); - - this->assign(Msg); -} -#endif \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/util/StdString.h b/GLideN64/src/GLideNUI-wtl/util/StdString.h deleted file mode 100644 index 3b24539..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/StdString.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -class stdstr; - -#include -#include -#include -#include - -typedef std::vector strvector; - -class stdstr : - public std::string -{ -public: - enum - { - CODEPAGE_UTF8 = 65001, - CODEPAGE_932 = 932, - }; - - stdstr(); - stdstr(const std::string & str); - stdstr(const stdstr & str); - stdstr(const char * str); - - strvector Tokenize(char delimiter) const; - strvector Tokenize(const char * delimiter) const; - void Format(const char * strFormat, ...); - stdstr& ToLower(void); - stdstr& ToUpper(void); - - void Replace(const char search, const char replace); - void Replace(const char * search, const char replace); - void Replace(const std::string & search, const std::string & replace); - - stdstr & Trim(const char * chars2remove = "\t "); - stdstr & TrimLeft(const char * chars2remove = "\t "); - stdstr & TrimRight(const char * chars2remove = "\t "); - -#ifdef _WIN32 - stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = NULL); - std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = NULL); -#endif - - void ArgFormat(const char * strFormat, va_list & args); -}; - -class stdstr_f : public stdstr -{ -public: - stdstr_f(const char * strFormat, ...); -}; - -#ifdef _WIN32 -class stdwstr_f : public std::wstring -{ -public: - stdwstr_f(const wchar_t * strFormat, ... ); -}; -#endif - -typedef std::list strlist; -typedef strlist::iterator strlist_iter; diff --git a/GLideN64/src/GLideNUI-wtl/util/md5.cpp b/GLideN64/src/GLideNUI-wtl/util/md5.cpp deleted file mode 100644 index b0529f8..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/md5.cpp +++ /dev/null @@ -1,481 +0,0 @@ -// MD5.CC - source code for the C++/object oriented translation and -// modification of MD5. - -// Translation and modification (c) 1995 by Mordechai T. Abzug - -// This translation/ modification is provided "as is," without express or -// implied warranty of any kind. - -// The translator/ modifier does not claim (1) that MD5 will do what you think -// it does; (2) that this translation/ modification is accurate; or (3) that -// this software is "merchantible." (Language for this disclaimer partially -// copied from the disclaimer below). - -/* based on: - - MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - MDDRIVER.C - test driver for MD2, MD4 and MD5 - - Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - - */ -#include "md5.h" - -// MD5 simple initialization method -MD5::MD5() -{ - init(); -} - -MD5::~MD5() -{ -} - -// MD5 block update operation. Continues an MD5 message-digest -// operation, processing another message block, and updating the -// context. -void MD5::update(const uint1 *input, uint4 input_length) -{ - uint4 input_index, buffer_index; - uint4 buffer_space; // how much space is left in buffer - - if (finalized) // so we can't update! - { - //WriteTrace(TraceMD5, TraceError, "Can't update a finalized digest!"); - return; - } - - // Compute number of bytes mod 64 - buffer_index = (unsigned int)((count[0] >> 3) & 0x3F); - - // Update number of bits - if ((count[0] += ((uint4)input_length << 3)) < ((uint4)input_length << 3)) - { - count[1]++; - } - - count[1] += ((uint4)input_length >> 29); - - buffer_space = 64 - buffer_index; // how much space is left in buffer - - // Transform as many times as possible. - if (input_length >= buffer_space) // ie. we have enough to fill the buffer - { - // fill the rest of the buffer and transform - memcpy(buffer + buffer_index, (unsigned char *)input, buffer_space); - transform(buffer); - - // now, transform each 64-byte piece of the input, bypassing the buffer - for (input_index = buffer_space; input_index + 63 < input_length; input_index += 64) - { - transform((unsigned char *)(input + input_index)); - } - - buffer_index = 0; // so we can buffer remaining - } - else - { - input_index = 0; // so we can buffer the whole input - } - - // and here we do the buffering: - memcpy(buffer + buffer_index, (unsigned char *)(input + input_index), input_length - input_index); -} - -// MD5 update for files. -// Like above, except that it works on files (and uses above as a primitive.) - -void MD5::update(FILE *file) -{ - unsigned char buffer[1024]; - int len; - - do - { - len = (int)fread(buffer, 1, 1024, file); - if (len) - { - update(buffer, len); - } - } while (len); - - fclose(file); -} - -// MD5 finalization. Ends an MD5 message-digest operation, writing the -// the message digest and zeroizing the context. - -void MD5::finalize() -{ - unsigned char bits[8]; - unsigned int index, padLen; - static uint1 PADDING[64] = - { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - if (finalized) - { - //WriteTrace(TraceMD5, TraceError, "Already finalized this digest!"); - return; - } - - // Save number of bits - encode(bits, count, 8); - - // Pad out to 56 mod 64. - index = (uint4)((count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - update(PADDING, padLen); - - // Append length (before padding) - update(bits, 8); - - // Store state in digest - encode(digest, state, 16); - - // Zeroize sensitive information - memset(buffer, 0, sizeof(*buffer)); - - finalized = 1; -} - -MD5::MD5(CPath File) -{ - init(); // must be called be all constructors - if (File.Exists()) - { - FILE * fp = fopen((const char *)File, "rb"); - if (fp) - { - update(fp); - } - } - finalize(); -} - -MD5::MD5(FILE *file) -{ - init(); // must be called be all constructors - update(file); - finalize(); -} - -MD5::MD5(const unsigned char *input, unsigned int input_length) -{ - init(); // must called by all constructors - update(input, input_length); - finalize(); -} - -MD5::MD5(const stdstr & string) -{ - init(); // must called by all constructors - update((const unsigned char *)string.c_str(), string.length()); - finalize(); -} - -const unsigned char *MD5::raw_digest() -{ - if (!finalized) - { - //WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!"); - return ((unsigned char*) ""); - } - return digest; -} - -void MD5::get_digest(MD5Digest& extdigest) -{ - if (!finalized) - { - //WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!"); - memset(extdigest.digest, 0, sizeof(extdigest.digest)); - return; - } - - memcpy(extdigest.digest, digest, 16); -} - -const char *MD5::hex_digest() -{ - if (m_hex_digest.length()) - { - return m_hex_digest.c_str(); - } - - if (!finalized) - { - //WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!"); - return ""; - } - char c[33]; - memset((unsigned char *)c, 0, 33); - for (int i = 0; i < 16; i++) - { - sprintf(c + i * 2, "%02X", digest[i]); - } - - c[32] = '\0'; - m_hex_digest = c; - - return m_hex_digest.c_str(); -} - -// PRIVATE METHODS: -void MD5::init() -{ - finalized = 0; // we just started! - - // Nothing counted, so count=0 - count[0] = 0; - count[1] = 0; - - // Load magic initialization constants. - state[0] = 0x67452301; - state[1] = 0xefcdab89; - state[2] = 0x98badcfe; - state[3] = 0x10325476; - - ::memset(digest, 0, sizeof(digest)); - ::memset(buffer, 0, sizeof(buffer)); - - m_hex_digest = NULL; -} - -// Constants for MD5Transform routine. -// Although we could use C++ style constants, defines are actually better, -// since they let us easily evade scope clashes. - -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -// MD5 basic transformation. Transforms state based on block. -void MD5::transform(uint1 block[64]) -{ - uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - decode(x, block, 64); - - //ATLASSERT(!finalized); // not just a user error, since the method is private - - /* Round 1 */ - FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ - FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ - FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */ - FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ - FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ - FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ - FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ - FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ - FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ - FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ - FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ - GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ - GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ - GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ - GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ - GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ - GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ - GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ - GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ - GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ - GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ - HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ - HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ - HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ - HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ - HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ - HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ - HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ - HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ - HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ - II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ - II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ - II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ - II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ - II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ - II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ - II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ - II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ - II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - // Zeroize sensitive information. - memset((uint1 *)x, 0, sizeof(x)); -} - -// Encodes input (UINT4) into output (unsigned char). Assumes len is -// a multiple of 4. -void MD5::encode(uint1 *output, uint4 *input, uint4 len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - { - output[j] = (uint1)(input[i] & 0xff); - output[j + 1] = (uint1)((input[i] >> 8) & 0xff); - output[j + 2] = (uint1)((input[i] >> 16) & 0xff); - output[j + 3] = (uint1)((input[i] >> 24) & 0xff); - } -} - -// Decodes input (unsigned char) into output (UINT4). Assumes len is -// a multiple of 4. -void MD5::decode(uint4 *output, uint1 *input, uint4 len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - { - output[i] = ((uint4)input[j]) | (((uint4)input[j + 1]) << 8) | (((uint4)input[j + 2]) << 16) | (((uint4)input[j + 3]) << 24); - } -} - -// Note: Replace "for loop" with standard memcpy if possible. -void MD5::memcpy(uint1 *output, uint1 *input, uint4 len) -{ - unsigned int i; - - for (i = 0; i < len; i++) - { - output[i] = input[i]; - } -} - -// Note: Replace "for loop" with standard memset if possible. -void MD5::memset(uint1 *output, uint1 value, uint4 len) -{ - unsigned int i; - - for (i = 0; i < len; i++) - { - output[i] = value; - } -} - -// ROTATE_LEFT rotates x left n bits. - -inline unsigned int MD5::rotate_left(uint4 x, uint4 n) -{ - return (x << n) | (x >> (32 - n)); -} - -// F, G, H and I are basic MD5 functions. - -inline unsigned int MD5::F(uint4 x, uint4 y, uint4 z) -{ - return (x & y) | (~x & z); -} - -inline unsigned int MD5::G(uint4 x, uint4 y, uint4 z) -{ - return (x & z) | (y & ~z); -} - -inline unsigned int MD5::H(uint4 x, uint4 y, uint4 z) -{ - return x ^ y ^ z; -} - -inline unsigned int MD5::I(uint4 x, uint4 y, uint4 z) -{ - return y ^ (x | ~z); -} - -// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. -// Rotation is separate from addition to prevent recomputation. - -inline void MD5::FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) -{ - a += F(b, c, d) + x + ac; - a = rotate_left(a, s) + b; -} - -inline void MD5::GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) -{ - a += G(b, c, d) + x + ac; - a = rotate_left(a, s) + b; -} - -inline void MD5::HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) -{ - a += H(b, c, d) + x + ac; - a = rotate_left(a, s) + b; -} - -inline void MD5::II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) -{ - a += I(b, c, d) + x + ac; - a = rotate_left(a, s) + b; -} \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/util/md5.h b/GLideN64/src/GLideNUI-wtl/util/md5.h deleted file mode 100644 index 0bc6648..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/md5.h +++ /dev/null @@ -1,150 +0,0 @@ -// MD5.CC - source code for the C++/object oriented translation and -// modification of MD5. - -// Translation and modification (c) 1995 by Mordechai T. Abzug - -// This translation/ modification is provided "as is," without express or -// implied warranty of any kind. - -// The translator/ modifier does not claim (1) that MD5 will do what you think -// it does; (2) that this translation/ modification is accurate; or (3) that -// this software is "merchantible." (Language for this disclaimer partially -// copied from the disclaimer below). - -/* based on: - -MD5.H - header file for MD5C.C -MDDRIVER.C - test driver for MD2, MD4 and MD5 - -Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - -*/ - -#pragma once - -#include -#include -#include -#include -#include "path.h" - -struct MD5Digest -{ - MD5Digest() { Reset(); } - unsigned char digest[16]; - - void Reset() { ::memset(digest, 0, sizeof(digest)); } - bool IsClear() - { - int isClear = 0; - for (int i = 0; i < 16; i++) - { - isClear += digest[i]; - } - return (isClear == 0); - } - std::string String(void) - { - char s[33]; - - ::memset(s, 0, sizeof(s)); - - for (int i = 0; i < 16; i++) - { - sprintf(s + i * 2, "%02X", digest[i]); - } - s[32] = '\0'; - - return s; - } -}; - -struct MD5Digest_less : std::binary_function < MD5Digest, MD5Digest, bool > -{ - bool operator()(const MD5Digest& x, const MD5Digest& y) const - { - return (memcmp(x.digest, y.digest, sizeof(x.digest)) < 0); - } -}; - -class MD5 -{ -public: - // methods for controlled operation: - MD5(); // simple initializer - ~MD5(); - void update(const unsigned char *input, unsigned int input_length); - void update(FILE *file); - void finalize(); - - // constructors for special circumstances. All these constructors finalize - // the MD5 context. - MD5(CPath File); // digest File, finalize - MD5(const unsigned char *string); // digest string, finalize - MD5(FILE *file); // digest file, close, finalize - MD5(const unsigned char *input, unsigned int input_length); - MD5(const stdstr & string); - - // methods to acquire finalized result - void get_digest(MD5Digest& extdigest); //Digest into a digest structure - const unsigned char *raw_digest(); // digest as a 16-byte binary array - const char * hex_digest(); // digest as a 33-byte ascii-hex string - -private: - - // first, some types: - typedef unsigned int uint4; // assumes integer is 4 words long - typedef unsigned short int uint2; // assumes short integer is 2 words long - typedef unsigned char uint1; // assumes char is 1 word long - - // next, the private data: - uint4 state[4]; - uint4 count[2]; // number of *bits*, mod 2^64 - uint1 buffer[64]; // input buffer - uint1 digest[16]; - uint1 finalized; - stdstr m_hex_digest; - - // last, the private methods, mostly static: - void init(); // called by all constructors - void transform(uint1 *buffer); // does the real update work. Note - // that length is implied to be 64. - - static void encode(uint1 *dest, uint4 *src, uint4 length); - static void decode(uint4 *dest, uint1 *src, uint4 length); - static void memcpy(uint1 *dest, uint1 *src, uint4 length); - static void memset(uint1 *start, uint1 val, uint4 length); - - static inline uint4 rotate_left(uint4 x, uint4 n); - static inline uint4 F(uint4 x, uint4 y, uint4 z); - static inline uint4 G(uint4 x, uint4 y, uint4 z); - static inline uint4 H(uint4 x, uint4 y, uint4 z); - static inline uint4 I(uint4 x, uint4 y, uint4 z); - static inline void FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, - uint4 s, uint4 ac); - static inline void GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, - uint4 s, uint4 ac); - static inline void HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, - uint4 s, uint4 ac); - static inline void II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, - uint4 s, uint4 ac); -}; diff --git a/GLideN64/src/GLideNUI-wtl/util/path.cpp b/GLideN64/src/GLideNUI-wtl/util/path.cpp deleted file mode 100644 index f054692..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/path.cpp +++ /dev/null @@ -1,1668 +0,0 @@ -// Path.cpp: implementation of the CPath class. -// -////////////////////////////////////////////////////////////////////// -#include "path.h" -#ifdef _WIN32 -#include -#include -#pragma warning(push) -#pragma warning(disable : 4996) // warning C4091: 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared -#include -#pragma warning(pop) -#else -#include -#include -#include -#include -#endif - -////////////////////////////////////////////////////////////////////// -// Constants -////////////////////////////////////////////////////////////////////// - -#ifdef _WIN32 -const char DRIVE_DELIMITER = ':'; -const char * const DIR_DOUBLEDELIM = "\\\\"; -const char DIRECTORY_DELIMITER = '\\'; -const char DIRECTORY_DELIMITER2 = '/'; -#else -const char * const DIR_DOUBLEDELIM = "//"; -const char DIRECTORY_DELIMITER = '/'; -const char DIRECTORY_DELIMITER2 = '\\'; -#endif -const char EXTENSION_DELIMITER = '.'; -#ifdef _WIN32 -void * CPath::m_hInst = NULL; -#endif - -////////////////////////////////////////////////////////////////////// -// Helpers -////////////////////////////////////////////////////////////////////// -#ifdef _WIN32 -void CPath::SethInst(void * hInst) -{ - m_hInst = hInst; -} - -void * CPath::GethInst() -{ - return m_hInst; -} -#endif -////////////////////////////////////////////////////////////////////// -// Initialisation -////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------- -// Task : Helper function for the various CPath constructors. -// Initializes the data members and establishes various -// class invariants -//------------------------------------------------------------- -inline void CPath::Init() -{ - m_dwFindFileAttributes = 0; -#ifdef _WIN32 - m_hFindFile = NULL; -#else - m_OpenedDir = NULL; - m_FindWildcard = ""; -#endif -} - -//------------------------------------------------------------- -// Task : Helper function for the various CPath destructors. -// Cleans up varios internals -//------------------------------------------------------------- -inline void CPath::Exit() -{ -#ifdef _WIN32 - if (m_hFindFile != NULL) - { - FindClose(m_hFindFile); - m_hFindFile = NULL; - } -#else - if (m_OpenedDir != NULL) - { - closedir((DIR*)m_OpenedDir); - m_OpenedDir = NULL; - } -#endif -} - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------- -// Task : Constructs a path -//------------------------------------------------------------- -CPath::CPath() -{ - Init(); - Empty(); -} - -//------------------------------------------------------------- -// Task : Constructs a path as copy of another -//------------------------------------------------------------- -CPath::CPath(const CPath& rPath) -{ - Init(); - m_strPath = rPath.m_strPath; -} - -//------------------------------------------------------------- -// Task : Constructs a path and points it 2 lpszPath -//------------------------------------------------------------- -CPath::CPath(const char * lpszPath) -{ - Init(); - m_strPath = lpszPath ? lpszPath : ""; - cleanPathString(m_strPath); -} - -CPath::CPath(const char * lpszPath, const char * NameExten) -{ - Init(); -#ifdef _WIN32 - SetDriveDirectory(lpszPath); -#else - SetDirectory(lpszPath); -#endif - SetNameExtension(NameExten); -} - -//------------------------------------------------------------- -// Task : Constructs a path and points it 2 strPath -//------------------------------------------------------------- -CPath::CPath(const std::string& strPath) -{ - Init(); - m_strPath = strPath; - cleanPathString(m_strPath); -} - -//------------------------------------------------------------- -// Task : Constructs a path and points it 2 strPath -//------------------------------------------------------------- -CPath::CPath(const std::string& strPath, const char * NameExten) -{ - Init(); -#ifdef _WIN32 - SetDriveDirectory(strPath.c_str()); -#else - SetDirectory(strPath.c_str(),true); -#endif - SetNameExtension(NameExten); -} - -//------------------------------------------------------------- -// Task : Constructs a path and points it 2 strPath -//------------------------------------------------------------- -CPath::CPath(const std::string& strPath, const std::string& NameExten) -{ - Init(); -#ifdef _WIN32 - SetDriveDirectory(strPath.c_str()); -#else - SetDirectory(strPath.c_str(),true); -#endif - SetNameExtension(NameExten.c_str()); -} - -//------------------------------------------------------------- -// Task : Cleanup and destruct a path object -//------------------------------------------------------------- -CPath::~CPath() -{ - Exit(); -} - -//------------------------------------------------------------- -// Post : Return TRUE if paths are equal -// Task : Check if the two path are the same -//------------------------------------------------------------- -bool CPath::operator ==(const CPath& rPath) const -{ - // Get fully qualified versions of the paths - std::string FullyQualified1; - std::string FullyQualified2; - - GetFullyQualified(FullyQualified1); - rPath.GetFullyQualified(FullyQualified2); - - // Compare them - return _stricmp(FullyQualified1.c_str(), FullyQualified2.c_str()) == 0; -} - -//------------------------------------------------------------- -// Post : Return TRUE if paths are different -// Task : Check if the two path are different -//------------------------------------------------------------- -bool CPath::operator !=(const CPath& rPath) const -{ - return !(*this == rPath); -} - -//------------------------------------------------------------- -// Task : Assign a path 2 another -//------------------------------------------------------------- -CPath& CPath::operator =(const CPath& rPath) -{ - if (this != &rPath) - { - m_strPath = rPath.m_strPath; - } - return *this; -} - -//------------------------------------------------------------- -// Post : Return the path, so that assignements can be chained -// Task : Assign a string 2 a path -//------------------------------------------------------------- -CPath& CPath::operator =(const char * lpszPath) -{ - m_strPath = lpszPath ? lpszPath : ""; - return *this; -} - -//------------------------------------------------------------- -// Post : Return the path, so that assignements can be chained -// Task : Assign a string 2 a path -//------------------------------------------------------------- -CPath& CPath::operator =(const std::string& strPath) -{ - m_strPath = strPath; - return *this; -} - -//------------------------------------------------------------- -// Post : Converts path 2 string -// Task : Convert path 2 string -// Warning: because this pointer 2 string point in the data -// of this class, it is possible 2 cast the result of this -// function in any non-constant pointer and alter the data. -// Very dangerous -//------------------------------------------------------------- -CPath::operator const char *() const -{ - return (const char *)m_strPath.c_str(); -} - -CPath::CPath(DIR_CURRENT_DIRECTORY /*sdt*/, const char * NameExten) -{ - // Application's current directory - Init(); - CurrentDirectory(); - if (NameExten) { SetNameExtension(NameExten); } -} - -#ifdef _WIN32 -CPath::CPath(DIR_MODULE_DIRECTORY /*sdt*/, const char * NameExten) -{ - // The directory where the executable of this app is - Init(); - ModuleDirectory(); - if (NameExten) { SetNameExtension(NameExten); } -} - -CPath::CPath(DIR_MODULE_FILE /*sdt*/) -{ - // The directory where the executable of this app is - Init(); - Module(); -} -#endif - -//------------------------------------------------------------- -// Post : Returns the drive component without a colon, e.g. "c" -// Returns the directory component with a leading backslash, -// but no trailing backslash, e.g. "\dir\subdir" -// Returns name compleletely without delimiters, e.g "letter" -// Returns extension completely without delimiters, e.g. "doc" -// Globals : -// I/O : -// Task : Return the individual components of this path. -// For any given argument, you can pass NULL if you are not -// interested in that component. -// Do not rely on pNames being <= 8 characters, extensions -// being <= 3 characters, or drives being 1 character -//------------------------------------------------------------- -#ifdef _WIN32 -void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::string* pName, std::string* pExtension) const -{ - char buff_drive[_MAX_DRIVE + 1] = { 0 }; - char buff_dir[_MAX_DIR + 1] = { 0 }; - char buff_name[_MAX_FNAME + 1] = { 0 }; - char buff_ext[_MAX_EXT + 1] = { 0 }; - - const char * BasePath = m_strPath.c_str(); - const char * DriveDir = strrchr(BasePath, DRIVE_DELIMITER); - if (DriveDir != NULL) - { - int len = sizeof(buff_dir) < (DriveDir - BasePath) ? sizeof(buff_drive) : DriveDir - BasePath; - strncpy(buff_drive, BasePath, len); - BasePath += len + 1; - } - - const char * last = strrchr(BasePath, DIRECTORY_DELIMITER); - if (last != NULL) - { - int len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath; - if (len > 0) - { - strncpy(buff_dir, BasePath, len); - } - else - { - buff_dir[0] = DIRECTORY_DELIMITER; - buff_dir[1] = '\0'; - } - strncpy(buff_name, last + 1, sizeof(buff_name)); - } - else - { - strncpy(buff_dir, BasePath, sizeof(buff_dir)); - } - char * ext = strrchr(buff_name, '.'); - if (ext != NULL) - { - strncpy(buff_ext, ext + 1, sizeof(buff_ext)); - *ext = '\0'; - } - - if (pDrive) - { - *pDrive = buff_drive; - } - if (pDirectory) - { - *pDirectory = buff_dir; - } - if (pName) - { - *pName = buff_name; - } - if (pExtension) - { - *pExtension = buff_ext; - } -} -#else -void CPath::GetComponents(std::string* pDirectory, std::string* pName, std::string* pExtension) const -{ - - char buff_dir[260]; - char buff_name[260]; - char buff_ext[260]; - - memset(buff_dir, 0, sizeof(buff_dir)); - memset(buff_name, 0, sizeof(buff_name)); - memset(buff_ext, 0, sizeof(buff_ext)); - - const char * BasePath = m_strPath.c_str(); - const char * last = strrchr(BasePath,DIRECTORY_DELIMITER); - if (last != NULL) - { - int len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath; - if (len > 0) - { - strncpy(buff_dir,BasePath,len); - } - else - { - buff_dir[0] = DIRECTORY_DELIMITER; - buff_dir[1] = '\0'; - } - strncpy(buff_name,last + 1,sizeof(buff_name)); - } - else - { - strncpy(buff_dir,BasePath,sizeof(buff_dir)); - } - char * ext = strrchr(buff_name,'.'); - if (ext != NULL) - { - strncpy(buff_ext,ext + 1,sizeof(buff_ext)); - *ext = '\0'; - } - - if (pDirectory) - { - *pDirectory = buff_dir; - } - if (pName) - { - *pName = buff_name; - } - if (pExtension) - { - *pExtension = buff_ext; - } -} -#endif - -//------------------------------------------------------------- -// Task : Get drive and directory from path -//------------------------------------------------------------- -#ifdef _WIN32 -void CPath::GetDriveDirectory(std::string& rDriveDirectory) const -{ - std::string Drive; - std::string Directory; - - GetComponents(&Drive, &Directory); - rDriveDirectory = Drive; - if (!Drive.empty()) - { - rDriveDirectory += DRIVE_DELIMITER; - } - rDriveDirectory += Directory; -} - -std::string CPath::GetDriveDirectory(void) const -{ - std::string rDriveDirectory; - GetDriveDirectory(rDriveDirectory); - return rDriveDirectory; -} -#endif - -//------------------------------------------------------------- -// Task : Get directory from path -//------------------------------------------------------------- -void CPath::GetDirectory(std::string& rDirectory) const -{ -#ifdef _WIN32 - GetComponents(NULL, &rDirectory); -#else - GetComponents(&rDirectory); -#endif -} - -std::string CPath::GetDirectory(void) const -{ - std::string rDirectory; - GetDirectory(rDirectory); - return rDirectory; -} - -//------------------------------------------------------------- -// Task : Get filename and extension from path -//------------------------------------------------------------- -void CPath::GetNameExtension(std::string& rNameExtension) const -{ - std::string Name; - std::string Extension; - -#ifdef _WIN32 - GetComponents(NULL, NULL, &Name, &Extension); -#else - GetComponents(NULL, &Name, &Extension); -#endif - rNameExtension = Name; - if (!Extension.empty()) - { - rNameExtension += EXTENSION_DELIMITER; - rNameExtension += Extension; - } -} - -std::string CPath::GetNameExtension(void) const -{ - std::string rNameExtension; - GetNameExtension(rNameExtension); - return rNameExtension; -} - -//------------------------------------------------------------- -// Task : Get filename from path -//------------------------------------------------------------- -void CPath::GetName(std::string& rName) const -{ -#ifdef _WIN32 - GetComponents(NULL, NULL, &rName); -#else - GetComponents(NULL, &rName); -#endif -} - -std::string CPath::GetName(void) const -{ - std::string rName; - GetName(rName); - return rName; -} - -//------------------------------------------------------------- -// Task : Get file extension from path -//------------------------------------------------------------- -void CPath::GetExtension(std::string& rExtension) const -{ -#ifdef _WIN32 - GetComponents(NULL, NULL, NULL, &rExtension); -#else - GetComponents(NULL, NULL, &rExtension); -#endif -} - -std::string CPath::GetExtension(void) const -{ - std::string rExtension; - GetExtension(rExtension); - return rExtension; -} - -//------------------------------------------------------------- -// Task : Get current directory -//------------------------------------------------------------- -void CPath::GetLastDirectory(std::string& rDirectory) const -{ - std::string Directory; - - rDirectory = ""; - - GetDirectory(Directory); - StripTrailingBackslash(Directory); - if (Directory.empty()) - { - return; - } - - std::string::size_type nDelimiter = Directory.rfind(DIRECTORY_DELIMITER); - rDirectory = Directory.substr(nDelimiter); - StripLeadingBackslash(rDirectory); -} - -std::string CPath::GetLastDirectory(void) const -{ - std::string rDirecotry; - GetLastDirectory(rDirecotry); - return rDirecotry; -} - -//------------------------------------------------------------- -// Task : Get fully qualified path -//------------------------------------------------------------- -void CPath::GetFullyQualified(std::string& rFullyQualified) const -{ -#ifdef _WIN32 - char buff_fullname[MAX_PATH]; - - memset(buff_fullname, 0, sizeof(buff_fullname)); - - _fullpath(buff_fullname, m_strPath.c_str(), MAX_PATH - 1); - rFullyQualified = buff_fullname; -#endif -} - -//------------------------------------------------------------- -// Post : Return TRUE if path does not start from filesystem root -// Task : Check if path is a relative one (e.g. doesn't start with C:\...) -//------------------------------------------------------------- -bool CPath::IsRelative() const -{ -#ifdef _WIN32 - if (m_strPath.length() > 1 && m_strPath[1] == DRIVE_DELIMITER) - { - return false; - } - if (m_strPath.length() > 2 && m_strPath[0] == DIRECTORY_DELIMITER && m_strPath[1] == DIRECTORY_DELIMITER) - { - return false; - } -#else - if (m_strPath.length() > 1 && m_strPath[0] == DIRECTORY_DELIMITER) - { - return false; - } -#endif - return true; -} - -//------------------------------------------------------------- -// Task : Set path components -//------------------------------------------------------------- -#ifdef _WIN32 -void CPath::SetComponents(const char * lpszDrive, const char * lpszDirectory, const char * lpszName, const char * lpszExtension) -{ - char buff_fullname[MAX_PATH]; - - memset(buff_fullname, 0, sizeof(buff_fullname)); - if (lpszDirectory == NULL || strlen(lpszDirectory) == 0) - { - static char empty_dir[] = { DIRECTORY_DELIMITER, '\0' }; - lpszDirectory = empty_dir; - } - - _makepath(buff_fullname, lpszDrive, lpszDirectory, lpszName, lpszExtension); - m_strPath.erase(); - m_strPath = buff_fullname; -} -#else -void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, const char * lpszExtension) -{ - char buff_fullname[260]; - - memset(buff_fullname, 0, sizeof(buff_fullname)); - if (lpszDirectory != NULL && lpszDirectory[0] != '\0') - { - if (lpszDirectory[0] != DIRECTORY_DELIMITER) { buff_fullname[0] = DIRECTORY_DELIMITER; } - strncat(buff_fullname,lpszDirectory,sizeof(buff_fullname) - 1); - std::string::size_type nLength = strlen(buff_fullname); - if (buff_fullname[nLength - 1] != DIRECTORY_DELIMITER && nLength < sizeof(buff_fullname)) - { - buff_fullname[nLength] = DIRECTORY_DELIMITER; - } - } - if (lpszName != NULL) - { - strncat(buff_fullname,lpszName,sizeof(buff_fullname) - 1); - } - if (lpszExtension != NULL && lpszExtension[0] != '\0') - { - if (lpszExtension[0] != '.') - { - strncat(buff_fullname,".",sizeof(buff_fullname)-1); - } - strncat(buff_fullname,lpszExtension,sizeof(buff_fullname)-1); - } - buff_fullname[sizeof(buff_fullname) - 1] = 0; //Make sure it is null terminated - m_strPath.erase(); - m_strPath = buff_fullname; -} -#endif - -//------------------------------------------------------------- -// Task : Set path's drive -//------------------------------------------------------------- -#ifdef _WIN32 -void CPath::SetDrive(char chDrive) -{ - stdstr_f Drive("%c", chDrive); - std::string Directory; - std::string Name; - std::string Extension; - - GetComponents(NULL, &Directory, &Name, &Extension); - SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str()); -} -#endif - -//------------------------------------------------------------- -// Task : Set path's directory -//------------------------------------------------------------- -void CPath::SetDirectory(const char * lpszDirectory, bool bEnsureAbsolute /*= false*/) -{ - std::string Directory = lpszDirectory; - std::string Name; - std::string Extension; - - if (bEnsureAbsolute) - { - EnsureLeadingBackslash(Directory); - } - if (Directory.length() > 0) - { - EnsureTrailingBackslash(Directory); - } - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, NULL, &Name, &Extension); - SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str()); -#else - GetComponents(NULL, &Name, &Extension); - SetComponents(Directory.c_str(), Name.c_str(), Extension.c_str()); -#endif -} - -#ifdef _WIN32 -//------------------------------------------------------------- -// Task : Set path's drive and directory -//------------------------------------------------------------- -void CPath::SetDriveDirectory(const char * lpszDriveDirectory) -{ - std::string DriveDirectory = lpszDriveDirectory; - std::string Name; - std::string Extension; - - if (DriveDirectory.length() > 0) - { - EnsureTrailingBackslash(DriveDirectory); - cleanPathString(DriveDirectory); - } - - GetComponents(NULL, NULL, &Name, &Extension); - SetComponents(NULL, DriveDirectory.c_str(), Name.c_str(), Extension.c_str()); -} -#endif - -//------------------------------------------------------------- -// Task : Set path's filename -//------------------------------------------------------------- -void CPath::SetName(const char * lpszName) -{ - std::string Directory; - std::string Extension; - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, &Directory, NULL, &Extension); - SetComponents(Drive.c_str(), Directory.c_str(), lpszName, Extension.c_str()); -#else - GetComponents(&Directory, NULL, &Extension); - SetComponents(Directory.c_str(), lpszName, Extension.c_str()); -#endif -} - -//------------------------------------------------------------- -// Task : Set path's filename -//------------------------------------------------------------- -void CPath::SetName(int iName) -{ - std::string Directory; - std::string Extension; - char sName[33]; - - memset(sName, 0, sizeof(sName)); - - _snprintf(sName, sizeof(sName), "%d", iName); - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, &Directory, NULL, &Extension); - SetComponents(Drive.c_str(), Directory.c_str(), sName, Extension.c_str()); -#else - GetComponents(&Directory, NULL, &Extension); - SetComponents(Directory.c_str(), sName, Extension.c_str()); -#endif -} - -//------------------------------------------------------------- -// Task : Set path's file extension -//------------------------------------------------------------- -void CPath::SetExtension(const char * lpszExtension) -{ - std::string Directory; - std::string Name; - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, &Directory, &Name); - SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), lpszExtension); -#else - GetComponents(&Directory, &Name); - SetComponents(Directory.c_str(), Name.c_str(), lpszExtension); -#endif -} - -//------------------------------------------------------------- -// Task : Set path's file extension -//------------------------------------------------------------- -void CPath::SetExtension(int iExtension) -{ - std::string Directory; - std::string Name; - char sExtension[20]; - - memset(sExtension, 0, sizeof(sExtension)); - - _snprintf(sExtension, sizeof(sExtension), "%d", iExtension); - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, &Directory, &Name); - SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), sExtension); -#else - GetComponents(&Directory, &Name); - SetComponents(Directory.c_str(), Name.c_str(), sExtension); -#endif -} - -//------------------------------------------------------------- -// Task : Set path's filename and extension -//------------------------------------------------------------- -void CPath::SetNameExtension(const char * lpszNameExtension) -{ - std::string Directory; - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, &Directory); - SetComponents(Drive.c_str(), Directory.c_str(), lpszNameExtension, NULL); -#else - GetComponents(&Directory); - SetComponents(Directory.c_str(), lpszNameExtension, NULL); -#endif -} - -//------------------------------------------------------------- -// Task : Append a subdirectory 2 path's directory -//------------------------------------------------------------- -void CPath::AppendDirectory(const char * lpszSubDirectory) -{ - std::string Directory; - std::string SubDirectory = lpszSubDirectory; - std::string Name; - std::string Extension; - - if (SubDirectory.empty()) - { - return; - } - - // Strip out any preceeding backslash - StripLeadingBackslash(SubDirectory); - EnsureTrailingBackslash(SubDirectory); - -#ifdef _WIN32 - std::string Drive; - GetComponents(&Drive, &Directory, &Name, &Extension); -#else - GetComponents(&Directory, &Name, &Extension); -#endif - EnsureTrailingBackslash(Directory); - Directory += SubDirectory; - -#ifdef _WIN32 - SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str()); -#else - SetComponents(Directory.c_str(), Name.c_str(), Extension.c_str()); -#endif -} - -//------------------------------------------------------------- -// Pre : If pLastDirectory is given we will store the name of the -// deepest directory (the one we're just exiting) in it -// Task : Remove deepest subdirectory from path -//------------------------------------------------------------- -void CPath::UpDirectory(std::string *pLastDirectory /*= NULL*/) -{ - std::string Directory; - - GetDirectory(Directory); - StripTrailingBackslash(Directory); - if (Directory.empty()) - return; - - std::string::size_type nDelimiter = Directory.rfind(DIRECTORY_DELIMITER); - - if (pLastDirectory != NULL) - { - *pLastDirectory = Directory.substr(nDelimiter); - StripLeadingBackslash(*pLastDirectory); - } - - if (nDelimiter != std::string::npos) - { - Directory = Directory.substr(0, nDelimiter); - } - - SetDirectory(Directory.c_str()); -} - -//------------------------------------------------------------- -// Task : Set path 2 current directory -//------------------------------------------------------------- -void CPath::CurrentDirectory() -{ - char buff_path[260]; - memset(buff_path, 0, sizeof(buff_path)); - - Empty(); - -#ifdef _WIN32 - ::GetCurrentDirectory(sizeof(buff_path), buff_path); - SetDriveDirectory(buff_path); -#else - getcwd(buff_path, sizeof(buff_path)); - SetDirectory(buff_path); -#endif -} - -//------------------------------------------------------------- -// Task : Set path 2 the name of specified module -//------------------------------------------------------------- -#ifdef _WIN32 -void CPath::Module(void * hInstance) -{ - char buff_path[MAX_PATH]; - - memset(buff_path, 0, sizeof(buff_path)); - - GetModuleFileName((HINSTANCE)hInstance, buff_path, MAX_PATH); - m_strPath = buff_path; -} - -//------------------------------------------------------------- -// Task : Set path 2 the name of current module -//------------------------------------------------------------- -void CPath::Module() -{ - Module(m_hInst); -} - -//------------------------------------------------------------- -// Task : Set path 2 the directory of specified module -//------------------------------------------------------------- -void CPath::ModuleDirectory(void * hInstance) -{ - Module(hInstance); - SetNameExtension(""); -} - -//------------------------------------------------------------- -// Task : Set path 2 the directory of current module -//------------------------------------------------------------- -void CPath::ModuleDirectory() -{ - Module(); - SetNameExtension(""); -} -#endif - -//--------------------------------------------------------------------------- -// Post : Return TRUE if a directory -// Task : Check if this path represents a directory -//--------------------------------------------------------------------------- -bool CPath::IsDirectory() const -{ - // Check if this path has a filename - std::string file_name; - GetNameExtension(file_name); - - return file_name.empty(); -} - -//------------------------------------------------------------- -// Post : Return TRUE if directory exists -// Task : To determine if the directory exists, we need to -// create a test path with a wildcard (*.*) extension -// and see if FindFirstFile returns anything. We don't -// use CPath::FindFirst() because that routine parses out -// '.' and '..', which fails for empty directories -//------------------------------------------------------------- -bool CPath::DirectoryExists() const -{ -#ifdef _WIN32 - // Create test path - CPath TestPath(m_strPath.c_str()); - - std::string DirName; - TestPath.UpDirectory(&DirName); - TestPath.SetNameExtension(DirName.c_str()); - - WIN32_FIND_DATA FindData; - HANDLE hFindFile = FindFirstFile((const char *)TestPath, &FindData); // Find anything - bool res = (hFindFile != INVALID_HANDLE_VALUE); - - if (hFindFile != NULL) // Make sure we close the search - { - FindClose(hFindFile); - } - -#else - std::string PathText; - GetDirectory(PathText); - StripTrailingBackslash(PathText); - - struct stat fileinfo; - bool res = stat(PathText.c_str(), &fileinfo) == 0 && S_ISDIR(fileinfo.st_mode); -#endif - return res; -} - -//------------------------------------------------------------- -// Post : Return TRUE if these is such a file -// Task : Check if file exists -//------------------------------------------------------------- -bool CPath::Exists() const -{ -#ifdef _WIN32 - WIN32_FIND_DATA FindData; - HANDLE hFindFile = FindFirstFile(m_strPath.c_str(), &FindData); - bool bSuccess = (hFindFile != INVALID_HANDLE_VALUE); - - if (hFindFile != NULL) // Make sure we close the search - { - FindClose(hFindFile); - } - - return bSuccess; -#else - struct stat statbuf; - return stat(m_strPath.c_str(), &statbuf) == 0; -#endif -} - -#ifdef _WIN32 -bool CPath::SelectFile(void * hwndOwner, const char * InitialDir, const char * FileFilter, bool FileMustExist) -{ - CPath CurrentDir(CURRENT_DIRECTORY); - - OPENFILENAME openfilename; - char FileName[MAX_PATH]; - memset(&FileName, 0, sizeof(FileName)); - memset(&openfilename, 0, sizeof(openfilename)); - - openfilename.lStructSize = sizeof(openfilename); - openfilename.hwndOwner = (HWND)hwndOwner; - openfilename.lpstrFilter = FileFilter; - openfilename.lpstrFile = FileName; - openfilename.lpstrInitialDir = InitialDir; - openfilename.nMaxFile = MAX_PATH; - openfilename.Flags = OFN_HIDEREADONLY | (FileMustExist ? OFN_FILEMUSTEXIST : 0); - - bool res = GetOpenFileName(&openfilename); - if (CPath(CURRENT_DIRECTORY) != CurrentDir) - { - CurrentDir.ChangeDirectory(); - } - if (!res) - { - return false; - } - m_strPath = FileName; - cleanPathString(m_strPath); - return true; -} -#endif - -//------------------------------------------------------------- -// Post : Return TRUE on success -// Task : Delete file -//------------------------------------------------------------- -bool CPath::Delete(bool bEvenIfReadOnly) const -{ -#ifdef _WIN32 - uint32_t dwAttr = ::GetFileAttributes(m_strPath.c_str()); - if (dwAttr == (uint32_t)-1) - { - // File does not exist. - return false; - } - - if (((dwAttr & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY) && !bEvenIfReadOnly) - { - // File is read-only, and we're not allowed 2 delete it - return false; - } - - SetFileAttributes(m_strPath.c_str(), FILE_ATTRIBUTE_NORMAL); - return DeleteFile(m_strPath.c_str()) != 0; -#else - return unlink(m_strPath.c_str()) == 0; -#endif -} - -//------------------------------------------------------------- -// Post : Return TRUE on success, false if there is such a target file -// and we weren't granted permission 2 overwrite file or some error -// Task : Copy file -// Since ::CopyFile will not overwrite read only files -// we will make sure the target file is writable first -//------------------------------------------------------------- -bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite) -{ - if (lpcszTargetFile == NULL) - { - return false; - } -#ifdef _WIN32 - // Check if the target file exists - CPath TargetFile(lpcszTargetFile); - if (TargetFile.Exists()) - { - // Yeah there is already such a target file - // Decide if we should overwrite - if (!bOverwrite) - { - return false; - } - - // Delete any previous target - if (!TargetFile.Delete(true)) - { - return false; - } - } - - // CopyFile will set the target's attributes 2 the same as - // the source after copying - return CopyFile(m_strPath.c_str(), lpcszTargetFile, !bOverwrite) != 0; -#else - - bool res = true; - FILE * infile = fopen(m_strPath.c_str(), "rb"); - if(infile == NULL) - { - res = false; - } - - FILE * outfile = NULL; - if (res) - { - outfile = fopen(lpcszTargetFile, "wb"); - if (outfile == NULL) - { - res = false; - } - } - - if (res) - { - while (!feof(infile)) - { - char buffer[1024]; - size_t bytes = fread(buffer, 1, sizeof(buffer), infile); - if (ferror(infile)) - { - res = false; - break; - } - if (!feof(infile)) - { - size_t written = fwrite(buffer, 1, sizeof(buffer), outfile); - } - if (ferror(outfile)) - { - res = false; - break; - } - } - } - - struct stat ts; - if (res) - { - if (fstat(fileno(infile), &ts) != 0) - { - res = false; - } - } - if (res) - { - if (fchmod(fileno(outfile),ts.st_mode) != 0) - { - res = false; - } - } - if (infile != NULL) - { - fclose(infile); - } - if (outfile != NULL) - { - fclose(outfile); - } - return res; -#endif -} - -//------------------------------------------------------------- -// Post : Return TRUE on success, false if there is such a target file -// and we weren't granted permission 2 overwrite file or some error -// Task : Move file -//------------------------------------------------------------- -bool CPath::MoveTo(const char * lpcszTargetFile, bool bOverwrite) -{ -#ifdef _WIN32 - // Check if the target file exists - CPath TargetFile(lpcszTargetFile); - if (TargetFile.Exists()) - { - // Yeah there is already such a target file - // Decide if we should overwrite - if (!bOverwrite) - { - return false; - } - - // Delete any previous target - if (!TargetFile.Delete(TRUE)) - { - return false; - } - } - - return MoveFile(m_strPath.c_str(), lpcszTargetFile) != 0; -#else - return false; -#endif -} - -//------------------------------------------------------------- -// Post : Return TRUE if attributes do match -// Task : Compare finder attributes -//------------------------------------------------------------- -bool CPath::AttributesMatch(uint32_t dwTargetAttributes, uint32_t dwFileAttributes) -{ - if (dwTargetAttributes == FIND_ATTRIBUTE_ALLFILES) - { - return true; - } - if (dwTargetAttributes == FIND_ATTRIBUTE_FILES) - { - return ((FIND_ATTRIBUTE_SUBDIR & dwFileAttributes) == 0); - } - return (((dwTargetAttributes & dwFileAttributes) != 0) && ((FIND_ATTRIBUTE_SUBDIR & dwTargetAttributes) == (FIND_ATTRIBUTE_SUBDIR & dwFileAttributes))); -} - -//------------------------------------------------------------- -// Post : Return TRUE if any match found -// Task : Find the first file that meets this path and the specified attributes -// You can specify the current attributes of the file or directory -// The attributes are represented by a combination (|) of the following -// constants: -// -// _A_ARCH Archive. Set whenever the file is -// changed, and cleared by the BACKUP command -// _A_HIDDEN Hidden file. Not normally seen with -// the DIR command, unless the /AH option -// is used. Returns information about normal -// files as well as files with this attribute -// FIND_ATTRIBUTE_FILES Normal. File can be read or written to -// without restriction -// _A_RDONLY Read-only. File cannot be opened for writing, -// and a file with the same name cannot be created -// FIND_ATTRIBUTE_SUBDIR Subdirectory -// _A_SYSTEM System file. Not normally seen with the DIR -// command, unless the /AS option is used -// -// These attributes do not follow a simple additive logic -// Note that FIND_ATTRIBUTE_FILES is 0x00, so it effectively cannot be -// removed from the attribute set. You will therefore always -// get normal files, and may also get Archive, Hidden, etc. -// if you specify those attributes -// See aso: FindFirstFile, FindNextFile -//------------------------------------------------------------- -bool CPath::FindFirst(uint32_t dwAttributes /*= FIND_ATTRIBUTE_FILES*/) -{ - // Close handle to any previous enumeration - Exit(); - - m_dwFindFileAttributes = dwAttributes; -#ifdef _WIN32 - BOOL bGotFile; - BOOL bWantSubdirectory = (BOOL)(FIND_ATTRIBUTE_SUBDIR & dwAttributes); - - // i.) Finding first candidate file - WIN32_FIND_DATA FindData; - m_hFindFile = FindFirstFile(m_strPath.c_str(), &FindData); - bGotFile = (m_hFindFile != INVALID_HANDLE_VALUE); - - while (bGotFile) - { - // ii.) Compare candidate to attributes, and filter out the "." and ".." folders - if (!AttributesMatch(m_dwFindFileAttributes, FindData.dwFileAttributes)) - goto LABEL_GetAnother; - if (bWantSubdirectory && (FindData.cFileName[0] == '.')) - goto LABEL_GetAnother; - - // iii.) Found match, prepare result - if ((FIND_ATTRIBUTE_SUBDIR & FindData.dwFileAttributes) != 0) - StripTrailingBackslash(m_strPath); - - SetNameExtension(FindData.cFileName); - - if ((FIND_ATTRIBUTE_SUBDIR & FindData.dwFileAttributes) != 0) - EnsureTrailingBackslash(m_strPath); - return TRUE; - - // iv.) Not found match, get another - LABEL_GetAnother: - bGotFile = FindNextFile(m_hFindFile, &FindData); - } -#else - std::string Directory, Name, Extension; - GetComponents(&Directory, &Name, &Extension); - - m_FindWildcard = Name; - if (!Extension.empty()) - { - m_FindWildcard += EXTENSION_DELIMITER; - m_FindWildcard += Extension; - } - - m_OpenedDir = opendir(Directory.c_str()); - if (m_OpenedDir == NULL) return false; - return FindNext(); -#endif - return false; -} - -//------------------------------------------------------------- -// Post : Return TRUE if a new match found -// Task : Find the next file that meets the conditions specified -// in the last FindFirst call -//------------------------------------------------------------- -bool CPath::FindNext() -{ -#ifdef _WIN32 - if (m_hFindFile == NULL) - { - return false; - } - - WIN32_FIND_DATA FindData; - while (FindNextFile(m_hFindFile, &FindData) != false) - { // while(FindNext(...)) - if (AttributesMatch(m_dwFindFileAttributes, FindData.dwFileAttributes)) - { // if(AttributesMatch(...) - if ((_A_SUBDIR & FindData.dwFileAttributes) == _A_SUBDIR) - { - if (IsDirectory()) - { - // Found a directory - UpDirectory(); - } - else - { - SetNameExtension(""); - } - AppendDirectory(FindData.cFileName); - } - else - { - // Found a file - if (IsDirectory()) - { - // Found a directory - UpDirectory(); - } - SetNameExtension(FindData.cFileName); - } - if ((_A_SUBDIR & FindData.dwFileAttributes) == _A_SUBDIR) - { - EnsureTrailingBackslash(m_strPath); - } - return TRUE; - } - } -#else - dirent* pEntry; - while ((pEntry = readdir((DIR*)m_OpenedDir))) - { - uint32_t dwFileAttributes = pEntry->d_type == DT_DIR ? FIND_ATTRIBUTE_SUBDIR : FIND_ATTRIBUTE_FILES; - - - // ii.) Compare candidate to attributes, and filter out the "." and ".." folders - if (!AttributesMatch(m_dwFindFileAttributes, dwFileAttributes) || - strcmp(pEntry->d_name,".") == 0 || - strcmp(pEntry->d_name,"..") == 0 || - !wildcmp(m_FindWildcard.c_str(),pEntry->d_name)) - { - continue; - } - if ((FIND_ATTRIBUTE_SUBDIR & dwFileAttributes) == FIND_ATTRIBUTE_SUBDIR) - { - if (IsDirectory()) - { - // Found a directory - UpDirectory(); - } - else - { - SetNameExtension(""); - } - AppendDirectory(pEntry->d_name); - } - else - { - //WriteTrace(TracePath, TraceVerbose, "is file"); - // Found a file - if (IsDirectory()) - { - // Found a directory - UpDirectory(); - } - SetNameExtension(pEntry->d_name); - //WriteTrace(TracePath, TraceVerbose, "m_strPath: %s pEntry->d_name: %s", m_strPath.c_str(), pEntry->d_name); - } - if ((FIND_ATTRIBUTE_SUBDIR & dwFileAttributes) == FIND_ATTRIBUTE_SUBDIR) - { - EnsureTrailingBackslash(m_strPath); - } - return true; - } -#endif - return false; -} - -//------------------------------------------------------------- -// Post : Return TRUE on success -// Task : Change current working directory of application 2 path -//------------------------------------------------------------- -bool CPath::ChangeDirectory() -{ -#ifdef _WIN32 - std::string DriveDirectory; - GetDriveDirectory(DriveDirectory); - - return SetCurrentDirectory(DriveDirectory.c_str()) != 0; -#else - std::string Dir; - GetDirectory(Dir); - - return chdir(Dir.c_str()) == 0; -#endif -} - -void CPath::NormalizePath(CPath BaseDir) -{ -#ifdef _WIN32 - stdstr Directory = BaseDir.GetDriveDirectory(); -#else - stdstr Directory = BaseDir.GetDirectory(); -#endif - bool Changed = false; - if (IsRelative()) - { - EnsureTrailingBackslash(Directory); - Directory += GetDirectory(); - Changed = true; - } - strvector Parts = Directory.Tokenize(DIRECTORY_DELIMITER); - strvector NormalizesParts; - for (strvector::const_iterator itr = Parts.begin(); itr != Parts.end(); itr++) - { - if (*itr == ".") - { - Changed = true; - } - else if (*itr == "..") - { - NormalizesParts.pop_back(); - Changed = true; - } - else - { - NormalizesParts.push_back(*itr); - } - } - if (Changed) - { - Directory.clear(); - for (strvector::const_iterator itr = NormalizesParts.begin(); itr != NormalizesParts.end(); itr++) - { - Directory += *itr + DIRECTORY_DELIMITER; - } -#ifdef _WIN32 - SetDriveDirectory(Directory.c_str()); -#else - SetDirectory(Directory.c_str()); -#endif - } -} - -//------------------------------------------------------------- -// Pre : If bCreateIntermediates is TRUE, create all eventually -// missing parent directories too -// Post : Return TRUE on success -// Task : Create new directory -//------------------------------------------------------------- -bool CPath::DirectoryCreate(bool bCreateIntermediates /*= TRUE*/) -{ - //WriteTrace(TracePath, TraceDebug, "m_strPath = %s bCreateIntermediates = %s",m_strPath.c_str(),bCreateIntermediates ? "true" : "false"); - std::string PathText; - bool bSuccess; - - if (DirectoryExists()) - { - //WriteTrace(TracePath, TraceDebug, "Directory already exists, res = true"); - return true; - } - -#ifdef _WIN32 - GetDriveDirectory(PathText); - StripTrailingBackslash(PathText); - //WriteTrace(TracePath, TraceDebug, "Create %s",PathText.c_str()); - bSuccess = ::CreateDirectory(PathText.c_str(), NULL) != 0; -#else - GetDirectory(PathText); - StripTrailingBackslash(PathText); - //WriteTrace(TracePath, TraceDebug, "Create %s",PathText.c_str()); - bSuccess = mkdir(PathText.c_str(), S_IRWXU) == 0; - if (!bSuccess) - { - //WriteTrace(TracePath, TraceWarning, "failed to create \"%s\" errno: %d",PathText.c_str(), errno); - } -#endif - if (!bSuccess && bCreateIntermediates) - { - //WriteTrace(TracePath, TraceDebug, "failed creating intermediates"); - std::string::size_type nDelimiter = PathText.rfind(DIRECTORY_DELIMITER); - if (nDelimiter == std::string::npos) - { - return false; - } - - PathText.resize(nDelimiter + 1); - CPath SubPath(PathText); - - return SubPath.DirectoryCreate() ? DirectoryCreate(false) : false; - } - //WriteTrace(TracePath, TraceDebug, "res = %s",bSuccess ? "true" : "false"); - return bSuccess; -} - -//Helpers - -//------------------------------------------------------------------------ -// Task : Remove first character (if any) if it's chLeading -//------------------------------------------------------------------------ -void CPath::cleanPathString(std::string& rDirectory) const -{ - std::string::size_type pos = rDirectory.find(DIRECTORY_DELIMITER2); - while (pos != std::string::npos) - { - rDirectory.replace(pos, 1, &DIRECTORY_DELIMITER); - pos = rDirectory.find(DIRECTORY_DELIMITER2, pos + 1); - } - - bool AppendEnd = !_strnicmp(rDirectory.c_str(), DIR_DOUBLEDELIM, 2); - pos = rDirectory.find(DIR_DOUBLEDELIM); - while (pos != std::string::npos) - { - rDirectory.replace(pos, 2, &DIRECTORY_DELIMITER); - pos = rDirectory.find(DIR_DOUBLEDELIM, pos + 1); - } - if (AppendEnd) - { - rDirectory.insert(0, stdstr_f("%c", DIRECTORY_DELIMITER).c_str()); - } -} - -void CPath::StripLeadingChar(std::string& rText, char chLeading) const -{ - std::string::size_type nLength = rText.length(); - if (nLength == 0) - return; - - if (rText[0] == chLeading) - rText = rText.substr(1); -} - -//------------------------------------------------------------------------ -// Task : Remove first character if \ -//------------------------------------------------------------------------ -void CPath::StripLeadingBackslash(std::string& Directory) const -{ - std::string::size_type nLength = Directory.length(); - - // If Directory is of the form '\', don't do it - if (nLength <= 1) - return; - - if (Directory[0] == DIRECTORY_DELIMITER) - Directory = Directory.substr(1); -} - -//------------------------------------------------------------------------ -// Task : Remove last character (if any) if it's chTrailing -//------------------------------------------------------------------------ -void CPath::StripTrailingChar(std::string& rText, char chTrailing) const -{ - std::string::size_type nLength = rText.length(); - if (nLength == 0) - return; - - if (rText[nLength - 1] == chTrailing) - rText.resize(nLength - 1); -} - -//------------------------------------------------------------------------ -// Task : Remove last character if \ -//------------------------------------------------------------------------ -void CPath::StripTrailingBackslash(std::string& rDirectory) const -{ - for (;;) - { - std::string::size_type nLength = rDirectory.length(); - if (nLength <= 1) - { - return; - } - - if (rDirectory[nLength - 1] == DIRECTORY_DELIMITER || rDirectory[nLength - 1] == DIRECTORY_DELIMITER2) - { - rDirectory.resize(nLength - 1); - continue; - } - return; - } -} - -//------------------------------------------------------------------------ -// Task : Add a backslash to the end of Directory if there is -// not already one there -//------------------------------------------------------------------------ -void CPath::EnsureTrailingBackslash(std::string& Directory) const -{ - std::string::size_type nLength = Directory.length(); - - if (Directory.empty() || (Directory[nLength - 1] != DIRECTORY_DELIMITER)) - { - Directory += DIRECTORY_DELIMITER; - } -} - -//------------------------------------------------------------------------ -// Task : Add a backslash to the beginning of Directory if there -// is not already one there -//------------------------------------------------------------------------ -void CPath::EnsureLeadingBackslash(std::string & Directory) const -{ - if (Directory.empty() || (Directory[0] != DIRECTORY_DELIMITER)) - { - Directory = stdstr_f("%c%s", DIRECTORY_DELIMITER, Directory.c_str()); - } -} - -#ifndef _WIN32 -bool CPath::wildcmp(const char *wild, const char *string) -{ - const char *cp = NULL, *mp = NULL; - - while ((*string) && (*wild != '*')) - { - if ((*wild != *string) && (*wild != '?')) - { - return 0; - } - wild++; - string++; - } - - while (*string) - { - if (*wild == '*') - { - if (!*++wild) - { - return 1; - } - mp = wild; - cp = string+1; - } - else if ((*wild == *string) || (*wild == '?')) - { - wild++; - string++; - } - else - { - wild = mp; - string = cp++; - } - } - - while (*wild == '*') - { - wild++; - } - return !*wild; -} -#endif diff --git a/GLideN64/src/GLideNUI-wtl/util/path.h b/GLideN64/src/GLideNUI-wtl/util/path.h deleted file mode 100644 index d488d3c..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/path.h +++ /dev/null @@ -1,165 +0,0 @@ -#pragma once -#include -#include -#include "StdString.h" - -class CPath -{ - //Enums -public: - - enum DIR_CURRENT_DIRECTORY { CURRENT_DIRECTORY = 1 }; -#ifdef _WIN32 - enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 2 }; - enum DIR_MODULE_FILE { MODULE_FILE = 3 }; -#endif - - enum - { - FIND_ATTRIBUTE_ALLFILES = 0xFFFF, // Search Include all files - FIND_ATTRIBUTE_FILES = 0x0000, // File can be read or written to without restriction - FIND_ATTRIBUTE_SUBDIR = 0x0010, // Subdirectories - }; - - //Attributes -private: - std::string m_strPath; -#ifdef _WIN32 - void * m_hFindFile; - static void * m_hInst; -#else - void * m_OpenedDir; - std::string m_FindWildcard; -#endif - uint32_t m_dwFindFileAttributes; - -public: - //Methods - - //Construction / destruction - CPath(); - CPath(const CPath& rPath); - CPath(const char * lpszPath); - CPath(const char * lpszPath, const char * NameExten); - CPath(const std::string& strPath); - CPath(const std::string& strPath, const char * NameExten); - CPath(const std::string& strPath, const std::string& NameExten); - - CPath(DIR_CURRENT_DIRECTORY sdt, const char * NameExten = NULL); -#ifdef _WIN32 - CPath(DIR_MODULE_DIRECTORY sdt, const char * NameExten = NULL); - CPath(DIR_MODULE_FILE sdt); -#endif - virtual ~CPath(); - - //Operators - CPath& operator = (const CPath& rPath); - CPath& operator = (const char * lpszPath); - CPath& operator = (const std::string & strPath); - bool operator == (const CPath& rPath) const; - bool operator != (const CPath& rPath) const; - operator const char *() const; - operator const std::string &() { return m_strPath; } - - //Get path components -#ifdef _WIN32 - void GetDriveDirectory(std::string & rDriveDirectory) const; - std::string GetDriveDirectory(void) const; -#endif - void GetDirectory(std::string& rDirectory) const; - std::string GetDirectory(void) const; - void GetName(std::string& rName) const; - std::string GetName(void) const; - void GetNameExtension(std::string& rNameExtension) const; - std::string GetNameExtension(void) const; - void GetExtension(std::string& rExtension) const; - std::string GetExtension(void) const; - void GetLastDirectory(std::string& rDirectory) const; - std::string GetLastDirectory(void) const; - void GetFullyQualified(std::string& rFullyQualified) const; -#ifdef _WIN32 - void GetComponents(std::string* pDrive = NULL, std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const; -#else - void GetComponents(std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const; -#endif - //Get other state - bool IsEmpty() const { return m_strPath.empty(); } - bool IsRelative() const; - - //Set path components -#ifdef _WIN32 - void SetDrive(char chDrive); - void SetDriveDirectory(const char * lpszDriveDirectory); -#endif - void SetDirectory(const char * lpszDirectory, bool bEnsureAbsolute = false); - void SetName(const char * lpszName); - void SetName(int iName); - void SetNameExtension(const char * lpszNameExtension); - void SetExtension(const char * lpszExtension); - void SetExtension(int iExtension); - void AppendDirectory(const char * lpszSubDirectory); - void UpDirectory(std::string* pLastDirectory = NULL); -#ifdef _WIN32 - void SetComponents(const char * lpszDrive, const char * lpszDirectory, const char * lpszName, const char * lpszExtension); -#else - void SetComponents(const char * lpszDirectory, const char * lpszName, const char * lpszExtension); -#endif - //Set whole path - void Empty() { m_strPath.erase(); } - void CurrentDirectory(); -#ifdef _WIN32 - void Module(); - void Module(void * hInstance); - void ModuleDirectory(); - void ModuleDirectory(void * hInstance); -#endif - - //Directory information - bool IsDirectory() const; - bool DirectoryExists() const; - - //File Information - bool IsFile() const { return !IsDirectory(); } - bool Exists() const; -#ifdef _WIN32 - bool SelectFile(void * hwndOwner, const char * InitialDir, const char * FileFilter, bool FileMustExist); -#endif - - //Directory operations - bool DirectoryCreate(bool bCreateIntermediates = true); - bool ChangeDirectory(); - void NormalizePath(CPath BaseDir); - - //File operations - bool Delete(bool bEvenIfReadOnly = true) const; - bool CopyTo(const char * lpcszTargetFile, bool bOverwrite = true); - bool MoveTo(const char * lpcszTargetFile, bool bOverwrite = true); - - //Finders - bool FindFirst(uint32_t dwAttributes = 0); - bool FindNext(); - - // Helpers -#ifdef _WIN32 - static void SethInst(void * hInst); - static void * GethInst(); -#endif - -private: - //Setup & Cleanup - inline void Init(); - inline void Exit(); - - bool AttributesMatch(uint32_t dwTargetAttributes, uint32_t dwFileAttributes); - - void cleanPathString(std::string& rDirectory) const; - void StripLeadingChar(std::string& rText, char chLeading) const; - void StripLeadingBackslash(std::string& Directory) const; - void StripTrailingChar(std::string& rText, char chTrailing) const; - void StripTrailingBackslash(std::string& rDirectory) const; - void EnsureTrailingBackslash(std::string& Directory) const; - void EnsureLeadingBackslash(std::string& Directory) const; -#ifndef _WIN32 - bool wildcmp(const char *wild, const char *string); -#endif -}; diff --git a/GLideN64/src/GLideNUI-wtl/util/ts2lang.cpp b/GLideN64/src/GLideNUI-wtl/util/ts2lang.cpp deleted file mode 100644 index d9afd22..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/ts2lang.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include -#include "../Language.h" -#include "../ticpp/ticpp.h" -#include "path.h" -#include "md5.h" -#include "StdString.h" -#include -#include -#include - -//#define DEBUG_LANG -typedef std::map Translations; - -std::string CleanString(std::string source) -{ - stdstr value = source; - value.Replace("

", "\\n\\n"); - value.Replace("
", "\\n"); - value.Replace(""", "\\\""); - const std::regex re("<[^>]*>"); - while (std::regex_search(value, re)) { - value = std::regex_replace(value, re, ""); - } - value.Replace("\\n\\n\"", "\""); - value.Replace(stdstr().FromUTF16(L"–"), "-"); - return value; -} - -bool GetLangInfo(const char * filename, std::string & version, std::string & langCode, Translations & translations) -{ - ticpp::Document doc(filename); - doc.LoadFile(); - - ticpp::Element * pElem = doc.FirstChildElement(); - if (pElem == NULL) - { - return false; - } - if (pElem->Value() != "TS") - { - return false; - } - std::string text = pElem->GetText(false); - std::string elmValue = pElem->Value(); - for (ticpp::Attribute* child = pElem->FirstAttribute(false); child; child = child->Next(false)) - { - if (child->Name() == "version") - { - version = child->Value(); - } - else if (child->Name() == "language") - { - langCode = child->Value(); - } - } - - if (version.empty() || langCode.empty()) - { - return false; - } - for (ticpp::Element* childElement = pElem->FirstChildElement(false); childElement; childElement = childElement->NextSiblingElement(false)) - { - if (childElement->Value() != "context") - { - continue; - } - for (ticpp::Element* contextElement = childElement->FirstChildElement(false); contextElement; contextElement = contextElement->NextSiblingElement(false)) - { - if (contextElement->Value() != "message") - { - continue; - } - stdstr source, translation; - for (ticpp::Element* messageElement = contextElement->FirstChildElement(false); messageElement; messageElement = messageElement->NextSiblingElement(false)) - { - if (messageElement->Value() == "source") - { - source = CleanString(messageElement->GetText()); - } - else if (messageElement->Value() == "translation") - { - translation = CleanString(messageElement->GetText(false)); - } - } - if (source.length() > 0 && translation.length() > 0) - { - translations.insert(Translations::value_type(source, translation)); - } - } - } - return translations.size() > 0; -} - -typedef std::map ID_MAP; -typedef std::set ID_USED; -void WriteSection(FILE * file, const ID_MAP & defaultStrings, const Translations & hashedTranslations, ID_USED &usedTranslations, const char * sectionName, int32_t start, int32_t end) -{ - std::string section; - for (int32_t id = start; id <= end; id++) - { - ID_MAP::const_iterator defaultStr_itr = defaultStrings.find(id); - if (defaultStr_itr == defaultStrings.end()) - { - continue; - } - stdstr defaultStr = defaultStr_itr->second; - defaultStr.Replace("\n", "\\n"); //escape characters for comparison - defaultStr.Replace("\"", "\\\""); - stdstr matchingHash = MD5(defaultStr).hex_digest(); - Translations::const_iterator translation_itr = hashedTranslations.find(matchingHash); - if (translation_itr == hashedTranslations.end()) - { - continue; - } - usedTranslations.insert(matchingHash); - stdstr_f line("#%04d# \"%s\"\n", id, translation_itr->second.c_str()); - section += line; - } - if (section.length() == 0) - { - return; - } - fprintf(file, "/*********************************************************************************\n"); - fprintf(file, "* %-78s *\n", sectionName); - fprintf(file, "*********************************************************************************/\n"); - fprintf(file, "%s\n", section.c_str()); -} - -bool WriteLangFile(const char * dstFile, const char * language, const Translations & translations, bool debugEnglish) -{ - ID_MAP defaultStrings = (ID_MAP)GetDefaultStrings(); - Translations hashedTranslations; - ID_USED usedTranslations; - for (Translations::const_iterator translation_itr = translations.begin(); translation_itr != translations.end(); translation_itr++) - { - std::string translation = debugEnglish ? translation_itr->first : translation_itr->second; - std::string key = MD5(translation_itr->first).hex_digest(); - hashedTranslations.insert(Translations::value_type(key, translation)); - } - - FILE * file = NULL; - fopen_s(&file, dstFile, "wb"); - if (file == NULL) - { - return false; - } - uint8_t utf_bom[3] = { 0xEF, 0xBB, 0xBF }; - fwrite(utf_bom, sizeof(utf_bom), 1, file); - - fprintf(file, "/*********************************************************************************\n"); - fprintf(file, "* Meta Information *\n"); - fprintf(file, "*********************************************************************************/\n"); - fprintf(file, "#0001# \"%s\"\n\n", language); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Config Dialog", 1000, 1999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Video Tab", 2000, 2999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Emulation Tab", 3000, 3999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Frame Buffer Tab", 4000, 4999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Texture enhancement", 5000, 5999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "On-screen display", 6000, 6999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Debug", 7000, 7999); - WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "About", 9000, 9999); - - for (ID_USED::const_iterator usedTranslation_itr = usedTranslations.begin(); usedTranslation_itr != usedTranslations.end(); usedTranslation_itr++) - { - Translations::iterator translation_itr = hashedTranslations.find(usedTranslation_itr->c_str()); - if (translation_itr != hashedTranslations.end()) - { - hashedTranslations.erase(translation_itr); - } - } -#ifdef DEBUG_LANG - if (hashedTranslations.size() > 0) - { - fprintf(file, "/*********************************************************************************\n"); - fprintf(file, "* Untranslated Strings *\n"); - fprintf(file, "*********************************************************************************/\n"); - for (Translations::const_iterator translation_itr = hashedTranslations.begin(); translation_itr != hashedTranslations.end(); translation_itr++) - { - fprintf(file, "%s=\"%s\"\n", translation_itr->first.c_str(), translation_itr->second.c_str()); - } - } -#endif - fclose(file); - return true; -} - -int main() -{ - if (__argc < 2) - { - return 0; - } - - CPath src(__argv[1], "*.ts"); - CPath dst(__argv[2], ""); - - if (!src.Exists()) - { - return 0; - } - - std::map languages = { - { "de_DE", L"Deutsch" }, - { "es_ES", L"Español" }, - { "fr_FR", L"Français" }, - { "it_IT", L"Italiano" }, - { "ja_JP", L"日本語" }, - { "pl_PL", L"Polski" }, - { "pt_BR", L"Português do Brasil" } - }; - - if (src.FindFirst()) - { - do - { - Translations translations; - std::string version, langCode, language; - if (GetLangInfo(src, version, langCode, translations)) - { - language = stdstr().FromUTF16(languages[langCode].c_str()); - dst.SetName(src.GetName().c_str()); - dst.SetExtension("Lang"); - if (!WriteLangFile(dst, language.c_str(), translations, 0)) - { - return false; - } -#ifdef DEBUG_LANG - if (langCode == "es_ES") - { - dst.SetName("gliden64_en"); - dst.SetExtension("Lang"); - WriteLangFile(dst, "English", translations, 1); - } -#endif - } - } while (src.FindNext()); - } - return 0; -} diff --git a/GLideN64/src/GLideNUI-wtl/util/util.cpp b/GLideN64/src/GLideNUI-wtl/util/util.cpp deleted file mode 100644 index f8574f1..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/util.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "util.h" -#include -#include - -std::string FromUTF16(const wchar_t * UTF16Source) -{ - std::string Result; - - uint32_t utf8size = WideCharToMultiByte(CP_UTF8, 0, UTF16Source, -1, NULL, 0, NULL, NULL); - if (utf8size > 0) - { - std::unique_ptr pUTF8(new char[utf8size]); - WideCharToMultiByte(CP_UTF8, 0, UTF16Source, -1, pUTF8.get(), utf8size, NULL, NULL); - Result = pUTF8.get(); - } - return Result; -} - -std::wstring ToUTF16(const char * Source) -{ - std::wstring res; - - DWORD nNeeded = MultiByteToWideChar(CP_UTF8, 0, Source, -1, NULL, 0); - if (nNeeded > 0) - { - std::unique_ptr pUTF8(new wchar_t[nNeeded]); - if (pUTF8.get() != NULL) - { - nNeeded = MultiByteToWideChar(CP_UTF8, 0, Source, -1, pUTF8.get(), nNeeded); - if (nNeeded) - { - res = pUTF8.get(); - } - } - } - return res; -} - -std::wstring FormatStrW(const wchar_t * strFormat, ...) -{ - va_list args; - va_start(args, strFormat); - - size_t nlen = _vscwprintf(strFormat, args) + 1; - wchar_t * buffer = (wchar_t *)alloca(nlen * sizeof(wchar_t)); - buffer[nlen - 1] = 0; - - std::wstring res; - if (buffer != NULL) - { - _vsnwprintf(buffer, nlen - 1, strFormat, args); - res = buffer; - } - va_end(args); - return res; - -} diff --git a/GLideN64/src/GLideNUI-wtl/util/util.h b/GLideN64/src/GLideNUI-wtl/util/util.h deleted file mode 100644 index 51a0582..0000000 --- a/GLideN64/src/GLideNUI-wtl/util/util.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -#include - -std::string FromUTF16(const wchar_t * UTF16Source); -std::wstring ToUTF16(const char * Source); -std::wstring FormatStrW(const wchar_t * Source, ...); - -template class range { -public: - static bool contains(int i) { return min <= i && i < max; } -}; \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/wtl-BitmapPicture.cpp b/GLideN64/src/GLideNUI-wtl/wtl-BitmapPicture.cpp deleted file mode 100644 index f733146..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-BitmapPicture.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "wtl-BitmapPicture.h" - -CBitmapPicture::CBitmapPicture() : - m_hBitmap(NULL), - m_nResourceID(-1), - m_ResourceIcon(false) -{ - memset(&m_bmInfo, 0, sizeof(m_bmInfo)); - m_BackgroundBrush.CreateSolidBrush(::GetSysColor(COLOR_3DFACE)); -} - -LRESULT CBitmapPicture::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/) -{ - CPaintDC dc(m_hWnd); - CRect rect; - GetClientRect(&rect); - - CBrush PaintBrush; - HBRUSH OldBrush = dc.SelectBrush(m_BackgroundBrush); - dc.PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY); - if (m_ResourceIcon) - { - CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), m_nResourceID > 0 ? MAKEINTRESOURCE(m_nResourceID) : m_strResourceName.c_str(), IMAGE_ICON, m_IconWidth, m_IconHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE); - if (!hIcon.IsNull()) - { - dc.DrawIconEx(0, 0, hIcon, rect.Width(), rect.Height(), 0, NULL, DI_NORMAL); - } - } - dc.SelectBrush(OldBrush); - return 0; -} - -bool CBitmapPicture::SetIcon(LPCWSTR lpszResourceName, uint32_t nWidth, uint32_t nHeight) -{ - CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), lpszResourceName > 0 ? MAKEINTRESOURCE(lpszResourceName) : lpszResourceName, IMAGE_ICON, nWidth, nHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE); - if (hIcon.IsNull()) - { - return false; - } - ICONINFO IconInfo; - if (!hIcon.GetIconInfo(&IconInfo)) - { - return false; - } - if (IS_INTRESOURCE(lpszResourceName)) - { - m_nResourceID = (int)lpszResourceName; - } - else - { - m_strResourceName = lpszResourceName; - } - m_ResourceIcon = true; - m_IconWidth = nWidth; - m_IconHeight = nHeight; - return true; -} - -bool CBitmapPicture::SetBitmap(HBITMAP hBitmap) -{ - m_hBitmap.Attach(hBitmap); - return ::GetObject(m_hBitmap, sizeof(BITMAP), &m_bmInfo) != 0; -} - -void CBitmapPicture::SetBackroundBrush(HBRUSH brush) -{ - m_BackgroundBrush.Attach(brush); -} diff --git a/GLideN64/src/GLideNUI-wtl/wtl-BitmapPicture.h b/GLideN64/src/GLideNUI-wtl/wtl-BitmapPicture.h deleted file mode 100644 index a235143..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-BitmapPicture.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#include "wtl.h" -#include - -class CBitmapPicture : - public CWindowImpl -{ -public: - BEGIN_MSG_MAP(CBitmapPicture) - MESSAGE_HANDLER(WM_PAINT, OnPaint); - END_MSG_MAP() - - CBitmapPicture(); - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/); - - bool SetIcon(LPCWSTR lpszResourceName, uint32_t nWidth, uint32_t nHeight); - void SetBackroundBrush(HBRUSH brush); - -private: - CBitmapPicture(const CBitmapPicture&); - CBitmapPicture& operator=(const CBitmapPicture&); - - bool CBitmapPicture::SetBitmap(HBITMAP hBitmap); - - int m_nResourceID; - std::wstring m_strResourceName; - uint32_t m_IconWidth, m_IconHeight; - bool m_ResourceIcon; - BITMAP m_bmInfo; - CBitmap m_hBitmap; - CBrush m_BackgroundBrush; -}; \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/wtl-ColorButton.cpp b/GLideN64/src/GLideNUI-wtl/wtl-ColorButton.cpp deleted file mode 100644 index caf17a9..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-ColorButton.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "wtl-ColorButton.h" - -CColorButton::CColorButton() : - m_Red(0), - m_Green(0), - m_Blue(0) -{ - memset(m_CustClr, 0, sizeof(m_CustClr)); -} - -LRESULT CColorButton::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/) -{ - CPaintDC dc(m_hWnd); - - CRect rect; - GetClientRect(&rect); - - CPen pen; - pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_GRAYTEXT)); - HPEN hpenOld = dc.SelectPen(pen); - CBrush PaintBrush; - PaintBrush.CreateSolidBrush(RGB(m_Red, m_Green, m_Blue)); - dc.SelectBrush(PaintBrush); - dc.Rectangle(rect.left, rect.top, rect.Width(), rect.Height()); - dc.SelectPen(hpenOld); - - return 0; -} - -void CColorButton::SetColor(uint8_t Red, uint8_t Green, uint8_t Blue) -{ - m_Red = Red; - m_Green = Green; - m_Blue = Blue; - SendNotification(CPN_SELCHANGE); - Invalidate(); -} - -LRESULT CColorButton::OnClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - CHOOSECOLOR cc = { 0 }; - static DWORD rgbCurrent; // initial color selection - ZeroMemory(&cc, sizeof(cc)); - cc.lStructSize = sizeof(cc); - cc.hwndOwner = GetParent(); - cc.lpCustColors = (LPDWORD)m_CustClr; - cc.rgbResult = RGB(m_Red, m_Green, m_Blue); - cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_PREVENTFULLOPEN; - if (ChooseColor(&cc) == TRUE) - { - m_Red = GetRValue(cc.rgbResult); - m_Green = GetGValue(cc.rgbResult); - m_Blue = GetBValue(cc.rgbResult); - SendNotification(CPN_SELCHANGE); - } - return TRUE; -} - -void CColorButton::SendNotification(UINT nCode) -{ - NMCOLORBUTTON nmclr; - nmclr.hdr.code = nCode; - nmclr.hdr.hwndFrom = m_hWnd; - nmclr.hdr.idFrom = GetDlgCtrlID(); - nmclr.clr = RGB(m_Red, m_Green, m_Blue); - ::SendMessage(GetParent(), WM_NOTIFY, (WPARAM)GetDlgCtrlID(), (LPARAM)&nmclr); -} diff --git a/GLideN64/src/GLideNUI-wtl/wtl-ColorButton.h b/GLideN64/src/GLideNUI-wtl/wtl-ColorButton.h deleted file mode 100644 index 6adc36f..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-ColorButton.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -#include "wtl.h" -#include - -class CColorButton : - public CWindowImpl -{ -public: - struct NMCOLORBUTTON - { - NMHDR hdr; - COLORREF clr; - }; - - enum - { - CPN_SELCHANGE = 0x8000, /* Colour Picker Selection change */ - }; - - BEGIN_MSG_MAP(CColorButton) - REFLECTED_COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked) - MESSAGE_HANDLER(WM_PAINT, OnPaint); - END_MSG_MAP() - - CColorButton(); - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/); - void SetColor(uint8_t Red, uint8_t Green, uint8_t Blue); - LRESULT OnClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - - inline uint8_t Red() const { return m_Red; } - inline uint8_t Green() const { return m_Green; } - inline uint8_t Blue() const { return m_Blue; } - -private: - void SendNotification(UINT nCode); - - COLORREF m_CustClr[16]; - uint8_t m_Red, m_Green, m_Blue; -}; diff --git a/GLideN64/src/GLideNUI-wtl/wtl-OsdButton.cpp b/GLideN64/src/GLideNUI-wtl/wtl-OsdButton.cpp deleted file mode 100644 index 1a54983..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-OsdButton.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "wtl-OsdButton.h" - -COSDButton::COSDButton(uint32_t IconId, DWORD dwExtendedStyle, HIMAGELIST hImageList) : - CBitmapButtonImpl(dwExtendedStyle, hImageList), - m_Checked(false) -{ - if (IconId != 0) - { - m_Icon.LoadIcon(IconId); - } -} - -void COSDButton::DoPaint(CDCHandle dc) -{ - CRect rect = { 0 }; - GetClientRect(&rect); - - COLORREF BackgroundColor = RGB(225, 225, 225); - COLORREF BorderColor = RGB(173, 173, 173); - if (!IsWindowEnabled()) - { - BackgroundColor = RGB(204, 204, 204); - BorderColor = RGB(191, 191, 191); - } - else if (m_fMouseOver) - { - BackgroundColor = RGB(229, 241, 251); - BorderColor = RGB(0, 120, 215); - } - if (m_Checked) - { - BackgroundColor = RGB(204, 228, 247); - BorderColor = RGB(0, 84, 153); - } - - CBrush Background; - Background.CreateSolidBrush(BackgroundColor); - - CPen pen; - pen.CreatePen(PS_SOLID, 1, BorderColor); - dc.SelectPen(pen); - dc.SelectBrush(Background); - dc.Rectangle(rect.left, rect.top, rect.right, rect.bottom); - - if (!m_Icon.IsNull()) - { - uint32_t IconBorder = (uint32_t)(rect.Width() * 0.3); - uint32_t IconSize = rect.Width() - (IconBorder * 2); - dc.DrawIconEx(IconBorder, IconBorder, m_Icon, IconSize, IconSize); - } -} - -void COSDButton::SetChecked(bool checked) -{ - if (m_Checked != checked) - { - m_Checked = checked; - Invalidate(); - } -} \ No newline at end of file diff --git a/GLideN64/src/GLideNUI-wtl/wtl-OsdButton.h b/GLideN64/src/GLideNUI-wtl/wtl-OsdButton.h deleted file mode 100644 index bb3d0de..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-OsdButton.h +++ /dev/null @@ -1,19 +0,0 @@ -#include "wtl.h" -#include - -class COSDButton : - public CBitmapButtonImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName()) - - COSDButton(uint32_t IconId, DWORD dwExtendedStyle = BMPBTN_AUTOSIZE | BMPBTN_HOVER, HIMAGELIST hImageList = NULL); - void DoPaint(CDCHandle dc); - void SetChecked(bool checked); - - inline bool isChecked(void) const { return m_Checked; } - -private: - CIcon m_Icon; - bool m_Checked; -}; diff --git a/GLideN64/src/GLideNUI-wtl/wtl-OsdPreview.cpp b/GLideN64/src/GLideNUI-wtl/wtl-OsdPreview.cpp deleted file mode 100644 index f36734a..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-OsdPreview.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "wtl-OsdPreview.h" -#include "FontInfo.h" -#include "util/util.h" -#include "Language.h" -#include - -#pragma comment(lib, "Dwrite.lib") - -COsdPreview::COsdPreview() : - m_FontFile(L"arial.ttf"), - m_FontSize(16), - m_Red(0), - m_Green(0), - m_Blue(0) -{ -} - -void COsdPreview::SetFont(const std::wstring & FontFile) -{ - m_FontFile = FontFile; - Invalidate(); -} - -void COsdPreview::SetFontSize(uint32_t FontSize) -{ - m_FontSize = FontSize; - Invalidate(); -} - -void COsdPreview::SetColor(uint8_t Red, uint8_t Green, uint8_t Blue) -{ - m_Red = Red; - m_Green = Green; - m_Blue = Blue; - Invalidate(); -} - - -LRESULT COsdPreview::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/) -{ - CRect rect; - GetClientRect(&rect); - - CPaintDC dc(m_hWnd); - CBrush PaintBrush; - PaintBrush.CreateSolidBrush(RGB(0, 0, 0)); - dc.SelectBrush(PaintBrush); - dc.Rectangle(rect.left, rect.top, rect.Width(), rect.Height()); - dc.SetTextColor(RGB(m_Red, m_Green, m_Blue)); - dc.SetBkColor(RGB(0, 0, 0)); - - std::wstring fontFileName = ToUTF16(GetFontFolder().c_str()); - fontFileName += L"\\" + m_FontFile; - - AddFontResourceEx(fontFileName.c_str(), FR_PRIVATE, 0); - LOGFONT logFont; - if (SUCCEEDED(GetLogFontFromFileName(fontFileName.c_str(), &logFont))) - { - int desiredPpem = (int)m_FontSize; - logFont.lfHeight = -long(desiredPpem); - HFONT hf = CreateFontIndirect(&logFont); - HFONT hOldFont = (HFONT)dc.SelectFont(hf); - if (hOldFont) - { - dc.DrawText(wGS(OSD_PREVIEW).c_str(), -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - dc.SelectFont(hOldFont); - } - } - return 0; -} - -HRESULT COsdPreview::GetLogFontFromFileName(const wchar_t * fontFileName, LOGFONT* logFont) -{ - CComPtr dwriteFactory; - if (FAILED(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast(&dwriteFactory)))) - { - return S_FALSE; - } - - CComPtr gdiInterop; - if (FAILED(dwriteFactory->GetGdiInterop(&gdiInterop))) - { - return S_FALSE; - } - - CComPtr fontFile; - if (FAILED(dwriteFactory->CreateFontFileReference(fontFileName, nullptr, &fontFile))) - { - return S_FALSE; - } - - BOOL isSupportedFontType = false; - DWRITE_FONT_FILE_TYPE fontFileType; - DWRITE_FONT_FACE_TYPE fontFaceType; - UINT32 numberOfFaces = 0; - if (FAILED(fontFile->Analyze(&isSupportedFontType, &fontFileType, &fontFaceType, &numberOfFaces))) - { - return S_FALSE; - } - if (!isSupportedFontType) - { - return DWRITE_E_FILEFORMAT; - } - - CComPtr fontFace; - IDWriteFontFile * const fontFiles[] = - { - fontFile.p - }; - if (FAILED(dwriteFactory->CreateFontFace(fontFaceType, ARRAYSIZE(fontFiles), &fontFiles[0], 0, DWRITE_FONT_SIMULATIONS_NONE, &fontFace))) - { - return S_FALSE; - } - - if (FAILED(gdiInterop->ConvertFontFaceToLOGFONT(fontFace, OUT logFont))) - { - return S_FALSE; - } - return S_OK; -} diff --git a/GLideN64/src/GLideNUI-wtl/wtl-OsdPreview.h b/GLideN64/src/GLideNUI-wtl/wtl-OsdPreview.h deleted file mode 100644 index 0bf73c9..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-OsdPreview.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "wtl.h" -#include - -class COsdPreview : - public CWindowImpl -{ -public: - BEGIN_MSG_MAP(CColorButton) - MESSAGE_HANDLER(WM_PAINT, OnPaint); - END_MSG_MAP() - - COsdPreview(); - void SetFont(const std::wstring & FontFile); - void SetFontSize(uint32_t FontSize); - void SetColor(uint8_t Red, uint8_t Green, uint8_t Blue); - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); - -private: - static HRESULT GetLogFontFromFileName(const wchar_t * fontFileName, LOGFONT* logFont); - - std::wstring m_FontFile; - uint8_t m_Red, m_Green, m_Blue; - uint32_t m_FontSize; -}; diff --git a/GLideN64/src/GLideNUI-wtl/wtl-WindowFont.h b/GLideN64/src/GLideNUI-wtl/wtl-WindowFont.h deleted file mode 100644 index 0c1bc24..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-WindowFont.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once -#include "wtl.h" - -// Wrapper for the Win32 LOGFONT structure -class CLogFont : public LOGFONT -{ -public: - CLogFont() - { - memset(static_cast(this), 0, sizeof(LOGFONT)); - } -}; - -// Class used to create a font based on the font used by a specific window -class CWindowFont : public CFont -{ -public: - // Font styles - typedef enum tagEType - { - typeNormal = 0x00, - typeBold = 0x01, - typeItalic = 0x02, - typeUnderline = 0x04, - typeSubheading = 0x08, - typeHeading = 0x10, - } EType; -public: - CWindowFont() : CFont() - { - } - - /// hWnd - The window to use for the base font - /// nType - Font style flags - CWindowFont(HWND hWnd, int nType) - { - // We need a HWND - ATLASSERT(hWnd != NULL); - // Create the font - Create(hWnd, nType); - } - - virtual ~CWindowFont() - { - } -public: - // Create the font - // hWnd - The window to use for the base font - // nType - Font style flags - // return true on success - bool Create(HWND hWnd, int nType) - { - // Be defensive - ATLASSERT(hWnd != NULL); - ATLASSERT(::IsWindow(hWnd) != FALSE); - // Get the font the window is currently using - HFONT hFont = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0); - // Do we have a font? - if (hFont == NULL) - return false; - - ::CLogFont lf; - // Fill the LOGFONT - if (::GetObject(hFont, sizeof(lf), &lf) == 0) - return false; - // Amend the LOGFONT members - if (nType & typeBold) - lf.lfWeight = FW_BOLD; - if (nType & typeItalic) - lf.lfItalic = TRUE; - if (nType & typeUnderline) - lf.lfUnderline = TRUE; - if (nType & typeSubheading) - lf.lfHeight = static_cast(lf.lfHeight * 1.25); - if (nType & typeHeading) - lf.lfHeight = static_cast(lf.lfHeight * 2.5); - - // Create the new font - return CreateFontIndirect(&lf) ? true : false; - } - - // Create the font and apply to a nominate dialog control - bool Apply(HWND hWnd, int nType, UINT nControlID) - { - // First create the font - if (IsNull() && !Create(hWnd, nType)) - { - return false; - } - // Apply to the nominated control - CWindow wndControl = ::GetDlgItem(hWnd, nControlID); - ATLASSERT(wndControl != NULL); - // Apply - wndControl.SetFont(m_hFont); - return true; - } -}; diff --git a/GLideN64/src/GLideNUI-wtl/wtl-tooltip.h b/GLideN64/src/GLideNUI-wtl/wtl-tooltip.h deleted file mode 100644 index f2cee08..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl-tooltip.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once - -template < class T, class TT = CToolTipCtrl > -class CToolTipDialog -{ - // Data declarations and members -public: - TT& GetTT() { return m_TT; } -protected: - TT m_TT; - UINT m_uTTStyle; - UINT m_uToolFlags; - // Construction - CToolTipDialog(UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON, UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS) - : m_TT(NULL), m_uTTStyle(uTTSTyle), - m_uToolFlags(uToolFlags | TTF_SUBCLASS) - {} - - void TTInit() - { - T* pT = (T*)this; - ATLASSERT(::IsWindow(*pT)); - m_TT.Create(*pT, NULL, NULL, m_uTTStyle); - CToolInfo ToolInfo(pT->m_uToolFlags, *pT, 0, 0, MAKEINTRESOURCE(pT->IDD)); - m_TT.AddTool(&ToolInfo); - ::EnumChildWindows(*pT, SetTool, (LPARAM)pT); - TTDelay(); - TTSize(0); - TTActivate(TRUE); - } - // Operations -public: - void TTActivate(BOOL bActivate) - { - m_TT.Activate(bActivate); - } - void TTSize(int nPixel) - { - m_TT.SetMaxTipWidth(nPixel); - } - void TTDelay() - { - m_TT.SetDelayTime(TTDT_INITIAL, 1250); - m_TT.SetDelayTime(TTDT_RESHOW, 600); - m_TT.SetDelayTime(TTDT_AUTOPOP, 32767); - } - - void TTSetTxt(HWND hTool, _U_STRINGorID text) - { - m_TT.UpdateTipText(text, hTool); - } - void TTSetTxt(UINT idTool, _U_STRINGorID text) - { - TTSetTxt(GetHWND(idTool), text); - } - - BOOL TTAdd(HWND hTool) - { - return SetTool(hTool, (LPARAM)(T*)this); - } - BOOL TTAdd(UINT idTool) - { - return TTAdd(GetHWND(idTool)); - } - - void TTRemove(HWND hTool) - { - m_TT.DelTool(hTool); - } - void TTRemove(UINT idTool) - { - TTRemove(GetHWND(idTool)); - } - // Message map and handlers - BEGIN_MSG_MAP(CToolTipDialog) - MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouse) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL& bHandled) - { - TTInit(); - bHandled = FALSE; - return TRUE; - } - - LRESULT OnMouse(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = (T*)this; - bHandled = FALSE; - if (m_TT.IsWindow()) - m_TT.RelayEvent((LPMSG)pT->GetCurrentMessage()); - return 0; - } - // Implementation -private: - HWND GetHWND(UINT idTool) - { - return ::GetDlgItem(*(T*)this, idTool); - } - - static BOOL CALLBACK SetTool(HWND hTool, LPARAM pDlg) - { - T* pT = (T*)pDlg; - auto idTool = ::GetWindowLong(hTool, GWL_ID); - if (idTool != IDC_STATIC) - { - CToolInfo ToolInfo(pT->m_uToolFlags, hTool, 0, 0, (LPTSTR)idTool); - pT->m_TT.AddTool(&ToolInfo); - } - return TRUE; - } -}; diff --git a/GLideN64/src/GLideNUI-wtl/wtl.h b/GLideN64/src/GLideNUI-wtl/wtl.h deleted file mode 100644 index 5c70e27..0000000 --- a/GLideN64/src/GLideNUI-wtl/wtl.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#undef OS_WINDOWS -#pragma warning(push) -#pragma warning(disable : 4091) // warning C4091: 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared -#pragma warning(disable : 4201) // warning C4201: nonstandard extension used: nameless struct/union -#pragma warning(disable : 4302) // warning C4302: 'type cast': truncation from 'LPCTSTR' to 'WORD' -#pragma warning(disable : 4458) // warning C4458: declaration of 'dwCommonButtons' hides class member -#pragma warning(disable : 4838) // warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion -#pragma warning(disable : 4996) // warning C4996: 'GetVersionExA': was declared deprecated -#define _ATL_DISABLE_NOTHROW_NEW -#include -#include "wtl\atlapp.h" -#include "wtl\atlcrack.h" -#include "wtl\atlctrls.h" -#include "WTL\atlctrlx.h" -#include "WTL\atlgdi.h" -#include "WTL\atlmisc.h" -#include "WTL\atlwinx.h" -#include -#pragma warning(pop) diff --git a/GLideN64/src/GLideNUI/AboutDialog.cpp b/GLideN64/src/GLideNUI/AboutDialog.cpp deleted file mode 100644 index 57af2c0..0000000 --- a/GLideN64/src/GLideNUI/AboutDialog.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "AboutDialog.h" -#include "ui_AboutDialog.h" -#include -#include - -AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags f) : - QDialog(parent, f), - ui(new Ui::AboutDialog) -{ - ui->setupUi(this); -} - -AboutDialog::~AboutDialog() -{ - delete ui; -} - -void AboutDialog::_init() -{ - ui->buttonBox->button(QDialogButtonBox::Close)->setText(tr("Close")); -} diff --git a/GLideN64/src/GLideNUI/AboutDialog.h b/GLideN64/src/GLideNUI/AboutDialog.h deleted file mode 100644 index 2e53ee4..0000000 --- a/GLideN64/src/GLideNUI/AboutDialog.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ABOUTDIALOG_H -#define ABOUTDIALOG_H - -#include - -namespace Ui { -class AboutDialog; -} - -class AboutDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AboutDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); - ~AboutDialog(); - -private: - void _init(); - Ui::AboutDialog *ui; -}; - -#endif // ABOUTDIALOG_H diff --git a/GLideN64/src/GLideNUI/AboutDialog.ui b/GLideN64/src/GLideNUI/AboutDialog.ui deleted file mode 100644 index a9baf9d..0000000 --- a/GLideN64/src/GLideNUI/AboutDialog.ui +++ /dev/null @@ -1,615 +0,0 @@ - - - AboutDialog - - - Qt::WindowModal - - - - 0 - 0 - 339 - 378 - - - - About GLideN64 - - - - :/Icon.ico:/Icon.ico - - - true - - - - QLayout::SetFixedSize - - - - - 10 - - - - - - 0 - 0 - - - - <html><head/><body><p><img width="48" height="48" src=":/Icon.ico"/></p></body></html> - - - - - - - - 20 - 75 - true - - - - GLideN64 - - - - - - - - - - 0 - 275 - - - - - 16777215 - 275 - - - - - About - - - - 12 - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - The next generation open source graphics plugin for N64 emulators. - - - true - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - Authors - - - - - - - 10 - 75 - true - - - - Sergey Lipskiy - - - - - - - Developer - - - true - - - - - - - - 10 - 75 - true - - - - Olivieryuyu - - - - - - - Beta tester - - - true - - - - - - - - 10 - 75 - true - - - - Ryan Rosser - - - - - - - GUI designer - - - true - - - - - - - - - - - Contributors - - - - - - true - - - - - 0 - 0 - 278 - 356 - - - - - - - <html><head/><body><p>Logan McNaughton</p><p>Francisco Zurita</p><p>gizmo98</p><p>purplemarshmallow</p><p>zilmar</p><p>matthewharvey</p><p>lioncash</p><p>Predator82Germany</p><p>AmbientMalice</p><p>baptiste0602</p><p>Gilles Siberlin</p><p>Daniel Eck</p><p>Víctor &quot;IlDucci&quot;</p><p>orbea</p><p>BenjaminSiskoo</p><p>ptitSeb</p><p>Kimberly J. Ortega</p><p>Maxime Morel</p><p>tony971</p><p>SigmaVirus</p><p>Jools Wills</p><p>Nekokabu</p><p>nicklauslittle</p><p>Nebuleon</p><p>sergiobenrocha2</p><p>MichaÅ‚ Durak</p><p>Mushman</p></body></html> - - - - - - - - - - - - Funders - - - - 18 - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - zolcos -Mush Man -nesplayer4life -neko9876 -AnthonyHeathcoat -daman6009 -Paul Lamb -zilmar - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - false - - - - - 0 - 0 - 147 - 1649 - - - - - - - Ryan Rosser -Amadeus Sterl -Narann -camara_luiz -weinerschnitzel -microdev -Thomas Ginelli -ace977 -patryk.szalanski -Detomine -itasovski -keithclark1985 -josephrmoore -fckyourlies -dougforr -camdenfurse -grandslam810 -rictic -Fred Lambes -David Vercruyssen -danielgormly -lukecool -rhilsky -phillipstuerzl -killjoy1337 -ratop46 -william.a.moore -RSP16 -kzidek127 -Dan Holberg -178amm -peterchrjoergensen -hill_jm -petercullenbryan -Christopher M Rock -Kenny.R.Mitchell -Kevin Grasso -mtgyure -Anthony Heathcoat -Liam Burns -Steven Impson -Gwyn.Whieldon -hipnotoad -shmuklidooha -bcanard123 -Ben Slater -Mike Nagy -littlegreendude55 -Jay Loring -Damion D -heranbago -baptiste.guilbert -shadowpower69 -j.mcguirk72 -Peter Greenwood -fla56 -Sergio -theboy_181 -Jindo Fox -s1n.pcc -rafaelvasco -copileo -hugues.fabien -seanmcm157 -David Morris -Jason Lightner -olivier_crepin77 -Paul Lamb -thegump2.0 -Bates -cdoublejj -buddybenj -don.carmical -kyussgreen -info1092 -YQ -Allan Nordhøy -christian010 -creuseur2patateradio -chrisbevanlee -theschklingen -Thomas Lindstrøm -Djipi -Dartus -Oscar Abraham -nwstrathdee -will7046 -Richard42 -V1del -AnthonyBentley -buddybenj -nickshooter251 -sicurella12 -jcspringer -Gru So -Vinícius dos Santos Oliveira -Jimmy Haugh -Malcolm -Alex Strange -Espen Jensen -m.johnsondelta -alexzandar.toxic2 -Ben Slater -WC-Predator -Mush Man -Ben Slater -aznlucidx -Nathan Dick -paulanocom -Ryan Rosser -nekow42 -mgos1 -ian.macdonald996 -itasovski -vikingpower1 -DukeX007X -palaciosgabriel -Franz-Josef Haider -e-male -aweath -famicom4 -Keith_at_UMR -sweatypickle -jeremydmiller - - - - - - - ... and more - - - - - - - - - - - - Credits - - - - - - - 10 - 75 - true - - - - Orkin - - - - - - - Author of the original glN64 graphics plugin - - - true - - - - - - - - 10 - 75 - true - - - - yongzh - - - - - - - Author of gles2n64, a port of glN64 to GL ES 2.0 - - - true - - - - - - - - 10 - 75 - true - - - - Hiroshi Morii - - - - - - - Author of the GlideHQ texture library - - - true - - - - - - - - 10 - 75 - true - - - - ziggy - - - - - - - Author of z64, an OpenGL LLE plugin - - - true - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - - - buttonBox - accepted() - AboutDialog - accept() - - - 257 - 414 - - - 157 - 274 - - - - - buttonBox - rejected() - AboutDialog - reject() - - - 325 - 414 - - - 286 - 274 - - - - - diff --git a/GLideN64/src/GLideNUI/ConfigDialog.cpp b/GLideN64/src/GLideNUI/ConfigDialog.cpp deleted file mode 100644 index 6f3d4e4..0000000 --- a/GLideN64/src/GLideNUI/ConfigDialog.cpp +++ /dev/null @@ -1,1121 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../PluginAPI.h" -#include "../Config.h" -#include "../DebugDump.h" -#include "ui_configDialog.h" -#include "Settings.h" -#include "ConfigDialog.h" -#include "qevent.h" -#include "osal_keys.h" -#include "QtKeyToHID.h" - -static -struct -{ - unsigned short width, height; - const char *description; -} WindowedModes[] = { - { 320, 240, "320 x 240" }, - { 400, 300, "400 x 300" }, - { 480, 360, "480 x 360" }, - { 640, 480, "640 x 480" }, - { 800, 600, "800 x 600" }, - { 960, 720, "960 x 720" }, - { 1024, 768, "1024 x 768" }, - { 1152, 864, "1152 x 864" }, - { 1280, 960, "1280 x 960" }, - { 1280, 1024, "1280 x 1024" }, - { 1440, 1080, "1440 x 1080" }, - { 1600, 1024, "1600 x 1024" }, - { 1600, 1200, "1600 x 1200" } -}; -static -const unsigned int numWindowedModes = sizeof(WindowedModes) / sizeof(WindowedModes[0]); - -static -u32 pow2(u32 dim) -{ - if (dim == 0) - return 0; - - return (1<customSettingsCheckBox->isChecked() && ui->settingsDestGameRadioButton->isChecked()) { - wchar_t strCustomFolderPath[PLUGIN_PATH_SIZE]; - api().FindPluginPath(strCustomFolderPath); - loadCustomRomSettings(QString::fromWCharArray(strCustomFolderPath), m_romName); - } else if (reInit) { - loadSettings(m_strIniPath); - } - - // Video settings - QStringList windowedModesList; - int windowedModesCurrent = -1; - for (unsigned int i = 0; i < numWindowedModes; ++i) { - windowedModesList.append(WindowedModes[i].description); - if (WindowedModes[i].width == config.video.windowedWidth && - WindowedModes[i].height == config.video.windowedHeight) - windowedModesCurrent = i; - } - ui->windowedResolutionComboBox->clear(); - ui->windowedResolutionComboBox->insertItems(0, windowedModesList); - if (windowedModesCurrent > -1) - ui->windowedResolutionComboBox->setCurrentIndex(windowedModesCurrent); - else - ui->windowedResolutionComboBox->setCurrentText( - QString::number(config.video.windowedWidth) + " x " + - QString::number(config.video.windowedHeight) - ); - - // matches w x h where w is 300-7999 and h is 200-3999, spaces around x optional - QRegExp windowedRegExp("([3-9][0-9]{2}|[1-7][0-9]{3}) ?x ?([2-9][0-9]{2}|[1-3][0-9]{3})"); - QValidator *windowedValidator = new QRegExpValidator(windowedRegExp, this); - ui->windowedResolutionComboBox->setValidator(windowedValidator); - - ui->overscanCheckBox->toggle(); - ui->overscanCheckBox->setChecked(config.frameBufferEmulation.enableOverscan != 0); - ui->overscanNtscLeftSpinBox->setValue(config.frameBufferEmulation.overscanNTSC.left); - ui->overscanNtscRightSpinBox->setValue(config.frameBufferEmulation.overscanNTSC.right); - ui->overscanNtscTopSpinBox->setValue(config.frameBufferEmulation.overscanNTSC.top); - ui->overscanNtscBottomSpinBox->setValue(config.frameBufferEmulation.overscanNTSC.bottom); - ui->overscanPalLeftSpinBox->setValue(config.frameBufferEmulation.overscanPAL.left); - ui->overscanPalRightSpinBox->setValue(config.frameBufferEmulation.overscanPAL.right); - ui->overscanPalTopSpinBox->setValue(config.frameBufferEmulation.overscanPAL.top); - ui->overscanPalBottomSpinBox->setValue(config.frameBufferEmulation.overscanPAL.bottom); - - ui->fullScreenCheckBox->setChecked(config.video.fullscreen != 0); - - if (m_maxMSAA == 0 && config.video.maxMultiSampling == 0) { - // default value - m_maxMSAA = 8; - } else if (m_maxMSAA == 0 && config.video.maxMultiSampling != 0) { - // use cached value - m_maxMSAA = config.video.maxMultiSampling; - } else { - // assign cached value - config.video.maxMultiSampling = m_maxMSAA; - } - - const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0 - ? std::min(config.video.multisampling, m_maxMSAA) - : m_maxMSAA; - - ui->aliasingSlider->blockSignals(true); - ui->aliasingSlider->setMaximum(powof(m_maxMSAA)); - ui->aliasingSlider->setValue(powof(multisampling)); - ui->aliasingSlider->blockSignals(false); - ui->aliasingLabelVal->setText(QString::number(multisampling)); - ui->anisotropicSlider->setValue(config.texture.maxAnisotropy); - ui->vSyncCheckBox->setChecked(config.video.verticalSync != 0); - ui->threadedVideoCheckBox->setChecked(config.video.threadedVideo != 0); - - switch (config.texture.bilinearMode) { - case BILINEAR_3POINT: - ui->blnr3PointRadioButton->setChecked(true); - break; - case BILINEAR_STANDARD: - ui->blnrStandardRadioButton->setChecked(true); - break; - } - - ui->ditheringModeComboBox->setCurrentIndex(config.generalEmulation.rdramImageDitheringMode); - ui->ditheringQuantizationCheckBox->setChecked(config.generalEmulation.enableDitheringQuantization); - ui->hiresNoiseDitheringCheckBox->setChecked(config.generalEmulation.enableHiresNoiseDithering); - ui->ditheringPatternCheckBox->setChecked(config.generalEmulation.enableDitheringPattern); - - switch (config.texture.screenShotFormat) { - case 0: - ui->pngRadioButton->setChecked(true); - break; - case 1: - ui->jpegRadioButton->setChecked(true); - break; - } - - // Emulation settings - ui->emulateLodCheckBox->setChecked(config.generalEmulation.enableLOD != 0); - ui->enableHWLightingCheckBox->setChecked(config.generalEmulation.enableHWLighting != 0); - ui->enableCoverageCheckBox->setChecked(config.generalEmulation.enableCoverage != 0); - ui->enableShadersStorageCheckBox->setChecked(config.generalEmulation.enableShadersStorage != 0); - if (!blockCustomSettings) - ui->customSettingsCheckBox->setChecked(config.generalEmulation.enableCustomSettings != 0); - - switch (config.graphics2D.correctTexrectCoords) { - case Config::tcDisable: - ui->fixTexrectDisableRadioButton->setChecked(true); - break; - case Config::tcSmart: - ui->fixTexrectSmartRadioButton->setChecked(true); - break; - case Config::tcForce: - ui->fixTexrectForceRadioButton->setChecked(true); - break; - } - - switch (config.graphics2D.bgMode) { - case Config::BGMode::bgOnePiece: - ui->bgModeOnePieceRadioButton->setChecked(true); - break; - case Config::BGMode::bgStripped: - ui->bgModeStrippedRadioButton->setChecked(true); - break; - } - - ui->halosRemovalCheckBox->setChecked(config.texture.enableHalosRemoval != 0); - ui->texCoordBoundsCheckBox->setChecked(config.graphics2D.enableTexCoordBounds != 0); - - ui->nativeRes2DComboBox->setCurrentIndex(config.graphics2D.enableNativeResTexrects); - - ui->gammaCorrectionNoteFrame->setHidden(true); - ui->gammaLevelSpinBox->setValue(config.gammaCorrection.force != 0 ? config.gammaCorrection.level : 2.0); - ui->gammaCorrectionCheckBox->setChecked(config.gammaCorrection.force != 0); - - ui->frameBufferSwapComboBox->setCurrentIndex(config.frameBufferEmulation.bufferSwapMode); - - ui->fbInfoEnableCheckBox->toggle(); - ui->fbInfoEnableCheckBox->setChecked(config.frameBufferEmulation.fbInfoDisabled == 0); - - ui->frameBufferCheckBox->toggle(); - const bool fbEmulationEnabled = config.frameBufferEmulation.enable != 0; - ui->frameBufferCheckBox->setChecked(fbEmulationEnabled); - ui->frameBufferInfoFrame->setVisible(!fbEmulationEnabled); - ui->frameBufferInfoFrame2->setVisible(!fbEmulationEnabled); - - ui->copyColorBufferComboBox->setCurrentIndex(config.frameBufferEmulation.copyToRDRAM); - ui->copyDepthBufferComboBox->setCurrentIndex(config.frameBufferEmulation.copyDepthToRDRAM); - ui->RenderFBCheckBox->setChecked(config.frameBufferEmulation.copyFromRDRAM != 0); - ui->copyDepthToMainDepthBufferCheckBox->setChecked(config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0); - ui->n64DepthCompareComboBox->setCurrentIndex(config.frameBufferEmulation.N64DepthCompare); - on_n64DepthCompareComboBox_currentIndexChanged(config.frameBufferEmulation.N64DepthCompare); - ui->forceDepthBufferClearCheckBox->setChecked(config.frameBufferEmulation.forceDepthBufferClear != 0); - - if (config.video.fxaa != 0) - ui->fxaaRadioButton->setChecked(true); - else if (config.video.multisampling == 0) - ui->noaaRadioButton->setChecked(true); - else - ui->msaaRadioButton->setChecked(true); - - switch (config.frameBufferEmulation.aspect) { - case Config::aStretch: - ui->aspectComboBox->setCurrentIndex(2); - break; - case Config::a43: - ui->aspectComboBox->setCurrentIndex(0); - break; - case Config::a169: - ui->aspectComboBox->setCurrentIndex(1); - break; - case Config::aAdjust: - ui->aspectComboBox->setCurrentIndex(3); - break; - } - - ui->resolutionFactorSpinBox->valueChanged(2); - ui->factor0xRadioButton->toggle(); - ui->factor1xRadioButton->toggle(); - ui->factorXxRadioButton->toggle(); - switch (config.frameBufferEmulation.nativeResFactor) { - case 0: - ui->factor0xRadioButton->setChecked(true); - break; - case 1: - ui->factor1xRadioButton->setChecked(true); - break; - default: - ui->factorXxRadioButton->setChecked(true); - ui->resolutionFactorSpinBox->setValue(config.frameBufferEmulation.nativeResFactor); - break; - } - - ui->copyAuxBuffersCheckBox->setChecked(config.frameBufferEmulation.copyAuxToRDRAM != 0); - - ui->readColorChunkCheckBox->setChecked(config.frameBufferEmulation.fbInfoReadColorChunk != 0); - ui->readColorChunkCheckBox->setEnabled(fbEmulationEnabled && config.frameBufferEmulation.fbInfoDisabled == 0); - ui->readDepthChunkCheckBox->setChecked(config.frameBufferEmulation.fbInfoReadDepthChunk != 0); - ui->readDepthChunkCheckBox->setEnabled(fbEmulationEnabled && config.frameBufferEmulation.fbInfoDisabled == 0); - -#if 0 - // Texture filter settings - ui->filterComboBox->setCurrentIndex(config.textureFilter.txFilterMode); - ui->enhancementComboBox->setCurrentIndex(config.textureFilter.txEnhancementMode); - - ui->textureFilterCacheSpinBox->setValue(config.textureFilter.txCacheSize / gc_uMegabyte); - ui->deposterizeCheckBox->setChecked(config.textureFilter.txDeposterize != 0); - ui->ignoreBackgroundsCheckBox->setChecked(config.textureFilter.txFilterIgnoreBG != 0); - - ui->texturePackGroupBox->setChecked(config.textureFilter.txHiresEnable != 0); - ui->alphaChannelCheckBox->setChecked(config.textureFilter.txHiresFullAlphaChannel != 0); - ui->alternativeCRCCheckBox->setChecked(config.textureFilter.txHresAltCRC != 0); - ui->force16bppCheckBox->setChecked(config.textureFilter.txForce16bpp != 0); - ui->compressCacheCheckBox->setChecked(config.textureFilter.txCacheCompression != 0); - ui->saveTextureCacheCheckBox->setChecked(config.textureFilter.txSaveCache != 0); - ui->enhancedTexFileStorageCheckBox->setChecked(config.textureFilter.txEnhancedTextureFileStorage != 0); - ui->hiresTexFileStorageCheckBox->setChecked(config.textureFilter.txHiresTextureFileStorage != 0); - - ui->texPackPathLineEdit->setText(QString::fromWCharArray(config.textureFilter.txPath)); - ui->texCachePathLineEdit->setText(QString::fromWCharArray(config.textureFilter.txCachePath)); - ui->texDumpPathLineEdit->setText(QString::fromWCharArray(config.textureFilter.txDumpPath)); - -#endif - // OSD settings - QString fontName(config.font.name.c_str()); - ui->fontLineEdit->setText(fontName); - m_font = QFont(fontName.left(fontName.indexOf(".ttf"))); - m_font.setPixelSize(config.font.size); - - ui->fontLineEdit->setHidden(true); - - ui->fontSizeSpinBox->setValue(config.font.size); - - m_color = QColor(config.font.color[0], config.font.color[1], config.font.color[2]); - QPalette palette; - palette.setColor(QPalette::WindowText, m_color); - palette.setColor(QPalette::Window, Qt::black); - ui->fontPreviewLabel->setAutoFillBackground(true); - ui->fontPreviewLabel->setPalette(palette); - ui->PickFontColorButton->setStyleSheet(QString("color:") + m_color.name()); - - switch (config.onScreenDisplay.pos) { - case Config::posTopLeft: - ui->topLeftPushButton->setChecked(true); - break; - case Config::posTopCenter: - ui->topPushButton->setChecked(true); - break; - case Config::posTopRight: - ui->topRightPushButton->setChecked(true); - break; - case Config::posBottomLeft: - ui->bottomLeftPushButton->setChecked(true); - break; - case Config::posBottomCenter: - ui->bottomPushButton->setChecked(true); - break; - case Config::posBottomRight: - ui->bottomRightPushButton->setChecked(true); - break; - } - - ui->fpsCheckBox->setChecked(config.onScreenDisplay.fps != 0); - ui->visCheckBox->setChecked(config.onScreenDisplay.vis != 0); - ui->percentCheckBox->setChecked(config.onScreenDisplay.percent != 0); - ui->internalResolutionCheckBox->setChecked(config.onScreenDisplay.internalResolution != 0); - ui->renderingResolutionCheckBox->setChecked(config.onScreenDisplay.renderingResolution != 0); - ui->statisticsCheckBox->setChecked(config.onScreenDisplay.statistics != 0); - - // Buttons - ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Save and Close")); - ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("Save")); - ui->buttonBox->button(QDialogButtonBox::Close)->setText(tr("Close")); - ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setText(tr("Restore Defaults")); - - ui->dumpLowCheckBox->setChecked((config.debug.dumpMode & DEBUG_LOW) != 0); - ui->dumpNormalCheckBox->setChecked((config.debug.dumpMode & DEBUG_NORMAL) != 0); - ui->dumpDetailCheckBox->setChecked((config.debug.dumpMode & DEBUG_DETAIL) != 0); - - { - ui->hotkeyListWidget->clear(); - for (quint32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - HotkeyItemWidget* pWgt = new HotkeyItemWidget; - QLayout* pLayout = new QHBoxLayout; - pLayout->addWidget(new QLabel(_hotkeyDescription(idx))); - - QPushButton* pBtn = new QPushButton(tr("Click me")); - connect(pBtn, SIGNAL(clicked()), SLOT(on_btn_clicked())); - pLayout->addWidget(pBtn); - pWgt->setLayout(pLayout); - - QListWidgetItem* pItem = new QListWidgetItem(ui->hotkeyListWidget); - pItem->setSizeHint(pWgt->sizeHint()); - pItem->setCheckState(Qt::Unchecked); - ui->hotkeyListWidget->setItemWidget(pItem, pWgt); - - if (config.hotkeys.keys[idx] != 0) { - pWgt->setHidCode(config.hotkeys.keys[idx]); - pBtn->setText(osal_keycode_name(config.hotkeys.keys[idx])); - pItem->setCheckState(Qt::Checked); - } - } - } - -#ifndef DEBUG_DUMP - for (int i = 0; i < ui->tabWidget->count(); ++i) { - if (tr("Debug") == ui->tabWidget->tabText(i)) { - ui->tabWidget->removeTab(i); - break; - } - } -#endif - - m_blockReInit = false; -} - -void ConfigDialog::_getTranslations(QStringList & _translationFiles) const -{ - QDir pluginFolder(m_strIniPath); - QStringList nameFilters("gliden64_*.qm"); - _translationFiles = pluginFolder.entryList(nameFilters, QDir::Files, QDir::Name); -} - -void ConfigDialog::setIniPath(const QString & _strIniPath) -{ - m_strIniPath = _strIniPath; - - QStringList translationFiles; - _getTranslations(translationFiles); - - const QString currentTranslation = getTranslationFile(); - int listIndex = 0; - QStringList translationLanguages("English"); - for (int i = 0; i < translationFiles.size(); ++i) { - // get locale extracted by filename - QString locale = translationFiles[i]; // "TranslationExample_de.qm" - const bool bCurrent = locale == currentTranslation; - locale.truncate(locale.lastIndexOf('.')); // "TranslationExample_de" - locale.remove(0, locale.indexOf('_') + 1); // "de" - QString language = QLocale(locale).nativeLanguageName(); - QString firstChar = language.left(1).toUpper(); - language = firstChar + language.remove(0, 1); - if (bCurrent) { - listIndex = i + 1; - } - translationLanguages << language; - } - - ui->translationsComboBox->insertItems(0, translationLanguages); - ui->translationsComboBox->setCurrentIndex(listIndex); - - // Profile - ui->profilesComboBox->blockSignals(true); - const QStringList aProfiles = getProfiles(m_strIniPath); - ui->profilesComboBox->addItems(aProfiles); - ui->profilesComboBox->setCurrentIndex(aProfiles.indexOf(getCurrentProfile(m_strIniPath))); - ui->profilesComboBox->insertSeparator(ui->profilesComboBox->count()); - ui->profilesComboBox->insertItem(ui->profilesComboBox->count(), tr("New...")); - ui->profilesComboBox->blockSignals(false); - ui->removeProfilePushButton->setEnabled(ui->profilesComboBox->count() > 3); -} - -void ConfigDialog::setRomName(const char * _romName) -{ - const bool bRomNameIsEmpty = _romName == nullptr || strlen(_romName) == 0; - m_romName = bRomNameIsEmpty ? nullptr : _romName; - this->on_customSettingsCheckBox_toggled(ui->customSettingsCheckBox->isChecked()); -} - -ConfigDialog::ConfigDialog(QWidget *parent, Qt::WindowFlags f, unsigned int _maxMsaaLevel) : -QDialog(parent, f), -ui(new Ui::ConfigDialog), -m_maxMSAA(_maxMsaaLevel), -m_accepted(false), -m_fontsInited(false), -m_blockReInit(false) -{ - ui->setupUi(this); - _init(); -} - -ConfigDialog::~ConfigDialog() -{ - delete ui; -} - -void ConfigDialog::accept(bool justSave) { - - m_accepted = true; - - int windowedValidatorPos = 0; - QString currentText = ui->windowedResolutionComboBox->currentText(); - if (ui->windowedResolutionComboBox->validator()->validate( - currentText, windowedValidatorPos - ) == QValidator::Acceptable) { - QStringList windowedResolutionDimensions = currentText.split("x"); - config.video.windowedWidth = windowedResolutionDimensions[0].trimmed().toInt(); - config.video.windowedHeight = windowedResolutionDimensions[1].trimmed().toInt(); - } - - config.video.fullscreen = ui->fullScreenCheckBox->isChecked() ? 1 : 0; - - config.video.fxaa = ui->fxaaRadioButton->isChecked() ? 1 : 0; - config.video.multisampling = - (ui->fxaaRadioButton->isChecked() - || ui->n64DepthCompareComboBox->currentIndex() != 0 - || ui->noaaRadioButton->isChecked() - ) ? 0 - : pow2(ui->aliasingSlider->value()); - config.texture.maxAnisotropy = ui->anisotropicSlider->value(); - - if (ui->blnrStandardRadioButton->isChecked()) - config.texture.bilinearMode = BILINEAR_STANDARD; - else if (ui->blnr3PointRadioButton->isChecked()) - config.texture.bilinearMode = BILINEAR_3POINT; - - config.generalEmulation.rdramImageDitheringMode = ui->ditheringModeComboBox->currentIndex(); - config.generalEmulation.enableDitheringQuantization = ui->ditheringQuantizationCheckBox->isChecked() ? 1 : 0; - config.generalEmulation.enableHiresNoiseDithering = ui->hiresNoiseDitheringCheckBox->isChecked() ? 1 : 0; - config.generalEmulation.enableDitheringPattern = ui->ditheringPatternCheckBox->isChecked() ? 1 : 0; - - if (ui->pngRadioButton->isChecked()) - config.texture.screenShotFormat = 0; - else if (ui->jpegRadioButton->isChecked()) - config.texture.screenShotFormat = 1; - - const int lanuageIndex = ui->translationsComboBox->currentIndex(); - if (lanuageIndex == 0) // English - config.translationFile.clear(); - else { - QStringList translationFiles; - _getTranslations(translationFiles); - config.translationFile = translationFiles[lanuageIndex-1].toLocal8Bit().constData(); - } - - config.video.verticalSync = ui->vSyncCheckBox->isChecked() ? 1 : 0; - config.video.threadedVideo = ui->threadedVideoCheckBox->isChecked() ? 1 : 0; - - // Emulation settings - config.generalEmulation.enableLOD = ui->emulateLodCheckBox->isChecked() ? 1 : 0; - config.generalEmulation.enableHWLighting = ui->enableHWLightingCheckBox->isChecked() ? 1 : 0; - config.generalEmulation.enableCoverage = ui->enableCoverageCheckBox->isChecked() ? 1 : 0; - config.generalEmulation.enableShadersStorage = ui->enableShadersStorageCheckBox->isChecked() ? 1 : 0; - config.generalEmulation.enableCustomSettings = ui->customSettingsCheckBox->isChecked() ? 1 : 0; - - config.gammaCorrection.force = ui->gammaCorrectionCheckBox->isChecked() ? 1 : 0; - config.gammaCorrection.level = ui->gammaLevelSpinBox->value(); - - if (ui->fixTexrectDisableRadioButton->isChecked()) - config.graphics2D.correctTexrectCoords = Config::tcDisable; - else if (ui->fixTexrectSmartRadioButton->isChecked()) - config.graphics2D.correctTexrectCoords = Config::tcSmart; - else if (ui->fixTexrectForceRadioButton->isChecked()) - config.graphics2D.correctTexrectCoords = Config::tcForce; - - if (ui->bgModeOnePieceRadioButton->isChecked()) - config.graphics2D.bgMode = Config::BGMode::bgOnePiece; - else if (ui->bgModeStrippedRadioButton->isChecked()) - config.graphics2D.bgMode = Config::BGMode::bgStripped; - - config.texture.enableHalosRemoval = ui->halosRemovalCheckBox->isChecked() ? 1 : 0; - config.graphics2D.enableTexCoordBounds = ui->texCoordBoundsCheckBox->isChecked() ? 1 : 0; - config.graphics2D.enableNativeResTexrects = ui->nativeRes2DComboBox->currentIndex(); - - config.frameBufferEmulation.enable = ui->frameBufferCheckBox->isChecked() ? 1 : 0; - - config.frameBufferEmulation.bufferSwapMode = ui->frameBufferSwapComboBox->currentIndex(); - config.frameBufferEmulation.copyToRDRAM = ui->copyColorBufferComboBox->currentIndex(); - config.frameBufferEmulation.copyDepthToRDRAM = ui->copyDepthBufferComboBox->currentIndex(); - config.frameBufferEmulation.copyFromRDRAM = ui->RenderFBCheckBox->isChecked() ? 1 : 0; - config.frameBufferEmulation.copyDepthToMainDepthBuffer = ui->copyDepthToMainDepthBufferCheckBox->isChecked() ? 1 : 0; - - config.frameBufferEmulation.N64DepthCompare = ui->n64DepthCompareComboBox->currentIndex(); - config.frameBufferEmulation.forceDepthBufferClear = ui->forceDepthBufferClearCheckBox->isChecked() ? 1 : 0; - - if (ui->aspectComboBox->currentIndex() == 2) - config.frameBufferEmulation.aspect = Config::aStretch; - else if (ui->aspectComboBox->currentIndex() == 0) - config.frameBufferEmulation.aspect = Config::a43; - else if (ui->aspectComboBox->currentIndex() == 1) - config.frameBufferEmulation.aspect = Config::a169; - else if (ui->aspectComboBox->currentIndex() == 3) - config.frameBufferEmulation.aspect = Config::aAdjust; - - if (ui->factor0xRadioButton->isChecked()) - config.frameBufferEmulation.nativeResFactor = 0; - else if (ui->factor1xRadioButton->isChecked()) - config.frameBufferEmulation.nativeResFactor = 1; - else if (ui->factorXxRadioButton->isChecked()) - config.frameBufferEmulation.nativeResFactor = ui->resolutionFactorSpinBox->value(); - - config.frameBufferEmulation.copyAuxToRDRAM = ui->copyAuxBuffersCheckBox->isChecked() ? 1 : 0; - config.frameBufferEmulation.fbInfoDisabled = ui->fbInfoEnableCheckBox->isChecked() ? 0 : 1; - config.frameBufferEmulation.fbInfoReadColorChunk = ui->readColorChunkCheckBox->isChecked() ? 1 : 0; - config.frameBufferEmulation.fbInfoReadDepthChunk = ui->readDepthChunkCheckBox->isChecked() ? 1 : 0; - - config.frameBufferEmulation.enableOverscan = ui->overscanCheckBox->isChecked() ? 1 : 0; - config.frameBufferEmulation.overscanNTSC.left = ui->overscanNtscLeftSpinBox->value(); - config.frameBufferEmulation.overscanNTSC.right = ui->overscanNtscRightSpinBox->value(); - config.frameBufferEmulation.overscanNTSC.top = ui->overscanNtscTopSpinBox->value(); - config.frameBufferEmulation.overscanNTSC.bottom = ui->overscanNtscBottomSpinBox->value(); - config.frameBufferEmulation.overscanPAL.left = ui->overscanPalLeftSpinBox->value(); - config.frameBufferEmulation.overscanPAL.right = ui->overscanPalRightSpinBox->value(); - config.frameBufferEmulation.overscanPAL.top = ui->overscanPalTopSpinBox->value(); - config.frameBufferEmulation.overscanPAL.bottom = ui->overscanPalBottomSpinBox->value(); - -#if 0 - // Texture filter settings - config.textureFilter.txFilterMode = ui->filterComboBox->currentIndex(); - config.textureFilter.txEnhancementMode = ui->enhancementComboBox->currentIndex(); - - config.textureFilter.txCacheSize = ui->textureFilterCacheSpinBox->value() * gc_uMegabyte; - config.textureFilter.txDeposterize = ui->deposterizeCheckBox->isChecked() ? 1 : 0; - config.textureFilter.txFilterIgnoreBG = ui->ignoreBackgroundsCheckBox->isChecked() ? 1 : 0; - - config.textureFilter.txHiresEnable = ui->texturePackGroupBox->isChecked() ? 1 : 0; - config.textureFilter.txHiresFullAlphaChannel = ui->alphaChannelCheckBox->isChecked() ? 1 : 0; - config.textureFilter.txHresAltCRC = ui->alternativeCRCCheckBox->isChecked() ? 1 : 0; - - config.textureFilter.txCacheCompression = ui->compressCacheCheckBox->isChecked() ? 1 : 0; - config.textureFilter.txForce16bpp = ui->force16bppCheckBox->isChecked() ? 1 : 0; - config.textureFilter.txSaveCache = ui->saveTextureCacheCheckBox->isChecked() ? 1 : 0; - config.textureFilter.txEnhancedTextureFileStorage = ui->enhancedTexFileStorageCheckBox->isChecked() ? 1 : 0; - config.textureFilter.txHiresTextureFileStorage = ui->hiresTexFileStorageCheckBox->isChecked() ? 1 : 0; - - QDir txPath(ui->texPackPathLineEdit->text()); - if (!txPath.exists() && - !txPath.mkdir(txPath.absolutePath()) && - config.textureFilter.txHiresEnable != 0) { - QMessageBox msgBox; - msgBox.setStandardButtons(QMessageBox::Close); - msgBox.setWindowTitle("GLideN64"); - msgBox.setText(tr("Failed to create the texture pack folder. Please change the folder or turn off texture packs.")); - msgBox.exec(); - ui->tabWidget->setCurrentIndex(3); - ui->texPackPathLineEdit->setFocus(Qt::PopupFocusReason); - ui->texPackPathLineEdit->selectAll(); - return; - } - config.textureFilter.txPath[txPath.path().toWCharArray(config.textureFilter.txPath)] = L'\0'; - - QDir txCachePath(ui->texCachePathLineEdit->text()); - if (!txCachePath.exists() && - !txCachePath.mkdir(txCachePath.absolutePath()) && - config.textureFilter.txHiresEnable != 0) { - QMessageBox msgBox; - msgBox.setStandardButtons(QMessageBox::Close); - msgBox.setWindowTitle("GLideN64"); - msgBox.setText(tr("Failed to create the texture pack cache folder. Please change the folder or turn off texture packs.")); - msgBox.exec(); - ui->tabWidget->setCurrentIndex(3); - ui->texCachePathLineEdit->setFocus(Qt::PopupFocusReason); - ui->texCachePathLineEdit->selectAll(); - return; - } - config.textureFilter.txCachePath[txCachePath.path().toWCharArray(config.textureFilter.txCachePath)] = L'\0'; - - QDir txDumpPath(ui->texDumpPathLineEdit->text()); - if (!txDumpPath.exists() && - !txDumpPath.mkdir(txDumpPath.absolutePath()) && - config.textureFilter.txHiresEnable != 0 && - config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) { - QMessageBox msgBox; - msgBox.setStandardButtons(QMessageBox::Close); - msgBox.setWindowTitle("GLideN64"); - msgBox.setText(tr("Failed to create the texture dump folder. Please change the folder or turn off dumping texture packs.")); - msgBox.exec(); - ui->tabWidget->setCurrentIndex(3); - ui->texDumpPathLineEdit->setFocus(Qt::PopupFocusReason); - ui->texDumpPathLineEdit->selectAll(); - return; - } - config.textureFilter.txDumpPath[txDumpPath.path().toWCharArray(config.textureFilter.txDumpPath)] = L'\0'; - -#endif - // OSD settings - config.font.size = ui->fontSizeSpinBox->value(); -#ifdef OS_WINDOWS - config.font.name = ui->fontLineEdit->text().toLocal8Bit().constData(); -#else - config.font.name = ui->fontLineEdit->text().toStdString(); -#endif - config.font.color[0] = m_color.red(); - config.font.color[1] = m_color.green(); - config.font.color[2] = m_color.blue(); - config.font.color[3] = m_color.alpha(); - config.font.colorf[0] = m_color.redF(); - config.font.colorf[1] = m_color.greenF(); - config.font.colorf[2] = m_color.blueF(); - config.font.colorf[3] = m_color.alphaF(); - - - if (ui->topLeftPushButton->isChecked()) - config.onScreenDisplay.pos = Config::posTopLeft; - else if (ui->topPushButton->isChecked()) - config.onScreenDisplay.pos = Config::posTopCenter; - else if (ui->topRightPushButton->isChecked()) - config.onScreenDisplay.pos = Config::posTopRight; - else if (ui->bottomLeftPushButton->isChecked()) - config.onScreenDisplay.pos = Config::posBottomLeft; - else if (ui->bottomPushButton->isChecked()) - config.onScreenDisplay.pos = Config::posBottomCenter; - else if (ui->bottomRightPushButton->isChecked()) - config.onScreenDisplay.pos = Config::posBottomRight; - - config.onScreenDisplay.fps = ui->fpsCheckBox->isChecked() ? 1 : 0; - config.onScreenDisplay.vis = ui->visCheckBox->isChecked() ? 1 : 0; - config.onScreenDisplay.percent = ui->percentCheckBox->isChecked() ? 1 : 0; - config.onScreenDisplay.internalResolution = ui->internalResolutionCheckBox->isChecked() ? 1 : 0; - config.onScreenDisplay.renderingResolution = ui->renderingResolutionCheckBox->isChecked() ? 1 : 0; - config.onScreenDisplay.statistics = ui->statisticsCheckBox->isChecked() ? 1 : 0; - - for (quint32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - config.hotkeys.keys[idx] = 0; - QListWidgetItem * pItem = ui->hotkeyListWidget->item(idx); - if (pItem->checkState() == Qt::Checked) { - HotkeyItemWidget* pWgt = (HotkeyItemWidget*)ui->hotkeyListWidget->itemWidget(pItem); - config.hotkeys.keys[idx] = pWgt->hidCode(); - } - } - - config.debug.dumpMode = 0; - if (ui->dumpLowCheckBox->isChecked()) - config.debug.dumpMode |= DEBUG_LOW; - if (ui->dumpNormalCheckBox->isChecked()) - config.debug.dumpMode |= DEBUG_NORMAL; - if (ui->dumpDetailCheckBox->isChecked()) - config.debug.dumpMode |= DEBUG_DETAIL; - - if (config.generalEmulation.enableCustomSettings && ui->settingsDestGameRadioButton->isChecked() && m_romName != nullptr) - { - wchar_t strCustomFolderPath[PLUGIN_PATH_SIZE]; - api().FindPluginPath(strCustomFolderPath); - saveCustomRomSettings(QString::fromWCharArray(strCustomFolderPath), m_romName); - } - else - writeSettings(m_strIniPath); - - if (!justSave) { - QDialog::accept(); - } -} - -void ConfigDialog::on_PickFontColorButton_clicked() -{ - const QColor color = QColorDialog::getColor(m_color, this); - - if (!color.isValid()) - return; - - m_color = color; - QPalette palette; - palette.setColor(QPalette::WindowText, m_color); - palette.setColor(QPalette::Window, Qt::black); - ui->fontPreviewLabel->setAutoFillBackground(true); - ui->fontPreviewLabel->setPalette(palette); - ui->PickFontColorButton->setStyleSheet(QString("color:") + m_color.name()); -} - -void ConfigDialog::on_aliasingSlider_valueChanged(int value) -{ - ui->aliasingLabelVal->setText(QString::number(pow2(value))); - if (value != 0) { - ui->msaaRadioButton->setChecked(true); - } else { - ui->noaaRadioButton->setChecked(true); - } -} - -void ConfigDialog::on_buttonBox_clicked(QAbstractButton *button) -{ - if ((QPushButton *)button == ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)) { - QMessageBox msgBox(QMessageBox::Warning, tr("Restore Defaults"), - tr("Are you sure you want to reset all settings to default?"), - QMessageBox::RestoreDefaults | QMessageBox::Cancel, this - ); - msgBox.setDefaultButton(QMessageBox::Cancel); - msgBox.setButtonText(QMessageBox::RestoreDefaults, tr("Restore Defaults")); - msgBox.setButtonText(QMessageBox::Cancel, tr("Cancel")); - if (msgBox.exec() == QMessageBox::RestoreDefaults) { - const u32 enableCustomSettings = config.generalEmulation.enableCustomSettings; - config.resetToDefaults(); - config.generalEmulation.enableCustomSettings = enableCustomSettings; - setTitle(); - setRomName(m_romName); - _init(); - } - } else if ((QPushButton *)button == ui->buttonBox->button(QDialogButtonBox::Save)) { - this->accept(true); - } else if ((QPushButton *)button == ui->buttonBox->button(QDialogButtonBox::Ok)) { - this->accept(false); - } -} - -void ConfigDialog::on_windowedResolutionComboBox_currentIndexChanged(int index) -{ - if (index < numWindowedModes) - ui->windowedResolutionComboBox->clearFocus(); -} - -void ConfigDialog::on_windowedResolutionComboBox_currentTextChanged(QString text) -{ - if (text == tr("Custom")) - ui->windowedResolutionComboBox->setCurrentText(""); -} - -void ConfigDialog::on_overscanCheckBox_toggled(bool checked) -{ - ui->overscanCheckBox->setText(tr("Overscan") + (checked ? QString(":") : QString(""))); -} - -void ConfigDialog::on_aliasingWarningLabel_linkActivated(QString link) -{ - if (link == "#n64DepthCompare") { - ui->tabWidget->setCurrentIndex(2); - ui->n64DepthCompareComboBox->setStyleSheet("background:yellow"); - } -} - -void ConfigDialog::on_frameBufferInfoLabel_linkActivated(QString link) -{ - if (link == "#frameBuffer") { - ui->tabWidget->setCurrentIndex(2); - ui->frameBufferCheckBox->setStyleSheet("background:yellow"); - } -} - -void ConfigDialog::on_customSettingsCheckBox_toggled(bool checked) -{ - const bool romLoaded = checked && m_romName != nullptr; - if (romLoaded) { - ui->settingsDestGameRadioButton->setText(QString::fromLatin1(m_romName)); - ui->settingsDestGameRadioButton->setChecked(true); - } else { - ui->settingsDestProfileRadioButton->setChecked(true); - } - - ui->profilesLabel->setHidden(romLoaded); - ui->settingsDestFrame->setVisible(romLoaded); - _init(false, true); -} - -void ConfigDialog::on_frameBufferInfoLabel2_linkActivated(QString link) -{ - if (link == "#frameBuffer") { - ui->tabWidget->setCurrentIndex(2); - ui->frameBufferCheckBox->setStyleSheet("background:yellow"); - } -} - -void ConfigDialog::on_frameBufferCheckBox_toggled(bool checked) -{ - ui->readColorChunkCheckBox->setEnabled(checked && ui->fbInfoEnableCheckBox->isChecked()); - ui->readDepthChunkCheckBox->setEnabled(checked && ui->fbInfoEnableCheckBox->isChecked()); - - if (!checked && ui->fxaaRadioButton->isChecked()) - ui->noaaRadioButton->setChecked(true); - - ui->frameBufferCheckBox->setStyleSheet(""); -} - -void ConfigDialog::on_gammaLevelSpinBox_valueChanged(double /*value*/) -{ - ui->gammaCorrectionCheckBox->setChecked(true); -} - -void ConfigDialog::on_gammaCorrectionCheckBox_toggled(bool checked) -{ - if (!checked) { - ui->gammaLevelSpinBox->setValue(2.0); - ui->gammaCorrectionCheckBox->setChecked(false); - } -} - -void ConfigDialog::on_resolutionFactorSpinBox_valueChanged(int /*value*/) -{ - ui->factorXxRadioButton->setChecked(true); -} - -void ConfigDialog::on_fontTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem * /*previous*/) -{ - if (current->childCount() > 0) { - ui->fontLineEdit->setText(current->child(0)->text(0)); - m_font.setFamily(current->text(0)); - } else { - ui->fontLineEdit->setText(current->text(0)); - m_font.setFamily(current->parent()->text(0)); - } - ui->fontPreviewLabel->setFont(m_font); -} - -void ConfigDialog::on_fontSizeSpinBox_valueChanged(int value) -{ - m_font.setPixelSize(value); - ui->fontPreviewLabel->setFont(m_font); -} - -void ConfigDialog::on_tabWidget_currentChanged(int tab) -{ - if (!m_fontsInited && ui->tabWidget->tabText(tab) == tr("OSD")) { - ui->tabWidget->setCursor(QCursor(Qt::WaitCursor)); - - QMap internalFontList; - QString fontDir = QStandardPaths::locate(QStandardPaths::FontsLocation, QString(), QStandardPaths::LocateDirectory); - QStringList fontFilter; - fontFilter << "*.ttf"; - QDirIterator fontIt(fontDir, fontFilter, QDir::Files, QDirIterator::Subdirectories); - while (fontIt.hasNext()) { - QString font = fontIt.next(); - int id = QFontDatabase::addApplicationFont(font); - QString fontListFamily = QFontDatabase::applicationFontFamilies(id).at(0); - internalFontList[fontListFamily].append(font); - } - - QMap::const_iterator i; - for (i = internalFontList.constBegin(); i != internalFontList.constEnd(); ++i) { - QTreeWidgetItem *fontFamily = new QTreeWidgetItem(ui->fontTreeWidget); - fontFamily->setText(0, i.key()); - for (int j = 0; j < i.value().size(); ++j) { - QTreeWidgetItem *fontFile = new QTreeWidgetItem(fontFamily); - fontFile->setText(0, i.value()[j]); - if (i.value()[j] == ui->fontLineEdit->text()) { - fontFamily->setExpanded(true); - fontFile->setSelected(true); - ui->fontTreeWidget->scrollToItem(fontFile); - m_font.setFamily(i.key()); - ui->fontPreviewLabel->setFont(m_font); - } - } - } - - ui->tabWidget->setCursor(QCursor(Qt::ArrowCursor)); - m_fontsInited = true; - } - - ui->n64DepthCompareComboBox->setStyleSheet(""); - ui->frameBufferCheckBox->setStyleSheet(""); -} - -void ConfigDialog::setTitle() -{ - setWindowTitle(tr("GLideN64 Settings")); -} - -void ConfigDialog::on_profilesComboBox_currentIndexChanged(const QString &profile) -{ - ui->settingsDestProfileRadioButton->setChecked(true); - if (profile == tr("New...")) { - bool ok; - QString switchToProfile = getCurrentProfile(m_strIniPath); - QString newProfile = QInputDialog::getText(this, - tr("New Profile"), tr("New profile name:"), QLineEdit::Normal, "", &ok, - Qt::WindowCloseButtonHint | Qt::WindowTitleHint); - if (ok) { - ui->profilesComboBox->blockSignals(true); - if (newProfile == tr("New...")) { - QMessageBox msgBox(QMessageBox::Warning, tr("New Profile"), - tr("New settings profiles cannot be called \"New...\"."), - QMessageBox::Close, this - ); - msgBox.exec(); - } else if (newProfile.isEmpty()) { - QMessageBox msgBox(QMessageBox::Warning, tr("New Profile"), - tr("Please type a name for your new settings profile."), - QMessageBox::Close, this - ); - msgBox.exec(); - } else if (getProfiles(m_strIniPath).contains(newProfile)) { - QMessageBox msgBox(QMessageBox::Warning, tr("New Profile"), - tr("This settings profile already exists."), - QMessageBox::Close, this - ); - msgBox.exec(); - } else { - ui->profilesComboBox->insertItem(0, newProfile); - addProfile(m_strIniPath, newProfile); - if (ui->profilesComboBox->count() > 3) { - ui->removeProfilePushButton->setEnabled(true); - } - switchToProfile = newProfile; - } - ui->profilesComboBox->blockSignals(false); - } - for (int i = 0; i < ui->profilesComboBox->count(); ++i) { - if (ui->profilesComboBox->itemText(i) == switchToProfile) { - ui->profilesComboBox->setCurrentIndex(i); - break; - } - } - return; - } - changeProfile(m_strIniPath, profile); - _init(true); -} - -void ConfigDialog::on_settingsDestProfileRadioButton_toggled(bool /*checked*/) -{ - _init(true, true); -} - -void ConfigDialog::on_removeProfilePushButton_clicked() -{ - if (ui->profilesComboBox->count() == 3) - return; - - QString profile = ui->profilesComboBox->currentText(); - if (!getProfiles(m_strIniPath).contains(profile)) - return; - QString msg(tr("Are you sure you want to remove the settings profile \"")); - msg += "" + profile + tr("\"?"); - QMessageBox msgBox(QMessageBox::Warning, tr("Remove Profile"), - msg, QMessageBox::Yes | QMessageBox::Cancel, this); - msgBox.setDefaultButton(QMessageBox::Cancel); - msgBox.setButtonText(QMessageBox::Yes, tr("Remove")); - msgBox.setButtonText(QMessageBox::No, tr("Cancel")); - if (msgBox.exec() == QMessageBox::Yes) { - removeProfile(m_strIniPath, profile); - ui->profilesComboBox->blockSignals(true); - ui->profilesComboBox->removeItem(ui->profilesComboBox->currentIndex()); - changeProfile(m_strIniPath, ui->profilesComboBox->itemText(ui->profilesComboBox->currentIndex())); - ui->profilesComboBox->blockSignals(false); - _init(true); - ui->removeProfilePushButton->setDisabled(ui->profilesComboBox->count() == 3); - } -} - -void ConfigDialog::on_nativeRes2DComboBox_currentIndexChanged(int index) -{ - ui->fixTexrectFrame->setEnabled(index == 0); -} - -void ConfigDialog::on_n64DepthCompareComboBox_currentIndexChanged(int index) -{ - ui->aliasingWarningFrame->setVisible(index > 0); - ui->aliasingSliderFrame->setDisabled(index > 0); - if (index > 0 && ui->msaaRadioButton->isChecked()) - ui->fxaaRadioButton->setChecked(true); - ui->msaaRadioButton->setDisabled(index > 0); - ui->n64DepthCompareComboBox->setStyleSheet(""); -} - -void ConfigDialog::on_hotkeyListWidget_itemClicked(QListWidgetItem *item) -{ - if (item->checkState() == Qt::Unchecked) - item->setCheckState(Qt::Checked); - else - item->setCheckState(Qt::Unchecked); -} - -class HotkeyMessageBox: public QMessageBox -{ -public: - HotkeyMessageBox(QWidget *parent = Q_NULLPTR) : QMessageBox(parent) - { - setWindowTitle("Hotkey"); - setIcon(QMessageBox::Information); - } - - void keyPressEvent(QKeyEvent * pEvent) override - { - switch (pEvent->key()) - { - case Qt::Key_Escape: - case Qt::Key_Return: - case Qt::Key_Enter: - QMessageBox::keyPressEvent(pEvent); - return; - } - m_Key = pEvent->key(); - QMessageBox::keyPressEvent(pEvent); - close(); - } - - quint32 m_Key = Qt::Key::Key_unknown; -}; - -void ConfigDialog::on_btn_clicked() { - if (QPushButton* pBtn = qobject_cast(sender())) { - if (QLabel* pLabel = pBtn->parent()->findChild< QLabel* >()) { - HotkeyMessageBox msgBox(this); - msgBox.setInformativeText(QString("Press a key for ") + pLabel->text()); - msgBox.exec(); - if (msgBox.m_Key != Qt::Key::Key_unknown) { - const unsigned int hidCode = QtKeyToHID(msgBox.m_Key); - for (quint32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - QListWidgetItem * pItem = ui->hotkeyListWidget->item(idx); - HotkeyItemWidget* pWgt = (HotkeyItemWidget*)ui->hotkeyListWidget->itemWidget(pItem); - if (pWgt->hidCode() == hidCode) { - QPushButton* pButton = pWgt->findChild(); - if (pButton != nullptr) - pButton->setText(tr("Click me")); - pWgt->setHidCode(0u); - break; - } - } - pBtn->setText(osal_keycode_name(hidCode)); - ((HotkeyItemWidget*)pBtn->parent())->setHidCode(hidCode); - } - } - } -} diff --git a/GLideN64/src/GLideNUI/ConfigDialog.h b/GLideN64/src/GLideNUI/ConfigDialog.h deleted file mode 100644 index 1105ac3..0000000 --- a/GLideN64/src/GLideNUI/ConfigDialog.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef CONFIGDIALOG_H -#define CONFIGDIALOG_H - -#include -#include -#include "QListWidget" - -namespace Ui { -class ConfigDialog; -} - -class QAbstractButton; -class ConfigDialog : public QDialog -{ - Q_OBJECT - -public: - explicit ConfigDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags(), unsigned int _maxMsaaLevel = 8); - ~ConfigDialog(); - - void setIniPath(const QString & _strIniPath); - void setRomName(const char * _romName); - void setTitle(); - bool isAccepted() const { return m_accepted; } - -public Q_SLOTS: - virtual void accept(bool justSave); - -private slots: - void on_PickFontColorButton_clicked(); - - void on_buttonBox_clicked(QAbstractButton *button); - - void on_windowedResolutionComboBox_currentIndexChanged(int index); - - void on_windowedResolutionComboBox_currentTextChanged(QString text); - - void on_overscanCheckBox_toggled(bool checked); - - void on_aliasingWarningLabel_linkActivated(QString link); - - void on_frameBufferInfoLabel_linkActivated(QString link); - - void on_customSettingsCheckBox_toggled(bool checked); - - void on_frameBufferInfoLabel2_linkActivated(QString link); - - void on_frameBufferCheckBox_toggled(bool checked); - - void on_aliasingSlider_valueChanged(int value); - - void on_gammaLevelSpinBox_valueChanged(double value); - - void on_gammaCorrectionCheckBox_toggled(bool checked); - - void on_resolutionFactorSpinBox_valueChanged(int value); - - void on_fontTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); - - void on_fontSizeSpinBox_valueChanged(int value); - - void on_tabWidget_currentChanged(int tab); - - void on_profilesComboBox_currentIndexChanged(const QString &arg1); - - void on_settingsDestProfileRadioButton_toggled(bool checked); - - void on_removeProfilePushButton_clicked(); - - void on_nativeRes2DComboBox_currentIndexChanged(int index); - - void on_n64DepthCompareComboBox_currentIndexChanged(int index); - - void on_hotkeyListWidget_itemClicked(QListWidgetItem *item); - - void on_btn_clicked(); - -private: - void _init(bool reInit = false, bool blockCustomSettings = false); - void _getTranslations(QStringList & _translationFiles) const; - void _switchDest(bool isGame); - QString _hotkeyDescription(quint32 _idx) const; - - Ui::ConfigDialog *ui; - QFont m_font; - QColor m_color; - bool m_accepted; - bool m_fontsInited; - bool m_blockReInit; - QString m_strIniPath; - const char * m_romName; - unsigned int m_maxMSAA; -}; - -#endif // CONFIGDIALOG_H diff --git a/GLideN64/src/GLideNUI/Config_GLideNUI.cpp b/GLideN64/src/GLideNUI/Config_GLideNUI.cpp deleted file mode 100644 index af93c7c..0000000 --- a/GLideN64/src/GLideNUI/Config_GLideNUI.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "../N64.h" -#include "../Config.h" -#include "../RSP.h" -#include "../PluginAPI.h" -#include "../GLideNUI/GLideNUI.h" -#include "../mupenplus/GLideN64_mupenplus.h" -#include -#include -#include - -Config config; - -void Config_DoConfig(/*HWND hParent*/) -{ - if (config.netplay) - return; - - wchar_t strIniFolderPath[PLUGIN_PATH_SIZE]; - QString configPath = QString::fromUtf8(ConfigGetUserConfigPath()); - int length = configPath.toWCharArray(&strIniFolderPath[0]); - strIniFolderPath[length] = 0; - wchar_t strCustomFolderPath[PLUGIN_PATH_SIZE]; - api().FindPluginPath(strCustomFolderPath); - - ConfigOpen = true; - const u32 maxMsaa = dwnd().maxMSAALevel(); - const bool bRestart = RunConfig(strIniFolderPath, api().isRomOpen() ? RSP.romname : nullptr, maxMsaa); - if (config.generalEmulation.enableCustomSettings != 0) - LoadCustomRomSettings(strCustomFolderPath, RSP.romname); - config.validate(); - if (bRestart) - dwnd().restart(); - ConfigOpen = false; -} - -void Config_LoadConfig() -{ - config.netplay = 0; - - wchar_t strIniFolderPath[PLUGIN_PATH_SIZE]; - QString configPath = QString::fromUtf8(ConfigGetUserConfigPath()); - int length = configPath.toWCharArray(&strIniFolderPath[0]); - strIniFolderPath[length] = 0; - wchar_t strCustomFolderPath[PLUGIN_PATH_SIZE]; - api().FindPluginPath(strCustomFolderPath); - LoadConfig(strIniFolderPath); - if (config.generalEmulation.enableCustomSettings != 0) - LoadCustomRomSettings(strCustomFolderPath, RSP.romname); - - char buffer[93]; - buffer[0] = 8; //send settings - memcpy(&buffer[1], &config.frameBufferEmulation.enable, 4); - memcpy(&buffer[5], &config.frameBufferEmulation.aspect, 4); - //memcpy(&buffer[9], &config.frameBufferEmulation.nativeResFactor, 4); - memcpy(&buffer[13], &config.frameBufferEmulation.bufferSwapMode, 4); - memcpy(&buffer[17], &config.frameBufferEmulation.N64DepthCompare, 4); - memcpy(&buffer[21], &config.frameBufferEmulation.forceDepthBufferClear, 4); - memcpy(&buffer[25], &config.frameBufferEmulation.copyAuxToRDRAM, 4); - memcpy(&buffer[29], &config.frameBufferEmulation.copyToRDRAM, 4); - memcpy(&buffer[33], &config.frameBufferEmulation.copyDepthToRDRAM, 4); - memcpy(&buffer[37], &config.frameBufferEmulation.copyFromRDRAM, 4); - memcpy(&buffer[41], &config.frameBufferEmulation.fbInfoDisabled, 4); - memcpy(&buffer[45], &config.frameBufferEmulation.fbInfoReadColorChunk, 4); - memcpy(&buffer[49], &config.frameBufferEmulation.fbInfoReadDepthChunk, 4); - memcpy(&buffer[53], &config.frameBufferEmulation.copyDepthToMainDepthBuffer, 4); - memcpy(&buffer[57], &config.frameBufferEmulation.enableOverscan, 4); - memcpy(&buffer[61], &config.frameBufferEmulation.overscanPAL.left, 4); - memcpy(&buffer[65], &config.frameBufferEmulation.overscanPAL.right, 4); - memcpy(&buffer[69], &config.frameBufferEmulation.overscanPAL.top, 4); - memcpy(&buffer[73], &config.frameBufferEmulation.overscanPAL.bottom, 4); - memcpy(&buffer[77], &config.frameBufferEmulation.overscanNTSC.left, 4); - memcpy(&buffer[81], &config.frameBufferEmulation.overscanNTSC.right, 4); - memcpy(&buffer[85], &config.frameBufferEmulation.overscanNTSC.top, 4); - memcpy(&buffer[89], &config.frameBufferEmulation.overscanNTSC.bottom, 4); - m64p_error netplay_init = ConfigSendNetplayConfig(&buffer[0], 93); - - if (netplay_init == M64ERR_INVALID_STATE) - { - buffer[0] = 9; //get gettings; - ConfigSendNetplayConfig(&buffer[0], 1); - ConfigReceiveNetplayConfig(&buffer[0], 92); - memcpy(&config.frameBufferEmulation.enable, &buffer[0], 4); - memcpy(&config.frameBufferEmulation.aspect, &buffer[4], 4); - //memcpy(&config.frameBufferEmulation.nativeResFactor, &buffer[8], 4); - memcpy(&config.frameBufferEmulation.bufferSwapMode, &buffer[12], 4); - memcpy(&config.frameBufferEmulation.N64DepthCompare, &buffer[16], 4); - memcpy(&config.frameBufferEmulation.forceDepthBufferClear, &buffer[20], 4); - memcpy(&config.frameBufferEmulation.copyAuxToRDRAM, &buffer[24], 4); - memcpy(&config.frameBufferEmulation.copyToRDRAM, &buffer[28], 4); - memcpy(&config.frameBufferEmulation.copyDepthToRDRAM, &buffer[32], 4); - memcpy(&config.frameBufferEmulation.copyFromRDRAM, &buffer[36], 4); - memcpy(&config.frameBufferEmulation.fbInfoDisabled, &buffer[40], 4); - memcpy(&config.frameBufferEmulation.fbInfoReadColorChunk, &buffer[44], 4); - memcpy(&config.frameBufferEmulation.fbInfoReadDepthChunk, &buffer[48], 4); - memcpy(&config.frameBufferEmulation.copyDepthToMainDepthBuffer, &buffer[52], 4); - memcpy(&config.frameBufferEmulation.enableOverscan, &buffer[56], 4); - memcpy(&config.frameBufferEmulation.overscanPAL.left, &buffer[60], 4); - memcpy(&config.frameBufferEmulation.overscanPAL.right, &buffer[64], 4); - memcpy(&config.frameBufferEmulation.overscanPAL.top, &buffer[68], 4); - memcpy(&config.frameBufferEmulation.overscanPAL.bottom, &buffer[72], 4); - memcpy(&config.frameBufferEmulation.overscanNTSC.left, &buffer[76], 4); - memcpy(&config.frameBufferEmulation.overscanNTSC.right, &buffer[80], 4); - memcpy(&config.frameBufferEmulation.overscanNTSC.top, &buffer[84], 4); - memcpy(&config.frameBufferEmulation.overscanNTSC.bottom, &buffer[88], 4); - } - - if (netplay_init != M64ERR_NOT_INIT && netplay_init != M64ERR_INCOMPATIBLE) - { - config.netplay = 1; - config.video.verticalSync = 0; - config.video.threadedVideo = 0; - if (strstr(RSP.romname, (const char *)"GOLDENEYE") != nullptr) - config.frameBufferEmulation.copyToRDRAM = 0; - } - - config.validate(); -} diff --git a/GLideN64/src/GLideNUI/FullscreenResolutions.h b/GLideN64/src/GLideNUI/FullscreenResolutions.h deleted file mode 100644 index 4fb23d5..0000000 --- a/GLideN64/src/GLideNUI/FullscreenResolutions.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef FULLSCREENRESOLUTIONS_H -#define FULLSCREENRESOLUTIONS_H - -#include "ConfigDialog.h" - -void fillFullscreenResolutionsList(QStringList & _listResolutions, int & _resolutionIdx, QStringList & _listRefreshRates, int & _rateIdx); - -void fillFullscreenRefreshRateList(int _resolutionIdx, QStringList & _listRefreshRates, int & _rateIdx); - -void getFullscreenResolutions(int _idx, unsigned int & _width, unsigned int & _height); -void getFullscreenRefreshRate(int _idx, unsigned int & _rate); - -#endif // FULLSCREENRESOLUTIONS_H - diff --git a/GLideN64/src/GLideNUI/GLideNUI.cpp b/GLideN64/src/GLideNUI/GLideNUI.cpp deleted file mode 100644 index 0506ccf..0000000 --- a/GLideN64/src/GLideNUI/GLideNUI.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include -#include -#include - -#include "GLideNUI.h" -#include "AboutDialog.h" -#include "ConfigDialog.h" -#include "Settings.h" -#include "../PluginAPI.h" -#include "../Config.h" - -#ifdef QT_STATICPLUGIN -#include -Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -#endif - -//#define RUN_DIALOG_IN_THREAD - -inline void initMyResource() { Q_INIT_RESOURCE(icon); } -inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); } - -static -int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, bool & _accepted) -{ - cleanMyResource(); - initMyResource(); - QString strIniFileName = QString::fromWCharArray(_strFileName); - loadSettings(strIniFileName); - if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0) - { - wchar_t strCustomFolderPath[PLUGIN_PATH_SIZE]; - api().FindPluginPath(strCustomFolderPath); - loadCustomRomSettings(QString::fromWCharArray(strCustomFolderPath), _romName); - } - - std::unique_ptr pQApp; - QCoreApplication* pApp = QCoreApplication::instance(); - - if (pApp == nullptr) { - int argc = 0; - char * argv = 0; - pQApp.reset(new QApplication(argc, &argv)); - pApp = pQApp.get(); - } - - QTranslator translator; - if (translator.load(getTranslationFile(), strIniFileName)) - pApp->installTranslator(&translator); - - ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint, _maxMSAALevel); - - w.setIniPath(strIniFileName); - w.setRomName(_romName); - w.setTitle(); - w.show(); - - int res = pQApp ? pQApp->exec() : w.exec(); - _accepted = w.isAccepted(); - return res; -} - -static -int openAboutDialog(const wchar_t * _strFileName) -{ - cleanMyResource(); - initMyResource(); - - int argc = 0; - char * argv = 0; - QApplication a(argc, &argv); - - QTranslator translator; - if (translator.load(getTranslationFile(), QString::fromWCharArray(_strFileName))) - a.installTranslator(&translator); - - AboutDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); - w.show(); - return a.exec(); -} - -bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel) { - bool accepted = false; -#ifdef RUN_DIALOG_IN_THREAD - std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted)); - configThread.join(); -#else - openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted); -#endif - return accepted; - -} - -int runAboutThread(const wchar_t * _strFileName) { -#ifdef RUN_DIALOG_IN_THREAD - std::thread aboutThread(openAboutDialog, _strFileName); - aboutThread.join(); -#else - openAboutDialog(_strFileName); -#endif - return 0; -} - -EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel) -{ - return runConfigThread(_strFileName, _romName, _maxMSAALevel); -} - -EXPORT int CALL RunAbout(const wchar_t * _strFileName) -{ - return runAboutThread(_strFileName); -} - -EXPORT void CALL LoadConfig(const wchar_t * _strFileName) -{ - loadSettings(QString::fromWCharArray(_strFileName)); -} - -EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName) -{ - loadCustomRomSettings(QString::fromWCharArray(_strFileName), _romName); -} diff --git a/GLideN64/src/GLideNUI/GLideNUI.h b/GLideN64/src/GLideNUI/GLideNUI.h deleted file mode 100644 index 7b2159a..0000000 --- a/GLideN64/src/GLideNUI/GLideNUI.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef GLIDENUII_H -#define GLIDENUII_H - -#if defined(__cplusplus) -extern "C" { -#endif - -#ifdef OS_WINDOWS -#define EXPORT __declspec(dllexport) -#define CALL __cdecl -#else -#define EXPORT __attribute__((visibility("default"))) -#define CALL -#endif - -EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel); -EXPORT int CALL RunAbout(const wchar_t * _strFileName); -EXPORT void CALL LoadConfig(const wchar_t * _strFileName); -EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName); -EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data); - -#if defined(__cplusplus) -} -#endif - -#endif // GLIDENUII_H diff --git a/GLideN64/src/GLideNUI/GLideNUI.pro b/GLideN64/src/GLideNUI/GLideNUI.pro deleted file mode 100644 index d060098..0000000 --- a/GLideN64/src/GLideNUI/GLideNUI.pro +++ /dev/null @@ -1,48 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2015-01-26T21:59:49 -# -#------------------------------------------------- - -QT += core gui -QTPLUGIN += qico - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = GLideNUI -TEMPLATE = lib -CONFIG += staticlib -CONFIG += c++11 - -win32:DEFINES += OS_WINDOWS - -SOURCES += \ - ConfigDialog.cpp \ - GLideNUI.cpp \ - Settings.cpp \ - ScreenShot.cpp \ - AboutDialog.cpp \ - QtKeyToHID.cpp - -HEADERS += \ - ConfigDialog.h \ - GLideNUI.h \ - Settings.h \ - AboutDialog.h - -RESOURCES += \ - icon.qrc - -FORMS += \ - configDialog.ui \ - AboutDialog.ui - -TRANSLATIONS = gliden64_fr.ts \ - gliden64_de.ts \ - gliden64_it.ts \ - gliden64_es.ts \ - gliden64_pl.ts \ - gliden64_pt_BR.ts \ - gliden64_ja.ts - -DISTFILES += diff --git a/GLideN64/src/GLideNUI/QtKeyToHID.cpp b/GLideN64/src/GLideNUI/QtKeyToHID.cpp deleted file mode 100644 index 5d21bdc..0000000 --- a/GLideN64/src/GLideNUI/QtKeyToHID.cpp +++ /dev/null @@ -1,393 +0,0 @@ -#include "QtKeyToHID.h" -#include "keycode/keycode.h" - -unsigned int QtKeyToHID(quint32 key) -{ - unsigned int returnValue = KEY_None; - - switch (key) - { - default: - returnValue = KEY_None; - break; - case Qt::Key::Key_A: - returnValue = KEY_A; - break; - case Qt::Key::Key_B: - returnValue = KEY_B; - break; - case Qt::Key::Key_C: - returnValue = KEY_C; - break; - case Qt::Key::Key_D: - returnValue = KEY_D; - break; - case Qt::Key::Key_E: - returnValue = KEY_E; - break; - case Qt::Key::Key_F: - returnValue = KEY_F; - break; - case Qt::Key::Key_G: - returnValue = KEY_G; - break; - case Qt::Key::Key_H: - returnValue = KEY_H; - break; - case Qt::Key::Key_I: - returnValue = KEY_I; - break; - case Qt::Key::Key_J: - returnValue = KEY_J; - break; - case Qt::Key::Key_K: - returnValue = KEY_K; - break; - case Qt::Key::Key_L: - returnValue = KEY_L; - break; - case Qt::Key::Key_M: - returnValue = KEY_M; - break; - case Qt::Key::Key_N: - returnValue = KEY_N; - break; - case Qt::Key::Key_O: - returnValue = KEY_O; - break; - case Qt::Key::Key_P: - returnValue = KEY_P; - break; - case Qt::Key::Key_Q: - returnValue = KEY_Q; - break; - case Qt::Key::Key_R: - returnValue = KEY_R; - break; - case Qt::Key::Key_S: - returnValue = KEY_S; - break; - case Qt::Key::Key_T: - returnValue = KEY_T; - break; - case Qt::Key::Key_U: - returnValue = KEY_U; - break; - case Qt::Key::Key_V: - returnValue = KEY_V; - break; - case Qt::Key::Key_W: - returnValue = KEY_W; - break; - case Qt::Key::Key_X: - returnValue = KEY_X; - break; - case Qt::Key::Key_Y: - returnValue = KEY_Y; - break; - case Qt::Key::Key_Z: - returnValue = KEY_Z; - break; - case Qt::Key::Key_1: - returnValue = KEY_1; - break; - case Qt::Key::Key_2: - returnValue = KEY_2; - break; - case Qt::Key::Key_3: - returnValue = KEY_3; - break; - case Qt::Key::Key_4: - returnValue = KEY_4; - break; - case Qt::Key::Key_5: - returnValue = KEY_5; - break; - case Qt::Key::Key_6: - returnValue = KEY_6; - break; - case Qt::Key::Key_7: - returnValue = KEY_7; - break; - case Qt::Key::Key_8: - returnValue = KEY_8; - break; - case Qt::Key::Key_9: - returnValue = KEY_9; - break; - case Qt::Key::Key_0: - returnValue = KEY_0; - break; - case Qt::Key::Key_Escape: - returnValue = KEY_Escape; - break; - case Qt::Key::Key_Delete: - returnValue = KEY_Delete; - break; - case Qt::Key::Key_Tab: - returnValue = KEY_Tab; - break; - case Qt::Key::Key_Space: - returnValue = KEY_Space; - break; - case Qt::Key::Key_Minus: - returnValue = KEY_Minus; - break; - case Qt::Key::Key_Equal: - returnValue = KEY_Equals; - break; - case Qt::Key::Key_BracketLeft: - returnValue = KEY_LeftBracket; - break; - case Qt::Key::Key_BracketRight: - returnValue = KEY_RightBracket; - break; - case Qt::Key::Key_Backslash: - returnValue = KEY_Backslash; - break; - case Qt::Key::Key_Semicolon: - returnValue = KEY_Semicolon; - break; - case Qt::Key::Key_QuoteDbl: - returnValue = KEY_Quote; - break; - case Qt::Key::Key_Dead_Grave: - returnValue = KEY_Grave; - break; - case Qt::Key::Key_Comma: - returnValue = KEY_Comma; - break; - case Qt::Key::Key_Period: - returnValue = KEY_Period; - break; - case Qt::Key::Key_Slash: - returnValue = KEY_Slash; - break; - case Qt::Key::Key_CapsLock: - returnValue = KEY_CapsLock; - break; - case Qt::Key::Key_F1: - returnValue = KEY_F1; - break; - case Qt::Key::Key_F2: - returnValue = KEY_F2; - break; - case Qt::Key::Key_F3: - returnValue = KEY_F3; - break; - case Qt::Key::Key_F4: - returnValue = KEY_F4; - break; - case Qt::Key::Key_F5: - returnValue = KEY_F5; - break; - case Qt::Key::Key_F6: - returnValue = KEY_F6; - break; - case Qt::Key::Key_F7: - returnValue = KEY_F7; - break; - case Qt::Key::Key_F8: - returnValue = KEY_F8; - break; - case Qt::Key::Key_F9: - returnValue = KEY_F9; - break; - case Qt::Key::Key_F10: - returnValue = KEY_F10; - break; - case Qt::Key::Key_F11: - returnValue = KEY_F11; - break; - case Qt::Key::Key_F12: - returnValue = KEY_F12; - break; - /* TODO, this is a META key - case Qt::Key::Key_Screen: - returnValue = KEY_PrintScreen; - break;*/ - case Qt::Key::Key_ScrollLock: - returnValue = KEY_ScrollLock; - break; - case Qt::Key::Key_Pause: - returnValue = KEY_Pause; - break; - case Qt::Key::Key_Insert: - returnValue = KEY_Insert; - break; - case Qt::Key::Key_Home: - returnValue = KEY_Home; - break; - case Qt::Key::Key_PageUp: - returnValue = KEY_PageUp; - break; - /* ??? - case Qt::Key::Key_Delete: - returnValue = KEY_DeleteForward; - break;*/ - case Qt::Key::Key_End: - returnValue = KEY_End; - break; - case Qt::Key::Key_PageDown: - returnValue = KEY_PageDown; - break; - case Qt::Key::Key_Right: - returnValue = KEY_Right; - break; - case Qt::Key::Key_Left: - returnValue = KEY_Left; - break; - case Qt::Key::Key_Down: - returnValue = KEY_Down; - break; - case Qt::Key::Key_Up: - returnValue = KEY_Up; - break; - case Qt::Key::Key_NumLock: - returnValue = KP_NumLock; - break; - case Qt::Key::Key_division: - returnValue = KP_Divide; - break; - case Qt::Key::Key_multiply: - returnValue = KP_Multiply; - break; - /* ??? - case Qt::Key::Key_Minus: - returnValue = KP_Subtract; - break; */ - case Qt::Key::Key_Plus: - returnValue = KP_Add; - break; - case Qt::Key::Key_Enter: - returnValue = KP_Enter; - break; - /* see https://bugreports.qt.io/browse/QTBUG-2913 - case Qt::Key:: - returnValue = KP_1; - break; - case Qt::Key:: - returnValue = KP_2; - break; - case Qt::Key:: - returnValue = KP_3; - break; - case Qt::Key:: - returnValue = KP_4; - break; - case Qt::Key:: - returnValue = KP_5; - break; - case Qt::Key:: - returnValue = KP_6; - break; - case Qt::Key:: - returnValue = KP_7; - break; - case Qt::Key:: - returnValue = KP_8; - break; - case Qt::Key:: - returnValue = KP_9; - break; - case Qt::Key:: - returnValue = KP_0; - break; - case Qt::Key:: - returnValue = KP_Point; - break; - // ??? - case Qt::Key:: - returnValue = KEY_NonUSBackslash; - break; - case Qt::Key:: - returnValue = KP_Equals; - break; - */ - case Qt::Key::Key_F13: - returnValue = KEY_F13; - break; - case Qt::Key::Key_F14: - returnValue = KEY_F14; - break; - case Qt::Key::Key_F15: - returnValue = KEY_F15; - break; - case Qt::Key::Key_F16: - returnValue = KEY_F16; - break; - case Qt::Key::Key_F17: - returnValue = KEY_F17; - break; - case Qt::Key::Key_F18: - returnValue = KEY_F18; - break; - case Qt::Key::Key_F19: - returnValue = KEY_F19; - break; - case Qt::Key::Key_F20: - returnValue = KEY_F20; - break; - case Qt::Key::Key_F21: - returnValue = KEY_F21; - break; - case Qt::Key::Key_F22: - returnValue = KEY_F22; - break; - case Qt::Key::Key_F23: - returnValue = KEY_F23; - break; - case Qt::Key::Key_F24: - returnValue = KEY_F24; - break; - case Qt::Key::Key_Help: - returnValue = KEY_Help; - break; - case Qt::Key::Key_Menu: - returnValue = KEY_Menu; - break; - case Qt::Key::Key_VolumeMute: - returnValue = KEY_Mute; - break; - case Qt::Key::Key_SysReq: - returnValue = KEY_SysReq; - break; - case Qt::Key::Key_Return: - returnValue = KEY_Return; - break; - case Qt::Key::Key_Clear: - returnValue = KP_Clear; - break; - /* ??? - case Qt::Key::Key_d: - returnValue = KP_Decimal; - break; */ - case Qt::Key::Key_Control: - returnValue = KEY_LeftControl; - break; - case Qt::Key::Key_Shift: - returnValue = KEY_LeftShift; - break; - case Qt::Key::Key_Alt: - returnValue = KEY_LeftAlt; - break; - case Qt::Key::Key_Super_L: - returnValue = KEY_LeftGUI; - break; - /*case Qt::Key::Key_Control: - returnValue = KEY_RightControl; - break;*/ - /*case Qt::Key::Key_Shift: - returnValue = KEY_RightShift; - break;*/ - case Qt::Key::Key_AltGr: - returnValue = KEY_RightAlt; - break; - case Qt::Key::Key_Super_R: - returnValue = KEY_RightGUI; - break; - - } - - return returnValue; -} diff --git a/GLideN64/src/GLideNUI/QtKeyToHID.h b/GLideN64/src/GLideNUI/QtKeyToHID.h deleted file mode 100644 index f35699e..0000000 --- a/GLideN64/src/GLideNUI/QtKeyToHID.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef QTKEYTOHID_H -#define QTKEYTOHID_H - -#include - -extern unsigned int QtKeyToHID(quint32 key); - -#endif // QTKEYTOHID_H diff --git a/GLideN64/src/GLideNUI/Resources/BottomLeft.ico b/GLideN64/src/GLideNUI/Resources/BottomLeft.ico deleted file mode 100644 index a6bc485..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/BottomLeft.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/BottomRight.ico b/GLideN64/src/GLideNUI/Resources/BottomRight.ico deleted file mode 100644 index 8d38d85..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/BottomRight.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Down.ico b/GLideN64/src/GLideNUI/Resources/Down.ico deleted file mode 100644 index bbedfab..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Down.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Icon-Original.ico b/GLideN64/src/GLideNUI/Resources/Icon-Original.ico deleted file mode 100644 index b8367ae..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Icon-Original.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Icon.ico b/GLideN64/src/GLideNUI/Resources/Icon.ico deleted file mode 100644 index 4d012b1..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Icon.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Info.ico b/GLideN64/src/GLideNUI/Resources/Info.ico deleted file mode 100644 index 63684d2..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Info.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Left.ico b/GLideN64/src/GLideNUI/Resources/Left.ico deleted file mode 100644 index 7c248a5..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Left.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Right.ico b/GLideN64/src/GLideNUI/Resources/Right.ico deleted file mode 100644 index e977589..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Right.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/TopLeft.ico b/GLideN64/src/GLideNUI/Resources/TopLeft.ico deleted file mode 100644 index a11fc6e..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/TopLeft.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/TopRight.ico b/GLideN64/src/GLideNUI/Resources/TopRight.ico deleted file mode 100644 index 7f330f9..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/TopRight.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Up.ico b/GLideN64/src/GLideNUI/Resources/Up.ico deleted file mode 100644 index 3a44925..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Up.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/Resources/Warning.ico b/GLideN64/src/GLideNUI/Resources/Warning.ico deleted file mode 100644 index e75cf40..0000000 Binary files a/GLideN64/src/GLideNUI/Resources/Warning.ico and /dev/null differ diff --git a/GLideN64/src/GLideNUI/ScreenShot.cpp b/GLideN64/src/GLideNUI/ScreenShot.cpp deleted file mode 100644 index 9b9be3b..0000000 --- a/GLideN64/src/GLideNUI/ScreenShot.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include -#include "GLideNUI.h" - -#include "../Config.h" - -EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data) -{ - const char * png = "png"; - const char * jpg = "jpg"; - const char * fileExt = config.texture.screenShotFormat == 0 ? png : jpg; - QString folderName = QString::fromWCharArray(_folder); - QDir folder; - if (!folder.exists(folderName) && !folder.mkpath(folderName)) - return; - - QString romName(_name); - romName = romName.replace(' ', '_'); - romName = romName.replace(':', ';'); - QString fileName; - int i; - for (i = 0; i < 1000; ++i) { - fileName = fileName.asprintf("%lsGLideN64_%ls_%03i.%s", folderName.data(), romName.data(), i, fileExt); - QFile f(fileName); - if (!f.exists()) - break; - } - if (i == 1000) - return; - QImage image(_data, _width, _height, QImage::Format_RGB888); - QImageWriter writer(fileName, fileExt); - writer.write(image.mirrored()); -} diff --git a/GLideN64/src/GLideNUI/Settings.cpp b/GLideN64/src/GLideNUI/Settings.cpp deleted file mode 100644 index 89f904d..0000000 --- a/GLideN64/src/GLideNUI/Settings.cpp +++ /dev/null @@ -1,546 +0,0 @@ -#include -#include - -#ifdef OS_WINDOWS -#include -#else -#include "../winlnxdefs.h" -#endif -#include "../GBI.h" -#include "../Config.h" - -#include "Settings.h" - -static const char * strIniFileName = "GLideN64.ini"; -static const char * strCustomSettingsFileName = "GLideN64.custom.ini"; -static QString strUserProfile("User"); - -static -void _loadSettings(QSettings & settings) -{ - config.version = settings.value("version").toInt(); - - settings.beginGroup("video"); - config.video.windowedWidth = settings.value("windowedWidth", config.video.windowedWidth).toInt(); - config.video.windowedHeight = settings.value("windowedHeight", config.video.windowedHeight).toInt(); - config.video.fullscreen = settings.value("fullscreen", config.video.fullscreen).toInt(); - config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt(); - config.video.maxMultiSampling = settings.value("maxMultiSampling", config.video.maxMultiSampling).toInt(); - config.video.fxaa= settings.value("fxaa", config.video.fxaa).toInt(); - config.video.verticalSync = settings.value("verticalSync", config.video.verticalSync).toInt(); - config.video.threadedVideo = settings.value("threadedVideo", config.video.threadedVideo).toInt(); - settings.endGroup(); - - settings.beginGroup("texture"); - config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt(); - config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt(); - config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt(); - config.texture.screenShotFormat = settings.value("screenShotFormat", config.texture.screenShotFormat).toInt(); - settings.endGroup(); - - settings.beginGroup("generalEmulation"); - config.generalEmulation.enableDitheringPattern = settings.value("enableDitheringPattern", config.generalEmulation.enableDitheringPattern).toInt(); - config.generalEmulation.enableDitheringQuantization = settings.value("enableDitheringQuantization", config.generalEmulation.enableDitheringQuantization).toInt(); - config.generalEmulation.enableHiresNoiseDithering = settings.value("enableHiresNoiseDithering", config.generalEmulation.enableHiresNoiseDithering).toInt(); - config.generalEmulation.rdramImageDitheringMode = settings.value("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode).toInt(); - config.generalEmulation.enableLOD = settings.value("enableLOD", config.generalEmulation.enableLOD).toInt(); - config.generalEmulation.enableHWLighting = settings.value("enableHWLighting", config.generalEmulation.enableHWLighting).toInt(); - config.generalEmulation.enableCoverage = settings.value("enableCoverage", config.generalEmulation.enableCoverage).toInt(); - config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt(); - config.generalEmulation.enableLegacyBlending = settings.value("enableLegacyBlending", config.generalEmulation.enableLegacyBlending).toInt(); //ini only - config.generalEmulation.enableHybridFilter = settings.value("enableHybridFilter", config.generalEmulation.enableHybridFilter).toInt(); //ini only - config.generalEmulation.enableFragmentDepthWrite = settings.value("enableFragmentDepthWrite", config.generalEmulation.enableFragmentDepthWrite).toInt(); //ini only - config.generalEmulation.enableCustomSettings = settings.value("enableCustomSettings", config.generalEmulation.enableCustomSettings).toInt(); - settings.endGroup(); - - settings.beginGroup("graphics2D"); - config.graphics2D.correctTexrectCoords = settings.value("correctTexrectCoords", config.graphics2D.correctTexrectCoords).toInt(); - config.graphics2D.enableNativeResTexrects = settings.value("enableNativeResTexrects", config.graphics2D.enableNativeResTexrects).toInt(); - config.graphics2D.bgMode = settings.value("bgMode", config.graphics2D.bgMode).toInt(); - config.graphics2D.enableTexCoordBounds = settings.value("enableTexCoordBounds", config.graphics2D.enableTexCoordBounds).toInt(); - settings.endGroup(); - - settings.beginGroup("frameBufferEmulation"); - config.frameBufferEmulation.enable = settings.value("enable", config.frameBufferEmulation.enable).toInt(); - config.frameBufferEmulation.aspect = settings.value("aspect", config.frameBufferEmulation.aspect).toInt(); - config.frameBufferEmulation.nativeResFactor = settings.value("nativeResFactor", config.frameBufferEmulation.nativeResFactor).toInt(); - config.frameBufferEmulation.bufferSwapMode = settings.value("bufferSwapMode", config.frameBufferEmulation.bufferSwapMode).toInt(); - config.frameBufferEmulation.N64DepthCompare = settings.value("N64DepthCompare", config.frameBufferEmulation.N64DepthCompare).toInt(); - config.frameBufferEmulation.forceDepthBufferClear = settings.value("forceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear).toInt(); - config.frameBufferEmulation.copyAuxToRDRAM = settings.value("copyAuxToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM).toInt(); - config.frameBufferEmulation.copyToRDRAM = settings.value("copyToRDRAM", config.frameBufferEmulation.copyToRDRAM).toInt(); - config.frameBufferEmulation.copyDepthToRDRAM = settings.value("copyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM).toInt(); - config.frameBufferEmulation.copyFromRDRAM = settings.value("copyFromRDRAM", config.frameBufferEmulation.copyFromRDRAM).toInt(); - config.frameBufferEmulation.fbInfoDisabled = settings.value("fbInfoDisabled", config.frameBufferEmulation.fbInfoDisabled).toInt(); - config.frameBufferEmulation.fbInfoReadColorChunk = settings.value("fbInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk).toInt(); - config.frameBufferEmulation.fbInfoReadDepthChunk = settings.value("fbInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk).toInt(); - config.frameBufferEmulation.copyDepthToMainDepthBuffer = settings.value("copyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer).toInt(); - config.frameBufferEmulation.enableOverscan = settings.value("enableOverscan", config.frameBufferEmulation.enableOverscan).toInt(); - config.frameBufferEmulation.overscanPAL.left = settings.value("overscanPalLeft", config.frameBufferEmulation.overscanPAL.left).toInt(); - config.frameBufferEmulation.overscanPAL.right = settings.value("overscanPalRight", config.frameBufferEmulation.overscanPAL.right).toInt(); - config.frameBufferEmulation.overscanPAL.top = settings.value("overscanPalTop", config.frameBufferEmulation.overscanPAL.top).toInt(); - config.frameBufferEmulation.overscanPAL.bottom= settings.value("overscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom).toInt(); - config.frameBufferEmulation.overscanNTSC.left = settings.value("overscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left).toInt(); - config.frameBufferEmulation.overscanNTSC.right = settings.value("overscanNtscRight", config.frameBufferEmulation.overscanNTSC.right).toInt(); - config.frameBufferEmulation.overscanNTSC.top = settings.value("overscanNtscTop", config.frameBufferEmulation.overscanNTSC.top).toInt(); - config.frameBufferEmulation.overscanNTSC.bottom = settings.value("overscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom).toInt(); - settings.endGroup(); - - settings.beginGroup("textureFilter"); - config.textureFilter.txFilterMode = settings.value("txFilterMode", config.textureFilter.txFilterMode).toInt(); - config.textureFilter.txEnhancementMode = settings.value("txEnhancementMode", config.textureFilter.txEnhancementMode).toInt(); - config.textureFilter.txDeposterize = settings.value("txDeposterize", config.textureFilter.txDeposterize).toInt(); - config.textureFilter.txFilterIgnoreBG = settings.value("txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG).toInt(); - config.textureFilter.txCacheSize = settings.value("txCacheSize", config.textureFilter.txCacheSize).toInt(); - config.textureFilter.txHiresEnable = settings.value("txHiresEnable", config.textureFilter.txHiresEnable).toInt(); - config.textureFilter.txHiresFullAlphaChannel = settings.value("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel).toInt(); - config.textureFilter.txHresAltCRC = settings.value("txHresAltCRC", config.textureFilter.txHresAltCRC).toInt(); - config.textureFilter.txForce16bpp = settings.value("txForce16bpp", config.textureFilter.txForce16bpp).toInt(); - config.textureFilter.txCacheCompression = settings.value("txCacheCompression", config.textureFilter.txCacheCompression).toInt(); - config.textureFilter.txSaveCache = settings.value("txSaveCache", config.textureFilter.txSaveCache).toInt(); - config.textureFilter.txEnhancedTextureFileStorage = settings.value("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage).toInt(); - config.textureFilter.txHiresTextureFileStorage = settings.value("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage).toInt(); - QString txPath = QString::fromWCharArray(config.textureFilter.txPath); - config.textureFilter.txPath[settings.value("txPath", txPath).toString().toWCharArray(config.textureFilter.txPath)] = L'\0'; - QString txCachePath = QString::fromWCharArray(config.textureFilter.txCachePath); - config.textureFilter.txCachePath[settings.value("txCachePath", txCachePath).toString().toWCharArray(config.textureFilter.txCachePath)] = L'\0'; - QString txDumpPath = QString::fromWCharArray(config.textureFilter.txDumpPath); - config.textureFilter.txDumpPath[settings.value("txDumpPath", txDumpPath).toString().toWCharArray(config.textureFilter.txDumpPath)] = L'\0'; - - settings.endGroup(); - - settings.beginGroup("font"); - config.font.name = settings.value("name", config.font.name.c_str()).toString().toLocal8Bit().constData(); - config.font.size = settings.value("size", config.font.size).toInt(); - QColor fontColor = settings.value("color", QColor(config.font.color[0], config.font.color[1], config.font.color[2])).value(); - config.font.color[0] = fontColor.red(); - config.font.color[1] = fontColor.green(); - config.font.color[2] = fontColor.blue(); - config.font.color[3] = fontColor.alpha(); - config.font.colorf[0] = _FIXED2FLOAT(config.font.color[0], 8); - config.font.colorf[1] = _FIXED2FLOAT(config.font.color[1], 8); - config.font.colorf[2] = _FIXED2FLOAT(config.font.color[2], 8); - config.font.colorf[3] = config.font.color[3] == 0 ? 1.0f : _FIXED2FLOAT(config.font.color[3], 8); - settings.endGroup(); - - settings.beginGroup("gammaCorrection"); - config.gammaCorrection.force = settings.value("force", config.gammaCorrection.force).toInt(); - config.gammaCorrection.level = settings.value("level", config.gammaCorrection.level).toFloat(); - settings.endGroup(); - - settings.beginGroup("onScreenDisplay"); - config.onScreenDisplay.fps = settings.value("showFPS", config.onScreenDisplay.fps).toInt(); - config.onScreenDisplay.vis = settings.value("showVIS", config.onScreenDisplay.vis).toInt(); - config.onScreenDisplay.percent = settings.value("showPercent", config.onScreenDisplay.percent).toInt(); - config.onScreenDisplay.internalResolution = settings.value("showInternalResolution", config.onScreenDisplay.internalResolution).toInt(); - config.onScreenDisplay.renderingResolution = settings.value("showRenderingResolution", config.onScreenDisplay.renderingResolution).toInt(); - config.onScreenDisplay.statistics = settings.value("showStatistics", config.onScreenDisplay.statistics).toInt(); - config.onScreenDisplay.pos = settings.value("osdPos", config.onScreenDisplay.pos).toInt(); - settings.endGroup(); - - settings.beginGroup("hotkeys"); - for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - config.hotkeys.keys[idx] = settings.value(Config::hotkeyIniName(idx), config.hotkeys.keys[idx]).toInt(); - } - settings.endGroup(); - - settings.beginGroup("debug"); - config.debug.dumpMode = settings.value("dumpMode", config.debug.dumpMode).toInt(); - settings.endGroup(); -} - -void loadSettings(const QString & _strIniFolder) -{ - bool rewriteSettings = false; - { - const u32 hacks = config.generalEmulation.hacks; - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - const u32 configVersion = settings.value("version", 0).toInt(); - QString configTranslationFile = settings.value("translation", config.translationFile.c_str()).toString(); - config.resetToDefaults(); - config.generalEmulation.hacks = hacks; - config.translationFile = configTranslationFile.toLocal8Bit().constData(); - if (configVersion < CONFIG_WITH_PROFILES) { - _loadSettings(settings); - config.version = CONFIG_VERSION_CURRENT; - settings.clear(); - settings.setValue("version", CONFIG_VERSION_CURRENT); - settings.setValue("profile", strUserProfile); - settings.setValue("translation", config.translationFile.c_str()); - settings.beginGroup(strUserProfile); - writeSettings(_strIniFolder); - settings.endGroup(); - } - QString profile = settings.value("profile", strUserProfile).toString(); - if (settings.childGroups().indexOf(profile) >= 0) { - settings.beginGroup(profile); - _loadSettings(settings); - settings.endGroup(); - } else - rewriteSettings = true; - if (config.version != CONFIG_VERSION_CURRENT) - rewriteSettings = true; - } - if (rewriteSettings) { - // Keep settings up-to-date - { - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - QString profile = settings.value("profile", strUserProfile).toString(); - settings.remove(profile); - } - config.version = CONFIG_VERSION_CURRENT; - writeSettings(_strIniFolder); - } -} - -void writeSettings(const QString & _strIniFolder) -{ -// QSettings settings("Emulation", "GLideN64"); - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - settings.setValue("version", config.version); - settings.setValue("translation", config.translationFile.c_str()); - QString profile = settings.value("profile", strUserProfile).toString(); - - settings.beginGroup(profile); - settings.setValue("version", config.version); - - settings.beginGroup("video"); - settings.setValue("windowedWidth", config.video.windowedWidth); - settings.setValue("windowedHeight", config.video.windowedHeight); - settings.setValue("fullscreen", config.video.fullscreen); - settings.setValue("multisampling", config.video.multisampling); - settings.setValue("maxMultiSampling", config.video.maxMultiSampling); - settings.setValue("fxaa", config.video.fxaa); - settings.setValue("verticalSync", config.video.verticalSync); - settings.setValue("threadedVideo", config.video.threadedVideo); - settings.endGroup(); - - settings.beginGroup("texture"); - settings.setValue("maxAnisotropy", config.texture.maxAnisotropy); - settings.setValue("bilinearMode", config.texture.bilinearMode); - settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval); - settings.setValue("screenShotFormat", config.texture.screenShotFormat); - settings.endGroup(); - - settings.beginGroup("generalEmulation"); - settings.setValue("enableDitheringPattern", config.generalEmulation.enableDitheringPattern); - settings.setValue("enableDitheringQuantization", config.generalEmulation.enableDitheringQuantization); - settings.setValue("enableHiresNoiseDithering", config.generalEmulation.enableHiresNoiseDithering); - settings.setValue("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode); - settings.setValue("enableLOD", config.generalEmulation.enableLOD); - settings.setValue("enableHWLighting", config.generalEmulation.enableHWLighting); - settings.setValue("enableCoverage", config.generalEmulation.enableCoverage); - settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage); - settings.setValue("enableLegacyBlending", config.generalEmulation.enableLegacyBlending); //ini only - settings.setValue("enableHybridFilter", config.generalEmulation.enableHybridFilter); //ini only - settings.setValue("enableFragmentDepthWrite", config.generalEmulation.enableFragmentDepthWrite); //ini only - settings.setValue("enableCustomSettings", config.generalEmulation.enableCustomSettings); - settings.endGroup(); - - settings.beginGroup("graphics2D"); - settings.setValue("correctTexrectCoords", config.graphics2D.correctTexrectCoords); - settings.setValue("enableNativeResTexrects", config.graphics2D.enableNativeResTexrects); - settings.setValue("bgMode", config.graphics2D.bgMode); - settings.setValue("enableTexCoordBounds", config.graphics2D.enableTexCoordBounds); - settings.endGroup(); - - settings.beginGroup("frameBufferEmulation"); - settings.setValue("enable", config.frameBufferEmulation.enable); - settings.setValue("aspect", config.frameBufferEmulation.aspect); - settings.setValue("nativeResFactor", config.frameBufferEmulation.nativeResFactor); - settings.setValue("bufferSwapMode", config.frameBufferEmulation.bufferSwapMode); - settings.setValue("N64DepthCompare", config.frameBufferEmulation.N64DepthCompare); - settings.setValue("forceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear); - settings.setValue("copyAuxToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM); - settings.setValue("copyFromRDRAM", config.frameBufferEmulation.copyFromRDRAM); - settings.setValue("copyToRDRAM", config.frameBufferEmulation.copyToRDRAM); - settings.setValue("copyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM); - settings.setValue("fbInfoDisabled", config.frameBufferEmulation.fbInfoDisabled); - settings.setValue("fbInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk); - settings.setValue("fbInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk); - settings.setValue("copyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer); - settings.setValue("enableOverscan", config.frameBufferEmulation.enableOverscan); - settings.setValue("overscanPalLeft", config.frameBufferEmulation.overscanPAL.left); - settings.setValue("overscanPalRight", config.frameBufferEmulation.overscanPAL.right); - settings.setValue("overscanPalTop", config.frameBufferEmulation.overscanPAL.top); - settings.setValue("overscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom); - settings.setValue("overscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left); - settings.setValue("overscanNtscRight", config.frameBufferEmulation.overscanNTSC.right); - settings.setValue("overscanNtscTop", config.frameBufferEmulation.overscanNTSC.top); - settings.setValue("overscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom); - settings.endGroup(); - - settings.beginGroup("textureFilter"); - settings.setValue("txFilterMode", config.textureFilter.txFilterMode); - settings.setValue("txEnhancementMode", config.textureFilter.txEnhancementMode); - settings.setValue("txDeposterize", config.textureFilter.txDeposterize); - settings.setValue("txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG); - settings.setValue("txCacheSize", config.textureFilter.txCacheSize); - settings.setValue("txHiresEnable", config.textureFilter.txHiresEnable); - settings.setValue("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel); - settings.setValue("txHresAltCRC", config.textureFilter.txHresAltCRC); - settings.setValue("txForce16bpp", config.textureFilter.txForce16bpp); - settings.setValue("txCacheCompression", config.textureFilter.txCacheCompression); - settings.setValue("txSaveCache", config.textureFilter.txSaveCache); - settings.setValue("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage); - settings.setValue("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage); - settings.setValue("txPath", QString::fromWCharArray(config.textureFilter.txPath)); - settings.setValue("txCachePath", QString::fromWCharArray(config.textureFilter.txCachePath)); - settings.setValue("txDumpPath", QString::fromWCharArray(config.textureFilter.txDumpPath)); - settings.endGroup(); - - settings.beginGroup("font"); - settings.setValue("name", config.font.name.c_str()); - settings.setValue("size", config.font.size); - settings.setValue("color", QColor(config.font.color[0], config.font.color[1], config.font.color[2], config.font.color[3])); - settings.endGroup(); - - settings.beginGroup("gammaCorrection"); - settings.setValue("force", config.gammaCorrection.force); - settings.setValue("level", config.gammaCorrection.level); - settings.endGroup(); - - settings.beginGroup("onScreenDisplay"); - settings.setValue("showFPS", config.onScreenDisplay.fps); - settings.setValue("showVIS", config.onScreenDisplay.vis); - settings.setValue("showPercent", config.onScreenDisplay.percent); - settings.setValue("showInternalResolution", config.onScreenDisplay.internalResolution); - settings.setValue("showRenderingResolution", config.onScreenDisplay.renderingResolution); - settings.setValue("showStatistics", config.onScreenDisplay.statistics); - settings.setValue("osdPos", config.onScreenDisplay.pos); - settings.endGroup(); - - settings.beginGroup("hotkeys"); - for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - settings.setValue(Config::hotkeyIniName(idx), config.hotkeys.keys[idx]); - } - settings.endGroup(); - - settings.beginGroup("debug"); - settings.setValue("dumpMode", config.debug.dumpMode); - settings.endGroup(); - - settings.endGroup(); -} - -static -u32 Adler32(u32 crc, const void *buffer, u32 count) -{ - register u32 s1 = crc & 0xFFFF; - register u32 s2 = (crc >> 16) & 0xFFFF; - int k; - const u8 *Buffer = (const u8*)buffer; - - if (Buffer == NULL) - return 0; - - while (count > 0) { - /* 5552 is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - k = (count < 5552 ? count : 5552); - count -= k; - while (k--) { - s1 += *Buffer++; - s2 += s1; - } - /* 65521 is the largest prime smaller than 65536 */ - s1 %= 65521; - s2 %= 65521; - } - - return (s2 << 16) | s1; -} - -static -QString _getRomName(const char * _strRomName) { - const QByteArray bytes(_strRomName); - bool bASCII = true; - for (int i = 0; i < bytes.length() && bASCII; ++i) - bASCII = bytes.at(i) >= 0; - - return bASCII ? - QString::fromLatin1(_strRomName).toUpper() : - QString::number(Adler32(0xFFFFFFFF, bytes.data(), bytes.length()), 16).toUpper(); -} - -void loadCustomRomSettings(const QString & _strIniFolder, const char * _strRomName) -{ - QSettings settings(_strIniFolder + "/" + strCustomSettingsFileName, QSettings::IniFormat); - - const QString romName = _getRomName(_strRomName); - if (settings.childGroups().indexOf(romName) < 0) - return; - - settings.beginGroup(romName); - _loadSettings(settings); - settings.endGroup(); - config.version = CONFIG_VERSION_CURRENT; -} - -void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomName) -{ - Config origConfig; - origConfig.resetToDefaults(); - std::swap(config, origConfig); - loadSettings(_strIniFolder); - std::swap(config, origConfig); - - QSettings settings(_strIniFolder + "/" + strCustomSettingsFileName, QSettings::IniFormat); - const QString romName = _getRomName(_strRomName); - -#define WriteCustomSetting(G, S) \ - if (origConfig.G.S != config.G.S || \ - origConfig.G.S != settings.value(#S, config.G.S).toInt()) \ - settings.setValue(#S, config.G.S) -#define WriteCustomSetting2(G, N, S) \ - if (origConfig.G.S != config.G.S || \ - origConfig.G.S != settings.value(#N, config.G.S).toInt()) \ - settings.setValue(#N, config.G.S) -#define WriteCustomSettingF(G, S) \ - if (origConfig.G.S != config.G.S || \ - origConfig.G.S != settings.value(#S, config.G.S).toFloat()) \ - settings.setValue(#S, config.G.S) -#define WriteCustomSettingS(S) \ - const QString new##S = QString::fromWCharArray(config.textureFilter.S); \ - const QString orig##S = QString::fromWCharArray(origConfig.textureFilter.S); \ - if (orig##S != new##S || \ - orig##S != settings.value(#S, new##S).toString()) \ - settings.setValue(#S, new##S) - - settings.beginGroup(romName); - - settings.beginGroup("video"); - WriteCustomSetting(video, windowedWidth); - WriteCustomSetting(video, windowedHeight); - WriteCustomSetting(video, fullscreen); - WriteCustomSetting(video, multisampling); - WriteCustomSetting(video, fxaa); - WriteCustomSetting(video, verticalSync); - settings.endGroup(); - - settings.beginGroup("texture"); - WriteCustomSetting(texture, maxAnisotropy); - WriteCustomSetting(texture, bilinearMode); - WriteCustomSetting(texture, enableHalosRemoval); - WriteCustomSetting(texture, screenShotFormat); - settings.endGroup(); - - settings.beginGroup("generalEmulation"); - WriteCustomSetting(generalEmulation, enableDitheringPattern); - WriteCustomSetting(generalEmulation, enableDitheringQuantization); - WriteCustomSetting(generalEmulation, enableHiresNoiseDithering); - WriteCustomSetting(generalEmulation, rdramImageDitheringMode); - WriteCustomSetting(generalEmulation, enableLOD); - WriteCustomSetting(generalEmulation, enableHWLighting); - WriteCustomSetting(generalEmulation, enableCoverage); - WriteCustomSetting(generalEmulation, enableShadersStorage); - settings.endGroup(); - - settings.beginGroup("graphics2D"); - WriteCustomSetting(graphics2D, correctTexrectCoords); - WriteCustomSetting(graphics2D, enableNativeResTexrects); - WriteCustomSetting(graphics2D, bgMode); - WriteCustomSetting(graphics2D, enableTexCoordBounds); - settings.endGroup(); - - settings.beginGroup("frameBufferEmulation"); - WriteCustomSetting(frameBufferEmulation, enable); - WriteCustomSetting(frameBufferEmulation, aspect); - WriteCustomSetting(frameBufferEmulation, nativeResFactor); - WriteCustomSetting(frameBufferEmulation, bufferSwapMode); - WriteCustomSetting(frameBufferEmulation, N64DepthCompare); - WriteCustomSetting(frameBufferEmulation, forceDepthBufferClear); - WriteCustomSetting(frameBufferEmulation, copyAuxToRDRAM); - WriteCustomSetting(frameBufferEmulation, copyFromRDRAM); - WriteCustomSetting(frameBufferEmulation, copyToRDRAM); - WriteCustomSetting(frameBufferEmulation, copyDepthToRDRAM); - WriteCustomSetting(frameBufferEmulation, fbInfoDisabled); - WriteCustomSetting(frameBufferEmulation, fbInfoReadColorChunk); - WriteCustomSetting(frameBufferEmulation, fbInfoReadDepthChunk); - WriteCustomSetting(frameBufferEmulation, copyDepthToMainDepthBuffer); - WriteCustomSetting(frameBufferEmulation, enableOverscan); - WriteCustomSetting2(frameBufferEmulation, overscanPalLeft, overscanPAL.left); - WriteCustomSetting2(frameBufferEmulation, overscanPalRight, overscanPAL.right); - WriteCustomSetting2(frameBufferEmulation, overscanPalTop, overscanPAL.top); - WriteCustomSetting2(frameBufferEmulation, overscanPalBottom, overscanPAL.bottom); - WriteCustomSetting2(frameBufferEmulation, overscanNtscLeft, overscanNTSC.left); - WriteCustomSetting2(frameBufferEmulation, overscanNtscRight, overscanNTSC.right); - WriteCustomSetting2(frameBufferEmulation, overscanNtscTop, overscanNTSC.top); - WriteCustomSetting2(frameBufferEmulation, overscanNtscBottom, overscanNTSC.bottom); - settings.endGroup(); - - settings.beginGroup("textureFilter"); - WriteCustomSetting(textureFilter, txFilterMode); - WriteCustomSetting(textureFilter, txEnhancementMode); - WriteCustomSetting(textureFilter, txDeposterize); - WriteCustomSetting(textureFilter, txFilterIgnoreBG); - WriteCustomSetting(textureFilter, txCacheSize); - WriteCustomSetting(textureFilter, txEnhancedTextureFileStorage); - WriteCustomSetting(textureFilter, txHiresTextureFileStorage); - WriteCustomSetting(textureFilter, txHiresEnable); - WriteCustomSetting(textureFilter, txHiresFullAlphaChannel); - WriteCustomSetting(textureFilter, txHresAltCRC); - WriteCustomSetting(textureFilter, txForce16bpp); - WriteCustomSetting(textureFilter, txCacheCompression); - WriteCustomSetting(textureFilter, txSaveCache); - WriteCustomSettingS(txPath); - WriteCustomSettingS(txCachePath); - WriteCustomSettingS(txDumpPath); - settings.endGroup(); - - settings.beginGroup("gammaCorrection"); - WriteCustomSetting(gammaCorrection, force); - WriteCustomSettingF(gammaCorrection, level); - settings.endGroup(); - - settings.beginGroup("onScreenDisplay"); - WriteCustomSetting2(onScreenDisplay, showFPS, fps); - WriteCustomSetting2(onScreenDisplay, showVIS, vis); - WriteCustomSetting2(onScreenDisplay, showPercent, percent); - WriteCustomSetting2(onScreenDisplay, showInternalResolution, internalResolution); - WriteCustomSetting2(onScreenDisplay, showRenderingResolution, renderingResolution); - WriteCustomSetting2(onScreenDisplay, osdPos, pos); - settings.endGroup(); - - settings.endGroup(); -} - -QString getTranslationFile() -{ - return config.translationFile.c_str(); -} - -QStringList getProfiles(const QString & _strIniFolder) -{ - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - return settings.childGroups(); -} - -QString getCurrentProfile(const QString & _strIniFolder) -{ - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - return settings.value("profile", strUserProfile).toString(); -} - -void changeProfile(const QString & _strIniFolder, const QString & _strProfile) -{ - { - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - settings.setValue("profile", _strProfile); - } - loadSettings(_strIniFolder); -} - -void addProfile(const QString & _strIniFolder, const QString & _strProfile) -{ - { - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - settings.setValue("profile", _strProfile); - } - writeSettings(_strIniFolder); -} - -void removeProfile(const QString & _strIniFolder, const QString & _strProfile) -{ - QSettings settings(_strIniFolder + "/" + strIniFileName, QSettings::IniFormat); - settings.remove(_strProfile); -} diff --git a/GLideN64/src/GLideNUI/Settings.h b/GLideN64/src/GLideNUI/Settings.h deleted file mode 100644 index c4e6a45..0000000 --- a/GLideN64/src/GLideNUI/Settings.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SETTINGS_H -#define SETTINGS_H - -void loadSettings(const QString & _strIniFolder); -void writeSettings(const QString & _strIniFolder); -void loadCustomRomSettings(const QString & _strIniFolder, const char * _strRomName); -void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomName); -QString getTranslationFile(); -QStringList getProfiles(const QString & _strIniFolder); -QString getCurrentProfile(const QString & _strIniFolder); -void changeProfile(const QString & _strIniFolder, const QString & _strProfile); -void addProfile(const QString & _strIniFolder, const QString & _strProfile); -void removeProfile(const QString & _strIniFolder, const QString & _strProfile); - -#endif // SETTINGS_H - diff --git a/GLideN64/src/GLideNUI/configDialog.ui b/GLideN64/src/GLideNUI/configDialog.ui deleted file mode 100644 index d8ddac8..0000000 --- a/GLideN64/src/GLideNUI/configDialog.ui +++ /dev/null @@ -1,3441 +0,0 @@ - - - ConfigDialog - - - Qt::WindowModal - - - - 0 - 0 - 747 - 715 - - - - GLideN64 Settings - - - - :/Icon.ico:/Icon.ico - - - true - - - - QLayout::SetFixedSize - - - - - 0 - - - false - - - - Video - - - - - - 16 - - - - - Video - - - - 18 - - - - - - - Full Screen: - - - true - - - - - - - - - - - - <html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html> - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Windowed resolution: - - - - - - - true - - - - Custom - - - - - - - - - - - <html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html> - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <html><head/><body><p>Aspect ratio:</p></body></html> - - - - - - - - 4:3 (recommended) - - - - - 16:9 - - - - - Stretch - - - - - Try to adjust game to fit - - - - - - - - - - - <html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html> - - - Enable VSync - - - - - - - <html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html> - - - Enable threaded video - - - - - - - - 147 - 0 - - - - When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games. - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Overscan - - - - - - - - 0 - 0 - - - - - NTSC - - - - 9 - - - 9 - - - 9 - - - 9 - - - 0 - - - 5 - - - - - -99 - - - - - - - -99 - - - - - - - -99 - - - - - - - -99 - - - - - - - - PAL - - - - 0 - - - 5 - - - - - -99 - - - - - - - -99 - - - - - - - -99 - - - - - - - -99 - - - - - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - 18 - - - - - Anti-aliasing - - - - 18 - - - - - <html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html> - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - No anti-aliasing - - - - - - - Fast approximate anti-aliasing (FXAA) - - - - - - - Multisample anti-aliasing (MSAA): - - - true - - - - - - - - 10 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 2 - - - - - Off - - - - - - - - - 2 - - - - - 4 - - - 1 - - - 1 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 1 - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 0 - - - - - - - - 0 - 0 - - - - x - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - - - - 2 - - - - - High - - - - - - - - - - - - - 9 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - :/Info.ico - - - - - - - Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>. - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - - - - - - - - - - - - - - Filtering - - - - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Anisotropic filtering: - - - - - - - 10 - - - - - 2 - - - - - Off - - - - - - - - - 2 - - - - - 16 - - - 2 - - - 2 - - - Qt::Horizontal - - - false - - - false - - - QSlider::TicksBelow - - - 2 - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 0 - - - - - - - - 0 - 0 - - - - x - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - - - - 2 - - - - - High - - - - - - - - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html> - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 1 - - - - - Bilinear filtering: - - - - - - - - - Standard - - - - - - - N64-style 3 point - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - 18 - - - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Screenshot format: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - JPEG - - - true - - - screenshotButtonGroup - - - - - - - PNG - - - screenshotButtonGroup - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - <html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html> - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Language: - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - - - - - - - 9 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - - - :/Info.ico - - - - - - - Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off. - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - - - - - - - - - - 0 - 380 - - - - Emulation - - - - 10 - - - - - 18 - - - - - - 0 - 0 - - - - <html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html> - - - Use per-game settings - - - true - - - - - - - - 4 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - <html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html> - - - Enable N64-style mip-mapping - - - true - - - - - - - <html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html> - - - Enable per-pixel lighting (better quality, HLE only) - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Enable pixel coverage calculation. </span></p><p>Enables approximated pixel coverage calculation. N64 uses pixel coverage for anti-aliasing and in some special blending modes. Some games have wire-frame mode aka 'pen and ink' mode. This mode also needs pixel coverage calculated. </p><p>[Recommended: Checked, unless performance is hurt]</p></body></html> - - - Enable pixel coverage calculation - - - - - - - <html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html> - - - Store compiled shaders for performance (recommended) - - - true - - - - - - - - - - 16 - - - - - <html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html> - - - Internal resolution - - - - 3 - - - - - Same as output resolution - - - factorButtonGroup - - - - - - - Original N64 resolution (most accurate) - - - factorButtonGroup - - - - - - - - - 2 - - - - - Multiple of N64 resolution: - - - factorButtonGroup - - - - - - - - - x - - - 2 - - - 16 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - <html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html> - - - Gamma - - - - 4 - - - - - - - Custom gamma correction level: - - - - - - - 0 - - - - - 1.000000000000000 - - - 4.000000000000000 - - - 0.100000000000000 - - - 2.000000000000000 - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 2 - - - - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - - 9 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - :/Info.ico - - - - - - - Selecting this option overrides gamma correction specified by the game. - - - true - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - - Dithering - - - - - - <html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html> - - - Enable 5bit quantization - - - - - - - <html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html> - - - High resolution noise dithering - - - - - - - <html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html> - - - Dithering pattern on output image - - - - - - - - - <html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html> - - - RDRAM image dithering: - - - - - - - <html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html> - - - - disable - - - - - Bayer - - - - - Magic square - - - - - Blue noise - - - - - - - - - - - - - 2D elements - - - - 18 - - - - - 4 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - <html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html> - - - Render 2D elements in N64 resolution (best quality, can be slow): - - - - - - - <html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html> - - - - Disable - - - - - Enable optimized - - - - - Enable unoptimized - - - - - - - - - - - - Remove colored halos around transparent objects - - - - - - - <html><head/><body><p>Bound texture rectangle texture coordinates to the values they take in native resolutions. It prevents garbage due to fetching out of texture bounds, but can result in hard edges.</p></body></html> - - - Enable native-res bounds for texture coordinates - - - - - - - - - - - 9 - - - - - <html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html> - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Fix black lines between 2D elements: - - - true - - - - - - - - 0 - 0 - - - - For adjacent 2D elements - - - fixTexrectCoordsButtonGroup - - - - - - - Always - - - fixTexrectCoordsButtonGroup - - - - - - - Never - - - true - - - fixTexrectCoordsButtonGroup - - - - - - - - - - color: rgba(0, 0, 0, 15%); - - - QFrame::Plain - - - Qt::Vertical - - - - - - - <html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html> - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Background rendering mode (HLE only): - - - - - - - One piece - - - - - - - Stripped - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 0 - 20 - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - 9 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - - - :/Info.ico - - - - - - - Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off. - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - - - - - - - - - Frame buffer - - - - - - 18 - - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Emulate frame buffer - - - true - - - - - - - - 10 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - <html><head/><body><p><img src=":/Warning.ico"/></p></body></html> - - - - - - - <html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html> - - - Qt::RichText - - - false - - - true - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 12 - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 18 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html> - - - Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues) - - - - - - - - - 16 - - - - - <html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html> - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Frame buffer swap on: - - - - - - - - Vertical interrupt (recommended, fewest game issues) - - - - - VI origin change (faster, few game issues) - - - - - Color buffer change (fastest, some game issues) - - - - - - - - - - - - 4 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html> - - - Use emulator help to read/write frame buffers - - - false - - - - - - - <html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html> - - - Read color buffer in 4 KB chunks - - - - - - - <html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html> - - - Read depth buffer in 4 KB chunks - - - true - - - - - - - - - - 5 - - - - - <html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html> - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Copy video card frame buffer to N64 memory: - - - - - - - - Never (fastest, many game issues) - - - - - Synchronous (slowest, fewest game issues) - - - - - Asynchronous (fast, few game issues) - - - - - - - - - - - <html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html> - - - QFrame::NoFrame - - - QFrame::Plain - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Copy video card depth buffer to N64 memory: - - - - - - - - Never (fastest, most game issues) - - - - - From VRAM (slow, some game issues) - - - - - In software (fast, fewest game issues) - - - - - - - - - - - - - 4 - - - - - - - <html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html> - - - N64-style depth compare (experimental, disables MSAA) - - - - - - - <html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html> - - - - Disable - - - - - Fast - - - - - Compatible - - - - - - - - - - <html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html> - - - Force depth buffer clear - - - - - - - <html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html> - - - Render N64 frame buffer to output - - - - - - - <html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html> - - - Copy depth to main depth buffer - - - - - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - OSD - - - On-screen display - - - - - - 16 - - - - - - - Position - - - - 9 - - - 6 - - - 9 - - - 12 - - - - - false - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Right - - - - :/Right.ico:/Right.ico - - - - 22 - 16 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Bottom left - - - - :/BottomLeft.ico:/BottomLeft.ico - - - - 17 - 17 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Top - - - - :/Up.ico:/Up.ico - - - - 16 - 22 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Bottom right - - - - :/BottomRight.ico:/BottomRight.ico - - - - 17 - 17 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - false - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Left - - - - :/Left.ico:/Left.ico - - - - 22 - 16 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - false - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - - - - false - - - osdButtonGroup - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Top left - - - - :/TopLeft.ico:/TopLeft.ico - - - - 17 - 17 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Bottom - - - - :/Down.ico:/Down.ico - - - - 16 - 22 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - - 38 - 38 - - - - - 17 - - - - Top right - - - - :/TopRight.ico:/TopRight.ico - - - - 17 - 17 - - - - true - - - true - - - false - - - osdButtonGroup - - - - - - - - - - 4 - - - - - Display FPS - - - - - - - Display VI/s - - - - - - - Display percentage - - - - - - - Display internal resolution - - - - - - - Display rendering resolution - - - - - - - Display statistics - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - Font - - - - 9 - - - 9 - - - 9 - - - 9 - - - - - - - - - 0 - 0 - - - - - 0 - 160 - - - - - 16777215 - 160 - - - - font: 8pt "MS Shell Dlg 2"; - - - false - - - - 1 - - - - - - - - - - Size: - - - - - - - - 0 - 0 - - - - px - - - 6 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 9 - 0 - - - - - - - - - 0 - 0 - - - - margin-top: 2px - - - Color: - - - PickFontColorButton - - - - - - - - 0 - 28 - - - - - 46 - 16777215 - - - - - Arial Unicode MS - 10 - - - - ████ - - - false - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - Preview - - - Qt::AlignCenter - - - 2 - - - - - - - - 9 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - :/Info.ico - - - - - - - The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game. - - - true - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - Hotkey - - - - - - - - - - - - - - Debug - - - - 4 - - - - - Dump low-level info - - - - - - - Dump display list commands - - - - - - - Dump detailed info (matrices, vertices, etc.) - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - This game - - - - - - - Save settings for: - - - - - - - Settings profile: - - - - - - - - - - Settings profile: - - - - - - - - 100 - 0 - - - - - - - - padding:3px 7px 4px - - - Remove - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - padding:4px 1em;min-width:47px - - - QDialogButtonBox::Close|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save - - - - - - - - - - - buttonBox - rejected() - ConfigDialog - reject() - - - 450 - 675 - - - 426 - 629 - - - - - fbInfoEnableCheckBox - toggled(bool) - readDepthChunkCheckBox - setEnabled(bool) - - - 98 - 221 - - - 97 - 263 - - - - - frameBufferCheckBox - toggled(bool) - frameBufferOptionsFrame - setEnabled(bool) - - - 100 - 41 - - - 112 - 143 - - - - - frameBufferCheckBox - toggled(bool) - frameBufferInfoFrame2 - setHidden(bool) - - - 100 - 41 - - - 156 - 604 - - - - - anisotropicSlider - valueChanged(int) - anisotropicLabelVal - setNum(int) - - - 489 - 297 - - - 367 - 313 - - - - - fbInfoEnableCheckBox - toggled(bool) - readColorChunkCheckBox - setEnabled(bool) - - - 82 - 221 - - - 82 - 242 - - - - - frameBufferCheckBox - toggled(bool) - frameBufferInfoFrame - setHidden(bool) - - - 100 - 41 - - - 356 - 604 - - - - - overscanCheckBox - toggled(bool) - overscanTabWidget - setVisible(bool) - - - 128 - 343 - - - 152 - 463 - - - - - gammaCorrectionCheckBox - toggled(bool) - gammaCorrectionNoteFrame - setVisible(bool) - - - 462 - 218 - - - 524 - 253 - - - - - frameBufferCheckBox - toggled(bool) - factorGroupBox - setEnabled(bool) - - - 278 - 49 - - - 140 - 201 - - - - - frameBufferCheckBox - toggled(bool) - overscanFrame - setEnabled(bool) - - - 278 - 49 - - - 104 - 395 - - - - - frameBufferCheckBox - toggled(bool) - fxaaRadioButton - setEnabled(bool) - - - 278 - 49 - - - 369 - 93 - - - - - enhancedTexFileStorageCheckBox - toggled(bool) - textureFilterCacheFrame - setDisabled(bool) - - - 350 - 116 - - - 278 - 395 - - - - - - - - - - - diff --git a/GLideN64/src/GLideNUI/fullscreenresolutions_mupen64plus.cpp b/GLideN64/src/GLideNUI/fullscreenresolutions_mupen64plus.cpp deleted file mode 100644 index bb70797..0000000 --- a/GLideN64/src/GLideNUI/fullscreenresolutions_mupen64plus.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include -#include -#include "FullscreenResolutions.h" -#include "../Config.h" -#include "../mupenplus/GLideN64_mupenplus.h" - -static struct -{ - struct - { - uint32_t width, height, refreshRate; - } selected; - - struct - { - uint32_t width, height; - } resolution[32]; - - uint32_t refreshRate[32]; - - uint32_t numResolutions; - uint32_t numRefreshRates; -} fullscreen; - -static void _fillFullscreenRefreshRateList(QStringList &_listRefreshRates, int &_rateIdx) -{ - memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate)); - fullscreen.numRefreshRates = 0; - _rateIdx = 0; - - m64p_error ret; - m64p_2d_size size; - size.uiHeight = fullscreen.selected.height; - size.uiWidth = fullscreen.selected.width; - - int num_rates = 32; - int *rates = (int *)malloc(num_rates * sizeof(int)); - - ret = CoreVideo_ListFullscreenRates(size, &num_rates, rates); - - if (ret != M64ERR_SUCCESS) - return; - - for (int i = 0; i < num_rates; i++) - { - int refreshRate = rates[i]; - - _listRefreshRates.append(QString::number(refreshRate) + " Hz"); - fullscreen.refreshRate[fullscreen.numRefreshRates] = refreshRate; - - if (fullscreen.selected.refreshRate == refreshRate) - _rateIdx = fullscreen.numRefreshRates; - - fullscreen.numRefreshRates++; - } - - free(rates); -} - -void fillFullscreenResolutionsList(QStringList &_listResolutions, int &_resolutionIdx, QStringList &_listRefreshRates, int &_rateIdx) -{ - fullscreen.selected.width = config.video.fullscreenWidth; - fullscreen.selected.height = config.video.fullscreenHeight; - fullscreen.selected.refreshRate = config.video.fullscreenRefresh; - - memset(&fullscreen.resolution, 0, sizeof(fullscreen.resolution)); - memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate)); - fullscreen.numResolutions = 0; - fullscreen.numRefreshRates = 0; - _resolutionIdx = 0; - - int resolutions_length = 32; - m64p_2d_size *resolutions = (m64p_2d_size *)malloc(resolutions_length * sizeof(m64p_2d_size)); - m64p_error ret; - - ret = CoreVideo_ListFullscreenModes(resolutions, &resolutions_length); - - if (ret != M64ERR_SUCCESS) - return; - - for (int i = 0; i < resolutions_length; i++) - { - fullscreen.resolution[fullscreen.numResolutions].width = resolutions[i].uiWidth; - fullscreen.resolution[fullscreen.numResolutions].height = resolutions[i].uiHeight; - - _listResolutions.append(QString::number(resolutions[i].uiWidth) + " x " + QString::number(resolutions[i].uiHeight)); - - if ((fullscreen.selected.width == resolutions[i].uiWidth) && - (fullscreen.selected.height == resolutions[i].uiHeight)) - _resolutionIdx = fullscreen.numResolutions; - - fullscreen.numResolutions++; - } - - _fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx); - - free(resolutions); -} - -void fillFullscreenRefreshRateList(int _resolutionIdx, QStringList &_listRefreshRates, int &_rateIdx) -{ - fullscreen.selected.width = fullscreen.resolution[_resolutionIdx].width; - fullscreen.selected.height = fullscreen.resolution[_resolutionIdx].height; - _fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx); - _rateIdx = fullscreen.numRefreshRates - 1; -} - -void getFullscreenResolutions(int _idx, unsigned int &_width, unsigned int &_height) -{ - _width = fullscreen.resolution[_idx].width; - _height = fullscreen.resolution[_idx].height; -} - -void getFullscreenRefreshRate(int _idx, unsigned int &_rate) -{ - _rate = fullscreen.refreshRate[_idx]; -} diff --git a/GLideN64/src/GLideNUI/fullscreenresolutions_windows.cpp b/GLideN64/src/GLideNUI/fullscreenresolutions_windows.cpp deleted file mode 100644 index 420c167..0000000 --- a/GLideN64/src/GLideNUI/fullscreenresolutions_windows.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include -#include -#include -#include "FullscreenResolutions.h" -#include "../Config.h" - -#if defined(_MSC_VER) && _MSC_VER < 1900 - -#define snprintf c99_snprintf -#define vsnprintf c99_vsnprintf - -__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) -{ - int count = -1; - - if (size != 0) - count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); - if (count == -1) - count = _vscprintf(format, ap); - - return count; -} - -__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) -{ - int count; - va_list ap; - - va_start(ap, format); - count = c99_vsnprintf(outBuf, size, format, ap); - va_end(ap); - - return count; -} - -#endif - -static -struct -{ - struct - { - DWORD width, height, refreshRate; - } selected; - - struct - { - DWORD width, height; - } resolution[32]; - - DWORD refreshRate[32]; - - DWORD numResolutions; - DWORD numRefreshRates; -} fullscreen; - -static -void _fillFullscreenRefreshRateList(QStringList & _listRefreshRates, int & _rateIdx) -{ - memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate)); - fullscreen.numRefreshRates = 0; - _rateIdx = 0; - - int i = 0; - DEVMODE deviceMode; - while (EnumDisplaySettings(NULL, i++, &deviceMode) != 0) - { - if (deviceMode.dmBitsPerPel != 32) - continue; - - DWORD j = 0; - for (; j < fullscreen.numRefreshRates; ++j) { - if ((deviceMode.dmDisplayFrequency == fullscreen.refreshRate[j])) - break; - } - if ((deviceMode.dmDisplayFrequency != fullscreen.refreshRate[j]) && - (deviceMode.dmPelsWidth == fullscreen.selected.width) && - (deviceMode.dmPelsHeight == fullscreen.selected.height)) { - - fullscreen.refreshRate[j] = deviceMode.dmDisplayFrequency; - //: Abbreviation for Hertz; include a leading space if appropriate - _listRefreshRates.append(QString::number(deviceMode.dmDisplayFrequency) + QObject::tr(" Hz")); - - if (fullscreen.selected.refreshRate == deviceMode.dmDisplayFrequency) - _rateIdx = fullscreen.numRefreshRates; - - ++fullscreen.numRefreshRates; - } - } -} - -void fillFullscreenResolutionsList(QStringList & _listResolutions, int & _resolutionIdx, QStringList & _listRefreshRates, int & _rateIdx) -{ - fullscreen.selected.width = config.video.fullscreenWidth; - fullscreen.selected.height = config.video.fullscreenHeight; - fullscreen.selected.refreshRate = config.video.fullscreenRefresh; - - memset(&fullscreen.resolution, 0, sizeof(fullscreen.resolution)); - memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate)); - fullscreen.numResolutions = 0; - fullscreen.numRefreshRates = 0; - _resolutionIdx = 0; - - static - struct - { - unsigned short x, y; - const char *description; - } ratios[] = { - { 3, 2, "3:2" }, - { 4, 3, "4:3" }, - { 5, 4, "5:4" }, - { 16, 9, "16:9" }, - { 8, 5, "16:10" }, - { 21, 9, "21:9" } - }; - const int numRatios = sizeof(ratios); - - int i = 0; - char text[128]; - DEVMODE deviceMode; - while (EnumDisplaySettings(NULL, i++, &deviceMode) != 0) - { - if (deviceMode.dmBitsPerPel != 32) - continue; - - DWORD j = 0; - for (; j < fullscreen.numResolutions; ++j) { - if ((deviceMode.dmPelsWidth == fullscreen.resolution[j].width) && - (deviceMode.dmPelsHeight == fullscreen.resolution[j].height)) { - break; - } - } - if ((deviceMode.dmPelsWidth != fullscreen.resolution[j].width) || - (deviceMode.dmPelsHeight != fullscreen.resolution[j].height)) { - - fullscreen.resolution[fullscreen.numResolutions].width = deviceMode.dmPelsWidth; - fullscreen.resolution[fullscreen.numResolutions].height = deviceMode.dmPelsHeight; - snprintf(text, 128, "%i x %i", deviceMode.dmPelsWidth, deviceMode.dmPelsHeight); - - for (int j = 0; j < numRatios; ++j) - if (fabs((float)deviceMode.dmPelsWidth / (float)deviceMode.dmPelsHeight - - (float)ratios[j].x / (float)ratios[j].y) < 0.005f) { - snprintf(text, 128, "%s (%s)", text, ratios[j].description); - break; - } - - _listResolutions.append(text); - - if ((fullscreen.selected.width == deviceMode.dmPelsWidth) && - (fullscreen.selected.height == deviceMode.dmPelsHeight)) - _resolutionIdx = fullscreen.numResolutions; - - ++fullscreen.numResolutions; - } - } - - _fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx); -} - -void fillFullscreenRefreshRateList(int _resolutionIdx, QStringList & _listRefreshRates, int & _rateIdx) -{ - fullscreen.selected.width = fullscreen.resolution[_resolutionIdx].width; - fullscreen.selected.height = fullscreen.resolution[_resolutionIdx].height; - _fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx); - _rateIdx = fullscreen.numRefreshRates - 1; -} - -void getFullscreenResolutions(int _idx, unsigned int & _width, unsigned int & _height) -{ - _width = fullscreen.resolution[_idx].width; - _height = fullscreen.resolution[_idx].height; -} - -void getFullscreenRefreshRate(int _idx, unsigned int & _rate) -{ - _rate = fullscreen.refreshRate[_idx]; -} diff --git a/GLideN64/src/GLideNUI/icon.qrc b/GLideN64/src/GLideNUI/icon.qrc deleted file mode 100644 index 9929470..0000000 --- a/GLideN64/src/GLideNUI/icon.qrc +++ /dev/null @@ -1,15 +0,0 @@ - - - Resources/BottomLeft.ico - Resources/BottomRight.ico - Resources/Down.ico - Resources/Icon.ico - Resources/Info.ico - Resources/Left.ico - Resources/Right.ico - Resources/TopLeft.ico - Resources/TopRight.ico - Resources/Up.ico - Resources/Warning.ico - - diff --git a/GLideN64/src/Graphics/ColorBufferReader.cpp b/GLideN64/src/Graphics/ColorBufferReader.cpp deleted file mode 100644 index 372b242..0000000 --- a/GLideN64/src/Graphics/ColorBufferReader.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -#include "ColorBufferReader.h" -#include "FramebufferTextureFormats.h" -#include "Context.h" -#include "Parameters.h" -#include -#include - -namespace graphics { - - ColorBufferReader::ColorBufferReader(CachedTexture * _pTexture) - : m_pTexture(_pTexture) - { - m_pixelData.resize(m_pTexture->textureBytes); - m_tempPixelData.resize(m_pTexture->textureBytes); - } - - const u8* ColorBufferReader::_convertFloatTextureBuffer(const u8* _gpuData, u32 _width, u32 _height, - u32 _heightOffset, u32 _stride) - { - int bytesToCopy = m_pTexture->width * _height * 16; - std::copy_n(_gpuData, bytesToCopy, m_tempPixelData.data()); - u8* pixelDataAlloc = m_pixelData.data(); - float* pixelData = reinterpret_cast(m_tempPixelData.data()); - const u32 colorsPerPixel = 4; - const u32 widthPixels = _width * colorsPerPixel; - const u32 stridePixels = _stride * colorsPerPixel; - - if (_height * widthPixels > m_pixelData.size()) - _height = static_cast(m_pixelData.size()) / widthPixels; - - for (u32 heightIndex = 0; heightIndex < _height; ++heightIndex) { - for (u32 widthIndex = 0; widthIndex < widthPixels; ++widthIndex) { - u8& dest = *(pixelDataAlloc + heightIndex*widthPixels + widthIndex); - float& src = *(pixelData + (heightIndex+_heightOffset)*stridePixels + widthIndex); - dest = static_cast(src*255.0); - } - } - - return pixelDataAlloc; - } - - const u8* ColorBufferReader::_convertIntegerTextureBuffer(const u8* _gpuData, u32 _width, u32 _height, - u32 _heightOffset, u32 _stride, u32 _colorsPerPixel) - { - const u32 widthBytes = _width * _colorsPerPixel; - const u32 strideBytes = _stride * _colorsPerPixel; - - u8* pixelDataAlloc = m_pixelData.data(); - - if (_height * widthBytes > m_pixelData.size()) - _height = static_cast(m_pixelData.size()) / widthBytes; - - for (u32 index = 0; index < _height; ++index) { - memcpy(pixelDataAlloc + index * widthBytes, _gpuData + ((index + _heightOffset) * strideBytes), widthBytes); - } - - return pixelDataAlloc; - } - - - const u8 * ColorBufferReader::readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync) - { - const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats(); - - ReadColorBufferParams params; - params.x0 = _x0; - params.y0 = _y0; - params.width = _width; - params.height = _height; - params.sync = _sync; - - if (_size > G_IM_SIZ_8b) { - params.colorFormat = fbTexFormat.colorFormat; - params.colorType = fbTexFormat.colorType; - params.colorFormatBytes = fbTexFormat.colorFormatBytes; - } else { - params.colorFormat = fbTexFormat.monochromeFormat; - params.colorType = fbTexFormat.monochromeType; - params.colorFormatBytes = fbTexFormat.monochromeFormatBytes; - } - - u32 heightOffset = 0; - u32 stride = 0; - const u8* pixelData = _readPixels(params, heightOffset, stride); - - if (pixelData == nullptr) - return nullptr; - - if(params.colorType == datatype::FLOAT && _size > G_IM_SIZ_8b) { - return _convertFloatTextureBuffer(pixelData, params.width, params.height, heightOffset, stride); - } else { - return _convertIntegerTextureBuffer(pixelData, params.width, params.height, heightOffset, stride, - params.colorFormatBytes); - } - } -} \ No newline at end of file diff --git a/GLideN64/src/Graphics/ColorBufferReader.h b/GLideN64/src/Graphics/ColorBufferReader.h deleted file mode 100644 index c119ae9..0000000 --- a/GLideN64/src/Graphics/ColorBufferReader.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -#include -#include -#include - -namespace graphics { - -class ColorBufferReader -{ -public: - ColorBufferReader(CachedTexture * _pTexture); - virtual ~ColorBufferReader() = default; - - virtual const u8 * readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync); - virtual void cleanUp() = 0; - -protected: - struct ReadColorBufferParams { - s32 x0; - s32 y0; - u32 width; - u32 height; - bool sync; - ColorFormatParam colorFormat; - DatatypeParam colorType; - u32 colorFormatBytes; - }; - - CachedTexture * m_pTexture; - std::vector m_pixelData; - std::vector m_tempPixelData; - -private: - const u8* _convertFloatTextureBuffer(const u8* _gpuData, u32 _width, u32 _height, u32 _heightOffset, u32 _stride); - const u8* _convertIntegerTextureBuffer(const u8* _gpuData, u32 _width, u32 _height,u32 _heightOffset, u32 _stride, u32 _colorsPerPixel); - virtual const u8 * _readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, u32& _stride) = 0; -}; - -} diff --git a/GLideN64/src/Graphics/CombinerProgram.cpp b/GLideN64/src/Graphics/CombinerProgram.cpp deleted file mode 100644 index bc3bcd8..0000000 --- a/GLideN64/src/Graphics/CombinerProgram.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "CombinerProgram.h" -#include - -namespace graphics { - - u32 CombinerProgram::getShaderCombinerOptionsBits() - { - // WARNING: Shader Storage format version must be increased after any change in this function. - std::vector vecOptions; - vecOptions.push_back(config.video.multisampling > 0 ? 1 : 0); - vecOptions.push_back(config.texture.bilinearMode); - vecOptions.push_back(config.texture.enableHalosRemoval); - vecOptions.push_back(config.generalEmulation.enableHWLighting); - vecOptions.push_back(config.generalEmulation.enableHiresNoiseDithering); - vecOptions.push_back(config.generalEmulation.enableDitheringPattern); - vecOptions.push_back(config.generalEmulation.enableDitheringQuantization); - vecOptions.push_back(config.generalEmulation.enableLOD); - vecOptions.push_back(config.generalEmulation.enableCoverage); - vecOptions.push_back(config.frameBufferEmulation.N64DepthCompare == Config::dcFast ? 1 : 0); - vecOptions.push_back(config.frameBufferEmulation.N64DepthCompare == Config::dcCompatible ? 1 : 0); - vecOptions.push_back(config.generalEmulation.enableLegacyBlending); - vecOptions.push_back(config.generalEmulation.enableFragmentDepthWrite); - u32 optionsSet = 0; - for (u32 i = 0; i < vecOptions.size(); ++i) - optionsSet |= vecOptions[i] << i; - return optionsSet; - } - -} diff --git a/GLideN64/src/Graphics/CombinerProgram.h b/GLideN64/src/Graphics/CombinerProgram.h deleted file mode 100644 index dca25ec..0000000 --- a/GLideN64/src/Graphics/CombinerProgram.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include -#include -#include "CombinerKey.h" - -namespace graphics { - - class CombinerProgram - { - public: - virtual ~CombinerProgram() {} - virtual void activate() = 0; - virtual void update(bool _force) = 0; - - virtual const CombinerKey & getKey() const = 0; - - virtual bool usesTexture() const = 0; - virtual bool usesTile(u32 _t) const = 0; - virtual bool usesShade() const = 0; - virtual bool usesLOD() const = 0; - virtual bool usesHwLighting() const = 0; - - virtual bool getBinaryForm(std::vector & _buffer) = 0; - - static u32 getShaderCombinerOptionsBits(); - }; - - typedef std::map Combiners; -} diff --git a/GLideN64/src/Graphics/Context.cpp b/GLideN64/src/Graphics/Context.cpp deleted file mode 100644 index 4503105..0000000 --- a/GLideN64/src/Graphics/Context.cpp +++ /dev/null @@ -1,365 +0,0 @@ -#include "Context.h" -#include "OpenGLContext/opengl_ContextImpl.h" - -using namespace graphics; - -Context gfxContext; - -bool Context::Multisampling = false; -bool Context::BlitFramebuffer = false; -bool Context::WeakBlitFramebuffer = false; -bool Context::DepthFramebufferTextures = false; -bool Context::ShaderProgramBinary = false; -bool Context::ImageTextures = false; -bool Context::IntegerTextures = false; -bool Context::ClipControl = false; -bool Context::FramebufferFetchDepth = false; -bool Context::FramebufferFetchColor = false; -bool Context::TextureBarrier = false; -bool Context::EglImage = false; -bool Context::EglImageFramebuffer = false; -bool Context::DualSourceBlending = false; - -Context::Context() {} - -Context::~Context() { - m_impl.reset(); -} - - -void Context::init() -{ - m_impl.reset(new opengl::ContextImpl); - m_impl->init(); - m_fbTexFormats.reset(m_impl->getFramebufferTextureFormats()); - Multisampling = m_impl->isSupported(SpecialFeatures::Multisampling); - BlitFramebuffer = m_impl->isSupported(SpecialFeatures::BlitFramebuffer); - WeakBlitFramebuffer = m_impl->isSupported(SpecialFeatures::WeakBlitFramebuffer); - DepthFramebufferTextures = m_impl->isSupported(SpecialFeatures::DepthFramebufferTextures); - ShaderProgramBinary = m_impl->isSupported(SpecialFeatures::ShaderProgramBinary); - ImageTextures = m_impl->isSupported(SpecialFeatures::ImageTextures); - IntegerTextures = m_impl->isSupported(SpecialFeatures::IntegerTextures); - ClipControl = m_impl->isSupported(SpecialFeatures::ClipControl); - FramebufferFetchDepth = m_impl->isSupported(SpecialFeatures::N64DepthWithFbFetchDepth); - FramebufferFetchColor = m_impl->isSupported(SpecialFeatures::FramebufferFetchColor); - TextureBarrier = m_impl->isSupported(SpecialFeatures::TextureBarrier); - EglImage = m_impl->isSupported(SpecialFeatures::EglImage); - EglImageFramebuffer = m_impl->isSupported(SpecialFeatures::EglImageFramebuffer); - DualSourceBlending = m_impl->isSupported(SpecialFeatures::DualSourceBlending); -} - -void Context::destroy() -{ - m_impl->destroy(); - m_impl.reset(); -} - -void Context::setClampMode(ClampMode _mode) -{ - m_impl->setClampMode(_mode); -} - -ClampMode Context::getClampMode() -{ - return m_impl->getClampMode(); -} - -void Context::enable(EnableParam _parameter, bool _enable) -{ - m_impl->enable(_parameter, _enable); -} - -u32 Context::isEnabled(EnableParam _parameter) -{ - return m_impl->isEnabled(_parameter); -} - -void Context::cullFace(CullModeParam _parameter) -{ - m_impl->cullFace(_parameter); -} - -void Context::enableDepthWrite(bool _enable) -{ - m_impl->enableDepthWrite(_enable); -} - -void Context::setDepthCompare(CompareParam _mode) -{ - m_impl->setDepthCompare(_mode); -} - -void Context::setViewport(s32 _x, s32 _y, s32 _width, s32 _height) -{ - m_impl->setViewport(_x, _y, _width, _height); -} - -void Context::setScissor(s32 _x, s32 _y, s32 _width, s32 _height) -{ - m_impl->setScissor(_x, _y, _width, _height); -} - -void Context::setBlending(BlendParam _sfactor, BlendParam _dfactor) -{ - m_impl->setBlending(_sfactor, _dfactor); -} - -void graphics::Context::setBlendingSeparate(BlendParam _sfactorcolor, BlendParam _dfactorcolor, BlendParam _sfactoralpha, BlendParam _dfactoralpha) -{ - m_impl->setBlendingSeparate(_sfactorcolor, _dfactorcolor, _sfactoralpha, _dfactoralpha); -} - -void Context::setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) -{ - m_impl->setBlendColor(_red, _green, _blue, _alpha); -} - -void Context::clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha) -{ - m_impl->clearColorBuffer(_red, _green, _blue, _alpha); -} - -void Context::clearDepthBuffer() -{ - m_impl->clearDepthBuffer(); -} - -void Context::setPolygonOffset(f32 _factor, f32 _units) -{ - m_impl->setPolygonOffset(_factor, _units); -} - -ObjectHandle Context::createTexture(Parameter _target) -{ - return m_impl->createTexture(_target); -} - -void Context::deleteTexture(ObjectHandle _name) -{ - m_impl->deleteTexture(_name); -} - -void Context::init2DTexture(const InitTextureParams & _params) -{ - m_impl->init2DTexture(_params); -} - -void Context::update2DTexture(const UpdateTextureDataParams & _params) -{ - m_impl->update2DTexture(_params); -} - -void Context::setTextureParameters(const TexParameters & _parameters) -{ - m_impl->setTextureParameters(_parameters); -} - -void Context::bindTexture(const BindTextureParameters & _params) -{ - m_impl->bindTexture(_params); -} - -void Context::setTextureUnpackAlignment(s32 _param) -{ - m_impl->setTextureUnpackAlignment(_param); -} - -s32 Context::getTextureUnpackAlignment() const -{ - return m_impl->getTextureUnpackAlignment(); -} - -s32 Context::getMaxTextureSize() const -{ - return m_impl->getMaxTextureSize(); -} - -void Context::bindImageTexture(const BindImageTextureParameters & _params) -{ - m_impl->bindImageTexture(_params); -} - -u32 Context::convertInternalTextureFormat(u32 _format) const -{ - return m_impl->convertInternalTextureFormat(_format); -} - -void Context::textureBarrier() -{ - m_impl->textureBarrier(); -} - -/*---------------Framebuffer-------------*/ - -const FramebufferTextureFormats & Context::getFramebufferTextureFormats() -{ - return *m_fbTexFormats.get(); -} - -ObjectHandle Context::createFramebuffer() -{ - return m_impl->createFramebuffer(); -} - -void Context::deleteFramebuffer(ObjectHandle _name) -{ - m_impl->deleteFramebuffer(_name); -} - -void Context::bindFramebuffer(BufferTargetParam _target, ObjectHandle _name) -{ - m_impl->bindFramebuffer(_target, _name); -} - -ObjectHandle Context::createRenderbuffer() -{ - return m_impl->createRenderbuffer(); -} - -void Context::initRenderbuffer(const InitRenderbufferParams & _params) -{ - m_impl->initRenderbuffer(_params); -} - -void Context::addFrameBufferRenderTarget(const FrameBufferRenderTarget & _params) -{ - m_impl->addFrameBufferRenderTarget(_params); -} - -bool Context::blitFramebuffers(const BlitFramebuffersParams & _params) -{ - return m_impl->blitFramebuffers(_params); -} - -void Context::setDrawBuffers(u32 _num) -{ - m_impl->setDrawBuffers(_num); -} - -PixelReadBuffer * Context::createPixelReadBuffer(size_t _sizeInBytes) -{ - return m_impl->createPixelReadBuffer(_sizeInBytes); -} - -ColorBufferReader * Context::createColorBufferReader(CachedTexture * _pTexture) -{ - return m_impl->createColorBufferReader(_pTexture); -} - -/*---------------Shaders-------------*/ - -bool Context::isCombinerProgramBuilderObsolete() -{ - return m_impl->isCombinerProgramBuilderObsolete(); - -} - -void Context::resetCombinerProgramBuilder() -{ - m_impl->resetCombinerProgramBuilder(); -} - -CombinerProgram * Context::createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key) -{ - return m_impl->createCombinerProgram(_color, _alpha, _key); -} - -bool Context::saveShadersStorage(const Combiners & _combiners) -{ - return m_impl->saveShadersStorage(_combiners); -} - -bool Context::loadShadersStorage(Combiners & _combiners) -{ - return m_impl->loadShadersStorage(_combiners); -} - -ShaderProgram * Context::createDepthFogShader() -{ - return m_impl->createDepthFogShader(); -} - -TexrectDrawerShaderProgram * Context::createTexrectDrawerDrawShader() -{ - return m_impl->createTexrectDrawerDrawShader(); -} - -ShaderProgram * Context::createTexrectDrawerClearShader() -{ - return m_impl->createTexrectDrawerClearShader(); -} - -ShaderProgram * Context::createTexrectUpscaleCopyShader() -{ - return m_impl->createTexrectUpscaleCopyShader(); -} - -ShaderProgram * Context::createTexrectColorAndDepthUpscaleCopyShader() -{ - return m_impl->createTexrectColorAndDepthUpscaleCopyShader(); -} - -ShaderProgram * Context::createTexrectDownscaleCopyShader() -{ - return m_impl->createTexrectDownscaleCopyShader(); -} - -ShaderProgram * Context::createTexrectColorAndDepthDownscaleCopyShader() -{ - return m_impl->createTexrectColorAndDepthDownscaleCopyShader(); -} - -ShaderProgram * Context::createGammaCorrectionShader() -{ - return m_impl->createGammaCorrectionShader(); -} - -ShaderProgram * Context::createFXAAShader() -{ - return m_impl->createFXAAShader(); -} - -TextDrawerShaderProgram * Context::createTextDrawerShader() -{ - return m_impl->createTextDrawerShader(); -} - -void Context::resetShaderProgram() -{ - m_impl->resetShaderProgram(); -} - -void Context::drawTriangles(const DrawTriangleParameters & _params) -{ - m_impl->drawTriangles(_params); -} - -void Context::drawRects(const DrawRectParameters & _params) -{ - m_impl->drawRects(_params); -} - -void Context::drawLine(f32 _width, SPVertex * _vertices) -{ - m_impl->drawLine(_width, _vertices); -} - -f32 Context::getMaxLineWidth() -{ - return m_impl->getMaxLineWidth(); -} - -s32 Context::getMaxMSAALevel() -{ - return m_impl->getMaxMSAALevel(); -} - -bool Context::isError() const -{ - return m_impl->isError(); -} - -bool Context::isFramebufferError() const -{ - return m_impl->isFramebufferError(); -} diff --git a/GLideN64/src/Graphics/Context.h b/GLideN64/src/Graphics/Context.h deleted file mode 100644 index 9483599..0000000 --- a/GLideN64/src/Graphics/Context.h +++ /dev/null @@ -1,316 +0,0 @@ -#pragma once - -#include -#include -#include "ObjectHandle.h" -#include "Parameter.h" -#include "CombinerProgram.h" -#include "ShaderProgram.h" -#include "PixelBuffer.h" -#include "FramebufferTextureFormats.h" - -#define GRAPHICS_CONTEXT - -struct CachedTexture; - -namespace graphics { - - enum class SpecialFeatures { - Multisampling, - BlitFramebuffer, - WeakBlitFramebuffer, - DepthFramebufferTextures, - ShaderProgramBinary, - ImageTextures, - IntegerTextures, - ClipControl, - N64DepthWithFbFetchDepth, - FramebufferFetchColor, - TextureBarrier, - EglImage, - EglImageFramebuffer, - DualSourceBlending - }; - - enum class ClampMode { - ClippingEnabled, - NoNearPlaneClipping, - NoClipping - }; - - class ContextImpl; - class ColorBufferReader; - - class Context - { - public: - Context(); - ~Context(); - - void init(); - - void destroy(); - - void setClampMode(ClampMode _mode); - - ClampMode getClampMode(); - - void enable(EnableParam _parameter, bool _enable); - - u32 isEnabled(EnableParam _parameter); - - void cullFace(CullModeParam _mode); - - void enableDepthWrite(bool _enable); - - void setDepthCompare(CompareParam _mode); - - void setViewport(s32 _x, s32 _y, s32 _width, s32 _height); - - void setScissor(s32 _x, s32 _y, s32 _width, s32 _height); - - void setBlending(BlendParam _sfactor, BlendParam _dfactor); - - void setBlendingSeparate(BlendParam _sfactorcolor, BlendParam _dfactorcolor, BlendParam _sfactoralpha, BlendParam _dfactoralpha); - - void setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha); - - void clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha); - - void clearDepthBuffer(); - - void setPolygonOffset(f32 _factor, f32 _units); - - /*---------------Texture-------------*/ - - ObjectHandle createTexture(Parameter _target); - - void deleteTexture(ObjectHandle _name); - - struct InitTextureParams { - ObjectHandle handle; - TextureUnitParam textureUnitIndex{0}; - TextureTargetParam target = textureTarget::TEXTURE_2D; - u32 msaaLevel = 0; - u32 width = 0; - u32 height = 0; - u32 mipMapLevel = 0; - u32 mipMapLevels = 1; - ColorFormatParam format; - InternalColorFormatParam internalFormat; - DatatypeParam dataType; - const void * data = nullptr; - }; - - void init2DTexture(const InitTextureParams & _params); - - struct UpdateTextureDataParams { - ObjectHandle handle; - TextureUnitParam textureUnitIndex{0}; - u32 x = 0; - u32 y = 0; - u32 width = 0; - u32 height = 0; - u32 mipMapLevel = 0; - ColorFormatParam format; - InternalColorFormatParam internalFormat; - DatatypeParam dataType; - const void * data = nullptr; - }; - - void update2DTexture(const UpdateTextureDataParams & _params); - - struct TexParameters { - ObjectHandle handle; - TextureUnitParam textureUnitIndex{0}; - TextureTargetParam target; - TextureParam magFilter; - TextureParam minFilter; - TextureParam wrapS; - TextureParam wrapT; - Parameter maxMipmapLevel; - Parameter maxAnisotropy; - }; - - void setTextureParameters(const TexParameters & _parameters); - - struct BindTextureParameters { - ObjectHandle texture; - TextureUnitParam textureUnitIndex; - TextureTargetParam target; - }; - - void bindTexture(const BindTextureParameters & _params); - - void setTextureUnpackAlignment(s32 _param); - - s32 getTextureUnpackAlignment() const; - - s32 getMaxTextureSize() const; - - struct BindImageTextureParameters { - ImageUnitParam imageUnit; - ObjectHandle texture; - ImageAccessModeParam accessMode; - InternalColorFormatParam textureFormat; - }; - - void bindImageTexture(const BindImageTextureParameters & _params); - - u32 convertInternalTextureFormat(u32 _format) const; - - void textureBarrier(); - - /*---------------Framebuffer-------------*/ - - const FramebufferTextureFormats & getFramebufferTextureFormats(); - - ObjectHandle createFramebuffer(); - - void deleteFramebuffer(ObjectHandle _name); - - void bindFramebuffer(BufferTargetParam _target, ObjectHandle _name); - - ObjectHandle createRenderbuffer(); - - struct InitRenderbufferParams { - ObjectHandle handle; - TextureTargetParam target; - InternalColorFormatParam format; - u32 width = 0; - u32 height = 0; - }; - - void initRenderbuffer(const InitRenderbufferParams & _params); - - struct FrameBufferRenderTarget { - ObjectHandle bufferHandle; - BufferTargetParam bufferTarget; - BufferAttachmentParam attachment; - Parameter textureTarget; - ObjectHandle textureHandle; - }; - - void addFrameBufferRenderTarget(const FrameBufferRenderTarget & _params); - - struct BlitFramebuffersParams - { - ObjectHandle readBuffer; - ObjectHandle drawBuffer; - s32 srcX0; - s32 srcY0; - s32 srcX1; - s32 srcY1; - s32 dstX0; - s32 dstY0; - s32 dstX1; - s32 dstY1; - Parameter mask; - Parameter filter; - }; - - bool blitFramebuffers(const BlitFramebuffersParams & _params); - - void setDrawBuffers(u32 _num); - - /*---------------Pixelbuffer-------------*/ - - PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes); - - ColorBufferReader * createColorBufferReader(CachedTexture * _pTexture); - - /*---------------Shaders-------------*/ - - bool isCombinerProgramBuilderObsolete(); - - void resetCombinerProgramBuilder(); - - CombinerProgram * createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key); - - bool saveShadersStorage(const Combiners & _combiners); - - bool loadShadersStorage(Combiners & _combiners); - - ShaderProgram * createDepthFogShader(); - - TexrectDrawerShaderProgram * createTexrectDrawerDrawShader(); - - ShaderProgram * createTexrectDrawerClearShader(); - - ShaderProgram * createTexrectUpscaleCopyShader(); - - ShaderProgram * createTexrectColorAndDepthUpscaleCopyShader(); - - ShaderProgram * createTexrectDownscaleCopyShader(); - - ShaderProgram * createTexrectColorAndDepthDownscaleCopyShader(); - - ShaderProgram * createGammaCorrectionShader(); - - ShaderProgram * createFXAAShader(); - - TextDrawerShaderProgram * createTextDrawerShader(); - - void resetShaderProgram(); - - /*---------------Draw-------------*/ - - struct DrawTriangleParameters - { - DrawModeParam mode; - Parameter elementsType; - u32 verticesCount = 0; - u32 elementsCount = 0; - bool flatColors = false; - SPVertex * vertices = nullptr; - void * elements = nullptr; - const CombinerProgram * combiner = nullptr; - }; - - void drawTriangles(const DrawTriangleParameters & _params); - - struct DrawRectParameters - { - DrawModeParam mode; - bool texrect = true; - u32 verticesCount = 0; - RectVertex * vertices = nullptr; - const CombinerProgram * combiner = nullptr; - }; - - void drawRects(const DrawRectParameters & _params); - - void drawLine(f32 _width, SPVertex * _vertices); - - f32 getMaxLineWidth(); - - /*---------------Misc-------------*/ - s32 getMaxMSAALevel(); - - bool isError() const; - - bool isFramebufferError() const; - - static bool Multisampling; - static bool BlitFramebuffer; - static bool WeakBlitFramebuffer; - static bool DepthFramebufferTextures; - static bool ShaderProgramBinary; - static bool ImageTextures; - static bool IntegerTextures; - static bool ClipControl; - static bool FramebufferFetchDepth; - static bool FramebufferFetchColor; - static bool TextureBarrier; - static bool EglImage; - static bool EglImageFramebuffer; - static bool DualSourceBlending; - - private: - std::unique_ptr m_impl; - std::unique_ptr m_fbTexFormats; - }; - -} - -extern graphics::Context gfxContext; diff --git a/GLideN64/src/Graphics/ContextImpl.h b/GLideN64/src/Graphics/ContextImpl.h deleted file mode 100644 index 1fcebff..0000000 --- a/GLideN64/src/Graphics/ContextImpl.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once -#include "ObjectHandle.h" -#include "Parameter.h" - -#include "Context.h" - -namespace graphics { - - class ContextImpl - { - public: - virtual ~ContextImpl() {} - virtual void init() = 0; - virtual void destroy() = 0; - virtual void setClampMode(ClampMode _mode) = 0; - virtual ClampMode getClampMode() = 0; - virtual void enable(EnableParam _parameter, bool _enable) = 0; - virtual u32 isEnabled(EnableParam _parameter) = 0; - virtual void cullFace(CullModeParam _mode) = 0; - virtual void enableDepthWrite(bool _enable) = 0; - virtual void setDepthCompare(CompareParam _mode) = 0; - virtual void setViewport(s32 _x, s32 _y, s32 _width, s32 _height) = 0; - virtual void setScissor(s32 _x, s32 _y, s32 _width, s32 _height) = 0; - virtual void setBlending(BlendParam _sfactor, BlendParam _dfactor) = 0; - virtual void setBlendingSeparate(BlendParam _sfactorcolor, BlendParam _dfactorcolor, BlendParam _sfactoralpha, BlendParam _dfactoralpha) = 0; - virtual void setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) = 0; - virtual void clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha) = 0; - virtual void clearDepthBuffer() = 0; - virtual void setPolygonOffset(f32 _factor, f32 _units) = 0; - virtual ObjectHandle createTexture(Parameter _target) = 0; - virtual void deleteTexture(ObjectHandle _name) = 0; - virtual void init2DTexture(const Context::InitTextureParams & _params) = 0; - virtual void update2DTexture(const Context::UpdateTextureDataParams & _params) = 0; - virtual void setTextureParameters(const Context::TexParameters & _parameters) = 0; - virtual void bindTexture(const Context::BindTextureParameters & _params) = 0; - virtual void setTextureUnpackAlignment(s32 _param) = 0; - virtual s32 getTextureUnpackAlignment() const = 0; - virtual s32 getMaxTextureSize() const = 0; - virtual void bindImageTexture(const Context::BindImageTextureParameters & _params) = 0; - virtual u32 convertInternalTextureFormat(u32 _format) const = 0; - virtual void textureBarrier() = 0; - virtual FramebufferTextureFormats * getFramebufferTextureFormats() = 0; - virtual ObjectHandle createFramebuffer() = 0; - virtual void deleteFramebuffer(ObjectHandle _name) = 0; - virtual void bindFramebuffer(BufferTargetParam _target, ObjectHandle _name) = 0; - virtual void addFrameBufferRenderTarget(const Context::FrameBufferRenderTarget & _params) = 0; - virtual ObjectHandle createRenderbuffer() = 0; - virtual void initRenderbuffer(const Context::InitRenderbufferParams & _params) = 0; - virtual bool blitFramebuffers(const Context::BlitFramebuffersParams & _params) = 0; - virtual void setDrawBuffers(u32 _num) = 0; - virtual PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes) = 0; - virtual ColorBufferReader * createColorBufferReader(CachedTexture * _pTexture) = 0; - virtual bool isCombinerProgramBuilderObsolete() = 0; - virtual void resetCombinerProgramBuilder() = 0; - virtual CombinerProgram * createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key) = 0; - virtual bool saveShadersStorage(const Combiners & _combiners) = 0; - virtual bool loadShadersStorage(Combiners & _combiners) = 0; - virtual ShaderProgram * createDepthFogShader() = 0; - virtual TexrectDrawerShaderProgram * createTexrectDrawerDrawShader() = 0; - virtual ShaderProgram * createTexrectDrawerClearShader() = 0; - virtual ShaderProgram * createTexrectUpscaleCopyShader() = 0; - virtual ShaderProgram * createTexrectColorAndDepthUpscaleCopyShader() = 0; - virtual ShaderProgram * createTexrectDownscaleCopyShader() = 0; - virtual ShaderProgram * createTexrectColorAndDepthDownscaleCopyShader() = 0; - virtual ShaderProgram * createGammaCorrectionShader() = 0; - virtual ShaderProgram * createFXAAShader() = 0; - virtual TextDrawerShaderProgram * createTextDrawerShader() = 0; - virtual void resetShaderProgram() = 0; - virtual void drawTriangles(const Context::DrawTriangleParameters & _params) = 0; - virtual void drawRects(const Context::DrawRectParameters & _params) = 0; - virtual void drawLine(f32 _width, SPVertex * _vertices) = 0; - virtual f32 getMaxLineWidth() = 0; - virtual bool isSupported(SpecialFeatures _feature) const = 0; - virtual s32 getMaxMSAALevel() = 0; - virtual bool isError() const = 0; - virtual bool isFramebufferError() const = 0; - }; - -} diff --git a/GLideN64/src/Graphics/FramebufferTextureFormats.h b/GLideN64/src/Graphics/FramebufferTextureFormats.h deleted file mode 100644 index c15b629..0000000 --- a/GLideN64/src/Graphics/FramebufferTextureFormats.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef GRAPHICS_FRAMEBUFFER_TEXTUREFORMATS_H -#define GRAPHICS_FRAMEBUFFER_TEXTUREFORMATS_H -#include "Parameter.h" - -namespace graphics { - - struct FramebufferTextureFormats - { - InternalColorFormatParam colorInternalFormat; - ColorFormatParam colorFormat; - DatatypeParam colorType; - u32 colorFormatBytes; - - InternalColorFormatParam monochromeInternalFormat; - ColorFormatParam monochromeFormat; - DatatypeParam monochromeType; - u32 monochromeFormatBytes; - - InternalColorFormatParam depthInternalFormat; - ColorFormatParam depthFormat; - DatatypeParam depthType; - u32 depthFormatBytes; - - InternalColorFormatParam depthImageInternalFormat; - ColorFormatParam depthImageFormat; - DatatypeParam depthImageType; - u32 depthImageFormatBytes; - - InternalColorFormatParam lutInternalFormat; - ColorFormatParam lutFormat; - DatatypeParam lutType; - u32 lutFormatBytes; - - InternalColorFormatParam noiseInternalFormat; - ColorFormatParam noiseFormat; - DatatypeParam noiseType; - u32 noiseFormatBytes; - - virtual ~FramebufferTextureFormats() {} - }; - -} -#endif // GRAPHICS_FRAMEBUFFER_TEXTUREFORMATS_H diff --git a/GLideN64/src/Graphics/ObjectHandle.cpp b/GLideN64/src/Graphics/ObjectHandle.cpp deleted file mode 100644 index 3f72dbc..0000000 --- a/GLideN64/src/Graphics/ObjectHandle.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "ObjectHandle.h" - -namespace graphics { - -ObjectHandle ObjectHandle::null; -ObjectHandle ObjectHandle::defaultFramebuffer; - -} diff --git a/GLideN64/src/Graphics/ObjectHandle.h b/GLideN64/src/Graphics/ObjectHandle.h deleted file mode 100644 index c0903fc..0000000 --- a/GLideN64/src/Graphics/ObjectHandle.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include - -namespace graphics { - - class ObjectHandle - { - public: - ObjectHandle() : m_name(0) {} - explicit ObjectHandle(u32 _name) : m_name(_name) {} - explicit operator u32() const { return m_name; } - bool operator==(const ObjectHandle & _other) const { return m_name == _other.m_name; } - bool operator!=(const ObjectHandle & _other) const { return m_name != _other.m_name; } - bool operator<(const ObjectHandle & _other) const { return m_name < _other.m_name; } - - bool isNotNull() const { return m_name != 0; } - - void reset() { m_name = 0; } - - static ObjectHandle null; - static ObjectHandle defaultFramebuffer; - private: - u32 m_name; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLFunctions.cpp b/GLideN64/src/Graphics/OpenGLContext/GLFunctions.cpp deleted file mode 100644 index dbca83b..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLFunctions.cpp +++ /dev/null @@ -1,395 +0,0 @@ -#include "GLFunctions.h" - -#define ASSIGN_PROC_ADR(proc_type, proc_name) ptr##proc_name = gl##proc_name - -#ifdef OS_WINDOWS - -#define glGetProcAddress wglGetProcAddress -#define GL_GET_PROC_ADR(proc_type, proc_name) ptr##proc_name = (proc_type) glGetProcAddress("gl"#proc_name) - -#elif defined(VERO4K) || defined(ODROID) || defined(VC) - -#define GL_GET_PROC_ADR(proc_type, proc_name) ptr##proc_name = (proc_type) dlsym(gles2so, "gl"#proc_name); - -#elif defined(EGL) - -#define glGetProcAddress eglGetProcAddress -#define GL_GET_PROC_ADR(proc_type, proc_name) ptr##proc_name = (proc_type) glGetProcAddress("gl"#proc_name) -#define GL_GET_PROC_ADR_EGL(proc_type, proc_name) ptr##proc_name = (proc_type) glGetProcAddress("egl"#proc_name) - -#elif defined(OS_LINUX) - -#include -typedef XID GLXContextID; -typedef XID GLXPixmap; -typedef XID GLXDrawable; -typedef XID GLXPbuffer; -typedef XID GLXWindow; -typedef XID GLXFBConfigID; -typedef struct __GLXcontextRec *GLXContext; -typedef struct __GLXFBConfigRec *GLXFBConfig; -#define GLX_GLXEXT_PROTOTYPES -#include -#define glGetProcAddress glXGetProcAddress -#define GL_GET_PROC_ADR(proc_type, proc_name) ptr##proc_name = (proc_type) glGetProcAddress((const GLubyte*)"gl"#proc_name) - -#elif defined(OS_MAC_OS_X) -#include - -static void* AppleGLGetProcAddress (const char *name) -{ - static void* image = NULL; - if (NULL == image) - image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); - - return (image ? dlsym(image, name) : NULL); -} -#define glGetProcAddress AppleGLGetProcAddress -#define GL_GET_PROC_ADR(proc_type, proc_name) ptr##proc_name = (proc_type) glGetProcAddress("gl"#proc_name) - -#elif defined(OS_IOS) -#include - -static void* IOSGLGetProcAddress (const char *name) -{ - return dlsym(RTLD_DEFAULT, name); -} - -#define glGetProcAddress IOSGLGetProcAddress -#define GL_GET_PROC_ADR(proc_type, proc_name) ptr##proc_name = (proc_type)glGetProcAddress("gl"#proc_name) - -#endif - -//GL Functions -PFNGLBLENDFUNCPROC ptrBlendFunc; -PFNGLBLENDFUNCSEPARATEPROC ptrBlendFuncSeparate; -PFNGLPIXELSTOREIPROC ptrPixelStorei; -PFNGLCLEARCOLORPROC ptrClearColor; -PFNGLCULLFACEPROC ptrCullFace; -PFNGLDEPTHFUNCPROC ptrDepthFunc; -PFNGLDEPTHMASKPROC ptrDepthMask; -PFNGLDISABLEPROC ptrDisable; -PFNGLENABLEPROC ptrEnable; -PFNGLPOLYGONOFFSETPROC ptrPolygonOffset; -PFNGLSCISSORPROC ptrScissor; -PFNGLVIEWPORTPROC ptrViewport; -PFNGLBINDTEXTUREPROC ptrBindTexture; -PFNGLTEXIMAGE2DPROC ptrTexImage2D; -PFNGLTEXPARAMETERIPROC ptrTexParameteri; -PFNGLGETINTEGERVPROC ptrGetIntegerv; -PFNGLGETSTRINGPROC ptrGetString; -PFNGLREADPIXELSPROC ptrReadPixels; -PFNGLTEXSUBIMAGE2DPROC ptrTexSubImage2D; -PFNGLDRAWARRAYSPROC ptrDrawArrays; -PFNGLGETERRORPROC ptrGetError; -PFNGLDRAWELEMENTSPROC ptrDrawElements; -PFNGLLINEWIDTHPROC ptrLineWidth; -PFNGLCLEARPROC ptrClear; -PFNGLGETFLOATVPROC ptrGetFloatv; -PFNGLDELETETEXTURESPROC ptrDeleteTextures; -PFNGLGENTEXTURESPROC ptrGenTextures; -PFNGLTEXPARAMETERFPROC ptrTexParameterf; -PFNGLACTIVETEXTUREPROC ptrActiveTexture; -PFNGLBLENDCOLORPROC ptrBlendColor; -PFNGLREADBUFFERPROC ptrReadBuffer; -PFNGLFINISHPROC ptrFinish; -#if defined(OS_ANDROID) -PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC ptrGetNativeClientBufferANDROID; -#endif - -PFNGLCREATESHADERPROC ptrCreateShader; -PFNGLCOMPILESHADERPROC ptrCompileShader; -PFNGLSHADERSOURCEPROC ptrShaderSource; -PFNGLCREATEPROGRAMPROC ptrCreateProgram; -PFNGLATTACHSHADERPROC ptrAttachShader; -PFNGLLINKPROGRAMPROC ptrLinkProgram; -PFNGLUSEPROGRAMPROC ptrUseProgram; -PFNGLGETUNIFORMLOCATIONPROC ptrGetUniformLocation; -PFNGLUNIFORM1IPROC ptrUniform1i; -PFNGLUNIFORM1FPROC ptrUniform1f; -PFNGLUNIFORM2FPROC ptrUniform2f; -PFNGLUNIFORM2IPROC ptrUniform2i; -PFNGLUNIFORM4IPROC ptrUniform4i; -PFNGLUNIFORM4FPROC ptrUniform4f; -PFNGLUNIFORM3FVPROC ptrUniform3fv; -PFNGLUNIFORM4FVPROC ptrUniform4fv; -PFNGLDETACHSHADERPROC ptrDetachShader; -PFNGLDELETESHADERPROC ptrDeleteShader; -PFNGLDELETEPROGRAMPROC ptrDeleteProgram; -PFNGLGETPROGRAMINFOLOGPROC ptrGetProgramInfoLog; -PFNGLGETSHADERINFOLOGPROC ptrGetShaderInfoLog; -PFNGLGETSHADERIVPROC ptrGetShaderiv; -PFNGLGETPROGRAMIVPROC ptrGetProgramiv; - -PFNGLENABLEVERTEXATTRIBARRAYPROC ptrEnableVertexAttribArray; -PFNGLDISABLEVERTEXATTRIBARRAYPROC ptrDisableVertexAttribArray; -PFNGLVERTEXATTRIBPOINTERPROC ptrVertexAttribPointer; -PFNGLBINDATTRIBLOCATIONPROC ptrBindAttribLocation; -PFNGLVERTEXATTRIB1FPROC ptrVertexAttrib1f; -PFNGLVERTEXATTRIB4FPROC ptrVertexAttrib4f; -PFNGLVERTEXATTRIB4FVPROC ptrVertexAttrib4fv; - -// multitexture functions -PFNGLDEPTHRANGEFPROC ptrDepthRangef; -PFNGLCLEARDEPTHFPROC ptrClearDepthf; - -PFNGLDRAWBUFFERSPROC ptrDrawBuffers; -PFNGLBINDFRAMEBUFFERPROC ptrBindFramebuffer; -PFNGLDELETEFRAMEBUFFERSPROC ptrDeleteFramebuffers; -PFNGLGENFRAMEBUFFERSPROC ptrGenFramebuffers; -PFNGLFRAMEBUFFERTEXTURE2DPROC ptrFramebufferTexture2D; -PFNGLTEXIMAGE2DMULTISAMPLEPROC ptrTexImage2DMultisample; -PFNGLTEXSTORAGE2DMULTISAMPLEPROC ptrTexStorage2DMultisample; -PFNGLGENRENDERBUFFERSPROC ptrGenRenderbuffers; -PFNGLBINDRENDERBUFFERPROC ptrBindRenderbuffer; -PFNGLRENDERBUFFERSTORAGEPROC ptrRenderbufferStorage; -PFNGLFRAMEBUFFERRENDERBUFFERPROC ptrFramebufferRenderbuffer; -PFNGLDELETERENDERBUFFERSPROC ptrDeleteRenderbuffers; -PFNGLCHECKFRAMEBUFFERSTATUSPROC ptrCheckFramebufferStatus; -PFNGLBLITFRAMEBUFFERPROC ptrBlitFramebuffer; -PFNGLGENVERTEXARRAYSPROC ptrGenVertexArrays; -PFNGLBINDVERTEXARRAYPROC ptrBindVertexArray; -PFNGLDELETEVERTEXARRAYSPROC ptrDeleteVertexArrays; -PFNGLGENBUFFERSPROC ptrGenBuffers; -PFNGLBINDBUFFERPROC ptrBindBuffer; -PFNGLBUFFERDATAPROC ptrBufferData; -PFNGLMAPBUFFERPROC ptrMapBuffer; -PFNGLMAPBUFFERRANGEPROC ptrMapBufferRange; -PFNGLUNMAPBUFFERPROC ptrUnmapBuffer; -PFNGLDELETEBUFFERSPROC ptrDeleteBuffers; -PFNGLBINDIMAGETEXTUREPROC ptrBindImageTexture; -PFNGLMEMORYBARRIERPROC ptrMemoryBarrier; -PFNGLGETSTRINGIPROC ptrGetStringi; -PFNGLINVALIDATEFRAMEBUFFERPROC ptrInvalidateFramebuffer; -PFNGLBUFFERSTORAGEPROC ptrBufferStorage; -PFNGLFENCESYNCPROC ptrFenceSync; -PFNGLCLIENTWAITSYNCPROC ptrClientWaitSync; -PFNGLDELETESYNCPROC ptrDeleteSync; - -PFNGLGETUNIFORMBLOCKINDEXPROC ptrGetUniformBlockIndex; -PFNGLUNIFORMBLOCKBINDINGPROC ptrUniformBlockBinding; -PFNGLGETACTIVEUNIFORMBLOCKIVPROC ptrGetActiveUniformBlockiv; -PFNGLGETUNIFORMINDICESPROC ptrGetUniformIndices; -PFNGLGETACTIVEUNIFORMSIVPROC ptrGetActiveUniformsiv; -PFNGLBINDBUFFERBASEPROC ptrBindBufferBase; -PFNGLBUFFERSUBDATAPROC ptrBufferSubData; - -PFNGLGETPROGRAMBINARYPROC ptrGetProgramBinary; -PFNGLPROGRAMBINARYPROC ptrProgramBinary; -PFNGLPROGRAMPARAMETERIPROC ptrProgramParameteri; - -PFNGLTEXSTORAGE2DPROC ptrTexStorage2D; -PFNGLTEXTURESTORAGE2DPROC ptrTextureStorage2D; -PFNGLTEXTURESUBIMAGE2DPROC ptrTextureSubImage2D; -PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC ptrTextureStorage2DMultisample; -PFNGLTEXTUREPARAMETERIPROC ptrTextureParameteri; -PFNGLTEXTUREPARAMETERFPROC ptrTextureParameterf; -PFNGLCREATETEXTURESPROC ptrCreateTextures; -PFNGLCREATEBUFFERSPROC ptrCreateBuffers; -PFNGLCREATEFRAMEBUFFERSPROC ptrCreateFramebuffers; -PFNGLNAMEDFRAMEBUFFERTEXTUREPROC ptrNamedFramebufferTexture; -PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC ptrDrawRangeElementsBaseVertex; -PFNGLFLUSHMAPPEDBUFFERRANGEPROC ptrFlushMappedBufferRange; -PFNGLTEXTUREBARRIERPROC ptrTextureBarrier; -PFNGLTEXTUREBARRIERNVPROC ptrTextureBarrierNV; -PFNGLCLEARBUFFERFVPROC ptrClearBufferfv; -PFNGLENABLEIPROC ptrEnablei; -PFNGLDISABLEIPROC ptrDisablei; -PFNGLDEBUGMESSAGECALLBACKPROC ptrDebugMessageCallback; -PFNGLDEBUGMESSAGECONTROLPROC ptrDebugMessageControl; -PFNGLCOPYTEXIMAGE2DPROC ptrCopyTexImage2D; -PFNGLEGLIMAGETARGETTEXTURE2DOESPROC ptrEGLImageTargetTexture2DOES; -PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC ptrEGLImageTargetRenderbufferStorageOES; - -void initGLFunctions() -{ -#ifdef VC - void *gles2so = dlopen("/opt/vc/lib/libbrcmGLESv2.so", RTLD_NOW); -#elif defined(ODROID) - void *gles2so = dlopen("/usr/lib/arm-linux-gnueabihf/libGLESv2.so", RTLD_NOW); -#elif defined(VERO4K) - void *gles2so = dlopen("/opt/vero3/lib/libGLESv2.so", RTLD_NOW); -#endif - -#if defined(EGL) || defined(OS_IOS) - GL_GET_PROC_ADR(PFNGLBLENDFUNCPROC, BlendFunc); - GL_GET_PROC_ADR(PFNGLPIXELSTOREIPROC, PixelStorei); - GL_GET_PROC_ADR(PFNGLCLEARCOLORPROC, ClearColor); - GL_GET_PROC_ADR(PFNGLCULLFACEPROC, CullFace); - GL_GET_PROC_ADR(PFNGLDEPTHFUNCPROC, DepthFunc); - GL_GET_PROC_ADR(PFNGLDEPTHMASKPROC, DepthMask); - GL_GET_PROC_ADR(PFNGLDISABLEPROC, Disable); - GL_GET_PROC_ADR(PFNGLENABLEPROC, Enable); - GL_GET_PROC_ADR(PFNGLPOLYGONOFFSETPROC, PolygonOffset); - GL_GET_PROC_ADR(PFNGLSCISSORPROC, Scissor); - GL_GET_PROC_ADR(PFNGLVIEWPORTPROC, Viewport); - GL_GET_PROC_ADR(PFNGLBINDTEXTUREPROC, BindTexture); - GL_GET_PROC_ADR(PFNGLTEXIMAGE2DPROC, TexImage2D); - GL_GET_PROC_ADR(PFNGLTEXPARAMETERIPROC, TexParameteri); - GL_GET_PROC_ADR(PFNGLGETINTEGERVPROC, GetIntegerv); - GL_GET_PROC_ADR(PFNGLGETSTRINGPROC, GetString); - GL_GET_PROC_ADR(PFNGLREADPIXELSPROC, ReadPixels); - GL_GET_PROC_ADR(PFNGLTEXSUBIMAGE2DPROC, TexSubImage2D); - GL_GET_PROC_ADR(PFNGLDRAWARRAYSPROC, DrawArrays); - GL_GET_PROC_ADR(PFNGLGETERRORPROC, GetError); - GL_GET_PROC_ADR(PFNGLDRAWELEMENTSPROC, DrawElements); - GL_GET_PROC_ADR(PFNGLLINEWIDTHPROC, LineWidth); - GL_GET_PROC_ADR(PFNGLCLEARPROC, Clear); - GL_GET_PROC_ADR(PFNGLGETFLOATVPROC, GetFloatv); - GL_GET_PROC_ADR(PFNGLDELETETEXTURESPROC, DeleteTextures); - GL_GET_PROC_ADR(PFNGLGENTEXTURESPROC, GenTextures); - GL_GET_PROC_ADR(PFNGLTEXPARAMETERFPROC, TexParameterf); - GL_GET_PROC_ADR(PFNGLACTIVETEXTUREPROC, ActiveTexture); - GL_GET_PROC_ADR(PFNGLBLENDCOLORPROC, BlendColor); - GL_GET_PROC_ADR(PFNGLREADBUFFERPROC, ReadBuffer); - GL_GET_PROC_ADR(PFNGLFINISHPROC, Finish); -#if defined(OS_ANDROID) - GL_GET_PROC_ADR_EGL(PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC, GetNativeClientBufferANDROID); -#endif -#else -#ifdef OS_WINDOWS - GL_GET_PROC_ADR(PFNGLACTIVETEXTUREPROC, ActiveTexture); - GL_GET_PROC_ADR(PFNGLBLENDCOLORPROC, BlendColor); -#else - ASSIGN_PROC_ADR(PFNGLACTIVETEXTUREPROC, ActiveTexture); - ASSIGN_PROC_ADR(PFNGLBLENDCOLORPROC, BlendColor); -#endif - ASSIGN_PROC_ADR(PFNGLBLENDFUNCPROC, BlendFunc); - ASSIGN_PROC_ADR(PFNGLPIXELSTOREIPROC, PixelStorei); - ASSIGN_PROC_ADR(PFNGLCLEARCOLORPROC, ClearColor); - ASSIGN_PROC_ADR(PFNGLCULLFACEPROC, CullFace); - ASSIGN_PROC_ADR(PFNGLDEPTHFUNCPROC, DepthFunc); - ASSIGN_PROC_ADR(PFNGLDEPTHMASKPROC, DepthMask); - ASSIGN_PROC_ADR(PFNGLDISABLEPROC, Disable); - ASSIGN_PROC_ADR(PFNGLENABLEPROC, Enable); - ASSIGN_PROC_ADR(PFNGLPOLYGONOFFSETPROC, PolygonOffset); - ASSIGN_PROC_ADR(PFNGLSCISSORPROC, Scissor); - ASSIGN_PROC_ADR(PFNGLVIEWPORTPROC, Viewport); - ASSIGN_PROC_ADR(PFNGLBINDTEXTUREPROC, BindTexture); - ASSIGN_PROC_ADR(PFNGLTEXIMAGE2DPROC, TexImage2D); - ASSIGN_PROC_ADR(PFNGLTEXPARAMETERIPROC, TexParameteri); - ASSIGN_PROC_ADR(PFNGLGETINTEGERVPROC, GetIntegerv); - ASSIGN_PROC_ADR(PFNGLGETSTRINGPROC, GetString); - ASSIGN_PROC_ADR(PFNGLREADPIXELSPROC, ReadPixels); - ASSIGN_PROC_ADR(PFNGLTEXSUBIMAGE2DPROC, TexSubImage2D); - ASSIGN_PROC_ADR(PFNGLDRAWARRAYSPROC, DrawArrays); - ASSIGN_PROC_ADR(PFNGLGETERRORPROC, GetError); - ASSIGN_PROC_ADR(PFNGLDRAWELEMENTSPROC, DrawElements); - ASSIGN_PROC_ADR(PFNGLLINEWIDTHPROC, LineWidth); - ASSIGN_PROC_ADR(PFNGLCLEARPROC, Clear); - ASSIGN_PROC_ADR(PFNGLGETFLOATVPROC, GetFloatv); - ASSIGN_PROC_ADR(PFNGLDELETETEXTURESPROC, DeleteTextures); - ASSIGN_PROC_ADR(PFNGLGENTEXTURESPROC, GenTextures); - ASSIGN_PROC_ADR(PFNGLTEXPARAMETERFPROC, TexParameterf); - ASSIGN_PROC_ADR(PFNGLREADBUFFERPROC, ReadBuffer); - ASSIGN_PROC_ADR(PFNGLFINISHPROC, Finish); -#endif - - GL_GET_PROC_ADR(PFNGLCREATESHADERPROC, CreateShader); - GL_GET_PROC_ADR(PFNGLCOMPILESHADERPROC, CompileShader); - GL_GET_PROC_ADR(PFNGLSHADERSOURCEPROC, ShaderSource); - GL_GET_PROC_ADR(PFNGLCREATEPROGRAMPROC, CreateProgram); - GL_GET_PROC_ADR(PFNGLATTACHSHADERPROC, AttachShader); - GL_GET_PROC_ADR(PFNGLLINKPROGRAMPROC, LinkProgram); - GL_GET_PROC_ADR(PFNGLUSEPROGRAMPROC, UseProgram); - GL_GET_PROC_ADR(PFNGLGETUNIFORMLOCATIONPROC, GetUniformLocation); - GL_GET_PROC_ADR(PFNGLUNIFORM1IPROC, Uniform1i); - GL_GET_PROC_ADR(PFNGLUNIFORM1FPROC, Uniform1f); - GL_GET_PROC_ADR(PFNGLUNIFORM2FPROC, Uniform2f); - GL_GET_PROC_ADR(PFNGLUNIFORM2IPROC, Uniform2i); - GL_GET_PROC_ADR(PFNGLUNIFORM4IPROC, Uniform4i); - GL_GET_PROC_ADR(PFNGLUNIFORM4FPROC, Uniform4f); - GL_GET_PROC_ADR(PFNGLUNIFORM3FVPROC, Uniform3fv); - GL_GET_PROC_ADR(PFNGLUNIFORM4FVPROC, Uniform4fv); - GL_GET_PROC_ADR(PFNGLDETACHSHADERPROC, DetachShader); - GL_GET_PROC_ADR(PFNGLDELETESHADERPROC, DeleteShader); - GL_GET_PROC_ADR(PFNGLDELETEPROGRAMPROC, DeleteProgram); - GL_GET_PROC_ADR(PFNGLGETPROGRAMINFOLOGPROC, GetProgramInfoLog); - GL_GET_PROC_ADR(PFNGLGETSHADERINFOLOGPROC, GetShaderInfoLog); - GL_GET_PROC_ADR(PFNGLGETSHADERIVPROC, GetShaderiv); - GL_GET_PROC_ADR(PFNGLGETPROGRAMIVPROC, GetProgramiv); - - GL_GET_PROC_ADR(PFNGLENABLEVERTEXATTRIBARRAYPROC, EnableVertexAttribArray); - GL_GET_PROC_ADR(PFNGLDISABLEVERTEXATTRIBARRAYPROC, DisableVertexAttribArray); - GL_GET_PROC_ADR(PFNGLVERTEXATTRIBPOINTERPROC, VertexAttribPointer); - GL_GET_PROC_ADR(PFNGLBINDATTRIBLOCATIONPROC, BindAttribLocation); - GL_GET_PROC_ADR(PFNGLVERTEXATTRIB1FPROC, VertexAttrib1f); - GL_GET_PROC_ADR(PFNGLVERTEXATTRIB4FPROC, VertexAttrib4f); - GL_GET_PROC_ADR(PFNGLVERTEXATTRIB4FVPROC, VertexAttrib4fv); - - GL_GET_PROC_ADR(PFNGLDEPTHRANGEFPROC, DepthRangef); - GL_GET_PROC_ADR(PFNGLCLEARDEPTHFPROC, ClearDepthf); - - GL_GET_PROC_ADR(PFNGLDRAWBUFFERSPROC, DrawBuffers); - GL_GET_PROC_ADR(PFNGLBINDFRAMEBUFFERPROC, BindFramebuffer); - GL_GET_PROC_ADR(PFNGLDELETEFRAMEBUFFERSPROC, DeleteFramebuffers); - GL_GET_PROC_ADR(PFNGLGENFRAMEBUFFERSPROC, GenFramebuffers); - GL_GET_PROC_ADR(PFNGLFRAMEBUFFERTEXTURE2DPROC, FramebufferTexture2D); - GL_GET_PROC_ADR(PFNGLTEXIMAGE2DMULTISAMPLEPROC, TexImage2DMultisample); - GL_GET_PROC_ADR(PFNGLTEXSTORAGE2DMULTISAMPLEPROC, TexStorage2DMultisample); - GL_GET_PROC_ADR(PFNGLGENRENDERBUFFERSPROC, GenRenderbuffers); - GL_GET_PROC_ADR(PFNGLBINDRENDERBUFFERPROC, BindRenderbuffer); - GL_GET_PROC_ADR(PFNGLRENDERBUFFERSTORAGEPROC, RenderbufferStorage); - GL_GET_PROC_ADR(PFNGLFRAMEBUFFERRENDERBUFFERPROC, FramebufferRenderbuffer); - GL_GET_PROC_ADR(PFNGLDELETERENDERBUFFERSPROC, DeleteRenderbuffers); - GL_GET_PROC_ADR(PFNGLCHECKFRAMEBUFFERSTATUSPROC, CheckFramebufferStatus); - GL_GET_PROC_ADR(PFNGLBLITFRAMEBUFFERPROC, BlitFramebuffer); - GL_GET_PROC_ADR(PFNGLGENVERTEXARRAYSPROC, GenVertexArrays); - GL_GET_PROC_ADR(PFNGLBINDVERTEXARRAYPROC, BindVertexArray); - GL_GET_PROC_ADR(PFNGLDELETEVERTEXARRAYSPROC, DeleteVertexArrays); - GL_GET_PROC_ADR(PFNGLGENBUFFERSPROC, GenBuffers); - GL_GET_PROC_ADR(PFNGLBINDBUFFERPROC, BindBuffer); - GL_GET_PROC_ADR(PFNGLBUFFERDATAPROC, BufferData); - GL_GET_PROC_ADR(PFNGLMAPBUFFERPROC, MapBuffer); - GL_GET_PROC_ADR(PFNGLMAPBUFFERRANGEPROC, MapBufferRange); - GL_GET_PROC_ADR(PFNGLUNMAPBUFFERPROC, UnmapBuffer); - GL_GET_PROC_ADR(PFNGLDELETEBUFFERSPROC, DeleteBuffers); - GL_GET_PROC_ADR(PFNGLBINDIMAGETEXTUREPROC, BindImageTexture); - GL_GET_PROC_ADR(PFNGLMEMORYBARRIERPROC, MemoryBarrier); - GL_GET_PROC_ADR(PFNGLGETSTRINGIPROC, GetStringi); - GL_GET_PROC_ADR(PFNGLINVALIDATEFRAMEBUFFERPROC, InvalidateFramebuffer); - GL_GET_PROC_ADR(PFNGLBUFFERSTORAGEPROC, BufferStorage); - GL_GET_PROC_ADR(PFNGLFENCESYNCPROC, FenceSync); - GL_GET_PROC_ADR(PFNGLCLIENTWAITSYNCPROC, ClientWaitSync); - GL_GET_PROC_ADR(PFNGLDELETESYNCPROC, DeleteSync); - - GL_GET_PROC_ADR(PFNGLGETUNIFORMBLOCKINDEXPROC, GetUniformBlockIndex); - GL_GET_PROC_ADR(PFNGLUNIFORMBLOCKBINDINGPROC, UniformBlockBinding); - GL_GET_PROC_ADR(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, GetActiveUniformBlockiv); - GL_GET_PROC_ADR(PFNGLGETUNIFORMINDICESPROC, GetUniformIndices); - GL_GET_PROC_ADR(PFNGLGETACTIVEUNIFORMSIVPROC, GetActiveUniformsiv); - GL_GET_PROC_ADR(PFNGLBINDBUFFERBASEPROC, BindBufferBase); - GL_GET_PROC_ADR(PFNGLBUFFERSUBDATAPROC, BufferSubData); - - GL_GET_PROC_ADR(PFNGLGETPROGRAMBINARYPROC, GetProgramBinary); - GL_GET_PROC_ADR(PFNGLPROGRAMBINARYPROC, ProgramBinary); - GL_GET_PROC_ADR(PFNGLPROGRAMPARAMETERIPROC, ProgramParameteri); - - GL_GET_PROC_ADR(PFNGLTEXSTORAGE2DPROC, TexStorage2D); - GL_GET_PROC_ADR(PFNGLTEXTURESTORAGE2DPROC, TextureStorage2D); - GL_GET_PROC_ADR(PFNGLTEXTURESUBIMAGE2DPROC, TextureSubImage2D); - GL_GET_PROC_ADR(PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC, TextureStorage2DMultisample); - - GL_GET_PROC_ADR(PFNGLTEXTUREPARAMETERIPROC, TextureParameteri); - GL_GET_PROC_ADR(PFNGLTEXTUREPARAMETERFPROC, TextureParameterf); - GL_GET_PROC_ADR(PFNGLCREATETEXTURESPROC, CreateTextures); - GL_GET_PROC_ADR(PFNGLCREATEBUFFERSPROC, CreateBuffers); - GL_GET_PROC_ADR(PFNGLCREATEFRAMEBUFFERSPROC, CreateFramebuffers); - GL_GET_PROC_ADR(PFNGLNAMEDFRAMEBUFFERTEXTUREPROC, NamedFramebufferTexture); - GL_GET_PROC_ADR(PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC, DrawRangeElementsBaseVertex); - GL_GET_PROC_ADR(PFNGLFLUSHMAPPEDBUFFERRANGEPROC, FlushMappedBufferRange); - GL_GET_PROC_ADR(PFNGLTEXTUREBARRIERPROC, TextureBarrier); - GL_GET_PROC_ADR(PFNGLTEXTUREBARRIERNVPROC, TextureBarrierNV); - GL_GET_PROC_ADR(PFNGLCLEARBUFFERFVPROC, ClearBufferfv); - GL_GET_PROC_ADR(PFNGLENABLEIPROC, Enablei); - GL_GET_PROC_ADR(PFNGLDISABLEIPROC, Disablei); - GL_GET_PROC_ADR(PFNGLDEBUGMESSAGECALLBACKPROC, DebugMessageCallback); - GL_GET_PROC_ADR(PFNGLDEBUGMESSAGECONTROLPROC, DebugMessageControl); - GL_GET_PROC_ADR(PFNGLCOPYTEXIMAGE2DPROC, CopyTexImage2D); - - GL_GET_PROC_ADR(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC, EGLImageTargetTexture2DOES); - GL_GET_PROC_ADR(PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC, EGLImageTargetRenderbufferStorageOES); - - GL_GET_PROC_ADR(PFNGLBLENDFUNCSEPARATEPROC, BlendFuncSeparate); - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLFunctions.h b/GLideN64/src/Graphics/OpenGLContext/GLFunctions.h deleted file mode 100644 index 8c138e2..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLFunctions.h +++ /dev/null @@ -1,349 +0,0 @@ -#ifndef GLFUNCTIONS_H -#define GLFUNCTIONS_H - -#ifdef OS_WINDOWS -#include -//#define FORCE_UNBUFFERED_DRAWER // Debug option. -#elif defined(OS_LINUX) -#include -#endif - -#ifdef EGL -#include -#include -#include -#elif defined(OS_MAC_OS_X) -#include -#include -#include - -#elif defined(OS_IOS) -#include -#include -// Add missing type defintions for iOS -typedef double GLclampd; -typedef double GLdouble; -// These will get redefined by other GL headers. -#undef GL_DRAW_FRAMEBUFFER_BINDING -#undef GL_COPY_READ_BUFFER_BINDING -#undef GL_COPY_WRITE_BUFFER_BINDING -#include -#else -#include -#include -#endif - -#define GL_LUMINANCE 0x1909 -#include -#include -#include -#include "Log.h" - -#define IS_GL_FUNCTION_VALID(proc_name) ptr##proc_name != nullptr - -#if !defined(EGL) && !defined(OS_IOS) -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -#endif - -extern PFNGLBLENDFUNCPROC ptrBlendFunc; -extern PFNGLBLENDFUNCSEPARATEPROC ptrBlendFuncSeparate; -extern PFNGLPIXELSTOREIPROC ptrPixelStorei; -extern PFNGLCLEARCOLORPROC ptrClearColor; -extern PFNGLCULLFACEPROC ptrCullFace; -extern PFNGLDEPTHFUNCPROC ptrDepthFunc; -extern PFNGLDEPTHMASKPROC ptrDepthMask; -extern PFNGLDISABLEPROC ptrDisable; -extern PFNGLENABLEPROC ptrEnable; -extern PFNGLPOLYGONOFFSETPROC ptrPolygonOffset; -extern PFNGLSCISSORPROC ptrScissor; -extern PFNGLVIEWPORTPROC ptrViewport; -extern PFNGLBINDTEXTUREPROC ptrBindTexture; -extern PFNGLTEXIMAGE2DPROC ptrTexImage2D; -extern PFNGLTEXPARAMETERIPROC ptrTexParameteri; -extern PFNGLGETINTEGERVPROC ptrGetIntegerv; -extern PFNGLGETSTRINGPROC ptrGetString; -extern PFNGLREADPIXELSPROC ptrReadPixels; -extern PFNGLTEXSUBIMAGE2DPROC ptrTexSubImage2D; -extern PFNGLDRAWARRAYSPROC ptrDrawArrays; -extern PFNGLGETERRORPROC ptrGetError; -extern PFNGLDRAWELEMENTSPROC ptrDrawElements; -extern PFNGLLINEWIDTHPROC ptrLineWidth; -extern PFNGLCLEARPROC ptrClear; -extern PFNGLGETFLOATVPROC ptrGetFloatv; -extern PFNGLDELETETEXTURESPROC ptrDeleteTextures; -extern PFNGLGENTEXTURESPROC ptrGenTextures; -extern PFNGLTEXPARAMETERFPROC ptrTexParameterf; -extern PFNGLACTIVETEXTUREPROC ptrActiveTexture; -extern PFNGLBLENDCOLORPROC ptrBlendColor; -extern PFNGLREADBUFFERPROC ptrReadBuffer; -extern PFNGLFINISHPROC ptrFinish; -#if defined(OS_ANDROID) -extern PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC ptrGetNativeClientBufferANDROID; -#endif - -#ifdef OS_WINDOWS -extern PFNGLACTIVETEXTUREPROC ptrActiveTexture; -extern PFNGLBLENDCOLORPROC ptrBlendColor; -#endif - -extern PFNGLCREATESHADERPROC ptrCreateShader; -extern PFNGLCOMPILESHADERPROC ptrCompileShader; -extern PFNGLSHADERSOURCEPROC ptrShaderSource; -extern PFNGLCREATEPROGRAMPROC ptrCreateProgram; -extern PFNGLATTACHSHADERPROC ptrAttachShader; -extern PFNGLLINKPROGRAMPROC ptrLinkProgram; -extern PFNGLUSEPROGRAMPROC ptrUseProgram; -extern PFNGLGETUNIFORMLOCATIONPROC ptrGetUniformLocation; -extern PFNGLUNIFORM1IPROC ptrUniform1i; -extern PFNGLUNIFORM1FPROC ptrUniform1f; -extern PFNGLUNIFORM2FPROC ptrUniform2f; -extern PFNGLUNIFORM2IPROC ptrUniform2i; -extern PFNGLUNIFORM4IPROC ptrUniform4i; - -extern PFNGLUNIFORM4FPROC ptrUniform4f; -extern PFNGLUNIFORM3FVPROC ptrUniform3fv; -extern PFNGLUNIFORM4FVPROC ptrUniform4fv; -extern PFNGLDETACHSHADERPROC ptrDetachShader; -extern PFNGLDELETESHADERPROC ptrDeleteShader; -extern PFNGLDELETEPROGRAMPROC ptrDeleteProgram; -extern PFNGLGETPROGRAMINFOLOGPROC ptrGetProgramInfoLog; -extern PFNGLGETSHADERINFOLOGPROC ptrGetShaderInfoLog; -extern PFNGLGETSHADERIVPROC ptrGetShaderiv; -extern PFNGLGETPROGRAMIVPROC ptrGetProgramiv; - -extern PFNGLENABLEVERTEXATTRIBARRAYPROC ptrEnableVertexAttribArray; -extern PFNGLDISABLEVERTEXATTRIBARRAYPROC ptrDisableVertexAttribArray; -extern PFNGLVERTEXATTRIBPOINTERPROC ptrVertexAttribPointer; -extern PFNGLBINDATTRIBLOCATIONPROC ptrBindAttribLocation; -extern PFNGLVERTEXATTRIB1FPROC ptrVertexAttrib1f; -extern PFNGLVERTEXATTRIB4FPROC ptrVertexAttrib4f; -extern PFNGLVERTEXATTRIB4FVPROC ptrVertexAttrib4fv; - -extern PFNGLDEPTHRANGEFPROC ptrDepthRangef; -extern PFNGLCLEARDEPTHFPROC ptrClearDepthf; - -extern PFNGLDRAWBUFFERSPROC ptrDrawBuffers; -extern PFNGLGENFRAMEBUFFERSPROC ptrGenFramebuffers; -extern PFNGLBINDFRAMEBUFFERPROC ptrBindFramebuffer; -extern PFNGLDELETEFRAMEBUFFERSPROC ptrDeleteFramebuffers; -extern PFNGLFRAMEBUFFERTEXTURE2DPROC ptrFramebufferTexture2D; -extern PFNGLTEXIMAGE2DMULTISAMPLEPROC ptrTexImage2DMultisample; -extern PFNGLTEXSTORAGE2DMULTISAMPLEPROC ptrTexStorage2DMultisample; -extern PFNGLGENRENDERBUFFERSPROC ptrGenRenderbuffers; -extern PFNGLBINDRENDERBUFFERPROC ptrBindRenderbuffer; -extern PFNGLRENDERBUFFERSTORAGEPROC ptrRenderbufferStorage; -extern PFNGLDELETERENDERBUFFERSPROC ptrDeleteRenderbuffers; -extern PFNGLFRAMEBUFFERRENDERBUFFERPROC ptrFramebufferRenderbuffer; -extern PFNGLCHECKFRAMEBUFFERSTATUSPROC ptrCheckFramebufferStatus; -extern PFNGLBLITFRAMEBUFFERPROC ptrBlitFramebuffer; -extern PFNGLGENVERTEXARRAYSPROC ptrGenVertexArrays; -extern PFNGLBINDVERTEXARRAYPROC ptrBindVertexArray; -extern PFNGLDELETEVERTEXARRAYSPROC ptrDeleteVertexArrays; -extern PFNGLGENBUFFERSPROC ptrGenBuffers; -extern PFNGLBINDBUFFERPROC ptrBindBuffer; -extern PFNGLBUFFERDATAPROC ptrBufferData; -extern PFNGLMAPBUFFERPROC ptrMapBuffer; -extern PFNGLMAPBUFFERRANGEPROC ptrMapBufferRange; -extern PFNGLUNMAPBUFFERPROC ptrUnmapBuffer; -extern PFNGLDELETEBUFFERSPROC ptrDeleteBuffers; -extern PFNGLBINDIMAGETEXTUREPROC ptrBindImageTexture; -extern PFNGLMEMORYBARRIERPROC ptrMemoryBarrier; -extern PFNGLGETSTRINGIPROC ptrGetStringi; -extern PFNGLINVALIDATEFRAMEBUFFERPROC ptrInvalidateFramebuffer; -extern PFNGLBUFFERSTORAGEPROC ptrBufferStorage; -extern PFNGLFENCESYNCPROC ptrFenceSync; -extern PFNGLCLIENTWAITSYNCPROC ptrClientWaitSync; -extern PFNGLDELETESYNCPROC ptrDeleteSync; - -extern PFNGLGETUNIFORMBLOCKINDEXPROC ptrGetUniformBlockIndex; -extern PFNGLUNIFORMBLOCKBINDINGPROC ptrUniformBlockBinding; -extern PFNGLGETACTIVEUNIFORMBLOCKIVPROC ptrGetActiveUniformBlockiv; -extern PFNGLGETUNIFORMINDICESPROC ptrGetUniformIndices; -extern PFNGLGETACTIVEUNIFORMSIVPROC ptrGetActiveUniformsiv; -extern PFNGLBINDBUFFERBASEPROC ptrBindBufferBase; -extern PFNGLBUFFERSUBDATAPROC ptrBufferSubData; - -extern PFNGLGETPROGRAMBINARYPROC ptrGetProgramBinary; -extern PFNGLPROGRAMBINARYPROC ptrProgramBinary; -extern PFNGLPROGRAMPARAMETERIPROC ptrProgramParameteri; - -extern PFNGLTEXSTORAGE2DPROC ptrTexStorage2D; -extern PFNGLTEXTURESTORAGE2DPROC ptrTextureStorage2D; -extern PFNGLTEXTURESUBIMAGE2DPROC ptrTextureSubImage2D; -extern PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC ptrTextureStorage2DMultisample; -extern PFNGLTEXTUREPARAMETERIPROC ptrTextureParameteri; -extern PFNGLTEXTUREPARAMETERFPROC ptrTextureParameterf; -extern PFNGLCREATETEXTURESPROC ptrCreateTextures; -extern PFNGLCREATEBUFFERSPROC ptrCreateBuffers; -extern PFNGLCREATEFRAMEBUFFERSPROC ptrCreateFramebuffers; -extern PFNGLNAMEDFRAMEBUFFERTEXTUREPROC ptrNamedFramebufferTexture; -extern PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC ptrDrawRangeElementsBaseVertex; -extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC ptrFlushMappedBufferRange; -extern PFNGLTEXTUREBARRIERPROC ptrTextureBarrier; -extern PFNGLTEXTUREBARRIERNVPROC ptrTextureBarrierNV; -extern PFNGLCLEARBUFFERFVPROC ptrClearBufferfv; -extern PFNGLENABLEIPROC ptrEnablei; -extern PFNGLDISABLEIPROC ptrDisablei; -extern PFNGLDEBUGMESSAGECALLBACKPROC ptrDebugMessageCallback; -extern PFNGLDEBUGMESSAGECONTROLPROC ptrDebugMessageControl; -extern PFNGLCOPYTEXIMAGE2DPROC ptrCopyTexImage2D; - -typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, void* image); -extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC ptrEGLImageTargetTexture2DOES; - -typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, void* image); -extern PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC ptrEGLImageTargetRenderbufferStorageOES; - -void initGLFunctions(); - -#define glGetError(...) opengl::FunctionWrapper::wrGetError(__VA_ARGS__) -#define glBlendFunc(...) opengl::FunctionWrapper::wrBlendFunc(__VA_ARGS__) -#define glBlendFuncSeparate(...) opengl::FunctionWrapper::wrBlendFuncSeparate(__VA_ARGS__) -#define glPixelStorei(...) opengl::FunctionWrapper::wrPixelStorei(__VA_ARGS__) -#define glClearColor(...) opengl::FunctionWrapper::wrClearColor(__VA_ARGS__) -#define glCullFace(...) opengl::FunctionWrapper::wrCullFace(__VA_ARGS__) -#define glDepthFunc(...) opengl::FunctionWrapper::wrDepthFunc(__VA_ARGS__) -#define glDepthMask(...) opengl::FunctionWrapper::wrDepthMask(__VA_ARGS__) -#define glDisable(...) opengl::FunctionWrapper::wrDisable(__VA_ARGS__) -#define glEnable(...) opengl::FunctionWrapper::wrEnable(__VA_ARGS__) -#define glPolygonOffset(...) opengl::FunctionWrapper::wrPolygonOffset(__VA_ARGS__) -#define glScissor(...) opengl::FunctionWrapper::wrScissor(__VA_ARGS__) -#define glViewport(...) opengl::FunctionWrapper::wrViewport(__VA_ARGS__) -#define glBindTexture(...) opengl::FunctionWrapper::wrBindTexture(__VA_ARGS__) -#define glTexImage2D(...) opengl::FunctionWrapper::wrTexImage2D(__VA_ARGS__) -#define glTexParameteri(...) opengl::FunctionWrapper::wrTexParameteri(__VA_ARGS__) -#define glGetIntegerv(...) opengl::FunctionWrapper::wrGetIntegerv(__VA_ARGS__) -#define glGetString(...) opengl::FunctionWrapper::wrGetString(__VA_ARGS__) -#define glReadPixels(...) opengl::FunctionWrapper::wrReadPixels(__VA_ARGS__) -#define glTexSubImage2D(...) opengl::FunctionWrapper::wrTexSubImage2D(__VA_ARGS__) -#define glDrawArrays(...) opengl::FunctionWrapper::wrDrawArrays(__VA_ARGS__) -#define glDrawElements(...) opengl::FunctionWrapper::wrDrawElements(__VA_ARGS__) -#define glLineWidth(...) opengl::FunctionWrapper::wrLineWidth(__VA_ARGS__) -#define glClear(...) opengl::FunctionWrapper::wrClear(__VA_ARGS__) -#define glGetFloatv(...) opengl::FunctionWrapper::wrGetFloatv(__VA_ARGS__) -#define glDeleteTextures(...) opengl::FunctionWrapper::wrDeleteTextures(__VA_ARGS__) -#define glGenTextures(...) opengl::FunctionWrapper::wrGenTextures(__VA_ARGS__) -#define glTexParameterf(...) opengl::FunctionWrapper::wrTexParameterf(__VA_ARGS__) -#define glActiveTexture(...) opengl::FunctionWrapper::wrActiveTexture(__VA_ARGS__) -#define glBlendColor(...) opengl::FunctionWrapper::wrBlendColor(__VA_ARGS__) -#define glReadBuffer(...) opengl::FunctionWrapper::wrReadBuffer(__VA_ARGS__) -#define glFinish(...) opengl::FunctionWrapper::wrFinish(__VA_ARGS__) -#if defined(OS_ANDROID) -#define eglGetNativeClientBufferANDROID(...) opengl::FunctionWrapper::ewrGetNativeClientBufferANDROID(__VA_ARGS__) -#endif -#define glCreateShader(...) opengl::FunctionWrapper::wrCreateShader(__VA_ARGS__) -#define glCompileShader(...) opengl::FunctionWrapper::wrCompileShader(__VA_ARGS__) -#define glShaderSource(...) opengl::FunctionWrapper::wrShaderSource(__VA_ARGS__) -#define glCreateProgram(...) opengl::FunctionWrapper::wrCreateProgram(__VA_ARGS__) -#define glAttachShader(...) opengl::FunctionWrapper::wrAttachShader(__VA_ARGS__) -#define glLinkProgram(...) opengl::FunctionWrapper::wrLinkProgram(__VA_ARGS__) -#define glUseProgram(...) opengl::FunctionWrapper::wrUseProgram(__VA_ARGS__) -#define glGetUniformLocation(...) opengl::FunctionWrapper::wrGetUniformLocation(__VA_ARGS__) -#define glUniform1i(...) opengl::FunctionWrapper::wrUniform1i(__VA_ARGS__) -#define glUniform1f(...) opengl::FunctionWrapper::wrUniform1f(__VA_ARGS__) -#define glUniform2f(...) opengl::FunctionWrapper::wrUniform2f(__VA_ARGS__) -#define glUniform2i(...) opengl::FunctionWrapper::wrUniform2i(__VA_ARGS__) -#define glUniform4i(...) opengl::FunctionWrapper::wrUniform4i(__VA_ARGS__) - -#define glUniform4f(...) opengl::FunctionWrapper::wrUniform4f(__VA_ARGS__) -#define glUniform3fv(...) opengl::FunctionWrapper::wrUniform3fv(__VA_ARGS__) -#define glUniform4fv(...) opengl::FunctionWrapper::wrUniform4fv(__VA_ARGS__) -#define glDetachShader(...) opengl::FunctionWrapper::wrDetachShader(__VA_ARGS__) -#define glDeleteShader(...) opengl::FunctionWrapper::wrDeleteShader(__VA_ARGS__) -#define glDeleteProgram(...) opengl::FunctionWrapper::wrDeleteProgram(__VA_ARGS__) -#define glGetProgramInfoLog(...) opengl::FunctionWrapper::wrGetProgramInfoLog(__VA_ARGS__) -#define glGetShaderInfoLog(...) opengl::FunctionWrapper::wrGetShaderInfoLog(__VA_ARGS__) -#define glGetShaderiv(...) opengl::FunctionWrapper::wrGetShaderiv(__VA_ARGS__) -#define glGetProgramiv(...) opengl::FunctionWrapper::wrGetProgramiv(__VA_ARGS__) - -#define glEnableVertexAttribArray(...) opengl::FunctionWrapper::wrEnableVertexAttribArray(__VA_ARGS__) -#define glDisableVertexAttribArray(...) opengl::FunctionWrapper::wrDisableVertexAttribArray(__VA_ARGS__) -#define glVertexAttribPointer(...) opengl::FunctionWrapper::wrVertexAttribPointer(__VA_ARGS__) -#define glBindAttribLocation(...) opengl::FunctionWrapper::wrBindAttribLocation(__VA_ARGS__) -#define glVertexAttrib1f(...) opengl::FunctionWrapper::wrVertexAttrib1f(__VA_ARGS__) -#define glVertexAttrib4f(...) opengl::FunctionWrapper::wrVertexAttrib4f(__VA_ARGS__) -#define glVertexAttrib4fv(...) opengl::FunctionWrapper::wrVertexAttrib4fv(__VA_ARGS__) - -#define glDepthRangef(...) opengl::FunctionWrapper::wrDepthRangef(__VA_ARGS__) -#define glClearDepthf(...) opengl::FunctionWrapper::wrClearDepthf(__VA_ARGS__) - -#define glBindBuffer(...) opengl::FunctionWrapper::wrBindBuffer(__VA_ARGS__) -#define glBindFramebuffer(...) opengl::FunctionWrapper::wrBindFramebuffer(__VA_ARGS__) -#define glBindRenderbuffer(...) opengl::FunctionWrapper::wrBindRenderbuffer(__VA_ARGS__) -#define glDrawBuffers(...) opengl::FunctionWrapper::wrDrawBuffers(__VA_ARGS__) -#define glGenFramebuffers(...) opengl::FunctionWrapper::wrGenFramebuffers(__VA_ARGS__) -#define glDeleteFramebuffers(...) opengl::FunctionWrapper::wrDeleteFramebuffers(__VA_ARGS__) -#define glFramebufferTexture2D(...) opengl::FunctionWrapper::wrFramebufferTexture2D(__VA_ARGS__) -#define glTexImage2DMultisample(...) opengl::FunctionWrapper::wrTexImage2DMultisample(__VA_ARGS__) -#define glTexStorage2DMultisample(...) opengl::FunctionWrapper::wrTexStorage2DMultisample(__VA_ARGS__) -#define glGenRenderbuffers(...) opengl::FunctionWrapper::wrGenRenderbuffers(__VA_ARGS__) -#define glRenderbufferStorage(...) opengl::FunctionWrapper::wrRenderbufferStorage(__VA_ARGS__) -#define glDeleteRenderbuffers(...) opengl::FunctionWrapper::wrDeleteRenderbuffers(__VA_ARGS__) -#define glFramebufferRenderbuffer(...) opengl::FunctionWrapper::wrFramebufferRenderbuffer(__VA_ARGS__) -#define glCheckFramebufferStatus(...) opengl::FunctionWrapper::wrCheckFramebufferStatus(__VA_ARGS__) -#define glBlitFramebuffer(...) opengl::FunctionWrapper::wrBlitFramebuffer(__VA_ARGS__) -#define glGenVertexArrays(...) opengl::FunctionWrapper::wrGenVertexArrays(__VA_ARGS__) -#define glBindVertexArray(...) opengl::FunctionWrapper::wrBindVertexArray(__VA_ARGS__) -#define glDeleteVertexArrays(...) opengl::FunctionWrapper::wrDeleteVertexArrays(__VA_ARGS__); -#define glGenBuffers(...) opengl::FunctionWrapper::wrGenBuffers(__VA_ARGS__) -#define glBufferData(...) opengl::FunctionWrapper::wrBufferData(__VA_ARGS__) -#define glMapBuffer(...) opengl::FunctionWrapper::wrMapBuffer(__VA_ARGS__) -#define glMapBufferRange(...) opengl::FunctionWrapper::wrMapBufferRange(__VA_ARGS__) -#define glUnmapBuffer(...) opengl::FunctionWrapper::wrUnmapBuffer(__VA_ARGS__) -#define glDeleteBuffers(...) opengl::FunctionWrapper::wrDeleteBuffers(__VA_ARGS__) -#define glBindImageTexture(...) opengl::FunctionWrapper::wrBindImageTexture(__VA_ARGS__) -#define glMemoryBarrier(...) opengl::FunctionWrapper::wrMemoryBarrier(__VA_ARGS__) -#define glGetStringi(...) opengl::FunctionWrapper::wrGetStringi(__VA_ARGS__) -#define glInvalidateFramebuffer(...) opengl::FunctionWrapper::wrInvalidateFramebuffer(__VA_ARGS__) -#define glBufferStorage(...) opengl::FunctionWrapper::wrBufferStorage(__VA_ARGS__) -#define glFenceSync(...) opengl::FunctionWrapper::wrFenceSync(__VA_ARGS__) -#define glClientWaitSync(...) opengl::FunctionWrapper::wrClientWaitSync(__VA_ARGS__) -#define glDeleteSync(...) opengl::FunctionWrapper::wrDeleteSync(__VA_ARGS__) - -#define glGetUniformBlockIndex(...) opengl::FunctionWrapper::wrGetUniformBlockIndex(__VA_ARGS__) -#define glUniformBlockBinding(...) opengl::FunctionWrapper::wrUniformBlockBinding(__VA_ARGS__) -#define glGetActiveUniformBlockiv(...) opengl::FunctionWrapper::wrGetActiveUniformBlockiv(__VA_ARGS__) -#define glGetUniformIndices(...) opengl::FunctionWrapper::wrGetUniformIndices(__VA_ARGS__) -#define glGetActiveUniformsiv(...) opengl::FunctionWrapper::wrGetActiveUniformsiv(__VA_ARGS__) -#define glBindBufferBase(...) opengl::FunctionWrapper::wrBindBufferBase(__VA_ARGS__) -#define glBufferSubData(...) opengl::FunctionWrapper::wrBufferSubData(__VA_ARGS__) - -#define glGetProgramBinary(...) opengl::FunctionWrapper::wrGetProgramBinary(__VA_ARGS__) -#define glProgramBinary(...) opengl::FunctionWrapper::wrProgramBinary(__VA_ARGS__) -#define glProgramParameteri(...) opengl::FunctionWrapper::wrProgramParameteri(__VA_ARGS__) - -#define glTexStorage2D(...) opengl::FunctionWrapper::wrTexStorage2D(__VA_ARGS__) -#define glTextureStorage2D(...) opengl::FunctionWrapper::wrTextureStorage2D(__VA_ARGS__) -#define glTextureSubImage2D(...) opengl::FunctionWrapper::wrTextureSubImage2D(__VA_ARGS__) -#define glTextureStorage2DMultisample(...) opengl::FunctionWrapper::wrTextureStorage2DMultisample(__VA_ARGS__) -#define glTextureParameteri(...) opengl::FunctionWrapper::wrTextureParameteri(__VA_ARGS__) -#define glTextureParameterf(...) opengl::FunctionWrapper::wrTextureParameterf(__VA_ARGS__) -#define glCreateTextures(...) opengl::FunctionWrapper::wrCreateTextures(__VA_ARGS__) -#define glCreateBuffers(...) opengl::FunctionWrapper::wrCreateBuffers(__VA_ARGS__) -#define glCreateFramebuffers(...) opengl::FunctionWrapper::wrCreateFramebuffers(__VA_ARGS__) -#define glNamedFramebufferTexture(...) opengl::FunctionWrapper::wrNamedFramebufferTexture(__VA_ARGS__) -#define glDrawRangeElementsBaseVertex(...) opengl::FunctionWrapper::wrDrawRangeElementsBaseVertex(__VA_ARGS__) -#define glFlushMappedBufferRange(...) opengl::FunctionWrapper::wrFlushMappedBufferRange(__VA_ARGS__) -#define glTextureBarrier(...) opengl::FunctionWrapper::wrTextureBarrier(__VA_ARGS__) -#define glTextureBarrierNV(...) opengl::FunctionWrapper::wrTextureBarrierNV(__VA_ARGS__) -#define glClearBufferfv(...) opengl::FunctionWrapper::wrClearBufferfv(__VA_ARGS__) -#define glEnablei(...) opengl::FunctionWrapper::wrEnablei(__VA_ARGS__) -#define glDisablei(...) opengl::FunctionWrapper::wrDisablei(__VA_ARGS__) -#define glCopyTexImage2D(...) opengl::FunctionWrapper::wrCopyTexImage2D(__VA_ARGS__) -#define glDebugMessageCallback(...) opengl::FunctionWrapper::wrDebugMessageCallback(__VA_ARGS__) -#define glDebugMessageControl(...) opengl::FunctionWrapper::wrDebugMessageControl(__VA_ARGS__) -#define glEGLImageTargetTexture2DOES(...) opengl::FunctionWrapper::wrEGLImageTargetTexture2DOES(__VA_ARGS__) -#define glEGLImageTargetRenderbufferStorageOES(...) opengl::FunctionWrapper::wrEGLImageTargetRenderbufferStorageOES(__VA_ARGS__) - -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 - -#include "Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.h" - -#endif // GLFUNCTIONS_H diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.cpp deleted file mode 100644 index 2644410..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include "glsl_CombinerInputs.h" - -using namespace glsl; - -bool CombinerInputs::usesTile(u32 _t) const -{ - if (_t == 0) - return (m_inputs & ((1 << G_GCI_TEXEL0) | (1 << G_GCI_TEXEL0_ALPHA))) != 0; - return (m_inputs & ((1 << G_GCI_TEXEL1) | (1 << G_GCI_TEXEL1_ALPHA))) != 0; -} - -bool CombinerInputs::usesTexture() const -{ - return (m_inputs & ((1 << G_GCI_TEXEL1) | (1 << G_GCI_TEXEL1_ALPHA) | (1 << G_GCI_TEXEL0) | (1 << G_GCI_TEXEL0_ALPHA))) != 0; -} - -bool CombinerInputs::usesLOD() const -{ - return (m_inputs & (1 << G_GCI_LOD_FRACTION)) != 0; -} - -bool CombinerInputs::usesNoise() const -{ - return (m_inputs & (1 << G_GCI_NOISE)) != 0; -} - -bool CombinerInputs::usesShade() const -{ - return (m_inputs & ((1 << G_GCI_SHADE) | (1 << G_GCI_SHADE_ALPHA))) != 0; -} - -bool CombinerInputs::usesShadeColor() const -{ - return (m_inputs & (1 << G_GCI_SHADE)) != 0; -} - -bool CombinerInputs::usesHwLighting() const -{ - return (m_inputs & (1 << G_GCI_HW_LIGHT)) != 0; -} - -void CombinerInputs::addInput(u32 _input) -{ - m_inputs |= 1 << _input; -} - -void CombinerInputs::operator+=(const CombinerInputs & _other) -{ - m_inputs |= _other.m_inputs; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.h deleted file mode 100644 index 01459b4..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerInputs.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once -#include - -namespace glsl { - - class CombinerInputs - { - public: - CombinerInputs() : m_inputs(0) {} - explicit CombinerInputs(int _inputs) : m_inputs(_inputs) {} - CombinerInputs(const CombinerInputs & _other) : m_inputs(_other.m_inputs) {} - - explicit operator int() { return m_inputs; } - - bool usesTile(u32 _t) const; - - bool usesTexture() const; - - bool usesLOD() const; - - bool usesNoise() const; - - bool usesShade() const; - - bool usesShadeColor() const; - - bool usesHwLighting() const; - - void addInput(u32 _input); - - void operator+=(const CombinerInputs & _other); - - private: - int m_inputs; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp deleted file mode 100644 index 659eb70..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp +++ /dev/null @@ -1,3143 +0,0 @@ -#include // for setprecision -#include -#include -#include -#include "glsl_Utils.h" -#include "glsl_ShaderPart.h" -#include "glsl_CombinerInputs.h" -#include "glsl_CombinerProgramImpl.h" -#include "glsl_CombinerProgramBuilder.h" -#include "glsl_CombinerProgramUniformFactory.h" -#include "GraphicsDrawer.h" - -using namespace glsl; - -class TextureConvert { -public: - void setMode(u32 _mode) { - m_mode = _mode; - } - - bool getBilerp1() const { - return (m_mode & 1) != 0; - } - - bool getBilerp0() const { - return (m_mode & 2) != 0; - } - - bool useYUVCoversion() const { - return (m_mode & 3) != 3; - } - - bool useTextureFiltering() const { - return (m_mode & 3) != 0; - } - -private: - u32 m_mode; -}; - - -u32 g_cycleType = G_CYC_1CYCLE; -TextureConvert g_textureConvert; - -/*---------------_compileCombiner-------------*/ - -static -const char *ColorInput[] = { - "combined_color.rgb", - "readtex0.rgb", - "readtex1.rgb", - "uPrimColor.rgb", - "vec_color.rgb", - "uEnvColor.rgb", - "uCenterColor.rgb", - "uScaleColor.rgb", - "combined_color.a", - "vec3(readtex0.a)", - "vec3(readtex1.a)", - "vec3(uPrimColor.a)", - "vec3(vec_color.a)", - "vec3(uEnvColor.a)", - "vec3(lod_frac)", - "vec3(uPrimLod)", - "vec3(0.5 + 0.5*snoise())", - "vec3(uK4)", - "vec3(uK5)", - "vec3(1.0)", - "vec3(0.0)", - "vec3(0.5)" -}; - -static -const char *AlphaInput[] = { - "combined_color.a", - "readtex0.a", - "readtex1.a", - "uPrimColor.a", - "vec_color.a", - "uEnvColor.a", - "uCenterColor.a", - "uScaleColor.a", - "combined_color.a", - "readtex0.a", - "readtex1.a", - "uPrimColor.a", - "vec_color.a", - "uEnvColor.a", - "lod_frac", - "uPrimLod", - "0.5 + 0.5*snoise()", - "uK4", - "uK5", - "1.0", - "0.0", - "0.5" -}; - -inline -u32 correctFirstStageParam(u32 _param) -{ - switch (_param) { - case G_GCI_TEXEL1: - return G_GCI_TEXEL0; - case G_GCI_TEXEL1_ALPHA: - return G_GCI_TEXEL0_ALPHA; - } - return _param; -} - -static -void _correctFirstStageParams(CombinerStage & _stage) -{ - for (u32 i = 0; i < _stage.numOps; ++i) { - _stage.op[i].param1 = correctFirstStageParam(_stage.op[i].param1); - _stage.op[i].param2 = correctFirstStageParam(_stage.op[i].param2); - _stage.op[i].param3 = correctFirstStageParam(_stage.op[i].param3); - } -} - -inline -u32 correctFirstStageParam2Cyc(u32 _param) -{ - switch (_param) { - case G_GCI_COMBINED: - return G_GCI_HALF; - } - return _param; -} - -static -void _correctFirstStageParams2Cyc(CombinerStage & _stage) -{ - for (u32 i = 0; i < _stage.numOps; ++i) { - _stage.op[i].param1 = correctFirstStageParam2Cyc(_stage.op[i].param1); - _stage.op[i].param2 = correctFirstStageParam2Cyc(_stage.op[i].param2); - _stage.op[i].param3 = correctFirstStageParam2Cyc(_stage.op[i].param3); - } -} - -inline -u32 correctSecondStageParam(u32 _param) -{ - switch (_param) { - case G_GCI_TEXEL0: - return G_GCI_TEXEL1; - case G_GCI_TEXEL1: - return G_GCI_TEXEL0; - case G_GCI_TEXEL0_ALPHA: - return G_GCI_TEXEL1_ALPHA; - case G_GCI_TEXEL1_ALPHA: - return G_GCI_TEXEL0_ALPHA; - } - return _param; -} - -static -void _correctSecondStageParams(CombinerStage & _stage) { - for (u32 i = 0; i < _stage.numOps; ++i) { - _stage.op[i].param1 = correctSecondStageParam(_stage.op[i].param1); - _stage.op[i].param2 = correctSecondStageParam(_stage.op[i].param2); - _stage.op[i].param3 = correctSecondStageParam(_stage.op[i].param3); - } -} - -static -CombinerInputs _compileCombiner(const CombinerStage & _stage, const char** _Input, std::stringstream & _strShader) { - bool bBracketOpen = false; - CombinerInputs inputs; - for (u32 i = 0; i < _stage.numOps; ++i) { - switch (_stage.op[i].op) { - case LOAD: - // sprintf(buf, "(%s ", _Input[_stage.op[i].param1]); - _strShader << "(" << _Input[_stage.op[i].param1] << " "; - bBracketOpen = true; - inputs.addInput(_stage.op[i].param1); - break; - case SUB: - if (bBracketOpen) { - // sprintf(buf, "- %s)", _Input[_stage.op[i].param1]); - _strShader << "- " << _Input[_stage.op[i].param1] << ")"; - bBracketOpen = false; - } - else - // sprintf(buf, "- %s", _Input[_stage.op[i].param1]); - _strShader << "- " << _Input[_stage.op[i].param1]; - // _strShader += buf; - inputs.addInput(_stage.op[i].param1); - break; - case ADD: - if (bBracketOpen) { - // sprintf(buf, "+ %s)", _Input[_stage.op[i].param1]); - _strShader << "+ " << _Input[_stage.op[i].param1] << ")"; - bBracketOpen = false; - } - else - // sprintf(buf, "+ %s", _Input[_stage.op[i].param1]); - _strShader << "+ " << _Input[_stage.op[i].param1]; - inputs.addInput(_stage.op[i].param1); - break; - case MUL: - if (bBracketOpen) { - // sprintf(buf, ")*%s", _Input[_stage.op[i].param1]); - _strShader << ")*" << _Input[_stage.op[i].param1]; - bBracketOpen = false; - } - else - // sprintf(buf, "*%s", _Input[_stage.op[i].param1]); - _strShader << "*" << _Input[_stage.op[i].param1]; - inputs.addInput(_stage.op[i].param1); - break; - case INTER: - // sprintf(buf, "mix(%s, %s, %s)", _Input[_stage.op[0].param2], _Input[_stage.op[0].param1], _Input[_stage.op[0].param3]); - _strShader << "mix(" << - _Input[_stage.op[0].param2] << "," << - _Input[_stage.op[0].param1] << "," << - _Input[_stage.op[0].param3] << ")"; - inputs.addInput(_stage.op[i].param1); - inputs.addInput(_stage.op[i].param2); - inputs.addInput(_stage.op[i].param3); - break; - - // default: - // assert(false); - } - } - if (bBracketOpen) - _strShader << ")"; - _strShader << ";" << std::endl; - return inputs; -} - -/*---------------ShaderParts-------------*/ - -class VertexShaderHeader : public ShaderPart -{ -public: - VertexShaderHeader(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = "#version 100 \n"; - m_part += - "#if (__VERSION__ > 120) \n" - "# define IN in \n" - "# define OUT out \n" - "#else \n" - "# define IN attribute \n" - "# define OUT varying \n" - "#ifndef GL_FRAGMENT_PRECISION_HIGH \n" - "# define highp mediump \n" - "#endif \n" - "#endif // __VERSION \n" - ; - } - else if (_glinfo.isGLESX) { - std::stringstream ss; - ss << "#version " << Utils::to_string(_glinfo.majorVersion) << Utils::to_string(_glinfo.minorVersion) << "0 es " << std::endl; - ss << "# define IN in" << std::endl << "# define OUT out" << std::endl; - if (_glinfo.noPerspective) { - ss << "#extension GL_NV_shader_noperspective_interpolation : enable" << std::endl - << "noperspective OUT highp float vZCoord;" << std::endl - << "uniform lowp int uClampMode;" << std::endl; - } - m_part = ss.str(); - } - else { - std::stringstream ss; - ss << "#version " << Utils::to_string(_glinfo.majorVersion) << Utils::to_string(_glinfo.minorVersion) << "0 core " << std::endl; - ss << "# define IN in" << std::endl << "# define OUT out" << std::endl; - m_part = ss.str(); - } - m_part += "uniform lowp vec2 uVertexOffset; \n"; - std::stringstream ss; - ss << "const lowp float screenSizeDims = " << std::setprecision(1) << std::fixed << SCREEN_SIZE_DIM << ";" << std::endl; - m_part += ss.str(); - } -}; - -class VertexShaderTexturedTriangle : public ShaderPart -{ -public: - VertexShaderTexturedTriangle(const opengl::GLInfo & _glinfo) - { - m_part = - "IN highp vec4 aPosition; \n" - "IN lowp vec4 aColor; \n" - "IN highp vec2 aTexCoord; \n" - "IN lowp float aNumLights; \n" - "IN highp vec4 aModify; \n" - "IN highp vec2 aBaryCoords; \n" - " \n" - "uniform int uTexturePersp; \n" - "uniform lowp int uTextureFilterMode; \n" - " \n" - "uniform lowp int uFogUsage; \n" - "uniform mediump vec2 uFogScale; \n" - "uniform mediump vec2 uScreenCoordsScale; \n" - " \n" - "uniform mediump vec2 uTexScale; \n" - "uniform mediump vec2 uTexOffset[2]; \n" - "uniform mediump vec2 uCacheScale[2]; \n" - "uniform mediump vec2 uCacheOffset[2]; \n" - "uniform mediump vec2 uCacheShiftScale[2]; \n" - "uniform mediump vec2 uVTrans; \n" - "uniform mediump vec2 uVScale; \n" - "uniform mediump vec2 uAdjustTrans; \n" - "uniform mediump vec2 uAdjustScale; \n" - "uniform lowp ivec2 uCacheFrameBuffer; \n" - "OUT highp vec2 vTexCoord0; \n" - "OUT highp vec2 vTexCoord1; \n" - "OUT mediump vec2 vLodTexCoord; \n" - "OUT lowp float vNumLights; \n" - "OUT lowp vec4 vShadeColor; \n" - "OUT highp vec4 vBaryCoords; \n" - ; - if (!_glinfo.isGLESX || _glinfo.noPerspective) - m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n"; - else - m_part += "OUT lowp vec4 vShadeColorNoperspective; \n"; - m_part += - "mediump vec2 calcTexCoord(in vec2 texCoord, in int idx) \n" - "{ \n" - " vec2 texCoordOut = texCoord*uCacheShiftScale[idx]; \n" - " texCoordOut -= uTexOffset[idx]; \n" - " texCoordOut += uCacheOffset[idx]; \n" - " if (uTextureFilterMode != 0 && uCacheFrameBuffer[idx] != 0) \n" /* Workaround for framebuffer textures. */ - " texCoordOut -= vec2(0.0,1.0); \n" /* They contain garbage at the bottom. */ - " return texCoordOut * uCacheScale[idx]; \n" - "} \n" - " \n" - "void main() \n" - "{ \n" - " gl_Position = aPosition; \n" - " vShadeColor = aColor; \n" - " vec2 texCoord = aTexCoord; \n" - " texCoord *= uTexScale; \n" - " if (uTexturePersp == 0 && aModify[2] == 0.0) texCoord *= 0.5;\n" - " vTexCoord0 = calcTexCoord(texCoord, 0); \n" - " vTexCoord1 = calcTexCoord(texCoord, 1); \n" - " vLodTexCoord = texCoord; \n" - " vNumLights = aNumLights; \n" - " if ((aModify[0]) != 0.0) { \n" - " gl_Position.xy *= gl_Position.w; \n" - " } \n" - " else { \n" - " gl_Position.xy = gl_Position.xy * uVScale.xy + uVTrans.xy * gl_Position.ww; \n" - " gl_Position.xy = floor(gl_Position.xy * vec2(4.0)) * vec2(0.25); \n" - " gl_Position.xy = gl_Position.xy * uAdjustScale + gl_Position.ww * uAdjustTrans; \n" - " } \n" - " if ((aModify[1]) != 0.0) \n" - " gl_Position.z *= gl_Position.w; \n" - " if ((aModify[3]) != 0.0) \n" - " vNumLights = 0.0; \n" - " if (uFogUsage > 0) { \n" - " lowp float fp; \n" - " if (aPosition.z < -aPosition.w && aModify[1] == 0.0) \n" - " fp = -uFogScale.s + uFogScale.t; \n" - " else \n" - " fp = aPosition.z/aPosition.w*uFogScale.s + uFogScale.t; \n" - " fp = clamp(fp, 0.0, 1.0); \n" - " if (uFogUsage == 1) \n" - " vShadeColor.a = fp; \n" - " else \n" - " vShadeColor.rgb = vec3(fp); \n" - " } \n" - " vBaryCoords = vec4(aBaryCoords, 1.0 - aBaryCoords.x - aBaryCoords.y, 0.5); \n" - " vShadeColorNoperspective = vShadeColor; \n" - ; - } -}; - -class VertexShaderTriangle : public ShaderPart -{ -public: - VertexShaderTriangle(const opengl::GLInfo & _glinfo) - { - m_part = - "IN highp vec4 aPosition; \n" - "IN lowp vec4 aColor; \n" - "IN lowp float aNumLights; \n" - "IN highp vec4 aModify; \n" - "IN highp vec2 aBaryCoords; \n" - " \n" - "uniform lowp int uFogUsage; \n" - "uniform mediump vec2 uFogScale; \n" - "uniform mediump vec2 uScreenCoordsScale; \n" - "uniform mediump vec2 uVTrans; \n" - "uniform mediump vec2 uVScale; \n" - "uniform mediump vec2 uAdjustTrans; \n" - "uniform mediump vec2 uAdjustScale; \n" - " \n" - "OUT lowp float vNumLights; \n" - "OUT lowp vec4 vShadeColor; \n" - "OUT highp vec4 vBaryCoords; \n" - ; - if (!_glinfo.isGLESX || _glinfo.noPerspective) - m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n"; - else - m_part += "OUT lowp vec4 vShadeColorNoperspective; \n"; - m_part += - " \n" - "void main() \n" - "{ \n" - " gl_Position = aPosition; \n" - " vShadeColor = aColor; \n" - " vNumLights = aNumLights; \n" - " if ((aModify[0]) != 0.0) { \n" - " gl_Position.xy *= gl_Position.w; \n" - " } \n" - " else { \n" - " gl_Position.xy = gl_Position.xy * uVScale.xy + uVTrans.xy * gl_Position.ww; \n" - " gl_Position.xy = floor(gl_Position.xy * vec2(4.0)) * vec2(0.25); \n" - " gl_Position.xy = gl_Position.xy * uAdjustScale + gl_Position.ww * uAdjustTrans; \n" - " } \n" - " if ((aModify[1]) != 0.0) \n" - " gl_Position.z *= gl_Position.w; \n" - " if ((aModify[3]) != 0.0) \n" - " vNumLights = 0.0; \n" - " if (uFogUsage > 0) { \n" - " lowp float fp; \n" - " if (aPosition.z < -aPosition.w && aModify[1] == 0.0) \n" - " fp = -uFogScale.s + uFogScale.t; \n" - " else \n" - " fp = aPosition.z/aPosition.w*uFogScale.s + uFogScale.t; \n" - " fp = clamp(fp, 0.0, 1.0); \n" - " if (uFogUsage == 1) \n" - " vShadeColor.a = fp; \n" - " else \n" - " vShadeColor.rgb = vec3(fp); \n" - " } \n" - " vBaryCoords = vec4(aBaryCoords, 1.0 - aBaryCoords.x - aBaryCoords.y, 0.5); \n" - " vShadeColorNoperspective = vShadeColor; \n" - ; - } -}; - -class VertexShaderTexturedRect : public ShaderPart -{ -public: - VertexShaderTexturedRect(const opengl::GLInfo & _glinfo) - { - m_part = - "IN highp vec4 aRectPosition; \n" - "IN highp vec2 aTexCoord0; \n" - "IN highp vec2 aTexCoord1; \n" - "IN highp vec2 aBaryCoords; \n" - " \n" - "OUT highp vec2 vTexCoord0; \n" - "OUT highp vec2 vTexCoord1; \n" - "OUT lowp vec4 vShadeColor; \n" - "OUT highp vec4 vBaryCoords;" - ; - if (!_glinfo.isGLESX || _glinfo.noPerspective) - m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n"; - else - m_part += "OUT lowp vec4 vShadeColorNoperspective; \n"; - m_part += - "uniform lowp vec4 uRectColor; \n" - "void main() \n" - "{ \n" - " gl_Position = aRectPosition; \n" - " vShadeColor = uRectColor; \n" - " vShadeColorNoperspective = uRectColor; \n" - " vTexCoord0 = aTexCoord0; \n" - " vTexCoord1 = aTexCoord1; \n" - " vBaryCoords = vec4(aBaryCoords, vec2(1.0) - aBaryCoords); \n" - ; - } -}; - -class VertexShaderRect : public ShaderPart -{ -public: - VertexShaderRect(const opengl::GLInfo & _glinfo) - { - m_part = - "IN highp vec4 aRectPosition; \n" - "IN highp vec2 aBaryCoords; \n" - " \n" - "OUT lowp vec4 vShadeColor; \n" - "OUT highp vec4 vBaryCoords; \n" - ; - if (!_glinfo.isGLESX || _glinfo.noPerspective) - m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n"; - else - m_part += "OUT lowp vec4 vShadeColorNoperspective; \n"; - m_part += - "uniform lowp vec4 uRectColor; \n" - "void main() \n" - "{ \n" - " gl_Position = aRectPosition; \n" - " vShadeColor = uRectColor; \n" - " vShadeColorNoperspective = uRectColor; \n" - " vBaryCoords = vec4(aBaryCoords, vec2(1.0) - aBaryCoords);\n" - ; - } -}; - -class VertexShaderEnd : public ShaderPart -{ -public: - VertexShaderEnd(const opengl::GLInfo & _glinfo) - { - if (!_glinfo.isGLESX) { - m_part = - " gl_ClipDistance[0] = gl_Position.w - gl_Position.z; \n" - ; - } else if (config.generalEmulation.enableFragmentDepthWrite != 0 && _glinfo.noPerspective) { - m_part = - " vZCoord = gl_Position.z / gl_Position.w; \n" - " if (uClampMode > 0) \n" - " gl_Position.z = 0.0; \n" - ; - } else if (config.generalEmulation.enableClipping != 0) { - // Move the near plane towards the camera. - // It helps to avoid issues with near-plane clipping in games, which do not use it. - // Z must be scaled back in fragment shader. - m_part = " gl_Position.z /= 8.0; \n"; - } - m_part += - " gl_Position.xy += uVertexOffset * vec2(gl_Position.w); \n" - " gl_Position.xy -= vec2(0.5*screenSizeDims) * gl_Position.ww; \n" - " gl_Position.xy /= vec2(0.5*screenSizeDims); \n" - "} \n" - ; - } -}; - -class FragmentShaderHeader : public ShaderPart -{ -public: - FragmentShaderHeader(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = "#version 100 \n"; - if (config.generalEmulation.enableLOD) { - m_part += "#extension GL_EXT_shader_texture_lod : enable \n"; - m_part += "#extension GL_OES_standard_derivatives : enable \n"; - } - m_part += - "#if (__VERSION__ > 120) \n" - "# define IN in \n" - "# define OUT out \n" - "# define texture2D texture \n" - "#else \n" - "# define IN varying \n" - "# define OUT \n" - "#ifndef GL_FRAGMENT_PRECISION_HIGH \n" - "# define highp mediump \n" - "#endif \n" - "#endif // __VERSION __ \n" - ; - } else if (_glinfo.isGLESX) { - std::stringstream ss; - ss << "#version " << Utils::to_string(_glinfo.majorVersion) << Utils::to_string(_glinfo.minorVersion) << "0 es " << std::endl; - if (_glinfo.noPerspective) - ss << "#extension GL_NV_shader_noperspective_interpolation : enable" << std::endl; - if (_glinfo.dual_source_blending) - ss << "#extension GL_EXT_blend_func_extended : enable" << std::endl; - if (_glinfo.ext_fetch) - ss << "#extension GL_EXT_shader_framebuffer_fetch : enable" << std::endl; - if (_glinfo.ext_fetch_arm) - ss << "#extension GL_ARM_shader_framebuffer_fetch : enable" << std::endl; - - if (config.frameBufferEmulation.N64DepthCompare == Config::dcFast) { - if (_glinfo.imageTextures && _glinfo.fragment_interlockNV) { - ss << "#extension GL_NV_fragment_shader_interlock : enable" << std::endl - << "layout(pixel_interlock_ordered) in;" << std::endl; - } - } - ss << "# define IN in" << std::endl - << "# define OUT out" << std::endl - << "# define texture2D texture" << std::endl; - m_part = ss.str(); - } else { - std::stringstream ss; - ss << "#version " << Utils::to_string(_glinfo.majorVersion) << Utils::to_string(_glinfo.minorVersion) << "0 core " << std::endl; - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - if (_glinfo.n64DepthWithFbFetch) - ss << "#extension GL_EXT_shader_framebuffer_fetch : enable" << std::endl; - else if (_glinfo.imageTextures) { - if (_glinfo.majorVersion * 10 + _glinfo.minorVersion < 42) { - ss << "#extension GL_ARB_shader_image_load_store : enable" << std::endl - << "#extension GL_ARB_shading_language_420pack : enable" << std::endl; - } - if (_glinfo.fragment_interlock) - ss << "#extension GL_ARB_fragment_shader_interlock : enable" << std::endl - << "layout(pixel_interlock_ordered) in;" << std::endl; - else if (_glinfo.fragment_interlockNV) - ss << "#extension GL_NV_fragment_shader_interlock : enable" << std::endl - << "layout(pixel_interlock_ordered) in;" << std::endl; - else if (_glinfo.fragment_ordering) - ss << "#extension GL_INTEL_fragment_shader_ordering : enable" << std::endl; - } - } - ss << "# define IN in" << std::endl - << "# define OUT out" << std::endl - << "# define texture2D texture" << std::endl; - m_part = ss.str(); - } - m_part += - // Return the vector of the standard basis of R^4 with a 1 at position and 0 otherwise. - " #define STVEC(pos) (step(float(pos), vec4(0.5,1.5,2.5,3.5)) - step(float(pos), vec4(-0.5,0.5,1.5,2.5))) \n"; - - } -}; - -class ShaderBlender1 : public ShaderPart -{ -public: - ShaderBlender1(const opengl::GLInfo & _glinfo) - { -#if 1 - m_part = - " srcColor1 = vec4(0.0); \n" - " dstFactor1 = 0.0; \n" - " muxPM[0] = clampedColor; \n" - " muxA[0] = clampedColor.a; \n" - " muxa = MUXA(uBlendMux1[1]); \n" - " muxB[0] = 1.0 - muxa; \n" - " muxb = MUXB(uBlendMux1[3]); \n" - " muxp = MUXPM(uBlendMux1[0]); \n" - " muxm = MUXPM(uBlendMux1[2]); \n" - " muxaf = MUXF(uBlendMux1[0]); \n" - " muxbf = MUXF(uBlendMux1[2]); \n" - " if (uForceBlendCycle1 != 0) { \n" - " srcColor1 = muxp * muxa + muxm * muxb; \n" - " dstFactor1 = muxaf * muxa + muxbf * muxb; \n" - " srcColor1 = clamp(srcColor1, 0.0, 1.0); \n" - " } else { \n" - " srcColor1 = muxp; \n" - " dstFactor1 = muxaf; \n" - " } \n" - " fragColor = srcColor1; \n" - " fragColor1 = vec4(dstFactor1); \n" - ; -#else - // Keep old code for reference - m_part = - " muxPM[0] = clampedColor; \n" - " if (uForceBlendCycle1 != 0) { \n" - " muxA[0] = clampedColor.a; \n" - " muxB[0] = 1.0 - muxA[uBlendMux1[1]]; \n" - " lowp vec4 blend1 = (muxPM[uBlendMux1[0]] * muxA[uBlendMux1[1]]) + (muxPM[uBlendMux1[2]] * muxB[uBlendMux1[3]]); \n" - " clampedColor.rgb = clamp(blend1.rgb, 0.0, 1.0); \n" - " } else clampedColor.rgb = muxPM[uBlendMux1[0]].rgb; \n" - ; -#endif - } -}; - -class ShaderBlender2 : public ShaderPart -{ -public: - ShaderBlender2(const opengl::GLInfo & _glinfo) - { -#if 1 - m_part = - " srcColor2 = vec4(0.0); \n" - " dstFactor2 = 0.0; \n" - " muxPM[0] = srcColor1; \n" - " muxa = MUXA(uBlendMux2[1]); \n" - " muxB[0] = 1.0 - muxa; \n" - " muxb = MUXB(uBlendMux2[3]); \n" - " muxp = MUXPM(uBlendMux2[0]); \n" - " muxm = MUXPM(uBlendMux2[2]); \n" - " muxF[0] = dstFactor1; \n" - " muxaf = MUXF(uBlendMux2[0]); \n" - " muxbf = MUXF(uBlendMux2[2]); \n" - " if (uForceBlendCycle2 != 0) { \n" - " srcColor2 = muxp * muxa + muxm * muxb; \n" - " dstFactor2 = muxaf * muxa + muxbf * muxb; \n" - " srcColor2 = clamp(srcColor2, 0.0, 1.0); \n" - " } else { \n" - " srcColor2 = muxp; \n" - " dstFactor2 = muxaf; \n" - " } \n" - " fragColor = srcColor2; \n" - " fragColor1 = vec4(dstFactor2); \n" - ; - -#else - // Keep old code for reference - m_part = - " muxPM[0] = clampedColor; \n" - " muxPM[1] = vec4(0.0); \n" - " if (uForceBlendCycle2 != 0) { \n" - " muxA[0] = clampedColor.a; \n" - " muxB[0] = 1.0 - muxA[uBlendMux2[1]]; \n" - " lowp vec4 blend2 = muxPM[uBlendMux2[0]] * muxA[uBlendMux2[1]] + muxPM[uBlendMux2[2]] * muxB[uBlendMux2[3]]; \n" - " clampedColor.rgb = clamp(blend2.rgb, 0.0, 1.0); \n" - " } else clampedColor.rgb = muxPM[uBlendMux2[0]].rgb; \n" - ; -#endif - } -}; - -class ShaderBlenderAlpha : public ShaderPart -{ -public: - ShaderBlenderAlpha(const opengl::GLInfo & _glinfo) - { - if (_glinfo.dual_source_blending || _glinfo.ext_fetch || _glinfo.ext_fetch_arm) { - m_part += - "if (uBlendAlphaMode != 2) { \n" - " lowp vec4 srcAlpha = vec4(cvg, cvg, 1.0, 0.0); \n" - " lowp vec4 dstFactorAlpha = vec4(1.0, 1.0, 0.0, 1.0); \n" - " if (uBlendAlphaMode == 0) \n" - " dstFactorAlpha[0] = 0.0; \n" - " fragColor1.a = dstFactorAlpha[uCvgDest]; \n" - " fragColor.a = srcAlpha[uCvgDest] + lastFragColor.a * fragColor1.a;\n" - "} else fragColor.a = clampedColor.a; \n"; - } - else { - m_part += - "fragColor.a = clampedColor.a;" - ; - } - } -}; - -class ShaderLegacyBlender : public ShaderPart -{ -public: - ShaderLegacyBlender() - { - m_part = - " if (uFogUsage == 1) \n" - " fragColor.rgb = mix(fragColor.rgb, uFogColor.rgb, vShadeColor.a); \n" - ; - } -}; - - -/* -// N64 color wrap and clamp on floats -// See https://github.com/gonetz/GLideN64/issues/661 for reference -if (c < -1.0) return c + 2.0; - -if (c < -0.5) return 1; - -if (c < 0.0) return 0; - -if (c > 2.0) return c - 2.0; - -if (c > 1.5) return 0; - -if (c > 1.0) return 1; - -return c; -*/ -class ShaderClamp : public ShaderPart -{ -public: - ShaderClamp() - { - m_part = - " lowp vec4 wrappedColor = WRAP(cmbRes, -0.51, 1.51); \n" - " lowp vec4 clampedColor = clamp(wrappedColor, 0.0, 1.0); \n" - ; - } -}; - -/* -N64 sign-extension for C component of combiner -if (c > 1.0) -return c - 2.0; - -return c; -*/ -class ShaderSignExtendColorC : public ShaderPart -{ -public: - ShaderSignExtendColorC() - { - m_part = - " color1 = WRAP(color1, -1.01, 1.01); \n" - ; - } -}; - -class ShaderSignExtendAlphaC : public ShaderPart -{ -public: - ShaderSignExtendAlphaC() - { - m_part = - " alpha1 = WRAP(alpha1, -1.01, 1.01); \n" - ; - } -}; - -/* -N64 sign-extension for ABD components of combiner -if (c > 1.5) -return c - 2.0; - -if (c < -0.5) -return c + 2.0; - -return c; -*/ -class ShaderSignExtendColorABD : public ShaderPart -{ -public: - ShaderSignExtendColorABD() - { - m_part = - " color1 = WRAP(color1, -0.51, 1.51); \n" - ; - } -}; - -class ShaderSignExtendAlphaABD : public ShaderPart -{ -public: - ShaderSignExtendAlphaABD() - { - m_part = - " alpha1 = WRAP(alpha1, -0.51,1.51); \n" - ; - } -}; - -class ShaderAlphaTest : public ShaderPart -{ -public: - ShaderAlphaTest() - { - m_part = - " if (uEnableAlphaTest != 0) { \n" - " lowp float alphaTestValue = (uAlphaCompareMode == 3) ? snoise() : uAlphaTestValue; \n" - " lowp float alphaValue; \n" - " if ((uAlphaCvgSel != 0) && (uCvgXAlpha == 0)) { \n" - " alphaValue = 0.125; \n" - " } else { \n" - " alphaValue = clamp(alpha1, 0.0, 1.0); \n" - " } \n" - " if (alphaValue < alphaTestValue) discard; \n" - " } \n" - ; - } -}; - -class ShaderDithering : public ShaderPart -{ -public: - ShaderDithering(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) - return; - - if (config.generalEmulation.enableDitheringPattern == 0) { - m_part = - " if (uColorDitherMode == 2) { \n" - " colorDither(snoiseRGB(), clampedColor.rgb); \n" - " } \n" - " if (uAlphaDitherMode == 2) { \n" - " alphaDither(snoiseA(), clampedColor.a); \n" - " } \n" - ; - return; - } - - m_part += - " lowp mat4 bayer = mat4( 0.0, 0.5, 0.125, 0.625, \n" - " 0.5, 0.0, 0.625, 0.125, \n" - " 0.375, 0.875, 0.25, 0.75, \n" - " 0.875, 0.375, 0.75, 0.25); \n" - " lowp mat4 mSquare = mat4( 0.0, 0.75, 0.125, 0.875, \n" - " 0.5, 0.25, 0.625, 0.375, \n" - " 0.375, 0.625, 0.25, 0.5, \n" - " 0.875, 0.125, 0.75, 0.0); \n" - // Try to keep dithering visible even at higher resolutions - " lowp float divider = 1.0 + step(3.0, uScreenScale.x); \n" - " mediump ivec2 position = ivec2(mod((gl_FragCoord.xy - 0.5) / divider,4.0));\n" - " lowp vec4 posX = STVEC(position.x); \n" - " lowp vec4 posY = STVEC(position.y); \n" - " lowp float bayerThreshold = dot(bayer*posY, posX); \n" - " lowp float mSquareThreshold = dot(mSquare*posY, posX); \n" - " switch (uColorDitherMode) { \n" - " case 0: \n" - " colorDither(vec3(mSquareThreshold), clampedColor.rgb); \n" - " break; \n" - " case 1: \n" - " colorDither(vec3(bayerThreshold), clampedColor.rgb); \n" - " break; \n" - " case 2: \n" - " colorDither(snoiseRGB(), clampedColor.rgb); \n" - " break; \n" - " case 3: \n" - " break; \n" - " } \n" - " switch (uAlphaDitherMode) { \n" - " case 0: \n" - " switch (uColorDitherMode) { \n" - " case 0: \n" - " case 2: \n" - " alphaDither(mSquareThreshold, clampedColor.a); \n" - " break; \n" - " case 1: \n" - " case 3: \n" - " alphaDither(bayerThreshold, clampedColor.a); \n" - " break; \n" - " } \n" - " break; \n" - " case 1: \n" - " switch (uColorDitherMode) { \n" - " case 0: \n" - " case 2: \n" - " alphaDither(bayerThreshold, clampedColor.a); \n" - " break; \n" - " case 1: \n" - " case 3: \n" - " alphaDither(mSquareThreshold, clampedColor.a); \n" - " break; \n" - " } \n" - " break; \n" - " case 2: \n" - " alphaDither(snoiseA(), clampedColor.a); \n" - " break; \n" - " case 3: \n" - " break; \n" - " } \n" - ; - } -}; - -class ShaderFragmentGlobalVariablesTex : public ShaderPart -{ -public: - ShaderFragmentGlobalVariablesTex(const opengl::GLInfo & _glinfo) - { - m_part = - "uniform sampler2D uTex0; \n" - "uniform sampler2D uTex1; \n" - "uniform lowp vec4 uFogColor; \n" - "uniform lowp vec4 uCenterColor;\n" - "uniform lowp vec4 uScaleColor; \n" - "uniform lowp vec4 uBlendColor; \n" - "uniform lowp vec4 uEnvColor; \n" - "uniform lowp vec4 uPrimColor; \n" - "uniform lowp float uPrimLod; \n" - "uniform lowp float uK4; \n" - "uniform lowp float uK5; \n" - "uniform lowp int uAlphaCompareMode; \n" - "uniform lowp ivec2 uFbMonochrome; \n" - "uniform lowp ivec2 uFbFixedAlpha; \n" - "uniform lowp int uEnableAlphaTest; \n" - "uniform lowp int uCvgXAlpha; \n" - "uniform lowp int uAlphaCvgSel; \n" - "uniform lowp float uAlphaTestValue; \n" - "uniform lowp int uDepthSource; \n" - "uniform highp float uPrimDepth; \n" - "uniform mediump vec2 uScreenScale; \n" - "uniform highp vec2 uTexClamp0; \n" - "uniform highp vec2 uTexClamp1; \n" - "uniform highp vec2 uTexWrap0; \n" - "uniform highp vec2 uTexWrap1; \n" - "uniform lowp vec2 uTexWrapEn0; \n" - "uniform lowp vec2 uTexWrapEn1; \n" - "uniform lowp vec2 uTexMirrorEn0; \n" - "uniform lowp vec2 uTexMirrorEn1; \n" - "uniform lowp vec2 uTexClampEn0; \n" - "uniform lowp vec2 uTexClampEn1; \n" - "uniform highp vec2 uTexCoordOffset[2]; \n" - "uniform lowp int uUseTexCoordBounds; \n" - "uniform highp vec4 uTexCoordBounds0; \n" - "uniform highp vec4 uTexCoordBounds1; \n" - "uniform lowp int uScreenSpaceTriangle; \n" - "highp vec2 texCoord0; \n" - "highp vec2 texCoord1; \n" - "highp vec2 tcData0[5]; \n" - "highp vec2 tcData1[5]; \n" - "uniform lowp int uCvgDest; \n" - "uniform lowp int uBlendAlphaMode; \n" - "lowp float cvg; \n" - ; - - if (config.generalEmulation.enableLegacyBlending != 0) { - m_part += - "uniform lowp int uFogUsage; \n" - ; - } else { - m_part += - "uniform lowp ivec4 uBlendMux1; \n" - "uniform lowp int uForceBlendCycle1;\n" - ; - } - - if (!_glinfo.isGLES2) { - m_part += - "uniform sampler2D uDepthTex; \n" - "uniform lowp int uAlphaDitherMode; \n" - "uniform lowp int uColorDitherMode; \n" - "uniform lowp int uRenderTarget; \n" - "uniform mediump vec2 uDepthScale; \n" - ; - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - m_part += - "uniform lowp int uEnableDepthCompare; \n" - ; - } - } else { - m_part += - "lowp int nCurrentTile; \n" - ; - } - - if (config.video.multisampling > 0) { - m_part += - "uniform lowp ivec2 uMSTexEnabled; \n" - "uniform lowp sampler2DMS uMSTex0; \n" - "uniform lowp sampler2DMS uMSTex1; \n" - ; - } - - if (!_glinfo.isGLESX || _glinfo.noPerspective) - m_part += "noperspective IN lowp vec4 vShadeColorNoperspective; \n"; - else - m_part += "IN lowp vec4 vShadeColorNoperspective; \n"; - - m_part += - "IN lowp vec4 vShadeColor; \n" - "IN highp vec2 vTexCoord0; \n" - "IN highp vec2 vTexCoord1; \n" - "IN mediump vec2 vLodTexCoord; \n" - "IN lowp float vNumLights; \n" - "IN highp vec4 vBaryCoords; \n" - ; - - if (_glinfo.dual_source_blending) { - m_part += - "layout(location = 0, index = 0) OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "layout(location = 0, index = 1) OUT lowp vec4 fragColor1; \n" // SECONDARY FRAGMENT SHADER OUTPUT - "#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY - "#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY - ; - } else if (_glinfo.ext_fetch) { - m_part += - "layout(location = 0) inout lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "lowp vec4 fragColor1; \n" // DUMMY - "#define LAST_FRAG_COLOR fragColor \n" // CURRENT FRAMEBUFFER COLOR/ALPHA - "#define LAST_FRAG_ALPHA fragColor.a \n" // CURRENT FRAMEBUFFER ALPHA - ; - } else if (_glinfo.ext_fetch_arm) { - m_part += - "OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "lowp vec4 fragColor1; \n" // DUMMY - "#define LAST_FRAG_COLOR gl_LastFragColorARM \n" // CURRENT FRAMEBUFFER COLOR/ALPHA - "#define LAST_FRAG_ALPHA gl_LastFragColorARM.a \n" // CURRENT FRAMEBUFFER ALPHA - ; - } else { - m_part += - "OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "lowp vec4 fragColor1; \n" // DUMMY - "#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY - "#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY - ; - } - - if (config.frameBufferEmulation.N64DepthCompare == Config::dcFast && _glinfo.n64DepthWithFbFetch) { - m_part += - "layout(location = 1) inout highp vec4 depthZ; \n" - "layout(location = 2) inout highp vec4 depthDeltaZ; \n" - ; - } - } -}; - -class ShaderFragmentGlobalVariablesNotex : public ShaderPart -{ -public: - ShaderFragmentGlobalVariablesNotex(const opengl::GLInfo & _glinfo) - { - m_part = - "uniform lowp vec4 uFogColor; \n" - "uniform lowp vec4 uCenterColor;\n" - "uniform lowp vec4 uScaleColor; \n" - "uniform lowp vec4 uBlendColor; \n" - "uniform lowp vec4 uEnvColor; \n" - "uniform lowp vec4 uPrimColor; \n" - "uniform lowp float uPrimLod; \n" - "uniform lowp float uK4; \n" - "uniform lowp float uK5; \n" - "uniform lowp int uAlphaCompareMode; \n" - "uniform lowp ivec2 uFbMonochrome; \n" - "uniform lowp ivec2 uFbFixedAlpha; \n" - "uniform lowp int uEnableAlphaTest; \n" - "uniform lowp int uCvgXAlpha; \n" - "uniform lowp int uAlphaCvgSel; \n" - "uniform lowp float uAlphaTestValue; \n" - "uniform lowp int uDepthSource; \n" - "uniform highp float uPrimDepth; \n" - "uniform mediump vec2 uScreenScale; \n" - "uniform lowp int uScreenSpaceTriangle; \n" - "uniform lowp int uCvgDest; \n" - "uniform lowp int uBlendAlphaMode; \n" - "lowp float cvg; \n" - ; - - if (config.generalEmulation.enableLegacyBlending != 0) { - m_part += - "uniform lowp int uFogUsage; \n" - ; - } else { - m_part += - "uniform lowp ivec4 uBlendMux1; \n" - "uniform lowp int uForceBlendCycle1;\n" - ; - } - - if (!_glinfo.isGLES2) { - m_part += - "uniform sampler2D uDepthTex; \n" - "uniform lowp int uAlphaDitherMode; \n" - "uniform lowp int uColorDitherMode; \n" - "uniform lowp int uRenderTarget; \n" - "uniform mediump vec2 uDepthScale; \n" - ; - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - m_part += - "uniform lowp int uEnableDepthCompare; \n" - ; - } - } else { - m_part += - "lowp int nCurrentTile; \n" - ; - } - - if (!_glinfo.isGLESX || _glinfo.noPerspective) - m_part += "noperspective IN lowp vec4 vShadeColorNoperspective; \n"; - else - m_part += "IN lowp vec4 vShadeColorNoperspective; \n"; - - m_part += - "IN lowp vec4 vShadeColor; \n" - "IN lowp float vNumLights; \n" - "IN highp vec4 vBaryCoords; \n" - ; - - if (_glinfo.dual_source_blending) { - m_part += - "layout(location = 0, index = 0) OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "layout(location = 0, index = 1) OUT lowp vec4 fragColor1; \n" // SECONDARY FRAGMENT SHADER OUTPUT - "#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY - "#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY - ; - } else if (_glinfo.ext_fetch) { - m_part += - "layout(location = 0) inout lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "lowp vec4 fragColor1; \n" // DUMMY - "#define LAST_FRAG_COLOR fragColor \n" // CURRENT FRAMEBUFFER COLOR/ALPHA - "#define LAST_FRAG_ALPHA fragColor.a \n" // CURRENT FRAMEBUFFER ALPHA - ; - } else if (_glinfo.ext_fetch_arm) { - m_part += - "OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "lowp vec4 fragColor1; \n" // DUMMY - "#define LAST_FRAG_COLOR gl_LastFragColorARM \n" // CURRENT FRAMEBUFFER COLOR/ALPHA - "#define LAST_FRAG_ALPHA gl_LastFragColorARM.a \n" // CURRENT FRAMEBUFFER ALPHA - ; - } else { - m_part += - "OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT - "lowp vec4 fragColor1; \n" // DUMMY - "#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY - "#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY - ; - } - - if (config.frameBufferEmulation.N64DepthCompare == Config::dcFast && _glinfo.n64DepthWithFbFetch) { - m_part += - "layout(location = 1) inout highp vec4 depthZ; \n" - "layout(location = 2) inout highp vec4 depthDeltaZ; \n" - ; - } - } -}; - -class ShaderFragmentHeaderNoise : public ShaderPart -{ -public: - ShaderFragmentHeaderNoise(const opengl::GLInfo & _glinfo) - { - m_part = - "lowp float snoise();\n" - ; - } -}; - -class ShaderFragmentHeaderWriteDepth : public ShaderPart -{ -public: - ShaderFragmentHeaderWriteDepth(const opengl::GLInfo & _glinfo) - { - if (!_glinfo.isGLES2) { - m_part = - "highp float writeDepth();\n"; - ; - } - if (_glinfo.isGLESX && _glinfo.noPerspective) { - m_part = - "noperspective IN highp float vZCoord; \n" - "uniform lowp float uPolygonOffset; \n" - "uniform lowp int uClampMode; \n" - + m_part - ; - } - - } -}; - -class ShaderFragmentHeaderCalcLight : public ShaderPart -{ -public: - ShaderFragmentHeaderCalcLight(const opengl::GLInfo & _glinfo) - { - m_part = - "void calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color);\n"; - ; - } -}; - -class ShaderFragmentHeaderMipMap : public ShaderPart -{ -public: - ShaderFragmentHeaderMipMap(const opengl::GLInfo & _glinfo) - { - m_part = - "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1);\n"; - ; - } -}; - -class ShaderFragmentHeaderTextureEngine : public ShaderPart -{ -public: - ShaderFragmentHeaderTextureEngine(const opengl::GLInfo & _glinfo) - { - m_part = - "highp vec2 clampWrapMirror(in highp vec2 vTexCoord, \n" - " in highp vec2 vWrap, in highp vec2 vClamp, \n" - " in lowp vec2 vClampEn, in lowp vec2 vMirrorEn ); \n" - "void textureEngine0(in highp vec2 texCoord, out highp vec2 tcData[5]); \n" - "void textureEngine1(in highp vec2 texCoord, out highp vec2 tcData[5]); \n" - ; - } -}; - -class ShaderFragmentHeaderReadMSTex : public ShaderPart -{ -public: - ShaderFragmentHeaderReadMSTex(const opengl::GLInfo & _glinfo) : m_glinfo(_glinfo) - { - } - - void write(std::stringstream & shader) const override - { - if (!m_glinfo.isGLES2 && - config.video.multisampling > 0 && - (g_cycleType == G_CYC_COPY || g_textureConvert.useTextureFiltering())) - { - shader << - "lowp vec4 readTexMS(in lowp sampler2DMS mstex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha);\n"; - } - } - -private: - const opengl::GLInfo& m_glinfo; -}; - -class ShaderFragmentHeaderDither : public ShaderPart -{ -public: - ShaderFragmentHeaderDither(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) - return; - - m_part = - "void colorDither(in lowp vec3 _threshold, inout lowp vec3 _color);\n" - "void alphaDither(in lowp float _threshold, inout lowp float _alpha);\n" - "lowp vec3 snoiseRGB();\n" - "lowp float snoiseA();\n" - ; - } -}; - -class ShaderFragmentHeaderDepthCompare : public ShaderPart -{ -public: - ShaderFragmentHeaderDepthCompare(const opengl::GLInfo & _glinfo) - { - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - m_part = - "bool depth_compare(highp float curZ); \n" - "bool depth_render(highp float Z, highp float curZ); \n" - ; - if (_glinfo.imageTextures & !_glinfo.n64DepthWithFbFetch) { - m_part += - "layout(binding = 2, r32f) highp uniform restrict image2D uDepthImageZ; \n" - "layout(binding = 3, r32f) highp uniform restrict image2D uDepthImageDeltaZ; \n" - ; - } - } - } -}; - -class ShaderFragmentHeaderReadTex : public ShaderPart -{ -public: - ShaderFragmentHeaderReadTex(const opengl::GLInfo & _glinfo) : m_glinfo(_glinfo) - { - } - - void write(std::stringstream & shader) const override - { - std::string shaderPart; - if (!m_glinfo.isGLES2) { - - if (g_textureConvert.useTextureFiltering()) { - shaderPart += "uniform lowp int uTextureFilterMode; \n"; - shaderPart += "#define TEX_NEAREST(name, tex, tcData) \\\n" - "{ \\\n" - " name = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - "} \n" - ; - switch (config.texture.bilinearMode + config.texture.enableHalosRemoval * 2) { - case BILINEAR_3POINT: - // 3 point texture filtering. - // Original author: ArthurCarvalho - // GLSL implementation: twinaphex, mupen64plus-libretro project. - shaderPart += - "#define TEX_FILTER(name, tex, tcData) \\\n" - " { \\\n" - " lowp float bottomRightTri = step(1.0, tcData[4].s + tcData[4].t); \\\n" - " lowp vec4 c00 = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - " lowp vec4 c01 = texelFetch(tex, ivec2(tcData[1]), 0); \\\n" - " lowp vec4 c10 = texelFetch(tex, ivec2(tcData[2]), 0); \\\n" - " lowp vec4 c11 = texelFetch(tex, ivec2(tcData[3]), 0); \\\n" - " lowp vec4 c0 = c00 + tcData[4].s*(c10-c00) + tcData[4].t*(c01-c00); \\\n" - " lowp vec4 c1 = c11 + (1.0-tcData[4].s)*(c01-c11) + (1.0-tcData[4].t)*(c10-c11); \\\n" - " name = c0 + bottomRightTri * (c1-c0); \\\n" - " } \n" - ; - break; - case BILINEAR_STANDARD: - shaderPart += - "#define TEX_FILTER(name, tex, tcData) \\\n" - "{ \\\n" - " lowp vec4 c00 = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - " lowp vec4 c01 = texelFetch(tex, ivec2(tcData[1]), 0); \\\n" - " lowp vec4 c10 = texelFetch(tex, ivec2(tcData[2]), 0); \\\n" - " lowp vec4 c11 = texelFetch(tex, ivec2(tcData[3]), 0); \\\n" - " lowp vec4 c0 = c00 + tcData[4].s * (c10-c00); \\\n" - " lowp vec4 c1 = c01 + tcData[4].s * (c11-c01); \\\n" - " name = c0 + tcData[4].t * (c1-c0); \\\n" - "} \n" - ; - break; - case BILINEAR_3POINT_WITH_COLOR_BLEEDING: - // 3 point texture filtering. - // Original author: ArthurCarvalho - // GLSL implementation: twinaphex, mupen64plus-libretro project. - shaderPart += - "#define TEX_FILTER(name, tex, tcData) \\\n" - "{ \\\n" - " lowp float bottomRightTri = step(1.0, tcData[4].s + tcData[4].t); \\\n" - " lowp vec4 c00 = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - " lowp vec4 c01 = texelFetch(tex, ivec2(tcData[1]), 0); \\\n" - " lowp vec4 c10 = texelFetch(tex, ivec2(tcData[2]), 0); \\\n" - " lowp vec4 c11 = texelFetch(tex, ivec2(tcData[3]), 0); \\\n" - " if(uEnableAlphaTest == 1 ){ \\\n" // Calculate premultiplied color values - " c00.rgb *= c00.a; \\\n" - " c01.rgb *= c01.a; \\\n" - " c10.rgb *= c10.a; \\\n" - " c11.rgb *= c11.a; \\\n" - " } \\\n" - " lowp vec4 c0 = c00 + tcData[4].s*(c10-c00) + tcData[4].t*(c01-c00); \\\n" - " lowp vec4 c1 = c11 + (1.0-tcData[4].s)*(c01-c11) + (1.0-tcData[4].t)*(c10-c11); \\\n" - " name = c0 + bottomRightTri * (c1-c0); \\\n" - " if(uEnableAlphaTest == 1 ) name.rgb /= name.a; \\\n" // Divide alpha to get actual color value - "} \n" - ; - break; - case BILINEAR_STANDARD_WITH_COLOR_BLEEDING_AND_PREMULTIPLIED_ALPHA: - shaderPart += - "#define TEX_FILTER(name, tex, tcData) \\\n" - "{ \\\n" - " lowp vec4 c00 = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - " lowp vec4 c01 = texelFetch(tex, ivec2(tcData[1]), 0); \\\n" - " lowp vec4 c10 = texelFetch(tex, ivec2(tcData[2]), 0); \\\n" - " lowp vec4 c11 = texelFetch(tex, ivec2(tcData[3]), 0); \\\n" - " if(uEnableAlphaTest == 1){ \\\n" // Calculate premultiplied color values - " c00.rgb *= c00.a; \\\n" - " c01.rgb *= c01.a; \\\n" - " c10.rgb *= c10.a; \\\n" - " c11.rgb *= c11.a; \\\n" - " } \\\n" - " lowp vec4 c0 = c00 + tcData[4].s * (c10-c00); \\\n" - " lowp vec4 c1 = c01 + tcData[4].s * (c11-c01); \\\n" - " name = c0 + tcData[4].t * (c1-c0); \\\n" - " if(uEnableAlphaTest == 1) name.rgb /= name.a; \\\n" - "} \n" - ; - break; - } - shaderPart += - "#define READ_TEX(name, tex, tcData, fbMonochrome, fbFixedAlpha) \\\n" - " { \\\n" - " if (fbMonochrome == 3) { \\\n" - " mediump ivec2 coord = ivec2(gl_FragCoord.xy); \\\n" - " name = texelFetch(tex, coord, 0); \\\n" - " } else { \\\n" - " if (uTextureFilterMode == 0) \\\n" - " { \\\n" - " TEX_NEAREST(name, tex, tcData); \\\n" - " } \\\n" - " else TEX_FILTER(name, tex, tcData); \\\n" - " } \\\n" - " if (fbMonochrome == 1) name = vec4(name.r); \\\n" - " else if (fbMonochrome == 2) \\\n" - " name.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), name.rgb)); \\\n" - " else if (fbMonochrome == 3) { \\\n" - " name.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), name.rgb)); \\\n" - " name.a = 0.0; \\\n" - " } \\\n" - " if (fbFixedAlpha == 1) name.a = 0.825; \\\n" - " } \n" - ; - } - - if (g_textureConvert.useYUVCoversion()) { - shaderPart += - "uniform lowp ivec2 uTextureFormat; \n" - "uniform lowp int uTextureConvert; \n" - "uniform mediump ivec4 uConvertParams; \n" - "#define YUVCONVERT(name, format) \\\n" - " mediump ivec4 icolor = ivec4(name*255.0); \\\n" - " if (format == 1) \\\n" - " icolor.rg -= 128; \\\n" - " mediump ivec4 iconvert; \\\n" - " iconvert.r = icolor.b + (uConvertParams[0]*icolor.g + 128)/256; \\\n" - " iconvert.g = icolor.b + (uConvertParams[1]*icolor.r + uConvertParams[2]*icolor.g + 128)/256; \\\n" - " iconvert.b = icolor.b + (uConvertParams[3]*icolor.r + 128)/256; \\\n" - " iconvert.a = icolor.b; \\\n" - " name = vec4(iconvert)/255.0; \n" - "#define YUVCONVERT_TEX0(name, tex, tcData, format) \\\n" - " { \\\n" - " name = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - " YUVCONVERT(name, format) \\\n" - " } \n" - "#define YUVCONVERT_TEX1(name, tex, tcData, format, prev) \\\n" - " { \\\n" - " if (uTextureConvert != 0) name = prev; \\\n" - " else name = texelFetch(tex, ivec2(tcData[0]), 0); \\\n" - " YUVCONVERT(name, format) \\\n" - " } \n" - ; - } - - } else { - if (g_textureConvert.useTextureFiltering()) { - shaderPart += - "uniform lowp int uTextureFilterMode; \n" - "lowp vec4 readTex(in sampler2D tex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha); \n" - ; - } - if (g_textureConvert.useYUVCoversion()) { - shaderPart += - "uniform lowp ivec2 uTextureFormat; \n" - "uniform lowp int uTextureConvert; \n" - "uniform mediump ivec4 uConvertParams; \n" - "lowp vec4 YUV_Convert(in sampler2D tex, in highp vec2 tcData[5], in lowp int convert, in lowp int format, in lowp vec4 prev); \n" - ; - } - } - - shader << shaderPart; - } - -private: - const opengl::GLInfo& m_glinfo; -}; - -class ShaderFragmentHeaderReadTexCopyMode : public ShaderPart -{ -public: - ShaderFragmentHeaderReadTexCopyMode (const opengl::GLInfo & _glinfo) - { - if (!_glinfo.isGLES2) { - m_part = - "#define READ_TEX(name, tex, tcData, fbMonochrome, fbFixedAlpha) \\\n" - " { \\\n" - " if (fbMonochrome == 3) { \\\n" - " mediump ivec2 coord = ivec2(gl_FragCoord.xy); \\\n" - " name = texelFetch(tex, coord, 0); \\\n" - " } else { \\\n" - " name = texelFetch(tex, ivec2(tcData[0]),0); \\\n" - " } \\\n" - " if (fbMonochrome == 1) name = vec4(name.r); \\\n" - " else if (fbMonochrome == 2) \\\n" - " name.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), name.rgb)); \\\n" - " else if (fbMonochrome == 3) { \\\n" - " name.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), name.rgb)); \\\n" - " name.a = 0.0; \\\n" - " } \\\n" - " if (fbFixedAlpha == 1) name.a = 0.825; \\\n" - " } \n" - ; - } else { - m_part = - "lowp vec4 readTex(in sampler2D tex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha); \n" - ; - } - } -}; - -class ShaderFragmentMain : public ShaderPart -{ -public: - ShaderFragmentMain(const opengl::GLInfo & _glinfo) - { - m_part = - "void main() \n" - "{ \n" - ; - if (!_glinfo.isGLES2) { - m_part += - " highp float fragDepth = writeDepth(); \n" - ; - } - m_part += - " lowp vec4 vec_color; \n" - " lowp float alpha1; \n" - " lowp vec3 color1, input_color; \n" - ; - if (config.generalEmulation.enableClipping != 0) - m_part += - " lowp vec4 shadeColor = vShadeColorNoperspective; \n" - ; - else - m_part += - " lowp vec4 shadeColor = uScreenSpaceTriangle == 0 ? vShadeColor : vShadeColorNoperspective; \n" - ; - - m_part += "#define WRAP(x, low, high) mod((x)-(low), (high)-(low)) + (low) \n"; // Return wrapped value of x in interval [low, high) - // m_part += "#define WRAP(x, low, high) (x) - ((high)-(low)) * floor(((x)-(low))/((high)-(low))) \n"; // Perhaps more compatible? - // m_part += "#define WRAP(x, low, high) (x) + ((high)-(low)) * (1.0-step(low,x)) - ((high)-(low)) * step(high,x) \n"; // Step based version. Only wraps correctly if input is in the range [low-(high-low), high + (high-low)). Similar to old code. - } - -}; - -class ShaderFragmentMain2Cycle : public ShaderPart -{ -public: - ShaderFragmentMain2Cycle(const opengl::GLInfo & _glinfo) - { - m_part = - "void main() \n" - "{ \n" - ; - if (!_glinfo.isGLES2) { - m_part += - " highp float fragDepth = writeDepth(); \n" - ; - } - m_part += - " lowp vec4 vec_color, combined_color; \n" - " lowp float alpha1, alpha2; \n" - " lowp vec3 color1, color2, input_color; \n" - ; - if (config.generalEmulation.enableClipping != 0) - m_part += - " lowp vec4 shadeColor = vShadeColorNoperspective; \n" - ; - else - m_part += - " lowp vec4 shadeColor = uScreenSpaceTriangle == 0 ? vShadeColor : vShadeColorNoperspective; \n" - ; - - m_part += "#define WRAP(x, low, high) mod((x)-(low), (high)-(low)) + (low) \n"; // Return wrapped value of x in interval [low, high) - // m_part += "#define WRAP(x, low, high) (x) - ((high)-(low)) * floor(((x)-(low))/((high)-(low))) \n"; // Perhaps more compatible? - // m_part += "#define WRAP(x, low, high) (x) + (2.0) * (1.0-step(low,x)) - (2.0) * step(high,x) \n"; // Step based version. Only wraps correctly if input is in the range [low-(high-low), high + (high-low)). Similar to old code. - } -}; - -class ShaderFragmentBlendMux : public ShaderPart -{ -public: - ShaderFragmentBlendMux(const opengl::GLInfo & _glinfo) - { - if (config.generalEmulation.enableLegacyBlending == 0) { - m_part = - " #define MUXA(pos) dot(muxA, STVEC(pos)) \n" - " #define MUXB(pos) dot(muxB, STVEC(pos)) \n" - " #define MUXPM(pos) muxPM*(STVEC(pos)) \n" - " #define MUXF(pos) dot(muxF, STVEC(pos)) \n" - " lowp vec4 lastFragColor = LAST_FRAG_COLOR; \n" - " lowp float lastFragAlpha = LAST_FRAG_ALPHA; \n" - " lowp mat4 muxPM = mat4(vec4(0.0), lastFragColor, uBlendColor, uFogColor); \n" - " lowp vec4 muxA = vec4(0.0, uFogColor.a, shadeColor.a, 0.0); \n" - " lowp vec4 muxB = vec4(0.0, lastFragAlpha, 1.0, 0.0); \n" - " lowp vec4 muxF = vec4(0.0, 1.0, 0.0, 0.0); \n" - " lowp vec4 muxp, muxm, srcColor1, srcColor2; \n" - " lowp float muxa, muxb, dstFactor1, dstFactor2, muxaf, muxbf; \n" - ; - } - } -}; - -class ShaderFragmentReadTexMipmap : public ShaderPart -{ -public: - ShaderFragmentReadTexMipmap(const opengl::GLInfo & _glinfo) - { - m_part = - " lowp vec4 readtex0, readtex1; \n" - " lowp float lod_frac = mipmap(readtex0, readtex1); \n" - ; - } -}; - -class ShaderFragmentReadTexCopyMode : public ShaderPart -{ -public: - ShaderFragmentReadTexCopyMode(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - " nCurrentTile = 0; \n" - " lowp vec4 readtex0 = readTex(uTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]); \n" - ; - } else { - if (config.video.multisampling > 0) { - m_part = - " lowp vec4 readtex0; \n" - " if (uMSTexEnabled[0] == 0) { \n" - " READ_TEX(readtex0, uTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]) \n" - " } else readtex0 = readTexMS(uMSTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]);\n" - ; - } else { - m_part = - " lowp vec4 readtex0; \n" - " READ_TEX(readtex0, uTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]) \n" - ; - } - } - } -}; - -class ShaderFragmentReadTex0 : public ShaderPart -{ -public: - ShaderFragmentReadTex0(const opengl::GLInfo & _glinfo) : m_glinfo(_glinfo) - { - } - - void write(std::stringstream & shader) const override - { - std::string shaderPart; - - if (m_glinfo.isGLES2) { - - shaderPart = " nCurrentTile = 0; \n"; - if (g_textureConvert.getBilerp0()) { - shaderPart += " lowp vec4 readtex0 = readTex(uTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]); \n"; - } else { - shaderPart += " lowp vec4 tmpTex = vec4(0.0); \n" - " lowp vec4 readtex0 = YUV_Convert(uTex0, tcData0, 0, uTextureFormat[0], tmpTex); \n"; - } - - } else { - - if (!g_textureConvert.getBilerp0()) { - shaderPart = " lowp vec4 readtex0; \n" - " YUVCONVERT_TEX0(readtex0, uTex0, tcData0, uTextureFormat[0]) \n"; - } else { - if (config.video.multisampling > 0) { - shaderPart = - " lowp vec4 readtex0; \n" - " if (uMSTexEnabled[0] == 0) { \n" - " READ_TEX(readtex0, uTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]) \n" - " } else readtex0 = readTexMS(uMSTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]); \n"; - } else { - shaderPart = " lowp vec4 readtex0; \n" - " READ_TEX(readtex0, uTex0, tcData0, uFbMonochrome[0], uFbFixedAlpha[0]) \n"; - } - } - - } - - shader << shaderPart; - } - -private: - const opengl::GLInfo& m_glinfo; -}; - -class ShaderFragmentReadTex1 : public ShaderPart -{ -public: - ShaderFragmentReadTex1(const opengl::GLInfo & _glinfo) : m_glinfo(_glinfo) - { - } - - void write(std::stringstream & shader) const override - { - std::string shaderPart; - - if (m_glinfo.isGLES2) { - - shaderPart = " nCurrentTile = 1; \n"; - - if (g_textureConvert.getBilerp1()) { - shaderPart += " lowp vec4 readtex1 = readTex(uTex1, tcData1, uFbMonochrome[1], uFbFixedAlpha[1]); \n"; - } else { - shaderPart += " lowp vec4 readtex1 = YUV_Convert(uTex1, tcData1, uTextureConvert, uTextureFormat[1], readtex0); \n"; - } - - } else { - - if (!g_textureConvert.getBilerp1()) { - shaderPart = - " lowp vec4 readtex1; \n" - " YUVCONVERT_TEX1(readtex1, uTex1, tcData1, uTextureFormat[1], readtex0) \n"; - } else { - if (config.video.multisampling > 0) { - shaderPart = - " lowp vec4 readtex1; \n" - " if (uMSTexEnabled[1] == 0) { \n" - " READ_TEX(readtex1, uTex1, tcData1, uFbMonochrome[1], uFbFixedAlpha[1]) \n" - " } else readtex1 = readTexMS(uMSTex1, tcData1, uFbMonochrome[1], uFbFixedAlpha[1]); \n"; - } else { - shaderPart = " lowp vec4 readtex1; \n" - " READ_TEX(readtex1, uTex1, tcData1, uFbMonochrome[1], uFbFixedAlpha[1]) \n"; - - } - } - - } - - shader << shaderPart; - } - -private: - const opengl::GLInfo& m_glinfo; -}; - -class ShaderFragmentCallN64Depth : public ShaderPart -{ -public: - ShaderFragmentCallN64Depth(const opengl::GLInfo & _glinfo) - { - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - m_part = " bool should_discard = false; \n"; - - if (_glinfo.imageTextures && !_glinfo.n64DepthWithFbFetch) { - if (_glinfo.fragment_interlock) - m_part += " beginInvocationInterlockARB(); \n"; - else if (_glinfo.fragment_interlockNV) - m_part += " beginInvocationInterlockNV(); \n"; - else if (_glinfo.fragment_ordering) - m_part += " beginFragmentShaderOrderingINTEL(); \n"; - } - - m_part += - " if (uRenderTarget != 0) { if (!depth_render(fragColor.r, fragDepth)) should_discard = true; } \n" - " else if (!depth_compare(fragDepth)) should_discard = true; \n" - ; - - if (_glinfo.imageTextures & !_glinfo.n64DepthWithFbFetch) { - if (_glinfo.fragment_interlock) - m_part += " endInvocationInterlockARB(); \n"; - else if (_glinfo.fragment_interlockNV) - m_part += " endInvocationInterlockNV(); \n"; - } - - m_part += " if (should_discard) discard; \n"; - - } - } -}; - -class ShaderFragmentRenderTarget : public ShaderPart -{ -public: - ShaderFragmentRenderTarget(const opengl::GLInfo & _glinfo) - { - if (config.generalEmulation.enableFragmentDepthWrite != 0) { - m_part = - " if (uRenderTarget != 0) { \n" - " if (uRenderTarget > 1) { \n" - " ivec2 coord = ivec2(gl_FragCoord.xy); \n" - " if (fragDepth >= texelFetch(uDepthTex, coord, 0).r) discard; \n" - " } \n" - " fragDepth = fragColor.r; \n" - " } \n" - " gl_FragDepth = fragDepth; \n" - ; - } - } -}; - -class ShaderFragmentMainEnd : public ShaderPart -{ -public: - ShaderFragmentMainEnd(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - " gl_FragColor = fragColor; \n" - "} \n\n"; - } else { - m_part = - "} \n\n" - ; - } - } -}; - -class ShaderNoise : public ShaderPart -{ -public: - ShaderNoise(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "uniform sampler2D uTexNoise; \n" - "lowp float snoise() \n" - "{ \n" - " mediump vec2 texSize = vec2(640.0, 580.0); \n" - " mediump vec2 coord = gl_FragCoord.xy/uScreenScale/texSize; \n" - " return texture2D(uTexNoise, coord).r; \n" - "} \n" - ; - } else { - m_part = - "uniform sampler2D uTexNoise; \n" - "lowp float snoise() \n" - "{ \n" - " ivec2 coord = ivec2(gl_FragCoord.xy/uScreenScale); \n" - " return texelFetch(uTexNoise, coord, 0).r; \n" - "} \n" - ; - } - } -}; - -class ShaderDither : public ShaderPart -{ -public: - ShaderDither(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) - return; - - if (config.generalEmulation.enableDitheringQuantization != 0) { - m_part = - "void quantizeRGB(inout lowp vec3 _color) \n" - "{ \n" - " _color.rgb = round(_color.rgb * 32.0)/32.0; \n" - "} \n" - "void quantizeA(inout lowp float _alpha) \n" - "{ \n" - " _alpha = round(_alpha * 32.0)/32.0; \n" - "} \n" - ; - } else { - m_part = - "void quantizeRGB(inout lowp vec3 _color){}\n" - "void quantizeA(inout lowp float _alpha){}\n" - ; - } - - m_part += - "void colorDither(in lowp vec3 _noise, inout lowp vec3 _color)\n" - "{ \n" - " mediump vec3 threshold = 7.0 / 255.0 * (_noise - 0.5); \n" - " _color = clamp(_color + threshold,0.0,1.0); \n" - " quantizeRGB(_color); \n" - "} \n" - "void alphaDither(in lowp float _noise, inout lowp float _alpha)\n" - "{ \n" - " mediump float threshold = 7.0 / 255.0 * (_noise - 0.5); \n" - " _alpha = clamp(_alpha + threshold,0.0,1.0); \n" - " quantizeA(_alpha); \n" - "} \n" - "lowp vec3 snoiseRGB() \n" - "{ \n" - " mediump vec2 texSize = vec2(640.0, 580.0); \n" - ; - if (config.generalEmulation.enableHiresNoiseDithering != 0) - // multiplier for higher res noise effect - m_part += - " lowp float mult = 1.0 + step(2.0, uScreenScale.x); \n"; - else - m_part += - " lowp float mult = 1.0; \n"; - m_part += - " mediump vec2 coordR = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n" - " mediump vec2 coordG = mult * ((gl_FragCoord.xy + vec2( 0.0, texSize.y / 2.0 ))/uScreenScale/texSize);\n" - " mediump vec2 coordB = mult * ((gl_FragCoord.xy + vec2( texSize.x / 2.0, 0.0))/uScreenScale/texSize);\n" - // Only red channel of noise texture contains noise. - " lowp float r = texture(uTexNoise,coordR).r; \n" - " lowp float g = texture(uTexNoise,coordG).r; \n" - " lowp float b = texture(uTexNoise,coordB).r; \n" - " \n" - " return vec3(r,g,b); \n" - "} \n" - "lowp float snoiseA() \n" - "{ \n" - " mediump vec2 texSize = vec2(640.0, 580.0); \n" - ; - if (config.generalEmulation.enableHiresNoiseDithering != 0) - // multiplier for higher res noise effect - m_part += - " lowp float mult = 1.0 + step(2.0, uScreenScale.x); \n"; - else - m_part += - " lowp float mult = 1.0; \n"; - m_part += - " \n" - " mediump vec2 coord = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n" - " \n" - // Only red channel of noise texture contains noise. - " return texture(uTexNoise,coord).r; \n" - "} \n" - ; - } -}; - -class ShaderWriteDepth : public ShaderPart -{ -public: - ShaderWriteDepth(const opengl::GLInfo & _glinfo) - { - if (!_glinfo.isGLES2) { - if (config.generalEmulation.enableFragmentDepthWrite == 0 && - config.frameBufferEmulation.N64DepthCompare == Config::dcDisable) { - // Dummy write depth - m_part = - "highp float writeDepth() \n" - "{ \n" - " return 0.0; \n" - "} \n" - ; - } else { - if ((config.generalEmulation.hacks & hack_RE2) != 0) { - m_part = - "uniform lowp usampler2D uZlutImage;\n" - "highp float writeDepth() \n" - "{ \n" - ; - if (_glinfo.isGLESX) { - if (_glinfo.noPerspective) { - m_part += - " if (uClampMode == 1 && (vZCoord > 1.0)) discard; \n" - " highp float FragDepth = (uDepthSource != 0) ? uPrimDepth : \n" - " clamp((vZCoord - uPolygonOffset) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - ; - } else if (config.generalEmulation.enableClipping != 0) { - m_part += - " highp float FragDepth = (uDepthSource != 0) ? uPrimDepth : \n" - " clamp(8.0 * (gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - ; - } else { - m_part += - " highp float FragDepth = (uDepthSource != 0) ? uPrimDepth : \n" - " clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - ; - } - } else { - m_part += - " highp float FragDepth = (uDepthSource != 0) ? uPrimDepth : \n" - " clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - ; - } - m_part += - " highp int iZ = FragDepth > 0.999 ? 262143 : int(floor(FragDepth * 262143.0)); \n" - " mediump int y0 = clamp(iZ/512, 0, 511); \n" - " mediump int x0 = iZ - 512*y0; \n" - " highp uint iN64z = texelFetch(uZlutImage,ivec2(x0,y0), 0).r; \n" - " return clamp(float(iN64z)/65532.0, 0.0, 1.0); \n" - "} \n" - ; - } else { - if (_glinfo.isGLESX) { - if (_glinfo.noPerspective) { - m_part = - "highp float writeDepth() \n" - "{ \n" - " if (uClampMode == 1 && (vZCoord > 1.0)) discard; \n" - " if (uDepthSource != 0) return uPrimDepth; \n" - " return clamp((vZCoord - uPolygonOffset) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - "} \n" - ; - } else if (config.generalEmulation.enableClipping != 0) { - m_part = - "highp float writeDepth() \n" - "{ \n" - " if (uDepthSource != 0) return uPrimDepth; \n" - " return clamp(8.0 * (gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - "} \n" - ; - } else { - m_part = - "highp float writeDepth() \n" - "{ \n" - " if (uDepthSource != 0) return uPrimDepth; \n" - " return clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - "} \n" - ; - } - } else { - m_part = - "highp float writeDepth() \n" - "{ \n" - " if (uDepthSource != 0) return uPrimDepth; \n" - " return clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - "} \n" - ; - } - } - } - } - } -}; - -class ShaderMipmap : public ShaderPart -{ -public: - ShaderMipmap(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "uniform mediump vec2 uTextureSize[2]; \n" - "lowp vec4 TextureMipMap(in sampler2D tex, in highp vec2 tcData[5], in lowp float lod) \n" - "{ \n" - " mediump vec2 texSize; \n" - " if (nCurrentTile == 0) \n" - " texSize = uTextureSize[0]; \n" - " else \n" - " texSize = uTextureSize[1]; \n" - " lowp vec4 c00 = texture2DLodEXT(tex, (tcData[0] + 0.5)/texSize, lod); \n" - " lowp vec4 c01 = texture2DLodEXT(tex, (tcData[1] + 0.5)/texSize, lod); \n" - " lowp vec4 c10 = texture2DLodEXT(tex, (tcData[2] + 0.5)/texSize, lod); \n" - " lowp vec4 c11 = texture2DLodEXT(tex, (tcData[3] + 0.5)/texSize, lod); \n" - " lowp vec4 c0 = c00 + tcData[4].s * (c10-c00); \n" - " lowp vec4 c1 = c01 + tcData[4].s * (c11-c01); \n" - " return c0 + tcData[4].t * (c1-c0); \n" - " } \n" - ; - if (config.generalEmulation.enableLOD == 0) { - // Fake mipmap - m_part += - "uniform lowp int uMaxTile; \n" - "uniform mediump float uMinLod; \n" - " \n" - "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1) { \n" - " readtex0 = TextureMipMap(uTex0, tcData0, 0.0); \n" - " readtex1 = TextureMipMap(uTex1, tcData1, 0.0); \n" - " if (uMaxTile == 0) return 1.0; \n" - " return uMinLod; \n" - "} \n" - ; - } else { - m_part += - "uniform lowp int uEnableLod; \n" - "uniform mediump float uMinLod; \n" - "uniform lowp int uMaxTile; \n" - "uniform lowp int uTextureDetail; \n" - " \n" - "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1) { \n" - " readtex0 = TextureMipMap(uTex0, tcData0, 0.0); \n" - " readtex1 = TextureMipMap(uTex1, tcData1, 0.0); \n" - " \n" - " mediump float fMaxTile = float(uMaxTile); \n" - " mediump vec2 dx = abs(dFdx(vLodTexCoord)) * uScreenScale; \n" - " mediump vec2 dy = abs(dFdy(vLodTexCoord)) * uScreenScale; \n" - " mediump float lod = max(dx.x + dx.y, dy.x + dy.y); \n" /*LINEAR*/ - " bool magnify = lod < 1.0; \n" - " mediump float lod_tile = magnify ? 0.0 : floor(log2(floor(lod))); \n" - " bool distant = lod > 128.0 || lod_tile >= fMaxTile; \n" - " mediump float lod_frac = fract(lod/pow(2.0, lod_tile)); \n" - " if (magnify) lod_frac = max(lod_frac, uMinLod); \n" - " if (uTextureDetail == 0) { \n" - " if (distant) lod_frac = 1.0; \n" - " else if (magnify) lod_frac = 0.0; \n" - " } \n" - " if (magnify && (uTextureDetail == 1 || uTextureDetail == 3)) \n" - " lod_frac = 1.0 - lod_frac; \n" - " if (uMaxTile == 0) { \n" - " if (uEnableLod != 0) { \n" - " if (uTextureDetail < 2) readtex1 = readtex0; \n" - " else if (!magnify) readtex0 = readtex1; \n" - " } \n" - " return lod_frac; \n" - " } \n" - " if (uEnableLod == 0) return lod_frac; \n" - " \n" - " lod_tile = min(lod_tile, fMaxTile); \n" - " lowp float lod_tile_m1 = max(0.0, lod_tile - 1.0); \n" - " lowp float lod_tile_p1 = min(fMaxTile - 1.0, lod_tile + 1.0); \n" - " lowp vec4 lodT = TextureMipMap(uTex1, tcData1, lod_tile); \n" - " lowp vec4 lodT_m1 = TextureMipMap(uTex1, tcData1, lod_tile_m1); \n" - " lowp vec4 lodT_p1 = TextureMipMap(uTex1, tcData1, lod_tile_p1); \n" - " if (lod_tile < 1.0) { \n" - " if (magnify) { \n" - // !sharpen && !detail - " if (uTextureDetail == 0) readtex1 = readtex0; \n" - " } else { \n" - // detail - " if (uTextureDetail > 1) { \n" - " readtex0 = lodT; \n" - " readtex1 = lodT_p1; \n" - " } \n" - " } \n" - " } else { \n" - " if (uTextureDetail > 1) { \n" - " readtex0 = lodT; \n" - " readtex1 = lodT_p1; \n" - " } else { \n" - " readtex0 = lodT_m1; \n" - " readtex1 = lodT; \n" - " } \n" - " } \n" - " return lod_frac; \n" - "} \n" - ; - } - } - else { - if (config.texture.bilinearMode == BILINEAR_3POINT) - m_part = - "#define READ_TEX_MIPMAP(name, tex, tcData, lod) \\\n" - "{ \\\n" - " lowp float bottomRightTri = step(1.0, tcData[4].s + tcData[4].t); \\\n" - " lowp vec2 lod_scale = vec2(textureSize(tex,int(lod))) / vec2(textureSize(tex,0)); \\\n" - " lowp vec4 c00 = texelFetch(tex, ivec2(tcData[0]*lod_scale), int(lod)); \\\n" - " lowp vec4 c01 = texelFetch(tex, ivec2(tcData[1]*lod_scale), int(lod)); \\\n" - " lowp vec4 c10 = texelFetch(tex, ivec2(tcData[2]*lod_scale), int(lod)); \\\n" - " lowp vec4 c11 = texelFetch(tex, ivec2(tcData[3]*lod_scale), int(lod)); \\\n" - " lowp vec4 c0 = c00 + tcData[4].s*(c10-c00) + tcData[4].t*(c01-c00); \\\n" - " lowp vec4 c1 = c11 + (1.0-tcData[4].s)*(c01-c11) + (1.0-tcData[4].t)*(c10-c11); \\\n" - " name = c0 + bottomRightTri * (c1-c0); \\\n" - "} \n" - ; - else - m_part = - "#define READ_TEX_MIPMAP(name, tex, tcData, lod) \\\n" - "{ \\\n" - " lowp vec2 lod_scale = vec2(textureSize(tex,int(lod))) / vec2(textureSize(tex,0)); \\\n" - " lowp vec4 c00 = texelFetch(tex, ivec2(tcData[0]*lod_scale), int(lod)); \\\n" - " lowp vec4 c01 = texelFetch(tex, ivec2(tcData[1]*lod_scale), int(lod)); \\\n" - " lowp vec4 c10 = texelFetch(tex, ivec2(tcData[2]*lod_scale), int(lod)); \\\n" - " lowp vec4 c11 = texelFetch(tex, ivec2(tcData[3]*lod_scale), int(lod)); \\\n" - " lowp vec4 c0 = c00 + tcData[4].s * (c10-c00); \\\n" - " lowp vec4 c1 = c01 + tcData[4].s * (c11-c01); \\\n" - " name = c0 + tcData[4].t * (c1-c0); \\\n" - "} \n" - ; - if (config.generalEmulation.enableLOD == 0) { - // Fake mipmap - m_part += - "uniform lowp int uMaxTile; \n" - "uniform mediump float uMinLod; \n" - " \n" - "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1) { \n" - " READ_TEX_MIPMAP(readtex0, uTex0, tcData0, 0); \n" - " READ_TEX_MIPMAP(readtex1, uTex1, tcData1, 0); \n" - " if (uMaxTile == 0) return 1.0; \n" - " return uMinLod; \n" - "} \n" - ; - } else { - m_part += - "uniform lowp int uEnableLod; \n" - "uniform mediump float uMinLod; \n" - "uniform lowp int uMaxTile; \n" - "uniform lowp int uTextureDetail; \n" - " \n" - "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1) { \n" - " READ_TEX_MIPMAP(readtex0, uTex0, tcData0, 0); \n" - " READ_TEX_MIPMAP(readtex1, uTex1, tcData1, 0); \n" - " \n" - " mediump float fMaxTile = float(uMaxTile); \n" - " mediump vec2 dx = abs(dFdx(vLodTexCoord)); \n" - " dx *= uScreenScale; \n" - " mediump float lod = max(dx.x, dx.y); \n" - " bool magnify = lod < 1.0; \n" - " mediump float lod_tile = magnify ? 0.0 : floor(log2(floor(lod))); \n" - " bool distant = lod > 128.0 || lod_tile >= fMaxTile; \n" - " mediump float lod_frac = fract(lod/pow(2.0, lod_tile)); \n" - " if (magnify) lod_frac = max(lod_frac, uMinLod); \n" - " if (uTextureDetail == 0) { \n" - " if (distant) lod_frac = 1.0; \n" - " else if (magnify) lod_frac = 0.0; \n" - " } \n" - " if (magnify && ((uTextureDetail & 1) != 0)) \n" - " lod_frac = 1.0 - lod_frac; \n" - " if (uMaxTile == 0) { \n" - " if (uEnableLod != 0) { \n" - " if ((uTextureDetail & 2) == 0) readtex1 = readtex0; \n" - " else if (!magnify) readtex0 = readtex1; \n" - " } \n" - " return lod_frac; \n" - " } \n" - " if (uEnableLod == 0) return lod_frac; \n" - " \n" - " lod_tile = min(lod_tile, fMaxTile - 1.0); \n" - " lowp float lod_tile_m1 = max(0.0, lod_tile - 1.0); \n" - " lowp float lod_tile_p1 = min(fMaxTile - 1.0, lod_tile + 1.0); \n" - " lowp vec4 lodT, lodT_m1, lodT_p1; \n" - " READ_TEX_MIPMAP(lodT, uTex1, tcData1, lod_tile); \n" - " READ_TEX_MIPMAP(lodT_m1, uTex1, tcData1, lod_tile_m1); \n" - " READ_TEX_MIPMAP(lodT_p1, uTex1, tcData1, lod_tile_p1); \n" - " if (lod_tile < 1.0) { \n" - " if (magnify) { \n" - // !sharpen && !detail - " if (uTextureDetail == 0) readtex1 = readtex0; \n" - " } else { \n" - // detail - " if ((uTextureDetail & 2) != 0 ) { \n" - " readtex0 = lodT; \n" - " readtex1 = lodT_p1; \n" - " } \n" - " } \n" - " } else { \n" - " if ((uTextureDetail & 2) != 0 ) { \n" - " readtex0 = lodT; \n" - " readtex1 = lodT_p1; \n" - " } else { \n" - " readtex0 = lodT_m1; \n" - " readtex1 = lodT; \n" - " } \n" - " } \n" - " return lod_frac; \n" - "} \n" - ; - } - } - } -}; - -class ShaderCalcLight : public ShaderPart -{ -public: - ShaderCalcLight(const opengl::GLInfo & /*_glinfo*/) - { - m_part = - "uniform mediump vec3 uLightDirection[8]; \n" - "uniform lowp vec3 uLightColor[8]; \n" - "void calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color) {\n" - " output_color = input_color; \n" - " lowp int nLights = int(floor(fLights + 0.5)); \n" - " if (nLights == 0) \n" - " return; \n" - " output_color = uLightColor[nLights]; \n" - " mediump float intensity; \n" - " for (int i = 0; i < nLights; i++) { \n" - " intensity = max(dot(input_color, uLightDirection[i]), 0.0);\n" - " output_color += intensity*uLightColor[i]; \n" - " }; \n" - " output_color = clamp(output_color, 0.0, 1.0); \n" - "} \n" - ; - } -}; - -class ShaderReadtex : public ShaderPart -{ -public: - ShaderReadtex(const opengl::GLInfo & _glinfo) : m_glinfo(_glinfo) - { - } - - void write(std::stringstream & shader) const override - { - std::string shaderPart; - - if (m_glinfo.isGLES2) { - shaderPart += - "uniform mediump vec2 uTextureSize[2]; \n" - "lowp vec4 TextureNearest(in sampler2D tex, in highp vec2 tcData[5]) \n" - "{ \n" - " mediump vec2 texSize; \n" - " if (nCurrentTile == 0) \n" - " texSize = uTextureSize[0]; \n" - " else \n" - " texSize = uTextureSize[1]; \n" - " return texture2D(tex, (tcData[0] + 0.5) / texSize); \n" - " } \n" - ; - if (g_textureConvert.useYUVCoversion()) - shaderPart += - "lowp vec4 YUV_Convert(in sampler2D tex, in highp vec2 tcData[5], in lowp int convert, in lowp int format, in lowp vec4 prev) \n" - "{ \n" - " lowp vec4 texColor; \n" - " if (convert != 0) texColor = prev; \n" - " else texColor = TextureNearest(tex, tcData); \n" - " mediump ivec4 icolor = ivec4(texColor*255.0); \n" - " if (format == 1) \n" - " icolor.rg -= 128; \n" - " mediump ivec4 iconvert; \n" - " iconvert.r = icolor.b + (uConvertParams[0]*icolor.g + 128)/256; \n" - " iconvert.g = icolor.b + (uConvertParams[1]*icolor.r + uConvertParams[2]*icolor.g + 128)/256; \n" - " iconvert.b = icolor.b + (uConvertParams[3]*icolor.r + 128)/256; \n" - " iconvert.a = icolor.b; \n" - " return vec4(iconvert)/255.0; \n" - " } \n" - ; - if (g_textureConvert.useTextureFiltering()) { - if (config.texture.bilinearMode == BILINEAR_3POINT) { - shaderPart += - // "uniform mediump vec2 uTextureSize[2]; \n" NOT NEEDED HERE? - // 3 point texture filtering. - // Original author: ArthurCarvalho - // GLSL implementation: twinaphex, mupen64plus-libretro project. - "lowp vec4 TextureFilter(in sampler2D tex, in highp vec2 tcData[5]) \n" - "{ \n" - " mediump vec2 texSize; \n" - " if (nCurrentTile == 0) \n" - " texSize = uTextureSize[0]; \n" - " else \n" - " texSize = uTextureSize[1]; \n" - " lowp float bottomRightTri = step(1.0, tcData[4].s + tcData[4].t); \n" - " lowp vec4 c00 = texture2D(tex, (tcData[0] + 0.5)/texSize); \n" - " lowp vec4 c01 = texture2D(tex, (tcData[1] + 0.5)/texSize); \n" - " lowp vec4 c10 = texture2D(tex, (tcData[2] + 0.5)/texSize); \n" - " lowp vec4 c11 = texture2D(tex, (tcData[3] + 0.5)/texSize); \n" - " lowp vec4 c0 = c00 + tcData[4].s*(c10-c00) + tcData[4].t*(c01-c00); \n" - " lowp vec4 c1 = c11 + (1.0-tcData[4].s)*(c01-c11) + (1.0-tcData[4].t)*(c10-c11); \n" - " return c0 + bottomRightTri * (c1-c0); \n" - " } \n" - ; - } else { - shaderPart += - // bilinear filtering. - //"uniform mediump vec2 uTextureSize[2]; \n" NOT NEEDED HERE? - "lowp vec4 TextureFilter(in sampler2D tex, in highp vec2 tcData[5]) \n" - "{ \n" - " mediump vec2 texSize; \n" - " if (nCurrentTile == 0) \n" - " texSize = uTextureSize[0]; \n" - " else \n" - " texSize = uTextureSize[1]; \n" - " lowp vec4 c00 = texture2D(tex, (tcData[0] + 0.5)/texSize); \n" - " lowp vec4 c01 = texture2D(tex, (tcData[1] + 0.5)/texSize); \n" - " lowp vec4 c10 = texture2D(tex, (tcData[2] + 0.5)/texSize); \n" - " lowp vec4 c11 = texture2D(tex, (tcData[3] + 0.5)/texSize); \n" - " lowp vec4 c0 = c00 + tcData[4].s * (c10-c00); \n" - " lowp vec4 c1 = c01 + tcData[4].s * (c11-c01); \n" - " return c0 + tcData[4].t * (c1-c0); \n" - " } \n" - ; - } - shaderPart += - "lowp vec4 readTex(in sampler2D tex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha) \n" - "{ \n" - " lowp vec4 texColor; \n" - " if (uTextureFilterMode == 0) texColor = TextureNearest(tex, tcData); \n" - " else texColor = TextureFilter(tex, tcData); \n" - " if (fbMonochrome == 1) texColor = vec4(texColor.r); \n" - " else if (fbMonochrome == 2) \n" - " texColor.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), texColor.rgb)); \n" - " if (fbFixedAlpha == 1) texColor.a = 0.825; \n" - " return texColor; \n" - "} \n" - ; - } - } else { - if (config.video.multisampling > 0 && g_textureConvert.useTextureFiltering()) { - shaderPart = - "uniform lowp int uMSAASamples; \n" - "lowp vec4 sampleMS(in lowp sampler2DMS mstex, in mediump ivec2 ipos) \n" - "{ \n" - " lowp vec4 texel = vec4(0.0); \n" - " for (int i = 0; i < uMSAASamples; ++i) \n" - " texel += texelFetch(mstex, ipos, i); \n" - " return texel / float(uMSAASamples); \n" - "} \n" - " \n" - "lowp vec4 readTexMS(in lowp sampler2DMS mstex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha) \n" - "{ \n" - " mediump ivec2 itexCoord; \n" - " if (fbMonochrome == 3) { \n" - " itexCoord = ivec2(gl_FragCoord.xy); \n" - " } else { \n" - " itexCoord = ivec2(tcData[0]); \n" - " } \n" - " lowp vec4 texColor = sampleMS(mstex, itexCoord); \n" - " if (fbMonochrome == 1) texColor = vec4(texColor.r); \n" - " else if (fbMonochrome == 2) \n" - " texColor.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), texColor.rgb)); \n" - " else if (fbMonochrome == 3) { \n" - " texColor.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), texColor.rgb)); \n" - " texColor.a = 0.0; \n" - " } \n" - " if (fbFixedAlpha == 1) texColor.a = 0.825; \n" - " return texColor; \n" - "} \n" - ; - } - } - - shader << shaderPart; - } - -private: - const opengl::GLInfo& m_glinfo; -}; - -class ShaderReadtexCopyMode : public ShaderPart -{ -public: - ShaderReadtexCopyMode(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "uniform mediump vec2 uTextureSize[2]; \n" - "lowp vec4 TextureNearest(in sampler2D tex, in highp vec2 tcData[5]) \n" - "{ \n" - " mediump vec2 texSize; \n" - " if (nCurrentTile == 0) \n" - " texSize = uTextureSize[0]; \n" - " else \n" - " texSize = uTextureSize[1]; \n" - " return texture2D(tex, (tcData[0] + 0.5) / texSize); \n" - " } \n" - "lowp vec4 readTex(in sampler2D tex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha) \n" - "{ \n" - " lowp vec4 texColor = TextureNearest(tex, tcData); \n" - " if (fbMonochrome == 1) texColor = vec4(texColor.r); \n" - " else if (fbMonochrome == 2) \n" - " texColor.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), texColor.rgb)); \n" - " if (fbFixedAlpha == 1) texColor.a = 0.825; \n" - " return texColor; \n" - "} \n" - ; - } else { - if (config.video.multisampling > 0) { - m_part = - "uniform lowp int uMSAASamples; \n" - "lowp vec4 sampleMS(in lowp sampler2DMS mstex, in mediump ivec2 ipos) \n" - "{ \n" - " lowp vec4 texel = vec4(0.0); \n" - " for (int i = 0; i < uMSAASamples; ++i) \n" - " texel += texelFetch(mstex, ipos, i); \n" - " return texel / float(uMSAASamples); \n" - "} \n" - " \n" - "lowp vec4 readTexMS(in lowp sampler2DMS mstex, in highp vec2 tcData[5], in lowp int fbMonochrome, in lowp int fbFixedAlpha) \n" - "{ \n" - " mediump ivec2 itexCoord; \n" - " if (fbMonochrome == 3) { \n" - " itexCoord = ivec2(gl_FragCoord.xy); \n" - " } else { \n" - " itexCoord = ivec2(tcData[0]); \n" - " } \n" - " lowp vec4 texColor = sampleMS(mstex, itexCoord); \n" - " if (fbMonochrome == 1) texColor = vec4(texColor.r); \n" - " else if (fbMonochrome == 2) \n" - " texColor.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), texColor.rgb)); \n" - " else if (fbMonochrome == 3) { \n" - " texColor.rgb = vec3(dot(vec3(0.2126, 0.7152, 0.0722), texColor.rgb)); \n" - " texColor.a = 0.0; \n" - " } \n" - " if (fbFixedAlpha == 1) texColor.a = 0.825; \n" - " return texColor; \n" - "} \n" - ; - } - } - } -}; - -class ShaderN64DepthCompare : public ShaderPart -{ -public: - ShaderN64DepthCompare(const opengl::GLInfo & _glinfo) - { - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - m_part = - "uniform lowp int uEnableDepth; \n" - "uniform lowp int uDepthMode; \n" - "uniform lowp int uEnableDepthUpdate; \n" - "uniform mediump float uDeltaZ; \n" - "bool depth_compare(highp float curZ) \n" - "{ \n" - " if (uEnableDepth == 0) return true; \n" - ; - if (_glinfo.imageTextures && !_glinfo.n64DepthWithFbFetch) { - m_part += - " ivec2 coord = ivec2(gl_FragCoord.xy); \n" - " highp vec4 depthZ = imageLoad(uDepthImageZ,coord); \n" - " highp vec4 depthDeltaZ = imageLoad(uDepthImageDeltaZ,coord);\n" - ; - } - m_part += - " highp float bufZ = depthZ.r; \n" - " highp float dz, dzMin; \n" - " if (uDepthSource == 1) { \n" - " dzMin = dz = uDeltaZ; \n" - " } else { \n" - " dz = 4.0*fwidth(curZ); \n" - " dzMin = min(dz, depthDeltaZ.r); \n" - " } \n" - " bool bInfront = curZ < bufZ; \n" - " bool bFarther = (curZ + dzMin) >= bufZ; \n" - " bool bNearer = (curZ - dzMin) <= bufZ; \n" - " bool bMax = bufZ == 1.0; \n" - " bool bRes = false; \n" - " switch (uDepthMode) { \n" - " case 1: \n" - " bRes = bMax || bNearer; \n" - " break; \n" - " case 0: \n" - " case 2: \n" - " bRes = bMax || bInfront; \n" - " break; \n" - " case 3: \n" - " bRes = bFarther && bNearer && !bMax; \n" - " break; \n" - " } \n" - " bRes = bRes || (uEnableDepthCompare == 0); \n" - " if (uEnableDepthUpdate != 0 && bRes) { \n" - ; - if (_glinfo.n64DepthWithFbFetch) { - m_part += - " depthZ.r = curZ; \n" - " depthDeltaZ.r = dz; \n" - ; - } else if (_glinfo.imageTextures) { - m_part += - " highp vec4 depthOutZ = vec4(curZ, 1.0, 1.0, 1.0); \n" - " highp vec4 depthOutDeltaZ = vec4(dz, 1.0, 1.0, 1.0); \n" - " imageStore(uDepthImageZ, coord, depthOutZ); \n" - " imageStore(uDepthImageDeltaZ, coord, depthOutDeltaZ); \n" - ; - } - - m_part += - " } \n" - " return bRes; \n" - "} \n" - ; - } - } -}; - -class ShaderN64DepthRender : public ShaderPart -{ -public: - ShaderN64DepthRender(const opengl::GLInfo & _glinfo) - { - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - m_part = - "bool depth_render(highp float Z, highp float curZ) \n" - "{ \n" - " ivec2 coord = ivec2(gl_FragCoord.xy); \n" - " if (uEnableDepthCompare != 0) { \n" - ; - if (_glinfo.imageTextures && !_glinfo.n64DepthWithFbFetch) { - m_part += - " highp vec4 depthZ = imageLoad(uDepthImageZ,coord); \n" - ; - } - m_part += - " highp float bufZ = depthZ.r; \n" - " if (curZ >= bufZ) return false; \n" - " } \n" - ; - if (_glinfo.n64DepthWithFbFetch) { - m_part += - " depthZ.r = Z; \n" - " depthDeltaZ.r = 0.0; \n" - ; - } else if (_glinfo.imageTextures) { - m_part += - " highp vec4 depthOutZ = vec4(Z, 1.0, 1.0, 1.0); \n" - " highp vec4 depthOutDeltaZ = vec4(0.0, 1.0, 1.0, 1.0);\n" - " imageStore(uDepthImageZ,coord, depthOutZ); \n" - " imageStore(uDepthImageDeltaZ,coord, depthOutDeltaZ); \n" - ; - } - - m_part += - " return true; \n" - "} \n" - ; - } - } -}; - - -class ShaderFragmentCorrectTexCoords : public ShaderPart { -public: - ShaderFragmentCorrectTexCoords() { - m_part += - " highp vec2 mTexCoord0 = vTexCoord0 + vec2(0.0001); \n" - " highp vec2 mTexCoord1 = vTexCoord1 + vec2(0.0001); \n" - " mTexCoord0 += uTexCoordOffset[0]; \n" - " mTexCoord1 += uTexCoordOffset[1]; \n" - " if (uUseTexCoordBounds != 0) { \n" - " mTexCoord0 = clamp(mTexCoord0, uTexCoordBounds0.xy, uTexCoordBounds0.zw); \n" - " mTexCoord1 = clamp(mTexCoord1, uTexCoordBounds1.xy, uTexCoordBounds1.zw); \n" - " } \n" - ; - } -}; - - -class ShaderTextureEngine : public ShaderPart -{ -public: - ShaderTextureEngine(const opengl::GLInfo _glinfo) { - m_part = - "highp vec2 clampWrapMirror(in highp vec2 vTexCoord, in highp vec2 vWrap, \n" - " in highp vec2 vClamp, in lowp vec2 vWrapEn, in lowp vec2 vClampEn, in lowp vec2 vMirrorEn) \n" - "{ \n" - " highp vec2 texCoord = vTexCoord; \n" - " highp vec2 clampedCoord = clamp(texCoord, vec2(0.0), vClamp); \n" - " texCoord += vClampEn*(clampedCoord-texCoord); \n" - " lowp vec2 needMirror = step(vWrap, mod(texCoord, 2.0*vWrap)); \n" - " highp vec2 invertedCoord = mod(-texCoord-vec2(1.0), vWrap); \n" - " texCoord += vMirrorEn*needMirror*(invertedCoord-texCoord); \n" - " highp vec2 wrappedCoord = mod(texCoord,vWrap); \n" - " texCoord += vWrapEn*(wrappedCoord-texCoord); \n" - " return texCoord; \n" - "} \n" - - "highp vec2 wrap2D(in highp vec2 tc, in highp vec2 size) \n" - "{ \n" - " highp float divs = floor(tc.s / size.s); \n" - " highp float divt = floor((tc.t + divs) / size.t); \n" - " return vec2(tc.s - divs * size.s, tc.t + divs - divt*size.t); \n" - "} \n" - - "uniform highp vec2 uTexSize0; \n" - "void textureEngine0(in highp vec2 texCoord, out highp vec2 tcData[5]) \n" - "{ \n" - " mediump vec2 intPart = floor(texCoord); \n" - " highp vec2 tc00 = clampWrapMirror(intPart, uTexWrap0, uTexClamp0, uTexWrapEn0, uTexClampEn0, uTexMirrorEn0); \n" - " highp vec2 tc11 = clampWrapMirror(intPart + vec2(1.0,1.0), uTexWrap0, uTexClamp0, uTexWrapEn0, uTexClampEn0, uTexMirrorEn0); \n" - " tcData[0] = wrap2D(tc00, uTexSize0); \n" - " tcData[3] = wrap2D(tc11, uTexSize0); \n" - " tcData[1] = vec2(tcData[0].s, tcData[3].t); \n" - " tcData[2] = vec2(tcData[3].s, tcData[0].t); \n" - " tcData[4] = texCoord - intPart; \n" - "} \n" - - "uniform highp vec2 uTexSize1; \n" - "void textureEngine1(in highp vec2 texCoord, out highp vec2 tcData[5]) \n" - "{ \n" - " mediump vec2 intPart = floor(texCoord); \n" - " highp vec2 tc00 = clampWrapMirror(intPart, uTexWrap1, uTexClamp1, uTexWrapEn1, uTexClampEn1, uTexMirrorEn1); \n" - " highp vec2 tc11 = clampWrapMirror(intPart + vec2(1.0,1.0), uTexWrap1, uTexClamp1, uTexWrapEn1, uTexClampEn1, uTexMirrorEn1); \n" - " tcData[0] = wrap2D(tc00, uTexSize1); \n" - " tcData[3] = wrap2D(tc11, uTexSize1); \n" - " tcData[1] = vec2(tcData[0].s, tcData[3].t); \n" - " tcData[2] = vec2(tcData[3].s, tcData[0].t); \n" - " tcData[4] = texCoord - intPart; \n" - "} \n" - - ; - } -}; - - -class ShaderFragmentTextureEngineTex0 : public ShaderPart { -public: - ShaderFragmentTextureEngineTex0(const opengl::GLInfo _glinfo) - { - m_part = - "textureEngine0(mTexCoord0, tcData0); \n" - ; - } -}; - -class ShaderFragmentTextureEngineTex1 : public ShaderPart { -public: - ShaderFragmentTextureEngineTex1(const opengl::GLInfo _glinfo) - { - m_part = - "textureEngine1(mTexCoord1, tcData1); \n" - ; - } -}; - -class ShaderCoverage : public ShaderPart { -public: - ShaderCoverage() { - m_part = - "const highp vec2 bias[8] = vec2[8] (vec2(-0.5,-0.5), vec2(0.0, -0.5), vec2(-0.25,-0.25), vec2(0.25, -0.25), \n" - " vec2(-0.5, 0.0), vec2(0.0,0.0), vec2(-0.25,0.25), vec2(0.25,0.25)); \n" - "highp vec4 dBCdx = dFdx(vBaryCoords); \n" - "highp vec4 dBCdy = dFdy(vBaryCoords); \n" - "cvg = 0.0; \n" - "for (int i = 0; i<8; i++) { \n" - " highp vec2 currentBias = bias[i]; \n" - " highp vec4 baryCoordsBiased = vBaryCoords + dBCdx*currentBias.x + dBCdy * currentBias.y; \n" - " lowp vec4 inside = step(0.0, baryCoordsBiased); \n" - " cvg += 0.125 * inside[0] * inside[1] * inside[2] * inside[3]; \n" - "} \n" - ; - } -}; - - -/*---------------ShaderPartsEnd-------------*/ - -static -bool needClampColor() { - return g_cycleType <= G_CYC_2CYCLE; -} - -static -bool combinedColorC(const gDPCombine & _combine) { - if (g_cycleType != G_CYC_2CYCLE) - return false; - return _combine.mRGB1 == G_CCMUX_COMBINED; -} - -static -bool combinedAlphaC(const gDPCombine & _combine) { - if (g_cycleType != G_CYC_2CYCLE) - return false; - return _combine.mA1 == G_ACMUX_COMBINED; -} - -static -bool combinedColorABD(const gDPCombine & _combine) { - if (g_cycleType != G_CYC_2CYCLE) - return false; - if (_combine.aRGB1 == G_CCMUX_COMBINED) - return true; - if (_combine.saRGB1 == G_CCMUX_COMBINED || _combine.sbRGB1 == G_CCMUX_COMBINED) - return _combine.mRGB1 != G_CCMUX_0; - return false; -} - -static -bool combinedAlphaABD(const gDPCombine & _combine) { - if (g_cycleType != G_CYC_2CYCLE) - return false; - if (_combine.aA1 == G_ACMUX_COMBINED) - return true; - if (_combine.saA1 == G_ACMUX_COMBINED || _combine.sbA1 == G_ACMUX_COMBINED) - return _combine.mA1 != G_ACMUX_0; - return false; -} - -CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key, Combiner & _color, Combiner & _alpha, std::string & _strShader) -{ - gDPCombine combine; - combine.mux = _key.getMux(); - - std::stringstream ssShader; - - if (g_cycleType != G_CYC_2CYCLE) { - _correctFirstStageParams(_alpha.stage[0]); - _correctFirstStageParams(_color.stage[0]); - } else { - _correctFirstStageParams2Cyc(_alpha.stage[0]); - _correctFirstStageParams2Cyc(_color.stage[0]); - } - ssShader << " alpha1 = "; - CombinerInputs inputs = _compileCombiner(_alpha.stage[0], AlphaInput, ssShader); - // Simulate N64 color sign-extend. - if (combinedAlphaC(combine)) - m_signExtendAlphaC->write(ssShader); - else if (combinedAlphaABD(combine)) - m_signExtendAlphaABD->write(ssShader); - - if (g_cycleType < G_CYC_FILL) - m_alphaTest->write(ssShader); - - ssShader << " color1 = "; - inputs += _compileCombiner(_color.stage[0], ColorInput, ssShader); - // Simulate N64 color sign-extend. - if (combinedColorC(combine)) - m_signExtendColorC->write(ssShader); - else if (combinedColorABD(combine)) - m_signExtendColorABD->write(ssShader); - - if (g_cycleType == G_CYC_2CYCLE) { - - ssShader << " combined_color = vec4(color1, alpha1);" << std::endl; - if (_alpha.numStages == 2) { - ssShader << " alpha2 = "; - _correctSecondStageParams(_alpha.stage[1]); - inputs += _compileCombiner(_alpha.stage[1], AlphaInput, ssShader); - } - else - ssShader << " alpha2 = alpha1;" << std::endl; - - ssShader << " if (uCvgXAlpha != 0 && alpha2 < 0.125) discard;" << std::endl; - - if (_color.numStages == 2) { - ssShader << " color2 = "; - _correctSecondStageParams(_color.stage[1]); - inputs += _compileCombiner(_color.stage[1], ColorInput, ssShader); - } - else - ssShader << " color2 = color1;" << std::endl; - - ssShader << " lowp vec4 cmbRes = vec4(color2, alpha2);" << std::endl; - } - else { - if (g_cycleType < G_CYC_FILL) - ssShader << " if (uCvgXAlpha != 0 && alpha1 < 0.125) discard;" << std::endl; - ssShader << " lowp vec4 cmbRes = vec4(color1, alpha1);" << std::endl; - } - - // Simulate N64 color clamp. - if (needClampColor()) - m_clamp->write(ssShader); - else - ssShader << " lowp vec4 clampedColor = clamp(cmbRes, 0.0, 1.0);" << std::endl; - - if (g_cycleType <= G_CYC_2CYCLE) { - m_callDither->write(ssShader); - - ssShader << "if (uCvgXAlpha != 0) cvg *= clampedColor.a;" << std::endl; - ssShader << "if (uAlphaCvgSel != 0) clampedColor.a = cvg; " << std::endl; - } - - - if (config.generalEmulation.enableLegacyBlending == 0) { - if (g_cycleType <= G_CYC_2CYCLE) { - m_blender1->write(ssShader); - if (g_cycleType == G_CYC_2CYCLE) - m_blender2->write(ssShader); - m_blenderAlpha->write(ssShader); - } else - ssShader << " fragColor = clampedColor;" << std::endl; - - } - else { - ssShader << " fragColor = clampedColor;" << std::endl; - m_legacyBlender->write(ssShader); - } - - - // SHOW COVERAGE HACK - // ssShader << "fragColor.rgb = vec3(cvg);" << std::endl; - - _strShader = ssShader.str(); - return inputs; -} - -graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combiner & _color, - Combiner & _alpha, - const CombinerKey & _key) -{ - g_cycleType = _key.getCycleType(); - g_textureConvert.setMode(_key.getBilerp()); - - std::string strCombiner; - CombinerInputs combinerInputs(compileCombiner(_key, _color, _alpha, strCombiner)); - - const bool bUseLod = combinerInputs.usesLOD(); - const bool bUseTextures = combinerInputs.usesTexture(); - const bool bIsRect = _key.isRectKey(); - const bool bUseHWLight = !bIsRect && // Rects not use lighting - isHWLightingAllowed() && - combinerInputs.usesShadeColor(); - - if (bUseHWLight) - combinerInputs.addInput(G_GCI_HW_LIGHT); - - std::stringstream ssShader; - - /* Write headers */ - m_fragmentHeader->write(ssShader); - - if (bUseTextures) { - m_fragmentGlobalVariablesTex->write(ssShader); - - if (g_cycleType == G_CYC_2CYCLE && config.generalEmulation.enableLegacyBlending == 0) - ssShader << "uniform lowp ivec4 uBlendMux2;" << std::endl << "uniform lowp int uForceBlendCycle2;" << std::endl; - - if (g_cycleType <= G_CYC_2CYCLE) - m_fragmentHeaderDither->write(ssShader); - m_fragmentHeaderNoise->write(ssShader); - m_fragmentHeaderWriteDepth->write(ssShader); - m_fragmentHeaderDepthCompare->write(ssShader); - m_fragmentHeaderReadMSTex->write(ssShader); - m_fragmentHeaderTextureEngine->write(ssShader); - if (bUseLod) - m_fragmentHeaderMipMap->write(ssShader); - else if (g_cycleType < G_CYC_COPY) - m_fragmentHeaderReadTex->write(ssShader); - else - m_fragmentHeaderReadTexCopyMode->write(ssShader); - } else { - m_fragmentGlobalVariablesNotex->write(ssShader); - - if (g_cycleType == G_CYC_2CYCLE && config.generalEmulation.enableLegacyBlending == 0) - ssShader << "uniform lowp ivec4 uBlendMux2;" << std::endl << "uniform lowp int uForceBlendCycle2;" << std::endl; - - if (g_cycleType <= G_CYC_2CYCLE) - m_fragmentHeaderDither->write(ssShader); - m_fragmentHeaderNoise->write(ssShader); - m_fragmentHeaderWriteDepth->write(ssShader); - m_fragmentHeaderDepthCompare->write(ssShader); - } - - if (bUseHWLight) - m_fragmentHeaderCalcLight->write(ssShader); - - /* Write body */ - if (g_cycleType == G_CYC_2CYCLE) - m_fragmentMain2Cycle->write(ssShader); - else - m_fragmentMain->write(ssShader); - - - if (g_cycleType <= G_CYC_2CYCLE) - m_fragmentBlendMux->write(ssShader); - - if (g_cycleType <= G_CYC_2CYCLE && m_useCoverage) - m_shaderCoverage->write(ssShader); - else - ssShader << "cvg = 1.0; \n" << std::endl; - - - if (bUseTextures) { - m_fragmentCorrectTexCoords->write(ssShader); - if (combinerInputs.usesTile(0)) - { - m_fragmentTextureEngineTex0->write(ssShader); - } - if (combinerInputs.usesTile(1)) - { - m_fragmentTextureEngineTex1->write(ssShader); - } - - if (bUseLod) { - m_fragmentReadTexMipmap->write(ssShader); - } else { - if (g_cycleType < G_CYC_COPY) { - if (combinerInputs.usesTile(0)) - m_fragmentReadTex0->write(ssShader); - else - ssShader << " lowp vec4 readtex0;" << std::endl; - - if (combinerInputs.usesTile(1)) - m_fragmentReadTex1->write(ssShader); - } else - m_fragmentReadTexCopyMode->write(ssShader); - } - } - - if (bUseHWLight) - ssShader << " calc_light(vNumLights, shadeColor.rgb, input_color);" << std::endl; - else - ssShader << " input_color = shadeColor.rgb;" << std::endl; - - ssShader << " vec_color = vec4(input_color, shadeColor.a);" << std::endl; - ssShader << strCombiner << std::endl; - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) - m_fragmentCallN64Depth->write(ssShader); - else - m_fragmentRenderTarget->write(ssShader); - - // End of Main() function - m_shaderFragmentMainEnd->write(ssShader); - - /* Write other functions */ - if (bUseHWLight) - m_shaderCalcLight->write(ssShader); - - if (bUseTextures) { - m_shaderTextureEngine->write(ssShader); - if (bUseLod) - m_shaderMipmap->write(ssShader); - else { - if (g_cycleType < G_CYC_COPY) - m_shaderReadtex->write(ssShader); - else - m_shaderReadtexCopyMode->write(ssShader); - } - } - - m_shaderNoise->write(ssShader); - - if (g_cycleType <= G_CYC_2CYCLE) - m_shaderDither->write(ssShader); - - m_shaderWriteDepth->write(ssShader); - - m_shaderN64DepthCompare->write(ssShader); - - m_shaderN64DepthRender->write(ssShader); - - const std::string strFragmentShader(ssShader.str()); - - /* Create shader program */ - - GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); - const GLchar * strShaderData = strFragmentShader.data(); - glShaderSource(fragmentShader, 1, &strShaderData, nullptr); - glCompileShader(fragmentShader); - if (!Utils::checkShaderCompileStatus(fragmentShader)) - Utils::logErrorShader(GL_FRAGMENT_SHADER, strFragmentShader); - - GLuint program = glCreateProgram(); - Utils::locateAttributes(program, bIsRect, bUseTextures); - if (bIsRect) - glAttachShader(program, bUseTextures ? m_vertexShaderTexturedRect : m_vertexShaderRect); - else - glAttachShader(program, bUseTextures ? m_vertexShaderTexturedTriangle : m_vertexShaderTriangle); - glAttachShader(program, fragmentShader); - if (CombinerInfo::get().isShaderCacheSupported()) { - if (IS_GL_FUNCTION_VALID(ProgramParameteri)) - glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); - } - glLinkProgram(program); - assert(Utils::checkProgramLinkStatus(program)); - glDeleteShader(fragmentShader); - - UniformGroups uniforms; - m_uniformFactory->buildUniforms(program, combinerInputs, _key, uniforms); - - return new CombinerProgramImpl(_key, program, m_useProgram, combinerInputs, std::move(uniforms)); -} - -const ShaderPart * CombinerProgramBuilder::getVertexShaderHeader() const -{ - return m_vertexHeader.get(); -} - -const ShaderPart * CombinerProgramBuilder::getFragmentShaderHeader() const -{ - return m_fragmentHeader.get(); -} - -const ShaderPart * CombinerProgramBuilder::getFragmentShaderEnd() const -{ - return m_shaderFragmentMainEnd.get(); -} - -static -GLuint _createVertexShader(ShaderPart * _header, ShaderPart * _body, ShaderPart * _footer) -{ - std::stringstream ssShader; - _header->write(ssShader); - _body->write(ssShader); - _footer->write(ssShader); - const std::string strShader(ssShader.str()); - const GLchar * strShaderData = strShader.data(); - - GLuint shader_object = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(shader_object, 1, &strShaderData, nullptr); - glCompileShader(shader_object); - if (!Utils::checkShaderCompileStatus(shader_object)) - Utils::logErrorShader(GL_VERTEX_SHADER, strShaderData); - return shader_object; -} - -CombinerProgramBuilder::CombinerProgramBuilder(const opengl::GLInfo & _glinfo, opengl::CachedUseProgram * _useProgram) -: m_blender1(new ShaderBlender1(_glinfo)) -, m_blender2(new ShaderBlender2(_glinfo)) -, m_blenderAlpha (new ShaderBlenderAlpha(_glinfo)) -, m_legacyBlender(new ShaderLegacyBlender) -, m_clamp(new ShaderClamp) -, m_signExtendColorC(new ShaderSignExtendColorC) -, m_signExtendAlphaC(new ShaderSignExtendAlphaC) -, m_signExtendColorABD(new ShaderSignExtendColorABD) -, m_signExtendAlphaABD(new ShaderSignExtendAlphaABD) -, m_alphaTest(new ShaderAlphaTest) -, m_callDither(new ShaderDithering(_glinfo)) -, m_vertexHeader(new VertexShaderHeader(_glinfo)) -, m_vertexEnd(new VertexShaderEnd(_glinfo)) -, m_vertexRect(new VertexShaderRect(_glinfo)) -, m_vertexTexturedRect(new VertexShaderTexturedRect(_glinfo)) -, m_vertexTriangle(new VertexShaderTriangle(_glinfo)) -, m_vertexTexturedTriangle(new VertexShaderTexturedTriangle(_glinfo)) -, m_fragmentHeader(new FragmentShaderHeader(_glinfo)) -, m_fragmentGlobalVariablesTex(new ShaderFragmentGlobalVariablesTex(_glinfo)) -, m_fragmentGlobalVariablesNotex(new ShaderFragmentGlobalVariablesNotex(_glinfo)) -, m_fragmentHeaderNoise(new ShaderFragmentHeaderNoise(_glinfo)) -, m_fragmentHeaderWriteDepth(new ShaderFragmentHeaderWriteDepth(_glinfo)) -, m_fragmentHeaderCalcLight(new ShaderFragmentHeaderCalcLight(_glinfo)) -, m_fragmentHeaderMipMap(new ShaderFragmentHeaderMipMap(_glinfo)) -, m_fragmentHeaderTextureEngine(new ShaderFragmentHeaderTextureEngine(_glinfo)) -, m_fragmentHeaderReadMSTex(new ShaderFragmentHeaderReadMSTex(_glinfo)) -, m_fragmentHeaderDither(new ShaderFragmentHeaderDither(_glinfo)) -, m_fragmentHeaderDepthCompare(new ShaderFragmentHeaderDepthCompare(_glinfo)) -, m_fragmentHeaderReadTex(new ShaderFragmentHeaderReadTex(_glinfo)) -, m_fragmentHeaderReadTexCopyMode(new ShaderFragmentHeaderReadTexCopyMode(_glinfo)) -, m_fragmentMain(new ShaderFragmentMain(_glinfo)) -, m_fragmentMain2Cycle(new ShaderFragmentMain2Cycle(_glinfo)) -, m_fragmentBlendMux(new ShaderFragmentBlendMux(_glinfo)) -, m_fragmentReadTex0(new ShaderFragmentReadTex0(_glinfo)) -, m_fragmentReadTex1(new ShaderFragmentReadTex1(_glinfo)) -, m_fragmentCorrectTexCoords(new ShaderFragmentCorrectTexCoords()) -, m_fragmentTextureEngineTex0(new ShaderFragmentTextureEngineTex0(_glinfo)) -, m_fragmentTextureEngineTex1(new ShaderFragmentTextureEngineTex1(_glinfo)) -, m_fragmentReadTexCopyMode(new ShaderFragmentReadTexCopyMode(_glinfo)) -, m_fragmentReadTexMipmap(new ShaderFragmentReadTexMipmap(_glinfo)) -, m_fragmentCallN64Depth(new ShaderFragmentCallN64Depth(_glinfo)) -, m_fragmentRenderTarget(new ShaderFragmentRenderTarget(_glinfo)) -, m_shaderFragmentMainEnd(new ShaderFragmentMainEnd(_glinfo)) -, m_shaderNoise(new ShaderNoise(_glinfo)) -, m_shaderDither(new ShaderDither(_glinfo)) -, m_shaderWriteDepth(new ShaderWriteDepth(_glinfo)) -, m_shaderMipmap(new ShaderMipmap(_glinfo)) -, m_shaderCalcLight(new ShaderCalcLight(_glinfo)) -, m_shaderReadtex(new ShaderReadtex(_glinfo)) -, m_shaderReadtexCopyMode(new ShaderReadtexCopyMode(_glinfo)) -, m_shaderN64DepthCompare(new ShaderN64DepthCompare(_glinfo)) -, m_shaderN64DepthRender(new ShaderN64DepthRender(_glinfo)) -, m_shaderTextureEngine(new ShaderTextureEngine(_glinfo)) -, m_shaderCoverage(new ShaderCoverage()) -, m_useProgram(_useProgram) -, m_combinerOptionsBits(graphics::CombinerProgram::getShaderCombinerOptionsBits()) -, m_useCoverage(_glinfo.coverage && config.generalEmulation.enableCoverage != 0) -{ - m_vertexShaderRect = _createVertexShader(m_vertexHeader.get(), m_vertexRect.get(), m_vertexEnd.get()); - m_vertexShaderTriangle = _createVertexShader(m_vertexHeader.get(), m_vertexTriangle.get(), m_vertexEnd.get()); - m_vertexShaderTexturedRect = _createVertexShader(m_vertexHeader.get(), m_vertexTexturedRect.get(), m_vertexEnd.get()); - m_vertexShaderTexturedTriangle = _createVertexShader(m_vertexHeader.get(), m_vertexTexturedTriangle.get(), m_vertexEnd.get()); - m_uniformFactory.reset(new CombinerProgramUniformFactory(_glinfo)); -} - -CombinerProgramBuilder::~CombinerProgramBuilder() -{ - glDeleteShader(m_vertexShaderRect); - glDeleteShader(m_vertexShaderTriangle); - glDeleteShader(m_vertexShaderTexturedRect); - glDeleteShader(m_vertexShaderTexturedTriangle); -} - -bool CombinerProgramBuilder::isObsolete() const -{ - return m_combinerOptionsBits != graphics::CombinerProgram::getShaderCombinerOptionsBits(); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.h deleted file mode 100644 index 9269803..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.h +++ /dev/null @@ -1,109 +0,0 @@ -#pragma once -#include -#include -#include - -namespace graphics { - class CombinerProgram; -} - -namespace opengl { - class CachedUseProgram; -} - -namespace glsl { - - class ShaderPart; - class CombinerInputs; - class CombinerProgramUniformFactory; - - class CombinerProgramBuilder - { - public: - CombinerProgramBuilder(const opengl::GLInfo & _glinfo, opengl::CachedUseProgram * _useProgram); - ~CombinerProgramBuilder(); - - graphics::CombinerProgram * buildCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key); - - const ShaderPart * getVertexShaderHeader() const; - - const ShaderPart * getFragmentShaderHeader() const; - - const ShaderPart * getFragmentShaderEnd() const; - - bool isObsolete() const; - - private: - CombinerInputs compileCombiner(const CombinerKey & _key, Combiner & _color, Combiner & _alpha, std::string & _strShader); - - typedef std::unique_ptr ShaderPartPtr; - ShaderPartPtr m_blender1; - ShaderPartPtr m_blender2; - ShaderPartPtr m_blenderAlpha; - ShaderPartPtr m_legacyBlender; - ShaderPartPtr m_clamp; - ShaderPartPtr m_signExtendColorC; - ShaderPartPtr m_signExtendAlphaC; - ShaderPartPtr m_signExtendColorABD; - ShaderPartPtr m_signExtendAlphaABD; - ShaderPartPtr m_alphaTest; - ShaderPartPtr m_callDither; - - ShaderPartPtr m_vertexHeader; - ShaderPartPtr m_vertexEnd; - ShaderPartPtr m_vertexRect; - ShaderPartPtr m_vertexTexturedRect; - ShaderPartPtr m_vertexTriangle; - ShaderPartPtr m_vertexTexturedTriangle; - - ShaderPartPtr m_fragmentHeader; - ShaderPartPtr m_fragmentGlobalVariablesTex; - ShaderPartPtr m_fragmentGlobalVariablesNotex; - ShaderPartPtr m_fragmentHeaderNoise; - ShaderPartPtr m_fragmentHeaderWriteDepth; - ShaderPartPtr m_fragmentHeaderCalcLight; - ShaderPartPtr m_fragmentHeaderMipMap; - ShaderPartPtr m_fragmentHeaderTextureEngine; - ShaderPartPtr m_fragmentHeaderReadMSTex; - ShaderPartPtr m_fragmentHeaderDither; - ShaderPartPtr m_fragmentHeaderDepthCompare; - ShaderPartPtr m_fragmentHeaderReadTex; - ShaderPartPtr m_fragmentHeaderReadTexCopyMode; - ShaderPartPtr m_fragmentMain; - ShaderPartPtr m_fragmentMain2Cycle; - ShaderPartPtr m_fragmentBlendMux; - ShaderPartPtr m_fragmentReadTex0; - ShaderPartPtr m_fragmentReadTex1; - ShaderPartPtr m_fragmentCorrectTexCoords; - ShaderPartPtr m_fragmentTextureEngineTex0; - ShaderPartPtr m_fragmentTextureEngineTex1; - ShaderPartPtr m_fragmentReadTexCopyMode; - ShaderPartPtr m_fragmentReadTexMipmap; - ShaderPartPtr m_fragmentCallN64Depth; - ShaderPartPtr m_fragmentRenderTarget; - ShaderPartPtr m_shaderFragmentMainEnd; - - ShaderPartPtr m_shaderNoise; - ShaderPartPtr m_shaderDither; - ShaderPartPtr m_shaderWriteDepth; - ShaderPartPtr m_shaderMipmap; - ShaderPartPtr m_shaderCalcLight; - ShaderPartPtr m_shaderReadtex; - ShaderPartPtr m_shaderReadtexCopyMode; - ShaderPartPtr m_shaderN64DepthCompare; - ShaderPartPtr m_shaderN64DepthRender; - ShaderPartPtr m_shaderTextureEngine; - ShaderPartPtr m_shaderCoverage; - - std::unique_ptr m_uniformFactory; - - GLuint m_vertexShaderRect; - GLuint m_vertexShaderTriangle; - GLuint m_vertexShaderTexturedRect; - GLuint m_vertexShaderTexturedTriangle; - opengl::CachedUseProgram * m_useProgram; - u32 m_combinerOptionsBits; - bool m_useCoverage = false; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp deleted file mode 100644 index f23bf86..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "glsl_Utils.h" -#include "glsl_CombinerProgramImpl.h" - -using namespace glsl; - -CombinerProgramImpl::CombinerProgramImpl(const CombinerKey & _key, - GLuint _program, - opengl::CachedUseProgram * _useProgram, - const CombinerInputs & _inputs, - UniformGroups && _uniforms) -: m_bNeedUpdate(true) -, m_key(_key) -, m_program(_program) -, m_useProgram(_useProgram) -, m_inputs(_inputs) -, m_uniforms(std::move(_uniforms)) -{ -} - - -CombinerProgramImpl::~CombinerProgramImpl() -{ - m_useProgram->useProgram(graphics::ObjectHandle::null); - glDeleteProgram(GLuint(m_program)); -} - -void CombinerProgramImpl::activate() -{ - m_useProgram->useProgram(m_program); -} - -void CombinerProgramImpl::update(bool _force) -{ - _force |= m_bNeedUpdate; - m_bNeedUpdate = false; - m_useProgram->useProgram(m_program); - for (auto it = m_uniforms.begin(); it != m_uniforms.end(); ++it) - (*it)->update(_force); -} - -const CombinerKey & CombinerProgramImpl::getKey() const -{ - return m_key; -} - -bool CombinerProgramImpl::usesTexture() const -{ - return m_inputs.usesTexture(); -} - -bool CombinerProgramImpl::usesTile(u32 _t) const -{ - return m_inputs.usesTile(_t); -} - -bool CombinerProgramImpl::usesShade() const -{ - return m_inputs.usesShade(); -} - -bool CombinerProgramImpl::usesLOD() const -{ - return m_inputs.usesLOD(); -} - -bool CombinerProgramImpl::usesHwLighting() const -{ - return m_inputs.usesHwLighting(); -} - -bool CombinerProgramImpl::getBinaryForm(std::vector & _buffer) -{ - GLint binaryLength; - glGetProgramiv(GLuint(m_program), GL_PROGRAM_BINARY_LENGTH, &binaryLength); - - if (binaryLength < 1) - return false; - - std::vector binary(binaryLength); - - GLenum binaryFormat; - glGetProgramBinary(GLuint(m_program), binaryLength, &binaryLength, &binaryFormat, binary.data()); - if (opengl::Utils::isGLError()) - return false; - - u64 key = m_key.getMux(); - int inputs(m_inputs); - - int totalSize = sizeof(key)+sizeof(inputs)+sizeof(binaryFormat)+ - sizeof(binaryLength)+binaryLength; - _buffer.resize(totalSize); - - char* keyData = reinterpret_cast(&key); - std::copy_n(keyData, sizeof(key), _buffer.data()); - int offset = sizeof(key); - - char* inputData = reinterpret_cast(&inputs); - std::copy_n(inputData, sizeof(inputs), _buffer.data() + offset); - offset += sizeof(inputs); - - char* binaryFormatData = reinterpret_cast(&binaryFormat); - std::copy_n(binaryFormatData, sizeof(binaryFormat), _buffer.data() + offset); - offset += sizeof(binaryFormat); - - char* binaryLengthData = reinterpret_cast(&binaryLength); - std::copy_n(binaryLengthData, sizeof(binaryLength), _buffer.data() + offset); - offset += sizeof(binaryLength); - - std::copy_n(binary.data(), binaryLength, _buffer.data() + offset); - - return true; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.h deleted file mode 100644 index 3c3dff5..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include "glsl_CombinerInputs.h" - -namespace opengl { - class CachedUseProgram; -} - -namespace glsl { - - class UniformGroup { - public: - virtual ~UniformGroup() {} - virtual void update(bool _force) = 0; - }; - - typedef std::vector< std::unique_ptr > UniformGroups; - - class CombinerProgramImpl : public graphics::CombinerProgram - { - public: - CombinerProgramImpl(const CombinerKey & _key, - GLuint _program, - opengl::CachedUseProgram * _useProgram, - const CombinerInputs & _inputs, - UniformGroups && _uniforms); - ~CombinerProgramImpl(); - - void activate() override; - void update(bool _force) override; - const CombinerKey & getKey() const override; - - bool usesTexture() const override; - bool usesTile(u32 _t) const override; - bool usesShade() const override; - bool usesLOD() const override; - bool usesHwLighting() const override; - - bool getBinaryForm(std::vector & _buffer) override; - - private: - bool m_bNeedUpdate; - CombinerKey m_key; - graphics::ObjectHandle m_program; - opengl::CachedUseProgram * m_useProgram; - CombinerInputs m_inputs; - UniformGroups m_uniforms; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp deleted file mode 100644 index a98cf58..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp +++ /dev/null @@ -1,1317 +0,0 @@ -#include -#include -#include "glsl_CombinerProgramUniformFactory.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace glsl { - -/*---------------Uniform-------------*/ - -struct iUniform { - GLint loc = -1; - int val = -999; - void set(int _val, bool _force) { - if (loc >= 0 && (_force || val != _val)) { - val = _val; - glUniform1i(loc, _val); - } - } -}; - -struct fUniform { - GLint loc = -1; - float val = -9999.9f; - void set(float _val, bool _force) { - if (loc >= 0 && (_force || val != _val)) { - val = _val; - glUniform1f(loc, _val); - } - } -}; - -struct fv2Uniform { - GLint loc = -1; - float val1 = -9999.9f, val2 = -9999.9f; - void set(float _val1, float _val2, bool _force) { - if (loc >= 0 && (_force || val1 != _val1 || val2 != _val2)) { - val1 = _val1; - val2 = _val2; - glUniform2f(loc, _val1, _val2); - } - } -}; - -struct fv3Uniform { - GLint loc = -1; - float val[3]; - void set(float * _pVal, bool _force) { - const size_t szData = sizeof(float)* 3; - if (loc >= 0 && (_force || memcmp(val, _pVal, szData) != 0)) { - memcpy(val, _pVal, szData); - glUniform3fv(loc, 1, _pVal); - } - } -}; - -struct fv4Uniform { - GLint loc = -1; - float val[4]; - void set(float * _pVal, bool _force) { - const size_t szData = sizeof(float)* 4; - if (loc >= 0 && (_force || memcmp(val, _pVal, szData) != 0)) { - memcpy(val, _pVal, szData); - glUniform4fv(loc, 1, _pVal); - } - } -}; - -struct iv2Uniform { - GLint loc = -1; - int val1 = -999, val2 = -999; - void set(int _val1, int _val2, bool _force) { - if (loc >= 0 && (_force || val1 != _val1 || val2 != _val2)) { - val1 = _val1; - val2 = _val2; - glUniform2i(loc, _val1, _val2); - } - } -}; - -struct i4Uniform { - GLint loc = -1; - int val0 = -999, val1 = -999, val2 = -999, val3 = -999; - void set(int _val0, int _val1, int _val2, int _val3, bool _force) { - if (loc < 0) - return; - if (_force || _val0 != val0 || _val1 != val1 || _val2 != val2 || _val3 != val3) { - val0 = _val0; - val1 = _val1; - val2 = _val2; - val3 = _val3; - glUniform4i(loc, val0, val1, val2, val3); - } - } -}; - - -/*---------------UniformGroup-------------*/ - -#define LocateUniform(A) \ - A.loc = glGetUniformLocation(_program, #A); - -class UNoiseTex : public UniformGroup -{ -public: - UNoiseTex(GLuint _program) { - LocateUniform(uTexNoise); - } - - void update(bool _force) override - { - uTexNoise.set(int(graphics::textureIndices::NoiseTex), _force); - } - -private: - iUniform uTexNoise; -}; - -class UDepthTex : public UniformGroup -{ -public: - UDepthTex(GLuint _program) { - LocateUniform(uDepthTex); - } - - void update(bool _force) override - { - uDepthTex.set(int(graphics::textureIndices::DepthTex), _force); - } - -private: - iUniform uDepthTex; -}; - -class UZLutTexture : public UniformGroup -{ -public: - UZLutTexture(GLuint _program) { - LocateUniform(uZlutImage); - } - - void update(bool _force) override - { - uZlutImage.set(int(graphics::textureIndices::ZLUTTex), _force); - } - -private: - iUniform uZlutImage; -}; - -class UTextures : public UniformGroup -{ -public: - UTextures(GLuint _program) { - LocateUniform(uTex0); - LocateUniform(uTex1); - } - - void update(bool _force) override - { - uTex0.set(0, _force); - uTex1.set(1, _force); - } - -private: - iUniform uTex0; - iUniform uTex1; -}; - -class UMSAATextures : public UniformGroup -{ -public: - UMSAATextures(GLuint _program) { - LocateUniform(uMSTex0); - LocateUniform(uMSTex1); - LocateUniform(uMSAASamples); - } - - void update(bool _force) override - { - uMSTex0.set(int(graphics::textureIndices::MSTex[0]), _force); - uMSTex1.set(int(graphics::textureIndices::MSTex[1]), _force); - uMSAASamples.set(config.video.multisampling, _force); - } - -private: - iUniform uMSTex0; - iUniform uMSTex1; - iUniform uMSAASamples; -}; - -class UScreenSpaceTriangleInfo : public UniformGroup -{ -public: - UScreenSpaceTriangleInfo(GLuint _program) { - LocateUniform(uScreenSpaceTriangle); - } - - void update(bool _force) override - { - uScreenSpaceTriangle.set( - (dwnd().getDrawer().getDrawingState() == DrawingState::ScreenSpaceTriangle) ? 1 : 0, _force); - } - -private: - iUniform uScreenSpaceTriangle; -}; - -class URasterInfo : public UniformGroup { -public: - URasterInfo(GLuint _program) { - LocateUniform(uVertexOffset); - LocateUniform(uTexCoordOffset[0]); - LocateUniform(uTexCoordOffset[1]); - LocateUniform(uUseTexCoordBounds); - LocateUniform(uTexCoordBounds0); - LocateUniform(uTexCoordBounds1); - } - - void update(bool _force) override { - const bool isNativeRes = config.frameBufferEmulation.nativeResFactor == 1 && config.video.multisampling == 0; - const bool isTexRect = dwnd().getDrawer().getDrawingState() == DrawingState::TexRect; - const bool useTexCoordBounds = isTexRect && !isNativeRes && config.graphics2D.enableTexCoordBounds; - /* At rasterization stage, the N64 places samples on the top left of the fragment while OpenGL */ - /* places them in the fragment center. As a result, a normal approach results in shifted texture */ - /* coordinates. In native resolution, this difference can be negated by shifting vertices by 0.5. */ - /* In higher resolutions, there are more samples than the game intends, so shifting is not very */ - /* effective. Still, an heuristic is applied to render texture rectangles as correctly as possible */ - /* in higher resolutions too. See issue #2324 for details. */ - const float vertexOffset = isNativeRes ? 0.5f : 0.0f; - float texCoordOffset[2][2] = { 0.0f, 0.0f }; - if (isTexRect && !isNativeRes) { - float scale[2] = { 0.0f, 0.0f }; - if (config.graphics2D.enableNativeResTexrects != 0) { - scale[0] = scale[1] = 1.0f; - } else { - scale[0] = scale[1] = static_cast(config.frameBufferEmulation.nativeResFactor); - } - - for (int t = 0; t < 2; t++) { - const CachedTexture* _pTexture = textureCache().current[t]; - if (_pTexture != nullptr) { - if (config.frameBufferEmulation.nativeResFactor != 0) { - texCoordOffset[t][0] = (gDP.lastTexRectInfo.dsdx >= 0.0f ? -0.5f / scale[0] : -1.0f + 0.5f / scale[0]) * gDP.lastTexRectInfo.dsdx * _pTexture->hdRatioS; - texCoordOffset[t][1] = (gDP.lastTexRectInfo.dtdy >= 0.0f ? -0.5f / scale[1] : -1.0f + 0.5f / scale[1]) * gDP.lastTexRectInfo.dtdy * _pTexture->hdRatioT; - } else { - texCoordOffset[t][0] = (gDP.lastTexRectInfo.dsdx >= 0.0f ? 0.0f : -1.0f) * gDP.lastTexRectInfo.dsdx * _pTexture->hdRatioS; - texCoordOffset[t][1] = (gDP.lastTexRectInfo.dtdy >= 0.0f ? 0.0f : -1.0f) * gDP.lastTexRectInfo.dtdy * _pTexture->hdRatioT; - } - } - } - } - float tcbounds[2][4] = {}; - if (useTexCoordBounds) { - f32 uls, lrs, ult, lrt, S, T, shiftScaleS, shiftScaleT; - s16 shiftedS, shiftedT; - u32 shifts, shiftt; - for (int t = 0; t < 2; t++) { - const CachedTexture * _pTexture = textureCache().current[t]; - const gDPTile * _pTile = gSP.textureTile[t]; - if (_pTexture != nullptr && _pTile != nullptr){ - if (_pTile->shifts > 10) { - shifts = 16 - _pTile->shifts; - shiftedS = static_cast(gDP.lastTexRectInfo.s << shifts); - shiftScaleS = static_cast(1 << shifts); - } else { - shifts = _pTile->shifts; - shiftedS = static_cast(gDP.lastTexRectInfo.s >> shifts); - shiftScaleS = 1.0f / static_cast(1 << shifts); - } - if (_pTile->shiftt > 10) { - shiftt = 16 - _pTile->shiftt; - shiftedT = static_cast(gDP.lastTexRectInfo.t << shiftt); - shiftScaleT = static_cast(1 << shiftt); - } else { - shiftt = _pTile->shiftt; - shiftedT = static_cast(gDP.lastTexRectInfo.t >> shiftt); - shiftScaleT = 1.0f / static_cast(1 << shiftt); - } - - S = _FIXED2FLOAT(shiftedS, 5); - T = _FIXED2FLOAT(shiftedT, 5); - uls = S + (ceilf(gDP.lastTexRectInfo.ulx) - gDP.lastTexRectInfo.ulx) * gDP.lastTexRectInfo.dsdx * shiftScaleS; - lrs = S + (ceilf(gDP.lastTexRectInfo.lrx) - gDP.lastTexRectInfo.ulx - 1.0f) * gDP.lastTexRectInfo.dsdx * shiftScaleS; - ult = T + (ceilf(gDP.lastTexRectInfo.uly) - gDP.lastTexRectInfo.uly) * gDP.lastTexRectInfo.dtdy * shiftScaleT; - lrt = T + (ceilf(gDP.lastTexRectInfo.lry) - gDP.lastTexRectInfo.uly - 1.0f) * gDP.lastTexRectInfo.dtdy * shiftScaleT; - - tcbounds[t][0] = (fmin(uls, lrs) - _pTile->fuls) * _pTexture->hdRatioS; - tcbounds[t][1] = (fmin(ult, lrt) - _pTile->fult) * _pTexture->hdRatioT; - tcbounds[t][2] = (fmax(uls, lrs) - _pTile->fuls) * _pTexture->hdRatioS; - tcbounds[t][3] = (fmax(ult, lrt) - _pTile->fult) * _pTexture->hdRatioT; - if (_pTexture->frameBufferTexture != CachedTexture::fbNone) { - tcbounds[t][0] += _pTexture->offsetS * _pTexture->hdRatioS; - tcbounds[t][1] += _pTexture->offsetT * _pTexture->hdRatioT; - tcbounds[t][2] += _pTexture->offsetS * _pTexture->hdRatioS; - tcbounds[t][3] += _pTexture->offsetT * _pTexture->hdRatioT; - } - } - } - } - - uVertexOffset.set(vertexOffset, vertexOffset, _force); - uTexCoordOffset[0].set(texCoordOffset[0][0], texCoordOffset[0][1], _force); - uTexCoordOffset[1].set(texCoordOffset[1][0], texCoordOffset[1][1], _force); - uUseTexCoordBounds.set(useTexCoordBounds ? 1 : 0, _force); - uTexCoordBounds0.set(tcbounds[0], _force); - uTexCoordBounds1.set(tcbounds[1], _force); - } - -private: - fv2Uniform uVertexOffset; - fv2Uniform uTexCoordOffset[2]; - iUniform uUseTexCoordBounds; - fv4Uniform uTexCoordBounds0; - fv4Uniform uTexCoordBounds1; -}; - -class UFrameBufferInfo : public UniformGroup -{ -public: - UFrameBufferInfo(GLuint _program) { - LocateUniform(uFbMonochrome); - LocateUniform(uFbFixedAlpha); - LocateUniform(uMSTexEnabled); - } - - void update(bool _force) override - { - int nFbMonochromeMode0 = 0, nFbMonochromeMode1 = 0; - int nFbFixedAlpha0 = 0, nFbFixedAlpha1 = 0; - int nMSTex0Enabled = 0, nMSTex1Enabled = 0; - TextureCache & cache = textureCache(); - if (cache.current[0] != nullptr && cache.current[0]->frameBufferTexture != CachedTexture::fbNone) { - if (cache.current[0]->size == G_IM_SIZ_8b) { - nFbMonochromeMode0 = 1; - if (gDP.otherMode.imageRead == 0) - nFbFixedAlpha0 = 1; - } else if (gSP.textureTile[0]->size == G_IM_SIZ_16b && gSP.textureTile[0]->format == G_IM_FMT_IA) { - nFbMonochromeMode0 = 2; - } else if ((config.generalEmulation.hacks & hack_ZeldaMonochrome) != 0 && - cache.current[0]->size == G_IM_SIZ_16b && - gSP.textureTile[0]->size == G_IM_SIZ_8b && - gSP.textureTile[0]->format == G_IM_FMT_CI) { - // Zelda monochrome effect - nFbMonochromeMode0 = 3; - nFbMonochromeMode1 = 3; - } - - nMSTex0Enabled = cache.current[0]->frameBufferTexture == CachedTexture::fbMultiSample ? 1 : 0; - } - if (cache.current[1] != nullptr && cache.current[1]->frameBufferTexture != CachedTexture::fbNone) { - if (cache.current[1]->size == G_IM_SIZ_8b) { - nFbMonochromeMode1 = 1; - if (gDP.otherMode.imageRead == 0) - nFbFixedAlpha1 = 1; - } - else if (gSP.textureTile[1]->size == G_IM_SIZ_16b && gSP.textureTile[1]->format == G_IM_FMT_IA) - nFbMonochromeMode1 = 2; - nMSTex1Enabled = cache.current[1]->frameBufferTexture == CachedTexture::fbMultiSample ? 1 : 0; - } - uFbMonochrome.set(nFbMonochromeMode0, nFbMonochromeMode1, _force); - uFbFixedAlpha.set(nFbFixedAlpha0, nFbFixedAlpha1, _force); - uMSTexEnabled.set(nMSTex0Enabled, nMSTex1Enabled, _force); - gDP.changed &= ~CHANGED_FB_TEXTURE; - } - -private: - iv2Uniform uFbMonochrome; - iv2Uniform uFbFixedAlpha; - iv2Uniform uMSTexEnabled; -}; - - -class UFog : public UniformGroup -{ -public: - UFog(GLuint _program) { - LocateUniform(uFogUsage); - LocateUniform(uFogScale); - } - - void update(bool _force) override - { - if (RSP.LLE) { - uFogUsage.set(0, _force); - return; - } - - int nFogUsage = ((gSP.geometryMode & G_FOG) != 0) ? 1 : 0; - if (GBI.getMicrocodeType() == F3DAM) { - const s16 fogMode = ((gSP.geometryMode >> 13) & 9) + 0xFFF8; - if (fogMode == 0) - nFogUsage = 1; - else if (fogMode > 0) - nFogUsage = 2; - } - uFogUsage.set(nFogUsage, _force); - uFogScale.set(gSP.fog.multiplierf, gSP.fog.offsetf, _force); - } - -private: - iUniform uFogUsage; - fv2Uniform uFogScale; -}; - -class UBlendMode1Cycle : public UniformGroup -{ -public: - UBlendMode1Cycle(GLuint _program) { - LocateUniform(uBlendMux1); - LocateUniform(uForceBlendCycle1); - } - - void update(bool _force) override - { - uBlendMux1.set(gDP.otherMode.c1_m1a, - gDP.otherMode.c1_m1b, - gDP.otherMode.c1_m2a, - gDP.otherMode.c1_m2b, - _force); - - const int forceBlend1 = (int)gDP.otherMode.forceBlender; - uForceBlendCycle1.set(forceBlend1, _force); - } - -private: - i4Uniform uBlendMux1; - iUniform uForceBlendCycle1; -}; - -class UBlendMode2Cycle : public UniformGroup -{ -public: - UBlendMode2Cycle(GLuint _program) { - LocateUniform(uBlendMux1); - LocateUniform(uBlendMux2); - LocateUniform(uForceBlendCycle1); - LocateUniform(uForceBlendCycle2); - } - - void update(bool _force) override - { - uBlendMux1.set(gDP.otherMode.c1_m1a, - gDP.otherMode.c1_m1b, - gDP.otherMode.c1_m2a, - gDP.otherMode.c1_m2b, - _force); - - uBlendMux2.set(gDP.otherMode.c2_m1a, - gDP.otherMode.c2_m1b, - gDP.otherMode.c2_m2a, - gDP.otherMode.c2_m2b, - _force); - - const int forceBlend1 = 1; - uForceBlendCycle1.set(forceBlend1, _force); - const int forceBlend2 = gDP.otherMode.forceBlender; - uForceBlendCycle2.set(forceBlend2, _force); - - if (!(graphics::Context::DualSourceBlending || graphics::Context::FramebufferFetchColor) || dwnd().getDrawer().isTexrectDrawerMode()) { - // Modes, which shader blender can't emulate - const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16); - switch (mode) { - case 0x0040: - // Mia Hamm Soccer - // clr_in * a_in + clr_mem * (1-a) - // clr_in * a_in + clr_in * (1-a) - case 0x0050: - // A Bug's Life - // clr_in * a_in + clr_mem * (1-a) - // clr_in * a_in + clr_mem * (1-a) - uForceBlendCycle1.set(0, _force); - uForceBlendCycle2.set(0, _force); - break; - case 0x0150: - // Tony Hawk - // clr_in * a_in + clr_mem * (1-a) - // clr_in * a_fog + clr_mem * (1-a_fog) - if ((config.generalEmulation.hacks & hack_TonyHawk) != 0) { - uForceBlendCycle1.set(0, _force); - uForceBlendCycle2.set(0, _force); - } - break; - } - } - - } - -private: - i4Uniform uBlendMux1; - i4Uniform uBlendMux2; - iUniform uForceBlendCycle1; - iUniform uForceBlendCycle2; -}; - -class UBlendCvg : public UniformGroup -{ -public: - UBlendCvg(GLuint _program) { - LocateUniform(uCvgDest); - LocateUniform(uBlendAlphaMode); - } - - void update(bool _force) override - { - uCvgDest.set(gDP.otherMode.cvgDest, _force); - if (dwnd().getDrawer().isTexrectDrawerMode()) - uBlendAlphaMode.set(2, _force); // No alpha blend in texrect drawing mode - else - uBlendAlphaMode.set(gDP.otherMode.forceBlender, _force); - } -private: - iUniform uCvgDest; - iUniform uBlendAlphaMode; -}; - -class UDitherMode : public UniformGroup -{ -public: - UDitherMode(GLuint _program, bool _usesNoise) - : m_usesNoise(_usesNoise) - { - LocateUniform(uAlphaCompareMode); - LocateUniform(uAlphaDitherMode); - LocateUniform(uColorDitherMode); - } - - void update(bool _force) override - { - if (gDP.otherMode.cycleType < G_CYC_COPY) { - uAlphaCompareMode.set(gDP.otherMode.alphaCompare, _force); - uAlphaDitherMode.set(gDP.otherMode.alphaDither, _force); - uColorDitherMode.set(gDP.otherMode.colorDither, _force); - } - else { - uAlphaCompareMode.set(0, _force); - uAlphaDitherMode.set(0, _force); - uColorDitherMode.set(0, _force); - } - - bool updateNoiseTex = m_usesNoise; - updateNoiseTex |= (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.colorDither == G_CD_NOISE || gDP.otherMode.alphaDither == G_AD_NOISE || gDP.otherMode.alphaCompare == G_AC_DITHER); - if (updateNoiseTex) - g_noiseTexture.update(); - } - -private: - iUniform uAlphaCompareMode; - iUniform uAlphaDitherMode; - iUniform uColorDitherMode; - bool m_usesNoise; -}; - -class UScreenScale : public UniformGroup -{ -public: - UScreenScale(GLuint _program) { - LocateUniform(uScreenScale); - } - - void update(bool _force) override - { - if (dwnd().getDrawer().isTexrectDrawerMode()) { - uScreenScale.set(1.0f, 1.0f, _force); - return; - } - - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer == nullptr) - uScreenScale.set(dwnd().getScaleX(), dwnd().getScaleY(), _force); - else - uScreenScale.set(pBuffer->m_scale, pBuffer->m_scale, _force); - } - -private: - fv2Uniform uScreenScale; -}; - -class UMipmap1 : public UniformGroup -{ -public: - UMipmap1(GLuint _program) { - LocateUniform(uMinLod); - LocateUniform(uMaxTile); - } - - void update(bool _force) override - { - uMinLod.set(gDP.primColor.m, _force); - uMaxTile.set(gSP.texture.level, _force); - } - -private: - fUniform uMinLod; - iUniform uMaxTile; -}; - -class UMipmap2 : public UniformGroup -{ -public: - UMipmap2(GLuint _program) { - LocateUniform(uEnableLod); - LocateUniform(uTextureDetail); - } - - void update(bool _force) override - { - const int uCalcLOD = (gDP.otherMode.textureLOD == G_TL_LOD) ? 1 : 0; - uEnableLod.set(uCalcLOD, _force); - uTextureDetail.set(gDP.otherMode.textureDetail, _force); - } - -private: - iUniform uEnableLod; - iUniform uTextureDetail; -}; - -class UTexturePersp : public UniformGroup -{ -public: - UTexturePersp(GLuint _program) { - LocateUniform(uTexturePersp); - } - - void update(bool _force) override - { - const u32 texturePersp = (RSP.LLE || GBI.isTexturePersp()) ? gDP.otherMode.texturePersp : 1U; - uTexturePersp.set(texturePersp, _force); - } - -private: - iUniform uTexturePersp; -}; - -class UTextureFetchMode : public UniformGroup -{ -public: - UTextureFetchMode(GLuint _program) { - LocateUniform(uTextureFilterMode); - LocateUniform(uTextureFormat); - LocateUniform(uTextureConvert); - LocateUniform(uConvertParams); - } - - void update(bool _force) override - { - int textureFilter = gDP.otherMode.textureFilter; - uTextureFilterMode.set(textureFilter, _force); - uTextureFormat.set(gSP.textureTile[0]->format, gSP.textureTile[1]->format, _force); - uTextureConvert.set(gDP.otherMode.convert_one, _force); - if (gDP.otherMode.bi_lerp0 == 0 || gDP.otherMode.bi_lerp1 == 0) - uConvertParams.set(gDP.convert.k0, gDP.convert.k1, gDP.convert.k2, gDP.convert.k3, _force); - } - -private: - iUniform uTextureFilterMode; - iv2Uniform uTextureFormat; - iUniform uTextureConvert; - i4Uniform uConvertParams; -}; - -class UAlphaTestInfo : public UniformGroup -{ -public: - UAlphaTestInfo(GLuint _program) { - LocateUniform(uEnableAlphaTest); - LocateUniform(uAlphaCvgSel); - LocateUniform(uCvgXAlpha); - LocateUniform(uAlphaTestValue); - } - - void update(bool _force) override - { - if (gDP.otherMode.cycleType == G_CYC_FILL) { - uEnableAlphaTest.set(0, _force); - uAlphaCvgSel.set(0, _force); - - } else if (gDP.otherMode.cycleType == G_CYC_COPY) { - uAlphaCvgSel.set(0, _force); - if (gDP.otherMode.alphaCompare & G_AC_THRESHOLD) { - uEnableAlphaTest.set(1, _force); - uAlphaTestValue.set(0.5f, _force); - } else { - uEnableAlphaTest.set(0, _force); - } - } else if ((gDP.otherMode.alphaCompare & G_AC_THRESHOLD) != 0) { - uEnableAlphaTest.set(1, _force); - uAlphaTestValue.set(gDP.blendColor.a, _force); - uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force); - } else { - uEnableAlphaTest.set(0, _force); - uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force); - } - - uCvgXAlpha.set(gDP.otherMode.cvgXAlpha, _force); - } - -private: - iUniform uEnableAlphaTest; - iUniform uAlphaCvgSel; - iUniform uCvgXAlpha; - fUniform uAlphaTestValue; -}; - -class UViewportInfo : public UniformGroup -{ -public: - UViewportInfo(GLuint _program) { - LocateUniform(uVTrans); - LocateUniform(uVScale); - LocateUniform(uAdjustTrans); - LocateUniform(uAdjustScale); - } - - void update(bool _force) override - { - const bool isOrthographicProjection = gSP.matrix.projection[3][2] == -1.f; - float adjustTrans[2] = { 0.0f, 0.0f }; - float adjustScale[2] = { 1.0f, 1.0f }; - if (dwnd().isAdjustScreen() && (gDP.colorImage.width > VI.width * 98 / 100)) { - if (isOrthographicProjection) { - adjustScale[1] = 1.0f / dwnd().getAdjustScale(); - adjustTrans[1] = static_cast(gDP.colorImage.width) * 3.0f / 4.0f * (1.0f - adjustScale[1]) / 2.0f; - } else { - adjustScale[0] = dwnd().getAdjustScale(); - adjustTrans[0] = static_cast(gDP.colorImage.width) * (1.0f - adjustScale[0]) / 2.0f; - } - } - uVTrans.set(gSP.viewport.vtrans[0], gSP.viewport.vtrans[1], _force); - uVScale.set(gSP.viewport.vscale[0], -gSP.viewport.vscale[1], _force); - uAdjustTrans.set(adjustTrans[0], adjustTrans[1], _force); - uAdjustScale.set(adjustScale[0], adjustScale[1], _force); - } - -private: - fv2Uniform uVTrans; - fv2Uniform uVScale; - fv2Uniform uAdjustTrans; - fv2Uniform uAdjustScale; -}; - -class UDepthScale : public UniformGroup -{ -public: - UDepthScale(GLuint _program) { - LocateUniform(uDepthScale); - } - - void update(bool _force) override - { - if (RSP.LLE) - uDepthScale.set(0.5f, 0.5f, _force); - else - uDepthScale.set(gSP.viewport.vscale[2], gSP.viewport.vtrans[2], _force); - } - -private: - fv2Uniform uDepthScale; -}; - -class UDepthInfo : public UniformGroup -{ -public: - UDepthInfo(GLuint _program) { - LocateUniform(uEnableDepth); - LocateUniform(uEnableDepthCompare); - LocateUniform(uEnableDepthUpdate); - LocateUniform(uDepthMode); - LocateUniform(uDepthSource); - LocateUniform(uPrimDepth); - LocateUniform(uDeltaZ); - } - - void update(bool _force) override - { - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer == nullptr || pBuffer->m_pDepthBuffer == nullptr) - return; - - const bool nDepthEnabled = ((gSP.geometryMode & G_ZBUFFER) || gDP.otherMode.depthSource == G_ZS_PRIM) && - gDP.otherMode.cycleType <= G_CYC_2CYCLE; - uEnableDepth.set(nDepthEnabled ? 1 : 0, _force); - if (nDepthEnabled) { - uEnableDepthCompare.set(gDP.otherMode.depthCompare, _force); - uEnableDepthUpdate.set(gDP.otherMode.depthUpdate, _force); - } else { - uEnableDepthCompare.set(0, _force); - uEnableDepthUpdate.set(0, _force); - } - uDepthMode.set(gDP.otherMode.depthMode, _force); - uDepthSource.set(gDP.otherMode.depthSource, _force); - if (gDP.otherMode.depthSource == G_ZS_PRIM) { - uDeltaZ.set(gDP.primDepth.deltaZ, _force); - uPrimDepth.set(gDP.primDepth.z, _force); - } - } - -private: - iUniform uEnableDepth; - iUniform uEnableDepthCompare; - iUniform uEnableDepthUpdate; - iUniform uDepthMode; - iUniform uDepthSource; - fUniform uPrimDepth; - fUniform uDeltaZ; -}; - -class UDepthSource : public UniformGroup -{ -public: - UDepthSource(GLuint _program) { - LocateUniform(uDepthSource); - LocateUniform(uPrimDepth); - } - - void update(bool _force) override - { - uDepthSource.set(gDP.otherMode.depthSource, _force); - if (gDP.otherMode.depthSource == G_ZS_PRIM) - uPrimDepth.set(gDP.primDepth.z, _force); - } - -private: - iUniform uDepthSource; - fUniform uPrimDepth; -}; - -class URenderTarget : public UniformGroup -{ -public: - URenderTarget(GLuint _program) { - LocateUniform(uRenderTarget); - } - - void update(bool _force) override - { - int renderTarget = 0; - if (isCurrentColorImageDepthImage()) { - renderTarget = isDepthCompareEnabled() ? 2 : 1; - } - uRenderTarget.set(renderTarget, _force); - } - -private: - iUniform uRenderTarget; -}; - -class UClampMode : public UniformGroup -{ -public: - UClampMode(GLuint _program) { - LocateUniform(uClampMode); - } - - void update(bool _force) override - { - int clampMode = -1; - switch (gfxContext.getClampMode()) - { - case graphics::ClampMode::ClippingEnabled: - clampMode = 0; - break; - case graphics::ClampMode::NoNearPlaneClipping: - clampMode = 1; - break; - case graphics::ClampMode::NoClipping: - clampMode = 2; - break; - } - uClampMode.set(clampMode, _force); - } - -private: - iUniform uClampMode; -}; - -class UPolygonOffset : public UniformGroup -{ -public: - UPolygonOffset(GLuint _program) { - LocateUniform(uPolygonOffset); - } - - void update(bool _force) override - { - f32 offset = gfxContext.isEnabled(graphics::enable::POLYGON_OFFSET_FILL) ? 0.003f : 0.0f; - uPolygonOffset.set(offset, _force); - } - -private: - fUniform uPolygonOffset; -}; - -class UScreenCoordsScale : public UniformGroup -{ -public: - UScreenCoordsScale(GLuint _program) { - LocateUniform(uScreenCoordsScale); - } - - void update(bool _force) override - { - f32 scaleX, scaleY; - calcCoordsScales(frameBufferList().getCurrent(), scaleX, scaleY); - uScreenCoordsScale.set(2.0f*scaleX, -2.0f*scaleY, _force); - } - -private: - fv2Uniform uScreenCoordsScale; -}; - -class UColors : public UniformGroup -{ -public: - UColors(GLuint _program) { - LocateUniform(uFogColor); - LocateUniform(uCenterColor); - LocateUniform(uScaleColor); - LocateUniform(uBlendColor); - LocateUniform(uEnvColor); - LocateUniform(uPrimColor); - LocateUniform(uPrimLod); - LocateUniform(uK4); - LocateUniform(uK5); - } - - void update(bool _force) override - { - uFogColor.set(&gDP.fogColor.r, _force); - uCenterColor.set(&gDP.key.center.r, _force); - uScaleColor.set(&gDP.key.scale.r, _force); - uBlendColor.set(&gDP.blendColor.r, _force); - uEnvColor.set(&gDP.envColor.r, _force); - uPrimColor.set(&gDP.primColor.r, _force); - uPrimLod.set(gDP.primColor.l, _force); - uK4.set(_FIXED2FLOATCOLOR(gDP.convert.k4, 8 ), _force); - uK5.set(_FIXED2FLOATCOLOR(gDP.convert.k5, 8 ), _force); - } - -private: - fv4Uniform uFogColor; - fv4Uniform uCenterColor; - fv4Uniform uScaleColor; - fv4Uniform uBlendColor; - fv4Uniform uEnvColor; - fv4Uniform uPrimColor; - fUniform uPrimLod; - fUniform uK4; - fUniform uK5; -}; - -class URectColor : public UniformGroup -{ -public: - URectColor(GLuint _program) { - LocateUniform(uRectColor); - } - - void update(bool _force) override - { - uRectColor.set(&gDP.rectColor.r, _force); - } - -private: - fv4Uniform uRectColor; -}; - -class UTextureSize : public UniformGroup -{ -public: - UTextureSize(GLuint _program, bool _useT0, bool _useT1) - : m_useT0(_useT0) - , m_useT1(_useT1) - { - LocateUniform(uTextureSize[0]); - LocateUniform(uTextureSize[1]); - } - - void update(bool _force) override - { - TextureCache & cache = textureCache(); - if (m_useT0 && cache.current[0] != NULL) - uTextureSize[0].set((float)cache.current[0]->width, (float)cache.current[0]->height, _force); - if (m_useT1 && cache.current[1] != NULL) - uTextureSize[1].set((float)cache.current[1]->width, (float)cache.current[1]->height, _force); - } - -private: - fv2Uniform uTextureSize[2]; - bool m_useT0; - bool m_useT1; -}; - -class UTextureParams : public UniformGroup -{ -public: - UTextureParams(GLuint _program, bool _useT0, bool _useT1) - { - m_useTile[0] = _useT0; - m_useTile[1] = _useT1; - LocateUniform(uTexOffset[0]); - LocateUniform(uTexOffset[1]); - LocateUniform(uCacheShiftScale[0]); - LocateUniform(uCacheShiftScale[1]); - LocateUniform(uCacheScale[0]); - LocateUniform(uCacheScale[1]); - LocateUniform(uCacheOffset[0]); - LocateUniform(uCacheOffset[1]); - LocateUniform(uTexScale); - LocateUniform(uTexSize[0]); - LocateUniform(uTexSize[1]); - LocateUniform(uCacheFrameBuffer); - } - - void update(bool _force) override - { - int nFB[2] = { 0, 0 }; - TextureCache & cache = textureCache(); - for (u32 t = 0; t < 2; ++t) { - if (!m_useTile[t]) - continue; - - gDPTile * pTile = gSP.textureTile[t]; - if (pTile != nullptr) { - if (pTile->textureMode == TEXTUREMODE_BGIMAGE || pTile->textureMode == TEXTUREMODE_FRAMEBUFFER_BG) - uTexOffset[t].set(0.0f, 0.0f, _force); - else { - float fuls = pTile->fuls; - float fult = pTile->fult; - if (pTile->frameBufferAddress > 0) { - FrameBuffer * pBuffer = frameBufferList().getBuffer(pTile->frameBufferAddress); - if (pBuffer != nullptr) { - if (pTile->masks > 0 && pTile->clamps == 0) - fuls = float(pTile->uls % (1 << pTile->masks)); - if (pTile->maskt > 0 && pTile->clampt == 0) - fult = float(pTile->ult % (1 << pTile->maskt)); - } else { - pTile->frameBufferAddress = 0; - } - } - uTexOffset[t].set(fuls, fult, _force); - } - } - - CachedTexture *_pTexture = cache.current[t]; - if (_pTexture != nullptr) { - f32 shiftScaleS = 1.0f; - f32 shiftScaleT = 1.0f; - getTextureShiftScale(t, cache, shiftScaleS, shiftScaleT); - uCacheShiftScale[t].set(shiftScaleS, shiftScaleT, _force); - uCacheScale[t].set(_pTexture->hdRatioS, _pTexture->hdRatioT, _force); - uCacheOffset[t].set(_pTexture->offsetS, _pTexture->offsetT, _force); - nFB[t] = _pTexture->frameBufferTexture; - } - } - - uCacheFrameBuffer.set(nFB[0], nFB[1], _force); - uTexScale.set(gSP.texture.scales, gSP.texture.scalet, _force); - } - -private: - bool m_useTile[2]; - fv2Uniform uTexOffset[2]; - fv2Uniform uCacheShiftScale[2]; - fv2Uniform uCacheScale[2]; - fv2Uniform uCacheOffset[2]; - fv2Uniform uTexScale; - fv2Uniform uTexSize[2]; - iv2Uniform uCacheFrameBuffer; -}; - -class UTextureEngine : public UniformGroup -{ -public: - UTextureEngine(GLuint _program, bool _useT0, bool _useT1) - { - m_useTile[0] = _useT0; - m_useTile[1] = _useT1; - LocateUniform(uTexWrap0); - LocateUniform(uTexWrap1); - LocateUniform(uTexClamp0); - LocateUniform(uTexClamp1); - LocateUniform(uTexWrapEn0); - LocateUniform(uTexWrapEn1); - LocateUniform(uTexClampEn0); - LocateUniform(uTexClampEn1); - LocateUniform(uTexMirrorEn0); - LocateUniform(uTexMirrorEn1); - LocateUniform(uTexSize0); - LocateUniform(uTexSize1); - } - - void update(bool _force) override - { - std::array aTexWrap[2] = { { 1024.0f, 1024.0f }, { 1024.0f, 1024.0f } }; - std::array aTexClamp[2] = { { 1024.0f, 1024.0f }, { 1024.0f, 1024.0f } }; - std::array aTexWrapEn[2] = { { 0.0f, 0.0f }, { 0.0f, 0.0f } }; - std::array aTexClampEn[2] = { { 0.0f, 0.0f }, { 0.0f, 0.0f } }; - std::array aTexMirrorEn[2] = { { 0.0f, 0.0f }, { 0.0f,0.0f }}; - std::array aTexSize[2] = { { 1024.0f, 1024.0f }, { 1024.0f, 1024.0f } }; - - TextureCache & cache = textureCache(); - const bool replaceTex1ByTex0 = needReplaceTex1ByTex0(); - for (u32 t = 0; t < 2; ++t) { - if (!m_useTile[t]) - continue; - - const u32 tile = replaceTex1ByTex0 ? 0 : t; - const gDPTile * pTile = gSP.textureTile[tile]; - CachedTexture * pTexture = cache.current[tile]; - if (pTile == nullptr || pTexture == nullptr) - continue; - - aTexSize[t][0] = pTexture->width * pTexture->hdRatioS; - aTexSize[t][1] = pTexture->height * pTexture->hdRatioT; - - /* Not sure if special treatment of framebuffer textures is correct */ - if (pTexture->frameBufferTexture != CachedTexture::fbNone) - { - aTexClamp[t][0] = f32(pTexture->width) * pTexture->hdRatioS - 1.0f; - aTexClamp[t][1] = f32(pTexture->height) * pTexture->hdRatioT - 1.0f; - aTexWrapEn[t][0] = 0.0; - aTexWrapEn[t][1] = 0.0; - aTexClampEn[t][0] = 1.0; - aTexClampEn[t][1] = 1.0; - aTexMirrorEn[t][0] = 0.0; - aTexMirrorEn[t][1] = 0.0; - } else if (pTile->textureMode != TEXTUREMODE_NORMAL || g_debugger.isDebugMode()) { - aTexWrapEn[t][0] = 0.0; - aTexWrapEn[t][1] = 0.0; - aTexClampEn[t][0] = 0.0; - aTexClampEn[t][1] = 0.0; - aTexMirrorEn[t][0] = 0.0; - aTexMirrorEn[t][1] = 0.0; - } else { - aTexWrap[t][0] = f32(1 << pTile->masks) * pTexture->hdRatioS; - aTexWrap[t][1] = f32(1 << pTile->maskt) * pTexture->hdRatioT; - aTexClamp[t][0] = f32(pTile->lrs - pTile->uls + 1) * pTexture->hdRatioS - 1.0f; - aTexClamp[t][1] = f32(pTile->lrt - pTile->ult + 1) * pTexture->hdRatioT - 1.0f; - aTexWrapEn[t][0] = f32(pTile->masks == 0 ? 0 : 1); - aTexWrapEn[t][1] = f32(pTile->maskt == 0 ? 0 : 1); - aTexClampEn[t][0] = f32(gDP.otherMode.cycleType == G_CYC_COPY ? 0 : (pTile->masks == 0 ? 1 : pTile->clamps)); - aTexClampEn[t][1] = f32(gDP.otherMode.cycleType == G_CYC_COPY ? 0 : (pTile->maskt == 0 ? 1 : pTile->clampt)); - aTexMirrorEn[t][0] = f32(pTile->masks == 0 ? 0 : pTile->mirrors); - aTexMirrorEn[t][1] = f32(pTile->maskt == 0 ? 0 : pTile->mirrort); - } - } - - uTexWrap0.set(aTexWrap[0][0], aTexWrap[0][1], _force); - uTexWrap1.set(aTexWrap[1][0], aTexWrap[1][1], _force); - uTexClamp0.set(aTexClamp[0][0], aTexClamp[0][1], _force); - uTexClamp1.set(aTexClamp[1][0], aTexClamp[1][1], _force); - uTexWrapEn0.set(aTexWrapEn[0][0], aTexWrapEn[0][1], _force); - uTexWrapEn1.set(aTexWrapEn[1][0], aTexWrapEn[1][1], _force); - uTexClampEn0.set(aTexClampEn[0][0], aTexClampEn[0][1], _force); - uTexClampEn1.set(aTexClampEn[1][0], aTexClampEn[1][1], _force); - uTexMirrorEn0.set(aTexMirrorEn[0][0], aTexMirrorEn[0][1], _force); - uTexMirrorEn1.set(aTexMirrorEn[1][0], aTexMirrorEn[1][1], _force); - uTexSize0.set(aTexSize[0][0], aTexSize[0][1], _force); - uTexSize1.set(aTexSize[1][0], aTexSize[1][1], _force); - - } - -private: - bool m_useTile[2]; - fv2Uniform uTexWrap0; - fv2Uniform uTexWrap1; - fv2Uniform uTexClamp0; - fv2Uniform uTexClamp1; - fv2Uniform uTexWrapEn0; - fv2Uniform uTexWrapEn1; - fv2Uniform uTexClampEn0; - fv2Uniform uTexClampEn1; - fv2Uniform uTexMirrorEn0; - fv2Uniform uTexMirrorEn1; - fv2Uniform uTexSize0; - fv2Uniform uTexSize1; -}; - -class ULights : public UniformGroup -{ -public: - ULights(GLuint _program) - { - char buf[32]; - for (s32 i = 0; i < 8; ++i) { - sprintf(buf, "uLightDirection[%d]", i); - uLightDirection[i].loc = glGetUniformLocation(_program, buf); - sprintf(buf, "uLightColor[%d]", i); - uLightColor[i].loc = glGetUniformLocation(_program, buf); - } - } - - void update(bool _force) override - { - for (u32 i = 0; i <= gSP.numLights; ++i) { - uLightDirection[i].set(gSP.lights.xyz[i], _force); - uLightColor[i].set(gSP.lights.rgb[i], _force); - } - } - -private: - fv3Uniform uLightDirection[8]; - fv3Uniform uLightColor[8]; -}; - - -/*---------------CombinerProgramUniformFactory-------------*/ - -void CombinerProgramUniformFactory::buildUniforms(GLuint _program, - const CombinerInputs & _inputs, - const CombinerKey & _key, - UniformGroups & _uniforms) -{ - _uniforms.emplace_back(new UNoiseTex(_program)); - _uniforms.emplace_back(new UScreenSpaceTriangleInfo(_program)); - _uniforms.emplace_back(new URasterInfo(_program)); - _uniforms.emplace_back(new UViewportInfo(_program)); - - if (!m_glInfo.isGLES2) { - _uniforms.emplace_back(new UDepthTex(_program)); - _uniforms.emplace_back(new UDepthScale(_program)); - } - - if (_inputs.usesTexture()) { - _uniforms.emplace_back(new UTextures(_program)); - - if (config.video.multisampling != 0) - _uniforms.emplace_back(new UMSAATextures(_program)); - - _uniforms.emplace_back(new UFrameBufferInfo(_program)); - - if (_inputs.usesLOD()) { - _uniforms.emplace_back(new UMipmap1(_program)); - if (config.generalEmulation.enableLOD != 0) - _uniforms.emplace_back(new UMipmap2(_program)); - } else if (_key.getCycleType() < G_CYC_COPY) { - _uniforms.emplace_back(new UTextureFetchMode(_program)); - } - - _uniforms.emplace_back(new UTexturePersp(_program)); - - if (m_glInfo.isGLES2) - _uniforms.emplace_back(new UTextureSize(_program, _inputs.usesTile(0), _inputs.usesTile(1))); - - if (!_key.isRectKey()) - _uniforms.emplace_back(new UTextureParams(_program, _inputs.usesTile(0), _inputs.usesTile(1))); - - _uniforms.emplace_back(new UTextureEngine(_program, _inputs.usesTile(0), _inputs.usesTile(1))); - } - - _uniforms.emplace_back(new UFog(_program)); - - if (config.generalEmulation.enableLegacyBlending == 0) { - switch (_key.getCycleType()) { - case G_CYC_1CYCLE: - _uniforms.emplace_back(new UBlendMode1Cycle(_program)); - break; - case G_CYC_2CYCLE: - _uniforms.emplace_back(new UBlendMode2Cycle(_program)); - break; - } - } - - _uniforms.emplace_back(new UBlendCvg(_program)); - - _uniforms.emplace_back(new UDitherMode(_program, _inputs.usesNoise())); - - _uniforms.emplace_back(new UScreenScale(_program)); - - _uniforms.emplace_back(new UAlphaTestInfo(_program)); - - if ((config.generalEmulation.hacks & hack_RE2) != 0 && config.generalEmulation.enableFragmentDepthWrite != 0) - _uniforms.emplace_back(new UZLutTexture(_program)); - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) - _uniforms.emplace_back(new UDepthInfo(_program)); - else - _uniforms.emplace_back(new UDepthSource(_program)); - - if (config.generalEmulation.enableFragmentDepthWrite != 0 || - config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) - _uniforms.emplace_back(new URenderTarget(_program)); - - if (m_glInfo.isGLESX && m_glInfo.noPerspective) { - _uniforms.emplace_back(new UClampMode(_program)); - _uniforms.emplace_back(new UPolygonOffset(_program)); - } - - _uniforms.emplace_back(new UScreenCoordsScale(_program)); - - _uniforms.emplace_back(new UColors(_program)); - - if (_key.isRectKey()) - _uniforms.emplace_back(new URectColor(_program)); - - if (_inputs.usesHwLighting()) - _uniforms.emplace_back(new ULights(_program)); -} - -CombinerProgramUniformFactory::CombinerProgramUniformFactory(const opengl::GLInfo & _glInfo) -: m_glInfo(_glInfo) -{ -} - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.h deleted file mode 100644 index f17ff1b..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include -#include "glsl_CombinerProgramImpl.h" - -namespace glsl { - - class CombinerProgramUniformFactory - { - public: - CombinerProgramUniformFactory(const opengl::GLInfo & _glInfo); - - void buildUniforms(GLuint _program, - const CombinerInputs & _inputs, - const CombinerKey & _key, - UniformGroups & _uniforms); - - private: - const opengl::GLInfo & m_glInfo; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_FXAA.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_FXAA.cpp deleted file mode 100644 index f580fd2..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_FXAA.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/** -FXAA implementation for glslify in WebGL, adopted for GLideN64 - --- - -From: -https://github.com/mattdesl/glsl-fxaa -*/ -/** -Basic FXAA implementation based on the code on geeks3d.com with the -modification that the texture2DLod stuff was removed since it's -unsupported by WebGL. - --- - -From: -https://github.com/mitsuhiko/webgl-meincraft - -Copyright (c) 2011 by Armin Ronacher. - -Some rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following -disclaimer in the documentation and/or other materials provided -with the distribution. - -* The names of the contributors may not be used to endorse or -promote products derived from this software without specific -prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "glsl_FXAA.h" - -using namespace glsl; - -FXAAVertexShader::FXAAVertexShader(const opengl::GLInfo & _glinfo) -{ - m_part = - "precision mediump float; \n" - " \n" - "//texcoords computed in vertex step \n" - "//to avoid dependent texture reads \n" - "OUT vec2 v_rgbNW; \n" - "OUT vec2 v_rgbNE; \n" - "OUT vec2 v_rgbSW; \n" - "OUT vec2 v_rgbSE; \n" - "OUT vec2 v_rgbM; \n" - " \n" - "uniform vec2 uTextureSize; \n" - "IN highp vec4 aRectPosition; \n" - " \n" - "void main(void) { \n" - " gl_Position = aRectPosition; \n" - " \n" - " //compute the texture coords and send them to varyings \n" - " vec2 vUv = (aRectPosition.xy + 1.0) * 0.5; \n" - " vec2 fragCoord = vUv * uTextureSize; \n" - " vec2 inverseVP = vec2(1.0) / uTextureSize; \n" - " v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; \n" - " v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; \n" - " v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; \n" - " v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; \n" - " v_rgbM = vec2(fragCoord * inverseVP); \n" - "} \n" - ; -} - -FXAAFragmentShader::FXAAFragmentShader(const opengl::GLInfo & _glinfo) -{ - m_part = - "#ifndef FXAA_REDUCE_MIN \n" - " #define FXAA_REDUCE_MIN (1.0/ 128.0) \n" - "#endif \n" - "#ifndef FXAA_REDUCE_MUL \n" - " #define FXAA_REDUCE_MUL (1.0 / 8.0) \n" - "#endif \n" - "#ifndef FXAA_SPAN_MAX \n" - " #define FXAA_SPAN_MAX 8.0 \n" - "#endif \n" - " \n" - "precision mediump float; \n" - "IN vec2 v_rgbNW; \n" - "IN vec2 v_rgbNE; \n" - "IN vec2 v_rgbSW; \n" - "IN vec2 v_rgbSE; \n" - "IN vec2 v_rgbM; \n" - " \n" - "uniform vec2 uTextureSize; \n" - "uniform sampler2D uTex0; \n" - " \n" - "vec4 fxaa(vec2 fragCoord) { \n" - " vec4 color; \n" - " mediump vec2 inverseVP = vec2(1.0) / uTextureSize; \n" - " vec3 rgbNW = texture2D(uTex0, v_rgbNW).xyz; \n" - " vec3 rgbNE = texture2D(uTex0, v_rgbNE).xyz; \n" - " vec3 rgbSW = texture2D(uTex0, v_rgbSW).xyz; \n" - " vec3 rgbSE = texture2D(uTex0, v_rgbSE).xyz; \n" - " vec4 texColor = texture2D(uTex0, v_rgbM); \n" - " vec3 rgbM = texColor.xyz; \n" - " vec3 luma = vec3(0.299, 0.587, 0.114); \n" - " float lumaNW = dot(rgbNW, luma); \n" - " float lumaNE = dot(rgbNE, luma); \n" - " float lumaSW = dot(rgbSW, luma); \n" - " float lumaSE = dot(rgbSE, luma); \n" - " float lumaM = dot(rgbM, luma); \n" - " float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); \n" - " float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); \n" - " \n" - " mediump vec2 dir; \n" - " dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); \n" - " dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); \n" - " \n" - " float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * \n" - " (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); \n" - " \n" - " float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); \n" - " dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), \n" - " max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), \n" - " dir * rcpDirMin)) * inverseVP; \n" - " \n" - " vec3 rgbA = 0.5 * ( \n" - " texture2D(uTex0, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + \n" - " texture2D(uTex0, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); \n" - " vec3 rgbB = rgbA * 0.5 + 0.25 * ( \n" - " texture2D(uTex0, fragCoord * inverseVP + dir * -0.5).xyz + \n" - " texture2D(uTex0, fragCoord * inverseVP + dir * 0.5).xyz); \n" - " \n" - " float lumaB = dot(rgbB, luma); \n" - " if ((lumaB < lumaMin) || (lumaB > lumaMax)) \n" - " color = vec4(rgbA, texColor.a); \n" - " else \n" - " color = vec4(rgbB, texColor.a); \n" - " return color; \n" - "} \n" - " \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() { \n" - " fragColor = fxaa(gl_FragCoord.xy); \n" - ; -} \ No newline at end of file diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_FXAA.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_FXAA.h deleted file mode 100644 index b9d874d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_FXAA.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "glsl_ShaderPart.h" -#include - -namespace glsl { - - class FXAAVertexShader : public ShaderPart - { - public: - FXAAVertexShader(const opengl::GLInfo & _glinfo); - }; - - class FXAAFragmentShader : public ShaderPart - { - public: - FXAAFragmentShader(const opengl::GLInfo & _glinfo); - }; -} \ No newline at end of file diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderPart.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderPart.h deleted file mode 100644 index 130ad14..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderPart.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include -#include - -namespace glsl { - - class ShaderPart - { - public: - virtual ~ShaderPart() {} - virtual void write(std::stringstream & shader) const - { - shader << m_part; - } - - protected: - std::string m_part; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.cpp deleted file mode 100644 index 0a3304f..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.cpp +++ /dev/null @@ -1,382 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "glsl_Utils.h" -#include "glsl_ShaderStorage.h" -#include "glsl_CombinerProgramImpl.h" -#include "glsl_CombinerProgramUniformFactory.h" - -using namespace glsl; - -#define SHADER_STORAGE_FOLDER_NAME "shaders" - -static -std::string getStorageFileName(const opengl::GLInfo & _glinfo, const char * _fileExtension) -{ - class SetLocale - { - public: - SetLocale() : m_locale(setlocale(LC_CTYPE, NULL)) { setlocale(LC_CTYPE, ""); } - ~SetLocale() { setlocale(LC_CTYPE, m_locale.c_str()); } - private: - std::string m_locale; - } setLocale; - - wchar_t strCacheFolderPath[PLUGIN_PATH_SIZE]; - api().GetUserCachePath(strCacheFolderPath); - - // Convert wchar string to multibyte string - // Use large enough buffer to hold multibyte conversion of wchar string - char strCacheFolderPathChar[PLUGIN_PATH_SIZE * 4]; - std::wcstombs(strCacheFolderPathChar, strCacheFolderPath, sizeof(strCacheFolderPathChar)); - - std::stringstream path; - path << strCacheFolderPathChar << "/" << SHADER_STORAGE_FOLDER_NAME; - - // Convert back to wide chars before using osal - wchar_t strShaderFolderPath[PLUGIN_PATH_SIZE]; - std::mbstowcs(strShaderFolderPath, path.str().c_str(), PLUGIN_PATH_SIZE); - - if (!osal_path_existsW(strShaderFolderPath) || !osal_is_directory(strShaderFolderPath)) { - if (osal_mkdirp(strShaderFolderPath) != 0) { - path.str(""); - path << strCacheFolderPathChar; - } - } - - std::string strOpenGLType; - - if(_glinfo.isGLESX) { - strOpenGLType = "GLES"; - } else { - strOpenGLType = "OpenGL"; - } - - path << "/GLideN64." << std::hex << static_cast(std::hash()(RSP.romname)) - << "." << strOpenGLType << "." << _fileExtension; - - return path.str(); -} - -/* -Storage has text format: -line_1 Version in hex form -line_2 Hardware per pixel lighting support flag -line_3 Count - numbers of combiners keys in hex form -line_4..line_Count+3 combiners keys in hex form, one key per line -*/ -bool ShaderStorage::_saveCombinerKeys(const graphics::Combiners & _combiners) const -{ - std::string keysFileName = getStorageFileName(m_glinfo, "keys"); - -#if defined(OS_WINDOWS) && !defined(MINGW) - std::ofstream keysOut(keysFileName, std::ofstream::trunc); -#else - std::ofstream keysOut(keysFileName.c_str(), std::ofstream::trunc); -#endif - if (!keysOut) - return false; - - const size_t szCombiners = _combiners.size(); - - std::vector allShaderData; - std::vector keysData; - keysData.reserve(szCombiners); - for (auto cur = _combiners.begin(); cur != _combiners.end(); ++cur) - keysData.push_back(cur->first.getMux()); - - std::sort(keysData.begin(), keysData.end()); - keysOut << "0x" << std::hex << std::setfill('0') << std::setw(8) << m_keysFormatVersion << "\n"; - keysOut << "0x" << std::hex << std::setfill('0') << std::setw(8) << keysData.size() << "\n"; - for (u64 key : keysData) - keysOut << "0x" << std::hex << std::setfill('0') << std::setw(16) << key << "\n"; - - keysOut.flush(); - keysOut.close(); - return true; -} - -/* -Storage format: -uint32 - format version; -uint32 - bitset of config options, which may change how shader is created. -uint32 - len of renderer string -char * - renderer string -uint32 - len of GL version string -char * - GL version string -uint32 - number of shaders -shaders in binary form -*/ -bool ShaderStorage::saveShadersStorage(const graphics::Combiners & _combiners) const -{ - if (!_saveCombinerKeys(_combiners)) - return false; - - if (gfxContext.isCombinerProgramBuilderObsolete()) - // Created shaders are obsolete due to changes in config, but we saved combiners keys. - return true; - - if (!graphics::Context::ShaderProgramBinary) - // Shaders storage is not supported, but we saved combiners keys. - return true; - - std::string shadersFileName = getStorageFileName(m_glinfo, "shaders"); - -#if defined(OS_WINDOWS) && !defined(MINGW) - std::ofstream shadersOut(shadersFileName, std::ofstream::binary | std::ofstream::trunc); -#else - std::ofstream shadersOut(shadersFileName.c_str(), std::ofstream::binary | std::ofstream::trunc); -#endif - if (!shadersOut) - return false; - - displayLoadProgress(L"SAVE COMBINER SHADERS %.1f%%", 0.0f); - - shadersOut.write((char*)&m_formatVersion, sizeof(m_formatVersion)); - - const u32 configOptionsBitSet = graphics::CombinerProgram::getShaderCombinerOptionsBits(); - shadersOut.write((char*)&configOptionsBitSet, sizeof(configOptionsBitSet)); - - const char * strRenderer = reinterpret_cast(glGetString(GL_RENDERER)); - u32 len = static_cast(strlen(strRenderer)); - shadersOut.write((char*)&len, sizeof(len)); - shadersOut.write(strRenderer, len); - - const char * strGLVersion = reinterpret_cast(glGetString(GL_VERSION)); - len = static_cast(strlen(strGLVersion)); - shadersOut.write((char*)&len, sizeof(len)); - shadersOut.write(strGLVersion, len); - - const size_t szCombiners = _combiners.size(); - - u32 totalWritten = 0; - std::vector allShaderData; - std::vector keysData; - - const f32 percent = szCombiners / 100.0f; - const f32 step = 100.0f / szCombiners; - f32 progress = 0.0f; - f32 percents = percent; - - for (auto cur = _combiners.begin(); cur != _combiners.end(); ++cur) - { - std::vector data; - if (cur->second->getBinaryForm(data)) - { - allShaderData.insert(allShaderData.end(), data.begin(), data.end()); - ++totalWritten; - progress += step; - if (progress > percents) { - displayLoadProgress(L"SAVE COMBINER SHADERS %.1f%%", f32(totalWritten) * 100.f / f32(szCombiners)); - percents += percent; - } - } - else - { - LOG(LOG_ERROR, "Error while writing shader with key key=0x%016lX", - static_cast(cur->second->getKey().getMux())); - } - } - - shadersOut.write((char*)&totalWritten, sizeof(totalWritten)); - shadersOut.write(allShaderData.data(), allShaderData.size()); - - shadersOut.flush(); - shadersOut.close(); - displayLoadProgress(L""); - return true; -} - -static -CombinerProgramImpl * _readCombinerProgramFromStream(std::istream & _is, - CombinerKey& _cmbKey, - CombinerProgramUniformFactory & _uniformFactory, - opengl::CachedUseProgram * _useProgram) -{ - int inputs; - _is.read((char*)&inputs, sizeof(inputs)); - CombinerInputs cmbInputs(inputs); - - GLenum binaryFormat; - GLint binaryLength; - _is.read((char*)&binaryFormat, sizeof(binaryFormat)); - _is.read((char*)&binaryLength, sizeof(binaryLength)); - std::vector binary(binaryLength); - _is.read(binary.data(), binaryLength); - - GLuint program = glCreateProgram(); - const bool isRect = _cmbKey.isRectKey(); - glsl::Utils::locateAttributes(program, isRect, cmbInputs.usesTexture()); - glProgramBinary(program, binaryFormat, binary.data(), binaryLength); - if (!glsl::Utils::checkProgramLinkStatus(program, true)) { - return nullptr; - } - - UniformGroups uniforms; - _uniformFactory.buildUniforms(program, cmbInputs, _cmbKey, uniforms); - - return new CombinerProgramImpl(_cmbKey, program, _useProgram, cmbInputs, std::move(uniforms)); -} - -bool ShaderStorage::_loadFromCombinerKeys(graphics::Combiners & _combiners) -{ - std::string keysFileName = getStorageFileName(m_glinfo, "keys"); -#if defined(OS_WINDOWS) && !defined(MINGW) - std::ifstream fin(keysFileName); -#else - std::ifstream fin(keysFileName.c_str()); -#endif - if (!fin) - return false; - - u32 version; - fin >> std::hex >> version; - if (version < 4) - return false; - - const bool useGlobalHWLSuport = version == 4; - - if (useGlobalHWLSuport) { - u32 hwlSupport = 0; - fin >> std::hex >> hwlSupport; - GBI.setHWLSupported(hwlSupport != 0); - } - - displayLoadProgress(L"LOAD COMBINER SHADERS %.1f%%", 0.0f); - - u32 szCombiners; - fin >> std::hex >> szCombiners; - const f32 percent = szCombiners / 100.0f; - const f32 step = 100.0f / szCombiners; - f32 progress = 0.0f; - f32 percents = percent; - u64 mux; - for (u32 i = 0; i < szCombiners; ++i) { - fin >> std::hex >> mux; - CombinerKey key(mux, false); - if (!useGlobalHWLSuport) - GBI.setHWLSupported(key.isHWLSupported()); - graphics::CombinerProgram * pCombiner = Combiner_Compile(key); - pCombiner->update(true); - _combiners[pCombiner->getKey()] = pCombiner; - progress += step; - if (progress > percents) { - displayLoadProgress(L"LOAD COMBINER SHADERS %.1f%%", f32(i + 1) * 100.f / f32(szCombiners)); - percents += percent; - } - } - fin.close(); - - if (opengl::Utils::isGLError()) - return false; - - if (graphics::Context::ShaderProgramBinary) - // Restore shaders storage - return saveShadersStorage(_combiners); - - displayLoadProgress(L""); - return true; -} - -bool ShaderStorage::loadShadersStorage(graphics::Combiners & _combiners) -{ - if (!graphics::Context::ShaderProgramBinary) - // Shaders storage is not supported, load from combiners keys. - return _loadFromCombinerKeys(_combiners); - - std::string shadersFileName = getStorageFileName(m_glinfo, "shaders"); - const u32 configOptionsBitSet = graphics::CombinerProgram::getShaderCombinerOptionsBits(); - -#if defined(OS_WINDOWS) && !defined(MINGW) - std::ifstream fin(shadersFileName, std::ofstream::binary); -#else - std::ifstream fin(shadersFileName.c_str(), std::ofstream::binary); -#endif - - if (!fin) - return _loadFromCombinerKeys(_combiners); - - try { - u32 version; - fin.read((char*)&version, sizeof(version)); - if (version != m_formatVersion) - return _loadFromCombinerKeys(_combiners); - - u32 optionsSet; - fin.read((char*)&optionsSet, sizeof(optionsSet)); - if (optionsSet != configOptionsBitSet) - return _loadFromCombinerKeys(_combiners); - - const char * strRenderer = reinterpret_cast(glGetString(GL_RENDERER)); - u32 len; - fin.read((char*)&len, sizeof(len)); - std::vector strBuf(len); - fin.read(strBuf.data(), len); - if (strncmp(strRenderer, strBuf.data(), len) != 0) - return _loadFromCombinerKeys(_combiners); - - const char * strGLVersion = reinterpret_cast(glGetString(GL_VERSION)); - fin.read((char*)&len, sizeof(len)); - strBuf.resize(len); - fin.read(strBuf.data(), len); - if (strncmp(strGLVersion, strBuf.data(), len) != 0) - return _loadFromCombinerKeys(_combiners); - - displayLoadProgress(L"LOAD COMBINER SHADERS %.1f%%", 0.0f); - CombinerProgramUniformFactory uniformFactory(m_glinfo); - - fin.read((char*)&len, sizeof(len)); - const f32 percent = len / 100.0f; - const f32 step = 100.0f / len; - f32 progress = 0.0f; - f32 percents = percent; - for (u32 i = 0; i < len; ++i) { - CombinerKey cmbKey; - cmbKey.read(fin); - - CombinerProgramImpl * pCombiner = _readCombinerProgramFromStream(fin, cmbKey, uniformFactory, m_useProgram); - - if (pCombiner != nullptr) { - pCombiner->update(true); - _combiners[pCombiner->getKey()] = pCombiner; - } else { - LOG(LOG_ERROR, "Shader is not a valid binary compiling from key instead"); - graphics::CombinerProgram *pCombinerFromKey = Combiner_Compile(cmbKey); - pCombinerFromKey->update(true); - _combiners[cmbKey] = pCombinerFromKey; - } - - progress += step; - if (progress > percents) { - displayLoadProgress(L"LOAD COMBINER SHADERS %.1f%%", f32(i + 1) * 100.f / f32(len) ); - percents += percent; - } - } - } catch (...) { - LOG(LOG_ERROR, "Stream error while loading shader cache! Buffer is probably not big enough"); - } - - fin.close(); - displayLoadProgress(L""); - return !opengl::Utils::isGLError(); -} - - -ShaderStorage::ShaderStorage(const opengl::GLInfo & _glinfo, opengl::CachedUseProgram * _useProgram) -: m_glinfo(_glinfo) -, m_useProgram(_useProgram) -{ -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h deleted file mode 100644 index 50a9ded..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include - -namespace opengl { - class CachedUseProgram; -} - -namespace glsl { - - class ShaderStorage - { - public: - ShaderStorage(const opengl::GLInfo & _glinfo, opengl::CachedUseProgram * _useProgram); - - bool saveShadersStorage(const graphics::Combiners & _combiners) const; - - bool loadShadersStorage(graphics::Combiners & _combiners); - - private: - bool _saveCombinerKeys(const graphics::Combiners & _combiners) const; - bool _loadFromCombinerKeys(graphics::Combiners & _combiners); - - const u32 m_formatVersion = 0x35U; - const u32 m_keysFormatVersion = 0x05; - const opengl::GLInfo & m_glinfo; - opengl::CachedUseProgram * m_useProgram; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp deleted file mode 100644 index 707380d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp +++ /dev/null @@ -1,1002 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "glsl_SpecialShadersFactory.h" -#include "glsl_ShaderPart.h" -#include "glsl_FXAA.h" -#include "glsl_Utils.h" - -namespace glsl { - - /*---------------VertexShaderPart-------------*/ - - class VertexShaderRectNocolor : public ShaderPart - { - public: - VertexShaderRectNocolor(const opengl::GLInfo & _glinfo) - { - m_part = - "IN highp vec4 aRectPosition; \n" - "void main() \n" - "{ \n" - " gl_Position = aRectPosition; \n" - "} \n" - ; - } - }; - - class VertexShaderTexturedRect : public ShaderPart - { - public: - VertexShaderTexturedRect(const opengl::GLInfo & _glinfo) - { - m_part = - "IN highp vec4 aRectPosition; \n" - "IN highp vec2 aTexCoord0; \n" - "OUT mediump vec2 vTexCoord0; \n" - "void main() \n" - "{ \n" - " gl_Position = aRectPosition; \n" - " vTexCoord0 = aTexCoord0; \n" - "} \n" - ; - } - }; - - /*---------------ShadowMapShaderPart-------------*/ - - class ShadowMapFragmentShader : public ShaderPart - { - public: - ShadowMapFragmentShader(const opengl::GLInfo & _glinfo) - { - m_part = - "uniform lowp usampler2D uZlutImage;\n" - "uniform lowp usampler2D uTlutImage;\n" - "uniform sampler2D uDepthImage; \n" - "uniform lowp vec4 uFogColor; \n" - ; - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - if (_glinfo.imageTextures && !_glinfo.n64DepthWithFbFetch) - m_part += "layout(binding = 2, r32f) highp uniform restrict readonly image2D uDepthImageZ; \n"; - - if (_glinfo.n64DepthWithFbFetch) { - m_part += - "layout(location = 0) OUT lowp vec4 fragColor; \n" - "layout(location = 1) inout highp vec4 depthZ; \n" - ; - } else - m_part += "OUT lowp vec4 fragColor; \n"; - } else - m_part += "OUT lowp vec4 fragColor; \n"; - - m_part += - "lowp float get_alpha() \n" - "{ \n" - ; - - if (config.frameBufferEmulation.N64DepthCompare == Config::dcDisable) { - if (_glinfo.fetch_depth) { - m_part += - " highp float bufZ = gl_LastFragDepthARM; \n" - ; - } else { - m_part += - " mediump ivec2 coord = ivec2(gl_FragCoord.xy); \n" - " highp float bufZ = texelFetch(uDepthImage,coord, 0).r; \n" - ; - } - } else { - // Either _glinfo.imageTextures or _glinfo.ext_fetch must be enabled when N64DepthCompare != 0 - // see GLInfo::init() - if (_glinfo.n64DepthWithFbFetch) { - m_part += - " highp float bufZ = depthZ.r; \n" - ; - } else if (_glinfo.imageTextures) { - m_part += - " mediump ivec2 coord = ivec2(gl_FragCoord.xy); \n" - " highp float bufZ = imageLoad(uDepthImageZ,coord).r; \n" - ; - } - } - - m_part += - " highp int iZ = bufZ > 0.999 ? 262143 : int(floor(bufZ * 262143.0));\n" - " mediump int y0 = clamp(iZ/512, 0, 511); \n" - " mediump int x0 = iZ - 512*y0; \n" - " highp uint iN64z = texelFetch(uZlutImage,ivec2(x0,y0), 0).r; \n" - " highp float n64z = clamp(float(iN64z)/65532.0, 0.0, 1.0);\n" - " highp int index = min(255, int(n64z*255.0)); \n" - " highp uint iAlpha = texelFetch(uTlutImage,ivec2(index,0), 0).r;\n" - " return float(iAlpha>>8)/255.0; \n" - "} \n" - "void main() \n" - "{ \n" - " fragColor = vec4(uFogColor.rgb, get_alpha()); \n" - "} \n" - ; - - if (config.frameBufferEmulation.N64DepthCompare == Config::dcDisable && _glinfo.fetch_depth) - m_part = "#extension GL_ARM_shader_framebuffer_fetch_depth_stencil : enable \n" + m_part; - } - }; - - /*---------------TexrectDrawerShaderPart-------------*/ - - class TexrectDrawerTex3PointFilter : public ShaderPart - { - public: - TexrectDrawerTex3PointFilter(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "#if (__VERSION__ > 120) \n" - "# define IN in \n" - "# define OUT out \n" - "#else \n" - "# define IN varying \n" - "# define OUT \n" - "#ifndef GL_FRAGMENT_PRECISION_HIGH \n" - "# define highp mediump \n" - "#endif \n" - "#endif // __VERSION __ \n" - "lowp vec4 uTestColor = vec4(4.0/255.0, 2.0/255.0, 1.0/255.0, 0.0); \n" - "uniform lowp int uEnableAlphaTest; \n" - "uniform mediump vec2 uTextureSize; \n" - // 3 point texture filtering. - // Original author: ArthurCarvalho - // GLSL implementation: twinaphex, mupen64plus-libretro project. - "#define TEX_OFFSET(off) texture2D(tex, texCoord - (off)/texSize) \n" - "lowp vec4 texFilter(in sampler2D tex, in mediump vec2 texCoord) \n" - "{ \n" - " lowp vec4 c = texture2D(tex, texCoord); \n" - " if (c == uTestColor) discard; \n" - " if (uEnableAlphaTest != 0 && !(c.a > 0.0)) discard; \n" - " mediump vec2 texSize = uTextureSize; \n" - " \n" - " mediump vec2 offset = fract(texCoord*texSize - vec2(0.5)); \n" - " offset -= step(1.0, offset.x + offset.y); \n" - " lowp vec4 zero = vec4(0.0); \n" - " lowp vec4 c0 = TEX_OFFSET(offset); \n" - " c0 = c * vec4(equal(c0, uTestColor)) + c0 * vec4(notEqual(c0, uTestColor)); \n" - " lowp vec4 c1 = TEX_OFFSET(vec2(offset.x - sign(offset.x), offset.y)); \n" - " c0 = c * vec4(equal(c1, uTestColor)) + c1 * vec4(notEqual(c1, uTestColor)); \n" - " lowp vec4 c2 = TEX_OFFSET(vec2(offset.x, offset.y - sign(offset.y))); \n" - " c2 = c * vec4(equal(c2, uTestColor)) + c2 * vec4(notEqual(c2, uTestColor)); \n" - " return c0 + abs(offset.x)*(c1-c0) + abs(offset.y)*(c2-c0); \n" - "} \n" - " \n" - ; - } else { - m_part = - // 3 point texture filtering. - // Original author: ArthurCarvalho - // GLSL implementation: twinaphex, mupen64plus-libretro project. - "#define TEX_OFFSET(off, tex, texCoord, texSize) texture(tex, texCoord - (off)/texSize) \n" - "#define TEX_FILTER(name, tex, texCoord) \\\n" - "{ \\\n" - " lowp vec4 c = texture(tex, texCoord); \\\n" - " if (c == uTestColor) discard; \\\n" - " if (uEnableAlphaTest == 1 && !(c.a > 0.0)) discard; \\\n" - " mediump vec2 texSize = vec2(textureSize(tex,0)); \\\n" - " mediump vec2 offset = fract(texCoord*texSize - vec2(0.5)); \\\n" - " offset -= step(1.0, offset.x + offset.y); \\\n" - " lowp vec4 zero = vec4(0.0); \\\n" - " lowp vec4 c0 = TEX_OFFSET(offset, tex, texCoord, texSize); \\\n" - " c0 = c * vec4(equal(c0, uTestColor)) + c0 * vec4(notEqual(c0, uTestColor)); \\\n" - " lowp vec4 c1 = TEX_OFFSET(vec2(offset.x - sign(offset.x), offset.y), tex, texCoord, texSize); \\\n" - " c1 = c * vec4(equal(c1, uTestColor)) + c1 * vec4(notEqual(c1, uTestColor)); \\\n" - " lowp vec4 c2 = TEX_OFFSET(vec2(offset.x, offset.y - sign(offset.y)), tex, texCoord, texSize); \\\n" - " c2 = c * vec4(equal(c2, uTestColor)) + c2 * vec4(notEqual(c2, uTestColor)); \\\n" - " name = c0 + abs(offset.x)*(c1-c0) + abs(offset.y)*(c2-c0); \\\n" - "} \\\n" - " \n" - ; - } - } - }; - - class TexrectDrawerTexBilinearFilter : public ShaderPart - { - public: - TexrectDrawerTexBilinearFilter(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "#if (__VERSION__ > 120) \n" - "# define IN in \n" - "# define OUT out \n" - "#else \n" - "# define IN varying \n" - "# define OUT \n" - "#ifndef GL_FRAGMENT_PRECISION_HIGH \n" - "# define highp mediump \n" - "#endif \n" - "#endif // __VERSION __ \n" - "lowp vec4 uTestColor = vec4(4.0/255.0, 2.0/255.0, 1.0/255.0, 0.0); \n" - "uniform lowp int uEnableAlphaTest; \n" - "uniform mediump vec2 uTextureSize; \n" - "#define TEX_OFFSET(off) texture2D(tex, texCoord - (off)/texSize) \n" - "lowp vec4 texFilter(in sampler2D tex, in mediump vec2 texCoord) \n" - "{ \n" - " lowp vec4 c = texture2D(tex, texCoord); \n" - " if (c == uTestColor) discard; \n" - " if (uEnableAlphaTest != 0 && !(c.a > 0.0)) discard; \n" - " mediump vec2 texSize = uTextureSize; \n" - " \n" - " mediump vec2 offset = fract(texCoord*texSize - vec2(0.5)); \n" - " offset -= step(1.0, offset.x + offset.y); \n" - " lowp vec4 zero = vec4(0.0); \n" - " \n" - " lowp vec4 p0q0 = TEX_OFFSET(offset); \n" - " p0q0 = c * vec4(equal(p0q0, uTestColor)) + p0q0 * vec4(notEqual(p0q0, uTestColor)); \n" - " lowp vec4 p1q0 = TEX_OFFSET(vec2(offset.x - sign(offset.x), offset.y)); \n" - " p1q0 = c * vec4(equal(p1q0, uTestColor)) + p1q0 * vec4(notEqual(p1q0, uTestColor)); \n" - " \n" - " lowp vec4 p0q1 = TEX_OFFSET(vec2(offset.x, offset.y - sign(offset.y))); \n" - " p0q1 = c * vec4(equal(p0q1, uTestColor)) + p0q1 * vec4(notEqual(p0q1, uTestColor)); \n" - " lowp vec4 p1q1 = TEX_OFFSET(vec2(offset.x - sign(offset.x), offset.y - sign(offset.y))); \n" - " p1q1 = c * vec4(equal(p1q1, uTestColor)) + p1q1 * vec4(notEqual(p1q1, uTestColor)); \n" - " \n" - " mediump vec2 interpolationFactor = abs(offset); \n" - " lowp vec4 pInterp_q0 = mix( p0q0, p1q0, interpolationFactor.x ); // Interpolates top row in X direction. \n" - " lowp vec4 pInterp_q1 = mix( p0q1, p1q1, interpolationFactor.x ); // Interpolates bottom row in X direction. \n" - " return mix( pInterp_q0, pInterp_q1, interpolationFactor.y ); // Interpolate in Y direction. \n" - "} \n" - ; - } - else { - m_part = - "#define TEX_OFFSET(off, tex, texCoord, texSize) texture(tex, texCoord - (off)/texSize) \n" - "#define TEX_FILTER(name, tex, texCoord) \\\n" - "{ \\\n" - " lowp vec4 c = texture(tex, texCoord); \\\n" - " if (c == uTestColor) discard; \\\n" - " if (uEnableAlphaTest == 1 && !(c.a > 0.0)) discard; \\\n" - " mediump vec2 texSize = vec2(textureSize(tex,0)); \\\n" - " mediump vec2 offset = fract(texCoord*texSize - vec2(0.5)); \\\n" - " offset -= step(1.0, offset.x + offset.y); \\\n" - " lowp vec4 zero = vec4(0.0); \\\n" - " \\\n" - " lowp vec4 p0q0 = TEX_OFFSET(offset, tex, texCoord, texSize); \\\n" - " p0q0 = c * vec4(equal(p0q0, uTestColor)) + p0q0 * vec4(notEqual(p0q0, uTestColor)); \\\n" - " lowp vec4 p1q0 = TEX_OFFSET(vec2(offset.x - sign(offset.x), offset.y), tex, texCoord, texSize); \\\n" - " p1q0 = c * vec4(equal(p1q0, uTestColor)) + p1q0 * vec4(notEqual(p1q0, uTestColor)); \\\n" - " \\\n" - " lowp vec4 p0q1 = TEX_OFFSET(vec2(offset.x, offset.y - sign(offset.y)), tex, texCoord, texSize); \\\n" - " p0q1 = c * vec4(equal(p0q1, uTestColor)) + p0q1 * vec4(notEqual(p0q1, uTestColor)); \\\n" - " lowp vec4 p1q1 = TEX_OFFSET(vec2(offset.x - sign(offset.x), offset.y - sign(offset.y)), tex, texCoord, texSize); \\\n" - " p1q1 = c * vec4(equal(p1q1, uTestColor)) + p1q1 * vec4(notEqual(p1q1, uTestColor)); \\\n" - " \\\n" - " mediump vec2 interpolationFactor = abs(offset); \\\n" - " lowp vec4 pInterp_q0 = mix( p0q0, p1q0, interpolationFactor.x ); \\\n" // Interpolates top row in X direction. - " lowp vec4 pInterp_q1 = mix( p0q1, p1q1, interpolationFactor.x ); \\\n" // Interpolates bottom row in X direction. - " name = mix( pInterp_q0, pInterp_q1, interpolationFactor.y ); \\\n" // Interpolate in Y direction. - "} \\\n" - " \n" - ; - } - } - }; - - class TexrectDrawerFragmentDraw : public ShaderPart - { - public: - TexrectDrawerFragmentDraw(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "uniform sampler2D uTex0; \n" - "IN mediump vec2 vTexCoord0; \n" - "OUT lowp vec4 fragColor; \n" - "void main() \n" - "{ \n" - " fragColor = texFilter(uTex0, vTexCoord0); \n" - " gl_FragColor = fragColor; \n" - "} \n" - ; - } else { - m_part = - "uniform sampler2D uTex0; \n" - "uniform lowp int uEnableAlphaTest; \n" - "uniform highp float uPrimDepth; \n" - "lowp vec4 uTestColor = vec4(4.0/255.0, 2.0/255.0, 1.0/255.0, 0.0); \n" - "in mediump vec2 vTexCoord0; \n" - "out lowp vec4 fragColor; \n" - "void main() \n" - "{ \n" - " TEX_FILTER(fragColor, uTex0, vTexCoord0); \n" - ; - if (config.generalEmulation.enableFragmentDepthWrite != 0 && - config.frameBufferEmulation.N64DepthCompare == Config::dcDisable) { - m_part += - " gl_FragDepth = uPrimDepth; \n" - ; - } - m_part += - "} \n" - ; - } - } - }; - - class TexrectDrawerFragmentClear : public ShaderPart - { - public: - TexrectDrawerFragmentClear(const opengl::GLInfo & _glinfo) - { - if (_glinfo.isGLES2) { - m_part = - "lowp vec4 uTestColor = vec4(4.0/255.0, 2.0/255.0, 1.0/255.0, 0.0); \n" - "void main() \n" - "{ \n" - " gl_FragColor = uTestColor; \n" - "} \n" - ; - } else { - m_part = - "lowp vec4 uTestColor = vec4(4.0/255.0, 2.0/255.0, 1.0/255.0, 0.0); \n" - "out lowp vec4 fragColor; \n" - "void main() \n" - "{ \n" - " fragColor = uTestColor; \n" - "} \n" - ; - } - } - }; - - /*---------------Hybrid texture filter-------------*/ - - static - std::string const& getHybridTextureFilter() - { - static std::string strFilter = - "uniform sampler2D uTex0; \n" - " \n" - "ivec2 get_texture_size() \n" - "{ \n" - " return textureSize(uTex0, 0); \n" - "} \n" - " \n" - "mediump vec2 norm2denorm(mediump vec2 uv) \n" - "{ \n" - " return uv * vec2(get_texture_size()) - 0.5; \n" - "} \n" - " \n" - "mediump vec2 denorm2norm(mediump vec2 denorm_uv) \n" - "{ \n" - " return (denorm_uv + 0.5) / vec2(get_texture_size()); \n" - "} \n" - " \n" - "mediump vec4 hybridFilter(mediump vec2 uv) \n" - "{ \n" - " mediump vec2 denorm_uv = norm2denorm(uv); \n" - " mediump vec2 low_corner = floor(denorm_uv); \n" - " mediump vec2 ratio = denorm_uv - low_corner; \n" - " \n" - /* - * 'radius' is the distance from the edge where interpolation happens. - * It's calculated based on how big a fragment is in denormalized - * texture coordinates. - * - * E.g.: If a texel maps to 5 fragments, then each fragment is - * 1/5 texels big. So the smooth transition should be between one and - * two fragments big, since there are enough fragments to show the full - * color of the texel. - * - * If a fragment is larger than one texel, we don't care, we're already - * sampling the wrong texels, and should be using mipmaps instead. - */ - - // Here, fwidth() is used to estimte how much denorm_uv changes per fragment. - // But we divide it by 2, since fwidth() is adding abs(dx) + abs(dy). - " mediump vec2 fragment_size = fwidth(denorm_uv) / 2.0; \n" - " \n" - " mediump float is_frag_gt1, radius; \n" - // Do nothing if fragment is greater than 1 texel - // Don't make the transition more than one fragment (+/- 0.5 fragment) - " is_frag_gt1 = step(1.0, fragment_size.s); \n" - " radius = min(fragment_size.s, 0.5); \n" - " ratio.s = ratio.s * is_frag_gt1 + smoothstep(0.5 - radius, \n" - " 0.5 + radius, ratio.s) * (1.0 - is_frag_gt1); \n" - " is_frag_gt1 = step(1.0, fragment_size.t); \n" - " radius = min(fragment_size.t, 0.5); \n" - " ratio.t = ratio.t * is_frag_gt1 + smoothstep(0.5 - radius, \n" - " 0.5 + radius, ratio.t) * (1.0 - is_frag_gt1); \n" - " \n" - // now bump the coord to the texel using ratio - " mediump vec2 new_denorm_uv = low_corner + ratio; \n" - " mediump vec2 new_uv = denorm2norm(new_denorm_uv); \n" - " return texture2D(uTex0, new_uv); \n" - "} \n" - ; - return strFilter; - } - - /*---------------TexrectCopyShaderPart-------------*/ - - class TexrectUpscaleCopy : public ShaderPart - { - public: - TexrectUpscaleCopy(const opengl::GLInfo & _glinfo) - { - if (config.generalEmulation.enableHybridFilter) { - m_part = getHybridTextureFilter(); - m_part += - "IN mediump vec2 vTexCoord0; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = hybridFilter(vTexCoord0); \n" - ; - } else { - m_part = - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex0; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = texture2D(uTex0, vTexCoord0); \n" - ; - } - } - }; - - class TexrectDownscaleCopy : public ShaderPart - { - public: - TexrectDownscaleCopy(const opengl::GLInfo & _glinfo) - { - m_part = - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex0; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = texture2D(uTex0, vTexCoord0); \n" - ; - } - }; - - /*---------------TexrectDepthCopyShaderPart-------------*/ - - class TexrectColorAndDepthUpscaleCopy : public ShaderPart - { - public: - TexrectColorAndDepthUpscaleCopy(const opengl::GLInfo & _glinfo) - { - if (config.generalEmulation.enableHybridFilter) { - m_part = getHybridTextureFilter(); - m_part += - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex1; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = hybridFilter(vTexCoord0); \n" - " gl_FragDepth = texture2D(uTex1, vTexCoord0).r; \n" - ; - } else { - m_part = - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex0; \n" - "uniform sampler2D uTex1; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = texture2D(uTex0, vTexCoord0); \n" - " gl_FragDepth = texture2D(uTex1, vTexCoord0).r; \n" - ; - } - } - }; - - class TexrectColorAndDepthDownscaleCopy : public ShaderPart - { - public: - TexrectColorAndDepthDownscaleCopy(const opengl::GLInfo & _glinfo) - { - m_part = - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex0; \n" - "uniform sampler2D uTex1; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = texture2D(uTex0, vTexCoord0); \n" - " gl_FragDepth = texture2D(uTex1, vTexCoord0).r; \n" - ; - } - }; - - /*---------------PostProcessorShaderPart-------------*/ - - class GammaCorrection : public ShaderPart - { - public: - GammaCorrection(const opengl::GLInfo & _glinfo) - { - m_part = - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex0; \n" - "uniform lowp float uGammaCorrectionLevel; \n" - "OUT lowp vec4 fragColor; \n" - "void main() \n" - "{ \n" - " fragColor = texture2D(uTex0, vTexCoord0); \n" - " fragColor.rgb = pow(fragColor.rgb, vec3(1.0 / uGammaCorrectionLevel)); \n" - ; - } - }; - - /*---------------TextDrawerShaderPart-------------*/ - - class TextDraw : public ShaderPart - { - public: - TextDraw(const opengl::GLInfo & _glinfo) - { - m_part = - "IN mediump vec2 vTexCoord0; \n" - "uniform sampler2D uTex0; \n" - "uniform lowp vec4 uColor; \n" - "OUT lowp vec4 fragColor; \n" - " \n" - "void main() \n" - "{ \n" - " fragColor = pow(texture2D(uTex0, vTexCoord0).r, 1.0 / 1.8) * uColor; \n" - ; - } - }; - - /*---------------SpecialShader-------------*/ - - template - class SpecialShader : public Base - { - public: - SpecialShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd = nullptr) - : m_program(0) - , m_useProgram(_useProgram) - { - VertexBody vertexBody(_glinfo); - FragmentBody fragmentBody(_glinfo); - - std::stringstream ssVertexShader; - _vertexHeader->write(ssVertexShader); - vertexBody.write(ssVertexShader); - - std::stringstream ssFragmentShader; - _fragmentHeader->write(ssFragmentShader); - fragmentBody.write(ssFragmentShader); - if (_fragmentEnd != nullptr) - _fragmentEnd->write(ssFragmentShader); - - m_program = - graphics::ObjectHandle(Utils::createRectShaderProgram(ssVertexShader.str().data(), ssFragmentShader.str().data())); - } - - ~SpecialShader() - { - m_useProgram->useProgram(graphics::ObjectHandle::null); - glDeleteProgram(GLuint(m_program)); - } - - void activate() override { - m_useProgram->useProgram(m_program); - gDP.changed |= CHANGED_COMBINE; - } - - protected: - graphics::ObjectHandle m_program; - opengl::CachedUseProgram * m_useProgram; - }; - - /*---------------ShadowMapShader-------------*/ - - typedef SpecialShader ShadowMapShaderBase; - - class ShadowMapShader : public ShadowMapShaderBase - { - public: - ShadowMapShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader) - : ShadowMapShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader) - , m_locFog(-1) - , m_locZlut(-1) - , m_locTlut(-1) - , m_locDepthImage(-1) - { - m_useProgram->useProgram(m_program); - m_locFog = glGetUniformLocation(GLuint(m_program), "uFogColor"); - m_locZlut = glGetUniformLocation(GLuint(m_program), "uZlutImage"); - m_locTlut = glGetUniformLocation(GLuint(m_program), "uTlutImage"); - m_locDepthImage = glGetUniformLocation(GLuint(m_program), "uDepthImage"); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - - void activate() override { - ShadowMapShaderBase::activate(); - glUniform4fv(m_locFog, 1, &gDP.fogColor.r); - glUniform1i(m_locZlut, int(graphics::textureIndices::ZLUTTex)); - glUniform1i(m_locTlut, int(graphics::textureIndices::PaletteTex)); - glUniform1i(m_locDepthImage, 0); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - g_paletteTexture.update(); - } - - private: - int m_locFog; - int m_locZlut; - int m_locTlut; - int m_locDepthImage; - }; - - /*---------------FXAAShader-------------*/ - - typedef SpecialShader FXAAShaderBase; - - class FXAAShader : public FXAAShaderBase - { - public: - FXAAShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : FXAAShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - m_textureSizeLoc = glGetUniformLocation(GLuint(m_program), "uTextureSize"); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - - void activate() override { - FXAAShaderBase::activate(); - FrameBuffer * pBuffer = frameBufferList().findBuffer(*REG.VI_ORIGIN & 0xffffff); - if (pBuffer != nullptr && pBuffer->m_pTexture != nullptr && - (m_width != pBuffer->m_pTexture->width || m_height != pBuffer->m_pTexture->height)) { - m_width = pBuffer->m_pTexture->width; - m_height = pBuffer->m_pTexture->height; - glUniform2f(m_textureSizeLoc, GLfloat(m_width), GLfloat(m_height)); - } - } - - private: - int m_textureSizeLoc = -1; - u16 m_width = 0; - u16 m_height = 0; - }; - - /*---------------TexrectDrawerShader-------------*/ - - class TexrectDrawerShaderDraw : public graphics::TexrectDrawerShaderProgram - { - public: - TexrectDrawerShaderDraw(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader) - : m_program(0) - , m_useProgram(_useProgram) - , m_depth(0) - { - VertexShaderTexturedRect vertexBody(_glinfo); - std::stringstream ssVertexShader; - _vertexHeader->write(ssVertexShader); - vertexBody.write(ssVertexShader); - - std::stringstream ssFragmentShader; - _fragmentHeader->write(ssFragmentShader); - - if (config.texture.bilinearMode == BILINEAR_STANDARD) { - TexrectDrawerTexBilinearFilter filter(_glinfo); - filter.write(ssFragmentShader); - } else { - TexrectDrawerTex3PointFilter filter(_glinfo); - filter.write(ssFragmentShader); - } - - TexrectDrawerFragmentDraw fragmentMain(_glinfo); - fragmentMain.write(ssFragmentShader); - - m_program = - graphics::ObjectHandle(Utils::createRectShaderProgram(ssVertexShader.str().data(), ssFragmentShader.str().data())); - - m_useProgram->useProgram(m_program); - GLint loc = glGetUniformLocation(GLuint(m_program), "uTex0"); - assert(loc >= 0); - glUniform1i(loc, 0); - m_textureSizeLoc = glGetUniformLocation(GLuint(m_program), "uTextureSize"); - m_enableAlphaTestLoc = glGetUniformLocation(GLuint(m_program), "uEnableAlphaTest"); - m_primDepthLoc = glGetUniformLocation(GLuint(m_program), "uPrimDepth"); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - - ~TexrectDrawerShaderDraw() - { - m_useProgram->useProgram(graphics::ObjectHandle::null); - glDeleteProgram(GLuint(m_program)); - } - - void activate() override - { - m_useProgram->useProgram(m_program); - if (m_primDepthLoc >= 0) { - const GLfloat depth = gDP.otherMode.depthSource == G_ZS_PRIM ? gDP.primDepth.z : 0.0f; - if (depth != m_depth) { - m_depth = depth; - glUniform1f(m_primDepthLoc, m_depth); - } - } - gDP.changed |= CHANGED_COMBINE; - } - - void setTextureSize(u32 _width, u32 _height) override - { - if (m_textureSizeLoc < 0) - return; - m_useProgram->useProgram(m_program); - glUniform2f(m_textureSizeLoc, (GLfloat)_width, (GLfloat)_height); - gDP.changed |= CHANGED_COMBINE; - } - - void setEnableAlphaTest(int _enable) override - { - m_useProgram->useProgram(m_program); - glUniform1i(m_enableAlphaTestLoc, _enable); - gDP.changed |= CHANGED_COMBINE; - } - - protected: - graphics::ObjectHandle m_program; - opengl::CachedUseProgram * m_useProgram; - GLint m_enableAlphaTestLoc; - GLint m_textureSizeLoc; - GLint m_primDepthLoc; - GLfloat m_depth; - }; - - typedef SpecialShader TexrectDrawerShaderClear; - - /*---------------TexrectCopyShader-------------*/ - - typedef SpecialShader TexrectUpscaleCopyShaderBase; - - class TexrectUpscaleCopyShader : public TexrectUpscaleCopyShaderBase - { - public: - TexrectUpscaleCopyShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : TexrectUpscaleCopyShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0"); - glUniform1i(texLoc, 0); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - }; - - typedef SpecialShader TexrectDownscaleCopyShaderBase; - - class TexrectDownscaleCopyShader : public TexrectDownscaleCopyShaderBase - { - public: - TexrectDownscaleCopyShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : TexrectDownscaleCopyShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0"); - glUniform1i(texLoc, 0); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - }; - - /*---------------TexrectColorAndDepthCopyShader-------------*/ - - typedef SpecialShader TexrectColorAndDepthUpscaleCopyShaderBase; - - class TexrectColorAndDepthUpscaleCopyShader : public TexrectColorAndDepthUpscaleCopyShaderBase - { - public: - TexrectColorAndDepthUpscaleCopyShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : TexrectColorAndDepthUpscaleCopyShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - const int texLoc0 = glGetUniformLocation(GLuint(m_program), "uTex0"); - glUniform1i(texLoc0, 0); - const int texLoc1 = glGetUniformLocation(GLuint(m_program), "uTex1"); - glUniform1i(texLoc1, 1); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - }; - - typedef SpecialShader TexrectColorAndDepthDownscaleCopyShaderBase; - - class TexrectColorAndDepthDownscaleCopyShader : public TexrectColorAndDepthDownscaleCopyShaderBase - { - public: - TexrectColorAndDepthDownscaleCopyShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : TexrectColorAndDepthDownscaleCopyShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - const int texLoc0 = glGetUniformLocation(GLuint(m_program), "uTex0"); - glUniform1i(texLoc0, 0); - const int texLoc1 = glGetUniformLocation(GLuint(m_program), "uTex1"); - glUniform1i(texLoc1, 1); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - }; - - /*---------------PostProcessorShader-------------*/ - - typedef SpecialShader GammaCorrectionShaderBase; - - class GammaCorrectionShader : public GammaCorrectionShaderBase - { - public: - GammaCorrectionShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : GammaCorrectionShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0"); - glUniform1i(texLoc, 0); - const int levelLoc = glGetUniformLocation(GLuint(m_program), "uGammaCorrectionLevel"); - assert(levelLoc >= 0); - const f32 gammaLevel = (config.gammaCorrection.force != 0) ? config.gammaCorrection.level : 2.0f; - glUniform1f(levelLoc, gammaLevel); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - }; - - /*---------------TexrectDrawerShader-------------*/ - - typedef SpecialShader TextDrawerShaderBase; - - class TextDrawerShader : public TextDrawerShaderBase - { - public: - TextDrawerShader(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : TextDrawerShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd) - { - m_useProgram->useProgram(m_program); - const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0"); - glUniform1i(texLoc, 0); - m_colorLoc = glGetUniformLocation(GLuint(m_program), "uColor"); - glUniform4fv(m_colorLoc, 1, config.font.colorf); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - - void setTextColor(float * _color) override { - m_useProgram->useProgram(m_program); - glUniform4fv(m_colorLoc, 1, _color); - m_useProgram->useProgram(graphics::ObjectHandle::null); - } - - private: - int m_colorLoc; - }; - - /*---------------SpecialShadersFactory-------------*/ - - SpecialShadersFactory::SpecialShadersFactory(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd) - : m_glinfo(_glinfo) - , m_vertexHeader(_vertexHeader) - , m_fragmentHeader(_fragmentHeader) - , m_fragmentEnd(_fragmentEnd) - , m_useProgram(_useProgram) - { - } - - graphics::ShaderProgram * SpecialShadersFactory::createShadowMapShader() const - { - if (m_glinfo.isGLES2) - return nullptr; - - return new ShadowMapShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader); - } - - graphics::TexrectDrawerShaderProgram * SpecialShadersFactory::createTexrectDrawerDrawShader() const - { - return new TexrectDrawerShaderDraw(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader); - } - - graphics::ShaderProgram * SpecialShadersFactory::createTexrectDrawerClearShader() const - { - return new TexrectDrawerShaderClear(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader); - } - - graphics::ShaderProgram * SpecialShadersFactory::createTexrectUpscaleCopyShader() const - { - return new TexrectUpscaleCopyShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - - graphics::ShaderProgram * SpecialShadersFactory::createTexrectColorAndDepthUpscaleCopyShader() const - { - if (m_glinfo.isGLES2) - return nullptr; - - return new TexrectColorAndDepthUpscaleCopyShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - - graphics::ShaderProgram * SpecialShadersFactory::createTexrectDownscaleCopyShader() const - { - return new TexrectDownscaleCopyShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - - graphics::ShaderProgram * SpecialShadersFactory::createTexrectColorAndDepthDownscaleCopyShader() const - { - if (m_glinfo.isGLES2) - return nullptr; - - return new TexrectColorAndDepthDownscaleCopyShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - - graphics::ShaderProgram * SpecialShadersFactory::createGammaCorrectionShader() const - { - return new GammaCorrectionShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - - graphics::ShaderProgram * SpecialShadersFactory::createFXAAShader() const - { - return new FXAAShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - - graphics::TextDrawerShaderProgram * SpecialShadersFactory::createTextDrawerShader() const - { - return new TextDrawerShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd); - } - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.h deleted file mode 100644 index 8c2ce6d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -#include - -namespace graphics { - class ShaderProgram; -} - -namespace opengl { - class CachedUseProgram; -} - -namespace glsl { - - class ShaderPart; - - class SpecialShadersFactory - { - public: - SpecialShadersFactory(const opengl::GLInfo & _glinfo, - opengl::CachedUseProgram * _useProgram, - const ShaderPart * _vertexHeader, - const ShaderPart * _fragmentHeader, - const ShaderPart * _fragmentEnd); - - graphics::ShaderProgram * createShadowMapShader() const; - - graphics::TexrectDrawerShaderProgram * createTexrectDrawerDrawShader() const; - - graphics::ShaderProgram * createTexrectDrawerClearShader() const; - - graphics::ShaderProgram * createTexrectUpscaleCopyShader() const; - - graphics::ShaderProgram * createTexrectColorAndDepthUpscaleCopyShader() const; - - graphics::ShaderProgram * createTexrectDownscaleCopyShader() const; - - graphics::ShaderProgram * createTexrectColorAndDepthDownscaleCopyShader() const; - - graphics::ShaderProgram * createGammaCorrectionShader() const; - - graphics::ShaderProgram * createFXAAShader() const; - - graphics::TextDrawerShaderProgram * createTextDrawerShader() const; - - private: - const opengl::GLInfo & m_glinfo; - const ShaderPart * m_vertexHeader; - const ShaderPart * m_fragmentHeader; - const ShaderPart * m_fragmentEnd; - opengl::CachedUseProgram * m_useProgram; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_Utils.cpp b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_Utils.cpp deleted file mode 100644 index 6cca54e..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_Utils.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include -#include "glsl_Utils.h" - -using namespace glsl; - -void Utils::locateAttributes(GLuint _program, bool _rect, bool _textures) -{ - static GLint maxVertexAttribs = 0; - if (maxVertexAttribs == 0) - glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); - - if (_rect) { - glBindAttribLocation(_program, opengl::rectAttrib::position, "aRectPosition"); - if (opengl::rectAttrib::barycoords < static_cast(maxVertexAttribs)) - glBindAttribLocation(_program, opengl::rectAttrib::barycoords, "aBaryCoords"); - if (_textures) { - glBindAttribLocation(_program, opengl::rectAttrib::texcoord0, "aTexCoord0"); - glBindAttribLocation(_program, opengl::rectAttrib::texcoord1, "aTexCoord1"); - } - return; - } - - glBindAttribLocation(_program, opengl::triangleAttrib::position, "aPosition"); - glBindAttribLocation(_program, opengl::triangleAttrib::color, "aColor"); - glBindAttribLocation(_program, opengl::triangleAttrib::numlights, "aNumLights"); - glBindAttribLocation(_program, opengl::triangleAttrib::modify, "aModify"); - if (opengl::triangleAttrib::barycoords < static_cast(maxVertexAttribs)) - glBindAttribLocation(_program, opengl::triangleAttrib::barycoords, "aBaryCoords"); - if (_textures) - glBindAttribLocation(_program, opengl::triangleAttrib::texcoord, "aTexCoord"); -} - - -static const GLsizei nShaderLogSize = 1024; - -bool Utils::checkShaderCompileStatus(GLuint obj) -{ -#ifdef GL_DEBUG - GLint status; - glGetShaderiv(obj, GL_COMPILE_STATUS, &status); - if (status == GL_FALSE) { - GLchar shader_log[nShaderLogSize]; - GLsizei nLogSize = nShaderLogSize; - glGetShaderInfoLog(obj, nShaderLogSize, &nLogSize, shader_log); - shader_log[nLogSize] = 0; - LOG(LOG_ERROR, "shader_compile error: %s", shader_log); - return false; - } -#endif - return true; -} - -static -bool _checkProgramLinkStatus(GLuint obj) -{ - GLint status; - glGetProgramiv(obj, GL_LINK_STATUS, &status); - if (status == GL_FALSE) { - GLsizei nLogSize = nShaderLogSize; - GLchar shader_log[nShaderLogSize]; - glGetProgramInfoLog(obj, nShaderLogSize, &nLogSize, shader_log); - LOG(LOG_ERROR, "shader_link error: %s", shader_log); - return false; - } - return true; -} - -bool Utils::checkProgramLinkStatus(GLuint obj, bool _force) -{ -#ifdef GL_DEBUG - return _checkProgramLinkStatus(obj); -#else - if (_force) - return _checkProgramLinkStatus(obj); - return true; -#endif -} - -void Utils::logErrorShader(GLenum _shaderType, const std::string & _strShader) -{ - LOG(LOG_ERROR, "Error in %s shader", _shaderType == GL_VERTEX_SHADER ? "vertex" : "fragment"); - - const u32 max = 800; - u32 pos = 0; - - while (pos < _strShader.length()) { - - if (_strShader.length() - pos < max) { - LOG(LOG_ERROR, "%s", _strShader.substr(pos).data()); - } - else { - LOG(LOG_ERROR, "%s", _strShader.substr(pos, max).data()); - } - pos += max; - } -} - -GLuint Utils::createRectShaderProgram(const char * _strVertex, const char * _strFragment) -{ - GLuint vertex_shader_object = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader_object, 1, &_strVertex, nullptr); - glCompileShader(vertex_shader_object); - assert(checkShaderCompileStatus(vertex_shader_object)); - - if (!checkShaderCompileStatus(vertex_shader_object)) - logErrorShader(GL_VERTEX_SHADER, _strVertex); - - GLuint fragment_shader_object = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader_object, 1, &_strFragment, nullptr); - glCompileShader(fragment_shader_object); - assert(checkShaderCompileStatus(fragment_shader_object)); - - if (!checkShaderCompileStatus(fragment_shader_object)) - logErrorShader(GL_FRAGMENT_SHADER, _strFragment); - - GLuint program = glCreateProgram(); - locateAttributes(program, true, true); - glAttachShader(program, vertex_shader_object); - glAttachShader(program, fragment_shader_object); - glLinkProgram(program); - glDeleteShader(vertex_shader_object); - glDeleteShader(fragment_shader_object); - assert(checkProgramLinkStatus(program)); - return program; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_Utils.h b/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_Utils.h deleted file mode 100644 index c74d112..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GLSL/glsl_Utils.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include -#include -#include - -namespace glsl { - - struct Utils { - static void locateAttributes(GLuint _program, bool _rect, bool _textures); - static bool checkShaderCompileStatus(GLuint obj); - static bool checkProgramLinkStatus(GLuint obj, bool _force = false); - static void logErrorShader(GLenum _shaderType, const std::string & _strShader); - static GLuint createRectShaderProgram(const char * _strVertex, const char * _strFragment); - - template - static std::string to_string(T value) - { -#ifdef OS_ANDROID - std::ostringstream os ; - os << value ; - return os.str() ; -#else - return std::to_string(value); -#endif - } - }; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.cpp b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.cpp deleted file mode 100644 index 6062d45..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// Based on https://github.com/chromium/chromium/blob/master/base/android/android_hardware_buffer_compat.h - -#include "GraphicBufferWrapper.h" -#include -#include "../GLFunctions.h" - -#include -#include -#include - -namespace opengl { - - -GraphicBufferWrapper::GraphicBufferWrapper() { - m_private = false; - - if (!isSupportAvailable()) { - return; - } - - if (getApiLevel() <= 23) { - m_private = true; - m_privateGraphicBuffer = new GraphicBuffer(); - } - - m_stride = 0; -} - -GraphicBufferWrapper::~GraphicBufferWrapper() { - if (m_private) { - delete m_privateGraphicBuffer; - } -} - -bool GraphicBufferWrapper::isSupportAvailable() { - - int apiLevel = getApiLevel(); - return apiLevel >= 26 || apiLevel <= 23; -} - -bool GraphicBufferWrapper::isPublicSupportAvailable() { - - int apiLevel = getApiLevel(); - return apiLevel >= 26; -} - -bool GraphicBufferWrapper::allocate(const AHardwareBuffer_Desc *desc) { - - if (m_private) { - return m_privateGraphicBuffer->reallocate(desc->width, desc->height, desc->format, desc->usage); - } else { - return AndroidHardwareBufferCompat::GetInstance().Allocate(desc, &m_publicGraphicBuffer) == 0; - } -} - -int GraphicBufferWrapper::lock(uint64_t usage, void **out_virtual_address) { - - int returnValue = 0; - if (m_private) { - returnValue = m_privateGraphicBuffer->lock(usage, out_virtual_address); - } else { - returnValue = AndroidHardwareBufferCompat::GetInstance().Lock(m_publicGraphicBuffer, usage, -1, nullptr, out_virtual_address); - }; - - return returnValue; -} - -void GraphicBufferWrapper::release() { - if (!m_private) { - AndroidHardwareBufferCompat::GetInstance().Release(m_publicGraphicBuffer); - } -} - -void GraphicBufferWrapper::unlock() { - - if (m_private) { - m_privateGraphicBuffer->unlock(); - } else { - AndroidHardwareBufferCompat::GetInstance().Unlock(m_publicGraphicBuffer, nullptr); - } - -} - -EGLClientBuffer GraphicBufferWrapper::getClientBuffer() { - EGLClientBuffer clientBuffer = nullptr; - if (m_private) { - clientBuffer = (EGLClientBuffer)m_privateGraphicBuffer->getNativeBuffer(); - } else { - clientBuffer = eglGetNativeClientBufferANDROID(m_publicGraphicBuffer); - } - - return clientBuffer; -} - -unsigned GraphicBufferWrapper::getStride() const { - if (m_private) { - return m_privateGraphicBuffer->getStride(); - } else { - AHardwareBuffer_Desc bufferInfo; - AndroidHardwareBufferCompat::GetInstance().Describe(m_publicGraphicBuffer, &bufferInfo); - return bufferInfo.stride; - } -} - -int GraphicBufferWrapper::getApiLevel() -{ - static bool apiLevelChecked = false; - static int apiLevel = 0; - - if (!apiLevelChecked) - { - char *androidApiLevel = new char[PROP_VALUE_MAX]; - - int valid = __system_property_get("ro.build.version.sdk", androidApiLevel); - - if (valid > 0) { - std::stringstream convert(androidApiLevel); - convert >> apiLevel; - } - } - return apiLevel; -} - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.h deleted file mode 100644 index a6e5344..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.h +++ /dev/null @@ -1,44 +0,0 @@ -// Based on https://github.com/chromium/chromium/blob/master/base/android/android_hardware_buffer_compat.h -#pragma once - -#include -#include -#include - -namespace opengl { - -// This class provides runtime support for working with AHardwareBuffer objects -// on Android O systems without requiring building for the Android O NDK level. -// Don't call GetInstance() unless IsSupportAvailable() returns true. -class GraphicBufferWrapper { -public: - - GraphicBufferWrapper (const GraphicBufferWrapper&) = delete; - GraphicBufferWrapper& operator= (const GraphicBufferWrapper&) = delete; - - GraphicBufferWrapper(); - ~GraphicBufferWrapper(); - - static bool isSupportAvailable(); - - static bool isPublicSupportAvailable(); - - bool allocate(const AHardwareBuffer_Desc* desc); - int lock(uint64_t usage, void** out_virtual_address); - void release(); - void unlock(); - EGLClientBuffer getClientBuffer(); - unsigned int getStride() const; - -private: - - static int getApiLevel(); - - bool m_private; - GraphicBuffer* m_privateGraphicBuffer; - AHardwareBuffer* m_publicGraphicBuffer; - unsigned int m_stride; - -}; - -} // namespace opengl diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.cpp b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.cpp deleted file mode 100644 index e603705..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* This file is part of Imagine. - - Imagine is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Imagine 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Imagine. If not, see */ - -#include "gralloc.h" -#include "GraphicBuffer.h" -#include "Log.h" -#include - -namespace opengl -{ - -static gralloc_module_t const *grallocMod{}; -static alloc_device_t *allocDev{}; - -static void initAllocDev() -{ - if(allocDev) - return; - if(!libhardware_dl()) - { - LOG(LOG_ERROR,"Incompatible libhardware.so"); - return; - } - if(hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (hw_module_t const**)&grallocMod) != 0) - { - LOG(LOG_ERROR,"Can't load gralloc module"); - return; - } - gralloc_open((const hw_module_t*)grallocMod, &allocDev); - if(!allocDev) - { - LOG(LOG_ERROR,"Can't load allocator device"); - return; - } - if(!allocDev->alloc || !allocDev->free) - { - LOG(LOG_ERROR,"Missing alloc/free functions"); - if(allocDev->common.close) - gralloc_close(allocDev); - else - LOG(LOG_WARNING,"Missing device close function"); - allocDev = {}; - return; - } - LOG(LOG_MINIMAL,"alloc device:%p", allocDev); -} - -GraphicBuffer::GraphicBuffer() -{ - initAllocDev(); - common.incRef = [](struct android_native_base_t *){ LOG(LOG_MINIMAL,"called incRef"); }; - common.decRef = [](struct android_native_base_t *){ LOG(LOG_MINIMAL,"called decRef"); }; -} - -GraphicBuffer::~GraphicBuffer() -{ - if(handle) - { - allocDev->free(allocDev, handle); - } -} - -bool GraphicBuffer::reallocate(unsigned int w, unsigned int h, unsigned int f, unsigned int reqUsage) -{ - if(handle && w == (unsigned int)width && h == (unsigned int)height && f == (unsigned int)format && reqUsage == (unsigned int)usage) - return true; - if(handle) - { - allocDev->free(allocDev, handle); - handle = nullptr; - } - return initSize(w, h, f, reqUsage); -} - -bool GraphicBuffer::initSize(unsigned int w, unsigned int h, unsigned int f, unsigned int reqUsage) -{ - auto err = allocDev->alloc(allocDev, w, h, f, reqUsage, &handle, &stride); - if(!err) - { - width = w; - height = h; - format = f; - usage = reqUsage; - return true; - } - LOG(LOG_ERROR,"alloc buffer failed: %s", std::strerror(-err)); - return false; -} - -bool GraphicBuffer::lock(unsigned int usage, void **vaddr) -{ - return lock(usage, 0, 0, width, height, vaddr); -} - -bool GraphicBuffer::lock(unsigned int _usage, int _x0, int _y0, int _width, int _height, void **_vaddr) -{ - if (_x0 < 0 || _width > width || - _y0 < 0 || _height > height) - { - LOG(LOG_ERROR,"locking pixels:[%d:%d:%d:%d] outside of buffer:%d,%d", - _x0, _y0, _width, _height, width, height); - return false; - } - auto err = grallocMod->lock(grallocMod, handle, _usage, _x0, _y0, _width, _height, _vaddr); - return !err; -} - -void GraphicBuffer::unlock() -{ - grallocMod->unlock(grallocMod, handle); -} - -unsigned int GraphicBuffer::getWidth() -{ - return width; -} - -unsigned int GraphicBuffer::getHeight() -{ - return height; -} - -unsigned int GraphicBuffer::getStride() -{ - return stride; -} - -android_native_buffer_t *GraphicBuffer::getNativeBuffer() -{ - return static_cast(this); -} - -bool GraphicBuffer::hasBufferMapper() -{ - return allocDev; -} - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.h deleted file mode 100644 index 49289b7..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/GraphicBuffer.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -/* This file is part of Imagine. - - Imagine is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Imagine 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Imagine. If not, see */ - -#include "gralloc.h" - -// Wrapper for ANativeWindowBuffer (android_native_buffer_t) -// similar to GraphicBuffer class in Android frameworks - -namespace opengl -{ - -class GraphicBuffer : public android_native_buffer_t -{ -public: - GraphicBuffer(); - ~GraphicBuffer(); - bool reallocate(unsigned int w, unsigned int h, unsigned int format, unsigned int usage); - bool lock(unsigned int usage, void **vaddr); - bool lock(unsigned int _usage, int _x0, int _y0, int _width, int _height, void **_vaddr); - void unlock(); - unsigned int getWidth(); - unsigned int getHeight(); - unsigned int getStride(); - android_native_buffer_t *getNativeBuffer(); - static bool hasBufferMapper(); - -private: - bool initSize(unsigned int w, unsigned int h, unsigned int format, unsigned int usage); -}; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/gralloc.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/gralloc.h deleted file mode 100644 index 3e6bd11..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/gralloc.h +++ /dev/null @@ -1,359 +0,0 @@ -#pragma once - -#include - -#include "libhardware.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * pixel format definitions - */ - -enum { - HAL_PIXEL_FORMAT_RGBA_8888 = 1, - HAL_PIXEL_FORMAT_RGBX_8888 = 2, - HAL_PIXEL_FORMAT_RGB_888 = 3, - HAL_PIXEL_FORMAT_RGB_565 = 4, - HAL_PIXEL_FORMAT_BGRA_8888 = 5, - HAL_PIXEL_FORMAT_RGBA_5551 = 6, - HAL_PIXEL_FORMAT_RGBA_4444 = 7, - - /* 0x8 - 0xFF range unavailable */ - - /* - * 0x100 - 0x1FF - * - * This range is reserved for pixel formats that are specific to the HAL - * implementation. Implementations can use any value in this range to - * communicate video pixel formats between their HAL modules. These formats - * must not have an alpha channel. Additionally, an EGLimage created from a - * gralloc buffer of one of these formats must be supported for use with the - * GL_OES_EGL_image_external OpenGL ES extension. - */ - - /* - * Android YUV format: - * - * This format is exposed outside of the HAL to software - * decoders and applications. - * EGLImageKHR must support it in conjunction with the - * OES_EGL_image_external extension. - * - * YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed - * by (W/2) x (H/2) Cr and Cb planes. - * - * This format assumes - * - an even width - * - an even height - * - a horizontal stride multiple of 16 pixels - * - a vertical stride equal to the height - * - * y_size = stride * height - * c_size = ALIGN(stride/2, 16) * height/2 - * size = y_size + c_size * 2 - * cr_offset = y_size - * cb_offset = y_size + c_size - * - */ - HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar - - - - /* Legacy formats (deprecated), used by ImageFormat.java */ - HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 - HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 - HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 -}; - -// hardware/gralloc.h - -#define GRALLOC_HARDWARE_MODULE_ID "gralloc" - -#define GRALLOC_HARDWARE_GPU0 "gpu0" - -enum { - /* buffer is never read in software */ - GRALLOC_USAGE_SW_READ_NEVER = 0x00000000, - /* buffer is rarely read in software */ - GRALLOC_USAGE_SW_READ_RARELY = 0x00000002, - /* buffer is often read in software */ - GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003, - /* mask for the software read values */ - GRALLOC_USAGE_SW_READ_MASK = 0x0000000F, - - /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000, - /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020, - /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030, - /* mask for the software write values */ - GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0, - - /* buffer will be used as an OpenGL ES texture */ - GRALLOC_USAGE_HW_TEXTURE = 0x00000100, - /* buffer will be used as an OpenGL ES render target */ - GRALLOC_USAGE_HW_RENDER = 0x00000200, - /* buffer will be used by the 2D hardware blitter */ - GRALLOC_USAGE_HW_2D = 0x00000C00, - /* buffer will be used with the framebuffer device */ - GRALLOC_USAGE_HW_FB = 0x00001000, - /* mask for the software usage bit-mask */ - GRALLOC_USAGE_HW_MASK = 0x00001F00, -}; - - -typedef const native_handle* buffer_handle_t; - -/** - * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM - * and the fields of this data structure must begin with hw_module_t - * followed by module specific information. - */ -typedef struct gralloc_module_t { - struct hw_module_t common; - - /* - * (*registerBuffer)() must be called before a buffer_handle_t that has not - * been created with (*alloc_device_t::alloc)() can be used. - * - * This is intended to be used with buffer_handle_t's that have been - * received in this process through IPC. - * - * This function checks that the handle is indeed a valid one and prepares - * it for use with (*lock)() and (*unlock)(). - * - * It is not necessary to call (*registerBuffer)() on a handle created - * with (*alloc_device_t::alloc)(). - * - * returns an error if this buffer_handle_t is not valid. - */ - int (*registerBuffer)(struct gralloc_module_t const* module, - buffer_handle_t handle); - - /* - * (*unregisterBuffer)() is called once this handle is no longer needed in - * this process. After this call, it is an error to call (*lock)(), - * (*unlock)(), or (*registerBuffer)(). - * - * This function doesn't close or free the handle itself; this is done - * by other means, usually through libcutils's native_handle_close() and - * native_handle_free(). - * - * It is an error to call (*unregisterBuffer)() on a buffer that wasn't - * explicitly registered first. - */ - int (*unregisterBuffer)(struct gralloc_module_t const* module, - buffer_handle_t handle); - - /* - * The (*lock)() method is called before a buffer is accessed for the - * specified usage. This call may block, for instance if the h/w needs - * to finish rendering or if CPU caches need to be synchronized. - * - * The caller promises to modify only pixels in the area specified - * by (l,t,w,h). - * - * The content of the buffer outside of the specified area is NOT modified - * by this call. - * - * If usage specifies GRALLOC_USAGE_SW_*, vaddr is filled with the address - * of the buffer in virtual memory. - * - * THREADING CONSIDERATIONS: - * - * It is legal for several different threads to lock a buffer from - * read access, none of the threads are blocked. - * - * However, locking a buffer simultaneously for write or read/write is - * undefined, but: - * - shall not result in termination of the process - * - shall not block the caller - * It is acceptable to return an error or to leave the buffer's content - * into an indeterminate state. - * - * If the buffer was created with a usage mask incompatible with the - * requested usage flags here, -EINVAL is returned. - * - */ - - int (*lock)(struct gralloc_module_t const* module, - buffer_handle_t handle, int usage, - int l, int t, int w, int h, - void** vaddr); - - - /* - * The (*unlock)() method must be called after all changes to the buffer - * are completed. - */ - - int (*unlock)(struct gralloc_module_t const* module, - buffer_handle_t handle); - - - /* reserved for future use */ - int (*perform)(struct gralloc_module_t const* module, - int operation, ... ); - - /* reserved for future use */ - void* reserved_proc[7]; -} gralloc_module_t; - -/*****************************************************************************/ - -/** - * Every device data structure must begin with hw_device_t - * followed by module specific public methods and attributes. - */ - -typedef struct alloc_device_t { - struct hw_device_t common; - - /* - * (*alloc)() Allocates a buffer in graphic memory with the requested - * parameters and returns a buffer_handle_t and the stride in pixels to - * allow the implementation to satisfy hardware constraints on the width - * of a pixmap (eg: it may have to be multiple of 8 pixels). - * The CALLER TAKES OWNERSHIP of the buffer_handle_t. - * - * Returns 0 on success or -errno on error. - */ - - int (*alloc)(struct alloc_device_t* dev, - int w, int h, int format, int usage, - buffer_handle_t* handle, int* stride); - - /* - * (*free)() Frees a previously allocated buffer. - * Behavior is undefined if the buffer is still mapped in any process, - * but shall not result in termination of the program or security breaches - * (allowing a process to get access to another process' buffers). - * THIS FUNCTION TAKES OWNERSHIP of the buffer_handle_t which becomes - * invalid after the call. - * - * Returns 0 on success or -errno on error. - */ - int (*free)(struct alloc_device_t* dev, - buffer_handle_t handle); - - /* This hook is OPTIONAL. - * - * If non NULL it will be caused by SurfaceFlinger on dumpsys - */ - void (*dump)(struct alloc_device_t *dev, char *buff, int buff_len); - - void* reserved_proc[7]; -} alloc_device_t; - - -/** convenience API for opening and closing a supported device */ - -static inline int gralloc_open(const struct hw_module_t* module, - struct alloc_device_t** device) { - return module->methods->open(module, - GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device); -} - -static inline int gralloc_close(struct alloc_device_t* device) { - return device->common.close(&device->common); -} - -// ui/egl/android_natives.h - -#define ANDROID_NATIVE_MAKE_CONSTANT(a,b,c,d) \ - (((unsigned)(a)<<24)|((unsigned)(b)<<16)|((unsigned)(c)<<8)|(unsigned)(d)) - -#define ANDROID_NATIVE_BUFFER_MAGIC \ - ANDROID_NATIVE_MAKE_CONSTANT('_','b','f','r') - - -typedef struct android_native_base_t -{ - /* a magic value defined by the actual EGL native type */ - int magic; - - /* the sizeof() of the actual EGL native type */ - int version; - - void* reserved[4]; - - /* reference-counting interface */ - void (*incRef)(struct android_native_base_t* base); - void (*decRef)(struct android_native_base_t* base); -} android_native_base_t; - -// ui/android_native_buffer.h - -struct android_native_buffer_t -{ -#ifdef __cplusplus - constexpr android_native_buffer_t() : - common{ANDROID_NATIVE_BUFFER_MAGIC, sizeof(android_native_buffer_t)}, - width{0}, height{0}, stride{0}, format{0}, usage{0}, reserved{}, handle{}, reserved_proc{} - {} -#endif - - struct android_native_base_t common; - - int width; - int height; - int stride; - int format; - int usage; - - void* reserved[2]; - - buffer_handle_t handle; - - void* reserved_proc[8]; -}; - -// include/pixelflinger/format.h - -enum GGLPixelFormat { - // these constants need to match those - // in graphics/PixelFormat.java, ui/PixelFormat.h, BlitHardware.h - GGL_PIXEL_FORMAT_UNKNOWN = 0, - GGL_PIXEL_FORMAT_NONE = 0, - - GGL_PIXEL_FORMAT_RGBA_8888 = 1, // 4x8-bit ARGB - GGL_PIXEL_FORMAT_RGBX_8888 = 2, // 3x8-bit RGB stored in 32-bit chunks - GGL_PIXEL_FORMAT_RGB_888 = 3, // 3x8-bit RGB - GGL_PIXEL_FORMAT_RGB_565 = 4, // 16-bit RGB - GGL_PIXEL_FORMAT_BGRA_8888 = 5, // 4x8-bit BGRA - GGL_PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit RGBA - GGL_PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit RGBA - - GGL_PIXEL_FORMAT_A_8 = 8, // 8-bit A - GGL_PIXEL_FORMAT_L_8 = 9, // 8-bit L (R=G=B = L) - GGL_PIXEL_FORMAT_LA_88 = 0xA, // 16-bit LA - GGL_PIXEL_FORMAT_RGB_332 = 0xB, // 8-bit RGB (non paletted) - - // reserved range. don't use. - GGL_PIXEL_FORMAT_RESERVED_10 = 0x10, - GGL_PIXEL_FORMAT_RESERVED_11 = 0x11, - GGL_PIXEL_FORMAT_RESERVED_12 = 0x12, - GGL_PIXEL_FORMAT_RESERVED_13 = 0x13, - GGL_PIXEL_FORMAT_RESERVED_14 = 0x14, - GGL_PIXEL_FORMAT_RESERVED_15 = 0x15, - GGL_PIXEL_FORMAT_RESERVED_16 = 0x16, - GGL_PIXEL_FORMAT_RESERVED_17 = 0x17, - - // reserved/special formats - GGL_PIXEL_FORMAT_Z_16 = 0x18, - GGL_PIXEL_FORMAT_S_8 = 0x19, - GGL_PIXEL_FORMAT_SZ_24 = 0x1A, - GGL_PIXEL_FORMAT_SZ_8 = 0x1B, - - // reserved range. don't use. - GGL_PIXEL_FORMAT_RESERVED_20 = 0x20, - GGL_PIXEL_FORMAT_RESERVED_21 = 0x21, -}; - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.cpp b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.cpp deleted file mode 100644 index 755f27d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "libhardware.h" -#include "Log.h" - -typedef int (*hw_get_moduleProto)(const char *id, const struct hw_module_t **module); - -static hw_get_moduleProto hw_get_moduleSym = 0; - -bool libhardware_dl() -{ - if(hw_get_moduleSym) - return true; - void *libhardware = dlopen("libhardware.so", RTLD_LAZY); - if(!libhardware) - { - LOG(LOG_ERROR, "libhardware not found"); - return false; - } - hw_get_moduleSym = (hw_get_moduleProto)dlsym(libhardware, "hw_get_module"); - if(!hw_get_moduleSym) - { - LOG(LOG_ERROR, "missing libhardware functions"); - dlclose(libhardware); - hw_get_moduleSym = 0; - return false; - } - LOG(LOG_ERROR, "libhardware symbols loaded"); - return true; -} - -int hw_get_module(const char *id, const struct hw_module_t **module) -{ - assert(hw_get_moduleSym); - return hw_get_moduleSym(id, module); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.h deleted file mode 100644 index efa708f..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PrivateApi/libhardware.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -bool libhardware_dl(); - -// hardware/hardware.h - -struct hw_module_t; -struct hw_module_methods_t; -struct hw_device_t; - -/** - * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM - * and the fields of this data structure must begin with hw_module_t - * followed by module specific information. - */ -typedef struct hw_module_t { - /** tag must be initialized to HARDWARE_MODULE_TAG */ - uint32_t tag; - - /** major version number for the module */ - uint16_t version_major; - - /** minor version number of the module */ - uint16_t version_minor; - - /** Identifier of module */ - const char *id; - - /** Name of this module */ - const char *name; - - /** Author/owner/implementor of the module */ - const char *author; - - /** Modules methods */ - struct hw_module_methods_t* methods; - - /** module's dso */ - void* dso; - - /** padding to 128 bytes, reserved for future use */ - uint32_t reserved[32-7]; - -} hw_module_t; - -typedef struct hw_module_methods_t { - /** Open a specific device */ - int (*open)(const struct hw_module_t* module, const char* id, - struct hw_device_t** device); - -} hw_module_methods_t; - -/** - * Every device data structure must begin with hw_device_t - * followed by module specific public methods and attributes. - */ -struct hw_device_t { - /** tag must be initialized to HARDWARE_DEVICE_TAG */ - uint32_t tag; - - /** version number for hw_device_t */ - uint32_t version; - - /** reference to the module this device belongs to */ - struct hw_module_t* module; - - /** padding reserved for future use */ - uint32_t reserved[12]; - - /** Close this device */ - int (*close)(struct hw_device_t* device); - -}; - -int hw_get_module(const char *id, const struct hw_module_t **module); - -// cutils/native_handle.h - -typedef struct -{ - int version; /* sizeof(native_handle_t) */ - int numFds; /* number of file-descriptors at &data[0] */ - int numInts; /* number of ints at &data[numFds] */ - int data[0]; /* numFds + numInts ints */ -} native_handle_t; - -/* keep the old definition for backward source-compatibility */ -typedef native_handle_t native_handle; - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.cpp b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.cpp deleted file mode 100644 index 387e3bf..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Based on https://github.com/chromium/chromium/blob/master/base/android/android_hardware_buffer_compat.h - -#include "android_hardware_buffer_compat.h" - -#include -#include -#include - -namespace opengl { - - -AndroidHardwareBufferCompat::AndroidHardwareBufferCompat() { - DCHECK(IsSupportAvailable()); - - // TODO(klausw): If the Chromium build requires __ANDROID_API__ >= 26 at some - // point in the future, we could directly use the global functions instead of - // dynamic loading. However, since this would be incompatible with pre-Oreo - // devices, this is unlikely to happen in the foreseeable future, so just - // unconditionally use dynamic loading. - - // cf. base/android/linker/modern_linker_jni.cc - void *main_dl_handle = dlopen(nullptr, RTLD_NOW); - - *reinterpret_cast(&allocate_) = - dlsym(main_dl_handle, "AHardwareBuffer_allocate"); - DCHECK(allocate_); - - *reinterpret_cast(&acquire_) = - dlsym(main_dl_handle, "AHardwareBuffer_acquire"); - DCHECK(acquire_); - - *reinterpret_cast(&describe_) = - dlsym(main_dl_handle, "AHardwareBuffer_describe"); - DCHECK(describe_); - - *reinterpret_cast(&lock_) = - dlsym(main_dl_handle, "AHardwareBuffer_lock"); - DCHECK(lock_); - - *reinterpret_cast(&recv_handle_) = - dlsym(main_dl_handle, "AHardwareBuffer_recvHandleFromUnixSocket"); - DCHECK(recv_handle_); - - *reinterpret_cast(&release_) = - dlsym(main_dl_handle, "AHardwareBuffer_release"); - DCHECK(release_); - - *reinterpret_cast(&send_handle_) = - dlsym(main_dl_handle, "AHardwareBuffer_sendHandleToUnixSocket"); - DCHECK(send_handle_); - - *reinterpret_cast(&unlock_) = - dlsym(main_dl_handle, "AHardwareBuffer_unlock"); - DCHECK(unlock_); -} - -bool AndroidHardwareBufferCompat::IsSupportAvailable() { - - static bool apiLevelChecked = false; - static int apiLevel = 0; - - if (!apiLevelChecked) - { - char *androidApiLevel = new char[PROP_VALUE_MAX]; - - int valid = __system_property_get("ro.build.version.sdk", androidApiLevel); - - if (valid > 0) { - std::stringstream convert(androidApiLevel); - convert >> apiLevel; - } - } - - return apiLevel >= 26; -} - - -AndroidHardwareBufferCompat &AndroidHardwareBufferCompat::GetInstance() { - static AndroidHardwareBufferCompat compat; - return compat; -} - -int AndroidHardwareBufferCompat::Allocate(const AHardwareBuffer_Desc *desc, - AHardwareBuffer **out_buffer) { - DCHECK(IsSupportAvailable()); - return allocate_(desc, out_buffer); -} - -void AndroidHardwareBufferCompat::Acquire(AHardwareBuffer *buffer) { - DCHECK(IsSupportAvailable()); - acquire_(buffer); -} - -void AndroidHardwareBufferCompat::Describe(const AHardwareBuffer *buffer, - AHardwareBuffer_Desc *out_desc) { - DCHECK(IsSupportAvailable()); - describe_(buffer, out_desc); -} - -int AndroidHardwareBufferCompat::Lock(AHardwareBuffer *buffer, - uint64_t usage, - int32_t fence, - const ARect *rect, - void **out_virtual_address) { - DCHECK(IsSupportAvailable()); - return lock_(buffer, usage, fence, rect, out_virtual_address); -} - -int AndroidHardwareBufferCompat::RecvHandleFromUnixSocket( - int socket_fd, - AHardwareBuffer **out_buffer) { - DCHECK(IsSupportAvailable()); - return recv_handle_(socket_fd, out_buffer); -} - -void AndroidHardwareBufferCompat::Release(AHardwareBuffer *buffer) { - DCHECK(IsSupportAvailable()); - release_(buffer); -} - -int AndroidHardwareBufferCompat::SendHandleToUnixSocket( - const AHardwareBuffer *buffer, - int socket_fd) { - DCHECK(IsSupportAvailable()); - return send_handle_(buffer, socket_fd); -} - -int AndroidHardwareBufferCompat::Unlock(AHardwareBuffer *buffer, - int32_t *fence) { - DCHECK(IsSupportAvailable()); - return unlock_(buffer, fence); -} - -} // namespace base \ No newline at end of file diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.h deleted file mode 100644 index b4179a4..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/android_hardware_buffer_compat.h +++ /dev/null @@ -1,75 +0,0 @@ -// Based on https://github.com/chromium/chromium/blob/master/base/android/android_hardware_buffer_compat.h - -#ifndef ANDROID_ANDROID_HARDWARE_BUFFER_COMPAT_H_ -#define ANDROID_ANDROID_HARDWARE_BUFFER_COMPAT_H_ - -#include -#include -#include "dcheck.h" - -extern "C" { -using PFAHardwareBuffer_allocate = int (*)(const AHardwareBuffer_Desc *desc, - AHardwareBuffer **outBuffer) ; -using PFAHardwareBuffer_acquire = void (*)(AHardwareBuffer *buffer) ; -using PFAHardwareBuffer_describe = void (*)(const AHardwareBuffer *buffer, - AHardwareBuffer_Desc *outDesc) ; -using PFAHardwareBuffer_lock = int (*)(AHardwareBuffer *buffer, - uint64_t usage, - int32_t fence, - const ARect *rect, - void **outVirtualAddress) ; -using PFAHardwareBuffer_recvHandleFromUnixSocket = -int (*)(int socketFd, AHardwareBuffer **outBuffer) ; -using PFAHardwareBuffer_release = void (*)(AHardwareBuffer *buffer) ; -using PFAHardwareBuffer_sendHandleToUnixSocket = -int (*)(const AHardwareBuffer *buffer, int socketFd) ; -using PFAHardwareBuffer_unlock = int (*)(AHardwareBuffer *buffer, - int32_t *fence) ; -} - -namespace opengl { - -// This class provides runtime support for working with AHardwareBuffer objects -// on Android O systems without requiring building for the Android O NDK level. -// Don't call GetInstance() unless IsSupportAvailable() returns true. -class AndroidHardwareBufferCompat { -public: - - AndroidHardwareBufferCompat (const AndroidHardwareBufferCompat&) = delete; - AndroidHardwareBufferCompat& operator= (const AndroidHardwareBufferCompat&) = delete; - - static bool IsSupportAvailable(); - static AndroidHardwareBufferCompat& GetInstance(); - - int Allocate(const AHardwareBuffer_Desc* desc, AHardwareBuffer** outBuffer); - void Acquire(AHardwareBuffer* buffer); - void Describe(const AHardwareBuffer* buffer, AHardwareBuffer_Desc* outDesc); - int Lock(AHardwareBuffer* buffer, - uint64_t usage, - int32_t fence, - const ARect* rect, - void** out_virtual_address); - int RecvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer); - void Release(AHardwareBuffer* buffer); - int SendHandleToUnixSocket(const AHardwareBuffer* buffer, int socketFd); - int Unlock(AHardwareBuffer* buffer, int32_t* fence); - -private: - - AndroidHardwareBufferCompat(); - ~AndroidHardwareBufferCompat() = default; - - PFAHardwareBuffer_allocate allocate_; - PFAHardwareBuffer_acquire acquire_; - PFAHardwareBuffer_describe describe_; - PFAHardwareBuffer_lock lock_; - PFAHardwareBuffer_recvHandleFromUnixSocket recv_handle_; - PFAHardwareBuffer_release release_; - PFAHardwareBuffer_sendHandleToUnixSocket send_handle_; - PFAHardwareBuffer_unlock unlock_; - -}; - -} // namespace opengl - -#endif // ANDROID_ANDROID_HARDWARE_BUFFER_COMPAT_H_ \ No newline at end of file diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/check.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/check.h deleted file mode 100644 index 41439f3..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/check.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * You can read more about these macros on chromium.org. - * Go to the direct link - https://www.chromium.org/developers/coding-style#TOC-CHECK-DCHECK-and-NOTREACHED- - * - * ... other source files should be here in this repo or folder or w/e - * - */ - -#ifndef CLIB_CHECK_H -#define CLIB_CHECK_H - -// thank you brother tj & stephen (https://github.com/clibs/unlikely) -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -# define likely(expr) (__builtin_expect(!!(expr), 1)) -# define unlikely(expr) (__builtin_expect(!!(expr), 0)) -#else -# define likely(expr) (1 == !!(expr)) -# define unlikely(expr) (0 == !!(expr)) -#endif - -// overload if you want your own abort fn - w/e -#ifndef CHECK_ABORT_FUNCTION -// need that prototype def -# include -# define CHECK_ABORT_FUNCTION abort -#endif - -// check and bail if nope -#ifndef CHECK -# define CHECK(expr) if (!likely(expr)) { CHECK_ABORT_FUNCTION(); } -#endif - -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/dcheck.h b/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/dcheck.h deleted file mode 100644 index b2bee88..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/GraphicBuffer/PublicApi/dcheck.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef CLIB_DCHECK_H -#define CLIB_DCHECK_H - -#include "check.h" - -// check and bail if nope. however, this only works if `-D DCHECK_IS_ON` -// or equivalent is defined -#ifdef DCHECK_IS_ON -# define DCHECK(...) CHECK(__VA_ARGS__); -#else -# define DCHECK(expr) ((void) expr); -#endif - -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/BlockingQueue.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/BlockingQueue.h deleted file mode 100644 index 1c5439c..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/BlockingQueue.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include -#include -#include - -template > -class BlockingQueue -{ -private: - std::mutex m_mutex; - std::condition_variable m_condition; - Container m_queue; -public: - void push(T const& value) - { - { - std::unique_lock lock(this->m_mutex); - m_queue.push_front(value); - } - this->m_condition.notify_one(); - } - - void pushBack(T const& value) - { - { - std::unique_lock lock(this->m_mutex); - m_queue.push_back(value); - } - this->m_condition.notify_one(); - } - - T pop() - { - std::unique_lock lock(this->m_mutex); - this->m_condition.wait(lock, [this]{ return !this->m_queue.empty(); }); - T rc(std::move(this->m_queue.back())); - this->m_queue.pop_back(); - return rc; - } - - bool tryPop(T & v, std::chrono::milliseconds dur) - { - std::unique_lock lock(this->m_mutex); - if (!this->m_condition.wait_for(lock, dur, [this]{ return !this->m_queue.empty(); })) { - return false; - } - v = std::move(this->m_queue.back()); - this->m_queue.pop_back(); - return true; - } - - size_t size() - { - return m_queue.size(); - } -}; diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp deleted file mode 100644 index 586ddf8..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "RingBufferPool.h" -#include -#include -#include -#include - -namespace opengl { - - -PoolBufferPointer::PoolBufferPointer() : - m_offset(0), - m_size(0), - m_realSize(0), - m_isValid(false) -{ - -} - -PoolBufferPointer::PoolBufferPointer(size_t _offset, size_t _size, size_t _realSize, bool _isValid) : - m_offset(_offset), - m_size(_size), - m_realSize(_realSize), - m_isValid(_isValid) -{ -} - -PoolBufferPointer::PoolBufferPointer(const PoolBufferPointer& other) : - m_offset(other.m_offset), - m_size(other.m_size), - m_realSize(other.m_realSize), - m_isValid(other.m_isValid) -{ -} - -PoolBufferPointer& PoolBufferPointer::operator=(const PoolBufferPointer& other) -{ - m_offset = other.m_offset; - m_size = other.m_size; - m_realSize = other.m_realSize; - m_isValid = other.m_isValid; - return *this; -} - -bool PoolBufferPointer::isValid() const -{ - return m_isValid; -} - -size_t PoolBufferPointer::getSize() const -{ - return m_size; -} - -RingBufferPool::RingBufferPool(size_t _poolSize) : - m_poolBuffer(m_startBufferPoolSize, 0), - m_inUseStartOffset(0), - m_inUseEndOffset(0), - m_full(false), - m_maxBufferPoolSize(_poolSize) -{ - -} - -PoolBufferPointer RingBufferPool::createPoolBuffer(const char* _buffer, size_t _bufferSize) -{ - size_t realBufferSize = _bufferSize; - const int byteAlignment = 8; - const size_t remainder = _bufferSize % byteAlignment; - - if (remainder != 0) - realBufferSize = _bufferSize + byteAlignment - remainder; - - const size_t tempInUseStart = m_inUseStartOffset; - - const size_t remaining = tempInUseStart > m_inUseEndOffset || m_full ? - static_cast(tempInUseStart - m_inUseEndOffset) : - m_poolBuffer.size() - m_inUseEndOffset + tempInUseStart; - - bool isValid = remaining >= realBufferSize; - - size_t startOffset = 0; - - // We have determined that it fits - if (isValid) { - - // We don't want to split data between the end of the ring buffer and the start - // Re-check buffer size if we are going to start at the beginning of the ring buffer - if (m_inUseEndOffset + realBufferSize > m_poolBuffer.size()) { - isValid = realBufferSize < tempInUseStart || tempInUseStart == m_inUseEndOffset; - - if (isValid) { - startOffset = 0; - m_inUseEndOffset = realBufferSize; - } else { - { - std::unique_lock lock(m_mutex); - m_condition.wait(lock, [this, realBufferSize] { - const size_t tempInUseStartLocal = m_inUseStartOffset; - return realBufferSize < tempInUseStartLocal || - tempInUseStartLocal == m_inUseEndOffset; - }); - } - return createPoolBuffer(_buffer, _bufferSize); - } - } else { - startOffset = m_inUseEndOffset; - m_inUseEndOffset += realBufferSize; - } - } else { - // Wait until enough space is avalable - { - if (realBufferSize > m_maxBufferPoolSize) { - std::stringstream errorString; - errorString << " Attempted to create buffer of invalid size, size=" << realBufferSize << ", max_size=" << m_maxBufferPoolSize; - LOG(LOG_ERROR, errorString.str().c_str()); - throw std::runtime_error(errorString.str().c_str()); - } - - std::unique_lock lock(m_mutex); - size_t poolBufferSize = m_poolBuffer.size(); - if (m_poolBuffer.size() < realBufferSize) { - std::stringstream logString; - logString << " Increasing buffer size from " << m_poolBuffer.size() << " to " << realBufferSize; - LOG(LOG_VERBOSE, logString.str().c_str()); - poolBufferSize = realBufferSize; - } - - m_condition.wait(lock, [this, realBufferSize, poolBufferSize] { - const size_t tempInUseStartLocal = m_inUseStartOffset; - const size_t remainingLocal = - tempInUseStartLocal > m_inUseEndOffset || m_full ? static_cast( - tempInUseStartLocal - m_inUseEndOffset) : - poolBufferSize - m_inUseEndOffset + tempInUseStartLocal; - - return remainingLocal >= realBufferSize; - }); - - // Resize afterwards, we don't want to lose the validity of pointers - // pointing at the old data, also wait until the memory pool is empty, - // we don't want anyone point to the old allocation. - if (m_poolBuffer.size() < realBufferSize) { - - const size_t tempInUseStartLocal = m_inUseStartOffset; - const size_t remainingLocal = - tempInUseStartLocal > m_inUseEndOffset || m_full ? static_cast( - tempInUseStartLocal - m_inUseEndOffset) : - poolBufferSize - m_inUseEndOffset + tempInUseStartLocal; - - if (remainingLocal != realBufferSize) { - m_condition.wait(lock, [this, realBufferSize, poolBufferSize] { - const size_t tempInUseStartLocal = m_inUseStartOffset; - const size_t remainingLocal = - tempInUseStartLocal > m_inUseEndOffset || m_full ? static_cast( - tempInUseStartLocal - m_inUseEndOffset) : - poolBufferSize - m_inUseEndOffset + tempInUseStartLocal; - - return remainingLocal == realBufferSize; - }); - } - - m_poolBuffer.resize(realBufferSize); - } - } - - return createPoolBuffer(_buffer, _bufferSize); - } - - std::copy_n(_buffer, _bufferSize, &m_poolBuffer[startOffset]); - - m_full = m_inUseEndOffset == tempInUseStart; - - return PoolBufferPointer(startOffset, _bufferSize, realBufferSize, isValid); -} - -const char* RingBufferPool::getBufferFromPool(PoolBufferPointer _poolBufferPointer) -{ - if (!_poolBufferPointer.isValid()) { - return nullptr; - } else { - std::unique_lock lock(m_mutex); - return m_poolBuffer.data() + _poolBufferPointer.m_offset; - } -} - -void RingBufferPool::removeBufferFromPool(PoolBufferPointer _poolBufferPointer) -{ - if (_poolBufferPointer.isValid()) { - std::unique_lock lock(m_mutex); - m_inUseStartOffset = _poolBufferPointer.m_offset + _poolBufferPointer.m_realSize; - m_full = false; - m_condition.notify_one(); - } -} - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.h deleted file mode 100644 index b14c943..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace opengl { -//This class is only thread safe for a single producer and single consumer -class PoolBufferPointer -{ -public: - PoolBufferPointer(); - PoolBufferPointer(const PoolBufferPointer& other); - PoolBufferPointer& operator=(const PoolBufferPointer& other); - - bool isValid() const; - size_t getSize() const; -private: - PoolBufferPointer(size_t _offset, size_t _size, size_t _realSize, bool _isValid); - - size_t m_offset; - size_t m_size; - size_t m_realSize; - bool m_isValid; - - friend class RingBufferPool; -}; - -class RingBufferPool -{ -public: - - explicit RingBufferPool(size_t _poolSize); - - // Create a buffer pool. This method will block if there is not enough space until - // enough space has been freed from a seperate thread. If a buffer bigger than the - // maximum is allocated, then a run time exception will be thrown - PoolBufferPointer createPoolBuffer(const char* _buffer, size_t _bufferSize); - - // Retrieves a buffer from the buffer pool, will return a nullptr if an invalid - // buffer is provided - const char* getBufferFromPool(PoolBufferPointer _poolBufferPointer); - - // Removes the give buffer from the pool, no action will be taken if the provided - // buffer is not valid - void removeBufferFromPool(PoolBufferPointer _poolBufferPointer); - -private: - std::atomic m_inUseStartOffset; - std::atomic m_inUseEndOffset; - std::vector m_poolBuffer; - std::mutex m_mutex; - std::atomic m_full; - std::condition_variable_any m_condition; - size_t m_maxBufferPoolSize; - static const size_t m_startBufferPoolSize = 1024 * 1024 * 10; -}; - -} \ No newline at end of file diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/atomicops.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/atomicops.h deleted file mode 100644 index ff828ca..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/atomicops.h +++ /dev/null @@ -1,675 +0,0 @@ -// ©2013-2016 Cameron Desrochers. -// Distributed under the simplified BSD license (see the license file that -// should have come with this header). -// Uses Jeff Preshing's semaphore implementation (under the terms of its -// separate zlib license, embedded below). - -#pragma once - -// Provides portable (VC++2010+, Intel ICC 13, GCC 4.7+, and anything C++11 compliant) implementation -// of low-level memory barriers, plus a few semi-portable utility macros (for inlining and alignment). -// Also has a basic atomic type (limited to hardware-supported atomics with no memory ordering guarantees). -// Uses the AE_* prefix for macros (historical reasons), and the "moodycamel" namespace for symbols. - -#include -#include -#include -#include -#include - -// Platform detection -#if defined(__INTEL_COMPILER) -#define AE_ICC -#elif defined(_MSC_VER) -#define AE_VCPP -#elif defined(__GNUC__) -#define AE_GCC -#endif - -#if defined(_M_IA64) || defined(__ia64__) -#define AE_ARCH_IA64 -#elif defined(_WIN64) || defined(__amd64__) || defined(_M_X64) || defined(__x86_64__) -#define AE_ARCH_X64 -#elif defined(_M_IX86) || defined(__i386__) -#define AE_ARCH_X86 -#elif defined(_M_PPC) || defined(__powerpc__) -#define AE_ARCH_PPC -#else -#define AE_ARCH_UNKNOWN -#endif - - -// AE_UNUSED -#define AE_UNUSED(x) ((void)x) - -// AE_NO_TSAN -#if defined(__has_feature) -#if __has_feature(thread_sanitizer) -#define AE_NO_TSAN __attribute__((no_sanitize("thread"))) -#else -#define AE_NO_TSAN -#endif -#else -#define AE_NO_TSAN -#endif - - -// AE_FORCEINLINE -#if defined(AE_VCPP) || defined(AE_ICC) -#define AE_FORCEINLINE __forceinline -#elif defined(AE_GCC) -//#define AE_FORCEINLINE __attribute__((always_inline)) -#define AE_FORCEINLINE inline -#else -#define AE_FORCEINLINE inline -#endif - - -// AE_ALIGN -#if defined(AE_VCPP) || defined(AE_ICC) -#define AE_ALIGN(x) __declspec(align(x)) -#elif defined(AE_GCC) -#define AE_ALIGN(x) __attribute__((aligned(x))) -#else -// Assume GCC compliant syntax... -#define AE_ALIGN(x) __attribute__((aligned(x))) -#endif - - -// Portable atomic fences implemented below: - -namespace moodycamel { - - enum memory_order { - memory_order_relaxed, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, - - // memory_order_sync: Forces a full sync: - // #LoadLoad, #LoadStore, #StoreStore, and most significantly, #StoreLoad - memory_order_sync = memory_order_seq_cst - }; - -} // end namespace moodycamel - -#if (defined(AE_VCPP) && (_MSC_VER < 1700 || defined(__cplusplus_cli))) || (defined(AE_ICC) && __INTEL_COMPILER < 1600) -// VS2010 and ICC13 don't support std::atomic_*_fence, implement our own fences - -#include - -#if defined(AE_ARCH_X64) || defined(AE_ARCH_X86) -#define AeFullSync _mm_mfence -#define AeLiteSync _mm_mfence -#elif defined(AE_ARCH_IA64) -#define AeFullSync __mf -#define AeLiteSync __mf -#elif defined(AE_ARCH_PPC) -#include -#define AeFullSync __sync -#define AeLiteSync __lwsync -#endif - - -#ifdef AE_VCPP -#pragma warning(push) -#pragma warning(disable: 4365) // Disable erroneous 'conversion from long to unsigned int, signed/unsigned mismatch' error when using `assert` -#ifdef __cplusplus_cli -#pragma managed(push, off) -#endif -#endif - -namespace moodycamel { - - AE_FORCEINLINE void compiler_fence(memory_order order) AE_NO_TSAN - { - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: _ReadBarrier(); break; - case memory_order_release: _WriteBarrier(); break; - case memory_order_acq_rel: _ReadWriteBarrier(); break; - case memory_order_seq_cst: _ReadWriteBarrier(); break; - default: assert(false); - } - } - - // x86/x64 have a strong memory model -- all loads and stores have - // acquire and release semantics automatically (so only need compiler - // barriers for those). -#if defined(AE_ARCH_X86) || defined(AE_ARCH_X64) - AE_FORCEINLINE void fence(memory_order order) AE_NO_TSAN - { - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: _ReadBarrier(); break; - case memory_order_release: _WriteBarrier(); break; - case memory_order_acq_rel: _ReadWriteBarrier(); break; - case memory_order_seq_cst: - _ReadWriteBarrier(); - AeFullSync(); - _ReadWriteBarrier(); - break; - default: assert(false); - } - } -#else - AE_FORCEINLINE void fence(memory_order order) AE_NO_TSAN - { - // Non-specialized arch, use heavier memory barriers everywhere just in case :-( - switch (order) { - case memory_order_relaxed: - break; - case memory_order_acquire: - _ReadBarrier(); - AeLiteSync(); - _ReadBarrier(); - break; - case memory_order_release: - _WriteBarrier(); - AeLiteSync(); - _WriteBarrier(); - break; - case memory_order_acq_rel: - _ReadWriteBarrier(); - AeLiteSync(); - _ReadWriteBarrier(); - break; - case memory_order_seq_cst: - _ReadWriteBarrier(); - AeFullSync(); - _ReadWriteBarrier(); - break; - default: assert(false); - } - } -#endif -} // end namespace moodycamel -#else -// Use standard library of atomics -#include - -namespace moodycamel { - - AE_FORCEINLINE void compiler_fence(memory_order order) AE_NO_TSAN - { - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: std::atomic_signal_fence(std::memory_order_acquire); break; - case memory_order_release: std::atomic_signal_fence(std::memory_order_release); break; - case memory_order_acq_rel: std::atomic_signal_fence(std::memory_order_acq_rel); break; - case memory_order_seq_cst: std::atomic_signal_fence(std::memory_order_seq_cst); break; - default: assert(false); - } - } - - AE_FORCEINLINE void fence(memory_order order) AE_NO_TSAN - { - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: std::atomic_thread_fence(std::memory_order_acquire); break; - case memory_order_release: std::atomic_thread_fence(std::memory_order_release); break; - case memory_order_acq_rel: std::atomic_thread_fence(std::memory_order_acq_rel); break; - case memory_order_seq_cst: std::atomic_thread_fence(std::memory_order_seq_cst); break; - default: assert(false); - } - } - -} // end namespace moodycamel - -#endif - - -#if !defined(AE_VCPP) || (_MSC_VER >= 1700 && !defined(__cplusplus_cli)) -#define AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC -#endif - -#ifdef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC -#include -#endif -#include - -// WARNING: *NOT* A REPLACEMENT FOR std::atomic. READ CAREFULLY: -// Provides basic support for atomic variables -- no memory ordering guarantees are provided. -// The guarantee of atomicity is only made for types that already have atomic load and store guarantees -// at the hardware level -- on most platforms this generally means aligned pointers and integers (only). -namespace moodycamel { - template - class weak_atomic - { - public: - AE_NO_TSAN weak_atomic() { } -#ifdef AE_VCPP -#pragma warning(push) -#pragma warning(disable: 4100) // Get rid of (erroneous) 'unreferenced formal parameter' warning -#endif - template AE_NO_TSAN weak_atomic(U&& x) : value(std::forward(x)) { } -#ifdef __cplusplus_cli - // Work around bug with universal reference/nullptr combination that only appears when /clr is on - AE_NO_TSAN weak_atomic(nullptr_t) : value(nullptr) { } -#endif - AE_NO_TSAN weak_atomic(weak_atomic const& other) : value(other.load()) { } - AE_NO_TSAN weak_atomic(weak_atomic&& other) : value(std::move(other.load())) { } -#ifdef AE_VCPP -#pragma warning(pop) -#endif - - AE_FORCEINLINE operator T() const AE_NO_TSAN{ return load(); } - - -#ifndef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC - template AE_FORCEINLINE weak_atomic const& operator=(U&& x) AE_NO_TSAN{ value = std::forward(x); return *this; } - AE_FORCEINLINE weak_atomic const& operator=(weak_atomic const& other) AE_NO_TSAN{ value = other.value; return *this; } - - AE_FORCEINLINE T load() const AE_NO_TSAN{ return value; } - - AE_FORCEINLINE T fetch_add_acquire(T increment) AE_NO_TSAN - { -#if defined(AE_ARCH_X64) || defined(AE_ARCH_X86) - if (sizeof(T) == 4) return _InterlockedExchangeAdd((long volatile*)&value, (long)increment); -#if defined(_M_AMD64) - else if (sizeof(T) == 8) return _InterlockedExchangeAdd64((long long volatile*)&value, (long long)increment); -#endif -#else -#error Unsupported platform -#endif - assert(false && "T must be either a 32 or 64 bit type"); - return value; - } - - AE_FORCEINLINE T fetch_add_release(T increment) AE_NO_TSAN - { -#if defined(AE_ARCH_X64) || defined(AE_ARCH_X86) - if (sizeof(T) == 4) return _InterlockedExchangeAdd((long volatile*)&value, (long)increment); -#if defined(_M_AMD64) - else if (sizeof(T) == 8) return _InterlockedExchangeAdd64((long long volatile*)&value, (long long)increment); -#endif -#else -#error Unsupported platform -#endif - assert(false && "T must be either a 32 or 64 bit type"); - return value; - } -#else - template - AE_FORCEINLINE weak_atomic const& operator=(U&& x) AE_NO_TSAN - { - value.store(std::forward(x), std::memory_order_relaxed); - return *this; - } - - AE_FORCEINLINE weak_atomic const& operator=(weak_atomic const& other) AE_NO_TSAN - { - value.store(other.value.load(std::memory_order_relaxed), std::memory_order_relaxed); - return *this; - } - - AE_FORCEINLINE T load() const AE_NO_TSAN{ return value.load(std::memory_order_relaxed); } - - AE_FORCEINLINE T fetch_add_acquire(T increment) AE_NO_TSAN - { - return value.fetch_add(increment, std::memory_order_acquire); - } - - AE_FORCEINLINE T fetch_add_release(T increment) AE_NO_TSAN - { - return value.fetch_add(increment, std::memory_order_release); - } -#endif - - - private: -#ifndef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC - // No std::atomic support, but still need to circumvent compiler optimizations. - // `volatile` will make memory access slow, but is guaranteed to be reliable. - volatile T value; -#else - std::atomic value; -#endif - }; - -} // end namespace moodycamel - - - -// Portable single-producer, single-consumer semaphore below: - -#if defined(_WIN32) -// Avoid including windows.h in a header; we only need a handful of -// items, so we'll redeclare them here (this is relatively safe since -// the API generally has to remain stable between Windows versions). -// I know this is an ugly hack but it still beats polluting the global -// namespace with thousands of generic names or adding a .cpp for nothing. -extern "C" { - struct _SECURITY_ATTRIBUTES; - __declspec(dllimport) void* __stdcall CreateSemaphoreW(_SECURITY_ATTRIBUTES* lpSemaphoreAttributes, long lInitialCount, long lMaximumCount, const wchar_t* lpName); - __declspec(dllimport) int __stdcall CloseHandle(void* hObject); - __declspec(dllimport) unsigned long __stdcall WaitForSingleObject(void* hHandle, unsigned long dwMilliseconds); - __declspec(dllimport) int __stdcall ReleaseSemaphore(void* hSemaphore, long lReleaseCount, long* lpPreviousCount); -} -#elif defined(__MACH__) -#include -#elif defined(__unix__) -#include -#endif - -namespace moodycamel -{ - // Code in the spsc_sema namespace below is an adaptation of Jeff Preshing's - // portable + lightweight semaphore implementations, originally from - // https://github.com/preshing/cpp11-on-multicore/blob/master/common/sema.h - // LICENSE: - // Copyright (c) 2015 Jeff Preshing - // - // This software is provided 'as-is', without any express or implied - // warranty. In no event will the authors be held liable for any damages - // arising from the use of this software. - // - // Permission is granted to anyone to use this software for any purpose, - // including commercial applications, and to alter it and redistribute it - // freely, subject to the following restrictions: - // - // 1. The origin of this software must not be misrepresented; you must not - // claim that you wrote the original software. If you use this software - // in a product, an acknowledgement in the product documentation would be - // appreciated but is not required. - // 2. Altered source versions must be plainly marked as such, and must not be - // misrepresented as being the original software. - // 3. This notice may not be removed or altered from any source distribution. - namespace spsc_sema - { -#if defined(_WIN32) - class Semaphore - { - private: - void* m_hSema; - - Semaphore(const Semaphore& other); - Semaphore& operator=(const Semaphore& other); - - public: - AE_NO_TSAN Semaphore(int initialCount = 0) - { - assert(initialCount >= 0); - const long maxLong = 0x7fffffff; - m_hSema = CreateSemaphoreW(nullptr, initialCount, maxLong, nullptr); - } - - AE_NO_TSAN ~Semaphore() - { - CloseHandle(m_hSema); - } - - void wait() AE_NO_TSAN - { - const unsigned long infinite = 0xffffffff; - WaitForSingleObject(m_hSema, infinite); - } - - bool try_wait() AE_NO_TSAN - { - const unsigned long RC_WAIT_TIMEOUT = 0x00000102; - return WaitForSingleObject(m_hSema, 0) != RC_WAIT_TIMEOUT; - } - - bool timed_wait(std::uint64_t usecs) AE_NO_TSAN - { - const unsigned long RC_WAIT_TIMEOUT = 0x00000102; - return WaitForSingleObject(m_hSema, (unsigned long)(usecs / 1000)) != RC_WAIT_TIMEOUT; - } - - void signal(int count = 1) AE_NO_TSAN - { - ReleaseSemaphore(m_hSema, count, nullptr); - } - }; -#elif defined(__MACH__) - //--------------------------------------------------------- - // Semaphore (Apple iOS and OSX) - // Can't use POSIX semaphores due to http://lists.apple.com/archives/darwin-kernel/2009/Apr/msg00010.html - //--------------------------------------------------------- - class Semaphore - { - private: - semaphore_t m_sema; - - Semaphore(const Semaphore& other); - Semaphore& operator=(const Semaphore& other); - - public: - AE_NO_TSAN Semaphore(int initialCount = 0) - { - assert(initialCount >= 0); - semaphore_create(mach_task_self(), &m_sema, SYNC_POLICY_FIFO, initialCount); - } - - AE_NO_TSAN ~Semaphore() - { - semaphore_destroy(mach_task_self(), m_sema); - } - - void wait() AE_NO_TSAN - { - semaphore_wait(m_sema); - } - - bool try_wait() AE_NO_TSAN - { - return timed_wait(0); - } - - bool timed_wait(std::int64_t timeout_usecs) AE_NO_TSAN - { - mach_timespec_t ts; - ts.tv_sec = static_cast(timeout_usecs / 1000000); - ts.tv_nsec = (timeout_usecs % 1000000) * 1000; - - // added in OSX 10.10: https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/APIDiffsMacOSX10_10SeedDiff/modules/Darwin.html - kern_return_t rc = semaphore_timedwait(m_sema, ts); - - return rc != KERN_OPERATION_TIMED_OUT && rc != KERN_ABORTED; - } - - void signal() AE_NO_TSAN - { - semaphore_signal(m_sema); - } - - void signal(int count) AE_NO_TSAN - { - while (count-- > 0) - { - semaphore_signal(m_sema); - } - } - }; -#elif defined(__unix__) - //--------------------------------------------------------- - // Semaphore (POSIX, Linux) - //--------------------------------------------------------- - class Semaphore - { - private: - sem_t m_sema; - - Semaphore(const Semaphore& other); - Semaphore& operator=(const Semaphore& other); - - public: - AE_NO_TSAN Semaphore(int initialCount = 0) - { - assert(initialCount >= 0); - sem_init(&m_sema, 0, initialCount); - } - - AE_NO_TSAN ~Semaphore() - { - sem_destroy(&m_sema); - } - - void wait() AE_NO_TSAN - { - // http://stackoverflow.com/questions/2013181/gdb-causes-sem-wait-to-fail-with-eintr-error - int rc; - do - { - rc = sem_wait(&m_sema); - } while (rc == -1 && errno == EINTR); - } - - bool try_wait() AE_NO_TSAN - { - int rc; - do { - rc = sem_trywait(&m_sema); - } while (rc == -1 && errno == EINTR); - return !(rc == -1 && errno == EAGAIN); - } - - bool timed_wait(std::uint64_t usecs) AE_NO_TSAN - { - struct timespec ts; - const int usecs_in_1_sec = 1000000; - const int nsecs_in_1_sec = 1000000000; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += usecs / usecs_in_1_sec; - ts.tv_nsec += (usecs % usecs_in_1_sec) * 1000; - // sem_timedwait bombs if you have more than 1e9 in tv_nsec - // so we have to clean things up before passing it in - if (ts.tv_nsec >= nsecs_in_1_sec) { - ts.tv_nsec -= nsecs_in_1_sec; - ++ts.tv_sec; - } - - int rc; - do { - rc = sem_timedwait(&m_sema, &ts); - } while (rc == -1 && errno == EINTR); - return !(rc == -1 && errno == ETIMEDOUT); - } - - void signal() AE_NO_TSAN - { - sem_post(&m_sema); - } - - void signal(int count) AE_NO_TSAN - { - while (count-- > 0) - { - sem_post(&m_sema); - } - } - }; -#else -#error Unsupported platform! (No semaphore wrapper available) -#endif - - //--------------------------------------------------------- - // LightweightSemaphore - //--------------------------------------------------------- - class LightweightSemaphore - { - public: - typedef std::make_signed::type ssize_t; - - private: - weak_atomic m_count; - Semaphore m_sema; - - bool waitWithPartialSpinning(std::int64_t timeout_usecs = -1) AE_NO_TSAN - { - ssize_t oldCount; - // Is there a better way to set the initial spin count? - // If we lower it to 1000, testBenaphore becomes 15x slower on my Core i7-5930K Windows PC, - // as threads start hitting the kernel semaphore. - int spin = 10000; - while (--spin >= 0) - { - if (m_count.load() > 0) - { - m_count.fetch_add_acquire(-1); - return true; - } - compiler_fence(memory_order_acquire); // Prevent the compiler from collapsing the loop. - } - oldCount = m_count.fetch_add_acquire(-1); - if (oldCount > 0) - return true; - if (timeout_usecs < 0) - { - m_sema.wait(); - return true; - } - if (m_sema.timed_wait(timeout_usecs)) - return true; - // At this point, we've timed out waiting for the semaphore, but the - // count is still decremented indicating we may still be waiting on - // it. So we have to re-adjust the count, but only if the semaphore - // wasn't signaled enough times for us too since then. If it was, we - // need to release the semaphore too. - while (true) - { - oldCount = m_count.fetch_add_release(1); - if (oldCount < 0) - return false; // successfully restored things to the way they were - // Oh, the producer thread just signaled the semaphore after all. Try again: - oldCount = m_count.fetch_add_acquire(-1); - if (oldCount > 0 && m_sema.try_wait()) - return true; - } - } - - public: - AE_NO_TSAN LightweightSemaphore(ssize_t initialCount = 0) : m_count(initialCount) - { - assert(initialCount >= 0); - } - - bool tryWait() AE_NO_TSAN - { - if (m_count.load() > 0) - { - m_count.fetch_add_acquire(-1); - return true; - } - return false; - } - - void wait() AE_NO_TSAN - { - if (!tryWait()) - waitWithPartialSpinning(); - } - - bool wait(std::int64_t timeout_usecs) AE_NO_TSAN - { - return tryWait() || waitWithPartialSpinning(timeout_usecs); - } - - void signal(ssize_t count = 1) AE_NO_TSAN - { - assert(count >= 0); - ssize_t oldCount = m_count.fetch_add_release(count); - assert(oldCount >= -1); - if (oldCount < 0) - { - m_sema.signal(1); - } - } - - ssize_t availableApprox() const AE_NO_TSAN - { - ssize_t count = m_count.load(); - return count > 0 ? count : 0; - } - }; - } // end namespace spsc_sema -} // end namespace moodycamel - -#if defined(AE_VCPP) && (_MSC_VER < 1700 || defined(__cplusplus_cli)) -#pragma warning(pop) -#ifdef __cplusplus_cli -#pragma managed(pop) -#endif -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.cpp b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.cpp deleted file mode 100644 index f8241fc..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "opengl_Command.h" -#include "Graphics/OpenGLContext/GLFunctions.h" -#include "RingBufferPool.h" -#include - -namespace opengl { - - // Max memory pool size - RingBufferPool OpenGlCommand::m_ringBufferPool(1024 * 1024 * 200 ); - - void OpenGlCommand::performCommandSingleThreaded() - { - commandToExecute(); - - setInUse(false); -#ifdef GL_DEBUG - if (m_isGlCommand) { - auto error = ptrGetError(); - if (error != GL_NO_ERROR) { - std::stringstream errorString; - errorString << " OpenGL error: 0x" << std::hex << error << ", on function: " << m_functionName; - LOG(LOG_ERROR, errorString.str().c_str()); - throw std::runtime_error(errorString.str().c_str()); - } - } -#endif - } - - bool OpenGlCommand::isTimeToShutdown() - { - return false; - } - - void OpenGlCommand::performCommand() - { - std::unique_lock lock(m_condvarMutex); - performCommandSingleThreaded(); - if (m_synced) { -#ifdef GL_DEBUG - if (m_logIfSynced) { - std::stringstream errorString; - errorString << " Executing synced: " << m_functionName; - LOG(LOG_ERROR, errorString.str().c_str()); - } -#endif - m_executed = true; - m_condition.notify_all(); - } - } - - void OpenGlCommand::waitOnCommand() - { - std::unique_lock lock(m_condvarMutex); - - if (m_synced && !m_executed) { - m_condition.wait(lock, [this] { return m_executed; }); - } - - m_executed = false; - } -#ifdef GL_DEBUG - std::string OpenGlCommand::getFunctionName() - { - return m_functionName; - } -#endif - OpenGlCommand::OpenGlCommand(bool _synced, bool _logIfSynced, const std::string &_functionName, - bool _isGlCommand) : - m_synced(_synced), m_executed(false) -#ifdef GL_DEBUG - , m_logIfSynced(_logIfSynced) - , m_functionName(std::move(_functionName)) - , m_isGlCommand(_isGlCommand) -#endif - { - } - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.h deleted file mode 100644 index c782074..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include "opengl_ObjectPool.h" -#include "RingBufferPool.h" - -namespace opengl { - - class OpenGlCommand : public PoolObject { - public: - void performCommandSingleThreaded(); - - void performCommand(); - - void waitOnCommand(); -#ifdef GL_DEBUG - std::string getFunctionName(); -#endif - - virtual bool isTimeToShutdown(); - - static RingBufferPool m_ringBufferPool; - - protected: - OpenGlCommand(bool _synced, bool _logIfSynced, const std::string &_functionName, - bool _isGlCommand = true); - - virtual void commandToExecute() = 0; - - template - static std::shared_ptr getFromPool(int _poolId) { - auto poolObject = OpenGlCommandPool::get().getAvailableObject(_poolId); - if (poolObject == nullptr) { - poolObject = std::shared_ptr(new CoomandType); - OpenGlCommandPool::get().addObjectToPool(_poolId, poolObject); - } - - poolObject->setInUse(true); - return std::static_pointer_cast(poolObject); - } - -#ifdef GL_DEBUG - const bool m_logIfSynced; - const std::string m_functionName; - const bool m_isGlCommand; -#endif - - private: - std::atomic m_synced; - bool m_executed; - std::mutex m_condvarMutex; - std::condition_variable m_condition; - }; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.cpp b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.cpp deleted file mode 100644 index e8b402a..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "opengl_ObjectPool.h" - -namespace opengl { - - - PoolObject::PoolObject() : - m_inUse(false), m_poolId(0), m_objectId(0) { - } - - bool PoolObject::isInUse() - { - return m_inUse; - } - - void PoolObject::setInUse(bool _inUse) - { - m_inUse = _inUse; - } - - int PoolObject::getPoolId() - { - return m_poolId; - } - - void PoolObject::setPoolId(int _poolId) - { - m_poolId = _poolId; - } - - int PoolObject::getObjectId() - { - return m_objectId; - } - - void PoolObject::setObjectId(int _objectId) - { - m_objectId = _objectId; - } - - OpenGlCommandPool &OpenGlCommandPool::get() - { - static OpenGlCommandPool commandPool; - return commandPool; - } - - int OpenGlCommandPool::getNextAvailablePool() - { - m_objectPool.push_back(std::vector>()); - m_objectPoolIndex.push_back(0); - return static_cast(m_objectPool.size() - 1); - } - - std::shared_ptr OpenGlCommandPool::getAvailableObject(int _poolId) - { - auto ¤tPool = m_objectPool[_poolId]; - auto ¤tIndex = m_objectPoolIndex[_poolId]; - - if (currentPool.empty()) { - return nullptr; - } else if (!currentPool[currentIndex]->isInUse()) { - int objectId = currentIndex; - ++currentIndex; - - if (currentIndex == currentPool.size()) { - currentIndex = 0; - } - - return currentPool[objectId]; - - } else { - bool found = false; - unsigned int index; - //Not found in most common case, so go ahead and search - for (index = currentIndex; index < currentPool.size() && !found; ++index) { - found = !currentPool[index]->isInUse(); - } - - if (!found) { - for (index = 0; index < currentIndex && !found; ++index) { - found = !currentPool[index]->isInUse(); - } - } - - if (found) { - currentIndex = index; - - if (currentIndex == currentPool.size()) { - currentIndex = 0; - } - --index; - - return currentPool[index]; - } else { - currentIndex = 0; - return nullptr; - } - } - } - - void OpenGlCommandPool::addObjectToPool(int _poolId, std::shared_ptr _object) - { - _object->setPoolId(_poolId); - _object->setObjectId(static_cast(m_objectPool[_poolId].size())); - m_objectPool[_poolId].push_back(_object); - } -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.h deleted file mode 100644 index 9ab93d8..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include - - -namespace opengl { - - class PoolObject { - public: - - PoolObject(); - - bool isInUse(); - void setInUse(bool _inUse); - - int getPoolId(); - - void setPoolId(int _poolId); - - int getObjectId(); - - void setObjectId(int _objectId); - private: - - bool m_inUse; - int m_poolId; - int m_objectId; - }; - - class OpenGlCommandPool - { - public: - static OpenGlCommandPool& get(); - - int getNextAvailablePool(); - - std::shared_ptr getAvailableObject(int _poolId); - - void addObjectToPool(int _poolId, std::shared_ptr _object); - - private: - std::vector>> m_objectPool; - std::vector m_objectPoolIndex; - }; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.cpp b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.cpp deleted file mode 100644 index de8b194..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "opengl_WrappedFunctions.h" - -namespace opengl { - - std::vector GlDrawArraysUnbufferedCommand::m_attribsData(2 * 1024 * 1024, 0); - std::vector GlDrawElementsUnbufferedCommand::m_attribsData(2 * 1024 * 1024, 0); - GLenum GlMapBufferRangeWriteAsyncCommand::m_targetTemp; - GLintptr GlMapBufferRangeWriteAsyncCommand::m_offsetTemp; - GLsizeiptr GlMapBufferRangeWriteAsyncCommand::m_lengthTemp; - GLbitfield GlMapBufferRangeWriteAsyncCommand::m_accessTemp; - std::unordered_map>> GlMapBufferRangeWriteAsyncCommand::m_TempData; - std::unordered_map>> GlMapBufferRangeReadAsyncCommand::m_data; - std::mutex GlMapBufferRangeReadAsyncCommand::m_mapMutex; - std::unordered_map GlVertexAttribPointerManager::m_vertexAttributePointers; - const void* GlVertexAttribPointerManager::smallestDataPtr = nullptr; - std::unordered_map GlVertexAttribPointerManager::m_vertexAttributePointersRender; - const void* GlVertexAttribPointerManager::smallestDataPtrRender = nullptr; - std::unordered_map GlBindBufferCommand::m_boundBuffersRender; - std::unordered_map GlBindBufferCommand::m_boundBuffers; - GLuint GlReadPixelsAsyncCommand::m_readPixelsBoundBuffer = 0; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.h deleted file mode 100644 index 588e6a3..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.h +++ /dev/null @@ -1,5333 +0,0 @@ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "cppcoreguidelines-pro-type-member-init" -#endif -#pragma once - -#include -#include -#include -#include -#include -#include -#include "BlockingQueue.h" -#include "Graphics/OpenGLContext/GLFunctions.h" -#include "Graphics/OpenGLContext/opengl_Attributes.h" -#include -#include -#include -#include "opengl_Command.h" -#include "RingBufferPool.h" - -#ifdef MUPENPLUSAPI -#include -#else -#include -#endif - -namespace opengl { - -class GlBlendFuncCommand : public OpenGlCommand -{ -public: - GlBlendFuncCommand() : - OpenGlCommand(false, false, "glBlendFunc") - { - } - - static std::shared_ptr get(GLenum sfactor, GLenum dfactor) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(sfactor, dfactor); - return ptr; - } - - void commandToExecute() override - { - ptrBlendFunc(m_sfactor, m_dfactor); - } -private: - void set(GLenum sfactor, GLenum dfactor) - { - m_sfactor = sfactor; - m_dfactor = dfactor; - } - - GLenum m_sfactor; - GLenum m_dfactor; -}; - -class GlBlendFuncSeparateCommand : public OpenGlCommand -{ -public: - GlBlendFuncSeparateCommand() : - OpenGlCommand(false, false, "glBlendFuncSeparate") - { - } - - static std::shared_ptr get(GLenum sfactorcolor, GLenum dfactorcolor, GLenum sfactoralpha, GLenum dfactoralpha) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(sfactorcolor, dfactorcolor, sfactoralpha, dfactoralpha); - return ptr; - } - - void commandToExecute() override - { - ptrBlendFuncSeparate(m_sfactorcolor, m_dfactorcolor, m_sfactoralpha, m_dfactoralpha); - } -private: - void set(GLenum sfactorcolor, GLenum dfactorcolor, GLenum sfactoralpha, GLenum dfactoralpha) - { - m_sfactorcolor = sfactorcolor; - m_dfactorcolor = dfactorcolor; - m_sfactoralpha = sfactoralpha; - m_dfactoralpha = dfactoralpha; - } - - GLenum m_sfactorcolor; - GLenum m_dfactorcolor; - GLenum m_sfactoralpha; - GLenum m_dfactoralpha; -}; - - -class GlPixelStoreiCommand : public OpenGlCommand -{ -public: - GlPixelStoreiCommand() : - OpenGlCommand(false, false, "glPixelStorei") - { - } - - static std::shared_ptr get(GLenum pname, GLint param) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(pname, param); - return ptr; - } - - void commandToExecute() override - { - ptrPixelStorei(m_pname, m_param); - } - -private: - void set(GLenum pname, GLint param) - { - m_pname = pname; - m_param = param; - } - - GLenum m_pname; - GLint m_param; -}; - -class GlClearColorCommand : public OpenGlCommand -{ -public: - GlClearColorCommand() : - OpenGlCommand(false, false, "glClearColor") - { - - } - - static std::shared_ptr get(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(red, green, blue, alpha); - return ptr; - } - - void commandToExecute() override - { - ptrClearColor(m_red, m_green, m_blue, m_alpha); - } -private: - void set(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - m_red = red; - m_green = green; - m_blue = blue; - m_alpha = alpha; - } - - GLfloat m_red; - GLfloat m_green; - GLfloat m_blue; - GLfloat m_alpha; -}; - -class GlCullFaceCommand : public OpenGlCommand -{ -public: - GlCullFaceCommand() : - OpenGlCommand(false, false, "glCullFace") - { - } - - static std::shared_ptr get(GLenum mode) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(mode); - return ptr; - } - - void commandToExecute() override - { - ptrCullFace(m_mode); - } - -private: - void set(GLenum mode) - { - m_mode = mode; - } - - GLenum m_mode; -}; - -class GlDepthFuncCommand : public OpenGlCommand -{ -public: - GlDepthFuncCommand() : - OpenGlCommand(false, false, "glDepthFunc") - { - } - - static std::shared_ptr get(GLenum func) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(func); - return ptr; - } - - void commandToExecute() override - { - ptrDepthFunc(m_func); - } - -private: - void set(GLenum func) - { - m_func = func; - } - - GLenum m_func; -}; - -class GlDepthMaskCommand : public OpenGlCommand -{ -public: - GlDepthMaskCommand() : - OpenGlCommand(false, false, "glDepthMask") - { - - } - - static std::shared_ptr get(GLboolean flag) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(flag); - return ptr; - } - - void commandToExecute() override - { - ptrDepthMask(m_flag); - } - -private: - void set(GLboolean flag) - { - m_flag = flag; - } - - GLboolean m_flag; -}; - -class GlDisableCommand : public OpenGlCommand -{ -public: - GlDisableCommand() : - OpenGlCommand(false, false, "glDisable") - { - } - - static std::shared_ptr get(GLenum cap) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(cap); - return ptr; - } - - void commandToExecute() override - { - ptrDisable(m_cap); - } - -private: - void set(GLenum cap) - { - m_cap = cap; - } - - GLenum m_cap; -}; - -class GlEnableCommand : public OpenGlCommand -{ -public: - GlEnableCommand() : - OpenGlCommand(false, false, "glEnable") - { - } - - static std::shared_ptr get(GLenum cap) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(cap); - return ptr; - } - - void commandToExecute() override - { - ptrEnable(m_cap); - } - -private: - void set(GLenum cap) - { - m_cap = cap; - } - - GLenum m_cap; -}; - -class GlDisableiCommand : public OpenGlCommand -{ -public: - GlDisableiCommand() : - OpenGlCommand(false, false, "glDisablei") - { - } - - static std::shared_ptr get(GLenum target, GLuint index) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, index); - return ptr; - } - - void commandToExecute() override - { - ptrDisablei(m_target, m_index); - } - -private: - void set(GLenum target, GLuint index) - { - m_target = target; - m_index = index; - } - - GLenum m_target; - GLuint m_index; -}; - -class GlEnableiCommand : public OpenGlCommand -{ -public: - GlEnableiCommand() : - OpenGlCommand(false, false, "glEnablei") - { - } - - static std::shared_ptr get(GLenum target, GLuint index) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, index); - return ptr; - } - - void commandToExecute() override - { - ptrEnablei(m_target, m_index); - } - -private: - void set(GLenum target, GLuint index) - { - m_target = target; - m_index = index; - } - - GLenum m_target; - GLuint m_index; -}; - -class GlPolygonOffsetCommand : public OpenGlCommand -{ -public: - GlPolygonOffsetCommand() : - OpenGlCommand(false, false, "glPolygonOffset") - { - } - - static std::shared_ptr get(GLfloat factor, GLfloat units) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(factor, units); - return ptr; - } - - void commandToExecute() override - { - ptrPolygonOffset(m_factor, m_units); - } - -private: - void set(GLfloat factor, GLfloat units) - { - m_factor = factor; - m_units = units; - } - - GLfloat m_factor; - GLfloat m_units; -}; - -class GlScissorCommand : public OpenGlCommand -{ -public: - GlScissorCommand() : - OpenGlCommand(false, false, "glScissor") - { - } - - static std::shared_ptr get(GLint x, GLint y, GLsizei width, GLsizei height) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(x, y, width, height); - return ptr; - } - - void commandToExecute() override - { - ptrScissor(m_x, m_y, m_width, m_height); - } - -private: - void set(GLint x, GLint y, GLsizei width, GLsizei height) - { - m_x = x; - m_y = y; - m_width = width; - m_height = height; - } - - GLint m_x; - GLint m_y; - GLsizei m_width; - GLsizei m_height; -}; - -class GlViewportCommand : public OpenGlCommand -{ -public: - GlViewportCommand() : - OpenGlCommand(false, false, "glViewport") - { - } - - static std::shared_ptr get(GLint x, GLint y, GLsizei width, GLsizei height) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(x, y, width, height); - return ptr; - } - - void commandToExecute() override - { - ptrViewport(m_x, m_y, m_width, m_height); - } - -private: - void set(GLint x, GLint y, GLsizei width, GLsizei height) - { - m_x = x; - m_y = y; - m_width = width; - m_height = height; - } - - GLint m_x; - GLint m_y; - GLsizei m_width; - GLsizei m_height; -}; - -class GlBindTextureCommand : public OpenGlCommand -{ -public: - GlBindTextureCommand() : - OpenGlCommand(false, false, "glBindTexture") - { - } - - static std::shared_ptr get(GLenum target, GLuint texture) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, texture); - return ptr; - } - - void commandToExecute() override - { - ptrBindTexture(m_target, m_texture); - } - -private: - void set(GLenum target, GLuint texture) - { - m_target = target; - m_texture = texture; - } - - GLenum m_target; - GLuint m_texture; -}; - -class GlTexImage2DCommand : public OpenGlCommand -{ -public: - GlTexImage2DCommand() : - OpenGlCommand(false, false, "glTexImage2D") - { - } - - static std::shared_ptr get(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, const PoolBufferPointer& pixels) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, level, internalformat, width, height, border, format, type, pixels); - return ptr; - } - - void commandToExecute() override - { - ptrTexImage2D(m_target, m_level, m_internalformat, m_width, m_height, m_border, m_format, m_type, - OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_pixels)); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_pixels); - } - -private: - void set(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, const PoolBufferPointer& pixels) - { - m_target = target; - m_level = level; - m_internalformat = internalformat; - m_width = width; - m_height = height; - m_border = border; - m_format = format; - m_type = type; - m_pixels = pixels; - } - - GLenum m_target; - GLint m_level; - GLint m_internalformat; - GLsizei m_width; - GLsizei m_height; - GLint m_border; - GLenum m_format; - GLenum m_type; - PoolBufferPointer m_pixels; -}; - -class GlTexParameteriCommand : public OpenGlCommand -{ -public: - GlTexParameteriCommand() : - OpenGlCommand(false, false, "glTexParameteri") - { - } - - static std::shared_ptr get(GLenum target, GLenum pname, GLint param) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, pname, param); - return ptr; - } - - void commandToExecute() override - { - ptrTexParameteri(m_target, m_pname, m_param); - } - -private: - void set(GLenum target, GLenum pname, GLint param) - { - m_target = target; - m_pname = pname; - m_param = param; - } - - GLenum m_target; - GLenum m_pname; - GLint m_param; -}; - -class GlGetIntegervCommand : public OpenGlCommand -{ -public: - GlGetIntegervCommand() : - OpenGlCommand(true, false, "glGetIntegerv") - { - } - - static std::shared_ptr get(GLenum pname, GLint* data) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(pname, data); - return ptr; - } - - void commandToExecute() override - { - ptrGetIntegerv(m_pname, m_data); - } - -private: - void set(GLenum pname, GLint* data) - { - m_pname = pname; - m_data = data; - } - - GLenum m_pname; - GLint* m_data; -}; - -class GlGetStringCommand : public OpenGlCommand -{ -public: - GlGetStringCommand() : - OpenGlCommand(true, false, "glGetString") - { - } - - static std::shared_ptr get(GLenum name, const GLubyte*& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(name, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrGetString(m_name); - } - -private: - void set(GLenum name, const GLubyte*& returnValue) - { - m_name = name; - m_returnValue = &returnValue; - } - - GLenum m_name; - const GLubyte** m_returnValue; -}; - -class GlReadPixelsCommand : public OpenGlCommand -{ -public: - GlReadPixelsCommand() : - OpenGlCommand(true, true, "glReadPixels") - { - } - - static std::shared_ptr get(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(x, y, width, height, format, type, pixels); - return ptr; - } - - void commandToExecute() override - { - ptrReadPixels(m_x, m_y, m_width, m_height, m_format, m_type, m_pixels); - } - -private: - void set(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) - { - m_x = x; - m_y = y; - m_width = width; - m_height = height; - m_format = format; - m_type = type; - m_pixels = pixels; - } - - GLint m_x; - GLint m_y; - GLsizei m_width; - GLsizei m_height; - GLenum m_format; - GLenum m_type; - void* m_pixels; -}; - -class GlReadPixelsAsyncCommand : public OpenGlCommand -{ -public: - GlReadPixelsAsyncCommand() : - OpenGlCommand(false, false, "GlReadPixelsAync") - { - } - - static std::shared_ptr get(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(x, y, width, height, format, type); - return ptr; - } - - void commandToExecute() override - { - ptrReadPixels(m_x, m_y, m_width, m_height, m_format, m_type, nullptr); - } - - static GLuint getBoundBuffer() - { - return m_readPixelsBoundBuffer; - } - - static void setBoundBuffer(GLuint buffer) - { - m_readPixelsBoundBuffer = buffer; - } - -private: - void set(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) - { - m_x = x; - m_y = y; - m_width = width; - m_height = height; - m_format = format; - m_type = type; - } - - GLint m_x; - GLint m_y; - GLsizei m_width; - GLsizei m_height; - GLenum m_format; - GLenum m_type; - static GLuint m_readPixelsBoundBuffer; -}; - -class GlTexSubImage2DUnbufferedCommand : public OpenGlCommand -{ -public: - GlTexSubImage2DUnbufferedCommand() : - OpenGlCommand(false, false, "glTexSubImage2D") - { - } - - static std::shared_ptr get(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, const PoolBufferPointer& pixels) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, level, xoffset, yoffset, width, height, format, type, pixels); - return ptr; - } - - void commandToExecute() override - { - ptrTexSubImage2D(m_target, m_level, m_xoffset, m_yoffset, m_width, m_height, m_format, m_type, - OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_pixels)); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_pixels); - } - -private: - void set(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, const PoolBufferPointer& pixels) - { - m_target = target; - m_level = level; - m_xoffset = xoffset; - m_yoffset = yoffset; - m_width = width; - m_height = height; - m_format = format; - m_type = type; - m_pixels = pixels; - } - - GLenum m_target; - GLint m_level; - GLint m_xoffset; - GLint m_yoffset; - GLsizei m_width; - GLsizei m_height; - GLenum m_format; - GLenum m_type; - PoolBufferPointer m_pixels; -}; - -class GlDrawArraysCommand : public OpenGlCommand -{ -public: - GlDrawArraysCommand() : - OpenGlCommand(false, false, "glDrawArrays") - { - } - - static std::shared_ptr get(GLenum mode, GLint first, GLsizei count) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(mode, first, count); - return ptr; - } - - void commandToExecute() override - { - ptrDrawArrays(m_mode, m_first, m_count); - } - -private: - void set(GLenum mode, GLint first, GLsizei count) - { - m_mode = mode; - m_first = first; - m_count = count; - } - - GLenum m_mode; - GLint m_first; - GLsizei m_count; -}; - -class GlVertexAttribPointerManager -{ -public: - struct VertexAttributeData - { - GLuint m_index; - GLint m_size; - GLenum m_type; - GLboolean m_normalized; - GLsizei m_stride; - const void* m_pointer; - bool m_enabled; - bool m_updated = false; - }; - - static void enableVertexAttributeIndexRender(unsigned int index) - { - VertexAttributeData& attributeData = m_vertexAttributePointersRender[index]; - attributeData.m_enabled = true; - - updatedSmallestPtrRender(); - } - - static void disableVertexAttributeIndexRender(unsigned int index) - { - VertexAttributeData& attributeData = m_vertexAttributePointersRender[index]; - attributeData.m_enabled = false; - - updatedSmallestPtrRender(); - } - - static std::unordered_map& getVertexAttributesRender() - { - return m_vertexAttributePointersRender; - } - - static void updateRender(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) - { - VertexAttributeData &vertexAttributeData = m_vertexAttributePointersRender[index]; - vertexAttributeData.m_index = index; - vertexAttributeData.m_size = size; - vertexAttributeData.m_type = type; - vertexAttributeData.m_normalized = normalized; - vertexAttributeData.m_stride = stride; - vertexAttributeData.m_pointer = pointer; - vertexAttributeData.m_updated = true; - - updatedSmallestPtrRender(); - } - - static const char* getSmallestPtrRender() { - return reinterpret_cast(smallestDataPtrRender); - } - - static void enableVertexAttributeIndex(unsigned int index) - { - VertexAttributeData& attributeData = m_vertexAttributePointers[index]; - attributeData.m_enabled = true; - - updatedSmallestPtr(); - } - - static void disableVertexAttributeIndex(int index) - { - VertexAttributeData& attributeData = m_vertexAttributePointers[index]; - attributeData.m_enabled = false; - - updatedSmallestPtr(); - } - - static int getStride() - { - int stride = 0; - for (auto& data : m_vertexAttributePointers) { - if (data.second.m_pointer && data.second.m_enabled) { - stride = data.second.m_stride; - break; - } - } - - return stride; - } - - static void update(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) - { - VertexAttributeData &vertexAttributeData = m_vertexAttributePointers[index]; - vertexAttributeData.m_index = index; - vertexAttributeData.m_size = size; - vertexAttributeData.m_type = type; - vertexAttributeData.m_normalized = normalized; - vertexAttributeData.m_stride = stride; - vertexAttributeData.m_pointer = pointer; - - updatedSmallestPtr(); - } - - static const char* getSmallestPtr() { - return reinterpret_cast(smallestDataPtr); - } - -private: - static void updatedSmallestPtrRender() - { - smallestDataPtrRender = nullptr; - - for (auto& data : m_vertexAttributePointersRender) { - if (data.second.m_pointer && data.second.m_enabled && (smallestDataPtrRender == nullptr || data.second.m_pointer < smallestDataPtrRender)) { - smallestDataPtrRender = data.second.m_pointer; - } - } - } - - static void updatedSmallestPtr() - { - smallestDataPtr = nullptr; - - for (auto& data : m_vertexAttributePointers) { - if (data.second.m_pointer && data.second.m_enabled && (smallestDataPtr == nullptr || data.second.m_pointer < smallestDataPtr)) { - smallestDataPtr = data.second.m_pointer; - } - } - } - - static std::unordered_map m_vertexAttributePointersRender; - static const void* smallestDataPtrRender; - - static std::unordered_map m_vertexAttributePointers; - static const void* smallestDataPtr; -}; - -class GlVertexAttribPointerUnbufferedCommand : public OpenGlCommand -{ -public: - GlVertexAttribPointerUnbufferedCommand() : - OpenGlCommand(false, false, "glVertexAttribPointer") - { - } - - static std::shared_ptr get(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index, size, type, normalized, stride, pointer); - return ptr; - } - - void commandToExecute() override - { - GlVertexAttribPointerManager::updateRender(m_index, m_size, m_type, m_normalized, m_stride, m_pointer); - } - -private: - void set(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) - { - m_index = index; - m_size = size; - m_type = type; - m_normalized = normalized; - m_stride = stride; - m_pointer = pointer; - } - - GLuint m_index; - GLint m_size; - GLenum m_type; - GLboolean m_normalized; - GLsizei m_stride; - const void* m_pointer; -}; - -class GlDrawArraysUnbufferedCommand : public OpenGlCommand -{ -public: - GlDrawArraysUnbufferedCommand() : - OpenGlCommand(false, false, "glDrawArraysUnbuffered") - { - } - - static std::shared_ptr get(GLenum mode, GLint first, GLsizei count, const PoolBufferPointer& data) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(mode, first, count, data); - return ptr; - } - - void commandToExecute() override - { - auto& vertexAttributes = GlVertexAttribPointerManager::getVertexAttributesRender(); - - for (auto& data : vertexAttributes) { - if (data.second.m_updated && data.second.m_enabled) { - - auto ptrOffset = static_cast(reinterpret_cast(data.second.m_pointer) - - GlVertexAttribPointerManager::getSmallestPtrRender()); - ptrVertexAttribPointer(data.second.m_index, data.second.m_size, data.second.m_type, data.second.m_normalized, - data.second.m_stride, reinterpret_cast(m_attribsData.data() + ptrOffset)); - data.second.m_updated = false; - } - } - - const char* data = OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_data); - std::copy_n(data, m_data.getSize(), m_attribsData.begin()); - ptrDrawArrays(m_mode, m_first, m_count); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_data); - } - -private: - void set(GLenum mode, GLint first, GLsizei count, const PoolBufferPointer& data) - { - m_mode = mode; - m_first = first; - m_count = count; - m_data = data; - } - - GLenum m_mode; - GLint m_first; - GLsizei m_count; - PoolBufferPointer m_data; - static std::vector m_attribsData; -}; - -class GlGetErrorCommand : public OpenGlCommand -{ -public: - GlGetErrorCommand() : - OpenGlCommand(true, true, "glGetError") - { - } - - static std::shared_ptr get(GLenum& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrGetError(); - } - -private: - void set(GLenum& returnValue) - { - m_returnValue = &returnValue; - } - - GLenum* m_returnValue; -}; - -class GlDrawElementsUnbufferedCommand : public OpenGlCommand -{ -public: - GlDrawElementsUnbufferedCommand() : - OpenGlCommand(false, false, "glDrawElementsUnbuffered") - { - } - - static std::shared_ptr get(GLenum mode, GLsizei count, GLenum type, const PoolBufferPointer& indices, - const PoolBufferPointer& data) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(mode, count, type, indices, data); - return ptr; - } - - void commandToExecute() override - { - auto& vertexAttributes = GlVertexAttribPointerManager::getVertexAttributesRender(); - - for (auto& data : vertexAttributes) { - if (data.second.m_updated && data.second.m_enabled) { - auto ptrOffset = static_cast(reinterpret_cast(data.second.m_pointer) - - GlVertexAttribPointerManager::getSmallestPtrRender()); - ptrVertexAttribPointer(data.second.m_index, data.second.m_size, data.second.m_type, data.second.m_normalized, - data.second.m_stride, reinterpret_cast(m_attribsData.data() + ptrOffset)); - data.second.m_updated = false; - } - } - - const char* data = OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_data); - std::copy_n(data, m_data.getSize(), m_attribsData.begin()); - ptrDrawElements(m_mode, m_count, m_type, OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_indices)); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_data); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_indices); - } - -private: - void set(GLenum mode, GLsizei count, GLenum type, const PoolBufferPointer& indices, - const PoolBufferPointer& data) - { - m_mode = mode; - m_count = count; - m_type = type; - m_indices = indices; - m_data = data; - } - - GLenum m_mode; - GLsizei m_count; - GLenum m_type; - PoolBufferPointer m_indices; - PoolBufferPointer m_data; - static std::vector m_attribsData; -}; - -class GlLineWidthCommand : public OpenGlCommand -{ -public: - GlLineWidthCommand() : - OpenGlCommand(false, false, "glLineWidth") - { - } - - static std::shared_ptr get(GLfloat width) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(width); - return ptr; - } - - void commandToExecute() override - { - ptrLineWidth(m_width); - } - -private: - void set(GLfloat width) - { - m_width = width; - } - - GLfloat m_width; -}; - -class GlClearCommand : public OpenGlCommand -{ -public: - GlClearCommand() : - OpenGlCommand(false, false, "glClear") - { - } - - static std::shared_ptr get(GLbitfield mask) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(mask); - return ptr; - } - - void commandToExecute() override - { - ptrClear(m_mask); - } - -private: - void set(GLbitfield mask) - { - m_mask = mask; - } - - GLbitfield m_mask; -}; - -class GlClearBufferfvCommand : public OpenGlCommand -{ -public: - GlClearBufferfvCommand() : - OpenGlCommand(false, false, "glClearBufferfv") - { - } - - static std::shared_ptr get(GLenum buffer, GLint drawbuffer, const PoolBufferPointer& value) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(buffer, drawbuffer, value); - return ptr; - } - - void commandToExecute() override - { - ptrClearBufferfv(m_buffer, m_drawbuffer, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_value))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_value); - } - -private: - void set(GLenum buffer, GLint drawbuffer, const PoolBufferPointer& value) - { - m_buffer = buffer; - m_drawbuffer = drawbuffer; - m_value = value; - } - - GLenum m_buffer; - GLint m_drawbuffer; - PoolBufferPointer m_value; -}; - -class GlGetFloatvCommand : public OpenGlCommand -{ -public: - GlGetFloatvCommand() : - OpenGlCommand(true, false, "glGetFloatv") - { - } - - static std::shared_ptr get(GLenum pname, GLfloat* data) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(pname, data); - return ptr; - } - - void commandToExecute() override - { - ptrGetFloatv(m_pname, m_data); - } - -private: - void set(GLenum pname, GLfloat* data) - { - m_pname = pname; - m_data = data; - } - - GLenum m_pname; - GLfloat* m_data; -}; - -class GlDeleteTexturesCommand : public OpenGlCommand -{ -public: - GlDeleteTexturesCommand() : - OpenGlCommand(false, false, "glDeleteTextures") - { - } - - static std::shared_ptr get(GLsizei n, const PoolBufferPointer& textures) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, textures); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteTextures(m_n, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_textures))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_textures); - } - -private: - void set(GLsizei n, const PoolBufferPointer& textures) - { - m_n = n; - m_textures = textures; - } - - GLsizei m_n; - PoolBufferPointer m_textures; -}; - -class GlGenTexturesCommand : public OpenGlCommand -{ -public: - GlGenTexturesCommand() : - OpenGlCommand(true, false, "glGenTextures") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* textures) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, textures); - return ptr; - } - - void commandToExecute() override - { - ptrGenTextures(m_n, m_textures); - } - -private: - void set(GLsizei n, GLuint* textures) - { - m_n = n; - m_textures = textures; - } - - GLsizei m_n; - GLuint* m_textures; -}; - -class GlTexParameterfCommand : public OpenGlCommand -{ -public: - GlTexParameterfCommand() : - OpenGlCommand(false, false, "glTexParameterf") - { - } - - static std::shared_ptr get(GLenum target, GLenum pname, GLfloat param) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, pname, param); - return ptr; - } - - void commandToExecute() override - { - ptrTexParameterf(m_target, m_pname, m_param); - } - -private: - void set(GLenum target, GLenum pname, GLfloat param) - { - m_target = target; - m_pname = pname; - m_param = param; - } - - GLenum m_target; - GLenum m_pname; - GLfloat m_param; -}; - -class GlActiveTextureCommand : public OpenGlCommand -{ -public: - GlActiveTextureCommand() : - OpenGlCommand(false, false, "glActiveTexture") - { - } - - static std::shared_ptr get(GLenum texture) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(texture); - return ptr; - } - - void commandToExecute() override - { - ptrActiveTexture(m_texture); - } - -private: - void set(GLenum texture) - { - m_texture = texture; - } - - GLenum m_texture; -}; - -class GlBlendColorCommand : public OpenGlCommand -{ -public: - GlBlendColorCommand() : - OpenGlCommand(false, false, "glBlendColor") - { - } - - static std::shared_ptr get(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(red, green, blue, alpha); - return ptr; - } - - void commandToExecute() override - { - ptrBlendColor(m_red, m_green, m_blue, m_alpha); - } - -private: - void set(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - m_red = red; - m_green = green; - m_blue = blue; - m_alpha = alpha; - } - - GLfloat m_red; - GLfloat m_green; - GLfloat m_blue; - GLfloat m_alpha; -}; - -class GlReadBufferCommand : public OpenGlCommand -{ -public: - GlReadBufferCommand() : - OpenGlCommand(false, false, "glReadBuffer") - { - } - - static std::shared_ptr get(GLenum src) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(src); - return ptr; - } - - void commandToExecute() override - { - ptrReadBuffer(m_src); - } - -private: - void set(GLenum src) - { - m_src = src; - } - - GLenum m_src; -}; - -class GlCreateShaderCommand : public OpenGlCommand -{ -public: - GlCreateShaderCommand() : - OpenGlCommand(true, true, "glCreateShader") - { - } - - static std::shared_ptr get(GLenum type, GLuint& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(type, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrCreateShader(m_type); - } - -private: - void set(GLenum type, GLuint& returnValue) - { - m_type = type; - m_returnValue = &returnValue; - } - - GLenum m_type; - GLuint* m_returnValue; -}; - -class GlCompileShaderCommand : public OpenGlCommand -{ -public: - GlCompileShaderCommand() : - OpenGlCommand(false, false, "glCompileShader") - { - } - - static std::shared_ptr get(GLuint shader) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(shader); - return ptr; - } - - void commandToExecute() override - { - ptrCompileShader(m_shader); - } - -private: - void set(GLuint shader) - { - m_shader = shader; - } - - GLuint m_shader; -}; - -class GlShaderSourceCommand : public OpenGlCommand -{ -public: - GlShaderSourceCommand() : - OpenGlCommand(false, false, "glShaderSource") - { - } - - static std::shared_ptr get(GLuint shader, std::vector& strings) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(shader, strings); - return ptr; - } - - void commandToExecute() override - { - const GLchar **stringData = new const GLchar*[m_strings.size()]; - for (unsigned int index = 0; index < m_strings.size(); ++index) { - stringData[index] = m_strings[index].data(); - } - - ptrShaderSource(m_shader, static_cast(m_strings.size()), stringData, nullptr); - } - -private: - void set(GLuint shader, std::vector& strings) - { - m_shader = shader; - m_strings = std::move(strings); - } - - GLuint m_shader; - std::vector m_strings; -}; - -class GlCreateProgramCommand : public OpenGlCommand -{ -public: - GlCreateProgramCommand() : - OpenGlCommand(true, true, "glCreateProgram") - { - } - - static std::shared_ptr get(GLuint& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrCreateProgram(); - } - -private: - void set(GLuint& returnValue) - { - m_returnValue = &returnValue; - } - - GLuint* m_returnValue; -}; - -class GlAttachShaderCommand : public OpenGlCommand -{ -public: - GlAttachShaderCommand() : - OpenGlCommand(false, false, "glAttachShader") - { - } - - static std::shared_ptr get(GLuint program, GLuint shader) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, shader); - return ptr; - } - - void commandToExecute() override - { - ptrAttachShader(m_program, m_shader); - } - -private: - void set(GLuint program, GLuint shader) - { - m_program = program; - m_shader = shader; - } - - GLuint m_program; - GLuint m_shader; -}; - -class GlLinkProgramCommand : public OpenGlCommand -{ -public: - GlLinkProgramCommand() : - OpenGlCommand(false, false, "glLinkProgram") - { - } - - static std::shared_ptr get(GLuint program) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program); - return ptr; - } - - void commandToExecute() override - { - ptrLinkProgram(m_program); - } - -private: - void set(GLuint program) - { - m_program = program; - } - - GLuint m_program; -}; - -class GlUseProgramCommand : public OpenGlCommand -{ -public: - GlUseProgramCommand() : - OpenGlCommand(false, false, "glUseProgram") - { - } - - static std::shared_ptr get(GLuint program) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program); - return ptr; - } - - void commandToExecute() override - { - ptrUseProgram(m_program); - } - -private: - void set(GLuint program) - { - m_program = program; - } - - GLuint m_program; -}; - -class GlGetUniformLocationCommand : public OpenGlCommand -{ -public: - GlGetUniformLocationCommand() : - OpenGlCommand(true, true, "glGetUniformLocation") - { - } - - static std::shared_ptr get(GLuint program, const GLchar* name, GLint& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, name, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrGetUniformLocation(m_program, m_name); - } - -private: - void set(GLuint program, const GLchar* name, GLint& returnValue) - { - m_program = program; - m_name = name; - m_returnValue = &returnValue; - } - - GLint* m_returnValue; - GLuint m_program; - const GLchar* m_name; -}; - -class GlUniform1iCommand : public OpenGlCommand -{ -public: - GlUniform1iCommand() : - OpenGlCommand(false, false, "glUniform1i") - { - } - - static std::shared_ptr get(GLint location, GLint v0) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, v0); - return ptr; - } - - void commandToExecute() override - { - ptrUniform1i(m_location, m_v0); - } - -private: - void set(GLint location, GLint v0) - { - m_location = location; - m_v0 = v0; - } - - GLint m_location; - GLint m_v0; -}; - -class GlUniform1fCommand : public OpenGlCommand -{ -public: - GlUniform1fCommand() : - OpenGlCommand(false, false, "glUniform1f") - { - } - - static std::shared_ptr get(GLint location, GLfloat v0) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, v0); - return ptr; - } - - void commandToExecute() override - { - ptrUniform1f(m_location, m_v0); - } - -private: - void set(GLint location, GLfloat v0) - { - m_location = location; - m_v0 = v0; - } - - GLint m_location; - GLfloat m_v0; -}; - -class GlUniform2fCommand : public OpenGlCommand -{ -public: - GlUniform2fCommand() : - OpenGlCommand(false, false, "glUniform2f") - { - } - - static std::shared_ptr get(GLint location, GLfloat v0, GLfloat v1) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, v0, v1); - return ptr; - } - - void commandToExecute() override - { - ptrUniform2f(m_location, m_v0, m_v1); - } - -private: - void set(GLint location, GLfloat v0, GLfloat v1) - { - m_location = location; - m_v0 = v0; - m_v1 = v1; - } - - GLint m_location; - GLfloat m_v0; - GLfloat m_v1; -}; - -class GlUniform2iCommand : public OpenGlCommand -{ - -public: - GlUniform2iCommand() : - OpenGlCommand(false, false, "glUniform2i") - { - } - - static std::shared_ptr get(GLint location, GLint v0, GLint v1) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, v0, v1); - return ptr; - } - - void commandToExecute() override - { - ptrUniform2i(m_location, m_v0, m_v1); - } - -private: - void set(GLint location, GLint v0, GLint v1) - { - m_location = location; - m_v0 = v0; - m_v1 = v1; - } - - GLint m_location; - GLint m_v0; - GLint m_v1; -}; - -class GlUniform4iCommand : public OpenGlCommand -{ -public: - GlUniform4iCommand() : - OpenGlCommand(false, false, "glUniform4i") - { - } - - static std::shared_ptr get(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, v0, v1, v2, v3); - return ptr; - } - - void commandToExecute() override - { - ptrUniform4i(m_location, m_v0, m_v1, m_v2, m_v3); - } - -private: - void set(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) - { - m_location = location; - m_v0 = v0; - m_v1 = v1; - m_v2 = v2; - m_v3 = v3; - } - - GLint m_location; - GLint m_v0; - GLint m_v1; - GLint m_v2; - GLint m_v3; -}; - -class GlUniform4fCommand : public OpenGlCommand -{ -public: - GlUniform4fCommand() : - OpenGlCommand(false, false, "glUniform4f") - { - } - - static std::shared_ptr get(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, v0, v1, v2, v3); - return ptr; - } - - void commandToExecute() override - { - ptrUniform4f(m_location, m_v0, m_v1, m_v2, m_v3); - } - -private: - void set(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) - { - m_location = location; - m_v0 = v0; - m_v1 = v1; - m_v2 = v2; - m_v3 = v3; - } - - GLint m_location; - GLfloat m_v0; - GLfloat m_v1; - GLfloat m_v2; - GLfloat m_v3; -}; - -class GlUniform3fvCommand : public OpenGlCommand -{ -public: - GlUniform3fvCommand() : - OpenGlCommand(false, false, "glUniform3fv") - { - } - - static std::shared_ptr get(GLint location, GLsizei count, const PoolBufferPointer& value) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, count, value); - return ptr; - } - - void commandToExecute() override - { - ptrUniform3fv(m_location, m_count, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_value))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_value); - } - -private: - void set(GLint location, GLsizei count, const PoolBufferPointer& value) - { - m_location = location; - m_count = count; - m_value = value; - } - - GLint m_location; - GLsizei m_count; - PoolBufferPointer m_value; -}; - -class GlUniform4fvCommand : public OpenGlCommand -{ -public: - GlUniform4fvCommand() : - OpenGlCommand(false, false, "glUniform4fv") - { - } - - static std::shared_ptr get(GLint location, GLsizei count, const PoolBufferPointer& value) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(location, count, value); - return ptr; - } - - void commandToExecute() override - { - ptrUniform4fv(m_location, m_count, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_value))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_value); - } - -private: - void set(GLint location, GLsizei count, const PoolBufferPointer& value) - { - m_location = location; - m_count = count; - m_value = value; - } - - GLint m_location; - GLsizei m_count; - PoolBufferPointer m_value; -}; - -class GlDetachShaderCommand : public OpenGlCommand -{ -public: - GlDetachShaderCommand() : - OpenGlCommand(false, false, "glDetachShader") - { - } - - static std::shared_ptr get(GLuint program, GLuint shader) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, shader); - return ptr; - } - - void commandToExecute() override - { - ptrDetachShader(m_program, m_shader); - } - -private: - void set(GLuint program, GLuint shader) - { - m_program = program; - m_shader = shader; - } - - GLuint m_program; - GLuint m_shader; -}; - -class GlDeleteShaderCommand : public OpenGlCommand -{ -public: - GlDeleteShaderCommand() : - OpenGlCommand(false, false, "glDeleteShader") - { - } - - static std::shared_ptr get(GLuint shader) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(shader); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteShader(m_shader); - } - -private: - void set(GLuint shader) - { - m_shader = shader; - } - - GLuint m_shader; -}; - -class GlDeleteProgramCommand : public OpenGlCommand -{ -public: - GlDeleteProgramCommand() : - OpenGlCommand(false, false, "glDeleteProgram") - { - } - - static std::shared_ptr get(GLuint program) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteProgram(m_program); - } - -private: - void set(GLuint program) - { - m_program = program; - } - - GLuint m_program; -}; - -class GlGetProgramInfoLogCommand : public OpenGlCommand -{ -public: - GlGetProgramInfoLogCommand() : - OpenGlCommand(true, true, "glGetProgramInfoLog") - { - } - - static std::shared_ptr get(GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, bufSize, length, infoLog); - return ptr; - } - - void commandToExecute() override - { - ptrGetProgramInfoLog(m_program, m_bufSize, m_length, m_infoLog); - } - -private: - void set(GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog) - { - m_program = program; - m_bufSize = bufSize; - m_length = length; - m_infoLog = infoLog; - } - - GLuint m_program; - GLsizei m_bufSize; - GLsizei* m_length; - GLchar* m_infoLog; -}; - -class GlGetShaderInfoLogCommand : public OpenGlCommand -{ -public: - GlGetShaderInfoLogCommand() : - OpenGlCommand(true, true, "glGetShaderInfoLog") - { - } - - static std::shared_ptr get(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(shader, bufSize, length, infoLog); - return ptr; - } - - void commandToExecute() override - { - ptrGetShaderInfoLog(m_shader, m_bufSize, m_length, m_infoLog); - } - -private: - void set(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog) - { - m_shader = shader; - m_bufSize = bufSize; - m_length = length; - m_infoLog = infoLog; - } - - GLuint m_shader; - GLsizei m_bufSize; - GLsizei* m_length; - GLchar* m_infoLog; -}; - -class GlGetShaderivCommand : public OpenGlCommand -{ -public: - GlGetShaderivCommand() : - OpenGlCommand(true, true, "glGetShaderiv") - { - } - - static std::shared_ptr get(GLuint shader, GLenum pname, GLint* params) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(shader, pname, params); - return ptr; - } - - void commandToExecute() override - { - ptrGetShaderiv(m_shader, m_pname, m_params); - } - -private: - void set(GLuint shader, GLenum pname, GLint* params) - { - m_shader = shader; - m_pname = pname; - m_params = params; - } - - GLuint m_shader; - GLenum m_pname; - GLint* m_params; -}; - -class GlGetProgramivCommand : public OpenGlCommand -{ -public: - GlGetProgramivCommand() : - OpenGlCommand(true, true, "glGetProgramiv") - { - } - - static std::shared_ptr get(GLuint program, GLenum pname, GLint*& params) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, pname, params); - return ptr; - } - - void commandToExecute() override - { - ptrGetProgramiv(m_program, m_pname, *m_params); - } - -private: - void set(GLuint program, GLenum pname, GLint*& params) - { - m_program = program; - m_pname = pname; - m_params = ¶ms; - } - - GLuint m_program; - GLenum m_pname; - GLint** m_params; -}; - -class GlEnableVertexAttribArrayCommand : public OpenGlCommand -{ -public: - GlEnableVertexAttribArrayCommand() : - OpenGlCommand(false, false, "glEnableVertexAttribArray") - { - } - - static std::shared_ptr get(GLuint index) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index); - return ptr; - } - - void commandToExecute() override - { - GlVertexAttribPointerManager::enableVertexAttributeIndexRender(m_index); - ptrEnableVertexAttribArray(m_index); - } - -private: - void set(GLuint index) - { - m_index = index; - } - - GLuint m_index; -}; - -class GlDisableVertexAttribArrayCommand : public OpenGlCommand -{ -public: - GlDisableVertexAttribArrayCommand() : - OpenGlCommand(false, false, "glDisableVertexAttribArray") - { - } - - static std::shared_ptr get(GLuint index) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index); - return ptr; - } - - void commandToExecute() override - { - GlVertexAttribPointerManager::disableVertexAttributeIndexRender(m_index); - ptrDisableVertexAttribArray(m_index); - } - -private: - void set(GLuint index) - { - m_index = index; - } - - GLuint m_index; -}; - -class GlVertexAttribPointerBufferedCommand : public OpenGlCommand -{ -public: - GlVertexAttribPointerBufferedCommand() : - OpenGlCommand(false, false, "glVertexAttribPointer") - { - } - - static std::shared_ptr get(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const GLvoid* offset) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index, size, type, normalized, stride, offset); - return ptr; - } - - void commandToExecute() override - { - ptrVertexAttribPointer(m_index, m_size, m_type, m_normalized, m_stride, m_offset); - } - -private: - void set(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const GLvoid* offset) - { - m_index = index; - m_size = size; - m_type = type; - m_normalized = normalized; - m_stride = stride; - m_offset = offset; - } - - GLuint m_index; - GLint m_size; - GLenum m_type; - GLboolean m_normalized; - GLsizei m_stride; - const GLvoid* m_offset; -}; - -class GlBindAttribLocationCommand : public OpenGlCommand -{ -public: - GlBindAttribLocationCommand() : - OpenGlCommand(false, false, "glBindAttribLocation") - { - } - - static std::shared_ptr get(GLuint program, GLuint index, const std::string name) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, index, name); - return ptr; - } - - void commandToExecute() override - { - ptrBindAttribLocation(m_program, m_index, m_name.data()); - } - -private: - void set(GLuint program, GLuint index, const std::string name) - { - m_program = program; - m_index = index; - m_name = name; - } - - GLuint m_program; - GLuint m_index; - std::string m_name; -}; - -class GlVertexAttrib1fCommand : public OpenGlCommand -{ -public: - GlVertexAttrib1fCommand() : - OpenGlCommand(false, false, "glVertexAttrib1f") - { - } - - static std::shared_ptr get(GLuint index, GLfloat x) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index, x); - return ptr; - } - - void commandToExecute() override - { - ptrVertexAttrib1f(m_index, m_x); - } - -private: - void set(GLuint index, GLfloat x) - { - m_index = index; - m_x = x; - } - - GLuint m_index; - GLfloat m_x; -}; - -class GlVertexAttrib4fCommand : public OpenGlCommand -{ -public: - GlVertexAttrib4fCommand() : - OpenGlCommand(false, false, "glVertexAttrib4f") - { - } - - static std::shared_ptr get(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index, x, y, z, w); - return ptr; - } - - void commandToExecute() override - { - ptrVertexAttrib4f(m_index, m_x, m_y, m_z, m_w); - } - -private: - void set(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) - { - m_index = index; - m_x = x; - m_y = y; - m_z = z; - m_w = w; - } - - GLuint m_index; - GLfloat m_x; - GLfloat m_y; - GLfloat m_z; - GLfloat m_w; -}; - -class GlVertexAttrib4fvCommand : public OpenGlCommand -{ -public: - GlVertexAttrib4fvCommand() : - OpenGlCommand(false, false, "glVertexAttrib4fv") - { - } - - static std::shared_ptr get(GLuint index, const PoolBufferPointer& v) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(index, v); - return ptr; - } - - void commandToExecute() override - { - ptrVertexAttrib4fv(m_index, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_v))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_v); - } - -private: - void set(GLuint index, const PoolBufferPointer& v) - { - m_index = index; - m_v = v; - } - - GLuint m_index; - PoolBufferPointer m_v; -}; - -class GlDepthRangefCommand : public OpenGlCommand -{ -public: - GlDepthRangefCommand() : - OpenGlCommand(false, false, "glDepthRangef") - { - } - - static std::shared_ptr get(GLfloat n, GLfloat f) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, f); - return ptr; - } - - void commandToExecute() override - { - ptrDepthRangef(m_n, m_f); - } - -private: - void set(GLfloat n, GLfloat f) - { - m_n = n; - m_f = f; - } - - GLfloat m_n; - GLfloat m_f; -}; - -class GlClearDepthfCommand : public OpenGlCommand -{ -public: - GlClearDepthfCommand() : - OpenGlCommand(false, false, "glClearDepthf") - { - } - - static std::shared_ptr get(GLfloat d) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(d); - return ptr; - } - - void commandToExecute() override - { - ptrClearDepthf(m_d); - } - -private: - void set(GLfloat d) - { - m_d = d; - } - - GLfloat m_d; -}; - -class GlDrawBuffersCommand : public OpenGlCommand -{ -public: - GlDrawBuffersCommand() : - OpenGlCommand(false, false, "glDrawBuffers") - { - } - - static std::shared_ptr get(GLsizei n, const PoolBufferPointer& bufs) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, bufs); - return ptr; - } - - void commandToExecute() override - { - ptrDrawBuffers(m_n, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_bufs))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_bufs); - } - -private: - void set(GLsizei n, const PoolBufferPointer& bufs) - { - m_n = n; - m_bufs = bufs; - } - - GLsizei m_n; - PoolBufferPointer m_bufs; -}; - -class GlGenFramebuffersCommand : public OpenGlCommand -{ -public: - GlGenFramebuffersCommand() : - OpenGlCommand(true, false, "glGenFramebuffers") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* framebuffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, framebuffers); - return ptr; - } - - void commandToExecute() override - { - ptrGenFramebuffers(m_n, m_framebuffers); - } - -private: - void set(GLsizei n, GLuint* framebuffers) - { - m_n = n; - m_framebuffers = framebuffers; - } - - GLsizei m_n; - GLuint* m_framebuffers; -}; - -class GlBindFramebufferCommand : public OpenGlCommand -{ -public: - GlBindFramebufferCommand() : - OpenGlCommand(false, false, "glBindFramebuffer") - { - } - - static std::shared_ptr get(GLenum target, GLuint framebuffer) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, framebuffer); - return ptr; - } - - void commandToExecute() override - { - ptrBindFramebuffer(m_target, m_framebuffer); - } - -private: - void set(GLenum target, GLuint framebuffer) - { - m_target = target; - m_framebuffer = framebuffer; - } - - GLenum m_target; - GLuint m_framebuffer; -}; - -class GlDeleteFramebuffersCommand : public OpenGlCommand -{ -public: - GlDeleteFramebuffersCommand() : - OpenGlCommand(false, false, "glDeleteFramebuffers") - { - } - - static std::shared_ptr get(GLsizei n, const PoolBufferPointer& framebuffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, framebuffers); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteFramebuffers(m_n, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_framebuffers))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_framebuffers); - } - -private: - void set(GLsizei n, const PoolBufferPointer& framebuffers) - { - m_n = n; - m_framebuffers = framebuffers; - } - - GLsizei m_n; - PoolBufferPointer m_framebuffers; -}; - -class GlFramebufferTexture2DCommand : public OpenGlCommand -{ -public: - GlFramebufferTexture2DCommand() : - OpenGlCommand(false, false, "glFramebufferTexture2D") - { - } - - static std::shared_ptr get(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, attachment, textarget, texture, level); - return ptr; - } - - void commandToExecute() override - { - ptrFramebufferTexture2D(m_target, m_attachment, m_textarget, m_texture, m_level); - } - -private: - void set(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) - { - m_target = target; - m_attachment = attachment; - m_textarget = textarget; - m_texture = texture; - m_level = level; - } - - GLenum m_target; - GLenum m_attachment; - GLenum m_textarget; - GLuint m_texture; - GLint m_level; -}; - -class GlTexImage2DMultisampleCommand : public OpenGlCommand -{ -public: - GlTexImage2DMultisampleCommand() : - OpenGlCommand(false, false, "glTexImage2DMultisample") - { - } - - static std::shared_ptr get(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height, GLboolean fixedsamplelocations) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, samples, internalformat, width, height, fixedsamplelocations); - return ptr; - } - - void commandToExecute() override - { - ptrTexImage2DMultisample(m_target, m_samples, m_internalformat, m_width, m_height, m_fixedsamplelocations); - } - -private: - void set(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height, GLboolean fixedsamplelocations) - { - m_target = target; - m_samples = samples; - m_internalformat = internalformat; - m_width = width; - m_height = height; - m_fixedsamplelocations = fixedsamplelocations; - } - - GLenum m_target; - GLsizei m_samples; - GLenum m_internalformat; - GLsizei m_width; - GLsizei m_height; - GLboolean m_fixedsamplelocations; -}; - -class GlTexStorage2DMultisampleCommand : public OpenGlCommand -{ -public: - GlTexStorage2DMultisampleCommand() : - OpenGlCommand(false, false, "glTexStorage2DMultisample") - { - } - - static std::shared_ptr get(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height, GLboolean fixedsamplelocations) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, samples, internalformat, width, height, fixedsamplelocations); - return ptr; - } - - void commandToExecute() override - { - ptrTexStorage2DMultisample(m_target, m_samples, m_internalformat, m_width, m_height, m_fixedsamplelocations); - } - -private: - void set(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height, GLboolean fixedsamplelocations) - { - m_target = target; - m_samples = samples; - m_internalformat = internalformat; - m_width = width; - m_height = height; - m_fixedsamplelocations = fixedsamplelocations; - } - - GLenum m_target; - GLsizei m_samples; - GLenum m_internalformat; - GLsizei m_width; - GLsizei m_height; - GLboolean m_fixedsamplelocations; -}; - -class GlGenRenderbuffersCommand : public OpenGlCommand -{ -public: - GlGenRenderbuffersCommand() : - OpenGlCommand(true, false, "glGenRenderbuffers") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* renderbuffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, renderbuffers); - return ptr; - } - - void commandToExecute() override - { - ptrGenRenderbuffers(m_n, m_renderbuffers); - } - -private: - void set(GLsizei n, GLuint* renderbuffers) - { - m_n = n; - m_renderbuffers = renderbuffers; - } - - GLsizei m_n; - GLuint* m_renderbuffers; -}; - -class GlBindRenderbufferCommand : public OpenGlCommand -{ -public: - GlBindRenderbufferCommand() : - OpenGlCommand(false, false, "glBindRenderbuffer") - { - } - - static std::shared_ptr get(GLenum target, GLuint renderbuffer) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, renderbuffer); - return ptr; - } - - void commandToExecute() override - { - ptrBindRenderbuffer(m_target, m_renderbuffer); - } - -private: - void set(GLenum target, GLuint renderbuffer) - { - m_target = target; - m_renderbuffer = renderbuffer; - } - - GLenum m_target; - GLuint m_renderbuffer; -}; - -class GlRenderbufferStorageCommand : public OpenGlCommand -{ -public: - GlRenderbufferStorageCommand() : - OpenGlCommand(false, false, "glRenderbufferStorage") - { - } - - static std::shared_ptr get(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, internalformat, width, height); - return ptr; - } - - void commandToExecute() override - { - ptrRenderbufferStorage(m_target, m_internalformat, m_width, m_height); - } - -private: - void set(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) - { - m_target = target; - m_internalformat = internalformat; - m_width = width; - m_height = height; - } - - GLenum m_target; - GLenum m_internalformat; - GLsizei m_width; - GLsizei m_height; -}; - -class GlDeleteRenderbuffersCommand : public OpenGlCommand -{ -public: - GlDeleteRenderbuffersCommand() : - OpenGlCommand(false, false, "glDeleteRenderbuffers") - { - } - - static std::shared_ptr get(GLsizei n, const PoolBufferPointer& renderbuffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, renderbuffers); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteRenderbuffers(m_n, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_renderbuffers))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_renderbuffers); - } - -private: - void set(GLsizei n, const PoolBufferPointer& renderbuffers) - { - m_n = n; - m_renderbuffers = renderbuffers; - } - - GLsizei m_n; - PoolBufferPointer m_renderbuffers; -}; - -class GlFramebufferRenderbufferCommand : public OpenGlCommand -{ -public: - GlFramebufferRenderbufferCommand() : - OpenGlCommand(false, false, "glFramebufferRenderbuffer") - { - } - - static std::shared_ptr get(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, attachment, renderbuffertarget, renderbuffer); - return ptr; - } - - void commandToExecute() override - { - ptrFramebufferRenderbuffer(m_target, m_attachment, m_renderbuffertarget, m_renderbuffer); - } - -private: - void set(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) - { - m_target = target; - m_attachment = attachment; - m_renderbuffertarget = renderbuffertarget; - m_renderbuffer = renderbuffer; - } - - GLenum m_target; - GLenum m_attachment; - GLenum m_renderbuffertarget; - GLuint m_renderbuffer; -}; - -class GlCheckFramebufferStatusCommand : public OpenGlCommand -{ -public: - GlCheckFramebufferStatusCommand() : - OpenGlCommand(true, true, "glCheckFramebufferStatus") - { - } - - static std::shared_ptr get(GLenum target, GLenum& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrCheckFramebufferStatus(m_target); - } - -private: - void set(GLenum target, GLenum& returnValue) - { - m_target = target; - m_returnValue = &returnValue; - } - - GLenum m_target; - GLenum* m_returnValue; -}; - -class GlBlitFramebufferCommand : public OpenGlCommand -{ -public: - GlBlitFramebufferCommand() : - OpenGlCommand(false, false, "glBlitFramebuffer") - { - } - - static std::shared_ptr get(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, - GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - return ptr; - } - - void commandToExecute() override - { - ptrBlitFramebuffer(m_srcX0, m_srcY0, m_srcX1, m_srcY1, m_dstX0, m_dstY0, m_dstX1, m_dstY1, m_mask, - m_filter); - } - -private: - void set(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, - GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) - { - m_srcX0 = srcX0; - m_srcY0 = srcY0; - m_srcX1 = srcX1; - m_srcY1 = srcY1; - m_dstX0 = dstX0; - m_dstY0 = dstY0; - m_dstX1 = dstX1; - m_dstY1 = dstY1; - m_mask = mask; - m_filter = filter; - } - - GLint m_srcX0; - GLint m_srcY0; - GLint m_srcX1; - GLint m_srcY1; - GLint m_dstX0; - GLint m_dstY0; - GLint m_dstX1; - GLint m_dstY1; - GLbitfield m_mask; - GLenum m_filter; -}; - -class GlGenVertexArraysCommand : public OpenGlCommand -{ -public: - GlGenVertexArraysCommand() : - OpenGlCommand(true, false, "glGenVertexArrays") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* arrays) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, arrays); - return ptr; - } - - void commandToExecute() override - { - ptrGenVertexArrays(m_n, m_arrays); - } - -private: - void set(GLsizei n, GLuint* arrays) - { - m_n = n; - m_arrays = arrays; - } - - GLsizei m_n; - GLuint* m_arrays; -}; - -class GlBindVertexArrayCommand : public OpenGlCommand -{ -public: - GlBindVertexArrayCommand() : - OpenGlCommand(false, false, "glBindVertexArray") - { - } - - static std::shared_ptr get(GLuint array) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(array); - return ptr; - } - - void commandToExecute() override - { - ptrBindVertexArray(m_array); - } - -private: - void set(GLuint array) - { - m_array = array; - } - - GLuint m_array; -}; - -class GlDeleteVertexArraysCommand : public OpenGlCommand -{ -public: - GlDeleteVertexArraysCommand() : - OpenGlCommand(false, false, "glDeleteVertexArrays") - { - } - - static std::shared_ptr get(GLsizei n, const PoolBufferPointer& arrays) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, arrays); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteVertexArrays(m_n, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_arrays))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_arrays); - } - -private: - void set(GLsizei n, const PoolBufferPointer& arrays) - { - m_n = n; - m_arrays = arrays; - } - - GLsizei m_n; - PoolBufferPointer m_arrays; -}; - -class GlGenBuffersCommand : public OpenGlCommand -{ -public: - GlGenBuffersCommand() : - OpenGlCommand(true, false, "glGenBuffers") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* buffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, buffers); - return ptr; - } - - void commandToExecute() override - { - ptrGenBuffers(m_n, m_buffers); - } - -private: - void set(GLsizei n, GLuint* buffers) - { - m_n = n; - m_buffers = buffers; - } - - GLsizei m_n; - GLuint* m_buffers; -}; - -class GlBindBufferCommand : public OpenGlCommand -{ -public: - GlBindBufferCommand() : - OpenGlCommand(false, false, "glBindBuffer") - { - } - - static std::shared_ptr get(GLenum target, GLuint buffer) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, buffer); - return ptr; - } - - static GLuint getBoundBufferRender(GLenum target) - { - return m_boundBuffersRender[target]; - } - - static void setBoundBuffer(GLenum target, GLuint buffer) - { - m_boundBuffers[target] = buffer; - } - - static GLuint getBoundBuffer(GLenum target) - { - return m_boundBuffers[target]; - } - - void commandToExecute() override - { - ptrBindBuffer(m_target, m_buffer); - m_boundBuffersRender[m_target] = m_buffer; - } - -private: - void set(GLenum target, GLuint buffer) - { - m_target = target; - m_buffer = buffer; - } - - GLenum m_target; - GLuint m_buffer; - - static std::unordered_map m_boundBuffersRender; - static std::unordered_map m_boundBuffers; -}; - -class GlBufferDataCommand : public OpenGlCommand -{ -public: - GlBufferDataCommand() : - OpenGlCommand(false, false, "glBufferData") - { - } - - static std::shared_ptr get(GLenum target, GLsizeiptr size, const PoolBufferPointer& data, GLenum usage) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, size, data, usage); - return ptr; - } - - void commandToExecute() override - { - ptrBufferData(m_target, m_size, OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_data), m_usage); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_data); - } - -private: - void set(GLenum target, GLsizeiptr size, const PoolBufferPointer& data, GLenum usage) - { - m_target = target; - m_size = size; - m_data = data; - m_usage = usage; - } - - GLenum m_target; - GLsizeiptr m_size; - PoolBufferPointer m_data; - GLenum m_usage; -}; - -class GlMapBufferCommand : public OpenGlCommand -{ -public: - GlMapBufferCommand() : - OpenGlCommand(false, false, "glMapBuffer") - { - } - - static std::shared_ptr get(GLenum target, GLenum access) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, access); - return ptr; - } - - void commandToExecute() override - { - ptrMapBuffer(m_target, m_access); - } - -private: - void set(GLenum target, GLenum access) - { - m_target = target; - m_access = access; - } - - GLenum m_target; - GLenum m_access; -}; - -class GlMapBufferRangeCommand : public OpenGlCommand -{ -public: - GlMapBufferRangeCommand() : - OpenGlCommand(true, true, "glMapBufferRange") - { - } - - static std::shared_ptr get(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, - void*& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, offset, length, access, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrMapBufferRange(m_target, m_offset, m_length, m_access); - } - -private: - void set(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, - void*& returnValue) - { - m_target = target; - m_offset = offset; - m_length = length; - m_access = access; - m_returnValue = &returnValue; - } - - GLenum m_target; - GLintptr m_offset; - GLsizeiptr m_length; - GLbitfield m_access; - void** m_returnValue; -}; - -class GlMapBufferRangeWriteAsyncCommand : public OpenGlCommand -{ -public: - GlMapBufferRangeWriteAsyncCommand() : - OpenGlCommand(false, false, "GlMapBufferRangeWriteAsyncCommand") - { - } - - static std::shared_ptr get(GLenum target, GLintptr offset, GLsizeiptr length, - GLbitfield access, const PoolBufferPointer& data) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, offset, length, access, data); - return ptr; - } - - void commandToExecute() override - { - const char* data = OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_data); - void* buffer_pointer = ptrMapBufferRange(m_target, m_offset, m_length, m_access); - std::copy_n(data, m_length, reinterpret_cast(buffer_pointer)); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_data); - } - - static std::shared_ptr> getData(GLuint buffer, GLsizeiptr length) - { - verifyBuffer(buffer, length); - return m_TempData[buffer]; - } - - static void setTemp(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) - { - m_targetTemp = target; - m_offsetTemp = offset; - m_lengthTemp = length; - m_accessTemp = access; - } - - static GLenum getTempTarget() - { - return m_targetTemp; - } - - static GLintptr getTempOffset() - { - return m_offsetTemp; - } - - static GLsizeiptr getTempLength() - { - return m_lengthTemp; - } - - static GLbitfield getTempAccess() - { - return m_accessTemp; - } - -private: - void set(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, const PoolBufferPointer& data) - { - m_target = target; - m_offset = offset; - m_length = length; - m_access = access; - m_data = data; - } - - static void verifyBuffer(GLuint buffer, GLsizeiptr length) - { - if (m_TempData[buffer] == nullptr || static_cast(m_TempData[buffer]->size()) < length) { - m_TempData[buffer] = std::make_shared>(length); - } - } - - GLenum m_target; - GLintptr m_offset; - GLsizeiptr m_length; - GLbitfield m_access; - PoolBufferPointer m_data; - - static GLenum m_targetTemp; - static GLintptr m_offsetTemp; - static GLsizeiptr m_lengthTemp; - static GLbitfield m_accessTemp; - static std::unordered_map>> m_TempData; -public: - static const GLbitfield WRITE_ACCESS_ASYNC = GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT; -}; - -class GlMapBufferRangeReadAsyncCommand : public OpenGlCommand -{ -public: - GlMapBufferRangeReadAsyncCommand() : - OpenGlCommand(false, false, "GlMapBufferRangeReadAsyncCommand") - { - } - - static std::shared_ptr get(GLenum target, GLintptr offset, GLsizeiptr length, - GLbitfield access) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, offset, length, access); - return ptr; - } - - void commandToExecute() override - { - void* buffer_pointer = ptrMapBufferRange(m_target, m_offset, m_length, m_access); - - if (buffer_pointer != nullptr) { - std::unique_lock lock(m_mapMutex); - GLuint buffer = GlBindBufferCommand::getBoundBufferRender(m_target); - verifyBuffer(buffer, m_length); - auto data = m_data[buffer]; - memcpy(data->data(), buffer_pointer, m_length); - } - } - - static std::shared_ptr> getData(GLuint buffer, GLsizeiptr length) - { - std::unique_lock lock(m_mapMutex); - verifyBuffer(buffer, length); - return m_data[buffer]; - } - -private: - void set(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) - { - m_target = target; - m_offset = offset; - m_length = length; - m_access = access; - } - - static void verifyBuffer(GLuint buffer, GLsizeiptr length) - { - if (m_data[buffer] == nullptr || static_cast(m_data[buffer]->size()) < length) { - m_data[buffer] = std::make_shared>(length); - } - } - - GLenum m_target; - GLintptr m_offset; - GLsizeiptr m_length; - GLbitfield m_access; - static std::unordered_map>> m_data; - static std::mutex m_mapMutex; -}; - -class GlUnmapBufferCommand : public OpenGlCommand -{ -public: - GlUnmapBufferCommand() : - OpenGlCommand(true, true, "glUnmapBuffer") - { - } - - static std::shared_ptr get(GLenum target, GLboolean& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrUnmapBuffer(m_target); - } - -private: - void set(GLenum target, GLboolean& returnValue) - { - m_target = target; - m_returnValue = &returnValue; - } - - GLenum m_target; - GLboolean* m_returnValue; -}; - -class GlUnmapBufferAsyncCommand : public OpenGlCommand -{ -public: - GlUnmapBufferAsyncCommand() : - OpenGlCommand(false, false, "glUnmapBuffer") - { - } - - static std::shared_ptr get(GLenum target) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target); - return ptr; - } - - void commandToExecute() override - { - ptrUnmapBuffer(m_target); - } - -private: - void set(GLenum target) - { - m_target = target; - } - - GLenum m_target; -}; - -class GlDeleteBuffersCommand : public OpenGlCommand -{ -public: - GlDeleteBuffersCommand() : - OpenGlCommand(false, false, "glDeleteBuffers") - { - } - - static std::shared_ptr get(GLsizei n, const PoolBufferPointer& buffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, buffers); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteBuffers(m_n, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_buffers))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_buffers); - } - -private: - void set(GLsizei n, const PoolBufferPointer& buffers) - { - m_n = n; - m_buffers = buffers; - } - - GLsizei m_n; - PoolBufferPointer m_buffers; -}; - -class GlBindImageTextureCommand : public OpenGlCommand -{ -public: - GlBindImageTextureCommand() : - OpenGlCommand(false, false, "glBindImageTexture") - { - } - - static std::shared_ptr get(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, - GLenum access, GLenum format) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(unit, texture, level, layered, layer, access, format); - return ptr; - } - - void commandToExecute() override - { - ptrBindImageTexture(m_unit, m_texture, m_level, m_layered, m_layer, m_access, m_format); - } - -private: - void set(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, - GLenum access, GLenum format) - { - m_unit = unit; - m_texture = texture; - m_level = level; - m_layered = layered; - m_layer = layer; - m_access = access; - m_format = format; - } - - GLuint m_unit; - GLuint m_texture; - GLint m_level; - GLboolean m_layered; - GLint m_layer; - GLenum m_access; - GLenum m_format; -}; - -class GlMemoryBarrierCommand : public OpenGlCommand -{ -public: - GlMemoryBarrierCommand() : - OpenGlCommand(false, false, "glMemoryBarrier") - { - } - - static std::shared_ptr get(GLbitfield barriers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(barriers); - return ptr; - } - - void commandToExecute() override - { - ptrMemoryBarrier(m_barriers); - } - -private: - void set(GLbitfield barriers) - { - m_barriers = barriers; - } - - GLbitfield m_barriers; -}; - -class GlTextureBarrierCommand : public OpenGlCommand -{ -public: - GlTextureBarrierCommand() : - OpenGlCommand(false, false, "glTextureBarrier") - { - } - - static std::shared_ptr get() - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(); - return ptr; - } - - void commandToExecute() override - { - ptrTextureBarrier(); - } - -private: - void set() - { - } -}; - -class GlTextureBarrierNVCommand : public OpenGlCommand -{ -public: - GlTextureBarrierNVCommand() : - OpenGlCommand(false, false, "glTextureBarrierNV") - { - } - - static std::shared_ptr get() - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(); - return ptr; - } - - void commandToExecute() override - { - ptrTextureBarrierNV(); - } - -private: - void set() - { - } -}; - -class GlGetStringiCommand : public OpenGlCommand -{ -public: - GlGetStringiCommand() : - OpenGlCommand(true, false, "glGetStringi") - { - } - - static std::shared_ptr get(GLenum name, GLuint index, const GLubyte*& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(name, index, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrGetStringi(m_name, m_index); - } - -private: - void set(GLenum name, GLuint index, const GLubyte*& returnValue) - { - m_name = name; - m_index = index; - m_returnValue = &returnValue; - } - - GLenum m_name; - GLuint m_index; - const GLubyte** m_returnValue; -}; - -class GlInvalidateFramebufferCommand : public OpenGlCommand -{ -public: - GlInvalidateFramebufferCommand() : - OpenGlCommand(false, false, "glInvalidateFramebuffer") - { - } - - static std::shared_ptr get(GLenum target, GLsizei numAttachments, const PoolBufferPointer& attachments) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, numAttachments, attachments); - return ptr; - } - - void commandToExecute() override - { - ptrInvalidateFramebuffer(m_target, m_numAttachments, reinterpret_cast(OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_attachments))); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_attachments); - } - -private: - void set(GLenum target, GLsizei numAttachments, const PoolBufferPointer& attachments) - { - m_target = target; - m_numAttachments = numAttachments; - m_attachments = attachments; - } - - GLenum m_target; - GLsizei m_numAttachments; - PoolBufferPointer m_attachments; -}; - -class GlBufferStorageCommand : public OpenGlCommand -{ -public: - GlBufferStorageCommand() : - OpenGlCommand(false, false, "glBufferStorage") - { - } - - static std::shared_ptr get(GLenum target, GLsizeiptr size, const PoolBufferPointer& data, GLbitfield flags) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, size, data, flags); - return ptr; - } - - void commandToExecute() override - { - ptrBufferStorage(m_target, m_size, OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_data), m_flags); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_data); - } - -private: - void set(GLenum target, GLsizeiptr size, const PoolBufferPointer& data, GLbitfield flags) - { - m_target = target; - m_size = size; - m_data = data; - m_flags = flags; - } - - GLenum m_target; - GLsizeiptr m_size; - PoolBufferPointer m_data; - GLbitfield m_flags; -}; - -class GlFenceSyncCommand : public OpenGlCommand -{ -public: - GlFenceSyncCommand() : - OpenGlCommand(true, false, "glFenceSync") - { - } - - static std::shared_ptr get(GLenum condition, GLbitfield flags, GLsync& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(condition, flags, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrFenceSync(m_condition, m_flags); - } - -private: - void set(GLenum condition, GLbitfield flags, GLsync& returnValue) - { - m_condition = condition; - m_flags = flags; - m_returnValue = &returnValue; - } - - GLenum m_condition; - GLbitfield m_flags; - GLsync* m_returnValue; -}; - -class GlClientWaitSyncCommand : public OpenGlCommand -{ -public: - GlClientWaitSyncCommand() : - OpenGlCommand(true, false, "glClientWaitSync") - { - } - - static std::shared_ptr get(GLsync sync, GLbitfield flags, GLuint64 timeout) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(sync, flags, timeout); - return ptr; - } - - void commandToExecute() override - { - ptrClientWaitSync(m_sync, m_flags, m_timeout); - } - -private: - void set(GLsync sync, GLbitfield flags, GLuint64 timeout) - { - m_sync = sync; - m_flags = flags; - m_timeout = timeout; - } - - GLsync m_sync; - GLbitfield m_flags; - GLuint64 m_timeout; -}; - -class GlDeleteSyncCommand : public OpenGlCommand -{ -public: - GlDeleteSyncCommand() : - OpenGlCommand(true, false, "glDeleteSync") - { - } - - static std::shared_ptr get(GLsync sync) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(sync); - return ptr; - } - - void commandToExecute() override - { - ptrDeleteSync(m_sync); - } - -private: - void set(GLsync sync) - { - m_sync = sync; - } - - GLsync m_sync; -}; - -class GlGetUniformBlockIndexCommand : public OpenGlCommand -{ -public: - GlGetUniformBlockIndexCommand() : - OpenGlCommand(true, true, "glGetUniformBlockIndex") - { - } - - static std::shared_ptr get(GLuint program, const GLchar* uniformBlockName, GLuint& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, uniformBlockName, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrGetUniformBlockIndex(m_program, m_uniformBlockName); - } - -private: - void set(GLuint program, const GLchar* uniformBlockName, GLuint& returnValue) - { - m_program = program; - m_uniformBlockName = uniformBlockName; - m_returnValue = &returnValue; - } - - GLuint m_program; - const GLchar* m_uniformBlockName; - GLuint* m_returnValue; -}; - -class GlUniformBlockBindingCommand : public OpenGlCommand -{ -public: - GlUniformBlockBindingCommand() : - OpenGlCommand(false, false, "glUniformBlockBinding") - { - } - - static std::shared_ptr get(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, uniformBlockIndex, uniformBlockBinding); - return ptr; - } - - void commandToExecute() override - { - ptrUniformBlockBinding(m_program, m_uniformBlockIndex, m_uniformBlockBinding); - } - -private: - void set(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) - { - m_program = program; - m_uniformBlockIndex = uniformBlockIndex; - m_uniformBlockBinding = uniformBlockBinding; - } - - GLuint m_program; - GLuint m_uniformBlockIndex; - GLuint m_uniformBlockBinding; -}; - -class GlGetActiveUniformBlockivCommand : public OpenGlCommand -{ -public: - GlGetActiveUniformBlockivCommand() : - OpenGlCommand(true, true, "glGetActiveUniformBlockiv") - { - } - - static std::shared_ptr get(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, uniformBlockIndex, pname, params); - return ptr; - } - - void commandToExecute() override - { - ptrGetActiveUniformBlockiv(m_program, m_uniformBlockIndex, m_pname, m_params); - } - -private: - void set(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) - { - m_program = program; - m_uniformBlockIndex = uniformBlockIndex; - m_pname = pname; - m_params = params; - } - - GLuint m_program; - GLuint m_uniformBlockIndex; - GLenum m_pname; - GLint* m_params; -}; - -class GlGetUniformIndicesCommand : public OpenGlCommand -{ -public: - GlGetUniformIndicesCommand() : - OpenGlCommand(true, true, "glGetUniformIndices") - { - } - - static std::shared_ptr get(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, - GLuint* uniformIndices) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, uniformCount, uniformNames, uniformIndices); - return ptr; - } - - void commandToExecute() override - { - ptrGetUniformIndices(m_program, m_uniformCount, m_uniformNames, m_uniformIndices); - } - -private: - void set(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, - GLuint* uniformIndices) - { - m_program = program; - m_uniformCount = uniformCount; - m_uniformNames = uniformNames; - m_uniformIndices = uniformIndices; - } - - GLuint m_program; - GLsizei m_uniformCount; - const GLchar* const* m_uniformNames; - GLuint* m_uniformIndices; -}; - -class GlGetActiveUniformsivCommand : public OpenGlCommand -{ -public: - GlGetActiveUniformsivCommand() : - OpenGlCommand(true, true, "glGetActiveUniformsiv") - { - } - - static std::shared_ptr get(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, - GLint* params) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, uniformCount, uniformIndices, pname, params); - return ptr; - } - - void commandToExecute() override - { - ptrGetActiveUniformsiv(m_program, m_uniformCount, m_uniformIndices, m_pname, m_params); - } - -private: - void set(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, - GLint* params) - { - m_program = program; - m_uniformCount = uniformCount; - m_uniformIndices = uniformIndices; - m_pname = pname; - m_params = params; - } - - GLuint m_program; - GLsizei m_uniformCount; - const GLuint* m_uniformIndices; - GLenum m_pname; - GLint* m_params; -}; - -class GlBindBufferBaseCommand : public OpenGlCommand -{ -public: - GlBindBufferBaseCommand() : - OpenGlCommand(false, false, "glBindBufferBase") - { - } - - static std::shared_ptr get(GLenum target, GLuint index, GLuint buffer) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, index, buffer); - return ptr; - } - - void commandToExecute() override - { - ptrBindBufferBase(m_target, m_index, m_buffer); - } - -private: - void set(GLenum target, GLuint index, GLuint buffer) - { - m_target = target; - m_index = index; - m_buffer = buffer; - } - - GLenum m_target; - GLuint m_index; - GLuint m_buffer; -}; - -class GlBufferSubDataCommand : public OpenGlCommand -{ -public: - GlBufferSubDataCommand() : - OpenGlCommand(false, false, "glBufferSubData") - { - } - - static std::shared_ptr get(GLenum target, GLintptr offset, GLsizeiptr size, const PoolBufferPointer& data) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, offset, size, data); - return ptr; - } - - void commandToExecute() override - { - ptrBufferSubData(m_target, m_offset, m_size, OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_data)); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_data); - } - -private: - void set(GLenum target, GLintptr offset, GLsizeiptr size, const PoolBufferPointer& data) - { - m_target = target; - m_offset = offset; - m_size = size; - m_data = data; - } - - GLenum m_target; - GLintptr m_offset; - GLsizeiptr m_size; - PoolBufferPointer m_data; -}; - -class GlGetProgramBinaryCommand : public OpenGlCommand -{ -public: - GlGetProgramBinaryCommand() : - OpenGlCommand(true, true, "glGetProgramBinary") - { - } - - static std::shared_ptr get(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, bufSize, length, binaryFormat, binary); - return ptr; - } - - void commandToExecute() override - { - ptrGetProgramBinary(m_program, m_bufSize, m_length, m_binaryFormat, m_binary); - } - -private: - void set(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary) - { - m_program = program; - m_bufSize = bufSize; - m_length = length; - m_binaryFormat = binaryFormat; - m_binary = binary; - } - - GLuint m_program; - GLsizei m_bufSize; - GLsizei* m_length; - GLenum* m_binaryFormat; - void* m_binary; -}; - -class GlProgramBinaryCommand : public OpenGlCommand -{ -public: - GlProgramBinaryCommand() : - OpenGlCommand(false, false, "glProgramBinary") - { - } - - static std::shared_ptr get(GLuint program, GLenum binaryFormat, const PoolBufferPointer& binary, GLsizei length) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, binaryFormat, binary, length); - return ptr; - } - - void commandToExecute() override - { - ptrProgramBinary(m_program, m_binaryFormat, OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_binary), m_length); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_binary); - } - -private: - void set(GLuint program, GLenum binaryFormat, const PoolBufferPointer& binary, GLsizei length) - { - m_program = program; - m_binaryFormat = binaryFormat; - m_binary = binary; - m_length = length; - } - - GLuint m_program; - GLenum m_binaryFormat; - PoolBufferPointer m_binary; - GLsizei m_length; -}; - -class GlProgramParameteriCommand : public OpenGlCommand -{ -public: - GlProgramParameteriCommand() : - OpenGlCommand(false, false, "glProgramParameteri") - { - } - - static std::shared_ptr get(GLuint program, GLenum pname, GLint value) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(program, pname, value); - return ptr; - } - - void commandToExecute() override - { - ptrProgramParameteri(m_program, m_pname, m_value); - } - -private: - void set(GLuint program, GLenum pname, GLint value) - { - m_program = program; - m_pname = pname; - m_value = value; - } - - GLuint m_program; - GLenum m_pname; - GLint m_value; -}; - -class GlTexStorage2DCommand : public OpenGlCommand -{ -public: - GlTexStorage2DCommand() : - OpenGlCommand(false, false, "glTexStorage2D") - { - } - - static std::shared_ptr get(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, levels, internalformat, width, height); - return ptr; - } - - void commandToExecute() override - { - ptrTexStorage2D(m_target, m_levels, m_internalformat, m_width, m_height); - } - -private: - void set(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) - { - m_target = target; - m_levels = levels; - m_internalformat = internalformat; - m_width = width; - m_height = height; - } - - GLenum m_target; - GLsizei m_levels; - GLenum m_internalformat; - GLsizei m_width; - GLsizei m_height; -}; - -class GlTextureStorage2DCommand : public OpenGlCommand -{ -public: - GlTextureStorage2DCommand() : - OpenGlCommand(false, false, "glTextureStorage2D") - { - } - - static std::shared_ptr get(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(texture, levels, internalformat, width, height); - return ptr; - } - - void commandToExecute() override - { - ptrTextureStorage2D(m_texture, m_levels, m_internalformat, m_width, m_height); - } - -private: - void set(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) - { - m_texture = texture; - m_levels = levels; - m_internalformat = internalformat; - m_width = width; - m_height = height; - } - - GLuint m_texture; - GLsizei m_levels; - GLenum m_internalformat; - GLsizei m_width; - GLsizei m_height; -}; - -class GlTextureSubImage2DUnbufferedCommand : public OpenGlCommand -{ -public: - GlTextureSubImage2DUnbufferedCommand() : - OpenGlCommand(false, false, "glTextureSubImage2D") - { - } - - static std::shared_ptr get(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const PoolBufferPointer& pixels) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(texture, level, xoffset, yoffset, width, height, format, type, pixels); - return ptr; - } - - void commandToExecute() override - { - ptrTextureSubImage2D(m_texture, m_level, m_xoffset, m_yoffset, m_width, m_height, m_format, m_type, - OpenGlCommand::m_ringBufferPool.getBufferFromPool(m_pixels)); - OpenGlCommand::m_ringBufferPool.removeBufferFromPool(m_pixels); - } - -private: - void set(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const PoolBufferPointer& pixels) - { - m_texture = texture; - m_level = level; - m_xoffset = xoffset; - m_yoffset = yoffset; - m_width = width; - m_height = height; - m_format = format; - m_type = type; - m_pixels = pixels; - } - - GLuint m_texture; - GLint m_level; - GLint m_xoffset; - GLint m_yoffset; - GLsizei m_width; - GLsizei m_height; - GLenum m_format; - GLenum m_type; - PoolBufferPointer m_pixels; -}; - -class GlTextureStorage2DMultisampleCommand : public OpenGlCommand -{ -public: - GlTextureStorage2DMultisampleCommand() : - OpenGlCommand(false, false, "glTextureStorage2DMultisample") - { - } - - static std::shared_ptr get(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, - GLsizei width, GLsizei height, GLboolean fixedsamplelocations) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(texture, target, samples, internalformat, width, height, fixedsamplelocations); - return ptr; - } - - void commandToExecute() override - { - ptrTextureStorage2DMultisample(m_texture, m_target, m_samples, m_internalformat, m_width, m_height, - m_fixedsamplelocations); - } - -private: - void set(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, - GLsizei width, GLsizei height, GLboolean fixedsamplelocations) - { - m_texture = texture; - m_target = target; - m_samples = samples; - m_internalformat = internalformat; - m_width = width; - m_height = height; - m_fixedsamplelocations = fixedsamplelocations; - } - - GLuint m_texture; - GLenum m_target; - GLsizei m_samples; - GLenum m_internalformat; - GLsizei m_width; - GLsizei m_height; - GLboolean m_fixedsamplelocations; -}; - -class GlTextureParameteriCommand : public OpenGlCommand -{ -public: - GlTextureParameteriCommand() : - OpenGlCommand(false, false, "glTextureParameteri") - { - } - - static std::shared_ptr get(GLuint texture, GLenum pname, GLint param) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(texture, pname, param); - return ptr; - } - - void commandToExecute() override - { - ptrTextureParameteri(m_texture, m_pname, m_param); - } - -private: - void set(GLuint texture, GLenum pname, GLint param) - { - m_texture = texture; - m_pname = pname; - m_param = param; - } - - GLuint m_texture; - GLenum m_pname; - GLint m_param; -}; - -class GlTextureParameterfCommand : public OpenGlCommand -{ -public: - GlTextureParameterfCommand() : - OpenGlCommand(false, false, "glTextureParameterf") - { - } - - static std::shared_ptr get(GLuint texture, GLenum pname, GLfloat param) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(texture, pname, param); - return ptr; - } - - void commandToExecute() override - { - ptrTextureParameterf(m_texture, m_pname, m_param); - } - -private: - void set(GLuint texture, GLenum pname, GLfloat param) - { - m_texture = texture; - m_pname = pname; - m_param = param; - } - - GLuint m_texture; - GLenum m_pname; - GLfloat m_param; -}; - -class GlCreateTexturesCommand : public OpenGlCommand -{ -public: - GlCreateTexturesCommand() : - OpenGlCommand(true, false, "glCreateTextures") - { - } - - static std::shared_ptr get(GLenum target, GLsizei n, GLuint* textures) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, n, textures); - return ptr; - } - - void commandToExecute() override - { - ptrCreateTextures(m_target, m_n, m_textures); - } - -private: - void set(GLenum target, GLsizei n, GLuint* textures) - { - m_target = target; - m_n = n; - m_textures = textures; - } - - GLenum m_target; - GLsizei m_n; - GLuint* m_textures; -}; - -class GlCreateBuffersCommand : public OpenGlCommand -{ -public: - GlCreateBuffersCommand() : - OpenGlCommand(true, false, "glCreateBuffers") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* buffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, buffers); - return ptr; - } - - void commandToExecute() override - { - ptrCreateBuffers(m_n, m_buffers); - } - -private: - void set(GLsizei n, GLuint* buffers) - { - m_n = n; - m_buffers = buffers; - } - - GLsizei m_n; - GLuint* m_buffers; -}; - -class GlCreateFramebuffersCommand : public OpenGlCommand -{ -public: - GlCreateFramebuffersCommand() : - OpenGlCommand(true, false, "glCreateFramebuffers") - { - } - - static std::shared_ptr get(GLsizei n, GLuint* framebuffers) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(n, framebuffers); - return ptr; - } - - void commandToExecute() override - { - ptrCreateFramebuffers(m_n, m_framebuffers); - } - -private: - void set(GLsizei n, GLuint* framebuffers) - { - m_n = n; - m_framebuffers = framebuffers; - } - - GLsizei m_n; - GLuint* m_framebuffers; -}; - -class GlNamedFramebufferTextureCommand : public OpenGlCommand -{ -public: - GlNamedFramebufferTextureCommand() : - OpenGlCommand(false, false, "glNamedFramebufferTexture") - { - } - - static std::shared_ptr get(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(framebuffer, attachment, texture, level); - return ptr; - } - - void commandToExecute() override - { - ptrNamedFramebufferTexture(m_framebuffer, m_attachment, m_texture, m_level); - } - -private: - void set(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) - { - m_framebuffer = framebuffer; - m_attachment = attachment; - m_texture = texture; - m_level = level; - } - - GLuint m_framebuffer; - GLenum m_attachment; - GLuint m_texture; - GLint m_level; -}; - -class GlDrawRangeElementsBaseVertexCommand : public OpenGlCommand -{ -public: - GlDrawRangeElementsBaseVertexCommand() : - OpenGlCommand(false, false, "glDrawRangeElementsBaseVertex") - { - } - - static std::shared_ptr get(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const u16* indices, GLint basevertex) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(mode, start, end, count, type, indices, basevertex); - return ptr; - } - - void commandToExecute() override - { - ptrDrawRangeElementsBaseVertex(m_mode, m_start, m_end, m_count, m_type, m_indices, m_basevertex); - } - -private: - void set(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const u16* indices, GLint basevertex) - { - m_mode = mode; - m_start = start; - m_end = end; - m_count = count; - m_type = type; - m_indices = indices; - m_basevertex = basevertex; - } - - GLenum m_mode; - GLuint m_start; - GLuint m_end; - GLsizei m_count; - GLenum m_type; - const u16* m_indices; - GLint m_basevertex; -}; - -class GlFlushMappedBufferRangeCommand : public OpenGlCommand -{ -public: - GlFlushMappedBufferRangeCommand() : - OpenGlCommand(false, false, "glFlushMappedBufferRange") - { - } - - static std::shared_ptr get(GLenum target, GLintptr offset, GLsizeiptr length) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, offset, length); - return ptr; - } - - void commandToExecute() override - { - ptrFlushMappedBufferRange(m_target, m_offset, m_length); - } - -private: - void set(GLenum target, GLintptr offset, GLsizeiptr length) - { - m_target = target; - m_offset = offset; - m_length = length; - } - - GLenum m_target; - GLintptr m_offset; - GLsizeiptr m_length; -}; - -class GlFinishCommand : public OpenGlCommand -{ -public: - GlFinishCommand() : - OpenGlCommand(true, true, "glFinish") - { - } - - static std::shared_ptr get() - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(); - return ptr; - } - - void commandToExecute() override - { - ptrFinish(); - } - -private: - void set() - { - - } -}; - -class GlCopyTexImage2DCommand : public OpenGlCommand -{ -public: - GlCopyTexImage2DCommand() : - OpenGlCommand(false, false, "glCopyTexImage2D") - { - } - - static std::shared_ptr get(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, level, internalformat, x, y, width, height, border); - return ptr; - } - - void commandToExecute() override - { - ptrCopyTexImage2D(m_target, m_level, m_internalformat, m_x, m_y, m_width, m_height, m_border); - } - -private: - void set(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) - { - m_target = target; - m_level = level; - m_internalformat = internalformat; - m_x = x; - m_y = y; - m_width = width; - m_height = height; - m_border = border; - } - - GLenum m_target; - GLint m_level; - GLenum m_internalformat; - GLint m_x; - GLint m_y; - GLsizei m_width; - GLsizei m_height; - GLint m_border; -}; - -class GlDebugMessageCallbackCommand : public OpenGlCommand -{ - public: - GlDebugMessageCallbackCommand() : - OpenGlCommand(true, false, "glDebugMessageCallback") - { - } - - static std::shared_ptr get(GLDEBUGPROC callback, const void *userParam) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(callback, userParam); - return ptr; - } - - void commandToExecute() override - { - ptrDebugMessageCallback(m_callback, m_userParam); - } - -private: - void set(GLDEBUGPROC callback, const void *userParam) - { - m_callback = callback; - m_userParam = userParam; - } - - GLDEBUGPROC m_callback; - const void* m_userParam; -}; - -class GlDebugMessageControlCommand : public OpenGlCommand -{ -public: - GlDebugMessageControlCommand() : - OpenGlCommand(true, false, "glDebugMessageControl") - { - } - - static std::shared_ptr get(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(source, type, severity, count, ids, enabled); - return ptr; - } - - void commandToExecute() override - { - ptrDebugMessageControl(m_source, m_type, m_severity, m_count, m_ids, m_enabled); - } - -private: - void set(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled) - { - m_source = source; - m_type = type; - m_severity = severity; - m_count = count; - m_ids = ids; - m_enabled = enabled; - } - - GLenum m_source; - GLenum m_type; - GLenum m_severity; - GLsizei m_count; - const GLuint* m_ids; - GLboolean m_enabled; -}; - -class GlEGLImageTargetTexture2DOESCommand : public OpenGlCommand -{ -public: - GlEGLImageTargetTexture2DOESCommand() : - OpenGlCommand(false, false, "glEGLImageTargetTexture2DOES") - { - } - - static std::shared_ptr get(GLenum target, void* image) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, image); - return ptr; - } - - void commandToExecute() override - { - ptrEGLImageTargetTexture2DOES(m_target, m_image); - } - -private: - void set(GLenum target, void* image) - { - m_target = target; - m_image = image; - } - - GLenum m_target; - void* m_image; -}; - -class GlEGLImageTargetRenderbufferStorageOESCommand : public OpenGlCommand -{ -public: - GlEGLImageTargetRenderbufferStorageOESCommand() : - OpenGlCommand(false, false, "glEGLImageTargetRenderbufferStorageOES") - { - } - - static std::shared_ptr get(GLenum target, void* image) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(target, image); - return ptr; - } - - void commandToExecute() override - { - ptrEGLImageTargetRenderbufferStorageOES(m_target, m_image); - } - -private: - void set(GLenum target, void* image) - { - m_target = target; - m_image = image; - } - - GLenum m_target; - void* m_image; -}; - -class ShutdownCommand : public OpenGlCommand -{ -public: - ShutdownCommand() : - OpenGlCommand(false, false, "Shutdown", false) - { - } - - static std::shared_ptr get() - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - return ptr; - } - - bool isTimeToShutdown() override - { - return true; - } - - void commandToExecute() override - { - } - -private: - void set() - { - - } -}; - -#if defined(OS_ANDROID) -class EglGetNativeClientBufferANDROIDCommand : public OpenGlCommand -{ -public: - EglGetNativeClientBufferANDROIDCommand() : - OpenGlCommand(true, true, "eglGetNativeClientBufferANDROID") - { - } - - static std::shared_ptr get(const AHardwareBuffer *buffer, EGLClientBuffer& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(buffer, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ptrGetNativeClientBufferANDROID(m_buffer); - } - -private: - void set(const AHardwareBuffer *buffer, EGLClientBuffer& returnValue) - { - m_buffer = buffer; - m_returnValue = &returnValue; - } - - const struct AHardwareBuffer *m_buffer; - EGLClientBuffer* m_returnValue; -}; -#endif -#ifdef MUPENPLUSAPI -//Vid ext functions -class CoreVideoInitCommand : public OpenGlCommand -{ -public: - CoreVideoInitCommand() : - OpenGlCommand(true, false, "CoreVideo_Init", false) - { - } - - static std::shared_ptr get(m64p_error& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ::CoreVideo_Init(); - } - -private: - void set(m64p_error& returnValue) - { - m_returnValue = &returnValue; - } - m64p_error* m_returnValue; -}; - -class CoreVideoQuitCommand : public OpenGlCommand -{ -public: - CoreVideoQuitCommand() : - OpenGlCommand(true, false, "CoreVideo_Quit", false) - { - } - - static std::shared_ptr get() - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(); - return ptr; - } - - void commandToExecute() override - { - ::CoreVideo_Quit(); - } - -private: - void set() - { - } -}; - -class CoreVideoSetVideoModeCommand : public OpenGlCommand -{ -public: - CoreVideoSetVideoModeCommand() : - OpenGlCommand(true, false, "CoreVideo_SetVideoMode", false) - { - } - - static std::shared_ptr get(int screenWidth, int screenHeight, int bitsPerPixel, m64p_video_mode mode, - m64p_video_flags flags, m64p_error& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(screenWidth, screenHeight, bitsPerPixel, mode, flags, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ::CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, m_bitsPerPixel, m_mode, m_flags); - - initGLFunctions(); - } - -private: - void set(int screenWidth, int screenHeight, int bitsPerPixel, m64p_video_mode mode, - m64p_video_flags flags, m64p_error& returnValue) - { - m_screenWidth = screenWidth; - m_screenHeight = screenHeight; - m_bitsPerPixel = bitsPerPixel; - m_mode = mode; - m_flags = flags; - m_returnValue = &returnValue; - } - - int m_screenWidth; - int m_screenHeight; - int m_bitsPerPixel; - m64p_video_mode m_mode; - m64p_video_flags m_flags; - m64p_error* m_returnValue; -}; - -class CoreVideoSetVideoModeWithRateCommand : public OpenGlCommand -{ -public: - CoreVideoSetVideoModeWithRateCommand() : - OpenGlCommand(true, false, "CoreVideo_SetVideoModeWithRate", false) - { - } - - static std::shared_ptr get(int screenWidth, int screenHeight, int refreshRate, int bitsPerPixel, m64p_video_mode mode, - m64p_video_flags flags, m64p_error& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(screenWidth, screenHeight, refreshRate, bitsPerPixel, mode, flags, returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = ::CoreVideo_SetVideoModeWithRate(m_screenWidth, m_screenHeight, m_refreshRate, m_bitsPerPixel, m_mode, m_flags); - - initGLFunctions(); - } - -private: - void set(int screenWidth, int screenHeight, int refreshRate, int bitsPerPixel, m64p_video_mode mode, - m64p_video_flags flags, m64p_error& returnValue) - { - m_screenWidth = screenWidth; - m_screenHeight = screenHeight; - m_refreshRate = refreshRate; - m_bitsPerPixel = bitsPerPixel; - m_mode = mode; - m_flags = flags; - m_returnValue = &returnValue; - } - - int m_screenWidth; - int m_screenHeight; - int m_refreshRate; - int m_bitsPerPixel; - m64p_video_mode m_mode; - m64p_video_flags m_flags; - m64p_error* m_returnValue; -}; - -class CoreVideoGLSetAttributeCommand : public OpenGlCommand -{ -public: - CoreVideoGLSetAttributeCommand() : - OpenGlCommand(true, false, "CoreVideo_GL_SetAttribute", false) - { - } - - static std::shared_ptr get(m64p_GLattr attribute, int value) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(attribute, value); - return ptr; - } - - void commandToExecute() override - { - ::CoreVideo_GL_SetAttribute(m_attribute, m_value); - } - -private: - void set(m64p_GLattr attribute, int value) - { - m_attribute = attribute; - m_value = value; - } - - m64p_GLattr m_attribute; - int m_value; -}; - -class CoreVideoGLGetAttributeCommand : public OpenGlCommand -{ -public: - CoreVideoGLGetAttributeCommand() : - OpenGlCommand(true, false, "CoreVideo_GL_GetAttribute", false) - { - } - - static std::shared_ptr get(m64p_GLattr attribute, int* value) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(attribute, value); - return ptr; - } - - void commandToExecute() override - { - ::CoreVideo_GL_GetAttribute(m_attribute, m_value); - } - -private: - void set(m64p_GLattr attribute, int* value) - { - m_attribute = attribute; - m_value = value; - } - - m64p_GLattr m_attribute; - int* m_value; -}; - -class CoreVideoGLSwapBuffersCommand : public OpenGlCommand -{ -public: - CoreVideoGLSwapBuffersCommand() : - OpenGlCommand(false, false, "CoreVideo_GL_SwapBuffers", false) - { - } - - static std::shared_ptr get(std::function swapBuffersCallback) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(swapBuffersCallback); - return ptr; - } - - void commandToExecute() override - { - ::CoreVideo_GL_SwapBuffers(); - m_swapBuffersCallback(); - } - -private: - void set(std::function swapBuffersCallback) - { - m_swapBuffersCallback = swapBuffersCallback; - } - - std::function m_swapBuffersCallback; -}; -#else - //Zilmar API functions - class WindowsStartCommand : public OpenGlCommand - { - public: - WindowsStartCommand() : - OpenGlCommand(true, false, "WindowsStartCommand", false) - { - } - - static std::shared_ptr get(bool& returnValue) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(returnValue); - return ptr; - } - - void commandToExecute() override - { - *m_returnValue = WindowsWGL::start(); - } - - private: - void set(bool& returnValue) - { - m_returnValue = &returnValue; - } - - bool* m_returnValue; - }; - - class WindowsStopCommand : public OpenGlCommand - { - public: - WindowsStopCommand() : - OpenGlCommand(true, false, "WindowsStopCommand", false) - { - } - - static std::shared_ptr get() - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(); - return ptr; - } - - void commandToExecute() override - { - WindowsWGL::stop(); - } - - private: - void set() - { - } - }; - - class WindowsSwapBuffersCommand : public OpenGlCommand - { - public: - WindowsSwapBuffersCommand() : - OpenGlCommand(false, false, "WindowsSwapBuffersCommand", false) - { - } - - static std::shared_ptr get(std::function swapBuffersCallback) - { - static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); - auto ptr = getFromPool(poolId); - ptr->set(swapBuffersCallback); - return ptr; - } - - void commandToExecute() override - { - WindowsWGL::swapBuffers(); - m_swapBuffersCallback(); - } - - private: - void set(std::function swapBuffersCallback) - { - m_swapBuffersCallback = swapBuffersCallback; - } - - std::function m_swapBuffersCallback; - }; - -#endif -} -#ifdef __clang__ -#pragma clang diagnostic pop -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.cpp b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.cpp deleted file mode 100644 index f8b6b40..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.cpp +++ /dev/null @@ -1,1661 +0,0 @@ -#include "opengl_Wrapper.h" -#include "opengl_WrappedFunctions.h" -#include "Graphics/OpenGLContext/GLFunctions.h" -#include -#include - -namespace opengl { - - bool FunctionWrapper::m_threaded_wrapper = false; - bool FunctionWrapper::m_shutdown = false; - int FunctionWrapper::m_swapBuffersQueued = 0; - bool FunctionWrapper::m_fastVertexAttributes = false; - std::thread FunctionWrapper::m_commandExecutionThread; - std::mutex FunctionWrapper::m_condvarMutex; - std::condition_variable FunctionWrapper::m_condition; -#if defined(GL_DEBUG) && defined(GL_PROFILE) - std::map FunctionWrapper::m_functionProfiling; - std::chrono::time_point FunctionWrapper::m_lastProfilingOutput; -#endif - BlockingReaderWriterQueue> FunctionWrapper::m_commandQueue; - BlockingReaderWriterQueue> FunctionWrapper::m_commandQueueHighPriority; - - - void FunctionWrapper::executeCommand(std::shared_ptr _command) - { -#if !defined(GL_DEBUG) - m_commandQueue.enqueue(_command); - _command->waitOnCommand(); -#elif !defined(GL_PROFILE) - _command->performCommandSingleThreaded(); -#else - auto callStartTime = std::chrono::high_resolution_clock::now(); - _command->performCommandSingleThreaded(); - std::chrono::duration callDuration = std::chrono::high_resolution_clock::now() - callStartTime; - - ++m_functionProfiling[_command->getFunctionName()].m_callCount; - m_functionProfiling[_command->getFunctionName()].m_totalTime += callDuration.count(); - - logProfilingData(); -#endif - } - - void FunctionWrapper::executePriorityCommand(std::shared_ptr _command) - { -#if !defined(GL_DEBUG) - m_commandQueueHighPriority.enqueue(_command); - m_commandQueue.enqueue(nullptr); - _command->waitOnCommand(); -#elif !defined(GL_PROFILE) - _command->performCommandSingleThreaded(); -#else - auto callStartTime = std::chrono::high_resolution_clock::now(); - _command->performCommandSingleThreaded(); - std::chrono::duration callDuration = std::chrono::high_resolution_clock::now() - callStartTime; - - ++m_functionProfiling[_command->getFunctionName()].m_callCount; - m_functionProfiling[_command->getFunctionName()].m_totalTime += callDuration.count(); - - logProfilingData(); -#endif - } - - void FunctionWrapper::commandLoop() - { - bool timeToShutdown = false; - while (!timeToShutdown) { - std::shared_ptr command; - - if (m_commandQueueHighPriority.peek() != nullptr) { - while (m_commandQueueHighPriority.try_dequeue(command)) { - command->performCommand(); - } - } else { - if (m_commandQueue.wait_dequeue_timed(command, std::chrono::milliseconds(10)) && command != nullptr) { - command->performCommand(); - timeToShutdown = command->isTimeToShutdown(); - } - } - } - } - -#if defined(GL_DEBUG) && defined(GL_PROFILE) - void FunctionWrapper::logProfilingData() - { - std::chrono::duration timeSinceLastOutput = std::chrono::high_resolution_clock::now() - m_lastProfilingOutput; - - static const double profilingOutputInterval = 10.0; - if (timeSinceLastOutput.count() > profilingOutputInterval) { - - // Declaring the type of Predicate that accepts 2 pairs and return a bool - typedef std::function, std::pair)> Comparator; - - // Defining a lambda function to compare two pairs. It will compare two pairs using second field - Comparator compFunctor = - [](std::pair elem1, std::pair elem2) - { - return elem1.second.m_totalTime > elem2.second.m_totalTime; - }; - std::set, Comparator> functionSet(m_functionProfiling.begin(), m_functionProfiling.end(), compFunctor); - - LOG(LOG_ERROR, "Profiling output"); - for ( auto element : functionSet ) { - std::stringstream output; - output << element.first << ": call_count=" << element.second.m_callCount - << " duration=" << element.second.m_totalTime - << " average_per_call=" << element.second.m_totalTime/element.second.m_callCount; - LOG(LOG_ERROR, output.str().c_str()); - } - - m_functionProfiling.clear(); - m_lastProfilingOutput = std::chrono::high_resolution_clock::now(); - } - } -#endif - - void FunctionWrapper::setThreadedMode(u32 _threaded) - { -#ifdef GL_DEBUG - m_threaded_wrapper = true; - m_shutdown = false; -#ifdef GL_PROFILE - m_lastProfilingOutput = std::chrono::high_resolution_clock::now(); -#endif -#else - if (_threaded == 1) { - m_threaded_wrapper = true; - m_shutdown = false; - m_commandExecutionThread = std::thread(&FunctionWrapper::commandLoop); - - } - else { - m_threaded_wrapper = false; - m_shutdown = true; - } -#endif - - } - - void FunctionWrapper::wrBlendFunc(GLenum sfactor, GLenum dfactor) - { - if (m_threaded_wrapper) - executeCommand(GlBlendFuncCommand::get(sfactor, dfactor)); - else - ptrBlendFunc(sfactor, dfactor); - } - - void FunctionWrapper::wrBlendFuncSeparate(GLenum sfactorcolor, GLenum dfactorcolor, GLenum sfactoralpha, GLenum dfactoralpha) - { - if (m_threaded_wrapper) - executeCommand(GlBlendFuncSeparateCommand::get(sfactorcolor, dfactorcolor, sfactoralpha, dfactoralpha)); - else - ptrBlendFuncSeparate(sfactorcolor, dfactorcolor, sfactoralpha, dfactoralpha); - } - - - void FunctionWrapper::wrPixelStorei(GLenum pname, GLint param) - { - if (m_threaded_wrapper) - executeCommand(GlPixelStoreiCommand::get(pname, param)); - else - ptrPixelStorei(pname, param); - } - - void FunctionWrapper::wrClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - if (m_threaded_wrapper) - executeCommand(GlClearColorCommand::get(red, green, blue, alpha)); - else - ptrClearColor(red, green, blue, alpha); - } - - void FunctionWrapper::wrCullFace(GLenum mode) - { - if (m_threaded_wrapper) - executeCommand(GlCullFaceCommand::get(mode)); - else - ptrCullFace(mode); - } - - void FunctionWrapper::wrDepthFunc(GLenum func) - { - if (m_threaded_wrapper) - executeCommand(GlDepthFuncCommand::get(func)); - else - ptrDepthFunc(func); - } - - void FunctionWrapper::wrDepthMask(GLboolean flag) - { - if (m_threaded_wrapper) - executeCommand(GlDepthMaskCommand::get(flag)); - else - ptrDepthMask(flag); - } - - void FunctionWrapper::wrDisable(GLenum cap) - { - if (m_threaded_wrapper) - executeCommand(GlDisableCommand::get(cap)); - else - ptrDisable(cap); - } - - void FunctionWrapper::wrEnable(GLenum cap) - { - if (m_threaded_wrapper) - executeCommand(GlEnableCommand::get(cap)); - else - ptrEnable(cap); - } - - void FunctionWrapper::wrDisablei(GLenum target, GLuint index) - { - if (m_threaded_wrapper) - executeCommand(GlDisableiCommand::get(target, index)); - else - ptrDisablei(target, index); - } - - void FunctionWrapper::wrEnablei(GLenum target, GLuint index) - { - if (m_threaded_wrapper) - executeCommand(GlEnableiCommand::get(target, index)); - else - ptrEnablei(target, index); - } - - void FunctionWrapper::wrPolygonOffset(GLfloat factor, GLfloat units) - { - if (m_threaded_wrapper) - executeCommand(GlPolygonOffsetCommand::get(factor, units)); - else - ptrPolygonOffset(factor, units); - } - - void FunctionWrapper::wrScissor(GLint x, GLint y, GLsizei width, GLsizei height) - { - if (m_threaded_wrapper) - executeCommand(GlScissorCommand::get(x, y, width, height)); - else - ptrScissor(x, y, width, height); - } - - void FunctionWrapper::wrViewport(GLint x, GLint y, GLsizei width, GLsizei height) - { - if (m_threaded_wrapper) - executeCommand(GlViewportCommand::get(x, y, width, height)); - else - ptrViewport(x, y, width, height); - } - - void FunctionWrapper::wrBindTexture(GLenum target, GLuint texture) - { - if (m_threaded_wrapper) - executeCommand(GlBindTextureCommand::get(target, texture)); - else - ptrBindTexture(target, texture); - } - - void FunctionWrapper::wrTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) - { - if (m_threaded_wrapper) { - int totalBytes = getTextureBytes(format, type, width, height); - - PoolBufferPointer data; - if (totalBytes > 0 && pixels != nullptr) { - data = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(pixels), totalBytes); - } - - if (totalBytes < 0) { - LOG(LOG_ERROR, "INVALID TEXTURE: format=%d type=%d total=%d", format, type, totalBytes); - } - - executeCommand(GlTexImage2DCommand::get(target, level, internalformat, width, height, border, - format, type, data)); - } - else - ptrTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); - } - - void FunctionWrapper::wrTexParameteri(GLenum target, GLenum pname, GLint param) - { - if (m_threaded_wrapper) - executeCommand(GlTexParameteriCommand::get(target, pname, param)); - else - ptrTexParameteri(target, pname, param); - } - - void FunctionWrapper::wrGetIntegerv(GLenum pname, GLint* data) - { - if (m_threaded_wrapper) - executeCommand(GlGetIntegervCommand::get(pname, data)); - else - ptrGetIntegerv(pname, data); - } - - const GLubyte* FunctionWrapper::wrGetString(GLenum name) - { - const GLubyte* returnValue; - - if (m_threaded_wrapper) - executeCommand(GlGetStringCommand::get(name, returnValue)); - else - returnValue = ptrGetString(name); - - return returnValue; - } - - void FunctionWrapper::wrReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) - { - if (m_threaded_wrapper) - if (pixels == nullptr) { - GlReadPixelsAsyncCommand::setBoundBuffer(GlBindBufferCommand::getBoundBuffer(GL_PIXEL_PACK_BUFFER)); - executeCommand(GlReadPixelsAsyncCommand::get(x, y, width, height, format, type)); - } else { - executeCommand(GlReadPixelsCommand::get(x, y, width, height, format, type, pixels)); - } - else - ptrReadPixels(x, y, width, height, format, type, pixels); - } - - void FunctionWrapper::wrTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) - { - if (m_threaded_wrapper) { - int totalBytes = getTextureBytes(format, type, width, height); - - PoolBufferPointer data; - if (totalBytes > 0 && pixels != nullptr) { - data = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(pixels), totalBytes); - } - - if (totalBytes < 0) { - LOG(LOG_ERROR, "INVALID TEXTURE: format=%d type=%d total=%d", format, type, totalBytes); - } - - executeCommand(GlTexSubImage2DUnbufferedCommand::get(target, level, xoffset, yoffset, width, height, format, type, data)); - } else - ptrTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); - } - - void FunctionWrapper::wrDrawArrays(GLenum mode, GLint first, GLsizei count) - { - if (m_threaded_wrapper) { - if (m_fastVertexAttributes) { - executeCommand(GlDrawArraysCommand::get(mode, first, count)); - } else { - const char* ptr = GlVertexAttribPointerManager::getSmallestPtr(); - PoolBufferPointer buffer = OpenGlCommand::m_ringBufferPool.createPoolBuffer(ptr, (count + 1)*GlVertexAttribPointerManager::getStride()); - executeCommand(GlDrawArraysUnbufferedCommand::get(mode, first, count, buffer)); - } - } else { - ptrDrawArrays(mode, first, count); - } - } - - GLenum FunctionWrapper::wrGetError() - { -#ifdef GL_DEBUG - GLenum returnValue; - - if (m_threaded_wrapper) - executeCommand(GlGetErrorCommand::get(returnValue)); - else - returnValue = ptrGetError(); - - return returnValue; -#else - return GL_NO_ERROR; -#endif - } - - void FunctionWrapper::wrDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) - { - if (!m_threaded_wrapper) { - ptrDrawElements(mode, count, type, indices); - return; - } - - int typeSizeBytes; - unsigned int maxElementIndex; - - switch (type) { - case GL_UNSIGNED_BYTE: - typeSizeBytes = 1; - maxElementIndex = 0; - for (int index = 0; index < count; ++index) { - unsigned int value = reinterpret_cast(indices)[index]; - if (maxElementIndex < value) maxElementIndex = value; - } - break; - case GL_UNSIGNED_SHORT: - typeSizeBytes = 2; - maxElementIndex = 0; - for (int index = 0; index < count; ++index) { - unsigned int value = reinterpret_cast(indices)[index]; - if (maxElementIndex < value) maxElementIndex = value; - } - break; - case GL_UNSIGNED_INT: - typeSizeBytes = 4; - maxElementIndex = 0; - for (int index = 0; index < count; ++index) { - unsigned int value = reinterpret_cast(indices)[index]; - if (maxElementIndex < value) maxElementIndex = value; - } - break; - default: - typeSizeBytes = 1; - maxElementIndex = 0; - for (int index = 0; index < count; ++index) { - unsigned int value = reinterpret_cast(indices)[index]; - if (maxElementIndex < value) maxElementIndex = value; - } - } - - const char* ptr = GlVertexAttribPointerManager::getSmallestPtr(); - PoolBufferPointer buffer = OpenGlCommand::m_ringBufferPool.createPoolBuffer(ptr, (maxElementIndex + 1)*GlVertexAttribPointerManager::getStride()); - PoolBufferPointer elementsCopy = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(indices), count*typeSizeBytes); - - executeCommand(GlDrawElementsUnbufferedCommand::get(mode, count, type, elementsCopy, buffer)); - } - - void FunctionWrapper::wrLineWidth(GLfloat width) - { - if (m_threaded_wrapper) - executeCommand(GlLineWidthCommand::get(width)); - else - ptrLineWidth(width); - } - - void FunctionWrapper::wrClear(GLbitfield mask) - { - if (m_threaded_wrapper) - executeCommand(GlClearCommand::get(mask)); - else - ptrClear(mask); - } - - void FunctionWrapper::wrClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) - { - if (!m_threaded_wrapper) { - ptrClearBufferfv(buffer, drawbuffer, value); - return; - } - - int numValues = 0; - - switch (buffer) { - case GL_COLOR: - numValues = 4; - break; - case GL_DEPTH: - case GL_STENCIL: - numValues = 1; - break; - default: - numValues = 1; - } - - PoolBufferPointer values = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(value), numValues*sizeof(GLfloat)); - executeCommand(GlClearBufferfvCommand::get(buffer, drawbuffer, values)); - } - - void FunctionWrapper::wrGetFloatv(GLenum pname, GLfloat* data) - { - if (m_threaded_wrapper) - executePriorityCommand(GlGetFloatvCommand::get(pname, data)); - else - ptrGetFloatv(pname, data); - } - - void FunctionWrapper::wrDeleteTextures(GLsizei n, const GLuint *textures) - { - if (m_threaded_wrapper) { - PoolBufferPointer texture = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(textures), n*sizeof(GLuint)); - executeCommand(GlDeleteTexturesCommand::get(n, texture)); - } - else - ptrDeleteTextures(n, textures); - } - - void FunctionWrapper::wrGenTextures(GLsizei n, GLuint* textures) - { - if (m_threaded_wrapper) - executePriorityCommand(GlGenTexturesCommand::get(n, textures)); - else - ptrGenTextures(n, textures); - } - - void FunctionWrapper::wrTexParameterf(GLenum target, GLenum pname, GLfloat param) - { - if (m_threaded_wrapper) - executeCommand(GlTexParameterfCommand::get(target, pname, param)); - else - ptrTexParameterf(target, pname, param); - } - - void FunctionWrapper::wrActiveTexture(GLenum texture) - { - if (m_threaded_wrapper) - executeCommand(GlActiveTextureCommand::get(texture)); - else - ptrActiveTexture(texture); - } - - void FunctionWrapper::wrBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - if (m_threaded_wrapper) - executeCommand(GlBlendColorCommand::get(red, green, blue, alpha)); - else - ptrBlendColor(red, green, blue, alpha); - } - - void FunctionWrapper::wrReadBuffer(GLenum src) - { - if (m_threaded_wrapper) - executeCommand(GlReadBufferCommand::get(src)); - else - ptrReadBuffer(src); - } - - GLuint FunctionWrapper::wrCreateShader(GLenum type) - { - GLuint returnValue; - - if (m_threaded_wrapper) - executeCommand(GlCreateShaderCommand::get(type, returnValue)); - else - returnValue = ptrCreateShader(type); - - return returnValue; - } - - void FunctionWrapper::wrCompileShader(GLuint shader) - { - if (m_threaded_wrapper) - executeCommand(GlCompileShaderCommand::get(shader)); - else - ptrCompileShader(shader); - } - - void FunctionWrapper::wrShaderSource(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length) - { - if (m_threaded_wrapper) { - std::vector stringData(count); - - if (length == nullptr) { - for (unsigned int index = 0; index < stringData.size(); ++index) { - stringData[index] = string[index]; - } - } else { - for (unsigned int index = 0; index < stringData.size(); ++index) { - std::string tempString; - tempString.assign(string[index], length[index]); - stringData[index] = tempString; - } - } - - executeCommand(GlShaderSourceCommand::get(shader, stringData)); - } else - ptrShaderSource(shader, count, string, length); - } - - GLuint FunctionWrapper::wrCreateProgram() - { - GLuint returnValue; - - if (m_threaded_wrapper) - executeCommand(GlCreateProgramCommand::get(returnValue)); - else - returnValue = ptrCreateProgram(); - - return returnValue; - } - - void FunctionWrapper::wrAttachShader(GLuint program, GLuint shader) - { - if (m_threaded_wrapper) - executeCommand(GlAttachShaderCommand::get(program, shader)); - else - ptrAttachShader(program, shader); - } - - void FunctionWrapper::wrLinkProgram(GLuint program) - { - if (m_threaded_wrapper) - executeCommand(GlLinkProgramCommand::get(program)); - else - ptrLinkProgram(program); - } - - void FunctionWrapper::wrUseProgram(GLuint program) - { - if (m_threaded_wrapper) - executeCommand(GlUseProgramCommand::get(program)); - else - ptrUseProgram(program); - } - - GLint FunctionWrapper::wrGetUniformLocation(GLuint program, const GLchar *name) - { - GLint returnValue; - - if (m_threaded_wrapper) - executeCommand(GlGetUniformLocationCommand::get(program, name, returnValue)); - else - returnValue = ptrGetUniformLocation(program, name); - - return returnValue; - } - - void FunctionWrapper::wrUniform1i(GLint location, GLint v0) - { - if (m_threaded_wrapper) - executeCommand(GlUniform1iCommand::get(location, v0)); - else - ptrUniform1i(location, v0); - } - - void FunctionWrapper::wrUniform1f(GLint location, GLfloat v0) - { - if (m_threaded_wrapper) - executeCommand(GlUniform1fCommand::get(location, v0)); - else - ptrUniform1f(location, v0); - } - - void FunctionWrapper::wrUniform2f(GLint location, GLfloat v0, GLfloat v1) - { - if (m_threaded_wrapper) - executeCommand(GlUniform2fCommand::get(location, v0, v1)); - else - ptrUniform2f(location, v0, v1); - } - - void FunctionWrapper::wrUniform2i(GLint location, GLint v0, GLint v1) - { - if (m_threaded_wrapper) - executeCommand(GlUniform2iCommand::get(location, v0, v1)); - else - ptrUniform2i(location, v0, v1); - } - - void FunctionWrapper::wrUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) - { - if (m_threaded_wrapper) - executeCommand(GlUniform4iCommand::get(location, v0, v1, v2, v3)); - else - ptrUniform4i(location, v0, v1, v2, v3); - } - - - void FunctionWrapper::wrUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) - { - if (m_threaded_wrapper) - executeCommand(GlUniform4fCommand::get(location, v0, v1, v2, v3)); - else - ptrUniform4f(location, v0, v1, v2, v3); - } - - void FunctionWrapper::wrUniform3fv(GLint location, GLsizei count, const GLfloat *value) - { - if (m_threaded_wrapper) { - PoolBufferPointer values = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(value), 3 * sizeof(GLfloat) * count); - executeCommand(GlUniform3fvCommand::get(location, count, values)); - } else - ptrUniform3fv(location, count, value); - } - - void FunctionWrapper::wrUniform4fv(GLint location, GLsizei count, const GLfloat *value) - { - if (m_threaded_wrapper) { - PoolBufferPointer values = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(value), 4 * sizeof(GLfloat) * count); - executeCommand(GlUniform4fvCommand::get(location, count, values)); - } else - ptrUniform4fv(location, count, value); - } - - void FunctionWrapper::wrDetachShader(GLuint program, GLuint shader) - { - if (m_threaded_wrapper) - executeCommand(GlDetachShaderCommand::get(program, shader)); - else - ptrDetachShader(program, shader); - } - - void FunctionWrapper::wrDeleteShader(GLuint shader) - { - if (m_threaded_wrapper) - executeCommand(GlDeleteShaderCommand::get(shader)); - else - ptrDeleteShader(shader); - } - - void FunctionWrapper::wrDeleteProgram(GLuint program) - { - if (m_threaded_wrapper) - executeCommand(GlDeleteProgramCommand::get(program)); - else - ptrDeleteProgram(program); - } - - void FunctionWrapper::wrGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei* length, GLchar *infoLog) - { - if (m_threaded_wrapper) - executeCommand(GlGetProgramInfoLogCommand::get(program, bufSize, length, infoLog)); - else - ptrGetProgramInfoLog(program, bufSize, length, infoLog); - } - - void FunctionWrapper::wrGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar *infoLog) - { - if (m_threaded_wrapper) - executeCommand(GlGetShaderInfoLogCommand::get(shader, bufSize, length, infoLog)); - else - ptrGetShaderInfoLog(shader, bufSize, length, infoLog); - } - - void FunctionWrapper::wrGetShaderiv(GLuint shader, GLenum pname, GLint* params) - { - if (m_threaded_wrapper) - executeCommand(GlGetShaderivCommand::get(shader, pname, params)); - else - ptrGetShaderiv(shader, pname, params); - } - - void FunctionWrapper::wrGetProgramiv(GLuint program, GLenum pname, GLint* params) - { - if (m_threaded_wrapper) - executeCommand(GlGetProgramivCommand::get(program, pname, params)); - else - ptrGetProgramiv(program, pname, params); - } - - void FunctionWrapper::wrEnableVertexAttribArray(GLuint index) - { - if (m_threaded_wrapper) { - GlVertexAttribPointerManager::enableVertexAttributeIndex(index); - executeCommand(GlEnableVertexAttribArrayCommand::get(index)); - } - else - ptrEnableVertexAttribArray(index); - } - - void FunctionWrapper::wrDisableVertexAttribArray(GLuint index) - { - if (m_threaded_wrapper) { - GlVertexAttribPointerManager::disableVertexAttributeIndex(index); - executeCommand(GlDisableVertexAttribArrayCommand::get(index)); - } else - ptrDisableVertexAttribArray(index); - } - - void FunctionWrapper::wrVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) - { - if (m_threaded_wrapper) { - if (m_fastVertexAttributes) { - executeCommand(GlVertexAttribPointerBufferedCommand::get(index, size, type, normalized, stride, pointer)); - } else { - GlVertexAttribPointerManager::update(index, size, type, normalized, stride, pointer); - executeCommand(GlVertexAttribPointerUnbufferedCommand::get(index, size, type, normalized, stride, pointer)); - } - } - else - ptrVertexAttribPointer(index, size, type, normalized, stride, pointer); - } - - void FunctionWrapper::wrBindAttribLocation(GLuint program, GLuint index, const GLchar *name) - { - if (m_threaded_wrapper) - executeCommand(GlBindAttribLocationCommand::get(program, index, name)); - else - ptrBindAttribLocation(program, index, name); - } - - void FunctionWrapper::wrVertexAttrib1f(GLuint index, GLfloat x) - { - if (m_threaded_wrapper) - executeCommand(GlVertexAttrib1fCommand::get(index, x)); - else - ptrVertexAttrib1f(index, x); - } - - void FunctionWrapper::wrVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) - { - if (m_threaded_wrapper) - executeCommand(GlVertexAttrib4fCommand::get(index, x, y, z, w)); - else - ptrVertexAttrib4f(index, x, y, z, w); - } - - void FunctionWrapper::wrVertexAttrib4fv(GLuint index, const GLfloat *v) - { - if (m_threaded_wrapper) { - PoolBufferPointer values = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(v), 4 * sizeof(GLfloat)); - executeCommand(GlVertexAttrib4fvCommand::get(index, values)); - } else - ptrVertexAttrib4fv(index, v); - } - - void FunctionWrapper::wrDepthRangef(GLfloat n, GLfloat f) - { - if (m_threaded_wrapper) - executeCommand(GlDepthRangefCommand::get(n, f)); - else - ptrDepthRangef(n, f); - } - - void FunctionWrapper::wrClearDepthf(GLfloat d) - { - if (m_threaded_wrapper) - executeCommand(GlClearDepthfCommand::get(d)); - else - ptrClearDepthf(d); - } - - void FunctionWrapper::wrDrawBuffers(GLsizei n, const GLenum *bufs) - { - if (m_threaded_wrapper) { - PoolBufferPointer bufsPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(bufs), n*sizeof(GLenum)); - executeCommand(GlDrawBuffersCommand::get(n, bufsPtr)); - } else - ptrDrawBuffers(n, bufs); - } - - void FunctionWrapper::wrGenFramebuffers(GLsizei n, GLuint* framebuffers) - { - if (m_threaded_wrapper) - executePriorityCommand(GlGenFramebuffersCommand::get(n, framebuffers)); - else - ptrGenFramebuffers(n, framebuffers); - } - - void FunctionWrapper::wrBindFramebuffer(GLenum target, GLuint framebuffer) - { - if (m_threaded_wrapper) - executeCommand(GlBindFramebufferCommand::get(target, framebuffer)); - else - ptrBindFramebuffer(target, framebuffer); - } - - void FunctionWrapper::wrDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) - { - if (m_threaded_wrapper) { - PoolBufferPointer framebuffersPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(framebuffers), n*sizeof(GLuint)); - executeCommand(GlDeleteFramebuffersCommand::get(n, framebuffersPtr)); - } else - ptrDeleteFramebuffers(n, framebuffers); - } - - void FunctionWrapper::wrFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) - { - if (m_threaded_wrapper) - executeCommand(GlFramebufferTexture2DCommand::get(target, attachment, textarget, texture, level)); - else - ptrFramebufferTexture2D(target, attachment, textarget, texture, level); - } - - void FunctionWrapper::wrTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) - { - if (m_threaded_wrapper) - executeCommand(GlTexImage2DMultisampleCommand::get(target, samples, internalformat, width, height, fixedsamplelocations)); - else - ptrTexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); - } - - void FunctionWrapper::wrTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) - { - if (m_threaded_wrapper) - executeCommand(GlTexStorage2DMultisampleCommand::get(target, samples, internalformat, width, height, fixedsamplelocations)); - else - ptrTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); - } - - void FunctionWrapper::wrGenRenderbuffers(GLsizei n, GLuint* renderbuffers) - { - if (m_threaded_wrapper) - executePriorityCommand(GlGenRenderbuffersCommand::get(n, renderbuffers)); - else - ptrGenRenderbuffers(n, renderbuffers); - } - - void FunctionWrapper::wrBindRenderbuffer(GLenum target, GLuint renderbuffer) - { - if (m_threaded_wrapper) - executeCommand(GlBindRenderbufferCommand::get(target, renderbuffer)); - else - ptrBindRenderbuffer(target, renderbuffer); - } - - void FunctionWrapper::wrRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) - { - if (m_threaded_wrapper) - executeCommand(GlRenderbufferStorageCommand::get(target, internalformat, width, height)); - else - ptrRenderbufferStorage(target, internalformat, width, height); - } - - void FunctionWrapper::wrDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) - { - if (m_threaded_wrapper) { - PoolBufferPointer renderbuffersPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(renderbuffers), n*sizeof(GLuint)); - executeCommand(GlDeleteRenderbuffersCommand::get(n, renderbuffersPtr)); - } else - ptrDeleteRenderbuffers(n, renderbuffers); - } - - void FunctionWrapper::wrFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) - { - if (m_threaded_wrapper) - executeCommand(GlFramebufferRenderbufferCommand::get(target, attachment, renderbuffertarget, renderbuffer)); - else - ptrFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); - } - - GLenum FunctionWrapper::wrCheckFramebufferStatus(GLenum target) - { -#ifdef GL_DEBUG - GLenum returnValue; - - if (m_threaded_wrapper) - executeCommand(GlCheckFramebufferStatusCommand::get(target, returnValue)); - else - returnValue = ptrCheckFramebufferStatus(target); - - return returnValue; -#else - return GL_FRAMEBUFFER_COMPLETE; -#endif - } - - void FunctionWrapper::wrBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) - { - if (m_threaded_wrapper) - executeCommand(GlBlitFramebufferCommand::get(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); - else - ptrBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - } - - void FunctionWrapper::wrGenVertexArrays(GLsizei n, GLuint* arrays) - { - if (m_threaded_wrapper) - executePriorityCommand(GlGenVertexArraysCommand::get(n, arrays)); - else - ptrGenVertexArrays(n, arrays); - } - - void FunctionWrapper::wrBindVertexArray(GLuint array) - { - if (m_threaded_wrapper) - executeCommand(GlBindVertexArrayCommand::get(array)); - else - ptrBindVertexArray(array); - } - - void FunctionWrapper::wrDeleteVertexArrays(GLsizei n, const GLuint *arrays) - { - if (m_threaded_wrapper) { - PoolBufferPointer arraysPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(arrays), n*sizeof(GLuint)); - executeCommand(GlDeleteVertexArraysCommand::get(n, arraysPtr)); - } else - ptrDeleteVertexArrays(n, arrays); - } - - void FunctionWrapper::wrGenBuffers(GLsizei n, GLuint* buffers) - { - if (m_threaded_wrapper) - executePriorityCommand(GlGenBuffersCommand::get(n, buffers)); - else - ptrGenBuffers(n, buffers); - } - - void FunctionWrapper::wrBindBuffer(GLenum target, GLuint buffer) - { - if (m_threaded_wrapper) { - GlBindBufferCommand::setBoundBuffer(target, buffer); - executeCommand(GlBindBufferCommand::get(target, buffer)); - } - else - ptrBindBuffer(target, buffer); - } - - void FunctionWrapper::wrBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) - { - if (m_threaded_wrapper) { - if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) - m_fastVertexAttributes = true; - - PoolBufferPointer dataPtr; - if (data != nullptr) { - dataPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(data), size); - } - executeCommand(GlBufferDataCommand::get(target, size, dataPtr, usage)); - } - else - ptrBufferData(target, size, data, usage); - } - - void FunctionWrapper::wrMapBuffer(GLenum target, GLenum access) - { - if (m_threaded_wrapper) - executeCommand(GlMapBufferCommand::get(target, access)); - else - ptrMapBuffer(target, access); - } - - void* FunctionWrapper::wrMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) - { - void* returnValue; - - if (m_threaded_wrapper) { - GLuint boundPixelBuffer = GlReadPixelsAsyncCommand::getBoundBuffer(); - if (target == GL_PIXEL_PACK_BUFFER && access == GL_MAP_READ_BIT && - GlBindBufferCommand::getBoundBuffer(GL_PIXEL_PACK_BUFFER) != boundPixelBuffer) { - executeCommand(GlMapBufferRangeReadAsyncCommand::get(target, offset, length, access)); - GLuint buffer = GlBindBufferCommand::getBoundBuffer(target); - returnValue = GlMapBufferRangeReadAsyncCommand::getData(buffer, length)->data(); - } - else if (access == GlMapBufferRangeWriteAsyncCommand::WRITE_ACCESS_ASYNC) { - GlMapBufferRangeWriteAsyncCommand::setTemp(target, offset, length, access); - returnValue = GlMapBufferRangeWriteAsyncCommand::getData(target, length)->data(); - } - else { - executeCommand(GlMapBufferRangeCommand::get(target, offset, length, access, returnValue)); - } - } - else { - returnValue = ptrMapBufferRange(target, offset, length, access); - } - - return returnValue; - } - - GLboolean FunctionWrapper::wrUnmapBuffer(GLenum target) - { - GLboolean returnValue = GL_TRUE; - - if (m_threaded_wrapper) { - - GLbitfield accessTemp = GlMapBufferRangeWriteAsyncCommand::getTempAccess(); - GLenum targetTemp = GlMapBufferRangeWriteAsyncCommand::getTempTarget(); - - if (accessTemp == GlMapBufferRangeWriteAsyncCommand::WRITE_ACCESS_ASYNC && - target == targetTemp) { - GLintptr offsetTemp = GlMapBufferRangeWriteAsyncCommand::getTempOffset(); - GLsizeiptr lengthTemp = GlMapBufferRangeWriteAsyncCommand::getTempLength(); - auto dataToCopy = GlMapBufferRangeWriteAsyncCommand::getData(targetTemp, lengthTemp); - - PoolBufferPointer buffer = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(dataToCopy->data()), dataToCopy->size()); - executeCommand(GlMapBufferRangeWriteAsyncCommand::get(targetTemp, offsetTemp, lengthTemp, accessTemp, buffer)); - GlMapBufferRangeWriteAsyncCommand::setTemp(0, 0, 0, 0); - } - - executeCommand(GlUnmapBufferAsyncCommand::get(target)); - } else - returnValue = ptrUnmapBuffer(target); - - return returnValue; - } - - void FunctionWrapper::wrDeleteBuffers(GLsizei n, const GLuint *buffers) - { - if (m_threaded_wrapper) { - PoolBufferPointer buffersPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(buffers), n*sizeof(GLuint)); - executeCommand(GlDeleteBuffersCommand::get(n, buffersPtr)); - } - else - ptrDeleteBuffers(n, buffers); - } - - void FunctionWrapper::wrBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) - { - if (m_threaded_wrapper) - executeCommand(GlBindImageTextureCommand::get(unit, texture, level, layered, layer, access, format)); - else - ptrBindImageTexture(unit, texture, level, layered, layer, access, format); - } - - void FunctionWrapper::wrMemoryBarrier(GLbitfield barriers) - { - if (m_threaded_wrapper) - executeCommand(GlMemoryBarrierCommand::get(barriers)); - else - ptrMemoryBarrier(barriers); - } - - void FunctionWrapper::wrTextureBarrier() - { - if (m_threaded_wrapper) - executeCommand(GlTextureBarrierCommand::get()); - else - ptrTextureBarrier(); - } - - void FunctionWrapper::wrTextureBarrierNV() - { - if (m_threaded_wrapper) - executeCommand(GlTextureBarrierNVCommand::get()); - else - ptrTextureBarrierNV(); - } - - const GLubyte* FunctionWrapper::wrGetStringi(GLenum name, GLuint index) - { - const GLubyte* returnValue; - - if (m_threaded_wrapper) - executePriorityCommand(GlGetStringiCommand::get(name, index, returnValue)); - else - returnValue = ptrGetStringi(name, index); - - return returnValue; - } - - void FunctionWrapper::wrInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments) - { - if (m_threaded_wrapper) { - PoolBufferPointer attachmentsPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(attachments), numAttachments*sizeof(GLenum)); - executeCommand(GlInvalidateFramebufferCommand::get(target, numAttachments, attachmentsPtr)); - } else - ptrInvalidateFramebuffer(target, numAttachments, attachments); - } - - void FunctionWrapper::wrBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags) - { - if (m_threaded_wrapper) { - if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) - m_fastVertexAttributes = true; - - PoolBufferPointer dataPtr; - if (data != nullptr) { - dataPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(data), size); - } - - executeCommand(GlBufferStorageCommand::get(target, size, dataPtr, flags)); - } else - ptrBufferStorage(target, size, data, flags); - } - - GLsync FunctionWrapper::wrFenceSync(GLenum condition, GLbitfield flags) - { - GLsync returnValue; - - if (m_threaded_wrapper) - executePriorityCommand(GlFenceSyncCommand::get(condition, flags, returnValue)); - else - returnValue = ptrFenceSync(condition, flags); - - return returnValue; - } - - void FunctionWrapper::wrClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) - { - if (m_threaded_wrapper) - executePriorityCommand(GlClientWaitSyncCommand::get(sync, flags, timeout)); - else - ptrClientWaitSync(sync, flags, timeout); - } - - void FunctionWrapper::wrDeleteSync(GLsync sync) - { - if (m_threaded_wrapper) - executeCommand(GlDeleteSyncCommand::get(sync)); - else - ptrDeleteSync(sync); - } - - GLuint FunctionWrapper::wrGetUniformBlockIndex(GLuint program, GLchar *uniformBlockName) - { - GLuint returnValue; - - if (m_threaded_wrapper) - executeCommand(GlGetUniformBlockIndexCommand::get(program, uniformBlockName, returnValue)); - else - returnValue = ptrGetUniformBlockIndex(program, uniformBlockName); - - return returnValue; - } - - void FunctionWrapper::wrUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) - { - if (m_threaded_wrapper) - executeCommand(GlUniformBlockBindingCommand::get(program, uniformBlockIndex, uniformBlockBinding)); - else - ptrUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); - } - - void FunctionWrapper::wrGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) - { - if (m_threaded_wrapper) - executeCommand(GlGetActiveUniformBlockivCommand::get(program, uniformBlockIndex, pname, params)); - else - ptrGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params); - } - - void FunctionWrapper::wrGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint* uniformIndices) - { - if (m_threaded_wrapper) - executeCommand(GlGetUniformIndicesCommand::get(program, uniformCount, uniformNames, uniformIndices)); - else - ptrGetUniformIndices(program, uniformCount, uniformNames, uniformIndices); - } - - void FunctionWrapper::wrGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint* params) - { - if (m_threaded_wrapper) - executeCommand(GlGetActiveUniformsivCommand::get(program, uniformCount, uniformIndices, pname, params)); - else - ptrGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params); - } - - void FunctionWrapper::wrBindBufferBase(GLenum target, GLuint index, GLuint buffer) - { - if (m_threaded_wrapper) - executeCommand(GlBindBufferBaseCommand::get(target, index, buffer)); - else - ptrBindBufferBase(target, index, buffer); - } - - void FunctionWrapper::wrBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data) - { - if (m_threaded_wrapper) { - PoolBufferPointer dataPtr; - if (data != nullptr) { - dataPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(data), size); - } - - executeCommand(GlBufferSubDataCommand::get(target, offset, size, dataPtr)); - } else - ptrBufferSubData(target, offset, size, data); - } - - void FunctionWrapper::wrGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void *binary) - { - if (m_threaded_wrapper) - executeCommand(GlGetProgramBinaryCommand::get(program, bufSize, length, binaryFormat, binary)); - else - ptrGetProgramBinary(program, bufSize, length, binaryFormat, binary); - } - - void FunctionWrapper::wrProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length) - { - if (m_threaded_wrapper) { - PoolBufferPointer binaryPtr = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(binary), length); - executeCommand(GlProgramBinaryCommand::get(program, binaryFormat, binaryPtr, length)); - } else - ptrProgramBinary(program, binaryFormat, binary, length); - } - - void FunctionWrapper::wrProgramParameteri(GLuint program, GLenum pname, GLint value) - { - if (m_threaded_wrapper) - executeCommand(GlProgramParameteriCommand::get(program, pname, value)); - else - ptrProgramParameteri(program, pname, value); - } - - void FunctionWrapper::wrTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) - { - if (m_threaded_wrapper) - executeCommand(GlTexStorage2DCommand::get(target, levels, internalformat, width, height)); - else - ptrTexStorage2D(target, levels, internalformat, width, height); - } - - void FunctionWrapper::wrTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) - { - if (m_threaded_wrapper) - executeCommand(GlTextureStorage2DCommand::get(texture, levels, internalformat, width, height)); - else - ptrTextureStorage2D(texture, levels, internalformat, width, height); - } - - void FunctionWrapper::wrTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) - { - if (m_threaded_wrapper) { - PoolBufferPointer data; - int totalBytes = getTextureBytes(format, type, width, height); - if (totalBytes > 0 && pixels != nullptr) { - data = OpenGlCommand::m_ringBufferPool.createPoolBuffer(reinterpret_cast(pixels), totalBytes); - } - - if (totalBytes < 0) { - LOG(LOG_ERROR, "INVALID TEXTURE: format=%d type=%d total=%d", format, type, totalBytes); - } - - executeCommand(GlTextureSubImage2DUnbufferedCommand::get(texture, level, xoffset, yoffset, - width, height, format, type, data)); - } else - ptrTextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, pixels); - } - - void FunctionWrapper::wrTextureStorage2DMultisample(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) - { - if (m_threaded_wrapper) - executeCommand(GlTextureStorage2DMultisampleCommand::get(texture, target, samples, internalformat, width, height, fixedsamplelocations)); - else - ptrTextureStorage2DMultisample(texture, target, samples, internalformat, width, height, fixedsamplelocations); - } - - void FunctionWrapper::wrTextureParameteri(GLuint texture, GLenum pname, GLint param) - { - if (m_threaded_wrapper) - executeCommand(GlTextureParameteriCommand::get(texture, pname, param)); - else - ptrTextureParameteri(texture, pname, param); - } - - void FunctionWrapper::wrTextureParameterf(GLuint texture, GLenum pname, GLfloat param) - { - if (m_threaded_wrapper) - executeCommand(GlTextureParameterfCommand::get(texture, pname, param)); - else - ptrTextureParameterf(texture, pname, param); - } - - void FunctionWrapper::wrCreateTextures(GLenum target, GLsizei n, GLuint* textures) - { - if (m_threaded_wrapper) - executePriorityCommand(GlCreateTexturesCommand::get(target, n, textures)); - else - ptrCreateTextures(target, n, textures); - } - - void FunctionWrapper::wrCreateBuffers(GLsizei n, GLuint* buffers) - { - if (m_threaded_wrapper) - executePriorityCommand(GlCreateBuffersCommand::get(n, buffers)); - else - ptrCreateBuffers(n, buffers); - } - - void FunctionWrapper::wrCreateFramebuffers(GLsizei n, GLuint* framebuffers) - { - if (m_threaded_wrapper) - executePriorityCommand(GlCreateFramebuffersCommand::get(n, framebuffers)); - else - ptrCreateFramebuffers(n, framebuffers); - } - - void FunctionWrapper::wrNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) - { - if (m_threaded_wrapper) - executeCommand(GlNamedFramebufferTextureCommand::get(framebuffer, attachment, texture, level)); - else - ptrNamedFramebufferTexture(framebuffer, attachment, texture, level); - } - - void FunctionWrapper::wrDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const u16* indices, GLint basevertex) - { - if (m_threaded_wrapper) - executeCommand(GlDrawRangeElementsBaseVertexCommand::get(mode, start, end, count, type, indices, basevertex)); - else - ptrDrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex); - } - - void FunctionWrapper::wrFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) - { - if (m_threaded_wrapper) - executeCommand(GlFlushMappedBufferRangeCommand::get(target, offset, length)); - else - ptrFlushMappedBufferRange(target, offset, length); - } - - void FunctionWrapper::wrFinish() - { - if (m_threaded_wrapper) - executeCommand(GlFinishCommand::get()); - else - ptrFinish(); - } - - void FunctionWrapper::wrCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) - { - if (m_threaded_wrapper) - executeCommand(GlCopyTexImage2DCommand::get(target, level, internalformat, x, y, width, height, border)); - else - ptrCopyTexImage2D(target, level, internalformat, x, y, width, height, border); - } - - void FunctionWrapper::wrDebugMessageCallback(GLDEBUGPROC callback, const void *userParam) - { - if (m_threaded_wrapper) - executeCommand(GlDebugMessageCallbackCommand::get(callback, userParam)); - else - ptrDebugMessageCallback(callback, userParam); - } - - void FunctionWrapper::wrDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled) - { - if (m_threaded_wrapper) - executeCommand(GlDebugMessageControlCommand::get(source, type, severity, count, ids, enabled)); - else - ptrDebugMessageControl(source, type, severity, count, ids, enabled); - } - - void FunctionWrapper::wrEGLImageTargetTexture2DOES(GLenum target, void* image) - { - if (m_threaded_wrapper) - executeCommand(GlEGLImageTargetTexture2DOESCommand::get(target, image)); - else - ptrEGLImageTargetTexture2DOES(target, image); - } - - void FunctionWrapper::wrEGLImageTargetRenderbufferStorageOES(GLenum target, void* image) - { - if (m_threaded_wrapper) - executeCommand(GlEGLImageTargetRenderbufferStorageOESCommand::get(target, image)); - else - ptrEGLImageTargetRenderbufferStorageOES(target, image); - } - -#if defined(OS_ANDROID) - EGLClientBuffer FunctionWrapper::ewrGetNativeClientBufferANDROID(const AHardwareBuffer *buffer) - { - EGLClientBuffer returnValue; - - if (m_threaded_wrapper) - executeCommand(EglGetNativeClientBufferANDROIDCommand::get(buffer, returnValue)); - else - returnValue = ptrGetNativeClientBufferANDROID(buffer); - - return returnValue; - } - -#endif - -#ifdef MUPENPLUSAPI - - m64p_error FunctionWrapper::CoreVideo_Init() - { - m64p_error returnValue; - if (m_threaded_wrapper) - executeCommand(CoreVideoInitCommand::get(returnValue)); - else - CoreVideoInitCommand::get(returnValue)->performCommandSingleThreaded(); - return returnValue; - } - - void FunctionWrapper::CoreVideo_Quit() - { - if (m_threaded_wrapper) { - executeCommand(CoreVideoQuitCommand::get()); - executeCommand(ShutdownCommand::get()); - } - else - CoreVideoQuitCommand::get()->performCommandSingleThreaded(); - - m_shutdown = true; - -#ifndef GL_DEBUG - if (m_threaded_wrapper) { - m_condition.notify_all(); - m_commandExecutionThread.join(); - } -#endif - } - - m64p_error FunctionWrapper::CoreVideo_SetVideoMode(int screenWidth, int screenHeight, int bitsPerPixel, m64p_video_mode mode, m64p_video_flags flags) - { - m64p_error returnValue; - - if (m_threaded_wrapper) - executeCommand(CoreVideoSetVideoModeCommand::get(screenWidth, screenHeight, bitsPerPixel, mode, flags, returnValue)); - else - CoreVideoSetVideoModeCommand::get(screenWidth, screenHeight, bitsPerPixel, mode, flags, returnValue)->performCommandSingleThreaded(); - - return returnValue; - } - - m64p_error FunctionWrapper::CoreVideo_SetVideoModeWithRate(int screenWidth, int screenHeight, int refreshRate, int bitsPerPixel, m64p_video_mode mode, m64p_video_flags flags) - { - m64p_error returnValue; - - if (m_threaded_wrapper) - executeCommand(CoreVideoSetVideoModeWithRateCommand::get(screenWidth, screenHeight, refreshRate, bitsPerPixel, mode, flags, returnValue)); - else - CoreVideoSetVideoModeWithRateCommand::get(screenWidth, screenHeight, refreshRate, bitsPerPixel, mode, flags, returnValue)->performCommandSingleThreaded(); - - return returnValue; - } - - void FunctionWrapper::CoreVideo_GL_SetAttribute(m64p_GLattr attribute, int value) - { - if (m_threaded_wrapper) - executeCommand(CoreVideoGLSetAttributeCommand::get(attribute, value)); - else - CoreVideoGLSetAttributeCommand::get(attribute, value)->performCommandSingleThreaded(); - } - - void FunctionWrapper::CoreVideo_GL_GetAttribute(m64p_GLattr attribute, int *value) - { - if (m_threaded_wrapper) - executeCommand(CoreVideoGLGetAttributeCommand::get(attribute, value)); - else - CoreVideoGLGetAttributeCommand::get(attribute, value)->performCommandSingleThreaded(); - } - - void FunctionWrapper::CoreVideo_GL_SwapBuffers() - { - ++m_swapBuffersQueued; - - if (m_threaded_wrapper) - executeCommand(CoreVideoGLSwapBuffersCommand::get([]{ReduceSwapBuffersQueued();})); - else - CoreVideoGLSwapBuffersCommand::get([]{ReduceSwapBuffersQueued();})->performCommandSingleThreaded(); - } -#else - bool FunctionWrapper::windowsStart() - { - bool returnValue; - - if (m_threaded_wrapper) - executeCommand(WindowsStartCommand::get(returnValue)); - else - WindowsStartCommand::get(returnValue)->performCommandSingleThreaded(); - - return returnValue; - } - - void FunctionWrapper::windowsStop() - { - if (m_threaded_wrapper) { - executeCommand(WindowsStopCommand::get()); - executeCommand(ShutdownCommand::get()); - } else - WindowsStopCommand::get()->performCommandSingleThreaded(); - - m_shutdown = true; - -#ifndef GL_DEBUG - if (m_threaded_wrapper) { - m_condition.notify_all(); - m_commandExecutionThread.join(); - } -#endif - } - - void FunctionWrapper::windowsSwapBuffers() - { - ++m_swapBuffersQueued; - - if (m_threaded_wrapper) - executeCommand(WindowsSwapBuffersCommand::get([]{ReduceSwapBuffersQueued(); })); - else - WindowsSwapBuffersCommand::get([]{ReduceSwapBuffersQueued(); })->performCommandSingleThreaded(); - } - -#endif - - void FunctionWrapper::ReduceSwapBuffersQueued() - { - --m_swapBuffersQueued; - - if (m_swapBuffersQueued <= MAX_SWAP) { - m_condition.notify_all(); - } - } - - void FunctionWrapper::WaitForSwapBuffersQueued() - { - std::unique_lock lock(m_condvarMutex); - - if (!m_shutdown && m_swapBuffersQueued > MAX_SWAP) { - m_condition.wait(lock, []{return FunctionWrapper::m_swapBuffersQueued <= MAX_SWAP; }); - } - } - - - int FunctionWrapper::getTextureBytes(GLenum format, GLenum type, int width, int height) - { - int components = 0; - int bytesPerPixel = 0; - - switch (format) - { - case GL_RED: - case GL_RED_INTEGER: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - case GL_LUMINANCE: - components = 1; - break; - case GL_RG: - case GL_RG_INTEGER: - case GL_DEPTH_STENCIL: - components = 2; - break; - case GL_RGB: - case GL_BGR: - case GL_RGB_INTEGER: - case GL_BGR_INTEGER: - components = 3; - break; - case GL_RGBA: - case GL_BGRA: - case GL_RGBA_INTEGER: - case GL_BGRA_INTEGER: - components = 4; - break; - default: - components = -1; - } - - switch (type) - { - case GL_UNSIGNED_BYTE: - case GL_BYTE: - bytesPerPixel = components * 1; - break; - case GL_UNSIGNED_SHORT: - case GL_SHORT: - case GL_HALF_FLOAT: - bytesPerPixel = components * 2; - break; - case GL_UNSIGNED_INT: - case GL_INT: - case GL_FLOAT: - bytesPerPixel = components * 4; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - bytesPerPixel = 1; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - bytesPerPixel = 2; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - bytesPerPixel = 4; - break; - default: - bytesPerPixel = -1; - } - - int textureSize = bytesPerPixel*width*height; - - if (textureSize < 0) - { - std::stringstream log; - log << "Invalid texture params: component=" << std::dec << components - << " bytesPerPixel=" << bytesPerPixel - << " format=0x" << std::hex << format - << " type=0x" << type - << " width=" << std::dec << width - << " height=" << height - << " size=" << bytesPerPixel*width*height; - LOG(LOG_ERROR, log.str().c_str()); - } - - return textureSize; - } -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.h deleted file mode 100644 index a01696d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.h +++ /dev/null @@ -1,225 +0,0 @@ -#pragma once - -#include "Graphics/OpenGLContext/GLFunctions.h" -#include "readerwriterqueue.h" -#include "opengl_WrappedFunctions.h" -#include "opengl_Command.h" -#include -#include - -#ifdef MUPENPLUSAPI -#include -#endif - -using namespace moodycamel; - -namespace opengl { - - class FunctionWrapper - { - private: - static void executeCommand(std::shared_ptr _command); - - static void executePriorityCommand(std::shared_ptr _command); - - static void commandLoop(); - - static BlockingReaderWriterQueue> m_commandQueue; - static BlockingReaderWriterQueue> m_commandQueueHighPriority; - - static bool m_threaded_wrapper; - static bool m_shutdown; - static int m_swapBuffersQueued; - static bool m_fastVertexAttributes; - static std::thread m_commandExecutionThread; - static std::mutex m_condvarMutex; - static std::condition_variable m_condition; - -#if defined(GL_DEBUG) && defined(GL_PROFILE) - static void logProfilingData(); - - struct FunctionProfilingData - { - double m_totalTime; - int m_callCount; - - FunctionProfilingData() - { - m_totalTime = 0; - m_callCount = 0; - } - }; - static std::map m_functionProfiling; - static std::chrono::time_point m_lastProfilingOutput; -#endif - - static const int MAX_SWAP = 2; - - public: - static void setThreadedMode(u32 _threaded); - - static void wrBlendFunc(GLenum sfactor, GLenum dfactor); - static void wrBlendFuncSeparate(GLenum sfactorcolor, GLenum dfactorcolor, GLenum sfactoralpha, GLenum dfactoralpha); - static void wrPixelStorei(GLenum pname, GLint param); - static void wrClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - static void wrCullFace(GLenum mode); - static void wrDepthFunc(GLenum func); - static void wrDepthMask(GLboolean flag); - static void wrDisable(GLenum cap); - static void wrEnable(GLenum cap); - static void wrDisablei(GLenum target, GLuint index); - static void wrEnablei(GLenum target, GLuint index); - static void wrPolygonOffset(GLfloat factor, GLfloat units); - - static void wrScissor(GLint x, GLint y, GLsizei width, GLsizei height); - static void wrViewport(GLint x, GLint y, GLsizei width, GLsizei height); - static void wrBindTexture(GLenum target, GLuint texture); - static void wrTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); - static void wrTexParameteri(GLenum target, GLenum pname, GLint param); - static void wrGetIntegerv(GLenum pname, GLint* data); - static const GLubyte* wrGetString(GLenum name); - - static void wrReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); - static void wrTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); - static void wrDrawArrays(GLenum mode, GLint first, GLsizei count); - static GLenum wrGetError(); - static void wrDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices); - static void wrLineWidth(GLfloat width); - static void wrClear(GLbitfield mask); - static void wrClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value); - static void wrGetFloatv(GLenum pname, GLfloat* data); - static void wrDeleteTextures(GLsizei n, const GLuint *textures); - static void wrGenTextures(GLsizei n, GLuint* textures); - static void wrTexParameterf(GLenum target, GLenum pname, GLfloat param); - static void wrActiveTexture(GLenum texture); - static void wrBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - static void wrReadBuffer(GLenum src); - - static GLuint wrCreateShader(GLenum type); - static void wrCompileShader(GLuint shader); - static void wrShaderSource(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); - static GLuint wrCreateProgram(); - static void wrAttachShader(GLuint program, GLuint shader); - static void wrLinkProgram(GLuint program); - static void wrUseProgram(GLuint program); - static GLint wrGetUniformLocation(GLuint program, const GLchar *name); - static void wrUniform1i(GLint location, GLint v0); - static void wrUniform1f(GLint location, GLfloat v0); - static void wrUniform2f(GLint location, GLfloat v0, GLfloat v1); - static void wrUniform2i(GLint location, GLint v0, GLint v1); - static void wrUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); - - static void wrUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); - static void wrUniform3fv(GLint location, GLsizei count, const GLfloat *value); - static void wrUniform4fv(GLint location, GLsizei count, const GLfloat *value); - static void wrDetachShader(GLuint program, GLuint shader); - static void wrDeleteShader(GLuint shader); - static void wrDeleteProgram(GLuint program); - static void wrGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei* length, GLchar *infoLog); - static void wrGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar *infoLog); - static void wrGetShaderiv(GLuint shader, GLenum pname, GLint* params); - static void wrGetProgramiv(GLuint program, GLenum pname, GLint* params); - - static void wrEnableVertexAttribArray(GLuint index); - static void wrDisableVertexAttribArray(GLuint index); - static void wrVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); - static void wrBindAttribLocation(GLuint program, GLuint index, const GLchar *name); - static void wrVertexAttrib1f(GLuint index, GLfloat x); - static void wrVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - static void wrVertexAttrib4fv(GLuint index, const GLfloat *v); - - static void wrDepthRangef(GLfloat n, GLfloat f); - static void wrClearDepthf(GLfloat d); - - static void wrDrawBuffers(GLsizei n, const GLenum *bufs); - static void wrGenFramebuffers(GLsizei n, GLuint* framebuffers); - static void wrBindFramebuffer(GLenum target, GLuint framebuffer); - static void wrDeleteFramebuffers(GLsizei n, const GLuint *framebuffers); - static void wrFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - static void wrTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); - static void wrTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); - static void wrGenRenderbuffers(GLsizei n, GLuint* renderbuffers); - static void wrBindRenderbuffer(GLenum target, GLuint renderbuffer); - static void wrRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - static void wrDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); - static void wrFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); - static GLenum wrCheckFramebufferStatus(GLenum target); - static void wrBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); - static void wrGenVertexArrays(GLsizei n, GLuint* arrays); - static void wrBindVertexArray(GLuint array); - static void wrDeleteVertexArrays(GLsizei n, const GLuint *arrays); - static void wrGenBuffers(GLsizei n, GLuint* buffers); - static void wrBindBuffer(GLenum target, GLuint buffer); - static void wrBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage); - static void wrMapBuffer(GLenum target, GLenum access); - static void* wrMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - static GLboolean wrUnmapBuffer(GLenum target); - static void wrDeleteBuffers(GLsizei n, const GLuint *buffers); - static void wrBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); - static void wrMemoryBarrier(GLbitfield barriers); - static void wrTextureBarrier(); - static void wrTextureBarrierNV(); - static const GLubyte* wrGetStringi(GLenum name, GLuint index); - static void wrInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments); - static void wrBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); - static GLsync wrFenceSync(GLenum condition, GLbitfield flags); - static void wrClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); - static void wrDeleteSync(GLsync sync); - - static GLuint wrGetUniformBlockIndex(GLuint program, GLchar *uniformBlockName); - static void wrUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); - static void wrGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params); - static void wrGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint* uniformIndices); - static void wrGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint* params); - static void wrBindBufferBase(GLenum target, GLuint index, GLuint buffer); - static void wrBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); - - static void wrGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void *binary); - static void wrProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); - static void wrProgramParameteri(GLuint program, GLenum pname, GLint value); - - static void wrTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); - static void wrTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); - static void wrTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); - static void wrTextureStorage2DMultisample(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); - static void wrTextureParameteri(GLuint texture, GLenum pname, GLint param); - static void wrTextureParameterf(GLuint texture, GLenum pname, GLfloat param); - static void wrCreateTextures(GLenum target, GLsizei n, GLuint* textures); - static void wrCreateBuffers(GLsizei n, GLuint* buffers); - static void wrCreateFramebuffers(GLsizei n, GLuint* framebuffers); - static void wrNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); - static void wrDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const u16* indices, GLint basevertex); - static void wrFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length); - static void wrFinish(); - static void wrCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - static void wrDebugMessageCallback(GLDEBUGPROC callback, const void *userParam); - static void wrDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); - static void wrEGLImageTargetTexture2DOES(GLenum target, void* image); - static void wrEGLImageTargetRenderbufferStorageOES(GLenum target, void* image); - -#if defined(OS_ANDROID) - static EGLClientBuffer ewrGetNativeClientBufferANDROID(const AHardwareBuffer *buffer); -#endif - -#ifdef MUPENPLUSAPI - //Vid_ext functions - static m64p_error CoreVideo_Init(); - static void CoreVideo_Quit(); - static m64p_error CoreVideo_SetVideoMode(int screenWidth, int screenHeight, int bitsPerPixel, m64p_video_mode mode, m64p_video_flags flags); - static m64p_error CoreVideo_SetVideoModeWithRate(int screenWidth, int screenHeight, int refreshRate, int bitsPerPixel, m64p_video_mode mode, m64p_video_flags flags); - static void CoreVideo_GL_SetAttribute(m64p_GLattr attribute, int value); - static void CoreVideo_GL_GetAttribute(m64p_GLattr attribute, int *value); - static void CoreVideo_GL_SwapBuffers(); -#else - //Windows GL context functions - static bool windowsStart(); - static void windowsStop(); - static void windowsSwapBuffers(); -#endif - - static void ReduceSwapBuffersQueued(); - static void WaitForSwapBuffersQueued(); - - static int getTextureBytes(GLenum format, GLenum type, int width, int height); - }; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/readerwriterqueue.h b/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/readerwriterqueue.h deleted file mode 100644 index 071147c..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/ThreadedOpenGl/readerwriterqueue.h +++ /dev/null @@ -1,906 +0,0 @@ -// ©2013-2016 Cameron Desrochers. -// Distributed under the simplified BSD license (see the license file that -// should have come with this header). - -#pragma once - -#include "atomicops.h" -#include -#include -#include -#include -#include -#include -#include // For malloc/free/abort & size_t -#include -#if __cplusplus > 199711L || _MSC_VER >= 1700 // C++11 or VS2012 -#include -#endif - - -// A lock-free queue for a single-consumer, single-producer architecture. -// The queue is also wait-free in the common path (except if more memory -// needs to be allocated, in which case malloc is called). -// Allocates memory sparingly (O(lg(n) times, amortized), and only once if -// the original maximum size estimate is never exceeded. -// Tested on x86/x64 processors, but semantics should be correct for all -// architectures (given the right implementations in atomicops.h), provided -// that aligned integer and pointer accesses are naturally atomic. -// Note that there should only be one consumer thread and producer thread; -// Switching roles of the threads, or using multiple consecutive threads for -// one role, is not safe unless properly synchronized. -// Using the queue exclusively from one thread is fine, though a bit silly. - -#ifndef MOODYCAMEL_CACHE_LINE_SIZE -#define MOODYCAMEL_CACHE_LINE_SIZE 64 -#endif - -#ifndef MOODYCAMEL_EXCEPTIONS_ENABLED -#if (defined(_MSC_VER) && defined(_CPPUNWIND)) || (defined(__GNUC__) && defined(__EXCEPTIONS)) || (!defined(_MSC_VER) && !defined(__GNUC__)) -#define MOODYCAMEL_EXCEPTIONS_ENABLED -#endif -#endif - -#ifndef MOODYCAMEL_HAS_EMPLACE -#if !defined(_MSC_VER) || _MSC_VER >= 1800 // variadic templates: either a non-MS compiler or VS >= 2013 -#define MOODYCAMEL_HAS_EMPLACE 1 -#endif -#endif - -#ifdef AE_VCPP -#pragma warning(push) -#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) -#pragma warning(disable: 4820) // padding was added -#pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace moodycamel { - -template -class ReaderWriterQueue -{ - // Design: Based on a queue-of-queues. The low-level queues are just - // circular buffers with front and tail indices indicating where the - // next element to dequeue is and where the next element can be enqueued, - // respectively. Each low-level queue is called a "block". Each block - // wastes exactly one element's worth of space to keep the design simple - // (if front == tail then the queue is empty, and can't be full). - // The high-level queue is a circular linked list of blocks; again there - // is a front and tail, but this time they are pointers to the blocks. - // The front block is where the next element to be dequeued is, provided - // the block is not empty. The back block is where elements are to be - // enqueued, provided the block is not full. - // The producer thread owns all the tail indices/pointers. The consumer - // thread owns all the front indices/pointers. Both threads read each - // other's variables, but only the owning thread updates them. E.g. After - // the consumer reads the producer's tail, the tail may change before the - // consumer is done dequeuing an object, but the consumer knows the tail - // will never go backwards, only forwards. - // If there is no room to enqueue an object, an additional block (of - // equal size to the last block) is added. Blocks are never removed. - -public: - typedef T value_type; - - // Constructs a queue that can hold maxSize elements without further - // allocations. If more than MAX_BLOCK_SIZE elements are requested, - // then several blocks of MAX_BLOCK_SIZE each are reserved (including - // at least one extra buffer block). - AE_NO_TSAN explicit ReaderWriterQueue(size_t maxSize = 15) -#ifndef NDEBUG - : enqueuing(false) - ,dequeuing(false) -#endif - { - assert(maxSize > 0); - assert(MAX_BLOCK_SIZE == ceilToPow2(MAX_BLOCK_SIZE) && "MAX_BLOCK_SIZE must be a power of 2"); - assert(MAX_BLOCK_SIZE >= 2 && "MAX_BLOCK_SIZE must be at least 2"); - - Block* firstBlock = nullptr; - - largestBlockSize = ceilToPow2(maxSize + 1); // We need a spare slot to fit maxSize elements in the block - if (largestBlockSize > MAX_BLOCK_SIZE * 2) { - // We need a spare block in case the producer is writing to a different block the consumer is reading from, and - // wants to enqueue the maximum number of elements. We also need a spare element in each block to avoid the ambiguity - // between front == tail meaning "empty" and "full". - // So the effective number of slots that are guaranteed to be usable at any time is the block size - 1 times the - // number of blocks - 1. Solving for maxSize and applying a ceiling to the division gives us (after simplifying): - size_t initialBlockCount = (maxSize + MAX_BLOCK_SIZE * 2 - 3) / (MAX_BLOCK_SIZE - 1); - largestBlockSize = MAX_BLOCK_SIZE; - Block* lastBlock = nullptr; - for (size_t i = 0; i != initialBlockCount; ++i) { - auto block = make_block(largestBlockSize); - if (block == nullptr) { -#ifdef MOODYCAMEL_EXCEPTIONS_ENABLED - throw std::bad_alloc(); -#else - abort(); -#endif - } - if (firstBlock == nullptr) { - firstBlock = block; - } - else { - lastBlock->next = block; - } - lastBlock = block; - block->next = firstBlock; - } - } - else { - firstBlock = make_block(largestBlockSize); - if (firstBlock == nullptr) { -#ifdef MOODYCAMEL_EXCEPTIONS_ENABLED - throw std::bad_alloc(); -#else - abort(); -#endif - } - firstBlock->next = firstBlock; - } - frontBlock = firstBlock; - tailBlock = firstBlock; - - // Make sure the reader/writer threads will have the initialized memory setup above: - fence(memory_order_sync); - } - - // Note: The queue should not be accessed concurrently while it's - // being moved. It's up to the user to synchronize this. - AE_NO_TSAN ReaderWriterQueue(ReaderWriterQueue&& other) - : frontBlock(other.frontBlock.load()), - tailBlock(other.tailBlock.load()), - largestBlockSize(other.largestBlockSize) -#ifndef NDEBUG - ,enqueuing(false) - ,dequeuing(false) -#endif - { - other.largestBlockSize = 32; - Block* b = other.make_block(other.largestBlockSize); - if (b == nullptr) { -#ifdef MOODYCAMEL_EXCEPTIONS_ENABLED - throw std::bad_alloc(); -#else - abort(); -#endif - } - b->next = b; - other.frontBlock = b; - other.tailBlock = b; - } - - // Note: The queue should not be accessed concurrently while it's - // being moved. It's up to the user to synchronize this. - ReaderWriterQueue& operator=(ReaderWriterQueue&& other) AE_NO_TSAN - { - Block* b = frontBlock.load(); - frontBlock = other.frontBlock.load(); - other.frontBlock = b; - b = tailBlock.load(); - tailBlock = other.tailBlock.load(); - other.tailBlock = b; - std::swap(largestBlockSize, other.largestBlockSize); - return *this; - } - - // Note: The queue should not be accessed concurrently while it's - // being deleted. It's up to the user to synchronize this. - AE_NO_TSAN ~ReaderWriterQueue() - { - // Make sure we get the latest version of all variables from other CPUs: - fence(memory_order_sync); - - // Destroy any remaining objects in queue and free memory - Block* frontBlock_ = frontBlock; - Block* block = frontBlock_; - do { - Block* nextBlock = block->next; - size_t blockFront = block->front; - size_t blockTail = block->tail; - - for (size_t i = blockFront; i != blockTail; i = (i + 1) & block->sizeMask) { - auto element = reinterpret_cast(block->data + i * sizeof(T)); - element->~T(); - (void)element; - } - - auto rawBlock = block->rawThis; - block->~Block(); - std::free(rawBlock); - block = nextBlock; - } while (block != frontBlock_); - } - - - // Enqueues a copy of element if there is room in the queue. - // Returns true if the element was enqueued, false otherwise. - // Does not allocate memory. - AE_FORCEINLINE bool try_enqueue(T const& element) AE_NO_TSAN - { - return inner_enqueue(element); - } - - // Enqueues a moved copy of element if there is room in the queue. - // Returns true if the element was enqueued, false otherwise. - // Does not allocate memory. - AE_FORCEINLINE bool try_enqueue(T&& element) AE_NO_TSAN - { - return inner_enqueue(std::forward(element)); - } - -#if MOODYCAMEL_HAS_EMPLACE - // Like try_enqueue() but with emplace semantics (i.e. construct-in-place). - template - AE_FORCEINLINE bool try_emplace(Args&&... args) AE_NO_TSAN - { - return inner_enqueue(std::forward(args)...); - } -#endif - - // Enqueues a copy of element on the queue. - // Allocates an additional block of memory if needed. - // Only fails (returns false) if memory allocation fails. - AE_FORCEINLINE bool enqueue(T const& element) AE_NO_TSAN - { - return inner_enqueue(element); - } - - // Enqueues a moved copy of element on the queue. - // Allocates an additional block of memory if needed. - // Only fails (returns false) if memory allocation fails. - AE_FORCEINLINE bool enqueue(T&& element) AE_NO_TSAN - { - return inner_enqueue(std::forward(element)); - } - -#if MOODYCAMEL_HAS_EMPLACE - // Like enqueue() but with emplace semantics (i.e. construct-in-place). - template - AE_FORCEINLINE bool emplace(Args&&... args) AE_NO_TSAN - { - return inner_enqueue(std::forward(args)...); - } -#endif - - // Attempts to dequeue an element; if the queue is empty, - // returns false instead. If the queue has at least one element, - // moves front to result using operator=, then returns true. - template - bool try_dequeue(U& result) AE_NO_TSAN - { -#ifndef NDEBUG - ReentrantGuard guard(this->dequeuing); -#endif - - // High-level pseudocode: - // Remember where the tail block is - // If the front block has an element in it, dequeue it - // Else - // If front block was the tail block when we entered the function, return false - // Else advance to next block and dequeue the item there - - // Note that we have to use the value of the tail block from before we check if the front - // block is full or not, in case the front block is empty and then, before we check if the - // tail block is at the front block or not, the producer fills up the front block *and - // moves on*, which would make us skip a filled block. Seems unlikely, but was consistently - // reproducible in practice. - // In order to avoid overhead in the common case, though, we do a double-checked pattern - // where we have the fast path if the front block is not empty, then read the tail block, - // then re-read the front block and check if it's not empty again, then check if the tail - // block has advanced. - - Block* frontBlock_ = frontBlock.load(); - size_t blockTail = frontBlock_->localTail; - size_t blockFront = frontBlock_->front.load(); - - if (blockFront != blockTail || blockFront != (frontBlock_->localTail = frontBlock_->tail.load())) { - fence(memory_order_acquire); - - non_empty_front_block: - // Front block not empty, dequeue from here - auto element = reinterpret_cast(frontBlock_->data + blockFront * sizeof(T)); - result = std::move(*element); - element->~T(); - - blockFront = (blockFront + 1) & frontBlock_->sizeMask; - - fence(memory_order_release); - frontBlock_->front = blockFront; - } - else if (frontBlock_ != tailBlock.load()) { - fence(memory_order_acquire); - - frontBlock_ = frontBlock.load(); - blockTail = frontBlock_->localTail = frontBlock_->tail.load(); - blockFront = frontBlock_->front.load(); - fence(memory_order_acquire); - - if (blockFront != blockTail) { - // Oh look, the front block isn't empty after all - goto non_empty_front_block; - } - - // Front block is empty but there's another block ahead, advance to it - Block* nextBlock = frontBlock_->next; - // Don't need an acquire fence here since next can only ever be set on the tailBlock, - // and we're not the tailBlock, and we did an acquire earlier after reading tailBlock which - // ensures next is up-to-date on this CPU in case we recently were at tailBlock. - - size_t nextBlockFront = nextBlock->front.load(); - size_t nextBlockTail = nextBlock->localTail = nextBlock->tail.load(); - fence(memory_order_acquire); - - // Since the tailBlock is only ever advanced after being written to, - // we know there's for sure an element to dequeue on it - assert(nextBlockFront != nextBlockTail); - AE_UNUSED(nextBlockTail); - - // We're done with this block, let the producer use it if it needs - fence(memory_order_release); // Expose possibly pending changes to frontBlock->front from last dequeue - frontBlock = frontBlock_ = nextBlock; - - compiler_fence(memory_order_release); // Not strictly needed - - auto element = reinterpret_cast(frontBlock_->data + nextBlockFront * sizeof(T)); - - result = std::move(*element); - element->~T(); - - nextBlockFront = (nextBlockFront + 1) & frontBlock_->sizeMask; - - fence(memory_order_release); - frontBlock_->front = nextBlockFront; - } - else { - // No elements in current block and no other block to advance to - return false; - } - - return true; - } - - - // Returns a pointer to the front element in the queue (the one that - // would be removed next by a call to `try_dequeue` or `pop`). If the - // queue appears empty at the time the method is called, nullptr is - // returned instead. - // Must be called only from the consumer thread. - T* peek() AE_NO_TSAN - { -#ifndef NDEBUG - ReentrantGuard guard(this->dequeuing); -#endif - // See try_dequeue() for reasoning - - Block* frontBlock_ = frontBlock.load(); - size_t blockTail = frontBlock_->localTail; - size_t blockFront = frontBlock_->front.load(); - - if (blockFront != blockTail || blockFront != (frontBlock_->localTail = frontBlock_->tail.load())) { - fence(memory_order_acquire); - non_empty_front_block: - return reinterpret_cast(frontBlock_->data + blockFront * sizeof(T)); - } - else if (frontBlock_ != tailBlock.load()) { - fence(memory_order_acquire); - frontBlock_ = frontBlock.load(); - blockTail = frontBlock_->localTail = frontBlock_->tail.load(); - blockFront = frontBlock_->front.load(); - fence(memory_order_acquire); - - if (blockFront != blockTail) { - goto non_empty_front_block; - } - - Block* nextBlock = frontBlock_->next; - - size_t nextBlockFront = nextBlock->front.load(); - fence(memory_order_acquire); - - assert(nextBlockFront != nextBlock->tail.load()); - return reinterpret_cast(nextBlock->data + nextBlockFront * sizeof(T)); - } - - return nullptr; - } - - // Removes the front element from the queue, if any, without returning it. - // Returns true on success, or false if the queue appeared empty at the time - // `pop` was called. - bool pop() AE_NO_TSAN - { -#ifndef NDEBUG - ReentrantGuard guard(this->dequeuing); -#endif - // See try_dequeue() for reasoning - - Block* frontBlock_ = frontBlock.load(); - size_t blockTail = frontBlock_->localTail; - size_t blockFront = frontBlock_->front.load(); - - if (blockFront != blockTail || blockFront != (frontBlock_->localTail = frontBlock_->tail.load())) { - fence(memory_order_acquire); - - non_empty_front_block: - auto element = reinterpret_cast(frontBlock_->data + blockFront * sizeof(T)); - element->~T(); - - blockFront = (blockFront + 1) & frontBlock_->sizeMask; - - fence(memory_order_release); - frontBlock_->front = blockFront; - } - else if (frontBlock_ != tailBlock.load()) { - fence(memory_order_acquire); - frontBlock_ = frontBlock.load(); - blockTail = frontBlock_->localTail = frontBlock_->tail.load(); - blockFront = frontBlock_->front.load(); - fence(memory_order_acquire); - - if (blockFront != blockTail) { - goto non_empty_front_block; - } - - // Front block is empty but there's another block ahead, advance to it - Block* nextBlock = frontBlock_->next; - - size_t nextBlockFront = nextBlock->front.load(); - size_t nextBlockTail = nextBlock->localTail = nextBlock->tail.load(); - fence(memory_order_acquire); - - assert(nextBlockFront != nextBlockTail); - AE_UNUSED(nextBlockTail); - - fence(memory_order_release); - frontBlock = frontBlock_ = nextBlock; - - compiler_fence(memory_order_release); - - auto element = reinterpret_cast(frontBlock_->data + nextBlockFront * sizeof(T)); - element->~T(); - - nextBlockFront = (nextBlockFront + 1) & frontBlock_->sizeMask; - - fence(memory_order_release); - frontBlock_->front = nextBlockFront; - } - else { - // No elements in current block and no other block to advance to - return false; - } - - return true; - } - - // Returns the approximate number of items currently in the queue. - // Safe to call from both the producer and consumer threads. - inline size_t size_approx() const AE_NO_TSAN - { - size_t result = 0; - Block* frontBlock_ = frontBlock.load(); - Block* block = frontBlock_; - do { - fence(memory_order_acquire); - size_t blockFront = block->front.load(); - size_t blockTail = block->tail.load(); - result += (blockTail - blockFront) & block->sizeMask; - block = block->next.load(); - } while (block != frontBlock_); - return result; - } - - -private: - enum AllocationMode { CanAlloc, CannotAlloc }; - -#if MOODYCAMEL_HAS_EMPLACE - template - bool inner_enqueue(Args&&... args) AE_NO_TSAN -#else - template - bool inner_enqueue(U&& element) AE_NO_TSAN -#endif - { -#ifndef NDEBUG - ReentrantGuard guard(this->enqueuing); -#endif - - // High-level pseudocode (assuming we're allowed to alloc a new block): - // If room in tail block, add to tail - // Else check next block - // If next block is not the head block, enqueue on next block - // Else create a new block and enqueue there - // Advance tail to the block we just enqueued to - - Block* tailBlock_ = tailBlock.load(); - size_t blockFront = tailBlock_->localFront; - size_t blockTail = tailBlock_->tail.load(); - - size_t nextBlockTail = (blockTail + 1) & tailBlock_->sizeMask; - if (nextBlockTail != blockFront || nextBlockTail != (tailBlock_->localFront = tailBlock_->front.load())) { - fence(memory_order_acquire); - // This block has room for at least one more element - char* location = tailBlock_->data + blockTail * sizeof(T); -#if MOODYCAMEL_HAS_EMPLACE - new (location) T(std::forward(args)...); -#else - new (location) T(std::forward(element)); -#endif - - fence(memory_order_release); - tailBlock_->tail = nextBlockTail; - } - else { - fence(memory_order_acquire); - if (tailBlock_->next.load() != frontBlock) { - // Note that the reason we can't advance to the frontBlock and start adding new entries there - // is because if we did, then dequeue would stay in that block, eventually reading the new values, - // instead of advancing to the next full block (whose values were enqueued first and so should be - // consumed first). - - fence(memory_order_acquire); // Ensure we get latest writes if we got the latest frontBlock - - // tailBlock is full, but there's a free block ahead, use it - Block* tailBlockNext = tailBlock_->next.load(); - size_t nextBlockFront = tailBlockNext->localFront = tailBlockNext->front.load(); - nextBlockTail = tailBlockNext->tail.load(); - fence(memory_order_acquire); - - // This block must be empty since it's not the head block and we - // go through the blocks in a circle - assert(nextBlockFront == nextBlockTail); - tailBlockNext->localFront = nextBlockFront; - - char* location = tailBlockNext->data + nextBlockTail * sizeof(T); -#if MOODYCAMEL_HAS_EMPLACE - new (location) T(std::forward(args)...); -#else - new (location) T(std::forward(element)); -#endif - - tailBlockNext->tail = (nextBlockTail + 1) & tailBlockNext->sizeMask; - - fence(memory_order_release); - tailBlock = tailBlockNext; - } - else if (canAlloc == CanAlloc) { - // tailBlock is full and there's no free block ahead; create a new block - auto newBlockSize = largestBlockSize >= MAX_BLOCK_SIZE ? largestBlockSize : largestBlockSize * 2; - auto newBlock = make_block(newBlockSize); - if (newBlock == nullptr) { - // Could not allocate a block! - return false; - } - largestBlockSize = newBlockSize; - -#if MOODYCAMEL_HAS_EMPLACE - new (newBlock->data) T(std::forward(args)...); -#else - new (newBlock->data) T(std::forward(element)); -#endif - assert(newBlock->front == 0); - newBlock->tail = newBlock->localTail = 1; - - newBlock->next = tailBlock_->next.load(); - tailBlock_->next = newBlock; - - // Might be possible for the dequeue thread to see the new tailBlock->next - // *without* seeing the new tailBlock value, but this is OK since it can't - // advance to the next block until tailBlock is set anyway (because the only - // case where it could try to read the next is if it's already at the tailBlock, - // and it won't advance past tailBlock in any circumstance). - - fence(memory_order_release); - tailBlock = newBlock; - } - else if (canAlloc == CannotAlloc) { - // Would have had to allocate a new block to enqueue, but not allowed - return false; - } - else { - assert(false && "Should be unreachable code"); - return false; - } - } - - return true; - } - - - // Disable copying - ReaderWriterQueue(ReaderWriterQueue const&) { } - - // Disable assignment - ReaderWriterQueue& operator=(ReaderWriterQueue const&) { } - - - - AE_FORCEINLINE static size_t ceilToPow2(size_t x) - { - // From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 - --x; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - for (size_t i = 1; i < sizeof(size_t); i <<= 1) { - x |= x >> (i << 3); - } - ++x; - return x; - } - - template - static AE_FORCEINLINE char* align_for(char* ptr) AE_NO_TSAN - { - const std::size_t alignment = std::alignment_of::value; - return ptr + (alignment - (reinterpret_cast(ptr) % alignment)) % alignment; - } -private: -#ifndef NDEBUG - struct ReentrantGuard - { - AE_NO_TSAN ReentrantGuard(bool& _inSection) - : inSection(_inSection) - { - assert(!inSection && "Concurrent (or re-entrant) enqueue or dequeue operation detected (only one thread at a time may hold the producer or consumer role)"); - inSection = true; - } - - AE_NO_TSAN ~ReentrantGuard() { inSection = false; } - - private: - ReentrantGuard& operator=(ReentrantGuard const&); - - private: - bool& inSection; - }; -#endif - - struct Block - { - // Avoid false-sharing by putting highly contended variables on their own cache lines - weak_atomic front; // (Atomic) Elements are read from here - size_t localTail; // An uncontended shadow copy of tail, owned by the consumer - - char cachelineFiller0[MOODYCAMEL_CACHE_LINE_SIZE - sizeof(weak_atomic) - sizeof(size_t)]; - weak_atomic tail; // (Atomic) Elements are enqueued here - size_t localFront; - - char cachelineFiller1[MOODYCAMEL_CACHE_LINE_SIZE - sizeof(weak_atomic) - sizeof(size_t)]; // next isn't very contended, but we don't want it on the same cache line as tail (which is) - weak_atomic next; // (Atomic) - - char* data; // Contents (on heap) are aligned to T's alignment - - const size_t sizeMask; - - - // size must be a power of two (and greater than 0) - AE_NO_TSAN Block(size_t const& _size, char* _rawThis, char* _data) - : front(0), localTail(0), tail(0), localFront(0), next(nullptr), data(_data), sizeMask(_size - 1), rawThis(_rawThis) - { - } - - private: - // C4512 - Assignment operator could not be generated - Block& operator=(Block const&); - - public: - char* rawThis; - }; - - - static Block* make_block(size_t capacity) AE_NO_TSAN - { - // Allocate enough memory for the block itself, as well as all the elements it will contain - auto size = sizeof(Block) + std::alignment_of::value - 1; - size += sizeof(T) * capacity + std::alignment_of::value - 1; - auto newBlockRaw = static_cast(std::malloc(size)); - if (newBlockRaw == nullptr) { - return nullptr; - } - - auto newBlockAligned = align_for(newBlockRaw); - auto newBlockData = align_for(newBlockAligned + sizeof(Block)); - return new (newBlockAligned) Block(capacity, newBlockRaw, newBlockData); - } - -private: - weak_atomic frontBlock; // (Atomic) Elements are enqueued to this block - - char cachelineFiller[MOODYCAMEL_CACHE_LINE_SIZE - sizeof(weak_atomic)]; - weak_atomic tailBlock; // (Atomic) Elements are dequeued from this block - - size_t largestBlockSize; - -#ifndef NDEBUG - bool enqueuing; - bool dequeuing; -#endif -}; - -// Like ReaderWriterQueue, but also providees blocking operations -template -class BlockingReaderWriterQueue -{ -private: - typedef ::moodycamel::ReaderWriterQueue ReaderWriterQueue; - -public: - explicit BlockingReaderWriterQueue(size_t maxSize = 15) AE_NO_TSAN - : inner(maxSize), sema(new spsc_sema::LightweightSemaphore()) - { } - - BlockingReaderWriterQueue(BlockingReaderWriterQueue&& other) AE_NO_TSAN - : inner(std::move(other.inner)), sema(std::move(other.sema)) - { } - - BlockingReaderWriterQueue& operator=(BlockingReaderWriterQueue&& other) AE_NO_TSAN - { - std::swap(sema, other.sema); - std::swap(inner, other.inner); - return *this; - } - - - // Enqueues a copy of element if there is room in the queue. - // Returns true if the element was enqueued, false otherwise. - // Does not allocate memory. - AE_FORCEINLINE bool try_enqueue(T const& element) AE_NO_TSAN - { - if (inner.try_enqueue(element)) { - sema->signal(); - return true; - } - return false; - } - - // Enqueues a moved copy of element if there is room in the queue. - // Returns true if the element was enqueued, false otherwise. - // Does not allocate memory. - AE_FORCEINLINE bool try_enqueue(T&& element) AE_NO_TSAN - { - if (inner.try_enqueue(std::forward(element))) { - sema->signal(); - return true; - } - return false; - } - - - // Enqueues a copy of element on the queue. - // Allocates an additional block of memory if needed. - // Only fails (returns false) if memory allocation fails. - AE_FORCEINLINE bool enqueue(T const& element) AE_NO_TSAN - { - if (inner.enqueue(element)) { - sema->signal(); - return true; - } - return false; - } - - // Enqueues a moved copy of element on the queue. - // Allocates an additional block of memory if needed. - // Only fails (returns false) if memory allocation fails. - AE_FORCEINLINE bool enqueue(T&& element) AE_NO_TSAN - { - if (inner.enqueue(std::forward(element))) { - sema->signal(); - return true; - } - return false; - } - - - // Attempts to dequeue an element; if the queue is empty, - // returns false instead. If the queue has at least one element, - // moves front to result using operator=, then returns true. - template - bool try_dequeue(U& result) AE_NO_TSAN - { - if (sema->tryWait()) { - bool success = inner.try_dequeue(result); - assert(success); - AE_UNUSED(success); - return true; - } - return false; - } - - - // Attempts to dequeue an element; if the queue is empty, - // waits until an element is available, then dequeues it. - template - void wait_dequeue(U& result) AE_NO_TSAN - { - sema->wait(); - bool success = inner.try_dequeue(result); - AE_UNUSED(result); - assert(success); - AE_UNUSED(success); - } - - - // Attempts to dequeue an element; if the queue is empty, - // waits until an element is available up to the specified timeout, - // then dequeues it and returns true, or returns false if the timeout - // expires before an element can be dequeued. - // Using a negative timeout indicates an indefinite timeout, - // and is thus functionally equivalent to calling wait_dequeue. - template - bool wait_dequeue_timed(U& result, std::int64_t timeout_usecs) AE_NO_TSAN - { - if (!sema->wait(timeout_usecs)) { - return false; - } - bool success = inner.try_dequeue(result); - AE_UNUSED(result); - assert(success); - AE_UNUSED(success); - return true; - } - - -#if __cplusplus > 199711L || _MSC_VER >= 1700 - // Attempts to dequeue an element; if the queue is empty, - // waits until an element is available up to the specified timeout, - // then dequeues it and returns true, or returns false if the timeout - // expires before an element can be dequeued. - // Using a negative timeout indicates an indefinite timeout, - // and is thus functionally equivalent to calling wait_dequeue. - template - inline bool wait_dequeue_timed(U& result, std::chrono::duration const& timeout) AE_NO_TSAN - { - return wait_dequeue_timed(result, std::chrono::duration_cast(timeout).count()); - } -#endif - - - // Returns a pointer to the front element in the queue (the one that - // would be removed next by a call to `try_dequeue` or `pop`). If the - // queue appears empty at the time the method is called, nullptr is - // returned instead. - // Must be called only from the consumer thread. - AE_FORCEINLINE T* peek() AE_NO_TSAN - { - return inner.peek(); - } - - // Removes the front element from the queue, if any, without returning it. - // Returns true on success, or false if the queue appeared empty at the time - // `pop` was called. - AE_FORCEINLINE bool pop() AE_NO_TSAN - { - if (sema->tryWait()) { - bool result = inner.pop(); - assert(result); - AE_UNUSED(result); - return true; - } - return false; - } - - // Returns the approximate number of items currently in the queue. - // Safe to call from both the producer and consumer threads. - AE_FORCEINLINE size_t size_approx() const AE_NO_TSAN - { - return sema->availableApprox(); - } - - -private: - // Disable copying & assignment - BlockingReaderWriterQueue(BlockingReaderWriterQueue const&) { } - BlockingReaderWriterQueue& operator=(BlockingReaderWriterQueue const&) { } - -private: - ReaderWriterQueue inner; - std::unique_ptr sema; -}; - -} // end namespace moodycamel - -#ifdef AE_VCPP -#pragma warning(pop) -#endif diff --git a/GLideN64/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp b/GLideN64/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp deleted file mode 100644 index 974a095..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp +++ /dev/null @@ -1,327 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef VC -#include -#endif - -using namespace opengl; - -class DisplayWindowMupen64plus : public DisplayWindow -{ -public: - DisplayWindowMupen64plus() {} - -private: - void _setAttributes(); - void _getDisplaySize(); - - bool _start() override; - void _stop() override; - void _restart() override; - void _swapBuffers() override; - void _saveScreenshot() override; - void _saveBufferContent(graphics::ObjectHandle _fbo, CachedTexture *_pTexture) override; - bool _resizeWindow() override; - void _changeWindow() override; - void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) override {} - void _readScreen2(void * _dest, int * _width, int * _height, int _front) override; -#ifdef M64P_GLIDENUI - bool _supportsWithRateFunctions = true; -#endif // M64P_GLIDENUI - graphics::ObjectHandle _getDefaultFramebuffer() override; -}; - -DisplayWindow & DisplayWindow::get() -{ - static DisplayWindowMupen64plus video; - return video; -} - -void DisplayWindowMupen64plus::_setAttributes() -{ - LOG(LOG_VERBOSE, "_setAttributes"); - - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_PROFILE_MASK, M64P_GL_CONTEXT_PROFILE_CORE); - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3); - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 3); - - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1); - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, config.video.verticalSync); - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, 32); - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, 16); - if (config.video.multisampling > 0 && config.frameBufferEmulation.enable == 0) { - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1); - if (config.video.multisampling <= 2) - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 2); - else if (config.video.multisampling <= 4) - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 4); - else if (config.video.multisampling <= 8) - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 8); - else - FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 16); - } -} - -bool DisplayWindowMupen64plus::_start() -{ - FunctionWrapper::setThreadedMode(config.video.threadedVideo); - auto returnValue = FunctionWrapper::CoreVideo_Init(); - if (returnValue != M64ERR_SUCCESS) { - LOG(LOG_ERROR, "Error in CoreVideo_Init. Error code: %d", returnValue); - FunctionWrapper::CoreVideo_Quit(); - return false; - } - - _setAttributes(); - - m_bFullscreen = config.video.fullscreen > 0; - m_screenWidth = config.video.windowedWidth; - m_screenHeight = config.video.windowedHeight; - m_screenRefresh = config.video.fullscreenRefresh; - - _getDisplaySize(); - _setBufferSize(); - - LOG(LOG_VERBOSE, "Setting video mode %dx%d", m_screenWidth, m_screenHeight); - const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; -#ifdef M64P_GLIDENUI - returnValue = FunctionWrapper::CoreVideo_SetVideoModeWithRate(m_screenWidth, m_screenHeight, m_screenRefresh, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags); - if (returnValue != M64ERR_SUCCESS) - { - _supportsWithRateFunctions = false; -#endif // M64P_GLIDENUI - returnValue = FunctionWrapper::CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags); -#ifdef M64P_GLIDENUI - } -#endif // M64P_GLIDENUI - if (returnValue != M64ERR_SUCCESS) { - LOG(LOG_ERROR, "Error setting videomode %dx%d @ %d. Error code: %d", m_screenWidth, m_screenHeight, m_screenRefresh, returnValue); - FunctionWrapper::CoreVideo_Quit(); - return false; - } - - char caption[128]; -# ifdef _DEBUG - sprintf(caption, "%s debug. Revision %s", pluginName, PLUGIN_REVISION); -# else // _DEBUG - sprintf(caption, "%s. Revision %s", pluginName, PLUGIN_REVISION); -# endif // _DEBUG - CoreVideo_SetCaption(caption); - - return true; -} - -void DisplayWindowMupen64plus::_stop() -{ - FunctionWrapper::CoreVideo_Quit(); -} - -void DisplayWindowMupen64plus::_restart() -{ -#ifdef M64P_GLIDENUI - if (_supportsWithRateFunctions && m_bFullscreen) { - m_resizeWidth = config.video.fullscreenWidth; - m_resizeHeight = config.video.fullscreenHeight; - } else { - m_resizeWidth = config.video.windowedWidth; - m_resizeHeight = config.video.windowedHeight; - } -#endif // M64P_GLIDENUI -} - -void DisplayWindowMupen64plus::_swapBuffers() -{ - // if emulator defined a render callback function, call it before buffer swap - if (renderCallback != nullptr) { - gfxContext.resetShaderProgram(); - if (config.frameBufferEmulation.N64DepthCompare == Config::dcDisable) { - gfxContext.setViewport(0, getHeightOffset(), getScreenWidth(), getScreenHeight()); - gSP.changed |= CHANGED_VIEWPORT; - } - gDP.changed |= CHANGED_COMBINE; - (*renderCallback)((gDP.changed&CHANGED_CPU_FB_WRITE) == 0 ? 1 : 0); - } - - //Don't let the command queue grow too big buy waiting on no more swap buffers being queued - FunctionWrapper::WaitForSwapBuffersQueued(); - - FunctionWrapper::CoreVideo_GL_SwapBuffers(); -} - -void DisplayWindowMupen64plus::_saveScreenshot() -{ -} - -void DisplayWindowMupen64plus::_saveBufferContent(graphics::ObjectHandle /*_fbo*/, CachedTexture* /*_pTexture*/) -{ -} - -bool DisplayWindowMupen64plus::_resizeWindow() -{ - _setAttributes(); - -#ifndef M64P_GLIDENUI - m_bFullscreen = false; -#endif // M64P_GLIDENUI - -#ifdef M64P_GLIDENUI - m64p_error returnValue; - - if (!_supportsWithRateFunctions) - m_bFullscreen = false; - - if (_supportsWithRateFunctions) { - m64p_video_flags flags = {}; - - m_width = m_screenWidth = m_resizeWidth; - m_height = m_screenHeight = m_resizeHeight; - - returnValue = FunctionWrapper::CoreVideo_SetVideoModeWithRate(m_screenWidth, m_screenHeight, m_screenRefresh, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags); - if (returnValue != M64ERR_SUCCESS) { - LOG(LOG_ERROR, "Error setting videomode %dx%d @ %d. Error code: %d", m_screenWidth, m_screenHeight, m_screenRefresh, returnValue); - FunctionWrapper::CoreVideo_Quit(); - return false; - } - - _setBufferSize(); - opengl::Utils::isGLError(); // reset GL error. - return true; - } -#endif // M64P_GLIDENUI - - m_width = m_screenWidth = m_resizeWidth; - m_height = m_screenHeight = m_resizeHeight; - switch (CoreVideo_ResizeWindow(m_screenWidth, m_screenHeight)) { - case M64ERR_INVALID_STATE: - LOG(LOG_ERROR, "Error setting videomode %dx%d in fullscreen mode", m_screenWidth, m_screenHeight); - m_width = m_screenWidth = config.video.windowedWidth; - m_height = m_screenHeight = config.video.windowedHeight; - break; - case M64ERR_SUCCESS: - break; - default: - LOG(LOG_ERROR, "Error setting videomode %dx%d", m_screenWidth, m_screenHeight); - m_width = m_screenWidth = config.video.windowedWidth; - m_height = m_screenHeight = config.video.windowedHeight; - FunctionWrapper::CoreVideo_Quit(); - return false; - } - _setBufferSize(); - opengl::Utils::isGLError(); // reset GL error. - return true; -} - -void DisplayWindowMupen64plus::_changeWindow() -{ -#ifdef M64P_GLIDENUI - if (_supportsWithRateFunctions) { - m64p_error returnValue; - m_bFullscreen = !m_bFullscreen; - if (m_bFullscreen) { - m_screenWidth = config.video.fullscreenWidth; - m_screenHeight = config.video.fullscreenHeight; - m_screenRefresh = config.video.fullscreenRefresh; - } else { - m_screenWidth = config.video.windowedWidth; - m_screenHeight = config.video.windowedHeight; - } - - m64p_video_flags flags = {}; - returnValue = FunctionWrapper::CoreVideo_SetVideoModeWithRate(m_screenWidth, m_screenHeight, m_screenRefresh, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags); - - if (returnValue != M64ERR_SUCCESS) { - LOG(LOG_ERROR, "Error setting videomode %dx%d @ %d. Error code: %d", m_screenWidth, m_screenHeight, m_screenRefresh, returnValue); - FunctionWrapper::CoreVideo_Quit(); - } - } else { -#endif // M64P_GLIDENUI - CoreVideo_ToggleFullScreen(); -#ifdef M64P_GLIDENUI - } -#endif // M64P_GLIDENUI -} - -void DisplayWindowMupen64plus::_getDisplaySize() -{ -#ifdef VC - if( m_bFullscreen ) { - // Use VC get_display_size function to get the current screen resolution - u32 fb_width; - u32 fb_height; - auto returnValue = graphics_get_display_size(0 /* LCD */, &fb_width, &fb_height); - if (returnValue < 0) - LOG(LOG_ERROR, "Failed to get display size. Error code: %d", returnValue); - else { - LOG(LOG_VERBOSE, "Display size %dx%d", fb_width, fb_height); - m_screenWidth = fb_width; - m_screenHeight = fb_height; - } - } -#endif -} - -void DisplayWindowMupen64plus::_readScreen2(void * _dest, int * _width, int * _height, int _front) -{ - if (_width == nullptr || _height == nullptr) - return; - - *_width = m_screenWidth; - *_height = m_screenHeight; - - if (_dest == nullptr) - return; - - u8 *pBufferData = (u8*)malloc((*_width)*(*_height) * 4); - if (pBufferData == nullptr) - return; - u8 *pDest = (u8*)_dest; - -#if !defined(OS_ANDROID) && !defined(OS_IOS) - GLint oldMode; - glGetIntegerv(GL_READ_BUFFER, &oldMode); - if (_front != 0) - glReadBuffer(GL_FRONT); - else - glReadBuffer(GL_BACK); - glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGBA, GL_UNSIGNED_BYTE, pBufferData); - glReadBuffer(oldMode); -#else - glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGBA, GL_UNSIGNED_BYTE, pBufferData); -#endif - - //Convert RGBA to RGB - for (s32 y = 0; y < *_height; ++y) { - u8 *ptr = pBufferData + ((*_width) * 4 * y); - for (s32 x = 0; x < *_width; ++x) { - pDest[x * 3] = ptr[0]; // red - pDest[x * 3 + 1] = ptr[1]; // green - pDest[x * 3 + 2] = ptr[2]; // blue - ptr += 4; - } - pDest += (*_width) * 3; - } - - free(pBufferData); -} - -graphics::ObjectHandle DisplayWindowMupen64plus::_getDefaultFramebuffer() -{ - if (CoreVideo_GL_GetDefaultFramebuffer != nullptr) - return graphics::ObjectHandle(CoreVideo_GL_GetDefaultFramebuffer()); - return graphics::ObjectHandle::null; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_Attributes.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_Attributes.cpp deleted file mode 100644 index d209efd..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_Attributes.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "opengl_Attributes.h" - -namespace opengl { - - namespace triangleAttrib { - const GLuint position = 0U; - const GLuint color = 1U; - const GLuint texcoord = 2U; - const GLuint numlights = 3U; - const GLuint modify = 4U; - const GLuint barycoords = 8U; - } - - // Rect attributes - namespace rectAttrib { - const GLuint position = 5U; - const GLuint texcoord0 = 6U; - const GLuint texcoord1 = 7U; - const GLuint barycoords = 9U; - } -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_Attributes.h b/GLideN64/src/Graphics/OpenGLContext/opengl_Attributes.h deleted file mode 100644 index 3629500..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_Attributes.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "GLFunctions.h" - -namespace opengl { - - // Triangle attributes - namespace triangleAttrib { - extern const GLuint position; - extern const GLuint color; - extern const GLuint texcoord; - extern const GLuint numlights; - extern const GLuint modify; - extern const GLuint barycoords; - } - - // Rect attributes - namespace rectAttrib { - extern const GLuint position; - extern const GLuint texcoord0; - extern const GLuint texcoord1; - extern const GLuint barycoords; - } - -#define MaxAttribIndex 10 -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp deleted file mode 100644 index 61de084..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp +++ /dev/null @@ -1,460 +0,0 @@ -#include -#include -#include "opengl_GLInfo.h" -#include "opengl_CachedFunctions.h" -#include "opengl_Utils.h" -#include "opengl_BufferManipulationObjectFactory.h" - -#ifdef OS_ANDROID -#include -#endif - -//#define ENABLE_GL_4_5 - -using namespace opengl; - -/*---------------CreateFramebufferObject-------------*/ - -class GenFramebuffer : public CreateFramebufferObject -{ -public: - graphics::ObjectHandle createFramebuffer() override - { - GLuint fbo; - glGenFramebuffers(1, &fbo); - return graphics::ObjectHandle(fbo); - } -}; - -class CreateFramebuffer : public CreateFramebufferObject -{ -public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_5 - return (_glinfo.majorVersion > 4) || (_glinfo.majorVersion == 4 && _glinfo.minorVersion >= 5); -#else - return false; -#endif - } - - graphics::ObjectHandle createFramebuffer() override - { - GLuint fbo; - glCreateFramebuffers(1, &fbo); - return graphics::ObjectHandle(fbo); - } -}; - -/*---------------CreateRenderbuffer-------------*/ - -class GenRenderbuffer : public CreateRenderbuffer -{ -public: - graphics::ObjectHandle createRenderbuffer() override - { - GLuint renderbuffer; - glGenRenderbuffers(1, &renderbuffer); - return graphics::ObjectHandle(renderbuffer); - } -}; - - -/*---------------InitRenderbuffer-------------*/ - -class RenderbufferStorage : public InitRenderbuffer -{ -public: - RenderbufferStorage(CachedBindRenderbuffer * _bind) : m_bind(_bind) {} - void initRenderbuffer(const graphics::Context::InitRenderbufferParams & _params) override - { - m_bind->bind(_params.target, _params.handle); - glRenderbufferStorage(GLenum(_params.target), GLenum(_params.format), _params.width, _params.height); - } - -private: - CachedBindRenderbuffer * m_bind; -}; - - -/*---------------AddFramebufferTarget-------------*/ - -class AddFramebufferTexture2D : public AddFramebufferRenderTarget -{ -public: - AddFramebufferTexture2D(CachedBindFramebuffer * _bind) : m_bind(_bind) {} - - void addFrameBufferRenderTarget(const graphics::Context::FrameBufferRenderTarget & _params) override - { - m_bind->bind(_params.bufferTarget, _params.bufferHandle); - if (_params.textureTarget == graphics::textureTarget::RENDERBUFFER) { - glFramebufferRenderbuffer(GLenum(_params.bufferTarget), - GLenum(_params.attachment), - GLenum(_params.textureTarget), - GLuint(_params.textureHandle)); - } else { - glFramebufferTexture2D(GLenum(_params.bufferTarget), - GLenum(_params.attachment), - GLenum(_params.textureTarget), - GLuint(_params.textureHandle), - 0); - } - } - -private: - CachedBindFramebuffer * m_bind; -}; - -class AddNamedFramebufferTexture : public AddFramebufferRenderTarget -{ -public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_5 - return (_glinfo.majorVersion > 4) || (_glinfo.majorVersion == 4 && _glinfo.minorVersion >= 5); -#else - return false; -#endif - } - - void addFrameBufferRenderTarget(const graphics::Context::FrameBufferRenderTarget & _params) override - { - glNamedFramebufferTexture(GLuint(_params.bufferHandle), - GLenum(_params.attachment), - GLuint(_params.textureHandle), - 0); - } -}; - -/*---------------CreatePixelReadBuffer-------------*/ - -class PBOReadBuffer : public graphics::PixelReadBuffer -{ -public: - PBOReadBuffer(CachedBindBuffer * _bind, size_t _size) - : m_bind(_bind) - , m_size(_size) - { - glGenBuffers(1, &m_PBO); - m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle(m_PBO)); - glBufferData(GL_PIXEL_PACK_BUFFER, m_size, nullptr, GL_DYNAMIC_READ); - m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle::null); - } - - ~PBOReadBuffer() { - glDeleteBuffers(1, &m_PBO); - m_PBO = 0; - } - - void readPixels(s32 _x,s32 _y, u32 _width, u32 _height, graphics::Parameter _format, graphics::Parameter _type) override - { - glReadPixels(_x, _y, _width, _height, GLenum(_format), GLenum(_type), 0); - } - - void * getDataRange(u32 _offset, u32 _range) override - { - if (_range > m_size) - _range = static_cast(m_size); - return glMapBufferRange(GL_PIXEL_PACK_BUFFER, _offset, _range, GL_MAP_READ_BIT); - } - - void closeReadBuffer() override - { - glUnmapBuffer(GL_PIXEL_PACK_BUFFER); - } - - void bind() override { - m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle(m_PBO)); - } - - void unbind() override { - m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle::null); - } - -private: - CachedBindBuffer * m_bind; - size_t m_size; - GLuint m_PBO; -}; - -template -class CreatePixelReadBufferT : public CreatePixelReadBuffer -{ -public: - CreatePixelReadBufferT(CachedBindBuffer * _bind) - : m_bind(_bind) { - } - - graphics::PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes) override - { - return new T(m_bind, _sizeInBytes); - } - -private: - CachedBindBuffer * m_bind; -}; - -/*---------------BlitFramebuffers-------------*/ - -class BlitFramebuffersImpl : public BlitFramebuffers -{ -public: - static bool Check(const GLInfo & _glinfo) { - return !_glinfo.isGLES2; - } - - BlitFramebuffersImpl(CachedBindFramebuffer * _bind, - CachedEnable * _enableScissor, - Renderer _renderer) - : m_bind(_bind) - , m_enableScissor(_enableScissor) - , m_renderer(_renderer) { - } - - bool blitFramebuffers(const graphics::Context::BlitFramebuffersParams & _params) override - { - m_bind->bind(graphics::bufferTarget::READ_FRAMEBUFFER, _params.readBuffer); - m_bind->bind(graphics::bufferTarget::DRAW_FRAMEBUFFER, _params.drawBuffer); - - const s32 adrenoCoordFix = (m_renderer == Renderer::Adreno) ? 1 : 0; - - m_enableScissor->enable(false); - - glBlitFramebuffer( - adrenoCoordFix + _params.srcX0, _params.srcY0, _params.srcX1, _params.srcY1, - adrenoCoordFix + _params.dstX0, _params.dstY0, _params.dstX1, _params.dstY1, - GLbitfield(_params.mask), GLenum(_params.filter) - ); - m_enableScissor->enable(true); - - return !Utils::isGLError(); - } - -private: - CachedBindFramebuffer * m_bind; - CachedEnable * m_enableScissor; - Renderer m_renderer; -}; - -class DummyBlitFramebuffers: public BlitFramebuffers -{ -public: - bool blitFramebuffers(const graphics::Context::BlitFramebuffersParams & _params) override - { - return false; - } -}; - -/*---------------FramebufferTextureFormats-------------*/ - -struct FramebufferTextureFormatsGLES2 : public graphics::FramebufferTextureFormats -{ - static bool Check(const GLInfo & _glinfo) { - return _glinfo.isGLES2; - } - - FramebufferTextureFormatsGLES2(const GLInfo & _glinfo) - { - monochromeInternalFormat = GL_RGB; - monochromeFormat = GL_RGB; - monochromeType = GL_UNSIGNED_SHORT_5_6_5; - monochromeFormatBytes = 2; - - if (Utils::isExtensionSupported(_glinfo, "GL_OES_depth_texture")) { - depthInternalFormat = GL_DEPTH_COMPONENT; - depthFormatBytes = 4; - } else { - depthInternalFormat = GL_DEPTH_COMPONENT16; - depthFormatBytes = 2; - } - - depthFormat = GL_DEPTH_COMPONENT; - depthType = GL_UNSIGNED_INT; - - if (Utils::isExtensionSupported(_glinfo, "GL_OES_rgb8_rgba8")) { - colorInternalFormat = GL_RGBA; - colorFormat = GL_RGBA; - colorType = GL_UNSIGNED_BYTE; - colorFormatBytes = 4; - } - else { - colorInternalFormat = GL_RGB; - colorFormat = GL_RGB; - colorType = GL_UNSIGNED_SHORT_5_6_5; - colorFormatBytes = 2; - } - - noiseInternalFormat = graphics::internalcolorFormat::LUMINANCE; - noiseFormat = graphics::colorFormat::LUMINANCE; - noiseType = GL_UNSIGNED_BYTE; - noiseFormatBytes = 1; - } -}; - -struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureFormats -{ - static bool Check(const GLInfo & _glinfo) { - return _glinfo.isGLESX && !_glinfo.isGLES2; - } - - FramebufferTextureFormatsGLES3(const GLInfo & _glinfo) - { - if (_glinfo.renderer == Renderer::Adreno530) { - colorInternalFormat = GL_RGBA32F; - colorFormat = GL_RGBA; - colorType = GL_FLOAT; - colorFormatBytes = 16; - } else { - colorInternalFormat = GL_RGBA8; - colorFormat = GL_RGBA; - colorType = GL_UNSIGNED_BYTE; - colorFormatBytes = 4; - } - -#ifdef OS_ANDROID - // If EGL image support is available, override above - if (_glinfo.eglImage) { - colorInternalFormat = GL_RGBA8; - colorFormat = GL_RGBA; - colorType = GL_UNSIGNED_BYTE; - colorFormatBytes = 4; - } -#endif - - monochromeInternalFormat = GL_R8; - monochromeFormat = GL_RED; - monochromeType = GL_UNSIGNED_BYTE; - monochromeFormatBytes = 1; - - depthInternalFormat = GL_DEPTH_COMPONENT24; - depthFormat = GL_DEPTH_COMPONENT; - depthType = GL_UNSIGNED_INT; - depthFormatBytes = 4; - - depthImageInternalFormat = GL_R32F; - depthImageFormat = GL_RED; - depthImageType = GL_FLOAT; - depthImageFormatBytes = 4; - - lutInternalFormat = GL_R32UI; - lutFormat = GL_RED_INTEGER; - lutType = GL_UNSIGNED_INT; - lutFormatBytes = 4; - - noiseInternalFormat = GL_R8; - noiseFormat = GL_RED; - noiseType = GL_UNSIGNED_BYTE; - noiseFormatBytes = 1; - } -}; - -struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureFormats -{ - static bool Check(const GLInfo & _glinfo) { - return !_glinfo.isGLESX; - } - - FramebufferTextureFormatsOpenGL() - { - colorInternalFormat = GL_RGBA8; - colorFormat = GL_RGBA; - colorType = GL_UNSIGNED_BYTE; - colorFormatBytes = 4; - - monochromeInternalFormat = GL_R8; - monochromeFormat = GL_RED; - monochromeType = GL_UNSIGNED_BYTE; - monochromeFormatBytes = 1; - - depthInternalFormat = GL_DEPTH_COMPONENT24; - depthFormat = GL_DEPTH_COMPONENT; - depthType = GL_FLOAT; - depthFormatBytes = 4; - - depthImageInternalFormat = GL_R32F; - depthImageFormat = GL_RED; - depthImageType = GL_FLOAT; - depthImageFormatBytes = 4; - - lutInternalFormat = GL_R32UI; - lutFormat = GL_RED_INTEGER; - lutType = GL_UNSIGNED_INT; - lutFormatBytes = 4; - - noiseInternalFormat = GL_R8; - noiseFormat = GL_RED; - noiseType = GL_UNSIGNED_BYTE; - noiseFormatBytes = 1; - } -}; - -/*---------------BufferManipulationObjectFactory-------------*/ - -BufferManipulationObjectFactory::BufferManipulationObjectFactory(const GLInfo & _info, - CachedFunctions & _cachedFunctions) - : m_glInfo(_info) - , m_cachedFunctions(_cachedFunctions) -{ -} - - -BufferManipulationObjectFactory::~BufferManipulationObjectFactory() -{ -} - -CreateFramebufferObject * BufferManipulationObjectFactory::getCreateFramebufferObject() const -{ - if (CreateFramebuffer::Check(m_glInfo)) - return new CreateFramebuffer; - - return new GenFramebuffer; -} - -CreateRenderbuffer * BufferManipulationObjectFactory::getCreateRenderbuffer() const -{ - return new GenRenderbuffer; -} - -InitRenderbuffer * BufferManipulationObjectFactory::getInitRenderbuffer() const -{ - return new RenderbufferStorage(m_cachedFunctions.getCachedBindRenderbuffer()); -} - -AddFramebufferRenderTarget * BufferManipulationObjectFactory::getAddFramebufferRenderTarget() const -{ - if (AddNamedFramebufferTexture::Check(m_glInfo)) - return new AddNamedFramebufferTexture; - - return new AddFramebufferTexture2D(m_cachedFunctions.getCachedBindFramebuffer()); -} - -BlitFramebuffers * BufferManipulationObjectFactory::getBlitFramebuffers() const -{ - if (BlitFramebuffersImpl::Check(m_glInfo)) - return new BlitFramebuffersImpl(m_cachedFunctions.getCachedBindFramebuffer(), - m_cachedFunctions.getCachedEnable(graphics::enable::SCISSOR_TEST), - m_glInfo.renderer); - - return new DummyBlitFramebuffers; -} - -CreatePixelReadBuffer * BufferManipulationObjectFactory::createPixelReadBuffer() const -{ - if (m_glInfo.isGLES2) - return nullptr; - - return new CreatePixelReadBufferT(m_cachedFunctions.getCachedBindBuffer()); -} - -graphics::FramebufferTextureFormats * BufferManipulationObjectFactory::getFramebufferTextureFormats() const -{ - if (FramebufferTextureFormatsOpenGL::Check(m_glInfo)) - return new FramebufferTextureFormatsOpenGL; - - if (FramebufferTextureFormatsGLES3::Check(m_glInfo)) - return new FramebufferTextureFormatsGLES3(m_glInfo); - - if (FramebufferTextureFormatsGLES2::Check(m_glInfo)) - return new FramebufferTextureFormatsGLES2(m_glInfo); - - assert(false); - return nullptr; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.h b/GLideN64/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.h deleted file mode 100644 index 86ec617..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include "opengl_GLInfo.h" - -namespace opengl { - - struct GLInfo; - class CachedFunctions; - - class CreateFramebufferObject - { - public: - virtual ~CreateFramebufferObject() {} - virtual graphics::ObjectHandle createFramebuffer() = 0; - }; - - class CreateRenderbuffer - { - public: - virtual ~CreateRenderbuffer() {} - virtual graphics::ObjectHandle createRenderbuffer() = 0; - }; - - class InitRenderbuffer - { - public: - virtual ~InitRenderbuffer() {} - virtual void initRenderbuffer(const graphics::Context::InitRenderbufferParams & _params) = 0; - }; - - class AddFramebufferRenderTarget - { - public: - virtual ~AddFramebufferRenderTarget() {} - virtual void addFrameBufferRenderTarget(const graphics::Context::FrameBufferRenderTarget & _params) = 0; - }; - - class CreatePixelReadBuffer - { - public: - virtual ~CreatePixelReadBuffer() {} - virtual graphics::PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes) = 0; - }; - - class BlitFramebuffers - { - public: - virtual ~BlitFramebuffers() {} - virtual bool blitFramebuffers(const graphics::Context::BlitFramebuffersParams & _params) = 0; - }; - - class BufferManipulationObjectFactory - { - public: - BufferManipulationObjectFactory(const GLInfo & _info, CachedFunctions & _cachedFunctions); - ~BufferManipulationObjectFactory(); - - CreateFramebufferObject * getCreateFramebufferObject() const; - - CreateRenderbuffer * getCreateRenderbuffer() const; - - InitRenderbuffer * getInitRenderbuffer() const; - - AddFramebufferRenderTarget * getAddFramebufferRenderTarget() const; - - CreatePixelReadBuffer * createPixelReadBuffer() const; - - BlitFramebuffers * getBlitFramebuffers() const; - - graphics::FramebufferTextureFormats * getFramebufferTextureFormats() const; - - private: - const GLInfo & m_glInfo; - CachedFunctions & m_cachedFunctions; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp deleted file mode 100644 index bf781a2..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp +++ /dev/null @@ -1,259 +0,0 @@ -#include -#include -#include "GLFunctions.h" -#include "opengl_Attributes.h" -#include "opengl_BufferedDrawer.h" - -using namespace graphics; -using namespace opengl; - -const u32 BufferedDrawer::m_bufMaxSize = 8 * 1024 * 1024; // 8 MB -#ifndef GL_DEBUG -const GLbitfield BufferedDrawer::m_bufAccessBits = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT; -const GLbitfield BufferedDrawer::m_bufMapBits = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT; -#else -const GLbitfield BufferedDrawer::m_bufAccessBits = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT; -const GLbitfield BufferedDrawer::m_bufMapBits = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_FLUSH_EXPLICIT_BIT; -#endif - -BufferedDrawer::BufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray * _cachedAttribArray, CachedBindBuffer * _bindBuffer) -: m_glInfo(_glinfo) -, m_cachedAttribArray(_cachedAttribArray) -, m_bindBuffer(_bindBuffer) -{ - m_vertices.resize(VERTBUFF_SIZE); - /* Init buffers for rects */ - glGenVertexArrays(1, &m_rectsBuffers.vao); - glBindVertexArray(m_rectsBuffers.vao); - _initBuffer(m_rectsBuffers.vbo, m_bufMaxSize); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, true); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, true); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, true); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, true); - glVertexAttribPointer(rectAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, x))); - glVertexAttribPointer(rectAttrib::texcoord0, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, s0))); - glVertexAttribPointer(rectAttrib::texcoord1, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, s1))); - if (_glinfo.coverage) - glVertexAttribPointer(rectAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, bc0))); - - /* Init buffers for triangles */ - glGenVertexArrays(1, &m_trisBuffers.vao); - glBindVertexArray(m_trisBuffers.vao); - _initBuffer(m_trisBuffers.vbo, m_bufMaxSize); - _initBuffer(m_trisBuffers.ebo, m_bufMaxSize); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, true); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, true); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, true); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, true); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::numlights, false); - glVertexAttribPointer(triangleAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, x))); - glVertexAttribPointer(triangleAttrib::color, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, r))); - glVertexAttribPointer(triangleAttrib::texcoord, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, s))); - glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_TRUE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, modify))); - if (_glinfo.coverage) { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, true); - glVertexAttribPointer(triangleAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)(offsetof(Vertex, bc0))); - } -} - -void BufferedDrawer::_initBuffer(Buffer & _buffer, GLuint _bufSize) -{ - _buffer.size = _bufSize; - glGenBuffers(1, &_buffer.handle); - m_bindBuffer->bind(Parameter(_buffer.type), ObjectHandle(_buffer.handle)); - if (m_glInfo.bufferStorage) { - glBufferStorage(_buffer.type, _bufSize, nullptr, m_bufAccessBits); - _buffer.data = (GLubyte*)glMapBufferRange(_buffer.type, 0, _bufSize, m_bufMapBits); - } else { - glBufferData(_buffer.type, _bufSize, nullptr, GL_DYNAMIC_DRAW); - } -} - -BufferedDrawer::~BufferedDrawer() -{ - m_bindBuffer->bind(Parameter(GL_ARRAY_BUFFER), ObjectHandle::null); - m_bindBuffer->bind(Parameter(GL_ELEMENT_ARRAY_BUFFER), ObjectHandle::null); - GLuint buffers[3] = { m_rectsBuffers.vbo.handle, m_trisBuffers.vbo.handle, m_trisBuffers.ebo.handle }; - glDeleteBuffers(3, buffers); - glBindVertexArray(0); - GLuint arrays[2] = { m_rectsBuffers.vao, m_trisBuffers.vao }; - glDeleteVertexArrays(2, arrays); -} - -void BufferedDrawer::_updateBuffer(Buffer & _buffer, u32 _count, u32 _dataSize, const void * _data) -{ - if (_buffer.offset + _dataSize >= _buffer.size) { - _buffer.offset = 0; - _buffer.pos = 0; - } - - if (m_glInfo.bufferStorage) { - memcpy(&_buffer.data[_buffer.offset], _data, _dataSize); - } else { - m_bindBuffer->bind(Parameter(_buffer.type), ObjectHandle(_buffer.handle)); - void* buffer_pointer = glMapBufferRange(_buffer.type, _buffer.offset, _dataSize, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT); - memcpy(buffer_pointer, _data, _dataSize); - glUnmapBuffer(_buffer.type); - } - - _buffer.offset += _dataSize; - _buffer.pos += _count; -} - -void BufferedDrawer::_updateRectBuffer(const graphics::Context::DrawRectParameters & _params) -{ - const BuffersType type = BuffersType::rects; - if (m_type != type) { - glBindVertexArray(m_rectsBuffers.vao); - m_type = type; - } - - Buffer & buffer = m_rectsBuffers.vbo; - const u32 dataSize = _params.verticesCount * static_cast(sizeof(RectVertex)); - - if (m_glInfo.bufferStorage) { - _updateBuffer(buffer, _params.verticesCount, dataSize, _params.vertices); - return; - } - - const u64 crc = CRC_Calculate(UINT64_MAX, _params.vertices, dataSize); - auto iter = m_rectBufferOffsets.find(crc); - if (iter != m_rectBufferOffsets.end()) { - buffer.pos = iter->second; - return; - } - - const GLintptr prevOffset = buffer.offset; - _updateBuffer(buffer, _params.verticesCount, dataSize, _params.vertices); - if (buffer.offset < prevOffset) - m_rectBufferOffsets.clear(); - - buffer.pos = static_cast(buffer.offset / sizeof(RectVertex)); - m_rectBufferOffsets[crc] = buffer.pos; -} - - -void BufferedDrawer::drawRects(const graphics::Context::DrawRectParameters & _params) -{ - _updateRectBuffer(_params); - - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, _params.texrect); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, _params.texrect); - - glDrawArrays(GLenum(_params.mode), m_rectsBuffers.vbo.pos - _params.verticesCount, _params.verticesCount); -} - -void BufferedDrawer::_convertFromSPVertex(bool _flatColors, u32 _count, const SPVertex * _data) -{ - if (_count > m_vertices.size()) - m_vertices.resize(_count); - - for (u32 i = 0; i < _count; ++i) { - const SPVertex & src = _data[i]; - Vertex & dst = m_vertices[i]; - dst.x = src.x; - dst.y = src.y; - dst.z = src.z; - dst.w = src.w; - if (_flatColors) { - dst.r = src.flat_r; - dst.g = src.flat_g; - dst.b = src.flat_b; - dst.a = src.flat_a; - } else { - dst.r = src.r; - dst.g = src.g; - dst.b = src.b; - dst.a = src.a; - } - dst.s = src.s; - dst.t = src.t; - dst.modify = src.modify; - dst.bc0 = src.bc0; - dst.bc1 = src.bc1; - } -} - -void BufferedDrawer::_updateTrianglesBuffers(const graphics::Context::DrawTriangleParameters & _params) -{ - const BuffersType type = BuffersType::triangles; - - if (m_type != type) { - glBindVertexArray(m_trisBuffers.vao); - m_type = type; - } - - _convertFromSPVertex(_params.flatColors, _params.verticesCount, _params.vertices); - const u32 vboDataSize = _params.verticesCount * static_cast(sizeof(Vertex)); - Buffer & vboBuffer = m_trisBuffers.vbo; - _updateBuffer(vboBuffer, _params.verticesCount, vboDataSize, m_vertices.data()); - - if (_params.elements == nullptr) - return; - - const u32 eboDataSize = static_cast(sizeof(GLushort)) * _params.elementsCount; - Buffer & eboBuffer = m_trisBuffers.ebo; - _updateBuffer(eboBuffer, _params.elementsCount, eboDataSize, _params.elements); -} - -void BufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParameters & _params) -{ - _updateTrianglesBuffers(_params); - - if (isHWLightingAllowed()) - glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight)); - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcCompatible) { - if (_params.elements == nullptr) { - glDrawArrays(GLenum(_params.mode), m_trisBuffers.vbo.pos - _params.verticesCount, _params.verticesCount); - return; - } - - glDrawRangeElementsBaseVertex(GLenum(_params.mode), 0, _params.verticesCount - 1, _params.elementsCount, GL_UNSIGNED_SHORT, - (u16*)nullptr + m_trisBuffers.ebo.pos - _params.elementsCount, m_trisBuffers.vbo.pos - _params.verticesCount); - return; - } - - // Draw polygons one by one - - if (_params.elements == nullptr) { - const GLint vboStartPos = m_trisBuffers.vbo.pos - _params.verticesCount; - if (_params.mode != graphics::drawmode::TRIANGLES) { - glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); - glDrawArrays(GLenum(_params.mode), m_trisBuffers.vbo.pos - _params.verticesCount, _params.verticesCount); - return; - } - - for (GLint i = 0; i < GLint(_params.verticesCount); i += 3) { - glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); - glDrawArrays(GLenum(_params.mode), vboStartPos + i, 3); - } - return; - } - - const GLint eboStartPos = m_trisBuffers.ebo.pos - _params.elementsCount; - const GLint vboStartPos = m_trisBuffers.vbo.pos - _params.verticesCount; - for (GLint i = 0; i < GLint(_params.elementsCount); i += 3) { - glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); - glDrawRangeElementsBaseVertex(GLenum(_params.mode), i, i + 2, 3, GL_UNSIGNED_SHORT, - (u16*)nullptr + eboStartPos + i, vboStartPos); - } -} - -void BufferedDrawer::drawLine(f32 _width, SPVertex * _vertices) -{ - const BuffersType type = BuffersType::triangles; - - if (m_type != type) { - glBindVertexArray(m_trisBuffers.vao); - m_type = type; - } - - _convertFromSPVertex(false, 2, _vertices); - const GLsizeiptr vboDataSize = 2 * sizeof(Vertex); - Buffer & vboBuffer = m_trisBuffers.vbo; - _updateBuffer(vboBuffer, 2, vboDataSize, m_vertices.data()); - - glLineWidth(_width); - glDrawArrays(GL_LINES, m_trisBuffers.vbo.pos - 2, 2); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferedDrawer.h b/GLideN64/src/Graphics/OpenGLContext/opengl_BufferedDrawer.h deleted file mode 100644 index 0255325..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_BufferedDrawer.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once -#include -#include -#include "opengl_GLInfo.h" -#include "opengl_GraphicsDrawer.h" -#include "opengl_CachedFunctions.h" - -namespace opengl { - - class BufferedDrawer : public GraphicsDrawer - { - public: - BufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray * _cachedAttribArray, - CachedBindBuffer * _bindBuffer); - ~BufferedDrawer(); - - void drawTriangles(const graphics::Context::DrawTriangleParameters & _params) override; - - void drawRects(const graphics::Context::DrawRectParameters & _params) override; - - void drawLine(f32 _width, SPVertex * _vertices) override; - - private: - void _updateRectBuffer(const graphics::Context::DrawRectParameters & _params); - void _updateTrianglesBuffers(const graphics::Context::DrawTriangleParameters & _params); - - enum class BuffersType { - none, - rects, - triangles - }; - - struct Buffer { - Buffer(GLenum _type) : type(_type) {} - - GLenum type; - GLuint handle = 0; - GLintptr offset = 0; - GLint pos = 0; - GLuint size = 0; - GLubyte * data = nullptr; - }; - - struct RectBuffers { - GLuint vao = 0; - Buffer vbo = Buffer(GL_ARRAY_BUFFER); - }; - - struct TrisBuffers { - GLuint vao = 0; - Buffer vbo = Buffer(GL_ARRAY_BUFFER); - Buffer ebo = Buffer(GL_ELEMENT_ARRAY_BUFFER); - }; - - struct Vertex - { - f32 x, y, z, w; - f32 r, g, b, a; - f32 s, t; - f32 bc0, bc1; - u32 modify; - }; - - void _initBuffer(Buffer & _buffer, GLuint _bufSize); - void _updateBuffer(Buffer & _buffer, u32 _count, u32 _dataSize, const void * _data); - void _convertFromSPVertex(bool _flatColors, u32 _count, const SPVertex * _data); - - const GLInfo & m_glInfo; - CachedVertexAttribArray * m_cachedAttribArray; - CachedBindBuffer * m_bindBuffer; - - RectBuffers m_rectsBuffers; - TrisBuffers m_trisBuffers; - BuffersType m_type = BuffersType::none; - - std::vector m_vertices; - - typedef std::unordered_map BufferOffsets; - BufferOffsets m_rectBufferOffsets; - - static const u32 m_bufMaxSize; - static const GLbitfield m_bufAccessBits; - static const GLbitfield m_bufMapBits; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_CachedFunctions.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_CachedFunctions.cpp deleted file mode 100644 index 43f6ce1..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_CachedFunctions.cpp +++ /dev/null @@ -1,315 +0,0 @@ -#include - -#include "GLFunctions.h" -#include "opengl_GLInfo.h" -#include "opengl_CachedFunctions.h" - -using namespace graphics; -using namespace opengl; - -/*---------------CachedEnable-------------*/ - -CachedEnable::CachedEnable(Parameter _parameter) -: m_parameter(_parameter) -{ -} - -void CachedEnable::enable(bool _enable) -{ - if (!m_parameter.isValid()) - return; - - if (!update(u32(_enable))) - return; - - if (_enable) { - if (m_parameter == enable::BLEND && IS_GL_FUNCTION_VALID(Enablei)) - glEnablei(GLenum(m_parameter), 0); - else - glEnable(GLenum(m_parameter)); - } else { - if (m_parameter == enable::BLEND && IS_GL_FUNCTION_VALID(Disablei)) - glDisablei(GLenum(m_parameter), 0); - else - glDisable(GLenum(m_parameter)); - } -} - -u32 CachedEnable::get() -{ - return u32(m_cached); -} - -/*---------------CachedBindFramebuffer-------------*/ - -void CachedBindFramebuffer::bind(graphics::Parameter _target, graphics::ObjectHandle _name) { - if (update(_target, _name)) - glBindFramebuffer(GLenum(_target), GLuint(_name)); -} - -/*---------------CachedBindRenderbuffer-------------*/ - -void CachedBindRenderbuffer::bind(graphics::Parameter _target, graphics::ObjectHandle _name) { - if (update(_target, _name)) - glBindRenderbuffer(GLenum(_target), GLuint(_name)); -} - -/*---------------CachedBindBuffer-------------*/ - -void CachedBindBuffer::bind(graphics::Parameter _target, graphics::ObjectHandle _name) { - if (update(_target, _name)) - glBindBuffer(GLenum(_target), GLuint(_name)); -} - -/*---------------CachedBindTexture-------------*/ - -void CachedBindTexture::bind(Parameter _tmuIndex, Parameter _target, ObjectHandle _name) -{ - if (update(_tmuIndex, _name)) { - glActiveTexture(GL_TEXTURE0 + GLuint(_tmuIndex)); - glBindTexture(GLenum(_target), GLuint(_name)); - } -} - -/*---------------CachedCullFace-------------*/ - -void CachedCullFace::setCullFace(Parameter _mode) -{ - if (update(_mode)) - glCullFace(GLenum(_mode)); -} - -/*---------------CachedDepthMask-------------*/ - -void CachedDepthMask::setDepthMask(bool _enable) -{ - if (update(Parameter(u32(_enable)))) - glDepthMask(GLboolean(_enable)); -} - -/*---------------CachedDepthMask-------------*/ - -void CachedDepthCompare::setDepthCompare(Parameter _mode) -{ - if (update(_mode)) - glDepthFunc(GLenum(_mode)); -} - -/*---------------CachedViewport-------------*/ - -void CachedViewport::setViewport(s32 _x, s32 _y, s32 _width, s32 _height) -{ - if (update(Parameter(_x), Parameter(_y), Parameter(_width), Parameter(_height))) - glViewport(_x, _y, _width, _height); -} - -/*---------------CachedScissor-------------*/ - -void CachedScissor::setScissor(s32 _x, s32 _y, s32 _width, s32 _height) -{ - if (update(Parameter(_x), Parameter(_y), Parameter(_width), Parameter(_height))) - glScissor(_x, _y, _width, _height); -} - -/*---------------CachedBlending-------------*/ - -void CachedBlending::setBlending(Parameter _sfactor, Parameter _dfactor) -{ - if (update(_sfactor, _dfactor)) - glBlendFunc(GLenum(_sfactor), GLenum(_dfactor)); -} - -/*---------------CachedBlendingSeparate-------------*/ - -void CachedBlendingSeparate::setBlendingSeparate(Parameter _sfactorcolor, Parameter _dfactorcolor, Parameter _sfactoralpha, Parameter _dfactoralpha) -{ - if (update(_sfactorcolor, _dfactorcolor, _sfactoralpha, _dfactoralpha)) - glBlendFuncSeparate(GLenum(_sfactorcolor), GLenum(_dfactorcolor), GLenum(_sfactoralpha), GLenum(_dfactoralpha)); -} - - -/*---------------CachedBlendColor-------------*/ - -void CachedBlendColor::setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) -{ - if (update(Parameter(_red), Parameter(_green), Parameter(_blue), Parameter(_alpha))) - glBlendColor(_red, _green, _blue, _alpha); -} - -/*---------------CachedClearColor-------------*/ - -void CachedClearColor::setClearColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) -{ - if (update(Parameter(_red), Parameter(_green), Parameter(_blue), Parameter(_alpha))) - glClearColor(_red, _green, _blue, _alpha); -} - -/*---------------CachedVertexAttribArray-------------*/ - -void CachedVertexAttribArray::enableVertexAttribArray(u32 _index, bool _enable) -{ - if (m_attribs[_index] == Parameter(u32(_enable))) - return; - m_attribs[_index] = Parameter(u32(_enable)); - - if (_enable) - glEnableVertexAttribArray(_index); - else - glDisableVertexAttribArray(_index); -} - -void CachedVertexAttribArray::reset() -{ - m_attribs.fill(Parameter()); -} - -/*---------------CachedUseProgram-------------*/ - -void CachedUseProgram::useProgram(graphics::ObjectHandle _program) -{ - if (update(_program)) - glUseProgram(GLuint(_program)); -} - -/*---------------CachedTextureUnpackAlignment-------------*/ - -void CachedTextureUnpackAlignment::setTextureUnpackAlignment(s32 _param) -{ - if (update(_param)) - glPixelStorei(GL_UNPACK_ALIGNMENT, _param); -} - -/*---------------CachedFunctions-------------*/ - -CachedFunctions::CachedFunctions(const GLInfo & _glinfo) -{ - if (_glinfo.isGLESX) { - // Disable parameters, not avalible for GLESX - m_enables.emplace(GL_DEPTH_CLAMP, Parameter()); - } -} - -CachedFunctions::~CachedFunctions() -{ -} - -void CachedFunctions::reset() -{ - for (auto it : m_enables) - it.second.reset(); - - m_texparams.clear(); - m_bindTexture.reset(); - m_bindFramebuffer.reset(); - m_bindRenderbuffer.reset(); - m_bindBuffer.reset(); - m_cullFace.reset(); - m_depthMask.reset(); - m_depthCompare.reset(); - m_viewport.reset(); - m_scissor.reset(); - m_blending.reset(); - m_blendColor.reset(); - m_clearColor.reset(); - m_attribArray.reset(); - m_useProgram.reset(); -} - -CachedEnable * CachedFunctions::getCachedEnable(Parameter _parameter) -{ - const u32 key(_parameter); - auto it = m_enables.find(key); - if (it == m_enables.end()) { - auto res = m_enables.emplace(key, _parameter); - if (res.second) - return &(res.first->second); - return nullptr; - } - return &(it->second); -} - -CachedBindTexture * CachedFunctions::getCachedBindTexture() -{ - return &m_bindTexture; -} - -CachedBindFramebuffer * CachedFunctions::getCachedBindFramebuffer() -{ - return &m_bindFramebuffer; -} - -CachedBindRenderbuffer * CachedFunctions::getCachedBindRenderbuffer() -{ - return &m_bindRenderbuffer; -} - -CachedBindBuffer * CachedFunctions::getCachedBindBuffer() -{ - return &m_bindBuffer; -} - -CachedCullFace * CachedFunctions::getCachedCullFace() -{ - return &m_cullFace; -} - -CachedDepthMask * CachedFunctions::getCachedDepthMask() -{ - return &m_depthMask; -} - -CachedDepthCompare * CachedFunctions::getCachedDepthCompare() -{ - return &m_depthCompare; -} - -CachedViewport * CachedFunctions::getCachedViewport() -{ - return &m_viewport; -} - -CachedScissor * CachedFunctions::getCachedScissor() -{ - return &m_scissor; -} - -CachedBlending * CachedFunctions::getCachedBlending() -{ - return &m_blending; -} - -CachedBlendingSeparate * CachedFunctions::getCachedBlendingSeparate() -{ - return &m_blendingseparate; -} - - -CachedBlendColor * CachedFunctions::getCachedBlendColor() -{ - return &m_blendColor; -} - -CachedClearColor * CachedFunctions::getCachedClearColor() -{ - return &m_clearColor; -} - -CachedVertexAttribArray * CachedFunctions::getCachedVertexAttribArray() -{ - return &m_attribArray; -} - -CachedUseProgram * CachedFunctions::getCachedUseProgram() -{ - return &m_useProgram; -} - -CachedTextureUnpackAlignment * CachedFunctions::getCachedTextureUnpackAlignment() -{ - return &m_unpackAlignment; -} - -TextureParams * CachedFunctions::getTexParams() -{ - return &m_texparams; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_CachedFunctions.h b/GLideN64/src/Graphics/OpenGLContext/opengl_CachedFunctions.h deleted file mode 100644 index 12e1aa9..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_CachedFunctions.h +++ /dev/null @@ -1,295 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include "opengl_GLInfo.h" -#include "opengl_Attributes.h" - -namespace opengl { - -#define CACHED_USE_CACHE1 -#define CACHED_USE_CACHE2 -#define CACHED_USE_CACHE4 - - template - class Cached1 - { - public: - bool update(T _param) - { -#ifdef CACHED_USE_CACHE1 - if (_param == m_cached) - return false; -#endif - m_cached = _param; - return true; - } - - void reset() - { - m_cached.reset(); - } - - protected: - T m_cached; - }; - - template - class Cached2 - { - public: - bool update(T1 _p1, T2 _p2) - { -#ifdef CACHED_USE_CACHE2 - if (_p1 == m_p1 && - _p2 == m_p2) - return false; -#endif - m_p1 = _p1; - m_p2 = _p2; - return true; - } - - void reset() - { - m_p1.reset(); - m_p2.reset(); - } - - protected: - T1 m_p1; - T2 m_p2; - }; - - class Cached4 - { - public: - bool update(graphics::Parameter _p1, - graphics::Parameter _p2, - graphics::Parameter _p3, - graphics::Parameter _p4) - { -#ifdef CACHED_USE_CACHE4 - if (_p1 == m_p1 && - _p2 == m_p2 && - _p3 == m_p3 && - _p4 == m_p4) - return false; -#endif - m_p1 = _p1; - m_p2 = _p2; - m_p3 = _p3; - m_p4 = _p4; - return true; - } - - void reset() - { - m_p1.reset(); - m_p2.reset(); - m_p3.reset(); - m_p4.reset(); - } - - protected: - graphics::Parameter m_p1, m_p2, m_p3, m_p4; - }; - - class CachedEnable : public Cached1 - { - public: - CachedEnable(graphics::Parameter _parameter); - - void enable(bool _enable); - - u32 get(); - - private: - const graphics::Parameter m_parameter; - }; - - - class CachedBindFramebuffer : public Cached2 - { - public: - void bind(graphics::Parameter _target, graphics::ObjectHandle _name); - }; - - class CachedBindRenderbuffer : public Cached2 - { - public: - void bind(graphics::Parameter _target, graphics::ObjectHandle _name); - }; - - class CachedBindBuffer : public Cached2 - { - public: - void bind(graphics::Parameter _target, graphics::ObjectHandle _name); - }; - - class CachedBindTexture : public Cached2 - { - public: - void bind(graphics::Parameter _tmuIndex, graphics::Parameter _target, graphics::ObjectHandle _name); - }; - - class CachedCullFace : public Cached1 - { - public: - void setCullFace(graphics::Parameter _mode); - }; - - class CachedDepthMask : public Cached1 - { - public: - void setDepthMask(bool _enable); - }; - - class CachedDepthCompare : public Cached1 - { - public: - void setDepthCompare(graphics::Parameter m_mode); - }; - - class CachedViewport : public Cached4 - { - public: - void setViewport(s32 _x, s32 _y, s32 _width, s32 _height); - }; - - class CachedScissor : public Cached4 - { - public: - void setScissor(s32 _x, s32 _y, s32 _width, s32 _height); - }; - - class CachedBlending : public Cached2 - { - public: - void setBlending(graphics::Parameter _sfactor, graphics::Parameter _dfactor); - }; - - class CachedBlendingSeparate : public Cached4 // - { - public: - void setBlendingSeparate(graphics::Parameter _sfactorcolor, graphics::Parameter _dfactorcolor, graphics::Parameter _sfactoralpha, graphics::Parameter _dfactoralpha); - }; - - - class CachedBlendColor : public Cached4 - { - public: - void setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha); - }; - - class CachedClearColor : public Cached4 - { - public: - void setClearColor(f32 _red, f32 _green, f32 _blue, f32 _alpha); - }; - - class CachedVertexAttribArray { - public: - CachedVertexAttribArray() = default; - void enableVertexAttribArray(u32 _index, bool _enable); - void reset(); - - private: - std::array m_attribs; - }; - - class CachedUseProgram : public Cached1 - { - public: - void useProgram(graphics::ObjectHandle _program); - }; - - class CachedTextureUnpackAlignment : public Cached1 - { - public: - CachedTextureUnpackAlignment() { m_cached = -1; } - void setTextureUnpackAlignment(s32 _param); - }; - - struct texture_params { - GLint magFilter; - GLint minFilter; - GLint wrapS; - GLint wrapT; - GLint maxMipmapLevel; - GLfloat maxAnisotropy; - }; - - typedef std::unordered_map TextureParams; - - /*---------------CachedFunctions-------------*/ - - class CachedFunctions - { - public: - CachedFunctions(const GLInfo & _glinfo); - ~CachedFunctions(); - - void reset(); - - CachedEnable * getCachedEnable(graphics::Parameter _parameter); - - CachedBindTexture * getCachedBindTexture(); - - CachedBindFramebuffer * getCachedBindFramebuffer(); - - CachedBindRenderbuffer * getCachedBindRenderbuffer(); - - CachedBindBuffer * getCachedBindBuffer(); - - CachedCullFace * getCachedCullFace(); - - CachedDepthMask * getCachedDepthMask(); - - CachedDepthCompare * getCachedDepthCompare(); - - CachedViewport * getCachedViewport(); - - CachedScissor * getCachedScissor(); - - CachedBlending * getCachedBlending(); - - CachedBlendingSeparate * getCachedBlendingSeparate(); - - CachedBlendColor * getCachedBlendColor(); - - CachedClearColor * getCachedClearColor(); - - CachedVertexAttribArray * getCachedVertexAttribArray(); - - CachedUseProgram * getCachedUseProgram(); - - CachedTextureUnpackAlignment * getCachedTextureUnpackAlignment(); - - TextureParams * getTexParams(); - - private: - typedef std::unordered_map EnableParameters; - - TextureParams m_texparams; - EnableParameters m_enables; - CachedBindTexture m_bindTexture; - CachedBindFramebuffer m_bindFramebuffer; - CachedBindRenderbuffer m_bindRenderbuffer; - CachedBindBuffer m_bindBuffer; - CachedCullFace m_cullFace; - CachedDepthMask m_depthMask; - CachedDepthCompare m_depthCompare; - CachedViewport m_viewport; - CachedScissor m_scissor; - CachedBlending m_blending; - CachedBlendingSeparate m_blendingseparate; - CachedBlendColor m_blendColor; - CachedClearColor m_clearColor; - CachedVertexAttribArray m_attribArray; - CachedUseProgram m_useProgram; - CachedTextureUnpackAlignment m_unpackAlignment; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp deleted file mode 100644 index cb0ccd4..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include -#include "opengl_ColorBufferReaderWithBufferStorage.h" - -using namespace graphics; -using namespace opengl; - -ColorBufferReaderWithBufferStorage::ColorBufferReaderWithBufferStorage(CachedTexture * _pTexture, - CachedBindBuffer * _bindBuffer) - : ColorBufferReader(_pTexture), m_bindBuffer(_bindBuffer) -{ - _initBuffers(); -} - -ColorBufferReaderWithBufferStorage::~ColorBufferReaderWithBufferStorage() -{ - _destroyBuffers(); -} - -void ColorBufferReaderWithBufferStorage::_initBuffers() -{ - m_numPBO = config.frameBufferEmulation.copyToRDRAM; - if (m_numPBO > _maxPBO) - m_numPBO = _maxPBO; - - // Generate Pixel Buffer Objects - glGenBuffers(m_numPBO, m_PBO); - m_curIndex = 0; - - // Initialize Pixel Buffer Objects - for (u32 index = 0; index < m_numPBO; ++index) { - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle(m_PBO[index])); - glBufferStorage(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, nullptr, GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT); - m_PBOData[index] = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, m_pTexture->textureBytes, GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); - } - - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null); -} - -void ColorBufferReaderWithBufferStorage::_destroyBuffers() -{ - glDeleteBuffers(m_numPBO, m_PBO); - - for (u32 index = 0; index < m_numPBO; ++index) { - m_PBO[index] = 0; - } -} - -const u8 * ColorBufferReaderWithBufferStorage::_readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, - u32& _stride) -{ - GLenum format = GLenum(_params.colorFormat); - GLenum type = GLenum(_params.colorType); - - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle(m_PBO[m_curIndex])); - - glReadPixels(_params.x0, _params.y0, m_pTexture->width, _params.height, format, type, nullptr); - - if (!_params.sync) { - m_curIndex = (m_curIndex + 1) % m_numPBO; - } else { - glFinish(); - } - - _heightOffset = 0; - _stride = m_pTexture->width; - - return reinterpret_cast(m_PBOData[m_curIndex]); -} - -void ColorBufferReaderWithBufferStorage::cleanUp() -{ - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.h b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.h deleted file mode 100644 index e871fea..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include "opengl_CachedFunctions.h" -#include - -namespace opengl { - - class ColorBufferReaderWithBufferStorage : - public graphics::ColorBufferReader - { - public: - ColorBufferReaderWithBufferStorage(CachedTexture * _pTexture, - CachedBindBuffer * _bindBuffer); - virtual ~ColorBufferReaderWithBufferStorage(); - - const u8 * _readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, u32& _stride) override; - - void cleanUp() override; - - private: - void _initBuffers(); - void _destroyBuffers(); - - CachedBindBuffer * m_bindBuffer; - - static const int _maxPBO = 3; - u32 m_numPBO; - GLuint m_PBO[_maxPBO]; - void* m_PBOData[_maxPBO]; - u32 m_curIndex; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.cpp deleted file mode 100644 index 8434262..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#if defined(EGL) && defined(OS_ANDROID) - -#include -#include -#include "opengl_ColorBufferReaderWithEGLImage.h" - -using namespace opengl; -using namespace graphics; - -ColorBufferReaderWithEGLImage::ColorBufferReaderWithEGLImage(CachedTexture *_pTexture, CachedBindTexture *_bindTexture) - : graphics::ColorBufferReader(_pTexture) - , m_bindTexture(_bindTexture) - , m_image(nullptr) - , m_usage(AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN|AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE) - , m_bufferLocked(false) -{ - _initBuffers(); -} - -ColorBufferReaderWithEGLImage::~ColorBufferReaderWithEGLImage() -{ - m_hardwareBuffer.release(); - - if (m_image != nullptr) { - eglDestroyImageKHR(eglGetDisplay(EGL_DEFAULT_DISPLAY), m_image); - } -} - -void ColorBufferReaderWithEGLImage::_initBuffers() -{ - AHardwareBuffer_Desc bufferDesc{m_pTexture->width, m_pTexture->height, - 1, AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM, - m_usage, - 0,0}; - m_hardwareBuffer.allocate(&bufferDesc); - - if(m_image == nullptr) - { - EGLint eglImgAttrs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE, EGL_NONE }; - m_image = eglCreateImageKHR(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_NO_CONTEXT, - EGL_NATIVE_BUFFER_ANDROID, m_hardwareBuffer.getClientBuffer(), eglImgAttrs); - - if (m_image != nullptr) { - m_bindTexture->bind(graphics::Parameter(0), textureTarget::TEXTURE_EXTERNAL, m_pTexture->name); - glEGLImageTargetTexture2DOES(GLenum(textureTarget::TEXTURE_EXTERNAL), m_image); - m_bindTexture->bind(graphics::Parameter(0), textureTarget::TEXTURE_EXTERNAL, ObjectHandle()); - } - } -} - - -const u8 * ColorBufferReaderWithEGLImage::_readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, - u32& _stride) -{ - GLenum format = GLenum(_params.colorFormat); - GLenum type = GLenum(_params.colorType); - - void* gpuData = nullptr; - - if (!_params.sync) { - m_hardwareBuffer.lock(AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN, &gpuData); - m_bufferLocked = true; - _heightOffset = static_cast(_params.y0); - _stride = m_hardwareBuffer.getStride(); - } else { - gpuData = m_pixelData.data(); - glReadPixels(_params.x0, _params.y0, m_pTexture->width, _params.height, format, type, gpuData); - _heightOffset = 0; - _stride = m_pTexture->width; - } - - return reinterpret_cast(gpuData); -} - -void ColorBufferReaderWithEGLImage::cleanUp() -{ - if (m_bufferLocked) { - m_hardwareBuffer.unlock(); - m_bufferLocked = false; - } -} - -#endif // EGL diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.h b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.h deleted file mode 100644 index 0b9118d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#ifdef EGL -#include -#include -#include "opengl_CachedFunctions.h" - -#include - -namespace opengl { - -class ColorBufferReaderWithEGLImage : public graphics::ColorBufferReader -{ -public: - ColorBufferReaderWithEGLImage(CachedTexture * _pTexture, CachedBindTexture * _bindTexture); - ~ColorBufferReaderWithEGLImage() override; - - const u8 * _readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, u32& _stride) override; - - void cleanUp() override; - -private: - void _initBuffers(); - - CachedBindTexture * m_bindTexture; - GraphicBufferWrapper m_hardwareBuffer; - EGLImageKHR m_image; - uint64_t m_usage; - bool m_bufferLocked; -}; - -} - -#endif //EGL diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp deleted file mode 100644 index b80cd78..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include "opengl_ColorBufferReaderWithPixelBuffer.h" - -using namespace graphics; -using namespace opengl; - -ColorBufferReaderWithPixelBuffer::ColorBufferReaderWithPixelBuffer(CachedTexture *_pTexture, - CachedBindBuffer *_bindBuffer) - : ColorBufferReader(_pTexture), m_bindBuffer(_bindBuffer) -{ - _initBuffers(); -} - - -ColorBufferReaderWithPixelBuffer::~ColorBufferReaderWithPixelBuffer() -{ - _destroyBuffers(); -} - -void ColorBufferReaderWithPixelBuffer::_destroyBuffers() -{ - glDeleteBuffers(m_numPBO, m_PBO); - - for (u32 index = 0; index < m_numPBO; ++index) - m_PBO[index] = 0; -} - -void ColorBufferReaderWithPixelBuffer::_initBuffers() -{ - m_numPBO = config.frameBufferEmulation.copyToRDRAM; - if (m_numPBO > _maxPBO) - m_numPBO = _maxPBO; - - // Generate Pixel Buffer Objects - glGenBuffers(m_numPBO, m_PBO); - m_curIndex = 0; - - // Initialize Pixel Buffer Objects - for (u32 i = 0; i < m_numPBO; ++i) { - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle(m_PBO[i])); - glBufferData(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, nullptr, GL_DYNAMIC_READ); - } - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null); -} - -const u8 * ColorBufferReaderWithPixelBuffer::_readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, - u32& _stride) -{ - GLenum format = GLenum(_params.colorFormat); - GLenum type = GLenum(_params.colorType); - - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle(m_PBO[m_curIndex])); - glReadPixels(_params.x0, _params.y0, m_pTexture->width, _params.height, format, type, 0); - // If Sync, read pixels from the buffer, copy them to RDRAM. - // If not Sync, read pixels from the buffer, copy pixels from the previous buffer to RDRAM. - if (!_params.sync) { - m_curIndex = (m_curIndex + 1) % m_numPBO; - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle(m_PBO[m_curIndex])); - } - - _heightOffset = 0; - _stride = m_pTexture->width; - - return reinterpret_cast(glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, - m_pTexture->width * _params.height * _params.colorFormatBytes, GL_MAP_READ_BIT)); -} - -void ColorBufferReaderWithPixelBuffer::cleanUp() -{ - glUnmapBuffer(GL_PIXEL_PACK_BUFFER); - m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.h b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.h deleted file mode 100644 index f2508cd..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include -#include "opengl_CachedFunctions.h" - -namespace opengl { - -class ColorBufferReaderWithPixelBuffer : - public graphics::ColorBufferReader -{ -public: - ColorBufferReaderWithPixelBuffer(CachedTexture * _pTexture, - CachedBindBuffer * _bindBuffer); - ~ColorBufferReaderWithPixelBuffer(); - - const u8 * _readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, u32& _stride) override; - void cleanUp() override; - -private: - void _initBuffers(); - void _destroyBuffers(); - - CachedBindBuffer * m_bindBuffer; - - u32 m_numPBO; - static const int _maxPBO = 3; - GLuint m_PBO[_maxPBO]; - u32 m_curIndex; -}; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.cpp deleted file mode 100644 index aedda5d..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "opengl_ColorBufferReaderWithReadPixels.h" -#include - -using namespace graphics; -using namespace opengl; - -ColorBufferReaderWithReadPixels::ColorBufferReaderWithReadPixels(CachedTexture *_pTexture) - : ColorBufferReader(_pTexture) -{ - -} - -const u8 * ColorBufferReaderWithReadPixels::_readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, - u32& _stride) -{ - GLenum format = GLenum(_params.colorFormat); - GLenum type = GLenum(_params.colorType); - - // No async pixel buffer copies are supported in this class, this is a last resort fallback - u8* gpuData = m_pixelData.data(); - glReadPixels(_params.x0, _params.y0, m_pTexture->width, _params.height, format, type, gpuData); - - _heightOffset = 0; - _stride = m_pTexture->width; - - return gpuData; -} - -void ColorBufferReaderWithReadPixels::cleanUp() -{ -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.h b/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.h deleted file mode 100644 index 9e5fcc8..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithReadPixels.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include -#include "opengl_CachedFunctions.h" - -namespace opengl { - -class ColorBufferReaderWithReadPixels : - public graphics::ColorBufferReader -{ -public: - ColorBufferReaderWithReadPixels(CachedTexture * _pTexture); - ~ColorBufferReaderWithReadPixels() = default; - - const u8 * _readPixels(const ReadColorBufferParams& _params, u32& _heightOffset, u32& _stride) override; - void cleanUp() override; -}; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp deleted file mode 100644 index e3a2bee..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp +++ /dev/null @@ -1,549 +0,0 @@ -#include -#include -#include -#include -#include -#include "opengl_ContextImpl.h" -#include "opengl_BufferedDrawer.h" -#include "opengl_UnbufferedDrawer.h" -#include "opengl_ColorBufferReaderWithPixelBuffer.h" -#include "opengl_ColorBufferReaderWithBufferStorage.h" -#ifdef OS_ANDROID -#include "opengl_ColorBufferReaderWithEGLImage.h" -#endif -#include "opengl_ColorBufferReaderWithReadPixels.h" -#include "opengl_Utils.h" -#include "GLSL/glsl_CombinerProgramBuilder.h" -#include "GLSL/glsl_SpecialShadersFactory.h" -#include "GLSL/glsl_ShaderStorage.h" - -#ifdef OS_ANDROID -#include -#endif - -#ifdef min -#undef min -#endif - -using namespace opengl; - -ContextImpl::ContextImpl() - : m_clampMode(graphics::ClampMode::ClippingEnabled) -{ - -} - - -ContextImpl::~ContextImpl() -{ -} - -void ContextImpl::init() -{ - m_clampMode = graphics::ClampMode::ClippingEnabled; - m_glInfo.init(); - - if (m_glInfo.isGLES2) { - // Correct buffer target parameters, since GLES2 knows only GL_FRAMEBUFFER - graphics::bufferTarget::DRAW_FRAMEBUFFER = graphics::bufferTarget::FRAMEBUFFER; - graphics::bufferTarget::READ_FRAMEBUFFER = graphics::bufferTarget::FRAMEBUFFER; - } - - if (!m_cachedFunctions) - m_cachedFunctions.reset(new CachedFunctions(m_glInfo)); - - { - TextureManipulationObjectFactory textureObjectsFactory(m_glInfo, *m_cachedFunctions.get()); - m_createTexture.reset(textureObjectsFactory.getCreate2DTexture()); - m_init2DTexture.reset(textureObjectsFactory.getInit2DTexture()); - m_update2DTexture.reset(textureObjectsFactory.getUpdate2DTexture()); - m_set2DTextureParameters.reset(textureObjectsFactory.getSet2DTextureParameters()); - } - - { - BufferManipulationObjectFactory bufferObjectFactory(m_glInfo, *m_cachedFunctions.get()); - m_fbTexFormats.reset(bufferObjectFactory.getFramebufferTextureFormats()); - m_createFramebuffer.reset(bufferObjectFactory.getCreateFramebufferObject()); - m_createRenderbuffer.reset(bufferObjectFactory.getCreateRenderbuffer()); - m_initRenderbuffer.reset(bufferObjectFactory.getInitRenderbuffer()); - m_addFramebufferRenderTarget.reset(bufferObjectFactory.getAddFramebufferRenderTarget()); - m_createPixelReadBuffer.reset(bufferObjectFactory.createPixelReadBuffer()); - m_blitFramebuffers.reset(bufferObjectFactory.getBlitFramebuffers()); - } - - { -#ifndef FORCE_UNBUFFERED_DRAWER - if (!m_glInfo.isGLESX || (m_glInfo.bufferStorage && m_glInfo.drawElementsBaseVertex)) - m_graphicsDrawer.reset(new BufferedDrawer(m_glInfo, m_cachedFunctions->getCachedVertexAttribArray(), m_cachedFunctions->getCachedBindBuffer())); - else -#endif - m_graphicsDrawer.reset(new UnbufferedDrawer(m_glInfo, m_cachedFunctions->getCachedVertexAttribArray())); - } - - resetCombinerProgramBuilder(); -} - -void ContextImpl::destroy() -{ - m_createTexture.reset(); - m_init2DTexture.reset(); - m_set2DTextureParameters.reset(); - - m_createFramebuffer.reset(); - m_createRenderbuffer.reset(); - m_initRenderbuffer.reset(); - m_addFramebufferRenderTarget.reset(); - m_graphicsDrawer.reset(); - m_combinerProgramBuilder.reset(); - - m_cachedFunctions.reset(); -} - -void ContextImpl::setClampMode(graphics::ClampMode _mode) -{ - if (!m_glInfo.isGLESX) { - switch (_mode) { - case graphics::ClampMode::ClippingEnabled: - m_cachedFunctions->getCachedEnable(graphics::enable::DEPTH_CLAMP)->enable(false); - m_cachedFunctions->getCachedEnable(graphics::enable::CLIP_DISTANCE0)->enable(false); - break; - case graphics::ClampMode::NoNearPlaneClipping: - m_cachedFunctions->getCachedEnable(graphics::enable::DEPTH_CLAMP)->enable(true); - m_cachedFunctions->getCachedEnable(graphics::enable::CLIP_DISTANCE0)->enable(true); - break; - case graphics::ClampMode::NoClipping: - m_cachedFunctions->getCachedEnable(graphics::enable::DEPTH_CLAMP)->enable(true); - m_cachedFunctions->getCachedEnable(graphics::enable::CLIP_DISTANCE0)->enable(false); - break; - } - } - m_clampMode = _mode; -} - -graphics::ClampMode ContextImpl::getClampMode() -{ - return m_clampMode; -} - -void ContextImpl::enable(graphics::EnableParam _parameter, bool _enable) -{ - m_cachedFunctions->getCachedEnable(_parameter)->enable(_enable); -} - -u32 ContextImpl::isEnabled(graphics::EnableParam _parameter) -{ - return m_cachedFunctions->getCachedEnable(_parameter)->get(); -} - -void ContextImpl::cullFace(graphics::CullModeParam _mode) -{ - m_cachedFunctions->getCachedCullFace()->setCullFace(_mode); -} - -void ContextImpl::enableDepthWrite(bool _enable) -{ - m_cachedFunctions->getCachedDepthMask()->setDepthMask(_enable); -} - -void ContextImpl::setDepthCompare(graphics::CompareParam _mode) -{ - m_cachedFunctions->getCachedDepthCompare()->setDepthCompare(_mode); -} - -void ContextImpl::setViewport(s32 _x, s32 _y, s32 _width, s32 _height) -{ - m_cachedFunctions->getCachedViewport()->setViewport(_x, _y, _width, _height); -} - -void ContextImpl::setScissor(s32 _x, s32 _y, s32 _width, s32 _height) -{ - m_cachedFunctions->getCachedScissor()->setScissor(_x, _y, _width, _height); -} - -void ContextImpl::setBlending(graphics::BlendParam _sfactor, graphics::BlendParam _dfactor) -{ - m_cachedFunctions->getCachedBlending()->setBlending(_sfactor, _dfactor); - m_cachedFunctions->getCachedBlendingSeparate()->reset(); -} - -void ContextImpl::setBlendingSeparate(graphics::BlendParam _sfactorcolor, graphics::BlendParam _dfactorcolor, graphics::BlendParam _sfactoralpha, graphics::BlendParam _dfactoralpha) -{ - m_cachedFunctions->getCachedBlendingSeparate()->setBlendingSeparate(_sfactorcolor, _dfactorcolor, _sfactoralpha, _dfactoralpha); - m_cachedFunctions->getCachedBlending()->reset(); -} - -void ContextImpl::setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) -{ - m_cachedFunctions->getCachedBlendColor()->setBlendColor(_red, _green, _blue, _alpha); -} - -void ContextImpl::clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha) -{ - CachedEnable * enableScissor = m_cachedFunctions->getCachedEnable(graphics::enable::SCISSOR_TEST); - enableScissor->enable(false); - - if (m_glInfo.isGLES2) { - m_cachedFunctions->getCachedClearColor()->setClearColor(_red, _green, _blue, _alpha); - glClear(GL_COLOR_BUFFER_BIT); - } else { - GLfloat values[4] = {_red, _green, _blue, _alpha}; - glClearBufferfv(GL_COLOR, 0, values); - } - - enableScissor->enable(true); -} - -void ContextImpl::clearDepthBuffer() -{ - CachedEnable * enableScissor = m_cachedFunctions->getCachedEnable(graphics::enable::SCISSOR_TEST); - CachedDepthMask * depthMask = m_cachedFunctions->getCachedDepthMask(); - enableScissor->enable(false); - - if (m_glInfo.renderer == Renderer::PowerVR) { - depthMask->setDepthMask(false); - glClear(GL_DEPTH_BUFFER_BIT); - } - - depthMask->setDepthMask(true); - glClear(GL_DEPTH_BUFFER_BIT); - - enableScissor->enable(true); -} - -void ContextImpl::setPolygonOffset(f32 _factor, f32 _units) -{ - glPolygonOffset(_factor, _units); -} - -/*---------------Texture-------------*/ - -graphics::ObjectHandle ContextImpl::createTexture(graphics::Parameter _target) -{ - return m_createTexture->createTexture(_target); -} - -void ContextImpl::deleteTexture(graphics::ObjectHandle _name) -{ - u32 glName(_name); - glDeleteTextures(1, &glName); - m_init2DTexture->reset(_name); - - m_cachedFunctions->getTexParams()->erase(u32(_name)); -} - -void ContextImpl::init2DTexture(const graphics::Context::InitTextureParams & _params) -{ - m_init2DTexture->init2DTexture(_params); -} - -void ContextImpl::update2DTexture(const graphics::Context::UpdateTextureDataParams & _params) -{ - m_update2DTexture->update2DTexture(_params); -} - -void ContextImpl::setTextureParameters(const graphics::Context::TexParameters & _parameters) -{ - m_set2DTextureParameters->setTextureParameters(_parameters); -} - -void ContextImpl::bindTexture(const graphics::Context::BindTextureParameters & _params) { - m_cachedFunctions->getCachedBindTexture()->bind(_params.textureUnitIndex, _params.target, _params.texture); -} - -void ContextImpl::setTextureUnpackAlignment(s32 _param) -{ - m_cachedFunctions->getCachedTextureUnpackAlignment()->setTextureUnpackAlignment(_param); -} - -s32 ContextImpl::getTextureUnpackAlignment() const -{ - GLint unpackAlignment; - glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackAlignment); - return unpackAlignment; -} - -s32 ContextImpl::getMaxTextureSize() const -{ - GLint maxTextureSize; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); - return maxTextureSize; -} - -void ContextImpl::bindImageTexture(const graphics::Context::BindImageTextureParameters & _params) -{ - glBindImageTexture(GLuint(_params.imageUnit), GLuint(_params.texture), 0, GL_FALSE, 0, GLenum(_params.accessMode), GLenum(_params.textureFormat)); -} - -u32 ContextImpl::convertInternalTextureFormat(u32 _format) const -{ - if (!m_glInfo.isGLES2) - return _format; - - switch (_format) { - case GL_RGB8: - return GL_RGB; - case GL_RGBA8: - case GL_RGBA4: - case GL_RGB5_A1: - return GL_RGBA; - } - - return _format; -} - -void ContextImpl::textureBarrier() -{ - if (m_glInfo.texture_barrier) - glTextureBarrier(); - else if (m_glInfo.texture_barrierNV) - glTextureBarrierNV(); -} - -/*---------------Framebuffer-------------*/ - -graphics::FramebufferTextureFormats * ContextImpl::getFramebufferTextureFormats() -{ - return m_fbTexFormats.release(); -} - -graphics::ObjectHandle ContextImpl::createFramebuffer() -{ - return m_createFramebuffer->createFramebuffer(); -} - -void ContextImpl::deleteFramebuffer(graphics::ObjectHandle _name) -{ - u32 fbo(_name); - if (fbo != 0) { - glDeleteFramebuffers(1, &fbo); - m_cachedFunctions->getCachedBindFramebuffer()->reset(); - } -} - -void ContextImpl::bindFramebuffer(graphics::BufferTargetParam _target, graphics::ObjectHandle _name) -{ - if (m_glInfo.renderer == Renderer::VideoCore) { - CachedDepthMask * depthMask = m_cachedFunctions->getCachedDepthMask(); - depthMask->setDepthMask(true); - glClear(GL_DEPTH_BUFFER_BIT); - } - m_cachedFunctions->getCachedBindFramebuffer()->bind(_target, _name); -} - -graphics::ObjectHandle ContextImpl::createRenderbuffer() -{ - return m_createRenderbuffer->createRenderbuffer(); -} - -void ContextImpl::initRenderbuffer(const graphics::Context::InitRenderbufferParams & _params) -{ - m_initRenderbuffer->initRenderbuffer(_params); -} - -void ContextImpl::addFrameBufferRenderTarget(const graphics::Context::FrameBufferRenderTarget & _params) -{ - m_addFramebufferRenderTarget->addFrameBufferRenderTarget(_params); -} - -bool ContextImpl::blitFramebuffers(const graphics::Context::BlitFramebuffersParams & _params) -{ - return m_blitFramebuffers->blitFramebuffers(_params); -} - -void ContextImpl::setDrawBuffers(u32 _num) -{ - GLenum targets[4] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; - glDrawBuffers(_num, targets); -} - -graphics::PixelReadBuffer * ContextImpl::createPixelReadBuffer(size_t _sizeInBytes) -{ - if (m_createPixelReadBuffer) - return m_createPixelReadBuffer->createPixelReadBuffer(_sizeInBytes); - return nullptr; -} - -graphics::ColorBufferReader * ContextImpl::createColorBufferReader(CachedTexture * _pTexture) -{ -#if defined(EGL) && defined(OS_ANDROID) - if (m_glInfo.eglImage) - return new ColorBufferReaderWithEGLImage(_pTexture, m_cachedFunctions->getCachedBindTexture()); -#endif - - if (m_glInfo.bufferStorage && m_glInfo.renderer != Renderer::Intel) - return new ColorBufferReaderWithBufferStorage(_pTexture, m_cachedFunctions->getCachedBindBuffer()); - - if (!m_glInfo.isGLES2) - return new ColorBufferReaderWithPixelBuffer(_pTexture, m_cachedFunctions->getCachedBindBuffer()); - - return new ColorBufferReaderWithReadPixels(_pTexture); -} - -/*---------------Shaders-------------*/ - -bool ContextImpl::isCombinerProgramBuilderObsolete() -{ - if (!m_combinerProgramBuilder) - return true; - return m_combinerProgramBuilder->isObsolete(); -} - -void ContextImpl::resetCombinerProgramBuilder() -{ - if (!isCombinerProgramBuilderObsolete()) - return; - m_combinerProgramBuilder.reset(new glsl::CombinerProgramBuilder(m_glInfo, m_cachedFunctions->getCachedUseProgram())); - m_specialShadersFactory.reset(new glsl::SpecialShadersFactory(m_glInfo, - m_cachedFunctions->getCachedUseProgram(), - m_combinerProgramBuilder->getVertexShaderHeader(), - m_combinerProgramBuilder->getFragmentShaderHeader(), - m_combinerProgramBuilder->getFragmentShaderEnd())); -} - -graphics::CombinerProgram * ContextImpl::createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key) -{ - return m_combinerProgramBuilder->buildCombinerProgram(_color, _alpha, _key); -} - -bool ContextImpl::saveShadersStorage(const graphics::Combiners & _combiners) -{ - glsl::ShaderStorage storage(m_glInfo, m_cachedFunctions->getCachedUseProgram()); - return storage.saveShadersStorage(_combiners); -} - -bool ContextImpl::loadShadersStorage(graphics::Combiners & _combiners) -{ - glsl::ShaderStorage storage(m_glInfo, m_cachedFunctions->getCachedUseProgram()); - return storage.loadShadersStorage(_combiners); -} - -graphics::ShaderProgram * ContextImpl::createDepthFogShader() -{ - return m_specialShadersFactory->createShadowMapShader(); -} - -graphics::TexrectDrawerShaderProgram * ContextImpl::createTexrectDrawerDrawShader() -{ - return m_specialShadersFactory->createTexrectDrawerDrawShader(); -} - -graphics::ShaderProgram * ContextImpl::createTexrectDrawerClearShader() -{ - return m_specialShadersFactory->createTexrectDrawerClearShader(); -} - -graphics::ShaderProgram * ContextImpl::createTexrectUpscaleCopyShader() -{ - return m_specialShadersFactory->createTexrectUpscaleCopyShader(); -} - -graphics::ShaderProgram * ContextImpl::createTexrectColorAndDepthUpscaleCopyShader() -{ - return m_specialShadersFactory->createTexrectColorAndDepthUpscaleCopyShader(); -} - -graphics::ShaderProgram * ContextImpl::createTexrectDownscaleCopyShader() -{ - return m_specialShadersFactory->createTexrectDownscaleCopyShader(); -} - -graphics::ShaderProgram * ContextImpl::createTexrectColorAndDepthDownscaleCopyShader() -{ - return m_specialShadersFactory->createTexrectColorAndDepthDownscaleCopyShader(); -} - -graphics::ShaderProgram * ContextImpl::createGammaCorrectionShader() -{ - return m_specialShadersFactory->createGammaCorrectionShader(); -} - -graphics::ShaderProgram * ContextImpl::createFXAAShader() -{ - return m_specialShadersFactory->createFXAAShader(); -} - -graphics::TextDrawerShaderProgram * ContextImpl::createTextDrawerShader() -{ - return m_specialShadersFactory->createTextDrawerShader(); -} - -void ContextImpl::resetShaderProgram() -{ - m_cachedFunctions->getCachedUseProgram()->useProgram(graphics::ObjectHandle::null); -} - -void ContextImpl::drawTriangles(const graphics::Context::DrawTriangleParameters & _params) -{ - m_graphicsDrawer->drawTriangles(_params); -} - -void ContextImpl::drawRects(const graphics::Context::DrawRectParameters & _params) -{ - m_graphicsDrawer->drawRects(_params); -} - -void ContextImpl::drawLine(f32 _width, SPVertex * _vertices) -{ - m_graphicsDrawer->drawLine(_width, _vertices); -} - -f32 ContextImpl::getMaxLineWidth() -{ - GLfloat lineWidthRange[2] = { 0.0f, 0.0f }; - glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, lineWidthRange); - return lineWidthRange[1]; -} - -bool ContextImpl::isSupported(graphics::SpecialFeatures _feature) const -{ - switch (_feature) { - case graphics::SpecialFeatures::BlitFramebuffer: - return !m_glInfo.isGLES2; - case graphics::SpecialFeatures::WeakBlitFramebuffer: - return m_glInfo.isGLESX; - case graphics::SpecialFeatures::Multisampling: - return m_glInfo.msaa; - case graphics::SpecialFeatures::ImageTextures: - return m_glInfo.imageTextures; - case graphics::SpecialFeatures::ShaderProgramBinary: - return m_glInfo.shaderStorage; - case graphics::SpecialFeatures::DepthFramebufferTextures: - return m_glInfo.depthTexture; - case graphics::SpecialFeatures::IntegerTextures: - return !m_glInfo.isGLES2; - case graphics::SpecialFeatures::ClipControl: - return !m_glInfo.isGLESX; - case graphics::SpecialFeatures::N64DepthWithFbFetchDepth: - return m_glInfo.n64DepthWithFbFetch; - case graphics::SpecialFeatures::FramebufferFetchColor: - return m_glInfo.ext_fetch || m_glInfo.ext_fetch_arm; - case graphics::SpecialFeatures::TextureBarrier: - return m_glInfo.texture_barrier || m_glInfo.texture_barrierNV; - case graphics::SpecialFeatures::EglImage: - return m_glInfo.eglImage; - case graphics::SpecialFeatures::EglImageFramebuffer: - return m_glInfo.eglImageFramebuffer; - case graphics::SpecialFeatures::DualSourceBlending: - return m_glInfo.dual_source_blending; - } - return false; -} - -s32 ContextImpl::getMaxMSAALevel() -{ - GLint maxMSAALevel = 0; - glGetIntegerv(GL_MAX_SAMPLES, &maxMSAALevel); - // Limit maxMSAALevel by 16. - // Graphics driver may return 32 for max samples, but pixel format with 32 samples is not supported. - return std::min(maxMSAALevel, 16); -} - -bool ContextImpl::isError() const -{ - return Utils::isGLError(); -} - -bool ContextImpl::isFramebufferError() const -{ - return Utils::isFramebufferError(); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_ContextImpl.h b/GLideN64/src/Graphics/OpenGLContext/opengl_ContextImpl.h deleted file mode 100644 index 127f3ed..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_ContextImpl.h +++ /dev/null @@ -1,182 +0,0 @@ -#pragma once -#include -#include -#include "opengl_TextureManipulationObjectFactory.h" -#include "opengl_BufferManipulationObjectFactory.h" -#include "opengl_GLInfo.h" -#include "opengl_CachedFunctions.h" -#include "opengl_GraphicsDrawer.h" - -namespace glsl { - class CombinerProgramBuilder; - class SpecialShadersFactory; -} - -namespace opengl { - - class ContextImpl : public graphics::ContextImpl - { - public: - ContextImpl(); - ~ContextImpl(); - - void init() override; - - void destroy() override; - - void setClampMode(graphics::ClampMode _mode) override; - - graphics::ClampMode getClampMode() override; - - void enable(graphics::EnableParam _parameter, bool _enable) override; - - u32 isEnabled(graphics::EnableParam _parameter) override; - - void cullFace(graphics::CullModeParam _mode) override; - - void enableDepthWrite(bool _enable) override; - - void setDepthCompare(graphics::CompareParam _mode) override; - - void setViewport(s32 _x, s32 _y, s32 _width, s32 _height) override; - - void setScissor(s32 _x, s32 _y, s32 _width, s32 _height) override; - - void setBlending(graphics::BlendParam _sfactor, graphics::BlendParam _dfactor) override; - - void setBlendingSeparate(graphics::BlendParam _sfactorcolor, graphics::BlendParam _dfactorcolor, graphics::BlendParam _sfactoralpha, graphics::BlendParam _dfactoralpha) override; - - void setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) override; - - void clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha) override; - - void clearDepthBuffer() override; - - void setPolygonOffset(f32 _factor, f32 _units) override; - - /*---------------Texture-------------*/ - - graphics::ObjectHandle createTexture(graphics::Parameter _target) override; - - void deleteTexture(graphics::ObjectHandle _name) override; - - void init2DTexture(const graphics::Context::InitTextureParams & _params) override; - - void update2DTexture(const graphics::Context::UpdateTextureDataParams & _params) override; - - void setTextureParameters(const graphics::Context::TexParameters & _parameters) override; - - void bindTexture(const graphics::Context::BindTextureParameters & _params) override; - - void setTextureUnpackAlignment(s32 _param) override; - - s32 getTextureUnpackAlignment() const override; - - s32 getMaxTextureSize() const override; - - void bindImageTexture(const graphics::Context::BindImageTextureParameters & _params) override; - - u32 convertInternalTextureFormat(u32 _format) const override; - - void textureBarrier() override; - - /*---------------Framebuffer-------------*/ - - graphics::FramebufferTextureFormats * getFramebufferTextureFormats() override; - - graphics::ObjectHandle createFramebuffer() override; - - void deleteFramebuffer(graphics::ObjectHandle _name) override; - - void bindFramebuffer(graphics::BufferTargetParam _target, graphics::ObjectHandle _name) override; - - graphics::ObjectHandle createRenderbuffer() override; - - void initRenderbuffer(const graphics::Context::InitRenderbufferParams & _params) override; - - void addFrameBufferRenderTarget(const graphics::Context::FrameBufferRenderTarget & _params) override; - - bool blitFramebuffers(const graphics::Context::BlitFramebuffersParams & _params) override; - - void setDrawBuffers(u32 _num) override; - - /*---------------Pixelbuffer-------------*/ - - graphics::PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes) override; - - graphics::ColorBufferReader * createColorBufferReader(CachedTexture * _pTexture) override; - - /*---------------Shaders-------------*/ - - bool isCombinerProgramBuilderObsolete() override; - - void resetCombinerProgramBuilder() override; - - graphics::CombinerProgram * createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key) override; - - bool saveShadersStorage(const graphics::Combiners & _combiners) override; - - bool loadShadersStorage(graphics::Combiners & _combiners) override; - - graphics::ShaderProgram * createDepthFogShader() override; - - graphics::TexrectDrawerShaderProgram * createTexrectDrawerDrawShader() override; - - graphics::ShaderProgram * createTexrectDrawerClearShader() override; - - graphics::ShaderProgram * createTexrectUpscaleCopyShader() override; - - graphics::ShaderProgram * createTexrectColorAndDepthUpscaleCopyShader() override; - - graphics::ShaderProgram * createTexrectDownscaleCopyShader() override; - - graphics::ShaderProgram * createTexrectColorAndDepthDownscaleCopyShader() override; - - graphics::ShaderProgram * createGammaCorrectionShader() override; - - graphics::ShaderProgram * createFXAAShader() override; - - graphics::TextDrawerShaderProgram * createTextDrawerShader() override; - - void resetShaderProgram() override; - - void drawTriangles(const graphics::Context::DrawTriangleParameters & _params) override; - - void drawRects(const graphics::Context::DrawRectParameters & _params) override; - - void drawLine(f32 _width, SPVertex * _vertices) override; - - f32 getMaxLineWidth() override; - - bool isSupported(graphics::SpecialFeatures _feature) const override; - - s32 getMaxMSAALevel() override; - - bool isError() const override; - - bool isFramebufferError() const override; - - private: - std::unique_ptr m_cachedFunctions; - std::unique_ptr m_createTexture; - std::unique_ptr m_init2DTexture; - std::unique_ptr m_update2DTexture; - std::unique_ptr m_set2DTextureParameters; - - std::unique_ptr m_createFramebuffer; - std::unique_ptr m_createRenderbuffer; - std::unique_ptr m_initRenderbuffer; - std::unique_ptr m_addFramebufferRenderTarget; - std::unique_ptr m_createPixelReadBuffer; - std::unique_ptr m_blitFramebuffers; - std::unique_ptr m_fbTexFormats; - - std::unique_ptr m_graphicsDrawer; - - std::unique_ptr m_combinerProgramBuilder; - std::unique_ptr m_specialShadersFactory; - GLInfo m_glInfo; - graphics::ClampMode m_clampMode; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_GLInfo.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_GLInfo.cpp deleted file mode 100644 index e31e9cb..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_GLInfo.cpp +++ /dev/null @@ -1,228 +0,0 @@ -#include -#include -#include "opengl_Utils.h" -#include "opengl_GLInfo.h" -#include -#include - -#ifdef EGL -#include -#endif - -#ifdef OS_ANDROID -#include -#endif - -using namespace opengl; - -static -void APIENTRY on_gl_error(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - GLsizei length, - const char* message, - const void *userParam) -{ - LOG(LOG_ERROR, "%s", message); -} - -void GLInfo::init() { - const char * strDriverVersion = reinterpret_cast(glGetString(GL_VERSION)); - isGLESX = strstr(strDriverVersion, "OpenGL ES") != nullptr; - isGLES2 = strstr(strDriverVersion, "OpenGL ES 2") != nullptr; - if (isGLES2) { - majorVersion = 2; - minorVersion = 0; - } else { - glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); - glGetIntegerv(GL_MINOR_VERSION, &minorVersion); - } - LOG(LOG_VERBOSE, "%s major version: %d", isGLESX ? "OpenGL ES" : "OpenGL", majorVersion); - LOG(LOG_VERBOSE, "%s minor version: %d", isGLESX ? "OpenGL ES" : "OpenGL", minorVersion); - - - LOG(LOG_VERBOSE, "OpenGL vendor: %s", glGetString(GL_VENDOR)); - const char * strRenderer = reinterpret_cast(glGetString(GL_RENDERER)); - - bool isAnyAdreno = strstr(strRenderer, "Adreno") != nullptr; - - if (std::regex_match(std::string(strRenderer), std::regex("Adreno.*530"))) - renderer = Renderer::Adreno530; - else if (std::regex_match(std::string(strRenderer), std::regex("Adreno.*540")) || - std::regex_match(std::string(strRenderer), std::regex("Adreno.*6\\d\\d"))) - renderer = Renderer::Adreno_no_bugs; - else if (strstr(strRenderer, "Adreno") != nullptr) - renderer = Renderer::Adreno; - else if (strstr(strRenderer, "VideoCore IV") != nullptr) - renderer = Renderer::VideoCore; - else if (strstr(strRenderer, "Intel") != nullptr) - renderer = Renderer::Intel; - else if (strstr(strRenderer, "PowerVR") != nullptr) - renderer = Renderer::PowerVR; - else if (strstr(strRenderer, "NVIDIA Tegra") != nullptr) - renderer = Renderer::Tegra; - LOG(LOG_VERBOSE, "OpenGL renderer: %s", strRenderer); - - int numericVersion = majorVersion * 10 + minorVersion; - if (isGLES2) { - imageTextures = false; - msaa = false; - } else if (isGLESX) { - imageTextures = (numericVersion >= 31); - msaa = numericVersion >= 31; - } else { - imageTextures = (numericVersion >= 42) || Utils::isExtensionSupported(*this, "GL_ARB_shader_image_load_store"); - msaa = true; - } - - //Tegra has a buggy implementation of fragment_shader_interlock that causes graphics lockups on drivers below 390.00 - bool hasBuggyFragmentShaderInterlock = false; - - if (renderer == Renderer::Tegra) { - std::string strDriverVersionString(strDriverVersion); - std::string nvidiaText = "NVIDIA"; - std::size_t versionPosition = strDriverVersionString.find(nvidiaText); - - if (versionPosition == std::string::npos) { - hasBuggyFragmentShaderInterlock = true; - } else { - std::string strDriverVersionNumber = strDriverVersionString.substr(versionPosition + nvidiaText.length() + 1); - float versionNumber = std::stof(strDriverVersionNumber); - hasBuggyFragmentShaderInterlock = versionNumber < 390.0; - } - } - - fragment_interlock = Utils::isExtensionSupported(*this, "GL_ARB_fragment_shader_interlock") && !hasBuggyFragmentShaderInterlock; - fragment_interlockNV = Utils::isExtensionSupported(*this, "GL_NV_fragment_shader_interlock") && !fragment_interlock && !hasBuggyFragmentShaderInterlock; - fragment_ordering = Utils::isExtensionSupported(*this, "GL_INTEL_fragment_shader_ordering") && !fragment_interlock && !fragment_interlockNV; - - const bool imageTexturesInterlock = imageTextures && (fragment_interlock || fragment_interlockNV || fragment_ordering); - - if (isGLES2) { - config.generalEmulation.enableFragmentDepthWrite = 0; - config.generalEmulation.enableHybridFilter = 0; - } - - drawElementsBaseVertex = !isGLESX || - (Utils::isExtensionSupported(*this, "GL_EXT_draw_elements_base_vertex") || numericVersion >= 32); -#ifdef EGL - if (isGLESX && Utils::isExtensionSupported(*this, "GL_EXT_draw_elements_base_vertex") && numericVersion < 32) { - ptrDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) eglGetProcAddress("glDrawRangeElementsBaseVertexEXT"); - } -#endif - - bufferStorage = (!isGLESX && (numericVersion >= 44)) || Utils::isExtensionSupported(*this, "GL_ARB_buffer_storage") || - Utils::isExtensionSupported(*this, "GL_EXT_buffer_storage"); - - texStorage = (isGLESX && (numericVersion >= 30)) || (!isGLESX && numericVersion >= 42) || - Utils::isExtensionSupported(*this, "GL_ARB_texture_storage"); - - shaderStorage = false; -#if 0 - if (config.generalEmulation.enableShadersStorage != 0) { - const char * strGetProgramBinary = isGLESX - ? "GL_OES_get_program_binary" - : "GL_ARB_get_program_binary"; - if ((isGLESX && numericVersion >= 30) || (!isGLESX && numericVersion >= 41) || Utils::isExtensionSupported(*this, strGetProgramBinary)) { - GLint numBinaryFormats = 0; - glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &numBinaryFormats); - shaderStorage = numBinaryFormats > 0; - } - } -#endif - - bool ext_draw_buffers_indexed = isGLESX && (Utils::isExtensionSupported(*this, "GL_EXT_draw_buffers_indexed") || numericVersion >= 32); -#ifdef EGL - if (isGLESX && bufferStorage) - ptrBufferStorage = (PFNGLBUFFERSTORAGEPROC) eglGetProcAddress("glBufferStorageEXT"); - if (isGLESX && numericVersion < 32) { - if (ext_draw_buffers_indexed) { - ptrEnablei = (PFNGLENABLEIPROC) eglGetProcAddress("glEnableiEXT"); - ptrDisablei = (PFNGLDISABLEIPROC) eglGetProcAddress("glDisableiEXT"); - } else { - ptrEnablei = nullptr; - ptrDisablei = nullptr; - } - } - if (isGLES2 && shaderStorage) { - ptrProgramBinary = (PFNGLPROGRAMBINARYPROC) eglGetProcAddress("glProgramBinaryOES"); - ptrGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC) eglGetProcAddress("glGetProgramBinaryOES"); - ptrProgramParameteri = nullptr; - } -#endif -#ifndef OS_ANDROID - if (isGLES2 && config.frameBufferEmulation.copyToRDRAM > Config::ctSync) { - config.frameBufferEmulation.copyToRDRAM = Config::ctDisable; - LOG(LOG_WARNING, "Async color buffer copies are not supported on GLES2"); - } -#endif - if (isGLES2 && config.generalEmulation.enableLOD) { - if (!Utils::isExtensionSupported(*this, "GL_EXT_shader_texture_lod") || !Utils::isExtensionSupported(*this, "GL_OES_standard_derivatives")) { - config.generalEmulation.enableLOD = 0; - LOG(LOG_WARNING, "LOD emulation not possible on this device"); - } - } - - depthTexture = !isGLES2 || Utils::isExtensionSupported(*this, "GL_OES_depth_texture"); - noPerspective = Utils::isExtensionSupported(*this, "GL_NV_shader_noperspective_interpolation"); - - fetch_depth = Utils::isExtensionSupported(*this, "GL_ARM_shader_framebuffer_fetch_depth_stencil"); - texture_barrier = !isGLESX && (numericVersion >= 45 || Utils::isExtensionSupported(*this, "GL_ARB_texture_barrier")); - texture_barrierNV = Utils::isExtensionSupported(*this, "GL_NV_texture_barrier"); - - ext_fetch = Utils::isExtensionSupported(*this, "GL_EXT_shader_framebuffer_fetch") && (!isGLESX || ext_draw_buffers_indexed); - n64DepthWithFbFetch = ext_fetch && !imageTexturesInterlock; - eglImage = (Utils::isEGLExtensionSupported("EGL_KHR_image_base") || Utils::isEGLExtensionSupported("EGL_KHR_image")); - ext_fetch_arm = Utils::isExtensionSupported(*this, "GL_ARM_shader_framebuffer_fetch") && !ext_fetch; - - dual_source_blending = !isGLESX || (Utils::isExtensionSupported(*this, "GL_EXT_blend_func_extended") && !isAnyAdreno); - -#ifdef OS_ANDROID - eglImage = eglImage && - ( (isGLES2 && GraphicBufferWrapper::isSupportAvailable()) || (isGLESX && GraphicBufferWrapper::isPublicSupportAvailable()) ) && - (renderer != Renderer::PowerVR) && (renderer != Renderer::Tegra); -#endif - - if (renderer == Renderer::Intel) { - graphics::textureTarget::TEXTURE_EXTERNAL = GL_TEXTURE_2D; - } - - eglImageFramebuffer = eglImage && !isGLES2; - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - if (config.frameBufferEmulation.N64DepthCompare == Config::dcFast) { - if (!imageTexturesInterlock && !n64DepthWithFbFetch) { - config.frameBufferEmulation.N64DepthCompare = Config::dcDisable; - LOG(LOG_WARNING, "Your GPU does not support the extensions needed for fast N64 Depth Compare."); - } - } else { - // Compatible - if (!imageTextures) { - config.frameBufferEmulation.N64DepthCompare = Config::dcDisable; - LOG(LOG_WARNING, "Your GPU does not support the extensions needed for N64 Depth Compare."); - } - } - } - - coverage = dual_source_blending || ext_fetch || ext_fetch_arm; - if (coverage) { - GLint maxVertexAttribs = 0; - glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); - coverage = maxVertexAttribs >= 10; - } - -#ifdef EGL - if (isGLESX) - { - ptrDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC) eglGetProcAddress("glDebugMessageCallbackKHR"); - ptrDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC) eglGetProcAddress("glDebugMessageControlKHR"); - } -#endif - -#ifdef GL_DEBUG - glDebugMessageCallback(on_gl_error, nullptr); - glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); -#endif -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_GLInfo.h b/GLideN64/src/Graphics/OpenGLContext/opengl_GLInfo.h deleted file mode 100644 index be3c40b..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_GLInfo.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once -#include "GLFunctions.h" - -namespace opengl { - -enum class Renderer { - Adreno530, - Adreno_no_bugs, - Adreno, - VideoCore, - Intel, - PowerVR, - Tegra, - Other -}; - -struct GLInfo { - GLint majorVersion = 0; - GLint minorVersion = 0; - bool isGLES2 = false; - bool isGLESX = false; - bool imageTextures = false; - bool bufferStorage = false; - bool drawElementsBaseVertex = false; - bool texStorage = false; - bool shaderStorage = false; - bool msaa = false; - bool depthTexture = false; - bool noPerspective = false; - bool fetch_depth = false; - bool texture_barrier = false; - bool texture_barrierNV = false; - bool fragment_interlock = false; - bool fragment_interlockNV = false; - bool fragment_ordering = false; - bool ext_fetch = false; - bool ext_fetch_arm = false; - bool n64DepthWithFbFetch = false; - bool eglImage = false; - bool eglImageFramebuffer = false; - bool dual_source_blending = false; - bool coverage = false; - Renderer renderer = Renderer::Other; - - void init(); -}; -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_GraphicsDrawer.h b/GLideN64/src/Graphics/OpenGLContext/opengl_GraphicsDrawer.h deleted file mode 100644 index 94b1678..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_GraphicsDrawer.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef OPENGL_GRAPHICS_DRAWER_H -#define OPENGL_GRAPHICS_DRAWER_H -#include - -namespace opengl { - - class GraphicsDrawer { - public: - virtual ~GraphicsDrawer() {} - - virtual void drawTriangles(const graphics::Context::DrawTriangleParameters & _params) = 0; - - virtual void drawRects(const graphics::Context::DrawRectParameters & _params) = 0; - - virtual void drawLine(f32 _width, SPVertex * _vertices) = 0; - }; -} - - -#endif // OPENGL_GRAPHICS_DRAWER_H \ No newline at end of file diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_Parameters.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_Parameters.cpp deleted file mode 100644 index 68ad2ce..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_Parameters.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include -#include "GLFunctions.h" - -namespace graphics { - - namespace colorFormat { - ColorFormatParam RED_GREEN_BLUE(GL_RGB); - ColorFormatParam RGBA(GL_RGBA); - ColorFormatParam RG(GL_RG); - ColorFormatParam RED(GL_RED); - ColorFormatParam DEPTH(GL_DEPTH_COMPONENT); - ColorFormatParam LUMINANCE(0x1909); - } - - namespace internalcolorFormat { - InternalColorFormatParam NOCOLOR(0U); - InternalColorFormatParam RGB8(GL_RGB8); - InternalColorFormatParam RGBA8(GL_RGBA8); - InternalColorFormatParam RGBA4(GL_RGBA4); - InternalColorFormatParam RGB5_A1(GL_RGB5_A1); - InternalColorFormatParam RG(GL_RG8); - InternalColorFormatParam R16F(GL_R16F); - InternalColorFormatParam DEPTH(GL_DEPTH_COMPONENT24); - InternalColorFormatParam RG32F(GL_RG32F); - InternalColorFormatParam LUMINANCE(0x1909); - InternalColorFormatParam COLOR_INDEX8(0x80E5); - } - - namespace datatype { - DatatypeParam UNSIGNED_BYTE(GL_UNSIGNED_BYTE); - DatatypeParam UNSIGNED_SHORT(GL_UNSIGNED_SHORT); - DatatypeParam UNSIGNED_INT(GL_UNSIGNED_INT); - DatatypeParam FLOAT(GL_FLOAT); - DatatypeParam UNSIGNED_SHORT_5_6_5(GL_UNSIGNED_SHORT_5_6_5); - DatatypeParam UNSIGNED_SHORT_5_5_5_1(GL_UNSIGNED_SHORT_5_5_5_1); - DatatypeParam UNSIGNED_SHORT_4_4_4_4(GL_UNSIGNED_SHORT_4_4_4_4); - } - - namespace textureTarget { - TextureTargetParam TEXTURE_2D(GL_TEXTURE_2D); - TextureTargetParam TEXTURE_2D_MULTISAMPLE(GL_TEXTURE_2D_MULTISAMPLE); - TextureTargetParam RENDERBUFFER(GL_RENDERBUFFER); - TextureTargetParam TEXTURE_EXTERNAL(GL_TEXTURE_EXTERNAL_OES); - } - - namespace bufferTarget { - BufferTargetParam FRAMEBUFFER(GL_FRAMEBUFFER); - BufferTargetParam DRAW_FRAMEBUFFER(GL_DRAW_FRAMEBUFFER); - BufferTargetParam READ_FRAMEBUFFER(GL_READ_FRAMEBUFFER); - } - - namespace bufferAttachment { - BufferAttachmentParam COLOR_ATTACHMENT0(GL_COLOR_ATTACHMENT0); - BufferAttachmentParam COLOR_ATTACHMENT1(GL_COLOR_ATTACHMENT1); - BufferAttachmentParam COLOR_ATTACHMENT2(GL_COLOR_ATTACHMENT2); - BufferAttachmentParam DEPTH_ATTACHMENT(GL_DEPTH_ATTACHMENT); - } - - namespace enable { - EnableParam BLEND(GL_BLEND); - EnableParam CULL_FACE(GL_CULL_FACE); - EnableParam DEPTH_TEST(GL_DEPTH_TEST); - EnableParam DEPTH_CLAMP(GL_DEPTH_CLAMP); - EnableParam CLIP_DISTANCE0(GL_CLIP_DISTANCE0); - EnableParam DITHER(GL_DITHER); - EnableParam POLYGON_OFFSET_FILL(GL_POLYGON_OFFSET_FILL); - EnableParam SCISSOR_TEST(GL_SCISSOR_TEST); - } - - namespace textureIndices { - TextureUnitParam Tex[2] = { 0U, 1U }; - TextureUnitParam NoiseTex(2U); - TextureUnitParam DepthTex(3U); - TextureUnitParam ZLUTTex(4U); - TextureUnitParam PaletteTex(5U); - TextureUnitParam MSTex[2] = { 6U, 7U }; - } - - namespace textureImageUnits { - ImageUnitParam DepthZ(2U); - ImageUnitParam DepthDeltaZ(3U); - } - - namespace textureImageAccessMode { - ImageAccessModeParam READ_ONLY(GL_READ_ONLY); - ImageAccessModeParam WRITE_ONLY(GL_WRITE_ONLY); - ImageAccessModeParam READ_WRITE(GL_READ_WRITE); - } - - namespace textureParameters { - TextureParam FILTER_NEAREST(GL_NEAREST); - TextureParam FILTER_LINEAR(GL_LINEAR); - TextureParam FILTER_NEAREST_MIPMAP_NEAREST(GL_NEAREST_MIPMAP_NEAREST); - TextureParam FILTER_LINEAR_MIPMAP_NEAREST(GL_LINEAR_MIPMAP_NEAREST); - TextureParam WRAP_CLAMP_TO_EDGE(GL_CLAMP_TO_EDGE); - TextureParam WRAP_REPEAT(GL_REPEAT); - TextureParam WRAP_MIRRORED_REPEAT(GL_MIRRORED_REPEAT); - } - - namespace cullMode { - CullModeParam FRONT(GL_BACK); - CullModeParam BACK(GL_FRONT); - CullModeParam FRONT_AND_BACK(GL_FRONT_AND_BACK); - } - - namespace compare { - CompareParam LEQUAL(GL_LEQUAL); - CompareParam LESS(GL_LESS); - CompareParam ALWAYS(GL_ALWAYS); - } - - namespace blend { - BlendParam ZERO(GL_ZERO); - BlendParam ONE(GL_ONE); - BlendParam SRC_ALPHA(GL_SRC_ALPHA); - BlendParam DST_ALPHA(GL_DST_ALPHA); - BlendParam ONE_MINUS_SRC_ALPHA(GL_ONE_MINUS_SRC_ALPHA); - BlendParam CONSTANT_ALPHA(GL_CONSTANT_ALPHA); - BlendParam ONE_MINUS_CONSTANT_ALPHA(GL_ONE_MINUS_CONSTANT_ALPHA); - BlendParam SRC1_COLOR(GL_SRC1_COLOR); - BlendParam ONE_MINUS_SRC1_COLOR(GL_ONE_MINUS_SRC1_COLOR); - BlendParam SRC1_ALPHA(GL_SRC1_ALPHA); - BlendParam ONE_MINUS_SRC1_ALPHA(GL_ONE_MINUS_SRC1_ALPHA); - } - - namespace drawmode { - DrawModeParam TRIANGLES(GL_TRIANGLES); - DrawModeParam TRIANGLE_STRIP(GL_TRIANGLE_STRIP); - DrawModeParam TRIANGLE_FAN(GL_TRIANGLE_FAN); - DrawModeParam LINES(GL_LINES); - } - - namespace blitMask { - BlitMaskParam COLOR_BUFFER(GL_COLOR_BUFFER_BIT); - BlitMaskParam DEPTH_BUFFER(GL_DEPTH_BUFFER_BIT); - BlitMaskParam STENCIL_BUFFER(GL_STENCIL_BUFFER_BIT); - } -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.cpp deleted file mode 100644 index 37e1df3..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.cpp +++ /dev/null @@ -1,401 +0,0 @@ -#include -#include -#include -#include "opengl_GLInfo.h" -#include "opengl_CachedFunctions.h" -#include "opengl_Utils.h" -#include "opengl_TextureManipulationObjectFactory.h" - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -namespace opengl { - -//#define ENABLE_GL_4_5 -#define ENABLE_GL_4_2 - - /*---------------Create2DTexture-------------*/ - - class GenTexture : public Create2DTexture - { - public: - graphics::ObjectHandle createTexture(graphics::Parameter _target) override - { - GLuint glName; - glGenTextures(1, &glName); - return graphics::ObjectHandle(glName); - } - }; - - class CreateTexture : public Create2DTexture - { - public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_5 - return (_glinfo.majorVersion > 4) || (_glinfo.majorVersion == 4 && _glinfo.minorVersion >= 5); -#else - return false; -#endif - } - - graphics::ObjectHandle createTexture(graphics::Parameter _target) override - { - GLuint glName; - glCreateTextures(GLenum(_target), 1, &glName); - return graphics::ObjectHandle(glName); - } - }; - - /*---------------Init2DTexture-------------*/ - - class Init2DTexImage : public Init2DTexture - { - public: - Init2DTexImage(CachedBindTexture* _bind) : m_bind(_bind) {} - - void init2DTexture(const graphics::Context::InitTextureParams & _params) override - { - if (_params.msaaLevel == 0) { - m_bind->bind(_params.textureUnitIndex, _params.target, _params.handle); - glTexImage2D(GLuint(_params.target), - _params.mipMapLevel, - GLuint(_params.internalFormat), - _params.width, - _params.height, - 0, - GLenum(_params.format), - GLenum(_params.dataType), - _params.data); - } else { - m_bind->bind(_params.textureUnitIndex, graphics::textureTarget::TEXTURE_2D_MULTISAMPLE, _params.handle); - glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, - _params.msaaLevel, - GLenum(_params.internalFormat), - _params.width, - _params.height, - false); - } - } - - void reset(graphics::ObjectHandle _deleted) override { - m_bind->reset(); - } - - private: - CachedBindTexture* m_bind; - }; - - class Init2DTexStorage : public Init2DTexture - { - public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_2 - return (_glinfo.texStorage); -#else - return false; -#endif - } - - Init2DTexStorage(CachedBindTexture* _bind) - : m_bind(_bind) {} - - void init2DTexture(const graphics::Context::InitTextureParams & _params) override - { - if (_params.msaaLevel == 0) { - m_bind->bind(_params.textureUnitIndex, _params.target, _params.handle); - if (m_handle != _params.handle) { - m_handle = _params.handle; - glTexStorage2D(GLuint(_params.target), - _params.mipMapLevels, - GLenum(_params.internalFormat), - _params.width, - _params.height); - } - - if (_params.data != nullptr) { - glTexSubImage2D(GLuint(_params.target), - _params.mipMapLevel, - 0, 0, - _params.width, - _params.height, - GLuint(_params.format), - GLenum(_params.dataType), - _params.data); - } - } - else { - m_bind->bind(_params.textureUnitIndex, graphics::textureTarget::TEXTURE_2D_MULTISAMPLE, _params.handle); - glTexStorage2DMultisample( - GL_TEXTURE_2D_MULTISAMPLE, - _params.msaaLevel, - GLenum(_params.internalFormat), - _params.width, - _params.height, - GL_FALSE); - } - - } - - void reset(graphics::ObjectHandle _deleted) override - { - m_bind->reset(); - if (m_handle == _deleted) - m_handle = graphics::ObjectHandle(0); - } - - private: - CachedBindTexture* m_bind; - graphics::ObjectHandle m_handle; - }; - - class Init2DTextureStorage : public Init2DTexture - { - public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_5 - return (_glinfo.majorVersion > 4) || (_glinfo.majorVersion == 4 && _glinfo.minorVersion >= 5); -#else - return false; -#endif - } - void init2DTexture(const graphics::Context::InitTextureParams & _params) override - { - - if (_params.msaaLevel == 0) { - if (m_handle != _params.handle) { - m_handle = _params.handle; - glTextureStorage2D(GLuint(_params.handle), - _params.mipMapLevels, - GLenum(_params.internalFormat), - _params.width, - _params.height); - } - - if (_params.data != nullptr) { - glTextureSubImage2D(GLuint(_params.handle), - _params.mipMapLevel, - 0, 0, - _params.width, - _params.height, - GLuint(_params.format), - GLenum(_params.dataType), - _params.data); - } - } - else { - glTexStorage2DMultisample(GLuint(_params.handle), - _params.msaaLevel, - GLenum(_params.internalFormat), - _params.width, - _params.height, - GL_FALSE); - } - } - - void reset(graphics::ObjectHandle _deleted) override - { - if (m_handle == _deleted) - m_handle = graphics::ObjectHandle(0); - } - - private: - graphics::ObjectHandle m_handle; - }; - - /*---------------Update2DTexture-------------*/ - - class Update2DTexSubImage : public Update2DTexture - { - public: - Update2DTexSubImage(CachedBindTexture* _bind) - : m_bind(_bind) {} - - void update2DTexture(const graphics::Context::UpdateTextureDataParams & _params) override - { - m_bind->bind(_params.textureUnitIndex, GL_TEXTURE_2D, _params.handle); - - glTexSubImage2D(GL_TEXTURE_2D, - _params.mipMapLevel, - _params.x, - _params.y, - _params.width, - _params.height, - GLuint(_params.format), - GLenum(_params.dataType), - _params.data); - } - - private: - CachedBindTexture* m_bind; - }; - - class Update2DTextureSubImage : public Update2DTexture - { - public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_5 - return (_glinfo.majorVersion > 4) || (_glinfo.majorVersion == 4 && _glinfo.minorVersion >= 5); -#else - return false; -#endif - } - - void update2DTexture(const graphics::Context::UpdateTextureDataParams & _params) override - { - glTextureSubImage2D(GLuint(_params.handle), - _params.mipMapLevel, - _params.x, - _params.y, - _params.width, - _params.height, - GLuint(_params.format), - GLenum(_params.dataType), - _params.data); - } - }; - - /*---------------Set2DTextureParameters-------------*/ - - class SetTexParameters : public Set2DTextureParameters - { - public: - SetTexParameters(CachedBindTexture* _bind, TextureParams * _texparams, bool _supportMipmapLevel) - : m_bind(_bind) - , m_texparams(_texparams) - , m_supportMipmapLevel(_supportMipmapLevel) { - } - - void setTextureParameters(const graphics::Context::TexParameters & _parameters) override - { - TextureParams::const_iterator iter = m_texparams->find(u32(_parameters.handle)); - m_bind->bind(_parameters.textureUnitIndex, _parameters.target, _parameters.handle); - - const bool iterValid = iter != m_texparams->end(); - const GLenum target(_parameters.target); - if (_parameters.magFilter.isValid() && !(iterValid && iter->second.magFilter == GLint(_parameters.magFilter))) { - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GLint(_parameters.magFilter)); - (*m_texparams)[u32(_parameters.handle)].magFilter = GLint(_parameters.magFilter); - } - if (_parameters.minFilter.isValid() && !(iterValid && iter->second.minFilter == GLint(_parameters.minFilter))) { - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GLint(_parameters.minFilter)); - (*m_texparams)[u32(_parameters.handle)].minFilter = GLint(_parameters.minFilter); - } - if (_parameters.wrapS.isValid() && !(iterValid && iter->second.wrapS == GLint(_parameters.wrapS))) { - glTexParameteri(target, GL_TEXTURE_WRAP_S, GLint(_parameters.wrapS)); - (*m_texparams)[u32(_parameters.handle)].wrapS = GLint(_parameters.wrapS); - } - if (_parameters.wrapT.isValid() && !(iterValid && iter->second.wrapT == GLint(_parameters.wrapT))) { - glTexParameteri(target, GL_TEXTURE_WRAP_T, GLint(_parameters.wrapT)); - (*m_texparams)[u32(_parameters.handle)].wrapT = GLint(_parameters.wrapT); - } - if (m_supportMipmapLevel && _parameters.maxMipmapLevel.isValid() && !(iterValid && iter->second.maxMipmapLevel == GLint(_parameters.maxMipmapLevel))) { - glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, GLint(_parameters.maxMipmapLevel)); - (*m_texparams)[u32(_parameters.handle)].maxMipmapLevel = GLint(_parameters.maxMipmapLevel); - } - if (_parameters.maxAnisotropy.isValid() && !(iterValid && iter->second.maxAnisotropy == GLfloat(_parameters.maxAnisotropy))) { - glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, GLfloat(_parameters.maxMipmapLevel)); - (*m_texparams)[u32(_parameters.handle)].maxAnisotropy = GLfloat(_parameters.maxMipmapLevel); - } - } - - private: - CachedBindTexture* m_bind; - TextureParams* m_texparams; - bool m_supportMipmapLevel; - }; - - - class SetTextureParameters : public Set2DTextureParameters - { - public: - static bool Check(const GLInfo & _glinfo) { -#ifdef ENABLE_GL_4_5 - return (_glinfo.majorVersion > 4) || (_glinfo.majorVersion == 4 && _glinfo.minorVersion >= 5); -#else - return false; -#endif - } - - SetTextureParameters() {} - - void setTextureParameters(const graphics::Context::TexParameters & _parameters) override - { - const u32 handle(_parameters.handle); - auto it = m_parameters.find(handle); - // TODO make cacheable - if (it == m_parameters.end()) { - auto res = m_parameters.emplace(handle, _parameters); - if (res.second) - it = res.first; - } - - if (_parameters.magFilter.isValid()) - glTextureParameteri(handle, GL_TEXTURE_MAG_FILTER, GLint(_parameters.magFilter)); - if (_parameters.minFilter.isValid()) - glTextureParameteri(handle, GL_TEXTURE_MIN_FILTER, GLint(_parameters.minFilter)); - if (_parameters.wrapS.isValid()) - glTextureParameteri(handle, GL_TEXTURE_WRAP_S, GLint(_parameters.wrapS)); - if (_parameters.wrapT.isValid()) - glTextureParameteri(handle, GL_TEXTURE_WRAP_T, GLint(_parameters.wrapT)); - if (_parameters.maxMipmapLevel.isValid()) - glTextureParameteri(handle, GL_TEXTURE_MAX_LEVEL, GLint(_parameters.maxMipmapLevel)); - if (_parameters.maxAnisotropy.isValid()) - glTextureParameterf(handle, GL_TEXTURE_MAX_ANISOTROPY_EXT, GLfloat(_parameters.maxAnisotropy)); - } - - private: - typedef std::unordered_map TextureParameters; - TextureParameters m_parameters; - }; - - /*---------------TextureManipulationObjectFactory-------------*/ - - TextureManipulationObjectFactory::TextureManipulationObjectFactory(const GLInfo & _glinfo, - CachedFunctions & _cachedFunctions) - : m_glInfo(_glinfo) - , m_cachedFunctions(_cachedFunctions) - { - } - - TextureManipulationObjectFactory::~TextureManipulationObjectFactory() - { - } - - Create2DTexture * TextureManipulationObjectFactory::getCreate2DTexture() const - { - if (CreateTexture::Check(m_glInfo)) - return new CreateTexture; - - return new GenTexture; - } - - Init2DTexture * TextureManipulationObjectFactory::getInit2DTexture() const - { - if (Init2DTextureStorage::Check(m_glInfo)) - return new Init2DTextureStorage; - - if (Init2DTexStorage::Check(m_glInfo)) - return new Init2DTexStorage(m_cachedFunctions.getCachedBindTexture()); - - return new Init2DTexImage(m_cachedFunctions.getCachedBindTexture()); - } - - Update2DTexture * TextureManipulationObjectFactory::getUpdate2DTexture() const - { - if (Update2DTextureSubImage::Check(m_glInfo)) - return new Update2DTextureSubImage; - - return new Update2DTexSubImage(m_cachedFunctions.getCachedBindTexture()); - } - - Set2DTextureParameters * TextureManipulationObjectFactory::getSet2DTextureParameters() const - { - if (SetTextureParameters::Check(m_glInfo)) - return new SetTextureParameters; - - return new SetTexParameters(m_cachedFunctions.getCachedBindTexture(), m_cachedFunctions.getTexParams(), !m_glInfo.isGLES2); - } - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.h b/GLideN64/src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.h deleted file mode 100644 index 1f8aaea..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -#include -#include -#include - -namespace opengl { - - struct GLInfo; - class CachedFunctions; - - class Create2DTexture - { - public: - virtual ~Create2DTexture() {}; - virtual graphics::ObjectHandle createTexture(graphics::Parameter _target) = 0; - }; - - class Init2DTexture - { - public: - virtual ~Init2DTexture() {}; - virtual void init2DTexture(const graphics::Context::InitTextureParams & _params) = 0; - virtual void reset(graphics::ObjectHandle _deleted) = 0; - }; - - class Update2DTexture - { - public: - virtual ~Update2DTexture() {}; - virtual void update2DTexture(const graphics::Context::UpdateTextureDataParams & _params) = 0; - }; - - class Set2DTextureParameters - { - public: - virtual ~Set2DTextureParameters() {} - virtual void setTextureParameters(const graphics::Context::TexParameters & _parameters) = 0; - }; - - class TextureManipulationObjectFactory - { - public: - TextureManipulationObjectFactory(const GLInfo & _glinfo, CachedFunctions & _cachedFunctions); - ~TextureManipulationObjectFactory(); - - Create2DTexture * getCreate2DTexture() const; - - Init2DTexture * getInit2DTexture() const; - - Update2DTexture * getUpdate2DTexture() const; - - Set2DTextureParameters * getSet2DTextureParameters() const; - - private: - const GLInfo & m_glInfo; - CachedFunctions & m_cachedFunctions; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_UnbufferedDrawer.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_UnbufferedDrawer.cpp deleted file mode 100644 index 0737b9e..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_UnbufferedDrawer.cpp +++ /dev/null @@ -1,198 +0,0 @@ -#include -#include "GLFunctions.h" -#include "opengl_Attributes.h" -#include "opengl_CachedFunctions.h" -#include "opengl_UnbufferedDrawer.h" - -using namespace opengl; - -UnbufferedDrawer::UnbufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray * _cachedAttribArray) -: m_glInfo(_glinfo) -, m_cachedAttribArray(_cachedAttribArray) -, m_useCoverage(_glinfo.coverage) -{ - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::numlights, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false); - - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false); - - if (m_useCoverage) { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false); - } - - m_attribsData.fill(nullptr); -} - -UnbufferedDrawer::~UnbufferedDrawer() -{ -} - -bool UnbufferedDrawer::_updateAttribPointer(u32 _index, const void * _ptr) -{ - if (m_attribsData[_index] == _ptr) - return false; - - m_attribsData[_index] = _ptr; - return true; -} - -void UnbufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParameters & _params) -{ - { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, true); - const void * ptr = &_params.vertices->x; - if (_updateAttribPointer(triangleAttrib::position, ptr)) - glVertexAttribPointer(triangleAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr); - } - - if (_params.combiner->usesShade()) { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, true); - const void * ptr = _params.flatColors ? &_params.vertices->flat_r : &_params.vertices->r; - if (_updateAttribPointer(triangleAttrib::color, ptr)) - glVertexAttribPointer(triangleAttrib::color, 4, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr); - } - else - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false); - - if (_params.combiner->usesTexture()) { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, true); - const void * ptr = &_params.vertices->s; - if (_updateAttribPointer(triangleAttrib::texcoord, ptr)) - glVertexAttribPointer(triangleAttrib::texcoord, 2, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr); - } else - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false); - - { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, true); - const void * ptr = &_params.vertices->modify; - if (_updateAttribPointer(triangleAttrib::modify, ptr)) - glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_FALSE, sizeof(SPVertex), ptr); - } - - if (m_useCoverage) { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, true); - const void * ptr = &_params.vertices->bc0; - if (_updateAttribPointer(triangleAttrib::barycoords, ptr)) - glVertexAttribPointer(triangleAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr); - } - - if (isHWLightingAllowed()) - glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight)); - - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false); - if (m_useCoverage) - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false); - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcCompatible) { - if (_params.elements == nullptr) { - glDrawArrays(GLenum(_params.mode), 0, _params.verticesCount); - return; - } - - glDrawElements(GLenum(_params.mode), _params.elementsCount, GL_UNSIGNED_SHORT, _params.elements); - return; - } - - // Draw polygons one by one - - if (_params.elements == nullptr) { - if (_params.mode != graphics::drawmode::TRIANGLES) { - glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); - glDrawArrays(GLenum(_params.mode), 0, _params.verticesCount); - return; - } - - for (GLint i = 0; i < GLint(_params.verticesCount); i += 3) { - glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); - glDrawArrays(GLenum(_params.mode), i, 3); - } - return; - } - - for (GLint i = 0; i < GLint(_params.elementsCount); i += 3) { - glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); - glDrawElements(GLenum(_params.mode), 3, GL_UNSIGNED_BYTE, (u8*)_params.elements + i); - } -} - -void UnbufferedDrawer::drawRects(const graphics::Context::DrawRectParameters & _params) -{ - { - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, true); - const void * ptr = &_params.vertices->x; - if (_updateAttribPointer(rectAttrib::position, ptr)) - glVertexAttribPointer(rectAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr); - } - - if (_params.texrect && _params.combiner->usesTile(0)) { - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, true); - const void * ptr = &_params.vertices->s0; - if (_updateAttribPointer(rectAttrib::texcoord0, ptr)) - glVertexAttribPointer(rectAttrib::texcoord0, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr); - } else - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false); - - if (_params.texrect && _params.combiner->usesTile(1)) { - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, true); - const void * ptr = &_params.vertices->s1; - if (_updateAttribPointer(rectAttrib::texcoord1, ptr)) - glVertexAttribPointer(rectAttrib::texcoord1, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr); - } else - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false); - - if (m_useCoverage) { - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, true); - const void * ptr = &_params.vertices->bc0; - if (_updateAttribPointer(rectAttrib::barycoords, ptr)) - glVertexAttribPointer(rectAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr); - } - - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false); - if (m_useCoverage) - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false); - - glDrawArrays(GLenum(_params.mode), 0, _params.verticesCount); -} - -void UnbufferedDrawer::drawLine(f32 _width, SPVertex * _vertices) -{ - { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, true); - const void * ptr = &_vertices->x; - if (_updateAttribPointer(triangleAttrib::position, ptr)) - glVertexAttribPointer(triangleAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr); - } - - { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, true); - const void * ptr = &_vertices->r; - if (_updateAttribPointer(triangleAttrib::color, ptr)) - glVertexAttribPointer(triangleAttrib::color, 4, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr); - } - - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false); - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false); - - if (m_useCoverage) { - m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false); - } - - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false); - m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false); - - glLineWidth(_width); - glDrawArrays(GL_LINES, 0, 2); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_UnbufferedDrawer.h b/GLideN64/src/Graphics/OpenGLContext/opengl_UnbufferedDrawer.h deleted file mode 100644 index 547cb83..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_UnbufferedDrawer.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include -#include "opengl_GraphicsDrawer.h" -#include "opengl_GLInfo.h" - -namespace opengl { - class CachedVertexAttribArray; - - class UnbufferedDrawer : public GraphicsDrawer - { - public: - UnbufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray * _cachedAttribArray); - ~UnbufferedDrawer(); - - void drawTriangles(const graphics::Context::DrawTriangleParameters & _params) override; - - void drawRects(const graphics::Context::DrawRectParameters & _params) override; - - void drawLine(f32 _width, SPVertex * _vertices) override; - - private: - bool _updateAttribPointer(u32 _index, const void * _ptr); - - const GLInfo & m_glInfo; - CachedVertexAttribArray * m_cachedAttribArray; - std::array m_attribsData; - bool m_useCoverage = false; - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_Utils.cpp b/GLideN64/src/Graphics/OpenGLContext/opengl_Utils.cpp deleted file mode 100644 index 0847f11..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_Utils.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include -#include -#include -#include "opengl_Utils.h" -#include "GLFunctions.h" -#include - -using namespace opengl; - -bool Utils::isExtensionSupported(const opengl::GLInfo & _glinfo, const char *extension) { - if (_glinfo.majorVersion >= 3) { - GLint count = 0; - glGetIntegerv(GL_NUM_EXTENSIONS, &count); - assert(count >= 0); - for (GLuint i = 0; i < (GLuint)count; ++i) { - const char* name = (const char*)glGetStringi(GL_EXTENSIONS, i); - if (name == nullptr) - continue; - if (strcmp(extension, name) == 0) - return true; - } - return false; - } - - GLubyte *where = (GLubyte *)strchr(extension, ' '); - if (where || *extension == '\0') - return false; - - const GLubyte *extensions = glGetString(GL_EXTENSIONS); - if (extensions == nullptr) { - LOG(LOG_WARNING, "Could not query GL extensions on this device"); - return false; - } - - const GLubyte *start = extensions; - for (;;) { - where = (GLubyte *)strstr((const char *)start, extension); - if (where == nullptr) - break; - - GLubyte *terminator = where + strlen(extension); - if (where == start || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') - return true; - - start = terminator; - } - - return false; -} - -bool Utils::isEGLExtensionSupported(const char * extension) -{ -#ifdef EGL - const char* where = strchr(extension, ' '); - if (where || *extension == '\0') - return false; - - const char* extensions = eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS); - if (extensions == nullptr) { - LOG(LOG_WARNING, "Could not query EGL extensions on this device"); - return false; - } - - const char* start = extensions; - for (;;) { - where = strstr(start, extension); - if (where == nullptr) - break; - - const char* terminator = where + strlen(extension); - if (where == start || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') - return true; - - start = terminator; - } - - return false; -#else - return false; -#endif -} - -static -const char* GLErrorString(GLenum errorCode) -{ - static const struct { - GLenum code; - const char *string; - } errors[] = - { - /* GL */ - { GL_NO_ERROR, "no error" }, - { GL_INVALID_ENUM, "invalid enumerant" }, - { GL_INVALID_VALUE, "invalid value" }, - { GL_INVALID_OPERATION, "invalid operation" }, -#if !defined(GLESX) && !defined(OS_MAC_OS_X) - { GL_STACK_OVERFLOW, "stack overflow" }, - { GL_STACK_UNDERFLOW, "stack underflow" }, -#endif - { GL_OUT_OF_MEMORY, "out of memory" }, - - { 0, nullptr } - }; - - int i; - - for (i = 0; errors[i].string; i++) - { - if (errors[i].code == errorCode) - { - return errors[i].string; - } - } - - return nullptr; -} - -bool Utils::isGLError() -{ -#ifdef GL_DEBUG - GLenum errCode; - const char* errString; - - if ((errCode = glGetError()) != GL_NO_ERROR) { - errString = GLErrorString(errCode); - if (errString != nullptr) { - LOG(LOG_ERROR, "OpenGL Error: %s (%x)", errString, errCode); - } else { - LOG(LOG_ERROR, "OpenGL Error: %x", errCode); - } - - return true; - } -#endif - return false; -} - -bool Utils::isFramebufferError() -{ -#ifdef GL_DEBUG - GLenum e = glCheckFramebufferStatus(GL_FRAMEBUFFER); - switch (e) { - // case GL_FRAMEBUFFER_UNDEFINED: - // printf("FBO Undefined\n"); - // break; - case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: - LOG(LOG_ERROR, "[GlideN64]: FBO Incomplete Attachment"); - break; - case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: - LOG(LOG_ERROR, "[GlideN64]: FBO Missing Attachment"); - break; - // case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER : - // printf("FBO Incomplete Draw Buffer\n"); - // break; - case GL_FRAMEBUFFER_UNSUPPORTED: - LOG(LOG_ERROR, "[GlideN64]: FBO Unsupported"); - break; - case GL_FRAMEBUFFER_COMPLETE: - //LOG(LOG_VERBOSE, "[GlideN64]: FBO OK\n"); - break; - // case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: - // printf("framebuffer FRAMEBUFFER_DIMENSIONS\n"); - // break; - // case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: - // printf("framebuffer INCOMPLETE_FORMATS\n"); - // break; - default: - LOG(LOG_ERROR, "[GlideN64]: FBO Problem?"); - } - - return e != GL_FRAMEBUFFER_COMPLETE; -#else - return false; -#endif -} diff --git a/GLideN64/src/Graphics/OpenGLContext/opengl_Utils.h b/GLideN64/src/Graphics/OpenGLContext/opengl_Utils.h deleted file mode 100644 index a36c381..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/opengl_Utils.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "opengl_GLInfo.h" - -namespace opengl { - - struct Utils - { - static bool isExtensionSupported(const opengl::GLInfo & _glinfo, const char * extension); - static bool isEGLExtensionSupported(const char * extension); - static bool isGLError(); - static bool isFramebufferError(); - }; - -} diff --git a/GLideN64/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp b/GLideN64/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp deleted file mode 100644 index cd91caf..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include "WindowsWGL.h" -#include -#include -#include - -HGLRC WindowsWGL::hRC = NULL; -HDC WindowsWGL::hDC = NULL; - -bool WindowsWGL::start() -{ - int pixelFormat; - - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd - 1, // version number - PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | // support OpenGL - PFD_DOUBLEBUFFER, // double buffered - PFD_TYPE_RGBA, // RGBA type - 32, // color depth - 0, 0, 0, 0, 0, 0, // color bits ignored - 0, // no alpha buffer - 0, // shift bit ignored - 0, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - 32, // z-buffer - 0, // no stencil buffer - 0, // no auxiliary buffer - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; - - if (hWnd == NULL) - hWnd = GetActiveWindow(); - - if ((hDC = GetDC(hWnd)) == NULL) { - MessageBox(hWnd, L"Error while getting a device context!", pluginNameW, MB_ICONERROR | MB_OK); - return false; - } - - if ((pixelFormat = ChoosePixelFormat(hDC, &pfd)) == 0) { - MessageBox(hWnd, L"Unable to find a suitable pixel format!", pluginNameW, MB_ICONERROR | MB_OK); - stop(); - return false; - } - - if ((SetPixelFormat(hDC, pixelFormat, &pfd)) == FALSE) { - MessageBox(hWnd, L"Error while setting pixel format!", pluginNameW, MB_ICONERROR | MB_OK); - stop(); - return false; - } - - if ((hRC = wglCreateContext(hDC)) == NULL) { - MessageBox(hWnd, L"Error while creating OpenGL context!", pluginNameW, MB_ICONERROR | MB_OK); - stop(); - return false; - } - - if ((wglMakeCurrent(hDC, hRC)) == FALSE) { - MessageBox(hWnd, L"Error while making OpenGL context current!", pluginNameW, MB_ICONERROR | MB_OK); - stop(); - return false; - } - - initGLFunctions(); - - PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = - (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB"); - - if (wglGetExtensionsStringARB != NULL) { - const char * wglextensions = wglGetExtensionsStringARB(hDC); - - if (strstr(wglextensions, "WGL_ARB_create_context_profile") != nullptr) { - PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = - (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"); - - GLint majorVersion = 0; - ptrGetIntegerv(GL_MAJOR_VERSION, &majorVersion); - GLint minorVersion = 0; - ptrGetIntegerv(GL_MINOR_VERSION, &minorVersion); - - const int attribList[] = - { - WGL_CONTEXT_MAJOR_VERSION_ARB, majorVersion, - WGL_CONTEXT_MINOR_VERSION_ARB, minorVersion, -#ifdef FORCE_UNBUFFERED_DRAWER - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, -#else - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, -#endif - 0 //End - }; - - HGLRC coreHrc = wglCreateContextAttribsARB(hDC, 0, attribList); - if (coreHrc != NULL) { - wglDeleteContext(hRC); - wglMakeCurrent(hDC, coreHrc); - hRC = coreHrc; - } - } - - if (strstr(wglextensions, "WGL_EXT_swap_control") != nullptr) { - PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT"); - wglSwapIntervalEXT(config.video.verticalSync); - } - } - - return true; -} - -void WindowsWGL::stop() -{ - wglMakeCurrent(NULL, NULL); - - if (hRC != NULL) { - wglDeleteContext(hRC); - hRC = NULL; - } - - if (hDC != NULL) { - ReleaseDC(hWnd, hDC); - hDC = NULL; - } -} - -void WindowsWGL::swapBuffers() -{ - if (hDC == NULL) - SwapBuffers(wglGetCurrentDC()); - else - SwapBuffers(hDC); -} diff --git a/GLideN64/src/Graphics/OpenGLContext/windows/WindowsWGL.h b/GLideN64/src/Graphics/OpenGLContext/windows/WindowsWGL.h deleted file mode 100644 index fa39e3e..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/windows/WindowsWGL.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - -class WindowsWGL -{ -public: - static bool start(); - static void stop(); - static void swapBuffers(); - -private: - static HGLRC hRC; - static HDC hDC; -}; - diff --git a/GLideN64/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp b/GLideN64/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp deleted file mode 100644 index 0e7a164..0000000 --- a/GLideN64/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp +++ /dev/null @@ -1,229 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace opengl; - -class DisplayWindowWindows : public DisplayWindow -{ -public: - DisplayWindowWindows() = default; - -private: - bool _start() override; - void _stop() override; - void _restart() override; - void _swapBuffers() override; - void _saveScreenshot() override; - void _saveBufferContent(graphics::ObjectHandle _fbo, CachedTexture *_pTexture) override; - bool _resizeWindow() override; - void _changeWindow() override; - void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) override; - void _readScreen2(void * _dest, int * _width, int * _height, int _front) override {} - graphics::ObjectHandle _getDefaultFramebuffer() override; -}; - -DisplayWindow & DisplayWindow::get() -{ - static DisplayWindowWindows video; - return video; -} - -bool DisplayWindowWindows::_start() -{ - FunctionWrapper::setThreadedMode(config.video.threadedVideo); - - FunctionWrapper::windowsStart(); - return _resizeWindow(); -} - -void DisplayWindowWindows::_stop() -{ - FunctionWrapper::windowsStop(); -} - -void DisplayWindowWindows::_restart() -{ - -} - -void DisplayWindowWindows::_swapBuffers() -{ - //Don't let the command queue grow too big buy waiting on no more swap buffers being queued - FunctionWrapper::WaitForSwapBuffersQueued(); - - FunctionWrapper::windowsSwapBuffers(); -} - -void DisplayWindowWindows::_saveScreenshot() -{ - unsigned char * pixelData = NULL; - GLint oldMode; - glGetIntegerv(GL_READ_BUFFER, &oldMode); - gfxContext.bindFramebuffer(graphics::bufferTarget::READ_FRAMEBUFFER, graphics::ObjectHandle::defaultFramebuffer); - glReadBuffer(GL_FRONT); - pixelData = (unsigned char*)malloc(m_screenWidth * m_screenHeight * 3); - glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGB, GL_UNSIGNED_BYTE, pixelData); - if (graphics::BufferAttachmentParam(oldMode) == graphics::bufferAttachment::COLOR_ATTACHMENT0) { - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr) - gfxContext.bindFramebuffer(graphics::bufferTarget::READ_FRAMEBUFFER, pBuffer->m_FBO); - } - glReadBuffer(oldMode); - SaveScreenshot(m_strScreenDirectory, RSP.romname, m_screenWidth, m_screenHeight, pixelData); - free( pixelData ); -} - -void DisplayWindowWindows::_saveBufferContent(graphics::ObjectHandle _fbo, CachedTexture *_pTexture) -{ - unsigned char * pixelData = NULL; - GLint oldMode; - glGetIntegerv(GL_READ_BUFFER, &oldMode); - gfxContext.bindFramebuffer(graphics::bufferTarget::READ_FRAMEBUFFER, _fbo); - pixelData = (unsigned char*)malloc(_pTexture->width * _pTexture->height * 3); - glReadPixels(0, 0, _pTexture->width, _pTexture->height, GL_RGB, GL_UNSIGNED_BYTE, pixelData); - if (graphics::BufferAttachmentParam(oldMode) == graphics::bufferAttachment::COLOR_ATTACHMENT0) { - FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent(); - if (pCurrentBuffer != nullptr) - gfxContext.bindFramebuffer(graphics::bufferTarget::READ_FRAMEBUFFER, pCurrentBuffer->m_FBO); - } - glReadBuffer(oldMode); - SaveScreenshot(m_strScreenDirectory, RSP.romname, _pTexture->width, _pTexture->height, pixelData); - free(pixelData); -} - -void DisplayWindowWindows::_changeWindow() -{ - static LONG windowedStyle; - static LONG windowedExStyle; - static RECT windowedRect; - static HMENU windowedMenu; - - if (!m_bFullscreen) { - DEVMODE fullscreenMode; - memset( &fullscreenMode, 0, sizeof(DEVMODE) ); - fullscreenMode.dmSize = sizeof(DEVMODE); - fullscreenMode.dmPelsWidth = config.video.fullscreenWidth; - fullscreenMode.dmPelsHeight = config.video.fullscreenHeight; - fullscreenMode.dmBitsPerPel = 32; - fullscreenMode.dmDisplayFrequency = config.video.fullscreenRefresh; - fullscreenMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; - - if (ChangeDisplaySettings( &fullscreenMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL) { - MessageBox( NULL, L"Failed to change display mode", pluginNameW, MB_ICONERROR | MB_OK ); - return; - } - - ShowCursor( FALSE ); - - windowedMenu = GetMenu( hWnd ); - - if (windowedMenu) - SetMenu( hWnd, NULL ); - - if (hStatusBar) - ShowWindow( hStatusBar, SW_HIDE ); - - windowedExStyle = GetWindowLong( hWnd, GWL_EXSTYLE ); - windowedStyle = GetWindowLong( hWnd, GWL_STYLE ); - - SetWindowLong( hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST ); - SetWindowLong( hWnd, GWL_STYLE, WS_POPUP ); - - GetWindowRect( hWnd, &windowedRect ); - - m_bFullscreen = true; - _resizeWindow(); - } else { - ChangeDisplaySettings( NULL, 0 ); - - ShowCursor( TRUE ); - - if (windowedMenu) - SetMenu( hWnd, windowedMenu ); - - if (hStatusBar) - ShowWindow( hStatusBar, SW_SHOW ); - - SetWindowLong( hWnd, GWL_STYLE, windowedStyle ); - SetWindowLong( hWnd, GWL_EXSTYLE, windowedExStyle ); - SetWindowPos( hWnd, NULL, windowedRect.left, windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE ); - - m_bFullscreen = false; - _resizeWindow(); - } -} - -bool DisplayWindowWindows::_resizeWindow() -{ - RECT windowRect, statusRect, toolRect; - - if (m_bFullscreen) { - m_screenWidth = config.video.fullscreenWidth; - m_screenHeight = config.video.fullscreenHeight; - m_heightOffset = 0; - _setBufferSize(); - - return (SetWindowPos(hWnd, NULL, 0, 0, m_screenWidth, m_screenHeight, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW) == TRUE); - } else { - m_screenWidth = m_width = config.video.windowedWidth; - m_screenHeight = config.video.windowedHeight; - _setBufferSize(); - - GetClientRect( hWnd, &windowRect ); - GetWindowRect( hStatusBar, &statusRect ); - - if (hToolBar) - GetWindowRect( hToolBar, &toolRect ); - else - toolRect.bottom = toolRect.top = 0; - - m_heightOffset = (statusRect.bottom - statusRect.top); - windowRect.right = windowRect.left + config.video.windowedWidth - 1; - windowRect.bottom = windowRect.top + config.video.windowedHeight - 1 + m_heightOffset; - - AdjustWindowRect( &windowRect, GetWindowLong( hWnd, GWL_STYLE ), GetMenu( hWnd ) != NULL ); - - return (SetWindowPos( hWnd, NULL, 0, 0, windowRect.right - windowRect.left + 1, - windowRect.bottom - windowRect.top + 1 + toolRect.bottom - toolRect.top + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE ) == TRUE); - } -} - -void DisplayWindowWindows::_readScreen(void **_pDest, long *_pWidth, long *_pHeight) -{ - *_pWidth = m_width; - *_pHeight = m_height; - - *_pDest = malloc(m_height * m_width * 3); - if (*_pDest == nullptr) - return; - -#ifndef GLESX - GLint oldMode; - glGetIntegerv(GL_READ_BUFFER, &oldMode); - gfxContext.bindFramebuffer(graphics::bufferTarget::READ_FRAMEBUFFER, graphics::ObjectHandle::defaultFramebuffer); - glReadBuffer(GL_FRONT); - glReadPixels(0, m_heightOffset, m_width, m_height, GL_BGR_EXT, GL_UNSIGNED_BYTE, *_pDest); - if (graphics::BufferAttachmentParam(oldMode) == graphics::bufferAttachment::COLOR_ATTACHMENT0) { - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr) - gfxContext.bindFramebuffer(graphics::bufferTarget::READ_FRAMEBUFFER, pBuffer->m_FBO); - } - glReadBuffer(oldMode); -#else - glReadPixels(0, m_heightOffset, m_width, m_height, GL_RGB, GL_UNSIGNED_BYTE, *_pDest); -#endif -} - -graphics::ObjectHandle DisplayWindowWindows::_getDefaultFramebuffer() -{ - return graphics::ObjectHandle::null; -} diff --git a/GLideN64/src/Graphics/Parameter.h b/GLideN64/src/Graphics/Parameter.h deleted file mode 100644 index 0c07f37..0000000 --- a/GLideN64/src/Graphics/Parameter.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once -#include - -namespace graphics { - -#define INVALID_PARAMETER 0xFFFFFFFF - - class Parameter - { - public: - Parameter() : m_iparameter(INVALID_PARAMETER) {} - Parameter(u32 _parameter) : m_iparameter(_parameter) {} - Parameter(s32 _parameter) : m_iparameter(static_cast(_parameter)) {} - Parameter(f32 _parameter) : m_fparameter(_parameter) {} - - explicit operator u32() const { return m_iparameter; } - explicit operator s32() const { return static_cast(m_iparameter); } - explicit operator f32() const { return m_fparameter; } - - bool isValid() const { return m_iparameter != INVALID_PARAMETER; } - - void reset() { m_iparameter = INVALID_PARAMETER; } - - bool operator==(const Parameter & _other) const { return m_iparameter == _other.m_iparameter; } - bool operator!=(const Parameter & _other) const { return m_iparameter != _other.m_iparameter; } - - private: - union { - u32 m_iparameter; - f32 m_fparameter; - }; - }; - -#define SpecialParameterClass(A) \ - class A : public Parameter \ - { \ - public: \ - A() : Parameter() {} \ - A(u32 _parameter) : Parameter(_parameter) {} \ - } - - SpecialParameterClass(ImageUnitParam); - SpecialParameterClass(TextureUnitParam); - SpecialParameterClass(ColorFormatParam); - SpecialParameterClass(InternalColorFormatParam); - SpecialParameterClass(DatatypeParam); - SpecialParameterClass(TextureTargetParam); - SpecialParameterClass(BufferTargetParam); - SpecialParameterClass(TextureParam); - SpecialParameterClass(BufferAttachmentParam); - SpecialParameterClass(EnableParam); - SpecialParameterClass(ImageAccessModeParam); - SpecialParameterClass(CullModeParam); - SpecialParameterClass(CompareParam); - SpecialParameterClass(BlendParam); - SpecialParameterClass(DrawModeParam); - SpecialParameterClass(BlitMaskParam); -} diff --git a/GLideN64/src/Graphics/Parameters.h b/GLideN64/src/Graphics/Parameters.h deleted file mode 100644 index f23ac95..0000000 --- a/GLideN64/src/Graphics/Parameters.h +++ /dev/null @@ -1,138 +0,0 @@ -#pragma once -#include "Parameter.h" - -namespace graphics { - - namespace colorFormat { - extern ColorFormatParam RED_GREEN_BLUE; //Windows has a macro called RGB - extern ColorFormatParam RGBA; - extern ColorFormatParam RG; - extern ColorFormatParam RED; - extern ColorFormatParam DEPTH; - extern ColorFormatParam LUMINANCE; - } - - namespace internalcolorFormat { - extern InternalColorFormatParam NOCOLOR; - extern InternalColorFormatParam RGB8; - extern InternalColorFormatParam RGBA8; - extern InternalColorFormatParam RGBA4; - extern InternalColorFormatParam RGB5_A1; - extern InternalColorFormatParam RG; - extern InternalColorFormatParam R16F; - extern InternalColorFormatParam DEPTH; - extern InternalColorFormatParam RG32F; - extern InternalColorFormatParam LUMINANCE; - extern InternalColorFormatParam COLOR_INDEX8; - } - - namespace datatype { - extern DatatypeParam UNSIGNED_BYTE; - extern DatatypeParam UNSIGNED_SHORT; - extern DatatypeParam UNSIGNED_INT; - extern DatatypeParam FLOAT; - extern DatatypeParam UNSIGNED_SHORT_5_6_5; - extern DatatypeParam UNSIGNED_SHORT_5_5_5_1; - extern DatatypeParam UNSIGNED_SHORT_4_4_4_4; - } - - namespace textureTarget { - extern TextureTargetParam TEXTURE_2D; - extern TextureTargetParam TEXTURE_2D_MULTISAMPLE; - extern TextureTargetParam RENDERBUFFER; - extern TextureTargetParam TEXTURE_EXTERNAL; - } - - namespace bufferTarget { - extern BufferTargetParam FRAMEBUFFER; - extern BufferTargetParam DRAW_FRAMEBUFFER; - extern BufferTargetParam READ_FRAMEBUFFER; - } - - namespace bufferAttachment { - extern BufferAttachmentParam COLOR_ATTACHMENT0; - extern BufferAttachmentParam COLOR_ATTACHMENT1; - extern BufferAttachmentParam COLOR_ATTACHMENT2; - extern BufferAttachmentParam DEPTH_ATTACHMENT; - } - - namespace enable { - extern EnableParam BLEND; - extern EnableParam CULL_FACE; - extern EnableParam DEPTH_TEST; - extern EnableParam DEPTH_CLAMP; - extern EnableParam CLIP_DISTANCE0; - extern EnableParam DITHER; - extern EnableParam POLYGON_OFFSET_FILL; - extern EnableParam SCISSOR_TEST; - } - - namespace textureIndices { - extern TextureUnitParam Tex[2]; - extern TextureUnitParam NoiseTex; - extern TextureUnitParam DepthTex; - extern TextureUnitParam ZLUTTex; - extern TextureUnitParam PaletteTex; - extern TextureUnitParam MSTex[2]; - } - - namespace textureImageUnits { - extern ImageUnitParam DepthZ; - extern ImageUnitParam DepthDeltaZ; - } - - namespace textureImageAccessMode { - extern ImageAccessModeParam READ_ONLY; - extern ImageAccessModeParam WRITE_ONLY; - extern ImageAccessModeParam READ_WRITE; - } - - namespace textureParameters { - extern TextureParam FILTER_NEAREST; - extern TextureParam FILTER_LINEAR; - extern TextureParam FILTER_NEAREST_MIPMAP_NEAREST; - extern TextureParam FILTER_LINEAR_MIPMAP_NEAREST; - extern TextureParam WRAP_CLAMP_TO_EDGE; - extern TextureParam WRAP_REPEAT; - extern TextureParam WRAP_MIRRORED_REPEAT; - } - - namespace cullMode { - extern CullModeParam FRONT; - extern CullModeParam BACK; - extern CullModeParam FRONT_AND_BACK; - } - - namespace compare { - extern CompareParam LEQUAL; - extern CompareParam LESS; - extern CompareParam ALWAYS; - } - - namespace blend { - extern BlendParam ZERO; - extern BlendParam ONE; - extern BlendParam SRC_ALPHA; - extern BlendParam DST_ALPHA; - extern BlendParam ONE_MINUS_SRC_ALPHA; - extern BlendParam CONSTANT_ALPHA; - extern BlendParam ONE_MINUS_CONSTANT_ALPHA; - extern BlendParam SRC1_COLOR; - extern BlendParam ONE_MINUS_SRC1_COLOR; - extern BlendParam SRC1_ALPHA; - extern BlendParam ONE_MINUS_SRC1_ALPHA; - } - - namespace drawmode { - extern DrawModeParam TRIANGLES; - extern DrawModeParam TRIANGLE_STRIP; - extern DrawModeParam TRIANGLE_FAN; - extern DrawModeParam LINES; - } - - namespace blitMask { - extern BlitMaskParam COLOR_BUFFER; - extern BlitMaskParam DEPTH_BUFFER; - extern BlitMaskParam STENCIL_BUFFER; - } -} diff --git a/GLideN64/src/Graphics/PixelBuffer.h b/GLideN64/src/Graphics/PixelBuffer.h deleted file mode 100644 index b432c72..0000000 --- a/GLideN64/src/Graphics/PixelBuffer.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#include "Parameter.h" - -namespace graphics { - - class PixelReadBuffer - { - public: - virtual ~PixelReadBuffer() {} - virtual void readPixels(s32 _x,s32 _y, u32 _width, u32 _height, Parameter _format, Parameter _type) = 0; - virtual void * getDataRange(u32 _offset, u32 _range) = 0; - virtual void closeReadBuffer() = 0; - virtual void bind() = 0; - virtual void unbind() = 0; - }; - - template - class PixelBufferBinder - { - public: - PixelBufferBinder(T * _buffer) - : m_buffer(_buffer) { - m_buffer->bind(); - } - - ~PixelBufferBinder() { - m_buffer->unbind(); - m_buffer = nullptr; - } - private: - T * m_buffer; - }; -} diff --git a/GLideN64/src/Graphics/ShaderProgram.h b/GLideN64/src/Graphics/ShaderProgram.h deleted file mode 100644 index 2e3543d..0000000 --- a/GLideN64/src/Graphics/ShaderProgram.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once -#include -#include "CombinerProgram.h" - -namespace graphics { - - class ShaderProgram : public CombinerProgram - { - public: - virtual ~ShaderProgram() {} - - void update(bool _force) override {} - const CombinerKey & getKey() const override { return CombinerKey::getEmpty(); } - bool usesTexture() const override {return true;} - virtual bool usesTile(u32 _t) const override {return _t == 0 ? true : false;} - virtual bool usesShade() const override {return false;} - virtual bool usesLOD() const override {return false;} - virtual bool usesHwLighting() const override {return false;} - virtual bool getBinaryForm(std::vector & _buffer) override {return false;} - }; - - class TexrectDrawerShaderProgram : public ShaderProgram - { - public: - virtual void setTextureSize(u32 _width, u32 _height) = 0; - virtual void setEnableAlphaTest(int _enable) = 0; - }; - - class TextDrawerShaderProgram : public ShaderProgram - { - public: - virtual void setTextColor(float * _color) = 0; - }; -} diff --git a/GLideN64/src/GraphicsDrawer.cpp b/GLideN64/src/GraphicsDrawer.cpp deleted file mode 100644 index 9f5a169..0000000 --- a/GLideN64/src/GraphicsDrawer.cpp +++ /dev/null @@ -1,1917 +0,0 @@ -#include -#include -#include -#include -#include -#include "Platform.h" -#include "Graphics/Context.h" -#include "DisplayWindow.h" -#include "SoftwareRender.h" -#include "GraphicsDrawer.h" -#include "Performance.h" -#include "TextureFilterHandler.h" -#include "PostProcessor.h" -#include "NoiseTexture.h" -#include "ZlutTexture.h" -#include "PaletteTexture.h" -#include "TextDrawer.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "FrameBufferInfo.h" -#include "Config.h" -#include "Debugger.h" -#include "RSP.h" -#include "RDP.h" -#include "VI.h" -#include "Log.h" - -using namespace graphics; - -GraphicsDrawer::GraphicsDrawer() -: m_drawingState(DrawingState::Non) -, m_dmaVerticesNum(0) -, m_modifyVertices(0) -, m_maxLineWidth(1.0f) -, m_bFlatColors(false) -, m_bBGMode(false) -{ - memset(m_rect, 0, sizeof(m_rect)); -} - -GraphicsDrawer::~GraphicsDrawer() -{ - while (!m_osdMessages.empty()) - std::this_thread::sleep_for(Milliseconds(1)); -} - -void GraphicsDrawer::addTriangle(u32 _v0, u32 _v1, u32 _v2) -{ - m_statistics.drawnTris++; - const u32 firstIndex = triangles.num; - triangles.elements[triangles.num++] = static_cast(_v0); - triangles.elements[triangles.num++] = static_cast(_v1); - triangles.elements[triangles.num++] = static_cast(_v2); - triangles.maxElement = std::max(triangles.maxElement, _v0); - triangles.maxElement = std::max(triangles.maxElement, _v1); - triangles.maxElement = std::max(triangles.maxElement, _v2); - - m_modifyVertices |= triangles.vertices[_v0].modify | - triangles.vertices[_v1].modify | - triangles.vertices[_v2].modify; - - for (u32 i = firstIndex; i < triangles.num; ++i) { - SPVertex& vtx = triangles.vertices[triangles.elements[i]]; - vtx.bc0 = i - firstIndex == 0 ? 1.0f : 0.0f; - vtx.bc1 = i - firstIndex == 1 ? 1.0f : 0.0f; - } - - if ((gSP.geometryMode & G_LIGHTING) == 0) { - if ((gSP.geometryMode & G_SHADE) == 0) { - // Prim shading - for (u32 i = firstIndex; i < triangles.num; ++i) { - SPVertex & vtx = triangles.vertices[triangles.elements[i]]; - vtx.flat_r = gDP.primColor.r; - vtx.flat_g = gDP.primColor.g; - vtx.flat_b = gDP.primColor.b; - vtx.flat_a = gDP.primColor.a; - } - } - else if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) { - // Flat shading - SPVertex & vtx0 = triangles.vertices[triangles.elements[firstIndex + (((RSP.w1 >> 24) & 3) % 3)]]; - for (u32 i = firstIndex; i < triangles.num; ++i) { - SPVertex & vtx = triangles.vertices[triangles.elements[i]]; - vtx.r = vtx.flat_r = vtx0.r; - vtx.g = vtx.flat_g = vtx0.g; - vtx.b = vtx.flat_b = vtx0.b; - vtx.a = vtx.flat_a = vtx0.a; - } - } - } - - if (gDP.otherMode.depthSource == G_ZS_PRIM) { - for (u32 i = firstIndex; i < triangles.num; ++i) { - SPVertex & vtx = triangles.vertices[triangles.elements[i]]; - vtx.z = gDP.primDepth.z * vtx.w; - } - } - - if (!Context::ClipControl) { - if (GBI.isNoN() && gDP.otherMode.depthCompare == 0 && gDP.otherMode.depthUpdate == 0) { - for (u32 i = firstIndex; i < triangles.num; ++i) { - SPVertex & vtx = triangles.vertices[triangles.elements[i]]; - vtx.z = 0.0f; - } - } - } -} - -void GraphicsDrawer::_updateCullFace() const -{ - if (gSP.geometryMode & G_CULL_BOTH) { - gfxContext.enable(enable::CULL_FACE, true); - - if ((gSP.geometryMode & G_CULL_BOTH) == G_CULL_BOTH && GBI.isCullBoth()) - gfxContext.cullFace(cullMode::FRONT_AND_BACK); - else if ((gSP.geometryMode & G_CULL_BACK) == G_CULL_BACK) - gfxContext.cullFace(cullMode::BACK); - else - gfxContext.cullFace(cullMode::FRONT); - } else - gfxContext.enable(enable::CULL_FACE, false); -} - -void GraphicsDrawer::_updateDepthUpdate() const -{ - gfxContext.enableDepthWrite(gDP.otherMode.depthUpdate != 0); -} - -void GraphicsDrawer::_updateDepthCompare() const -{ - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enableDepthWrite(false); - } - else if ((gDP.changed & (CHANGED_RENDERMODE | CHANGED_CYCLETYPE)) != 0) { - if (((gSP.geometryMode & G_ZBUFFER) || gDP.otherMode.depthSource == G_ZS_PRIM) && gDP.otherMode.cycleType <= G_CYC_2CYCLE) { - if (gDP.otherMode.depthCompare != 0) { - switch (gDP.otherMode.depthMode) { - case ZMODE_INTER: - gfxContext.enable(enable::POLYGON_OFFSET_FILL, false); - gfxContext.setDepthCompare(compare::LEQUAL); - break; - case ZMODE_OPA: - case ZMODE_XLU: - // Max || Infront; - gfxContext.enable(enable::POLYGON_OFFSET_FILL, false); - if (gDP.otherMode.depthSource == G_ZS_PRIM && gDP.primDepth.z == 1.0f) - // Max - gfxContext.setDepthCompare(compare::LEQUAL); - else - // Infront - gfxContext.setDepthCompare(compare::LESS); - break; - case ZMODE_DEC: - gfxContext.enable(enable::POLYGON_OFFSET_FILL, true); - gfxContext.setDepthCompare(compare::LEQUAL); - break; - } - } else { - gfxContext.enable(enable::POLYGON_OFFSET_FILL, false); - gfxContext.setDepthCompare(compare::ALWAYS); - } - - _updateDepthUpdate(); - - gfxContext.enable(enable::DEPTH_TEST, true); - if (!GBI.isNoN()) - gfxContext.setClampMode(graphics::ClampMode::ClippingEnabled); - } else { - gfxContext.enable(enable::DEPTH_TEST, false); - if (!GBI.isNoN()) - gfxContext.setClampMode(graphics::ClampMode::NoClipping); - } - } -} - -SPVertex & GraphicsDrawer::getCurrentDMAVertex() -{ - if (m_dmaVerticesNum >= m_dmaVertices.size()) - m_dmaVertices.resize(std::max(static_cast::size_type>(64), m_dmaVertices.size() * 2)); - return m_dmaVertices[m_dmaVerticesNum++]; -} - -inline -bool _needAdjustCoordinate(DisplayWindow & _wnd) -{ - return _wnd.isAdjustScreen() && - gSP.viewport.width < gDP.colorImage.width && - u32(gSP.viewport.width + gSP.viewport.x * 2.0f) != gDP.colorImage.width && - gDP.colorImage.width > VI.width * 98 / 100; -} - -inline -void _adjustScissorX(f32 & _X0, f32 & _X1, float _scale) -{ - const float halfX = gDP.colorImage.width / 2.0f; - _X0 = (_X0 - halfX) * _scale + halfX; - _X1 = (_X1 - halfX) * _scale + halfX; -} - -inline -s32 roundup(f32 _v, f32 _scale) -{ - return static_cast(floorf(_v * _scale + 0.5f)); -} - -void GraphicsDrawer::updateScissor(FrameBuffer * _pBuffer) const -{ - DisplayWindow & wnd = DisplayWindow::get(); - f32 scaleX, scaleY; - f32 offsetX = 0.0f, offsetY = 0.0f; - if (_pBuffer == nullptr) { - scaleX = wnd.getScaleX(); - scaleY = wnd.getScaleY(); - } else { - scaleX = _pBuffer->m_scale; - scaleY = _pBuffer->m_scale; - offsetX = f32(_pBuffer->m_originX); - offsetY = f32(_pBuffer->m_originY); - } - - f32 SX0 = gDP.scissor.ulx + offsetX; - f32 SX1 = gDP.scissor.lrx + offsetX; - f32 SY0 = gDP.scissor.uly + offsetY; - f32 SY1 = gDP.scissor.lry + offsetY; - - if (u32(SX1) == 512 && (config.generalEmulation.hacks & hack_RE2) != 0) { - SX1 = f32(*REG.VI_WIDTH); - SY1 *= 512.0f / SX1; - } - - if (_needAdjustCoordinate(wnd)) - _adjustScissorX(SX0, SX1, wnd.getAdjustScale()); - - gfxContext.setScissor(roundup(SX0, scaleX), roundup(SY0, scaleY), - std::max(roundup(SX1 - SX0, scaleX), 0), std::max(roundup(SY1 - SY0, scaleY), 0)); - - gDP.changed &= ~CHANGED_SCISSOR; -} - -void GraphicsDrawer::_updateViewport(const FrameBuffer* _pBuffer, const f32 scale) const -{ - s32 X, Y, WIDTH, HEIGHT; - f32 scaleX, scaleY; - if (scale == 0.0f) { - const FrameBuffer* pCurrentBuffer = _pBuffer != nullptr ? _pBuffer : frameBufferList().getCurrent(); - if (pCurrentBuffer != nullptr) { - scaleX = scaleY = pCurrentBuffer->m_scale; - } else { - scaleX = dwnd().getScaleX(); - scaleY = dwnd().getScaleY(); - } - } else { - scaleX = scaleY = scale; - } - X = 0; - Y = 0; - WIDTH = roundup(SCREEN_SIZE_DIM, scaleX); - HEIGHT = roundup(SCREEN_SIZE_DIM, scaleY); - gfxContext.setViewport(X, Y, WIDTH, HEIGHT); - gSP.changed |= CHANGED_VIEWPORT; -} - -void GraphicsDrawer::_legacyBlending() const -{ - const u32 blendmode = gDP.otherMode.l >> 16; - // 0x7000 = CVG_X_ALPHA|ALPHA_CVG_SEL|FORCE_BL - if (gDP.otherMode.alphaCvgSel != 0 && (gDP.otherMode.l & 0x7000) != 0x7000) { - switch (blendmode) { - case 0x4055: // Mario Golf - case 0x5055: // Paper Mario intro clr_mem * a_in + clr_mem * a_mem - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - break; - default: - gfxContext.enable(enable::BLEND, false); - } - return; - } - - if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType < G_CYC_COPY) { - BlendParam sfactor, dfactor; - - switch (blendmode) - { - // Mace objects - case 0x0382: - // Mace special blend mode, see GLSLCombiner.cpp - case 0x0091: - // 1080 Sky - case 0x0C08: - // Used LOTS of places - case 0x0F0A: - //DK64 blue prints - case 0x0302: - // Bomberman 2 special blend mode, see GLSLCombiner.cpp - case 0xA500: - //Sin and Punishment - case 0xCB02: - // Battlezone - // clr_in * a + clr_in * (1-a) - case 0xC800: - // Conker BFD - // clr_in * a_fog + clr_fog * (1-a) - // clr_in * 0 + clr_in * 1 - case 0x07C2: - case 0x00C0: - //ISS64 - case 0xC302: - // Donald Duck - case 0xC702: - sfactor = blend::ONE; - dfactor = blend::ZERO; - break; - - case 0x55f0: - // Bust-A-Move 3 DX - // CLR_MEM * A_FOG + CLR_FOG * 1MA - sfactor = blend::ONE; - dfactor = blend::SRC_ALPHA; - break; - - case 0x0F1A: - if (gDP.otherMode.cycleType == G_CYC_1CYCLE) { - sfactor = blend::ONE; - dfactor = blend::ZERO; - } else { - sfactor = blend::ZERO; - dfactor = blend::ONE; - } - break; - - //Space Invaders - case 0x0448: // Add - case 0x055A: - sfactor = blend::ONE; - dfactor = blend::ONE; - break; - - case 0xc712: // Pokemon Stadium? - case 0xAF50: // LOT in Zelda: MM - case 0x0F5A: // LOT in Zelda: MM - case 0x0FA5: // Seems to be doing just blend color - maybe combiner can be used for this? - case 0x5055: // Used in Paper Mario intro, I'm not sure if this is right... - //clr_in * 0 + clr_mem * 1 - sfactor = blend::ZERO; - dfactor = blend::ONE; - break; - - case 0x5F50: //clr_mem * 0 + clr_mem * (1-a) - sfactor = blend::ZERO; - dfactor = blend::ONE_MINUS_SRC_ALPHA; - break; - - case 0xF550: //clr_fog * a_fog + clr_mem * (1-a) - case 0x0150: // spiderman - case 0x0550: // bomberman 64 - case 0x0D18: //clr_in * a_fog + clr_mem * (1-a) - sfactor = blend::SRC_ALPHA; - dfactor = blend::ONE_MINUS_SRC_ALPHA; - break; - - case 0xC912: //40 winks, clr_in * a_fog + clr_mem * 1 - sfactor = blend::SRC_ALPHA; - dfactor = blend::ONE; - break; - - case 0x0040: // Fzero - case 0xC810: // Blends fog - case 0x0C18: // Standard interpolated blend - case 0x0050: // Standard interpolated blend - case 0x0051: // Standard interpolated blend - case 0x0055: // Used for antialiasing - sfactor = blend::SRC_ALPHA; - dfactor = blend::ONE_MINUS_SRC_ALPHA; - break; - - case 0x0C19: // Used for antialiasing - case 0xC811: // Blends fog - sfactor = blend::SRC_ALPHA; - dfactor = blend::DST_ALPHA; - break; - - case 0x5000: // V8 explosions - sfactor = blend::ONE_MINUS_SRC_ALPHA; - dfactor = blend::SRC_ALPHA; - break; - - case 0xFA00: // Bomberman second attack - sfactor = blend::ONE; - dfactor = blend::ZERO; - break; - - default: - //LOG(LOG_VERBOSE, "Unhandled blend mode=%x", gDP.otherMode.l >> 16); - sfactor = blend::SRC_ALPHA; - dfactor = blend::ONE_MINUS_SRC_ALPHA; - break; - } - - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(sfactor, dfactor); - } else if (gDP.otherMode.colorOnCvg != 0) { - // CLR_ON_CVG - just use second mux of blender - bool useMemColor = false; - if (gDP.otherMode.cycleType == G_CYC_1CYCLE) { - if (gDP.otherMode.c1_m2a == 1) - useMemColor = true; - } else if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { - if (gDP.otherMode.c2_m2a == 1) - useMemColor = true; - } - if (useMemColor) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - } else { - gfxContext.enable(enable::BLEND, false); - } - } else { - gfxContext.enable(enable::BLEND, false); - } -} - -void GraphicsDrawer::_ordinaryBlending() const -{ - // Set unsupported blend modes - if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { - const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16); - switch (mode) { - case 0x0040: - // Mia Hamm Soccer - // clr_in * a_in + clr_mem * (1-a) - // clr_in * a_in + clr_in * (1-a) - case 0x0050: - // A Bug's Life - // clr_in * a_in + clr_mem * (1-a) - // clr_in * a_in + clr_mem * (1-a) - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA); - return; - case 0x0150: - // Tony Hawk - // clr_in * a_in + clr_mem * (1-a) - // clr_in * a_fog + clr_mem * (1-a_fog) - if ((config.generalEmulation.hacks & hack_TonyHawk) != 0) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA); - return; - } - break; - } - } - - if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType < G_CYC_COPY) { - BlendParam srcFactor = blend::ONE; - BlendParam dstFactor = blend::ZERO; - u32 memFactorSource = 2, muxA, muxB; - if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { - muxA = gDP.otherMode.c2_m1b; - muxB = gDP.otherMode.c2_m2b; - if (gDP.otherMode.c2_m1a == 1) { - if (gDP.otherMode.c2_m2a == 1) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - return; - } - memFactorSource = 0; - } - else if (gDP.otherMode.c2_m2a == 1) { - memFactorSource = 1; - } - if (gDP.otherMode.c2_m2a == 0 && gDP.otherMode.c2_m2b == 1) { - // c_in * a_mem - srcFactor = blend::DST_ALPHA; - } - } else { - muxA = gDP.otherMode.c1_m1b; - muxB = gDP.otherMode.c1_m2b; - if (gDP.otherMode.c1_m1a == 1) { - if (gDP.otherMode.c1_m2a == 1) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - return; - } - memFactorSource = 0; - } else if (gDP.otherMode.c1_m2a == 1) { - memFactorSource = 1; - } - if (gDP.otherMode.c1_m2a == 0 && gDP.otherMode.c1_m2b == 1) { - // c_pixel * a_mem - srcFactor = blend::DST_ALPHA; - } - } - switch (memFactorSource) { - case 0: - switch (muxA) { - case 0: - dstFactor = blend::SRC_ALPHA; - break; - case 1: - gfxContext.setBlendColor(gDP.fogColor.r, gDP.fogColor.g, gDP.fogColor.b, gDP.fogColor.a); - dstFactor = blend::CONSTANT_ALPHA; - break; - case 2: - assert(false); // shade alpha - dstFactor = blend::SRC_ALPHA; - break; - case 3: - dstFactor = blend::ZERO; - break; - } - break; - case 1: - switch (muxB) { - case 0: - // 1.0 - muxA - switch (muxA) { - case 0: - dstFactor = blend::ONE_MINUS_SRC_ALPHA; - break; - case 1: - gfxContext.setBlendColor(gDP.fogColor.r, gDP.fogColor.g, gDP.fogColor.b, gDP.fogColor.a); - dstFactor = blend::ONE_MINUS_CONSTANT_ALPHA; - break; - case 2: - assert(false); // shade alpha - dstFactor = blend::ONE_MINUS_SRC_ALPHA; - break; - case 3: - dstFactor = blend::ONE; - break; - } - break; - case 1: - dstFactor = blend::DST_ALPHA; - break; - case 2: - dstFactor = blend::ONE; - break; - case 3: - dstFactor = blend::ZERO; - break; - } - break; - default: - dstFactor = blend::ZERO; - } - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(srcFactor, dstFactor); - } else if ((gDP.otherMode.forceBlender == 0 && gDP.otherMode.cycleType < G_CYC_COPY)) { - // Just use first mux of blender - bool useMemColor = false; - if (gDP.otherMode.cycleType == G_CYC_1CYCLE) { - if (gDP.otherMode.c1_m1a == 1) - useMemColor = true; - } else if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { - if (gDP.otherMode.c2_m1a == 1) - useMemColor = true; - } - if (useMemColor) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - } else { - gfxContext.enable(enable::BLEND, false); - } - } else { - gfxContext.enable(enable::BLEND, false); - } -} - -void GraphicsDrawer::_dualSourceBlending() const -{ - if (gDP.otherMode.cycleType < G_CYC_COPY) { - BlendParam srcFactor = blend::ONE; - BlendParam dstFactor = blend::SRC1_COLOR; - BlendParam srcFactorAlpha = blend::ONE; - BlendParam dstFactorAlpha = blend::SRC1_ALPHA; - if (gDP.otherMode.forceBlender != 0) { - if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { - if (gDP.otherMode.c2_m2a != 1 && gDP.otherMode.c2_m2b == 1) { - srcFactor = blend::DST_ALPHA; - } - if (gDP.otherMode.c2_m2a == 1 && gDP.otherMode.c2_m2b == 1) { - dstFactor = blend::DST_ALPHA; - } - } else { - if (gDP.otherMode.c1_m2a != 1 && gDP.otherMode.c1_m2b == 1) { - srcFactor = blend::DST_ALPHA; - } - if (gDP.otherMode.c1_m2a == 1 && gDP.otherMode.c2_m2b == 1) { - dstFactor = blend::DST_ALPHA; - } - } - } - - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlendingSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha); - } else { - gfxContext.enable(enable::BLEND, false); - } -} - -void GraphicsDrawer::setBlendMode(bool _forceLegacyBlending) const -{ - bool blastCorpsHack = (config.generalEmulation.hacks & hack_blastCorps) != 0 && - gSP.texture.on == 0 && gDP.otherMode.cycleType < G_CYC_COPY && currentCombiner()->usesTexture(); - - if (blastCorpsHack) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - return; - } - - if (_forceLegacyBlending || config.generalEmulation.enableLegacyBlending != 0) { - _legacyBlending(); - return; - } - - if (Context::DualSourceBlending && !isTexrectDrawerMode()) { - _dualSourceBlending(); - return; - } - - if (Context::FramebufferFetchColor && !isTexrectDrawerMode()) { - gfxContext.enable(enable::BLEND, false); - return; - } - - _ordinaryBlending(); -} - -void GraphicsDrawer::_updateTextures() const -{ - //For some reason updating the texture cache on the first frame of LOZ:OOT causes a nullptr Pointer exception... - CombinerInfo & cmbInfo = CombinerInfo::get(); - CombinerProgram * pCurrentCombiner = cmbInfo.getCurrent(); - if (pCurrentCombiner != nullptr) { - for (u32 t = 0; t < 2; ++t) { - if (pCurrentCombiner->usesTile(t)) - textureCache().update(t); - else - textureCache().activateDummy(t); - } - } - gDP.changed &= ~(CHANGED_TILE | CHANGED_TMEM); - gSP.changed &= ~(CHANGED_TEXTURE); -} - -void GraphicsDrawer::_updateStates(DrawingState _drawingState) const -{ - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.setPolygonMode(_drawingState); - cmbInfo.update(); - - if (gSP.changed & CHANGED_GEOMETRYMODE) { - _updateCullFace(); - gSP.changed &= ~CHANGED_GEOMETRYMODE; - } - - _updateDepthCompare(); - - if (gDP.changed & CHANGED_SCISSOR) - updateScissor(frameBufferList().getCurrent()); - - if (gSP.changed & CHANGED_VIEWPORT) - _updateViewport(); - - if ((gSP.changed & CHANGED_TEXTURE) || - (gDP.changed & (CHANGED_TILE | CHANGED_TMEM)) || - cmbInfo.isChanged() || - _drawingState == DrawingState::TexRect) { - _updateTextures(); - } - - if ((gDP.changed & (CHANGED_RENDERMODE | CHANGED_CYCLETYPE))) { - setBlendMode(); - gDP.changed &= ~(CHANGED_RENDERMODE | CHANGED_CYCLETYPE); - } - - cmbInfo.updateParameters(); - - if (!config.generalEmulation.enableFragmentDepthWrite) - return; - - if (isCurrentColorImageDepthImage() && - config.generalEmulation.enableFragmentDepthWrite != 0 && - config.frameBufferEmulation.N64DepthCompare == Config::dcDisable) { - // Current render target is depth buffer. - // Shader will set gl_FragDepth to shader color, see ShaderCombiner ctor - // Here we enable depth buffer write. - if (gDP.otherMode.cycleType <= G_CYC_2CYCLE && gDP.otherMode.depthCompare != 0) { - // Render to depth buffer with depth compare. Need to get copy of current depth buffer. - FrameBuffer * pCurBuf = frameBufferList().getCurrent(); - if (pCurBuf != nullptr && pCurBuf->m_pDepthBuffer != nullptr) { - CachedTexture * pDepthTexture = pCurBuf->m_pDepthBuffer->copyDepthBufferTexture(pCurBuf); - if (pDepthTexture == nullptr) - return; - Context::TexParameters params; - params.handle = pDepthTexture->name; - params.target = textureTarget::TEXTURE_2D; - params.textureUnitIndex = textureIndices::DepthTex; - params.maxMipmapLevel = 0; - params.minFilter = textureParameters::FILTER_NEAREST; - params.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(params); - } - } else if (frameBufferList().getCurrent() == nullptr) { - gfxContext.enable(enable::BLEND, true); - gfxContext.setBlending(blend::ZERO, blend::ONE); - } - gfxContext.enable(enable::DEPTH_TEST, true); - gfxContext.setDepthCompare(compare::ALWAYS); - gfxContext.enableDepthWrite(true); - gDP.changed |= CHANGED_RENDERMODE; - } -} - -void GraphicsDrawer::_prepareDrawTriangle(DrawingState _drawingState) -{ - m_texrectDrawer.draw(); - - if ((m_modifyVertices & MODIFY_XY) != 0) - gSP.changed &= ~CHANGED_VIEWPORT; - - m_drawingState = _drawingState; - - if (gSP.changed || gDP.changed) - _updateStates(_drawingState); - - bool bFlatColors = false; - if (!RSP.LLE && (gSP.geometryMode & G_LIGHTING) == 0) { - bFlatColors = (gSP.geometryMode & G_SHADE) == 0; - bFlatColors |= (gSP.geometryMode & G_SHADING_SMOOTH) == 0; - } - m_bFlatColors = bFlatColors; - - if ((m_modifyVertices & MODIFY_XY) != 0) - _updateViewport(); - m_modifyVertices = 0; -} - -bool GraphicsDrawer::_canDraw() const -{ - return config.frameBufferEmulation.enable == 0 || frameBufferList().getCurrent() != nullptr; -} - -void GraphicsDrawer::drawTriangles() -{ - if (triangles.num == 0 || !_canDraw()) { - triangles.num = 0; - triangles.maxElement = 0; - return; - } - - _prepareDrawTriangle(DrawingState::Triangle); - Context::DrawTriangleParameters triParams; - triParams.mode = drawmode::TRIANGLES; - triParams.flatColors = m_bFlatColors; - triParams.elementsType = datatype::UNSIGNED_BYTE; - triParams.verticesCount = static_cast(triangles.maxElement) + 1; - triParams.elementsCount = triangles.num; - triParams.vertices = triangles.vertices.data(); - triParams.elements = triangles.elements.data(); - triParams.combiner = currentCombiner(); - g_debugger.addTriangles(triParams); - - if (config.frameBufferEmulation.enable != 0) { - f32 maxY; - if (config.generalEmulation.enableClipping != 0) { - maxY = renderAndDrawTriangles(triangles.vertices.data(), triangles.elements.data(), triangles.num, m_bFlatColors, m_statistics); - } else { - gfxContext.drawTriangles(triParams); - maxY = renderTriangles(triangles.vertices.data(), triangles.elements.data(), triangles.num); - } - frameBufferList().setBufferChanged(maxY); - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender && - gDP.otherMode.depthUpdate != 0) { - FrameBuffer * pCurrentDepthBuffer = frameBufferList().findBuffer(gDP.depthImageAddress); - if (pCurrentDepthBuffer != nullptr) - pCurrentDepthBuffer->setDirty(); - } - } else { - gfxContext.drawTriangles(triParams); - } - - triangles.num = 0; - triangles.maxElement = 0; -} - -void GraphicsDrawer::drawScreenSpaceTriangle(u32 _numVtx, graphics::DrawModeParam _mode) -{ - if (_numVtx == 0 || !_canDraw()) - return; - - f32 maxY = 0; - for (u32 i = 0; i < _numVtx; ++i) { - SPVertex & vtx = m_dmaVertices[i]; - vtx.modify = MODIFY_ALL; - maxY = std::max(maxY, vtx.y); - - vtx.clip = 0; - if (vtx.x > gSP.viewport.width) vtx.clip |= CLIP_POSX; - if (vtx.x < 0) vtx.clip |= CLIP_NEGX; - if (vtx.y > gSP.viewport.height) vtx.clip |= CLIP_POSY; - if (vtx.y < 0) vtx.clip |= CLIP_NEGY; - - vtx.bc0 = (i % 3 == 0) ? 1.0f : 0.0f; - vtx.bc1 = (i % 3 == 1) ? 1.0f : 0.0f; - } - m_modifyVertices = MODIFY_ALL; - - gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode - _prepareDrawTriangle(DrawingState::ScreenSpaceTriangle); - gfxContext.enable(enable::CULL_FACE, false); - - Context::DrawTriangleParameters triParams; - triParams.mode = _mode; - triParams.flatColors = m_bFlatColors; - triParams.verticesCount = _numVtx; - triParams.vertices = m_dmaVertices.data(); - triParams.combiner = currentCombiner(); - gfxContext.drawTriangles(triParams); - g_debugger.addTriangles(triParams); - m_dmaVerticesNum = 0; - - if (config.frameBufferEmulation.enable != 0) { - const f32 maxY = renderScreenSpaceTriangles(m_dmaVertices.data(), _numVtx); - frameBufferList().setBufferChanged(maxY); - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender && - gDP.otherMode.depthUpdate != 0) { - FrameBuffer * pCurrentDepthBuffer = frameBufferList().findBuffer(gDP.depthImageAddress); - if (pCurrentDepthBuffer != nullptr) - pCurrentDepthBuffer->setDirty(); - } - } - gSP.changed |= CHANGED_GEOMETRYMODE; - if (_mode == graphics::drawmode::TRIANGLES) - m_statistics.drawnTris += _numVtx / 3; - else if (_mode == graphics::drawmode::TRIANGLE_STRIP) - m_statistics.drawnTris += _numVtx - 2; -} - -void GraphicsDrawer::drawDMATriangles(u32 _numVtx) -{ - if (_numVtx == 0 || !_canDraw()) - return; - _prepareDrawTriangle(DrawingState::Triangle); - - Context::DrawTriangleParameters triParams; - triParams.mode = drawmode::TRIANGLES; - triParams.flatColors = m_bFlatColors; - triParams.verticesCount = _numVtx; - triParams.vertices = m_dmaVertices.data(); - triParams.combiner = currentCombiner(); - g_debugger.addTriangles(triParams); - m_dmaVerticesNum = 0; - m_statistics.drawnTris += _numVtx / 3; - - if (config.frameBufferEmulation.enable != 0) { - f32 maxY; - if (config.generalEmulation.enableClipping != 0) { - maxY = renderAndDrawTriangles(m_dmaVertices.data(), nullptr, _numVtx, m_bFlatColors, m_statistics); - } - else { - gfxContext.drawTriangles(triParams); - maxY = renderTriangles(m_dmaVertices.data(), nullptr, _numVtx); - } - frameBufferList().setBufferChanged(maxY); - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender && - gDP.otherMode.depthUpdate != 0) { - FrameBuffer * pCurrentDepthBuffer = frameBufferList().findBuffer(gDP.depthImageAddress); - if (pCurrentDepthBuffer != nullptr) - pCurrentDepthBuffer->setDirty(); - } - } else { - gfxContext.drawTriangles(triParams); - } -} - -void GraphicsDrawer::_drawThickLine(u32 _v0, u32 _v1, float _width) -{ - if ((gSP.geometryMode & G_LIGHTING) == 0) { - if ((gSP.geometryMode & G_SHADE) == 0) { - SPVertex & vtx1 = triangles.vertices[_v0]; - vtx1.flat_r = gDP.primColor.r; - vtx1.flat_g = gDP.primColor.g; - vtx1.flat_b = gDP.primColor.b; - vtx1.flat_a = gDP.primColor.a; - SPVertex & vtx2 = triangles.vertices[_v1]; - vtx2.flat_r = gDP.primColor.r; - vtx2.flat_g = gDP.primColor.g; - vtx2.flat_b = gDP.primColor.b; - vtx2.flat_a = gDP.primColor.a; - } - else if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) { - // Flat shading - SPVertex & vtx0 = triangles.vertices[_v0 + ((RSP.w1 >> 24) & 3)]; - SPVertex & vtx1 = triangles.vertices[_v0]; - vtx1.r = vtx1.flat_r = vtx0.r; - vtx1.g = vtx1.flat_g = vtx0.g; - vtx1.b = vtx1.flat_b = vtx0.b; - vtx1.a = vtx1.flat_a = vtx0.a; - SPVertex & vtx2 = triangles.vertices[_v1]; - vtx2.r = vtx2.flat_r = vtx0.r; - vtx2.g = vtx2.flat_g = vtx0.g; - vtx2.b = vtx2.flat_b = vtx0.b; - vtx2.a = vtx2.flat_a = vtx0.a; - } - } - - setDMAVerticesSize(4); - SPVertex * pVtx = getDMAVerticesData(); - const f32 ySign = GBI.isNegativeY() ? -1.0f : 1.0f; - pVtx[0] = triangles.vertices[_v0]; - pVtx[0].x = pVtx[0].x / pVtx[0].w * gSP.viewport.vscale[0] + gSP.viewport.vtrans[0]; - pVtx[0].y = ySign * pVtx[0].y / pVtx[0].w * gSP.viewport.vscale[1] + gSP.viewport.vtrans[1]; - pVtx[0].z = pVtx[0].z / pVtx[0].w; - pVtx[1] = pVtx[0]; - - pVtx[2] = triangles.vertices[_v1]; - pVtx[2].x = pVtx[2].x / pVtx[2].w * gSP.viewport.vscale[0] + gSP.viewport.vtrans[0]; - pVtx[2].y = ySign * pVtx[2].y / pVtx[2].w * gSP.viewport.vscale[1] + gSP.viewport.vtrans[1]; - pVtx[2].z = pVtx[2].z / pVtx[2].w; - pVtx[3] = pVtx[2]; - - if (fabs(pVtx[0].y - pVtx[2].y) < 0.0001) { - const f32 Y = pVtx[0].y; - pVtx[0].y = pVtx[2].y = Y - _width; - pVtx[1].y = pVtx[3].y = Y + _width; - } else if (fabs(pVtx[0].x - pVtx[2].x) < 0.0001) { - const f32 X = pVtx[0].x; - pVtx[0].x = pVtx[2].x = X - _width; - pVtx[1].x = pVtx[3].x = X + _width; - } else { - const f32 X0 = pVtx[0].x; - const f32 Y0 = pVtx[0].y; - const f32 X1 = pVtx[2].x; - const f32 Y1 = pVtx[2].y; - const f32 dx = X1 - X0; - const f32 dy = Y1 - Y0; - const f32 len = sqrtf(dx*dx + dy*dy); - const f32 wx = dy * _width / len; - const f32 wy = dx * _width / len; - pVtx[0].x = X0 + wx; - pVtx[0].y = Y0 - wy; - pVtx[1].x = X0 - wx; - pVtx[1].y = Y0 + wy; - pVtx[2].x = X1 + wx; - pVtx[2].y = Y1 - wy; - pVtx[3].x = X1 - wx; - pVtx[3].y = Y1 + wy; - } - drawScreenSpaceTriangle(4); -} - -void GraphicsDrawer::drawLine(u32 _v0, u32 _v1, float _width) -{ - m_texrectDrawer.draw(); - m_statistics.lines++; - - if (!_canDraw()) - return; - - f32 lineWidth = _width; - if (config.frameBufferEmulation.nativeResFactor == 0) - lineWidth *= dwnd().getScaleX(); - else - lineWidth *= config.frameBufferEmulation.nativeResFactor; - if (lineWidth > m_maxLineWidth) { - _drawThickLine(_v0, _v1, _width * 0.5f); - return; - } - - if ((triangles.vertices[_v0].modify & MODIFY_XY) != 0) - gSP.changed &= ~CHANGED_VIEWPORT; - if (gSP.changed || gDP.changed) - _updateStates(DrawingState::Line); - - m_drawingState = DrawingState::Line; - - if ((triangles.vertices[_v0].modify & MODIFY_XY) != 0) - _updateViewport(); - - SPVertex vertexBuf[2] = { triangles.vertices[_v0], triangles.vertices[_v1] }; - gfxContext.drawLine(lineWidth, vertexBuf); -} - -void GraphicsDrawer::drawRect(int _ulx, int _uly, int _lrx, int _lry) -{ - m_texrectDrawer.draw(); - m_statistics.fillRects++; - - if (!_canDraw()) - return; - - gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode - gSP.changed &= ~CHANGED_VIEWPORT; // Don't update viewport - if (gSP.changed || gDP.changed) - _updateStates(DrawingState::Rect); - - m_drawingState = DrawingState::Rect; - - _updateViewport(); - - gfxContext.enable(enable::CULL_FACE, false); - - const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f; - const float W = 1.0f; - m_rect[0].x = static_cast(_ulx); - m_rect[0].y = static_cast(_uly); - m_rect[0].z = Z; - m_rect[0].w = W; - m_rect[1].x = static_cast(_lrx); - m_rect[1].y = m_rect[0].y; - m_rect[1].z = Z; - m_rect[1].w = W; - m_rect[2].x = m_rect[0].x; - m_rect[2].y = static_cast(_lry); - m_rect[2].z = Z; - m_rect[2].w = W; - m_rect[3].x = m_rect[1].x; - m_rect[3].y = m_rect[2].y; - m_rect[3].z = Z; - m_rect[3].w = W; - - m_rect[0].bc0 = 0.0f; - m_rect[0].bc1 = 0.0f; - m_rect[1].bc0 = 0.0f; - m_rect[1].bc1 = 1.0f; - m_rect[2].bc0 = 1.0f; - m_rect[2].bc1 = 0.0f; - m_rect[3].bc0 = 1.0f; - m_rect[3].bc1 = 1.0f; - - DisplayWindow & wnd = dwnd(); - if (wnd.isAdjustScreen() && (gDP.colorImage.width > VI.width * 98 / 100) && (static_cast(_lrx - _ulx) < VI.width * 9 / 10)) { - const float scale = wnd.getAdjustScale(); - const float offsetx = static_cast(gDP.colorImage.width) * (1.0f - scale) / 2.0f; - for (u32 i = 0; i < 4; ++i) { - m_rect[i].x *= scale; - m_rect[i].x += offsetx; - } - } - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.texrect = false; - rectParams.verticesCount = 4; - rectParams.vertices = m_rect; - rectParams.combiner = currentCombiner(); - gfxContext.drawRects(rectParams); - g_debugger.addRects(rectParams); - gSP.changed |= CHANGED_GEOMETRYMODE | CHANGED_VIEWPORT; -} - -static -bool texturedRectShadowMap(const GraphicsDrawer::TexturedRectParams &) -{ - FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent(); - if (pCurrentBuffer != nullptr) { - if (gDP.textureImage.size == 2 && gDP.textureImage.address >= gDP.depthImageAddress && - gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*gDP.colorImage.width * 6 / 4)) { - - if (!Context::IntegerTextures) - return true; - - pCurrentBuffer->m_pDepthBuffer->activateDepthBufferTexture(pCurrentBuffer); - CombinerInfo::get().setDepthFogCombiner(); - // DepthFogCombiner does not support shader blending. - dwnd().getDrawer().setBlendMode(true); - return false; - } - } - return false; -} - -u32 rectDepthBufferCopyFrame = 0xFFFFFFFF; -static -bool texturedRectDepthBufferCopy(const GraphicsDrawer::TexturedRectParams & _params) -{ - // Copy one line from depth buffer into auxiliary color buffer with height = 1. - // Data from depth buffer loaded into TMEM and then rendered to RDRAM by texrect. - // Works only with depth buffer emulation enabled. - // Load of arbitrary data to that area causes weird camera rotation in CBFD. - if (_params.uly != 0.0f || std::min(_params.lry, gDP.scissor.lry) != 1.0f) - return false; - const gDPTile * pTile = gSP.textureTile[0]; - if (pTile->loadType == LOADTYPE_BLOCK && gDP.textureImage.size == 2 && - gDP.textureImage.address >= gDP.depthImageAddress && - gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*VI.height*2)) { - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdDisable) - return true; - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer == nullptr) - return true; - pBuffer->m_cleared = true; - if (config.frameBufferEmulation.copyDepthToRDRAM == Config::cdCopyFromVRam) { - if (rectDepthBufferCopyFrame != dwnd().getBuffersSwapCount()) { - rectDepthBufferCopyFrame = dwnd().getBuffersSwapCount(); - if (!FrameBuffer_CopyDepthBuffer(gDP.depthImageAddress)) - return true; - } - RDP_RepeatLastLoadBlock(); - } - - const u32 width = static_cast(_params.lrx - _params.ulx); - const u32 ulx = static_cast(_params.ulx); - u16 * pSrc = reinterpret_cast(TMEM) + _params.s/32; - u16 *pDst = reinterpret_cast(RDRAM + gDP.colorImage.address); - for (u32 x = 0; x < width; ++x) - pDst[(ulx + x) ^ 1] = swapword(pSrc[x]); - - return true; - } - return false; -} - -static -bool texturedRectCopyToItself(const GraphicsDrawer::TexturedRectParams & _params) -{ - FrameBuffer * pCurrent = frameBufferList().getCurrent(); - if (pCurrent != nullptr && pCurrent->m_size == G_IM_SIZ_8b && gSP.textureTile[0]->frameBufferAddress == pCurrent->m_startAddress) - return true; - return texturedRectDepthBufferCopy(_params); -} - -static -bool texturedRectBGCopy(const GraphicsDrawer::TexturedRectParams & _params) -{ - if (gDP.colorImage.size > G_IM_SIZ_8b) - return false; - - float flry = _params.lry; - if (flry > gDP.scissor.lry) - flry = gDP.scissor.lry; - - const u32 width = static_cast(_params.lrx - _params.ulx); - const u32 tex_width = gSP.textureTile[0]->line << 3; - const u32 uly = static_cast(_params.uly); - const u32 lry = static_cast(flry); - - u8 * texaddr = RDRAM + gDP.loadInfo[gSP.textureTile[0]->tmem].texAddress + tex_width*_params.t/32 + _params.s/32; - u8 * fbaddr = RDRAM + gDP.colorImage.address + static_cast(_params.ulx); - // LOG(LOG_VERBOSE, "memrect (%d, %d, %d, %d), ci_width: %d texaddr: 0x%08lx fbaddr: 0x%08lx\n", (u32)_params.ulx, uly, (u32)_params.lrx, lry, gDP.colorImage.width, gSP.textureTile[0]->imageAddress + tex_width*(u32)_params.ult + (u32)_params.uls, gDP.colorImage.address + (u32)_params.ulx); - - for (u32 y = uly; y < lry; ++y) { - u8 *src = texaddr + (y - uly) * tex_width; - u8 *dst = fbaddr + y * gDP.colorImage.width; - memcpy(dst, src, width); - } - frameBufferList().removeBuffer(gDP.colorImage.address); - return true; -} - -static -bool texturedRectPaletteMod(const GraphicsDrawer::TexturedRectParams & _params) -{ - if (gDP.textureImage.address == 0x400) { - // Paper Mario uses complex set of actions to prepare darkness texture. - // It includes manipulations with texture formats and drawing buffer into itsels. - // All that stuff is hardly possible to reproduce with GL, so I just use dirty hacks to emualte it. - - if (gDP.colorImage.address == 0x400 && gDP.colorImage.width == 64) { - memcpy(RDRAM + 0x400, RDRAM + 0x14d500, 4096); - return true; - } - - if (gDP.textureImage.width == 64) { - gDPTile & curTile = gDP.tiles[0]; - curTile.frameBufferAddress = 0; - curTile.textureMode = TEXTUREMODE_NORMAL; - textureCache().update(0); - currentCombiner()->update(false); - } - return false; - } - - // Modify palette for Paper Mario "2D lighting" effect - if (gDP.scissor.lrx != 16 || gDP.scissor.lry != 1 || _params.lrx != 16 || _params.lry != 1) - return false; - u8 envr = static_cast(gDP.envColor.r * 31.0f); - u8 envg = static_cast(gDP.envColor.g * 31.0f); - u8 envb = static_cast(gDP.envColor.b * 31.0f); - u16 env16 = static_cast((envr << 11) | (envg << 6) | (envb << 1) | 1); - u8 prmr = static_cast(gDP.primColor.r * 31.0f); - u8 prmg = static_cast(gDP.primColor.g * 31.0f); - u8 prmb = static_cast(gDP.primColor.b * 31.0f); - u16 prim16 = static_cast((prmr << 11) | (prmg << 6) | (prmb << 1) | 1); - u16 * src = reinterpret_cast(&TMEM[256]); - u16 * dst = reinterpret_cast(RDRAM + gDP.colorImage.address); - for (u32 i = 0; i < 16; ++i) - dst[i ^ 1] = (src[i << 2] & 0x100) ? prim16 : env16; - return true; -} - -// Special processing of textured rect. -// Return true if actuial rendering is not necessary -static bool(*texturedRectSpecial)(const GraphicsDrawer::TexturedRectParams & _params) = nullptr; - -void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params) -{ - gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode - m_drawingState = DrawingState::TexRect; - m_statistics.texRects++; - - if (m_texrectDrawer.canContinue()) { - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.setPolygonMode(DrawingState::TexRect); - cmbInfo.update(); - _updateTextures(); - cmbInfo.updateParameters(); - } else { - if (!m_texrectDrawer.isEmpty()) - m_texrectDrawer.draw(); - gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode - gSP.changed &= ~CHANGED_VIEWPORT; // Don't update viewport - if (_params.texrectCmd && (gSP.changed | gDP.changed) != 0) - _updateStates(DrawingState::TexRect); - gfxContext.enable(enable::CULL_FACE, false); - - if (_params.texrectCmd && texturedRectSpecial != nullptr && texturedRectSpecial(_params)) { - gSP.changed |= CHANGED_GEOMETRYMODE | CHANGED_VIEWPORT; - return; - } - - if (!_canDraw()) - return; - } - - CombinerProgram * pCurrentCombiner = currentCombiner(); - const FrameBuffer * pCurrentBuffer = _params.pBuffer; - DisplayWindow & wnd = dwnd(); - TextureCache & cache = textureCache(); - const bool bUseBilinear = gDP.otherMode.textureFilter != 0; - const bool bUseTexrectDrawer = m_bBGMode || ((config.graphics2D.enableNativeResTexrects != 0) - && bUseBilinear - && pCurrentCombiner->usesTexture() - && (pCurrentBuffer == nullptr || !pCurrentBuffer->m_cfb) - && (cache.current[0] != nullptr) - // && (cache.current[0] == nullptr || cache.current[0]->format == G_IM_FMT_RGBA || cache.current[0]->format == G_IM_FMT_CI) - && ((cache.current[0]->frameBufferTexture == CachedTexture::fbNone && !cache.current[0]->bHDTexture)) - && (cache.current[1] == nullptr || (cache.current[1]->frameBufferTexture == CachedTexture::fbNone && !cache.current[1]->bHDTexture))); - - const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f; - const float W = 1.0f; - const f32 ulx = _params.ulx; - const f32 uly = _params.uly; - const f32 lrx = _params.lrx; - const f32 lry = _params.lry; - - m_rect[0].x = ulx; - m_rect[0].y = uly; - m_rect[0].z = Z; - m_rect[0].w = W; - m_rect[1].x = lrx; - m_rect[1].y = uly; - m_rect[1].z = Z; - m_rect[1].w = W; - m_rect[2].x = ulx; - m_rect[2].y = lry; - m_rect[2].z = Z; - m_rect[2].w = W; - m_rect[3].x = lrx; - m_rect[3].y = lry; - m_rect[3].z = Z; - m_rect[3].w = W; - - struct - { - float s0, t0, s1, t1; - } texST[2] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; //struct for texture coordinates - - float offsetX, offsetY; - if (_params.flip) { - offsetX = (_params.lry - _params.uly) * _params.dsdx; - offsetY = (_params.lrx - _params.ulx) * _params.dtdy; - } else { - offsetX = (_params.lrx - _params.ulx) * _params.dsdx; - offsetY = (_params.lry - _params.uly) * _params.dtdy; - } - - for (u32 t = 0; t < 2; ++t) { - if (pCurrentCombiner->usesTile(t) && cache.current[t] && gSP.textureTile[t]) { - f32 shiftScaleS = 1.0f; - f32 shiftScaleT = 1.0f; - - s16 S = _params.s; - if (gSP.textureTile[t]->shifts > 10) { - const u32 shifts = 16 - gSP.textureTile[t]->shifts; - S = static_cast(S << shifts); - shiftScaleS = static_cast(1 << shifts); - } else if (gSP.textureTile[t]->shifts > 0) { - const u32 shifts = gSP.textureTile[t]->shifts; - S = static_cast(S >> shifts); - shiftScaleS /= static_cast(1 << shifts); - } - const f32 uls = _FIXED2FLOAT(S, 5); - const f32 lrs = uls + offsetX * shiftScaleS; - - s16 T = _params.t; - if (gSP.textureTile[t]->shiftt > 10) { - const u32 shiftt = 16 - gSP.textureTile[t]->shiftt; - T = static_cast(T << shiftt); - shiftScaleT = static_cast(1 << shiftt); - } else if (gSP.textureTile[t]->shiftt > 0) { - const u32 shiftt = gSP.textureTile[t]->shiftt; - T = static_cast(T >> shiftt); - shiftScaleT /= static_cast(1 << shiftt); - } - const f32 ult = _FIXED2FLOAT(T, 5); - const f32 lrt = ult + offsetY * shiftScaleT; - - texST[t].s0 = uls - gSP.textureTile[t]->fuls; - texST[t].s1 = lrs - gSP.textureTile[t]->fuls; - texST[t].t0 = ult - gSP.textureTile[t]->fult; - texST[t].t1 = lrt - gSP.textureTile[t]->fult; - - if (cache.current[t]->frameBufferTexture != CachedTexture::fbNone) { - texST[t].s0 = cache.current[t]->offsetS + texST[t].s0; - texST[t].t0 = cache.current[t]->offsetT + texST[t].t0; - texST[t].s1 = cache.current[t]->offsetS + texST[t].s1; - texST[t].t1 = cache.current[t]->offsetT + texST[t].t1; - } - - if (cache.current[t]->frameBufferTexture != CachedTexture::fbMultiSample) { - Context::TexParameters texParams; - - if ((cache.current[t]->mirrorS == 0 && cache.current[t]->maskS == 0 && - (texST[t].s0 < texST[t].s1 ? - texST[t].s0 >= 0.0f && texST[t].s1 <= static_cast(cache.current[t]->width) : - texST[t].s1 >= 0.0f && texST[t].s0 <= static_cast(cache.current[t]->width))) - || (cache.current[t]->maskS == 0 && (texST[t].s0 < -1024.0f || texST[t].s1 > 1023.99f))) - texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - - if (cache.current[t]->mirrorT == 0 && - (texST[t].t0 < texST[t].t1 ? - texST[t].t0 >= 0.0f && texST[t].t1 <= static_cast(cache.current[t]->height) : - texST[t].t1 >= 0.0f && texST[t].t0 <= static_cast(cache.current[t]->height))) - texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - - if (texParams.wrapS.isValid() || texParams.wrapT.isValid()) { - texParams.handle = cache.current[t]->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[t]; - gfxContext.setTextureParameters(texParams); - } - } - - texST[t].s0 *= cache.current[t]->hdRatioS; - texST[t].t0 *= cache.current[t]->hdRatioT; - texST[t].s1 *= cache.current[t]->hdRatioS; - texST[t].t1 *= cache.current[t]->hdRatioT; - - } - } - - if (gDP.otherMode.cycleType == G_CYC_COPY && cache.current[0]->frameBufferTexture != CachedTexture::fbMultiSample) { - Context::TexParameters texParams; - texParams.handle = cache.current[0]->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[0]; - texParams.minFilter = textureParameters::FILTER_NEAREST; - texParams.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(texParams); - } - - m_rect[0].s0 = texST[0].s0; - m_rect[0].t0 = texST[0].t0; - m_rect[0].s1 = texST[1].s0; - m_rect[0].t1 = texST[1].t0; - - m_rect[3].s0 = texST[0].s1; - m_rect[3].t0 = texST[0].t1; - m_rect[3].s1 = texST[1].s1; - m_rect[3].t1 = texST[1].t1; - - if (_params.flip) { - m_rect[1].s0 = texST[0].s0; - m_rect[1].t0 = texST[0].t1; - m_rect[1].s1 = texST[1].s0; - m_rect[1].t1 = texST[1].t1; - - m_rect[2].s0 = texST[0].s1; - m_rect[2].t0 = texST[0].t0; - m_rect[2].s1 = texST[1].s1; - m_rect[2].t1 = texST[1].t0; - } else { - m_rect[1].s0 = texST[0].s1; - m_rect[1].t0 = texST[0].t0; - m_rect[1].s1 = texST[1].s1; - m_rect[1].t1 = texST[1].t0; - - m_rect[2].s0 = texST[0].s0; - m_rect[2].t0 = texST[0].t1; - m_rect[2].s1 = texST[1].s0; - m_rect[2].t1 = texST[1].t1; - } - - if (wnd.isAdjustScreen() && - (_params.forceAjustScale || - ((gDP.colorImage.width > VI.width * 98 / 100) && (static_cast(_params.lrx - _params.ulx) < VI.width * 9 / 10)))) - { - const float scale = wnd.getAdjustScale(); - const float offsetx = static_cast(gDP.colorImage.width) * (1.0f-scale) / 2.0f; - for (u32 i = 0; i < 4; ++i) { - m_rect[i].x *= scale; - m_rect[i].x += offsetx; - } - } - - m_rect[0].bc0 = 0.0f; - m_rect[0].bc1 = 0.0f; - m_rect[1].bc0 = 0.0f; - m_rect[1].bc1 = 1.0f; - m_rect[2].bc0 = 1.0f; - m_rect[2].bc1 = 0.0f; - m_rect[3].bc0 = 1.0f; - m_rect[3].bc1 = 1.0f; - - - if (bUseTexrectDrawer) { - if (m_bBGMode) { - m_texrectDrawer.addBackgroundRect(); - return; - } - if (m_texrectDrawer.addRect()) - return; - } - - _updateViewport(_params.pBuffer); - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = m_rect; - rectParams.combiner = currentCombiner(); - gfxContext.drawRects(rectParams); - if (g_debugger.isCaptureMode()) { - g_debugger.addRects(rectParams); - } - - gSP.changed |= CHANGED_GEOMETRYMODE | CHANGED_VIEWPORT; -} - -void GraphicsDrawer::correctTexturedRectParams(TexturedRectParams & _params) -{ - if (config.graphics2D.correctTexrectCoords == Config::tcSmart) { - if (_params.ulx == m_texrectParams.ulx && _params.lrx == m_texrectParams.lrx) { - if (fabsf(_params.uly - m_texrectParams.lry) < 0.51f) - _params.uly = m_texrectParams.lry; - else if (fabsf(_params.lry - m_texrectParams.uly) < 0.51f) - _params.lry = m_texrectParams.uly; - } - else if (_params.uly == m_texrectParams.uly && _params.lry == m_texrectParams.lry) { - if (fabsf(_params.ulx - m_texrectParams.lrx) < 0.51f) - _params.ulx = m_texrectParams.lrx; - else if (fabsf(_params.lrx - m_texrectParams.ulx) < 0.51f) - _params.lrx = m_texrectParams.ulx; - } - } - else if (config.graphics2D.correctTexrectCoords == Config::tcForce) { - _params.lrx += 0.25f; - _params.lry += 0.25f; - } - - m_texrectParams = _params; -} - -void GraphicsDrawer::drawText(const char *_pText, float x, float y) -{ - m_drawingState = DrawingState::Non; - g_textDrawer.drawText(_pText, x, y); -} - -void GraphicsDrawer::Statistics::clear() -{ - fillRects = 0; - texRects = 0; - clippedTris = 0; - rejectedTris = 0; - culledTris = 0; - drawnTris = 0; - lines = 0; -} - -void GraphicsDrawer::_drawOSD(const char *_pText, float _x, float & _y) -{ - float tW, tH; - g_textDrawer.getTextSize(_pText, tW, tH); - - const bool top = (config.posTop & config.onScreenDisplay.pos) != 0; - const bool right = (config.onScreenDisplay.pos == Config::posTopRight) || (config.onScreenDisplay.pos == Config::posBottomRight); - const bool center = (config.onScreenDisplay.pos == Config::posTopCenter) || (config.onScreenDisplay.pos == Config::posBottomCenter); - - if (center) - _x = -tW * 0.5f; - else if (right) - _x -= tW; - - if (top) - _y -= tH; - - drawText(_pText, _x, _y); - - if (top) - _y -= tH * 0.5f; - else - _y += tH * 1.5f; -} - -void GraphicsDrawer::drawOSD() -{ - if ((config.onScreenDisplay.fps | - config.onScreenDisplay.vis | - config.onScreenDisplay.percent | - config.onScreenDisplay.internalResolution | - config.onScreenDisplay.renderingResolution | - config.onScreenDisplay.statistics - ) == 0 && - m_osdMessages.empty()) - return; - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - DisplayWindow & wnd = DisplayWindow::get(); - const s32 X = (wnd.getScreenWidth() - wnd.getWidth()) / 2; - const s32 Y = static_cast(wnd.getHeightOffset()); - const s32 W = static_cast(wnd.getWidth()); - const s32 H = static_cast(wnd.getHeight()); - - gfxContext.setViewport(X, Y, W, H); - gfxContext.setScissor(X, Y, W, H); - - gSP.changed |= CHANGED_VIEWPORT; - gDP.changed |= CHANGED_SCISSOR; - - - const bool bottom = (config.posBottom & config.onScreenDisplay.pos) != 0; - const bool left = (config.onScreenDisplay.pos == Config::posTopLeft) || (config.onScreenDisplay.pos == Config::posBottomLeft); - - const float hp = left ? -1.0f : 1.0f; - const float vp = bottom ? -1.0f : 1.0f; - - float hShift, vShift; - g_textDrawer.getTextSize("0", hShift, vShift); - hShift *= 0.5f; - vShift *= 0.5f; - const float x = hp - hShift * hp; - float y = vp - vShift * vp; - char buf[256]; - - if (config.onScreenDisplay.fps) { - sprintf(buf, "%d FPS", int(perf.getFps())); - _drawOSD(buf, x, y); - } - - if (config.onScreenDisplay.vis) { - sprintf(buf, "%d VI/S", int(perf.getVIs())); - _drawOSD(buf, x, y); - } - - if (config.onScreenDisplay.percent) { - sprintf(buf, "%d %%", int(perf.getPercent())); - _drawOSD(buf, x, y); - } - - if (config.onScreenDisplay.renderingResolution) { - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr && VI.width != 0) { - const float aspect = float(VI.height) / float(VI.width); - const u32 height = u32(pBuffer->m_pTexture->width * aspect); - sprintf(buf, "Rendering Resolution %ux%u", pBuffer->m_pTexture->width, height); - _drawOSD(buf, x, y); - } - } - - if (config.onScreenDisplay.internalResolution) { - FrameBuffer * pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr && VI.width != 0) { - const float aspect = float(VI.height) / float(VI.width); - const u32 height = u32(pBuffer->m_width * aspect); - sprintf(buf, "Internal Resolution %ux%u", pBuffer->m_width, height); - _drawOSD(buf, x, y); - } - } - - if (config.onScreenDisplay.statistics) { - if (RSP.LLE) - sprintf(buf, "fill rects: %3u | tex rects: %3u | triangles: %5u", - m_statistics.fillRects, m_statistics.texRects, m_statistics.drawnTris); - else - sprintf(buf, "fill rects: %3u | tex rects: %3u | lines: %4u | tris drawn: %4u | clipped: %4u | culled: %4u | total: %5u", - m_statistics.fillRects, m_statistics.texRects, m_statistics.lines, - m_statistics.drawnTris, m_statistics.clippedTris, m_statistics.culledTris, - m_statistics.drawnTris + m_statistics.clippedTris + m_statistics.culledTris); - _drawOSD(buf, x, y); - } - - - for (const std::string & m : m_osdMessages) { - _drawOSD(m.c_str(), x, y); - } -} - -void GraphicsDrawer::showMessage(std::string _message, Milliseconds _interval) -{ - m_osdMessages.emplace_back(_message); - std::thread t(&GraphicsDrawer::_removeOSDMessage, this, std::prev(m_osdMessages.end()), _interval); - t.detach(); -} - -void GraphicsDrawer::_removeOSDMessage(OSDMessages::iterator _iter, Milliseconds _interval) -{ - std::this_thread::sleep_for(_interval); - m_osdMessages.erase(_iter); -} - -void GraphicsDrawer::clearDepthBuffer() -{ - if (!_canDraw()) - return; - - depthBufferList().clearBuffer(); - - _updateDepthUpdate(); -} - -void GraphicsDrawer::clearColorBuffer(float *_pColor) -{ - if (_pColor != nullptr) - gfxContext.clearColorBuffer(_pColor[0], _pColor[1], _pColor[2], _pColor[3]); - else - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); -} - -bool GraphicsDrawer::isClipped(u32 _v0, u32 _v1, u32 _v2) const -{ - if ((triangles.vertices[_v0].clip & triangles.vertices[_v1].clip & triangles.vertices[_v2].clip) != 0) { - m_statistics.clippedTris++; - return true; - } - return false; -} - -bool GraphicsDrawer::isRejected(u32 _v0, u32 _v1, u32 _v2) const -{ - if (!GBI.isRej() || gSP.clipRatio < 2) - return false; - - static gDPScissor rejectBox; - if ((gDP.changed & CHANGED_REJECT_BOX) != 0) { - const f32 scissorWidth2 = (gDP.scissor.lrx - gDP.scissor.ulx) * (gSP.clipRatio - 1) * 0.5f; - const f32 scissorHeight2 = (gDP.scissor.lry - gDP.scissor.uly) * (gSP.clipRatio - 1) * 0.5f; - rejectBox.ulx = gDP.scissor.ulx - scissorWidth2; - rejectBox.lrx = gDP.scissor.lrx + scissorWidth2; - rejectBox.uly = gDP.scissor.uly - scissorHeight2; - rejectBox.lry = gDP.scissor.lry + scissorHeight2; - gDP.changed ^= CHANGED_REJECT_BOX; - } - u32 verts[3] = { _v0, _v1, _v2 }; - const f32 ySign = GBI.isNegativeY() ? -1.0f : 1.0f; - for (u32 i = 0; i < 3; ++i) { - const SPVertex & v = triangles.vertices[verts[i]]; - if ((v.modify & MODIFY_XY) != 0) - continue; - const f32 sx = gSP.viewport.vtrans[0] + (v.x / v.w) * gSP.viewport.vscale[0]; - if (sx < rejectBox.ulx) { - m_statistics.rejectedTris++; - return true; - } - if (sx > rejectBox.lrx) { - m_statistics.rejectedTris++; - return true; - } - const f32 sy = gSP.viewport.vtrans[1] + (v.y / v.w) * gSP.viewport.vscale[1] * ySign; - if (sy < rejectBox.uly) { - m_statistics.rejectedTris++; - return true; - } - if (sy > rejectBox.lry) { - m_statistics.rejectedTris++; - return true; - } - } - return false; -} - -void GraphicsDrawer::copyTexturedRect(const CopyRectParams & _params) -{ - m_drawingState = DrawingState::TexRect; - - const float scaleX = 1.0f / _params.dstWidth; - const float scaleY = 1.0f / _params.dstHeight; - const float Z = 0.0f; - const float W = 1.0f; - float X0 = _params.dstX0 * (2.0f * scaleX) - 1.0f; - float Y0 = _params.dstY0 * (2.0f * scaleY) - 1.0f; - float X1 = _params.dstX1 * (2.0f * scaleX) - 1.0f; - float Y1 = _params.dstY1 * (2.0f * scaleY) - 1.0f; - if (_params.invertX) { - X0 = -X0; - X1 = -X1; - } - if (_params.invertY) { - Y0 = -Y0; - Y1 = -Y1; - } - - m_rect[0].x = X0; - m_rect[0].y = Y0; - m_rect[0].z = Z; - m_rect[0].w = W; - m_rect[1].x = X1; - m_rect[1].y = Y0; - m_rect[1].z = Z; - m_rect[1].w = W; - m_rect[2].x = X0; - m_rect[2].y = Y1; - m_rect[2].z = Z; - m_rect[2].w = W; - m_rect[3].x = X1; - m_rect[3].y = Y1; - m_rect[3].z = Z; - m_rect[3].w = W; - - const float scaleS = 1.0f / _params.srcWidth; - const float scaleT = 1.0f / _params.srcHeight; - - const float S0 = _params.srcX0 * scaleS; - const float S1 = _params.srcX1 * scaleS; - const float T0 = _params.srcY0 * scaleT; - const float T1 = _params.srcY1 * scaleT; - - m_rect[0].s0 = S0; - m_rect[0].t0 = T0; - m_rect[1].s0 = S1; - m_rect[1].t0 = T0; - m_rect[2].s0 = S0; - m_rect[2].t0 = T1; - m_rect[3].s0 = S1; - m_rect[3].t0 = T1; - - for (u32 i = 0; i < 2; ++i) { - CachedTexture * tex = _params.tex[i]; - if (tex == nullptr) - continue; - - Context::TexParameters texParams; - texParams.handle = tex->name; - texParams.textureUnitIndex = textureIndices::Tex[i]; - if (tex->frameBufferTexture == CachedTexture::fbMultiSample) - texParams.target = textureTarget::TEXTURE_2D_MULTISAMPLE; - else { - texParams.target = textureTarget::TEXTURE_2D; - texParams.minFilter = _params.filter; - texParams.magFilter = _params.filter; - texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - } - gfxContext.setTextureParameters(texParams); - } - - gfxContext.setViewport(0, 0, static_cast(_params.dstWidth), static_cast(_params.dstHeight)); - gfxContext.enable(enable::CULL_FACE, false); - gfxContext.enable(enable::BLEND, false); - - if (config.frameBufferEmulation.copyDepthToMainDepthBuffer == 0 || _params.tex[1] == nullptr) { - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enableDepthWrite(false); - } else { - gfxContext.setDepthCompare(compare::ALWAYS); - gfxContext.enableDepthWrite(true); - gfxContext.enable(enable::DEPTH_TEST, true); - } - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = m_rect; - rectParams.combiner = _params.combiner; - _params.combiner->activate(); - gfxContext.enable(enable::SCISSOR_TEST, false); - gfxContext.drawRects(rectParams); - gfxContext.enable(enable::SCISSOR_TEST, true); - - gSP.changed |= CHANGED_GEOMETRYMODE | CHANGED_VIEWPORT; - gDP.changed |= CHANGED_RENDERMODE | CHANGED_TILE | CHANGED_COMBINE; -} - -void GraphicsDrawer::blitOrCopyTexturedRect(const BlitOrCopyRectParams & _params) -{ - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = _params.readBuffer; - blitParams.drawBuffer = _params.drawBuffer; - blitParams.srcX0 = _params.srcX0; - blitParams.srcX1 = _params.srcX1; - blitParams.dstX0 = _params.dstX0; - blitParams.dstX1 = _params.dstX1; - blitParams.srcY0 = _params.srcY0; - blitParams.srcY1 = _params.srcY1; - blitParams.dstY0 = _params.dstY0; - blitParams.dstY1 = _params.dstY1; - blitParams.mask = _params.mask; - blitParams.filter = _params.filter; - if (_params.invertX) { - std::swap(blitParams.dstX0, blitParams.dstX1); - } - if (_params.invertY) { - std::swap(blitParams.dstY0, blitParams.dstY1); - } - - if (gfxContext.blitFramebuffers(blitParams)) - return; - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, _params.readBuffer); - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, _params.drawBuffer); - copyTexturedRect(_params); -} - -void GraphicsDrawer::_initStates() -{ - gfxContext.enable(enable::CULL_FACE, false); - gfxContext.enable(enable::SCISSOR_TEST, true); - gfxContext.enableDepthWrite(false); - gfxContext.setDepthCompare(compare::ALWAYS); - - if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable) { - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enable(enable::POLYGON_OFFSET_FILL, false); - } - else { - gfxContext.enable(enable::DEPTH_TEST, true); -#if defined(OS_ANDROID) || defined(OS_IOS) - if (config.generalEmulation.forcePolygonOffset != 0) - gfxContext.setPolygonOffset(config.generalEmulation.polygonOffsetFactor, config.generalEmulation.polygonOffsetUnits); - else -#endif - gfxContext.setPolygonOffset(-3.0f, -3.0f); - } - - DisplayWindow & wnd = DisplayWindow::get(); - gfxContext.setViewport(0, static_cast(wnd.getHeightOffset()), - static_cast(wnd.getScreenWidth()), static_cast(wnd.getScreenHeight())); - - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); - - srand(static_cast(time(nullptr))); - - wnd.swapBuffers(); -} - -void GraphicsDrawer::_setSpecialTexrect() const -{ - std::string name(RSP.romname); - std::transform(name.begin(), name.end(), name.begin(), ::toupper); -#define FOUND(romname) name.find(romname) != std::string::npos - - if (FOUND("BEETLE") || FOUND("HSV") || FOUND("DUCK DODGERS") || FOUND("DAFFY DUCK")) - texturedRectSpecial = texturedRectShadowMap; - else if (FOUND("PERFECT DARK") || FOUND("TUROK_DINOSAUR_HUNTE")) - texturedRectSpecial = texturedRectDepthBufferCopy; // See comments to that function! - else if (FOUND("CONKER BFD")) - texturedRectSpecial = texturedRectCopyToItself; - else if (FOUND("YOSHI STORY")) - texturedRectSpecial = texturedRectBGCopy; - else if (FOUND("PAPER MARIO") || FOUND("MARIO STORY")) - texturedRectSpecial = texturedRectPaletteMod; - else - texturedRectSpecial = nullptr; -} - -void GraphicsDrawer::_initData() -{ - _initStates(); - _setSpecialTexrect(); - - textureCache().init(); - g_textDrawer.init(); - DepthBuffer_Init(); - FrameBuffer_Init(); - Combiner_Init(); - TFH.init(); - PostProcessor::get().init(); - g_zlutTexture.init(); - g_noiseTexture.init(); - g_paletteTexture.init(); - perf.reset(); - FBInfo::fbInfo.reset(); - m_texrectDrawer.init(); - m_drawingState = DrawingState::Non; - m_maxLineWidth = gfxContext.getMaxLineWidth(); - - gSP.changed = gDP.changed = 0xFFFFFFFF; - - memset(triangles.vertices.data(), 0, triangles.vertices.size() * sizeof(SPVertex)); - triangles.elements.fill(0); - for (auto vtx : triangles.vertices) - vtx.w = 1.0f; - triangles.num = 0; - m_dmaVerticesNum = 0; -} - -void GraphicsDrawer::_destroyData() -{ - m_drawingState = DrawingState::Non; - m_texrectDrawer.destroy(); - g_paletteTexture.destroy(); - g_zlutTexture.destroy(); - g_noiseTexture.destroy(); - PostProcessor::get().destroy(); - if (TFH.optionsChanged()) - TFH.shutdown(); - Combiner_Destroy(); - FrameBuffer_Destroy(); - DepthBuffer_Destroy(); - g_textDrawer.destroy(); - textureCache().destroy(); -} diff --git a/GLideN64/src/GraphicsDrawer.h b/GLideN64/src/GraphicsDrawer.h deleted file mode 100644 index d1c479e..0000000 --- a/GLideN64/src/GraphicsDrawer.h +++ /dev/null @@ -1,231 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include "gSP.h" -#include "TexrectDrawer.h" -#include "Graphics/ObjectHandle.h" -#include "Graphics/Parameters.h" - -namespace graphics { - class CombinerProgram; -} - -struct CachedTexture; -struct FrameBuffer; - -#define VERTBUFF_SIZE 256U -#define ELEMBUFF_SIZE 1024U - -constexpr f32 SCREEN_SIZE_DIM = 640.0f; - -enum class DrawingState -{ - Non, - Line, - Triangle, - ScreenSpaceTriangle, - Rect, - TexRect -}; - -struct RectVertex -{ - float x, y, z, w; - float s0, t0, s1, t1; - float bc0, bc1; -}; - -typedef std::chrono::milliseconds Milliseconds; - -class GraphicsDrawer -{ -public: - void addTriangle(u32 _v0, u32 _v1, u32 _v2); - - void drawTriangles(); - - void drawScreenSpaceTriangle(u32 _numVtx, graphics::DrawModeParam _mode = graphics::drawmode::TRIANGLE_STRIP); - - void drawDMATriangles(u32 _numVtx); - - void drawLine(u32 _v0, u32 _v1, float _width); - - void drawRect(int _ulx, int _uly, int _lrx, int _lry); - - struct TexturedRectParams - { - float ulx, uly, lrx, lry; - float dsdx, dtdy; - s16 s, t; - bool flip, forceAjustScale, texrectCmd; - const FrameBuffer * pBuffer; - TexturedRectParams(float _ulx, float _uly, float _lrx, float _lry, - float _dsdx, float _dtdy, - s16 _s, s16 _t, - bool _flip, bool _forceAjustScale, bool _texrectCmd, - const FrameBuffer * _pBuffer - ) : - ulx(_ulx), uly(_uly), lrx(_lrx), lry(_lry), - dsdx(_dsdx), dtdy(_dtdy), - s(_s), t(_t), - flip(_flip), forceAjustScale(_forceAjustScale), texrectCmd(_texrectCmd), - pBuffer(_pBuffer) - {} - private: - friend class GraphicsDrawer; - TexturedRectParams() : - ulx(0), uly(0), lrx(0), lry(0) - {}; - }; - - void correctTexturedRectParams(TexturedRectParams & _params); - - void drawTexturedRect(const TexturedRectParams & _params); - - struct CopyRectParams - { - s32 srcX0 = 0; - s32 srcY0 = 0; - s32 srcX1; - s32 srcY1; - u32 srcWidth; - u32 srcHeight; - s32 dstX0 = 0; - s32 dstY0 = 0; - s32 dstX1; - s32 dstY1; - u32 dstWidth; - u32 dstHeight; - bool invertX = false; - bool invertY = false; - typedef std::array Textures; - Textures tex = Textures{ { nullptr, nullptr } }; - graphics::CombinerProgram * combiner = nullptr; - graphics::TextureParam filter; - }; - - void copyTexturedRect(const CopyRectParams & _params); - - struct BlitOrCopyRectParams : public CopyRectParams - { - graphics::ObjectHandle readBuffer; - graphics::ObjectHandle drawBuffer; - graphics::BlitMaskParam mask; - }; - - void blitOrCopyTexturedRect(const BlitOrCopyRectParams & _params); - - void drawText(const char *_pText, float x, float y); - - void drawOSD(); - - void showMessage(std::string _message, Milliseconds _interval); - - void clearDepthBuffer(); - - void clearColorBuffer(float * _pColor); - - int getTrianglesCount() const { return triangles.num; } - - bool isClipped(u32 _v0, u32 _v1, u32 _v2) const; - - bool isRejected(u32 _v0, u32 _v1, u32 _v2) const; - - SPVertex & getVertex(u32 _v) { return triangles.vertices[_v]; } - - SPVertex * getVertexPtr(u32 _v) { return triangles.vertices.data() + _v; } - - void setDMAVerticesSize(u32 _size) { if (m_dmaVertices.size() < _size) m_dmaVertices.resize(_size); } - - SPVertex * getDMAVerticesData() { return m_dmaVertices.data(); } - - SPVertex & getCurrentDMAVertex(); - u32 getDMAVerticesCount() const { return m_dmaVerticesNum; } - - void updateScissor(FrameBuffer * _pBuffer) const; - - DrawingState getDrawingState() const { return m_drawingState; } - - void dropRenderState() { m_drawingState = DrawingState::Non; } - - void flush() { m_texrectDrawer.draw(); } - - bool isTexrectDrawerMode() const { return !m_texrectDrawer.isEmpty(); } - - void setBackgroundDrawingMode(bool _mode) { m_bBGMode = _mode; } - - void setBlendMode(bool _forceLegacyBlending = false) const; - - void clearStatistics() { m_statistics.clear(); } - - struct Statistics { - u32 fillRects = 0; - u32 texRects = 0; - u32 clippedTris = 0; - u32 rejectedTris = 0; - u32 culledTris = 0; - u32 drawnTris = 0; - u32 lines = 0; - void clear(); - }; - -private: - friend class DisplayWindow; - friend TexrectDrawer; - - GraphicsDrawer(); - ~GraphicsDrawer(); - - GraphicsDrawer(const GraphicsDrawer &) = delete; - - void _initStates(); - void _initData(); - void _destroyData(); - - void _setSpecialTexrect() const; - - void _legacyBlending() const; - void _ordinaryBlending() const; - void _dualSourceBlending() const; - void _updateCullFace() const; - void _updateViewport(const FrameBuffer * _pBuffer = nullptr, const f32 scale = 0.0f) const; - void _updateDepthUpdate() const; - void _updateDepthCompare() const; - void _updateTextures() const; - void _updateStates(DrawingState _drawingState) const; - void _prepareDrawTriangle(DrawingState _drawingState); - bool _canDraw() const; - void _drawThickLine(u32 _v0, u32 _v1, float _width); - - void _drawOSD(const char *_pText, float _x, float & _y); - - typedef std::list OSDMessages; - void _removeOSDMessage(OSDMessages::iterator _iter, Milliseconds _interval); - - DrawingState m_drawingState; - TexturedRectParams m_texrectParams; - - struct { - std::array vertices; - std::array elements; - u32 num = 0; - u32 maxElement = 0; - } triangles; - - std::vector m_dmaVertices; - u32 m_dmaVerticesNum; - - RectVertex m_rect[4]; - - u32 m_modifyVertices; - f32 m_maxLineWidth; - bool m_bFlatColors; - bool m_bBGMode; - TexrectDrawer m_texrectDrawer; - OSDMessages m_osdMessages; - mutable Statistics m_statistics; -}; diff --git a/GLideN64/src/Log.cpp b/GLideN64/src/Log.cpp deleted file mode 100644 index 557fc79..0000000 --- a/GLideN64/src/Log.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include -#include -#include -#include "Log.h" -#include "PluginAPI.h" -#include "wst.h" -#include -#include -#include -#include -#include -#include -#include - -std::mutex g_logMutex; -std::wofstream fileOutput; - -std::wstring getFormattedTime() -{ - using namespace std::chrono; - - // get current time - auto now = system_clock::now(); - - // get number of milliseconds for the current second - // (remainder after division into seconds) - auto ms = duration_cast(now.time_since_epoch()) % 1000; - - // convert to std::time_t in order to convert to std::tm (broken time) - auto timer = system_clock::to_time_t(now); - - // convert to broken time - std::tm bt = *std::localtime(&timer); - - std::wstringstream oss; - - oss << std::put_time(&bt, L"%Y/%m/%d,%H:%M:%S"); // HH:MM:SS - oss << L'.' << std::setfill(L'0') << std::setw(3) << ms.count(); - - return oss.str(); -} - -void LogDebug(const char* _fileName, int _line, u16 _type, const char* _format, ...) { - - static const char* logLevelText[] = { - "NONE", - "ERROR", - "MINIMAL", - "WARNING", - "VERBOSE", - "APIFUNC", - }; - - if (_type > LOG_LEVEL) - return; - - std::wstring formattedTimeOfLog = getFormattedTime(); - - std::unique_lock lock(g_logMutex); - - if (!fileOutput.is_open()) { - class SetLocale - { - public: - SetLocale() : m_locale(setlocale(LC_CTYPE, NULL)) { setlocale(LC_CTYPE, ""); } - ~SetLocale() { setlocale(LC_CTYPE, m_locale.c_str()); } - private: - std::string m_locale; - } setLocale; - - wchar_t logPath[PLUGIN_PATH_SIZE + 16]; - api().GetUserDataPath(logPath); - - // Convert wchar string to multibyte string - // Use large enough buffer to hold multibyte conversion of wchar string - char logPathChar[PLUGIN_PATH_SIZE * 4]; - std::wcstombs(logPathChar, logPath, sizeof(logPathChar)); - - std::stringstream logPathStream; - logPathStream << logPathChar << "/" << "gliden64.log"; - fileOutput.open(logPathStream.str().c_str(), std::wofstream::out | std::wofstream::app); - } - - if (!fileOutput.is_open()) - return; - - // initialize use of the variable argument array - va_list vaArgs; - va_start(vaArgs, _format); - - // reliably acquire the size from a copy of - // the variable argument array - // and a functionally reliable call - // to mock the formatting - va_list vaCopy; - va_copy(vaCopy, vaArgs); - const int iLen = std::vsnprintf(NULL, 0, _format, vaCopy); - va_end(vaCopy); - - // return a formatted string without - // risking memory mismanagement - // and without assuming any compiler - // or platform specific behavior - std::vector zc(iLen + 1); - std::vsnprintf(zc.data(), zc.size(), _format, vaArgs); - va_end(vaArgs); - - std::time_t t = std::time(nullptr); - std::wstringstream lcFormatString; - lcFormatString << formattedTimeOfLog << "," << _fileName << ":" << _line << "," << logLevelText[_type] << ", \"" << zc.data() << "\"" << std::endl; - fileOutput << lcFormatString.str(); - fileOutput.flush(); -} - -#if defined(OS_WINDOWS) && !defined(MINGW) -#include "windows/GLideN64_windows.h" -void debugPrint(const char * format, ...) { - char text[256]; - wchar_t wtext[256]; - va_list va; - va_start(va, format); - vsprintf(text, format, va); - mbstowcs(wtext, text, 256); - OutputDebugString(wtext); - va_end(va); -} -#endif diff --git a/GLideN64/src/Log.h b/GLideN64/src/Log.h deleted file mode 100644 index 250f74e..0000000 --- a/GLideN64/src/Log.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __LOG_H__ -#define __LOG_H__ - -#define LOG_NONE 0 -#define LOG_ERROR 1 -#define LOG_MINIMAL 2 -#define LOG_WARNING 3 -#define LOG_VERBOSE 4 -#define LOG_APIFUNC 5 - -#define LOG_LEVEL LOG_WARNING - -#if LOG_LEVEL > 0 - -#include "Types.h" -#include -#include - -// for strrchr -#include - -#ifdef OS_WINDOWS -#define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) -#else -#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) -#endif //OS_WINDOWS - -#define LOG(...) LogDebug(__FILENAME__, __LINE__, __VA_ARGS__) - -void LogDebug(const char* _fileName, int _line, u16 _type, const char* _format, ...); - -#else - -#define LOG(A, ...) - -#endif - -#if defined(OS_WINDOWS) && !defined(MINGW) -void debugPrint(const char * format, ...); -#else -#define debugPrint(A, ...) -#endif - -#endif diff --git a/GLideN64/src/Log_android.cpp b/GLideN64/src/Log_android.cpp deleted file mode 100644 index c078a8a..0000000 --- a/GLideN64/src/Log_android.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "Log.h" -#include -#include -#include - -void LogDebug(const char* _fileName, int _line, u16 _type, const char* _format, ...) { - - if (_type > LOG_LEVEL) - return; - - // initialize use of the variable argument array - va_list vaArgs; - va_start(vaArgs, _format); - - // reliably acquire the size from a copy of - // the variable argument array - // and a functionally reliable call - // to mock the formatting - va_list vaCopy; - va_copy(vaCopy, vaArgs); - const int iLen = std::vsnprintf(NULL, 0, _format, vaCopy); - va_end(vaCopy); - - // return a formatted string without - // risking memory mismanagement - // and without assuming any compiler - // or platform specific behavior - std::vector zc(iLen + 1); - std::vsnprintf(zc.data(), zc.size(), _format, vaArgs); - va_end(vaArgs); - - static const char* logLevelText[] = { - "NONE", - "ERROR", - "MINIMAL", - "WARNING", - "VERBOSE", - "APIFUNC", - }; - - std::stringstream lcFormatString; - lcFormatString << _fileName << ":" << _line << "," << logLevelText[_type] << ", \"" << zc.data() << "\"" << std::endl; - - static android_LogPriority androidLogTranslate[] = { - ANDROID_LOG_SILENT, - ANDROID_LOG_ERROR, - ANDROID_LOG_INFO, - ANDROID_LOG_WARN, - ANDROID_LOG_DEBUG, - ANDROID_LOG_VERBOSE, - }; - - __android_log_write(androidLogTranslate[_type], "GLideN64", lcFormatString.str().c_str()); -} \ No newline at end of file diff --git a/GLideN64/src/Log_ios.mm b/GLideN64/src/Log_ios.mm deleted file mode 100644 index 41e8090..0000000 --- a/GLideN64/src/Log_ios.mm +++ /dev/null @@ -1,13 +0,0 @@ -#include "Log.h" -#include - -void LOG(u16 type, const char * format, ...) { - if (type > LOG_LEVEL) - return; - - va_list va; - va_start(va, format); - NSString *nsformat = [NSString stringWithFormat:@"GLideN64: %s", format]; - NSLogv(nsformat, va); - va_end(va); -} diff --git a/GLideN64/src/MemoryStatus.h b/GLideN64/src/MemoryStatus.h deleted file mode 100644 index 87d13b1..0000000 --- a/GLideN64/src/MemoryStatus.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include "Platform.h" -#include "Types.h" - -bool isMemoryWritable(void * ptr, size_t byteCount); diff --git a/GLideN64/src/MupenPlusPluginAPI.cpp b/GLideN64/src/MupenPlusPluginAPI.cpp deleted file mode 100644 index ea77791..0000000 --- a/GLideN64/src/MupenPlusPluginAPI.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "PluginAPI.h" -#include "Types.h" -#include "mupenplus/GLideN64_mupenplus.h" -#include "N64.h" - -extern "C" { - -EXPORT int CALL RomOpen(void) -{ - if (rdram_size != nullptr) - RDRAMSize = *rdram_size - 1; - else - RDRAMSize = 0; - - return api().RomOpen(); -} - -EXPORT m64p_error CALL PluginGetVersion( - m64p_plugin_type * _PluginType, - int * _PluginVersion, - int * _APIVersion, - const char ** _PluginNamePtr, - int * _Capabilities -) -{ - return api().PluginGetVersion(_PluginType, _PluginVersion, _APIVersion, _PluginNamePtr, _Capabilities); -} - -EXPORT m64p_error CALL PluginStartup( - m64p_dynlib_handle CoreLibHandle, - void *Context, - void (*DebugCallback)(void *, int, const char *) -) -{ - return api().PluginStartup(CoreLibHandle); -} - -#ifdef M64P_GLIDENUI -EXPORT m64p_error CALL PluginConfig(void) -{ - return api().PluginConfig(); -} -#endif // M64P_GLIDENUI - -EXPORT m64p_error CALL PluginShutdown(void) -{ - return api().PluginShutdown(); -} - -EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front) -{ - api().ReadScreen2(dest, width, height, front); -} - -EXPORT void CALL SetRenderingCallback(void (*callback)(int)) -{ - api().SetRenderingCallback(callback); -} - -EXPORT void CALL ResizeVideoOutput(int width, int height) -{ - api().ResizeVideoOutput(width, height); -} - -} // extern "C" diff --git a/GLideN64/src/N64.cpp b/GLideN64/src/N64.cpp deleted file mode 100644 index dc91c4c..0000000 --- a/GLideN64/src/N64.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "N64.h" - -u8 *HEADER; -u8 *DMEM; -u8 *IMEM; -u64 TMEM[512]; -u8 *RDRAM; - -u32 RDRAMSize = 0; - -N64Regs REG; - -bool ConfigOpen = false; diff --git a/GLideN64/src/N64.h b/GLideN64/src/N64.h deleted file mode 100644 index 2b2a650..0000000 --- a/GLideN64/src/N64.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef N64_H -#define N64_H - -#include "Types.h" - -#define MI_INTR_DP 0x20 // Bit 5: DP intr - -struct N64Regs -{ - u32 *MI_INTR; - - u32 *DPC_START; - u32 *DPC_END; - u32 *DPC_CURRENT; - u32 *DPC_STATUS; - u32 *DPC_CLOCK; - u32 *DPC_BUFBUSY; - u32 *DPC_PIPEBUSY; - u32 *DPC_TMEM; - - u32 *VI_STATUS; - u32 *VI_ORIGIN; - u32 *VI_WIDTH; - u32 *VI_INTR; - u32 *VI_V_CURRENT_LINE; - u32 *VI_TIMING; - u32 *VI_V_SYNC; - u32 *VI_H_SYNC; - u32 *VI_LEAP; - u32 *VI_H_START; - u32 *VI_V_START; - u32 *VI_V_BURST; - u32 *VI_X_SCALE; - u32 *VI_Y_SCALE; - - u32 *SP_STATUS; -}; - -extern N64Regs REG; -extern u8 *HEADER; -extern u8 *DMEM; -extern u8 *IMEM; -extern u8 *RDRAM; -extern u64 TMEM[512]; -extern u32 RDRAMSize; -extern bool ConfigOpen; - -#endif - diff --git a/GLideN64/src/Neon/3DMathNeon.cpp b/GLideN64/src/Neon/3DMathNeon.cpp deleted file mode 100644 index 9d26129..0000000 --- a/GLideN64/src/Neon/3DMathNeon.cpp +++ /dev/null @@ -1,409 +0,0 @@ -#include "3DMath.h" -#include -#include "Log.h" -#include "Types.h" -#include - -void MultMatrix( float m0[4][4], float m1[4][4], float dest[4][4]) -{ - // Load m0 - float32x4x4_t _m0; - _m0.val[0] = vld1q_f32(m0[0]); - _m0.val[1] = vld1q_f32(m0[1]); - _m0.val[2] = vld1q_f32(m0[2]); - _m0.val[3] = vld1q_f32(m0[3]); - - // Load m1 - float32x4x4_t _m1; - _m1.val[0] = vld1q_f32(m1[0]); - _m1.val[1] = vld1q_f32(m1[1]); - _m1.val[2] = vld1q_f32(m1[2]); - _m1.val[3] = vld1q_f32(m1[3]); - - float32x4x4_t _dest; - - _dest.val[0] = vmulq_n_f32(_m0.val[0], _m1.val[0][0]); - _dest.val[1] = vmulq_n_f32(_m0.val[0], _m1.val[1][0]); - _dest.val[2] = vmulq_n_f32(_m0.val[0], _m1.val[2][0]); - _dest.val[3] = vmulq_n_f32(_m0.val[0], _m1.val[3][0]); - _dest.val[0] = vmlaq_n_f32(_dest.val[0], _m0.val[1], _m1.val[0][1]); - _dest.val[1] = vmlaq_n_f32(_dest.val[1], _m0.val[1], _m1.val[1][1]); - _dest.val[2] = vmlaq_n_f32(_dest.val[2], _m0.val[1], _m1.val[2][1]); - _dest.val[3] = vmlaq_n_f32(_dest.val[3], _m0.val[1], _m1.val[3][1]); - _dest.val[0] = vmlaq_n_f32(_dest.val[0], _m0.val[2], _m1.val[0][2]); - _dest.val[1] = vmlaq_n_f32(_dest.val[1], _m0.val[2], _m1.val[1][2]); - _dest.val[2] = vmlaq_n_f32(_dest.val[2], _m0.val[2], _m1.val[2][2]); - _dest.val[3] = vmlaq_n_f32(_dest.val[3], _m0.val[2], _m1.val[3][2]); - _dest.val[0] = vmlaq_n_f32(_dest.val[0], _m0.val[3], _m1.val[0][3]); - _dest.val[1] = vmlaq_n_f32(_dest.val[1], _m0.val[3], _m1.val[1][3]); - _dest.val[2] = vmlaq_n_f32(_dest.val[2], _m0.val[3], _m1.val[2][3]); - _dest.val[3] = vmlaq_n_f32(_dest.val[3], _m0.val[3], _m1.val[3][3]); - - vst1q_f32(dest[0], _dest.val[0]); - vst1q_f32(dest[1], _dest.val[1]); - vst1q_f32(dest[2], _dest.val[2]); - vst1q_f32(dest[3], _dest.val[3]); -} - -void MultMatrix2(float m0[4][4], float m1[4][4]) -{ - MultMatrix(m0, m1, m0); -} - -void TransformVectorNormalize(float vec[3], float mtx[4][4]) -{ - // Load mtx - float32x4x4_t _mtx; - _mtx.val[0] = vld1q_f32(mtx[0]); - _mtx.val[1] = vld1q_f32(mtx[1]); - _mtx.val[2] = vld1q_f32(mtx[2]); - _mtx.val[3] = vld1q_f32(mtx[3]); - - // Multiply and add - float32x4_t product; - product = vmulq_n_f32(_mtx.val[0], vec[0]); - product = vmlaq_n_f32(product, _mtx.val[1], vec[1]); - product = vmlaq_n_f32(product, _mtx.val[2], vec[2]); - - // Normalize - float32x2_t product0 = {product[0],product[1]}; - float32x2_t product1 = {product[2],product[3]}; - float32x2_t temp; - - temp = vmul_f32(product0, product0); - temp = vpadd_f32(temp, temp); - temp = vmla_f32(temp, product1, product1); // temp[0] is important - - float32x2_t recpSqrtEst; - float32x2_t recp; - float32x2_t prod; - - recpSqrtEst = vrsqrte_f32(temp); - prod = vmul_f32(recpSqrtEst,temp); - recp = vrsqrts_f32(prod,recpSqrtEst); - recpSqrtEst = vmul_f32(recpSqrtEst,recp); - prod = vmul_f32(recpSqrtEst,temp); - recp = vrsqrts_f32(prod,recpSqrtEst); - recpSqrtEst = vmul_f32(recpSqrtEst,recp); - - product = vmulq_n_f32(product, recpSqrtEst[0]); - - // Store mtx - vec[0] = product[0]; - vec[1] = product[1]; - vec[2] = product[2]; -} - -void InverseTransformVectorNormalize(float src[3], float dst[3], float mtx[4][4]) -{ - // Load mtx - float32x4x4_t _mtx = vld4q_f32(mtx[0]); - - // Multiply and add - float32x4_t product; - product = vmulq_n_f32(_mtx.val[0], src[0]); - product = vmlaq_n_f32(product, _mtx.val[1], src[1]); - product = vmlaq_n_f32(product, _mtx.val[2], src[2]); - - // Normalize - float32x2_t product0 = {product[0],product[1]}; - float32x2_t product1 = {product[2],product[3]}; - float32x2_t temp; - - temp = vmul_f32(product0, product0); - temp = vpadd_f32(temp, temp); - temp = vmla_f32(temp, product1, product1); // temp[0] is important - - float32x2_t recpSqrtEst; - float32x2_t recp; - float32x2_t prod; - - recpSqrtEst = vrsqrte_f32(temp); - prod = vmul_f32(recpSqrtEst,temp); - recp = vrsqrts_f32(prod,recpSqrtEst); - recpSqrtEst = vmul_f32(recpSqrtEst,recp); - prod = vmul_f32(recpSqrtEst,temp); - recp = vrsqrts_f32(prod,recpSqrtEst); - recpSqrtEst = vmul_f32(recpSqrtEst,recp); - - product = vmulq_n_f32(product, recpSqrtEst[0]); - - // Store mtx - dst[0] = product[0]; - dst[1] = product[1]; - dst[2] = product[2]; -} - -void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mtx[4][4]) -{ - // Load mtx - float32x4x4_t _mtx = vld4q_f32(mtx[0]); - - // Multiply and add - float32x4x4_t product; - product.val[0] = vmulq_n_f32(_mtx.val[0], src[0][0]); - product.val[1] = vmulq_n_f32(_mtx.val[0], src[1][0]); - product.val[2] = vmulq_n_f32(_mtx.val[0], src[2][0]); - product.val[3] = vmulq_n_f32(_mtx.val[0], src[3][0]); - product.val[0] = vmlaq_n_f32(product.val[0], _mtx.val[1], src[0][1]); - product.val[1] = vmlaq_n_f32(product.val[1], _mtx.val[1], src[1][1]); - product.val[2] = vmlaq_n_f32(product.val[2], _mtx.val[1], src[2][1]); - product.val[3] = vmlaq_n_f32(product.val[3], _mtx.val[1], src[3][1]); - product.val[0] = vmlaq_n_f32(product.val[0], _mtx.val[2], src[0][2]); - product.val[1] = vmlaq_n_f32(product.val[1], _mtx.val[2], src[1][2]); - product.val[2] = vmlaq_n_f32(product.val[2], _mtx.val[2], src[2][2]); - product.val[3] = vmlaq_n_f32(product.val[3], _mtx.val[2], src[3][2]); - - // Normalize - float32x2_t product00 = {product.val[0][0],product.val[0][1]}; - float32x2_t product01 = {product.val[0][2],product.val[0][3]}; - float32x2_t product10 = {product.val[1][0],product.val[1][1]}; - float32x2_t product11 = {product.val[1][2],product.val[1][3]}; - float32x2_t product20 = {product.val[2][0],product.val[2][1]}; - float32x2_t product21 = {product.val[2][2],product.val[2][3]}; - float32x2_t product30 = {product.val[3][0],product.val[3][1]}; - float32x2_t product31 = {product.val[3][2],product.val[3][3]}; - - float32x2_t temp0; - float32x2_t temp1; - float32x2_t temp2; - float32x2_t temp3; - - temp0 = vmul_f32(product00, product00); - temp1 = vmul_f32(product10, product10); - temp2 = vmul_f32(product20, product20); - temp3 = vmul_f32(product30, product30); - temp0 = vpadd_f32(temp0, temp0); - temp1 = vpadd_f32(temp1, temp1); - temp2 = vpadd_f32(temp2, temp2); - temp3 = vpadd_f32(temp3, temp3); - temp0 = vmla_f32(temp0, product01, product01); // temp[0] is important - temp1 = vmla_f32(temp1, product11, product11); // temp[0] is important - temp2 = vmla_f32(temp2, product21, product21); // temp[0] is important - temp3 = vmla_f32(temp3, product31, product31); // temp[0] is important - - float32x4_t temp = {temp0[0], temp1[0], temp2[0], temp3[0]}; - - float32x4_t recpSqrtEst; - float32x4_t recp; - float32x4_t prod; - - recpSqrtEst = vrsqrteq_f32(temp); - prod = vmulq_f32(recpSqrtEst,temp); - recp = vrsqrtsq_f32(prod,recpSqrtEst); - recpSqrtEst = vmulq_f32(recpSqrtEst,recp); - prod = vmulq_f32(recpSqrtEst,temp); - recp = vrsqrtsq_f32(prod,recpSqrtEst); - recpSqrtEst = vmulq_f32(recpSqrtEst,recp); - - product.val[0] = vmulq_n_f32(product.val[0], recpSqrtEst[0]); - product.val[1] = vmulq_n_f32(product.val[1], recpSqrtEst[1]); - product.val[2] = vmulq_n_f32(product.val[2], recpSqrtEst[2]); - product.val[3] = vmulq_n_f32(product.val[3], recpSqrtEst[3]); - - // Store mtx - dst[0][0] = product.val[0][0]; - dst[0][1] = product.val[0][1]; - dst[0][2] = product.val[0][2]; - dst[1][0] = product.val[1][0]; - dst[1][1] = product.val[1][1]; - dst[1][2] = product.val[1][2]; - dst[2][0] = product.val[2][0]; - dst[2][1] = product.val[2][1]; - dst[2][2] = product.val[2][2]; - dst[3][0] = product.val[3][0]; - dst[3][1] = product.val[3][1]; - dst[3][2] = product.val[3][2]; -} - -void InverseTransformVectorNormalize7(float src[4][3], float dst[4][3], float mtx[4][4]) -{ - // Load mtx - float32x4x4_t _mtx = vld4q_f32(mtx[0]); - - // Multiply and add - float32x4x4_t product0; - float32x4x4_t product1; - - product0.val[0] = vmulq_n_f32(_mtx.val[0], src[0][0]); - product0.val[1] = vmulq_n_f32(_mtx.val[0], src[1][0]); - product0.val[2] = vmulq_n_f32(_mtx.val[0], src[2][0]); - product0.val[3] = vmulq_n_f32(_mtx.val[0], src[3][0]); - product1.val[0] = vmulq_n_f32(_mtx.val[0], src[4][0]); - product1.val[1] = vmulq_n_f32(_mtx.val[0], src[5][0]); - product1.val[2] = vmulq_n_f32(_mtx.val[0], src[6][0]); - product0.val[0] = vmlaq_n_f32(product0.val[0], _mtx.val[1], src[0][1]); - product0.val[1] = vmlaq_n_f32(product0.val[1], _mtx.val[1], src[1][1]); - product0.val[2] = vmlaq_n_f32(product0.val[2], _mtx.val[1], src[2][1]); - product0.val[3] = vmlaq_n_f32(product0.val[3], _mtx.val[1], src[3][1]); - product1.val[0] = vmlaq_n_f32(product1.val[0], _mtx.val[1], src[4][1]); - product1.val[1] = vmlaq_n_f32(product1.val[1], _mtx.val[1], src[5][1]); - product1.val[2] = vmlaq_n_f32(product1.val[2], _mtx.val[1], src[6][1]); - product0.val[0] = vmlaq_n_f32(product0.val[0], _mtx.val[2], src[0][2]); - product0.val[1] = vmlaq_n_f32(product0.val[1], _mtx.val[2], src[1][2]); - product0.val[2] = vmlaq_n_f32(product0.val[2], _mtx.val[2], src[2][2]); - product0.val[3] = vmlaq_n_f32(product0.val[3], _mtx.val[2], src[3][2]); - product1.val[0] = vmlaq_n_f32(product1.val[0], _mtx.val[2], src[4][2]); - product1.val[1] = vmlaq_n_f32(product1.val[1], _mtx.val[2], src[5][2]); - product1.val[2] = vmlaq_n_f32(product1.val[2], _mtx.val[2], src[6][2]); - - // Normalize - float32x2_t product00 = {product0.val[0][0],product0.val[0][1]}; - float32x2_t product01 = {product0.val[0][2],product0.val[0][3]}; - float32x2_t product10 = {product0.val[1][0],product0.val[1][1]}; - float32x2_t product11 = {product0.val[1][2],product0.val[1][3]}; - float32x2_t product20 = {product0.val[2][0],product0.val[2][1]}; - float32x2_t product21 = {product0.val[2][2],product0.val[2][3]}; - float32x2_t product30 = {product0.val[3][0],product0.val[3][1]}; - float32x2_t product31 = {product0.val[3][2],product0.val[3][3]}; - float32x2_t product40 = {product1.val[0][0],product1.val[0][1]}; - float32x2_t product41 = {product1.val[0][2],product1.val[0][3]}; - float32x2_t product50 = {product1.val[1][0],product1.val[1][1]}; - float32x2_t product51 = {product1.val[1][2],product1.val[1][3]}; - float32x2_t product60 = {product1.val[2][0],product1.val[2][1]}; - float32x2_t product61 = {product1.val[2][2],product1.val[2][3]}; - - float32x2_t temp00; - float32x2_t temp01; - float32x2_t temp02; - float32x2_t temp03; - float32x2_t temp04; - float32x2_t temp05; - float32x2_t temp06; - - temp00 = vmul_f32(product00, product00); - temp01 = vmul_f32(product10, product10); - temp02 = vmul_f32(product20, product20); - temp03 = vmul_f32(product30, product30); - temp04 = vmul_f32(product40, product40); - temp05 = vmul_f32(product50, product50); - temp06 = vmul_f32(product60, product60); - temp00 = vpadd_f32(temp00, temp00); - temp01 = vpadd_f32(temp01, temp01); - temp02 = vpadd_f32(temp02, temp02); - temp03 = vpadd_f32(temp03, temp03); - temp04 = vpadd_f32(temp04, temp04); - temp05 = vpadd_f32(temp05, temp05); - temp06 = vpadd_f32(temp06, temp06); - temp00 = vmla_f32(temp00, product01, product01); // temp[0] is important - temp01 = vmla_f32(temp01, product11, product11); // temp[0] is important - temp02 = vmla_f32(temp02, product21, product21); // temp[0] is important - temp03 = vmla_f32(temp03, product31, product31); // temp[0] is important - temp04 = vmla_f32(temp04, product41, product41); // temp[0] is important - temp05 = vmla_f32(temp05, product51, product51); // temp[0] is important - temp06 = vmla_f32(temp06, product61, product61); // temp[0] is important - - float32x4_t temp0 = {temp00[0], temp01[0], temp02[0], temp03[0]}; - float32x4_t temp1 = {temp04[0], temp05[0], temp06[0], 0.0}; - - float32x4_t recpSqrtEst0; - float32x4_t recpSqrtEst1; - float32x4_t recp0; - float32x4_t recp1; - float32x4_t prod0; - float32x4_t prod1; - - recpSqrtEst0 = vrsqrteq_f32(temp0); - recpSqrtEst1 = vrsqrteq_f32(temp1); - prod0 = vmulq_f32(recpSqrtEst0,temp0); - prod1 = vmulq_f32(recpSqrtEst1,temp1); - recp0 = vrsqrtsq_f32(prod0,recpSqrtEst0); - recp1 = vrsqrtsq_f32(prod1,recpSqrtEst1); - recpSqrtEst0 = vmulq_f32(recpSqrtEst0,recp0); - recpSqrtEst1 = vmulq_f32(recpSqrtEst1,recp1); - prod0 = vmulq_f32(recpSqrtEst0,temp0); - prod1 = vmulq_f32(recpSqrtEst1,temp1); - recp0 = vrsqrtsq_f32(prod0,recpSqrtEst0); - recp1 = vrsqrtsq_f32(prod1,recpSqrtEst1); - recpSqrtEst0 = vmulq_f32(recpSqrtEst0,recp0); - recpSqrtEst1 = vmulq_f32(recpSqrtEst1,recp1); - - product0.val[0] = vmulq_n_f32(product0.val[0], recpSqrtEst0[0]); - product0.val[1] = vmulq_n_f32(product0.val[1], recpSqrtEst0[1]); - product0.val[2] = vmulq_n_f32(product0.val[2], recpSqrtEst0[2]); - product0.val[3] = vmulq_n_f32(product0.val[3], recpSqrtEst0[3]); - product1.val[0] = vmulq_n_f32(product1.val[0], recpSqrtEst1[0]); - product1.val[1] = vmulq_n_f32(product1.val[1], recpSqrtEst1[1]); - product1.val[2] = vmulq_n_f32(product1.val[2], recpSqrtEst1[2]); - - // Store mtx - dst[0][0] = product0.val[0][0]; - dst[0][1] = product0.val[0][1]; - dst[0][2] = product0.val[0][2]; - dst[1][0] = product0.val[1][0]; - dst[1][1] = product0.val[1][1]; - dst[1][2] = product0.val[1][2]; - dst[2][0] = product0.val[2][0]; - dst[2][1] = product0.val[2][1]; - dst[2][2] = product0.val[2][2]; - dst[3][0] = product0.val[3][0]; - dst[3][1] = product0.val[3][1]; - dst[3][2] = product0.val[3][2]; - dst[4][0] = product1.val[0][0]; - dst[4][1] = product1.val[0][1]; - dst[4][2] = product1.val[0][2]; - dst[5][0] = product1.val[1][0]; - dst[5][1] = product1.val[1][1]; - dst[5][2] = product1.val[1][2]; - dst[6][0] = product1.val[2][0]; - dst[6][1] = product1.val[2][1]; - dst[6][2] = product1.val[2][2]; - -} - -void Normalize(float v[3]) -{ - // Load vector - float32x4_t product = {v[0], v[1], v[2], 0.0}; - - // Normalize - float32x2_t product0 = {product[0],product[1]}; - float32x2_t product1 = {product[2],product[3]}; - float32x2_t temp; - - temp = vmul_f32(product0, product0); - temp = vpadd_f32(temp, temp); - temp = vmla_f32(temp, product1, product1); // temp[0] is important - - float32x2_t recpSqrtEst; - float32x2_t recp; - float32x2_t prod; - - recpSqrtEst = vrsqrte_f32(temp); - prod = vmul_f32(recpSqrtEst,temp); - recp = vrsqrts_f32(prod,recpSqrtEst); - recpSqrtEst = vmul_f32(recpSqrtEst,recp); - prod = vmul_f32(recpSqrtEst,temp); - recp = vrsqrts_f32(prod,recpSqrtEst); - recpSqrtEst = vmul_f32(recpSqrtEst,recp); - - product = vmulq_n_f32(product, recpSqrtEst[0]); - - // Store vector - v[0] = product[0]; - v[1] = product[1]; - v[2] = product[2]; -} - -void InverseTransformVectorNormalizeN(float src[][3], float dst[][3], float mtx[4][4], u32 count) -{ - while (count >= 7) { - InverseTransformVectorNormalize7((float (*)[3])src[count-7], (float (*)[3])dst[count-7], mtx); - count -= 7; - } - while (count >= 4) { - InverseTransformVectorNormalize4((float (*)[3])src[count-4], (float (*)[3])dst[count-4], mtx); - count -= 4; - } - while (count >= 1) { - InverseTransformVectorNormalize((float (*))src[count-1], (float (*))dst[count-1], mtx); - count--; - } - -} - -void CopyMatrix( float m0[4][4], float m1[4][4] ) -{ - // load and store 16 floats - vst4q_f32(m0[0],vld4q_f32(m1[0])); -} diff --git a/GLideN64/src/Neon/CRC_OPT_NEON.cpp b/GLideN64/src/Neon/CRC_OPT_NEON.cpp deleted file mode 100644 index 05ec961..0000000 --- a/GLideN64/src/Neon/CRC_OPT_NEON.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "CRC.h" -#define XXH_INLINE_ALL -#include "xxHash/xxhash.h" -#include - -#define CRC32_POLYNOMIAL 0x04C11DB7 - -unsigned int CRCTable[256]; - -static -u32 Reflect(u32 ref, char ch) { - u32 value = 0; - - // Swap bit 0 for bit 7 - // bit 1 for bit 6, etc. - for (int i = 1; i < (ch + 1); ++i) { - if (ref & 1) - value |= 1 << (ch - i); - ref >>= 1; - } - return value; -} - -void CRC_Init() { - u32 crc; - - for (int i = 0; i < 256; ++i) { - crc = Reflect(i, 8) << 24; - for (int j = 0; j < 8; ++j) - crc = (crc << 1) ^ (crc & (1 << 31) ? CRC32_POLYNOMIAL : 0); - - CRCTable[i] = Reflect(crc, 32); - } -} - -u32 CRC_Calculate_Strict(u32 crc, const void *buffer, u32 count) { - u8 *p; - u32 orig = crc; - - p = (u8 *) buffer; - while (count--) - crc = (crc >> 8) ^ CRCTable[(crc & 0xFF) ^ *p++]; - - return crc ^ orig; -} - -#define PRIME32_1 2654435761U -#define PRIME32_2 2246822519U -#define PRIME32_3 3266489917U -#define PRIME32_4 668265263U -#define PRIME32_5 374761393U - -u64 ReliableHash32NEON(const void *input, size_t len, u64 seed) { - if (((uintptr_t) input & 3) != 0) { - // Cannot handle misaligned data. Fall back to XXH32. - return XXH3_64bits_withSeed(input, len, seed); - } - - const u8 *p = (const u8 *) input; - const u8 *const bEnd = p + len; - u32 h32; - - - if (len >= 16) { - const unsigned char *const limit = bEnd - 16; - u32 v1 = seed + PRIME32_1 + PRIME32_2; - u32 v2 = seed + PRIME32_2; - u32 v3 = seed + 0; - u32 v4 = seed - PRIME32_1; - - uint32x4_t prime32_1q = vdupq_n_u32(PRIME32_1); - uint32x4_t prime32_2q = vdupq_n_u32(PRIME32_2); - uint32x4_t vq = vcombine_u32(vcreate_u32(v1 | ((u64) v2 << 32)), - vcreate_u32(v3 | ((u64) v4 << 32))); - - do { - __builtin_prefetch(p + 0xc0, 0, 0); - vq = vmlaq_u32(vq, vld1q_u32((const u32 *) p), prime32_2q); - vq = vorrq_u32(vshlq_n_u32(vq, 13), vshrq_n_u32(vq, 32 - 13)); - p += 16; - vq = vmulq_u32(vq, prime32_1q); - } while (p <= limit); - - v1 = vgetq_lane_u32(vq, 0); - v2 = vgetq_lane_u32(vq, 1); - v3 = vgetq_lane_u32(vq, 2); - v4 = vgetq_lane_u32(vq, 3); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); - } else { - h32 = seed + PRIME32_5; - } - - h32 += (u32) len; - - while (p <= bEnd - 4) { - h32 += *(const u32 *) p * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4; - p += 4; - } - - while (p < bEnd) { - h32 += (*p) * PRIME32_5; - h32 = XXH_rotl32(h32, 11) * PRIME32_1; - p++; - } - - h32 ^= h32 >> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - -u64 CRC_Calculate(u64 crc, const void *buffer, u32 count) { - return ReliableHash32NEON(buffer, count, crc); -} - -u64 CRC_CalculatePalette(u64 crc, const void *buffer, u32 count) { - u8 *p = (u8 *) buffer; - while (count--) { - crc = ReliableHash32NEON(p, 2, crc); - p += 8; - } - return crc; -} diff --git a/GLideN64/src/Neon/RSP_LoadMatrixNeon.cpp b/GLideN64/src/Neon/RSP_LoadMatrixNeon.cpp deleted file mode 100644 index 167e39a..0000000 --- a/GLideN64/src/Neon/RSP_LoadMatrixNeon.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "RSP.h" -#include "N64.h" -#include "arm_neon.h" -#include "GBI.h" - -void RSP_LoadMatrix( f32 mtx[4][4], u32 address ) -{ - f32 recip = FIXED2FLOATRECIP16; - - struct _N64Matrix - { - s16 integer[4][4]; - u16 fraction[4][4]; - } *n64Mat = (struct _N64Matrix *)&RDRAM[address]; - - // Load recip - float32_t _recip = recip; - - // Load integer - int16x4x4_t _integer_s16; - _integer_s16.val[0] = vld1_s16(n64Mat->integer[0]); - _integer_s16.val[1] = vld1_s16(n64Mat->integer[1]); - _integer_s16.val[2] = vld1_s16(n64Mat->integer[2]); - _integer_s16.val[3] = vld1_s16(n64Mat->integer[3]); - - // Load fraction - uint16x4x4_t _fraction_u16; - _fraction_u16.val[0] = vld1_u16(n64Mat->fraction[0]); - _fraction_u16.val[1] = vld1_u16(n64Mat->fraction[1]); - _fraction_u16.val[2] = vld1_u16(n64Mat->fraction[2]); - _fraction_u16.val[3] = vld1_u16(n64Mat->fraction[3]); - - // Reverse 16bit values --> j^1 - _integer_s16.val[0] = vrev32_s16 (_integer_s16.val[0]); // 0 1 2 3 --> 1 0 3 2 - _integer_s16.val[1] = vrev32_s16 (_integer_s16.val[1]); // 0 1 2 3 --> 1 0 3 2 - _integer_s16.val[2] = vrev32_s16 (_integer_s16.val[2]); // 0 1 2 3 --> 1 0 3 2 - _integer_s16.val[3] = vrev32_s16 (_integer_s16.val[3]); // 0 1 2 3 --> 1 0 3 2 - _fraction_u16.val[0] = vrev32_u16 (_fraction_u16.val[0]); // 0 1 2 3 --> 1 0 3 2 - _fraction_u16.val[1] = vrev32_u16 (_fraction_u16.val[1]); // 0 1 2 3 --> 1 0 3 2 - _fraction_u16.val[2] = vrev32_u16 (_fraction_u16.val[2]); // 0 1 2 3 --> 1 0 3 2 - _fraction_u16.val[3] = vrev32_u16 (_fraction_u16.val[3]); // 0 1 2 3 --> 1 0 3 2 - - // Expand to 32Bit int/uint - int32x4x4_t _integer_s32; - uint32x4x4_t _fraction_u32; - _integer_s32.val[0] = vmovl_s16(_integer_s16.val[0]); // _integer0_s32 = (i32)_integer0_s16 - _integer_s32.val[1] = vmovl_s16(_integer_s16.val[1]); // _integer1_s32 = (i32)_integer1_s16 - _integer_s32.val[2] = vmovl_s16(_integer_s16.val[2]); // _integer2_s32 = (i32)_integer2_s16 - _integer_s32.val[3] = vmovl_s16(_integer_s16.val[3]); // _integer3_s32 = (i32)_integer3_s16 - _fraction_u32.val[0] = vmovl_u16(_fraction_u16.val[0]); // _fraction0_u32 = (u32)_fraction0_u16 - _fraction_u32.val[1] = vmovl_u16(_fraction_u16.val[1]); // _fraction1_u32 = (u32)_fraction1_u16 - _fraction_u32.val[2] = vmovl_u16(_fraction_u16.val[2]); // _fraction2_u32 = (u32)_fraction2_u16 - _fraction_u32.val[3] = vmovl_u16(_fraction_u16.val[3]); // _fraction3_u32 = (u32)_fraction3_u16 - - // Convert to Float - float32x4x4_t _integer_f32; - float32x4x4_t _fraction_f32; - _integer_f32.val[0] = vcvtq_f32_s32 (_integer_s32.val[0]); // _integer0_f32 = (f32)_integer0_s32 - _integer_f32.val[1] = vcvtq_f32_s32 (_integer_s32.val[1]); // _integer1_f32 = (f32)_integer1_s32 - _integer_f32.val[2] = vcvtq_f32_s32 (_integer_s32.val[2]); // _integer2_f32 = (f32)_integer2_s32 - _integer_f32.val[3] = vcvtq_f32_s32 (_integer_s32.val[3]); // _integer3_f32 = (f32)_integer3_s32 - _fraction_f32.val[0] = vcvtq_f32_u32 (_fraction_u32.val[0]);// _fraction0_f32 = (f32)_fraction0_u32 - _fraction_f32.val[1] = vcvtq_f32_u32 (_fraction_u32.val[1]);// _fraction1_f32 = (f32)_fraction1_u32 - _fraction_f32.val[2] = vcvtq_f32_u32 (_fraction_u32.val[2]);// _fraction2_f32 = (f32)_fraction2_u32 - _fraction_f32.val[3] = vcvtq_f32_u32 (_fraction_u32.val[3]);// _fraction3_f32 = (f32)_fraction3_u32 - - // Multiply and add - _integer_f32.val[0] = vmlaq_n_f32(_integer_f32.val[0],_fraction_f32.val[0],_recip);// _integer0_f32 = _integer0_f32 + _fraction0_f32* _recip - _integer_f32.val[1] = vmlaq_n_f32(_integer_f32.val[1],_fraction_f32.val[1],_recip);// _integer1_f32 = _integer1_f32 + _fraction1_f32* _recip - _integer_f32.val[2] = vmlaq_n_f32(_integer_f32.val[2],_fraction_f32.val[2],_recip);// _integer2_f32 = _integer2_f32 + _fraction2_f32* _recip - _integer_f32.val[3] = vmlaq_n_f32(_integer_f32.val[3],_fraction_f32.val[3],_recip);// _integer3_f32 = _integer3_f32 + _fraction3_f32* _recip - - // Store in mtx - vst1q_f32(mtx[0], _integer_f32.val[0]); - vst1q_f32(mtx[1], _integer_f32.val[1]); - vst1q_f32(mtx[2], _integer_f32.val[2]); - vst1q_f32(mtx[3], _integer_f32.val[3]); -} - diff --git a/GLideN64/src/Neon/gSPNeon.cpp b/GLideN64/src/Neon/gSPNeon.cpp deleted file mode 100644 index 9581e18..0000000 --- a/GLideN64/src/Neon/gSPNeon.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#include -#include -#include -#include -#include "N64.h" -#include "GLideN64.h" -#include "Types.h" -#include "RSP.h" -#include "GBI.h" -#include "gSP.h" -#include "gDP.h" -#include "3DMath.h" -#include "CRC.h" -#include -#include "convert.h" -#include "uCodes/S2DEX.h" -#include "VI.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "Config.h" -#include "Log.h" -#include "DisplayWindow.h" -#include - -using namespace std; - -void gSPTransformVertex4NEON(u32 v, float mtx[4][4]) -{ - GraphicsDrawer & drawer = dwnd().getDrawer(); - SPVertex & vtx0 = drawer.getVertex(v); - SPVertex & vtx1 = drawer.getVertex(v + 1); - SPVertex & vtx2 = drawer.getVertex(v + 2); - SPVertex & vtx3 = drawer.getVertex(v + 3); - - // Load vtx - float32x4x4_t _vtx; - _vtx.val[0] = vld1q_f32(&vtx0.x); - _vtx.val[1] = vld1q_f32(&vtx1.x); - _vtx.val[2] = vld1q_f32(&vtx2.x); - _vtx.val[3] = vld1q_f32(&vtx3.x); - - // Load mtx - float32x4x4_t _mtx; - _mtx.val[0] = vld1q_f32(mtx[0]); - _mtx.val[1] = vld1q_f32(mtx[1]); - _mtx.val[2] = vld1q_f32(mtx[2]); - _mtx.val[3] = vld1q_f32(mtx[3]); - - float32x4x4_t _out; - - _out.val[0] = vmlaq_n_f32(_mtx.val[3], _mtx.val[0], _vtx.val[0][0]); - _out.val[1] = vmlaq_n_f32(_mtx.val[3], _mtx.val[0], _vtx.val[1][0]); - _out.val[2] = vmlaq_n_f32(_mtx.val[3], _mtx.val[0], _vtx.val[2][0]); - _out.val[3] = vmlaq_n_f32(_mtx.val[3], _mtx.val[0], _vtx.val[3][0]); - _out.val[0] = vmlaq_n_f32(_out.val[0], _mtx.val[1], _vtx.val[0][1]); - _out.val[1] = vmlaq_n_f32(_out.val[1], _mtx.val[1], _vtx.val[1][1]); - _out.val[2] = vmlaq_n_f32(_out.val[2], _mtx.val[1], _vtx.val[2][1]); - _out.val[3] = vmlaq_n_f32(_out.val[3], _mtx.val[1], _vtx.val[3][1]); - _out.val[0] = vmlaq_n_f32(_out.val[0], _mtx.val[2], _vtx.val[0][2]); - _out.val[1] = vmlaq_n_f32(_out.val[1], _mtx.val[2], _vtx.val[1][2]); - _out.val[2] = vmlaq_n_f32(_out.val[2], _mtx.val[2], _vtx.val[2][2]); - _out.val[3] = vmlaq_n_f32(_out.val[3], _mtx.val[2], _vtx.val[3][2]); - - // Store vtx data - vst1q_f32(&vtx0.x, _out.val[0]); - vst1q_f32(&vtx1.x, _out.val[1]); - vst1q_f32(&vtx2.x, _out.val[2]); - vst1q_f32(&vtx3.x, _out.val[3]); -} - -void gSPBillboardVertex4NEON(u32 v) -{ - GraphicsDrawer & drawer = dwnd().getDrawer(); - - SPVertex & vtx = drawer.getVertex(0); - - SPVertex & vtx0 = drawer.getVertex(v); - SPVertex & vtx1 = drawer.getVertex(v+1); - SPVertex & vtx2 = drawer.getVertex(v+2); - SPVertex & vtx3 = drawer.getVertex(v+3); - - // Load vtx[0] - float32x4_t _vtx = vld1q_f32(&vtx.x); - - // Load vtx v, v+1, v+2, v+3 - float32x4_t _vtx0 = vld1q_f32(&vtx0.x); - float32x4_t _vtx1 = vld1q_f32(&vtx1.x); - float32x4_t _vtx2 = vld1q_f32(&vtx2.x); - float32x4_t _vtx3 = vld1q_f32(&vtx3.x); - - // Add vtx[0] with vtx[n]./.[n+3] quad registers - _vtx0 = vaddq_f32(_vtx0, _vtx); - _vtx1 = vaddq_f32(_vtx1, _vtx); - _vtx2 = vaddq_f32(_vtx2, _vtx); - _vtx3 = vaddq_f32(_vtx3, _vtx); - - // Store quad registers - vst1q_f32(&vtx0.x, _vtx0); - vst1q_f32(&vtx1.x, _vtx1); - vst1q_f32(&vtx2.x, _vtx2); - vst1q_f32(&vtx3.x, _vtx3); -} - -void gSPTransformVector_NEON(float vtx[4], float mtx[4][4]) -{ - // Load vtx - float32x4_t _vtx = vld1q_f32(vtx); - - // Load mtx - float32x4_t _mtx0 = vld1q_f32(mtx[0]); - float32x4_t _mtx1 = vld1q_f32(mtx[1]); - float32x4_t _mtx2 = vld1q_f32(mtx[2]); - float32x4_t _mtx3 = vld1q_f32(mtx[3]); - - // Multiply and add - _mtx0 = vmlaq_n_f32(_mtx3, _mtx0, _vtx[0]); // _mtx0 = _mtx3 + _mtx0 * _vtx[0] - _mtx0 = vmlaq_n_f32(_mtx0, _mtx1, _vtx[1]); // _mtx0 = _mtx0 + _mtx1 * _vtx[1] - _mtx0 = vmlaq_n_f32(_mtx0, _mtx2, _vtx[2]); // _mtx0 = _mtx0 + _mtx2 * _vtx[2] - - // Store vtx - vst1q_f32(vtx, _mtx0); -} - -void gSPInverseTransformVector_NEON(float vec[3], float mtx[4][4]) -{ - float32x4x4_t _mtx = vld4q_f32(mtx[0]); // load 4x4 mtx interleaved - - _mtx.val[0] = vmulq_n_f32(_mtx.val[0], vec[0]); // mtx[0][0]=mtx[0][0]*_vtx[0] - // mtx[0][1]=mtx[0][1]*_vtx[0] - // mtx[0][2]=mtx[0][2]*_vtx[0] - _mtx.val[0] = vmlaq_n_f32(_mtx.val[0], _mtx.val[1], vec[1]); // mtx[0][0]+=mtx[1][0]*_vtx[1] - // mtx[0][1]+=mtx[1][1]*_vtx[1] - // mtx[0][2]+=mtx[1][2]*_vtx[1] - _mtx.val[0] = vmlaq_n_f32(_mtx.val[0], _mtx.val[2], vec[2]); // mtx[0][0]+=mtx[2][0]*_vtx[2] - // mtx[0][1]+=mtx[2][1]*_vtx[2] - // mtx[0][2]+=mtx[2][2]*_vtx[2] - - vec[0] = _mtx.val[0][0]; // store vec[0] - vec[1] = _mtx.val[0][1]; // store vec[1] - vec[2] = _mtx.val[0][2]; // store vec[2] -} - -void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], float _vtx[3]) -{ - // load v1 - float32x4x3_t _v10 = vld3q_f32(v1[0]); // load 4x3 mtx interleaved - float32x2x3_t _v11 = vld3_f32(v1[4]); // load 2x3 mtx interleaved - float32x2x3_t _v12 = vld3_dup_f32(v1[6]); // load 1x3 mtx interleaved - for(int i = 0; i< 3; i++){ - _v12.val[i][1]=0.0; - } - - // load lights - float32x4x3_t _lights0 = vld3q_f32(lights[0]); // load 4x3 mtx interleaved - float32x2x3_t _lights1 = vld3_f32(lights[4]); // load 2x3 mtx interleaved - float32x2x3_t _lights2 = vld3_dup_f32(lights[6]); // load 1x3 mtx interleaved - - float32x4_t product0; - float32x2_t product1; - float32x2_t product2; - float32x4_t max = vmovq_n_f32(0.0); - float32x2_t max1 = vmov_n_f32(0.0); - - // calc product - product0 = vmulq_n_f32(_v10.val[0],v0[0]); - product1 = vmul_n_f32(_v11.val[0],v0[0]); - product2 = vmul_n_f32(_v12.val[0],v0[0]); - product0 = vmlaq_n_f32(product0, _v10.val[1],v0[1]); - product1 = vmla_n_f32(product1, _v11.val[1],v0[1]); - product2 = vmla_n_f32(product2, _v12.val[1],v0[1]); - product0 = vmlaq_n_f32(product0, _v10.val[2],v0[2]); - product1 = vmla_n_f32(product1, _v11.val[2],v0[2]); - product2 = vmla_n_f32(product2, _v12.val[2],v0[2]); - - product0 = vmaxq_f32(product0, max); - product1 = vmax_f32(product1, max1); - product2 = vmax_f32(product2, max1); - - // multiply product with lights - _lights0.val[0] = vmulq_f32(_lights0.val[0],product0); - _lights1.val[0] = vmul_f32(_lights1.val[0],product1); - _lights1.val[0] = vmla_f32(_lights1.val[0],_lights2.val[0],product2); - _lights0.val[1] = vmulq_f32(_lights0.val[1],product0); - _lights1.val[1] = vmul_f32(_lights1.val[1],product1); - _lights1.val[1] = vmla_f32(_lights1.val[1],_lights2.val[1],product2); - _lights0.val[2] = vmulq_f32(_lights0.val[2],product0); - _lights1.val[2] = vmul_f32(_lights1.val[2],product1); - _lights1.val[2] = vmla_f32(_lights1.val[2],_lights2.val[2],product2); - - // add x, y and z values - float32x2_t d00 = vadd_f32(vget_high_f32(_lights0.val[0]),vget_low_f32(_lights0.val[0])); - float32x2_t d10 = vadd_f32(vget_high_f32(_lights0.val[1]),vget_low_f32(_lights0.val[1])); - float32x2_t d20 = vadd_f32(vget_high_f32(_lights0.val[2]),vget_low_f32(_lights0.val[2])); - d00 = vadd_f32(d00,_lights1.val[0]); - d10 = vadd_f32(d10,_lights1.val[1]); - d20 = vadd_f32(d20,_lights1.val[2]); - d00 = vpadd_f32(d00,d00); - d10 = vpadd_f32(d10,d10); - d20 = vpadd_f32(d20,d20); - - _vtx[0] += d00[0]; - _vtx[1] += d10[0]; - _vtx[2] += d20[0]; -} - -void DotProductMax4FullNeon( float v0[3], float v1[4][3], float lights[4][3], float vtx[3]) -{ - float32x4x3_t _v1 = vld3q_f32(v1[0]); // load 4x3 mtx interleaved - float32x4x3_t _lights = vld3q_f32(lights[0]); // load 4x3 mtx interleaved - - float32x4_t product; - float32x4_t max = vmovq_n_f32(0.0); - - product = vmulq_n_f32(_v1.val[0],v0[0]); - product = vmlaq_n_f32(product, _v1.val[1],v0[1]); - product = vmlaq_n_f32(product, _v1.val[2],v0[2]); - - product = vmaxq_f32(product, max); - - _lights.val[0] = vmulq_f32(_lights.val[0],product); - _lights.val[1] = vmulq_f32(_lights.val[1],product); - _lights.val[2] = vmulq_f32(_lights.val[2],product); - - float32x2_t d00 = vadd_f32(vget_high_f32(_lights.val[0]),vget_low_f32(_lights.val[0])); - float32x2_t d10 = vadd_f32(vget_high_f32(_lights.val[1]),vget_low_f32(_lights.val[1])); - float32x2_t d20 = vadd_f32(vget_high_f32(_lights.val[2]),vget_low_f32(_lights.val[2])); - d00 = vpadd_f32(d00,d00); - d10 = vpadd_f32(d10,d10); - d20 = vpadd_f32(d20,d20); - - vtx[0] += d00[0]; - vtx[1] += d10[0]; - vtx[2] += d20[0]; -} - -void gSPLightVertex_NEON(u32 vnum, u32 v, SPVertex * spVtx) -{ - if (!isHWLightingAllowed()) { - for(int j = 0; j < vnum; ++j) { - SPVertex & vtx = spVtx[v + j]; - vtx.r = gSP.lights.rgb[gSP.numLights][R]; - vtx.g = gSP.lights.rgb[gSP.numLights][G]; - vtx.b = gSP.lights.rgb[gSP.numLights][B]; - vtx.HWLight = 0; - - s32 count = gSP.numLights-1; - while (count >= 6) { - DotProductMax7FullNeon(&vtx.nx,(float (*)[3])gSP.lights.i_xyz[gSP.numLights - count - 1],(float (*)[3])gSP.lights.rgb[gSP.numLights - count - 1],&vtx.r); - count -= 7; - } - while (count >= 3) { - DotProductMax4FullNeon(&vtx.nx,(float (*)[3])gSP.lights.i_xyz[gSP.numLights - count - 1],(float (*)[3])gSP.lights.rgb[gSP.numLights - count - 1],&vtx.r); - count -= 4; - } - while (count >= 0) - { - f32 intensity = DotProduct( &vtx.nx, gSP.lights.i_xyz[gSP.numLights - count - 1] ); - if (intensity > 0.0f){ - vtx.r += gSP.lights.rgb[gSP.numLights - count - 1][R] * intensity; - vtx.g += gSP.lights.rgb[gSP.numLights - count - 1][G] * intensity; - vtx.b += gSP.lights.rgb[gSP.numLights - count - 1][B] * intensity; - } - count -= 1; - } - vtx.r = min(1.0f, vtx.r); - vtx.g = min(1.0f, vtx.g); - vtx.b = min(1.0f, vtx.b); - } - } else { - for(int j = 0; j < vnum; ++j) { - SPVertex & vtx = spVtx[v+j]; - TransformVectorNormalize(&vtx.r, gSP.matrix.modelView[gSP.matrix.modelViewi]); - vtx.HWLight = gSP.numLights; - } - } -} diff --git a/GLideN64/src/NoiseTexture.cpp b/GLideN64/src/NoiseTexture.cpp deleted file mode 100644 index 4a16526..0000000 --- a/GLideN64/src/NoiseTexture.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#ifdef MINGW -#define _CRT_RAND_S -#endif - -#include -#include -#include -#include -#include -#include -#include -#include "FrameBuffer.h" -#include "Config.h" -#include "GBI.h" -#include "VI.h" -#include "Textures.h" -#include "NoiseTexture.h" -#include "DisplayWindow.h" -#include "DisplayLoadProgress.h" - -using namespace graphics; - -#define NOISE_TEX_WIDTH 640 -#define NOISE_TEX_HEIGHT 580 - -NoiseTexture g_noiseTexture; - -NoiseTexture::NoiseTexture() - : m_DList(0) - , m_currTex(0) - , m_prevTex(0) -{ - for (u32 i = 0; i < NOISE_TEX_NUM; ++i) - m_pTexture[i] = nullptr; -} - -static -u32 Rand(u32 rand_value) -{ -#ifdef MINGW - rand_s(&rand_value); -#else - rand_value = rand(); -#endif - return rand_value; -} - -static -void FillTextureData(u32 _seed, NoiseTexturesData * _pData, u32 _start, u32 _stop) -{ - srand(_seed); - for (u32 i = _start; i < _stop; ++i) { - auto & vec = _pData->at(i); - const size_t sz = vec.size(); - u32 rand_value(0U); - for (size_t t = 0; t < sz; ++t) { - rand_value = Rand(rand_value); - vec[t] = rand_value & 0xFF; - } - } -} - - -void NoiseTexture::_fillTextureData() -{ - displayLoadProgress(L"INIT NOISE TEXTURES. PLEASE WAIT..."); - - for (auto& vec : m_texData) - vec.resize(NOISE_TEX_WIDTH * NOISE_TEX_HEIGHT); - - const u32 concurentThreadsSupported = std::thread::hardware_concurrency(); - if (concurentThreadsSupported > 1) { - const u32 numThreads = concurentThreadsSupported; - u32 chunk = NOISE_TEX_NUM / numThreads; - if (NOISE_TEX_NUM % numThreads != 0) - chunk++; - - std::uniform_int_distribution uint_dist; - std::mt19937 engine; // Mersenne twister MT19937 - engine.seed(std::mt19937::default_seed); - auto generator = std::bind(uint_dist, engine); - - std::vector threads; - u32 start = 0; - do { - threads.emplace_back( - FillTextureData, - generator(), - &m_texData, - start, - std::min(start + chunk, static_cast(m_texData.size()))); - start += chunk; - } while (start < NOISE_TEX_NUM - chunk); - - FillTextureData(generator(), &m_texData, start, static_cast(m_texData.size())); - - for (auto& t : threads) - t.join(); - } else { - FillTextureData(static_cast(time(nullptr)), &m_texData, 0, static_cast(m_texData.size())); - } - - displayLoadProgress(L""); -} - - -void NoiseTexture::init() -{ - if (m_texData[0].empty()) - _fillTextureData(); - - for (u32 i = 0; i < NOISE_TEX_NUM; ++i) { - m_pTexture[i] = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pTexture[i]->format = G_IM_FMT_RGBA; - m_pTexture[i]->clampS = 1; - m_pTexture[i]->clampT = 1; - m_pTexture[i]->frameBufferTexture = CachedTexture::fbOneSample; - m_pTexture[i]->maskS = 0; - m_pTexture[i]->maskT = 0; - m_pTexture[i]->mirrorS = 0; - m_pTexture[i]->mirrorT = 0; - m_pTexture[i]->width = NOISE_TEX_WIDTH; - m_pTexture[i]->height = NOISE_TEX_HEIGHT; - m_pTexture[i]->textureBytes = m_pTexture[i]->width * m_pTexture[i]->height; - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - { - Context::InitTextureParams params; - params.handle = m_pTexture[i]->name; - params.textureUnitIndex = textureIndices::NoiseTex; - params.width = m_pTexture[i]->width; - params.height = m_pTexture[i]->height; - params.internalFormat = fbTexFormats.noiseInternalFormat; - params.format = fbTexFormats.noiseFormat; - params.dataType = fbTexFormats.noiseType; - params.data = m_texData[i].data(); - gfxContext.init2DTexture(params); - } - { - Context::TexParameters params; - params.handle = m_pTexture[i]->name; - params.target = textureTarget::TEXTURE_2D; - params.textureUnitIndex = textureIndices::NoiseTex; - params.minFilter = textureParameters::FILTER_NEAREST; - params.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(params); - } - } -} - -void NoiseTexture::destroy() -{ - for (u32 i = 0; i < NOISE_TEX_NUM; ++i) { - textureCache().removeFrameBufferTexture(m_pTexture[i]); - m_pTexture[i] = nullptr; - } -} - -void NoiseTexture::update() -{ - if (m_texData[0].empty() || m_DList == dwnd().getBuffersSwapCount()) - return; - - u32 rand_value(0U); - while (m_currTex == m_prevTex) { - rand_value = Rand(rand_value); - m_currTex = rand_value % NOISE_TEX_NUM; - } - m_prevTex = m_currTex; - if (m_pTexture[m_currTex] == nullptr) - return; - { - Context::BindTextureParameters params; - params.texture = m_pTexture[m_currTex]->name; - params.textureUnitIndex = textureIndices::NoiseTex; - params.target = textureTarget::TEXTURE_2D; - gfxContext.bindTexture(params); - } - m_DList = dwnd().getBuffersSwapCount(); -} diff --git a/GLideN64/src/NoiseTexture.h b/GLideN64/src/NoiseTexture.h deleted file mode 100644 index 47b4c79..0000000 --- a/GLideN64/src/NoiseTexture.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include -#include -#include -#include "Types.h" - -#define NOISE_TEX_NUM 30 - -struct CachedTexture; -typedef std::array, NOISE_TEX_NUM> NoiseTexturesData; - -class NoiseTexture -{ -public: - NoiseTexture(); - - void init(); - void destroy(); - void update(); - -private: - void _fillTextureData(); - - CachedTexture * m_pTexture[NOISE_TEX_NUM]; - u32 m_DList; - u32 m_currTex, m_prevTex; - NoiseTexturesData m_texData; -}; - -extern NoiseTexture g_noiseTexture; diff --git a/GLideN64/src/PaletteTexture.cpp b/GLideN64/src/PaletteTexture.cpp deleted file mode 100644 index 372f565..0000000 --- a/GLideN64/src/PaletteTexture.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "Graphics/Context.h" -#include "Graphics/Parameters.h" -#include "N64.h" -#include "gDP.h" -#include "VI.h" -#include "Textures.h" -#include "PaletteTexture.h" -#include "DepthBuffer.h" - - -PaletteTexture g_paletteTexture; -using namespace graphics; - -PaletteTexture::PaletteTexture() -: m_pTexture(nullptr) -, m_pbuf(nullptr) -, m_paletteCRC256(0) -{ -} - -void PaletteTexture::init() -{ - if (!Context::IntegerTextures) - return; - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - m_paletteCRC256 = 0; - m_pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pTexture->format = G_IM_FMT_IA; - m_pTexture->clampS = 1; - m_pTexture->clampT = 1; - m_pTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pTexture->maskS = 0; - m_pTexture->maskT = 0; - m_pTexture->mirrorS = 0; - m_pTexture->mirrorT = 0; - m_pTexture->width = 256; - m_pTexture->height = 1; - m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.lutFormatBytes; - - Context::InitTextureParams initParams; - initParams.handle = m_pTexture->name; - initParams.width = m_pTexture->width; - initParams.height = m_pTexture->height; - initParams.internalFormat = fbTexFormats.lutInternalFormat; - initParams.format = fbTexFormats.lutFormat; - initParams.dataType = fbTexFormats.lutType; - gfxContext.init2DTexture(initParams); - - Context::TexParameters setParams; - setParams.handle = m_pTexture->name; - setParams.target = textureTarget::TEXTURE_2D; - setParams.textureUnitIndex = textureIndices::PaletteTex; - setParams.minFilter = textureParameters::FILTER_NEAREST; - setParams.magFilter = textureParameters::FILTER_NEAREST; - setParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - setParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - gfxContext.setTextureParameters(setParams); - - // Generate Pixel Buffer Object. Initialize it with max buffer size. - m_pbuf = (u8*)malloc(m_pTexture->textureBytes); -} - -void PaletteTexture::destroy() -{ - if (!Context::IntegerTextures) - return; - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = nullptr; - free(m_pbuf); - m_pbuf = nullptr; -} - -void PaletteTexture::update() -{ - if (!Context::IntegerTextures) - return; - - if (m_paletteCRC256 == gDP.paletteCRC256) - return; - - m_paletteCRC256 = gDP.paletteCRC256; - - u32 * palette = (u32*)m_pbuf; - u16 *src = (u16*)&TMEM[256]; - for (int i = 0; i < 256; ++i) - palette[i] = swapword(src[i * 4]); - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - Context::UpdateTextureDataParams params; - params.handle = m_pTexture->name; - params.textureUnitIndex = textureIndices::PaletteTex; - params.width = m_pTexture->width; - params.height = m_pTexture->height; - params.format = fbTexFormats.lutFormat; - params.internalFormat = fbTexFormats.lutInternalFormat; - params.dataType = fbTexFormats.lutType; - params.data = m_pbuf; - gfxContext.update2DTexture(params); -} diff --git a/GLideN64/src/PaletteTexture.h b/GLideN64/src/PaletteTexture.h deleted file mode 100644 index 0ef2b56..0000000 --- a/GLideN64/src/PaletteTexture.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include - -struct CachedTexture; - -class PaletteTexture -{ -public: - PaletteTexture(); - - void init(); - void destroy(); - void update(); - -private: - CachedTexture * m_pTexture; - u8* m_pbuf; - u64 m_paletteCRC256; -}; - -extern PaletteTexture g_paletteTexture; diff --git a/GLideN64/src/Performance.cpp b/GLideN64/src/Performance.cpp deleted file mode 100644 index 8ed5de2..0000000 --- a/GLideN64/src/Performance.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "VI.h" -#include "Config.h" -#include "Performance.h" - -Performance perf; - -Performance::Performance() - : m_vi(0) - , m_frames(0) - , m_fps(0) - , m_vis(0) - , m_enabled(false) { -} - -void Performance::reset() -{ - m_vi = 0; - m_frames = 0; - m_fps = 0; - m_vis = 0; - m_enabled = (config.onScreenDisplay.fps | config.onScreenDisplay.vis | config.onScreenDisplay.percent) != 0; - if (m_enabled) - m_startTime = std::chrono::steady_clock::now(); -} - -f32 Performance::getFps() const -{ - return m_fps; -} - -f32 Performance::getVIs() const -{ - return m_vis; -} - -f32 Performance::getPercent() const -{ - const f32 scale = VI.PAL ? 0.5f : 0.6f; - return m_vis / scale; -} - -void Performance::increaseVICount() -{ - if (!m_enabled) - return; - m_vi++; - const std::chrono::steady_clock::time_point curTime = std::chrono::steady_clock::now(); - std::chrono::steady_clock::duration time_span = curTime - m_startTime; - const double elapsed = double(time_span.count()) * std::chrono::steady_clock::period::num / std::chrono::steady_clock::period::den; - if (elapsed < 0.5) - return; - m_vis = (f32)(m_vi / elapsed); - m_fps = (f32)(m_frames / elapsed); - m_vi = 0; - m_frames = 0; - m_startTime = curTime; -} - -void Performance::increaseFramesCount() -{ - if (!m_enabled) - return; - m_frames++; -} diff --git a/GLideN64/src/Performance.h b/GLideN64/src/Performance.h deleted file mode 100644 index 7072135..0000000 --- a/GLideN64/src/Performance.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef PERFORMANCE_H -#define PERFORMANCE_H -#include -#include "Types.h" - -class Performance -{ -public: - Performance(); - void reset(); - f32 getFps() const; - f32 getVIs() const; - f32 getPercent() const; - void increaseVICount(); - void increaseFramesCount(); - -private: - u32 m_vi; - u32 m_frames; - f32 m_fps; - f32 m_vis; - std::chrono::steady_clock::time_point m_startTime; - bool m_enabled; -}; - -extern Performance perf; -#endif // PERFORMANCE_H diff --git a/GLideN64/src/Platform.h b/GLideN64/src/Platform.h deleted file mode 100644 index 3e764d0..0000000 --- a/GLideN64/src/Platform.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PLATFORM_H -#define PLATFORM_H - -#ifdef OS_WINDOWS -#ifndef NOMINMAX -#define NOMINMAX -#endif -#include -#else -#include "winlnxdefs.h" -#endif - -#ifdef PANDORA -typedef char GLchar; -#endif - -#endif // PLATFORM_H diff --git a/GLideN64/src/PluginAPI.h b/GLideN64/src/PluginAPI.h deleted file mode 100644 index 4a0ae4a..0000000 --- a/GLideN64/src/PluginAPI.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef COMMONPLUGINAPI_H -#define COMMONPLUGINAPI_H - -#ifdef MUPENPLUSAPI -#include "m64p_plugin.h" -#else -#include "windows/GLideN64_windows.h" -#include "ZilmarGFX_1_3.h" -#include "FrameBufferInfoAPI.h" -//#define RSPTHREAD -#endif - -#ifdef RSPTHREAD -#include -#include -#endif - -class APICommand; - -class PluginAPI -{ -public: -#ifdef RSPTHREAD - ~PluginAPI() - { - delete m_pRspThread; - m_pRspThread = NULL; - } -#endif - - // Common - void MoveScreen(int /*_xpos*/, int /*_ypos*/) {} - void ViStatusChanged() {} - void ViWidthChanged() {} - - void ProcessDList(); - void ProcessRDPList(); - void RomClosed(); - int RomOpen(); - void ShowCFB(); - void UpdateScreen(); - int InitiateGFX(const GFX_INFO & _gfxInfo); - void ChangeWindow(); - - void FindPluginPath(wchar_t * _strPath); - void GetUserDataPath(wchar_t * _strPath); - void GetUserCachePath(wchar_t * _strPath); - bool isRomOpen() const { return m_bRomOpen; } - -#ifndef MUPENPLUSAPI - // Zilmar - void DllTest(HWND /*_hParent*/) {} - void DrawScreen() {} - void CloseDLL(void) {} - - void CaptureScreen(char * _Directory); - void DllConfig(HWND _hParent); - void GetDllInfo (PLUGIN_INFO * PluginInfo); - void ReadScreen(void **_dest, long *_width, long *_height); - - void DllAbout(/*HWND _hParent*/); - - // FrameBufferInfo extension - void FBWrite(unsigned int addr, unsigned int size); - void FBWList(FrameBufferModifyEntry *plist, unsigned int size); - void FBRead(unsigned int addr); - void FBGetFrameBufferInfo(void *pinfo); -#else - // MupenPlus - void ResizeVideoOutput(int _Width, int _Height); - void ReadScreen2(void * _dest, int * _width, int * _height, int _front); - - m64p_error PluginStartup(m64p_dynlib_handle _CoreLibHandle); -#ifdef M64P_GLIDENUI - m64p_error PluginConfig(); -#endif // M64P_GLIDENUI - m64p_error PluginShutdown(); - m64p_error PluginGetVersion( - m64p_plugin_type * _PluginType, - int * _PluginVersion, - int * _APIVersion, - const char ** _PluginNamePtr, - int * _Capabilities - ); - void SetRenderingCallback(void (*callback)(int)); - - // FrameBufferInfo extension - void FBWrite(unsigned int addr, unsigned int size); - void FBRead(unsigned int addr); - void FBGetFrameBufferInfo(void *pinfo); -#endif - - static PluginAPI & get(); - -private: - PluginAPI() - : m_bRomOpen(false) -#ifdef RSPTHREAD - , m_pRspThread(NULL) - , m_pCommand(nullptr) -#endif - {} - PluginAPI(const PluginAPI &) = delete; - - void _initiateGFX(const GFX_INFO & _gfxInfo) const; - - bool m_bRomOpen; -#ifdef RSPTHREAD - void _callAPICommand(APICommand & _command); - std::mutex m_rspThreadMtx; - std::mutex m_pluginThreadMtx; - std::condition_variable_any m_rspThreadCv; - std::condition_variable_any m_pluginThreadCv; - std::thread * m_pRspThread; - APICommand * m_pCommand; -#endif -}; - -inline PluginAPI & api() -{ - return PluginAPI::get(); -} - -#endif // COMMONPLUGINAPI_H diff --git a/GLideN64/src/PostProcessor.cpp b/GLideN64/src/PostProcessor.cpp deleted file mode 100644 index 102e604..0000000 --- a/GLideN64/src/PostProcessor.cpp +++ /dev/null @@ -1,171 +0,0 @@ -#include - -#include "N64.h" -#include "gSP.h" -#include "PostProcessor.h" -#include "FrameBuffer.h" -#include "Config.h" -#include "VI.h" - -#include -#include -#include "DisplayWindow.h" - -using namespace graphics; - -PostProcessor::PostProcessor() - : m_pTextureOriginal(nullptr) -{} - -void PostProcessor::_createResultBuffer(const FrameBuffer * _pMainBuffer) -{ - m_pResultBuffer.reset(new FrameBuffer()); - m_pResultBuffer->m_width = _pMainBuffer->m_width; - m_pResultBuffer->m_height = _pMainBuffer->m_height; - m_pResultBuffer->m_scale = _pMainBuffer->m_scale; - - const CachedTexture * pMainTexture = _pMainBuffer->m_pTexture; - CachedTexture * pTexture = m_pResultBuffer->m_pTexture; - pTexture->format = G_IM_FMT_RGBA; - pTexture->clampS = 1; - pTexture->clampT = 1; - pTexture->frameBufferTexture = CachedTexture::fbOneSample; - pTexture->maskS = 0; - pTexture->maskT = 0; - pTexture->mirrorS = 0; - pTexture->mirrorT = 0; - pTexture->width = pMainTexture->width; - pTexture->height = pMainTexture->height; - pTexture->textureBytes = pTexture->width * pTexture->height * 4; - - Context::InitTextureParams initParams; - initParams.handle = pTexture->name; - initParams.width = pTexture->width; - initParams.height = pTexture->height; - initParams.internalFormat = gfxContext.convertInternalTextureFormat(u32(internalcolorFormat::RGBA8)); - initParams.format = colorFormat::RGBA; - initParams.dataType = datatype::UNSIGNED_BYTE; - gfxContext.init2DTexture(initParams); - - Context::TexParameters setParams; - setParams.handle = pTexture->name; - setParams.target = textureTarget::TEXTURE_2D; - setParams.minFilter = textureParameters::FILTER_NEAREST; - setParams.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(setParams); - - Context::FrameBufferRenderTarget bufTarget; - bufTarget.bufferHandle = m_pResultBuffer->m_FBO; - bufTarget.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - bufTarget.attachment = bufferAttachment::COLOR_ATTACHMENT0; - bufTarget.textureTarget = textureTarget::TEXTURE_2D; - bufTarget.textureHandle = pTexture->name; - gfxContext.addFrameBufferRenderTarget(bufTarget); - assert(!gfxContext.isFramebufferError()); -} - -void PostProcessor::init() -{ - m_gammaCorrectionProgram.reset(gfxContext.createGammaCorrectionShader()); - m_postprocessingList.emplace_front(std::mem_fn(&PostProcessor::_doGammaCorrection)); // std::mem_fn to fix compilation with VS 2013 - if (config.video.fxaa != 0) { - m_FXAAProgram.reset(gfxContext.createFXAAShader()); - m_postprocessingList.emplace_front(std::mem_fn(&PostProcessor::_doFXAA)); - } -} - -void PostProcessor::destroy() -{ - m_postprocessingList.clear(); - m_gammaCorrectionProgram.reset(); - m_FXAAProgram.reset(); - m_pResultBuffer.reset(); -} - -const PostProcessor::PostprocessingList & PostProcessor::getPostprocessingList() const -{ - return m_postprocessingList; -} - -PostProcessor & PostProcessor::get() -{ - static PostProcessor processor; - return processor; -} - -void PostProcessor::_preDraw(FrameBuffer * _pBuffer) -{ - if (!m_pResultBuffer || m_pResultBuffer->m_width != _pBuffer->m_width || - m_pResultBuffer->m_scale != _pBuffer->m_scale) - _createResultBuffer(_pBuffer); - - if (_pBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) { - _pBuffer->resolveMultisampledTexture(true); - m_pTextureOriginal = _pBuffer->m_pResolveTexture; - } else - m_pTextureOriginal = _pBuffer->m_pTexture; - - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, - ObjectHandle::defaultFramebuffer); -} - -void PostProcessor::_postDraw() -{ - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, - ObjectHandle::defaultFramebuffer); - - gfxContext.resetShaderProgram(); -} - -FrameBuffer * PostProcessor::_doPostProcessing(FrameBuffer * _pBuffer, graphics::ShaderProgram * _pShader) -{ - _preDraw(_pBuffer); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, - ObjectHandle(m_pResultBuffer->m_FBO)); - - CachedTexture * pDstTex = m_pResultBuffer->m_pTexture; - GraphicsDrawer::CopyRectParams copyParams; - copyParams.srcX0 = 0; - copyParams.srcY0 = 0; - copyParams.srcX1 = m_pTextureOriginal->width; - copyParams.srcY1 = m_pTextureOriginal->height; - copyParams.srcWidth = m_pTextureOriginal->width; - copyParams.srcHeight = m_pTextureOriginal->height; - copyParams.dstX0 = 0; - copyParams.dstY0 = 0; - copyParams.dstX1 = pDstTex->width; - copyParams.dstY1 = pDstTex->height; - copyParams.dstWidth = pDstTex->width; - copyParams.dstHeight = pDstTex->height; - copyParams.tex[0] = m_pTextureOriginal; - copyParams.filter = textureParameters::FILTER_NEAREST; - copyParams.combiner = _pShader; - - dwnd().getDrawer().copyTexturedRect(copyParams); - - _postDraw(); - return m_pResultBuffer.get(); -} - -FrameBuffer * PostProcessor::_doGammaCorrection(FrameBuffer * _pBuffer) -{ - if (_pBuffer == nullptr) - return nullptr; - - if (((*REG.VI_STATUS & VI_STATUS_GAMMA_ENABLED) | config.gammaCorrection.force) == 0) - return _pBuffer; - - return _doPostProcessing(_pBuffer, m_gammaCorrectionProgram.get()); -} - -FrameBuffer * PostProcessor::_doFXAA(FrameBuffer * _pBuffer) -{ - if (_pBuffer == nullptr) - return nullptr; - - if (config.video.fxaa == 0) - return _pBuffer; - - return _doPostProcessing(_pBuffer, m_FXAAProgram.get()); -} diff --git a/GLideN64/src/PostProcessor.h b/GLideN64/src/PostProcessor.h deleted file mode 100644 index 2f344f7..0000000 --- a/GLideN64/src/PostProcessor.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef POST_PROCESSOR_H -#define POST_PROCESSOR_H - -#include -#include -#include -#include "Types.h" -#include "Textures.h" -#include "Graphics/ObjectHandle.h" - -namespace graphics { - class ShaderProgram; -} - -struct FrameBuffer; - -class PostProcessor { -public: - void init(); - void destroy(); - - using PostprocessingFunc = std::function; - using PostprocessingList = std::list; - const PostprocessingList & getPostprocessingList() const; - - static PostProcessor & get(); - -private: - PostProcessor(); - PostProcessor(const PostProcessor & _other) = delete; - - FrameBuffer * _doGammaCorrection(FrameBuffer * _pBuffer); - FrameBuffer * _doFXAA(FrameBuffer * _pBuffer); - - void _createResultBuffer(const FrameBuffer * _pMainBuffer); - void _preDraw(FrameBuffer * _pBuffer); - void _postDraw(); - FrameBuffer * _doPostProcessing(FrameBuffer * _pBuffer, graphics::ShaderProgram * _pShader); - - std::unique_ptr m_gammaCorrectionProgram; - std::unique_ptr m_FXAAProgram; - std::unique_ptr m_pResultBuffer; - CachedTexture * m_pTextureOriginal; - PostprocessingList m_postprocessingList; -}; - -#endif // POST_PROCESSOR_H diff --git a/GLideN64/src/RDP.cpp b/GLideN64/src/RDP.cpp deleted file mode 100644 index 882011d..0000000 --- a/GLideN64/src/RDP.cpp +++ /dev/null @@ -1,627 +0,0 @@ -#include -#include -#include -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "GBI.h" -#include "gDP.h" -#include "gSP.h" -#include "Config.h" -#include "DebugDump.h" -#include "DisplayWindow.h" - -void RDP_Unknown( u32 w0, u32 w1 ) -{ - DebugMsg(DEBUG_NORMAL, "RDP_Unknown\r\n"); - DebugMsg(DEBUG_NORMAL, "\tUnknown RDP opcode %02X\r\n", _SHIFTR(w0, 24, 8)); -} - -void RDP_NoOp( u32 w0, u32 w1 ) -{ - gDPNoOp(); -} - -void RDP_SetCImg( u32 w0, u32 w1 ) -{ - gDPSetColorImage( _SHIFTR( w0, 21, 3 ), // fmt - _SHIFTR( w0, 19, 2 ), // siz - _SHIFTR( w0, 0, 12 ) + 1, // width - w1 ); // img -} - -void RDP_SetZImg( u32 w0, u32 w1 ) -{ - gDPSetDepthImage( w1 ); // img -} - -void RDP_SetTImg( u32 w0, u32 w1 ) -{ - gDPSetTextureImage( _SHIFTR( w0, 21, 3), // fmt - _SHIFTR( w0, 19, 2 ), // siz - _SHIFTR( w0, 0, 12 ) + 1, // width - w1 ); // img -} - -void RDP_SetCombine( u32 w0, u32 w1 ) -{ - gDPSetCombine( _SHIFTR( w0, 0, 24 ), // muxs0 - w1 ); // muxs1 -} - -void RDP_SetEnvColor( u32 w0, u32 w1 ) -{ - gDPSetEnvColor( _SHIFTR( w1, 24, 8 ), // r - _SHIFTR( w1, 16, 8 ), // g - _SHIFTR( w1, 8, 8 ), // b - _SHIFTR( w1, 0, 8 ) ); // a -} - -void RDP_SetPrimColor( u32 w0, u32 w1 ) -{ - gDPSetPrimColor( _SHIFTR( w0, 8, 5 ), // m - _SHIFTR( w0, 0, 8 ), // l - _SHIFTR( w1, 24, 8 ), // r - _SHIFTR( w1, 16, 8 ), // g - _SHIFTR( w1, 8, 8 ), // b - _SHIFTR( w1, 0, 8 ) ); // a - -} - -void RDP_SetBlendColor( u32 w0, u32 w1 ) -{ - gDPSetBlendColor( _SHIFTR( w1, 24, 8 ), // r - _SHIFTR( w1, 16, 8 ), // g - _SHIFTR( w1, 8, 8 ), // b - _SHIFTR( w1, 0, 8 ) ); // a -} - -void RDP_SetFogColor( u32 w0, u32 w1 ) -{ - gDPSetFogColor( _SHIFTR( w1, 24, 8 ), // r - _SHIFTR( w1, 16, 8 ), // g - _SHIFTR( w1, 8, 8 ), // b - _SHIFTR( w1, 0, 8 ) ); // a -} - -void RDP_SetFillColor( u32 w0, u32 w1 ) -{ - gDPSetFillColor( w1 ); -} - -void RDP_FillRect( u32 w0, u32 w1 ) -{ - const u32 ulx = _SHIFTR(w1, 14, 10); - const u32 uly = _SHIFTR(w1, 2, 10); - const u32 lrx = _SHIFTR(w0, 14, 10); - const u32 lry = _SHIFTR(w0, 2, 10); - if (lrx < ulx || lry < uly) - return; - gDPFillRectangle(ulx, uly, lrx, lry); -} - -void RDP_SetTile( u32 w0, u32 w1 ) -{ - gDPSetTile( _SHIFTR( w0, 21, 3 ), // fmt - _SHIFTR( w0, 19, 2 ), // siz - _SHIFTR( w0, 9, 9 ), // line - _SHIFTR( w0, 0, 9 ), // tmem - _SHIFTR( w1, 24, 3 ), // tile - _SHIFTR( w1, 20, 4 ), // palette - _SHIFTR( w1, 18, 2 ), // cmt - _SHIFTR( w1, 8, 2 ), // cms - _SHIFTR( w1, 14, 4 ), // maskt - _SHIFTR( w1, 4, 4 ), // masks - _SHIFTR( w1, 10, 4 ), // shiftt - _SHIFTR( w1, 0, 4 ) ); // shifts -} - -void RDP_LoadTile( u32 w0, u32 w1 ) -{ - gDPLoadTile( _SHIFTR( w1, 24, 3 ), // tile - _SHIFTR( w0, 12, 12 ), // uls - _SHIFTR( w0, 0, 12 ), // ult - _SHIFTR( w1, 12, 12 ), // lrs - _SHIFTR( w1, 0, 12 ) ); // lrt -} - -static u32 lbw0, lbw1; -void RDP_LoadBlock( u32 w0, u32 w1 ) -{ - lbw0 = w0; - lbw1 = w1; - gDPLoadBlock( _SHIFTR( w1, 24, 3 ), // tile - _SHIFTR( w0, 12, 12 ), // uls - _SHIFTR( w0, 0, 12 ), // ult - _SHIFTR( w1, 12, 12 ), // lrs - _SHIFTR( w1, 0, 12 ) ); // dxt -} - -void RDP_RepeatLastLoadBlock() -{ - RDP_LoadBlock(lbw0, lbw1); -} - -void RDP_SetTileSize( u32 w0, u32 w1 ) -{ - gDPSetTileSize( _SHIFTR( w1, 24, 3 ), // tile - _SHIFTR( w0, 12, 12 ), // uls - _SHIFTR( w0, 0, 12 ), // ult - _SHIFTR( w1, 12, 12 ), // lrs - _SHIFTR( w1, 0, 12 ) ); // lrt -} - -void RDP_LoadTLUT( u32 w0, u32 w1 ) -{ - gDPLoadTLUT( _SHIFTR( w1, 24, 3 ), // tile - _SHIFTR( w0, 12, 12 ), // uls - _SHIFTR( w0, 0, 12 ), // ult - _SHIFTR( w1, 12, 12 ), // lrs - _SHIFTR( w1, 0, 12 ) ); // lrt -} - -void RDP_SetOtherMode( u32 w0, u32 w1 ) -{ - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 -} - -void RDP_SetPrimDepth( u32 w0, u32 w1 ) -{ - gDPSetPrimDepth( _SHIFTR( w1, 16, 16 ), // z - _SHIFTR( w1, 0, 16 ) ); // dz -} - -void RDP_SetScissor( u32 w0, u32 w1 ) -{ - gDPSetScissor( _SHIFTR( w1, 24, 2 ), // mode - _SHIFTR( w0, 12, 12 ), // ulx - _SHIFTR( w0, 0, 12 ), // uly - _SHIFTR( w1, 12, 12 ), // lrx - _SHIFTR( w1, 0, 12 ) ); // lry -} - -void RDP_SetConvert( u32 w0, u32 w1 ) -{ - gDPSetConvert( _SHIFTR( w0, 13, 9 ), // k0 - _SHIFTR( w0, 4, 9 ), // k1 - _SHIFTL( w0, 5, 4 ) | _SHIFTR( w1, 27, 5 ), // k2 - _SHIFTR( w1, 18, 9 ), // k3 - _SHIFTR( w1, 9, 9 ), // k4 - _SHIFTR( w1, 0, 9 ) ); // k5 -} - -void RDP_SetKeyR( u32 w0, u32 w1 ) -{ - gDPSetKeyR( _SHIFTR( w1, 8, 8 ), // cR - _SHIFTR( w1, 0, 8 ), // sR - _SHIFTR( w1, 16, 12 ) ); // wR -} - -void RDP_SetKeyGB( u32 w0, u32 w1 ) -{ - gDPSetKeyGB( _SHIFTR( w1, 24, 8 ), // cG - _SHIFTR( w1, 16, 8 ), // sG - _SHIFTR( w0, 12, 12 ), // wG - _SHIFTR( w1, 8, 8 ), // cB - _SHIFTR( w1, 0, 8 ), // SB - _SHIFTR( w0, 0, 12 ) ); // wB -} - -void RDP_FullSync( u32 w0, u32 w1 ) -{ - gDPFullSync(); -} - -void RDP_TileSync( u32 w0, u32 w1 ) -{ - gDPTileSync(); -} - -void RDP_PipeSync( u32 w0, u32 w1 ) -{ - gDPPipeSync(); -} - -void RDP_LoadSync( u32 w0, u32 w1 ) -{ - gDPLoadSync(); -} - -static -bool _getTexRectParams(u32 & w2, u32 & w3) -{ - if (RSP.LLE) { - w2 = RDP.w2; - w3 = RDP.w3; - return true; - } - - enum { - gspTexRect, - gdpTexRect, - halfTexRect - } texRectMode = gdpTexRect; - - const u32 cmd1 = (*(u32*)&RDRAM[RSP.PC[RSP.PCi] + 0]) >> 24; - const u32 cmd2 = (*(u32*)&RDRAM[RSP.PC[RSP.PCi] + 8]) >> 24; - if (cmd1 == G_RDPHALF_1) { - if (cmd2 == G_RDPHALF_2) - texRectMode = gspTexRect; - } else if (cmd1 == 0xB3) { - texRectMode = halfTexRect; - } else if (cmd1 == 0xF1) - texRectMode = halfTexRect; - - switch (texRectMode) { - case gspTexRect: - w2 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.PC[RSP.PCi] += 8; - - w3 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.PC[RSP.PCi] += 8; - break; - case gdpTexRect: - if ((config.generalEmulation.hacks & hack_WinBack) != 0) { - RSP.PC[RSP.PCi] += 8; - return false; - } - { - const u32 ucode = GBI.getMicrocodeType(); - if (ucode == F5Rogue || ucode == F5Indi_Naboo) { - w2 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 8]; - w3 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 12]; - RSP.PC[RSP.PCi] += 8; - return true; - } - } - w2 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 0]; - w3 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.PC[RSP.PCi] += 8; - break; - case halfTexRect: - w2 = 0; - w3 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.PC[RSP.PCi] += 8; - break; - default: - assert(false && "Unknown texrect mode"); - } - return true; -} - -static -void _TexRect( u32 w0, u32 w1, bool flip ) -{ - u32 w2, w3; - if (!_getTexRectParams(w2, w3)) - return; - RDP.w0 = w0; - RDP.w1 = w1; - const s32 ulx = _SHIFTR(w1, 12, 12); - const s32 uly = _SHIFTR(w1, 0, 12); - const s32 lrx = _SHIFTR(w0, 12, 12); - const s32 lry = _SHIFTR(w0, 0, 12); - if (lrx < ulx || lry < uly) - return; - if (gDP.otherMode.cycleType == G_CYC_COPY) - gDPTextureRectangle( - f32(ulx >> 2), - f32(uly >> 2), - f32(lrx >> 2), - f32(lry >> 2), - _SHIFTR(w1, 24, 3), // tile - (s16)_SHIFTR(w2, 16, 16), // s - (s16)_SHIFTR(w2, 0, 16), // t - _FIXED2FLOAT((s16)_SHIFTR(w3, 16, 16), 10), // dsdx - _FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10), // dsdy - flip); - else - gDPTextureRectangle( - _FIXED2FLOAT(ulx, 2), - _FIXED2FLOAT(uly, 2), - _FIXED2FLOAT(lrx, 2), - _FIXED2FLOAT(lry, 2), - _SHIFTR(w1, 24, 3), // tile - (s16)_SHIFTR(w2, 16, 16), // s - (s16)_SHIFTR(w2, 0, 16), // t - _FIXED2FLOAT((s16)_SHIFTR(w3, 16, 16), 10), // dsdx - _FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10), // dsdy - flip); -} - -void RDP_TexRectFlip( u32 w0, u32 w1 ) -{ - _TexRect(w0, w1, true); -} - -void RDP_TexRect( u32 w0, u32 w1 ) -{ - _TexRect(w0, w1, false); -} - -void RDP_TriFill( u32 _w0, u32 _w1 ) -{ - gDPTriFill(_w0, _w1); -} - -void RDP_TriShade( u32 _w0, u32 _w1 ) -{ - gDPTriShade(_w0, _w1); -} - -void RDP_TriTxtr( u32 _w0, u32 _w1 ) -{ - gDPTriTxtr(_w0, _w1); -} - -void RDP_TriShadeTxtr( u32 _w0, u32 _w1 ) -{ - gDPTriShadeTxtr(_w0, _w1); -} - -void RDP_TriFillZ( u32 _w0, u32 _w1 ) -{ - gDPTriFillZ(_w0, _w1); -} - -void RDP_TriShadeZ( u32 _w0, u32 _w1 ) -{ - gDPTriShadeZ(_w0, _w1); -} - -void RDP_TriTxtrZ( u32 _w0, u32 _w1 ) -{ - gDPTriTxtrZ(_w0, _w1); -} - -void RDP_TriShadeTxtrZ( u32 _w0, u32 _w1 ) -{ - gDPTriShadeTxtrZ(_w0, _w1); -} - -RDPInfo RDP; - -void RDP_Init() -{ - // Initialize RDP commands to RDP_UNKNOWN - for (int i = 0xC8; i <= 0xCF; i++) - GBI.cmd[i] = RDP_Unknown; - - // Initialize RDP commands to RDP_UNKNOWN - for (int i = 0xE4; i <= 0xFF; i++) - GBI.cmd[i] = RDP_Unknown; - - // Set known GBI commands - GBI.cmd[G_NOOP] = RDP_NoOp; - GBI.cmd[G_SETCIMG] = RDP_SetCImg; - GBI.cmd[G_SETZIMG] = RDP_SetZImg; - GBI.cmd[G_SETTIMG] = RDP_SetTImg; - GBI.cmd[G_SETCOMBINE] = RDP_SetCombine; - GBI.cmd[G_SETENVCOLOR] = RDP_SetEnvColor; - GBI.cmd[G_SETPRIMCOLOR] = RDP_SetPrimColor; - GBI.cmd[G_SETBLENDCOLOR] = RDP_SetBlendColor; - GBI.cmd[G_SETFOGCOLOR] = RDP_SetFogColor; - GBI.cmd[G_SETFILLCOLOR] = RDP_SetFillColor; - GBI.cmd[G_FILLRECT] = RDP_FillRect; - GBI.cmd[G_SETTILE] = RDP_SetTile; - GBI.cmd[G_LOADTILE] = RDP_LoadTile; - GBI.cmd[G_LOADBLOCK] = RDP_LoadBlock; - GBI.cmd[G_SETTILESIZE] = RDP_SetTileSize; - GBI.cmd[G_LOADTLUT] = RDP_LoadTLUT; - GBI.cmd[G_RDPSETOTHERMODE] = RDP_SetOtherMode; - GBI.cmd[G_SETPRIMDEPTH] = RDP_SetPrimDepth; - GBI.cmd[G_SETSCISSOR] = RDP_SetScissor; - GBI.cmd[G_SETCONVERT] = RDP_SetConvert; - GBI.cmd[G_SETKEYR] = RDP_SetKeyR; - GBI.cmd[G_SETKEYGB] = RDP_SetKeyGB; - GBI.cmd[G_RDPFULLSYNC] = RDP_FullSync; - GBI.cmd[G_RDPTILESYNC] = RDP_TileSync; - GBI.cmd[G_RDPPIPESYNC] = RDP_PipeSync; - GBI.cmd[G_RDPLOADSYNC] = RDP_LoadSync; - GBI.cmd[G_TEXRECTFLIP] = RDP_TexRectFlip; - GBI.cmd[G_TEXRECT] = RDP_TexRect; - GBI.cmd[G_RDPNOOP] = RDP_NoOp; - - RDP.w0 = RDP.w1 = RDP.w2 = RDP.w3 = 0; - RDP.cmd_ptr = RDP.cmd_cur = 0; -} - -static -GBIFunc LLEcmd[64] = { - /* 0x00 */ - RDP_NoOp, RDP_Unknown, RDP_Unknown, RDP_Unknown, - RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown, - RDP_TriFill, RDP_TriFillZ, RDP_TriTxtr, RDP_TriTxtrZ, - RDP_TriShade, RDP_TriShadeZ, RDP_TriShadeTxtr, RDP_TriShadeTxtrZ, - /* 0x10 */ - RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown, - RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown, - RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown, - RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown, - /* 0x20 */ - RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown, - RDP_TexRect, RDP_TexRectFlip, RDP_LoadSync, RDP_PipeSync, - RDP_TileSync, RDP_FullSync, RDP_SetKeyGB, RDP_SetKeyR, - RDP_SetConvert, RDP_SetScissor, RDP_SetPrimDepth, RDP_SetOtherMode, - /* 0x30 */ - RDP_LoadTLUT, RDP_Unknown, RDP_SetTileSize, RDP_LoadBlock, - RDP_LoadTile, RDP_SetTile, RDP_FillRect, RDP_SetFillColor, - RDP_SetFogColor, RDP_SetBlendColor, RDP_SetPrimColor, RDP_SetEnvColor, - RDP_SetCombine, RDP_SetTImg, RDP_SetZImg, RDP_SetCImg -}; - -static -const u32 CmdLength[64] = -{ - 8, // 0x00, No Op - 8, // 0x01, ??? - 8, // 0x02, ??? - 8, // 0x03, ??? - 8, // 0x04, ??? - 8, // 0x05, ??? - 8, // 0x06, ??? - 8, // 0x07, ??? - 32, // 0x08, Non-Shaded Triangle - 32+16, // 0x09, Non-Shaded, Z-Buffered Triangle - 32+64, // 0x0a, Textured Triangle - 32+64+16, // 0x0b, Textured, Z-Buffered Triangle - 32+64, // 0x0c, Shaded Triangle - 32+64+16, // 0x0d, Shaded, Z-Buffered Triangle - 32+64+64, // 0x0e, Shaded+Textured Triangle - 32+64+64+16,// 0x0f, Shaded+Textured, Z-Buffered Triangle - 8, // 0x10, ??? - 8, // 0x11, ??? - 8, // 0x12, ??? - 8, // 0x13, ??? - 8, // 0x14, ??? - 8, // 0x15, ??? - 8, // 0x16, ??? - 8, // 0x17, ??? - 8, // 0x18, ??? - 8, // 0x19, ??? - 8, // 0x1a, ??? - 8, // 0x1b, ??? - 8, // 0x1c, ??? - 8, // 0x1d, ??? - 8, // 0x1e, ??? - 8, // 0x1f, ??? - 8, // 0x20, ??? - 8, // 0x21, ??? - 8, // 0x22, ??? - 8, // 0x23, ??? - 16, // 0x24, Texture_Rectangle - 16, // 0x25, Texture_Rectangle_Flip - 8, // 0x26, Sync_Load - 8, // 0x27, Sync_Pipe - 8, // 0x28, Sync_Tile - 8, // 0x29, Sync_Full - 8, // 0x2a, Set_Key_GB - 8, // 0x2b, Set_Key_R - 8, // 0x2c, Set_Convert - 8, // 0x2d, Set_Scissor - 8, // 0x2e, Set_Prim_Depth - 8, // 0x2f, Set_Other_Modes - 8, // 0x30, Load_TLUT - 8, // 0x31, ??? - 8, // 0x32, Set_Tile_Size - 8, // 0x33, Load_Block - 8, // 0x34, Load_Tile - 8, // 0x35, Set_Tile - 8, // 0x36, Fill_Rectangle - 8, // 0x37, Set_Fill_Color - 8, // 0x38, Set_Fog_Color - 8, // 0x39, Set_Blend_Color - 8, // 0x3a, Set_Prim_Color - 8, // 0x3b, Set_Env_Color - 8, // 0x3c, Set_Combine - 8, // 0x3d, Set_Texture_Image - 8, // 0x3e, Set_Mask_Image - 8 // 0x3f, Set_Color_Image -}; - -void RDP_Half_1( u32 _c ) -{ - u32 w0 = 0, w1 = _c; - u32 cmd = _SHIFTR( _c, 24, 8 ); - if (cmd >= 0xc8 && cmd <=0xcf) {//triangle command - DebugMsg(DEBUG_NORMAL, "gDPHalf_1 LLE Triangle\n"); - RDP.cmd_ptr = 0; - RDP.cmd_cur = 0; - do { - RDP.cmd_data[RDP.cmd_ptr++] = w1; - RSP_CheckDLCounter(); - - w0 = *(u32*)&RDRAM[RSP.PC[RSP.PCi]]; - w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - - DebugMsg(DEBUG_NORMAL, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(w0, 24, 8), w0, w1); - - RSP.PC[RSP.PCi] += 8; - // RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[RSP.PC[RSP.PCi]], 24, 8 ); - } while (RSP.cmd != 0xb3); - RDP.cmd_data[RDP.cmd_ptr++] = w1; - RSP.cmd = (RDP.cmd_data[RDP.cmd_cur] >> 24) & 0x3f; - w0 = RDP.cmd_data[RDP.cmd_cur+0]; - w1 = RDP.cmd_data[RDP.cmd_cur+1]; - LLEcmd[RSP.cmd](w0, w1); - LLETriangle::get().flush(cmd); - } else { - DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "gDPHalf_1()\n"); - } -} - -#define rdram ((u32*)RDRAM) -#define rsp_dmem ((u32*)DMEM) - -#define dp_start (*(u32*)REG.DPC_START) -#define dp_end (*(u32*)REG.DPC_END) -#define dp_current (*(u32*)REG.DPC_CURRENT) -#define dp_status (*(u32*)REG.DPC_STATUS) - -inline u32 READ_RDP_DATA(u32 address) -{ - if (dp_status & 0x1) // XBUS_DMEM_DMA enabled - return rsp_dmem[(address & 0xfff)>>2]; - else - return rdram[(address & 0xffffff)>>2]; -} - -void RDP_ProcessRDPList() -{ - if (ConfigOpen || dwnd().isResizeWindow()) { - dp_start = dp_current = dp_end; - gDPFullSync(); - return; - } - - const u32 length = dp_end - dp_current; - - if (dp_end <= dp_current) return; - - RSP.LLE = true; - - // load command data - for (u32 i = 0; i < length; i += 4) { - RDP.cmd_data[RDP.cmd_ptr] = READ_RDP_DATA(dp_current + i); - RDP.cmd_ptr = (RDP.cmd_ptr + 1) & maxCMDMask; - } - - bool setZero = true; - while (RDP.cmd_cur != RDP.cmd_ptr) { - u32 cmd = (RDP.cmd_data[RDP.cmd_cur] >> 24) & 0x3f; - - if ((((RDP.cmd_ptr - RDP.cmd_cur)&maxCMDMask) * 4) < CmdLength[cmd]) { - setZero = false; - break; - } - - if (RDP.cmd_cur + CmdLength[cmd] / 4 > MAXCMD) - ::memcpy(RDP.cmd_data + MAXCMD, RDP.cmd_data, CmdLength[cmd] - (MAXCMD - RDP.cmd_cur) * 4); - - // execute the command - RDP.w0 = RDP.cmd_data[RDP.cmd_cur + 0]; - RDP.w1 = RDP.cmd_data[RDP.cmd_cur + 1]; - RDP.w2 = RDP.cmd_data[RDP.cmd_cur + 2]; - RDP.w3 = RDP.cmd_data[RDP.cmd_cur + 3]; - RSP.cmd = cmd; -#ifdef DEBUG_DUMP - DebugMsg(DEBUG_LOW, "CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", cmd, RDP.w0, RDP.w1); -#endif - LLETriangle::get().flush(cmd); - LLEcmd[cmd](RDP.w0, RDP.w1); - - RDP.cmd_cur = (RDP.cmd_cur + CmdLength[cmd] / 4) & maxCMDMask; - } - - if (setZero) { - RDP.cmd_ptr = 0; - RDP.cmd_cur = 0; - } - - gDP.changed |= CHANGED_COLORBUFFER; - gDP.changed &= ~CHANGED_CPU_FB_WRITE; - - dp_start = dp_current = dp_end; -} diff --git a/GLideN64/src/RDP.h b/GLideN64/src/RDP.h deleted file mode 100644 index 992548c..0000000 --- a/GLideN64/src/RDP.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef RDP_H -#define RDP_H - -#define MAXCMD 0x100000 -const unsigned int maxCMDMask = MAXCMD - 1; - -typedef struct -{ - u32 w0, w1, w2, w3; - u32 cmd_ptr; - u32 cmd_cur; - u32 cmd_data[MAXCMD + 32]; -} RDPInfo; - -extern RDPInfo RDP; - -void RDP_Init(); -void RDP_Half_1(u32 _c); -void RDP_TexRect(u32 w0, u32 w1); -void RDP_ProcessRDPList(); -void RDP_RepeatLastLoadBlock(); -void RDP_SetScissor(u32 w0, u32 w1); -void RDP_SetTImg(u32 w0, u32 w1); -void RDP_LoadBlock(u32 w0, u32 w1); -void RDP_SetTile(u32 w0, u32 w1); -void RDP_SetTileSize(u32 w0, u32 w1); - -#endif - diff --git a/GLideN64/src/RSP.cpp b/GLideN64/src/RSP.cpp deleted file mode 100644 index 88bd4b6..0000000 --- a/GLideN64/src/RSP.cpp +++ /dev/null @@ -1,352 +0,0 @@ -#include -#include -#include "DebugDump.h" -#include "RSP.h" -#include "RDP.h" -#include "N64.h" -#include "uCodes/F3D.h" -#include "uCodes/Turbo3D.h" -#include "uCodes/T3DUX.h" -#include "VI.h" -#include "Combiner.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "FrameBufferInfo.h" -#include "GBI.h" -#include "PluginAPI.h" -#include "Config.h" -#include "TextureFilterHandler.h" -#include "DisplayWindow.h" - -using namespace std; - -#define SP_STATUS_HALT 0x0001 -#define SP_STATUS_BROKE 0x0002 -#define SP_STATUS_TASKDONE 0x0200 - -RSPInfo RSP; - -static -void _ProcessDList() -{ - while (!RSP.halt) { - if ((RSP.PC[RSP.PCi] + 8) > RDRAMSize) { -#ifdef DEBUG_DUMP - if ((config.debug.dumpMode & DEBUG_DETAIL) != 0) - DebugMsg(DEBUG_DETAIL | DEBUG_ERROR, "// Attempting to execute RSP command at invalid RDRAM location\n"); - else if ((config.debug.dumpMode & DEBUG_NORMAL) != 0) - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "Attempting to execute RSP command at invalid RDRAM location\n"); - else if ((config.debug.dumpMode & DEBUG_LOW) != 0) - DebugMsg(DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n"); -#endif - break; - } - - RSP.w0 = *(u32*)&RDRAM[RSP.PC[RSP.PCi]]; - RSP.w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.cmd = _SHIFTR(RSP.w0, 24, 8); - -#ifdef DEBUG_DUMP - DebugMsg(DEBUG_LOW, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(RSP.w0, 24, 8), RSP.w0, RSP.w1); -#endif - - RSP.PC[RSP.PCi] += 8; - u32 pci = RSP.PCi; - if (RSP.count == 1) - --pci; - RSP.nextCmd = _SHIFTR(*(u32*)&RDRAM[RSP.PC[pci]], 24, 8); - - GBI.cmd[RSP.cmd](RSP.w0, RSP.w1); - RSP_CheckDLCounter(); - } -} - -static -void _ProcessDListFactor5() -{ - // Lemmy's note: read first 64 bits of this dlist - RSP.F5DL[0] = _SHIFTR(*(u32*)&RDRAM[RSP.PC[0]], 0, 24); - RSP.PC[0] += 8; - - static u32 vAddrToClear[7] = { 0x11C >> 2, 0x120 >> 2, 0x124 >> 2, 0x37C >> 2, - 0x58C >> 2, 0x5B0 >> 2, 0x5B4 >> 2}; - u32 * pDmem32 = reinterpret_cast(DMEM); - for (u32 i = 0; i < 7; ++i) - pDmem32[vAddrToClear[i]] = 0U; - - while (!RSP.halt) { - if ((RSP.PC[RSP.PCi] + 8) > RDRAMSize) { - break; - } - - RSP.w0 = *(u32*)&RDRAM[RSP.PC[RSP.PCi]]; - RSP.w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.cmd = _SHIFTR(RSP.w0, 24, 8); - -#ifdef DEBUG_DUMP - DebugMsg(DEBUG_LOW, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(RSP.w0, 24, 8), RSP.w0, RSP.w1); -#endif - - RSP.nextCmd = _SHIFTR(*(u32*)&RDRAM[RSP.PC[RSP.PCi] + 8], 24, 8); - - GBI.cmd[RSP.cmd](RSP.w0, RSP.w1); - RSP.PC[RSP.PCi] += 8; - RSP_CheckDLCounter(); - } -} - -void RSP_CheckDLCounter() -{ - if (RSP.count != -1) { - --RSP.count; - if (RSP.count == 0) { - RSP.count = -1; - --RSP.PCi; - DebugMsg(DEBUG_NORMAL, "End of DL\n"); - } - } -} - -void RSP_ProcessDList() -{ - RSP.LLE = false; - - if (ConfigOpen || dwnd().isResizeWindow()) { - *REG.MI_INTR |= MI_INTR_DP; - CheckInterrupts(); - return; - } - - if (RSP.infloop) { - RSP.infloop = false; - RSP.halt = false; - } else { - if (*REG.VI_ORIGIN != VI.lastOrigin) { - VI_UpdateSize(); - dwnd().updateScale(); - } - - RSP.PC[0] = *(u32*)&DMEM[0x0FF0]; - RSP.PCi = 0; - RSP.count = -1; - - RSP.halt = false; - RSP.busy = true; - - gSP.matrix.stackSize = min( 32U, *(u32*)&DMEM[0x0FE4] >> 6 ); - if (gSP.matrix.stackSize == 0) - gSP.matrix.stackSize = 32; - gSP.matrix.modelViewi = 0; - gSP.status[0] = gSP.status[1] = gSP.status[2] = gSP.status[3] = 0; - gSP.geometryMode = 0U; - gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT | CHANGED_GEOMETRYMODE; - gSP.tri_num = 0; - gSP.cbfd.advancedLighting = false; - gDP.changed &= ~CHANGED_CPU_FB_WRITE; - gDPSetTexturePersp(G_TP_PERSP); - - // Get the start of the display list and the length of it - const u32 dlist_start = *(u32*)(DMEM + 0xFF0); - const u32 dlist_length = *(u32*)(DMEM + 0xFF4); - DebugMsg(DEBUG_NORMAL, "--- NEW DLIST --- ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f\n", - GBI.getMicrocodeType(), *REG.VI_ORIGIN, *REG.VI_WIDTH, dlist_start, dlist_length, (*REG.VI_X_SCALE & 0xFFF) / 1024.0f, (*REG.VI_Y_SCALE & 0xFFF) / 1024.0f); - - u32 uc_start = *(u32*)&DMEM[0x0FD0]; - u32 uc_dstart = *(u32*)&DMEM[0x0FD8]; - u32 uc_dsize = *(u32*)&DMEM[0x0FDC]; - - if ((uc_start != RSP.uc_start) || (uc_dstart != RSP.uc_dstart)) - gSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize); - - depthBufferList().setCleared(false); - - if (GBI.getMicrocodeType() == ZSortBOSS) { - RSP.PC[1] = *(u32*)&DMEM[0xff8]; - *REG.SP_STATUS &= ~0x300; // clear sig1 | sig2 - *REG.SP_STATUS |= 0x800; // set sig4 - } - } - - switch (GBI.getMicrocodeType()) { - case Turbo3D: - RunTurbo3D(); - break; - case T3DUX: - RunT3DUX(); - break; - case F5Rogue: - case F5Indi_Naboo: - _ProcessDListFactor5(); - break; - default: - _ProcessDList(); - break; - } - - if (RSP.infloop && REG.SP_STATUS) { - *REG.SP_STATUS &= ~(SP_STATUS_TASKDONE | SP_STATUS_HALT | SP_STATUS_BROKE); - return; - } - - if (config.frameBufferEmulation.copyDepthToRDRAM != Config::cdDisable) { - if ((config.generalEmulation.hacks & hack_rectDepthBufferCopyCBFD) != 0) { - ; // do nothing - } else if ((config.generalEmulation.hacks & hack_rectDepthBufferCopyPD) != 0) { - if (rectDepthBufferCopyFrame == dwnd().getBuffersSwapCount()) - FrameBuffer_CopyDepthBuffer(gDP.colorImage.address); - } else if (!FBInfo::fbInfo.isSupported()) - FrameBuffer_CopyDepthBuffer(gDP.colorImage.address); - } - - RSP.busy = false; - gDP.changed |= CHANGED_COLORBUFFER; -} - -static -void RSP_SetDefaultState() -{ - memset(&gSP, 0, sizeof(gSPInfo)); - - gSPTexture(1.0f, 1.0f, 0, 0, TRUE); - gDP.loadTile = &gDP.tiles[7]; - gSP.textureTile[0] = &gDP.tiles[0]; - gSP.textureTile[1] = &gDP.tiles[1]; - gSP.lookat.xyz[0][Y] = gSP.lookat.xyz[1][X] = 1.0f; - gSP.lookatEnable = true; - - gSP.objRendermode = 0; - - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) - gSP.matrix.modelView[0][i][j] = 0.0f; - - gSP.matrix.modelView[0][0][0] = 1.0f; - gSP.matrix.modelView[0][1][1] = 1.0f; - gSP.matrix.modelView[0][2][2] = 1.0f; - gSP.matrix.modelView[0][3][3] = 1.0f; - - gSP.clipRatio = 1U; - - gDP.otherMode._u64 = 0U; - gDP.otherMode.bi_lerp0 = gDP.otherMode.bi_lerp1 = 1; -} - -u32 DepthClearColor = 0xfffcfffc; - -static -void setDepthClearColor() -{ - if (strstr(RSP.romname, (const char *)"Elmo's") != nullptr) - DepthClearColor = 0xFFFFFFFF; - else if (strstr(RSP.romname, (const char *)"Taz Express") != nullptr) - DepthClearColor = 0xFFBCFFBC; - else if (strstr(RSP.romname, (const char *)"NFL QBC 2000") != nullptr || strstr(RSP.romname, (const char *)"NFL Quarterback Club") != nullptr || strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != nullptr) - DepthClearColor = 0xFFFDFFFC; - else - DepthClearColor = 0xFFFCFFFC; -} - -void RSP_Init() -{ - if (RDRAMSize == 0) { -#ifdef OS_WINDOWS - // Calculate RDRAM size by intentionally causing an access violation - u32 test; - try - { - test = RDRAM[0x007FFFFF] + 1; - } - catch (...) - { - test = 0; - } - if (test > 0) - RDRAMSize = 0x7FFFFF; - else - RDRAMSize = 0x3FFFFF; -#else // OS_WINDOWS - RDRAMSize = 1024 * 1024 * 8 - 1; -#endif // OS_WINDOWS - } - - RSP.uc_start = RSP.uc_dstart = 0; - RSP.LLE = false; - RSP.infloop = false; - - // get the name of the ROM - char romname[21]; - for (int i = 0; i < 20; ++i) - romname[i] = HEADER[(32 + i) ^ 3]; - romname[20] = 0; - - // remove all trailing spaces - while (romname[strlen(romname) - 1] == ' ') - romname[strlen(romname) - 1] = 0; - - if (strcmp(RSP.romname, romname) != 0) - TFH.shutdown(); - - strncpy(RSP.romname, romname, 21); - setDepthClearColor(); - config.generalEmulation.hacks = 0; - if (strstr(RSP.romname, (const char *)"OgreBattle64") != nullptr) - config.generalEmulation.hacks |= hack_Ogre64; - else if (strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != nullptr) - config.generalEmulation.hacks |= hack_noDepthFrameBuffers; - else if (strstr(RSP.romname, (const char *)"ROADSTERS TROPHY") != nullptr) - config.generalEmulation.hacks |= hack_noDepthFrameBuffers; - else if (strstr(RSP.romname, (const char *)"VIGILANTE 8") != nullptr) - config.generalEmulation.hacks |= hack_noDepthFrameBuffers; - else if (strstr(RSP.romname, (const char *)"CONKER BFD") != nullptr) - config.generalEmulation.hacks |= hack_blurPauseScreen | hack_rectDepthBufferCopyCBFD; - else if (strstr(RSP.romname, (const char *)"MICKEY USA") != nullptr) - config.generalEmulation.hacks |= hack_blurPauseScreen; - else if (strstr(RSP.romname, (const char *)"GOLDENEYE") != nullptr) - config.generalEmulation.hacks |= hack_clearAloneDepthBuffer; - else if (strstr(RSP.romname, (const char *)"STARCRAFT 64") != nullptr) - config.generalEmulation.hacks |= hack_StarCraftBackgrounds; - else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != nullptr || - strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != nullptr) - config.generalEmulation.hacks |= hack_subscreen | hack_ZeldaMonochrome; - else if (strstr(RSP.romname, (const char *)"DOUBUTSUNOMORI") != nullptr || - strstr(RSP.romname, (const char *)"ANIMAL FOREST") != nullptr) - config.generalEmulation.hacks |= hack_subscreen; - else if (strstr(RSP.romname, (const char *)"Lode Runner 3D") != nullptr) - config.generalEmulation.hacks |= hack_LodeRunner; - else if (strstr(RSP.romname, (const char *)"Blast") != nullptr) - config.generalEmulation.hacks |= hack_blastCorps; - else if (strstr(RSP.romname, (const char *)"MASK") != nullptr) // Zelda MM - config.generalEmulation.hacks |= hack_ZeldaMonochrome | hack_ZeldaMM; - else if (strstr(RSP.romname, (const char *)"Perfect Dark") != nullptr || - strstr(RSP.romname, (const char *)"PERFECT DARK") != nullptr) - config.generalEmulation.hacks |= hack_rectDepthBufferCopyPD | hack_clearAloneDepthBuffer; - else if (strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != nullptr) - config.generalEmulation.hacks |= hack_ModifyVertexXyInShader; - else if (strstr(RSP.romname, (const char *)"RAT ATTACK") != nullptr) - config.generalEmulation.hacks |= hack_ModifyVertexXyInShader; - else if (strstr(RSP.romname, (const char *)"Quake") != nullptr) - config.generalEmulation.hacks |= hack_doNotResetOtherModeH|hack_doNotResetOtherModeL; - else if (strstr(RSP.romname, (const char *)"QUAKE II") != nullptr || - strstr(RSP.romname, (const char *)"GAUNTLET LEGENDS") != nullptr) - config.generalEmulation.hacks |= hack_doNotResetOtherModeH; - else if (strstr(RSP.romname, (const char *)"quarterback_club_98") != nullptr) - config.generalEmulation.hacks |= hack_LoadDepthTextures; - else if (strstr(RSP.romname, (const char *)"WIN BACK") != nullptr || - strstr(RSP.romname, (const char *)"OPERATION WINBACK") != nullptr) - config.generalEmulation.hacks |= hack_WinBack; - else if (strstr(RSP.romname, (const char *)"POKEMON SNAP") != nullptr) - config.generalEmulation.hacks |= hack_Snap; - else if (strstr(RSP.romname, (const char *)"MARIOKART64") != nullptr) - config.generalEmulation.hacks |= hack_MK64; - else if (strstr(RSP.romname, (const char *)"Resident Evil II") || - strstr(RSP.romname, (const char *)"BioHazard II")) - config.generalEmulation.hacks |= hack_RE2 | hack_ModifyVertexXyInShader | hack_LoadDepthTextures; - else if (strstr(RSP.romname, (const char *)"THPS") != nullptr) - config.generalEmulation.hacks |= hack_TonyHawk; - else if (strstr(RSP.romname, (const char *)"NITRO64") != nullptr) - config.generalEmulation.hacks |= hack_WCWNitro; - - api().FindPluginPath(RSP.pluginpath); - - RSP_SetDefaultState(); -} diff --git a/GLideN64/src/RSP.h b/GLideN64/src/RSP.h deleted file mode 100644 index d9c5801..0000000 --- a/GLideN64/src/RSP.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RSP_H -#define RSP_H - -#include "Types.h" -#include "N64.h" - -typedef struct -{ - u32 PC[18], PCi; - u32 F5DL[10]; - u32 uc_start, uc_dstart, cmd, nextCmd; - u32 w0, w1; - s32 count; - bool busy, halt, infloop; - bool LLE; - char romname[21]; - wchar_t pluginpath[PLUGIN_PATH_SIZE]; -} RSPInfo; - -extern RSPInfo RSP; - -extern u32 DepthClearColor; -extern u32 rectDepthBufferCopyFrame; - -#define RSP_SegmentToPhysical( segaddr ) ((gSP.segment[(segaddr >> 24) & 0x0F] + (segaddr & RDRAMSize)) & RDRAMSize) - -void RSP_Init(); -void RSP_ProcessDList(); -void RSP_LoadMatrix( f32 mtx[4][4], u32 address ); -void RSP_CheckDLCounter(); - -#endif diff --git a/GLideN64/src/RSP_LoadMatrix.cpp b/GLideN64/src/RSP_LoadMatrix.cpp deleted file mode 100644 index 90189c0..0000000 --- a/GLideN64/src/RSP_LoadMatrix.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "RSP.h" -#include "3DMath.h" - -void RSP_LoadMatrix( f32 mtx[4][4], u32 address ) -{ - struct _N64Matrix - { - s16 integer[4][4]; - u16 fraction[4][4]; - } *n64Mat = (struct _N64Matrix *)&RDRAM[address]; - - for (u32 i = 0; i < 4; i++) - for (u32 j = 0; j < 4; j++) - mtx[i][j] = GetFloatMatrixElement(n64Mat->integer[i][j ^ 1], n64Mat->fraction[i][j ^ 1]); -} diff --git a/GLideN64/src/RSP_LoadMatrixX86.cpp b/GLideN64/src/RSP_LoadMatrixX86.cpp deleted file mode 100644 index 2ee25ec..0000000 --- a/GLideN64/src/RSP_LoadMatrixX86.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include "RSP.h" -#include "GBI.h" - -void RSP_LoadMatrix( f32 mtx[4][4], u32 address ) -{ - f32 recip = FIXED2FLOATRECIP16; -#if defined (WIN32_ASM) - __asm { - mov esi, dword ptr [RDRAM]; - add esi, dword ptr [address]; - mov edi, dword ptr [mtx]; - - mov ecx, 4 -LoadLoop: - fild word ptr [esi+02h] - movzx eax, word ptr [esi+22h] - mov dword ptr [edi], eax - fild dword ptr [edi] - fmul dword ptr [recip] - fadd - fstp dword ptr [edi] - - fild word ptr [esi+00h] - movzx eax, word ptr [esi+20h] - mov dword ptr [edi+04h], eax - fild dword ptr [edi+04h] - fmul dword ptr [recip] - fadd - fstp dword ptr [edi+04h] - - fild word ptr [esi+06h] - movzx eax, word ptr [esi+26h] - mov dword ptr [edi+08h], eax - fild dword ptr [edi+08h] - fmul dword ptr [recip] - fadd - fstp dword ptr [edi+08h] - - fild word ptr [esi+04h] - movzx eax, word ptr [esi+24h] - mov dword ptr [edi+0Ch], eax - fild dword ptr [edi+0Ch] - fmul dword ptr [recip] - fadd - fstp dword ptr [edi+0Ch] - - add esi, 08h - add edi, 10h - loop LoadLoop - } -#else // WIN32_ASM - __asm__ __volatile__( - ".intel_syntax noprefix" "\n\t" - "LoadLoop:" "\n\t" - " fild word ptr [esi+0x02]" "\n\t" - " movzx eax, word ptr [esi+0x22]" "\n\t" - " mov dword ptr [edi], eax" "\n\t" - " fild dword ptr [edi]" "\n\t" - " fmul %0" "\n\t" - " fadd" "\n\t" - " fstp dword ptr [edi]" "\n\t" - - " fild word ptr [esi+0x00]" "\n\t" - " movzx eax, word ptr [esi+0x20]" "\n\t" - " mov dword ptr [edi+0x04], eax" "\n\t" - " fild dword ptr [edi+0x04]" "\n\t" - " fmul %0" "\n\t" - " fadd" "\n\t" - " fstp dword ptr [edi+0x04]" "\n\t" - - " fild word ptr [esi+0x06]" "\n\t" - " movzx eax, word ptr [esi+0x26]" "\n\t" - " mov dword ptr [edi+0x08], eax" "\n\t" - " fild dword ptr [edi+0x08]" "\n\t" - " fmul %0" "\n\t" - " fadd" "\n\t" - " fstp dword ptr [edi+0x08]" "\n\t" - - " fild word ptr [esi+0x04]" "\n\t" - " movzx eax, word ptr [esi+0x24]" "\n\t" - " mov dword ptr [edi+0x0C], eax" "\n\t" - " fild dword ptr [edi+0x0C]" "\n\t" - " fmul %0" "\n\t" - " fadd" "\n\t" - " fstp dword ptr [edi+0x0C]" "\n\t" - - " add esi, 0x08" "\n\t" - " add edi, 0x10" "\n\t" - " loop LoadLoop" "\n\t" - ".att_syntax prefix" "\n\t" - : /* no output */ - : "f"(recip), "S"((intptr_t)RDRAM+address), "D"(mtx), "c"(4) - : "memory" ); -#endif // WIN32_ASM -} diff --git a/GLideN64/src/SoftwareRender.cpp b/GLideN64/src/SoftwareRender.cpp deleted file mode 100644 index 0a00632..0000000 --- a/GLideN64/src/SoftwareRender.cpp +++ /dev/null @@ -1,458 +0,0 @@ -#include -#include -#include -#include "DepthBufferRender/ClipPolygon.h" -#include "DepthBufferRender/DepthBufferRender.h" -#include "gSP.h" -#include "RSP.h" -#include "SoftwareRender.h" -#include "DepthBuffer.h" -#include "Config.h" - -static -bool calcScreenCoordinates(const SPVertex** _vsrc, vertexclip * _vclip, u32 _numVertex, bool & _clockwise) -{ - const f32 ySign = GBI.isNegativeY() ? -1.0f : 1.0f; - for (u32 i = 0; i < _numVertex; ++i) { - const SPVertex& v = *_vsrc[i]; - - if ((v.modify & MODIFY_XY) == 0) { - _vclip[i].x = gSP.viewport.vtrans[0] + (v.x / v.w) * gSP.viewport.vscale[0]; - _vclip[i].y = gSP.viewport.vtrans[1] + (v.y / v.w) * gSP.viewport.vscale[1] * ySign; - } else { - _vclip[i].x = v.x; - _vclip[i].y = v.y; - } - - if ((v.modify & MODIFY_Z) == 0) { - _vclip[i].z = (gSP.viewport.vtrans[2] + (v.z / v.w) * gSP.viewport.vscale[2]) * 32767.0f; - } else { - _vclip[i].z = v.z * 32767.0f; - } - } - - // Check culling - const float x1 = _vclip[0].x - _vclip[1].x; - const float y1 = _vclip[0].y - _vclip[1].y; - const float x2 = _vclip[2].x - _vclip[1].x; - const float y2 = _vclip[2].y - _vclip[1].y; - - _clockwise = ((x1 * y2 - y1 * x2) * ySign < 0.0f); - - const u32 cullMode = (gSP.geometryMode & G_CULL_BOTH); - if (cullMode == G_CULL_BOTH && GBI.isCullBoth()) { - // Cull front and back - return false; - } else if (cullMode == G_CULL_FRONT) { - if (_clockwise) //clockwise, negative - return false; - } else if (cullMode == G_CULL_BACK) { - if (!_clockwise) //counter-clockwise, positive - return false; - } - - return true; -} - -inline -void clipTest(vertexclip & _vtx) -{ - _vtx.clip = 0; - if (_vtx.x > gSP.viewport.width) - _vtx.clip |= RIGHT; - if (_vtx.x < 0) - _vtx.clip |= LEFT; - if (_vtx.y > gSP.viewport.height) - _vtx.clip |= TOP; - if (_vtx.y < 0) - _vtx.clip |= BOT; - if (_vtx.clip != 0) - int t = 0; -} - -bool calcScreenCoordinates(const SPVertex * _vsrc, vertexclip * _vclip, size_t _numVertex, bool _cull, bool & _clockwise) -{ - const f32 ySign = GBI.isNegativeY() ? -1.0f : 1.0f; - for (u32 i = 0; i < _numVertex; ++i) { - const SPVertex & v = _vsrc[i]; - - if ((v.modify & MODIFY_XY) == 0) { - _vclip[i].x = gSP.viewport.vtrans[0] + (v.x / v.w) * gSP.viewport.vscale[0]; - _vclip[i].y = gSP.viewport.vtrans[1] + (v.y / v.w) * gSP.viewport.vscale[1] * ySign; - } else { - _vclip[i].x = v.x; - _vclip[i].y = v.y; - } - - if ((v.modify & MODIFY_Z) == 0) { - _vclip[i].z = (gSP.viewport.vtrans[2] + (v.z / v.w) * gSP.viewport.vscale[2]) * 32767.0f; - } else { - _vclip[i].z = v.z * 32767.0f; - } - - clipTest(_vclip[i]); - } - - if (!_cull) - return true; - - // Check culling - const float x1 = _vclip[0].x - _vclip[1].x; - const float y1 = _vclip[0].y - _vclip[1].y; - const float x2 = _vclip[2].x - _vclip[1].x; - const float y2 = _vclip[2].y - _vclip[1].y; - - _clockwise = ((x1 * y2 - y1 * x2) * ySign < 0.0f); - - const u32 cullMode = (gSP.geometryMode & G_CULL_BOTH); - if (cullMode == G_CULL_BOTH && GBI.isCullBoth()) { - // Cull front and back - return false; - } else if (cullMode == G_CULL_FRONT) { - if (_clockwise) //clockwise, negative - return false; - } else if (cullMode == G_CULL_BACK) { - if (!_clockwise) //counter-clockwise, positive - return false; - } - - return true; -} - -static -bool isClockwise(const SPVertex ** _vsrc) -{ - // Check culling - const float x1 = _vsrc[0]->x - _vsrc[1]->x; - const float y1 = _vsrc[0]->y - _vsrc[1]->y; - const float x2 = _vsrc[2]->x - _vsrc[1]->x; - const float y2 = _vsrc[2]->y - _vsrc[1]->y; - - return (x1*y2 - y1 * x2) >= 0.0f; -} - - -inline -int floatToFixed16(double _v) -{ - return static_cast(_v * 65536.0); -} - -static -int calcDzDx(const vertexclip* _v) -{ - double X0 = _v[0].x; - double Y0 = _v[0].y; - double X1 = _v[1].x; - double Y1 = _v[1].y; - double X2 = _v[2].x; - double Y2 = _v[2].y; - double diffy_02 = Y0 - Y2; - double diffy_12 = Y1 - Y2; - double diffx_02 = X0 - X2; - double diffx_12 = X1 - X2; - - double denom = (diffx_02 * diffy_12 - diffx_12 * diffy_02); - if(denom*denom > 0.0) { - double diffz_02 = _v[0].z - _v[2].z; - double diffz_12 = _v[1].z - _v[2].z; - double fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom; - return floatToFixed16(fdzdx); - } - return 0; -} - -static -int calcDzDx(const SPVertex ** _v) -{ - double X0 = _v[0]->x; - double Y0 = _v[0]->y; - double X1 = _v[1]->x; - double Y1 = _v[1]->y; - double X2 = _v[2]->x; - double Y2 = _v[2]->y; - double diffy_02 = Y0 - Y2; - double diffy_12 = Y1 - Y2; - double diffx_02 = X0 - X2; - double diffx_12 = X1 - X2; - - double denom = (diffx_02 * diffy_12 - diffx_12 * diffy_02); - if (denom*denom > 0.0) { - double diffz_02 = _v[0]->z - _v[2]->z; - double diffz_12 = _v[1]->z - _v[2]->z; - double fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom; - return floatToFixed16(fdzdx); - } - return 0; -} - -static -int calcDzDx2(const SPVertex ** _vsrc) -{ - const SPVertex * v = _vsrc[0]; - double X0 = gSP.viewport.vtrans[0] + (v->x / v->w) * gSP.viewport.vscale[0]; - double Y0 = gSP.viewport.vtrans[1] + (v->y / v->w) * -gSP.viewport.vscale[1]; - double Z0 = (gSP.viewport.vtrans[2] + (v->z / v->w) * gSP.viewport.vscale[2]) * 32767.0f; - v = _vsrc[1]; - double X1 = gSP.viewport.vtrans[0] + (v->x / v->w) * gSP.viewport.vscale[0]; - double Y1 = gSP.viewport.vtrans[1] + (v->y / v->w) * -gSP.viewport.vscale[1]; - double Z1 = (gSP.viewport.vtrans[2] + (v->z / v->w) * gSP.viewport.vscale[2]) * 32767.0f; - v = _vsrc[2]; - double X2 = gSP.viewport.vtrans[0] + (v->x / v->w) * gSP.viewport.vscale[0]; - double Y2 = gSP.viewport.vtrans[1] + (v->y / v->w) * -gSP.viewport.vscale[1]; - double Z2 = (gSP.viewport.vtrans[2] + (v->z / v->w) * gSP.viewport.vscale[2]) * 32767.0f; - double diffy_02 = Y0 - Y2; - double diffy_12 = Y1 - Y2; - double diffx_02 = X0 - X2; - double diffx_12 = X1 - X2; - - double denom = (diffx_02 * diffy_12 - diffx_12 * diffy_02); - if (denom*denom > 0.0) { - double diffz_02 = Z0 - Z2; - double diffz_12 = Z1 - Z2; - double fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom; - return floatToFixed16(fdzdx); - } - return 0; -} - -f32 renderScreenSpaceTriangles(const SPVertex *_pVertices, u32 _numElements) -{ - vertexi vdraw[3]; - const SPVertex * vsrc[3]; - f32 maxY = 0.0f; - const bool needResterise = (depthBufferList().getCurrent() != nullptr && - config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender && - gDP.otherMode.depthUpdate != 0); - - for (u32 i = 0; i < _numElements; i += 3) { - for (u32 j = 0; j < 3; ++j) { - vsrc[j] = &_pVertices[i + j]; - } - - if (isClockwise(vsrc)) { - for (int k = 0; k < 3; ++k) { - maxY = std::max(maxY, vsrc[k]->y); - vdraw[k].x = floatToFixed16(vsrc[k]->x); - vdraw[k].y = floatToFixed16(vsrc[k]->y); - vdraw[k].z = floatToFixed16(vsrc[k]->z); - } - } else { - for (int k = 0; k < 3; ++k) { - const u32 idx = 3 - k - 1; - maxY = std::max(maxY, vsrc[idx]->y); - vdraw[k].x = floatToFixed16(vsrc[idx]->x); - vdraw[k].y = floatToFixed16(vsrc[idx]->y); - vdraw[k].z = floatToFixed16(vsrc[idx]->z); - } - } - - //Current depth buffer can be null if we are loading from a save state - if (needResterise) { - const int dzdx = calcDzDx(vsrc); - Rasterize(vdraw, 3, dzdx); - } - } - return maxY; -} - -f32 renderTriangles(const SPVertex * _pVertices, const u16 * _pElements, u32 _numElements) -{ - vertexclip vclip[16]; - vertexi vdraw[12]; - const SPVertex * vsrc[4]; - SPVertex vdata[6]; - f32 maxY = 0.0f; - //Current depth buffer can be null if we are loading from a save state - const bool needResterise = (depthBufferList().getCurrent() != nullptr && - config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender && - gDP.otherMode.depthUpdate != 0); - - for (u32 i = 0; i < _numElements; i += 3) { - u32 orbits = 0; - if (_pElements != nullptr) { - for (u32 j = 0; j < 3; ++j) { - vsrc[j] = &_pVertices[_pElements[i + j]]; - orbits |= vsrc[j]->clip; - } - } else { - for (u32 j = 0; j < 3; ++j) { - vsrc[j] = &_pVertices[i + j]; - orbits |= vsrc[j]->clip; - } - } - vsrc[3] = vsrc[0]; - - u32 numVertex = clipW(vsrc, vdata); - - const bool wClipped = (orbits & CLIP_W) != 0; - bool clockwise = true; - if (!calcScreenCoordinates(vdata, vclip, numVertex, !wClipped, clockwise)) - continue; - - if (orbits == 0) { - assert(numVertex == 3); - if (clockwise) { - for (int k = 0; k < 3; ++k) { - maxY = std::max(maxY, vclip[k].y); - vdraw[k].x = floatToFixed16(vclip[k].x); - vdraw[k].y = floatToFixed16(vclip[k].y); - vdraw[k].z = floatToFixed16(vclip[k].z); - } - } else { - for (int k = 0; k < 3; ++k) { - const u32 idx = 3 - k - 1; - maxY = std::max(maxY, vclip[idx].y); - vdraw[k].x = floatToFixed16(vclip[idx].x); - vdraw[k].y = floatToFixed16(vclip[idx].y); - vdraw[k].z = floatToFixed16(vclip[idx].z); - } - } - } else { - vertexclip ** vtx; - numVertex = clipInScreenSpace(&vtx, vclip, numVertex); - if (numVertex < 3) - continue; - - if (clockwise) { - for (u32 k = 0; k < numVertex; ++k) { - maxY = std::max(maxY, vtx[k]->y); - vdraw[k].x = floatToFixed16(vtx[k]->x); - vdraw[k].y = floatToFixed16(vtx[k]->y); - vdraw[k].z = floatToFixed16(vtx[k]->z); - } - } else { - for (u32 k = 0; k < numVertex; ++k) { - const u32 idx = numVertex - k - 1; - maxY = std::max(maxY, vtx[idx]->y); - vdraw[k].x = floatToFixed16(vtx[idx]->x); - vdraw[k].y = floatToFixed16(vtx[idx]->y); - vdraw[k].z = floatToFixed16(vtx[idx]->z); - } - } - } - - if (needResterise) { - const int dzdx = !wClipped ? calcDzDx(vclip) : calcDzDx2(vsrc); - Rasterize(vdraw, numVertex, dzdx); - } - } - return maxY; -} - -f32 renderAndDrawTriangles(const SPVertex *_pVertices, - const u16 *_pElements, - u32 _numElements, - bool _flatColors, - GraphicsDrawer::Statistics & _statistics) -{ - f32 maxY = 0.0f; - std::vector vResult; - vResult.reserve(_numElements * 3); - - //Current depth buffer can be null if we are loading from a save state - const bool needResterise = (depthBufferList().getCurrent() != nullptr && - config.frameBufferEmulation.copyDepthToRDRAM == Config::cdSoftwareRender && - gDP.otherMode.depthUpdate != 0); - - auto rasterise = [&maxY](const vertexclip* pVtxClip, bool clockwise) - { - int dzdx = calcDzDx(pVtxClip); - vertexi vdraw[3]; - for (u32 k = 0; k < 3; ++k) { - const u32 idx = clockwise ? k : 3 - k - 1; - maxY = std::max(maxY, pVtxClip[idx].y); - vdraw[k].x = floatToFixed16(pVtxClip[idx].x); - vdraw[k].y = floatToFixed16(pVtxClip[idx].y); - vdraw[k].z = floatToFixed16(pVtxClip[idx].z); - } - Rasterize(vdraw, 3, dzdx); - }; - - for (u32 i = 0; i < _numElements; i += 3) { - u32 orbits = 0; - u32 modify = 0; - const SPVertex* vsrc[3]; - for (u32 j = 0; j < 3; ++j) { - vsrc[j] = _pElements != nullptr ? &_pVertices[_pElements[i + j]] : &_pVertices[i + j]; - orbits |= vsrc[j]->clip; - modify |= vsrc[j]->modify & (MODIFY_XY | MODIFY_Z); - } - - if (orbits == 0) { - // No clipping is necessary. - vertexclip vclip[3]; - bool clockwise = true; - if (!calcScreenCoordinates(vsrc, vclip, 3, clockwise)) { - // Culled - _statistics.drawnTris--; - _statistics.culledTris++; - continue; - } - - // Copy vertices to result - for (u32 k = 0; k < 3; ++k) { - vResult.push_back(*vsrc[k]); - SPVertex& v = vResult.back(); - v.bc0 = (k % 3 == 0) ? 1.0f : 0.0f; - v.bc1 = (k % 3 == 1) ? 1.0f : 0.0f; - } - - if (needResterise) - rasterise(vclip, clockwise); - else { - for (u32 k = 0; k < 3; ++k) - maxY = std::max(maxY, vclip[k].y); - } - } else { - assert(modify == 0); - // No screen space coordinates, so use clipping in homogeneous space. - SPVertex vCopy[3]; - for (u32 k = 0; k < 3; ++k) { - SPVertex& v = vCopy[k]; - v = *vsrc[k]; - v.bc0 = (k % 3 == 0) ? 1.0f : 0.0f; - v.bc1 = (k % 3 == 1) ? 1.0f : 0.0f; - } - auto prevNumVtx = vResult.size(); - clipInHomogeneousSpace(vCopy, vResult); - const size_t numVertex = vResult.size() - prevNumVtx; - if (numVertex == 0) { - _statistics.drawnTris--; - _statistics.clippedTris++; - continue; - } - - std::vector vclip(numVertex); - const bool cull = ((orbits & CLIP_W) == 0); - bool clockwise = true; - if (!calcScreenCoordinates(vResult.data() + prevNumVtx, vclip.data(), numVertex, cull, clockwise)) { - vResult.resize(prevNumVtx); - _statistics.drawnTris--; - _statistics.culledTris++; - continue; - } - - if (needResterise) { - for (size_t l = 0; l < numVertex; l += 3) - rasterise(vclip.data() + l, clockwise); - } else { - for (const vertexclip& v : vclip) - maxY = std::max(maxY, v.y); - } - } - } - - if (!vResult.empty()) { - vResult[0].HWLight = _pVertices[0].HWLight; - graphics::Context::DrawTriangleParameters triParams; - triParams.mode = graphics::drawmode::TRIANGLES; - triParams.flatColors = _flatColors; - triParams.combiner = currentCombiner(); - triParams.verticesCount = static_cast(vResult.size()); - triParams.vertices = vResult.data(); - gfxContext.drawTriangles(triParams); - } - - return maxY; -} diff --git a/GLideN64/src/SoftwareRender.h b/GLideN64/src/SoftwareRender.h deleted file mode 100644 index 5d09317..0000000 --- a/GLideN64/src/SoftwareRender.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SOFTWARE_RENDER_H -#define SOFTWARE_RENDER_H - -#include "gSP.h" -#include "GraphicsDrawer.h" -#include "Graphics/Context.h" - -/* Software render triangles to N64 depth buffer -* Coordinates of vertices must be in screen space. -* No coordinate clipping applied. -* Return max vertex Y. -*/ -f32 renderScreenSpaceTriangles(const SPVertex *_pVertices, u32 _numElements); - -/* Software render triangles to N64 depth buffer -* Coordinates of vertices can be in screen space or in homogeneous space -* Return max vertex Y. -*/ -f32 renderTriangles(const SPVertex *_pVertices, const u16 *_pElements, u32 _numElements); - -/* Software render triangles to N64 depth buffer and draw them with GPU -* Software clipping is used before rendering and drawing. -* Return max vertex Y. -*/ -f32 renderAndDrawTriangles(const SPVertex *_pVertices, - const u16 *_pElements, - u32 _numElements, - bool _flatColors, - GraphicsDrawer::Statistics & _statistics); - -#endif // SOFTWARE_RENDER_H diff --git a/GLideN64/src/TexrectDrawer.cpp b/GLideN64/src/TexrectDrawer.cpp deleted file mode 100644 index cde7443..0000000 --- a/GLideN64/src/TexrectDrawer.cpp +++ /dev/null @@ -1,489 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "Config.h" -#include "DisplayWindow.h" -#include "Textures.h" -#include "RDP.h" -#include "RSP.h" -#include "VI.h" -#include "FrameBuffer.h" -#include "TexrectDrawer.h" - -using namespace graphics; - -TexrectDrawer::TexrectDrawer() -: m_numRects(0) -, m_otherMode(0) -, m_mux(0) -, m_ulx(0) -, m_lrx(0) -, m_uly(0) -, m_lry(0) -, m_ulx_i(0) -, m_uly_i(0) -, m_lry_i(0) -, m_Z(0) -, m_max_lrx(0) -, m_max_lry(0) -, m_scissor(gDPScissor()) -, m_pTexture(nullptr) -, m_pBuffer(nullptr) -{} - -void TexrectDrawer::init() -{ - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - m_FBO = gfxContext.createFramebuffer(); - - m_pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pTexture->format = G_IM_FMT_RGBA; - m_pTexture->clampS = 1; - m_pTexture->clampT = 1; - m_pTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pTexture->maskS = 0; - m_pTexture->maskT = 0; - m_pTexture->mirrorS = 0; - m_pTexture->mirrorT = 0; - m_pTexture->width = 640; - m_pTexture->height = 580; - m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.colorFormatBytes; - - Context::InitTextureParams initParams; - initParams.handle = m_pTexture->name; - initParams.textureUnitIndex = textureIndices::Tex[0]; - initParams.width = m_pTexture->width; - initParams.height = m_pTexture->height; - initParams.internalFormat = fbTexFormats.colorInternalFormat; - initParams.format = fbTexFormats.colorFormat; - initParams.dataType = fbTexFormats.colorType; - gfxContext.init2DTexture(initParams); - - Context::TexParameters texParams; - texParams.handle = m_pTexture->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[0]; - texParams.minFilter = textureParameters::FILTER_LINEAR; - texParams.magFilter = textureParameters::FILTER_LINEAR; - gfxContext.setTextureParameters(texParams); - - - Context::FrameBufferRenderTarget bufTarget; - bufTarget.bufferHandle = m_FBO; - bufTarget.bufferTarget = bufferTarget::DRAW_FRAMEBUFFER; - bufTarget.attachment = bufferAttachment::COLOR_ATTACHMENT0; - bufTarget.textureTarget = textureTarget::TEXTURE_2D; - bufTarget.textureHandle = m_pTexture->name; - gfxContext.addFrameBufferRenderTarget(bufTarget); - - // check if everything is OK - assert(!gfxContext.isFramebufferError()); - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - m_programTex.reset(gfxContext.createTexrectDrawerDrawShader()); - m_programClear.reset(gfxContext.createTexrectDrawerClearShader()); - m_programTex->setTextureSize(m_pTexture->width, m_pTexture->height); - - m_vecRectCoords.reserve(256); -} - -void TexrectDrawer::destroy() -{ - gfxContext.deleteFramebuffer(m_FBO); - if (m_pTexture != nullptr) { - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = nullptr; - } - m_programTex.reset(); - m_programClear.reset(); -} - -void TexrectDrawer::_setViewport() const -{ - dwnd().getDrawer()._updateViewport(nullptr, 1.0f); -} - -void TexrectDrawer::_setDrawBuffer() -{ - if (m_pBuffer != nullptr) - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pBuffer->m_FBO); - else - frameBufferList().setCurrentDrawBuffer(); -} - -TexrectDrawer::iRect TexrectDrawer::_getiRect(u32 w0, u32 w1) const -{ - iRect rect; - rect.ulx = _SHIFTR(w1, 12, 12); - rect.uly = _SHIFTR(w1, 0, 12); - rect.lrx = _SHIFTR(w0, 12, 12); - rect.lry = _SHIFTR(w0, 0, 12); - return rect; -} - -#define COMPARE_COORDS(a, b) std::abs(a - b) <= 4 - -bool TexrectDrawer::_lookAhead(bool _checkCoordinates) const -{ - if (config.graphics2D.enableNativeResTexrects != Config::NativeResTexrectsMode::ntOptimized) - return true; - if (RSP.LLE) - return true; - switch (GBI.getMicrocodeType()) { - case Turbo3D: - case T3DUX: - case F5Rogue: - case F5Indi_Naboo: - return true; - } - - auto sideBySide = [&](u32 pc) ->bool { - const u32 w0 = *(u32*)&RDRAM[pc]; - const u32 w1 = *(u32*)&RDRAM[pc + 4]; - const iRect nextRect = _getiRect(w0, w1); - - if (COMPARE_COORDS(m_curRect.ulx, nextRect.ulx)) { - bool sbs = COMPARE_COORDS(m_curRect.lry, nextRect.uly); - sbs |= COMPARE_COORDS(m_curRect.uly, nextRect.lry); - return sbs; - } - if (COMPARE_COORDS(m_curRect.uly, nextRect.uly)) { - bool sbs = COMPARE_COORDS(m_curRect.lrx, nextRect.ulx); - sbs |= COMPARE_COORDS(m_curRect.ulx, nextRect.lrx); - return sbs; - } - return false; - }; - - u32 pc = RSP.PC[RSP.PCi]; - while (true) { - switch (_SHIFTR(*(u32*)&RDRAM[pc], 24, 8)) { - case G_RDPLOADSYNC: - case G_RDPPIPESYNC: - case G_RDPTILESYNC: - case G_LOADTLUT: - case G_SETTILESIZE: - case G_LOADBLOCK: - case G_LOADTILE: - case G_SETTILE: - case G_SETTIMG: - break; - case G_TEXRECT: - case G_TEXRECTFLIP: - if (_checkCoordinates) - return sideBySide(pc); - return true; - default: - return false; - } - pc += 8; - } - return false; -} - -bool TexrectDrawer::addRect() -{ - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - RectVertex * pRect = drawer.m_rect; - - m_curRect = _getiRect(RDP.w0, RDP.w1); - - bool bDownUp = false; - if (m_numRects != 0) { - bool bContinue = false; - if (m_otherMode == gDP.otherMode._u64 && m_mux == gDP.combine.mux) { - if (COMPARE_COORDS(m_ulx_i, m_curRect.ulx)) { - bContinue = COMPARE_COORDS(m_lry_i, m_curRect.uly); - bDownUp = COMPARE_COORDS(m_uly_i, m_curRect.lry); - bContinue |= bDownUp; - } - else { - for (auto iter = m_vecRectCoords.crbegin(); iter != m_vecRectCoords.crend(); ++iter) { - if (COMPARE_COORDS(iter->x, m_curRect.ulx) && COMPARE_COORDS(iter->y, m_curRect.uly)) { - bContinue = true; - break; - } - } - } - } - if (!bContinue) { - draw(); - drawer._updateStates(DrawingState::TexRect); - gfxContext.enable(enable::CULL_FACE, false); - } - } - - if (m_numRects == 0) { - if (!_lookAhead(true)) - return false; - - m_numRects = 1; - m_pBuffer = frameBufferList().getCurrent(); - m_otherMode = gDP.otherMode._u64; - m_mux = gDP.combine.mux; - m_Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f; - m_scissor = gDP.scissor; - - m_ulx = pRect[0].x; - m_uly = pRect[0].y; - m_lrx = m_max_lrx = pRect[3].x; - m_lry = m_max_lry = pRect[3].y; - - m_ulx_i = m_curRect.ulx; - m_uly_i = m_curRect.uly; - m_lry_i = m_curRect.lry; - - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.update(); - cmbInfo.updateParameters(); - gfxContext.enableDepthWrite(false); - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enable(enable::BLEND, false); - - _setViewport(); - - gfxContext.setScissor((s32)gDP.scissor.ulx, (s32)gDP.scissor.uly, (s32)(gDP.scissor.lrx - gDP.scissor.ulx), (s32)(gDP.scissor.lry - gDP.scissor.uly)); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_FBO); - } else { - ++m_numRects; - } - - if (bDownUp) { - m_ulx = pRect[0].x; - m_uly = pRect[0].y; - m_ulx_i = m_curRect.ulx; - m_uly_i = m_curRect.uly; - } else { - m_lrx = pRect[3].x; - m_lry = pRect[3].y; - m_max_lrx = std::max(m_max_lrx, m_lrx); - m_max_lry = std::max(m_max_lry, m_lry); - m_lry_i = m_curRect.lry; - } - - RectCoords coords; - coords.x = m_curRect.lrx; - coords.y = m_curRect.uly; - m_vecRectCoords.push_back(coords); - coords.x = m_curRect.lrx; - coords.y = m_curRect.lry; - m_vecRectCoords.push_back(coords); - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = pRect; - rectParams.combiner = currentCombiner(); - gfxContext.drawRects(rectParams); - - if (m_numRects > 1 && !_lookAhead(false)) - draw(); - - return true; -} - -void TexrectDrawer::addBackgroundRect() -{ - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - RectVertex * pRect = drawer.m_rect; - - if (m_numRects == 0) { - m_numRects = 1; - m_pBuffer = frameBufferList().getCurrent(); - m_otherMode = gDP.otherMode._u64; - m_mux = gDP.combine.mux; - m_Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz; - m_scissor = gDP.scissor; - - m_ulx = pRect[0].x; - m_uly = pRect[0].y; - m_lrx = m_max_lrx = pRect[3].x; - m_lry = m_max_lry = pRect[3].y; - - CombinerInfo & cmbInfo = CombinerInfo::get(); - cmbInfo.update(); - cmbInfo.updateParameters(); - gfxContext.enableDepthWrite(false); - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enable(enable::BLEND, false); - - _setViewport(); - - gfxContext.setScissor((s32)gDP.scissor.ulx, (s32)gDP.scissor.uly, (s32)(gDP.scissor.lrx - gDP.scissor.ulx), (s32)(gDP.scissor.lry - gDP.scissor.uly)); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_FBO); - } else { - ++m_numRects; - } - - m_lrx = pRect[3].x; - m_lry = pRect[3].y; - m_max_lrx = std::max(m_max_lrx, m_lrx); - m_max_lry = std::max(m_max_lry, m_lry); - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = pRect; - rectParams.combiner = currentCombiner(); - gfxContext.drawRects(rectParams); -} - -bool TexrectDrawer::draw() -{ - if (m_numRects == 0) - return false; - - ValueKeeper otherMode(gDP.otherMode._u64, m_otherMode); - ValueKeeper scissor(gDP.scissor, m_scissor); - DisplayWindow & wnd = dwnd(); - GraphicsDrawer & drawer = wnd.getDrawer(); - drawer.setBlendMode(); - gDP.changed |= CHANGED_RENDERMODE; // Force update of depth compare parameters - drawer._updateDepthCompare(); - - int enableAlphaTest = 0; - switch (gDP.otherMode.cycleType) { - case G_CYC_COPY: - if (gDP.otherMode.alphaCompare & G_AC_THRESHOLD) - enableAlphaTest = 1; - break; - case G_CYC_1CYCLE: - case G_CYC_2CYCLE: - if (((gDP.otherMode.alphaCompare & G_AC_THRESHOLD) != 0) && (gDP.otherMode.alphaCvgSel == 0) && (gDP.otherMode.forceBlender == 0 || gDP.blendColor.a > 0)) - enableAlphaTest = 1; - else if ((gDP.otherMode.alphaCompare == G_AC_DITHER) && (gDP.otherMode.alphaCvgSel == 0)) - enableAlphaTest = 1; - else if (gDP.otherMode.cvgXAlpha != 0) - enableAlphaTest = 1; - break; - } - - m_lrx = m_max_lrx; - m_lry = m_max_lry; - - RectVertex rect[4]; - - f32 scaleX, scaleY; - calcCoordsScales(m_pBuffer, scaleX, scaleY); - scaleX *= 2.0f; - scaleY *= 2.0f; - - const float s0 = m_ulx / (float)m_pTexture->width; // +0.5f / (float)m_pTexture->width; - const float t0 = m_lry / (float)m_pTexture->height;// +0.5f / (float)m_pTexture->height; - const float s1 = m_lrx / (float)m_pTexture->width; - const float t1 = m_uly / (float)m_pTexture->height; - const float W = 1.0f; - const float Z = m_Z; - constexpr float halfScreenSizeDims = SCREEN_SIZE_DIM * 0.5f; - - drawer._updateViewport(m_pBuffer); - - textureCache().activateTexture(0, m_pTexture); - // Disable filtering to avoid black outlines - Context::TexParameters texParams; - texParams.handle = m_pTexture->name; - texParams.target = textureTarget::TEXTURE_2D; - texParams.textureUnitIndex = textureIndices::Tex[0]; - texParams.minFilter = textureParameters::FILTER_NEAREST; - texParams.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(texParams); - - m_programTex->activate(); - m_programTex->setEnableAlphaTest(enableAlphaTest); - - float ulx = (m_ulx - halfScreenSizeDims) / halfScreenSizeDims; - float uly = (m_uly - halfScreenSizeDims) / halfScreenSizeDims; - float lrx = (m_lrx - halfScreenSizeDims) / halfScreenSizeDims; - float lry = (m_lry - halfScreenSizeDims) / halfScreenSizeDims; - - rect[0].x = ulx; - rect[0].y = lry; - rect[0].z = Z; - rect[0].w = W; - rect[0].s0 = s0; - rect[0].t0 = t0; - rect[1].x = lrx; - rect[1].y = lry; - rect[1].z = Z; - rect[1].w = W; - rect[1].s0 = s1; - rect[1].t0 = t0; - rect[2].x = ulx; - rect[2].y = uly; - rect[2].z = Z; - rect[2].w = W; - rect[2].s0 = s0; - rect[2].t0 = t1; - rect[3].x = lrx; - rect[3].y = uly; - rect[3].z = Z; - rect[3].w = W; - rect[3].s0 = s1; - rect[3].t0 = t1; - - drawer.updateScissor(m_pBuffer); - _setDrawBuffer(); - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLE_STRIP; - rectParams.verticesCount = 4; - rectParams.vertices = rect; - rectParams.combiner = m_programTex.get(); - gfxContext.drawRects(rectParams); - - gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_FBO); - m_programClear->activate(); - - ulx = (std::max(0.0f, m_ulx - 1.0f) - halfScreenSizeDims) / halfScreenSizeDims; - lrx = (std::min(640.0f, m_lrx + 1.0f) - halfScreenSizeDims) / halfScreenSizeDims; - rect[0].x = ulx; - rect[1].x = lrx; - rect[2].x = ulx; - rect[3].x = lrx; - - uly = (std::max(0.0f, m_uly - 1.0f) - halfScreenSizeDims) / halfScreenSizeDims; - lry = (std::min(580.0f, m_lry + 1.0f) - halfScreenSizeDims) / halfScreenSizeDims; - rect[0].y = uly; - rect[1].y = uly; - rect[2].y = lry; - rect[3].y = lry; - - _setViewport(); - - gfxContext.enable(enable::BLEND, false); - gfxContext.enable(enable::SCISSOR_TEST, false); - rectParams.combiner = m_programClear.get(); - gfxContext.drawRects(rectParams); - gfxContext.enable(enable::SCISSOR_TEST, true); - - m_pBuffer = frameBufferList().getCurrent(); - _setDrawBuffer(); - - m_numRects = 0; - m_vecRectCoords.clear(); - gDP.changed |= CHANGED_COMBINE | CHANGED_SCISSOR | CHANGED_RENDERMODE; - gSP.changed |= CHANGED_VIEWPORT | CHANGED_TEXTURE | CHANGED_GEOMETRYMODE; - - return true; -} - -bool TexrectDrawer::isEmpty() const -{ - return m_numRects == 0; -} - -bool TexrectDrawer::canContinue() const -{ - return (m_numRects != 0 && - m_otherMode == gDP.otherMode._u64 && - m_mux == gDP.combine.mux && - m_pBuffer == frameBufferList().getCurrent()); -} diff --git a/GLideN64/src/TexrectDrawer.h b/GLideN64/src/TexrectDrawer.h deleted file mode 100644 index e62ff60..0000000 --- a/GLideN64/src/TexrectDrawer.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef TEXRECTDRAWER_H -#define TEXRECTDRAWER_H - -#include -#include -#include "gDP.h" -#include "Graphics/ObjectHandle.h" -#include "Graphics/ShaderProgram.h" - -struct CachedTexture; -struct FrameBuffer; - -class TexrectDrawer -{ -public: - TexrectDrawer(); - - void init(); - void destroy(); - bool addRect(); - void addBackgroundRect(); - bool draw(); - bool isEmpty() const; - bool canContinue() const; - -private: - void _setViewport() const; - void _setDrawBuffer(); - bool _lookAhead(bool _checkCoordinates) const; - - u32 m_numRects; - u64 m_otherMode; - u64 m_mux; - f32 m_ulx, m_lrx, m_uly, m_lry, m_Z; - s32 m_ulx_i, m_uly_i, m_lry_i; - f32 m_max_lrx, m_max_lry; - graphics::ObjectHandle m_FBO; - gDPScissor m_scissor; - CachedTexture * m_pTexture; - FrameBuffer * m_pBuffer; - std::unique_ptr m_programTex; - std::unique_ptr m_programClear; - - struct RectCoords { - s32 x, y; - }; - std::vector m_vecRectCoords; - - struct iRect { - s32 ulx = 0, uly = 0, lrx = 0, lry = 0; - }; - iRect _getiRect(u32 w0, u32 w1) const; - iRect m_curRect; -}; - -#endif // TEXRECTDRAWER_H diff --git a/GLideN64/src/TextDrawer.cpp b/GLideN64/src/TextDrawer.cpp deleted file mode 100644 index c5b39dd..0000000 --- a/GLideN64/src/TextDrawer.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/* Draw text on screen. - * Requires freetype library. - * Code is taken from "OpenGL source examples from the OpenGL Programming wikibook: - * http://en.wikibooks.org/wiki/OpenGL_Programming" - */ - -#include -#include -#include -#include -#include - -#include -#include FT_FREETYPE_H - -#include "Platform.h" -#include "DisplayWindow.h" -#include "GraphicsDrawer.h" -#include "Textures.h" -#include "Config.h" -#include "Log.h" - -#include "Graphics/Context.h" -#include "Graphics/Parameters.h" - -#include "TextDrawer.h" - -#include - -#ifdef MUPENPLUSAPI -#include "mupenplus/GLideN64_mupenplus.h" -#endif - -using namespace graphics; - -// Maximum texture width -#define MAXWIDTH 1024 - -TextDrawer g_textDrawer; - -/** - * The atlas struct holds a texture that contains the visible US-ASCII characters - * of a certain font rendered with a certain character height. - * It also contains an array that contains all the information necessary to - * generate the appropriate vertex and texture coordinates for each character. - * - * After the constructor is run, you don't need to use any FreeType functions anymore. - */ -struct Atlas { - CachedTexture * m_pTexture; // texture object - - int w; // width of texture in pixels - int h; // height of texture in pixels - - struct { - float ax; // advance.x - float ay; // advance.y - - float bw; // bitmap.width; - float bh; // bitmap.height; - - float bl; // bitmap_left; - float bt; // bitmap_top; - - float tx; // x offset of glyph in texture coordinates - float ty; // y offset of glyph in texture coordinates - } c[128]; // character information - - Atlas(FT_Face face, int height) - { - FT_Set_Pixel_Sizes(face, 0, height); - FT_GlyphSlot g = face->glyph; - - int roww = 0; - int rowh = 0; - w = 0; - h = 0; - - memset(c, 0, sizeof c); - - /* Find minimum size for a texture holding all visible ASCII characters */ - for (int i = 32; i < 128; i++) { - if (FT_Load_Char(face, i, FT_LOAD_RENDER)) { - fprintf(stderr, "Loading character %c failed!\n", i); - continue; - } - if (roww + g->bitmap.width + 1 >= MAXWIDTH) { - w = std::max(w, roww); - h += rowh; - roww = 0; - rowh = 0; - } - roww += g->bitmap.width + 1; - rowh = std::max(rowh, (int)g->bitmap.rows); - } - - w = std::max(w, roww); - h += rowh; - - /* Create a texture that will be used to hold all ASCII glyphs */ - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - m_pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pTexture->format = G_IM_FMT_I; - m_pTexture->clampS = 1; - m_pTexture->clampT = 1; - m_pTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pTexture->maskS = 0; - m_pTexture->maskT = 0; - m_pTexture->mirrorS = 0; - m_pTexture->mirrorT = 0; - m_pTexture->width = w; - m_pTexture->height = h; - m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.noiseFormatBytes; - - Context::InitTextureParams initParams; - initParams.handle = m_pTexture->name; - initParams.textureUnitIndex = textureIndices::Tex[0]; - initParams.width = w; - initParams.height = h; - initParams.internalFormat = fbTexFormats.noiseInternalFormat; - initParams.format = fbTexFormats.noiseFormat; - initParams.dataType = fbTexFormats.noiseType; - gfxContext.init2DTexture(initParams); - - Context::TexParameters setParams; - setParams.handle = m_pTexture->name; - setParams.textureUnitIndex = textureIndices::Tex[0]; - setParams.target = textureTarget::TEXTURE_2D; - setParams.minFilter = textureParameters::FILTER_LINEAR; - setParams.magFilter = textureParameters::FILTER_LINEAR; - setParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - setParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - gfxContext.setTextureParameters(setParams); - - /* Paste all glyph bitmaps into the texture, remembering the offset */ - - /* We require 1 byte alignment when uploading texture data */ - const s32 curUnpackAlignment = gfxContext.getTextureUnpackAlignment(); - gfxContext.setTextureUnpackAlignment(1); - - Context::UpdateTextureDataParams updateParams; - updateParams.handle = m_pTexture->name; - updateParams.textureUnitIndex = textureIndices::Tex[0]; - updateParams.format = initParams.format; - updateParams.internalFormat = initParams.internalFormat; - updateParams.dataType = initParams.dataType; - - int ox = 0; - int oy = 0; - rowh = 0; - - for (int i = 32; i < 128; i++) { - if (FT_Load_Char(face, i, FT_LOAD_RENDER)) { - fprintf(stderr, "Loading character %c failed!\n", i); - continue; - } - - if (ox + g->bitmap.width + 1 >= MAXWIDTH) { - oy += rowh; - rowh = 0; - ox = 0; - } - - if (g->bitmap.buffer != nullptr) { - updateParams.x = ox; - updateParams.y = oy; - updateParams.width = g->bitmap.width; - updateParams.height = g->bitmap.rows; - updateParams.data = g->bitmap.buffer; - gfxContext.update2DTexture(updateParams); - } - - c[i].ax = _FIXED2FLOAT(g->advance.x, 6); - c[i].ay = _FIXED2FLOAT(g->advance.y, 6); - - c[i].bw = (float)g->bitmap.width; - c[i].bh = (float)g->bitmap.rows; - - c[i].bl = (float)g->bitmap_left; - c[i].bt = (float)g->bitmap_top; - - c[i].tx = ox / (float)w; - c[i].ty = oy / (float)h; - - rowh = std::max(rowh, (int)g->bitmap.rows); - ox += g->bitmap.width + 1; - } - - gfxContext.setTextureUnpackAlignment(curUnpackAlignment); - - LOG(LOG_VERBOSE, "Generated a %d x %d (%d kb) texture atlas", w, h, w * h / 1024); - } - - ~Atlas() { - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = nullptr; - } -}; - -static -bool getFontFileName(char * _strName) -{ -#ifdef OS_WINDOWS - char * pSysPath = getenv("WINDIR"); - if (pSysPath == nullptr) - return false; - sprintf(_strName, "%s/Fonts/%s", pSysPath, config.font.name.c_str()); -#elif defined (OS_ANDROID) - sprintf(_strName, "/system/fonts/%s", config.font.name.c_str()); -#elif defined (PANDORA) - sprintf(_strName, "/usr/share/fonts/truetype/%s", config.font.name.c_str()); -#else - sprintf(_strName, "/usr/share/fonts/truetype/freefont/%s", config.font.name.c_str()); -#endif - - // if the font name is a full path, use that instead - if (osal_path_existsA(config.font.name.c_str())) { - sprintf(_strName, "%s", config.font.name.c_str()); - } - -#ifdef MUPENPLUSAPI - if (!osal_path_existsA(_strName)) { - const char * fontPath = ConfigGetSharedDataFilepath("font.ttf"); - if (osal_path_existsA(fontPath)) - strncpy(_strName, fontPath, PLUGIN_PATH_SIZE); - } -#endif - return true; -} - -FT_Library g_ft; -FT_Face g_face; - -void TextDrawer::init() -{ - char strBuffer[PLUGIN_PATH_SIZE]; - const char *fontfilename; - if (getFontFileName(strBuffer)) - fontfilename = strBuffer; - else - return; - - /* Initialize the FreeType2 library */ - if (FT_Init_FreeType(&g_ft)) { - fprintf(stderr, "Could not init freetype library\n"); - return; - } - - /* Load a font */ - if (FT_New_Face(g_ft, fontfilename, 0, &g_face)) { - fprintf(stderr, "Could not open font %s\n", fontfilename); - return; - } - - /* Create texture atlas for selected font size */ - m_atlas.reset(new Atlas(g_face, config.font.size)); - - m_program.reset(gfxContext.createTextDrawerShader()); -} - -void TextDrawer::destroy() -{ - m_atlas.reset(); - m_program.reset(); - FT_Done_Face(g_face); - g_face = NULL; - FT_Done_FreeType(g_ft); - g_ft = NULL; -} - -/** - * Render text using the currently loaded font and currently set font size. - * Rendering starts at coordinates (x, y), z is always 0. - * The pixel coordinates that the FreeType2 library uses are scaled by (sx, sy). - */ -void TextDrawer::drawText(const char *_pText, float _x, float _y) const -{ - if (!m_atlas) - return; - - DisplayWindow & wnd = DisplayWindow::get(); - const float sx = 2.0f / wnd.getWidth(); - const float sy = 2.0f / wnd.getHeight(); - - const u8 *p; - - - std::vector coords; - coords.reserve(6 * strlen(_pText)); - - RectVertex rect; - rect.z = 0.0f; - rect.w = 1.0f; - - /* Loop through all characters */ - for (p = (const u8 *)_pText; *p; ++p) { - /* Calculate the vertex and texture coordinates */ - float x2 = _x + m_atlas->c[*p].bl * sx; - float y2 = -_y - m_atlas->c[*p].bt * sy; - float w = m_atlas->c[*p].bw * sx; - float h = m_atlas->c[*p].bh * sy; - - /* Advance the cursor to the start of the next character */ - _x += m_atlas->c[*p].ax * sx; - _y += m_atlas->c[*p].ay * sy; - - /* Skip glyphs that have no pixels */ - if (!w || !h) - continue; - - rect.x = x2; - rect.y = -y2; - rect.s0 = m_atlas->c[*p].tx; - rect.t0 = m_atlas->c[*p].ty; - coords.push_back(rect); - - rect.x = x2 + w; - rect.y = -y2; - rect.s0 = m_atlas->c[*p].tx + m_atlas->c[*p].bw / m_atlas->w; - rect.t0 = m_atlas->c[*p].ty; - coords.push_back(rect); - - rect.x = x2; - rect.y = -y2 - h; - rect.s0 = m_atlas->c[*p].tx; - rect.t0 = m_atlas->c[*p].ty + m_atlas->c[*p].bh / m_atlas->h; - coords.push_back(rect); - - rect.x = x2 + w; - rect.y = -y2; - rect.s0 = m_atlas->c[*p].tx + m_atlas->c[*p].bw / m_atlas->w; - rect.t0 = m_atlas->c[*p].ty; - coords.push_back(rect); - - rect.x = x2; - rect.y = -y2 - h; - rect.s0 = m_atlas->c[*p].tx; - rect.t0 = m_atlas->c[*p].ty + m_atlas->c[*p].bh / m_atlas->h; - coords.push_back(rect); - - rect.x = x2 + w; - rect.y = -y2 - h; - rect.s0 = m_atlas->c[*p].tx + m_atlas->c[*p].bw / m_atlas->w; - rect.t0 = m_atlas->c[*p].ty + m_atlas->c[*p].bh / m_atlas->h; - coords.push_back(rect); - } - - gfxContext.enable(enable::BLEND, true); - gfxContext.enable(enable::CULL_FACE, false); - gfxContext.enable(enable::DEPTH_TEST, false); - gfxContext.enableDepthWrite(false); - gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA); - m_program->activate(); - - const s32 X = (wnd.getScreenWidth() - wnd.getWidth()) / 2; - const s32 Y = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset(); - const s32 W = static_cast(wnd.getWidth()); - const s32 H = static_cast(wnd.getHeight()); - - gfxContext.setViewport(X, Y, W, H); - gfxContext.setScissor(X, Y, W, H); - - gSP.changed |= CHANGED_VIEWPORT; - gDP.changed |= CHANGED_SCISSOR; - - Context::TexParameters setParams; - setParams.handle = m_atlas->m_pTexture->name; - setParams.textureUnitIndex = textureIndices::Tex[0]; - setParams.target = textureTarget::TEXTURE_2D; - setParams.minFilter = textureParameters::FILTER_LINEAR; - setParams.magFilter = textureParameters::FILTER_LINEAR; - setParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - setParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - setParams.maxMipmapLevel = Parameter(0); - gfxContext.setTextureParameters(setParams); - - Context::DrawRectParameters rectParams; - rectParams.mode = drawmode::TRIANGLES; - rectParams.verticesCount = static_cast(coords.size()); - rectParams.vertices = coords.data(); - rectParams.combiner = m_program.get(); - gfxContext.drawRects(rectParams); -} - -void TextDrawer::getTextSize(const char *_pText, float & _w, float & _h) const -{ - _w = _h = 0; - if (!m_atlas) - return; - - DisplayWindow & wnd = DisplayWindow::get(); - const float sx = 2.0f / wnd.getWidth(); - const float sy = 2.0f / wnd.getHeight(); - float bw = 0, bh = 0; - - for (const u8 *p = (const u8 *)_pText; *p; ++p) { - bw = m_atlas->c[*p].bw * sx; - bh = std::max(bh, m_atlas->c[*p].bh * sy); - - _w += m_atlas->c[*p].ax * sx; -// _h += m_atlas->c[*p].ay * sy; - } - _w += bw; - _h += bh; -} - -void TextDrawer::setTextColor(float * _color) -{ - if (m_program) - m_program->setTextColor(_color); -} diff --git a/GLideN64/src/TextDrawer.h b/GLideN64/src/TextDrawer.h deleted file mode 100644 index 726172e..0000000 --- a/GLideN64/src/TextDrawer.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef TEXTDRAWER_H -#define TEXTDRAWER_H - -#include -#include "Graphics/ShaderProgram.h" -#include "Graphics/FramebufferTextureFormats.h" - -struct Atlas; - -class TextDrawer -{ -public: - void init(); - - void destroy(); - - void drawText(const char *_pText, float x, float y) const; - - void getTextSize(const char *_pText, float & _w, float & _h) const; - - void setTextColor(float * _color); - -private: - std::unique_ptr m_atlas; - std::unique_ptr m_program; -}; - -extern TextDrawer g_textDrawer; - -#endif // TEXTDRAWER_H diff --git a/GLideN64/src/TextDrawerStub.cpp b/GLideN64/src/TextDrawerStub.cpp deleted file mode 100644 index 4cf6358..0000000 --- a/GLideN64/src/TextDrawerStub.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* Stub for TextDrawer.h - * Use to replace remove freetype library requirement. - */ - -#include "TextDrawer.h" - -TextDrawer g_textDrawer; - -struct Atlas { -}; - -void TextDrawer::init() -{ -} - -void TextDrawer::destroy() -{ -} - -void TextDrawer::drawText(const char *_pText, float _x, float _y) const -{ -} - -void TextDrawer::getTextSize(const char *_pText, float & _w, float & _h) const -{ -} - -void TextDrawer::setTextColor(float * _color) -{ -} diff --git a/GLideN64/src/TextureFilterHandler.cpp b/GLideN64/src/TextureFilterHandler.cpp deleted file mode 100644 index eabfc01..0000000 --- a/GLideN64/src/TextureFilterHandler.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include -#include -#include "GLideNHQ/Ext_TxFilter.h" -#include -#include - -#include "RSP.h" -#include "Config.h" -#include "PluginAPI.h" -#include "FrameBuffer.h" -#include "TextureFilterHandler.h" -#include "DisplayWindow.h" -#include "DisplayLoadProgress.h" -#include "wst.h" - -static -u32 textureFilters[] = { - NO_FILTER, //"None" - SMOOTH_FILTER_1, //"Smooth filtering 1" - SMOOTH_FILTER_2, //"Smooth filtering 2" - SMOOTH_FILTER_3, //"Smooth filtering 3" - SMOOTH_FILTER_4, //"Smooth filtering 4" - SHARP_FILTER_1, //"Sharp filtering 1" - SHARP_FILTER_2, //"Sharp filtering 2" -}; - -static -u32 textureEnhancements[] = { - NO_ENHANCEMENT, //"None" - NO_ENHANCEMENT, //"Store" - X2_ENHANCEMENT, //"X2" - X2SAI_ENHANCEMENT, //"X2SAI" - HQ2X_ENHANCEMENT, //"HQ2X" - HQ2XS_ENHANCEMENT, //"HQ2XS" - LQ2X_ENHANCEMENT, //"LQ2X" - LQ2XS_ENHANCEMENT, //"LQ2XS" - HQ4X_ENHANCEMENT, //"HQ4X" - BRZ2X_ENHANCEMENT, //"2XBRZ" - BRZ3X_ENHANCEMENT, //"3XBRZ" - BRZ4X_ENHANCEMENT, //"4XBRZ" - BRZ5X_ENHANCEMENT, //"5XBRZ" - BRZ6X_ENHANCEMENT //"6XBRZ" -}; - -u32 TextureFilterHandler::_getConfigOptions() const -{ - u32 options = textureFilters[config.textureFilter.txFilterMode] | textureEnhancements[config.textureFilter.txEnhancementMode]; - if (config.textureFilter.txHiresEnable) - options |= RICE_HIRESTEXTURES; - if (config.textureFilter.txForce16bpp) - options |= FORCE16BPP_TEX | FORCE16BPP_HIRESTEX; - if (config.textureFilter.txCacheCompression) - options |= GZ_TEXCACHE | GZ_HIRESTEXCACHE; - if (config.textureFilter.txSaveCache) - options |= (DUMP_TEXCACHE | DUMP_HIRESTEXCACHE); - if (config.textureFilter.txHiresFullAlphaChannel) - options |= LET_TEXARTISTS_FLY; - if (config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) - options |= DUMP_TEX; - if (config.textureFilter.txDeposterize) - options |= DEPOSTERIZE; - if (config.textureFilter.txEnhancedTextureFileStorage) - options |= FILE_TEXCACHE; - if (config.textureFilter.txHiresTextureFileStorage) - options |= FILE_HIRESTEXCACHE; - return options; -} - -void TextureFilterHandler::init() -{ - if (isInited()) - return; - - m_inited = config.textureFilter.txFilterMode | config.textureFilter.txEnhancementMode | config.textureFilter.txHiresEnable; - if (m_inited == 0) - return; - - m_options = _getConfigOptions(); - - s32 maxTextureSize = gfxContext.getMaxTextureSize(); - wchar_t wRomName[32]; - ::mbstowcs(wRomName, RSP.romname, 32); - - wchar_t txPath[PLUGIN_PATH_SIZE + 16]; - wchar_t * pTexPackPath = config.textureFilter.txPath; - if (::wcslen(config.textureFilter.txPath) == 0 || - osal_is_absolute_path(config.textureFilter.txPath) == 0) { - api().GetUserDataPath(txPath); - gln_wcscat(txPath, wst("/hires_texture")); - pTexPackPath = txPath; - } - - wchar_t txCachePath[PLUGIN_PATH_SIZE + 16]; - wchar_t * pTexCachePath = config.textureFilter.txCachePath; - if (::wcslen(config.textureFilter.txCachePath) == 0 || - osal_is_absolute_path(config.textureFilter.txCachePath) == 0) { - api().GetUserCachePath(txCachePath); - gln_wcscat(txCachePath, wst("/cache")); - pTexCachePath = txCachePath; - } - - wchar_t txDumpPath[PLUGIN_PATH_SIZE + 16]; - wchar_t * pTexDumpPath = config.textureFilter.txDumpPath; - if (::wcslen(config.textureFilter.txDumpPath) == 0 || - osal_is_absolute_path(config.textureFilter.txDumpPath) == 0) { - api().GetUserCachePath(txDumpPath); - gln_wcscat(txDumpPath, wst("/texture_dump")); - pTexDumpPath = txDumpPath; - } - - m_inited = txfilter_init(maxTextureSize, // max texture width supported by hardware - maxTextureSize, // max texture height supported by hardware - 32, // max texture bpp supported by hardware - m_options, - config.textureFilter.txCacheSize, // cache texture to system memory - pTexCachePath, // path to store cache files - pTexDumpPath, // path to folder with dumped textures - pTexPackPath, // path to texture packs folder - wRomName, // name of ROM. must be no longer than 256 characters - displayLoadProgress); - -} - -void TextureFilterHandler::shutdown() -{ - if (isInited()) { - txfilter_shutdown(); - m_inited = m_options = 0; - } -} - -void TextureFilterHandler::dumpcache() -{ - if (isInited()) - txfilter_dumpcache(); -} - -TextureFilterHandler TFH; diff --git a/GLideN64/src/TextureFilterHandler.h b/GLideN64/src/TextureFilterHandler.h deleted file mode 100644 index 28c3a13..0000000 --- a/GLideN64/src/TextureFilterHandler.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef TEXTUREFILTERHANDLER_H -#define TEXTUREFILTERHANDLER_H - -#include "Types.h" - -class TextureFilterHandler -{ -public: - TextureFilterHandler() : m_inited(0), m_options(0) {} - // It's not safe to call shutdown() in destructor, because texture filter has its own static objects, which can be destroyed first. - ~TextureFilterHandler() { shutdown(); } - void init(); - void shutdown(); - void dumpcache(); - bool isInited() const { return m_inited != 0; } - bool optionsChanged() const { return _getConfigOptions() != m_options; } -private: - u32 _getConfigOptions() const; - u32 m_inited; - u32 m_options; -}; - -extern TextureFilterHandler TFH; - -#endif // TEXTUREFILTERHANDLER_H diff --git a/GLideN64/src/Textures.cpp b/GLideN64/src/Textures.cpp deleted file mode 100644 index ef18b89..0000000 --- a/GLideN64/src/Textures.cpp +++ /dev/null @@ -1,1695 +0,0 @@ -#include -#include -#include -#include // std::this_thread::sleep_for -#include // std::chrono::seconds -#include "Platform.h" -#include "Textures.h" -#include "GBI.h" -#include "RSP.h" -#include "RDP.h" -#include "gDP.h" -#include "gSP.h" -#include "N64.h" -#include "convert.h" -#include "FrameBuffer.h" -#include "Config.h" -#include "GLideNHQ/Ext_TxFilter.h" -#include "TextureFilterHandler.h" -#include "DisplayLoadProgress.h" -#include "Graphics/Context.h" -#include "Graphics/Parameters.h" -#include "DisplayWindow.h" - -using namespace std; -using namespace graphics; - -inline u32 GetNone( u64 *src, u16 x, u16 i, u8 palette ) -{ - return 0x00000000; -} - -inline u32 GetCI4_RGBA8888(u64 *src, u16 x, u16 i, u8 palette) -{ - u8 color4B = ((u8*)src)[(x >> 1) ^ (i << 1)]; - - return CI4_RGBA8888((x & 1) ? (palette << 4) | (color4B & 0x0F) : (palette << 4) | (color4B >> 4)); -} - -inline u32 GetCI4_RGBA4444(u64 *src, u16 x, u16 i, u8 palette) -{ - u8 color4B = ((u8*)src)[(x >> 1) ^ (i << 1)]; - - return CI4_RGBA4444((x & 1) ? (palette << 4) | (color4B & 0x0F) : (palette << 4) | (color4B >> 4)); -} - -inline u32 GetCI4IA_RGBA4444(u64 *src, u16 x, u16 i, u8 palette) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - if (x & 1) - return IA88_RGBA4444( *(u16*)&TMEM[256 + (palette << 4) + (color4B & 0x0F)] ); - else - return IA88_RGBA4444( *(u16*)&TMEM[256 + (palette << 4) + (color4B >> 4)] ); -} - -inline u32 GetCI4IA_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - if (x & 1) - return IA88_RGBA8888( *(u16*)&TMEM[256 + (palette << 4) + (color4B & 0x0F)] ); - else - return IA88_RGBA8888( *(u16*)&TMEM[256 + (palette << 4) + (color4B >> 4)] ); -} - -inline u32 GetCI4RGBA_RGBA5551( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - if (x & 1) - return RGBA5551_RGBA5551( *(u16*)&TMEM[256 + (palette << 4) + (color4B & 0x0F)] ); - else - return RGBA5551_RGBA5551( *(u16*)&TMEM[256 + (palette << 4) + (color4B >> 4)] ); -} - -inline u32 GetCI4RGBA_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - if (x & 1) - return RGBA5551_RGBA8888( *(u16*)&TMEM[256 + (palette << 4) + (color4B & 0x0F)] ); - else - return RGBA5551_RGBA8888( *(u16*)&TMEM[256 + (palette << 4) + (color4B >> 4)] ); -} - -inline u32 GetIA31_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - return IA31_RGBA8888( (x & 1) ? (color4B & 0x0F) : (color4B >> 4) ); -} - -inline u32 GetIA31_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - return IA31_RGBA4444( (x & 1) ? (color4B & 0x0F) : (color4B >> 4) ); -} - -inline u32 GetI4_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - return I4_RGBA8888( (x & 1) ? (color4B & 0x0F) : (color4B >> 4) ); -} - -inline u32 GetI4_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - u8 color4B = ((u8*)src)[(x>>1)^(i<<1)]; - - return I4_RGBA4444( (x & 1) ? (color4B & 0x0F) : (color4B >> 4) ); -} - -inline u32 GetCI8IA_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - return IA88_RGBA4444( *(u16*)&TMEM[256 + ((u8*)src)[x^(i<<1)]] ); -} - -inline u32 GetCI8IA_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - return IA88_RGBA8888( *(u16*)&TMEM[256 + ((u8*)src)[x^(i<<1)]] ); -} - -inline u32 GetCI8RGBA_RGBA5551( u64 *src, u16 x, u16 i, u8 palette ) -{ - return RGBA5551_RGBA5551( *(u16*)&TMEM[256 + ((u8*)src)[x^(i<<1)]] ); -} - -inline u32 GetCI8RGBA_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - return RGBA5551_RGBA8888( *(u16*)&TMEM[256 + ((u8*)src)[x^(i<<1)]] ); -} - -inline u32 GetIA44_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - return IA44_RGBA8888(((u8*)src)[x^(i<<1)]); -} - -inline u32 GetIA44_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - return IA44_RGBA4444(((u8*)src)[x^(i<<1)]); -} - -inline u32 GetI8_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - return I8_RGBA8888(((u8*)src)[x^(i<<1)]); -} - -inline u32 GetI8_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - return I8_RGBA4444(((u8*)src)[x^(i<<1)]); -} - -inline u32 GetCI16IA_RGBA8888(u64 *src, u16 x, u16 i, u8 palette) -{ - const u16 tex = ((u16*)src)[x^i]; - const u16 col = (*(u16*)&TMEM[256 + (tex & 0xFF)]); - const u16 c = col >> 8; - const u16 a = col & 0xFF; - return (a << 24) | (c << 16) | (c << 8) | c; -} - -inline u32 GetCI16IA_RGBA4444(u64 *src, u16 x, u16 i, u8 palette) -{ - const u16 tex = ((u16*)src)[x^i]; - const u16 col = (*(u16*)&TMEM[256 + (tex & 0xFF)]); - const u16 c = col >> 12; - const u16 a = col & 0x0F; - return (a << 12) | (c << 8) | (c << 4) | c; -} - -inline u32 GetCI16RGBA_RGBA8888(u64 *src, u16 x, u16 i, u8 palette) -{ - const u16 tex = (((u16*)src)[x^i])&0xFF; - return RGBA5551_RGBA8888(((u16*)&TMEM[256])[tex << 2]); -} - -inline u32 GetCI16RGBA_RGBA5551(u64 *src, u16 x, u16 i, u8 palette) -{ - const u16 tex = (((u16*)src)[x^i]) & 0xFF; - return RGBA5551_RGBA5551(((u16*)&TMEM[256])[tex << 2]); -} - -inline u32 GetRGBA5551_RGBA8888(u64 *src, u16 x, u16 i, u8 palette) -{ - u16 tex = ((u16*)src)[x^i]; - return RGBA5551_RGBA8888(tex); -} - -inline u32 GetRGBA5551_RGBA5551( u64 *src, u16 x, u16 i, u8 palette ) -{ - u16 tex = ((u16*)src)[x^i]; - return RGBA5551_RGBA5551(tex); -} - -inline u32 GetIA88_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - return IA88_RGBA8888(((u16*)src)[x^i]); -} - -inline u32 GetIA88_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - return IA88_RGBA4444(((u16*)src)[x^i]); -} - -inline u32 GetRGBA8888_RGBA8888( u64 *src, u16 x, u16 i, u8 palette ) -{ - return ((u32*)src)[x^i]; -} - -inline u32 GetRGBA8888_RGBA4444( u64 *src, u16 x, u16 i, u8 palette ) -{ - return RGBA8888_RGBA4444(((u32*)src)[x^i]); -} - -inline u32 YUV_RGBA8888(u8 y, u8 u, u8 v) -{ - return (0xff << 24) | (y << 16) | (v << 8) | u; -} - -inline void GetYUV_RGBA8888(u64 * src, u32 * dst, u16 x) -{ - const u32 t = (((u32*)src)[x]); - u8 y1 = (u8)t & 0xFF; - u8 v = (u8)(t >> 8) & 0xFF; - u8 y0 = (u8)(t >> 16) & 0xFF; - u8 u = (u8)(t >> 24) & 0xFF; - u32 c = YUV_RGBA8888(y0, u, v); - *(dst++) = c; - c = YUV_RGBA8888(y1, u, v); - *(dst++) = c; -} - -struct TextureLoadParameters -{ - GetTexelFunc Get16; - DatatypeParam glType16; - InternalColorFormatParam glInternalFormat16; - GetTexelFunc Get32; - DatatypeParam glType32; - InternalColorFormatParam glInternalFormat32; - InternalColorFormatParam autoFormat; - u32 lineShift; - u32 maxTexels; -}; - -struct ImageFormat { - ImageFormat(); - - TextureLoadParameters tlp[4][4][5]; - - static ImageFormat & get() { - static ImageFormat imageFmt; - return imageFmt; - } -}; - -ImageFormat::ImageFormat() -{ - TextureLoadParameters imageFormat[4][4][5] = - { // G_TT_NONE - { // Get16 glType16 glInternalFormat16 Get32 glType32 glInternalFormat32 autoFormat - { // 4-bit - { GetI4_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetI4_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // RGBA as I - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // YUV - { GetCI4_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI4_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // CI without palette - { GetIA31_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetIA31_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // IA - { GetI4_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetI4_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // I - }, - { // 8-bit - { GetI8_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetI8_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 4096 }, // RGBA as I - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 4096 }, // YUV - { GetI8_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetI8_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 4096 }, // CI without palette - { GetIA44_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetIA44_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 3, 4096 }, // IA - { GetI8_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetI8_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 4096 }, // I - }, - { // 16-bit - { GetRGBA5551_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetRGBA5551_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 2, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // YUV - { GetIA88_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetIA88_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // CI as IA - { GetIA88_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetIA88_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 2048 }, // I - }, - { // 32-bit - { GetRGBA8888_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetRGBA8888_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 1024 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // CI - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // I - } - }, - // DUMMY - { // Get16 glType16 glInternalFormat16 Get32 glType32 glInternalFormat32 autoFormat - { // 4-bit - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // CI (Banjo-Kazooie uses this, doesn't make sense, but it works...) - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // YUV - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // CI - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // IA as CI - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // I as CI - }, - { // 8-bit - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 4096 }, // YUV - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // CI - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // IA as CI - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // I as CI - }, - { // 16-bit - { GetCI16RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetRGBA5551_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 2, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 2048 }, // CI - { GetCI16RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI16RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 2, 2048 }, // IA as CI - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 2048 }, // I - }, - { // 32-bit - { GetRGBA8888_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetRGBA8888_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 1024 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // CI - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // I - } - }, - // G_TT_RGBA16 - { // Get16 glType16 glInternalFormat16 Get32 glType32 glInternalFormat32 autoFormat - { // 4-bit - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // CI (Banjo-Kazooie uses this, doesn't make sense, but it works...) - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 4, 8192 }, // YUV - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // CI - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // IA as CI - { GetCI4RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI4RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 4, 4096 }, // I as CI - }, - { // 8-bit - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 4096 }, // YUV - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // CI - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // IA as CI - { GetCI8RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI8RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 3, 2048 }, // I as CI - }, - { // 16-bit - { GetCI16RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetRGBA5551_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 2, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 2048 }, // CI - { GetCI16RGBA_RGBA5551, datatype::UNSIGNED_SHORT_5_5_5_1, internalcolorFormat::RGB5_A1, GetCI16RGBA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGB5_A1, 2, 2048 }, // IA as CI - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 2048 }, // I - }, - { // 32-bit - { GetRGBA8888_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetRGBA8888_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 1024 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // CI - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA4, 0, 1024 }, // I - } - }, - // G_TT_IA16 - { // Get16 glType16 glInternalFormat16 Get32 glType32 glInternalFormat32 autoFormat - { // 4-bit - { GetCI4IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI4IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 4, 4096 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 4, 8192 }, // YUV - { GetCI4IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI4IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 4, 4096 }, // CI - { GetCI4IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI4IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 4, 4096 }, // IA - { GetCI4IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI4IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 4, 4096 }, // I - }, - { // 8-bit - { GetCI8IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI8IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 4096 }, // YUV - { GetCI8IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI8IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 2048 }, // CI - { GetCI8IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI8IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 2048 }, // IA - { GetCI8IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI8IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 3, 2048 }, // I - }, - { // 16-bit - { GetCI16IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI16IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 2048 }, // CI - { GetCI16IA_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetCI16IA_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 2048 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 2048 }, // I - }, - { // 32-bit - { GetRGBA8888_RGBA4444, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetRGBA8888_RGBA8888, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 2, 1024 }, // RGBA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 1024 }, // YUV - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 1024 }, // CI - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 1024 }, // IA - { GetNone, datatype::UNSIGNED_SHORT_4_4_4_4, internalcolorFormat::RGBA4, GetNone, datatype::UNSIGNED_BYTE, internalcolorFormat::RGBA8, internalcolorFormat::RGBA8, 0, 1024 }, // I - } - } - }; - - memcpy(tlp, imageFormat, sizeof(tlp)); -} - -/** cite from RiceVideo */ -inline u32 CalculateDXT(u32 txl2words) -{ - if (txl2words == 0) return 1; - else return (2048 + txl2words - 1) / txl2words; -} - -u32 sizeBytes[4] = {0, 1, 2, 4}; - -inline u32 Txl2Words(u32 width, u32 size) -{ - if (size == 0) - return max(1U, width / 16); - else - return max(1U, width*sizeBytes[size] / 8); -} - -inline u32 ReverseDXT(u32 val, u32 lrs, u32 width, u32 size) -{ - if (val == 0x800) return 1; - - int low = 2047 / val; - if (CalculateDXT(low) > val) low++; - int high = 2047 / (val - 1); - - if (low == high) return low; - - for (int i = low; i <= high; i++) { - if (Txl2Words(width, size) == (u32)i) - return i; - } - - return (low + high) / 2; -} -/** end RiceVideo cite */ - -TextureCache & TextureCache::get() { - static TextureCache cache; - return cache; -} - -void TextureCache::_initDummyTexture(CachedTexture * _pDummy) -{ - _pDummy->address = 0; - _pDummy->clampS = 1; - _pDummy->clampT = 1; - _pDummy->clampWidth = 2; - _pDummy->clampHeight = 2; - _pDummy->crc = 0; - _pDummy->format = 0; - _pDummy->size = 0; - _pDummy->frameBufferTexture = CachedTexture::fbNone; - _pDummy->width = 2; - _pDummy->height = 2; - _pDummy->maskS = 0; - _pDummy->maskT = 0; - _pDummy->scaleS = 0.5f; - _pDummy->scaleT = 0.5f; - _pDummy->hdRatioS = 1.0f; - _pDummy->hdRatioT = 1.0f; - _pDummy->shiftScaleS = 1.0f; - _pDummy->shiftScaleT = 1.0f; - _pDummy->textureBytes = 2 * 2 * 4; - _pDummy->tMem = 0; -} - -void TextureCache::init() -{ - m_curUnpackAlignment = 0; - - u32 dummyTexture[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - m_pDummy = addFrameBufferTexture(textureTarget::TEXTURE_2D); // we don't want to remove dummy texture - _initDummyTexture(m_pDummy); - - Context::InitTextureParams params; - params.handle = m_pDummy->name; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = m_pDummy->width; - params.height = m_pDummy->height; - params.format = colorFormat::RGBA; - params.internalFormat = gfxContext.convertInternalTextureFormat(u32(internalcolorFormat::RGBA8)); - params.dataType = datatype::UNSIGNED_BYTE; - params.data = dummyTexture; - gfxContext.init2DTexture(params); - - activateDummy( 0 ); - activateDummy(1); - current[0] = current[1] = nullptr; - - - m_pMSDummy = nullptr; - if (config.video.multisampling != 0 && Context::Multisampling) { - m_pMSDummy = addFrameBufferTexture(textureTarget::TEXTURE_2D_MULTISAMPLE); // we don't want to remove dummy texture - _initDummyTexture(m_pMSDummy); - - Context::InitTextureParams msParams; - msParams.handle = m_pMSDummy->name; - msParams.mipMapLevel = 0; - msParams.msaaLevel = config.video.multisampling; - msParams.width = m_pMSDummy->width; - msParams.height = m_pMSDummy->height; - msParams.format = colorFormat::RGBA; - msParams.internalFormat = gfxContext.convertInternalTextureFormat(u32(internalcolorFormat::RGBA8)); - msParams.dataType = datatype::UNSIGNED_BYTE; - gfxContext.init2DTexture(msParams); - - activateMSDummy(0); - activateMSDummy(1); - } - - assert(!gfxContext.isError()); -} - -void TextureCache::destroy() -{ - current[0] = current[1] = nullptr; - - for (Textures::const_iterator cur = m_textures.cbegin(); cur != m_textures.cend(); ++cur) - gfxContext.deleteTexture(cur->name); - m_textures.clear(); - m_lruTextureLocations.clear(); - - for (FBTextures::const_iterator cur = m_fbTextures.cbegin(); cur != m_fbTextures.cend(); ++cur) - gfxContext.deleteTexture(cur->second.name); - m_fbTextures.clear(); -} - -void TextureCache::_checkCacheSize() -{ - if (m_textures.size() >= m_maxCacheSize) { - CachedTexture& clsTex = m_textures.back(); - gfxContext.deleteTexture(clsTex.name); - m_lruTextureLocations.erase(clsTex.crc); - m_textures.pop_back(); - } -} - -CachedTexture * TextureCache::_addTexture(u64 _crc64) -{ - if (m_curUnpackAlignment == 0) - m_curUnpackAlignment = gfxContext.getTextureUnpackAlignment(); - _checkCacheSize(); - m_textures.emplace_front(gfxContext.createTexture(textureTarget::TEXTURE_2D)); - Textures::iterator new_iter = m_textures.begin(); - new_iter->crc = _crc64; - m_lruTextureLocations.insert(std::pair(_crc64, new_iter)); - return &(*new_iter); -} - -void TextureCache::removeFrameBufferTexture(CachedTexture * _pTexture) -{ - if (_pTexture == nullptr) - return; - FBTextures::const_iterator iter = m_fbTextures.find(u32(_pTexture->name)); - assert(iter != m_fbTextures.cend()); - - if (iter != m_fbTextures.cend()) { - gfxContext.deleteTexture(ObjectHandle(iter->second.name)); - m_fbTextures.erase(iter); - } -} - -CachedTexture * TextureCache::addFrameBufferTexture(graphics::Parameter _target) -{ - ObjectHandle texName(gfxContext.createTexture(_target)); - m_fbTextures.emplace(u32(texName), texName); - return &m_fbTextures.at(u32(texName)); -} - -struct TileSizes -{ - u32 clampWidth = 0U; - u32 width = 0U; - u32 clampHeight = 0U; - u32 height = 0U; - u32 bytes = 0U; -}; - -static -void _calcTileSizes(u32 _t, TileSizes & _sizes, gDPTile * _pLoadTile) -{ - gDPTile * pTile = _t < 2 ? gSP.textureTile[_t] : &gDP.tiles[_t]; - pTile->masks = pTile->originalMaskS; - pTile->maskt = pTile->originalMaskT; - - u32 tileWidth = ((pTile->lrs - pTile->uls) & 0x03FF) + 1; - u32 tileHeight = ((pTile->lrt - pTile->ult) & 0x03FF) + 1; - - const u32 tMemMask = gDP.otherMode.textureLUT == G_TT_NONE ? 0x1FF : 0xFF; - gDPLoadTileInfo &info = gDP.loadInfo[pTile->tmem & tMemMask]; - if (pTile->tmem == gDP.loadTile->tmem) { - if (gDP.loadTile->loadWidth != 0 && gDP.loadTile->masks == 0) - info.width = gDP.loadTile->loadWidth; - if (gDP.loadTile->loadHeight != 0 && gDP.loadTile->maskt == 0) { - info.height = gDP.loadTile->loadHeight; - info.bytes = info.height * (gDP.loadTile->line << 3); - if (gDP.loadTile->size == G_IM_SIZ_32b) - // 32 bit texture loaded into lower and upper half of TMEM, thus actual bytes doubled. - info.bytes *= 2; - } - gDP.loadTile->loadWidth = gDP.loadTile->loadHeight = 0; - } - _sizes.bytes = info.bytes; - - if (tileWidth == 1 && tileHeight == 1 && - gDP.otherMode.cycleType == G_CYC_COPY && - _pLoadTile != nullptr) { - const u32 ulx = _SHIFTR(RDP.w1, 14, 10); - const u32 uly = _SHIFTR(RDP.w1, 2, 10); - const u32 lrx = _SHIFTR(RDP.w0, 14, 10); - const u32 lry = _SHIFTR(RDP.w0, 2, 10); - tileWidth = lrx - ulx + 1; - tileHeight = lry - uly + 1; - } - - u32 width = 0, height = 0; - if (info.loadType == LOADTYPE_TILE) { - width = min(info.width, info.texWidth); - if (width == 0) - width = tileWidth; - if (info.size > pTile->size) - width <<= info.size - pTile->size; - - height = info.height; - if (height == 0) - height = tileHeight; - if ((config.generalEmulation.hacks & hack_MK64) != 0 && (height % 2) != 0) - height--; - } else { - const TextureLoadParameters & loadParams = - ImageFormat::get().tlp[gDP.otherMode.textureLUT][pTile->size][pTile->format]; - - int tile_width = pTile->lrs - pTile->uls + 1; - int tile_height = pTile->lrt - pTile->ult + 1; - - int mask_width = (pTile->masks == 0) ? (tile_width) : (1 << pTile->masks); - int mask_height = (pTile->maskt == 0) ? (tile_height) : (1 << pTile->maskt); - - if (pTile->clamps) - width = min(mask_width, tile_width); - else if ((u32)(mask_width * mask_height) <= loadParams.maxTexels) - width = mask_width; - else - width = tileWidth; - - if (pTile->clampt) - height = min(mask_height, tile_height); - else if ((u32)(mask_width * mask_height) <= loadParams.maxTexels) - height = mask_height; - else - height = tileHeight; - } - - _sizes.clampWidth = (pTile->clamps && gDP.otherMode.cycleType != G_CYC_COPY) ? tileWidth : width; - _sizes.clampHeight = (pTile->clampt && gDP.otherMode.cycleType != G_CYC_COPY) ? tileHeight : height; - - _sizes.width = (info.loadType == LOADTYPE_TILE && - pTile->clamps != 0 && - pTile->masks == 0) ? - _sizes.clampWidth : - width; - _sizes.height = (info.loadType == LOADTYPE_TILE && - pTile->clampt != 0 && - pTile->maskt == 0) ? - _sizes.clampHeight : - height; -} - - -inline -void _updateCachedTexture(const GHQTexInfo & _info, CachedTexture *_pTexture, u16 widthOrg, u16 heightOrg) -{ - _pTexture->textureBytes = _info.width * _info.height; - - Parameter format(_info.format); - if (format == internalcolorFormat::RGB8 || - format == internalcolorFormat::RGBA4 || - format == internalcolorFormat::RGB5_A1) { - _pTexture->textureBytes <<= 1; - } else { - _pTexture->textureBytes <<= 2; - } - - _pTexture->scaleS = 1.0f / (_pTexture->maskS ? f32(pow2(widthOrg)) : f32(widthOrg)); - _pTexture->scaleT = 1.0f / (_pTexture->maskT ? f32(pow2(heightOrg)) : f32(heightOrg)); - - _pTexture->hdRatioS = (f32)(_info.width) / (f32)(_pTexture->width); - _pTexture->hdRatioT = (f32)(_info.height) / (f32)(_pTexture->height); - - _pTexture->bHDTexture = true; -} - -bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture, u64 & _ricecrc) -{ - if (!TFH.isInited()) - return false; - - u8 * addr = (u8*)(RDRAM + gSP.bgImage.address); - int tile_width = gSP.bgImage.width; - int tile_height = gSP.bgImage.height; - int bpl = tile_width << gSP.bgImage.size >> 1; - - u8 * paladdr = nullptr; - u16 * palette = nullptr; - if ((gSP.bgImage.size < G_IM_SIZ_16b) && (gDP.otherMode.textureLUT != G_TT_NONE || gSP.bgImage.format == G_IM_FMT_CI)) { - if (gSP.bgImage.size == G_IM_SIZ_8b) - paladdr = (u8*)(gDP.TexFilterPalette); - else if (config.textureFilter.txHresAltCRC) - paladdr = (u8*)(gDP.TexFilterPalette + (gSP.bgImage.palette << 5)); - else - paladdr = (u8*)(gDP.TexFilterPalette + (gSP.bgImage.palette << 4)); - // TODO: fix palette load - // palette = (rdp.pal_8 + (gSP.textureTile[_t]->palette << 4)); - } - - _ricecrc = txfilter_checksum(addr, tile_width, - tile_height, (unsigned short)(gSP.bgImage.format << 8 | gSP.bgImage.size), - bpl, paladdr); - GHQTexInfo ghqTexInfo; - // TODO: fix problem with zero texture dimensions on GLideNHQ side. - if (txfilter_hirestex(_pTexture->crc, _ricecrc, palette, &ghqTexInfo) && - ghqTexInfo.width != 0 && ghqTexInfo.height != 0) { - ghqTexInfo.format = gfxContext.convertInternalTextureFormat(ghqTexInfo.format); - Context::InitTextureParams params; - params.handle = _pTexture->name; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = ghqTexInfo.width; - params.height = ghqTexInfo.height; - params.format = ColorFormatParam(ghqTexInfo.texture_format); - params.internalFormat = InternalColorFormatParam(ghqTexInfo.format); - params.dataType = DatatypeParam(ghqTexInfo.pixel_type); - params.data = ghqTexInfo.data; - gfxContext.init2DTexture(params); - - assert(!gfxContext.isError()); - _updateCachedTexture(ghqTexInfo, _pTexture, tile_width, tile_height); - return true; - } - return false; -} - -void TextureCache::_loadBackground(CachedTexture *pTexture) -{ - u64 ricecrc = 0; - if (_loadHiresBackground(pTexture, ricecrc)) - return; - - u32 *pDest = nullptr; - u16 *pDest16 = nullptr; - - u8 *pSwapped, *pSrc; - u32 numBytes, bpl; - u32 x, y, j, tx, ty; - u16 clampSClamp; - u16 clampTClamp; - GetTexelFunc GetTexel; - InternalColorFormatParam glInternalFormat; - DatatypeParam glType; - - const TextureLoadParameters & loadParams = - ImageFormat::get().tlp[pTexture->format == 2 ? G_TT_RGBA16 : G_TT_NONE][pTexture->size][pTexture->format]; - if (loadParams.autoFormat == internalcolorFormat::RGBA8) { - pTexture->textureBytes = (pTexture->width * pTexture->height) << 2; - GetTexel = loadParams.Get32; - glInternalFormat = loadParams.glInternalFormat32; - glType = loadParams.glType32; - } else { - pTexture->textureBytes = (pTexture->width * pTexture->height) << 1; - GetTexel = loadParams.Get16; - glInternalFormat = loadParams.glInternalFormat16; - glType = loadParams.glType16; - } - - bpl = gSP.bgImage.width << gSP.bgImage.size >> 1; - numBytes = bpl * gSP.bgImage.height; - pSwapped = (u8*)malloc(numBytes); - if (pSwapped == nullptr) - return; - UnswapCopyWrap(RDRAM, gSP.bgImage.address, pSwapped, 0, RDRAMSize, numBytes); - pDest = (u32*)malloc(pTexture->textureBytes); - if (pDest == nullptr) { - free(pSwapped); - return; - } - pDest16 = reinterpret_cast(pDest); - - clampSClamp = pTexture->width - 1; - clampTClamp = pTexture->height - 1; - - j = 0; - for (y = 0; y < pTexture->height; y++) { - ty = min(y, (u32)clampTClamp); - - pSrc = &pSwapped[bpl * ty]; - - for (x = 0; x < pTexture->width; x++) { - tx = min(x, (u32)clampSClamp); - - if (glInternalFormat == internalcolorFormat::RGBA8) - pDest[j++] = GetTexel((u64*)pSrc, tx, 0, pTexture->palette); - else - pDest16[j++] = static_cast(GetTexel((u64*)pSrc, tx, 0, pTexture->palette)); - } - } - - if ((config.generalEmulation.hacks&hack_LoadDepthTextures) != 0 && gDP.colorImage.address == gDP.depthImageAddress) { - _loadDepthTexture(pTexture, (u16*)pDest); - free(pDest); - free(pSwapped); - return; - } - - if (m_toggleDumpTex && - config.textureFilter.txHiresEnable != 0 && - config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) { - txfilter_dmptx((u8*)pDest, pTexture->width, pTexture->height, - pTexture->width, (u16)u32(glInternalFormat), - (unsigned short)(pTexture->format << 8 | pTexture->size), - ricecrc); - } - - bool bLoaded = false; - if ((config.textureFilter.txEnhancementMode | config.textureFilter.txFilterMode) != 0 && - config.textureFilter.txFilterIgnoreBG == 0 && - TFH.isInited()) { - GHQTexInfo ghqTexInfo; - if (txfilter_filter((u8*)pDest, pTexture->width, pTexture->height, - (u16)u32(glInternalFormat), (uint64)pTexture->crc, &ghqTexInfo) != 0 && - ghqTexInfo.data != nullptr) { - - if (ghqTexInfo.width % 2 != 0 && - ghqTexInfo.format != u32(internalcolorFormat::RGBA8) && - m_curUnpackAlignment > 1) - gfxContext.setTextureUnpackAlignment(2); - - ghqTexInfo.format = gfxContext.convertInternalTextureFormat(ghqTexInfo.format); - Context::InitTextureParams params; - params.handle = pTexture->name; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = ghqTexInfo.width; - params.height = ghqTexInfo.height; - params.format = ColorFormatParam(ghqTexInfo.texture_format); - params.internalFormat = InternalColorFormatParam(ghqTexInfo.format); - params.dataType = DatatypeParam(ghqTexInfo.pixel_type); - params.data = ghqTexInfo.data; - gfxContext.init2DTexture(params); - _updateCachedTexture(ghqTexInfo, pTexture, pTexture->width, pTexture->height); - bLoaded = true; - } - } - if (!bLoaded) { - if (pTexture->width % 2 != 0 && glInternalFormat != internalcolorFormat::RGBA8) - gfxContext.setTextureUnpackAlignment(2); - Context::InitTextureParams params; - params.handle = pTexture->name; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = pTexture->width; - params.height = pTexture->height; - params.format = colorFormat::RGBA; - params.internalFormat = gfxContext.convertInternalTextureFormat(u32(glInternalFormat)); - params.dataType = glType; - params.data = pDest; - gfxContext.init2DTexture(params); - } - if (m_curUnpackAlignment > 1) - gfxContext.setTextureUnpackAlignment(m_curUnpackAlignment); - free(pSwapped); - free(pDest); -} - -bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 & _ricecrc) -{ - if (config.textureFilter.txHiresEnable == 0 || !TFH.isInited()) - return false; - - gDPLoadTileInfo & info = gDP.loadInfo[_pTexture->tMem]; - - // Temporal workaround for crash problem with mip-mapped textures. See #1711 for details. - // TODO: make proper fix. - if (info.texAddress == 0) - return false; - - int bpl; - int width, height; - u8 * addr = (u8*)(RDRAM + info.texAddress); - if (info.loadType == LOADTYPE_TILE) { - bpl = info.texWidth << info.size >> 1; - addr += (info.ult * bpl) + (((info.uls << info.size) + 1) >> 1); - - width = min(info.width, info.texWidth); - if (info.size > _pTexture->size) - width <<= info.size - _pTexture->size; - - height = info.height; - if ((config.generalEmulation.hacks & hack_MK64) != 0 && (height % 2) != 0) - height--; - } else { - const gDPTile * pTile = gSP.textureTile[_tile]; - int tile_width = pTile->lrs - pTile->uls + 1; - int tile_height = pTile->lrt - pTile->ult + 1; - - int mask_width = (pTile->masks == 0) ? (tile_width) : (1 << pTile->masks); - int mask_height = (pTile->maskt == 0) ? (tile_height) : (1 << pTile->maskt); - - if ((pTile->clamps && tile_width <= 256)) - width = min(mask_width, tile_width); - else - width = mask_width; - - if ((pTile->clampt && tile_height <= 256) || (mask_height > 256)) - height = min(mask_height, tile_height); - else - height = mask_height; - - if (pTile->size == G_IM_SIZ_32b) - bpl = pTile->line << 4; - else if (info.dxt == 0) - bpl = pTile->line << 3; - else { - u32 dxt = info.dxt; - if (dxt > 1) - dxt = ReverseDXT(dxt, info.width, _pTexture->width, _pTexture->size); - bpl = dxt << 3; - } - } - - u8 * paladdr = nullptr; - u16 * palette = nullptr; - if ((_pTexture->size < G_IM_SIZ_16b) && (gDP.otherMode.textureLUT != G_TT_NONE || _pTexture->format == G_IM_FMT_CI)) { - if (_pTexture->size == G_IM_SIZ_8b) - paladdr = (u8*)(gDP.TexFilterPalette); - else if (config.textureFilter.txHresAltCRC) - paladdr = (u8*)(gDP.TexFilterPalette + (_pTexture->palette << 5)); - else - paladdr = (u8*)(gDP.TexFilterPalette + (_pTexture->palette << 4)); - // TODO: fix palette load - // palette = (rdp.pal_8 + (gSP.textureTile[_t]->palette << 4)); - } - - _ricecrc = txfilter_checksum(addr, width, height, (unsigned short)(_pTexture->format << 8 | _pTexture->size), bpl, paladdr); - GHQTexInfo ghqTexInfo; - // TODO: fix problem with zero texture dimensions on GLideNHQ side. - if (txfilter_hirestex(_pTexture->crc, _ricecrc, palette, &ghqTexInfo) && - ghqTexInfo.width != 0 && ghqTexInfo.height != 0) { - ghqTexInfo.format = gfxContext.convertInternalTextureFormat(ghqTexInfo.format); - Context::InitTextureParams params; - params.handle = _pTexture->name; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = ghqTexInfo.width; - params.height = ghqTexInfo.height; - params.internalFormat = InternalColorFormatParam(ghqTexInfo.format); - params.format = ColorFormatParam(ghqTexInfo.texture_format); - params.dataType = DatatypeParam(ghqTexInfo.pixel_type); - params.data = ghqTexInfo.data; - params.textureUnitIndex = textureIndices::Tex[_tile]; - gfxContext.init2DTexture(params); - assert(!gfxContext.isError()); - _updateCachedTexture(ghqTexInfo, _pTexture, width, height); - return true; - } - - return false; -} - -void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest) -{ - if (!config.generalEmulation.enableFragmentDepthWrite) - return; - - u32 size = _pTexture->width * _pTexture->height; - std::vector pDestFloat(size); - for (u32 i = 0; i < size; ++i) - pDestFloat[i] = _pDest[i] / 65535.0f; - - Context::InitTextureParams params; - params.handle = _pTexture->name; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = _pTexture->width; - params.height = _pTexture->height; - params.internalFormat = internalcolorFormat::R16F; - params.format = colorFormat::RED; - params.dataType = datatype::FLOAT; - params.data = pDestFloat.data(); - gfxContext.init2DTexture(params); -} - -/* - * Worker function for _load -*/ -void TextureCache::_getTextureDestData(CachedTexture& tmptex, - u32* pDest, - Parameter glInternalFormat, - GetTexelFunc GetTexel, - u16* pLine) -{ - u16 maskSMask, clampSClamp; - u16 maskTMask, clampTClamp; - u16 x, y, tx, ty; - u32 i, j; - u64 *pSrc; - - if (tmptex.maskS > 0) { - clampSClamp = tmptex.clampS ? tmptex.clampWidth - 1 : (tmptex.mirrorS ? (tmptex.width << 1) - 1 : tmptex.width - 1); - maskSMask = (1 << tmptex.maskS) - 1; - } else { - clampSClamp = tmptex.clampS ? tmptex.clampWidth - 1 : tmptex.width - 1; - maskSMask = 0xFFFF; - } - - if (tmptex.maskT > 0) { - clampTClamp = tmptex.clampT ? tmptex.clampHeight - 1 : (tmptex.mirrorT ? (tmptex.height << 1) - 1 : tmptex.height - 1); - maskTMask = (1 << tmptex.maskT) - 1; - } else { - clampTClamp = tmptex.clampT ? tmptex.clampHeight - 1 : tmptex.height - 1; - maskTMask = 0xFFFF; - } - - if (tmptex.size == G_IM_SIZ_32b) { - const u16 * tmem16 = (u16*)TMEM; - const u32 tbase = tmptex.tMem << 2; - - int wid_64 = (tmptex.clampWidth) << 2; - if (wid_64 & 15) { - wid_64 += 16; - } - wid_64 &= 0xFFFFFFF0; - wid_64 >>= 3; - int line32 = tmptex.line << 1; - line32 = (line32 - wid_64) << 3; - if (wid_64 < 1) { - wid_64 = 1; - } - int width = wid_64 << 1; - line32 = width + (line32 >> 2); - - u16 gr, ab; - - j = 0; - for (y = 0; y < tmptex.height; ++y) { - ty = min(y, clampTClamp) & maskTMask; - - u32 tline = tbase + line32 * ty; - u32 xorval = (ty & 1) ? 3 : 1; - - for (x = 0; x < tmptex.width; ++x) { - tx = min(x, clampSClamp) & maskSMask; - - u32 taddr = ((tline + tx) ^ xorval) & 0x3ff; - gr = swapword(tmem16[taddr]); - ab = swapword(tmem16[taddr | 0x400]); - pDest[j++] = (ab << 16) | gr; - } - } - } else if (tmptex.format == G_IM_FMT_YUV) { - j = 0; - *pLine <<= 1; - for (y = 0; y < tmptex.height; ++y) { - pSrc = &TMEM[tmptex.tMem] + *pLine * y; - for (x = 0; x < tmptex.width / 2; x++) { - GetYUV_RGBA8888(pSrc, pDest + j, x); - j += 2; - } - } - } else { - j = 0; - const u32 tMemMask = gDP.otherMode.textureLUT == G_TT_NONE ? 0x1FF : 0xFF; - for (y = 0; y < tmptex.height; ++y) { - ty = min(y, clampTClamp) & maskTMask; - - pSrc = &TMEM[(tmptex.tMem + *pLine * ty) & tMemMask]; - - i = (ty & 1) << 1; - for (x = 0; x < tmptex.width; ++x) { - tx = min(x, clampSClamp) & maskSMask; - - if (glInternalFormat == internalcolorFormat::RGBA8) { - pDest[j++] = GetTexel(pSrc, tx, i, tmptex.palette); - } else { - ((u16*)pDest)[j++] = GetTexel(pSrc, tx, i, tmptex.palette); - } - } - } - } -} - -template -void doubleTexture(T* pTex, u32 width, u32 height) -{ - std::vector vData(width * height); - memcpy(vData.data(), pTex, width * height * sizeof(T)); - u32 srcIdx = 0; - u32 dstIdx = 0; - for (u32 y = 0; y < height; ++y) { - const u32 srcIdxCur = srcIdx; - for (u32 x = 0; x < width; ++x) { - pTex[dstIdx++] = vData[srcIdx]; - pTex[dstIdx++] = vData[srcIdx++]; - } - srcIdx = srcIdxCur; - for (u32 x = 0; x < width; ++x) { - pTex[dstIdx++] = vData[srcIdx]; - pTex[dstIdx++] = vData[srcIdx++]; - } - } -} - -void TextureCache::_load(u32 _tile, CachedTexture *_pTexture) -{ - u64 ricecrc = 0; - if (_loadHiresTexture(_tile, _pTexture, ricecrc)) - return; - - s32 mipLevel = 0; - bool force32bitFormat = false; - _pTexture->max_level = 0; - - if (config.generalEmulation.enableLOD != 0 && gSP.texture.level > 1) { - if (_tile == 0) { - _pTexture->max_level = 0; - } else { - _pTexture->max_level = static_cast(gSP.texture.level - 1); - const u16 dim = std::max(_pTexture->width, _pTexture->height); - while (dim < static_cast(1 << _pTexture->max_level)) - --_pTexture->max_level; - - auto texFormat = gDP.tiles[gSP.texture.tile + 1].format; - auto texSize = gDP.tiles[gSP.texture.tile + 1].size; - u32 tileMipLevel = gSP.texture.tile + 2; - while (!force32bitFormat && (tileMipLevel < gSP.texture.tile + gSP.texture.level)) { - gDPTile const& mipTile = gDP.tiles[tileMipLevel++]; - force32bitFormat = texFormat != mipTile.format || texSize != mipTile.size; - } - } - } - - u32 sizeShift = 1; - { - const TextureLoadParameters & loadParams = - ImageFormat::get().tlp[gDP.otherMode.textureLUT][_pTexture->size][_pTexture->format]; - if (force32bitFormat || loadParams.autoFormat == internalcolorFormat::RGBA8) - sizeShift = 2; - } - _pTexture->textureBytes = (_pTexture->width * _pTexture->height) << sizeShift; - - // RAII holder for texture data - class TexData - { - public: - TexData(u32 bytes) - { - pData = (u32*)malloc(bytes); - assert(pData != NULL); - } - ~TexData() - { - free(pData); - pData = NULL; - } - u32 * get() const - { - return pData; - } - private: - u32 *pData = NULL; - } texData(_pTexture->textureBytes); - - GetTexelFunc GetTexel; - InternalColorFormatParam glInternalFormat; - DatatypeParam glType; - - auto getLoadParams = [&](u16 _format, u16 _size) - { - const TextureLoadParameters & loadParams = - ImageFormat::get().tlp[gDP.otherMode.textureLUT][_size][_format]; - if (force32bitFormat || loadParams.autoFormat == internalcolorFormat::RGBA8) { - GetTexel = loadParams.Get32; - glInternalFormat = loadParams.glInternalFormat32; - glType = loadParams.glType32; - } - else { - GetTexel = loadParams.Get16; - glInternalFormat = loadParams.glInternalFormat16; - glType = loadParams.glType16; - } - }; - - CachedTexture tmptex = *_pTexture; - u16 line = tmptex.line; - - while (true) { - getLoadParams(tmptex.format, tmptex.size); - { - const u32 tileMipLevel = gSP.texture.tile + mipLevel + 1; - gDPTile & mipTile = gDP.tiles[tileMipLevel]; - if (tmptex.max_level > 1 && - tmptex.width == (mipTile.lrs - mipTile.uls + 1) * 2 && - tmptex.height == (mipTile.lrt - mipTile.ult + 1) * 2) - { - // Special case for Southern Swamp grass texture, Zelda MM. See #2315 - const u16 texWidth = tmptex.width; - const u16 texHeight = tmptex.height; - tmptex.width = mipTile.lrs - mipTile.uls + 1; - tmptex.height = mipTile.lrt - mipTile.ult + 1; - _getTextureDestData(tmptex, texData.get(), glInternalFormat, GetTexel, &line); - if (sizeShift == 2) - doubleTexture(texData.get(), tmptex.width, tmptex.height); - else - doubleTexture((u16*)texData.get(), tmptex.width, tmptex.height); - tmptex.width = texWidth; - tmptex.height = texHeight; - } else { - _getTextureDestData(tmptex, texData.get(), glInternalFormat, GetTexel, &line); - } - } - - if ((config.generalEmulation.hacks&hack_LoadDepthTextures) != 0 && gDP.colorImage.address == gDP.depthImageAddress) { - _loadDepthTexture(_pTexture, (u16*)texData.get()); - return; - } - - if (m_toggleDumpTex && - config.textureFilter.txHiresEnable != 0 && - config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) { - txfilter_dmptx((u8*)texData.get(), tmptex.width, tmptex.height, - tmptex.width, (u16)u32(glInternalFormat), - (unsigned short)(_pTexture->format << 8 | _pTexture->size), - ricecrc); - } - - bool bLoaded = false; - bool needEnhance = (config.textureFilter.txEnhancementMode | config.textureFilter.txFilterMode) != 0 && - _pTexture->max_level == 0 && - TFH.isInited(); - if (needEnhance) { - if (config.textureFilter.txFilterIgnoreBG != 0) { - switch (GBI.getMicrocodeType()) { - case S2DEX_1_07: - case S2DEX_1_03: - case S2DEX_1_05: - needEnhance = RSP.cmd != 0x01 && RSP.cmd != 0x02; - break; - case S2DEX2: - needEnhance = RSP.cmd != 0x09 && RSP.cmd != 0x0A; - break; - } - } - } - - if (needEnhance) { - GHQTexInfo ghqTexInfo; - if (txfilter_filter((u8*)texData.get(), tmptex.width, tmptex.height, - (u16)u32(glInternalFormat), (uint64)_pTexture->crc, - &ghqTexInfo) != 0 && ghqTexInfo.data != nullptr) { - if (ghqTexInfo.width % 2 != 0 && - ghqTexInfo.format != u32(internalcolorFormat::RGBA8) && - m_curUnpackAlignment > 1) - gfxContext.setTextureUnpackAlignment(2); - ghqTexInfo.format = gfxContext.convertInternalTextureFormat(ghqTexInfo.format); - Context::InitTextureParams params; - params.handle = _pTexture->name; - params.textureUnitIndex = textureIndices::Tex[_tile]; - params.mipMapLevel = 0; - params.msaaLevel = 0; - params.width = ghqTexInfo.width; - params.height = ghqTexInfo.height; - params.internalFormat = InternalColorFormatParam(ghqTexInfo.format); - params.format = ColorFormatParam(ghqTexInfo.texture_format); - params.dataType = DatatypeParam(ghqTexInfo.pixel_type); - params.data = ghqTexInfo.data; - gfxContext.init2DTexture(params); - _updateCachedTexture(ghqTexInfo, _pTexture, tmptex.width, tmptex.height); - bLoaded = true; - } - } - if (!bLoaded) { - if (tmptex.width % 2 != 0 && - glInternalFormat != internalcolorFormat::RGBA8 && - m_curUnpackAlignment > 1) - gfxContext.setTextureUnpackAlignment(2); - Context::InitTextureParams params; - params.handle = _pTexture->name; - params.textureUnitIndex = textureIndices::Tex[_tile]; - params.mipMapLevel = mipLevel; - params.mipMapLevels = _pTexture->max_level + 1; - params.msaaLevel = 0; - params.width = tmptex.width; - params.height = tmptex.height; - params.internalFormat = gfxContext.convertInternalTextureFormat(u32(glInternalFormat)); - params.format = colorFormat::RGBA; - params.dataType = glType; - params.data = texData.get(); - gfxContext.init2DTexture(params); - } - if (mipLevel == _pTexture->max_level) - break; - ++mipLevel; - const u32 tileMipLevel = gSP.texture.tile + mipLevel + 1; - gDPTile & mipTile = gDP.tiles[tileMipLevel]; - line = mipTile.line; - tmptex.tMem = mipTile.tmem; - tmptex.palette = mipTile.palette; - tmptex.maskS = mipTile.masks; - tmptex.maskT = mipTile.maskt; - tmptex.format = mipTile.format; - tmptex.size = mipTile.size; - TileSizes sizes; - _calcTileSizes(tileMipLevel, sizes, nullptr); - tmptex.clampWidth = sizes.clampWidth; - tmptex.clampHeight = sizes.clampHeight; - // Insure mip-map levels size consistency. - if (tmptex.width > 1) - tmptex.width >>= 1; - if (tmptex.height > 1) - tmptex.height >>= 1; - _pTexture->textureBytes += (tmptex.width * tmptex.height) << sizeShift; - } - if (m_curUnpackAlignment > 1) - gfxContext.setTextureUnpackAlignment(m_curUnpackAlignment); -} - -struct TextureParams -{ - u16 width; - u16 height; - u32 flags; -}; - -static -u64 _calculateCRC(u32 _t, const TextureParams & _params, u32 _bytes) -{ - const bool rgba32 = gSP.textureTile[_t]->size == G_IM_SIZ_32b; - if (_bytes == 0) { - const u32 lineBytes = gSP.textureTile[_t]->line << 3; - _bytes = _params.height*lineBytes; - } - if (rgba32) - _bytes >>= 1; - const u32 tMemMask = (gDP.otherMode.textureLUT == G_TT_NONE && !rgba32) ? 0x1FF : 0xFF; - const u32 tMem = gSP.textureTile[_t]->tmem & tMemMask; - const u64 *src = (u64*)&TMEM[tMem]; - const u32 maxBytes = (tMemMask + 1) << 3; - const u32 tileTmemInBytes = tMem << 3; - if (!rgba32 && (tileTmemInBytes + _bytes > maxBytes)) - _bytes = maxBytes - tileTmemInBytes; - u64 crc = UINT64_MAX; - crc = CRC_Calculate(crc, src, _bytes); - - if (rgba32) { - src = (u64*)&TMEM[(gSP.textureTile[_t]->tmem + 256) & 0x1FF]; - crc = CRC_Calculate(crc, src, _bytes); - } - - if (gDP.otherMode.textureLUT != G_TT_NONE || gSP.textureTile[_t]->format == G_IM_FMT_CI) { - if (gSP.textureTile[_t]->size == G_IM_SIZ_4b) - crc = CRC_Calculate( crc, &gDP.paletteCRC16[gSP.textureTile[_t]->palette], sizeof(u64) ); - else if (gSP.textureTile[_t]->size == G_IM_SIZ_8b) - crc = CRC_Calculate( crc, &gDP.paletteCRC256, sizeof(u64) ); - } - - if (config.generalEmulation.enableLOD != 0 && gSP.texture.level > 1 && _t > 0) - crc = CRC_Calculate(crc, &gSP.texture.level, 4); - - crc = CRC_Calculate(crc, &_params, sizeof(_params)); - - return crc; -} - -void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture) -{ - - Context::TexParameters params; - params.handle = _pTexture->name; - if (config.video.multisampling > 0 && _pTexture->frameBufferTexture == CachedTexture::fbMultiSample) { - params.target = textureTarget::TEXTURE_2D_MULTISAMPLE; - params.textureUnitIndex = textureIndices::MSTex[_t]; - } else { - params.target = textureTarget::TEXTURE_2D; - params.textureUnitIndex = textureIndices::Tex[_t]; - - const bool bUseBilinear = gDP.otherMode.textureFilter != G_TF_POINT && config.texture.bilinearMode != BILINEAR_3POINT; - const bool bUseLOD = currentCombiner()->usesLOD(); - const s32 texLevel = bUseLOD ? _pTexture->max_level : 0; - params.maxMipmapLevel = Parameter(texLevel); - - if (bUseLOD) { - if (bUseBilinear) { - // Apply standard bilinear to mipmap textures - if (texLevel > 0) - params.minFilter = textureParameters::FILTER_LINEAR_MIPMAP_NEAREST; - else - params.minFilter = textureParameters::FILTER_LINEAR; - params.magFilter = textureParameters::FILTER_LINEAR; - } else { - if (texLevel > 0) - params.minFilter = textureParameters::FILTER_NEAREST_MIPMAP_NEAREST; - else - params.minFilter = textureParameters::FILTER_NEAREST; - params.magFilter = textureParameters::FILTER_NEAREST; - } - } else { // Don't use texture filter. Texture will be filtered by filter shader - params.minFilter = textureParameters::FILTER_NEAREST; - params.magFilter = textureParameters::FILTER_NEAREST; - } - - // Set clamping modes - params.wrapS = _pTexture->clampS ? textureParameters::WRAP_CLAMP_TO_EDGE : - _pTexture->mirrorS ? textureParameters::WRAP_MIRRORED_REPEAT : textureParameters::WRAP_REPEAT; - params.wrapT = _pTexture->clampT ? textureParameters::WRAP_CLAMP_TO_EDGE : - _pTexture->mirrorT ? textureParameters::WRAP_MIRRORED_REPEAT : textureParameters::WRAP_REPEAT; - - if (config.texture.maxAnisotropyF > 0.0f) { - switch (dwnd().getDrawer().getDrawingState()) { - case DrawingState::Triangle: - case DrawingState::ScreenSpaceTriangle: - params.maxAnisotropy = Parameter(config.texture.maxAnisotropyF); - break; - default: - break; - } - } - } - - gfxContext.setTextureParameters(params); - - current[_t] = _pTexture; -} - -void TextureCache::activateDummy(u32 _t) -{ - Context::TexParameters params; - params.handle = m_pDummy->name; - params.target = textureTarget::TEXTURE_2D; - params.textureUnitIndex = textureIndices::Tex[_t]; - params.minFilter = textureParameters::FILTER_NEAREST; - params.magFilter = textureParameters::FILTER_NEAREST; - gfxContext.setTextureParameters(params); -} - -void TextureCache::activateMSDummy(u32 _t) -{ - Context::TexParameters params; - params.handle = m_pMSDummy->name; - params.target = textureTarget::TEXTURE_2D_MULTISAMPLE; - params.textureUnitIndex = textureIndices::MSTex[_t]; - gfxContext.setTextureParameters(params); -} - -void TextureCache::_updateBackground() -{ - u32 numBytes = gSP.bgImage.width * gSP.bgImage.height << gSP.bgImage.size >> 1; - u64 crc; - - crc = CRC_Calculate( UINT64_MAX, &RDRAM[gSP.bgImage.address], numBytes ); - - if (gDP.otherMode.textureLUT != G_TT_NONE || gSP.bgImage.format == G_IM_FMT_CI) { - if (gSP.bgImage.size == G_IM_SIZ_4b) - crc = CRC_Calculate( crc, &gDP.paletteCRC16[gSP.bgImage.palette], sizeof(u64) ); - else if (gSP.bgImage.size == G_IM_SIZ_8b) - crc = CRC_Calculate( crc, &gDP.paletteCRC256, sizeof(u64) ); - } - - u32 params[4] = {gSP.bgImage.width, gSP.bgImage.height, gSP.bgImage.format, gSP.bgImage.size}; - crc = CRC_Calculate(crc, params, sizeof(u32)*4); - - Texture_Locations::iterator locations_iter = m_lruTextureLocations.find(crc); - if (locations_iter != m_lruTextureLocations.end()) { - Textures::iterator iter = locations_iter->second; - CachedTexture & currentTex = *iter; - m_textures.splice(m_textures.begin(), m_textures, iter); - - assert(currentTex.width == gSP.bgImage.width); - assert(currentTex.height == gSP.bgImage.height); - assert(currentTex.format == gSP.bgImage.format); - assert(currentTex.size == gSP.bgImage.size); - currentTex.clampS = gSP.bgImage.clampS; - currentTex.clampT = gSP.bgImage.clampT; - - activateTexture(0, ¤tTex); - m_hits++; - return; - } - - m_misses++; - - CachedTexture * pCurrent = _addTexture(crc); - - pCurrent->address = gSP.bgImage.address; - - pCurrent->format = gSP.bgImage.format; - pCurrent->size = gSP.bgImage.size; - - pCurrent->width = gSP.bgImage.width; - pCurrent->height = gSP.bgImage.height; - - pCurrent->clampWidth = gSP.bgImage.width; - pCurrent->clampHeight = gSP.bgImage.height; - pCurrent->palette = gSP.bgImage.palette; - pCurrent->maskS = 0; - pCurrent->maskT = 0; - pCurrent->mirrorS = 0; - pCurrent->mirrorT = 0; - pCurrent->clampS = gSP.bgImage.clampS; - pCurrent->clampT = gSP.bgImage.clampT; - pCurrent->line = 0; - pCurrent->tMem = 0; - pCurrent->frameBufferTexture = CachedTexture::fbNone; - - pCurrent->scaleS = 1.0f / (f32)(pCurrent->width); - pCurrent->scaleT = 1.0f / (f32)(pCurrent->height); - - pCurrent->hdRatioS = 1.0f; - pCurrent->hdRatioT = 1.0f; - - pCurrent->shiftScaleS = 1.0f; - pCurrent->shiftScaleT = 1.0f; - - pCurrent->offsetS = 0.0f; - pCurrent->offsetT = 0.0f; - - _loadBackground(pCurrent); - activateTexture(0, pCurrent); - - current[0] = pCurrent; -} - -void TextureCache::clear() -{ - current[0] = current[1] = nullptr; - - for (auto cur = m_textures.cbegin(); cur != m_textures.cend(); ++cur) { - gfxContext.deleteTexture(cur->name); - } - m_textures.clear(); - m_lruTextureLocations.clear(); -} - -void TextureCache::toggleDumpTex() -{ - m_toggleDumpTex = !m_toggleDumpTex; - if (m_toggleDumpTex) { - displayLoadProgress(L"Texture dump - ON\n"); - clear(); - std::this_thread::sleep_for(std::chrono::seconds(1)); - } else { - displayLoadProgress(L"Texture dump - OFF\n"); - std::this_thread::sleep_for(std::chrono::seconds(1)); - } -} - -void TextureCache::update(u32 _t) -{ - const gDPTile * pTile = gSP.textureTile[_t]; - switch (pTile->textureMode) { - case TEXTUREMODE_BGIMAGE: - _updateBackground(); - return; - case TEXTUREMODE_FRAMEBUFFER: - FrameBuffer_ActivateBufferTexture( _t, pTile->frameBufferAddress ); - return; - case TEXTUREMODE_FRAMEBUFFER_BG: - FrameBuffer_ActivateBufferTextureBG( _t, pTile->frameBufferAddress ); - return; - } - - if (_t == 1 && needReplaceTex1ByTex0()) { - current[1] = current[0]; - if (current[1] != nullptr) { - activateTexture(1, current[1]); - return; - } - } - - if (gSP.texture.tile == 7 && - _t == 0 && - gSP.textureTile[0] == gDP.loadTile && - gDP.loadTile->loadType == LOADTYPE_BLOCK && - gSP.textureTile[0]->tmem == gSP.textureTile[1]->tmem) { - gSP.textureTile[0] = gSP.textureTile[1]; - pTile = gSP.textureTile[_t]; - } - - TileSizes sizes; - _calcTileSizes(_t, sizes, gDP.loadTile); - TextureParams params; - const u32 texLevel = _t == 0 ? 0U : gSP.texture.level; - params.flags = pTile->masks | - (pTile->maskt << 4) | - (pTile->mirrors << 8) | - (pTile->mirrort << 9) | - (pTile->clamps << 10) | - (pTile->clampt << 11) | - (pTile->size << 12) | - (pTile->format << 14) | - (gDP.otherMode.textureLUT << 17) | - (texLevel << 19); - params.width = sizes.width; - params.height = sizes.height; - - const u64 crc = _calculateCRC(_t, params, sizes.bytes); - - if (current[_t] != nullptr && current[_t]->crc == crc) { - activateTexture(_t, current[_t]); - return; - } - - Texture_Locations::iterator locations_iter = m_lruTextureLocations.find(crc); - if (locations_iter != m_lruTextureLocations.end()) { - Textures::iterator iter = locations_iter->second; - CachedTexture & currentTex = *iter; - - if (currentTex.width == sizes.width && currentTex.height == sizes.height) { - m_textures.splice(m_textures.begin(), m_textures, iter); - - assert(currentTex.format == pTile->format); - assert(currentTex.size == pTile->size); - - activateTexture(_t, ¤tTex); - m_hits++; - return; - } - - gfxContext.deleteTexture(currentTex.name); - m_lruTextureLocations.erase(locations_iter); - m_textures.erase(iter); - } - - m_misses++; - - CachedTexture * pCurrent = _addTexture(crc); - - pCurrent->address = gDP.loadInfo[pTile->tmem].texAddress; - - pCurrent->format = pTile->format; - pCurrent->size = pTile->size; - - pCurrent->width = sizes.width; - pCurrent->height = sizes.height; - - pCurrent->clampWidth = sizes.clampWidth; - pCurrent->clampHeight = sizes.clampHeight; - - pCurrent->palette = pTile->palette; -/* pCurrent->fulS = gSP.textureTile[t]->fulS; - pCurrent->fulT = gSP.textureTile[t]->fulT; - pCurrent->ulS = gSP.textureTile[t]->ulS; - pCurrent->ulT = gSP.textureTile[t]->ulT; - pCurrent->lrS = gSP.textureTile[t]->lrS; - pCurrent->lrT = gSP.textureTile[t]->lrT;*/ - pCurrent->maskS = pTile->masks; - pCurrent->maskT = pTile->maskt; - pCurrent->mirrorS = pTile->mirrors; - pCurrent->mirrorT = pTile->mirrort; - pCurrent->clampS = pTile->clamps; - pCurrent->clampT = pTile->clampt; - pCurrent->line = pTile->line; - pCurrent->tMem = pTile->tmem; - pCurrent->frameBufferTexture = CachedTexture::fbNone; - - pCurrent->scaleS = 1.0f / (pCurrent->maskS ? f32(pow2(pCurrent->width)) : f32(pCurrent->width)); - pCurrent->scaleT = 1.0f / (pCurrent->maskT ? f32(pow2(pCurrent->height)) : f32(pCurrent->height)); - - pCurrent->hdRatioS = 1.0f; - pCurrent->hdRatioT = 1.0f; - - pCurrent->offsetS = 0.0f; - pCurrent->offsetT = 0.0f; - - _load(_t, pCurrent); - activateTexture( _t, pCurrent ); - - current[_t] = pCurrent; -} - -void getTextureShiftScale(u32 t, const TextureCache & cache, f32 & shiftScaleS, f32 & shiftScaleT) -{ - if (gSP.textureTile[t]->textureMode != TEXTUREMODE_NORMAL) { - shiftScaleS = cache.current[t]->shiftScaleS; - shiftScaleT = cache.current[t]->shiftScaleT; - return; - } - - if (gDP.otherMode.textureLOD == G_TL_LOD && gSP.texture.level == 0 && !currentCombiner()->usesLOD()) - t = 0; - - if (gSP.textureTile[t]->shifts > 10) - shiftScaleS = (f32)(1 << (16 - gSP.textureTile[t]->shifts)); - else if (gSP.textureTile[t]->shifts > 0) - shiftScaleS /= (f32)(1 << gSP.textureTile[t]->shifts); - - if (gSP.textureTile[t]->shiftt > 10) - shiftScaleT = (f32)(1 << (16 - gSP.textureTile[t]->shiftt)); - else if (gSP.textureTile[t]->shiftt > 0) - shiftScaleT /= (f32)(1 << gSP.textureTile[t]->shiftt); -} - -bool needReplaceTex1ByTex0() -{ - return gSP.texture.level == 0 && gDP.otherMode.textureLOD == G_TL_LOD && gDP.otherMode.textureDetail == G_TD_CLAMP; -} diff --git a/GLideN64/src/Textures.h b/GLideN64/src/Textures.h deleted file mode 100644 index ff996dc..0000000 --- a/GLideN64/src/Textures.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef TEXTURES_H -#define TEXTURES_H - -#include -#include -#include -#include -#include // for size_t - -#include "CRC.h" -#include "convert.h" -#include "Graphics/ObjectHandle.h" -#include "Graphics/Parameter.h" - -typedef u32 (*GetTexelFunc)( u64 *src, u16 x, u16 i, u8 palette ); - -struct CachedTexture -{ - CachedTexture(graphics::ObjectHandle _name) : name(_name), max_level(0), frameBufferTexture(fbNone), bHDTexture(false) {} - - graphics::ObjectHandle name; - u64 crc = 0; -// float fulS, fulT; -// WORD ulS, ulT, lrS, lrT; - float offsetS, offsetT; - u8 maskS, maskT; - u8 clampS, clampT; - u8 mirrorS, mirrorT; - u16 line; - u16 size; - u16 format; - u32 tMem; - u32 palette; - u16 width, height; // N64 width and height - u16 clampWidth, clampHeight; // Size to clamp to - f32 scaleS, scaleT; // Scale to map to 0.0-1.0 - f32 hdRatioS, hdRatioT; // HD / N64 width and height - f32 shiftScaleS, shiftScaleT; // Scale to shift - u32 textureBytes; - - u32 address; - u8 max_level; - enum { - fbNone = 0, - fbOneSample = 1, - fbMultiSample = 2 - } frameBufferTexture; - bool bHDTexture; -}; - - -struct TextureCache -{ - CachedTexture * current[2]; - - void init(); - void destroy(); - void clear(); - CachedTexture * addFrameBufferTexture(graphics::Parameter _target); - void removeFrameBufferTexture(CachedTexture * _pTexture); - void activateTexture(u32 _t, CachedTexture *_pTexture); - void activateDummy(u32 _t); - void activateMSDummy(u32 _t); - void update(u32 _t); - void toggleDumpTex(); - - static TextureCache & get(); - -private: - TextureCache() - : m_pDummy(nullptr) - , m_pMSDummy(nullptr) - , m_hits(0) - , m_misses(0) - , m_curUnpackAlignment(4) - , m_toggleDumpTex(false) - { - current[0] = nullptr; - current[1] = nullptr; - CRC_Init(); - } - TextureCache(const TextureCache &) = delete; - - void _checkCacheSize(); - CachedTexture * _addTexture(u64 _crc64); - void _load(u32 _tile, CachedTexture *_pTexture); - bool _loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 & _ricecrc); - void _loadBackground(CachedTexture *pTexture); - bool _loadHiresBackground(CachedTexture *_pTexture, u64 & _ricecrc); - void _loadDepthTexture(CachedTexture * _pTexture, u16* _pDest); - void _updateBackground(); - void _initDummyTexture(CachedTexture * _pDummy); - void _getTextureDestData(CachedTexture& tmptex, u32* pDest, graphics::Parameter glInternalFormat, GetTexelFunc GetTexel, u16* pLine); - - typedef std::list Textures; - typedef std::unordered_map Texture_Locations; - typedef std::unordered_map FBTextures; - Textures m_textures; - Texture_Locations m_lruTextureLocations; - FBTextures m_fbTextures; - CachedTexture * m_pDummy; - CachedTexture * m_pMSDummy; - u32 m_hits, m_misses; - s32 m_curUnpackAlignment; - bool m_toggleDumpTex; -#ifdef VC - const size_t m_maxCacheSize = 1500; -#else - const size_t m_maxCacheSize = 8000; -#endif -}; - -void getTextureShiftScale(u32 tile, const TextureCache & cache, f32 & shiftScaleS, f32 & shiftScaleT); - -// Check for situation when Tex0 is used instead of Tex1 -bool needReplaceTex1ByTex0(); - -inline TextureCache & textureCache() -{ - return TextureCache::get(); -} - -inline u32 pow2( u32 dim ) -{ - u32 i = 1; - - while (i < dim) i <<= 1; - - return i; -} - -inline u32 powof( u32 dim ) -{ - u32 num = 1; - u32 i = 0; - - while (num < dim) - { - num <<= 1; - i++; - } - - return i; -} -#endif diff --git a/GLideN64/src/TxFilterStub.cpp b/GLideN64/src/TxFilterStub.cpp deleted file mode 100644 index a199a36..0000000 --- a/GLideN64/src/TxFilterStub.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "GLideNHQ/Ext_TxFilter.h" - -TAPI boolean TAPIENTRY -txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, - const wchar_t *txCachePath, const wchar_t *txDumpPath, const wchar_t * texPackPath, - const wchar_t* ident, dispInfoFuncExt callback) -{ - return 0; -} - -TAPI void TAPIENTRY -txfilter_shutdown(void) -{} - -TAPI boolean TAPIENTRY -txfilter_filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, - uint64 g64crc, GHQTexInfo *info) -{ - return 0; -} - -TAPI boolean TAPIENTRY -txfilter_hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info) -{ - return 0; -} - -TAPI uint64 TAPIENTRY -txfilter_checksum(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette) -{ - return 0U; -} - -TAPI boolean TAPIENTRY -txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64) -{ - return 0; -} - -TAPI boolean TAPIENTRY -txfilter_reloadhirestex() -{ - return 0; -} - -TAPI void TAPIENTRY -txfilter_dumpcache(void) -{} diff --git a/GLideN64/src/Types.h b/GLideN64/src/Types.h deleted file mode 100644 index ed1130b..0000000 --- a/GLideN64/src/Types.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned char u8; /* unsigned 8-bit */ -typedef unsigned short u16; /* unsigned 16-bit */ -typedef unsigned int u32; /* unsigned 32-bit */ -typedef unsigned long long u64; /* unsigned 64-bit */ - -typedef signed char s8; /* signed 8-bit */ -typedef short s16; /* signed 16-bit */ -typedef int s32; /* signed 32-bit */ -typedef long long s64; /* signed 64-bit */ - -typedef volatile unsigned char vu8; /* unsigned 8-bit */ -typedef volatile unsigned short vu16; /* unsigned 16-bit */ -typedef volatile unsigned int vu32; /* unsigned 32-bit */ -typedef volatile unsigned long long vu64; /* unsigned 64-bit */ - -typedef volatile signed char vs8; /* signed 8-bit */ -typedef volatile short vs16; /* signed 16-bit */ -typedef volatile int vs32; /* signed 32-bit */ -typedef volatile long long vs64; /* signed 64-bit */ - -typedef float f32; /* single prec floating point */ -typedef double f64; /* double prec floating point */ - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef PLUGIN_PATH_SIZE -#define PLUGIN_PATH_SIZE 260 -#endif - -template -class ValueKeeper -{ -public: - ValueKeeper(T& _obj, T _newVal) - : m_obj(_obj) - , m_val(_obj) - { - m_obj = _newVal; - } - - ~ValueKeeper() - { - m_obj = m_val; - } - -private: - T & m_obj; - T m_val; -}; - -#endif // TYPES_H diff --git a/GLideN64/src/VI.cpp b/GLideN64/src/VI.cpp deleted file mode 100644 index b3b88ad..0000000 --- a/GLideN64/src/VI.cpp +++ /dev/null @@ -1,313 +0,0 @@ -#include "GLideN64.h" -#include -#include "Types.h" -#include "VI.h" -#include "N64.h" -#include "gSP.h" -#include "gDP.h" -#include "RSP.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "FrameBufferInfo.h" -#include "Config.h" -#include "Performance.h" -#include "Debugger.h" -#include "DebugDump.h" -#include "osal_keys.h" -#include "DisplayWindow.h" -#include "GLideNHQ/Ext_TxFilter.h" -#include - -using namespace std; - -VIInfo VI; - -u16 VI_GetMaxBufferHeight(u16 _width) -{ - if (_width > 320 || VI.interlaced) - return VI.PAL ? 580 : 480; - - return VI.PAL ? 290 : 240; -} - -void VI_UpdateSize() -{ - const f32 xScale = _FIXED2FLOAT( _SHIFTR( *REG.VI_X_SCALE, 0, 12 ), 10 ); -// f32 xOffset = _FIXED2FLOAT( _SHIFTR( *REG.VI_X_SCALE, 16, 12 ), 10 ); - - const u32 vScale = _SHIFTR(*REG.VI_Y_SCALE, 0, 12); -// f32 yOffset = _FIXED2FLOAT( _SHIFTR( *REG.VI_Y_SCALE, 16, 12 ), 10 ); - -// const u32 hEnd = _SHIFTR( *REG.VI_H_START, 0, 10 ); -// const u32 hStart = _SHIFTR( *REG.VI_H_START, 16, 10 ); - - // These are in half-lines, so shift an extra bit - const u32 vEnd = _SHIFTR( *REG.VI_V_START, 0, 10 ); - const u32 vStart = _SHIFTR( *REG.VI_V_START, 16, 10 ); - const bool interlacedPrev = VI.interlaced; - if (VI.width > 0) - VI.widthPrev = VI.width; - - VI.real_height = vEnd > vStart ? (((vEnd - vStart) >> 1) * vScale) >> 10 : 0; - VI.width = *REG.VI_WIDTH; - VI.interlaced = (*REG.VI_STATUS & VI_STATUS_SERRATE_ENABLED) != 0; - - if (VI.interlaced) { - f32 fullWidth = 640.0f; - if ((*REG.VI_X_SCALE) % 512 == 0) - fullWidth *= xScale; - if (*REG.VI_WIDTH > fullWidth) { - const u32 scale = (u32)floorf(*REG.VI_WIDTH / fullWidth + 0.5f); - VI.width /= scale; - VI.real_height *= scale; - } - if (VI.real_height % 2 == 1) - --VI.real_height; - } //else if (hEnd != 0 && *REG.VI_WIDTH != 0) - //VI.width = min((u32)floorf((hEnd - hStart)*xScale + 0.5f), *REG.VI_WIDTH); - - VI.PAL = (*REG.VI_V_SYNC & 0x3ff) > 550; - if (VI.PAL && (vEnd - vStart) > 478) { - VI.height = (u32)(VI.real_height*1.0041841f); - if (VI.height > 576) - VI.height = VI.real_height = 576; - } - else { - VI.height = (u32)(VI.real_height*1.0126582f); - if (VI.height > 480) - VI.height = VI.real_height = 480; - } - if (VI.height % 2 == 1) - --VI.height; - -// const int fsaa = ((*REG.VI_STATUS) >> 8) & 3; -// const int divot = ((*REG.VI_STATUS) >> 4) & 1; - FrameBufferList & fbList = frameBufferList(); - FrameBuffer * pBuffer = fbList.findBuffer(VI.lastOrigin & 0xffffff); - DepthBuffer * pDepthBuffer = pBuffer != nullptr ? pBuffer->m_pDepthBuffer : nullptr; - if (config.frameBufferEmulation.enable && - ((interlacedPrev != VI.interlaced) || - (VI.width > 0 && VI.width != VI.widthPrev) || - (!VI.interlaced && pDepthBuffer != nullptr && pDepthBuffer->m_width != VI.width))) { - fbList.removeBuffers(VI.widthPrev); - fbList.removeBuffers(VI.width); - depthBufferList().destroy(); - depthBufferList().init(); - } - - VI.rwidth = VI.width != 0 ? 1.0f / VI.width : 0.0f; - VI.rheight = VI.height != 0 ? 1.0f / VI.height : 0.0f; -} - -static void checkHotkeys() -{ - osal_keys_update_state(); - - if (osal_is_key_pressed(KEY_G, 0x0001)) { - SwitchDump(config.debug.dumpMode); - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkHdTexToggle], 0x0001)) { - if (config.textureFilter.txHiresEnable == 0) - dwnd().getDrawer().showMessage("Enable HD textures\n", Milliseconds(750)); - else - dwnd().getDrawer().showMessage("Disable HD textures\n", Milliseconds(750)); - config.textureFilter.txHiresEnable = !config.textureFilter.txHiresEnable; - textureCache().clear(); - } - - if (config.textureFilter.txHiresEnable != 0) { - /* Force reload hi-res textures. Useful for texture artists */ - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkHdTexReload], 0x0001)) { - dwnd().getDrawer().showMessage("Reload HD textures\n", Milliseconds(750)); - if (txfilter_reloadhirestex()) { - textureCache().clear(); - } - } - - /* Turn on texture dump */ - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkTexDump], 0x0001)) - textureCache().toggleDumpTex(); - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkTexCoordBounds], 0x0001)) { - if (config.graphics2D.enableTexCoordBounds == 0) - dwnd().getDrawer().showMessage("Bound texrect texture coordinates on\n", Milliseconds(1000)); - else - dwnd().getDrawer().showMessage("Bound texrect texture coordinates off\n", Milliseconds(1000)); - config.graphics2D.enableTexCoordBounds = !config.graphics2D.enableTexCoordBounds; - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkNativeResTexrects], 0x0001)) { - static u32 s_nativeResTexrects = Config::NativeResTexrectsMode::ntOptimized; - if (config.graphics2D.enableNativeResTexrects != Config::NativeResTexrectsMode::ntDisable) { - s_nativeResTexrects = config.graphics2D.enableNativeResTexrects; - config.graphics2D.enableNativeResTexrects = Config::NativeResTexrectsMode::ntDisable; - } - else - config.graphics2D.enableNativeResTexrects = s_nativeResTexrects; - if (config.graphics2D.enableNativeResTexrects == Config::NativeResTexrectsMode::ntDisable) - dwnd().getDrawer().showMessage("Disable 2D texrects in native resolution\n", Milliseconds(1000)); - else - dwnd().getDrawer().showMessage("Enable 2D texrects in native resolution\n", Milliseconds(1000)); - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkVsync], 0x0001)) { - config.video.verticalSync = !config.video.verticalSync; - dwnd().stop(); - dwnd().start(); - if (config.video.verticalSync == 0) - dwnd().getDrawer().showMessage("Disable vertical sync\n", Milliseconds(1000)); - else - dwnd().getDrawer().showMessage("Enable vertical sync\n", Milliseconds(1000)); - } - - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkFBEmulation], 0x0001)) { - config.frameBufferEmulation.enable = !config.frameBufferEmulation.enable; - dwnd().stop(); - dwnd().start(); - if (config.frameBufferEmulation.enable == 0) - dwnd().getDrawer().showMessage("Disable frame buffer emulation\n", Milliseconds(2000)); - else - dwnd().getDrawer().showMessage("Enable frame buffer emulation\n", Milliseconds(1000)); - } - - if (config.frameBufferEmulation.enable != 0 && - osal_is_key_pressed(config.hotkeys.keys[Config::hkN64DepthCompare], 0x0001)) { - static u32 N64DepthCompare = Config::N64DepthCompareMode::dcCompatible; - if (config.frameBufferEmulation.N64DepthCompare != Config::N64DepthCompareMode::dcDisable) { - N64DepthCompare = config.frameBufferEmulation.N64DepthCompare; - config.frameBufferEmulation.N64DepthCompare = Config::N64DepthCompareMode::dcDisable; - } else - config.frameBufferEmulation.N64DepthCompare = N64DepthCompare; - dwnd().stop(); - dwnd().start(); - if (config.frameBufferEmulation.N64DepthCompare == Config::N64DepthCompareMode::dcDisable) - dwnd().getDrawer().showMessage("Disable N64 depth compare\n", Milliseconds(1000)); - else - dwnd().getDrawer().showMessage("Enable N64 depth compare\n", Milliseconds(1000)); - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdVis], 0x0001)) { - config.onScreenDisplay.vis = !config.onScreenDisplay.vis; - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdFps], 0x0001)) { - config.onScreenDisplay.fps = !config.onScreenDisplay.fps; - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdPercent], 0x0001)) { - config.onScreenDisplay.percent = !config.onScreenDisplay.percent; - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdInternalResolution], 0x0001)) { - config.onScreenDisplay.internalResolution = !config.onScreenDisplay.internalResolution; - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdRenderingResolution], 0x0001)) { - config.onScreenDisplay.renderingResolution = !config.onScreenDisplay.renderingResolution; - } - - if (osal_is_key_pressed(config.hotkeys.keys[Config::hkForceGammaCorrection], 0x0001)) { - if (config.gammaCorrection.force == 0) - dwnd().getDrawer().showMessage("Force gamma correction on\n", Milliseconds(750)); - else - dwnd().getDrawer().showMessage("Force gamma correction off\n", Milliseconds(750)); - config.gammaCorrection.force = !config.gammaCorrection.force; - } -} - -void VI_UpdateScreen() -{ - if (VI.lastOrigin == -1) // Workaround for Mupen64Plus issue with initialization - gfxContext.isError(); - - DebugMsg(DEBUG_DETAIL, "VI_UpdateScreen Origin: %08x, Old origin: %08x, width: %d\n", *REG.VI_ORIGIN, VI.lastOrigin, *REG.VI_WIDTH); - - if (ConfigOpen) - return; - - perf.increaseVICount(); - DisplayWindow & wnd = dwnd(); - if (wnd.changeWindow()) - return; - if (wnd.resizeWindow()) - return; - wnd.saveScreenshot(); - g_debugger.checkDebugState(); - - checkHotkeys(); - - bool bVIUpdated = false; - if (*REG.VI_ORIGIN != VI.lastOrigin) { - VI_UpdateSize(); - bVIUpdated = true; - wnd.updateScale(); - perf.increaseFramesCount(); - } - - if (config.frameBufferEmulation.enable) { - - FrameBuffer * pBuffer = frameBufferList().findBuffer(*REG.VI_ORIGIN & 0xffffff); - if (pBuffer == nullptr) { - gDP.changed |= CHANGED_CPU_FB_WRITE; - } else if (!FBInfo::fbInfo.isSupported() && - (config.generalEmulation.hacks & hack_RE2) == 0 && - !pBuffer->isValid(true)) { - gDP.changed |= CHANGED_CPU_FB_WRITE; - if (config.frameBufferEmulation.copyToRDRAM == 0 && (config.generalEmulation.hacks & hack_subscreen) == 0) - pBuffer->copyRdram(); - } - - const bool bCFB = (gDP.changed&CHANGED_CPU_FB_WRITE) == CHANGED_CPU_FB_WRITE; - bool bNeedSwap = false; - switch (config.frameBufferEmulation.bufferSwapMode) { - case Config::bsOnVerticalInterrupt: - bNeedSwap = true; - break; - case Config::bsOnVIOriginChange: - bNeedSwap = bCFB ? true : (*REG.VI_ORIGIN != VI.lastOrigin); - break; - case Config::bsOnColorImageChange: - bNeedSwap = bCFB ? true : (gDP.colorImage.changed != 0); - break; - } - - if (bNeedSwap) { - if (bCFB) { - if (pBuffer == nullptr || pBuffer->m_width != VI.width) { - if (!bVIUpdated) { - VI_UpdateSize(); - wnd.updateScale(); - bVIUpdated = true; - } - const u32 size = *REG.VI_STATUS & VI_STATUS_TYPE_32; - if (VI.height > 0 && size > G_IM_SIZ_8b && VI.width > 0) - frameBufferList().saveBuffer(*REG.VI_ORIGIN & 0xffffff, G_IM_FMT_RGBA, size, VI.width, true); - } - } -// if ((((*REG.VI_STATUS) & 3) > 0) && (gDP.colorImage.changed || bCFB)) { // Does not work in release build!!! - if (((*REG.VI_STATUS) & VI_STATUS_TYPE_32) > 0) { - if (!bVIUpdated) { - VI_UpdateSize(); - bVIUpdated = true; - } - FrameBuffer_CopyFromRDRAM(*REG.VI_ORIGIN & 0xffffff, bCFB); - } - frameBufferList().renderBuffer(); - frameBufferList().clearBuffersChanged(); - VI.lastOrigin = *REG.VI_ORIGIN; - } - } else { - if (gDP.changed & CHANGED_COLORBUFFER) { - frameBufferList().renderBuffer(); - gDP.changed &= ~CHANGED_COLORBUFFER; - VI.lastOrigin = *REG.VI_ORIGIN; - } - } - - if (VI.lastOrigin == -1) { // Workaround for Mupen64Plus issue with initialization - gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f); - } -} diff --git a/GLideN64/src/VI.h b/GLideN64/src/VI.h deleted file mode 100644 index 440ed83..0000000 --- a/GLideN64/src/VI.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef VI_H -#define VI_H -#include "Types.h" - -// VI status register -#define VI_STATUS_TYPE_16 0x000002 /* 16 bit 5/5/5/3 */ -#define VI_STATUS_TYPE_32 0x000003 /* 32 bit 8/8/8/8 */ -#define VI_STATUS_GAMMA_DITHER_ENABLED 0x000004 -#define VI_STATUS_GAMMA_ENABLED 0x000008 -#define VI_STATUS_DIVOT_ENABLED 0x000010 -#define VI_STATUS_SERRATE_ENABLED 0x000040 -#define VI_STATUS_AA_MASK 0x000300 /* see AA modes */ -#define VI_STATUS_DITHER_FILTER_ENABLED 0x010000 - -// AA modes -#define AA_MODE_AA_RESAMPLE_ALWAYS_FETCH 0x000000 /* Always fetch lines */ -#define AA_MODE_AA_RESAMPLE 0x000100 /* Fetch extra line if needed */ -#define AA_MODE_RESAMPLE_ONLY 0x000200 -#define AA_MODE_NEITHER 0x000300 /* Replicate pixels, no interpolation */ - -struct VIInfo -{ - u32 width, widthPrev, height, real_height; - f32 rwidth, rheight; - u32 lastOrigin; - bool interlaced; - bool PAL; - - VIInfo() : - width(0), widthPrev(0), height(0), real_height(0), rwidth(0), rheight(0), - lastOrigin(-1), interlaced(false), PAL(false) - {} -}; - -extern VIInfo VI; - -void VI_UpdateSize(); -void VI_UpdateScreen(); -u16 VI_GetMaxBufferHeight(u16 _width); - -#endif - diff --git a/GLideN64/src/ZilmarGFX_1_3.h b/GLideN64/src/ZilmarGFX_1_3.h deleted file mode 100644 index f1cde0f..0000000 --- a/GLideN64/src/ZilmarGFX_1_3.h +++ /dev/null @@ -1,283 +0,0 @@ -/********************************************************************************** -Common gfx plugin spec, version #1.3 maintained by zilmar (zilmar@emulation64.com) - -All questions or suggestions should go through the mailing list. -http://www.egroups.com/group/Plugin64-Dev -*********************************************************************************** - -Notes: ------- - -Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which -are both passed to the DLL in InitiateGFX will generate an Interrupt from with in -the plugin. - -The Setting of the RSP flags and generating an SP interrupt should not be done in -the plugin - -**********************************************************************************/ -#ifndef _GFX_H_INCLUDED__ -#define _GFX_H_INCLUDED__ - -#if defined(__cplusplus) -extern "C" { -#endif - -/* Plugin types */ -#define PLUGIN_TYPE_GFX 2 - -#ifdef OS_WINDOWS - #define EXPORT __declspec(dllexport) - #define CALL __cdecl -#else - #define EXPORT __attribute__((visibility("default"))) - #define CALL _cdecl -#endif - -/***** Structures *****/ -typedef struct { - WORD Version; /* Set to 0x0103 */ - WORD Type; /* Set to PLUGIN_TYPE_GFX */ - char Name[100]; /* Name of the DLL */ - - /* If DLL supports memory these memory options then set them to TRUE or FALSE - if it does not support it */ - BOOL NormalMemory; /* a normal BYTE array */ - BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre - bswap on a dword (32 bits) boundry */ -} PLUGIN_INFO; - -typedef struct { - HWND hWnd; /* Render window */ - HWND hStatusBar; /* if render window does not have a status bar then this is NULL */ - - BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre - // bswap on a dword (32 bits) boundry - // eg. the first 8 bytes are stored like this: - // 4 3 2 1 8 7 6 5 - - unsigned char * HEADER; /* This is the rom header (first 40h bytes of the rom) */ - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * DPC_START_REG; - unsigned int * DPC_END_REG; - unsigned int * DPC_CURRENT_REG; - unsigned int * DPC_STATUS_REG; - unsigned int * DPC_CLOCK_REG; - unsigned int * DPC_BUFBUSY_REG; - unsigned int * DPC_PIPEBUSY_REG; - unsigned int * DPC_TMEM_REG; - - unsigned int * VI_STATUS_REG; - unsigned int * VI_ORIGIN_REG; - unsigned int * VI_WIDTH_REG; - unsigned int * VI_INTR_REG; - unsigned int * VI_V_CURRENT_LINE_REG; - unsigned int * VI_TIMING_REG; - unsigned int * VI_V_SYNC_REG; - unsigned int * VI_H_SYNC_REG; - unsigned int * VI_LEAP_REG; - unsigned int * VI_H_START_REG; - unsigned int * VI_V_START_REG; - unsigned int * VI_V_BURST_REG; - unsigned int * VI_X_SCALE_REG; - unsigned int * VI_Y_SCALE_REG; - - void (*CheckInterrupts)( void ); -} GFX_INFO; - -/****************************************************************** - Function: CaptureScreen - Purpose: This function dumps the current frame to a file - input: pointer to the directory to save the file to - output: none -*******************************************************************/ -EXPORT void CALL CaptureScreen ( char * Directory ); - -/****************************************************************** - Function: ChangeWindow - Purpose: to change the window between fullscreen and window - mode. If the window was in fullscreen this should - change the screen to window mode and vice vesa. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ChangeWindow (void); - -/****************************************************************** - Function: CloseDLL - Purpose: This function is called when the emulator is closing - down allowing the dll to de-initialise. - input: none - output: none -*******************************************************************/ -EXPORT void CALL CloseDLL (void); - -/****************************************************************** - Function: DllAbout - Purpose: This function is optional function that is provided - to give further information about the DLL. - input: a handle to the window that calls this function - output: none -*******************************************************************/ -EXPORT void CALL DllAbout ( HWND hParent ); - -/****************************************************************** - Function: DllConfig - Purpose: This function is optional function that is provided - to allow the user to configure the dll - input: a handle to the window that calls this function - output: none -*******************************************************************/ -EXPORT void CALL DllConfig ( HWND hParent ); - -/****************************************************************** - Function: DllTest - Purpose: This function is optional function that is provided - to allow the user to test the dll - input: a handle to the window that calls this function - output: none -*******************************************************************/ -EXPORT void CALL DllTest ( HWND hParent ); - -/****************************************************************** - Function: DrawScreen - Purpose: This function is called when the emulator receives a - WM_PAINT message. This allows the gfx to fit in when - it is being used in the desktop. - input: none - output: none -*******************************************************************/ -EXPORT void CALL DrawScreen (void); - -/****************************************************************** - Function: GetDllInfo - Purpose: This function allows the emulator to gather information - about the dll by filling in the PluginInfo structure. - input: a pointer to a PLUGIN_INFO stucture that needs to be - filled by the function. (see def above) - output: none -*******************************************************************/ -EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ); - -/****************************************************************** - Function: InitiateGFX - Purpose: This function is called when the DLL is started to give - information from the emulator that the n64 graphics - uses. This is not called from the emulation thread. - Input: Gfx_Info is passed to this function which is defined - above. - Output: TRUE on success - FALSE on failure to initialise - - ** note on interrupts **: - To generate an interrupt set the appropriate bit in MI_INTR_REG - and then call the function CheckInterrupts to tell the emulator - that there is a waiting interrupt. -*******************************************************************/ -EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info); - -/****************************************************************** - Function: MoveScreen - Purpose: This function is called in response to the emulator - receiving a WM_MOVE passing the xpos and ypos passed - from that message. - input: xpos - the x-coordinate of the upper-left corner of the - client area of the window. - ypos - y-coordinate of the upper-left corner of the - client area of the window. - output: none -*******************************************************************/ -EXPORT void CALL MoveScreen (int xpos, int ypos); - -/****************************************************************** - Function: ProcessDList - Purpose: This function is called when there is a Dlist to be - processed. (High level GFX list) - input: none - output: none -*******************************************************************/ -EXPORT void CALL ProcessDList(void); - -/****************************************************************** - Function: ProcessRDPList - Purpose: This function is called when there is a Dlist to be - processed. (Low level GFX list) - input: none - output: none -*******************************************************************/ -EXPORT void CALL ProcessRDPList(void); - -/****************************************************************** - Function: RomClosed - Purpose: This function is called when a rom is closed. - input: none - output: none -*******************************************************************/ -EXPORT void CALL RomClosed (void); - -/****************************************************************** - Function: RomOpen - Purpose: This function is called when a rom is open. (from the - emulation thread) - input: none - output: none -*******************************************************************/ -EXPORT void CALL RomOpen (void); - -/****************************************************************** - Function: ShowCFB - Purpose: Useally once Dlists are started being displayed, cfb is - ignored. This function tells the dll to start displaying - them again. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ShowCFB (void); - -/****************************************************************** - Function: UpdateScreen - Purpose: This function is called in response to a vsync of the - screen were the VI bit in MI_INTR_REG has already been - set - input: none - output: none -*******************************************************************/ -EXPORT void CALL UpdateScreen (void); - -/****************************************************************** - Function: ViStatusChanged - Purpose: This function is called to notify the dll that the - ViStatus registers value has been changed. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ViStatusChanged (void); - -/****************************************************************** - Function: ViWidthChanged - Purpose: This function is called to notify the dll that the - ViWidth registers value has been changed. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ViWidthChanged (void); - -/****************************************************************** - Function: ReadScreen - Purpose: Capture the current screen - Input: none - Output: dest - 24-bit RGB data (flipped horizontally) - width - width of image - height - height of image - ******************************************************************/ -EXPORT void CALL ReadScreen (void **dest, long *width, long *height); - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/GLideN64/src/ZilmarPluginAPI.cpp b/GLideN64/src/ZilmarPluginAPI.cpp deleted file mode 100644 index 89bd028..0000000 --- a/GLideN64/src/ZilmarPluginAPI.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifdef OS_WINDOWS -# include -#else -# include "winlnxdefs.h" -#endif // OS_WINDOWS - -#include "PluginAPI.h" -#include "N64.h" - -extern "C" { - -EXPORT void CALL RomOpen (void) -{ - RDRAMSize = 0; - api().RomOpen(); -} - -EXPORT void CALL CaptureScreen ( char * Directory ) -{ - api().CaptureScreen(Directory); -} - -EXPORT void CALL CloseDLL (void) -{ - api().CloseDLL(); -} - -EXPORT void CALL DllAbout ( HWND hParent ) -{ - api().DllAbout(/*hParent*/); -} - -EXPORT void CALL DllConfig ( HWND hParent ) -{ - api().DllConfig(hParent); -} - -EXPORT void CALL DllTest ( HWND hParent ) -{ - api().DllTest(hParent); -} - -EXPORT void CALL DrawScreen (void) -{ - api().DrawScreen(); -} - -EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ) -{ - api().GetDllInfo(PluginInfo); -} - -EXPORT void CALL ReadScreen (void **dest, long *width, long *height) -{ - api().ReadScreen(dest, width, height); -} - -} diff --git a/GLideN64/src/ZlutTexture.cpp b/GLideN64/src/ZlutTexture.cpp deleted file mode 100644 index 7e90f5c..0000000 --- a/GLideN64/src/ZlutTexture.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "Graphics/Context.h" -#include "Graphics/Parameters.h" -#include "DepthBuffer.h" -#include "Config.h" -#include "Textures.h" -#include "ZlutTexture.h" - -using namespace graphics; - -ZlutTexture g_zlutTexture; - -ZlutTexture::ZlutTexture() -: m_pTexture(nullptr) -{ -} - -void ZlutTexture::init() -{ - if (!Context::IntegerTextures) - return; - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - std::vector vecZLUT(0x40000); - const u16 * const zLUT16 = depthBufferList().getZLUT(); - for (u32 i = 0; i < 0x40000; ++i) - vecZLUT[i] = zLUT16[i]; - - m_pTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D); - m_pTexture->format = G_IM_FMT_IA; - m_pTexture->clampS = 1; - m_pTexture->clampT = 1; - m_pTexture->frameBufferTexture = CachedTexture::fbOneSample; - m_pTexture->maskS = 0; - m_pTexture->maskT = 0; - m_pTexture->mirrorS = 0; - m_pTexture->mirrorT = 0; - m_pTexture->width = 512; - m_pTexture->height = 512; - m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.lutFormatBytes; - - Context::InitTextureParams initParams; - initParams.handle = m_pTexture->name; - initParams.width = m_pTexture->width; - initParams.height = m_pTexture->height; - initParams.internalFormat = fbTexFormats.lutInternalFormat; - initParams.format = fbTexFormats.lutFormat; - initParams.dataType = fbTexFormats.lutType; - initParams.data = vecZLUT.data(); - gfxContext.init2DTexture(initParams); - - Context::TexParameters setParams; - setParams.handle = m_pTexture->name; - setParams.target = textureTarget::TEXTURE_2D; - setParams.textureUnitIndex = textureIndices::ZLUTTex; - setParams.minFilter = textureParameters::FILTER_NEAREST; - setParams.magFilter = textureParameters::FILTER_NEAREST; - setParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE; - setParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE; - gfxContext.setTextureParameters(setParams); -} - -void ZlutTexture::destroy() -{ - if (!Context::IntegerTextures) - return; - - const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats(); - - textureCache().removeFrameBufferTexture(m_pTexture); - m_pTexture = nullptr; -} diff --git a/GLideN64/src/ZlutTexture.h b/GLideN64/src/ZlutTexture.h deleted file mode 100644 index d871b80..0000000 --- a/GLideN64/src/ZlutTexture.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -struct CachedTexture; - -class ZlutTexture -{ -public: - ZlutTexture(); - - void init(); - void destroy(); - -private: - CachedTexture * m_pTexture; -}; - -extern ZlutTexture g_zlutTexture; diff --git a/GLideN64/src/common/CommonAPIImpl_common.cpp b/GLideN64/src/common/CommonAPIImpl_common.cpp deleted file mode 100644 index 70f3eee..0000000 --- a/GLideN64/src/common/CommonAPIImpl_common.cpp +++ /dev/null @@ -1,314 +0,0 @@ -#ifdef OS_WINDOWS -# include -#else -# include -#endif // OS_WINDOWS -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Graphics/Context.h" -#include -#include - -PluginAPI & PluginAPI::get() -{ - static PluginAPI api; - return api; -} - -#ifdef RSPTHREAD -class APICommand { -public: - virtual bool run() = 0; -}; - -void RSP_ThreadProc(std::mutex * _pRspThreadMtx, std::mutex * _pPluginThreadMtx, std::condition_variable_any * _pRspThreadCv, std::condition_variable_any * _pPluginThreadCv, APICommand ** _pCommand) -{ - _pRspThreadMtx->lock(); - RSP_Init(); - GBI.init(); - Config_LoadConfig(); - dwnd().start(); - assert(!gfxContext.isError()); - - while (true) { - _pPluginThreadMtx->lock(); - _pPluginThreadCv->notify_one(); - _pPluginThreadMtx->unlock(); - _pRspThreadCv->wait(*_pRspThreadMtx); - if (*_pCommand != nullptr && !(*_pCommand)->run()) - return; - assert(!gfxContext.isError()); - } -} - -void PluginAPI::_callAPICommand(APICommand & _command) -{ - m_pCommand = &_command; - m_pluginThreadMtx.lock(); - m_rspThreadMtx.lock(); - m_rspThreadCv.notify_one(); - m_rspThreadMtx.unlock(); - m_pluginThreadCv.wait(m_pluginThreadMtx); - m_pluginThreadMtx.unlock(); - m_pCommand = nullptr; -} - -class ProcessDListCommand : public APICommand { -public: - bool run() { - RSP_ProcessDList(); - return true; - } -}; - -class ProcessRDPListCommand : public APICommand { -public: - bool run() { - RDP_ProcessRDPList(); - return true; - } -}; - -class ProcessUpdateScreenCommand : public APICommand { -public: - bool run() { - VI_UpdateScreen(); - return true; - } -}; - -class FBReadCommand : public APICommand { -public: - FBReadCommand(u32 _addr) : m_addr(_addr) { - } - - bool run() { - FBInfo::fbInfo.Read(m_addr); - return true; - } -private: - u32 m_addr; -}; - -class ReadScreenCommand : public APICommand { -public: - ReadScreenCommand(void **_dest, long *_width, long *_height) - : m_dest(_dest) - , m_width(_width) - , m_height(_height) { - } - - bool run() { - dwnd().readScreen(m_dest, m_width, m_height); - return true; - } - -private: - void ** m_dest; - long * m_width; - long * m_height; -}; - -class RomClosedCommand : public APICommand { -public: - RomClosedCommand(std::mutex * _pRspThreadMtx, - std::mutex * _pPluginThreadMtx, - std::condition_variable_any * _pRspThreadCv, - std::condition_variable_any * _pPluginThreadCv) - : m_pRspThreadMtx(_pRspThreadMtx) - , m_pPluginThreadMtx(_pPluginThreadMtx) - , m_pRspThreadCv(_pRspThreadCv) - , m_pPluginThreadCv(_pPluginThreadCv) { - } - - bool run() { - TFH.dumpcache(); - dwnd().stop(); - GBI.destroy(); - m_pRspThreadMtx->unlock(); - m_pPluginThreadMtx->lock(); - m_pPluginThreadCv->notify_one(); - m_pPluginThreadMtx->unlock(); - return false; - } - -private: - std::mutex * m_pRspThreadMtx; - std::mutex * m_pPluginThreadMtx; - std::condition_variable_any * m_pRspThreadCv; - std::condition_variable_any * m_pPluginThreadCv; -}; -#endif - -void PluginAPI::ProcessDList() -{ - LOG(LOG_APIFUNC, "ProcessDList"); -#ifdef RSPTHREAD - _callAPICommand(ProcessDListCommand()); -#else - RSP_ProcessDList(); -#endif -} - -void PluginAPI::ProcessRDPList() -{ - LOG(LOG_APIFUNC, "ProcessRDPList"); -#ifdef RSPTHREAD - _callAPICommand(ProcessRDPListCommand()); -#else - RDP_ProcessRDPList(); -#endif -} - -void PluginAPI::RomClosed() -{ - if (!m_bRomOpen) - return; - - m_bRomOpen = false; - - LOG(LOG_APIFUNC, "RomClosed"); -#ifdef RSPTHREAD - _callAPICommand(RomClosedCommand( - &m_rspThreadMtx, - &m_pluginThreadMtx, - &m_rspThreadCv, - &m_pluginThreadCv) - ); - delete m_pRspThread; - m_pRspThread = nullptr; -#else - TFH.dumpcache(); - dwnd().stop(); - GBI.destroy(); -#endif - osal_keys_quit(); -} - -int PluginAPI::RomOpen() -{ - LOG(LOG_APIFUNC, "RomOpen"); -#ifdef RSPTHREAD - m_pluginThreadMtx.lock(); - m_pRspThread = new std::thread(RSP_ThreadProc, &m_rspThreadMtx, &m_pluginThreadMtx, &m_rspThreadCv, &m_pluginThreadCv, &m_pCommand); - m_pRspThread->detach(); - m_pluginThreadCv.wait(m_pluginThreadMtx); - m_pluginThreadMtx.unlock(); -#else - RSP_Init(); - GBI.init(); - Config_LoadConfig(); - if (!dwnd().start()) - return 0; -#endif - osal_keys_init(); - - m_bRomOpen = true; - - return 1; -} - -void PluginAPI::ShowCFB() -{ - gDP.changed |= CHANGED_CPU_FB_WRITE; -} - -void PluginAPI::UpdateScreen() -{ - LOG(LOG_APIFUNC, "UpdateScreen"); -#ifdef RSPTHREAD - _callAPICommand(ProcessUpdateScreenCommand()); -#else - VI_UpdateScreen(); -#endif -} - -void PluginAPI::_initiateGFX(const GFX_INFO & _gfxInfo) const { - HEADER = _gfxInfo.HEADER; - DMEM = _gfxInfo.DMEM; - IMEM = _gfxInfo.IMEM; - RDRAM = _gfxInfo.RDRAM; - - REG.MI_INTR = _gfxInfo.MI_INTR_REG; - REG.DPC_START = _gfxInfo.DPC_START_REG; - REG.DPC_END = _gfxInfo.DPC_END_REG; - REG.DPC_CURRENT = _gfxInfo.DPC_CURRENT_REG; - REG.DPC_STATUS = _gfxInfo.DPC_STATUS_REG; - REG.DPC_CLOCK = _gfxInfo.DPC_CLOCK_REG; - REG.DPC_BUFBUSY = _gfxInfo.DPC_BUFBUSY_REG; - REG.DPC_PIPEBUSY = _gfxInfo.DPC_PIPEBUSY_REG; - REG.DPC_TMEM = _gfxInfo.DPC_TMEM_REG; - - REG.VI_STATUS = _gfxInfo.VI_STATUS_REG; - REG.VI_ORIGIN = _gfxInfo.VI_ORIGIN_REG; - REG.VI_WIDTH = _gfxInfo.VI_WIDTH_REG; - REG.VI_INTR = _gfxInfo.VI_INTR_REG; - REG.VI_V_CURRENT_LINE = _gfxInfo.VI_V_CURRENT_LINE_REG; - REG.VI_TIMING = _gfxInfo.VI_TIMING_REG; - REG.VI_V_SYNC = _gfxInfo.VI_V_SYNC_REG; - REG.VI_H_SYNC = _gfxInfo.VI_H_SYNC_REG; - REG.VI_LEAP = _gfxInfo.VI_LEAP_REG; - REG.VI_H_START = _gfxInfo.VI_H_START_REG; - REG.VI_V_START = _gfxInfo.VI_V_START_REG; - REG.VI_V_BURST = _gfxInfo.VI_V_BURST_REG; - REG.VI_X_SCALE = _gfxInfo.VI_X_SCALE_REG; - REG.VI_Y_SCALE = _gfxInfo.VI_Y_SCALE_REG; - - CheckInterrupts = _gfxInfo.CheckInterrupts; - - REG.SP_STATUS = nullptr; -} - -void PluginAPI::ChangeWindow() -{ - LOG(LOG_APIFUNC, "ChangeWindow"); - dwnd().setToggleFullscreen(); - if (!m_bRomOpen) - dwnd().closeWindow(); -} - -void PluginAPI::FBWrite(unsigned int _addr, unsigned int _size) -{ - FBInfo::fbInfo.Write(_addr, _size); -} - -void PluginAPI::FBRead(unsigned int _addr) -{ -#ifdef RSPTHREAD - _callAPICommand(FBReadCommand(_addr)); -#else - FBInfo::fbInfo.Read(_addr); -#endif -} - -void PluginAPI::FBGetFrameBufferInfo(void * _pinfo) -{ - FBInfo::fbInfo.GetInfo(_pinfo); -} - -#ifndef MUPENPLUSAPI -void PluginAPI::FBWList(FrameBufferModifyEntry * _plist, unsigned int _size) -{ - FBInfo::fbInfo.WriteList(reinterpret_cast(_plist), _size); -} - -void PluginAPI::ReadScreen(void **_dest, long *_width, long *_height) -{ -#ifdef RSPTHREAD - _callAPICommand(ReadScreenCommand(_dest, _width, _height)); -#else - dwnd().readScreen(_dest, _width, _height); -#endif -} -#endif diff --git a/GLideN64/src/convert.cpp b/GLideN64/src/convert.cpp deleted file mode 100644 index 137c33d..0000000 --- a/GLideN64/src/convert.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "convert.h" - -const volatile unsigned char Five2Eight[32] = -{ - 0, // 00000 = 00000000 - 8, // 00001 = 00001000 - 16, // 00010 = 00010000 - 25, // 00011 = 00011001 - 33, // 00100 = 00100001 - 41, // 00101 = 00101001 - 49, // 00110 = 00110001 - 58, // 00111 = 00111010 - 66, // 01000 = 01000010 - 74, // 01001 = 01001010 - 82, // 01010 = 01010010 - 90, // 01011 = 01011010 - 99, // 01100 = 01100011 - 107, // 01101 = 01101011 - 115, // 01110 = 01110011 - 123, // 01111 = 01111011 - 132, // 10000 = 10000100 - 140, // 10001 = 10001100 - 148, // 10010 = 10010100 - 156, // 10011 = 10011100 - 165, // 10100 = 10100101 - 173, // 10101 = 10101101 - 181, // 10110 = 10110101 - 189, // 10111 = 10111101 - 197, // 11000 = 11000101 - 206, // 11001 = 11001110 - 214, // 11010 = 11010110 - 222, // 11011 = 11011110 - 230, // 11100 = 11100110 - 239, // 11101 = 11101111 - 247, // 11110 = 11110111 - 255 // 11111 = 11111111 -}; - -const volatile unsigned char Four2Eight[16] = -{ - 0, // 0000 = 00000000 - 17, // 0001 = 00010001 - 34, // 0010 = 00100010 - 51, // 0011 = 00110011 - 68, // 0100 = 01000100 - 85, // 0101 = 01010101 - 102, // 0110 = 01100110 - 119, // 0111 = 01110111 - 136, // 1000 = 10001000 - 153, // 1001 = 10011001 - 170, // 1010 = 10101010 - 187, // 1011 = 10111011 - 204, // 1100 = 11001100 - 221, // 1101 = 11011101 - 238, // 1110 = 11101110 - 255 // 1111 = 11111111 -}; - -const volatile unsigned char Three2Four[8] = -{ - 0, // 000 = 0000 - 2, // 001 = 0010 - 4, // 010 = 0100 - 6, // 011 = 0110 - 9, // 100 = 1001 - 11, // 101 = 1011 - 13, // 110 = 1101 - 15, // 111 = 1111 -}; - -const volatile unsigned char Three2Eight[8] = -{ - 0, // 000 = 00000000 - 36, // 001 = 00100100 - 73, // 010 = 01001001 - 109, // 011 = 01101101 - 146, // 100 = 10010010 - 182, // 101 = 10110110 - 219, // 110 = 11011011 - 255, // 111 = 11111111 -}; -const volatile unsigned char Two2Eight[4] = -{ - 0, // 00 = 00000000 - 85, // 01 = 01010101 - 170, // 10 = 10101010 - 255 // 11 = 11111111 -}; - -const volatile unsigned char One2Four[2] = -{ - 0, // 0 = 0000 - 15, // 1 = 1111 -}; - -const volatile unsigned char One2Eight[2] = -{ - 0, // 0 = 00000000 - 255, // 1 = 11111111 -}; - -void UnswapCopyWrap(const u8 *src, u32 srcIdx, u8 *dest, u32 destIdx, u32 destMask, u32 numBytes) -{ - // copy leading bytes - u32 leadingBytes = srcIdx & 3; - if (leadingBytes != 0) { - leadingBytes = 4 - leadingBytes; - if (leadingBytes > numBytes) - leadingBytes = numBytes; - numBytes -= leadingBytes; - - srcIdx ^= 3; - for (u32 i = 0; i < leadingBytes; i++) { - dest[destIdx&destMask] = src[srcIdx]; - ++destIdx; - --srcIdx; - } - srcIdx += 5; - } - - // copy dwords - int numDWords = numBytes >> 2; - while (numDWords--) { - dest[(destIdx + 3) & destMask] = src[srcIdx++]; - dest[(destIdx + 2) & destMask] = src[srcIdx++]; - dest[(destIdx + 1) & destMask] = src[srcIdx++]; - dest[(destIdx + 0) & destMask] = src[srcIdx++]; - destIdx += 4; - } - - // copy trailing bytes - int trailingBytes = numBytes & 3; - if (trailingBytes) { - srcIdx ^= 3; - for (int i = 0; i < trailingBytes; i++) { - dest[destIdx&destMask] = src[srcIdx]; - ++destIdx; - --srcIdx; - } - } -} - -void DWordInterleaveWrap(u32 *src, u32 srcIdx, u32 srcMask, u32 numQWords) -{ - u32 p0, idx0, idx1; - while (numQWords--) { - idx0 = srcIdx++ & srcMask; - idx1 = srcIdx++ & srcMask; - p0 = src[idx0]; - src[idx0] = src[idx1]; - src[idx1] = p0; - } -} diff --git a/GLideN64/src/convert.h b/GLideN64/src/convert.h deleted file mode 100644 index 158c89a..0000000 --- a/GLideN64/src/convert.h +++ /dev/null @@ -1,364 +0,0 @@ -#ifndef CONVERT_H -#define CONVERT_H - -#include "Types.h" - -extern const volatile unsigned char Five2Eight[32]; -extern const volatile unsigned char Four2Eight[16]; -extern const volatile unsigned char Three2Four[8]; -extern const volatile unsigned char Three2Eight[8]; -extern const volatile unsigned char Two2Eight[4]; -extern const volatile unsigned char One2Four[2]; -extern const volatile unsigned char One2Eight[2]; - -void UnswapCopyWrap(const u8 *src, u32 srcIdx, u8 *dest, u32 destIdx, u32 destMask, u32 numBytes); - -void DWordInterleaveWrap(u32 *src, u32 srcIdx, u32 srcMask, u32 numQWords); - -inline u16 swapword( u16 value ) -{ -#ifdef WIN32_ASM - __asm - { - mov ax, word ptr [value] - xchg ah, al - } -#else // WIN32_ASM - return (value << 8) | (value >> 8); -#endif // WIN32_ASM -} - -inline u16 RGBA8888_RGBA4444( u32 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov ebx, dword ptr [color] - // R - and bl, 0F0h - mov ah, bl - - // G - shr bh, 4 - or ah, bh - - bswap ebx - - // B - and bh, 0F0h - mov al, bh - - // A - shr bl, 4 - or al, bl - } -#else // WIN32_ASM - return ((color & 0x000000f0) << 8) | // r - ((color & 0x0000f000) >> 4) | // g - ((color & 0x00f00000) >> 16) | // b - ((color & 0xf0000000) >> 28); // a -#endif // WIN32_ASM -} - -inline u32 RGBA5551_RGBA8888( u16 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov ebx, 00000000h - mov cx, word ptr [color] - xchg cl, ch - - mov bx, cx - and bx, 01h - mov al, byte ptr [One2Eight+ebx] - - mov bx, cx - shr bx, 01h - and bx, 1Fh - mov ah, byte ptr [Five2Eight+ebx] - - bswap eax - - mov bx, cx - shr bx, 06h - and bx, 1Fh - mov ah, byte ptr [Five2Eight+ebx] - - mov bx, cx - shr bx, 0Bh - and bx, 1Fh - mov al, byte ptr [Five2Eight+ebx] - } -#else // WIN32_ASM - color = swapword( color ); - u8 r, g, b, a; - r = Five2Eight[color >> 11]; - g = Five2Eight[(color >> 6) & 0x001f]; - b = Five2Eight[(color >> 1) & 0x001f]; - a = One2Eight [(color ) & 0x0001]; - return (a << 24) | (b << 16) | (g << 8) | r; -#endif // WIN32_ASM -} - -// Just swaps the word -inline u16 RGBA5551_RGBA5551( u16 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov ax, word ptr [color] - xchg ah, al - } -#else // WIN32_ASM - return swapword( color ); -#endif // WIN32_ASM -} - -inline u32 IA88_RGBA8888( u16 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov cx, word ptr [color] - - mov al, ch - mov ah, cl - - bswap eax - - mov ah, cl - mov al, cl - } -#else // WIN32_ASM - // ok - u8 a = color >> 8; - u8 i = color & 0x00FF; - return (a << 24) | (i << 16) | (i << 8) | i; -#endif // WIN32_ASM -} - -inline u16 IA88_RGBA4444( u16 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov cx, word ptr [color] - - shr cl, 4 - mov ah, cl - shl cl, 4 - or ah, cl - mov al, cl - - shr ch, 4 - or al, ch - } -#else // WIN32_ASM - u8 a = color >> 12; - u8 i = (color >> 4) & 0x000F; - return (i << 12) | (i << 8) | (i << 4) | a; -#endif // WIN32_ASM -} - -inline u16 IA44_RGBA4444( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov cl, byte ptr [color] - mov al, cl - - shr cl, 4 - mov ah, cl - shl cl, 4 - or ah, cl - } -#else // WIN32_ASM - return ((color & 0xf0) << 8) | ((color & 0xf0) << 4) | (color); -#endif // WIN32_ASM -} - -inline u32 IA44_RGBA8888( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov ebx, 00000000h - mov cl, byte ptr [color] - - mov bl, cl - shr bl, 04h - mov ch, byte ptr [Four2Eight+ebx] - - mov bl, cl - and bl, 0Fh - mov cl, byte ptr [Four2Eight+ebx] - - mov al, cl - mov ah, ch - - bswap eax - - mov ah, ch - mov al, ch - } -#else // WIN32_ASM - u8 i = Four2Eight[color >> 4]; - u8 a = Four2Eight[color & 0x0F]; - return (a << 24) | (i << 16) | (i << 8) | i; -#endif // WIN32_ASM -} - -inline u16 IA31_RGBA4444( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov ebx, 00000000h - mov cl, byte ptr [color] - - mov bl, cl - shr bl, 01h - mov ch, byte ptr [Three2Four+ebx] - mov ah, ch - shl ch, 4 - or ah, ch - mov al, ch - - mov bl, cl - and bl, 01h - mov ch, byte ptr [One2Four+ebx] - or al, ch - } -#else // WIN32_ASM - u8 i = Three2Four[color >> 1]; - u8 a = One2Four[color & 0x01]; - return (i << 12) | (i << 8) | (i << 4) | a; -#endif // WIN32_ASM -} - -inline u32 IA31_RGBA8888( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov ebx, 00000000h - mov cl, byte ptr [color] - - mov bl, cl - shr bl, 01h - mov ch, byte ptr [Three2Eight+ebx] - - mov bl, cl - and bl, 01h - mov cl, byte ptr [One2Eight+ebx] - - mov al, cl - mov ah, ch - - bswap eax - - mov ah, ch - mov al, ch - } -#else // WIN32_ASM - u8 i = Three2Eight[color >> 1]; - u8 a = One2Eight[color & 0x01]; - return (i << 24) | (i << 16) | (i << 8) | a; -#endif // WIN32_ASM -} - -inline u16 I8_RGBA4444( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov cl, byte ptr [color] - - shr cl, 4 - mov al, cl - shl cl, 4 - or al, cl - mov ah, al - } -#else // WIN32_ASM - u8 c = color >> 4; - return (c << 12) | (c << 8) | (c << 4) | c; -#endif // WIN32_ASM -} - -inline u32 I8_RGBA8888( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov cl, byte ptr [color] - - mov al, cl - mov ah, cl - bswap eax - mov ah, cl - mov al, cl - } -#else // WIN32_ASM - return (color << 24) | (color << 16) | (color << 8) | color; -#endif // WIN32_ASM -} - -inline u16 I4_RGBA4444( u8 color ) -{ -#ifdef WIN32_ASM - __asm - { - mov cl, byte ptr [color] - mov al, cl - shl cl, 4 - or al, cl - mov ah, al - } -#else // WIN32_ASM - u16 ret = color & 0x0f; - ret |= ret << 4; - ret |= ret << 8; - return ret; -#endif // WIN32_ASM -} - -inline u32 CI4_RGBA4444(u8 color) -{ - u16 ret = color >> 4; - ret |= ret << 4; - ret |= ret << 8; - return ret; -} - -inline u32 CI4_RGBA8888(u8 color) -{ - return (color << 24) | (color << 16) | (color << 8) | color; -} - -inline u32 I4_RGBA8888(u8 color) -{ -#ifdef WIN32_ASM - __asm - { - mov ebx, 00000000h - - mov bl, byte ptr [color] - mov cl, byte ptr [Four2Eight+ebx] - - mov al, cl - mov ah, cl - bswap eax - mov ah, cl - mov al, cl - } -#else // WIN32_ASM - u8 c = Four2Eight[color]; - c |= c << 4; - return (c << 24) | (c << 16) | (c << 8) | c; -#endif // WIN32_ASM -} - -#endif // CONVERT_H diff --git a/GLideN64/src/gDP.cpp b/GLideN64/src/gDP.cpp deleted file mode 100644 index 0c5c231..0000000 --- a/GLideN64/src/gDP.cpp +++ /dev/null @@ -1,1431 +0,0 @@ -#include -#include -#include -#include "GLideN64.h" -#include "N64.h" -#include "GBI.h" -#include "RSP.h" -#include "RDP.h" -#include "gDP.h" -#include "gSP.h" -#include "Types.h" -#include "DebugDump.h" -#include "convert.h" -#include "CRC.h" -#include "FrameBuffer.h" -#include "DepthBuffer.h" -#include "FrameBufferInfo.h" -#include "TextureFilterHandler.h" -#include "VI.h" -#include "Config.h" -#include "Combiner.h" -#include "Performance.h" -#include "DisplayWindow.h" -#include - -using namespace std; - -gDPInfo gDP; - -// angrylion's macro -#define SIGN(x, numb) (((x) & ((1 << numb) - 1)) | -((x) & (1 << (numb - 1)))) - -bool isCurrentColorImageDepthImage() -{ - return (gDP.colorImage.address == gDP.depthImageAddress) || - (gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL); -} - -bool isDepthCompareEnabled() -{ - return gDP.otherMode.cycleType <= G_CYC_2CYCLE && - gDP.otherMode.depthCompare != 0 && - ((gSP.geometryMode & G_ZBUFFER) || gDP.otherMode.depthSource == G_ZS_PRIM); -} - -void gDPSetOtherMode( u32 mode0, u32 mode1 ) -{ - gDP.otherMode.h = mode0; - gDP.otherMode.l = mode1; - - gDP.changed |= CHANGED_RENDERMODE | CHANGED_CYCLETYPE | CHANGED_ALPHACOMPARE; - -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetOtherMode( %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s, %s | %s | %s%s%s%s%s | %s | %s%s%s );\n", - AlphaDitherText[gDP.otherMode.alphaDither], - ColorDitherText[gDP.otherMode.colorDither], - CombineKeyText[gDP.otherMode.combineKey], - TextureConvertText[gDP.otherMode.convert_one | (gDP.otherMode.bi_lerp1 << 1) | (gDP.otherMode.bi_lerp0 << 2)], - TextureFilterText[gDP.otherMode.textureFilter], - TextureLUTText[gDP.otherMode.textureLUT], - TextureLODText[gDP.otherMode.textureLOD], - TextureDetailText[gDP.otherMode.textureDetail], - TexturePerspText[gDP.otherMode.texturePersp], - CycleTypeText[gDP.otherMode.cycleType], - PipelineModeText[gDP.otherMode.pipelineMode], - AlphaCompareText[gDP.otherMode.alphaCompare], - DepthSourceText[gDP.otherMode.depthSource], - gDP.otherMode.AAEnable ? "AA_EN | " : "", - gDP.otherMode.depthCompare ? "Z_CMP | " : "", - gDP.otherMode.depthUpdate ? "Z_UPD | " : "", - gDP.otherMode.imageRead ? "IM_RD | " : "", - CvgDestText[gDP.otherMode.cvgDest], - DepthModeText[gDP.otherMode.depthMode], - gDP.otherMode.cvgXAlpha ? "CVG_X_ALPHA | " : "", - gDP.otherMode.alphaCvgSel ? "ALPHA_CVG_SEL | " : "", - gDP.otherMode.forceBlender ? "FORCE_BL" : "" ); -#endif -} - -void gDPSetPrimDepth( u16 z, u16 dz ) -{ - gDP.primDepth.z = _FIXED2FLOAT(_SHIFTR(z, 0, 15), 15); - gDP.primDepth.deltaZ = _FIXED2FLOAT(_SHIFTR(dz, 0, 15), 15); - DebugMsg( DEBUG_NORMAL, "gDPSetPrimDepth( %f, %f );\n", gDP.primDepth.z, gDP.primDepth.deltaZ); -} - -void gDPSetTexturePersp( u32 enable ) -{ - gDP.otherMode.texturePersp = enable & 1; - -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetTexturePersp( %s );\n", TexturePerspText[gDP.otherMode.texturePersp] ); -#endif -} - -void gDPSetTextureLUT( u32 mode ) -{ - gDP.otherMode.textureLUT = mode & 3; - -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetTextureLUT( %s );\n", TextureLUTText[gDP.otherMode.textureLUT] ); -#endif -} - -void gDPSetCombine( u32 muxs0, u32 muxs1 ) -{ - gDP.combine.muxs0 = muxs0; - gDP.combine.muxs1 = muxs1; - - gDP.changed |= CHANGED_COMBINE; - - DebugMsg(DEBUG_NORMAL, "gDPSetCombine\n"); -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, " %s, %s, %s, %s, %s, %s, %s, %s,\n", - saRGBText[gDP.combine.saRGB0], - sbRGBText[gDP.combine.sbRGB0], - mRGBText[gDP.combine.mRGB0], - aRGBText[gDP.combine.aRGB0], - saAText[gDP.combine.saA0], - sbAText[gDP.combine.sbA0], - mAText[gDP.combine.mA0], - aAText[gDP.combine.aA0] ); - - DebugMsg( DEBUG_NORMAL, " %s, %s, %s, %s, %s, %s, %s, %s );\n", - saRGBText[gDP.combine.saRGB1], - sbRGBText[gDP.combine.sbRGB1], - mRGBText[gDP.combine.mRGB1], - aRGBText[gDP.combine.aRGB1], - saAText[gDP.combine.saA1], - sbAText[gDP.combine.sbA1], - mAText[gDP.combine.mA1], - aAText[gDP.combine.aA1] ); -#endif -} - -void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address ) -{ - address = RSP_SegmentToPhysical( address ); - - gDP.colorImage.format = format; - gDP.colorImage.size = size; - gDP.colorImage.width = width; - gDP.colorImage.height = 0; - gDP.colorImage.address = address; - - frameBufferList().saveBuffer(address, static_cast(format), static_cast(size), static_cast(width), false); - -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetColorImage( %s, %s, %i, 0x%08X );\n", - ImageFormatText[gDP.colorImage.format], - ImageSizeText[gDP.colorImage.size], - gDP.colorImage.width, - gDP.colorImage.address ); -#endif -} - -void gDPSetTextureImage(u32 format, u32 size, u32 width, u32 address) -{ - gDP.textureImage.format = format; - gDP.textureImage.size = size; - gDP.textureImage.width = width; - gDP.textureImage.address = RSP_SegmentToPhysical(address); - gDP.textureImage.bpl = gDP.textureImage.width << gDP.textureImage.size >> 1; - if (gSP.DMAOffsets.tex_offset != 0) { - if (format == G_IM_FMT_RGBA) { - u16 * t = reinterpret_cast(RDRAM + gSP.DMAOffsets.tex_offset); - gSP.DMAOffsets.tex_shift = t[gSP.DMAOffsets.tex_count ^ 1]; - gDP.textureImage.address += gSP.DMAOffsets.tex_shift; - } else { - gSP.DMAOffsets.tex_offset = 0; - gSP.DMAOffsets.tex_shift = 0; - gSP.DMAOffsets.tex_count = 0; - } - } -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetTextureImage( %s, %s, %i, 0x%08X );\n", - ImageFormatText[gDP.textureImage.format], - ImageSizeText[gDP.textureImage.size], - gDP.textureImage.width, - gDP.textureImage.address ); -#endif -} - -void gDPSetDepthImage( u32 address ) -{ - address = RSP_SegmentToPhysical( address ); - gDP.depthImageAddress = address; - depthBufferList().saveBuffer(address); - - DebugMsg( DEBUG_NORMAL, "gDPSetDepthImage( 0x%08X );\n", gDP.depthImageAddress ); -} - -void gDPSetEnvColor( u32 r, u32 g, u32 b, u32 a ) -{ - gDP.envColor.r = _FIXED2FLOATCOLOR( r, 8 ); - gDP.envColor.g = _FIXED2FLOATCOLOR( g, 8 ); - gDP.envColor.b = _FIXED2FLOATCOLOR( b, 8 ); - gDP.envColor.a = _FIXED2FLOATCOLOR( a, 8 ); - - DebugMsg( DEBUG_NORMAL, "gDPSetEnvColor( %i, %i, %i, %i );\n", r, g, b, a ); -} - -void gDPSetBlendColor( u32 r, u32 g, u32 b, u32 a ) -{ - gDP.blendColor.r = _FIXED2FLOATCOLOR( r, 8 ); - gDP.blendColor.g = _FIXED2FLOATCOLOR( g, 8 ); - gDP.blendColor.b = _FIXED2FLOATCOLOR( b, 8 ); - gDP.blendColor.a = _FIXED2FLOATCOLOR( a, 8 ); - - gDP.changed |= CHANGED_BLENDCOLOR; - - DebugMsg( DEBUG_NORMAL, "gDPSetBlendColor( %i, %i, %i, %i );\n", r, g, b, a ); -} - -void gDPSetFogColor( u32 r, u32 g, u32 b, u32 a ) -{ - gDP.fogColor.r = _FIXED2FLOATCOLOR( r, 8 ); - gDP.fogColor.g = _FIXED2FLOATCOLOR( g, 8 ); - gDP.fogColor.b = _FIXED2FLOATCOLOR( b, 8 ); - gDP.fogColor.a = _FIXED2FLOATCOLOR( a, 8 ); - - gDP.changed |= CHANGED_FOGCOLOR; - - DebugMsg( DEBUG_NORMAL, "gDPSetFogColor( %i, %i, %i, %i );\n", r, g, b, a ); -} - -void gDPSetFillColor( u32 c ) -{ - gDP.fillColor.color = c; - gDP.fillColor.z = static_cast(_SHIFTR( c, 2, 14 )); - gDP.fillColor.dz = static_cast(_SHIFTR( c, 0, 2 )); - - DebugMsg( DEBUG_NORMAL, "gDPSetFillColor( 0x%08X );\n", c ); -} - -void gDPGetFillColor(f32 _fillColor[4]) -{ - const u32 c = gDP.fillColor.color; - if (gDP.colorImage.size < 3) { - _fillColor[0] = _FIXED2FLOATCOLOR( _SHIFTR( c, 11, 5 ), 5 ); - _fillColor[1] = _FIXED2FLOATCOLOR( _SHIFTR( c, 6, 5 ), 5 ); - _fillColor[2] = _FIXED2FLOATCOLOR( _SHIFTR( c, 1, 5 ), 5 ); - _fillColor[3] = static_cast(_SHIFTR( c, 0, 1 )); - } else { - _fillColor[0] = _FIXED2FLOATCOLOR( _SHIFTR( c, 24, 8 ), 8 ); - _fillColor[1] = _FIXED2FLOATCOLOR( _SHIFTR( c, 16, 8 ), 8 ); - _fillColor[2] = _FIXED2FLOATCOLOR( _SHIFTR( c, 8, 8 ), 8 ); - _fillColor[3] = _FIXED2FLOATCOLOR( _SHIFTR( c, 0, 8 ), 8 ); - } -} - -void gDPSetPrimColor( u32 m, u32 l, u32 r, u32 g, u32 b, u32 a ) -{ - gDP.primColor.m = _FIXED2FLOAT( m, 5 ); - gDP.primColor.l = _FIXED2FLOATCOLOR( l, 8 ); - gDP.primColor.r = _FIXED2FLOATCOLOR( r, 8 ); - gDP.primColor.g = _FIXED2FLOATCOLOR( g, 8 ); - gDP.primColor.b = _FIXED2FLOATCOLOR( b, 8 ); - gDP.primColor.a = _FIXED2FLOATCOLOR( a, 8 ); - - DebugMsg( DEBUG_NORMAL, "gDPSetPrimColor( %i, %i, %i, %i, %i, %i );\n", m, l, r, g, b, a ); -} - -void gDPSetTile( u32 format, u32 size, u32 line, u32 tmem, u32 tile, u32 palette, u32 cmt, u32 cms, u32 maskt, u32 masks, u32 shiftt, u32 shifts ) -{ - gDP.tiles[tile].format = format; - gDP.tiles[tile].size = size; - gDP.tiles[tile].line = line; - gDP.tiles[tile].tmem = tmem; - gDP.tiles[tile].palette = palette; - gDP.tiles[tile].cmt = cmt; - gDP.tiles[tile].cms = cms; - gDP.tiles[tile].maskt = gDP.tiles[tile].originalMaskT = maskt; - gDP.tiles[tile].masks = gDP.tiles[tile].originalMaskS = masks; - gDP.tiles[tile].shiftt = shiftt; - gDP.tiles[tile].shifts = shifts; - - if (!gDP.tiles[tile].masks) gDP.tiles[tile].clamps = 1; - if (!gDP.tiles[tile].maskt) gDP.tiles[tile].clampt = 1; - - if (tile == gSP.texture.tile || tile == gSP.texture.tile + 1) { - u32 nTile = gDP.loadTileIdx; - while(gDP.tiles[nTile].tmem != tmem && nTile > gSP.texture.tile + 1) - --nTile; - if (nTile > gSP.texture.tile + 1) { - gDP.tiles[tile].textureMode = gDP.tiles[nTile].textureMode; - gDP.tiles[tile].loadType = gDP.tiles[nTile].loadType; - gDP.tiles[tile].frameBufferAddress = gDP.tiles[nTile].frameBufferAddress; - gDP.tiles[tile].imageAddress = gDP.tiles[nTile].imageAddress; - } - } - - gDP.changed |= CHANGED_TILE; - -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetTile( %s, %s, %i, %i, %i, %i, %s%s, %s%s, %i, %i, %i, %i );\n", - ImageFormatText[format], - ImageSizeText[size], - line, - tmem, - tile, - palette, - cmt & G_TX_MIRROR ? "G_TX_MIRROR" : "G_TX_NOMIRROR", - cmt & G_TX_CLAMP ? " | G_TX_CLAMP" : "", - cms & G_TX_MIRROR ? "G_TX_MIRROR" : "G_TX_NOMIRROR", - cms & G_TX_CLAMP ? " | G_TX_CLAMP" : "", - maskt, - masks, - shiftt, - shifts ); -#endif -} - - -void gDPSetTileSize( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt ) -{ - gDP.tiles[tile].uls = _SHIFTR( uls, 2, 10 ); - gDP.tiles[tile].ult = _SHIFTR( ult, 2, 10 ); - gDP.tiles[tile].lrs = _SHIFTR( lrs, 2, 10 ); - gDP.tiles[tile].lrt = _SHIFTR( lrt, 2, 10 ); - - gDP.tiles[tile].fuls = _FIXED2FLOAT( uls, 2 ); - gDP.tiles[tile].fult = _FIXED2FLOAT( ult, 2 ); - gDP.tiles[tile].flrs = _FIXED2FLOAT( lrs, 2 ); - gDP.tiles[tile].flrt = _FIXED2FLOAT( lrt, 2 ); - - gDP.changed |= CHANGED_TILE; - - DebugMsg( DEBUG_NORMAL, "gDPSetTileSize( %i, %.2f, %.2f, %.2f, %.2f );\n", - tile, - gDP.tiles[tile].fuls, - gDP.tiles[tile].fult, - gDP.tiles[tile].flrs, - gDP.tiles[tile].flrt ); -} - -static -bool CheckForFrameBufferTexture(u32 _address, u32 _width, u32 _bytes) -{ - gDP.loadTile->textureMode = TEXTUREMODE_NORMAL; - gDP.loadTile->frameBufferAddress = 0U; - gDP.changed |= CHANGED_TMEM; - if (!config.frameBufferEmulation.enable) - return false; - - FrameBufferList & fbList = frameBufferList(); - FrameBuffer *pBuffer = fbList.findBuffer(_address); - bool bRes = pBuffer != nullptr && pBuffer->m_readable; - while (bRes) { - if ((config.generalEmulation.hacks & hack_blurPauseScreen) != 0) { - if (gDP.colorImage.address == gDP.depthImageAddress && pBuffer->m_copiedToRdram) { - memcpy(RDRAM + gDP.depthImageAddress, - RDRAM + pBuffer->m_startAddress, - (pBuffer->m_width*pBuffer->m_height) << pBuffer->m_size >> 1); - pBuffer->m_copiedToRdram = false; - fbList.getCurrent()->m_isPauseScreen = true; - } - if (pBuffer->m_isPauseScreen) { - bRes = false; - break; - } - } - - if (gDP.otherMode.textureLUT == G_TT_RGBA16 && (config.generalEmulation.hacks & hack_StarCraftBackgrounds) != 0) { - bRes = false; - break; - } - - if (pBuffer->m_cfb) { - fbList.removeBuffer(pBuffer->m_startAddress); - bRes = false; - break; - } - - if ((config.generalEmulation.hacks & hack_noDepthFrameBuffers) != 0 && pBuffer->m_isDepthBuffer) { - fbList.removeBuffer(pBuffer->m_startAddress); - bRes = false; - break; - } - - const u32 texEndAddress = _address + _bytes - 1; - if (_address > pBuffer->m_startAddress && - std::abs(static_cast(pBuffer->m_width) - static_cast(_width)) > 1 && - texEndAddress > (pBuffer->m_endAddress + (pBuffer->m_width << pBuffer->m_size >> 1))) { - //fbList.removeBuffer(pBuffer->m_startAddress); - bRes = false; - break; - } - - if (gDP.loadTile->loadType == LOADTYPE_TILE && - gDP.textureImage.width != pBuffer->m_width && - gDP.textureImage.size != pBuffer->m_size) { - //fbList.removeBuffer(pBuffer->m_startAddress); // Does not work with Zelda MM - bRes = false; - break; - } - - bRes = pBuffer->isValid(false); - if (!bRes && pBuffer != fbList.getCurrent()) { - fbList.removeBuffer(pBuffer->m_startAddress); - break; - } - - pBuffer->m_loadType = gDP.loadTile->loadType; - pBuffer->m_loadTileOrigin.uls = gDP.loadTile->uls; - pBuffer->m_loadTileOrigin.ult = gDP.loadTile->ult; - gDP.loadTile->frameBufferAddress = pBuffer->m_startAddress; - gDP.loadTile->textureMode = TEXTUREMODE_FRAMEBUFFER; - break; - } - - for (u32 nTile = gSP.texture.tile; nTile < 6; ++nTile) { - if (gDP.tiles[nTile].tmem == gDP.loadTile->tmem) { - gDPTile & curTile = gDP.tiles[nTile]; - curTile.textureMode = gDP.loadTile->textureMode; - curTile.loadType = gDP.loadTile->loadType; - curTile.frameBufferAddress = gDP.loadTile->frameBufferAddress; - curTile.imageAddress = gDP.loadTile->imageAddress; - } - } - return bRes; -} - -//**************************************************************** -// LoadTile for 32bit RGBA texture -// Based on sources of angrylion's software plugin. -// -void gDPLoadTile32b(u32 uls, u32 ult, u32 lrs, u32 lrt) -{ - const u32 width = lrs - uls + 1; - const u32 height = lrt - ult + 1; - const u32 line = gDP.loadTile->line << 2; - const u32 tbase = gDP.loadTile->tmem << 2; - const u32 addr = gDP.textureImage.address >> 2; - const u32 * src = reinterpret_cast(RDRAM); - u16 * tmem16 = reinterpret_cast(TMEM); - u32 c, ptr, tline, s, xorval; - - for (u32 j = 0; j < height; ++j) { - tline = tbase + line * j; - s = ((j + ult) * gDP.textureImage.width) + uls; - xorval = (j & 1) ? 3 : 1; - for (u32 i = 0; i < width; ++i) { - c = src[addr + s + i]; - ptr = ((tline + i) ^ xorval) & 0x3ff; - tmem16[ptr] = c >> 16; - tmem16[ptr | 0x400] = c & 0xffff; - } - } -} - -void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt) -{ - gDPSetTileSize( tile, uls, ult, lrs, lrt ); - gDP.loadTileIdx = tile; - gDP.loadTile = &gDP.tiles[tile]; - gDP.loadTile->loadType = LOADTYPE_TILE; - gDP.loadTile->imageAddress = gDP.textureImage.address; - - if (gDP.loadTile->lrs < gDP.loadTile->uls || gDP.loadTile->lrt < gDP.loadTile->ult) - return; - - const u32 width = (gDP.loadTile->lrs - gDP.loadTile->uls + 1) & 0x03FF; - const u32 height = (gDP.loadTile->lrt - gDP.loadTile->ult + 1) & 0x03FF; - const u32 bpl = gDP.loadTile->line << 3; - - u32 alignedWidth = width; - u32 wmask = 0; - switch (gDP.textureImage.size) { - case G_IM_SIZ_8b: - wmask = 7; - break; - case G_IM_SIZ_16b: - wmask = 3; - break; - case G_IM_SIZ_32b: - wmask = 1; - break; - } - if ((width & wmask) != 0) - alignedWidth = (width & (~wmask)) + wmask + 1; - const u32 bpr = alignedWidth << gDP.loadTile->size >> 1; - - gDPLoadTileInfo &info = gDP.loadInfo[gDP.loadTile->tmem]; - info.texAddress = gDP.loadTile->imageAddress; - info.uls = static_cast(gDP.loadTile->uls); - info.ult = static_cast(gDP.loadTile->ult); - info.lrs = static_cast(gDP.loadTile->lrs); - info.lrt = static_cast(gDP.loadTile->lrt); - info.width = static_cast(gDP.loadTile->masks != 0 ? min(width, 1U << gDP.loadTile->masks) : width); - info.height = static_cast(gDP.loadTile->maskt != 0 ? min(height, 1U << gDP.loadTile->maskt) : height); - info.texWidth = static_cast(gDP.textureImage.width); - info.size = static_cast(gDP.textureImage.size); - info.loadType = LOADTYPE_TILE; - info.bytes = bpl * height; - if (gDP.loadTile->size == G_IM_SIZ_32b) - // 32 bit texture loaded into lower and upper half of TMEM, thus actual bytes doubled. - info.bytes *= 2; - - if (gDP.loadTile->line == 0) - return; - - if (gDP.loadTile->masks == 0) - gDP.loadTile->loadWidth = max(gDP.loadTile->loadWidth, info.width); - if (gDP.loadTile->maskt == 0) { - if (gDP.otherMode.cycleType != G_CYC_2CYCLE && gDP.loadTile->tmem % gDP.loadTile->line == 0) { - u16 theight = static_cast(info.height + gDP.loadTile->tmem / gDP.loadTile->line); - gDP.loadTile->loadHeight = max(gDP.loadTile->loadHeight, theight); - } else - gDP.loadTile->loadHeight = max(gDP.loadTile->loadHeight, info.height); - } - - u32 address = gDP.textureImage.address + gDP.loadTile->ult * gDP.textureImage.bpl + (gDP.loadTile->uls << gDP.textureImage.size >> 1); - u32 bpl2 = bpl; - if (gDP.loadTile->lrs > gDP.textureImage.width) - bpl2 = (gDP.textureImage.width - gDP.loadTile->uls); - u32 height2 = height; - if (gDP.loadTile->lrt > gDP.scissor.lry) - height2 = static_cast(gDP.scissor.lry) - gDP.loadTile->ult; - - if (CheckForFrameBufferTexture(address, info.width, bpl2*height2)) - return; - - if (gDP.loadTile->size == G_IM_SIZ_32b) - gDPLoadTile32b(gDP.loadTile->uls, gDP.loadTile->ult, gDP.loadTile->lrs, gDP.loadTile->lrt); - else { - u32 tmemAddr = gDP.loadTile->tmem; - const u32 line = gDP.loadTile->line; - const u32 qwpr = bpr >> 3; - for (u32 y = 0; y < height; ++y) { - if (address + bpl > RDRAMSize) - UnswapCopyWrap(RDRAM, address, reinterpret_cast(TMEM), tmemAddr << 3, 0xFFF, RDRAMSize - address); - else - UnswapCopyWrap(RDRAM, address, reinterpret_cast(TMEM), tmemAddr << 3, 0xFFF, bpr); - if (y & 1) - DWordInterleaveWrap(reinterpret_cast(TMEM), tmemAddr << 1, 0x3FF, qwpr); - - address += gDP.textureImage.bpl; - if (address >= RDRAMSize) - break; - tmemAddr += line; - } - } - - DebugMsg( DEBUG_NORMAL, "gDPLoadTile( %i, %i, %i, %i, %i );\n", - tile, gDP.loadTile->uls, gDP.loadTile->ult, gDP.loadTile->lrs, gDP.loadTile->lrt ); -} - -//**************************************************************** -// LoadBlock for 32bit RGBA texture -// Based on sources of angrylion's software plugin. -// -void gDPLoadBlock32(u32 uls,u32 lrs, u32 dxt) -{ - const u32 * src = reinterpret_cast(RDRAM); - const u32 tb = gDP.loadTile->tmem << 2; - const u32 line = gDP.loadTile->line << 2; - - u16 *tmem16 = reinterpret_cast(TMEM); - u32 addr = gDP.loadTile->imageAddress >> 2; - u32 width = (lrs - uls + 1) << 2; - if (width == 4) // lr_s == 0, 1x1 texture - width = 1; - else if (width & 7) - width = (width & (~7U)) + 8; - - if (dxt != 0) { - u32 j = 0; - u32 t = 0; - u32 oldt = 0; - u32 ptr; - - u32 c = 0; - for (u32 i = 0; i < width; i += 2) { - oldt = t; - t = ((j >> 11) & 1) ? 3 : 1; - if (t != oldt) - i += line; - ptr = ((tb + i) ^ t) & 0x3ff; - c = src[addr + i]; - tmem16[ptr] = c >> 16; - tmem16[ptr | 0x400] = c & 0xffff; - ptr = ((tb + i + 1) ^ t) & 0x3ff; - c = src[addr + i + 1]; - tmem16[ptr] = c >> 16; - tmem16[ptr | 0x400] = c & 0xffff; - j += dxt; - } - } else { - u32 c, ptr; - for (u32 i = 0; i < width; i++) { - ptr = ((tb + i) ^ 1) & 0x3ff; - c = src[addr + i]; - tmem16[ptr] = c >> 16; - tmem16[ptr | 0x400] = c & 0xffff; - } - } -} - -void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt) -{ - gDPSetTileSize( tile, uls, ult, lrs, dxt ); - gDP.loadTileIdx = tile; - gDP.loadTile = &gDP.tiles[tile]; - gDP.loadTile->loadType = LOADTYPE_BLOCK; - - if (gSP.DMAOffsets.tex_offset != 0) { - if (gSP.DMAOffsets.tex_shift % (((lrs>>2) + 1) << 3)) { - gDP.textureImage.address -= gSP.DMAOffsets.tex_shift; - gSP.DMAOffsets.tex_offset = 0; - gSP.DMAOffsets.tex_shift = 0; - gSP.DMAOffsets.tex_count = 0; - } else - ++gSP.DMAOffsets.tex_count; - } - gDP.loadTile->imageAddress = gDP.textureImage.address; - - gDPLoadTileInfo &info = gDP.loadInfo[gDP.loadTile->tmem]; - info.texAddress = gDP.loadTile->imageAddress; - info.uls = static_cast(gDP.loadTile->uls); - info.ult = static_cast(gDP.loadTile->ult); - info.lrs = static_cast(gDP.loadTile->lrs); - info.lrt = static_cast(gDP.loadTile->lrt); - info.width = static_cast(gDP.loadTile->lrs); - info.dxt = dxt; - info.size = static_cast(gDP.textureImage.size); - info.loadType = LOADTYPE_BLOCK; - - const u32 width = (lrs - uls + 1) & 0x0FFF; - u32 bytes = width << gDP.loadTile->size >> 1; - if ((bytes & 7) != 0) - bytes = (bytes & (~7U)) + 8; - - info.bytes = bytes; - u32 address = gDP.textureImage.address + ult * gDP.textureImage.bpl + (uls << gDP.textureImage.size >> 1); - - if (bytes == 0 || (address + bytes) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load texture block out of range\n"); - DebugMsg(DEBUG_NORMAL, "gDPLoadBlock( %i, %i, %i, %i, %i );\n", tile, uls, ult, lrs, dxt ); - return; - } - - gDP.loadTile->frameBufferAddress = 0; - CheckForFrameBufferTexture(address, info.width, bytes); // Load data to TMEM even if FB texture is found. See comment to texturedRectDepthBufferCopy - - const u32 texLowerBound = gDP.loadTile->tmem; - const u32 texUpperBound = gDP.loadTile->tmem + (bytes >> 3); - for (u32 i = 0; i < tile; ++i) { - if (gDP.tiles[i].tmem >= texLowerBound && gDP.tiles[i].tmem < texUpperBound) { - gDPLoadTileInfo &info = gDP.loadInfo[gDP.tiles[i].tmem]; - info.loadType = LOADTYPE_BLOCK; - } - } - - if (gDP.loadTile->size == G_IM_SIZ_32b) - gDPLoadBlock32(gDP.loadTile->uls, gDP.loadTile->lrs, dxt); - else if (gDP.loadTile->format == G_IM_FMT_YUV) - memcpy(TMEM, &RDRAM[address], bytes); // HACK! - else { - u32 tmemAddr = gDP.loadTile->tmem; - UnswapCopyWrap(RDRAM, address, reinterpret_cast(TMEM), tmemAddr << 3, 0xFFF, bytes); - if (dxt != 0) { - u32 dxtCounter = 0; - u32 qwords = (bytes >> 3); - u32 line = 0; - while (true) { - do { - ++tmemAddr; - --qwords; - if (qwords == 0) - goto end_dxt_test; - dxtCounter += dxt; - } while ((dxtCounter & 0x800) == 0); - do { - ++line; - --qwords; - if (qwords == 0) - goto end_dxt_test; - dxtCounter += dxt; - } while ((dxtCounter & 0x800) != 0); - DWordInterleaveWrap(reinterpret_cast(TMEM), tmemAddr << 1, 0x3FF, line); - tmemAddr += line; - line = 0; - } - end_dxt_test: - DWordInterleaveWrap(reinterpret_cast(TMEM), tmemAddr << 1, 0x3FF, line); - } - } - - DebugMsg( DEBUG_NORMAL, "gDPLoadBlock( %i, %i, %i, %i, %i );\n", tile, uls, ult, lrs, dxt ); -} - -void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt ) -{ - gDPSetTileSize( tile, uls, ult, lrs, lrt ); - if (gDP.tiles[tile].tmem < 256) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "gDPLoadTLUT wrong tile tmem addr: tile[%d].tmem=%04x;\n", tile, gDP.tiles[tile].tmem); - return; - } - u16 count = static_cast((gDP.tiles[tile].lrs - gDP.tiles[tile].uls + 1) * (gDP.tiles[tile].lrt - gDP.tiles[tile].ult + 1)); - u32 address = gDP.textureImage.address + gDP.tiles[tile].ult * gDP.textureImage.bpl + (gDP.tiles[tile].uls << gDP.textureImage.size >> 1); - u16 pal = static_cast((gDP.tiles[tile].tmem - 256) >> 4); - u16 * dest = reinterpret_cast(TMEM); - u32 destIdx = gDP.tiles[tile].tmem << 2; - - int i = 0; - while (i < count) { - for (u16 j = 0; (j < 16) && (i < count); ++j, ++i) { - dest[(destIdx | 0x0400) & 0x07FF] = swapword(*reinterpret_cast(RDRAM + (address ^ 2))); - address += 2; - destIdx += 4; - } - - gDP.paletteCRC16[pal] = CRC_CalculatePalette(UINT64_MAX, &TMEM[256 + (pal << 4)], 16); - pal = (pal + 1) & 0x0F; - } - - gDP.paletteCRC256 = CRC_Calculate(UINT64_MAX, gDP.paletteCRC16, sizeof(u64) * 16); - - if (TFH.isInited()) { - const u16 start = static_cast(gDP.tiles[tile].tmem) - 256; // starting location in the palettes - u16 *spal = reinterpret_cast(RDRAM + gDP.textureImage.address); - memcpy(reinterpret_cast(gDP.TexFilterPalette + start), spal, u32(count)<<1); - } - - gDP.changed |= CHANGED_TMEM; - - DebugMsg( DEBUG_NORMAL, "gDPLoadTLUT( %i, %i, %i, %i, %i );\n", - tile, gDP.tiles[tile].uls, gDP.tiles[tile].ult, gDP.tiles[tile].lrs, gDP.tiles[tile].lrt ); -} - -void gDPSetScissor(u32 mode, s16 xh, s16 yh, s16 xl, s16 yl) -{ - gDP.scissor.mode = mode; - gDP.scissor.xh = xh; - gDP.scissor.yh = yh; - gDP.scissor.xl = xl; - gDP.scissor.yl = yl; - gDP.scissor.ulx = _FIXED2FLOAT(xh, 2); - gDP.scissor.uly = _FIXED2FLOAT(yh, 2); - gDP.scissor.lrx = _FIXED2FLOAT(xl, 2); - gDP.scissor.lry = _FIXED2FLOAT(yl, 2); - - gDP.changed |= CHANGED_SCISSOR | CHANGED_REJECT_BOX; - -#ifdef DEBUG_DUMP - DebugMsg( DEBUG_NORMAL, "gDPSetScissor( %s, %.2f, %.2f, %.2f, %.2f );\n", - ScissorModeText[gDP.scissor.mode], - gDP.scissor.ulx, - gDP.scissor.uly, - gDP.scissor.lrx, - gDP.scissor.lry ); -#endif -} - -void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry ) -{ - GraphicsDrawer & drawer = dwnd().getDrawer(); - if (gDP.otherMode.cycleType == G_CYC_FILL) { - ++lrx; - ++lry; - } else if (lry == uly) - ++lry; - - enum { - dbNone, - dbFound, - dbCleared - } depthBuffer = dbNone; - if (gDP.depthImageAddress == gDP.colorImage.address) { - // Game may use depth texture as auxilary color texture. Example: Mario Tennis - // If color is not depth clear color, that is most likely the case - if (gDP.fillColor.color == DepthClearColor) { - depthBuffer = dbFound; - if (config.generalEmulation.enableFragmentDepthWrite == 0) { - drawer.clearDepthBuffer(); - depthBuffer = dbCleared; - } else - depthBufferList().setCleared(true); - } - } else if (gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL) { - depthBuffer = dbFound; - depthBufferList().saveBuffer(gDP.colorImage.address); - if (config.generalEmulation.enableFragmentDepthWrite == 0 || - (config.generalEmulation.hacks & hack_Snap) != 0) { - drawer.clearDepthBuffer(); - depthBuffer = dbCleared; - } else - depthBufferList().setCleared(true); - } - - if (depthBuffer != dbCleared) { - if (gDP.otherMode.cycleType == G_CYC_FILL) { - f32 fillColor[4]; - gDPGetFillColor(fillColor); - gDP.rectColor.r = fillColor[0]; - gDP.rectColor.g = fillColor[1]; - gDP.rectColor.b = fillColor[2]; - gDP.rectColor.a = fillColor[3]; - } else { - gDP.rectColor = gDPInfo::Color(); - } - drawer.drawRect(ulx, uly, lrx, lry); - } - - if (gDP.otherMode.cycleType == G_CYC_FILL) - frameBufferList().fillRDRAM(ulx, uly, lrx, lry); - - frameBufferList().setBufferChanged(f32(lry)); - - DebugMsg( DEBUG_NORMAL, "gDPFillRectangle #%i- #%i ( %i, %i, %i, %i );\n", gSP.tri_num, gSP.tri_num +1, ulx, uly, lrx, lry ); - gSP.tri_num += 2; -} - -void gDPSetConvert( s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5 ) -{ - gDP.convert.k0 = static_cast(static_cast(SIGN(k0, 9) << 1)) + 1; - gDP.convert.k1 = static_cast(static_cast(SIGN(k1, 9) << 1)) + 1; - gDP.convert.k2 = static_cast(static_cast(SIGN(k2, 9) << 1)) + 1; - gDP.convert.k3 = static_cast(static_cast(SIGN(k3, 9) << 1)) + 1; - gDP.convert.k4 = k4; - gDP.convert.k5 = k5; - - DebugMsg( DEBUG_NORMAL, "gDPSetConvert( %i, %i, %i, %i, %i, %i );\n", k0, k1, k2, k3, k4, k5); -} - -void gDPSetKeyR( u32 cR, u32 sR, u32 wR ) -{ - gDP.key.center.r = _FIXED2FLOATCOLOR( cR, 8 ); - gDP.key.scale.r = _FIXED2FLOATCOLOR( sR, 8 ); - gDP.key.width.r = _FIXED2FLOATCOLOR( wR, 8 ); - DebugMsg( DEBUG_NORMAL, "gDPSetKeyR( %u, %u, %u );\n", cR, sR, wR ); -} - -void gDPSetKeyGB(u32 cG, u32 sG, u32 wG, u32 cB, u32 sB, u32 wB ) -{ - gDP.key.center.g = _FIXED2FLOATCOLOR( cG, 8 ); - gDP.key.scale.g = _FIXED2FLOATCOLOR( sG, 8 ); - gDP.key.width.g = _FIXED2FLOATCOLOR( wG, 8 ); - gDP.key.center.b = _FIXED2FLOATCOLOR( cB, 8 ); - gDP.key.scale.b = _FIXED2FLOATCOLOR( sB, 8 ); - gDP.key.width.b = _FIXED2FLOATCOLOR( wB, 8 ); - DebugMsg( DEBUG_NORMAL, "gDPSetKeyGB( %u, %u, %u, %u, %u, %u );\n", - cG, sG, wG, cB, sB, wB ); -} - -void gDPTextureRectangle(f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, s16 s, s16 t, f32 dsdx, f32 dtdy , bool flip) -{ - if (gDP.otherMode.cycleType == G_CYC_COPY) { - dsdx /= 4.0f; - lrx += 1.0f; - lry += 1.0f; - } else if (lry - uly < 1.0f) { - lry = ceil(lry); - } - - gDPTile *textureTileOrg[2]; - textureTileOrg[0] = gSP.textureTile[0]; - textureTileOrg[1] = gSP.textureTile[1]; - gSP.textureTile[0] = &gDP.tiles[tile]; - gSP.textureTile[1] = needReplaceTex1ByTex0() ? &gDP.tiles[tile] : &gDP.tiles[(tile + 1) & 7]; - - // HACK ALERT! - if (s == 0x4000 && (gDP.colorImage.width + gSP.textureTile[0]->uls < 512)) - s = 0; - - gDP.rectColor = gDPInfo::Color(); - - gDP.lastTexRectInfo.ulx = ulx; - gDP.lastTexRectInfo.lrx = lrx; - gDP.lastTexRectInfo.uly = uly; - gDP.lastTexRectInfo.lry = lry; - gDP.lastTexRectInfo.s = !flip ? s : t; - gDP.lastTexRectInfo.t = !flip ? t : s; - gDP.lastTexRectInfo.dsdx = !flip ? dsdx : dtdy; - gDP.lastTexRectInfo.dtdy = !flip ? dtdy : dsdx; - - GraphicsDrawer & drawer = dwnd().getDrawer(); - GraphicsDrawer::TexturedRectParams params(ulx, uly, lrx, lry, dsdx, dtdy, s, t, - flip, false, true, frameBufferList().getCurrent()); - if (config.graphics2D.enableNativeResTexrects == 0 && config.graphics2D.correctTexrectCoords != Config::tcDisable) - drawer.correctTexturedRectParams(params); - drawer.drawTexturedRect(params); - - gSP.textureTile[0] = textureTileOrg[0]; - gSP.textureTile[1] = textureTileOrg[1]; - - frameBufferList().setBufferChanged(lry); - - if (flip) - DebugMsg( DEBUG_NORMAL, "gDPTextureRectangleFlip( %f, %f, %f, %f, %i, %f, %f, %f, %f);\n", - ulx, uly, lrx, lry, tile, s/32.0f, t/32.0f, dsdx, dtdy ); - else - DebugMsg( DEBUG_NORMAL, "gDPTextureRectangle( %f, %f, %f, %f, %i, %f, %f, %f, %f );\n", - ulx, uly, lrx, lry, tile, s/32.0f, t/32.0f, dsdx, dtdy); - gSP.tri_num += 2; -} - -void gDPFullSync() -{ - if (config.frameBufferEmulation.copyAuxToRDRAM != 0) { - frameBufferList().copyAux(); - frameBufferList().removeAux(); - } - - dwnd().getDrawer().flush(); - - frameBufferList().updateCurrentBufferEndAddress(); - - FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent(); - if (pCurrentBuffer != nullptr) - pCurrentBuffer->copyDepthTexture(); - if ((config.frameBufferEmulation.copyToRDRAM != Config::ctDisable || (config.generalEmulation.hacks & hack_subscreen) != 0) && - !FBInfo::fbInfo.isSupported() && - pCurrentBuffer != nullptr && - !pCurrentBuffer->isAuxiliary() - ) - FrameBuffer_CopyToRDRAM(gDP.colorImage.address, config.frameBufferEmulation.copyToRDRAM == Config::ctSync); - - if (RSP.LLE) { - if (config.frameBufferEmulation.copyDepthToRDRAM != Config::cdDisable && !FBInfo::fbInfo.isSupported()) - FrameBuffer_CopyDepthBuffer(gDP.colorImage.address); - } - - *REG.MI_INTR |= MI_INTR_DP; - - CheckInterrupts(); - - DebugMsg( DEBUG_NORMAL, "gDPFullSync();\n" ); -} - -void gDPTileSync() -{ - DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPTileSync();\n" ); -} - -void gDPPipeSync() -{ - DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPPipeSync();\n" ); -} - -void gDPLoadSync() -{ - DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPLoadSync();\n" ); -} - -void gDPNoOp() -{ - DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPNoOp();\n" ); -} - -LLETriangle::LLETriangle() -{ - m_textureTileOrg[0] = gSP.textureTile[0]; - m_textureTileOrg[1] = gSP.textureTile[1]; - m_textureScaleOrg[0] = m_textureScaleOrg[1] = 1.0f; -} - -LLETriangle& LLETriangle::get() -{ - static LLETriangle lleTriangle; - return lleTriangle; -} - -void LLETriangle::start(u32 _tile) -{ - if (!m_flushed) - return; - m_textureTileOrg[0] = gSP.textureTile[0]; - m_textureTileOrg[1] = gSP.textureTile[1]; - m_textureScaleOrg[0] = gSP.texture.scales; - m_textureScaleOrg[1] = gSP.texture.scalet; - gSP.texture.tile = _tile; - gSP.textureTile[0] = &gDP.tiles[_tile]; - gSP.textureTile[1] = needReplaceTex1ByTex0() ? &gDP.tiles[_tile] : &gDP.tiles[(_tile + 1) & 7]; - gSP.texture.scales = 1.0f; - gSP.texture.scalet = 1.0f; - m_flushed = false; -} - -void LLETriangle::flush(u32 _cmd) -{ - if (_cmd >= 0x08 && _cmd <= 0x0f) - return; - - GraphicsDrawer & drawer = dwnd().getDrawer(); - if (drawer.getDMAVerticesCount() > 0) { - drawer.drawScreenSpaceTriangle(drawer.getDMAVerticesCount(), graphics::drawmode::TRIANGLES); - } - gSP.textureTile[0] = m_textureTileOrg[0]; - gSP.textureTile[1] = m_textureTileOrg[1]; - gSP.texture.scales = m_textureScaleOrg[0]; - gSP.texture.scalet = m_textureScaleOrg[1]; - m_flushed = true; -} - -void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData) -{ - DebugMsg(DEBUG_NORMAL, "gDPLLETriangle shade: %d, texture: %d, zbuffer: %d\n", - int(_shade), int(_texture), int(_zbuffer)); - - gSP.texture.level = _SHIFTR(_pData[0], 19, 3); - const u32 tile = _SHIFTR(_pData[0], 16, 3); - if (tile != m_tile) - flush(0); - m_tile = tile; -// const int flip = (_pData[0] & 0x800000) >> 23; // unused - start(tile); - - s32* pDataSigned = reinterpret_cast(_pData); - int yl = SIGN(pDataSigned[0], 14); - int ym = pDataSigned[1] >> 16; - ym = SIGN(ym, 14); - int yh = SIGN(pDataSigned[1], 14); - - int xl = SIGN(pDataSigned[2], 28); - int xh = SIGN(pDataSigned[4], 28); - int xm = SIGN(pDataSigned[6], 28); - - const int dxldy = SIGN(pDataSigned[3], 30); - const int dxhdy = SIGN(pDataSigned[5], 30); - const int dxmdy = SIGN(pDataSigned[7], 30); - - yh &= ~3; - - int r = 0xff, g = 0xff, b = 0xff, a = 0xff; - int drdx = 0, dgdx = 0, dbdx = 0, dadx = 0; - int drde = 0, dgde = 0, dbde = 0, dade = 0; - - if (_shade) { - r = static_cast((_pData[8] & 0xffff0000) | ((_pData[12] >> 16) & 0x0000ffff)); - g = static_cast(((_pData[8] << 16) & 0xffff0000) | (_pData[12] & 0x0000ffff)); - b = static_cast((_pData[9] & 0xffff0000) | ((_pData[13] >> 16) & 0x0000ffff)); - a = static_cast(((_pData[9] << 16) & 0xffff0000) | (_pData[13] & 0x0000ffff)); - drdx = static_cast((_pData[10] & 0xffff0000) | ((_pData[14] >> 16) & 0x0000ffff)); - dgdx = static_cast(((_pData[10] << 16) & 0xffff0000) | (_pData[14] & 0x0000ffff)); - dbdx = static_cast((_pData[11] & 0xffff0000) | ((_pData[15] >> 16) & 0x0000ffff)); - dadx = static_cast(((_pData[11] << 16) & 0xffff0000) | (_pData[15] & 0x0000ffff)); - drde = static_cast((_pData[16] & 0xffff0000) | ((_pData[20] >> 16) & 0x0000ffff)); - dgde = static_cast(((_pData[16] << 16) & 0xffff0000) | (_pData[20] & 0x0000ffff)); - dbde = static_cast((_pData[17] & 0xffff0000) | ((_pData[21] >> 16) & 0x0000ffff)); - dade = static_cast(((_pData[17] << 16) & 0xffff0000) | (_pData[21] & 0x0000ffff)); - } - - int s = 0, t = 0, w = 0x30000; - int dsdx = 0, dtdx = 0, dwdx = 0; - int dsde = 0, dtde = 0, dwde = 0; - if (_texture) { - s = static_cast((_pData[24] & 0xffff0000) | ((_pData[28] >> 16) & 0x0000ffff)); - t = static_cast(((_pData[24] << 16) & 0xffff0000) | (_pData[28] & 0x0000ffff)); - w = static_cast((_pData[25] & 0xffff0000) | ((_pData[29] >> 16) & 0x0000ffff)); - dsdx = static_cast((_pData[26] & 0xffff0000) | ((_pData[30] >> 16) & 0x0000ffff)); - dtdx = static_cast(((_pData[26] << 16) & 0xffff0000) | (_pData[30] & 0x0000ffff)); - dwdx = static_cast((_pData[27] & 0xffff0000) | ((_pData[31] >> 16) & 0x0000ffff)); - dsde = static_cast((_pData[32] & 0xffff0000) | ((_pData[36] >> 16) & 0x0000ffff)); - dtde = static_cast(((_pData[32] << 16) & 0xffff0000) | (_pData[36] & 0x0000ffff)); - dwde = static_cast((_pData[33] & 0xffff0000) | ((_pData[37] >> 16) & 0x0000ffff)); - } - - int z = 0xffff0000; - int dzdx = 0, dzde = 0; - if (_zbuffer) { - z = pDataSigned[40]; - dzdx = pDataSigned[41]; - dzde = pDataSigned[42]; - } - - std::array vertices; - - auto cscale = [](int c) { - return _FIXED2FLOATCOLOR((((c) > 0x3ff0000 ? 0x3ff0000 : ((c) < 0 ? 0 : (c))) >> 18), 8); - }; - - f32 rf = cscale(r << 2); - f32 gf = cscale(g << 2); - f32 bf = cscale(b << 2); - f32 af = cscale(a << 2); - f32 wf = f32(w) / f32(0xffff0000); - f32 zf = f32(z) / f32(0xffff0000); - f32 sf = f32(s) / f32(1 << 18); - f32 tf = f32(t) / f32(1 << 18); - - f32 drdef = _FIXED2FLOAT(((drde >> 2) & ~1), 16) / 255.0f; - f32 dgdef = _FIXED2FLOAT(((dgde >> 2) & ~1), 16) / 255.0f; - f32 dbdef = _FIXED2FLOAT(((dbde >> 2) & ~1), 16) / 255.0f; - f32 dadef = _FIXED2FLOAT(((dade >> 2) & ~1), 16) / 255.0f; - f32 dwdef = f32(dwde >> 2) / f32(0xffff0000); - f32 dzdef = f32(dzde >> 2) / f32(0xffff0000); - - f32 dsdef = f32(dsde >> 2) / f32(1 << 18); - f32 dtdef = f32(dtde >> 2) / f32(1 << 18); - - f32 drdxf = _FIXED2FLOAT(drdx, 16) / 255.0f; - f32 dgdxf = _FIXED2FLOAT(dgdx, 16) / 255.0f; - f32 dbdxf = _FIXED2FLOAT(dbdx, 16) / 255.0f; - f32 dadxf = _FIXED2FLOAT(dadx, 16) / 255.0f; - - f32 dwdxf = f32(dwdx >> 2) / f32(0xffff0000); - f32 dzdxf = f32(dzdx >> 2) / f32(0xffff0000); - - f32 dsdxf = _FIXED2FLOAT(((dsdx >> 2) & ~1), 16); - f32 dtdxf = _FIXED2FLOAT(((dtdx >> 2) & ~1), 16); - - f32 xhf = _FIXED2FLOAT((xh & ~0x1), 16); - f32 xmf = _FIXED2FLOAT((xm & ~0x1), 16); - - f32 yhf = f32(yh); - f32 ymf = f32(ym); - f32 ylf = f32(yl); - f32 hk = _FIXED2FLOAT(((dxhdy >> 2) & ~0x1), 16); - f32 mk = _FIXED2FLOAT(((dxmdy >> 2) & ~0x1), 16); - f32 hc = xhf - hk * yhf; - f32 mc = xmf - mk * yhf; - - auto updateVtx = [&](SPVertex * vtx, f32 diffY, f32 diffx) - { - if (_shade) { - auto colorClamp = [](f32 c) -> f32 - { - f32 res; - if (c < 0.0f) - res = 0.0f; - else if (c > 1.0f) - res = 1.0f; - else - res = static_cast(c); - return res; - }; - - vtx->r = colorClamp(rf + drdef * diffY + drdxf * diffx); - vtx->g = colorClamp(gf + dgdef * diffY + dgdxf * diffx); - vtx->b = colorClamp(bf + dbdef * diffY + dbdxf * diffx); - vtx->a = colorClamp(af + dadef * diffY + dadxf * diffx); - } - - if (_zbuffer) { - //((gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : f32(u32(z)) / 0xffff0000) - vtx->z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? - gDP.primDepth.z : - static_cast((zf + dzdef * diffY + dzdxf * diffx * 4.0f)*2.0f); - //if (vtx->z < 0.0f) - // vtx->z = 1.0f + vtx->z - ceil(vtx->z); - } else - vtx->z = 0.0f; - - if (_texture) { - if (gDP.otherMode.texturePersp != 0) { - f32 vw = wf + dwdef * diffY + dwdxf * diffx * 4.0f; - vtx->w = static_cast(1.0f / (vw > 0.0f ? vw : (1.0f + vw - ceil(vw)))); - //vtx->w = static_cast(1.0f / vw); - if (vw <= 0.0f) { - // TODO fix with proper coords - vtx->s = static_cast(1 << gSP.textureTile[0]->masks); - vtx->t = static_cast(1 << gSP.textureTile[0]->maskt); - } else { - vtx->s = static_cast((sf + dsdef * diffY + dsdxf*diffx) / vw * 0.0625f); - vtx->t = static_cast((tf + dtdef * diffY + dtdxf*diffx) / vw * 0.0625f); - } - } else { - vtx->w = 1.0f; - vtx->s = static_cast((sf + dsdef * diffY + dsdxf*diffx) * 0.125f); - vtx->t = static_cast((tf + dtdef * diffY + dtdxf*diffx) * 0.125f); - } - } else - vtx->w = 1.0f; - //assert(!isnan(vtx->x)); - }; - - u32 vtxCount = 0; - if (fabs(hk - mk) < 0.00000001f) { - SPVertex * vtx = &vertices[vtxCount++]; - vtx->x = static_cast(hk * yhf + hc); - vtx->y = static_cast(yhf * 0.25f); - updateVtx(vtx, 0.0f, 0.0f); - - if (mc != hc) { - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(mk * yhf + mc); - vtx->y = static_cast(yhf * 0.25f); - updateVtx(vtx, 0.0f, (mc - hc)); - } - - f32 diffym = (ymf - yhf); - f32 xhym = (hk * ymf + hc); - f32 xmym = (mk * ymf + mc); - f32 diffxm = (xmym - xhym); - -#if 1 - f32 vw = wf + dwdef * diffym + dwdxf * diffxm * 4.0f; - if (vw <= 0.0f) { - f32 xhyf, xmyf, diffyf, diffxf; - f32 yf = ymf; - do { - yf -= 1.0f; - diffyf = (yf - yhf); - xhyf = hk * yf + hc; - xmyf = mk * yf + mc; - diffxf = xmyf - xhyf; - vw = wf + dwdef * diffyf + dwdxf * diffxf * 4.0f; - } while (vw <= 0.0f && yf > yhf); - - SPVertex * vtx = &vertices[vtxCount++]; - vtx->x = static_cast(xhyf); - vtx->y = static_cast(yf * 0.25f); - updateVtx(vtx, diffyf, 0.0f); - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(xmyf); - vtx->y = static_cast(yf * 0.25f); - updateVtx(vtx, diffyf, diffxf); - } -#endif - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(xhym); - vtx->y = static_cast(ymf * 0.25f); - updateVtx(vtx, diffym, 0.0f); - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(xmym); - vtx->y = static_cast(ymf * 0.25f); - updateVtx(vtx, diffym, diffxm); - - if (dxldy != dxmdy && ym < yl) { - f32 xlf = _FIXED2FLOAT((xl & ~1), 16); - f32 lk = _FIXED2FLOAT(((dxldy >> 2) & ~1), 16); - f32 lc = xlf - lk * ym; - f32 y4f = (lc - hc) / (hk - lk); - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(hk * y4f + hc); - vtx->y = static_cast(y4f * 0.25f); - updateVtx(vtx, (y4f - yhf), 0.0f); - } - } else { - f32 y0f = (mc - hc) / (hk - mk); - - SPVertex * vtx = &vertices[vtxCount++]; - vtx->x = static_cast(hk * y0f + hc); - vtx->y = static_cast(y0f * 0.25f); - updateVtx(vtx, (y0f - yhf), 0.0f); - - f32 y1f = ymf; - f32 xlf = _FIXED2FLOAT((xl & ~1), 16); - f32 lk = _FIXED2FLOAT(((dxldy >> 2) & ~1), 16); - f32 lc = xlf - lk * y1f; - - //f32 lc = xt - lk * yf; - //if ((dxldy >> 2) == (dxmdy >> 2)) - // y1f = (lc - hc) / (hk - lk); - //else - // y1f = (lc - mc) / (mk - lk); - - //if (y1f < ymf) - // y1f = ymf; - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(xlf); - vtx->y = static_cast(y1f * 0.25f); - - f32 x1f = hk * y1f + hc; - f32 diffx1 = xlf - x1f; - -#if 0 - if ((dxldy >> 2) == (dxmdy >> 2)) - y1f = (lc - hc) / (hk - lk); - else - y1f = (lc - mc) / (mk - lk); -#endif - - f32 diffy1 = (y1f - yhf); - updateVtx(vtx, diffy1, diffx1); - -#if 1 - f32 vw1 = wf + dwdef * diffy1 + dwdxf * diffx1 * 4.0f; - if (vw1 <= 0.0f) { - f32 y1_1f = y1f; - f32 vw1_1 = vw1; - f32 x1_1f = x1f; - f32 x1_2f = xlf; - f32 diffy1_1 = diffy1; - f32 diffx1_1 = diffx1; - do { - y1_1f += 1.0f; - diffy1_1 = (y1_1f - yhf); - x1_1f = hk * y1_1f + hc; - x1_2f = lk * y1_1f + lc; - diffx1_1 = x1_2f - x1_1f; - vw1_1 = wf + dwdef * diffy1_1 + dwdxf * diffx1_1 * 4.0f; - } while (vw1_1 <= 0.0f && y1_1f < ylf); - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(x1_1f); - vtx->y = static_cast(y1_1f * 0.25f); - updateVtx(vtx, diffy1_1, 0.0f); - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(x1_2f); - vtx->y = static_cast(y1_1f * 0.25f); - updateVtx(vtx, diffy1_1, diffx1_1); - - } -#endif - - if (hk == lk) { - f32 lrx = lk * ylf + lc; - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(lrx); - vtx->y = static_cast(ylf * 0.25f - (vertices[1].y - vertices[0].y)); - f32 ydiff = (vtx->y*4.0f - yhf); - updateVtx(vtx, ydiff, diffx1); - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(lrx); - vtx->y = static_cast(ylf*0.25f); - ydiff = (ylf - yhf); - - f32 x2f = hk * ylf + hc; - f32 diffx2 = vtx->x - x2f; - updateVtx(vtx, ydiff, diffx2); - } else if (mk == lk) { - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(hk * ylf + hc); - vtx->y = static_cast(ylf * 0.25f); - updateVtx(vtx, (ylf - yhf), 0.0f); - } else { - f32 y2f = ylf; - - if (yl == ym) { - y2f = (lc - mc) / (mk - lk); - } else { - y2f = (lc - hc) / (hk - lk); - } - - vtx = &vertices[vtxCount++]; - vtx->x = static_cast(hk * y2f + hc); - vtx->y = static_cast(y2f * 0.25f); - updateVtx(vtx, (y2f - yhf), 0.0f); - } - } - - if (_texture) - gDP.changed |= CHANGED_TILE; - if (_zbuffer) - gSP.geometryMode |= G_ZBUFFER; - - GraphicsDrawer & drawer = dwnd().getDrawer(); - - for (u32 i = 0; i < vtxCount - 2; ++i) { - for (u32 j = 0; j < 3; ++j) { - SPVertex & v = drawer.getCurrentDMAVertex(); - v = vertices[i + j]; - } - } -} - -void gDPTriFill(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32)); - memset(&ewdata[8], 0, 36 * sizeof(s32)); - LLETriangle::get().draw(0, 0, 0, ewdata); - DebugMsg( DEBUG_NORMAL, "trifill\n"); -} - -void gDPTriShade(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 24 * sizeof(s32)); - memset(&ewdata[24], 0, 20 * sizeof(s32)); - LLETriangle::get().draw(1, 0, 0, ewdata); - DebugMsg( DEBUG_NORMAL, "trishade\n"); -} - -void gDPTriTxtr(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32)); - memset(&ewdata[8], 0, 16 * sizeof(s32)); - memcpy(&ewdata[24], RDP.cmd_data + RDP.cmd_cur + 8, 16 * sizeof(s32)); - memset(&ewdata[40], 0, 4 * sizeof(s32)); - LLETriangle::get().draw(0, 1, 0, ewdata); - DebugMsg(DEBUG_NORMAL, "tritxtr\n"); -} - -void gDPTriShadeTxtr(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 40 * sizeof(s32)); - memset(&ewdata[40], 0, 4 * sizeof(s32)); - LLETriangle::get().draw(1, 1, 0, ewdata); - DebugMsg( DEBUG_NORMAL, "trishadetxtr\n"); -} - -void gDPTriFillZ(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32)); - memset(&ewdata[8], 0, 32 * sizeof(s32)); - memcpy(&ewdata[40], RDP.cmd_data + RDP.cmd_cur + 8, 4 * sizeof(s32)); - LLETriangle::get().draw(0, 0, 1, ewdata); - DebugMsg( DEBUG_NORMAL, "trifillz\n"); -} - -void gDPTriShadeZ(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 24 * sizeof(s32)); - memset(&ewdata[24], 0, 16 * sizeof(s32)); - memcpy(&ewdata[40], RDP.cmd_data + RDP.cmd_cur + 24, 4 * sizeof(s32)); - LLETriangle::get().draw(1, 0, 1, ewdata); - DebugMsg( DEBUG_NORMAL, "trishadez\n"); -} - -void gDPTriTxtrZ(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32)); - memset(&ewdata[8], 0, 16 * sizeof(s32)); - memcpy(&ewdata[24], RDP.cmd_data + RDP.cmd_cur + 8, 16 * sizeof(s32)); - memcpy(&ewdata[40], RDP.cmd_data + RDP.cmd_cur + 24, 4 * sizeof(s32)); - LLETriangle::get().draw(0, 1, 1, ewdata); - DebugMsg( DEBUG_NORMAL, "tritxtrz\n"); -} - -void gDPTriShadeTxtrZ(u32 w0, u32 w1) -{ - u32 ewdata[44]; - memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 44 * sizeof(s32)); - LLETriangle::get().draw(1, 1, 1, ewdata); - DebugMsg( DEBUG_NORMAL, "trishadetxtrz\n"); -} diff --git a/GLideN64/src/gDP.h b/GLideN64/src/gDP.h deleted file mode 100644 index a845895..0000000 --- a/GLideN64/src/gDP.h +++ /dev/null @@ -1,332 +0,0 @@ -#ifndef GDP_H -#define GDP_H - -#include "Types.h" - -#define CHANGED_RENDERMODE 0x001U -#define CHANGED_CYCLETYPE 0x002U -#define CHANGED_SCISSOR 0x004U -#define CHANGED_TMEM 0x008U -#define CHANGED_TILE 0x010U -#define CHANGED_REJECT_BOX 0x020U -//#define CHANGED_COMBINE_COLORS 0x020 -#define CHANGED_COMBINE 0x040U -#define CHANGED_ALPHACOMPARE 0x080U -#define CHANGED_FOGCOLOR 0x100U -#define CHANGED_BLENDCOLOR 0x200U -#define CHANGED_FB_TEXTURE 0x400U -#define CHANGED_COLORBUFFER 0x1000U -#define CHANGED_CPU_FB_WRITE 0x2000U - -#define TEXTUREMODE_NORMAL 0 -#define TEXTUREMODE_BGIMAGE 2 -#define TEXTUREMODE_FRAMEBUFFER 3 -#define TEXTUREMODE_FRAMEBUFFER_BG 4 - -#define LOADTYPE_BLOCK 0 -#define LOADTYPE_TILE 1 - -struct gDPCombine -{ - union - { - struct - { - // muxs1 - unsigned aA1 : 3; - unsigned sbA1 : 3; - unsigned aRGB1 : 3; - unsigned aA0 : 3; - unsigned sbA0 : 3; - unsigned aRGB0 : 3; - unsigned mA1 : 3; - unsigned saA1 : 3; - unsigned sbRGB1 : 4; - unsigned sbRGB0 : 4; - - // muxs0 - unsigned mRGB1 : 5; - unsigned saRGB1 : 4; - unsigned mA0 : 3; - unsigned saA0 : 3; - unsigned mRGB0 : 5; - unsigned saRGB0 : 4; - }; - - struct - { - u32 muxs1, muxs0; - }; - - u64 mux; - }; -}; - -struct FrameBuffer; -struct gDPTile -{ - u32 format, size, line, tmem, palette; - - union - { - struct - { - unsigned mirrort : 1; - unsigned clampt : 1; - unsigned pad0 : 30; - - unsigned mirrors : 1; - unsigned clamps : 1; - unsigned pad1 : 30; - }; - - struct - { - u32 cmt, cms; - }; - }; - - u32 maskt, masks; - u32 originalMaskT, originalMaskS; - u32 shiftt, shifts; - f32 fuls, fult, flrs, flrt; - u32 uls, ult, lrs, lrt; - - u32 textureMode; - u32 loadType; - u16 loadWidth; - u16 loadHeight; - u32 imageAddress; - u32 frameBufferAddress; -}; - -struct gDPLoadTileInfo { - u8 size; - u8 loadType; - u16 uls; - u16 ult; - u16 lrs; - u16 lrt; - u16 width; - u16 height; - u16 texWidth; - u32 texAddress; - u32 dxt; - u32 bytes; -}; - -struct gDPScissor -{ - u32 mode; - f32 ulx, uly, lrx, lry; - s16 xh, yh, xl, yl; -}; - -struct gDPTexrectInfo -{ - f32 ulx, lrx, uly, lry; - s16 s, t; - f32 dsdx, dtdy; -}; - -struct gDPInfo -{ - struct OtherMode - { - union - { - struct - { - unsigned int alphaCompare : 2; - unsigned int depthSource : 1; - -// struct -// { - unsigned int AAEnable : 1; - unsigned int depthCompare : 1; - unsigned int depthUpdate : 1; - unsigned int imageRead : 1; - unsigned int colorOnCvg : 1; - - unsigned int cvgDest : 2; - unsigned int depthMode : 2; - - unsigned int cvgXAlpha : 1; - unsigned int alphaCvgSel : 1; - unsigned int forceBlender : 1; - unsigned int textureEdge : 1; -// } renderMode; - -// struct -// { - unsigned int c2_m2b : 2; - unsigned int c1_m2b : 2; - unsigned int c2_m2a : 2; - unsigned int c1_m2a : 2; - unsigned int c2_m1b : 2; - unsigned int c1_m1b : 2; - unsigned int c2_m1a : 2; - unsigned int c1_m1a : 2; -// } blender; - - unsigned int blendMask : 4; - unsigned int alphaDither : 2; - unsigned int colorDither : 2; - - unsigned int combineKey : 1; -// unsigned int textureConvert : 3; - unsigned int convert_one : 1; - unsigned int bi_lerp1 : 1; - unsigned int bi_lerp0 : 1; - - unsigned int textureFilter : 2; - unsigned int textureLUT : 2; - - unsigned int textureLOD : 1; - unsigned int textureDetail : 2; - unsigned int texturePersp : 1; - unsigned int cycleType : 2; - unsigned int unusedColorDither : 1; // unsupported - unsigned int pipelineMode : 1; - - unsigned int pad : 8; - - }; - - u64 _u64; - - struct - { - u32 l, h; - }; - }; - } otherMode; - - gDPCombine combine; - - gDPTile tiles[8], *loadTile; - u32 loadTileIdx; - - struct Color - { - Color() : r(0), g(0), b(0), a(0) {} - f32 r, g, b, a; - } fogColor, blendColor, envColor, rectColor; - - struct FillColor - { - f32 z, dz; - u32 color; - } fillColor; - - struct PrimColor : public Color - { - f32 l, m; - } primColor; - - struct - { - f32 z, deltaZ; - } primDepth; - - struct - { - u32 format, size, width, bpl; - u32 address; - } textureImage; - - struct - { - u32 format, size, width, height, bpl; - u32 address, changed; - } colorImage; - - u32 depthImageAddress; - - gDPScissor scissor; - - struct - { - s32 k0, k1, k2, k3, k4, k5; - } convert; - - struct - { - Color center, scale, width; - } key; - - u32 changed; - - u16 TexFilterPalette[512]; - u64 paletteCRC16[16]; - u64 paletteCRC256; - u32 half_1, half_2; - - gDPLoadTileInfo loadInfo[512]; - gDPTexrectInfo lastTexRectInfo; -}; - -extern gDPInfo gDP; - -class LLETriangle -{ -public: - void draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData); - void flush(u32 _cmd); - static LLETriangle& get(); - -private: - LLETriangle(); - LLETriangle(LLETriangle&) = delete; - void start(u32 _tile); - - gDPTile *m_textureTileOrg[2]; - f32 m_textureScaleOrg[2]; - bool m_flushed{ true }; - u32 m_tile{ 0 }; -}; - -void gDPSetOtherMode( u32 mode0, u32 mode1 ); -void gDPSetPrimDepth( u16 z, u16 dz ); -void gDPSetTexturePersp( u32 enable ); -void gDPSetTextureLUT( u32 mode ); -void gDPSetCombine( u32 muxs0, u32 muxs1 ); -void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address ); -void gDPSetTextureImage( u32 format, u32 size, u32 width, u32 address ); -void gDPSetDepthImage( u32 address ); -void gDPSetEnvColor( u32 r, u32 g, u32 b, u32 a ); -void gDPSetBlendColor( u32 r, u32 g, u32 b, u32 a ); -void gDPSetFogColor( u32 r, u32 g, u32 b, u32 a ); -void gDPSetFillColor( u32 c ); -void gDPGetFillColor(f32 _fillColor[4]); -void gDPSetPrimColor( u32 m, u32 l, u32 r, u32 g, u32 b, u32 a ); -void gDPSetTile( u32 format, u32 size, u32 line, u32 tmem, u32 tile, u32 palette, u32 cmt, u32 cms, u32 maskt, u32 masks, u32 shiftt, u32 shifts ); -void gDPSetTileSize( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt ); -void gDPLoadTile( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt ); -void gDPLoadBlock( u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt ); -void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt ); -void gDPSetScissor( u32 mode, s16 xh, s16 yh, s16 xl, s16 yl); -void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry ); -void gDPSetConvert( s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5 ); -void gDPSetKeyR( u32 cR, u32 sR, u32 wR ); -void gDPSetKeyGB(u32 cG, u32 sG, u32 wG, u32 cB, u32 sB, u32 wB ); -void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, s16 s, s16 t, f32 dsdx, f32 dtdy, bool flip ); -void gDPFullSync(); -void gDPTileSync(); -void gDPPipeSync(); -void gDPLoadSync(); -void gDPNoOp(); - -void gDPTriFill( u32 w0, u32 w1 ); -void gDPTriShade( u32 w0, u32 w1 ); -void gDPTriTxtr( u32 w0, u32 w1 ); -void gDPTriShadeTxtr( u32 w0, u32 w1 ); -void gDPTriFillZ( u32 w0, u32 w1 ); -void gDPTriShadeZ( u32 w0, u32 w1 ); -void gDPTriTxtrZ( u32 w0, u32 w1 ); -void gDPTriShadeTxtrZ( u32 w0, u32 w1 ); - -bool isCurrentColorImageDepthImage(); -bool isDepthCompareEnabled(); - -#endif diff --git a/GLideN64/src/gSP.cpp b/GLideN64/src/gSP.cpp deleted file mode 100644 index 08a8730..0000000 --- a/GLideN64/src/gSP.cpp +++ /dev/null @@ -1,2116 +0,0 @@ -#include -#include -#include -#include -#include -#include "N64.h" -#include "GLideN64.h" -#include "DebugDump.h" -#include "Types.h" -#include "RSP.h" -#include "GBI.h" -#include "gSP.h" -#include "gDP.h" -#include "3DMath.h" -#include "CRC.h" -#include "VI.h" -#include "FrameBuffer.h" -#include "Config.h" -#include "Log.h" -#include "DisplayWindow.h" - -using namespace std; -using namespace graphics; - -#define INDEXMAP_SIZE 80U - -#ifdef __VEC4_OPT -#define VEC_OPT 4U -#else -#define VEC_OPT 1U -#endif - -static bool g_ConkerUcode; - -void gSPFlushTriangles() -{ - if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) { - dwnd().getDrawer().drawTriangles(); - return; - } - - if ( - (RSP.nextCmd != G_TRI1) && - (RSP.nextCmd != G_TRI2) && - (RSP.nextCmd != G_TRIX) && - (RSP.nextCmd != G_QUAD) - ) { - dwnd().getDrawer().drawTriangles(); - DebugMsg(DEBUG_NORMAL, "Triangles flushed;\n"); - } -} - -static -void _gSPCombineMatrices() -{ - MultMatrix(gSP.matrix.projection, gSP.matrix.modelView[gSP.matrix.modelViewi], gSP.matrix.combined); - gSP.changed &= ~CHANGED_MATRIX; -} - -void gSPCombineMatrices(u32 _mode) -{ - if (_mode == 1) - _gSPCombineMatrices(); - else - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Unknown gSPCombineMatrices mode: %u\n", _mode); - DebugMsg(DEBUG_NORMAL, "gSPCombineMatrices();\n"); -} - -void gSPTriangle(u32 v0, u32 v1, u32 v2) -{ - GraphicsDrawer & drawer = dwnd().getDrawer(); - if ((v0 < INDEXMAP_SIZE) && (v1 < INDEXMAP_SIZE) && (v2 < INDEXMAP_SIZE)) { - if (drawer.isClipped(v0, v1, v2)) { - DebugMsg(DEBUG_NORMAL, "Triangle clipped (%i, %i, %i)\n", v0, v1, v2); - return; - } - if (drawer.isRejected(v0, v1, v2)) { - DebugMsg(DEBUG_NORMAL, "Triangle rejected (%i, %i, %i)\n", v0, v1, v2); - return; - } - drawer.addTriangle(v0, v1, v2); - DebugMsg(DEBUG_NORMAL, "Triangle #%i added (%i, %i, %i)\n", gSP.tri_num++, v0, v1, v2); - } -} - -void gSP1Triangle( const u32 v0, const u32 v1, const u32 v2) -{ - DebugMsg(DEBUG_NORMAL, "gSP1Triangle (%i, %i, %i)\n", v0, v1, v2); - - gSPTriangle( v0, v1, v2); - gSPFlushTriangles(); -} - -void gSP2Triangles(const u32 v00, const u32 v01, const u32 v02, const u32 flag0, - const u32 v10, const u32 v11, const u32 v12, const u32 flag1 ) -{ - DebugMsg(DEBUG_NORMAL, "gSP2Triangle (%i, %i, %i)-(%i, %i, %i)\n", v00, v01, v02, v10, v11, v12); - - gSPTriangle( v00, v01, v02); - gSPTriangle( v10, v11, v12); - gSPFlushTriangles(); -} - -void gSP4Triangles(const u32 v00, const u32 v01, const u32 v02, - const u32 v10, const u32 v11, const u32 v12, - const u32 v20, const u32 v21, const u32 v22, - const u32 v30, const u32 v31, const u32 v32 ) -{ - DebugMsg(DEBUG_NORMAL, "gSP4Triangle (%i, %i, %i)-(%i, %i, %i)-(%i, %i, %i)-(%i, %i, %i)\n", - v00, v01, v02, v10, v11, v12, v20, v21, v22, v30, v31, v32); - - gSPTriangle(v00, v01, v02); - gSPTriangle(v10, v11, v12); - gSPTriangle(v20, v21, v22); - gSPTriangle(v30, v31, v32); - gSPFlushTriangles(); -} - -gSPInfo gSP; - -static -f32 identityMatrix[4][4] = -{ - { 1.0f, 0.0f, 0.0f, 0.0f }, - { 0.0f, 1.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 1.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 1.0f } -}; - -void gSPLoadUcodeEx( u32 uc_start, u32 uc_dstart, u16 uc_dsize ) -{ - gSP.matrix.modelViewi = 0; - gSP.status[0] = gSP.status[1] = gSP.status[2] = gSP.status[3] = 0; - gSP.fog.multiplier = gSP.fog.offset = 0; - gSP.fog.multiplierf = gSP.fog.offsetf = 0.0f; - gSP.geometryMode = 0U; - gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT | CHANGED_GEOMETRYMODE; - - if ((((uc_start & 0x1FFFFFFF) + 4096) > RDRAMSize) || (((uc_dstart & 0x1FFFFFFF) + uc_dsize) > RDRAMSize)) { - DebugMsg(DEBUG_NORMAL|DEBUG_ERROR, "gSPLoadUcodeEx out of RDRAM\n"); - return; - } - - GBI.loadMicrocode(uc_start, uc_dstart, uc_dsize); - RSP.uc_start = uc_start; - RSP.uc_dstart = uc_dstart; - - DebugMsg(DEBUG_NORMAL, "gSPLoadUcodeEx type: %d\n", GBI.getMicrocodeType()); -} - -void gSPNoOp() -{ - gSPFlushTriangles(); - DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "gSPNoOp();\n"); -} - -void gSPMatrix( u32 matrix, u8 param ) -{ - - f32 mtx[4][4]; - u32 address = RSP_SegmentToPhysical( matrix ); - - if (address + 64 > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load matrix from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPMatrix( 0x%08X, %s | %s | %s );\n", - matrix, - (param & G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_MODELVIEW", - (param & G_MTX_LOAD) ? "G_MTX_LOAD" : "G_MTX_MUL", - (param & G_MTX_PUSH) ? "G_MTX_PUSH" : "G_MTX_NOPUSH" ); - return; - } - - RSP_LoadMatrix( mtx, address ); - - if (param & G_MTX_PROJECTION) { - if (param & G_MTX_LOAD) - CopyMatrix( gSP.matrix.projection, mtx ); - else - MultMatrix2( gSP.matrix.projection, mtx ); - } else { - if ((param & G_MTX_PUSH)) { - if (gSP.matrix.modelViewi < (gSP.matrix.stackSize)) { - CopyMatrix(gSP.matrix.modelView[gSP.matrix.modelViewi + 1], gSP.matrix.modelView[gSP.matrix.modelViewi]); - gSP.matrix.modelViewi++; - } else - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Modelview stack overflow\n"); - } - - if (param & G_MTX_LOAD) - CopyMatrix( gSP.matrix.modelView[gSP.matrix.modelViewi], mtx ); - else - MultMatrix2( gSP.matrix.modelView[gSP.matrix.modelViewi], mtx ); - gSP.changed |= CHANGED_LIGHT | CHANGED_LOOKAT; - } - - gSP.changed |= CHANGED_MATRIX; - - DebugMsg(DEBUG_NORMAL, "gSPMatrix( 0x%08X, %s | %s | %s );\n", - matrix, - (param & G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_MODELVIEW", - (param & G_MTX_LOAD) ? "G_MTX_LOAD" : "G_MTX_MUL", - (param & G_MTX_PUSH) ? "G_MTX_PUSH" : "G_MTX_NOPUSH"); - DebugMsg(DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[0][0], mtx[0][1], mtx[0][2], mtx[0][3] ); - DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[1][0], mtx[1][1], mtx[1][2], mtx[1][3] ); - DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[2][0], mtx[2][1], mtx[2][2], mtx[2][3] ); - DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[3][0], mtx[3][1], mtx[3][2], mtx[3][3] ); -} - -void gSPDMAMatrix( u32 matrix, u8 index, u8 multiply ) -{ - f32 mtx[4][4]; - u32 address = gSP.DMAOffsets.mtx + RSP_SegmentToPhysical( matrix ); - - if (address + 64 > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load matrix from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPDMAMatrix( 0x%08X, %i, %s );\n", - matrix, index, multiply ? "TRUE" : "FALSE"); - return; - } - - RSP_LoadMatrix(mtx, address); - - gSP.matrix.modelViewi = index; - - if (multiply) - MultMatrix(gSP.matrix.modelView[0], mtx, gSP.matrix.modelView[gSP.matrix.modelViewi]); - else - CopyMatrix( gSP.matrix.modelView[gSP.matrix.modelViewi], mtx ); - - CopyMatrix( gSP.matrix.projection, identityMatrix ); - - - gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT; - - DebugMsg(DEBUG_NORMAL, "gSPDMAMatrix( 0x%08X, %i, %s );\n", - matrix, index, multiply ? "TRUE" : "FALSE"); - DebugMsg(DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[0][0], mtx[0][1], mtx[0][2], mtx[0][3] ); - DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[1][0], mtx[1][1], mtx[1][2], mtx[1][3] ); - DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[2][0], mtx[2][1], mtx[2][2], mtx[2][3] ); - DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n", - mtx[3][0], mtx[3][1], mtx[3][2], mtx[3][3] ); -} - -void gSPViewport( u32 v ) -{ - u32 address = RSP_SegmentToPhysical( v ); - - if ((address + 16) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load viewport from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPViewport( 0x%08X );\n", v); - return; - } - - gSP.viewport.vscale[0] = _FIXED2FLOAT( *(s16*)&RDRAM[address + 2], 2 ); - gSP.viewport.vscale[1] = _FIXED2FLOAT( *(s16*)&RDRAM[address ], 2 ); - gSP.viewport.vscale[2] = _FIXED2FLOAT( *(s16*)&RDRAM[address + 6], 10 );// * 0.00097847357f; - gSP.viewport.vscale[3] = *(s16*)&RDRAM[address + 4]; - gSP.viewport.vtrans[0] = _FIXED2FLOAT( *(s16*)&RDRAM[address + 10], 2 ); - gSP.viewport.vtrans[1] = _FIXED2FLOAT( *(s16*)&RDRAM[address + 8], 2 ); - gSP.viewport.vtrans[2] = _FIXED2FLOAT( *(s16*)&RDRAM[address + 14], 10 );// * 0.00097847357f; - gSP.viewport.vtrans[3] = *(s16*)&RDRAM[address + 12]; - - if (gSP.viewport.vscale[1] < 0.0f && !GBI.isNegativeY()) - gSP.viewport.vscale[1] = -gSP.viewport.vscale[1]; - - gSP.viewport.x = gSP.viewport.vtrans[0] - gSP.viewport.vscale[0]; - gSP.viewport.y = gSP.viewport.vtrans[1] - gSP.viewport.vscale[1]; - gSP.viewport.width = fabs(gSP.viewport.vscale[0]) * 2; - gSP.viewport.height = fabs(gSP.viewport.vscale[1] * 2); - gSP.viewport.nearz = gSP.viewport.vtrans[2] - gSP.viewport.vscale[2]; - gSP.viewport.farz = (gSP.viewport.vtrans[2] + gSP.viewport.vscale[2]) ; - - gSP.changed |= CHANGED_VIEWPORT; - - DebugMsg(DEBUG_NORMAL, "gSPViewport scale(%02f, %02f, %02f), trans(%02f, %02f, %02f)\n", - gSP.viewport.vscale[0], gSP.viewport.vscale[1], gSP.viewport.vscale[2], - gSP.viewport.vtrans[0], gSP.viewport.vtrans[1], gSP.viewport.vtrans[2]); -} - -void gSPForceMatrix( u32 mptr ) -{ - u32 address = RSP_SegmentToPhysical( mptr ); - - if (address + 64 > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load from invalid address"); - DebugMsg(DEBUG_NORMAL, "gSPForceMatrix( 0x%08X );\n", mptr); - return; - } - - RSP_LoadMatrix(gSP.matrix.combined, address); - - gSP.changed &= ~CHANGED_MATRIX; - - DebugMsg(DEBUG_NORMAL, "gSPForceMatrix( 0x%08X );\n", mptr); -} - -void gSPLight( u32 l, s32 n ) -{ - --n; - u32 addrByte = RSP_SegmentToPhysical( l ); - - if ((addrByte + sizeof( Light )) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load light from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n", l, n ); - return; - } - - Light *light = (Light*)&RDRAM[addrByte]; - - if (n < 8) { - gSP.lights.rgb[n][R] = _FIXED2FLOATCOLOR(light->r,8); - gSP.lights.rgb[n][G] = _FIXED2FLOATCOLOR(light->g,8); - gSP.lights.rgb[n][B] = _FIXED2FLOATCOLOR(light->b,8); - gSP.lights.rgb2[n][R] = _FIXED2FLOATCOLOR(light->r2, 8); - gSP.lights.rgb2[n][G] = _FIXED2FLOATCOLOR(light->g2, 8); - gSP.lights.rgb2[n][B] = _FIXED2FLOATCOLOR(light->b2, 8); - - gSP.lights.xyz[n][X] = light->x; - gSP.lights.xyz[n][Y] = light->y; - gSP.lights.xyz[n][Z] = light->z; - - Normalize( gSP.lights.xyz[n] ); - u32 addrShort = addrByte >> 1; - gSP.lights.pos_xyzw[n][X] = (float)(((short*)RDRAM)[(addrShort+4)^1]); - gSP.lights.pos_xyzw[n][Y] = (float)(((short*)RDRAM)[(addrShort+5)^1]); - gSP.lights.pos_xyzw[n][Z] = (float)(((short*)RDRAM)[(addrShort+6)^1]); - gSP.lights.ca[n] = (float)(RDRAM[(addrByte + 3) ^ 3]); - gSP.lights.la[n] = (float)(RDRAM[(addrByte + 7) ^ 3]); - gSP.lights.qa[n] = (float)(RDRAM[(addrByte + 14) ^ 3]); - } - - gSP.changed |= CHANGED_LIGHT; - - DebugMsg( DEBUG_DETAIL, "// x = %2.6f y = %2.6f z = %2.6f\n", - _FIXED2FLOAT( light->x, 7 ), _FIXED2FLOAT( light->y, 7 ), _FIXED2FLOAT( light->z, 7 ) ); - DebugMsg( DEBUG_DETAIL, "// r = %3i g = %3i b = %3i\n", - light->r, light->g, light->b ); - DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n", - l, n ); -} - -void gSPLightCBFD( u32 l, s32 n ) -{ - u32 addrByte = RSP_SegmentToPhysical( l ); - - if ((addrByte + sizeof( Light )) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load light from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n", l, n ); - return; - } - - Light *light = (Light*)&RDRAM[addrByte]; - - if (n < 12) { - gSP.lights.rgb[n][R] = _FIXED2FLOATCOLOR(light->r, 8); - gSP.lights.rgb[n][G] = _FIXED2FLOATCOLOR(light->g, 8); - gSP.lights.rgb[n][B] = _FIXED2FLOATCOLOR(light->b, 8); - gSP.lights.rgb2[n][R] = _FIXED2FLOATCOLOR(light->r2, 8); - gSP.lights.rgb2[n][G] = _FIXED2FLOATCOLOR(light->g2, 8); - gSP.lights.rgb2[n][B] = _FIXED2FLOATCOLOR(light->b2, 8); - - gSP.lights.xyz[n][X] = light->x; - gSP.lights.xyz[n][Y] = light->y; - gSP.lights.xyz[n][Z] = light->z; - - Normalize( gSP.lights.xyz[n] ); - u32 addrShort = addrByte >> 1; - gSP.lights.pos_xyzw[n][X] = (float)(((short*)RDRAM)[(addrShort+16)^1]); - gSP.lights.pos_xyzw[n][Y] = (float)(((short*)RDRAM)[(addrShort+17)^1]); - gSP.lights.pos_xyzw[n][Z] = (float)(((short*)RDRAM)[(addrShort+18)^1]); - gSP.lights.pos_xyzw[n][W] = (float)(((short*)RDRAM)[(addrShort+19)^1]); - gSP.lights.ca[n] = (float)(RDRAM[(addrByte + 12) ^ 3]) / 16.0f; - } - - gSP.changed |= CHANGED_LIGHT; - - DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n", l, n); - DebugMsg(DEBUG_DETAIL, "// x = %2.6f y = %2.6f z = %2.6f\n", - _FIXED2FLOAT( light->x, 7 ), _FIXED2FLOAT( light->y, 7 ), _FIXED2FLOAT( light->z, 7 ) ); - DebugMsg( DEBUG_DETAIL, "// r = %3i g = %3i b = %3i\n", - light->r, light->g, light->b ); -} - -void gSPLightAcclaim(u32 l, s32 n) -{ - u32 addrByte = RSP_SegmentToPhysical(l); - - if (n < 10) { - const u32 addrShort = addrByte >> 1; - gSP.lights.pos_xyzw[n][X] = (f32)(((s16*)RDRAM)[(addrShort + 0) ^ 1]); - gSP.lights.pos_xyzw[n][Y] = (f32)(((s16*)RDRAM)[(addrShort + 1) ^ 1]); - gSP.lights.pos_xyzw[n][Z] = (f32)(((s16*)RDRAM)[(addrShort + 2) ^ 1]); - gSP.lights.ca[n] = (f32)(((s16*)RDRAM)[(addrShort + 5) ^ 1]); - gSP.lights.la[n] = _FIXED2FLOAT((((u16*)RDRAM)[(addrShort + 6) ^ 1]), 16); - gSP.lights.qa[n] = (f32)(((u16*)RDRAM)[(addrShort + 7) ^ 1]); - gSP.lights.rgb[n][R] = _FIXED2FLOATCOLOR((RDRAM[(addrByte + 6) ^ 3]), 8); - gSP.lights.rgb[n][G] = _FIXED2FLOATCOLOR((RDRAM[(addrByte + 7) ^ 3]), 8); - gSP.lights.rgb[n][B] = _FIXED2FLOATCOLOR((RDRAM[(addrByte + 8) ^ 3]), 8); - gSP.lights.rgb2[n][R] = gSP.lights.rgb[n][R]; - gSP.lights.rgb2[n][G] = gSP.lights.rgb[n][G]; - gSP.lights.rgb2[n][B] = gSP.lights.rgb[n][B]; - } - - gSP.changed |= CHANGED_LIGHT; - - DebugMsg(DEBUG_NORMAL, "gSPLightAcclaim( 0x%08X, LIGHT_%i ca=%f la=%f);\n", l, n, gSP.lights.ca[n], gSP.lights.la[n]); -} - -void gSPLookAt( u32 _l, u32 _n ) -{ - u32 address = RSP_SegmentToPhysical(_l); - - if ((address + sizeof(Light)) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load light from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPLookAt( 0x%08X, LOOKAT_%i );\n", _l, _n); - return; - } - assert(_n < 2); - - Light *light = (Light*)&RDRAM[address]; - - gSP.lookat.xyz[_n][X] = light->x; - gSP.lookat.xyz[_n][Y] = light->y; - gSP.lookat.xyz[_n][Z] = light->z; - - gSP.lookatEnable = (_n == 0) || (_n == 1 && (light->x != 0 || light->y != 0)); - - Normalize(gSP.lookat.xyz[_n]); - gSP.changed |= CHANGED_LOOKAT; - DebugMsg(DEBUG_NORMAL, "gSPLookAt( 0x%08X, LOOKAT_%i );\n", _l, _n); -} - -static -void gSPUpdateLightVectors() -{ - InverseTransformVectorNormalizeN(&gSP.lights.xyz[0], &gSP.lights.i_xyz[0], - gSP.matrix.modelView[gSP.matrix.modelViewi], gSP.numLights); - gSP.changed ^= CHANGED_LIGHT; - gSP.changed |= CHANGED_HW_LIGHT; -} - -static -void gSPUpdateLookatVectors() -{ - if (gSP.lookatEnable) { - InverseTransformVectorNormalizeN(&gSP.lookat.xyz[0], &gSP.lookat.i_xyz[0], - gSP.matrix.modelView[gSP.matrix.modelViewi], 2); - } - gSP.changed ^= CHANGED_LOOKAT; -} - -/*---------------------------------Vertex Load------------------------------------*/ - -static -void gSPTransformVector_default(float vtx[4], float mtx[4][4]) -{ - const float x = vtx[0]; - const float y = vtx[1]; - const float z = vtx[2]; - - vtx[0] = x * mtx[0][0] + y * mtx[1][0] + z * mtx[2][0] + mtx[3][0]; - vtx[1] = x * mtx[0][1] + y * mtx[1][1] + z * mtx[2][1] + mtx[3][1]; - vtx[2] = x * mtx[0][2] + y * mtx[1][2] + z * mtx[2][2] + mtx[3][2]; - vtx[3] = x * mtx[0][3] + y * mtx[1][3] + z * mtx[2][3] + mtx[3][3]; -} - -static -void gSPInverseTransformVector_default(float vec[3], float mtx[4][4]) -{ - const float x = vec[0]; - const float y = vec[1]; - const float z = vec[2]; - - vec[0] = mtx[0][0] * x + mtx[0][1] * y + mtx[0][2] * z; - vec[1] = mtx[1][0] * x + mtx[1][1] * y + mtx[1][2] * z; - vec[2] = mtx[2][0] * x + mtx[2][1] * y + mtx[2][2] * z; -} - -template -void gSPLightVertexStandard(u32 v, SPVertex * spVtx) -{ -#ifndef __NEON_OPT - if (!isHWLightingAllowed()) { - for(int j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v+j]; - const bool useFirstColor = ((v + j) & 1) == 0; - const float* pColor = useFirstColor ? gSP.lights.rgb[gSP.numLights] : gSP.lights.rgb2[gSP.numLights]; - vtx.r = pColor[R]; - vtx.g = pColor[G]; - vtx.b = pColor[B]; - vtx.HWLight = 0; - - for (u32 i = 0; i < gSP.numLights; ++i) { - const f32 intensity = DotProduct( &vtx.nx, gSP.lights.i_xyz[i] ); - if (intensity > 0.0f) { - pColor = useFirstColor ? gSP.lights.rgb[i] : gSP.lights.rgb2[i]; - vtx.r += pColor[R] * intensity; - vtx.g += pColor[G] * intensity; - vtx.b += pColor[B] * intensity; - } - } - vtx.r = min(1.0f, vtx.r); - vtx.g = min(1.0f, vtx.g); - vtx.b = min(1.0f, vtx.b); - } - } else { - for(int j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v+j]; - TransformVectorNormalize(&vtx.r, gSP.matrix.modelView[gSP.matrix.modelViewi]); - vtx.HWLight = gSP.numLights; - } - } -#else - void gSPLightVertex_NEON(u32 vnum, u32 v, SPVertex * spVtx); - gSPLightVertex_NEON(VNUM, v, spVtx); -#endif -} - -template -void gSPLightVertexCBFD_basic(u32 v, SPVertex * spVtx) -{ - for (int j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v + j]; - vtx.HWLight = 0; - if (vtx.flag < 0) - continue; - - f32 r = gSP.lights.rgb[gSP.numLights][R]; - f32 g = gSP.lights.rgb[gSP.numLights][G]; - f32 b = gSP.lights.rgb[gSP.numLights][B]; - const f32 vPos[3] = { - (vtx.x + gSP.cbfd.vertexCoordMod[ 8])*gSP.cbfd.vertexCoordMod[12], - (vtx.y + gSP.cbfd.vertexCoordMod[ 9])*gSP.cbfd.vertexCoordMod[13], - (vtx.z + gSP.cbfd.vertexCoordMod[10])*gSP.cbfd.vertexCoordMod[14] - }; - - for (int l = gSP.numLights - 2; l >= 0; --l) { - const f32 vx = vPos[X] - gSP.lights.pos_xyzw[l][X]; - const f32 vy = vPos[Y] - gSP.lights.pos_xyzw[l][Y]; - const f32 vz = vPos[Z] - gSP.lights.pos_xyzw[l][Z]; - const f32 len = 2.0f * (vx*vx + vy*vy + vz*vz) * FIXED2FLOATRECIP16; - f32 intensity = std::min(1.0f, gSP.lights.ca[l] / len); - if (intensity > 0.0f) { - r += gSP.lights.rgb[l][R] * intensity; - g += gSP.lights.rgb[l][G] * intensity; - b += gSP.lights.rgb[l][B] * intensity; - } - } - - r = min(1.0f, r); - g = min(1.0f, g); - b = min(1.0f, b); - - vtx.r *= r; - vtx.g *= g; - vtx.b *= b; - } -} - -template -void gSPLightVertexCBFD_advanced(u32 v, SPVertex * spVtx) -{ - for (int j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v + j]; - vtx.HWLight = 0; - if (vtx.flag < 0) - continue; - - const f32 vPos[3] = { - (vtx.x + gSP.cbfd.vertexCoordMod[ 8])*gSP.cbfd.vertexCoordMod[12], - (vtx.y + gSP.cbfd.vertexCoordMod[ 9])*gSP.cbfd.vertexCoordMod[13], - (vtx.z + gSP.cbfd.vertexCoordMod[10])*gSP.cbfd.vertexCoordMod[14] - }; - int l = gSP.numLights; - f32 r = gSP.lights.rgb[l][R]; - f32 g = gSP.lights.rgb[l][G]; - f32 b = gSP.lights.rgb[l][B]; - --l; - f32 intensity = std::min(1.0f, DotProduct(&vtx.nx, gSP.lights.i_xyz[l])); - if (intensity > 0.0f) { - r += gSP.lights.rgb[l][R] * intensity; - g += gSP.lights.rgb[l][G] * intensity; - b += gSP.lights.rgb[l][B] * intensity; - } - - while (--l >= 0) { - const f32 vx = vPos[X] - gSP.lights.pos_xyzw[l][X]; - const f32 vy = vPos[Y] - gSP.lights.pos_xyzw[l][Y]; - const f32 vz = vPos[Z] - gSP.lights.pos_xyzw[l][Z]; - const f32 len = 2.0f * (vx*vx + vy*vy + vz*vz) * FIXED2FLOATRECIP16; - intensity = std::min(1.0f, gSP.lights.ca[l] / len); - if ((gSP.geometryMode & G_POINT_LIGHTING) != 0) - intensity *= std::min(1.0f, DotProduct(&vtx.nx, gSP.lights.i_xyz[l]));; - if (intensity > 0.0f) { - r += gSP.lights.rgb[l][R] * intensity; - g += gSP.lights.rgb[l][G] * intensity; - b += gSP.lights.rgb[l][B] * intensity; - } - } - - r = min(1.0f, r); - g = min(1.0f, g); - b = min(1.0f, b); - - vtx.r *= r; - vtx.g *= g; - vtx.b *= b; - } -} - -template -void gSPLightVertex(u32 _v, SPVertex * _spVtx) -{ - if (g_ConkerUcode) { - if (gSP.cbfd.advancedLighting) - gSPLightVertexCBFD_advanced(_v, _spVtx); - else - gSPLightVertexCBFD_basic(_v, _spVtx); - } else - gSPLightVertexStandard(_v, _spVtx); -} - -void gSPLightVertex(SPVertex & _vtx) -{ - gSPLightVertex<1>(0, &_vtx); -} - -template -void gSPPointLightVertexZeldaMM(u32 v, float _vecPos[VNUM][4], SPVertex * spVtx) -{ - f32 intensity = 0.0f; - for (int j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v + j]; - vtx.HWLight = 0; - vtx.r = gSP.lights.rgb[gSP.numLights][R]; - vtx.g = gSP.lights.rgb[gSP.numLights][G]; - vtx.b = gSP.lights.rgb[gSP.numLights][B]; - gSPTransformVector(_vecPos[j], gSP.matrix.modelView[gSP.matrix.modelViewi]); - - for (u32 l = 0; l < gSP.numLights; ++l) { - if (gSP.lights.ca[l] != 0.0f) { - f32 recip = FIXED2FLOATRECIP16; - // Point lighting - f32 lvec[3] = { gSP.lights.pos_xyzw[l][X], gSP.lights.pos_xyzw[l][Y], gSP.lights.pos_xyzw[l][Z] }; - lvec[0] -= _vecPos[j][0]; - lvec[1] -= _vecPos[j][1]; - lvec[2] -= _vecPos[j][2]; - - const f32 K = lvec[0] * lvec[0] + lvec[1] * lvec[1] + lvec[2] * lvec[2] * 2.0f; - const f32 KS = sqrtf(K); - - gSPInverseTransformVector(lvec, gSP.matrix.modelView[gSP.matrix.modelViewi]); - - for (u32 i = 0; i < 3; ++i) { - lvec[i] = (4.0f * lvec[i] / KS); - if (lvec[i] < -1.0f) - lvec[i] = -1.0f; - if (lvec[i] > 1.0f) - lvec[i] = 1.0f; - } - - f32 V = lvec[0] * vtx.nx + lvec[1] * vtx.ny + lvec[2] * vtx.nz; - if (V < -1.0f) - V = -1.0f; - if (V > 1.0f) - V = 1.0f; - - const f32 KSF = floorf(KS); - const f32 D = (KSF * gSP.lights.la[l] * 2.0f + KSF * KSF * gSP.lights.qa[l] / 8.0f) * recip + 1.0f; - intensity = V / D; - } else { - // Standard lighting - intensity = DotProduct(&vtx.nx, gSP.lights.i_xyz[l]); - } - if (intensity > 0.0f) { - vtx.r += gSP.lights.rgb[l][R] * intensity; - vtx.g += gSP.lights.rgb[l][G] * intensity; - vtx.b += gSP.lights.rgb[l][B] * intensity; - } - } - if (vtx.r > 1.0f) vtx.r = 1.0f; - if (vtx.g > 1.0f) vtx.g = 1.0f; - if (vtx.b > 1.0f) vtx.b = 1.0f; - } -} - -template -void gSPPointLightVertex(u32 _v, float _vecPos[VNUM][4], SPVertex * _spVtx) -{ - if (g_ConkerUcode) { - if (gSP.cbfd.advancedLighting) - gSPLightVertexCBFD_advanced(_v, _spVtx); - else - gSPLightVertexCBFD_basic(_v, _spVtx); - } else - gSPPointLightVertexZeldaMM(_v, _vecPos, _spVtx); -} - -template -void gSPPointLightVertexAcclaim(u32 v, SPVertex * spVtx) -{ - for (int j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v + j]; - vtx.HWLight = 0; - - for (u32 l = 2; l < 10; ++l) { - if (gSP.lights.ca[l] < 0) - continue; - - const f32 dX = fabsf(gSP.lights.pos_xyzw[l][X] - vtx.x); - const f32 dY = fabsf(gSP.lights.pos_xyzw[l][Y] - vtx.y); - const f32 dZ = fabsf(gSP.lights.pos_xyzw[l][Z] - vtx.z); - const f32 distance = dX + dY + dZ - gSP.lights.ca[l]; - if (distance >= 0.0f) - continue; - - const f32 light_intensity = -distance * gSP.lights.la[l]; - vtx.r += gSP.lights.rgb[l][R] * light_intensity; - vtx.g += gSP.lights.rgb[l][G] * light_intensity; - vtx.b += gSP.lights.rgb[l][B] * light_intensity; - } - - if (vtx.r > 1.0f) vtx.r = 1.0f; - if (vtx.g > 1.0f) vtx.g = 1.0f; - if (vtx.b > 1.0f) vtx.b = 1.0f; - } -} - -template -void gSPBillboardVertex(u32 v, SPVertex * spVtx) -{ -#ifndef __NEON_OPT - SPVertex & vtx0 = spVtx[0]; - for (u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v + j]; - vtx.x += vtx0.x; - vtx.y += vtx0.y; - vtx.z += vtx0.z; - vtx.w += vtx0.w; - } -#else - if (VNUM == 1) { - SPVertex & vtx0 = spVtx[0]; - SPVertex & vtx = spVtx[v]; - vtx.x += vtx0.x; - vtx.y += vtx0.y; - vtx.z += vtx0.z; - vtx.w += vtx0.w; - } else { - void gSPBillboardVertex4NEON(u32 v); - gSPBillboardVertex4NEON(v); - } -#endif //__NEON_OPT -} - -template -void gSPClipVertex(u32 v, SPVertex * spVtx) -{ - const f32 scale = dwnd().getAdjustScale(); - for (u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[v+j]; - vtx.clip = 0; - const f32 scaledX = vtx.x * scale; - if (scaledX > +vtx.w) vtx.clip |= CLIP_POSX; - if (scaledX < -vtx.w) vtx.clip |= CLIP_NEGX; - if (vtx.y > +vtx.w) vtx.clip |= CLIP_POSY; - if (vtx.y < -vtx.w) vtx.clip |= CLIP_NEGY; - if (vtx.w < 0.01f) vtx.clip |= CLIP_W; - } -} - -template -void gSPTransformVertex(u32 v, SPVertex * spVtx, float mtx[4][4]) -{ -#ifndef __NEON_OPT - float x, y, z; - for (int i = 0; i < VNUM; ++i) { - SPVertex & vtx = spVtx[v+i]; - x = vtx.x; - y = vtx.y; - z = vtx.z; - vtx.x = x * mtx[0][0] + y * mtx[1][0] + z * mtx[2][0] + mtx[3][0]; - vtx.y = x * mtx[0][1] + y * mtx[1][1] + z * mtx[2][1] + mtx[3][1]; - vtx.z = x * mtx[0][2] + y * mtx[1][2] + z * mtx[2][2] + mtx[3][2]; - vtx.w = x * mtx[0][3] + y * mtx[1][3] + z * mtx[2][3] + mtx[3][3]; - } -#else - void gSPTransformVector_NEON(float vtx[4], float mtx[4][4]); - void gSPTransformVertex4NEON(u32 v, float mtx[4][4]); - if (VNUM == 1) - gSPTransformVector_NEON(&spVtx[v].x, mtx); - else - gSPTransformVertex4NEON(v, mtx); -#endif //__NEON_OPT -} - -template -void gSPProcessVertex(u32 v, SPVertex * spVtx) -{ - if (gSP.changed & CHANGED_MATRIX) - _gSPCombineMatrices(); - - float vPos[VNUM][4]; - for(u32 i = 0; i < VNUM; ++i) { - SPVertex & vtx = spVtx[v+i]; - vPos[i][0] = vtx.x; - vPos[i][1] = vtx.y; - vPos[i][2] = vtx.z; - vPos[i][3] = 0.0f; - vtx.modify = 0; - } - - gSPTransformVertex(v, spVtx, gSP.matrix.combined ); - - if (gSP.matrix.billboard) - gSPBillboardVertex(v, spVtx); - - gSPClipVertex(v, spVtx); - - if (gSP.geometryMode & G_LIGHTING) { - if (gSP.geometryMode & G_POINT_LIGHTING) - gSPPointLightVertex(v, vPos, spVtx); - else - gSPLightVertex(v, spVtx); - - if (gSP.geometryMode & G_ACCLAIM_LIGHTING) - gSPPointLightVertexAcclaim(v, spVtx); - - if ((gSP.geometryMode & G_TEXTURE_GEN) != 0) { - if (GBI.getMicrocodeType() != F3DFLX2) { - for(int i = 0; i < VNUM; ++i) { - SPVertex & vtx = spVtx[v+i]; - f32 vNormale[3] = {vtx.nx, vtx.ny, vtx.nz}; - f32 x, y; - if (gSP.lookatEnable) { - x = DotProduct(gSP.lookat.i_xyz[0], vNormale); - y = DotProduct(gSP.lookat.i_xyz[1], vNormale); - } else { - vNormale[0] *= 128.0f; - vNormale[1] *= 128.0f; - vNormale[2] *= 128.0f; - TransformVectorNormalize(vNormale, gSP.matrix.modelView[gSP.matrix.modelViewi]); - x = vNormale[0]; - y = vNormale[1]; - } - if (gSP.geometryMode & G_TEXTURE_GEN_LINEAR) { - if (x < -1.0f) x = -1.0f; - if (x > 1.0f) x = 1.0f; - if (y < -1.0f) y = -1.0f; - if (y > 1.0f) y = 1.0f; - vtx.s = acosf(-x) * 325.94931f; - vtx.t = acosf(-y) * 325.94931f; - } else { - vtx.s = (x + 1.0f) * 512.0f; - vtx.t = (y + 1.0f) * 512.0f; - } - } - } else { - for(int i = 0; i < VNUM; ++i) { - SPVertex & vtx = spVtx[v+i]; - const f32 intensity = DotProduct(gSP.lookat.i_xyz[0], &vtx.nx) * 128.0f; - const s16 index = static_cast(intensity); - vtx.a = _FIXED2FLOATCOLOR(RDRAM[(gSP.DMAIO_address + 128 + index) ^ 3], 8); - } - } - } - } else if (gSP.geometryMode & G_ACCLAIM_LIGHTING) { - gSPPointLightVertexAcclaim(v, spVtx); - } else { - for(u32 i = 0; i < VNUM; ++i) - spVtx[v].HWLight = 0; - } - - for(u32 i = 0; i < VNUM; ++i) { - SPVertex & vtx = spVtx[v+i]; - DebugMsg(DEBUG_DETAIL, "v%d - x: %f, y: %f, z: %f, w: %f, s: %f, t: %f, r=%02f, g=%02f, b=%02f, a=%02f\n", - i, vtx.x, vtx.y, vtx.z, vtx.w, vtx.s, vtx.t, vtx.r, vtx.g, vtx.b, vtx.a); - } -} - -template -u32 gSPLoadVertexData(const Vertex *orgVtx, SPVertex * spVtx, u32 v0, u32 vi, u32 n) -{ - const u32 end = n - (n%VNUM) + v0; - for (; vi < end; vi += VNUM) { - for(u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.x = orgVtx->x; - vtx.y = orgVtx->y; - vtx.z = orgVtx->z; - //vtx.flag = vertex->flag; - vtx.s = _FIXED2FLOAT( orgVtx->s, 5 ); - vtx.t = _FIXED2FLOAT( orgVtx->t, 5 ); - - if (gSP.geometryMode & G_LIGHTING) { - vtx.nx = _FIXED2FLOATCOLOR(orgVtx->normal.x, 7); - vtx.ny = _FIXED2FLOATCOLOR(orgVtx->normal.y, 7); - vtx.nz = _FIXED2FLOATCOLOR(orgVtx->normal.z, 7); - if (isHWLightingAllowed()) { - vtx.r = orgVtx->normal.x; - vtx.g = orgVtx->normal.y; - vtx.b = orgVtx->normal.z; - } - } else { - vtx.r = _FIXED2FLOATCOLOR(orgVtx->color.r, 8); - vtx.g = _FIXED2FLOATCOLOR(orgVtx->color.g, 8); - vtx.b = _FIXED2FLOATCOLOR(orgVtx->color.b, 8); - } - vtx.a = _FIXED2FLOATCOLOR(orgVtx->color.a, 8); - - ++orgVtx; - } - gSPProcessVertex(vi, spVtx); - } - return vi; -} - -void gSPVertex(u32 a, u32 n, u32 v0) -{ - DebugMsg(DEBUG_NORMAL, "gSPVertex n = %i, v0 = %i, from %08x\n", n, v0, a); - - if ((n + v0) > INDEXMAP_SIZE) { - LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i", v0, n); - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n); - return; - } - - const u32 address = RSP_SegmentToPhysical(a); - - if ((address + sizeof(Vertex)* n) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "gSPVertex Using Vertex outside RDRAM n = %i, v0 = %i, from %08x\n", n, v0, a); - return; - } - - if ((gSP.geometryMode & G_LIGHTING) != 0) { - - if ((gSP.changed & CHANGED_LIGHT) != 0) - gSPUpdateLightVectors(); - - if (((gSP.geometryMode & G_TEXTURE_GEN) != 0) && ((gSP.changed & CHANGED_LOOKAT) != 0)) - gSPUpdateLookatVectors(); - } - - const Vertex *vertex = (Vertex*)&RDRAM[address]; - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - u32 i = gSPLoadVertexData(vertex, spVtx, v0, v0, n); - if (i < n + v0) - gSPLoadVertexData<1>(vertex + (i - v0), spVtx, v0, i, n); -} - -template -u32 gSPLoadCIVertexData(const PDVertex *orgVtx, SPVertex * spVtx, u32 v0, u32 vi, u32 n) -{ - const u32 end = n - (n%VNUM) + v0; - for (; vi < end; vi += VNUM) { - for(u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.x = orgVtx->x; - vtx.y = orgVtx->y; - vtx.z = orgVtx->z; - vtx.s = _FIXED2FLOAT( orgVtx->s, 5 ); - vtx.t = _FIXED2FLOAT( orgVtx->t, 5 ); - u8 *color = &RDRAM[gSP.vertexColorBase + (orgVtx->ci & 0xff)]; - - if (gSP.geometryMode & G_LIGHTING) { - vtx.nx = _FIXED2FLOATCOLOR((s8)color[3], 7); - vtx.ny = _FIXED2FLOATCOLOR((s8)color[2], 7); - vtx.nz = _FIXED2FLOATCOLOR((s8)color[1], 7); - if (isHWLightingAllowed()) { - vtx.r = (s8)color[3]; - vtx.g = (s8)color[2]; - vtx.b = (s8)color[1]; - } - } else { - vtx.r = _FIXED2FLOATCOLOR(color[3], 8); - vtx.g = _FIXED2FLOATCOLOR(color[2], 8); - vtx.b = _FIXED2FLOATCOLOR(color[1], 8); - } - vtx.a = _FIXED2FLOATCOLOR(color[0], 8); - - ++orgVtx; - } - gSPProcessVertex(vi, spVtx); - } - return vi; -} - -void gSPCIVertex( u32 a, u32 n, u32 v0 ) -{ - DebugMsg(DEBUG_NORMAL, "gSPCIVertex n = %i, v0 = %i, from %08x\n", n, v0, a); - - if ((n + v0) > INDEXMAP_SIZE) { - LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i", v0, n); - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n); - return; - } - - const u32 address = RSP_SegmentToPhysical( a ); - - if ((address + sizeof( PDVertex ) * n) > RDRAMSize) - return; - - if ((gSP.geometryMode & G_LIGHTING) != 0) { - - if ((gSP.changed & CHANGED_LIGHT) != 0) - gSPUpdateLightVectors(); - - if (((gSP.geometryMode & G_TEXTURE_GEN) != 0) && ((gSP.changed & CHANGED_LOOKAT) != 0)) - gSPUpdateLookatVectors(); - } - - const PDVertex *vertex = (PDVertex*)&RDRAM[address]; - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - u32 i = gSPLoadCIVertexData(vertex, spVtx, v0, v0, n); - if (i < n + v0) - gSPLoadCIVertexData<1>(vertex + (i - v0), spVtx, v0, i, n); -} - - -template -u32 gSPLoadDMAVertexData(u32 address, SPVertex * spVtx, u32 v0, u32 vi, u32 n) -{ - const u32 end = n - (n%VNUM) + v0; - for (; vi < end; vi += VNUM) { - for(u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.x = *(s16*)&RDRAM[address ^ 2]; - vtx.y = *(s16*)&RDRAM[(address + 2) ^ 2]; - vtx.z = *(s16*)&RDRAM[(address + 4) ^ 2]; - - vtx.r = _FIXED2FLOATCOLOR((*(u8*)&RDRAM[(address + 6) ^ 3]), 8); - vtx.g = _FIXED2FLOATCOLOR((*(u8*)&RDRAM[(address + 7) ^ 3]), 8); - vtx.b = _FIXED2FLOATCOLOR((*(u8*)&RDRAM[(address + 8) ^ 3]), 8); - vtx.a = _FIXED2FLOATCOLOR((*(u8*)&RDRAM[(address + 9) ^ 3]), 8); - - address += 10; - } - gSPProcessVertex(vi, spVtx); - } - return vi; -} - -void gSPDMAVertex( u32 a, u32 n, u32 v0 ) -{ - DebugMsg(DEBUG_NORMAL, "gSPDMAVertex n = %i, v0 = %i, from %08x\n", n, v0, a); - - if ((n + v0) > INDEXMAP_SIZE) { - LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i", v0, n); - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n); - return; - } - - const u32 address = gSP.DMAOffsets.vtx + RSP_SegmentToPhysical(a); - - if ((address + 10 * n) > RDRAMSize) - return; - - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - u32 i = gSPLoadDMAVertexData(address, spVtx, v0, v0, n); - if (i < n + v0) - gSPLoadDMAVertexData<1>(address + (i - v0) * 10, spVtx, v0, i, n); -} - -template -u32 gSPLoadCBFDVertexData(const Vertex *orgVtx, SPVertex * spVtx, u32 v0, u32 vi, u32 n) -{ - const u32 end = n - (n%VNUM) + v0; - for (; vi < end; vi += VNUM) { - for(u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.x = orgVtx->x; - vtx.y = orgVtx->y; - vtx.z = orgVtx->z; - vtx.s = _FIXED2FLOAT( orgVtx->s, 5 ); - vtx.t = _FIXED2FLOAT( orgVtx->t, 5 ); - vtx.flag = orgVtx->flag; - if (gSP.geometryMode & G_LIGHTING) { - const u32 normaleAddrOffset = ((vi+j)<<1); - vtx.nx = _FIXED2FLOATCOLOR(((s8*)RDRAM)[(gSP.cbfd.vertexNormalBase + normaleAddrOffset + 0) ^ 3], 7); - vtx.ny = _FIXED2FLOATCOLOR(((s8*)RDRAM)[(gSP.cbfd.vertexNormalBase + normaleAddrOffset + 1) ^ 3], 7); - vtx.nz = _FIXED2FLOATCOLOR((s8)(orgVtx->flag & 0xFF), 7); - } - vtx.r = _FIXED2FLOATCOLOR(orgVtx->color.r, 8); - vtx.g = _FIXED2FLOATCOLOR(orgVtx->color.g, 8); - vtx.b = _FIXED2FLOATCOLOR(orgVtx->color.b, 8); - vtx.a = _FIXED2FLOATCOLOR(orgVtx->color.a, 8); - ++orgVtx; - } - gSPProcessVertex(vi, spVtx); - } - return vi; -} - -void gSPCBFDVertex( u32 a, u32 n, u32 v0 ) -{ - DebugMsg(DEBUG_NORMAL, "gSPCBFDVertex n = %i, v0 = %i, from %08x\n", n, v0, a); - - if ((n + v0) > INDEXMAP_SIZE) { - LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i", v0, n); - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n); - return; - } - - const u32 address = RSP_SegmentToPhysical(a); - - if ((address + sizeof( Vertex ) * n) > RDRAMSize) - return; - - if ((gSP.geometryMode & G_LIGHTING) != 0) { - - if ((gSP.changed & CHANGED_LIGHT) != 0) - gSPUpdateLightVectors(); - - if (((gSP.geometryMode & G_TEXTURE_GEN) != 0) && ((gSP.changed & CHANGED_LOOKAT) != 0)) - gSPUpdateLookatVectors(); - } - - const Vertex *vertex = (Vertex*)&RDRAM[address]; - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - u32 i = gSPLoadCBFDVertexData(vertex, spVtx, v0, v0, n); - if (i < n + v0) - gSPLoadCBFDVertexData<1>(vertex + (i - v0), spVtx, v0, i, n); -} - -static -void calcF3DAMTexCoords(const Vertex * _vertex, SPVertex & _vtx) -{ - const u32 s0 = (u32)_vertex->s; - const u32 t0 = (u32)_vertex->t; - const u32 acum_0 = ((_SHIFTR(gSP.textureCoordScaleOrg, 0, 16) * t0) << 1) + 0x8000; - const u32 acum_1 = ((_SHIFTR(gSP.textureCoordScale[1], 0, 16) * t0) << 1) + 0x8000; - const u32 sres = ((_SHIFTR(gSP.textureCoordScaleOrg, 16, 16) * s0) << 1) + acum_0; - const u32 tres = ((_SHIFTR(gSP.textureCoordScale[1], 16, 16) * s0) << 1) + acum_1; - const s16 s = _SHIFTR(sres, 16, 16) + _SHIFTR(gSP.textureCoordScale[0], 16, 16); - const s16 t = _SHIFTR(tres, 16, 16) + _SHIFTR(gSP.textureCoordScale[0], 0, 16); - - _vtx.s = _FIXED2FLOAT( s, 5 ); - _vtx.t = _FIXED2FLOAT( t, 5 ); -} - -template -u32 gSPLoadF3DAMVertexData(const Vertex *orgVtx, SPVertex * spVtx, u32 v0, u32 vi, u32 n) -{ - const u32 end = n - (n%VNUM) + v0; - for (; vi < end; vi += VNUM) { - for(u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.x = orgVtx->x; - vtx.y = orgVtx->y; - vtx.z = orgVtx->z; - //vtx.flag = orgVtx->flag; - calcF3DAMTexCoords(orgVtx, vtx); - if (gSP.geometryMode & G_LIGHTING) { - vtx.nx = _FIXED2FLOATCOLOR( orgVtx->normal.x, 7 ); - vtx.ny = _FIXED2FLOATCOLOR( orgVtx->normal.y, 7 ); - vtx.nz = _FIXED2FLOATCOLOR( orgVtx->normal.z, 7 ); - vtx.a = _FIXED2FLOATCOLOR(orgVtx->color.a,8); - } else { - vtx.r = _FIXED2FLOATCOLOR(orgVtx->color.r,8); - vtx.g = _FIXED2FLOATCOLOR(orgVtx->color.g,8); - vtx.b = _FIXED2FLOATCOLOR(orgVtx->color.b,8); - vtx.a = _FIXED2FLOATCOLOR(orgVtx->color.a,8); - } - ++orgVtx; - } - gSPProcessVertex(vi, spVtx); - } - return vi; -} - -void gSPF3DAMVertex(u32 a, u32 n, u32 v0) -{ - DebugMsg(DEBUG_NORMAL, "gSPF3DAMVertex n = %i, v0 = %i, from %08x\n", n, v0, a); - - if ((n + v0) > INDEXMAP_SIZE) { - LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i", v0, n); - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n); - return; - } - - const u32 address = RSP_SegmentToPhysical(a); - - if ((address + sizeof(Vertex)* n) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "gSPF3DAMVertex Using Vertex outside RDRAM n = %i, v0 = %i, from %08x\n", n, v0, a); - return; - } - - if ((gSP.geometryMode & G_LIGHTING) != 0) { - - if ((gSP.changed & CHANGED_LIGHT) != 0) - gSPUpdateLightVectors(); - - if (((gSP.geometryMode & G_TEXTURE_GEN) != 0) && ((gSP.changed & CHANGED_LOOKAT) != 0)) - gSPUpdateLookatVectors(); - } - - const Vertex *vertex = (Vertex*)&RDRAM[address]; - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - u32 i = gSPLoadF3DAMVertexData(vertex, spVtx, v0, v0, n); - if (i < n + v0) - gSPLoadF3DAMVertexData<1>(vertex + (i - v0), spVtx, v0, i, n); -} - -template -u32 gSPLoadSWVertexData(const SWVertex *orgVtx, SPVertex * spVtx, u32 vi, u32 n) -{ - const u32 end = n - (n%VNUM); - for (; vi < end; vi += VNUM) { - for(u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.x = orgVtx->x; - vtx.y = orgVtx->y; - vtx.z = orgVtx->z; - ++orgVtx; - } - gSPProcessVertex(vi, spVtx); - for (u32 j = 0; j < VNUM; ++j) { - SPVertex & vtx = spVtx[vi+j]; - vtx.y = -vtx.y; - } - } - return vi; -} - -void gSPSWVertex(const SWVertex * vertex, u32 n, const bool * const verticesToProcess) -{ - DebugMsg(DEBUG_NORMAL, "gSPSWVertex n = %i\n", n); - - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - if (verticesToProcess == nullptr) { - u32 i = gSPLoadSWVertexData(vertex, spVtx, 0, n); - if (i < n) - gSPLoadSWVertexData<1>(vertex + i, spVtx, i, n); - } else { - for (u32 i = 0; i < n; ++i) { - if (verticesToProcess[i]) - gSPLoadSWVertexData<1>(vertex + i, spVtx, i, i + 1); - } - } -} - -void gSPSWVertex(const SWVertex * vertex, u32 v0, u32 n) -{ - DebugMsg(DEBUG_NORMAL, "gSPSWVertex v0 = %i, n = %i\n", v0, n); - - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - const u32 endIdx = v0 + n; - u32 i = gSPLoadSWVertexData(vertex, spVtx, v0, endIdx); - if (i < endIdx) - gSPLoadSWVertexData<1>(vertex + i - v0, spVtx, i, endIdx); -} - -void gSPT3DUXVertex(u32 a, u32 n, u32 ci) -{ - const u32 address = RSP_SegmentToPhysical(a); - const u32 colors = RSP_SegmentToPhysical(ci); - - struct T3DUXVertex { - s16 y; - s16 x; - u16 flag; - s16 z; - } *vertex = (T3DUXVertex*)&RDRAM[address]; - - struct T3DUXColor - { - u8 a; - u8 b; - u8 g; - u8 r; - } *color = (T3DUXColor*)&RDRAM[colors]; - - if ((address + sizeof(T3DUXVertex)* n) > RDRAMSize) - return; - - SPVertex * spVtx = dwnd().getDrawer().getVertexPtr(0); - u32 i = 0; -#ifdef __VEC4_OPT - for (; i < n - (n % 4); i += 4) { - u32 v = i; - for (int j = 0; j < 4; ++j) { - SPVertex & vtx = spVtx[v+j]; - vtx.x = vertex->x; - vtx.y = vertex->y; - vtx.z = vertex->z; - vtx.s = 0; - vtx.t = 0; - vtx.r = _FIXED2FLOATCOLOR(color->r, 8); - vtx.g = _FIXED2FLOATCOLOR(color->g, 8); - vtx.b = _FIXED2FLOATCOLOR(color->b, 8); - vtx.a = _FIXED2FLOATCOLOR(color->a, 8); - vertex++; - color++; - } - gSPProcessVertex<4>(v, spVtx); - } -#endif - for (; i < n; ++i) { - SPVertex & vtx = spVtx[i]; - vtx.x = vertex->x; - vtx.y = vertex->y; - vtx.z = vertex->z; - vtx.s = 0; - vtx.t = 0; - vtx.r = _FIXED2FLOATCOLOR(color->r, 8); - vtx.g = _FIXED2FLOATCOLOR(color->g, 8); - vtx.b = _FIXED2FLOATCOLOR(color->b, 8); - vtx.a = _FIXED2FLOATCOLOR(color->a, 8); - gSPProcessVertex<1>(i, spVtx); - vertex++; - color++; - } -} - -void gSPDisplayList( u32 dl ) -{ - u32 address = RSP_SegmentToPhysical( dl ); - - if ((address + 8) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load display list from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPDisplayList( 0x%08X );\n", dl ); - return; - } - - if (RSP.PCi < (GBI.PCStackSize - 1)) { - DebugMsg(DEBUG_NORMAL, "gSPDisplayList( 0x%08X ) push\n", dl); - RSP.PCi++; - RSP.PC[RSP.PCi] = address; - RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[address], 24, 8 ); - } else { - assert(false); - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// PC stack overflow\n"); - DebugMsg(DEBUG_NORMAL, "gSPDisplayList( 0x%08X );\n", dl ); - } -} - -void gSPBranchList( u32 dl ) -{ - u32 address = RSP_SegmentToPhysical( dl ); - - if ((address + 8) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to branch to display list at invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPBranchList( 0x%08X );\n", dl ); - return; - } - - DebugMsg(DEBUG_NORMAL, "gSPBranchList( 0x%08X ) nopush\n", dl ); - - if (address == (RSP.PC[RSP.PCi] - 8)) { - RSP.infloop = true; - RSP.PC[RSP.PCi] -= 8; - RSP.halt = true; - return; - } - - RSP.PC[RSP.PCi] = address; - RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[address], 24, 8 ); -} - -void gSPBranchLessZ(u32 branchdl, u32 vtx, u32 zval) -{ - const u32 address = RSP_SegmentToPhysical( branchdl ); - - if ((address + 8) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Specified display list at invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPBranchLessZ( 0x%08X, %i, %i );\n", branchdl, vtx, zval ); - return; - } - - SPVertex & v = dwnd().getDrawer().getVertex(vtx); - const u32 zTest = u32((v.z / v.w) * 1023.0f); - if (zTest > 0x03FF || zTest <= zval) - RSP.PC[RSP.PCi] = address; - - DebugMsg(DEBUG_NORMAL, "gSPBranchLessZ( 0x%08X, %i, %i );\n", branchdl, vtx, zval ); -} - -void gSPBranchLessW( u32 branchdl, u32 vtx, u32 wval ) -{ - const u32 address = RSP_SegmentToPhysical( branchdl ); - - if ((address + 8) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Specified display list at invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPBranchLessW( 0x%08X, %i, %i );\n", branchdl, vtx, wval); - return; - } - - SPVertex & v = dwnd().getDrawer().getVertex(vtx); - if (v.w < (float)wval) - RSP.PC[RSP.PCi] = address; - - DebugMsg(DEBUG_NORMAL, "gSPBranchLessZ( 0x%08X, %i, %i );\n", branchdl, vtx, wval); -} - -void gSPDlistCount(u32 count, u32 v) -{ - u32 address = RSP_SegmentToPhysical( v ); - if (address == 0 || (address + 8) > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to branch to display list at invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPDlistCnt(%d, 0x%08X );\n", count, v); - return; - } - - if (RSP.PCi >= 9) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// ** DL stack overflow **\n"); - DebugMsg(DEBUG_NORMAL, "gSPDlistCnt(%d, 0x%08X );\n", count, v); - return; - } - - DebugMsg(DEBUG_NORMAL, "gSPDlistCnt(%d, 0x%08X );\n", count, v); - - ++RSP.PCi; // go to the next PC in the stack - RSP.PC[RSP.PCi] = address; // jump to the address - RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[address], 24, 8 ); - RSP.count = count + 1; -} - -void gSPSetDMAOffsets( u32 mtxoffset, u32 vtxoffset ) -{ - gSP.DMAOffsets.mtx = mtxoffset; - gSP.DMAOffsets.vtx = vtxoffset; - - DebugMsg(DEBUG_NORMAL, "gSPSetDMAOffsets( 0x%08X, 0x%08X );\n", mtxoffset, vtxoffset ); -} - -void gSPSetDMATexOffset(u32 _addr) -{ - gSP.DMAOffsets.tex_offset = RSP_SegmentToPhysical(_addr); - gSP.DMAOffsets.tex_shift = 0; - gSP.DMAOffsets.tex_count = 0; -} - -void gSPSetVertexColorBase( u32 base ) -{ - gSP.vertexColorBase = RSP_SegmentToPhysical( base ); - - DebugMsg(DEBUG_NORMAL, "gSPSetVertexColorBase( 0x%08X );\n", base ); -} - -void gSPDMATriangles( u32 tris, u32 n ){ - const u32 address = RSP_SegmentToPhysical( tris ); - - if (address + sizeof( DKRTriangle ) * n > RDRAMSize) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load triangles from invalid address\n"); - DebugMsg(DEBUG_NORMAL, "gSPDMATriangles( 0x%08X, %i );\n"); - return; - } - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(n * 3); - - DKRTriangle *triangles = (DKRTriangle*)&RDRAM[address]; - SPVertex * pVtx = drawer.getDMAVerticesData(); - for (u32 i = 0; i < n; ++i) { - int mode = 0; - if (!(triangles->flag & 0x40)) { - if (gSP.viewport.vscale[0] > 0) - mode |= G_CULL_BACK; - else - mode |= G_CULL_FRONT; - } - if ((gSP.geometryMode&G_CULL_BOTH) != mode) { - drawer.drawDMATriangles(static_cast(pVtx - drawer.getDMAVerticesData())); - pVtx = drawer.getDMAVerticesData(); - gSP.geometryMode &= ~G_CULL_BOTH; - gSP.geometryMode |= mode; - gSP.changed |= CHANGED_GEOMETRYMODE; - } - - const s32 v0 = triangles->v0; - const s32 v1 = triangles->v1; - const s32 v2 = triangles->v2; - if (drawer.isClipped(v0, v1, v2)) { - ++triangles; - continue; - } - *pVtx = drawer.getVertex(v0); - pVtx->s = _FIXED2FLOAT(triangles->s0, 5); - pVtx->t = _FIXED2FLOAT(triangles->t0, 5); - ++pVtx; - *pVtx = drawer.getVertex(v1); - pVtx->s = _FIXED2FLOAT(triangles->s1, 5); - pVtx->t = _FIXED2FLOAT(triangles->t1, 5); - ++pVtx; - *pVtx = drawer.getVertex(v2); - pVtx->s = _FIXED2FLOAT(triangles->s2, 5); - pVtx->t = _FIXED2FLOAT(triangles->t2, 5); - ++pVtx; - ++triangles; - } - DebugMsg(DEBUG_NORMAL, "gSPDMATriangles( 0x%08X, %i );\n"); - drawer.drawDMATriangles(static_cast(pVtx - drawer.getDMAVerticesData())); -} - -void gSP1Quadrangle( s32 v0, s32 v1, s32 v2, s32 v3 ) -{ - gSPTriangle( v0, v1, v2); - gSPTriangle( v0, v2, v3); - gSPFlushTriangles(); - - DebugMsg(DEBUG_NORMAL, "gSP1Quadrangle( %i, %i, %i, %i );\n", v0, v1, v2, v3 ); -} - -bool gSPCullVertices( u32 v0, u32 vn ) -{ - if (vn < v0) { - // Aidyn Chronicles - The First Mage seems to pass parameters in reverse order. - const u32 v = v0; - v0 = vn; - vn = v; - } - u32 clip = 0; - GraphicsDrawer & drawer = dwnd().getDrawer(); - for (u32 i = v0; i <= vn; ++i) { - clip |= (~drawer.getVertex(i).clip) & CLIP_ALL; - if (clip == CLIP_ALL) - return false; - } - return true; -} - -void gSPCullDisplayList( u32 v0, u32 vn ) -{ - if (gSPCullVertices( v0, vn )) { - if (RSP.PCi > 0) - RSP.PCi--; - else { - DebugMsg(DEBUG_NORMAL, "End of display list, halting execution\n"); - RSP.halt = true; - } - DebugMsg( DEBUG_DETAIL, "// Culling display list\n" ); - DebugMsg(DEBUG_NORMAL, "gSPCullDisplayList( %i, %i );\n\n", v0, vn ); - } else { - DebugMsg( DEBUG_DETAIL, "// Not culling display list\n" ); - DebugMsg(DEBUG_NORMAL, "gSPCullDisplayList( %i, %i );\n", v0, vn); - } -} - -void gSPPopMatrixN(u32 param, u32 num) -{ - if (gSP.matrix.modelViewi > num - 1) { - gSP.matrix.modelViewi -= num; - gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT; - } else { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to pop matrix stack below 0\n"); - } - DebugMsg(DEBUG_NORMAL, "gSPPopMatrixN( %s, %i );\n", - (param == G_MTX_MODELVIEW) ? "G_MTX_MODELVIEW" : - (param == G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_INVALID", num ); -} - -void gSPPopMatrix( u32 param ) -{ - switch (param) { - case 0: // modelview - if (gSP.matrix.modelViewi > 0) { - gSP.matrix.modelViewi--; - - gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT; - } - break; - case 1: // projection, can't - break; - default: - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to pop matrix stack below 0\n"); - } - DebugMsg(DEBUG_NORMAL, "gSPPopMatrix( %s );\n", - (param == G_MTX_MODELVIEW) ? "G_MTX_MODELVIEW" : - (param == G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_INVALID"); -} - -void gSPSegment( s32 seg, s32 base ) -{ - gSP.segment[seg] = base; - - DebugMsg(DEBUG_NORMAL, "gSPSegment( %s, 0x%08X );\n", SegmentText[seg], base ); -} - -void gSPClipRatio(u32 ratio) -{ - gSP.clipRatio = std::abs(static_cast(ratio & 0xFFFF)); - gSP.changed |= CHANGED_VIEWPORT; - DebugMsg(DEBUG_NORMAL, "gSPClipRatio(%u);\n", gSP.clipRatio); -} - -void gSPInsertMatrix( u32 where, u32 num ) -{ - DebugMsg(DEBUG_NORMAL, "gSPInsertMatrix(%u, %u);\n", where, num); - - if ((where & 0x3) != 0) - return; - - f32 * pMtx = nullptr; - u16 addr = (where + 0x80) & 0xFFFF; - if (addr < 0x40) { - pMtx = reinterpret_cast(gSP.matrix.modelView[gSP.matrix.modelViewi]); - } else if (addr < 0x80) { - pMtx = reinterpret_cast(gSP.matrix.projection); - addr -= 0x40; - } else if (addr < 0xC0) { - pMtx = reinterpret_cast(gSP.matrix.combined); - addr -= 0x80; - } else - return; - - const u16 * pData = reinterpret_cast(&num); - const u32 index = (addr < 0x20) ? (addr >> 1) : ((addr - 0x20) >> 1); - for (u32 i = 0; i < 2; i++) { - if (addr < 0x20) { - // integer elements of the matrix to be changed - const s16 integer = static_cast(pData[i ^ 1]); - const u16 fract = GetIntMatrixElement(pMtx[index + i]).second; - pMtx[index + i] = GetFloatMatrixElement(integer, fract); - } else { - // fractional elements of the matrix to be changed - const s16 integer = GetIntMatrixElement(pMtx[index + i]).first; - const u16 fract = pData[i ^ 1]; - pMtx[index + i] = GetFloatMatrixElement(integer, fract); - } - } -} - -void gSPModifyVertex( u32 _vtx, u32 _where, u32 _val ) -{ - GraphicsDrawer & drawer = dwnd().getDrawer(); - - SPVertex & vtx0 = drawer.getVertex(_vtx); - switch (_where) { - case G_MWO_POINT_RGBA: - vtx0.r = _FIXED2FLOATCOLOR(_SHIFTR( _val, 24, 8 ),8); - vtx0.g = _FIXED2FLOATCOLOR(_SHIFTR( _val, 16, 8 ),8); - vtx0.b = _FIXED2FLOATCOLOR(_SHIFTR( _val, 8, 8 ),8); - vtx0.a = _FIXED2FLOATCOLOR(_SHIFTR( _val, 0, 8 ),8); - vtx0.modify |= MODIFY_RGBA; - DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: RGBA(%02f, %02f, %02f, %02f);\n", vtx0.r, vtx0.g, vtx0.b, vtx0.a); - break; - case G_MWO_POINT_ST: - vtx0.s = _FIXED2FLOAT( (s16)_SHIFTR( _val, 16, 16 ), 5 ) / gSP.texture.scales; - vtx0.t = _FIXED2FLOAT((s16)_SHIFTR(_val, 0, 16), 5) / gSP.texture.scalet; - //vtx0.modify |= MODIFY_ST; // still neeed to divide by 2 in vertex shader if TexturePersp disabled - DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: ST(%02f, %02f);\n", vtx0.s, vtx0.t); - break; - case G_MWO_POINT_XYSCREEN: - vtx0.x = _FIXED2FLOAT((s16)_SHIFTR(_val, 16, 16), 2); - vtx0.y = _FIXED2FLOAT((s16)_SHIFTR(_val, 0, 16), 2); - vtx0.modify |= MODIFY_XY; - vtx0.clip &= ~(CLIP_POSX | CLIP_NEGX | CLIP_POSY | CLIP_NEGY); - if ((config.generalEmulation.hacks & hack_ModifyVertexXyInShader) == 0) { - if (dwnd().isAdjustScreen()) { - const f32 adjustScale = dwnd().getAdjustScale(); - const f32 adjustOffset = static_cast(VI.width) * (1.0f - adjustScale) / 2.0f; - vtx0.x *= adjustScale; - vtx0.x += adjustOffset; - if (gSP.matrix.projection[3][2] == -1.f) - vtx0.w *= adjustScale; - } - } else { - if (vtx0.w == 0.0f || gDP.otherMode.depthSource == G_ZS_PRIM) { - vtx0.w = 1.0f; - vtx0.clip &= ~(CLIP_W); - } - } - DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: XY(%02f, %02f);\n", vtx0.x, vtx0.y); - break; - case G_MWO_POINT_ZSCREEN: - { - // All 32 bits of _val are the z value (16.11) - f32 scrZ = float(_val) / 65535.0f / 2048.0f; - DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: iZ(0x%08x) Z(%02f);\n", _val, scrZ); - vtx0.z = scrZ; - vtx0.clip &= ~CLIP_W; - vtx0.modify |= MODIFY_Z; - } - break; - } -} - -void gSPNumLights( s32 n ) -{ - if (n < 12) { - gSP.numLights = n; - gSP.changed |= CHANGED_LIGHT; - } else { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Setting an invalid number of lights\n"); - } - - DebugMsg(DEBUG_NORMAL, "gSPNumLights( %i );\n", n); -} - -void gSPLightColor( u32 lightNum, u32 packedColor ) -{ - --lightNum; - - if (lightNum < 8) - { - gSP.lights.rgb[lightNum][R] = _FIXED2FLOATCOLOR(_SHIFTR( packedColor, 24, 8 ),8); - gSP.lights.rgb[lightNum][G] = _FIXED2FLOATCOLOR(_SHIFTR( packedColor, 16, 8 ),8); - gSP.lights.rgb[lightNum][B] = _FIXED2FLOATCOLOR(_SHIFTR( packedColor, 8, 8 ),8); - gSP.lights.rgb2[lightNum][R] = gSP.lights.rgb[lightNum][R]; - gSP.lights.rgb2[lightNum][G] = gSP.lights.rgb[lightNum][G]; - gSP.lights.rgb2[lightNum][B] = gSP.lights.rgb[lightNum][B]; - gSP.changed |= CHANGED_HW_LIGHT; - } - DebugMsg(DEBUG_NORMAL, "gSPLightColor( %i, 0x%08X );\n", lightNum, packedColor ); -} - -void gSPFogFactor( s16 fm, s16 fo ) -{ - gSP.fog.multiplier = fm; - gSP.fog.offset = fo; - gSP.fog.multiplierf = _FIXED2FLOAT(fm, 8); - gSP.fog.offsetf = _FIXED2FLOAT(fo, 8); - - gSP.changed |= CHANGED_FOGPOSITION; - DebugMsg(DEBUG_NORMAL, "gSPFogFactor( %i, %i );\n", fm, fo); -} - -void gSPPerspNormalize( u16 scale ) -{ - DebugMsg(DEBUG_NORMAL| DEBUG_IGNORED, "gSPPerspNormalize( %i );\n", scale); -} - -void gSPTexture( f32 sc, f32 tc, u32 level, u32 tile, u32 on ) -{ - gSP.texture.on = on; - if (on == 0) { - DebugMsg(DEBUG_NORMAL, "gSPTexture skipped b/c of off\n"); - return; - } - - gSP.texture.scales = sc; - gSP.texture.scalet = tc; - - if (gSP.texture.scales == 0.0f) gSP.texture.scales = 1.0f; - if (gSP.texture.scalet == 0.0f) gSP.texture.scalet = 1.0f; - - gSP.texture.level = level; - - gSP.texture.tile = tile; - gSP.textureTile[0] = &gDP.tiles[tile]; - gSP.textureTile[1] = &gDP.tiles[(tile + 1) & 7]; - - gSP.changed |= CHANGED_TEXTURE; - - DebugMsg(DEBUG_NORMAL, "gSPTexture: tile: %d, mipmap_lvl: %d, on: %d, s_scale: %f, t_scale: %f\n", tile, level, on, sc, tc); -} - -void gSPEndDisplayList() -{ - if (RSP.PCi > 0) - --RSP.PCi; - else { - DebugMsg( DEBUG_NORMAL, "End of display list, halting execution\n" ); - RSP.halt = true; - } - - DebugMsg(DEBUG_NORMAL, "gSPEndDisplayList();\n\n"); -} - -void gSPGeometryMode( u32 clear, u32 set ) -{ - gSP.geometryMode = (gSP.geometryMode & ~clear) | set; - - gSP.changed |= CHANGED_GEOMETRYMODE; - - DebugMsg(DEBUG_NORMAL, "gSPGeometryMode( %s%s%s%s%s%s%s%s%s%s, %s%s%s%s%s%s%s%s%s%s );\n", - clear & G_SHADE ? "G_SHADE | " : "", - clear & G_LIGHTING ? "G_LIGHTING | " : "", - clear & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "", - clear & G_ZBUFFER ? "G_ZBUFFER | " : "", - clear & G_TEXTURE_GEN ? "G_TEXTURE_GEN | " : "", - clear & G_TEXTURE_GEN_LINEAR ? "G_TEXTURE_GEN_LINEAR | " : "", - clear & G_CULL_FRONT ? "G_CULL_FRONT | " : "", - clear & G_CULL_BACK ? "G_CULL_BACK | " : "", - clear & G_FOG ? "G_FOG | " : "", - clear & G_CLIPPING ? "G_CLIPPING" : "", - set & G_SHADE ? "G_SHADE | " : "", - set & G_LIGHTING ? "G_LIGHTING | " : "", - set & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "", - set & G_ZBUFFER ? "G_ZBUFFER | " : "", - set & G_TEXTURE_GEN ? "G_TEXTURE_GEN | " : "", - set & G_TEXTURE_GEN_LINEAR ? "G_TEXTURE_GEN_LINEAR | " : "", - set & G_CULL_FRONT ? "G_CULL_FRONT | " : "", - set & G_CULL_BACK ? "G_CULL_BACK | " : "", - set & G_FOG ? "G_FOG | " : "", - set & G_CLIPPING ? "G_CLIPPING" : "" ); -} - -void gSPSetGeometryMode( u32 mode ) -{ - gSP.geometryMode |= mode; - - gSP.changed |= CHANGED_GEOMETRYMODE; - - DebugMsg(DEBUG_NORMAL, "gSPSetGeometryMode( %s%s%s%s%s%s%s%s%s%s );\n", - mode & G_SHADE ? "G_SHADE | " : "", - mode & G_LIGHTING ? "G_LIGHTING | " : "", - mode & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "", - mode & G_ZBUFFER ? "G_ZBUFFER | " : "", - mode & G_TEXTURE_GEN ? "G_TEXTURE_GEN | " : "", - mode & G_TEXTURE_GEN_LINEAR ? "G_TEXTURE_GEN_LINEAR | " : "", - mode & G_CULL_FRONT ? "G_CULL_FRONT | " : "", - mode & G_CULL_BACK ? "G_CULL_BACK | " : "", - mode & G_FOG ? "G_FOG | " : "", - mode & G_CLIPPING ? "G_CLIPPING" : "" ); -} - -void gSPClearGeometryMode( u32 mode ) -{ - gSP.geometryMode &= ~mode; - - gSP.changed |= CHANGED_GEOMETRYMODE; - - DebugMsg(DEBUG_NORMAL, "gSPClearGeometryMode( %s%s%s%s%s%s%s%s%s%s );\n", - mode & G_SHADE ? "G_SHADE | " : "", - mode & G_LIGHTING ? "G_LIGHTING | " : "", - mode & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "", - mode & G_ZBUFFER ? "G_ZBUFFER | " : "", - mode & G_TEXTURE_GEN ? "G_TEXTURE_GEN | " : "", - mode & G_TEXTURE_GEN_LINEAR ? "G_TEXTURE_GEN_LINEAR | " : "", - mode & G_CULL_FRONT ? "G_CULL_FRONT | " : "", - mode & G_CULL_BACK ? "G_CULL_BACK | " : "", - mode & G_FOG ? "G_FOG | " : "", - mode & G_CLIPPING ? "G_CLIPPING" : "" ); -} - -void gSPSetOtherMode_H(u32 _length, u32 _shift, u32 _data) -{ - const u32 mask = (((u64)1 << _length) - 1) << _shift; - gDP.otherMode.h = (gDP.otherMode.h&(~mask)) | _data; - - if (mask & 0x00300000) // cycle type - gDP.changed |= CHANGED_CYCLETYPE; - - DebugMsg(DEBUG_NORMAL, "gSPSetOtherMode_H"); -#ifdef DEBUG_DUMP - std::string strRes; - if (mask & 0x00000030) { - strRes.append(AlphaDitherText[(gDP.otherMode.h>>4) & 3]); - strRes.append(" | "); - } - - if (mask & 0x000000C0) { - strRes.append(ColorDitherText[(gDP.otherMode.h >> 6) & 3]); - strRes.append(" | "); - } - - if (mask & 0x00003000) { - strRes.append(TextureFilterText[(gDP.otherMode.h & 0x00003000) >> 12]); - strRes.append(" | "); - } - - if (mask & 0x0000C000) { - strRes.append(TextureLUTText[(gDP.otherMode.h & 0x0000C000) >> 14]); - strRes.append(" | "); - } - - if (mask & 0x00300000) { - strRes.append(CycleTypeText[(gDP.otherMode.h & 0x00300000) >> 20]); - strRes.append(" | "); - } - - if (mask & 0x00010000) { - strRes.append("LOD_en : "); - strRes.append((gDP.otherMode.h & 0x00010000) ? "yes | " : "no | "); - } - - if (mask & 0x00080000) { - strRes.append("Persp_en : "); - strRes.append((gDP.otherMode.h & 0x00080000) ? "yes" : "no"); - } - - DebugMsg(DEBUG_NORMAL, "( %s)", strRes.c_str()); -#endif - DebugMsg(DEBUG_NORMAL, " result: %08x\n", gDP.otherMode.h); -} - -void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data) -{ - const u32 mask = (((u64)1 << _length) - 1) << _shift; - gDP.otherMode.l = (gDP.otherMode.l&(~mask)) | _data; - - if (mask & 0x00000003) // alpha compare - gDP.changed |= CHANGED_ALPHACOMPARE; - - if (mask & 0xFFFFFFF8) // rendermode / blender bits - gDP.changed |= CHANGED_RENDERMODE; - - DebugMsg(DEBUG_NORMAL, "gSPSetOtherMode_L"); -#ifdef DEBUG_DUMP - std::string strRes; - - if (mask & 0x00000003) { - strRes.append(AlphaCompareText[gDP.otherMode.l & 0x00000003]); - strRes.append(" | "); - } - - if (mask & 0x00000004) { - strRes.append(DepthSourceText[(gDP.otherMode.l & 0x00000004) >> 2]); - strRes.append(" | "); - } - - if (mask & 0xFFFFFFF8) { // rendermode / blender bits - strRes.append(" rendermode"); - } - - DebugMsg(DEBUG_NORMAL, "( %s)", strRes.c_str()); -#endif - DebugMsg(DEBUG_NORMAL, " result: %08x\n", gDP.otherMode.l); -} - -void gSPLine3D(u32 v0, u32 v1, u32 flag ) -{ - dwnd().getDrawer().drawLine(v0, v1, 1.5f); - - DebugMsg(DEBUG_NORMAL, "gSPLine3D( %i, %i, %i )\n", v0, v1, flag); -} - -void gSPLineW3D(u32 v0, u32 v1, u32 wd, u32 flag ) -{ - dwnd().getDrawer().drawLine(v0, v1, 1.5f + wd * 0.5f); - - DebugMsg(DEBUG_NORMAL, "gSPLineW3D( %i, %i, %i, %i )\n", v0, v1, wd, flag); -} - -void gSPSetStatus(u32 sid, u32 val) -{ - assert(sid <= 12); - gSP.status[sid>>2] = val; - - DebugMsg(DEBUG_NORMAL, "gSPSetStatus sid=%u val=%u\n", sid, val); -} - -struct uSprite { - u32 imagePtr; - u32 tlutPtr; - s16 imageW; - s16 stride; - s8 imageSiz; - s8 imageFmt; - s16 imageH; - s16 imageY; - s16 imageX; - s8 dummy[4]; -}; /* 24 bytes */ - -static -void _loadSpriteImage(const uSprite *_pSprite) -{ - gSP.bgImage.address = RSP_SegmentToPhysical( _pSprite->imagePtr ); - - gSP.bgImage.width = _pSprite->stride; - gSP.bgImage.height = _pSprite->imageY + _pSprite->imageH; - gSP.bgImage.format = _pSprite->imageFmt; - gSP.bgImage.size = _pSprite->imageSiz; - gSP.bgImage.palette = 0; - gDP.tiles[0].textureMode = TEXTUREMODE_BGIMAGE; - gSP.bgImage.imageX = _pSprite->imageX; - gSP.bgImage.imageY = _pSprite->imageY; - gSP.bgImage.scaleW = gSP.bgImage.scaleH = 1.0f; - - if (config.frameBufferEmulation.enable != 0) - { - FrameBuffer *pBuffer = frameBufferList().findBuffer(gSP.bgImage.address); - if (pBuffer != nullptr) { - if (pBuffer->m_cfb) { - frameBufferList().removeBuffer(pBuffer->m_startAddress); - return; - } - gDP.tiles[0].frameBufferAddress = pBuffer->m_startAddress; - gDP.tiles[0].textureMode = TEXTUREMODE_FRAMEBUFFER_BG; - gDP.tiles[0].loadType = LOADTYPE_TILE; - gDP.changed |= CHANGED_TMEM; - } - } -} - -void gSPSprite2DBase(u32 _base) -{ - DebugMsg(DEBUG_NORMAL, "gSPSprite2DBase\n"); - assert(RSP.nextCmd == 0xBE); - const u32 address = RSP_SegmentToPhysical( _base ); - uSprite *pSprite = (uSprite*)&RDRAM[address]; - - if (pSprite->tlutPtr != 0) { - gDPSetTextureImage( G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, pSprite->tlutPtr ); - gDPSetTile( G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 256, 7, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 0, 0, 0, 0 ); - gDPLoadTLUT( 7, 0, 0, 1020, 0 ); - - if (pSprite->imageFmt != G_IM_FMT_RGBA) - gDP.otherMode.textureLUT = G_TT_RGBA16; - else - gDP.otherMode.textureLUT = G_TT_NONE; - } else - gDP.otherMode.textureLUT = G_TT_NONE; - - _loadSpriteImage(pSprite); - gSPTexture( 1.0f, 1.0f, 0, 0, TRUE ); - gDP.otherMode.texturePersp = 1; - - const f32 z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz; - const f32 w = 1.0f; - - f32 scaleX = 1.0f, scaleY = 1.0f; - u32 flipX = 0, flipY = 0; - do { - u32 w0 = *(u32*)&RDRAM[RSP.PC[RSP.PCi]]; - u32 w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - - RSP.PC[RSP.PCi] += 8; - RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[RSP.PC[RSP.PCi]], 24, 8 ); - - if ( RSP.cmd == 0xBE ) { // gSPSprite2DScaleFlip - scaleX = _FIXED2FLOAT( _SHIFTR(w1, 16, 16), 10 ); - scaleY = _FIXED2FLOAT( _SHIFTR(w1, 0, 16), 10 ); - flipX = _SHIFTR(w0, 8, 8); - flipY = _SHIFTR(w0, 0, 8); - continue; - } - // gSPSprite2DDraw - const f32 frameX = _FIXED2FLOAT(((s16)_SHIFTR(w1, 16, 16)), 2); - const f32 frameY = _FIXED2FLOAT(((s16)_SHIFTR(w1, 0, 16)), 2); - const f32 frameW = pSprite->imageW / scaleX; - const f32 frameH = pSprite->imageH / scaleY; - - f32 ulx, uly, lrx, lry; - if (flipX != 0) { - ulx = frameX + frameW; - lrx = frameX; - } else { - ulx = frameX; - lrx = frameX + frameW; - } - if (flipY != 0) { - uly = frameY + frameH; - lry = frameY; - } else { - uly = frameY; - lry = frameY + frameH; - } - - f32 uls = pSprite->imageX; - f32 ult = pSprite->imageY; - f32 lrs = uls + pSprite->imageW; - f32 lrt = ult + pSprite->imageH; - - // Hack for WCW Nitro. - if ((config.generalEmulation.hacks & hack_WCWNitro) != 0) { - const u32 scale = u32(scaleY); - gSP.bgImage.height /= scale; - gSP.bgImage.imageY /= scale; - ult /= scaleY; - lrt /= scaleY; - gSP.bgImage.width *= scale; - } - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(4); - SPVertex * pVtx = drawer.getDMAVerticesData(); - - SPVertex & vtx0 = pVtx[0]; - vtx0.x = ulx; - vtx0.y = uly; - vtx0.z = z; - vtx0.w = w; - vtx0.s = uls; - vtx0.t = ult; - SPVertex & vtx1 = pVtx[1]; - vtx1.x = lrx; - vtx1.y = uly; - vtx1.z = z; - vtx1.w = w; - vtx1.s = lrs; - vtx1.t = ult; - SPVertex & vtx2 = pVtx[2]; - vtx2.x = ulx; - vtx2.y = lry; - vtx2.z = z; - vtx2.w = w; - vtx2.s = uls; - vtx2.t = lrt; - SPVertex & vtx3 = pVtx[3]; - vtx3.x = lrx; - vtx3.y = lry; - vtx3.z = z; - vtx3.w = w; - vtx3.s = lrs; - vtx3.t = lrt; - - if (pSprite->stride > 0) - drawer.drawScreenSpaceTriangle(4); - } while (RSP.nextCmd == 0xBD || RSP.nextCmd == 0xBE); -} - -#ifndef __NEON_OPT -void(*gSPInverseTransformVector)(float vec[3], float mtx[4][4]) = gSPInverseTransformVector_default; -void(*gSPTransformVector)(float vtx[4], float mtx[4][4]) = gSPTransformVector_default; -#else -void gSPInverseTransformVector_NEON(float vec[3], float mtx[4][4]); -void gSPTransformVector_NEON(float vtx[4], float mtx[4][4]); -void(*gSPInverseTransformVector)(float vec[3], float mtx[4][4]) = gSPInverseTransformVector_NEON; -void(*gSPTransformVector)(float vtx[4], float mtx[4][4]) = gSPTransformVector_NEON; -#endif //__NEON_OPT - -void gSPSetupFunctions() -{ - g_ConkerUcode = GBI.getMicrocodeType() == F3DEX2CBFD; -} diff --git a/GLideN64/src/gSP.h b/GLideN64/src/gSP.h deleted file mode 100644 index 7aab7da..0000000 --- a/GLideN64/src/gSP.h +++ /dev/null @@ -1,219 +0,0 @@ -#ifndef GSP_H -#define GSP_H - -#include "Types.h" -#include "GBI.h" -#include "gDP.h" - -#define CHANGED_VIEWPORT 0x01U -#define CHANGED_MATRIX 0x02U -#define CHANGED_TEXTURE 0x04U -#define CHANGED_GEOMETRYMODE 0x08U -#define CHANGED_FOGPOSITION 0x10U -#define CHANGED_LIGHT 0x20U -#define CHANGED_LOOKAT 0x40U -#define CHANGED_TEXTURESCALE 0x80U -#define CHANGED_HW_LIGHT 0x100U - -#define CLIP_X 0x03 -#define CLIP_NEGX 0x01 -#define CLIP_POSX 0x02 -#define CLIP_Y 0x0C -#define CLIP_NEGY 0x04 -#define CLIP_POSY 0x08 -#define CLIP_W 0x10 -#define CLIP_ALL 0x1F // CLIP_NEGX|CLIP_POSX|CLIP_NEGY|CLIP_POSY|CLIP_W - -#define MODIFY_XY 0x000000FF -#define MODIFY_Z 0x0000FF00 -#define MODIFY_ST 0x00FF0000 -#define MODIFY_RGBA 0xFF000000 -#define MODIFY_ALL 0xFFFFFFFF - -enum Component { R, G, B }; -enum Axis { X ,Y, Z, W }; - -struct SPVertex -{ - f32 x, y, z, w; - f32 nx, ny, nz, __pad0; - f32 r, g, b, a; - f32 flat_r, flat_g, flat_b, flat_a; - f32 s, t; - f32 bc0, bc1; - u32 modify; - u8 HWLight; - u8 clip; - s16 flag; -}; - -struct gSPInfo -{ - u32 segment[16]; - - struct - { - u32 modelViewi, stackSize, billboard; - f32 modelView[32][4][4]; - f32 projection[4][4]; - f32 combined[4][4]; - } matrix; - - u32 objRendermode; - - u32 vertexColorBase; - u32 vertexi; - - struct - { - f32 rgb[12][3]; - f32 rgb2[12][3]; - f32 xyz[12][3]; - f32 i_xyz[12][3]; - f32 pos_xyzw[12][4]; - f32 ca[12], la[12], qa[12]; - } lights; - - struct - { - f32 rgb[2][3]; - f32 xyz[2][3]; - f32 i_xyz[2][3]; - f32 pos_xyzw[2][4]; - f32 ca[2], la[2], qa[2]; - } lookat; - - u32 numLights; - bool lookatEnable; - - struct - { - f32 scales, scalet; - u32 level, on, tile; - } texture; - - gDPTile *textureTile[2]; - - struct Viewport - { - f32 vscale[4]; - f32 vtrans[4]; - f32 x, y, width, height; - f32 nearz, farz; - } viewport; - - struct - { - s16 multiplier, offset; - f32 multiplierf, offsetf; - } fog; - - struct - { - u32 address, width, height, format, size, palette; - f32 imageX, imageY, scaleW, scaleH; - u8 clampS, clampT; - } bgImage; - - u32 geometryMode; - u32 changed; - - struct { - u8 sid; - u32 flag; - u32 addr; - } selectDL; - u32 status[4]; - - struct - { - u32 vtx, mtx, tex_offset, tex_shift, tex_count; - } DMAOffsets; - - u32 DMAIO_address; - - u32 tri_num; - - u32 clipRatio; - - struct - { - u32 vertexNormalBase; - f32 vertexCoordMod[16]; - bool advancedLighting; - } cbfd; - - u32 textureCoordScaleOrg; - u32 textureCoordScale[2]; -}; - -extern gSPInfo gSP; - -void gSPLoadUcodeEx( u32 uc_start, u32 uc_dstart, u16 uc_dsize ); -void gSPNoOp(); -void gSPMatrix( u32 matrix, u8 param ); -void gSPDMAMatrix( u32 matrix, u8 index, u8 multiply ); -void gSPViewport( u32 v ); -void gSPForceMatrix( u32 mptr ); -void gSPLight( u32 l, s32 n ); -void gSPLightCBFD( u32 l, s32 n ); -void gSPLookAt( u32 l, u32 n ); -void gSPLightAcclaim(u32 l, s32 n); -void gSPVertex( u32 v, u32 n, u32 v0 ); -void gSPCIVertex( u32 v, u32 n, u32 v0 ); -void gSPDMAVertex( u32 v, u32 n, u32 v0 ); -void gSPCBFDVertex( u32 v, u32 n, u32 v0 ); -void gSPT3DUXVertex(u32 v, u32 n, u32 ci); -void gSPF3DAMVertex( u32 v, u32 n, u32 v0 ); -void gSPSWVertex(const SWVertex * vertex, u32 n, const bool * const verticesToProcess); -void gSPSWVertex(const SWVertex * vertex, u32 v0, u32 n); -void gSPDisplayList(u32 dl); -void gSPBranchList( u32 dl ); -void gSPBranchLessZ(u32 branchdl, u32 vtx, u32 zval); -void gSPBranchLessW( u32 branchdl, u32 vtx, u32 wval ); -void gSPDlistCount(u32 count, u32 v); -void gSPSprite2DBase(u32 _base ); -void gSPDMATriangles( u32 tris, u32 n ); -void gSP1Quadrangle( s32 v0, s32 v1, s32 v2, s32 v3 ); -void gSPCullDisplayList( u32 v0, u32 vn ); -void gSPPopMatrix( u32 param ); -void gSPPopMatrixN( u32 param, u32 num ); -void gSPSegment( s32 seg, s32 base ); -void gSPClipRatio( u32 ratio ); -void gSPInsertMatrix( u32 where, u32 num ); -void gSPModifyVertex(u32 _vtx, u32 _where, u32 _val ); -void gSPNumLights( s32 n ); -void gSPLightColor( u32 lightNum, u32 packedColor ); -void gSPFogFactor( s16 fm, s16 fo ); -void gSPPerspNormalize( u16 scale ); -void gSPTexture( f32 sc, f32 tc, u32 level, u32 tile, u32 on ); -void gSPEndDisplayList(); -void gSPGeometryMode( u32 clear, u32 set ); -void gSPSetGeometryMode( u32 mode ); -void gSPClearGeometryMode( u32 mode ); -void gSPSetOtherMode_H(u32 _length, u32 _shift, u32 _data); -void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data); -void gSPLine3D(u32 v0, u32 v1, u32 flag); -void gSPLineW3D( u32 v0, u32 v1, u32 wd, u32 flag ); -void gSPSetStatus(u32 sid, u32 val); -void gSPSetDMAOffsets( u32 mtxoffset, u32 vtxoffset ); -void gSPSetDMATexOffset(u32 _addr); -void gSPSetVertexColorBase( u32 base ); -void gSPCombineMatrices(u32 _mode); - -void gSPTriangle(u32 v0, u32 v1, u32 v2); -void gSP1Triangle(u32 v0, u32 v1, u32 v2); -void gSP2Triangles(const u32 v00, const u32 v01, const u32 v02, const u32 flag0, - const u32 v10, const u32 v11, const u32 v12, const u32 flag1 ); -void gSP4Triangles(const u32 v00, const u32 v01, const u32 v02, - const u32 v10, const u32 v11, const u32 v12, - const u32 v20, const u32 v21, const u32 v22, - const u32 v30, const u32 v31, const u32 v32 ); - -void gSPLightVertex(SPVertex & _vtx); - -extern void (*gSPTransformVector)(float vtx[4], float mtx[4][4]); -extern void (*gSPInverseTransformVector)(float vec[3], float mtx[4][4]); -void gSPSetupFunctions(); -void gSPFlushTriangles(); -#endif diff --git a/GLideN64/src/getRevision.bat b/GLideN64/src/getRevision.bat deleted file mode 100644 index e76964f..0000000 --- a/GLideN64/src/getRevision.bat +++ /dev/null @@ -1,7 +0,0 @@ -@echo off -set "SCRIPT_DIRECTORY=%~dp0" - -for /f "delims=" %%A in ('git rev-parse --short HEAD') do set "rev=%%A" -echo current revision %rev% -echo #define PLUGIN_REVISION "%rev%">"%SCRIPT_DIRECTORY%Revision.h" -echo #define PLUGIN_REVISION_W L"%rev%">>"%SCRIPT_DIRECTORY%Revision.h" diff --git a/GLideN64/src/getRevision.sh b/GLideN64/src/getRevision.sh deleted file mode 100755 index 7c0782d..0000000 --- a/GLideN64/src/getRevision.sh +++ /dev/null @@ -1,12 +0,0 @@ -SCRIPT_DIRECTORY=`dirname "$0"` -rev=\"`git rev-parse --short HEAD`\" -lastrev=$(head -n 1 "$SCRIPT_DIRECTORY/Revision.h" 2> /dev/null | cut -d ' ' -f3) - -echo current revision $rev -echo last build revision $lastrev - -if [ "$lastrev" != "$rev" ] -then - echo "#define PLUGIN_REVISION $rev" > "$SCRIPT_DIRECTORY/Revision.h" - echo "#define PLUGIN_REVISION_W L$rev" >> "$SCRIPT_DIRECTORY/Revision.h" -fi diff --git a/GLideN64/src/inc/GL/glcorearb.h b/GLideN64/src/inc/GL/glcorearb.h deleted file mode 100644 index be94baf..0000000 --- a/GLideN64/src/inc/GL/glcorearb.h +++ /dev/null @@ -1,3621 +0,0 @@ -#ifndef __glcorearb_h_ -#define __glcorearb_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 32433 $ on $Date: 2016-02-10 02:02:08 -0500 (Wed, 10 Feb 2016) $ -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -/* glcorearb.h is for use with OpenGL core profile implementations. -** It should should be placed in the same directory as gl.h and -** included as . -** -** glcorearb.h includes only APIs in the latest OpenGL core profile -** implementation together with APIs in newer ARB extensions which -** can be supported by the core profile. It does not, and never will -** include functionality removed from the core profile, such as -** fixed-function vertex and fragment processing. -** -** Do not #include both and either of or -** in the same source file. -*/ - -/* Generated C header for: - * API: gl - * Profile: core - * Versions considered: .* - * Versions emitted: .* - * Default extensions included: glcore - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef GL_VERSION_1_0 -#define GL_VERSION_1_0 1 -typedef void GLvoid; -typedef unsigned int GLenum; -typedef float GLfloat; -typedef int GLint; -typedef int GLsizei; -typedef unsigned int GLbitfield; -typedef double GLdouble; -typedef unsigned int GLuint; -typedef unsigned char GLboolean; -typedef unsigned char GLubyte; -typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); -typedef void (APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); -typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size); -typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum buf); -typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); -typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth); -typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); -typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); -typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap); -typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap); -typedef void (APIENTRYP PFNGLFINISHPROC) (void); -typedef void (APIENTRYP PFNGLFLUSHPROC) (void); -typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); -typedef void (APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode); -typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); -typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); -typedef void (APIENTRYP PFNGLPIXELSTOREFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum src); -typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -typedef void (APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data); -typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum pname, GLdouble *data); -typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void); -typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data); -typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); -typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); -typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); -typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble near, GLdouble far); -typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCullFace (GLenum mode); -GLAPI void APIENTRY glFrontFace (GLenum mode); -GLAPI void APIENTRY glHint (GLenum target, GLenum mode); -GLAPI void APIENTRY glLineWidth (GLfloat width); -GLAPI void APIENTRY glPointSize (GLfloat size); -GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); -GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glDrawBuffer (GLenum buf); -GLAPI void APIENTRY glClear (GLbitfield mask); -GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI void APIENTRY glClearStencil (GLint s); -GLAPI void APIENTRY glClearDepth (GLdouble depth); -GLAPI void APIENTRY glStencilMask (GLuint mask); -GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GLAPI void APIENTRY glDepthMask (GLboolean flag); -GLAPI void APIENTRY glDisable (GLenum cap); -GLAPI void APIENTRY glEnable (GLenum cap); -GLAPI void APIENTRY glFinish (void); -GLAPI void APIENTRY glFlush (void); -GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GLAPI void APIENTRY glLogicOp (GLenum opcode); -GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GLAPI void APIENTRY glDepthFunc (GLenum func); -GLAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); -GLAPI void APIENTRY glReadBuffer (GLenum src); -GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GLAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); -GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *data); -GLAPI GLenum APIENTRY glGetError (void); -GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *data); -GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data); -GLAPI const GLubyte *APIENTRY glGetString (GLenum name); -GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap); -GLAPI void APIENTRY glDepthRange (GLdouble near, GLdouble far); -GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -#endif -#endif /* GL_VERSION_1_0 */ - -#ifndef GL_VERSION_1_1 -#define GL_VERSION_1_1 1 -typedef float GLclampf; -typedef double GLclampd; -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_VIEWPORT 0x0BA2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_DOUBLE 0x140A -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F -#define GL_TEXTURE 0x1702 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 -#define GL_REPEAT 0x2901 -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_VERTEX_ARRAY 0x8074 -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); -typedef void (APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params); -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); -GLAPI void APIENTRY glGetPointerv (GLenum pname, void **params); -GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GLAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); -GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); -GLAPI GLboolean APIENTRY glIsTexture (GLuint texture); -#endif -#endif /* GL_VERSION_1_1 */ - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif -#endif /* GL_VERSION_1_2 */ - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum texture); -GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img); -#endif -#endif /* GL_VERSION_1_3 */ - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); -GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); -GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); -GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI void APIENTRY glBlendEquation (GLenum mode); -#endif -#endif /* GL_VERSION_1_4 */ - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#include -typedef ptrdiff_t GLsizeiptr; -typedef ptrdiff_t GLintptr; -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_SRC1_ALPHA 0x8589 -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); -typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsQuery (GLuint id); -GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); -GLAPI void APIENTRY glEndQuery (GLenum target); -GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); -GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); -GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data); -GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); -#endif -#endif /* GL_VERSION_1_5 */ - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -typedef char GLchar; -typedef short GLshort; -typedef signed char GLbyte; -typedef unsigned short GLushort; -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GLAPI void APIENTRY glCompileShader (GLuint shader); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum type); -GLAPI void APIENTRY glDeleteProgram (GLuint program); -GLAPI void APIENTRY glDeleteShader (GLuint shader); -GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); -GLAPI GLboolean APIENTRY glIsProgram (GLuint program); -GLAPI GLboolean APIENTRY glIsShader (GLuint shader); -GLAPI void APIENTRY glLinkProgram (GLuint program); -GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GLAPI void APIENTRY glUseProgram (GLuint program); -GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); -GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); -GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glValidateProgram (GLuint program); -GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -#endif -#endif /* GL_VERSION_2_0 */ - -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif -#endif /* GL_VERSION_2_1 */ - -#ifndef GL_VERSION_3_0 -#define GL_VERSION_3_0 1 -typedef unsigned short GLhalf; -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RG 0x8226 -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_GREEN_INTEGER 0x8D95 -#define GL_BLUE_INTEGER 0x8D96 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_BGR_INTEGER 0x8D9A -#define GL_BGRA_INTEGER 0x8D9B -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_QUERY_WAIT 0x8E13 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_COLOR_ATTACHMENT16 0x8CF0 -#define GL_COLOR_ATTACHMENT17 0x8CF1 -#define GL_COLOR_ATTACHMENT18 0x8CF2 -#define GL_COLOR_ATTACHMENT19 0x8CF3 -#define GL_COLOR_ATTACHMENT20 0x8CF4 -#define GL_COLOR_ATTACHMENT21 0x8CF5 -#define GL_COLOR_ATTACHMENT22 0x8CF6 -#define GL_COLOR_ATTACHMENT23 0x8CF7 -#define GL_COLOR_ATTACHMENT24 0x8CF8 -#define GL_COLOR_ATTACHMENT25 0x8CF9 -#define GL_COLOR_ATTACHMENT26 0x8CFA -#define GL_COLOR_ATTACHMENT27 0x8CFB -#define GL_COLOR_ATTACHMENT28 0x8CFC -#define GL_COLOR_ATTACHMENT29 0x8CFD -#define GL_COLOR_ATTACHMENT30 0x8CFE -#define GL_COLOR_ATTACHMENT31 0x8CFF -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822A -#define GL_RG8 0x822B -#define GL_RG16 0x822C -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); -GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); -GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); -GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); -GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); -GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedback (void); -GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); -GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); -GLAPI void APIENTRY glEndConditionalRender (void); -GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); -GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); -GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); -GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); -GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); -GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); -GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateMipmap (GLenum target); -GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glBindVertexArray (GLuint array); -GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); -GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); -GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); -#endif -#endif /* GL_VERSION_3_0 */ - -#ifndef GL_VERSION_3_1 -#define GL_VERSION_3_1 1 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); -GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); -GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#endif -#endif /* GL_VERSION_3_1 */ - -#ifndef GL_VERSION_3_2 -#define GL_VERSION_3_2 1 -typedef struct __GLsync *GLsync; -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif -typedef uint64_t GLuint64; -typedef int64_t GLint64; -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -#define GL_DEPTH_CLAMP 0x864F -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION 0x8E4D -#define GL_LAST_VERTEX_CONVENTION 0x8E4E -#define GL_PROVOKING_VERTEX 0x8E4F -#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_INTEGER_SAMPLES 0x9110 -typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); -typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); -GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); -GLAPI void APIENTRY glProvokingVertex (GLenum mode); -GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GLAPI GLboolean APIENTRY glIsSync (GLsync sync); -GLAPI void APIENTRY glDeleteSync (GLsync sync); -GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); -GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); -#endif -#endif /* GL_VERSION_3_2 */ - -#ifndef GL_VERSION_3_3 -#define GL_VERSION_3_3 1 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_SRC1_COLOR 0x88F9 -#define GL_ONE_MINUS_SRC1_COLOR 0x88FA -#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#define GL_TIME_ELAPSED 0x88BF -#define GL_TIMESTAMP 0x8E28 -#define GL_INT_2_10_10_10_REV 0x8D9F -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); -typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); -typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); -GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); -GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); -GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); -GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); -GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); -GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); -GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -#endif -#endif /* GL_VERSION_3_3 */ - -#ifndef GL_VERSION_4_0 -#define GL_VERSION_4_0 1 -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D -#define GL_MAX_VERTEX_STREAMS 0x8E71 -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E -#define GL_ACTIVE_SUBROUTINES 0x8DE5 -#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 -#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 -#define GL_MAX_SUBROUTINES 0x8DE7 -#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 -#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A -#define GL_COMPATIBLE_SUBROUTINES 0x8E4B -#define GL_PATCHES 0x000E -#define GL_PATCH_VERTICES 0x8E72 -#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 -#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 -#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 -#define GL_TESS_GEN_MODE 0x8E76 -#define GL_TESS_GEN_SPACING 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 -#define GL_TESS_GEN_POINT_MODE 0x8E79 -#define GL_ISOLINES 0x8E7A -#define GL_FRACTIONAL_ODD 0x8E7B -#define GL_FRACTIONAL_EVEN 0x8E7C -#define GL_MAX_PATCH_VERTICES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 -#define GL_TESS_EVALUATION_SHADER 0x8E87 -#define GL_TESS_CONTROL_SHADER 0x8E88 -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); -typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); -typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); -typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); -typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); -typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShading (GLfloat value); -GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); -GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); -GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); -GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); -GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); -GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); -GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); -GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); -GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); -GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); -GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); -GLAPI void APIENTRY glPauseTransformFeedback (void); -GLAPI void APIENTRY glResumeTransformFeedback (void); -GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); -GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); -GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); -GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); -GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); -#endif -#endif /* GL_VERSION_4_0 */ - -#ifndef GL_VERSION_4_1 -#define GL_VERSION_4_1 1 -#define GL_FIXED 0x140C -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_RGB565 0x8D62 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_VERTEX_SHADER_BIT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT 0x00000002 -#define GL_GEOMETRY_SHADER_BIT 0x00000004 -#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 -#define GL_ALL_SHADER_BITS 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE 0x8258 -#define GL_ACTIVE_PROGRAM 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING 0x825A -#define GL_MAX_VIEWPORTS 0x825B -#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C -#define GL_VIEWPORT_BOUNDS_RANGE 0x825D -#define GL_LAYER_PROVOKING_VERTEX 0x825E -#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F -#define GL_UNDEFINED_VERTEX 0x8260 -typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); -typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); -typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); -typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); -typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); -typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GLAPI void APIENTRY glClearDepthf (GLfloat d); -GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); -GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); -GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); -GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); -GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); -GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); -GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); -GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); -GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); -GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); -GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); -GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); -GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); -GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); -GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); -GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); -#endif -#endif /* GL_VERSION_4_1 */ - -#ifndef GL_VERSION_4_2 -#define GL_VERSION_4_2 1 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 -#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 -#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 -#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A -#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B -#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C -#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D -#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC -#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 -#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 -#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 -#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 -#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 -#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 -#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB -#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE -#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF -#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 -#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 -#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 -#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 -#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 -#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC -#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 -#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA -#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 -#define GL_COMMAND_BARRIER_BIT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 -#define GL_ALL_BARRIER_BITS 0xFFFFFFFF -#define GL_MAX_IMAGE_UNITS 0x8F38 -#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 -#define GL_IMAGE_BINDING_NAME 0x8F3A -#define GL_IMAGE_BINDING_LEVEL 0x8F3B -#define GL_IMAGE_BINDING_LAYERED 0x8F3C -#define GL_IMAGE_BINDING_LAYER 0x8F3D -#define GL_IMAGE_BINDING_ACCESS 0x8F3E -#define GL_IMAGE_1D 0x904C -#define GL_IMAGE_2D 0x904D -#define GL_IMAGE_3D 0x904E -#define GL_IMAGE_2D_RECT 0x904F -#define GL_IMAGE_CUBE 0x9050 -#define GL_IMAGE_BUFFER 0x9051 -#define GL_IMAGE_1D_ARRAY 0x9052 -#define GL_IMAGE_2D_ARRAY 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 -#define GL_INT_IMAGE_1D 0x9057 -#define GL_INT_IMAGE_2D 0x9058 -#define GL_INT_IMAGE_3D 0x9059 -#define GL_INT_IMAGE_2D_RECT 0x905A -#define GL_INT_IMAGE_CUBE 0x905B -#define GL_INT_IMAGE_BUFFER 0x905C -#define GL_INT_IMAGE_1D_ARRAY 0x905D -#define GL_INT_IMAGE_2D_ARRAY 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C -#define GL_MAX_IMAGE_SAMPLES 0x906D -#define GL_IMAGE_BINDING_FORMAT 0x906E -#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 -#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA -#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB -#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC -#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD -#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE -#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF -#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); -typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); -GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); -GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); -GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); -#endif -#endif /* GL_VERSION_4_2 */ - -#ifndef GL_VERSION_4_3 -#define GL_VERSION_4_3 1 -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 -#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_COMPUTE_SHADER 0x91B9 -#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB -#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC -#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD -#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 -#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 -#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 -#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 -#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 -#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB -#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE -#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF -#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED -#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE -#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF -#define GL_COMPUTE_SHADER_BIT 0x00000020 -#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 -#define GL_DEBUG_SOURCE_API 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION 0x824A -#define GL_DEBUG_SOURCE_OTHER 0x824B -#define GL_DEBUG_TYPE_ERROR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 -#define GL_DEBUG_TYPE_OTHER 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES 0x9145 -#define GL_DEBUG_SEVERITY_HIGH 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 -#define GL_DEBUG_SEVERITY_LOW 0x9148 -#define GL_DEBUG_TYPE_MARKER 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D -#define GL_BUFFER 0x82E0 -#define GL_SHADER 0x82E1 -#define GL_PROGRAM 0x82E2 -#define GL_QUERY 0x82E3 -#define GL_PROGRAM_PIPELINE 0x82E4 -#define GL_SAMPLER 0x82E6 -#define GL_MAX_LABEL_LENGTH 0x82E8 -#define GL_DEBUG_OUTPUT 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 -#define GL_MAX_UNIFORM_LOCATIONS 0x826E -#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 -#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 -#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 -#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 -#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 -#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 -#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 -#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 -#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 -#define GL_INTERNALFORMAT_SUPPORTED 0x826F -#define GL_INTERNALFORMAT_PREFERRED 0x8270 -#define GL_INTERNALFORMAT_RED_SIZE 0x8271 -#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 -#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 -#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 -#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 -#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 -#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 -#define GL_INTERNALFORMAT_RED_TYPE 0x8278 -#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 -#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A -#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B -#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C -#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D -#define GL_MAX_WIDTH 0x827E -#define GL_MAX_HEIGHT 0x827F -#define GL_MAX_DEPTH 0x8280 -#define GL_MAX_LAYERS 0x8281 -#define GL_MAX_COMBINED_DIMENSIONS 0x8282 -#define GL_COLOR_COMPONENTS 0x8283 -#define GL_DEPTH_COMPONENTS 0x8284 -#define GL_STENCIL_COMPONENTS 0x8285 -#define GL_COLOR_RENDERABLE 0x8286 -#define GL_DEPTH_RENDERABLE 0x8287 -#define GL_STENCIL_RENDERABLE 0x8288 -#define GL_FRAMEBUFFER_RENDERABLE 0x8289 -#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A -#define GL_FRAMEBUFFER_BLEND 0x828B -#define GL_READ_PIXELS 0x828C -#define GL_READ_PIXELS_FORMAT 0x828D -#define GL_READ_PIXELS_TYPE 0x828E -#define GL_TEXTURE_IMAGE_FORMAT 0x828F -#define GL_TEXTURE_IMAGE_TYPE 0x8290 -#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 -#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 -#define GL_MIPMAP 0x8293 -#define GL_MANUAL_GENERATE_MIPMAP 0x8294 -#define GL_AUTO_GENERATE_MIPMAP 0x8295 -#define GL_COLOR_ENCODING 0x8296 -#define GL_SRGB_READ 0x8297 -#define GL_SRGB_WRITE 0x8298 -#define GL_FILTER 0x829A -#define GL_VERTEX_TEXTURE 0x829B -#define GL_TESS_CONTROL_TEXTURE 0x829C -#define GL_TESS_EVALUATION_TEXTURE 0x829D -#define GL_GEOMETRY_TEXTURE 0x829E -#define GL_FRAGMENT_TEXTURE 0x829F -#define GL_COMPUTE_TEXTURE 0x82A0 -#define GL_TEXTURE_SHADOW 0x82A1 -#define GL_TEXTURE_GATHER 0x82A2 -#define GL_TEXTURE_GATHER_SHADOW 0x82A3 -#define GL_SHADER_IMAGE_LOAD 0x82A4 -#define GL_SHADER_IMAGE_STORE 0x82A5 -#define GL_SHADER_IMAGE_ATOMIC 0x82A6 -#define GL_IMAGE_TEXEL_SIZE 0x82A7 -#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 -#define GL_IMAGE_PIXEL_FORMAT 0x82A9 -#define GL_IMAGE_PIXEL_TYPE 0x82AA -#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC -#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD -#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE -#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF -#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 -#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 -#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 -#define GL_CLEAR_BUFFER 0x82B4 -#define GL_TEXTURE_VIEW 0x82B5 -#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 -#define GL_FULL_SUPPORT 0x82B7 -#define GL_CAVEAT_SUPPORT 0x82B8 -#define GL_IMAGE_CLASS_4_X_32 0x82B9 -#define GL_IMAGE_CLASS_2_X_32 0x82BA -#define GL_IMAGE_CLASS_1_X_32 0x82BB -#define GL_IMAGE_CLASS_4_X_16 0x82BC -#define GL_IMAGE_CLASS_2_X_16 0x82BD -#define GL_IMAGE_CLASS_1_X_16 0x82BE -#define GL_IMAGE_CLASS_4_X_8 0x82BF -#define GL_IMAGE_CLASS_2_X_8 0x82C0 -#define GL_IMAGE_CLASS_1_X_8 0x82C1 -#define GL_IMAGE_CLASS_11_11_10 0x82C2 -#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 -#define GL_VIEW_CLASS_128_BITS 0x82C4 -#define GL_VIEW_CLASS_96_BITS 0x82C5 -#define GL_VIEW_CLASS_64_BITS 0x82C6 -#define GL_VIEW_CLASS_48_BITS 0x82C7 -#define GL_VIEW_CLASS_32_BITS 0x82C8 -#define GL_VIEW_CLASS_24_BITS 0x82C9 -#define GL_VIEW_CLASS_16_BITS 0x82CA -#define GL_VIEW_CLASS_8_BITS 0x82CB -#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC -#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD -#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE -#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF -#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 -#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 -#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 -#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 -#define GL_UNIFORM 0x92E1 -#define GL_UNIFORM_BLOCK 0x92E2 -#define GL_PROGRAM_INPUT 0x92E3 -#define GL_PROGRAM_OUTPUT 0x92E4 -#define GL_BUFFER_VARIABLE 0x92E5 -#define GL_SHADER_STORAGE_BLOCK 0x92E6 -#define GL_VERTEX_SUBROUTINE 0x92E8 -#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 -#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA -#define GL_GEOMETRY_SUBROUTINE 0x92EB -#define GL_FRAGMENT_SUBROUTINE 0x92EC -#define GL_COMPUTE_SUBROUTINE 0x92ED -#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE -#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF -#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 -#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 -#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 -#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 -#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 -#define GL_ACTIVE_RESOURCES 0x92F5 -#define GL_MAX_NAME_LENGTH 0x92F6 -#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 -#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 -#define GL_NAME_LENGTH 0x92F9 -#define GL_TYPE 0x92FA -#define GL_ARRAY_SIZE 0x92FB -#define GL_OFFSET 0x92FC -#define GL_BLOCK_INDEX 0x92FD -#define GL_ARRAY_STRIDE 0x92FE -#define GL_MATRIX_STRIDE 0x92FF -#define GL_IS_ROW_MAJOR 0x9300 -#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 -#define GL_BUFFER_BINDING 0x9302 -#define GL_BUFFER_DATA_SIZE 0x9303 -#define GL_NUM_ACTIVE_VARIABLES 0x9304 -#define GL_ACTIVE_VARIABLES 0x9305 -#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 -#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 -#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 -#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 -#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A -#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B -#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C -#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D -#define GL_LOCATION 0x930E -#define GL_LOCATION_INDEX 0x930F -#define GL_IS_PER_PATCH 0x92E7 -#define GL_SHADER_STORAGE_BUFFER 0x90D2 -#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 -#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 -#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 -#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 -#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 -#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 -#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 -#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA -#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB -#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC -#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD -#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE -#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF -#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 -#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 -#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA -#define GL_TEXTURE_BUFFER_OFFSET 0x919D -#define GL_TEXTURE_BUFFER_SIZE 0x919E -#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F -#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -#define GL_VERTEX_ATTRIB_BINDING 0x82D4 -#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 -#define GL_VERTEX_BINDING_DIVISOR 0x82D6 -#define GL_VERTEX_BINDING_OFFSET 0x82D7 -#define GL_VERTEX_BINDING_STRIDE 0x82D8 -#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 -#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA -#define GL_VERTEX_BINDING_BUFFER 0x8F4F -typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); -typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); -typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); -typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); -typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); -GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); -GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); -GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); -GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); -GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); -GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); -GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GLAPI void APIENTRY glPopDebugGroup (void); -GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -#endif /* GL_VERSION_4_3 */ - -#ifndef GL_VERSION_4_4 -#define GL_VERSION_4_4 1 -#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 -#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 -#define GL_TEXTURE_BUFFER_BINDING 0x8C2A -#define GL_MAP_PERSISTENT_BIT 0x0040 -#define GL_MAP_COHERENT_BIT 0x0080 -#define GL_DYNAMIC_STORAGE_BIT 0x0100 -#define GL_CLIENT_STORAGE_BIT 0x0200 -#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 -#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F -#define GL_BUFFER_STORAGE_FLAGS 0x8220 -#define GL_CLEAR_TEXTURE 0x9365 -#define GL_LOCATION_COMPONENT 0x934A -#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B -#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C -#define GL_QUERY_BUFFER 0x9192 -#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 -#define GL_QUERY_BUFFER_BINDING 0x9193 -#define GL_QUERY_RESULT_NO_WAIT 0x9194 -#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 -typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); -typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); -typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); -typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); -typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); -typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); -typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); -GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); -GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); -GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures); -GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers); -GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures); -GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -#endif -#endif /* GL_VERSION_4_4 */ - -#ifndef GL_VERSION_4_5 -#define GL_VERSION_4_5 1 -#define GL_CONTEXT_LOST 0x0507 -#define GL_NEGATIVE_ONE_TO_ONE 0x935E -#define GL_ZERO_TO_ONE 0x935F -#define GL_CLIP_ORIGIN 0x935C -#define GL_CLIP_DEPTH_MODE 0x935D -#define GL_QUERY_WAIT_INVERTED 0x8E17 -#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 -#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 -#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A -#define GL_MAX_CULL_DISTANCES 0x82F9 -#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA -#define GL_TEXTURE_TARGET 0x1006 -#define GL_QUERY_TARGET 0x82EA -#define GL_GUILTY_CONTEXT_RESET 0x8253 -#define GL_INNOCENT_CONTEXT_RESET 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET 0x8252 -#define GL_NO_RESET_NOTIFICATION 0x8261 -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 -#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB -#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC -typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); -typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); -typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); -typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); -typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); -typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); -typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); -typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); -typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); -typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); -typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); -typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); -typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); -typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); -typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); -typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); -typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); -typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); -typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); -GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); -GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); -GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); -GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); -GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); -GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); -GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); -GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); -GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); -GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); -GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); -GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); -GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); -GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); -GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); -GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); -GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); -GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); -GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); -GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); -GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); -GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); -GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); -GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); -GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); -GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); -GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); -GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); -GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); -GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); -GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); -GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); -GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); -GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); -GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GLAPI void APIENTRY glTextureBarrier (void); -#endif -#endif /* GL_VERSION_4_5 */ - -#ifndef GL_ARB_ES2_compatibility -#define GL_ARB_ES2_compatibility 1 -#endif /* GL_ARB_ES2_compatibility */ - -#ifndef GL_ARB_ES3_1_compatibility -#define GL_ARB_ES3_1_compatibility 1 -#endif /* GL_ARB_ES3_1_compatibility */ - -#ifndef GL_ARB_ES3_compatibility -#define GL_ARB_ES3_compatibility 1 -#endif /* GL_ARB_ES3_compatibility */ - -#ifndef GL_ARB_arrays_of_arrays -#define GL_ARB_arrays_of_arrays 1 -#endif /* GL_ARB_arrays_of_arrays */ - -#ifndef GL_ARB_base_instance -#define GL_ARB_base_instance 1 -#endif /* GL_ARB_base_instance */ - -#ifndef GL_ARB_bindless_texture -#define GL_ARB_bindless_texture 1 -typedef uint64_t GLuint64EXT; -#define GL_UNSIGNED_INT64_ARB 0x140F -typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); -typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); -typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); -typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); -typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); -typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); -typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); -typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture); -GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler); -GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle); -GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle); -GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); -GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access); -GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle); -GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value); -GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value); -GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values); -GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle); -GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle); -GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x); -GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params); -#endif -#endif /* GL_ARB_bindless_texture */ - -#ifndef GL_ARB_blend_func_extended -#define GL_ARB_blend_func_extended 1 -#endif /* GL_ARB_blend_func_extended */ - -#ifndef GL_ARB_buffer_storage -#define GL_ARB_buffer_storage 1 -#endif /* GL_ARB_buffer_storage */ - -#ifndef GL_ARB_cl_event -#define GL_ARB_cl_event 1 -struct _cl_context; -struct _cl_event; -#define GL_SYNC_CL_EVENT_ARB 0x8240 -#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 -typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); -#endif -#endif /* GL_ARB_cl_event */ - -#ifndef GL_ARB_clear_buffer_object -#define GL_ARB_clear_buffer_object 1 -#endif /* GL_ARB_clear_buffer_object */ - -#ifndef GL_ARB_clear_texture -#define GL_ARB_clear_texture 1 -#endif /* GL_ARB_clear_texture */ - -#ifndef GL_ARB_clip_control -#define GL_ARB_clip_control 1 -#endif /* GL_ARB_clip_control */ - -#ifndef GL_ARB_compressed_texture_pixel_storage -#define GL_ARB_compressed_texture_pixel_storage 1 -#endif /* GL_ARB_compressed_texture_pixel_storage */ - -#ifndef GL_ARB_compute_shader -#define GL_ARB_compute_shader 1 -#endif /* GL_ARB_compute_shader */ - -#ifndef GL_ARB_compute_variable_group_size -#define GL_ARB_compute_variable_group_size 1 -#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 -#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB -#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 -#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); -#endif -#endif /* GL_ARB_compute_variable_group_size */ - -#ifndef GL_ARB_conditional_render_inverted -#define GL_ARB_conditional_render_inverted 1 -#endif /* GL_ARB_conditional_render_inverted */ - -#ifndef GL_ARB_conservative_depth -#define GL_ARB_conservative_depth 1 -#endif /* GL_ARB_conservative_depth */ - -#ifndef GL_ARB_copy_buffer -#define GL_ARB_copy_buffer 1 -#endif /* GL_ARB_copy_buffer */ - -#ifndef GL_ARB_copy_image -#define GL_ARB_copy_image 1 -#endif /* GL_ARB_copy_image */ - -#ifndef GL_ARB_cull_distance -#define GL_ARB_cull_distance 1 -#endif /* GL_ARB_cull_distance */ - -#ifndef GL_ARB_debug_output -#define GL_ARB_debug_output 1 -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 -#define GL_DEBUG_SOURCE_API_ARB 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A -#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B -#define GL_DEBUG_TYPE_ERROR_ARB 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 -#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 -#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 -typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#endif -#endif /* GL_ARB_debug_output */ - -#ifndef GL_ARB_depth_buffer_float -#define GL_ARB_depth_buffer_float 1 -#endif /* GL_ARB_depth_buffer_float */ - -#ifndef GL_ARB_depth_clamp -#define GL_ARB_depth_clamp 1 -#endif /* GL_ARB_depth_clamp */ - -#ifndef GL_ARB_derivative_control -#define GL_ARB_derivative_control 1 -#endif /* GL_ARB_derivative_control */ - -#ifndef GL_ARB_direct_state_access -#define GL_ARB_direct_state_access 1 -#endif /* GL_ARB_direct_state_access */ - -#ifndef GL_ARB_draw_buffers_blend -#define GL_ARB_draw_buffers_blend 1 -typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif -#endif /* GL_ARB_draw_buffers_blend */ - -#ifndef GL_ARB_draw_elements_base_vertex -#define GL_ARB_draw_elements_base_vertex 1 -#endif /* GL_ARB_draw_elements_base_vertex */ - -#ifndef GL_ARB_draw_indirect -#define GL_ARB_draw_indirect 1 -#endif /* GL_ARB_draw_indirect */ - -#ifndef GL_ARB_enhanced_layouts -#define GL_ARB_enhanced_layouts 1 -#endif /* GL_ARB_enhanced_layouts */ - -#ifndef GL_ARB_explicit_attrib_location -#define GL_ARB_explicit_attrib_location 1 -#endif /* GL_ARB_explicit_attrib_location */ - -#ifndef GL_ARB_explicit_uniform_location -#define GL_ARB_explicit_uniform_location 1 -#endif /* GL_ARB_explicit_uniform_location */ - -#ifndef GL_ARB_fragment_coord_conventions -#define GL_ARB_fragment_coord_conventions 1 -#endif /* GL_ARB_fragment_coord_conventions */ - -#ifndef GL_ARB_fragment_layer_viewport -#define GL_ARB_fragment_layer_viewport 1 -#endif /* GL_ARB_fragment_layer_viewport */ - -#ifndef GL_ARB_framebuffer_no_attachments -#define GL_ARB_framebuffer_no_attachments 1 -#endif /* GL_ARB_framebuffer_no_attachments */ - -#ifndef GL_ARB_framebuffer_object -#define GL_ARB_framebuffer_object 1 -#endif /* GL_ARB_framebuffer_object */ - -#ifndef GL_ARB_framebuffer_sRGB -#define GL_ARB_framebuffer_sRGB 1 -#endif /* GL_ARB_framebuffer_sRGB */ - -#ifndef GL_ARB_get_program_binary -#define GL_ARB_get_program_binary 1 -#endif /* GL_ARB_get_program_binary */ - -#ifndef GL_ARB_get_texture_sub_image -#define GL_ARB_get_texture_sub_image 1 -#endif /* GL_ARB_get_texture_sub_image */ - -#ifndef GL_ARB_gpu_shader5 -#define GL_ARB_gpu_shader5 1 -#endif /* GL_ARB_gpu_shader5 */ - -#ifndef GL_ARB_gpu_shader_fp64 -#define GL_ARB_gpu_shader_fp64 1 -#endif /* GL_ARB_gpu_shader_fp64 */ - -#ifndef GL_ARB_half_float_vertex -#define GL_ARB_half_float_vertex 1 -#endif /* GL_ARB_half_float_vertex */ - -#ifndef GL_ARB_imaging -#define GL_ARB_imaging 1 -#define GL_BLEND_COLOR 0x8005 -#define GL_BLEND_EQUATION 0x8009 -#endif /* GL_ARB_imaging */ - -#ifndef GL_ARB_indirect_parameters -#define GL_ARB_indirect_parameters 1 -#define GL_PARAMETER_BUFFER_ARB 0x80EE -#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -#endif -#endif /* GL_ARB_indirect_parameters */ - -#ifndef GL_ARB_internalformat_query -#define GL_ARB_internalformat_query 1 -#endif /* GL_ARB_internalformat_query */ - -#ifndef GL_ARB_internalformat_query2 -#define GL_ARB_internalformat_query2 1 -#define GL_SRGB_DECODE_ARB 0x8299 -#endif /* GL_ARB_internalformat_query2 */ - -#ifndef GL_ARB_invalidate_subdata -#define GL_ARB_invalidate_subdata 1 -#endif /* GL_ARB_invalidate_subdata */ - -#ifndef GL_ARB_map_buffer_alignment -#define GL_ARB_map_buffer_alignment 1 -#endif /* GL_ARB_map_buffer_alignment */ - -#ifndef GL_ARB_map_buffer_range -#define GL_ARB_map_buffer_range 1 -#endif /* GL_ARB_map_buffer_range */ - -#ifndef GL_ARB_multi_bind -#define GL_ARB_multi_bind 1 -#endif /* GL_ARB_multi_bind */ - -#ifndef GL_ARB_multi_draw_indirect -#define GL_ARB_multi_draw_indirect 1 -#endif /* GL_ARB_multi_draw_indirect */ - -#ifndef GL_ARB_occlusion_query2 -#define GL_ARB_occlusion_query2 1 -#endif /* GL_ARB_occlusion_query2 */ - -#ifndef GL_ARB_pipeline_statistics_query -#define GL_ARB_pipeline_statistics_query 1 -#define GL_VERTICES_SUBMITTED_ARB 0x82EE -#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF -#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 -#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 -#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 -#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 -#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 -#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 -#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 -#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 -#endif /* GL_ARB_pipeline_statistics_query */ - -#ifndef GL_ARB_program_interface_query -#define GL_ARB_program_interface_query 1 -#endif /* GL_ARB_program_interface_query */ - -#ifndef GL_ARB_provoking_vertex -#define GL_ARB_provoking_vertex 1 -#endif /* GL_ARB_provoking_vertex */ - -#ifndef GL_ARB_query_buffer_object -#define GL_ARB_query_buffer_object 1 -#endif /* GL_ARB_query_buffer_object */ - -#ifndef GL_ARB_robust_buffer_access_behavior -#define GL_ARB_robust_buffer_access_behavior 1 -#endif /* GL_ARB_robust_buffer_access_behavior */ - -#ifndef GL_ARB_robustness -#define GL_ARB_robustness 1 -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 -typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); -typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); -typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img); -typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); -GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); -GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img); -GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -#endif -#endif /* GL_ARB_robustness */ - -#ifndef GL_ARB_robustness_isolation -#define GL_ARB_robustness_isolation 1 -#endif /* GL_ARB_robustness_isolation */ - -#ifndef GL_ARB_sample_shading -#define GL_ARB_sample_shading 1 -#define GL_SAMPLE_SHADING_ARB 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); -#endif -#endif /* GL_ARB_sample_shading */ - -#ifndef GL_ARB_sampler_objects -#define GL_ARB_sampler_objects 1 -#endif /* GL_ARB_sampler_objects */ - -#ifndef GL_ARB_seamless_cube_map -#define GL_ARB_seamless_cube_map 1 -#endif /* GL_ARB_seamless_cube_map */ - -#ifndef GL_ARB_seamless_cubemap_per_texture -#define GL_ARB_seamless_cubemap_per_texture 1 -#endif /* GL_ARB_seamless_cubemap_per_texture */ - -#ifndef GL_ARB_separate_shader_objects -#define GL_ARB_separate_shader_objects 1 -#endif /* GL_ARB_separate_shader_objects */ - -#ifndef GL_ARB_shader_atomic_counters -#define GL_ARB_shader_atomic_counters 1 -#endif /* GL_ARB_shader_atomic_counters */ - -#ifndef GL_ARB_shader_bit_encoding -#define GL_ARB_shader_bit_encoding 1 -#endif /* GL_ARB_shader_bit_encoding */ - -#ifndef GL_ARB_shader_draw_parameters -#define GL_ARB_shader_draw_parameters 1 -#endif /* GL_ARB_shader_draw_parameters */ - -#ifndef GL_ARB_shader_group_vote -#define GL_ARB_shader_group_vote 1 -#endif /* GL_ARB_shader_group_vote */ - -#ifndef GL_ARB_shader_image_load_store -#define GL_ARB_shader_image_load_store 1 -#endif /* GL_ARB_shader_image_load_store */ - -#ifndef GL_ARB_shader_image_size -#define GL_ARB_shader_image_size 1 -#endif /* GL_ARB_shader_image_size */ - -#ifndef GL_ARB_shader_precision -#define GL_ARB_shader_precision 1 -#endif /* GL_ARB_shader_precision */ - -#ifndef GL_ARB_shader_stencil_export -#define GL_ARB_shader_stencil_export 1 -#endif /* GL_ARB_shader_stencil_export */ - -#ifndef GL_ARB_shader_storage_buffer_object -#define GL_ARB_shader_storage_buffer_object 1 -#endif /* GL_ARB_shader_storage_buffer_object */ - -#ifndef GL_ARB_shader_subroutine -#define GL_ARB_shader_subroutine 1 -#endif /* GL_ARB_shader_subroutine */ - -#ifndef GL_ARB_shader_texture_image_samples -#define GL_ARB_shader_texture_image_samples 1 -#endif /* GL_ARB_shader_texture_image_samples */ - -#ifndef GL_ARB_shading_language_420pack -#define GL_ARB_shading_language_420pack 1 -#endif /* GL_ARB_shading_language_420pack */ - -#ifndef GL_ARB_shading_language_include -#define GL_ARB_shading_language_include 1 -#define GL_SHADER_INCLUDE_ARB 0x8DAE -#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 -#define GL_NAMED_STRING_TYPE_ARB 0x8DEA -typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); -typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); -GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#endif -#endif /* GL_ARB_shading_language_include */ - -#ifndef GL_ARB_shading_language_packing -#define GL_ARB_shading_language_packing 1 -#endif /* GL_ARB_shading_language_packing */ - -#ifndef GL_ARB_sparse_buffer -#define GL_ARB_sparse_buffer 1 -#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 -#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 -typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); -typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); -GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -#endif -#endif /* GL_ARB_sparse_buffer */ - -#ifndef GL_ARB_sparse_texture -#define GL_ARB_sparse_texture 1 -#define GL_TEXTURE_SPARSE_ARB 0x91A6 -#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 -#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA -#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 -#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 -#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 -#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 -#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 -#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 -#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A -#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 -typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); -#endif -#endif /* GL_ARB_sparse_texture */ - -#ifndef GL_ARB_stencil_texturing -#define GL_ARB_stencil_texturing 1 -#endif /* GL_ARB_stencil_texturing */ - -#ifndef GL_ARB_sync -#define GL_ARB_sync 1 -#endif /* GL_ARB_sync */ - -#ifndef GL_ARB_tessellation_shader -#define GL_ARB_tessellation_shader 1 -#endif /* GL_ARB_tessellation_shader */ - -#ifndef GL_ARB_texture_barrier -#define GL_ARB_texture_barrier 1 -#endif /* GL_ARB_texture_barrier */ - -#ifndef GL_ARB_texture_buffer_object_rgb32 -#define GL_ARB_texture_buffer_object_rgb32 1 -#endif /* GL_ARB_texture_buffer_object_rgb32 */ - -#ifndef GL_ARB_texture_buffer_range -#define GL_ARB_texture_buffer_range 1 -#endif /* GL_ARB_texture_buffer_range */ - -#ifndef GL_ARB_texture_compression_bptc -#define GL_ARB_texture_compression_bptc 1 -#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F -#endif /* GL_ARB_texture_compression_bptc */ - -#ifndef GL_ARB_texture_compression_rgtc -#define GL_ARB_texture_compression_rgtc 1 -#endif /* GL_ARB_texture_compression_rgtc */ - -#ifndef GL_ARB_texture_cube_map_array -#define GL_ARB_texture_cube_map_array 1 -#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F -#endif /* GL_ARB_texture_cube_map_array */ - -#ifndef GL_ARB_texture_gather -#define GL_ARB_texture_gather 1 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F -#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F -#endif /* GL_ARB_texture_gather */ - -#ifndef GL_ARB_texture_mirror_clamp_to_edge -#define GL_ARB_texture_mirror_clamp_to_edge 1 -#endif /* GL_ARB_texture_mirror_clamp_to_edge */ - -#ifndef GL_ARB_texture_multisample -#define GL_ARB_texture_multisample 1 -#endif /* GL_ARB_texture_multisample */ - -#ifndef GL_ARB_texture_query_levels -#define GL_ARB_texture_query_levels 1 -#endif /* GL_ARB_texture_query_levels */ - -#ifndef GL_ARB_texture_query_lod -#define GL_ARB_texture_query_lod 1 -#endif /* GL_ARB_texture_query_lod */ - -#ifndef GL_ARB_texture_rg -#define GL_ARB_texture_rg 1 -#endif /* GL_ARB_texture_rg */ - -#ifndef GL_ARB_texture_rgb10_a2ui -#define GL_ARB_texture_rgb10_a2ui 1 -#endif /* GL_ARB_texture_rgb10_a2ui */ - -#ifndef GL_ARB_texture_stencil8 -#define GL_ARB_texture_stencil8 1 -#endif /* GL_ARB_texture_stencil8 */ - -#ifndef GL_ARB_texture_storage -#define GL_ARB_texture_storage 1 -#endif /* GL_ARB_texture_storage */ - -#ifndef GL_ARB_texture_storage_multisample -#define GL_ARB_texture_storage_multisample 1 -#endif /* GL_ARB_texture_storage_multisample */ - -#ifndef GL_ARB_texture_swizzle -#define GL_ARB_texture_swizzle 1 -#endif /* GL_ARB_texture_swizzle */ - -#ifndef GL_ARB_texture_view -#define GL_ARB_texture_view 1 -#endif /* GL_ARB_texture_view */ - -#ifndef GL_ARB_timer_query -#define GL_ARB_timer_query 1 -#endif /* GL_ARB_timer_query */ - -#ifndef GL_ARB_transform_feedback2 -#define GL_ARB_transform_feedback2 1 -#endif /* GL_ARB_transform_feedback2 */ - -#ifndef GL_ARB_transform_feedback3 -#define GL_ARB_transform_feedback3 1 -#endif /* GL_ARB_transform_feedback3 */ - -#ifndef GL_ARB_transform_feedback_instanced -#define GL_ARB_transform_feedback_instanced 1 -#endif /* GL_ARB_transform_feedback_instanced */ - -#ifndef GL_ARB_transform_feedback_overflow_query -#define GL_ARB_transform_feedback_overflow_query 1 -#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC -#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED -#endif /* GL_ARB_transform_feedback_overflow_query */ - -#ifndef GL_ARB_uniform_buffer_object -#define GL_ARB_uniform_buffer_object 1 -#endif /* GL_ARB_uniform_buffer_object */ - -#ifndef GL_ARB_vertex_array_bgra -#define GL_ARB_vertex_array_bgra 1 -#endif /* GL_ARB_vertex_array_bgra */ - -#ifndef GL_ARB_vertex_array_object -#define GL_ARB_vertex_array_object 1 -#endif /* GL_ARB_vertex_array_object */ - -#ifndef GL_ARB_vertex_attrib_64bit -#define GL_ARB_vertex_attrib_64bit 1 -#endif /* GL_ARB_vertex_attrib_64bit */ - -#ifndef GL_ARB_vertex_attrib_binding -#define GL_ARB_vertex_attrib_binding 1 -#endif /* GL_ARB_vertex_attrib_binding */ - -#ifndef GL_ARB_vertex_type_10f_11f_11f_rev -#define GL_ARB_vertex_type_10f_11f_11f_rev 1 -#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ - -#ifndef GL_ARB_vertex_type_2_10_10_10_rev -#define GL_ARB_vertex_type_2_10_10_10_rev 1 -#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ - -#ifndef GL_ARB_viewport_array -#define GL_ARB_viewport_array 1 -#endif /* GL_ARB_viewport_array */ - -#ifndef GL_KHR_context_flush_control -#define GL_KHR_context_flush_control 1 -#endif /* GL_KHR_context_flush_control */ - -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -#endif /* GL_KHR_debug */ - -#ifndef GL_KHR_no_error -#define GL_KHR_no_error 1 -#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 -#endif /* GL_KHR_no_error */ - -#ifndef GL_KHR_robust_buffer_access_behavior -#define GL_KHR_robust_buffer_access_behavior 1 -#endif /* GL_KHR_robust_buffer_access_behavior */ - -#ifndef GL_KHR_robustness -#define GL_KHR_robustness 1 -#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 -#endif /* GL_KHR_robustness */ - -#ifndef GL_KHR_texture_compression_astc_hdr -#define GL_KHR_texture_compression_astc_hdr 1 -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif /* GL_KHR_texture_compression_astc_hdr */ - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 -#endif /* GL_KHR_texture_compression_astc_ldr */ - -#ifndef GL_KHR_texture_compression_astc_sliced_3d -#define GL_KHR_texture_compression_astc_sliced_3d 1 -#endif /* GL_KHR_texture_compression_astc_sliced_3d */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/GLideN64/src/inc/GL/glext.h b/GLideN64/src/inc/GL/glext.h deleted file mode 100644 index 7d792bb..0000000 --- a/GLideN64/src/inc/GL/glext.h +++ /dev/null @@ -1,12146 +0,0 @@ -#ifndef __glext_h_ -#define __glext_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 33248 $ on $Date: 2016-10-24 01:22:03 -0400 (Mon, 24 Oct 2016) $ -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -#define GL_GLEXT_VERSION 20161024 - -/* Generated C header for: - * API: gl - * Profile: compatibility - * Versions considered: .* - * Versions emitted: 1\.[2-9]|[234]\.[0-9] - * Default extensions included: gl - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_RESCALE_NORMAL 0x803A -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif -#endif /* GL_VERSION_1_2 */ - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum texture); -GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img); -GLAPI void APIENTRY glClientActiveTexture (GLenum texture); -GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); -GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s); -GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s); -GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s); -GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); -GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); -GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t); -GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); -GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); -GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); -GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m); -GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); -GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); -GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); -#endif -#endif /* GL_VERSION_1_3 */ - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); -GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); -GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); -GLAPI void APIENTRY glFogCoordf (GLfloat coord); -GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); -GLAPI void APIENTRY glFogCoordd (GLdouble coord); -GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord); -GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); -GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v); -GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); -GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v); -GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); -GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v); -GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue); -GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v); -GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); -GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v); -GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); -GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v); -GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); -GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v); -GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); -GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v); -GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y); -GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v); -GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y); -GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v); -GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y); -GLAPI void APIENTRY glWindowPos2iv (const GLint *v); -GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y); -GLAPI void APIENTRY glWindowPos2sv (const GLshort *v); -GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v); -GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v); -GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z); -GLAPI void APIENTRY glWindowPos3iv (const GLint *v); -GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); -GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI void APIENTRY glBlendEquation (GLenum mode); -#endif -#endif /* GL_VERSION_1_4 */ - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#include -typedef ptrdiff_t GLsizeiptr; -typedef ptrdiff_t GLintptr; -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_SRC1_ALPHA 0x8589 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_FOG_COORD_SRC 0x8450 -#define GL_FOG_COORD 0x8451 -#define GL_CURRENT_FOG_COORD 0x8453 -#define GL_FOG_COORD_ARRAY_TYPE 0x8454 -#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORD_ARRAY_POINTER 0x8456 -#define GL_FOG_COORD_ARRAY 0x8457 -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D -#define GL_SRC0_RGB 0x8580 -#define GL_SRC1_RGB 0x8581 -#define GL_SRC2_RGB 0x8582 -#define GL_SRC0_ALPHA 0x8588 -#define GL_SRC2_ALPHA 0x858A -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); -typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsQuery (GLuint id); -GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); -GLAPI void APIENTRY glEndQuery (GLenum target); -GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); -GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); -GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data); -GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); -#endif -#endif /* GL_VERSION_1_5 */ - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -typedef char GLchar; -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_TEXTURE_COORDS 0x8871 -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GLAPI void APIENTRY glCompileShader (GLuint shader); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum type); -GLAPI void APIENTRY glDeleteProgram (GLuint program); -GLAPI void APIENTRY glDeleteShader (GLuint shader); -GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); -GLAPI GLboolean APIENTRY glIsProgram (GLuint program); -GLAPI GLboolean APIENTRY glIsShader (GLuint shader); -GLAPI void APIENTRY glLinkProgram (GLuint program); -GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GLAPI void APIENTRY glUseProgram (GLuint program); -GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); -GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); -GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glValidateProgram (GLuint program); -GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -#endif -#endif /* GL_VERSION_2_0 */ - -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif -#endif /* GL_VERSION_2_1 */ - -#ifndef GL_VERSION_3_0 -#define GL_VERSION_3_0 1 -typedef unsigned short GLhalf; -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RG 0x8226 -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_GREEN_INTEGER 0x8D95 -#define GL_BLUE_INTEGER 0x8D96 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_BGR_INTEGER 0x8D9A -#define GL_BGRA_INTEGER 0x8D9B -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_QUERY_WAIT 0x8E13 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_COLOR_ATTACHMENT16 0x8CF0 -#define GL_COLOR_ATTACHMENT17 0x8CF1 -#define GL_COLOR_ATTACHMENT18 0x8CF2 -#define GL_COLOR_ATTACHMENT19 0x8CF3 -#define GL_COLOR_ATTACHMENT20 0x8CF4 -#define GL_COLOR_ATTACHMENT21 0x8CF5 -#define GL_COLOR_ATTACHMENT22 0x8CF6 -#define GL_COLOR_ATTACHMENT23 0x8CF7 -#define GL_COLOR_ATTACHMENT24 0x8CF8 -#define GL_COLOR_ATTACHMENT25 0x8CF9 -#define GL_COLOR_ATTACHMENT26 0x8CFA -#define GL_COLOR_ATTACHMENT27 0x8CFB -#define GL_COLOR_ATTACHMENT28 0x8CFC -#define GL_COLOR_ATTACHMENT29 0x8CFD -#define GL_COLOR_ATTACHMENT30 0x8CFE -#define GL_COLOR_ATTACHMENT31 0x8CFF -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_INDEX 0x8222 -#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822A -#define GL_RG8 0x822B -#define GL_RG16 0x822C -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_CLAMP_VERTEX_COLOR 0x891A -#define GL_CLAMP_FRAGMENT_COLOR 0x891B -#define GL_ALPHA_INTEGER 0x8D97 -typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); -GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); -GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); -GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); -GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); -GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedback (void); -GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); -GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); -GLAPI void APIENTRY glEndConditionalRender (void); -GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); -GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); -GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); -GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); -GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); -GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); -GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateMipmap (GLenum target); -GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glBindVertexArray (GLuint array); -GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); -GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); -GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); -#endif -#endif /* GL_VERSION_3_0 */ - -#ifndef GL_VERSION_3_1 -#define GL_VERSION_3_1 1 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); -GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); -GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#endif -#endif /* GL_VERSION_3_1 */ - -#ifndef GL_VERSION_3_2 -#define GL_VERSION_3_2 1 -typedef struct __GLsync *GLsync; -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif -typedef uint64_t GLuint64; -typedef int64_t GLint64; -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -#define GL_DEPTH_CLAMP 0x864F -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION 0x8E4D -#define GL_LAST_VERTEX_CONVENTION 0x8E4E -#define GL_PROVOKING_VERTEX 0x8E4F -#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_INTEGER_SAMPLES 0x9110 -typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); -typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); -GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); -GLAPI void APIENTRY glProvokingVertex (GLenum mode); -GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GLAPI GLboolean APIENTRY glIsSync (GLsync sync); -GLAPI void APIENTRY glDeleteSync (GLsync sync); -GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); -GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); -#endif -#endif /* GL_VERSION_3_2 */ - -#ifndef GL_VERSION_3_3 -#define GL_VERSION_3_3 1 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_SRC1_COLOR 0x88F9 -#define GL_ONE_MINUS_SRC1_COLOR 0x88FA -#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#define GL_TIME_ELAPSED 0x88BF -#define GL_TIMESTAMP 0x8E28 -#define GL_INT_2_10_10_10_REV 0x8D9F -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); -typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); -typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); -GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); -GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); -GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); -GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); -GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); -GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); -GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color); -GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color); -GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color); -GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color); -#endif -#endif /* GL_VERSION_3_3 */ - -#ifndef GL_VERSION_4_0 -#define GL_VERSION_4_0 1 -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D -#define GL_MAX_VERTEX_STREAMS 0x8E71 -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E -#define GL_ACTIVE_SUBROUTINES 0x8DE5 -#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 -#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 -#define GL_MAX_SUBROUTINES 0x8DE7 -#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 -#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A -#define GL_COMPATIBLE_SUBROUTINES 0x8E4B -#define GL_PATCHES 0x000E -#define GL_PATCH_VERTICES 0x8E72 -#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 -#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 -#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 -#define GL_TESS_GEN_MODE 0x8E76 -#define GL_TESS_GEN_SPACING 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 -#define GL_TESS_GEN_POINT_MODE 0x8E79 -#define GL_ISOLINES 0x8E7A -#define GL_FRACTIONAL_ODD 0x8E7B -#define GL_FRACTIONAL_EVEN 0x8E7C -#define GL_MAX_PATCH_VERTICES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 -#define GL_TESS_EVALUATION_SHADER 0x8E87 -#define GL_TESS_CONTROL_SHADER 0x8E88 -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); -typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); -typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); -typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); -typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); -typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShading (GLfloat value); -GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); -GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); -GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); -GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); -GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); -GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); -GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); -GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); -GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); -GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); -GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); -GLAPI void APIENTRY glPauseTransformFeedback (void); -GLAPI void APIENTRY glResumeTransformFeedback (void); -GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); -GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); -GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); -GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); -GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); -#endif -#endif /* GL_VERSION_4_0 */ - -#ifndef GL_VERSION_4_1 -#define GL_VERSION_4_1 1 -#define GL_FIXED 0x140C -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_RGB565 0x8D62 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_VERTEX_SHADER_BIT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT 0x00000002 -#define GL_GEOMETRY_SHADER_BIT 0x00000004 -#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 -#define GL_ALL_SHADER_BITS 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE 0x8258 -#define GL_ACTIVE_PROGRAM 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING 0x825A -#define GL_MAX_VIEWPORTS 0x825B -#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C -#define GL_VIEWPORT_BOUNDS_RANGE 0x825D -#define GL_LAYER_PROVOKING_VERTEX 0x825E -#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F -#define GL_UNDEFINED_VERTEX 0x8260 -typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); -typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); -typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); -typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); -typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); -typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GLAPI void APIENTRY glClearDepthf (GLfloat d); -GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); -GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); -GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); -GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); -GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); -GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); -GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); -GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); -GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); -GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); -GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); -GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); -GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); -GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); -GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); -GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); -#endif -#endif /* GL_VERSION_4_1 */ - -#ifndef GL_VERSION_4_2 -#define GL_VERSION_4_2 1 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 -#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 -#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 -#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A -#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B -#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C -#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D -#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC -#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 -#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 -#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 -#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 -#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 -#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 -#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB -#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE -#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF -#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 -#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 -#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 -#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 -#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 -#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC -#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 -#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA -#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 -#define GL_COMMAND_BARRIER_BIT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 -#define GL_ALL_BARRIER_BITS 0xFFFFFFFF -#define GL_MAX_IMAGE_UNITS 0x8F38 -#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 -#define GL_IMAGE_BINDING_NAME 0x8F3A -#define GL_IMAGE_BINDING_LEVEL 0x8F3B -#define GL_IMAGE_BINDING_LAYERED 0x8F3C -#define GL_IMAGE_BINDING_LAYER 0x8F3D -#define GL_IMAGE_BINDING_ACCESS 0x8F3E -#define GL_IMAGE_1D 0x904C -#define GL_IMAGE_2D 0x904D -#define GL_IMAGE_3D 0x904E -#define GL_IMAGE_2D_RECT 0x904F -#define GL_IMAGE_CUBE 0x9050 -#define GL_IMAGE_BUFFER 0x9051 -#define GL_IMAGE_1D_ARRAY 0x9052 -#define GL_IMAGE_2D_ARRAY 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 -#define GL_INT_IMAGE_1D 0x9057 -#define GL_INT_IMAGE_2D 0x9058 -#define GL_INT_IMAGE_3D 0x9059 -#define GL_INT_IMAGE_2D_RECT 0x905A -#define GL_INT_IMAGE_CUBE 0x905B -#define GL_INT_IMAGE_BUFFER 0x905C -#define GL_INT_IMAGE_1D_ARRAY 0x905D -#define GL_INT_IMAGE_2D_ARRAY 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C -#define GL_MAX_IMAGE_SAMPLES 0x906D -#define GL_IMAGE_BINDING_FORMAT 0x906E -#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 -#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA -#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB -#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC -#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD -#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE -#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF -#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); -typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); -GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); -GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); -GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); -#endif -#endif /* GL_VERSION_4_2 */ - -#ifndef GL_VERSION_4_3 -#define GL_VERSION_4_3 1 -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 -#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_COMPUTE_SHADER 0x91B9 -#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB -#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC -#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD -#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 -#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 -#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 -#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 -#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 -#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB -#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE -#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF -#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED -#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE -#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF -#define GL_COMPUTE_SHADER_BIT 0x00000020 -#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 -#define GL_DEBUG_SOURCE_API 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION 0x824A -#define GL_DEBUG_SOURCE_OTHER 0x824B -#define GL_DEBUG_TYPE_ERROR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 -#define GL_DEBUG_TYPE_OTHER 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES 0x9145 -#define GL_DEBUG_SEVERITY_HIGH 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 -#define GL_DEBUG_SEVERITY_LOW 0x9148 -#define GL_DEBUG_TYPE_MARKER 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D -#define GL_BUFFER 0x82E0 -#define GL_SHADER 0x82E1 -#define GL_PROGRAM 0x82E2 -#define GL_QUERY 0x82E3 -#define GL_PROGRAM_PIPELINE 0x82E4 -#define GL_SAMPLER 0x82E6 -#define GL_MAX_LABEL_LENGTH 0x82E8 -#define GL_DEBUG_OUTPUT 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 -#define GL_MAX_UNIFORM_LOCATIONS 0x826E -#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 -#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 -#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 -#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 -#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 -#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 -#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 -#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 -#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 -#define GL_INTERNALFORMAT_SUPPORTED 0x826F -#define GL_INTERNALFORMAT_PREFERRED 0x8270 -#define GL_INTERNALFORMAT_RED_SIZE 0x8271 -#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 -#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 -#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 -#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 -#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 -#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 -#define GL_INTERNALFORMAT_RED_TYPE 0x8278 -#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 -#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A -#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B -#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C -#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D -#define GL_MAX_WIDTH 0x827E -#define GL_MAX_HEIGHT 0x827F -#define GL_MAX_DEPTH 0x8280 -#define GL_MAX_LAYERS 0x8281 -#define GL_MAX_COMBINED_DIMENSIONS 0x8282 -#define GL_COLOR_COMPONENTS 0x8283 -#define GL_DEPTH_COMPONENTS 0x8284 -#define GL_STENCIL_COMPONENTS 0x8285 -#define GL_COLOR_RENDERABLE 0x8286 -#define GL_DEPTH_RENDERABLE 0x8287 -#define GL_STENCIL_RENDERABLE 0x8288 -#define GL_FRAMEBUFFER_RENDERABLE 0x8289 -#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A -#define GL_FRAMEBUFFER_BLEND 0x828B -#define GL_READ_PIXELS 0x828C -#define GL_READ_PIXELS_FORMAT 0x828D -#define GL_READ_PIXELS_TYPE 0x828E -#define GL_TEXTURE_IMAGE_FORMAT 0x828F -#define GL_TEXTURE_IMAGE_TYPE 0x8290 -#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 -#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 -#define GL_MIPMAP 0x8293 -#define GL_MANUAL_GENERATE_MIPMAP 0x8294 -#define GL_AUTO_GENERATE_MIPMAP 0x8295 -#define GL_COLOR_ENCODING 0x8296 -#define GL_SRGB_READ 0x8297 -#define GL_SRGB_WRITE 0x8298 -#define GL_FILTER 0x829A -#define GL_VERTEX_TEXTURE 0x829B -#define GL_TESS_CONTROL_TEXTURE 0x829C -#define GL_TESS_EVALUATION_TEXTURE 0x829D -#define GL_GEOMETRY_TEXTURE 0x829E -#define GL_FRAGMENT_TEXTURE 0x829F -#define GL_COMPUTE_TEXTURE 0x82A0 -#define GL_TEXTURE_SHADOW 0x82A1 -#define GL_TEXTURE_GATHER 0x82A2 -#define GL_TEXTURE_GATHER_SHADOW 0x82A3 -#define GL_SHADER_IMAGE_LOAD 0x82A4 -#define GL_SHADER_IMAGE_STORE 0x82A5 -#define GL_SHADER_IMAGE_ATOMIC 0x82A6 -#define GL_IMAGE_TEXEL_SIZE 0x82A7 -#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 -#define GL_IMAGE_PIXEL_FORMAT 0x82A9 -#define GL_IMAGE_PIXEL_TYPE 0x82AA -#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC -#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD -#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE -#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF -#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 -#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 -#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 -#define GL_CLEAR_BUFFER 0x82B4 -#define GL_TEXTURE_VIEW 0x82B5 -#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 -#define GL_FULL_SUPPORT 0x82B7 -#define GL_CAVEAT_SUPPORT 0x82B8 -#define GL_IMAGE_CLASS_4_X_32 0x82B9 -#define GL_IMAGE_CLASS_2_X_32 0x82BA -#define GL_IMAGE_CLASS_1_X_32 0x82BB -#define GL_IMAGE_CLASS_4_X_16 0x82BC -#define GL_IMAGE_CLASS_2_X_16 0x82BD -#define GL_IMAGE_CLASS_1_X_16 0x82BE -#define GL_IMAGE_CLASS_4_X_8 0x82BF -#define GL_IMAGE_CLASS_2_X_8 0x82C0 -#define GL_IMAGE_CLASS_1_X_8 0x82C1 -#define GL_IMAGE_CLASS_11_11_10 0x82C2 -#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 -#define GL_VIEW_CLASS_128_BITS 0x82C4 -#define GL_VIEW_CLASS_96_BITS 0x82C5 -#define GL_VIEW_CLASS_64_BITS 0x82C6 -#define GL_VIEW_CLASS_48_BITS 0x82C7 -#define GL_VIEW_CLASS_32_BITS 0x82C8 -#define GL_VIEW_CLASS_24_BITS 0x82C9 -#define GL_VIEW_CLASS_16_BITS 0x82CA -#define GL_VIEW_CLASS_8_BITS 0x82CB -#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC -#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD -#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE -#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF -#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 -#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 -#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 -#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 -#define GL_UNIFORM 0x92E1 -#define GL_UNIFORM_BLOCK 0x92E2 -#define GL_PROGRAM_INPUT 0x92E3 -#define GL_PROGRAM_OUTPUT 0x92E4 -#define GL_BUFFER_VARIABLE 0x92E5 -#define GL_SHADER_STORAGE_BLOCK 0x92E6 -#define GL_VERTEX_SUBROUTINE 0x92E8 -#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 -#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA -#define GL_GEOMETRY_SUBROUTINE 0x92EB -#define GL_FRAGMENT_SUBROUTINE 0x92EC -#define GL_COMPUTE_SUBROUTINE 0x92ED -#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE -#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF -#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 -#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 -#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 -#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 -#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 -#define GL_ACTIVE_RESOURCES 0x92F5 -#define GL_MAX_NAME_LENGTH 0x92F6 -#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 -#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 -#define GL_NAME_LENGTH 0x92F9 -#define GL_TYPE 0x92FA -#define GL_ARRAY_SIZE 0x92FB -#define GL_OFFSET 0x92FC -#define GL_BLOCK_INDEX 0x92FD -#define GL_ARRAY_STRIDE 0x92FE -#define GL_MATRIX_STRIDE 0x92FF -#define GL_IS_ROW_MAJOR 0x9300 -#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 -#define GL_BUFFER_BINDING 0x9302 -#define GL_BUFFER_DATA_SIZE 0x9303 -#define GL_NUM_ACTIVE_VARIABLES 0x9304 -#define GL_ACTIVE_VARIABLES 0x9305 -#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 -#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 -#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 -#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 -#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A -#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B -#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C -#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D -#define GL_LOCATION 0x930E -#define GL_LOCATION_INDEX 0x930F -#define GL_IS_PER_PATCH 0x92E7 -#define GL_SHADER_STORAGE_BUFFER 0x90D2 -#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 -#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 -#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 -#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 -#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 -#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 -#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 -#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA -#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB -#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC -#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD -#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE -#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF -#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 -#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 -#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA -#define GL_TEXTURE_BUFFER_OFFSET 0x919D -#define GL_TEXTURE_BUFFER_SIZE 0x919E -#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F -#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -#define GL_VERTEX_ATTRIB_BINDING 0x82D4 -#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 -#define GL_VERTEX_BINDING_DIVISOR 0x82D6 -#define GL_VERTEX_BINDING_OFFSET 0x82D7 -#define GL_VERTEX_BINDING_STRIDE 0x82D8 -#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 -#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA -#define GL_VERTEX_BINDING_BUFFER 0x8F4F -#define GL_DISPLAY_LIST 0x82E7 -typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); -typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); -typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); -typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); -typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); -GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); -GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); -GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); -GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); -GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); -GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); -GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GLAPI void APIENTRY glPopDebugGroup (void); -GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -#endif /* GL_VERSION_4_3 */ - -#ifndef GL_VERSION_4_4 -#define GL_VERSION_4_4 1 -#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 -#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 -#define GL_TEXTURE_BUFFER_BINDING 0x8C2A -#define GL_MAP_PERSISTENT_BIT 0x0040 -#define GL_MAP_COHERENT_BIT 0x0080 -#define GL_DYNAMIC_STORAGE_BIT 0x0100 -#define GL_CLIENT_STORAGE_BIT 0x0200 -#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 -#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F -#define GL_BUFFER_STORAGE_FLAGS 0x8220 -#define GL_CLEAR_TEXTURE 0x9365 -#define GL_LOCATION_COMPONENT 0x934A -#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B -#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C -#define GL_QUERY_BUFFER 0x9192 -#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 -#define GL_QUERY_BUFFER_BINDING 0x9193 -#define GL_QUERY_RESULT_NO_WAIT 0x9194 -#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 -typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); -typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); -typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); -typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); -typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); -typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); -typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); -GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); -GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); -GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures); -GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers); -GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures); -GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -#endif -#endif /* GL_VERSION_4_4 */ - -#ifndef GL_VERSION_4_5 -#define GL_VERSION_4_5 1 -#define GL_CONTEXT_LOST 0x0507 -#define GL_NEGATIVE_ONE_TO_ONE 0x935E -#define GL_ZERO_TO_ONE 0x935F -#define GL_CLIP_ORIGIN 0x935C -#define GL_CLIP_DEPTH_MODE 0x935D -#define GL_QUERY_WAIT_INVERTED 0x8E17 -#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 -#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 -#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A -#define GL_MAX_CULL_DISTANCES 0x82F9 -#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA -#define GL_TEXTURE_TARGET 0x1006 -#define GL_QUERY_TARGET 0x82EA -#define GL_GUILTY_CONTEXT_RESET 0x8253 -#define GL_INNOCENT_CONTEXT_RESET 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET 0x8252 -#define GL_NO_RESET_NOTIFICATION 0x8261 -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 -#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB -#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC -typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); -typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); -typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); -typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); -typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); -typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); -typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); -typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); -typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); -typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); -typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); -typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); -typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); -typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); -typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); -typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); -typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); -typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); -typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (APIENTRYP PFNGLGETNMAPDVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); -typedef void (APIENTRYP PFNGLGETNMAPFVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); -typedef void (APIENTRYP PFNGLGETNMAPIVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); -typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC) (GLenum map, GLsizei bufSize, GLfloat *values); -typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC) (GLenum map, GLsizei bufSize, GLuint *values); -typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC) (GLenum map, GLsizei bufSize, GLushort *values); -typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC) (GLsizei bufSize, GLubyte *pattern); -typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); -typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); -typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); -typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -typedef void (APIENTRYP PFNGLGETNMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); -GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); -GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); -GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); -GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); -GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); -GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); -GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); -GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); -GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); -GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); -GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); -GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); -GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); -GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); -GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); -GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); -GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); -GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); -GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); -GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); -GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); -GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); -GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); -GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); -GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); -GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); -GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); -GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); -GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); -GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); -GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); -GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); -GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); -GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); -GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); -GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); -GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); -GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GLAPI void APIENTRY glGetnMapdv (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); -GLAPI void APIENTRY glGetnMapfv (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); -GLAPI void APIENTRY glGetnMapiv (GLenum target, GLenum query, GLsizei bufSize, GLint *v); -GLAPI void APIENTRY glGetnPixelMapfv (GLenum map, GLsizei bufSize, GLfloat *values); -GLAPI void APIENTRY glGetnPixelMapuiv (GLenum map, GLsizei bufSize, GLuint *values); -GLAPI void APIENTRY glGetnPixelMapusv (GLenum map, GLsizei bufSize, GLushort *values); -GLAPI void APIENTRY glGetnPolygonStipple (GLsizei bufSize, GLubyte *pattern); -GLAPI void APIENTRY glGetnColorTable (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); -GLAPI void APIENTRY glGetnConvolutionFilter (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); -GLAPI void APIENTRY glGetnSeparableFilter (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); -GLAPI void APIENTRY glGetnHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -GLAPI void APIENTRY glGetnMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -GLAPI void APIENTRY glTextureBarrier (void); -#endif -#endif /* GL_VERSION_4_5 */ - -#ifndef GL_ARB_ES2_compatibility -#define GL_ARB_ES2_compatibility 1 -#endif /* GL_ARB_ES2_compatibility */ - -#ifndef GL_ARB_ES3_1_compatibility -#define GL_ARB_ES3_1_compatibility 1 -#endif /* GL_ARB_ES3_1_compatibility */ - -#ifndef GL_ARB_ES3_2_compatibility -#define GL_ARB_ES3_2_compatibility 1 -#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE -#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 -#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 -typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); -#endif -#endif /* GL_ARB_ES3_2_compatibility */ - -#ifndef GL_ARB_ES3_compatibility -#define GL_ARB_ES3_compatibility 1 -#endif /* GL_ARB_ES3_compatibility */ - -#ifndef GL_ARB_arrays_of_arrays -#define GL_ARB_arrays_of_arrays 1 -#endif /* GL_ARB_arrays_of_arrays */ - -#ifndef GL_ARB_base_instance -#define GL_ARB_base_instance 1 -#endif /* GL_ARB_base_instance */ - -#ifndef GL_ARB_bindless_texture -#define GL_ARB_bindless_texture 1 -typedef uint64_t GLuint64EXT; -#define GL_UNSIGNED_INT64_ARB 0x140F -typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); -typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); -typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); -typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); -typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); -typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); -typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); -typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture); -GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler); -GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle); -GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle); -GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); -GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access); -GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle); -GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value); -GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value); -GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values); -GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle); -GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle); -GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x); -GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params); -#endif -#endif /* GL_ARB_bindless_texture */ - -#ifndef GL_ARB_blend_func_extended -#define GL_ARB_blend_func_extended 1 -#endif /* GL_ARB_blend_func_extended */ - -#ifndef GL_ARB_buffer_storage -#define GL_ARB_buffer_storage 1 -#endif /* GL_ARB_buffer_storage */ - -#ifndef GL_ARB_cl_event -#define GL_ARB_cl_event 1 -struct _cl_context; -struct _cl_event; -#define GL_SYNC_CL_EVENT_ARB 0x8240 -#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 -typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); -#endif -#endif /* GL_ARB_cl_event */ - -#ifndef GL_ARB_clear_buffer_object -#define GL_ARB_clear_buffer_object 1 -#endif /* GL_ARB_clear_buffer_object */ - -#ifndef GL_ARB_clear_texture -#define GL_ARB_clear_texture 1 -#endif /* GL_ARB_clear_texture */ - -#ifndef GL_ARB_clip_control -#define GL_ARB_clip_control 1 -#endif /* GL_ARB_clip_control */ - -#ifndef GL_ARB_color_buffer_float -#define GL_ARB_color_buffer_float 1 -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); -#endif -#endif /* GL_ARB_color_buffer_float */ - -#ifndef GL_ARB_compatibility -#define GL_ARB_compatibility 1 -#endif /* GL_ARB_compatibility */ - -#ifndef GL_ARB_compressed_texture_pixel_storage -#define GL_ARB_compressed_texture_pixel_storage 1 -#endif /* GL_ARB_compressed_texture_pixel_storage */ - -#ifndef GL_ARB_compute_shader -#define GL_ARB_compute_shader 1 -#endif /* GL_ARB_compute_shader */ - -#ifndef GL_ARB_compute_variable_group_size -#define GL_ARB_compute_variable_group_size 1 -#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 -#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB -#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 -#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); -#endif -#endif /* GL_ARB_compute_variable_group_size */ - -#ifndef GL_ARB_conditional_render_inverted -#define GL_ARB_conditional_render_inverted 1 -#endif /* GL_ARB_conditional_render_inverted */ - -#ifndef GL_ARB_conservative_depth -#define GL_ARB_conservative_depth 1 -#endif /* GL_ARB_conservative_depth */ - -#ifndef GL_ARB_copy_buffer -#define GL_ARB_copy_buffer 1 -#endif /* GL_ARB_copy_buffer */ - -#ifndef GL_ARB_copy_image -#define GL_ARB_copy_image 1 -#endif /* GL_ARB_copy_image */ - -#ifndef GL_ARB_cull_distance -#define GL_ARB_cull_distance 1 -#endif /* GL_ARB_cull_distance */ - -#ifndef GL_ARB_debug_output -#define GL_ARB_debug_output 1 -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 -#define GL_DEBUG_SOURCE_API_ARB 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A -#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B -#define GL_DEBUG_TYPE_ERROR_ARB 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 -#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 -#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 -typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#endif -#endif /* GL_ARB_debug_output */ - -#ifndef GL_ARB_depth_buffer_float -#define GL_ARB_depth_buffer_float 1 -#endif /* GL_ARB_depth_buffer_float */ - -#ifndef GL_ARB_depth_clamp -#define GL_ARB_depth_clamp 1 -#endif /* GL_ARB_depth_clamp */ - -#ifndef GL_ARB_depth_texture -#define GL_ARB_depth_texture 1 -#define GL_DEPTH_COMPONENT16_ARB 0x81A5 -#define GL_DEPTH_COMPONENT24_ARB 0x81A6 -#define GL_DEPTH_COMPONENT32_ARB 0x81A7 -#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A -#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B -#endif /* GL_ARB_depth_texture */ - -#ifndef GL_ARB_derivative_control -#define GL_ARB_derivative_control 1 -#endif /* GL_ARB_derivative_control */ - -#ifndef GL_ARB_direct_state_access -#define GL_ARB_direct_state_access 1 -#endif /* GL_ARB_direct_state_access */ - -#ifndef GL_ARB_draw_buffers -#define GL_ARB_draw_buffers 1 -#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 -#define GL_DRAW_BUFFER0_ARB 0x8825 -#define GL_DRAW_BUFFER1_ARB 0x8826 -#define GL_DRAW_BUFFER2_ARB 0x8827 -#define GL_DRAW_BUFFER3_ARB 0x8828 -#define GL_DRAW_BUFFER4_ARB 0x8829 -#define GL_DRAW_BUFFER5_ARB 0x882A -#define GL_DRAW_BUFFER6_ARB 0x882B -#define GL_DRAW_BUFFER7_ARB 0x882C -#define GL_DRAW_BUFFER8_ARB 0x882D -#define GL_DRAW_BUFFER9_ARB 0x882E -#define GL_DRAW_BUFFER10_ARB 0x882F -#define GL_DRAW_BUFFER11_ARB 0x8830 -#define GL_DRAW_BUFFER12_ARB 0x8831 -#define GL_DRAW_BUFFER13_ARB 0x8832 -#define GL_DRAW_BUFFER14_ARB 0x8833 -#define GL_DRAW_BUFFER15_ARB 0x8834 -typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs); -#endif -#endif /* GL_ARB_draw_buffers */ - -#ifndef GL_ARB_draw_buffers_blend -#define GL_ARB_draw_buffers_blend 1 -typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif -#endif /* GL_ARB_draw_buffers_blend */ - -#ifndef GL_ARB_draw_elements_base_vertex -#define GL_ARB_draw_elements_base_vertex 1 -#endif /* GL_ARB_draw_elements_base_vertex */ - -#ifndef GL_ARB_draw_indirect -#define GL_ARB_draw_indirect 1 -#endif /* GL_ARB_draw_indirect */ - -#ifndef GL_ARB_draw_instanced -#define GL_ARB_draw_instanced 1 -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#endif -#endif /* GL_ARB_draw_instanced */ - -#ifndef GL_ARB_enhanced_layouts -#define GL_ARB_enhanced_layouts 1 -#endif /* GL_ARB_enhanced_layouts */ - -#ifndef GL_ARB_explicit_attrib_location -#define GL_ARB_explicit_attrib_location 1 -#endif /* GL_ARB_explicit_attrib_location */ - -#ifndef GL_ARB_explicit_uniform_location -#define GL_ARB_explicit_uniform_location 1 -#endif /* GL_ARB_explicit_uniform_location */ - -#ifndef GL_ARB_fragment_coord_conventions -#define GL_ARB_fragment_coord_conventions 1 -#endif /* GL_ARB_fragment_coord_conventions */ - -#ifndef GL_ARB_fragment_layer_viewport -#define GL_ARB_fragment_layer_viewport 1 -#endif /* GL_ARB_fragment_layer_viewport */ - -#ifndef GL_ARB_fragment_program -#define GL_ARB_fragment_program 1 -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB -#define GL_PROGRAM_ATTRIBS_ARB 0x88AC -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_MATRIX0_ARB 0x88C0 -#define GL_MATRIX1_ARB 0x88C1 -#define GL_MATRIX2_ARB 0x88C2 -#define GL_MATRIX3_ARB 0x88C3 -#define GL_MATRIX4_ARB 0x88C4 -#define GL_MATRIX5_ARB 0x88C5 -#define GL_MATRIX6_ARB 0x88C6 -#define GL_MATRIX7_ARB 0x88C7 -#define GL_MATRIX8_ARB 0x88C8 -#define GL_MATRIX9_ARB 0x88C9 -#define GL_MATRIX10_ARB 0x88CA -#define GL_MATRIX11_ARB 0x88CB -#define GL_MATRIX12_ARB 0x88CC -#define GL_MATRIX13_ARB 0x88CD -#define GL_MATRIX14_ARB 0x88CE -#define GL_MATRIX15_ARB 0x88CF -#define GL_MATRIX16_ARB 0x88D0 -#define GL_MATRIX17_ARB 0x88D1 -#define GL_MATRIX18_ARB 0x88D2 -#define GL_MATRIX19_ARB 0x88D3 -#define GL_MATRIX20_ARB 0x88D4 -#define GL_MATRIX21_ARB 0x88D5 -#define GL_MATRIX22_ARB 0x88D6 -#define GL_MATRIX23_ARB 0x88D7 -#define GL_MATRIX24_ARB 0x88D8 -#define GL_MATRIX25_ARB 0x88D9 -#define GL_MATRIX26_ARB 0x88DA -#define GL_MATRIX27_ARB 0x88DB -#define GL_MATRIX28_ARB 0x88DC -#define GL_MATRIX29_ARB 0x88DD -#define GL_MATRIX30_ARB 0x88DE -#define GL_MATRIX31_ARB 0x88DF -typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string); -typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const void *string); -GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program); -GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs); -GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs); -GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); -GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); -GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); -GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); -GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, void *string); -GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); -#endif -#endif /* GL_ARB_fragment_program */ - -#ifndef GL_ARB_fragment_program_shadow -#define GL_ARB_fragment_program_shadow 1 -#endif /* GL_ARB_fragment_program_shadow */ - -#ifndef GL_ARB_fragment_shader -#define GL_ARB_fragment_shader 1 -#define GL_FRAGMENT_SHADER_ARB 0x8B30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B -#endif /* GL_ARB_fragment_shader */ - -#ifndef GL_ARB_fragment_shader_interlock -#define GL_ARB_fragment_shader_interlock 1 -#endif /* GL_ARB_fragment_shader_interlock */ - -#ifndef GL_ARB_framebuffer_no_attachments -#define GL_ARB_framebuffer_no_attachments 1 -#endif /* GL_ARB_framebuffer_no_attachments */ - -#ifndef GL_ARB_framebuffer_object -#define GL_ARB_framebuffer_object 1 -#endif /* GL_ARB_framebuffer_object */ - -#ifndef GL_ARB_framebuffer_sRGB -#define GL_ARB_framebuffer_sRGB 1 -#endif /* GL_ARB_framebuffer_sRGB */ - -#ifndef GL_ARB_geometry_shader4 -#define GL_ARB_geometry_shader4 1 -#define GL_LINES_ADJACENCY_ARB 0x000A -#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B -#define GL_TRIANGLES_ADJACENCY_ARB 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D -#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 -#define GL_GEOMETRY_SHADER_ARB 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value); -GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif -#endif /* GL_ARB_geometry_shader4 */ - -#ifndef GL_ARB_get_program_binary -#define GL_ARB_get_program_binary 1 -#endif /* GL_ARB_get_program_binary */ - -#ifndef GL_ARB_get_texture_sub_image -#define GL_ARB_get_texture_sub_image 1 -#endif /* GL_ARB_get_texture_sub_image */ - -#ifndef GL_ARB_gpu_shader5 -#define GL_ARB_gpu_shader5 1 -#endif /* GL_ARB_gpu_shader5 */ - -#ifndef GL_ARB_gpu_shader_fp64 -#define GL_ARB_gpu_shader_fp64 1 -#endif /* GL_ARB_gpu_shader_fp64 */ - -#ifndef GL_ARB_gpu_shader_int64 -#define GL_ARB_gpu_shader_int64 1 -#define GL_INT64_ARB 0x140E -#define GL_INT64_VEC2_ARB 0x8FE9 -#define GL_INT64_VEC3_ARB 0x8FEA -#define GL_INT64_VEC4_ARB 0x8FEB -#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 -typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x); -typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y); -typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z); -typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); -typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x); -typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y); -typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); -typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); -typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params); -typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x); -GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y); -GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z); -GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); -GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x); -GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y); -GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); -GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); -GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params); -GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params); -GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); -GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); -GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x); -GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y); -GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); -GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); -GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); -GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x); -GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y); -GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); -GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); -GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); -#endif -#endif /* GL_ARB_gpu_shader_int64 */ - -#ifndef GL_ARB_half_float_pixel -#define GL_ARB_half_float_pixel 1 -typedef unsigned short GLhalfARB; -#define GL_HALF_FLOAT_ARB 0x140B -#endif /* GL_ARB_half_float_pixel */ - -#ifndef GL_ARB_half_float_vertex -#define GL_ARB_half_float_vertex 1 -#endif /* GL_ARB_half_float_vertex */ - -#ifndef GL_ARB_imaging -#define GL_ARB_imaging 1 -#define GL_BLEND_COLOR 0x8005 -#define GL_BLEND_EQUATION 0x8009 -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C -#define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E -#define GL_MINMAX_FORMAT 0x802F -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 -#define GL_COLOR_MATRIX 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 -#define GL_COLOR_TABLE_SCALE 0x80D6 -#define GL_COLOR_TABLE_BIAS 0x80D7 -#define GL_COLOR_TABLE_FORMAT 0x80D8 -#define GL_COLOR_TABLE_WIDTH 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 -typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); -GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, void *table); -GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); -GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); -GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); -GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params); -GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, void *image); -GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); -GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); -GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glResetHistogram (GLenum target); -GLAPI void APIENTRY glResetMinmax (GLenum target); -#endif -#endif /* GL_ARB_imaging */ - -#ifndef GL_ARB_indirect_parameters -#define GL_ARB_indirect_parameters 1 -#define GL_PARAMETER_BUFFER_ARB 0x80EE -#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -#endif -#endif /* GL_ARB_indirect_parameters */ - -#ifndef GL_ARB_instanced_arrays -#define GL_ARB_instanced_arrays 1 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor); -#endif -#endif /* GL_ARB_instanced_arrays */ - -#ifndef GL_ARB_internalformat_query -#define GL_ARB_internalformat_query 1 -#endif /* GL_ARB_internalformat_query */ - -#ifndef GL_ARB_internalformat_query2 -#define GL_ARB_internalformat_query2 1 -#define GL_SRGB_DECODE_ARB 0x8299 -#endif /* GL_ARB_internalformat_query2 */ - -#ifndef GL_ARB_invalidate_subdata -#define GL_ARB_invalidate_subdata 1 -#endif /* GL_ARB_invalidate_subdata */ - -#ifndef GL_ARB_map_buffer_alignment -#define GL_ARB_map_buffer_alignment 1 -#endif /* GL_ARB_map_buffer_alignment */ - -#ifndef GL_ARB_map_buffer_range -#define GL_ARB_map_buffer_range 1 -#endif /* GL_ARB_map_buffer_range */ - -#ifndef GL_ARB_matrix_palette -#define GL_ARB_matrix_palette 1 -#define GL_MATRIX_PALETTE_ARB 0x8840 -#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 -#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 -#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 -#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 -#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 -#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 -typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); -typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index); -GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices); -GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices); -GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices); -GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer); -#endif -#endif /* GL_ARB_matrix_palette */ - -#ifndef GL_ARB_multi_bind -#define GL_ARB_multi_bind 1 -#endif /* GL_ARB_multi_bind */ - -#ifndef GL_ARB_multi_draw_indirect -#define GL_ARB_multi_draw_indirect 1 -#endif /* GL_ARB_multi_draw_indirect */ - -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 -#define GL_MULTISAMPLE_ARB 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F -#define GL_SAMPLE_COVERAGE_ARB 0x80A0 -#define GL_SAMPLE_BUFFERS_ARB 0x80A8 -#define GL_SAMPLES_ARB 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert); -#endif -#endif /* GL_ARB_multisample */ - -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTextureARB (GLenum texture); -GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture); -GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s); -GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s); -GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s); -GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s); -GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); -GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); -GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); -GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); -GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); -GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); -GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v); -#endif -#endif /* GL_ARB_multitexture */ - -#ifndef GL_ARB_occlusion_query -#define GL_ARB_occlusion_query 1 -#define GL_QUERY_COUNTER_BITS_ARB 0x8864 -#define GL_CURRENT_QUERY_ARB 0x8865 -#define GL_QUERY_RESULT_ARB 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 -#define GL_SAMPLES_PASSED_ARB 0x8914 -typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id); -GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id); -GLAPI void APIENTRY glEndQueryARB (GLenum target); -GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); -#endif -#endif /* GL_ARB_occlusion_query */ - -#ifndef GL_ARB_occlusion_query2 -#define GL_ARB_occlusion_query2 1 -#endif /* GL_ARB_occlusion_query2 */ - -#ifndef GL_ARB_parallel_shader_compile -#define GL_ARB_parallel_shader_compile 1 -#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 -#define GL_COMPLETION_STATUS_ARB 0x91B1 -typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count); -#endif -#endif /* GL_ARB_parallel_shader_compile */ - -#ifndef GL_ARB_pipeline_statistics_query -#define GL_ARB_pipeline_statistics_query 1 -#define GL_VERTICES_SUBMITTED_ARB 0x82EE -#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF -#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 -#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 -#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 -#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 -#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 -#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 -#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 -#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 -#endif /* GL_ARB_pipeline_statistics_query */ - -#ifndef GL_ARB_pixel_buffer_object -#define GL_ARB_pixel_buffer_object 1 -#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF -#endif /* GL_ARB_pixel_buffer_object */ - -#ifndef GL_ARB_point_parameters -#define GL_ARB_point_parameters 1 -#define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); -#endif -#endif /* GL_ARB_point_parameters */ - -#ifndef GL_ARB_point_sprite -#define GL_ARB_point_sprite 1 -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif /* GL_ARB_point_sprite */ - -#ifndef GL_ARB_post_depth_coverage -#define GL_ARB_post_depth_coverage 1 -#endif /* GL_ARB_post_depth_coverage */ - -#ifndef GL_ARB_program_interface_query -#define GL_ARB_program_interface_query 1 -#endif /* GL_ARB_program_interface_query */ - -#ifndef GL_ARB_provoking_vertex -#define GL_ARB_provoking_vertex 1 -#endif /* GL_ARB_provoking_vertex */ - -#ifndef GL_ARB_query_buffer_object -#define GL_ARB_query_buffer_object 1 -#endif /* GL_ARB_query_buffer_object */ - -#ifndef GL_ARB_robust_buffer_access_behavior -#define GL_ARB_robust_buffer_access_behavior 1 -#endif /* GL_ARB_robust_buffer_access_behavior */ - -#ifndef GL_ARB_robustness -#define GL_ARB_robustness 1 -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 -typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); -typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); -typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img); -typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); -typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); -typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); -typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); -typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); -typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); -typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); -typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); -typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); -typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); -typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); -GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); -GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img); -GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); -GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); -GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v); -GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values); -GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values); -GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values); -GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern); -GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); -GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); -GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); -GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); -#endif -#endif /* GL_ARB_robustness */ - -#ifndef GL_ARB_robustness_isolation -#define GL_ARB_robustness_isolation 1 -#endif /* GL_ARB_robustness_isolation */ - -#ifndef GL_ARB_sample_locations -#define GL_ARB_sample_locations 1 -#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D -#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E -#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340 -#define GL_SAMPLE_LOCATION_ARB 0x8E50 -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341 -#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342 -#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343 -typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glEvaluateDepthValuesARB (void); -#endif -#endif /* GL_ARB_sample_locations */ - -#ifndef GL_ARB_sample_shading -#define GL_ARB_sample_shading 1 -#define GL_SAMPLE_SHADING_ARB 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); -#endif -#endif /* GL_ARB_sample_shading */ - -#ifndef GL_ARB_sampler_objects -#define GL_ARB_sampler_objects 1 -#endif /* GL_ARB_sampler_objects */ - -#ifndef GL_ARB_seamless_cube_map -#define GL_ARB_seamless_cube_map 1 -#endif /* GL_ARB_seamless_cube_map */ - -#ifndef GL_ARB_seamless_cubemap_per_texture -#define GL_ARB_seamless_cubemap_per_texture 1 -#endif /* GL_ARB_seamless_cubemap_per_texture */ - -#ifndef GL_ARB_separate_shader_objects -#define GL_ARB_separate_shader_objects 1 -#endif /* GL_ARB_separate_shader_objects */ - -#ifndef GL_ARB_shader_atomic_counter_ops -#define GL_ARB_shader_atomic_counter_ops 1 -#endif /* GL_ARB_shader_atomic_counter_ops */ - -#ifndef GL_ARB_shader_atomic_counters -#define GL_ARB_shader_atomic_counters 1 -#endif /* GL_ARB_shader_atomic_counters */ - -#ifndef GL_ARB_shader_ballot -#define GL_ARB_shader_ballot 1 -#endif /* GL_ARB_shader_ballot */ - -#ifndef GL_ARB_shader_bit_encoding -#define GL_ARB_shader_bit_encoding 1 -#endif /* GL_ARB_shader_bit_encoding */ - -#ifndef GL_ARB_shader_clock -#define GL_ARB_shader_clock 1 -#endif /* GL_ARB_shader_clock */ - -#ifndef GL_ARB_shader_draw_parameters -#define GL_ARB_shader_draw_parameters 1 -#endif /* GL_ARB_shader_draw_parameters */ - -#ifndef GL_ARB_shader_group_vote -#define GL_ARB_shader_group_vote 1 -#endif /* GL_ARB_shader_group_vote */ - -#ifndef GL_ARB_shader_image_load_store -#define GL_ARB_shader_image_load_store 1 -#endif /* GL_ARB_shader_image_load_store */ - -#ifndef GL_ARB_shader_image_size -#define GL_ARB_shader_image_size 1 -#endif /* GL_ARB_shader_image_size */ - -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -#ifdef __APPLE__ -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif -typedef char GLcharARB; -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_SHADER_OBJECT_ARB 0x8B48 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); -typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); -typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); -typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); -typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); -typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj); -GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname); -GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); -GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType); -GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); -GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj); -GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); -GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); -GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj); -GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj); -GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj); -GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0); -GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0); -GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); -GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); -GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); -GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#endif -#endif /* GL_ARB_shader_objects */ - -#ifndef GL_ARB_shader_precision -#define GL_ARB_shader_precision 1 -#endif /* GL_ARB_shader_precision */ - -#ifndef GL_ARB_shader_stencil_export -#define GL_ARB_shader_stencil_export 1 -#endif /* GL_ARB_shader_stencil_export */ - -#ifndef GL_ARB_shader_storage_buffer_object -#define GL_ARB_shader_storage_buffer_object 1 -#endif /* GL_ARB_shader_storage_buffer_object */ - -#ifndef GL_ARB_shader_subroutine -#define GL_ARB_shader_subroutine 1 -#endif /* GL_ARB_shader_subroutine */ - -#ifndef GL_ARB_shader_texture_image_samples -#define GL_ARB_shader_texture_image_samples 1 -#endif /* GL_ARB_shader_texture_image_samples */ - -#ifndef GL_ARB_shader_texture_lod -#define GL_ARB_shader_texture_lod 1 -#endif /* GL_ARB_shader_texture_lod */ - -#ifndef GL_ARB_shader_viewport_layer_array -#define GL_ARB_shader_viewport_layer_array 1 -#endif /* GL_ARB_shader_viewport_layer_array */ - -#ifndef GL_ARB_shading_language_100 -#define GL_ARB_shading_language_100 1 -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C -#endif /* GL_ARB_shading_language_100 */ - -#ifndef GL_ARB_shading_language_420pack -#define GL_ARB_shading_language_420pack 1 -#endif /* GL_ARB_shading_language_420pack */ - -#ifndef GL_ARB_shading_language_include -#define GL_ARB_shading_language_include 1 -#define GL_SHADER_INCLUDE_ARB 0x8DAE -#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 -#define GL_NAMED_STRING_TYPE_ARB 0x8DEA -typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); -typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); -GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#endif -#endif /* GL_ARB_shading_language_include */ - -#ifndef GL_ARB_shading_language_packing -#define GL_ARB_shading_language_packing 1 -#endif /* GL_ARB_shading_language_packing */ - -#ifndef GL_ARB_shadow -#define GL_ARB_shadow 1 -#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C -#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D -#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E -#endif /* GL_ARB_shadow */ - -#ifndef GL_ARB_shadow_ambient -#define GL_ARB_shadow_ambient 1 -#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF -#endif /* GL_ARB_shadow_ambient */ - -#ifndef GL_ARB_sparse_buffer -#define GL_ARB_sparse_buffer 1 -#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 -#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 -typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); -typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); -GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); -#endif -#endif /* GL_ARB_sparse_buffer */ - -#ifndef GL_ARB_sparse_texture -#define GL_ARB_sparse_texture 1 -#define GL_TEXTURE_SPARSE_ARB 0x91A6 -#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 -#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA -#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 -#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 -#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 -#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 -#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 -#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 -#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A -#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 -typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); -#endif -#endif /* GL_ARB_sparse_texture */ - -#ifndef GL_ARB_sparse_texture2 -#define GL_ARB_sparse_texture2 1 -#endif /* GL_ARB_sparse_texture2 */ - -#ifndef GL_ARB_sparse_texture_clamp -#define GL_ARB_sparse_texture_clamp 1 -#endif /* GL_ARB_sparse_texture_clamp */ - -#ifndef GL_ARB_stencil_texturing -#define GL_ARB_stencil_texturing 1 -#endif /* GL_ARB_stencil_texturing */ - -#ifndef GL_ARB_sync -#define GL_ARB_sync 1 -#endif /* GL_ARB_sync */ - -#ifndef GL_ARB_tessellation_shader -#define GL_ARB_tessellation_shader 1 -#endif /* GL_ARB_tessellation_shader */ - -#ifndef GL_ARB_texture_barrier -#define GL_ARB_texture_barrier 1 -#endif /* GL_ARB_texture_barrier */ - -#ifndef GL_ARB_texture_border_clamp -#define GL_ARB_texture_border_clamp 1 -#define GL_CLAMP_TO_BORDER_ARB 0x812D -#endif /* GL_ARB_texture_border_clamp */ - -#ifndef GL_ARB_texture_buffer_object -#define GL_ARB_texture_buffer_object 1 -#define GL_TEXTURE_BUFFER_ARB 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E -typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer); -#endif -#endif /* GL_ARB_texture_buffer_object */ - -#ifndef GL_ARB_texture_buffer_object_rgb32 -#define GL_ARB_texture_buffer_object_rgb32 1 -#endif /* GL_ARB_texture_buffer_object_rgb32 */ - -#ifndef GL_ARB_texture_buffer_range -#define GL_ARB_texture_buffer_range 1 -#endif /* GL_ARB_texture_buffer_range */ - -#ifndef GL_ARB_texture_compression -#define GL_ARB_texture_compression 1 -#define GL_COMPRESSED_ALPHA_ARB 0x84E9 -#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB -#define GL_COMPRESSED_INTENSITY_ARB 0x84EC -#define GL_COMPRESSED_RGB_ARB 0x84ED -#define GL_COMPRESSED_RGBA_ARB 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 -#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void *img); -#endif -#endif /* GL_ARB_texture_compression */ - -#ifndef GL_ARB_texture_compression_bptc -#define GL_ARB_texture_compression_bptc 1 -#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F -#endif /* GL_ARB_texture_compression_bptc */ - -#ifndef GL_ARB_texture_compression_rgtc -#define GL_ARB_texture_compression_rgtc 1 -#endif /* GL_ARB_texture_compression_rgtc */ - -#ifndef GL_ARB_texture_cube_map -#define GL_ARB_texture_cube_map 1 -#define GL_NORMAL_MAP_ARB 0x8511 -#define GL_REFLECTION_MAP_ARB 0x8512 -#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C -#endif /* GL_ARB_texture_cube_map */ - -#ifndef GL_ARB_texture_cube_map_array -#define GL_ARB_texture_cube_map_array 1 -#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F -#endif /* GL_ARB_texture_cube_map_array */ - -#ifndef GL_ARB_texture_env_add -#define GL_ARB_texture_env_add 1 -#endif /* GL_ARB_texture_env_add */ - -#ifndef GL_ARB_texture_env_combine -#define GL_ARB_texture_env_combine 1 -#define GL_COMBINE_ARB 0x8570 -#define GL_COMBINE_RGB_ARB 0x8571 -#define GL_COMBINE_ALPHA_ARB 0x8572 -#define GL_SOURCE0_RGB_ARB 0x8580 -#define GL_SOURCE1_RGB_ARB 0x8581 -#define GL_SOURCE2_RGB_ARB 0x8582 -#define GL_SOURCE0_ALPHA_ARB 0x8588 -#define GL_SOURCE1_ALPHA_ARB 0x8589 -#define GL_SOURCE2_ALPHA_ARB 0x858A -#define GL_OPERAND0_RGB_ARB 0x8590 -#define GL_OPERAND1_RGB_ARB 0x8591 -#define GL_OPERAND2_RGB_ARB 0x8592 -#define GL_OPERAND0_ALPHA_ARB 0x8598 -#define GL_OPERAND1_ALPHA_ARB 0x8599 -#define GL_OPERAND2_ALPHA_ARB 0x859A -#define GL_RGB_SCALE_ARB 0x8573 -#define GL_ADD_SIGNED_ARB 0x8574 -#define GL_INTERPOLATE_ARB 0x8575 -#define GL_SUBTRACT_ARB 0x84E7 -#define GL_CONSTANT_ARB 0x8576 -#define GL_PRIMARY_COLOR_ARB 0x8577 -#define GL_PREVIOUS_ARB 0x8578 -#endif /* GL_ARB_texture_env_combine */ - -#ifndef GL_ARB_texture_env_crossbar -#define GL_ARB_texture_env_crossbar 1 -#endif /* GL_ARB_texture_env_crossbar */ - -#ifndef GL_ARB_texture_env_dot3 -#define GL_ARB_texture_env_dot3 1 -#define GL_DOT3_RGB_ARB 0x86AE -#define GL_DOT3_RGBA_ARB 0x86AF -#endif /* GL_ARB_texture_env_dot3 */ - -#ifndef GL_ARB_texture_filter_minmax -#define GL_ARB_texture_filter_minmax 1 -#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366 -#define GL_WEIGHTED_AVERAGE_ARB 0x9367 -#endif /* GL_ARB_texture_filter_minmax */ - -#ifndef GL_ARB_texture_float -#define GL_ARB_texture_float 1 -#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 -#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 -#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 -#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_ALPHA32F_ARB 0x8816 -#define GL_INTENSITY32F_ARB 0x8817 -#define GL_LUMINANCE32F_ARB 0x8818 -#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 -#define GL_RGBA16F_ARB 0x881A -#define GL_RGB16F_ARB 0x881B -#define GL_ALPHA16F_ARB 0x881C -#define GL_INTENSITY16F_ARB 0x881D -#define GL_LUMINANCE16F_ARB 0x881E -#define GL_LUMINANCE_ALPHA16F_ARB 0x881F -#endif /* GL_ARB_texture_float */ - -#ifndef GL_ARB_texture_gather -#define GL_ARB_texture_gather 1 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F -#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F -#endif /* GL_ARB_texture_gather */ - -#ifndef GL_ARB_texture_mirror_clamp_to_edge -#define GL_ARB_texture_mirror_clamp_to_edge 1 -#endif /* GL_ARB_texture_mirror_clamp_to_edge */ - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_ARB_texture_mirrored_repeat 1 -#define GL_MIRRORED_REPEAT_ARB 0x8370 -#endif /* GL_ARB_texture_mirrored_repeat */ - -#ifndef GL_ARB_texture_multisample -#define GL_ARB_texture_multisample 1 -#endif /* GL_ARB_texture_multisample */ - -#ifndef GL_ARB_texture_non_power_of_two -#define GL_ARB_texture_non_power_of_two 1 -#endif /* GL_ARB_texture_non_power_of_two */ - -#ifndef GL_ARB_texture_query_levels -#define GL_ARB_texture_query_levels 1 -#endif /* GL_ARB_texture_query_levels */ - -#ifndef GL_ARB_texture_query_lod -#define GL_ARB_texture_query_lod 1 -#endif /* GL_ARB_texture_query_lod */ - -#ifndef GL_ARB_texture_rectangle -#define GL_ARB_texture_rectangle 1 -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 -#endif /* GL_ARB_texture_rectangle */ - -#ifndef GL_ARB_texture_rg -#define GL_ARB_texture_rg 1 -#endif /* GL_ARB_texture_rg */ - -#ifndef GL_ARB_texture_rgb10_a2ui -#define GL_ARB_texture_rgb10_a2ui 1 -#endif /* GL_ARB_texture_rgb10_a2ui */ - -#ifndef GL_ARB_texture_stencil8 -#define GL_ARB_texture_stencil8 1 -#endif /* GL_ARB_texture_stencil8 */ - -#ifndef GL_ARB_texture_storage -#define GL_ARB_texture_storage 1 -#endif /* GL_ARB_texture_storage */ - -#ifndef GL_ARB_texture_storage_multisample -#define GL_ARB_texture_storage_multisample 1 -#endif /* GL_ARB_texture_storage_multisample */ - -#ifndef GL_ARB_texture_swizzle -#define GL_ARB_texture_swizzle 1 -#endif /* GL_ARB_texture_swizzle */ - -#ifndef GL_ARB_texture_view -#define GL_ARB_texture_view 1 -#endif /* GL_ARB_texture_view */ - -#ifndef GL_ARB_timer_query -#define GL_ARB_timer_query 1 -#endif /* GL_ARB_timer_query */ - -#ifndef GL_ARB_transform_feedback2 -#define GL_ARB_transform_feedback2 1 -#endif /* GL_ARB_transform_feedback2 */ - -#ifndef GL_ARB_transform_feedback3 -#define GL_ARB_transform_feedback3 1 -#endif /* GL_ARB_transform_feedback3 */ - -#ifndef GL_ARB_transform_feedback_instanced -#define GL_ARB_transform_feedback_instanced 1 -#endif /* GL_ARB_transform_feedback_instanced */ - -#ifndef GL_ARB_transform_feedback_overflow_query -#define GL_ARB_transform_feedback_overflow_query 1 -#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC -#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED -#endif /* GL_ARB_transform_feedback_overflow_query */ - -#ifndef GL_ARB_transpose_matrix -#define GL_ARB_transpose_matrix 1 -#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m); -GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m); -GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m); -GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); -#endif -#endif /* GL_ARB_transpose_matrix */ - -#ifndef GL_ARB_uniform_buffer_object -#define GL_ARB_uniform_buffer_object 1 -#endif /* GL_ARB_uniform_buffer_object */ - -#ifndef GL_ARB_vertex_array_bgra -#define GL_ARB_vertex_array_bgra 1 -#endif /* GL_ARB_vertex_array_bgra */ - -#ifndef GL_ARB_vertex_array_object -#define GL_ARB_vertex_array_object 1 -#endif /* GL_ARB_vertex_array_object */ - -#ifndef GL_ARB_vertex_attrib_64bit -#define GL_ARB_vertex_attrib_64bit 1 -#endif /* GL_ARB_vertex_attrib_64bit */ - -#ifndef GL_ARB_vertex_attrib_binding -#define GL_ARB_vertex_attrib_binding 1 -#endif /* GL_ARB_vertex_attrib_binding */ - -#ifndef GL_ARB_vertex_blend -#define GL_ARB_vertex_blend 1 -#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 -#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 -#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 -#define GL_VERTEX_BLEND_ARB 0x86A7 -#define GL_CURRENT_WEIGHT_ARB 0x86A8 -#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA -#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB -#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC -#define GL_WEIGHT_ARRAY_ARB 0x86AD -#define GL_MODELVIEW0_ARB 0x1700 -#define GL_MODELVIEW1_ARB 0x850A -#define GL_MODELVIEW2_ARB 0x8722 -#define GL_MODELVIEW3_ARB 0x8723 -#define GL_MODELVIEW4_ARB 0x8724 -#define GL_MODELVIEW5_ARB 0x8725 -#define GL_MODELVIEW6_ARB 0x8726 -#define GL_MODELVIEW7_ARB 0x8727 -#define GL_MODELVIEW8_ARB 0x8728 -#define GL_MODELVIEW9_ARB 0x8729 -#define GL_MODELVIEW10_ARB 0x872A -#define GL_MODELVIEW11_ARB 0x872B -#define GL_MODELVIEW12_ARB 0x872C -#define GL_MODELVIEW13_ARB 0x872D -#define GL_MODELVIEW14_ARB 0x872E -#define GL_MODELVIEW15_ARB 0x872F -#define GL_MODELVIEW16_ARB 0x8730 -#define GL_MODELVIEW17_ARB 0x8731 -#define GL_MODELVIEW18_ARB 0x8732 -#define GL_MODELVIEW19_ARB 0x8733 -#define GL_MODELVIEW20_ARB 0x8734 -#define GL_MODELVIEW21_ARB 0x8735 -#define GL_MODELVIEW22_ARB 0x8736 -#define GL_MODELVIEW23_ARB 0x8737 -#define GL_MODELVIEW24_ARB 0x8738 -#define GL_MODELVIEW25_ARB 0x8739 -#define GL_MODELVIEW26_ARB 0x873A -#define GL_MODELVIEW27_ARB 0x873B -#define GL_MODELVIEW28_ARB 0x873C -#define GL_MODELVIEW29_ARB 0x873D -#define GL_MODELVIEW30_ARB 0x873E -#define GL_MODELVIEW31_ARB 0x873F -typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); -typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); -typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); -typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); -typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); -typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); -typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights); -GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights); -GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights); -GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights); -GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights); -GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights); -GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights); -GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights); -GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glVertexBlendARB (GLint count); -#endif -#endif /* GL_ARB_vertex_blend */ - -#ifndef GL_ARB_vertex_buffer_object -#define GL_ARB_vertex_buffer_object 1 -typedef ptrdiff_t GLsizeiptrARB; -typedef ptrdiff_t GLintptrARB; -#define GL_BUFFER_SIZE_ARB 0x8764 -#define GL_BUFFER_USAGE_ARB 0x8765 -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F -#define GL_READ_ONLY_ARB 0x88B8 -#define GL_WRITE_ONLY_ARB 0x88B9 -#define GL_READ_WRITE_ARB 0x88BA -#define GL_BUFFER_ACCESS_ARB 0x88BB -#define GL_BUFFER_MAPPED_ARB 0x88BC -#define GL_BUFFER_MAP_POINTER_ARB 0x88BD -#define GL_STREAM_DRAW_ARB 0x88E0 -#define GL_STREAM_READ_ARB 0x88E1 -#define GL_STREAM_COPY_ARB 0x88E2 -#define GL_STATIC_DRAW_ARB 0x88E4 -#define GL_STATIC_READ_ARB 0x88E5 -#define GL_STATIC_COPY_ARB 0x88E6 -#define GL_DYNAMIC_DRAW_ARB 0x88E8 -#define GL_DYNAMIC_READ_ARB 0x88E9 -#define GL_DYNAMIC_COPY_ARB 0x88EA -typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); -typedef void *(APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void **params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer); -GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers); -GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers); -GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer); -GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); -GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); -GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); -GLAPI void *APIENTRY glMapBufferARB (GLenum target, GLenum access); -GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target); -GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, void **params); -#endif -#endif /* GL_ARB_vertex_buffer_object */ - -#ifndef GL_ARB_vertex_program -#define GL_ARB_vertex_program 1 -#define GL_COLOR_SUM_ARB 0x8458 -#define GL_VERTEX_PROGRAM_ARB 0x8620 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A -#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 -#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 -#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 -#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index); -GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index); -GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, void **pointer); -#endif -#endif /* GL_ARB_vertex_program */ - -#ifndef GL_ARB_vertex_shader -#define GL_ARB_vertex_shader 1 -#define GL_VERTEX_SHADER_ARB 0x8B31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A -#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); -GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); -#endif -#endif /* GL_ARB_vertex_shader */ - -#ifndef GL_ARB_vertex_type_10f_11f_11f_rev -#define GL_ARB_vertex_type_10f_11f_11f_rev 1 -#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ - -#ifndef GL_ARB_vertex_type_2_10_10_10_rev -#define GL_ARB_vertex_type_2_10_10_10_rev 1 -#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ - -#ifndef GL_ARB_viewport_array -#define GL_ARB_viewport_array 1 -#endif /* GL_ARB_viewport_array */ - -#ifndef GL_ARB_window_pos -#define GL_ARB_window_pos 1 -typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y); -GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v); -GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y); -GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v); -GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y); -GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v); -GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y); -GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v); -GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v); -GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v); -GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z); -GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v); -GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); -#endif -#endif /* GL_ARB_window_pos */ - -#ifndef GL_KHR_blend_equation_advanced -#define GL_KHR_blend_equation_advanced 1 -#define GL_MULTIPLY_KHR 0x9294 -#define GL_SCREEN_KHR 0x9295 -#define GL_OVERLAY_KHR 0x9296 -#define GL_DARKEN_KHR 0x9297 -#define GL_LIGHTEN_KHR 0x9298 -#define GL_COLORDODGE_KHR 0x9299 -#define GL_COLORBURN_KHR 0x929A -#define GL_HARDLIGHT_KHR 0x929B -#define GL_SOFTLIGHT_KHR 0x929C -#define GL_DIFFERENCE_KHR 0x929E -#define GL_EXCLUSION_KHR 0x92A0 -#define GL_HSL_HUE_KHR 0x92AD -#define GL_HSL_SATURATION_KHR 0x92AE -#define GL_HSL_COLOR_KHR 0x92AF -#define GL_HSL_LUMINOSITY_KHR 0x92B0 -typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendBarrierKHR (void); -#endif -#endif /* GL_KHR_blend_equation_advanced */ - -#ifndef GL_KHR_blend_equation_advanced_coherent -#define GL_KHR_blend_equation_advanced_coherent 1 -#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 -#endif /* GL_KHR_blend_equation_advanced_coherent */ - -#ifndef GL_KHR_context_flush_control -#define GL_KHR_context_flush_control 1 -#endif /* GL_KHR_context_flush_control */ - -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -#endif /* GL_KHR_debug */ - -#ifndef GL_KHR_no_error -#define GL_KHR_no_error 1 -#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 -#endif /* GL_KHR_no_error */ - -#ifndef GL_KHR_robust_buffer_access_behavior -#define GL_KHR_robust_buffer_access_behavior 1 -#endif /* GL_KHR_robust_buffer_access_behavior */ - -#ifndef GL_KHR_robustness -#define GL_KHR_robustness 1 -#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 -#endif /* GL_KHR_robustness */ - -#ifndef GL_KHR_texture_compression_astc_hdr -#define GL_KHR_texture_compression_astc_hdr 1 -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif /* GL_KHR_texture_compression_astc_hdr */ - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 -#endif /* GL_KHR_texture_compression_astc_ldr */ - -#ifndef GL_KHR_texture_compression_astc_sliced_3d -#define GL_KHR_texture_compression_astc_sliced_3d 1 -#endif /* GL_KHR_texture_compression_astc_sliced_3d */ - -#ifndef GL_OES_byte_coordinates -#define GL_OES_byte_coordinates 1 -typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords); -typedef void (APIENTRYP PFNGLTEXCOORD1BOESPROC) (GLbyte s); -typedef void (APIENTRYP PFNGLTEXCOORD1BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t); -typedef void (APIENTRYP PFNGLTEXCOORD2BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); -typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); -typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x, GLbyte y); -typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y, GLbyte z); -typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z, GLbyte w); -typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s); -GLAPI void APIENTRY glMultiTexCoord1bvOES (GLenum texture, const GLbyte *coords); -GLAPI void APIENTRY glMultiTexCoord2bOES (GLenum texture, GLbyte s, GLbyte t); -GLAPI void APIENTRY glMultiTexCoord2bvOES (GLenum texture, const GLbyte *coords); -GLAPI void APIENTRY glMultiTexCoord3bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r); -GLAPI void APIENTRY glMultiTexCoord3bvOES (GLenum texture, const GLbyte *coords); -GLAPI void APIENTRY glMultiTexCoord4bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); -GLAPI void APIENTRY glMultiTexCoord4bvOES (GLenum texture, const GLbyte *coords); -GLAPI void APIENTRY glTexCoord1bOES (GLbyte s); -GLAPI void APIENTRY glTexCoord1bvOES (const GLbyte *coords); -GLAPI void APIENTRY glTexCoord2bOES (GLbyte s, GLbyte t); -GLAPI void APIENTRY glTexCoord2bvOES (const GLbyte *coords); -GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r); -GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords); -GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q); -GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex2bOES (GLbyte x, GLbyte y); -GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y, GLbyte z); -GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z, GLbyte w); -GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); -#endif -#endif /* GL_OES_byte_coordinates */ - -#ifndef GL_OES_compressed_paletted_texture -#define GL_OES_compressed_paletted_texture 1 -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif /* GL_OES_compressed_paletted_texture */ - -#ifndef GL_OES_fixed_point -#define GL_OES_fixed_point 1 -typedef GLint GLfixed; -#define GL_FIXED_OES 0x140C -typedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref); -typedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -typedef void (APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth); -typedef void (APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); -typedef void (APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -typedef void (APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f); -typedef void (APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param); -typedef void (APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -typedef void (APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation); -typedef void (APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param); -typedef void (APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); -typedef void (APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); -typedef void (APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); -typedef void (APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param); -typedef void (APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -typedef void (APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); -typedef void (APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); -typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); -typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); -typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); -typedef void (APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLACCUMXOESPROC) (GLenum op, GLfixed value); -typedef void (APIENTRYP PFNGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); -typedef void (APIENTRYP PFNGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -typedef void (APIENTRYP PFNGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -typedef void (APIENTRYP PFNGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue); -typedef void (APIENTRYP PFNGLCOLOR3XVOESPROC) (const GLfixed *components); -typedef void (APIENTRYP PFNGLCOLOR4XVOESPROC) (const GLfixed *components); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); -typedef void (APIENTRYP PFNGLEVALCOORD1XOESPROC) (GLfixed u); -typedef void (APIENTRYP PFNGLEVALCOORD1XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v); -typedef void (APIENTRYP PFNGLEVALCOORD2XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v); -typedef void (APIENTRYP PFNGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values); -typedef void (APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params); -typedef void (APIENTRYP PFNGLINDEXXOESPROC) (GLfixed component); -typedef void (APIENTRYP PFNGLINDEXXVOESPROC) (const GLfixed *component); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); -typedef void (APIENTRYP PFNGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); -typedef void (APIENTRYP PFNGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); -typedef void (APIENTRYP PFNGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2); -typedef void (APIENTRYP PFNGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords); -typedef void (APIENTRYP PFNGLNORMAL3XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLPASSTHROUGHXOESPROC) (GLfixed token); -typedef void (APIENTRYP PFNGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values); -typedef void (APIENTRYP PFNGLPIXELSTOREXPROC) (GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor); -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities); -typedef void (APIENTRYP PFNGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y); -typedef void (APIENTRYP PFNGLRASTERPOS2XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLRASTERPOS3XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w); -typedef void (APIENTRYP PFNGLRASTERPOS4XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); -typedef void (APIENTRYP PFNGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2); -typedef void (APIENTRYP PFNGLTEXCOORD1XOESPROC) (GLfixed s); -typedef void (APIENTRYP PFNGLTEXCOORD1XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t); -typedef void (APIENTRYP PFNGLTEXCOORD2XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r); -typedef void (APIENTRYP PFNGLTEXCOORD3XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q); -typedef void (APIENTRYP PFNGLTEXCOORD4XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); -typedef void (APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); -typedef void (APIENTRYP PFNGLVERTEX2XOESPROC) (GLfixed x); -typedef void (APIENTRYP PFNGLVERTEX2XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLVERTEX3XOESPROC) (GLfixed x, GLfixed y); -typedef void (APIENTRYP PFNGLVERTEX3XVOESPROC) (const GLfixed *coords); -typedef void (APIENTRYP PFNGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLVERTEX4XVOESPROC) (const GLfixed *coords); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref); -GLAPI void APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI void APIENTRY glClearDepthxOES (GLfixed depth); -GLAPI void APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); -GLAPI void APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI void APIENTRY glDepthRangexOES (GLfixed n, GLfixed f); -GLAPI void APIENTRY glFogxOES (GLenum pname, GLfixed param); -GLAPI void APIENTRY glFogxvOES (GLenum pname, const GLfixed *param); -GLAPI void APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -GLAPI void APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation); -GLAPI void APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); -GLAPI void APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glLightModelxOES (GLenum pname, GLfixed param); -GLAPI void APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param); -GLAPI void APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); -GLAPI void APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); -GLAPI void APIENTRY glLineWidthxOES (GLfixed width); -GLAPI void APIENTRY glLoadMatrixxOES (const GLfixed *m); -GLAPI void APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); -GLAPI void APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param); -GLAPI void APIENTRY glMultMatrixxOES (const GLfixed *m); -GLAPI void APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -GLAPI void APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); -GLAPI void APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); -GLAPI void APIENTRY glPointSizexOES (GLfixed size); -GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); -GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); -GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); -GLAPI void APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); -GLAPI void APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); -GLAPI void APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glAccumxOES (GLenum op, GLfixed value); -GLAPI void APIENTRY glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); -GLAPI void APIENTRY glBlendColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI void APIENTRY glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI void APIENTRY glColor3xOES (GLfixed red, GLfixed green, GLfixed blue); -GLAPI void APIENTRY glColor3xvOES (const GLfixed *components); -GLAPI void APIENTRY glColor4xvOES (const GLfixed *components); -GLAPI void APIENTRY glConvolutionParameterxOES (GLenum target, GLenum pname, GLfixed param); -GLAPI void APIENTRY glConvolutionParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); -GLAPI void APIENTRY glEvalCoord1xOES (GLfixed u); -GLAPI void APIENTRY glEvalCoord1xvOES (const GLfixed *coords); -GLAPI void APIENTRY glEvalCoord2xOES (GLfixed u, GLfixed v); -GLAPI void APIENTRY glEvalCoord2xvOES (const GLfixed *coords); -GLAPI void APIENTRY glFeedbackBufferxOES (GLsizei n, GLenum type, const GLfixed *buffer); -GLAPI void APIENTRY glGetConvolutionParameterxvOES (GLenum target, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glGetHistogramParameterxvOES (GLenum target, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glGetLightxOES (GLenum light, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glGetMapxvOES (GLenum target, GLenum query, GLfixed *v); -GLAPI void APIENTRY glGetMaterialxOES (GLenum face, GLenum pname, GLfixed param); -GLAPI void APIENTRY glGetPixelMapxv (GLenum map, GLint size, GLfixed *values); -GLAPI void APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glGetTexLevelParameterxvOES (GLenum target, GLint level, GLenum pname, GLfixed *params); -GLAPI void APIENTRY glIndexxOES (GLfixed component); -GLAPI void APIENTRY glIndexxvOES (const GLfixed *component); -GLAPI void APIENTRY glLoadTransposeMatrixxOES (const GLfixed *m); -GLAPI void APIENTRY glMap1xOES (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); -GLAPI void APIENTRY glMap2xOES (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); -GLAPI void APIENTRY glMapGrid1xOES (GLint n, GLfixed u1, GLfixed u2); -GLAPI void APIENTRY glMapGrid2xOES (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); -GLAPI void APIENTRY glMultTransposeMatrixxOES (const GLfixed *m); -GLAPI void APIENTRY glMultiTexCoord1xOES (GLenum texture, GLfixed s); -GLAPI void APIENTRY glMultiTexCoord1xvOES (GLenum texture, const GLfixed *coords); -GLAPI void APIENTRY glMultiTexCoord2xOES (GLenum texture, GLfixed s, GLfixed t); -GLAPI void APIENTRY glMultiTexCoord2xvOES (GLenum texture, const GLfixed *coords); -GLAPI void APIENTRY glMultiTexCoord3xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r); -GLAPI void APIENTRY glMultiTexCoord3xvOES (GLenum texture, const GLfixed *coords); -GLAPI void APIENTRY glMultiTexCoord4xvOES (GLenum texture, const GLfixed *coords); -GLAPI void APIENTRY glNormal3xvOES (const GLfixed *coords); -GLAPI void APIENTRY glPassThroughxOES (GLfixed token); -GLAPI void APIENTRY glPixelMapx (GLenum map, GLint size, const GLfixed *values); -GLAPI void APIENTRY glPixelStorex (GLenum pname, GLfixed param); -GLAPI void APIENTRY glPixelTransferxOES (GLenum pname, GLfixed param); -GLAPI void APIENTRY glPixelZoomxOES (GLfixed xfactor, GLfixed yfactor); -GLAPI void APIENTRY glPrioritizeTexturesxOES (GLsizei n, const GLuint *textures, const GLfixed *priorities); -GLAPI void APIENTRY glRasterPos2xOES (GLfixed x, GLfixed y); -GLAPI void APIENTRY glRasterPos2xvOES (const GLfixed *coords); -GLAPI void APIENTRY glRasterPos3xOES (GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glRasterPos3xvOES (const GLfixed *coords); -GLAPI void APIENTRY glRasterPos4xOES (GLfixed x, GLfixed y, GLfixed z, GLfixed w); -GLAPI void APIENTRY glRasterPos4xvOES (const GLfixed *coords); -GLAPI void APIENTRY glRectxOES (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); -GLAPI void APIENTRY glRectxvOES (const GLfixed *v1, const GLfixed *v2); -GLAPI void APIENTRY glTexCoord1xOES (GLfixed s); -GLAPI void APIENTRY glTexCoord1xvOES (const GLfixed *coords); -GLAPI void APIENTRY glTexCoord2xOES (GLfixed s, GLfixed t); -GLAPI void APIENTRY glTexCoord2xvOES (const GLfixed *coords); -GLAPI void APIENTRY glTexCoord3xOES (GLfixed s, GLfixed t, GLfixed r); -GLAPI void APIENTRY glTexCoord3xvOES (const GLfixed *coords); -GLAPI void APIENTRY glTexCoord4xOES (GLfixed s, GLfixed t, GLfixed r, GLfixed q); -GLAPI void APIENTRY glTexCoord4xvOES (const GLfixed *coords); -GLAPI void APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); -GLAPI void APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); -GLAPI void APIENTRY glVertex2xOES (GLfixed x); -GLAPI void APIENTRY glVertex2xvOES (const GLfixed *coords); -GLAPI void APIENTRY glVertex3xOES (GLfixed x, GLfixed y); -GLAPI void APIENTRY glVertex3xvOES (const GLfixed *coords); -GLAPI void APIENTRY glVertex4xOES (GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glVertex4xvOES (const GLfixed *coords); -#endif -#endif /* GL_OES_fixed_point */ - -#ifndef GL_OES_query_matrix -#define GL_OES_query_matrix 1 -typedef GLbitfield (APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLbitfield APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent); -#endif -#endif /* GL_OES_query_matrix */ - -#ifndef GL_OES_read_format -#define GL_OES_read_format 1 -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#endif /* GL_OES_read_format */ - -#ifndef GL_OES_single_precision -#define GL_OES_single_precision 1 -typedef void (APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); -typedef void (APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); -typedef void (APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); -typedef void (APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -typedef void (APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation); -typedef void (APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClearDepthfOES (GLclampf depth); -GLAPI void APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); -GLAPI void APIENTRY glDepthRangefOES (GLclampf n, GLclampf f); -GLAPI void APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -GLAPI void APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation); -GLAPI void APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -#endif -#endif /* GL_OES_single_precision */ - -#ifndef GL_3DFX_multisample -#define GL_3DFX_multisample 1 -#define GL_MULTISAMPLE_3DFX 0x86B2 -#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 -#define GL_SAMPLES_3DFX 0x86B4 -#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 -#endif /* GL_3DFX_multisample */ - -#ifndef GL_3DFX_tbuffer -#define GL_3DFX_tbuffer 1 -typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask); -#endif -#endif /* GL_3DFX_tbuffer */ - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_3DFX_texture_compression_FXT1 1 -#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 -#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 -#endif /* GL_3DFX_texture_compression_FXT1 */ - -#ifndef GL_AMD_blend_minmax_factor -#define GL_AMD_blend_minmax_factor 1 -#define GL_FACTOR_MIN_AMD 0x901C -#define GL_FACTOR_MAX_AMD 0x901D -#endif /* GL_AMD_blend_minmax_factor */ - -#ifndef GL_AMD_conservative_depth -#define GL_AMD_conservative_depth 1 -#endif /* GL_AMD_conservative_depth */ - -#ifndef GL_AMD_debug_output -#define GL_AMD_debug_output 1 -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); -#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 -#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 -#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 -#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A -#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B -#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C -#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D -#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E -#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F -#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 -typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); -#endif -#endif /* GL_AMD_debug_output */ - -#ifndef GL_AMD_depth_clamp_separate -#define GL_AMD_depth_clamp_separate 1 -#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E -#define GL_DEPTH_CLAMP_FAR_AMD 0x901F -#endif /* GL_AMD_depth_clamp_separate */ - -#ifndef GL_AMD_draw_buffers_blend -#define GL_AMD_draw_buffers_blend 1 -typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -#endif -#endif /* GL_AMD_draw_buffers_blend */ - -#ifndef GL_AMD_gcn_shader -#define GL_AMD_gcn_shader 1 -#endif /* GL_AMD_gcn_shader */ - -#ifndef GL_AMD_gpu_shader_half_float -#define GL_AMD_gpu_shader_half_float 1 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB -#define GL_FLOAT16_MAT2_AMD 0x91C5 -#define GL_FLOAT16_MAT3_AMD 0x91C6 -#define GL_FLOAT16_MAT4_AMD 0x91C7 -#define GL_FLOAT16_MAT2x3_AMD 0x91C8 -#define GL_FLOAT16_MAT2x4_AMD 0x91C9 -#define GL_FLOAT16_MAT3x2_AMD 0x91CA -#define GL_FLOAT16_MAT3x4_AMD 0x91CB -#define GL_FLOAT16_MAT4x2_AMD 0x91CC -#define GL_FLOAT16_MAT4x3_AMD 0x91CD -#endif /* GL_AMD_gpu_shader_half_float */ - -#ifndef GL_AMD_gpu_shader_int64 -#define GL_AMD_gpu_shader_int64 1 -typedef int64_t GLint64EXT; -#define GL_INT64_NV 0x140E -#define GL_UNSIGNED_INT64_NV 0x140F -#define GL_INT8_NV 0x8FE0 -#define GL_INT8_VEC2_NV 0x8FE1 -#define GL_INT8_VEC3_NV 0x8FE2 -#define GL_INT8_VEC4_NV 0x8FE3 -#define GL_INT16_NV 0x8FE4 -#define GL_INT16_VEC2_NV 0x8FE5 -#define GL_INT16_VEC3_NV 0x8FE6 -#define GL_INT16_VEC4_NV 0x8FE7 -#define GL_INT64_VEC2_NV 0x8FE9 -#define GL_INT64_VEC3_NV 0x8FEA -#define GL_INT64_VEC4_NV 0x8FEB -#define GL_UNSIGNED_INT8_NV 0x8FEC -#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED -#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE -#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF -#define GL_UNSIGNED_INT16_NV 0x8FF0 -#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 -#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 -#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 -#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 -typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); -typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); -typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); -GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); -GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); -GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); -GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); -GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); -GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif -#endif /* GL_AMD_gpu_shader_int64 */ - -#ifndef GL_AMD_interleaved_elements -#define GL_AMD_interleaved_elements 1 -#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4 -#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5 -typedef void (APIENTRYP PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribParameteriAMD (GLuint index, GLenum pname, GLint param); -#endif -#endif /* GL_AMD_interleaved_elements */ - -#ifndef GL_AMD_multi_draw_indirect -#define GL_AMD_multi_draw_indirect 1 -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); -#endif -#endif /* GL_AMD_multi_draw_indirect */ - -#ifndef GL_AMD_name_gen_delete -#define GL_AMD_name_gen_delete 1 -#define GL_DATA_BUFFER_AMD 0x9151 -#define GL_PERFORMANCE_MONITOR_AMD 0x9152 -#define GL_QUERY_OBJECT_AMD 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 -#define GL_SAMPLER_OBJECT_AMD 0x9155 -typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names); -typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names); -typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names); -GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names); -GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); -#endif -#endif /* GL_AMD_name_gen_delete */ - -#ifndef GL_AMD_occlusion_query_event -#define GL_AMD_occlusion_query_event 1 -#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F -#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001 -#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002 -#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004 -#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008 -#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF -typedef void (APIENTRYP PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glQueryObjectParameteruiAMD (GLenum target, GLuint id, GLenum pname, GLuint param); -#endif -#endif /* GL_AMD_occlusion_query_event */ - -#ifndef GL_AMD_performance_monitor -#define GL_AMD_performance_monitor 1 -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); -typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); -typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); -GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); -GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); -GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor); -GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor); -GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif -#endif /* GL_AMD_performance_monitor */ - -#ifndef GL_AMD_pinned_memory -#define GL_AMD_pinned_memory 1 -#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 -#endif /* GL_AMD_pinned_memory */ - -#ifndef GL_AMD_query_buffer_object -#define GL_AMD_query_buffer_object 1 -#define GL_QUERY_BUFFER_AMD 0x9192 -#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 -#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 -#endif /* GL_AMD_query_buffer_object */ - -#ifndef GL_AMD_sample_positions -#define GL_AMD_sample_positions 1 -#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F -typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val); -#endif -#endif /* GL_AMD_sample_positions */ - -#ifndef GL_AMD_seamless_cubemap_per_texture -#define GL_AMD_seamless_cubemap_per_texture 1 -#endif /* GL_AMD_seamless_cubemap_per_texture */ - -#ifndef GL_AMD_shader_atomic_counter_ops -#define GL_AMD_shader_atomic_counter_ops 1 -#endif /* GL_AMD_shader_atomic_counter_ops */ - -#ifndef GL_AMD_shader_ballot -#define GL_AMD_shader_ballot 1 -#endif /* GL_AMD_shader_ballot */ - -#ifndef GL_AMD_shader_explicit_vertex_parameter -#define GL_AMD_shader_explicit_vertex_parameter 1 -#endif /* GL_AMD_shader_explicit_vertex_parameter */ - -#ifndef GL_AMD_shader_stencil_export -#define GL_AMD_shader_stencil_export 1 -#endif /* GL_AMD_shader_stencil_export */ - -#ifndef GL_AMD_shader_trinary_minmax -#define GL_AMD_shader_trinary_minmax 1 -#endif /* GL_AMD_shader_trinary_minmax */ - -#ifndef GL_AMD_sparse_texture -#define GL_AMD_sparse_texture 1 -#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 -#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 -#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 -#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 -#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 -#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A -#define GL_MIN_SPARSE_LEVEL_AMD 0x919B -#define GL_MIN_LOD_WARNING_AMD 0x919C -#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 -typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); -typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); -GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); -#endif -#endif /* GL_AMD_sparse_texture */ - -#ifndef GL_AMD_stencil_operation_extended -#define GL_AMD_stencil_operation_extended 1 -#define GL_SET_AMD 0x874A -#define GL_REPLACE_VALUE_AMD 0x874B -#define GL_STENCIL_OP_VALUE_AMD 0x874C -#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D -typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value); -#endif -#endif /* GL_AMD_stencil_operation_extended */ - -#ifndef GL_AMD_texture_texture4 -#define GL_AMD_texture_texture4 1 -#endif /* GL_AMD_texture_texture4 */ - -#ifndef GL_AMD_transform_feedback3_lines_triangles -#define GL_AMD_transform_feedback3_lines_triangles 1 -#endif /* GL_AMD_transform_feedback3_lines_triangles */ - -#ifndef GL_AMD_transform_feedback4 -#define GL_AMD_transform_feedback4 1 -#define GL_STREAM_RASTERIZATION_AMD 0x91A0 -#endif /* GL_AMD_transform_feedback4 */ - -#ifndef GL_AMD_vertex_shader_layer -#define GL_AMD_vertex_shader_layer 1 -#endif /* GL_AMD_vertex_shader_layer */ - -#ifndef GL_AMD_vertex_shader_tessellator -#define GL_AMD_vertex_shader_tessellator 1 -#define GL_SAMPLER_BUFFER_AMD 0x9001 -#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 -#define GL_TESSELLATION_MODE_AMD 0x9004 -#define GL_TESSELLATION_FACTOR_AMD 0x9005 -#define GL_DISCRETE_AMD 0x9006 -#define GL_CONTINUOUS_AMD 0x9007 -typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor); -GLAPI void APIENTRY glTessellationModeAMD (GLenum mode); -#endif -#endif /* GL_AMD_vertex_shader_tessellator */ - -#ifndef GL_AMD_vertex_shader_viewport_index -#define GL_AMD_vertex_shader_viewport_index 1 -#endif /* GL_AMD_vertex_shader_viewport_index */ - -#ifndef GL_APPLE_aux_depth_stencil -#define GL_APPLE_aux_depth_stencil 1 -#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 -#endif /* GL_APPLE_aux_depth_stencil */ - -#ifndef GL_APPLE_client_storage -#define GL_APPLE_client_storage 1 -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 -#endif /* GL_APPLE_client_storage */ - -#ifndef GL_APPLE_element_array -#define GL_APPLE_element_array 1 -#define GL_ELEMENT_ARRAY_APPLE 0x8A0C -#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D -#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E -typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const void *pointer); -GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count); -GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#endif -#endif /* GL_APPLE_element_array */ - -#ifndef GL_APPLE_fence -#define GL_APPLE_fence 1 -#define GL_DRAW_PIXELS_APPLE 0x8A0A -#define GL_FENCE_APPLE 0x8A0B -typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); -typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); -typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences); -GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences); -GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence); -GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence); -GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence); -GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence); -GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name); -GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name); -#endif -#endif /* GL_APPLE_fence */ - -#ifndef GL_APPLE_float_pixels -#define GL_APPLE_float_pixels 1 -#define GL_HALF_APPLE 0x140B -#define GL_RGBA_FLOAT32_APPLE 0x8814 -#define GL_RGB_FLOAT32_APPLE 0x8815 -#define GL_ALPHA_FLOAT32_APPLE 0x8816 -#define GL_INTENSITY_FLOAT32_APPLE 0x8817 -#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 -#define GL_RGBA_FLOAT16_APPLE 0x881A -#define GL_RGB_FLOAT16_APPLE 0x881B -#define GL_ALPHA_FLOAT16_APPLE 0x881C -#define GL_INTENSITY_FLOAT16_APPLE 0x881D -#define GL_LUMINANCE_FLOAT16_APPLE 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F -#define GL_COLOR_FLOAT_APPLE 0x8A0F -#endif /* GL_APPLE_float_pixels */ - -#ifndef GL_APPLE_flush_buffer_range -#define GL_APPLE_flush_buffer_range 1 -#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 -#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 -typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size); -#endif -#endif /* GL_APPLE_flush_buffer_range */ - -#ifndef GL_APPLE_object_purgeable -#define GL_APPLE_object_purgeable 1 -#define GL_BUFFER_OBJECT_APPLE 0x85B3 -#define GL_RELEASED_APPLE 0x8A19 -#define GL_VOLATILE_APPLE 0x8A1A -#define GL_RETAINED_APPLE 0x8A1B -#define GL_UNDEFINED_APPLE 0x8A1C -#define GL_PURGEABLE_APPLE 0x8A1D -typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); -typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); -GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); -GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params); -#endif -#endif /* GL_APPLE_object_purgeable */ - -#ifndef GL_APPLE_rgb_422 -#define GL_APPLE_rgb_422 1 -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#define GL_RGB_RAW_422_APPLE 0x8A51 -#endif /* GL_APPLE_rgb_422 */ - -#ifndef GL_APPLE_row_bytes -#define GL_APPLE_row_bytes 1 -#define GL_PACK_ROW_BYTES_APPLE 0x8A15 -#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 -#endif /* GL_APPLE_row_bytes */ - -#ifndef GL_APPLE_specular_vector -#define GL_APPLE_specular_vector 1 -#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 -#endif /* GL_APPLE_specular_vector */ - -#ifndef GL_APPLE_texture_range -#define GL_APPLE_texture_range 1 -#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 -#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 -#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC -#define GL_STORAGE_PRIVATE_APPLE 0x85BD -#define GL_STORAGE_CACHED_APPLE 0x85BE -#define GL_STORAGE_SHARED_APPLE 0x85BF -typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const void *pointer); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const void *pointer); -GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, void **params); -#endif -#endif /* GL_APPLE_texture_range */ - -#ifndef GL_APPLE_transform_hint -#define GL_APPLE_transform_hint 1 -#define GL_TRANSFORM_HINT_APPLE 0x85B1 -#endif /* GL_APPLE_transform_hint */ - -#ifndef GL_APPLE_vertex_array_object -#define GL_APPLE_vertex_array_object 1 -#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array); -GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays); -GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays); -GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array); -#endif -#endif /* GL_APPLE_vertex_array_object */ - -#ifndef GL_APPLE_vertex_array_range -#define GL_APPLE_vertex_array_range 1 -#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E -#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F -#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 -#define GL_STORAGE_CLIENT_APPLE 0x85B4 -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); -typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, void *pointer); -GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, void *pointer); -GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param); -#endif -#endif /* GL_APPLE_vertex_array_range */ - -#ifndef GL_APPLE_vertex_program_evaluators -#define GL_APPLE_vertex_program_evaluators 1 -#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 -#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 -#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 -#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 -#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 -#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 -#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 -#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 -#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 -#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); -typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname); -GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname); -GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname); -GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -#endif -#endif /* GL_APPLE_vertex_program_evaluators */ - -#ifndef GL_APPLE_ycbcr_422 -#define GL_APPLE_ycbcr_422 1 -#define GL_YCBCR_422_APPLE 0x85B9 -#endif /* GL_APPLE_ycbcr_422 */ - -#ifndef GL_ATI_draw_buffers -#define GL_ATI_draw_buffers 1 -#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 -#define GL_DRAW_BUFFER0_ATI 0x8825 -#define GL_DRAW_BUFFER1_ATI 0x8826 -#define GL_DRAW_BUFFER2_ATI 0x8827 -#define GL_DRAW_BUFFER3_ATI 0x8828 -#define GL_DRAW_BUFFER4_ATI 0x8829 -#define GL_DRAW_BUFFER5_ATI 0x882A -#define GL_DRAW_BUFFER6_ATI 0x882B -#define GL_DRAW_BUFFER7_ATI 0x882C -#define GL_DRAW_BUFFER8_ATI 0x882D -#define GL_DRAW_BUFFER9_ATI 0x882E -#define GL_DRAW_BUFFER10_ATI 0x882F -#define GL_DRAW_BUFFER11_ATI 0x8830 -#define GL_DRAW_BUFFER12_ATI 0x8831 -#define GL_DRAW_BUFFER13_ATI 0x8832 -#define GL_DRAW_BUFFER14_ATI 0x8833 -#define GL_DRAW_BUFFER15_ATI 0x8834 -typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs); -#endif -#endif /* GL_ATI_draw_buffers */ - -#ifndef GL_ATI_element_array -#define GL_ATI_element_array 1 -#define GL_ELEMENT_ARRAY_ATI 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A -typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerATI (GLenum type, const void *pointer); -GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count); -GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count); -#endif -#endif /* GL_ATI_element_array */ - -#ifndef GL_ATI_envmap_bumpmap -#define GL_ATI_envmap_bumpmap 1 -#define GL_BUMP_ROT_MATRIX_ATI 0x8775 -#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 -#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 -#define GL_BUMP_TEX_UNITS_ATI 0x8778 -#define GL_DUDV_ATI 0x8779 -#define GL_DU8DV8_ATI 0x877A -#define GL_BUMP_ENVMAP_ATI 0x877B -#define GL_BUMP_TARGET_ATI 0x877C -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param); -GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param); -GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param); -#endif -#endif /* GL_ATI_envmap_bumpmap */ - -#ifndef GL_ATI_fragment_shader -#define GL_ATI_fragment_shader 1 -#define GL_FRAGMENT_SHADER_ATI 0x8920 -#define GL_REG_0_ATI 0x8921 -#define GL_REG_1_ATI 0x8922 -#define GL_REG_2_ATI 0x8923 -#define GL_REG_3_ATI 0x8924 -#define GL_REG_4_ATI 0x8925 -#define GL_REG_5_ATI 0x8926 -#define GL_REG_6_ATI 0x8927 -#define GL_REG_7_ATI 0x8928 -#define GL_REG_8_ATI 0x8929 -#define GL_REG_9_ATI 0x892A -#define GL_REG_10_ATI 0x892B -#define GL_REG_11_ATI 0x892C -#define GL_REG_12_ATI 0x892D -#define GL_REG_13_ATI 0x892E -#define GL_REG_14_ATI 0x892F -#define GL_REG_15_ATI 0x8930 -#define GL_REG_16_ATI 0x8931 -#define GL_REG_17_ATI 0x8932 -#define GL_REG_18_ATI 0x8933 -#define GL_REG_19_ATI 0x8934 -#define GL_REG_20_ATI 0x8935 -#define GL_REG_21_ATI 0x8936 -#define GL_REG_22_ATI 0x8937 -#define GL_REG_23_ATI 0x8938 -#define GL_REG_24_ATI 0x8939 -#define GL_REG_25_ATI 0x893A -#define GL_REG_26_ATI 0x893B -#define GL_REG_27_ATI 0x893C -#define GL_REG_28_ATI 0x893D -#define GL_REG_29_ATI 0x893E -#define GL_REG_30_ATI 0x893F -#define GL_REG_31_ATI 0x8940 -#define GL_CON_0_ATI 0x8941 -#define GL_CON_1_ATI 0x8942 -#define GL_CON_2_ATI 0x8943 -#define GL_CON_3_ATI 0x8944 -#define GL_CON_4_ATI 0x8945 -#define GL_CON_5_ATI 0x8946 -#define GL_CON_6_ATI 0x8947 -#define GL_CON_7_ATI 0x8948 -#define GL_CON_8_ATI 0x8949 -#define GL_CON_9_ATI 0x894A -#define GL_CON_10_ATI 0x894B -#define GL_CON_11_ATI 0x894C -#define GL_CON_12_ATI 0x894D -#define GL_CON_13_ATI 0x894E -#define GL_CON_14_ATI 0x894F -#define GL_CON_15_ATI 0x8950 -#define GL_CON_16_ATI 0x8951 -#define GL_CON_17_ATI 0x8952 -#define GL_CON_18_ATI 0x8953 -#define GL_CON_19_ATI 0x8954 -#define GL_CON_20_ATI 0x8955 -#define GL_CON_21_ATI 0x8956 -#define GL_CON_22_ATI 0x8957 -#define GL_CON_23_ATI 0x8958 -#define GL_CON_24_ATI 0x8959 -#define GL_CON_25_ATI 0x895A -#define GL_CON_26_ATI 0x895B -#define GL_CON_27_ATI 0x895C -#define GL_CON_28_ATI 0x895D -#define GL_CON_29_ATI 0x895E -#define GL_CON_30_ATI 0x895F -#define GL_CON_31_ATI 0x8960 -#define GL_MOV_ATI 0x8961 -#define GL_ADD_ATI 0x8963 -#define GL_MUL_ATI 0x8964 -#define GL_SUB_ATI 0x8965 -#define GL_DOT3_ATI 0x8966 -#define GL_DOT4_ATI 0x8967 -#define GL_MAD_ATI 0x8968 -#define GL_LERP_ATI 0x8969 -#define GL_CND_ATI 0x896A -#define GL_CND0_ATI 0x896B -#define GL_DOT2_ADD_ATI 0x896C -#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D -#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E -#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F -#define GL_NUM_PASSES_ATI 0x8970 -#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 -#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 -#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 -#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 -#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 -#define GL_SWIZZLE_STR_ATI 0x8976 -#define GL_SWIZZLE_STQ_ATI 0x8977 -#define GL_SWIZZLE_STR_DR_ATI 0x8978 -#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 -#define GL_SWIZZLE_STRQ_ATI 0x897A -#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B -#define GL_RED_BIT_ATI 0x00000001 -#define GL_GREEN_BIT_ATI 0x00000002 -#define GL_BLUE_BIT_ATI 0x00000004 -#define GL_2X_BIT_ATI 0x00000001 -#define GL_4X_BIT_ATI 0x00000002 -#define GL_8X_BIT_ATI 0x00000004 -#define GL_HALF_BIT_ATI 0x00000008 -#define GL_QUARTER_BIT_ATI 0x00000010 -#define GL_EIGHTH_BIT_ATI 0x00000020 -#define GL_SATURATE_BIT_ATI 0x00000040 -#define GL_COMP_BIT_ATI 0x00000002 -#define GL_NEGATE_BIT_ATI 0x00000004 -#define GL_BIAS_BIT_ATI 0x00000008 -typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); -typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); -typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range); -GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id); -GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id); -GLAPI void APIENTRY glBeginFragmentShaderATI (void); -GLAPI void APIENTRY glEndFragmentShaderATI (void); -GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle); -GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle); -GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value); -#endif -#endif /* GL_ATI_fragment_shader */ - -#ifndef GL_ATI_map_object_buffer -#define GL_ATI_map_object_buffer 1 -typedef void *(APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void *APIENTRY glMapObjectBufferATI (GLuint buffer); -GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer); -#endif -#endif /* GL_ATI_map_object_buffer */ - -#ifndef GL_ATI_meminfo -#define GL_ATI_meminfo 1 -#define GL_VBO_FREE_MEMORY_ATI 0x87FB -#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC -#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD -#endif /* GL_ATI_meminfo */ - -#ifndef GL_ATI_pixel_format_float -#define GL_ATI_pixel_format_float 1 -#define GL_RGBA_FLOAT_MODE_ATI 0x8820 -#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 -#endif /* GL_ATI_pixel_format_float */ - -#ifndef GL_ATI_pn_triangles -#define GL_ATI_pn_triangles 1 -#define GL_PN_TRIANGLES_ATI 0x87F0 -#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 -#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 -#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 -#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 -#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 -#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 -#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 -#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 -typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param); -GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param); -#endif -#endif /* GL_ATI_pn_triangles */ - -#ifndef GL_ATI_separate_stencil -#define GL_ATI_separate_stencil 1 -#define GL_STENCIL_BACK_FUNC_ATI 0x8800 -#define GL_STENCIL_BACK_FAIL_ATI 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#endif -#endif /* GL_ATI_separate_stencil */ - -#ifndef GL_ATI_text_fragment_shader -#define GL_ATI_text_fragment_shader 1 -#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 -#endif /* GL_ATI_text_fragment_shader */ - -#ifndef GL_ATI_texture_env_combine3 -#define GL_ATI_texture_env_combine3 1 -#define GL_MODULATE_ADD_ATI 0x8744 -#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 -#define GL_MODULATE_SUBTRACT_ATI 0x8746 -#endif /* GL_ATI_texture_env_combine3 */ - -#ifndef GL_ATI_texture_float -#define GL_ATI_texture_float 1 -#define GL_RGBA_FLOAT32_ATI 0x8814 -#define GL_RGB_FLOAT32_ATI 0x8815 -#define GL_ALPHA_FLOAT32_ATI 0x8816 -#define GL_INTENSITY_FLOAT32_ATI 0x8817 -#define GL_LUMINANCE_FLOAT32_ATI 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 -#define GL_RGBA_FLOAT16_ATI 0x881A -#define GL_RGB_FLOAT16_ATI 0x881B -#define GL_ALPHA_FLOAT16_ATI 0x881C -#define GL_INTENSITY_FLOAT16_ATI 0x881D -#define GL_LUMINANCE_FLOAT16_ATI 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F -#endif /* GL_ATI_texture_float */ - -#ifndef GL_ATI_texture_mirror_once -#define GL_ATI_texture_mirror_once 1 -#define GL_MIRROR_CLAMP_ATI 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 -#endif /* GL_ATI_texture_mirror_once */ - -#ifndef GL_ATI_vertex_array_object -#define GL_ATI_vertex_array_object 1 -#define GL_STATIC_ATI 0x8760 -#define GL_DYNAMIC_ATI 0x8761 -#define GL_PRESERVE_ATI 0x8762 -#define GL_DISCARD_ATI 0x8763 -#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 -#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 -#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 -#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 -typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage); -typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const void *pointer, GLenum usage); -GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer); -GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); -GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer); -GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params); -GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params); -#endif -#endif /* GL_ATI_vertex_array_object */ - -#ifndef GL_ATI_vertex_attrib_array_object -#define GL_ATI_vertex_attrib_array_object 1 -typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params); -#endif -#endif /* GL_ATI_vertex_attrib_array_object */ - -#ifndef GL_ATI_vertex_streams -#define GL_ATI_vertex_streams 1 -#define GL_MAX_VERTEX_STREAMS_ATI 0x876B -#define GL_VERTEX_STREAM0_ATI 0x876C -#define GL_VERTEX_STREAM1_ATI 0x876D -#define GL_VERTEX_STREAM2_ATI 0x876E -#define GL_VERTEX_STREAM3_ATI 0x876F -#define GL_VERTEX_STREAM4_ATI 0x8770 -#define GL_VERTEX_STREAM5_ATI 0x8771 -#define GL_VERTEX_STREAM6_ATI 0x8772 -#define GL_VERTEX_STREAM7_ATI 0x8773 -#define GL_VERTEX_SOURCE_ATI 0x8774 -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x); -GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x); -GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x); -GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x); -GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y); -GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords); -GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz); -GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream); -GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param); -GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param); -#endif -#endif /* GL_ATI_vertex_streams */ - -#ifndef GL_EXT_422_pixels -#define GL_EXT_422_pixels 1 -#define GL_422_EXT 0x80CC -#define GL_422_REV_EXT 0x80CD -#define GL_422_AVERAGE_EXT 0x80CE -#define GL_422_REV_AVERAGE_EXT 0x80CF -#endif /* GL_EXT_422_pixels */ - -#ifndef GL_EXT_abgr -#define GL_EXT_abgr 1 -#define GL_ABGR_EXT 0x8000 -#endif /* GL_EXT_abgr */ - -#ifndef GL_EXT_bgra -#define GL_EXT_bgra 1 -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 -#endif /* GL_EXT_bgra */ - -#ifndef GL_EXT_bindable_uniform -#define GL_EXT_bindable_uniform 1 -#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 -#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 -#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 -#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED -#define GL_UNIFORM_BUFFER_EXT 0x8DEE -#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF -typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); -typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); -typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer); -GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location); -GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location); -#endif -#endif /* GL_EXT_bindable_uniform */ - -#ifndef GL_EXT_blend_color -#define GL_EXT_blend_color 1 -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 -typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#endif -#endif /* GL_EXT_blend_color */ - -#ifndef GL_EXT_blend_equation_separate -#define GL_EXT_blend_equation_separate 1 -#define GL_BLEND_EQUATION_RGB_EXT 0x8009 -#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha); -#endif -#endif /* GL_EXT_blend_equation_separate */ - -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 -#define GL_BLEND_DST_RGB_EXT 0x80C8 -#define GL_BLEND_SRC_RGB_EXT 0x80C9 -#define GL_BLEND_DST_ALPHA_EXT 0x80CA -#define GL_BLEND_SRC_ALPHA_EXT 0x80CB -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif -#endif /* GL_EXT_blend_func_separate */ - -#ifndef GL_EXT_blend_logic_op -#define GL_EXT_blend_logic_op 1 -#endif /* GL_EXT_blend_logic_op */ - -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_BLEND_EQUATION_EXT 0x8009 -typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationEXT (GLenum mode); -#endif -#endif /* GL_EXT_blend_minmax */ - -#ifndef GL_EXT_blend_subtract -#define GL_EXT_blend_subtract 1 -#define GL_FUNC_SUBTRACT_EXT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B -#endif /* GL_EXT_blend_subtract */ - -#ifndef GL_EXT_clip_volume_hint -#define GL_EXT_clip_volume_hint 1 -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 -#endif /* GL_EXT_clip_volume_hint */ - -#ifndef GL_EXT_cmyka -#define GL_EXT_cmyka 1 -#define GL_CMYK_EXT 0x800C -#define GL_CMYKA_EXT 0x800D -#define GL_PACK_CMYK_HINT_EXT 0x800E -#define GL_UNPACK_CMYK_HINT_EXT 0x800F -#endif /* GL_EXT_cmyka */ - -#ifndef GL_EXT_color_subtable -#define GL_EXT_color_subtable 1 -typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif -#endif /* GL_EXT_color_subtable */ - -#ifndef GL_EXT_compiled_vertex_array -#define GL_EXT_compiled_vertex_array 1 -#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 -#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 -typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count); -GLAPI void APIENTRY glUnlockArraysEXT (void); -#endif -#endif /* GL_EXT_compiled_vertex_array */ - -#ifndef GL_EXT_convolution -#define GL_EXT_convolution 1 -#define GL_CONVOLUTION_1D_EXT 0x8010 -#define GL_CONVOLUTION_2D_EXT 0x8011 -#define GL_SEPARABLE_2D_EXT 0x8012 -#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 -#define GL_REDUCE_EXT 0x8016 -#define GL_CONVOLUTION_FORMAT_EXT 0x8017 -#define GL_CONVOLUTION_WIDTH_EXT 0x8018 -#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); -GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); -GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params); -GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params); -GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, void *image); -GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); -GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); -#endif -#endif /* GL_EXT_convolution */ - -#ifndef GL_EXT_coordinate_frame -#define GL_EXT_coordinate_frame 1 -#define GL_TANGENT_ARRAY_EXT 0x8439 -#define GL_BINORMAL_ARRAY_EXT 0x843A -#define GL_CURRENT_TANGENT_EXT 0x843B -#define GL_CURRENT_BINORMAL_EXT 0x843C -#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E -#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F -#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 -#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 -#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 -#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 -#define GL_MAP1_TANGENT_EXT 0x8444 -#define GL_MAP2_TANGENT_EXT 0x8445 -#define GL_MAP1_BINORMAL_EXT 0x8446 -#define GL_MAP2_BINORMAL_EXT 0x8447 -typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); -typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); -typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); -typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); -typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); -typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); -typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); -typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); -typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); -typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); -typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz); -GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v); -GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz); -GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v); -GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz); -GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v); -GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz); -GLAPI void APIENTRY glTangent3ivEXT (const GLint *v); -GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz); -GLAPI void APIENTRY glTangent3svEXT (const GLshort *v); -GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz); -GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v); -GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz); -GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v); -GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz); -GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v); -GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz); -GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v); -GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz); -GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v); -GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const void *pointer); -#endif -#endif /* GL_EXT_coordinate_frame */ - -#ifndef GL_EXT_copy_texture -#define GL_EXT_copy_texture 1 -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif -#endif /* GL_EXT_copy_texture */ - -#ifndef GL_EXT_cull_vertex -#define GL_EXT_cull_vertex 1 -#define GL_CULL_VERTEX_EXT 0x81AA -#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB -#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC -typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params); -GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params); -#endif -#endif /* GL_EXT_cull_vertex */ - -#ifndef GL_EXT_debug_label -#define GL_EXT_debug_label 1 -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -#endif /* GL_EXT_debug_label */ - -#ifndef GL_EXT_debug_marker -#define GL_EXT_debug_marker 1 -typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); -GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); -GLAPI void APIENTRY glPopGroupMarkerEXT (void); -#endif -#endif /* GL_EXT_debug_marker */ - -#ifndef GL_EXT_depth_bounds_test -#define GL_EXT_depth_bounds_test 1 -#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 -#define GL_DEPTH_BOUNDS_EXT 0x8891 -typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax); -#endif -#endif /* GL_EXT_depth_bounds_test */ - -#ifndef GL_EXT_direct_state_access -#define GL_EXT_direct_state_access 1 -#define GL_PROGRAM_MATRIX_EXT 0x8E2D -#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E -#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F -typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); -typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); -typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); -typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); -typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data); -typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data); -typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void **data); -typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, void *img); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, void *img); -typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); -typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void **params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params); -typedef void (APIENTRYP PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); -typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); -typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); -typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); -typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); -typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); -typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); -typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void **param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param); -typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode); -GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI void APIENTRY glMatrixPopEXT (GLenum mode); -GLAPI void APIENTRY glMatrixPushEXT (GLenum mode); -GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask); -GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask); -GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture); -GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); -GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); -GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); -GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param); -GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); -GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params); -GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index); -GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index); -GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data); -GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data); -GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, void **data); -GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index); -GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index); -GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index); -GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data); -GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data); -GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, void *img); -GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); -GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, void *img); -GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); -GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI void *APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access); -GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer); -GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, void **params); -GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); -GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); -GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); -GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); -GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); -GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params); -GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params); -GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params); -GLAPI void APIENTRY glEnableClientStateiEXT (GLenum array, GLuint index); -GLAPI void APIENTRY glDisableClientStateiEXT (GLenum array, GLuint index); -GLAPI void APIENTRY glGetFloati_vEXT (GLenum pname, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetDoublei_vEXT (GLenum pname, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetPointeri_vEXT (GLenum pname, GLuint index, void **params); -GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); -GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params); -GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, void *string); -GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target); -GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target); -GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target); -GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode); -GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode); -GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); -GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glVertexArrayVertexOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayEdgeFlagOffsetEXT (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayIndexOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayNormalOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayMultiTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayFogCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArraySecondaryColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayVertexAttribOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glVertexArrayVertexAttribIOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glEnableVertexArrayEXT (GLuint vaobj, GLenum array); -GLAPI void APIENTRY glDisableVertexArrayEXT (GLuint vaobj, GLenum array); -GLAPI void APIENTRY glEnableVertexArrayAttribEXT (GLuint vaobj, GLuint index); -GLAPI void APIENTRY glDisableVertexArrayAttribEXT (GLuint vaobj, GLuint index); -GLAPI void APIENTRY glGetVertexArrayIntegervEXT (GLuint vaobj, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetVertexArrayPointervEXT (GLuint vaobj, GLenum pname, void **param); -GLAPI void APIENTRY glGetVertexArrayIntegeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, GLint *param); -GLAPI void APIENTRY glGetVertexArrayPointeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, void **param); -GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); -GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); -GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); -GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); -GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor); -#endif -#endif /* GL_EXT_direct_state_access */ - -#ifndef GL_EXT_draw_buffers2 -#define GL_EXT_draw_buffers2 1 -typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -#endif -#endif /* GL_EXT_draw_buffers2 */ - -#ifndef GL_EXT_draw_instanced -#define GL_EXT_draw_instanced 1 -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#endif -#endif /* GL_EXT_draw_instanced */ - -#ifndef GL_EXT_draw_range_elements -#define GL_EXT_draw_range_elements 1 -#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -#endif -#endif /* GL_EXT_draw_range_elements */ - -#ifndef GL_EXT_fog_coord -#define GL_EXT_fog_coord 1 -#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 -#define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 -#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 -#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 -typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord); -GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord); -GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord); -GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord); -GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const void *pointer); -#endif -#endif /* GL_EXT_fog_coord */ - -#ifndef GL_EXT_framebuffer_blit -#define GL_EXT_framebuffer_blit 1 -#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -#endif /* GL_EXT_framebuffer_blit */ - -#ifndef GL_EXT_framebuffer_multisample -#define GL_EXT_framebuffer_multisample 1 -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -#endif /* GL_EXT_framebuffer_multisample */ - -#ifndef GL_EXT_framebuffer_multisample_blit_scaled -#define GL_EXT_framebuffer_multisample_blit_scaled 1 -#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA -#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB -#endif /* GL_EXT_framebuffer_multisample_blit_scaled */ - -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer); -GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers); -GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer); -GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer); -GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers); -GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers); -GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target); -GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target); -#endif -#endif /* GL_EXT_framebuffer_object */ - -#ifndef GL_EXT_framebuffer_sRGB -#define GL_EXT_framebuffer_sRGB 1 -#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 -#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA -#endif /* GL_EXT_framebuffer_sRGB */ - -#ifndef GL_EXT_geometry_shader4 -#define GL_EXT_geometry_shader4 1 -#define GL_GEOMETRY_SHADER_EXT 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE -#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 -#define GL_LINES_ADJACENCY_EXT 0x000A -#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B -#define GL_TRIANGLES_ADJACENCY_EXT 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 -#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -#endif -#endif /* GL_EXT_geometry_shader4 */ - -#ifndef GL_EXT_gpu_program_parameters -#define GL_EXT_gpu_program_parameters 1 -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -#endif -#endif /* GL_EXT_gpu_program_parameters */ - -#ifndef GL_EXT_gpu_shader4 -#define GL_EXT_gpu_shader4 1 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD -#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 -#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 -#define GL_SAMPLER_BUFFER_EXT 0x8DC2 -#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 -#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 -#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 -#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 -#define GL_INT_SAMPLER_1D_EXT 0x8DC9 -#define GL_INT_SAMPLER_2D_EXT 0x8DCA -#define GL_INT_SAMPLER_3D_EXT 0x8DCB -#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC -#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD -#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF -#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 -typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); -GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name); -GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0); -GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); -#endif -#endif /* GL_EXT_gpu_shader4 */ - -#ifndef GL_EXT_histogram -#define GL_EXT_histogram 1 -#define GL_HISTOGRAM_EXT 0x8024 -#define GL_PROXY_HISTOGRAM_EXT 0x8025 -#define GL_HISTOGRAM_WIDTH_EXT 0x8026 -#define GL_HISTOGRAM_FORMAT_EXT 0x8027 -#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C -#define GL_HISTOGRAM_SINK_EXT 0x802D -#define GL_MINMAX_EXT 0x802E -#define GL_MINMAX_FORMAT_EXT 0x802F -#define GL_MINMAX_SINK_EXT 0x8030 -#define GL_TABLE_TOO_LARGE_EXT 0x8031 -typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); -GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glResetHistogramEXT (GLenum target); -GLAPI void APIENTRY glResetMinmaxEXT (GLenum target); -#endif -#endif /* GL_EXT_histogram */ - -#ifndef GL_EXT_index_array_formats -#define GL_EXT_index_array_formats 1 -#define GL_IUI_V2F_EXT 0x81AD -#define GL_IUI_V3F_EXT 0x81AE -#define GL_IUI_N3F_V2F_EXT 0x81AF -#define GL_IUI_N3F_V3F_EXT 0x81B0 -#define GL_T2F_IUI_V2F_EXT 0x81B1 -#define GL_T2F_IUI_V3F_EXT 0x81B2 -#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 -#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 -#endif /* GL_EXT_index_array_formats */ - -#ifndef GL_EXT_index_func -#define GL_EXT_index_func 1 -#define GL_INDEX_TEST_EXT 0x81B5 -#define GL_INDEX_TEST_FUNC_EXT 0x81B6 -#define GL_INDEX_TEST_REF_EXT 0x81B7 -typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref); -#endif -#endif /* GL_EXT_index_func */ - -#ifndef GL_EXT_index_material -#define GL_EXT_index_material 1 -#define GL_INDEX_MATERIAL_EXT 0x81B8 -#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 -#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA -typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode); -#endif -#endif /* GL_EXT_index_material */ - -#ifndef GL_EXT_index_texture -#define GL_EXT_index_texture 1 -#endif /* GL_EXT_index_texture */ - -#ifndef GL_EXT_light_texture -#define GL_EXT_light_texture 1 -#define GL_FRAGMENT_MATERIAL_EXT 0x8349 -#define GL_FRAGMENT_NORMAL_EXT 0x834A -#define GL_FRAGMENT_COLOR_EXT 0x834C -#define GL_ATTENUATION_EXT 0x834D -#define GL_SHADOW_ATTENUATION_EXT 0x834E -#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F -#define GL_TEXTURE_LIGHT_EXT 0x8350 -#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 -#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 -typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glApplyTextureEXT (GLenum mode); -GLAPI void APIENTRY glTextureLightEXT (GLenum pname); -GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode); -#endif -#endif /* GL_EXT_light_texture */ - -#ifndef GL_EXT_misc_attribute -#define GL_EXT_misc_attribute 1 -#endif /* GL_EXT_misc_attribute */ - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); -#endif -#endif /* GL_EXT_multi_draw_arrays */ - -#ifndef GL_EXT_multisample -#define GL_EXT_multisample 1 -#define GL_MULTISAMPLE_EXT 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F -#define GL_SAMPLE_MASK_EXT 0x80A0 -#define GL_1PASS_EXT 0x80A1 -#define GL_2PASS_0_EXT 0x80A2 -#define GL_2PASS_1_EXT 0x80A3 -#define GL_4PASS_0_EXT 0x80A4 -#define GL_4PASS_1_EXT 0x80A5 -#define GL_4PASS_2_EXT 0x80A6 -#define GL_4PASS_3_EXT 0x80A7 -#define GL_SAMPLE_BUFFERS_EXT 0x80A8 -#define GL_SAMPLES_EXT 0x80A9 -#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA -#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB -#define GL_SAMPLE_PATTERN_EXT 0x80AC -#define GL_MULTISAMPLE_BIT_EXT 0x20000000 -typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert); -GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); -#endif -#endif /* GL_EXT_multisample */ - -#ifndef GL_EXT_packed_depth_stencil -#define GL_EXT_packed_depth_stencil 1 -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 -#endif /* GL_EXT_packed_depth_stencil */ - -#ifndef GL_EXT_packed_float -#define GL_EXT_packed_float 1 -#define GL_R11F_G11F_B10F_EXT 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B -#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C -#endif /* GL_EXT_packed_float */ - -#ifndef GL_EXT_packed_pixels -#define GL_EXT_packed_pixels 1 -#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 -#endif /* GL_EXT_packed_pixels */ - -#ifndef GL_EXT_paletted_texture -#define GL_EXT_paletted_texture 1 -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 -#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED -typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table); -GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, void *data); -GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -#endif -#endif /* GL_EXT_paletted_texture */ - -#ifndef GL_EXT_pixel_buffer_object -#define GL_EXT_pixel_buffer_object 1 -#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF -#endif /* GL_EXT_pixel_buffer_object */ - -#ifndef GL_EXT_pixel_transform -#define GL_EXT_pixel_transform 1 -#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 -#define GL_PIXEL_MAG_FILTER_EXT 0x8331 -#define GL_PIXEL_MIN_FILTER_EXT 0x8332 -#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 -#define GL_CUBIC_EXT 0x8334 -#define GL_AVERAGE_EXT 0x8335 -#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 -#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 -#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -#endif -#endif /* GL_EXT_pixel_transform */ - -#ifndef GL_EXT_pixel_transform_color_table -#define GL_EXT_pixel_transform_color_table 1 -#endif /* GL_EXT_pixel_transform_color_table */ - -#ifndef GL_EXT_point_parameters -#define GL_EXT_point_parameters 1 -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params); -#endif -#endif /* GL_EXT_point_parameters */ - -#ifndef GL_EXT_polygon_offset -#define GL_EXT_polygon_offset 1 -#define GL_POLYGON_OFFSET_EXT 0x8037 -#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 -#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 -typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); -#endif -#endif /* GL_EXT_polygon_offset */ - -#ifndef GL_EXT_polygon_offset_clamp -#define GL_EXT_polygon_offset_clamp 1 -#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B -typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); -#endif -#endif /* GL_EXT_polygon_offset_clamp */ - -#ifndef GL_EXT_post_depth_coverage -#define GL_EXT_post_depth_coverage 1 -#endif /* GL_EXT_post_depth_coverage */ - -#ifndef GL_EXT_provoking_vertex -#define GL_EXT_provoking_vertex 1 -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D -#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E -#define GL_PROVOKING_VERTEX_EXT 0x8E4F -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); -#endif -#endif /* GL_EXT_provoking_vertex */ - -#ifndef GL_EXT_raster_multisample -#define GL_EXT_raster_multisample 1 -#define GL_RASTER_MULTISAMPLE_EXT 0x9327 -#define GL_RASTER_SAMPLES_EXT 0x9328 -#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 -#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A -#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B -#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C -typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); -#endif -#endif /* GL_EXT_raster_multisample */ - -#ifndef GL_EXT_rescale_normal -#define GL_EXT_rescale_normal 1 -#define GL_RESCALE_NORMAL_EXT 0x803A -#endif /* GL_EXT_rescale_normal */ - -#ifndef GL_EXT_secondary_color -#define GL_EXT_secondary_color 1 -#define GL_COLOR_SUM_EXT 0x8458 -#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D -#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue); -GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v); -GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue); -GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v); -GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue); -GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v); -GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue); -GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v); -GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue); -GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v); -GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue); -GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v); -GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue); -GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v); -GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue); -GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v); -GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer); -#endif -#endif /* GL_EXT_secondary_color */ - -#ifndef GL_EXT_separate_shader_objects -#define GL_EXT_separate_shader_objects 1 -#define GL_ACTIVE_PROGRAM_EXT 0x8B8D -typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); -typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program); -GLAPI void APIENTRY glActiveProgramEXT (GLuint program); -GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string); -#endif -#endif /* GL_EXT_separate_shader_objects */ - -#ifndef GL_EXT_separate_specular_color -#define GL_EXT_separate_specular_color 1 -#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 -#define GL_SINGLE_COLOR_EXT 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA -#endif /* GL_EXT_separate_specular_color */ - -#ifndef GL_EXT_shader_image_load_formatted -#define GL_EXT_shader_image_load_formatted 1 -#endif /* GL_EXT_shader_image_load_formatted */ - -#ifndef GL_EXT_shader_image_load_store -#define GL_EXT_shader_image_load_store 1 -#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 -#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 -#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A -#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B -#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C -#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D -#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E -#define GL_IMAGE_1D_EXT 0x904C -#define GL_IMAGE_2D_EXT 0x904D -#define GL_IMAGE_3D_EXT 0x904E -#define GL_IMAGE_2D_RECT_EXT 0x904F -#define GL_IMAGE_CUBE_EXT 0x9050 -#define GL_IMAGE_BUFFER_EXT 0x9051 -#define GL_IMAGE_1D_ARRAY_EXT 0x9052 -#define GL_IMAGE_2D_ARRAY_EXT 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 -#define GL_INT_IMAGE_1D_EXT 0x9057 -#define GL_INT_IMAGE_2D_EXT 0x9058 -#define GL_INT_IMAGE_3D_EXT 0x9059 -#define GL_INT_IMAGE_2D_RECT_EXT 0x905A -#define GL_INT_IMAGE_CUBE_EXT 0x905B -#define GL_INT_IMAGE_BUFFER_EXT 0x905C -#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D -#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C -#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D -#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 -#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 -#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF -typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); -typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); -GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); -#endif -#endif /* GL_EXT_shader_image_load_store */ - -#ifndef GL_EXT_shader_integer_mix -#define GL_EXT_shader_integer_mix 1 -#endif /* GL_EXT_shader_integer_mix */ - -#ifndef GL_EXT_shadow_funcs -#define GL_EXT_shadow_funcs 1 -#endif /* GL_EXT_shadow_funcs */ - -#ifndef GL_EXT_shared_texture_palette -#define GL_EXT_shared_texture_palette 1 -#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB -#endif /* GL_EXT_shared_texture_palette */ - -#ifndef GL_EXT_sparse_texture2 -#define GL_EXT_sparse_texture2 1 -#endif /* GL_EXT_sparse_texture2 */ - -#ifndef GL_EXT_stencil_clear_tag -#define GL_EXT_stencil_clear_tag 1 -#define GL_STENCIL_TAG_BITS_EXT 0x88F2 -#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 -typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag); -#endif -#endif /* GL_EXT_stencil_clear_tag */ - -#ifndef GL_EXT_stencil_two_side -#define GL_EXT_stencil_two_side 1 -#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 -#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 -typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face); -#endif -#endif /* GL_EXT_stencil_two_side */ - -#ifndef GL_EXT_stencil_wrap -#define GL_EXT_stencil_wrap 1 -#define GL_INCR_WRAP_EXT 0x8507 -#define GL_DECR_WRAP_EXT 0x8508 -#endif /* GL_EXT_stencil_wrap */ - -#ifndef GL_EXT_subtexture -#define GL_EXT_subtexture 1 -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -#endif -#endif /* GL_EXT_subtexture */ - -#ifndef GL_EXT_texture -#define GL_EXT_texture 1 -#define GL_ALPHA4_EXT 0x803B -#define GL_ALPHA8_EXT 0x803C -#define GL_ALPHA12_EXT 0x803D -#define GL_ALPHA16_EXT 0x803E -#define GL_LUMINANCE4_EXT 0x803F -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE12_EXT 0x8041 -#define GL_LUMINANCE16_EXT 0x8042 -#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 -#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 -#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 -#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 -#define GL_INTENSITY_EXT 0x8049 -#define GL_INTENSITY4_EXT 0x804A -#define GL_INTENSITY8_EXT 0x804B -#define GL_INTENSITY12_EXT 0x804C -#define GL_INTENSITY16_EXT 0x804D -#define GL_RGB2_EXT 0x804E -#define GL_RGB4_EXT 0x804F -#define GL_RGB5_EXT 0x8050 -#define GL_RGB8_EXT 0x8051 -#define GL_RGB10_EXT 0x8052 -#define GL_RGB12_EXT 0x8053 -#define GL_RGB16_EXT 0x8054 -#define GL_RGBA2_EXT 0x8055 -#define GL_RGBA4_EXT 0x8056 -#define GL_RGB5_A1_EXT 0x8057 -#define GL_RGBA8_EXT 0x8058 -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGBA12_EXT 0x805A -#define GL_RGBA16_EXT 0x805B -#define GL_TEXTURE_RED_SIZE_EXT 0x805C -#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D -#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E -#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 -#define GL_REPLACE_EXT 0x8062 -#define GL_PROXY_TEXTURE_1D_EXT 0x8063 -#define GL_PROXY_TEXTURE_2D_EXT 0x8064 -#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 -#endif /* GL_EXT_texture */ - -#ifndef GL_EXT_texture3D -#define GL_EXT_texture3D 1 -#define GL_PACK_SKIP_IMAGES_EXT 0x806B -#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C -#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D -#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E -#define GL_TEXTURE_3D_EXT 0x806F -#define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 -typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -#endif -#endif /* GL_EXT_texture3D */ - -#ifndef GL_EXT_texture_array -#define GL_EXT_texture_array 1 -#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 -#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D -#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF -#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#endif -#endif /* GL_EXT_texture_array */ - -#ifndef GL_EXT_texture_buffer_object -#define GL_EXT_texture_buffer_object 1 -#define GL_TEXTURE_BUFFER_EXT 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E -typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); -#endif -#endif /* GL_EXT_texture_buffer_object */ - -#ifndef GL_EXT_texture_compression_latc -#define GL_EXT_texture_compression_latc 1 -#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 -#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 -#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 -#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 -#endif /* GL_EXT_texture_compression_latc */ - -#ifndef GL_EXT_texture_compression_rgtc -#define GL_EXT_texture_compression_rgtc 1 -#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC -#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD -#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE -#endif /* GL_EXT_texture_compression_rgtc */ - -#ifndef GL_EXT_texture_compression_s3tc -#define GL_EXT_texture_compression_s3tc 1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#endif /* GL_EXT_texture_compression_s3tc */ - -#ifndef GL_EXT_texture_cube_map -#define GL_EXT_texture_cube_map 1 -#define GL_NORMAL_MAP_EXT 0x8511 -#define GL_REFLECTION_MAP_EXT 0x8512 -#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C -#endif /* GL_EXT_texture_cube_map */ - -#ifndef GL_EXT_texture_env_add -#define GL_EXT_texture_env_add 1 -#endif /* GL_EXT_texture_env_add */ - -#ifndef GL_EXT_texture_env_combine -#define GL_EXT_texture_env_combine 1 -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858A -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859A -#endif /* GL_EXT_texture_env_combine */ - -#ifndef GL_EXT_texture_env_dot3 -#define GL_EXT_texture_env_dot3 1 -#define GL_DOT3_RGB_EXT 0x8740 -#define GL_DOT3_RGBA_EXT 0x8741 -#endif /* GL_EXT_texture_env_dot3 */ - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif /* GL_EXT_texture_filter_anisotropic */ - -#ifndef GL_EXT_texture_filter_minmax -#define GL_EXT_texture_filter_minmax 1 -#endif /* GL_EXT_texture_filter_minmax */ - -#ifndef GL_EXT_texture_integer -#define GL_EXT_texture_integer 1 -#define GL_RGBA32UI_EXT 0x8D70 -#define GL_RGB32UI_EXT 0x8D71 -#define GL_ALPHA32UI_EXT 0x8D72 -#define GL_INTENSITY32UI_EXT 0x8D73 -#define GL_LUMINANCE32UI_EXT 0x8D74 -#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 -#define GL_RGBA16UI_EXT 0x8D76 -#define GL_RGB16UI_EXT 0x8D77 -#define GL_ALPHA16UI_EXT 0x8D78 -#define GL_INTENSITY16UI_EXT 0x8D79 -#define GL_LUMINANCE16UI_EXT 0x8D7A -#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B -#define GL_RGBA8UI_EXT 0x8D7C -#define GL_RGB8UI_EXT 0x8D7D -#define GL_ALPHA8UI_EXT 0x8D7E -#define GL_INTENSITY8UI_EXT 0x8D7F -#define GL_LUMINANCE8UI_EXT 0x8D80 -#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 -#define GL_RGBA32I_EXT 0x8D82 -#define GL_RGB32I_EXT 0x8D83 -#define GL_ALPHA32I_EXT 0x8D84 -#define GL_INTENSITY32I_EXT 0x8D85 -#define GL_LUMINANCE32I_EXT 0x8D86 -#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 -#define GL_RGBA16I_EXT 0x8D88 -#define GL_RGB16I_EXT 0x8D89 -#define GL_ALPHA16I_EXT 0x8D8A -#define GL_INTENSITY16I_EXT 0x8D8B -#define GL_LUMINANCE16I_EXT 0x8D8C -#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D -#define GL_RGBA8I_EXT 0x8D8E -#define GL_RGB8I_EXT 0x8D8F -#define GL_ALPHA8I_EXT 0x8D90 -#define GL_INTENSITY8I_EXT 0x8D91 -#define GL_LUMINANCE8I_EXT 0x8D92 -#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 -#define GL_RED_INTEGER_EXT 0x8D94 -#define GL_GREEN_INTEGER_EXT 0x8D95 -#define GL_BLUE_INTEGER_EXT 0x8D96 -#define GL_ALPHA_INTEGER_EXT 0x8D97 -#define GL_RGB_INTEGER_EXT 0x8D98 -#define GL_RGBA_INTEGER_EXT 0x8D99 -#define GL_BGR_INTEGER_EXT 0x8D9A -#define GL_BGRA_INTEGER_EXT 0x8D9B -#define GL_LUMINANCE_INTEGER_EXT 0x8D9C -#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D -#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); -typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha); -GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha); -#endif -#endif /* GL_EXT_texture_integer */ - -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif /* GL_EXT_texture_lod_bias */ - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_EXT_texture_mirror_clamp 1 -#define GL_MIRROR_CLAMP_EXT 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 -#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 -#endif /* GL_EXT_texture_mirror_clamp */ - -#ifndef GL_EXT_texture_object -#define GL_EXT_texture_object 1 -#define GL_TEXTURE_PRIORITY_EXT 0x8066 -#define GL_TEXTURE_RESIDENT_EXT 0x8067 -#define GL_TEXTURE_1D_BINDING_EXT 0x8068 -#define GL_TEXTURE_2D_BINDING_EXT 0x8069 -#define GL_TEXTURE_3D_BINDING_EXT 0x806A -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences); -GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture); -GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures); -GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures); -GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture); -GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#endif -#endif /* GL_EXT_texture_object */ - -#ifndef GL_EXT_texture_perturb_normal -#define GL_EXT_texture_perturb_normal 1 -#define GL_PERTURB_EXT 0x85AE -#define GL_TEXTURE_NORMAL_EXT 0x85AF -typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); -#endif -#endif /* GL_EXT_texture_perturb_normal */ - -#ifndef GL_EXT_texture_sRGB -#define GL_EXT_texture_sRGB 1 -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB8_EXT 0x8C41 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 -#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 -#define GL_SLUMINANCE_EXT 0x8C46 -#define GL_SLUMINANCE8_EXT 0x8C47 -#define GL_COMPRESSED_SRGB_EXT 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 -#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B -#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F -#endif /* GL_EXT_texture_sRGB */ - -#ifndef GL_EXT_texture_sRGB_decode -#define GL_EXT_texture_sRGB_decode 1 -#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 -#define GL_DECODE_EXT 0x8A49 -#define GL_SKIP_DECODE_EXT 0x8A4A -#endif /* GL_EXT_texture_sRGB_decode */ - -#ifndef GL_EXT_texture_shared_exponent -#define GL_EXT_texture_shared_exponent 1 -#define GL_RGB9_E5_EXT 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E -#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F -#endif /* GL_EXT_texture_shared_exponent */ - -#ifndef GL_EXT_texture_snorm -#define GL_EXT_texture_snorm 1 -#define GL_ALPHA_SNORM 0x9010 -#define GL_LUMINANCE_SNORM 0x9011 -#define GL_LUMINANCE_ALPHA_SNORM 0x9012 -#define GL_INTENSITY_SNORM 0x9013 -#define GL_ALPHA8_SNORM 0x9014 -#define GL_LUMINANCE8_SNORM 0x9015 -#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 -#define GL_INTENSITY8_SNORM 0x9017 -#define GL_ALPHA16_SNORM 0x9018 -#define GL_LUMINANCE16_SNORM 0x9019 -#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A -#define GL_INTENSITY16_SNORM 0x901B -#define GL_RED_SNORM 0x8F90 -#define GL_RG_SNORM 0x8F91 -#define GL_RGB_SNORM 0x8F92 -#define GL_RGBA_SNORM 0x8F93 -#endif /* GL_EXT_texture_snorm */ - -#ifndef GL_EXT_texture_swizzle -#define GL_EXT_texture_swizzle 1 -#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 -#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 -#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 -#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 -#endif /* GL_EXT_texture_swizzle */ - -#ifndef GL_EXT_timer_query -#define GL_EXT_timer_query 1 -#define GL_TIME_ELAPSED_EXT 0x88BF -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); -#endif -#endif /* GL_EXT_timer_query */ - -#ifndef GL_EXT_transform_feedback -#define GL_EXT_transform_feedback 1 -#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F -#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C -#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D -#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 -#define GL_RASTERIZER_DISCARD_EXT 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedbackEXT (void); -GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -#endif -#endif /* GL_EXT_transform_feedback */ - -#ifndef GL_EXT_vertex_array -#define GL_EXT_vertex_array 1 -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); -typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); -typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, void **params); -typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); -typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glArrayElementEXT (GLint i); -GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); -GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count); -GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer); -GLAPI void APIENTRY glGetPointervEXT (GLenum pname, void **params); -GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer); -GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer); -GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); -GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); -#endif -#endif /* GL_EXT_vertex_array */ - -#ifndef GL_EXT_vertex_array_bgra -#define GL_EXT_vertex_array_bgra 1 -#endif /* GL_EXT_vertex_array_bgra */ - -#ifndef GL_EXT_vertex_attrib_64bit -#define GL_EXT_vertex_attrib_64bit 1 -#define GL_DOUBLE_VEC2_EXT 0x8FFC -#define GL_DOUBLE_VEC3_EXT 0x8FFD -#define GL_DOUBLE_VEC4_EXT 0x8FFE -#define GL_DOUBLE_MAT2_EXT 0x8F46 -#define GL_DOUBLE_MAT3_EXT 0x8F47 -#define GL_DOUBLE_MAT4_EXT 0x8F48 -#define GL_DOUBLE_MAT2x3_EXT 0x8F49 -#define GL_DOUBLE_MAT2x4_EXT 0x8F4A -#define GL_DOUBLE_MAT3x2_EXT 0x8F4B -#define GL_DOUBLE_MAT3x4_EXT 0x8F4C -#define GL_DOUBLE_MAT4x2_EXT 0x8F4D -#define GL_DOUBLE_MAT4x3_EXT 0x8F4E -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params); -#endif -#endif /* GL_EXT_vertex_attrib_64bit */ - -#ifndef GL_EXT_vertex_shader -#define GL_EXT_vertex_shader 1 -#define GL_VERTEX_SHADER_EXT 0x8780 -#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 -#define GL_OP_INDEX_EXT 0x8782 -#define GL_OP_NEGATE_EXT 0x8783 -#define GL_OP_DOT3_EXT 0x8784 -#define GL_OP_DOT4_EXT 0x8785 -#define GL_OP_MUL_EXT 0x8786 -#define GL_OP_ADD_EXT 0x8787 -#define GL_OP_MADD_EXT 0x8788 -#define GL_OP_FRAC_EXT 0x8789 -#define GL_OP_MAX_EXT 0x878A -#define GL_OP_MIN_EXT 0x878B -#define GL_OP_SET_GE_EXT 0x878C -#define GL_OP_SET_LT_EXT 0x878D -#define GL_OP_CLAMP_EXT 0x878E -#define GL_OP_FLOOR_EXT 0x878F -#define GL_OP_ROUND_EXT 0x8790 -#define GL_OP_EXP_BASE_2_EXT 0x8791 -#define GL_OP_LOG_BASE_2_EXT 0x8792 -#define GL_OP_POWER_EXT 0x8793 -#define GL_OP_RECIP_EXT 0x8794 -#define GL_OP_RECIP_SQRT_EXT 0x8795 -#define GL_OP_SUB_EXT 0x8796 -#define GL_OP_CROSS_PRODUCT_EXT 0x8797 -#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 -#define GL_OP_MOV_EXT 0x8799 -#define GL_OUTPUT_VERTEX_EXT 0x879A -#define GL_OUTPUT_COLOR0_EXT 0x879B -#define GL_OUTPUT_COLOR1_EXT 0x879C -#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D -#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E -#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F -#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 -#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 -#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 -#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 -#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 -#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 -#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 -#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 -#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 -#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 -#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA -#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB -#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC -#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD -#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE -#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF -#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 -#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 -#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 -#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 -#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 -#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 -#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 -#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 -#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 -#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 -#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA -#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB -#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC -#define GL_OUTPUT_FOG_EXT 0x87BD -#define GL_SCALAR_EXT 0x87BE -#define GL_VECTOR_EXT 0x87BF -#define GL_MATRIX_EXT 0x87C0 -#define GL_VARIANT_EXT 0x87C1 -#define GL_INVARIANT_EXT 0x87C2 -#define GL_LOCAL_CONSTANT_EXT 0x87C3 -#define GL_LOCAL_EXT 0x87C4 -#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 -#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 -#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 -#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 -#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE -#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF -#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 -#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 -#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 -#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 -#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 -#define GL_X_EXT 0x87D5 -#define GL_Y_EXT 0x87D6 -#define GL_Z_EXT 0x87D7 -#define GL_W_EXT 0x87D8 -#define GL_NEGATIVE_X_EXT 0x87D9 -#define GL_NEGATIVE_Y_EXT 0x87DA -#define GL_NEGATIVE_Z_EXT 0x87DB -#define GL_NEGATIVE_W_EXT 0x87DC -#define GL_ZERO_EXT 0x87DD -#define GL_ONE_EXT 0x87DE -#define GL_NEGATIVE_ONE_EXT 0x87DF -#define GL_NORMALIZED_RANGE_EXT 0x87E0 -#define GL_FULL_RANGE_EXT 0x87E1 -#define GL_CURRENT_VERTEX_EXT 0x87E2 -#define GL_MVP_MATRIX_EXT 0x87E3 -#define GL_VARIANT_VALUE_EXT 0x87E4 -#define GL_VARIANT_DATATYPE_EXT 0x87E5 -#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 -#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 -#define GL_VARIANT_ARRAY_EXT 0x87E8 -#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 -#define GL_INVARIANT_VALUE_EXT 0x87EA -#define GL_INVARIANT_DATATYPE_EXT 0x87EB -#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC -#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED -typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); -typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); -typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const void *addr); -typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const void *addr); -typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); -typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); -typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); -typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); -typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); -typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); -typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); -typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); -typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const void *addr); -typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); -typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); -typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data); -typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVertexShaderEXT (void); -GLAPI void APIENTRY glEndVertexShaderEXT (void); -GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id); -GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range); -GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id); -GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1); -GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num); -GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num); -GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const void *addr); -GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const void *addr); -GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr); -GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr); -GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr); -GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr); -GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr); -GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr); -GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr); -GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr); -GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const void *addr); -GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id); -GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id); -GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value); -GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value); -GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value); -GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value); -GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value); -GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap); -GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); -GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data); -GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); -GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, void **data); -GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); -GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data); -GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); -GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); -GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data); -GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data); -#endif -#endif /* GL_EXT_vertex_shader */ - -#ifndef GL_EXT_vertex_weighting -#define GL_EXT_vertex_weighting 1 -#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 -#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 -#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 -#define GL_MODELVIEW1_MATRIX_EXT 0x8506 -#define GL_VERTEX_WEIGHTING_EXT 0x8509 -#define GL_MODELVIEW0_EXT 0x1700 -#define GL_MODELVIEW1_EXT 0x850A -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F -#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); -GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer); -#endif -#endif /* GL_EXT_vertex_weighting */ - -#ifndef GL_EXT_window_rectangles -#define GL_EXT_window_rectangles 1 -#define GL_INCLUSIVE_EXT 0x8F10 -#define GL_EXCLUSIVE_EXT 0x8F11 -#define GL_WINDOW_RECTANGLE_EXT 0x8F12 -#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 -#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 -#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 -typedef void (APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box); -#endif -#endif /* GL_EXT_window_rectangles */ - -#ifndef GL_EXT_x11_sync_object -#define GL_EXT_x11_sync_object 1 -#define GL_SYNC_X11_FENCE_EXT 0x90E1 -typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); -#endif -#endif /* GL_EXT_x11_sync_object */ - -#ifndef GL_GREMEDY_frame_terminator -#define GL_GREMEDY_frame_terminator 1 -typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); -#endif -#endif /* GL_GREMEDY_frame_terminator */ - -#ifndef GL_GREMEDY_string_marker -#define GL_GREMEDY_string_marker 1 -typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const void *string); -#endif -#endif /* GL_GREMEDY_string_marker */ - -#ifndef GL_HP_convolution_border_modes -#define GL_HP_convolution_border_modes 1 -#define GL_IGNORE_BORDER_HP 0x8150 -#define GL_CONSTANT_BORDER_HP 0x8151 -#define GL_REPLICATE_BORDER_HP 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 -#endif /* GL_HP_convolution_border_modes */ - -#ifndef GL_HP_image_transform -#define GL_HP_image_transform 1 -#define GL_IMAGE_SCALE_X_HP 0x8155 -#define GL_IMAGE_SCALE_Y_HP 0x8156 -#define GL_IMAGE_TRANSLATE_X_HP 0x8157 -#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 -#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 -#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A -#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B -#define GL_IMAGE_MAG_FILTER_HP 0x815C -#define GL_IMAGE_MIN_FILTER_HP 0x815D -#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E -#define GL_CUBIC_HP 0x815F -#define GL_AVERAGE_HP 0x8160 -#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 -#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 -#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params); -#endif -#endif /* GL_HP_image_transform */ - -#ifndef GL_HP_occlusion_test -#define GL_HP_occlusion_test 1 -#define GL_OCCLUSION_TEST_HP 0x8165 -#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 -#endif /* GL_HP_occlusion_test */ - -#ifndef GL_HP_texture_lighting -#define GL_HP_texture_lighting 1 -#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 -#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 -#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 -#endif /* GL_HP_texture_lighting */ - -#ifndef GL_IBM_cull_vertex -#define GL_IBM_cull_vertex 1 -#define GL_CULL_VERTEX_IBM 103050 -#endif /* GL_IBM_cull_vertex */ - -#ifndef GL_IBM_multimode_draw_arrays -#define GL_IBM_multimode_draw_arrays 1 -typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride); -#endif -#endif /* GL_IBM_multimode_draw_arrays */ - -#ifndef GL_IBM_rasterpos_clip -#define GL_IBM_rasterpos_clip 1 -#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 -#endif /* GL_IBM_rasterpos_clip */ - -#ifndef GL_IBM_static_data -#define GL_IBM_static_data 1 -#define GL_ALL_STATIC_DATA_IBM 103060 -#define GL_STATIC_VERTEX_ARRAY_IBM 103061 -typedef void (APIENTRYP PFNGLFLUSHSTATICDATAIBMPROC) (GLenum target); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushStaticDataIBM (GLenum target); -#endif -#endif /* GL_IBM_static_data */ - -#ifndef GL_IBM_texture_mirrored_repeat -#define GL_IBM_texture_mirrored_repeat 1 -#define GL_MIRRORED_REPEAT_IBM 0x8370 -#endif /* GL_IBM_texture_mirrored_repeat */ - -#ifndef GL_IBM_vertex_array_lists -#define GL_IBM_vertex_array_lists 1 -#define GL_VERTEX_ARRAY_LIST_IBM 103070 -#define GL_NORMAL_ARRAY_LIST_IBM 103071 -#define GL_COLOR_ARRAY_LIST_IBM 103072 -#define GL_INDEX_ARRAY_LIST_IBM 103073 -#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 -#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 -#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 -#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 -#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 -#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 -#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 -#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 -#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 -#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 -#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 -#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 -typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean **pointer, GLint ptrstride); -GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); -GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); -GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); -GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); -#endif -#endif /* GL_IBM_vertex_array_lists */ - -#ifndef GL_INGR_blend_func_separate -#define GL_INGR_blend_func_separate 1 -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif -#endif /* GL_INGR_blend_func_separate */ - -#ifndef GL_INGR_color_clamp -#define GL_INGR_color_clamp 1 -#define GL_RED_MIN_CLAMP_INGR 0x8560 -#define GL_GREEN_MIN_CLAMP_INGR 0x8561 -#define GL_BLUE_MIN_CLAMP_INGR 0x8562 -#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 -#define GL_RED_MAX_CLAMP_INGR 0x8564 -#define GL_GREEN_MAX_CLAMP_INGR 0x8565 -#define GL_BLUE_MAX_CLAMP_INGR 0x8566 -#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 -#endif /* GL_INGR_color_clamp */ - -#ifndef GL_INGR_interlace_read -#define GL_INGR_interlace_read 1 -#define GL_INTERLACE_READ_INGR 0x8568 -#endif /* GL_INGR_interlace_read */ - -#ifndef GL_INTEL_conservative_rasterization -#define GL_INTEL_conservative_rasterization 1 -#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE -#endif /* GL_INTEL_conservative_rasterization */ - -#ifndef GL_INTEL_fragment_shader_ordering -#define GL_INTEL_fragment_shader_ordering 1 -#endif /* GL_INTEL_fragment_shader_ordering */ - -#ifndef GL_INTEL_framebuffer_CMAA -#define GL_INTEL_framebuffer_CMAA 1 -typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); -#endif -#endif /* GL_INTEL_framebuffer_CMAA */ - -#ifndef GL_INTEL_map_texture -#define GL_INTEL_map_texture 1 -#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF -#define GL_LAYOUT_DEFAULT_INTEL 0 -#define GL_LAYOUT_LINEAR_INTEL 1 -#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2 -typedef void (APIENTRYP PFNGLSYNCTEXTUREINTELPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level); -typedef void *(APIENTRYP PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSyncTextureINTEL (GLuint texture); -GLAPI void APIENTRY glUnmapTexture2DINTEL (GLuint texture, GLint level); -GLAPI void *APIENTRY glMapTexture2DINTEL (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout); -#endif -#endif /* GL_INTEL_map_texture */ - -#ifndef GL_INTEL_parallel_arrays -#define GL_INTEL_parallel_arrays 1 -#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 -#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 -#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 -#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 -#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 -typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void **pointer); -typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const void **pointer); -GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const void **pointer); -GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const void **pointer); -GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void **pointer); -#endif -#endif /* GL_INTEL_parallel_arrays */ - -#ifndef GL_INTEL_performance_query -#define GL_INTEL_performance_query 1 -#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 -#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 -#define GL_PERFQUERY_WAIT_INTEL 0x83FB -#define GL_PERFQUERY_FLUSH_INTEL 0x83FA -#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 -#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 -#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 -#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 -#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 -#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 -#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 -#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 -#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 -#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA -#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB -#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC -#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD -#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE -#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF -#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 -typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); -typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); -typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); -typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); -typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); -typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); -typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); -typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); -typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); -typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); -GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); -GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); -GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); -GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); -GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); -GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); -GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); -GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); -GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); -#endif -#endif /* GL_INTEL_performance_query */ - -#ifndef GL_MESAX_texture_stack -#define GL_MESAX_texture_stack 1 -#define GL_TEXTURE_1D_STACK_MESAX 0x8759 -#define GL_TEXTURE_2D_STACK_MESAX 0x875A -#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B -#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C -#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D -#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E -#endif /* GL_MESAX_texture_stack */ - -#ifndef GL_MESA_pack_invert -#define GL_MESA_pack_invert 1 -#define GL_PACK_INVERT_MESA 0x8758 -#endif /* GL_MESA_pack_invert */ - -#ifndef GL_MESA_resize_buffers -#define GL_MESA_resize_buffers 1 -typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glResizeBuffersMESA (void); -#endif -#endif /* GL_MESA_resize_buffers */ - -#ifndef GL_MESA_window_pos -#define GL_MESA_window_pos 1 -typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y); -GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v); -GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y); -GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v); -GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y); -GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v); -GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y); -GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v); -GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v); -GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v); -GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z); -GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v); -GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v); -GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v); -GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v); -GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v); -GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v); -#endif -#endif /* GL_MESA_window_pos */ - -#ifndef GL_MESA_ycbcr_texture -#define GL_MESA_ycbcr_texture 1 -#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB -#define GL_YCBCR_MESA 0x8757 -#endif /* GL_MESA_ycbcr_texture */ - -#ifndef GL_NVX_conditional_render -#define GL_NVX_conditional_render 1 -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVXPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginConditionalRenderNVX (GLuint id); -GLAPI void APIENTRY glEndConditionalRenderNVX (void); -#endif -#endif /* GL_NVX_conditional_render */ - -#ifndef GL_NVX_gpu_memory_info -#define GL_NVX_gpu_memory_info 1 -#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 -#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 -#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 -#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A -#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B -#endif /* GL_NVX_gpu_memory_info */ - -#ifndef GL_NV_bindless_multi_draw_indirect -#define GL_NV_bindless_multi_draw_indirect 1 -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); -GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); -#endif -#endif /* GL_NV_bindless_multi_draw_indirect */ - -#ifndef GL_NV_bindless_multi_draw_indirect_count -#define GL_NV_bindless_multi_draw_indirect_count 1 -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); -GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); -#endif -#endif /* GL_NV_bindless_multi_draw_indirect_count */ - -#ifndef GL_NV_bindless_texture -#define GL_NV_bindless_texture 1 -typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); -typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); -typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); -typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); -typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); -typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); -typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); -typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); -typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture); -GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); -GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); -GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); -GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); -GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); -GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); -GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); -GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); -GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); -GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); -GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); -GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); -#endif -#endif /* GL_NV_bindless_texture */ - -#ifndef GL_NV_blend_equation_advanced -#define GL_NV_blend_equation_advanced 1 -#define GL_BLEND_OVERLAP_NV 0x9281 -#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 -#define GL_BLUE_NV 0x1905 -#define GL_COLORBURN_NV 0x929A -#define GL_COLORDODGE_NV 0x9299 -#define GL_CONJOINT_NV 0x9284 -#define GL_CONTRAST_NV 0x92A1 -#define GL_DARKEN_NV 0x9297 -#define GL_DIFFERENCE_NV 0x929E -#define GL_DISJOINT_NV 0x9283 -#define GL_DST_ATOP_NV 0x928F -#define GL_DST_IN_NV 0x928B -#define GL_DST_NV 0x9287 -#define GL_DST_OUT_NV 0x928D -#define GL_DST_OVER_NV 0x9289 -#define GL_EXCLUSION_NV 0x92A0 -#define GL_GREEN_NV 0x1904 -#define GL_HARDLIGHT_NV 0x929B -#define GL_HARDMIX_NV 0x92A9 -#define GL_HSL_COLOR_NV 0x92AF -#define GL_HSL_HUE_NV 0x92AD -#define GL_HSL_LUMINOSITY_NV 0x92B0 -#define GL_HSL_SATURATION_NV 0x92AE -#define GL_INVERT_OVG_NV 0x92B4 -#define GL_INVERT_RGB_NV 0x92A3 -#define GL_LIGHTEN_NV 0x9298 -#define GL_LINEARBURN_NV 0x92A5 -#define GL_LINEARDODGE_NV 0x92A4 -#define GL_LINEARLIGHT_NV 0x92A7 -#define GL_MINUS_CLAMPED_NV 0x92B3 -#define GL_MINUS_NV 0x929F -#define GL_MULTIPLY_NV 0x9294 -#define GL_OVERLAY_NV 0x9296 -#define GL_PINLIGHT_NV 0x92A8 -#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 -#define GL_PLUS_CLAMPED_NV 0x92B1 -#define GL_PLUS_DARKER_NV 0x9292 -#define GL_PLUS_NV 0x9291 -#define GL_RED_NV 0x1903 -#define GL_SCREEN_NV 0x9295 -#define GL_SOFTLIGHT_NV 0x929C -#define GL_SRC_ATOP_NV 0x928E -#define GL_SRC_IN_NV 0x928A -#define GL_SRC_NV 0x9286 -#define GL_SRC_OUT_NV 0x928C -#define GL_SRC_OVER_NV 0x9288 -#define GL_UNCORRELATED_NV 0x9282 -#define GL_VIVIDLIGHT_NV 0x92A6 -#define GL_XOR_NV 0x1506 -typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendParameteriNV (GLenum pname, GLint value); -GLAPI void APIENTRY glBlendBarrierNV (void); -#endif -#endif /* GL_NV_blend_equation_advanced */ - -#ifndef GL_NV_blend_equation_advanced_coherent -#define GL_NV_blend_equation_advanced_coherent 1 -#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 -#endif /* GL_NV_blend_equation_advanced_coherent */ - -#ifndef GL_NV_blend_square -#define GL_NV_blend_square 1 -#endif /* GL_NV_blend_square */ - -#ifndef GL_NV_clip_space_w_scaling -#define GL_NV_clip_space_w_scaling 1 -#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C -#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D -#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E -typedef void (APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff); -#endif -#endif /* GL_NV_clip_space_w_scaling */ - -#ifndef GL_NV_command_list -#define GL_NV_command_list 1 -#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 -#define GL_NOP_COMMAND_NV 0x0001 -#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002 -#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003 -#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004 -#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005 -#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006 -#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007 -#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008 -#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009 -#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A -#define GL_BLEND_COLOR_COMMAND_NV 0x000B -#define GL_STENCIL_REF_COMMAND_NV 0x000C -#define GL_LINE_WIDTH_COMMAND_NV 0x000D -#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E -#define GL_ALPHA_REF_COMMAND_NV 0x000F -#define GL_VIEWPORT_COMMAND_NV 0x0010 -#define GL_SCISSOR_COMMAND_NV 0x0011 -#define GL_FRONT_FACE_COMMAND_NV 0x0012 -typedef void (APIENTRYP PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint *states); -typedef void (APIENTRYP PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint *states); -typedef GLboolean (APIENTRYP PFNGLISSTATENVPROC) (GLuint state); -typedef void (APIENTRYP PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode); -typedef GLuint (APIENTRYP PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size); -typedef GLushort (APIENTRYP PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype); -typedef void (APIENTRYP PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); -typedef void (APIENTRYP PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); -typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); -typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); -typedef void (APIENTRYP PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint *lists); -typedef void (APIENTRYP PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint *lists); -typedef GLboolean (APIENTRYP PFNGLISCOMMANDLISTNVPROC) (GLuint list); -typedef void (APIENTRYP PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); -typedef void (APIENTRYP PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments); -typedef void (APIENTRYP PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list); -typedef void (APIENTRYP PFNGLCALLCOMMANDLISTNVPROC) (GLuint list); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCreateStatesNV (GLsizei n, GLuint *states); -GLAPI void APIENTRY glDeleteStatesNV (GLsizei n, const GLuint *states); -GLAPI GLboolean APIENTRY glIsStateNV (GLuint state); -GLAPI void APIENTRY glStateCaptureNV (GLuint state, GLenum mode); -GLAPI GLuint APIENTRY glGetCommandHeaderNV (GLenum tokenID, GLuint size); -GLAPI GLushort APIENTRY glGetStageIndexNV (GLenum shadertype); -GLAPI void APIENTRY glDrawCommandsNV (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); -GLAPI void APIENTRY glDrawCommandsAddressNV (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); -GLAPI void APIENTRY glDrawCommandsStatesNV (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); -GLAPI void APIENTRY glDrawCommandsStatesAddressNV (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); -GLAPI void APIENTRY glCreateCommandListsNV (GLsizei n, GLuint *lists); -GLAPI void APIENTRY glDeleteCommandListsNV (GLsizei n, const GLuint *lists); -GLAPI GLboolean APIENTRY glIsCommandListNV (GLuint list); -GLAPI void APIENTRY glListDrawCommandsStatesClientNV (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); -GLAPI void APIENTRY glCommandListSegmentsNV (GLuint list, GLuint segments); -GLAPI void APIENTRY glCompileCommandListNV (GLuint list); -GLAPI void APIENTRY glCallCommandListNV (GLuint list); -#endif -#endif /* GL_NV_command_list */ - -#ifndef GL_NV_compute_program5 -#define GL_NV_compute_program5 1 -#define GL_COMPUTE_PROGRAM_NV 0x90FB -#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC -#endif /* GL_NV_compute_program5 */ - -#ifndef GL_NV_conditional_render -#define GL_NV_conditional_render 1 -#define GL_QUERY_WAIT_NV 0x8E13 -#define GL_QUERY_NO_WAIT_NV 0x8E14 -#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); -GLAPI void APIENTRY glEndConditionalRenderNV (void); -#endif -#endif /* GL_NV_conditional_render */ - -#ifndef GL_NV_conservative_raster -#define GL_NV_conservative_raster 1 -#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 -#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 -#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 -#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 -typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); -#endif -#endif /* GL_NV_conservative_raster */ - -#ifndef GL_NV_conservative_raster_dilate -#define GL_NV_conservative_raster_dilate 1 -#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379 -#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A -#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B -typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value); -#endif -#endif /* GL_NV_conservative_raster_dilate */ - -#ifndef GL_NV_conservative_raster_pre_snap_triangles -#define GL_NV_conservative_raster_pre_snap_triangles 1 -#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D -#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E -#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F -typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param); -#endif -#endif /* GL_NV_conservative_raster_pre_snap_triangles */ - -#ifndef GL_NV_copy_depth_to_color -#define GL_NV_copy_depth_to_color 1 -#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E -#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F -#endif /* GL_NV_copy_depth_to_color */ - -#ifndef GL_NV_copy_image -#define GL_NV_copy_image 1 -typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#endif -#endif /* GL_NV_copy_image */ - -#ifndef GL_NV_deep_texture3D -#define GL_NV_deep_texture3D 1 -#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0 -#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1 -#endif /* GL_NV_deep_texture3D */ - -#ifndef GL_NV_depth_buffer_float -#define GL_NV_depth_buffer_float 1 -#define GL_DEPTH_COMPONENT32F_NV 0x8DAB -#define GL_DEPTH32F_STENCIL8_NV 0x8DAC -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD -#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF -typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); -typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar); -GLAPI void APIENTRY glClearDepthdNV (GLdouble depth); -GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax); -#endif -#endif /* GL_NV_depth_buffer_float */ - -#ifndef GL_NV_depth_clamp -#define GL_NV_depth_clamp 1 -#define GL_DEPTH_CLAMP_NV 0x864F -#endif /* GL_NV_depth_clamp */ - -#ifndef GL_NV_draw_texture -#define GL_NV_draw_texture 1 -typedef void (APIENTRYP PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); -#endif -#endif /* GL_NV_draw_texture */ - -#ifndef GL_NV_evaluators -#define GL_NV_evaluators 1 -#define GL_EVAL_2D_NV 0x86C0 -#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 -#define GL_MAP_TESSELLATION_NV 0x86C2 -#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 -#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 -#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 -#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 -#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 -#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 -#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 -#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA -#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB -#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC -#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD -#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE -#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF -#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 -#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 -#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 -#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 -#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 -#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 -#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 -#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 -typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); -typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); -GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); -GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode); -#endif -#endif /* GL_NV_evaluators */ - -#ifndef GL_NV_explicit_multisample -#define GL_NV_explicit_multisample 1 -#define GL_SAMPLE_POSITION_NV 0x8E50 -#define GL_SAMPLE_MASK_NV 0x8E51 -#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 -#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 -#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 -#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 -#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 -#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 -#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 -#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); -typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask); -GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer); -#endif -#endif /* GL_NV_explicit_multisample */ - -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); -GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); -GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence); -GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence); -GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); -GLAPI void APIENTRY glFinishFenceNV (GLuint fence); -GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); -#endif -#endif /* GL_NV_fence */ - -#ifndef GL_NV_fill_rectangle -#define GL_NV_fill_rectangle 1 -#define GL_FILL_RECTANGLE_NV 0x933C -#endif /* GL_NV_fill_rectangle */ - -#ifndef GL_NV_float_buffer -#define GL_NV_float_buffer 1 -#define GL_FLOAT_R_NV 0x8880 -#define GL_FLOAT_RG_NV 0x8881 -#define GL_FLOAT_RGB_NV 0x8882 -#define GL_FLOAT_RGBA_NV 0x8883 -#define GL_FLOAT_R16_NV 0x8884 -#define GL_FLOAT_R32_NV 0x8885 -#define GL_FLOAT_RG16_NV 0x8886 -#define GL_FLOAT_RG32_NV 0x8887 -#define GL_FLOAT_RGB16_NV 0x8888 -#define GL_FLOAT_RGB32_NV 0x8889 -#define GL_FLOAT_RGBA16_NV 0x888A -#define GL_FLOAT_RGBA32_NV 0x888B -#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C -#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D -#define GL_FLOAT_RGBA_MODE_NV 0x888E -#endif /* GL_NV_float_buffer */ - -#ifndef GL_NV_fog_distance -#define GL_NV_fog_distance 1 -#define GL_FOG_DISTANCE_MODE_NV 0x855A -#define GL_EYE_RADIAL_NV 0x855B -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C -#endif /* GL_NV_fog_distance */ - -#ifndef GL_NV_fragment_coverage_to_color -#define GL_NV_fragment_coverage_to_color 1 -#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD -#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE -typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color); -#endif -#endif /* GL_NV_fragment_coverage_to_color */ - -#ifndef GL_NV_fragment_program -#define GL_NV_fragment_program 1 -#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 -#define GL_FRAGMENT_PROGRAM_NV 0x8870 -#define GL_MAX_TEXTURE_COORDS_NV 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 -#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 -#define GL_PROGRAM_ERROR_STRING_NV 0x8874 -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#endif -#endif /* GL_NV_fragment_program */ - -#ifndef GL_NV_fragment_program2 -#define GL_NV_fragment_program2 1 -#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 -#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 -#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 -#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 -#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 -#endif /* GL_NV_fragment_program2 */ - -#ifndef GL_NV_fragment_program4 -#define GL_NV_fragment_program4 1 -#endif /* GL_NV_fragment_program4 */ - -#ifndef GL_NV_fragment_program_option -#define GL_NV_fragment_program_option 1 -#endif /* GL_NV_fragment_program_option */ - -#ifndef GL_NV_fragment_shader_interlock -#define GL_NV_fragment_shader_interlock 1 -#endif /* GL_NV_fragment_shader_interlock */ - -#ifndef GL_NV_framebuffer_mixed_samples -#define GL_NV_framebuffer_mixed_samples 1 -#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 -#define GL_COLOR_SAMPLES_NV 0x8E20 -#define GL_DEPTH_SAMPLES_NV 0x932D -#define GL_STENCIL_SAMPLES_NV 0x932E -#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F -#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 -#define GL_COVERAGE_MODULATION_NV 0x9332 -#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 -typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); -typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); -typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); -GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); -GLAPI void APIENTRY glCoverageModulationNV (GLenum components); -#endif -#endif /* GL_NV_framebuffer_mixed_samples */ - -#ifndef GL_NV_framebuffer_multisample_coverage -#define GL_NV_framebuffer_multisample_coverage 1 -#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB -#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 -#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 -#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -#endif /* GL_NV_framebuffer_multisample_coverage */ - -#ifndef GL_NV_geometry_program4 -#define GL_NV_geometry_program4 1 -#define GL_GEOMETRY_PROGRAM_NV 0x8C26 -#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 -#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 -typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); -GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif -#endif /* GL_NV_geometry_program4 */ - -#ifndef GL_NV_geometry_shader4 -#define GL_NV_geometry_shader4 1 -#endif /* GL_NV_geometry_shader4 */ - -#ifndef GL_NV_geometry_shader_passthrough -#define GL_NV_geometry_shader_passthrough 1 -#endif /* GL_NV_geometry_shader_passthrough */ - -#ifndef GL_NV_gpu_program4 -#define GL_NV_gpu_program4 1 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 -#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 -#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 -#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 -#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 -#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 -#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params); -GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); -GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params); -GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); -GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params); -GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params); -GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params); -GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params); -#endif -#endif /* GL_NV_gpu_program4 */ - -#ifndef GL_NV_gpu_program5 -#define GL_NV_gpu_program5 1 -#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C -#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F -#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 -#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 -typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param); -#endif -#endif /* GL_NV_gpu_program5 */ - -#ifndef GL_NV_gpu_program5_mem_extended -#define GL_NV_gpu_program5_mem_extended 1 -#endif /* GL_NV_gpu_program5_mem_extended */ - -#ifndef GL_NV_gpu_shader5 -#define GL_NV_gpu_shader5 1 -#endif /* GL_NV_gpu_shader5 */ - -#ifndef GL_NV_half_float -#define GL_NV_half_float 1 -typedef unsigned short GLhalfNV; -#define GL_HALF_FLOAT_NV 0x140B -typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); -typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); -typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y); -GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z); -GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s); -GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t); -GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r); -GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s); -GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t); -GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog); -GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog); -GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight); -GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight); -GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x); -GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y); -GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -#endif -#endif /* GL_NV_half_float */ - -#ifndef GL_NV_internalformat_sample_query -#define GL_NV_internalformat_sample_query 1 -#define GL_MULTISAMPLES_NV 0x9371 -#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 -#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 -#define GL_CONFORMANT_NV 0x9374 -typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); -#endif -#endif /* GL_NV_internalformat_sample_query */ - -#ifndef GL_NV_light_max_exponent -#define GL_NV_light_max_exponent 1 -#define GL_MAX_SHININESS_NV 0x8504 -#define GL_MAX_SPOT_EXPONENT_NV 0x8505 -#endif /* GL_NV_light_max_exponent */ - -#ifndef GL_NV_multisample_coverage -#define GL_NV_multisample_coverage 1 -#endif /* GL_NV_multisample_coverage */ - -#ifndef GL_NV_multisample_filter_hint -#define GL_NV_multisample_filter_hint 1 -#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 -#endif /* GL_NV_multisample_filter_hint */ - -#ifndef GL_NV_occlusion_query -#define GL_NV_occlusion_query 1 -#define GL_PIXEL_COUNTER_BITS_NV 0x8864 -#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 -#define GL_PIXEL_COUNT_NV 0x8866 -#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 -typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id); -GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id); -GLAPI void APIENTRY glEndOcclusionQueryNV (void); -GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params); -#endif -#endif /* GL_NV_occlusion_query */ - -#ifndef GL_NV_packed_depth_stencil -#define GL_NV_packed_depth_stencil 1 -#define GL_DEPTH_STENCIL_NV 0x84F9 -#define GL_UNSIGNED_INT_24_8_NV 0x84FA -#endif /* GL_NV_packed_depth_stencil */ - -#ifndef GL_NV_parameter_buffer_object -#define GL_NV_parameter_buffer_object 1 -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 -#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 -#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 -#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params); -GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params); -GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params); -#endif -#endif /* GL_NV_parameter_buffer_object */ - -#ifndef GL_NV_parameter_buffer_object2 -#define GL_NV_parameter_buffer_object2 1 -#endif /* GL_NV_parameter_buffer_object2 */ - -#ifndef GL_NV_path_rendering -#define GL_NV_path_rendering 1 -#define GL_PATH_FORMAT_SVG_NV 0x9070 -#define GL_PATH_FORMAT_PS_NV 0x9071 -#define GL_STANDARD_FONT_NAME_NV 0x9072 -#define GL_SYSTEM_FONT_NAME_NV 0x9073 -#define GL_FILE_NAME_NV 0x9074 -#define GL_PATH_STROKE_WIDTH_NV 0x9075 -#define GL_PATH_END_CAPS_NV 0x9076 -#define GL_PATH_INITIAL_END_CAP_NV 0x9077 -#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 -#define GL_PATH_JOIN_STYLE_NV 0x9079 -#define GL_PATH_MITER_LIMIT_NV 0x907A -#define GL_PATH_DASH_CAPS_NV 0x907B -#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C -#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D -#define GL_PATH_DASH_OFFSET_NV 0x907E -#define GL_PATH_CLIENT_LENGTH_NV 0x907F -#define GL_PATH_FILL_MODE_NV 0x9080 -#define GL_PATH_FILL_MASK_NV 0x9081 -#define GL_PATH_FILL_COVER_MODE_NV 0x9082 -#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 -#define GL_PATH_STROKE_MASK_NV 0x9084 -#define GL_COUNT_UP_NV 0x9088 -#define GL_COUNT_DOWN_NV 0x9089 -#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A -#define GL_CONVEX_HULL_NV 0x908B -#define GL_BOUNDING_BOX_NV 0x908D -#define GL_TRANSLATE_X_NV 0x908E -#define GL_TRANSLATE_Y_NV 0x908F -#define GL_TRANSLATE_2D_NV 0x9090 -#define GL_TRANSLATE_3D_NV 0x9091 -#define GL_AFFINE_2D_NV 0x9092 -#define GL_AFFINE_3D_NV 0x9094 -#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 -#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 -#define GL_UTF8_NV 0x909A -#define GL_UTF16_NV 0x909B -#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C -#define GL_PATH_COMMAND_COUNT_NV 0x909D -#define GL_PATH_COORD_COUNT_NV 0x909E -#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F -#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 -#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 -#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 -#define GL_SQUARE_NV 0x90A3 -#define GL_ROUND_NV 0x90A4 -#define GL_TRIANGULAR_NV 0x90A5 -#define GL_BEVEL_NV 0x90A6 -#define GL_MITER_REVERT_NV 0x90A7 -#define GL_MITER_TRUNCATE_NV 0x90A8 -#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 -#define GL_USE_MISSING_GLYPH_NV 0x90AA -#define GL_PATH_ERROR_POSITION_NV 0x90AB -#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD -#define GL_ADJACENT_PAIRS_NV 0x90AE -#define GL_FIRST_TO_REST_NV 0x90AF -#define GL_PATH_GEN_MODE_NV 0x90B0 -#define GL_PATH_GEN_COEFF_NV 0x90B1 -#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 -#define GL_PATH_STENCIL_FUNC_NV 0x90B7 -#define GL_PATH_STENCIL_REF_NV 0x90B8 -#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 -#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD -#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE -#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF -#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 -#define GL_MOVE_TO_RESETS_NV 0x90B5 -#define GL_MOVE_TO_CONTINUES_NV 0x90B6 -#define GL_CLOSE_PATH_NV 0x00 -#define GL_MOVE_TO_NV 0x02 -#define GL_RELATIVE_MOVE_TO_NV 0x03 -#define GL_LINE_TO_NV 0x04 -#define GL_RELATIVE_LINE_TO_NV 0x05 -#define GL_HORIZONTAL_LINE_TO_NV 0x06 -#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 -#define GL_VERTICAL_LINE_TO_NV 0x08 -#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 -#define GL_QUADRATIC_CURVE_TO_NV 0x0A -#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B -#define GL_CUBIC_CURVE_TO_NV 0x0C -#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D -#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E -#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F -#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 -#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 -#define GL_SMALL_CCW_ARC_TO_NV 0x12 -#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 -#define GL_SMALL_CW_ARC_TO_NV 0x14 -#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 -#define GL_LARGE_CCW_ARC_TO_NV 0x16 -#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 -#define GL_LARGE_CW_ARC_TO_NV 0x18 -#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 -#define GL_RESTART_PATH_NV 0xF0 -#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 -#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 -#define GL_RECT_NV 0xF6 -#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 -#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA -#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC -#define GL_ARC_TO_NV 0xFE -#define GL_RELATIVE_ARC_TO_NV 0xFF -#define GL_BOLD_BIT_NV 0x01 -#define GL_ITALIC_BIT_NV 0x02 -#define GL_GLYPH_WIDTH_BIT_NV 0x01 -#define GL_GLYPH_HEIGHT_BIT_NV 0x02 -#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 -#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 -#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 -#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 -#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 -#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 -#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 -#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 -#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 -#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 -#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 -#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 -#define GL_FONT_ASCENDER_BIT_NV 0x00200000 -#define GL_FONT_DESCENDER_BIT_NV 0x00400000 -#define GL_FONT_HEIGHT_BIT_NV 0x00800000 -#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 -#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 -#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 -#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 -#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 -#define GL_ROUNDED_RECT_NV 0xE8 -#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 -#define GL_ROUNDED_RECT2_NV 0xEA -#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB -#define GL_ROUNDED_RECT4_NV 0xEC -#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED -#define GL_ROUNDED_RECT8_NV 0xEE -#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF -#define GL_RELATIVE_RECT_NV 0xF7 -#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 -#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 -#define GL_FONT_UNAVAILABLE_NV 0x936A -#define GL_FONT_UNINTELLIGIBLE_NV 0x936B -#define GL_CONIC_CURVE_TO_NV 0x1A -#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B -#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 -#define GL_STANDARD_FONT_FORMAT_NV 0x936C -#define GL_2_BYTES_NV 0x1407 -#define GL_3_BYTES_NV 0x1408 -#define GL_4_BYTES_NV 0x1409 -#define GL_EYE_LINEAR_NV 0x2400 -#define GL_OBJECT_LINEAR_NV 0x2401 -#define GL_CONSTANT_NV 0x8576 -#define GL_PATH_FOG_GEN_MODE_NV 0x90AC -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D -#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 -#define GL_PATH_PROJECTION_NV 0x1701 -#define GL_PATH_MODELVIEW_NV 0x1700 -#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 -#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 -#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 -#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 -#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 -#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 -#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 -#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 -#define GL_FRAGMENT_INPUT_NV 0x936D -typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); -typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); -typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); -typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); -typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); -typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); -typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); -typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); -typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); -typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); -typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); -typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); -typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); -typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); -typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); -typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); -typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); -typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); -typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); -typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); -typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); -typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); -typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); -typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); -typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); -typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); -typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); -typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); -typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); -typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); -typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); -typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); -typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); -typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); -typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); -typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); -typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); -typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); -GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); -GLAPI GLboolean APIENTRY glIsPathNV (GLuint path); -GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); -GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); -GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); -GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); -GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); -GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); -GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); -GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); -GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); -GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); -GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); -GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); -GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); -GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); -GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); -GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); -GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); -GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); -GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); -GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); -GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); -GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); -GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); -GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); -GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); -GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); -GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); -GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); -GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); -GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); -GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); -GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); -GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); -GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); -GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); -GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); -GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); -GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); -GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); -GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); -GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); -GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); -GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); -#endif -#endif /* GL_NV_path_rendering */ - -#ifndef GL_NV_path_rendering_shared_edge -#define GL_NV_path_rendering_shared_edge 1 -#define GL_SHARED_EDGE_NV 0xC0 -#endif /* GL_NV_path_rendering_shared_edge */ - -#ifndef GL_NV_pixel_data_range -#define GL_NV_pixel_data_range 1 -#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 -#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 -#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A -#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B -#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C -#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const void *pointer); -typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const void *pointer); -GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); -#endif -#endif /* GL_NV_pixel_data_range */ - -#ifndef GL_NV_point_sprite -#define GL_NV_point_sprite 1 -#define GL_POINT_SPRITE_NV 0x8861 -#define GL_COORD_REPLACE_NV 0x8862 -#define GL_POINT_SPRITE_R_MODE_NV 0x8863 -typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param); -GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params); -#endif -#endif /* GL_NV_point_sprite */ - -#ifndef GL_NV_present_video -#define GL_NV_present_video 1 -#define GL_FRAME_NV 0x8E26 -#define GL_FIELDS_NV 0x8E27 -#define GL_CURRENT_TIME_NV 0x8E28 -#define GL_NUM_FILL_STREAMS_NV 0x8E29 -#define GL_PRESENT_TIME_NV 0x8E2A -#define GL_PRESENT_DURATION_NV 0x8E2B -typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); -typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); -typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); -GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); -GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params); -GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params); -GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params); -#endif -#endif /* GL_NV_present_video */ - -#ifndef GL_NV_primitive_restart -#define GL_NV_primitive_restart 1 -#define GL_PRIMITIVE_RESTART_NV 0x8558 -#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPrimitiveRestartNV (void); -GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); -#endif -#endif /* GL_NV_primitive_restart */ - -#ifndef GL_NV_register_combiners -#define GL_NV_register_combiners 1 -#define GL_REGISTER_COMBINERS_NV 0x8522 -#define GL_VARIABLE_A_NV 0x8523 -#define GL_VARIABLE_B_NV 0x8524 -#define GL_VARIABLE_C_NV 0x8525 -#define GL_VARIABLE_D_NV 0x8526 -#define GL_VARIABLE_E_NV 0x8527 -#define GL_VARIABLE_F_NV 0x8528 -#define GL_VARIABLE_G_NV 0x8529 -#define GL_CONSTANT_COLOR0_NV 0x852A -#define GL_CONSTANT_COLOR1_NV 0x852B -#define GL_SPARE0_NV 0x852E -#define GL_SPARE1_NV 0x852F -#define GL_DISCARD_NV 0x8530 -#define GL_E_TIMES_F_NV 0x8531 -#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 -#define GL_UNSIGNED_IDENTITY_NV 0x8536 -#define GL_UNSIGNED_INVERT_NV 0x8537 -#define GL_EXPAND_NORMAL_NV 0x8538 -#define GL_EXPAND_NEGATE_NV 0x8539 -#define GL_HALF_BIAS_NORMAL_NV 0x853A -#define GL_HALF_BIAS_NEGATE_NV 0x853B -#define GL_SIGNED_IDENTITY_NV 0x853C -#define GL_SIGNED_NEGATE_NV 0x853D -#define GL_SCALE_BY_TWO_NV 0x853E -#define GL_SCALE_BY_FOUR_NV 0x853F -#define GL_SCALE_BY_ONE_HALF_NV 0x8540 -#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 -#define GL_COMBINER_INPUT_NV 0x8542 -#define GL_COMBINER_MAPPING_NV 0x8543 -#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 -#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 -#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 -#define GL_COMBINER_MUX_SUM_NV 0x8547 -#define GL_COMBINER_SCALE_NV 0x8548 -#define GL_COMBINER_BIAS_NV 0x8549 -#define GL_COMBINER_AB_OUTPUT_NV 0x854A -#define GL_COMBINER_CD_OUTPUT_NV 0x854B -#define GL_COMBINER_SUM_OUTPUT_NV 0x854C -#define GL_MAX_GENERAL_COMBINERS_NV 0x854D -#define GL_NUM_GENERAL_COMBINERS_NV 0x854E -#define GL_COLOR_SUM_CLAMP_NV 0x854F -#define GL_COMBINER0_NV 0x8550 -#define GL_COMBINER1_NV 0x8551 -#define GL_COMBINER2_NV 0x8552 -#define GL_COMBINER3_NV 0x8553 -#define GL_COMBINER4_NV 0x8554 -#define GL_COMBINER5_NV 0x8555 -#define GL_COMBINER6_NV 0x8556 -#define GL_COMBINER7_NV 0x8557 -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param); -GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params); -GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param); -GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params); -#endif -#endif /* GL_NV_register_combiners */ - -#ifndef GL_NV_register_combiners2 -#define GL_NV_register_combiners2 1 -#define GL_PER_STAGE_CONSTANTS_NV 0x8535 -typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params); -#endif -#endif /* GL_NV_register_combiners2 */ - -#ifndef GL_NV_robustness_video_memory_purge -#define GL_NV_robustness_video_memory_purge 1 -#define GL_PURGED_CONTEXT_RESET_NV 0x92BB -#endif /* GL_NV_robustness_video_memory_purge */ - -#ifndef GL_NV_sample_locations -#define GL_NV_sample_locations 1 -#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D -#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E -#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 -#define GL_SAMPLE_LOCATION_NV 0x8E50 -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 -#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 -#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 -typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glResolveDepthValuesNV (void); -#endif -#endif /* GL_NV_sample_locations */ - -#ifndef GL_NV_sample_mask_override_coverage -#define GL_NV_sample_mask_override_coverage 1 -#endif /* GL_NV_sample_mask_override_coverage */ - -#ifndef GL_NV_shader_atomic_counters -#define GL_NV_shader_atomic_counters 1 -#endif /* GL_NV_shader_atomic_counters */ - -#ifndef GL_NV_shader_atomic_float -#define GL_NV_shader_atomic_float 1 -#endif /* GL_NV_shader_atomic_float */ - -#ifndef GL_NV_shader_atomic_float64 -#define GL_NV_shader_atomic_float64 1 -#endif /* GL_NV_shader_atomic_float64 */ - -#ifndef GL_NV_shader_atomic_fp16_vector -#define GL_NV_shader_atomic_fp16_vector 1 -#endif /* GL_NV_shader_atomic_fp16_vector */ - -#ifndef GL_NV_shader_atomic_int64 -#define GL_NV_shader_atomic_int64 1 -#endif /* GL_NV_shader_atomic_int64 */ - -#ifndef GL_NV_shader_buffer_load -#define GL_NV_shader_buffer_load 1 -#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D -#define GL_GPU_ADDRESS_NV 0x8F34 -#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 -typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); -typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); -typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); -typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); -typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); -typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result); -typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); -typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access); -GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target); -GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target); -GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access); -GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer); -GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer); -GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params); -GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params); -GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result); -GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value); -GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value); -GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif -#endif /* GL_NV_shader_buffer_load */ - -#ifndef GL_NV_shader_buffer_store -#define GL_NV_shader_buffer_store 1 -#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 -#endif /* GL_NV_shader_buffer_store */ - -#ifndef GL_NV_shader_storage_buffer_object -#define GL_NV_shader_storage_buffer_object 1 -#endif /* GL_NV_shader_storage_buffer_object */ - -#ifndef GL_NV_shader_thread_group -#define GL_NV_shader_thread_group 1 -#define GL_WARP_SIZE_NV 0x9339 -#define GL_WARPS_PER_SM_NV 0x933A -#define GL_SM_COUNT_NV 0x933B -#endif /* GL_NV_shader_thread_group */ - -#ifndef GL_NV_shader_thread_shuffle -#define GL_NV_shader_thread_shuffle 1 -#endif /* GL_NV_shader_thread_shuffle */ - -#ifndef GL_NV_stereo_view_rendering -#define GL_NV_stereo_view_rendering 1 -#endif /* GL_NV_stereo_view_rendering */ - -#ifndef GL_NV_tessellation_program5 -#define GL_NV_tessellation_program5 1 -#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 -#define GL_TESS_CONTROL_PROGRAM_NV 0x891E -#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F -#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 -#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 -#endif /* GL_NV_tessellation_program5 */ - -#ifndef GL_NV_texgen_emboss -#define GL_NV_texgen_emboss 1 -#define GL_EMBOSS_LIGHT_NV 0x855D -#define GL_EMBOSS_CONSTANT_NV 0x855E -#define GL_EMBOSS_MAP_NV 0x855F -#endif /* GL_NV_texgen_emboss */ - -#ifndef GL_NV_texgen_reflection -#define GL_NV_texgen_reflection 1 -#define GL_NORMAL_MAP_NV 0x8511 -#define GL_REFLECTION_MAP_NV 0x8512 -#endif /* GL_NV_texgen_reflection */ - -#ifndef GL_NV_texture_barrier -#define GL_NV_texture_barrier 1 -typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureBarrierNV (void); -#endif -#endif /* GL_NV_texture_barrier */ - -#ifndef GL_NV_texture_compression_vtc -#define GL_NV_texture_compression_vtc 1 -#endif /* GL_NV_texture_compression_vtc */ - -#ifndef GL_NV_texture_env_combine4 -#define GL_NV_texture_env_combine4 1 -#define GL_COMBINE4_NV 0x8503 -#define GL_SOURCE3_RGB_NV 0x8583 -#define GL_SOURCE3_ALPHA_NV 0x858B -#define GL_OPERAND3_RGB_NV 0x8593 -#define GL_OPERAND3_ALPHA_NV 0x859B -#endif /* GL_NV_texture_env_combine4 */ - -#ifndef GL_NV_texture_expand_normal -#define GL_NV_texture_expand_normal 1 -#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F -#endif /* GL_NV_texture_expand_normal */ - -#ifndef GL_NV_texture_multisample -#define GL_NV_texture_multisample 1 -#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 -#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); -GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); -GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); -GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); -GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); -GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); -#endif -#endif /* GL_NV_texture_multisample */ - -#ifndef GL_NV_texture_rectangle -#define GL_NV_texture_rectangle 1 -#define GL_TEXTURE_RECTANGLE_NV 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 -#endif /* GL_NV_texture_rectangle */ - -#ifndef GL_NV_texture_shader -#define GL_NV_texture_shader 1 -#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C -#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D -#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E -#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 -#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA -#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB -#define GL_DSDT_MAG_INTENSITY_NV 0x86DC -#define GL_SHADER_CONSISTENT_NV 0x86DD -#define GL_TEXTURE_SHADER_NV 0x86DE -#define GL_SHADER_OPERATION_NV 0x86DF -#define GL_CULL_MODES_NV 0x86E0 -#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 -#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 -#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 -#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1 -#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2 -#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3 -#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 -#define GL_CONST_EYE_NV 0x86E5 -#define GL_PASS_THROUGH_NV 0x86E6 -#define GL_CULL_FRAGMENT_NV 0x86E7 -#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 -#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 -#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA -#define GL_DOT_PRODUCT_NV 0x86EC -#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED -#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE -#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 -#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 -#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 -#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 -#define GL_HILO_NV 0x86F4 -#define GL_DSDT_NV 0x86F5 -#define GL_DSDT_MAG_NV 0x86F6 -#define GL_DSDT_MAG_VIB_NV 0x86F7 -#define GL_HILO16_NV 0x86F8 -#define GL_SIGNED_HILO_NV 0x86F9 -#define GL_SIGNED_HILO16_NV 0x86FA -#define GL_SIGNED_RGBA_NV 0x86FB -#define GL_SIGNED_RGBA8_NV 0x86FC -#define GL_SIGNED_RGB_NV 0x86FE -#define GL_SIGNED_RGB8_NV 0x86FF -#define GL_SIGNED_LUMINANCE_NV 0x8701 -#define GL_SIGNED_LUMINANCE8_NV 0x8702 -#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 -#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 -#define GL_SIGNED_ALPHA_NV 0x8705 -#define GL_SIGNED_ALPHA8_NV 0x8706 -#define GL_SIGNED_INTENSITY_NV 0x8707 -#define GL_SIGNED_INTENSITY8_NV 0x8708 -#define GL_DSDT8_NV 0x8709 -#define GL_DSDT8_MAG8_NV 0x870A -#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B -#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C -#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D -#define GL_HI_SCALE_NV 0x870E -#define GL_LO_SCALE_NV 0x870F -#define GL_DS_SCALE_NV 0x8710 -#define GL_DT_SCALE_NV 0x8711 -#define GL_MAGNITUDE_SCALE_NV 0x8712 -#define GL_VIBRANCE_SCALE_NV 0x8713 -#define GL_HI_BIAS_NV 0x8714 -#define GL_LO_BIAS_NV 0x8715 -#define GL_DS_BIAS_NV 0x8716 -#define GL_DT_BIAS_NV 0x8717 -#define GL_MAGNITUDE_BIAS_NV 0x8718 -#define GL_VIBRANCE_BIAS_NV 0x8719 -#define GL_TEXTURE_BORDER_VALUES_NV 0x871A -#define GL_TEXTURE_HI_SIZE_NV 0x871B -#define GL_TEXTURE_LO_SIZE_NV 0x871C -#define GL_TEXTURE_DS_SIZE_NV 0x871D -#define GL_TEXTURE_DT_SIZE_NV 0x871E -#define GL_TEXTURE_MAG_SIZE_NV 0x871F -#endif /* GL_NV_texture_shader */ - -#ifndef GL_NV_texture_shader2 -#define GL_NV_texture_shader2 1 -#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF -#endif /* GL_NV_texture_shader2 */ - -#ifndef GL_NV_texture_shader3 -#define GL_NV_texture_shader3 1 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 -#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 -#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 -#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 -#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 -#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A -#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B -#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C -#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D -#define GL_HILO8_NV 0x885E -#define GL_SIGNED_HILO8_NV 0x885F -#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 -#endif /* GL_NV_texture_shader3 */ - -#ifndef GL_NV_transform_feedback -#define GL_NV_transform_feedback 1 -#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 -#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 -#define GL_TEXTURE_COORD_NV 0x8C79 -#define GL_CLIP_DISTANCE_NV 0x8C7A -#define GL_VERTEX_ID_NV 0x8C7B -#define GL_PRIMITIVE_ID_NV 0x8C7C -#define GL_GENERIC_ATTRIB_NV 0x8C7D -#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 -#define GL_ACTIVE_VARYINGS_NV 0x8C81 -#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 -#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 -#define GL_PRIMITIVES_GENERATED_NV 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 -#define GL_RASTERIZER_DISCARD_NV 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B -#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C -#define GL_SEPARATE_ATTRIBS_NV 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F -#define GL_LAYER_NV 0x8DAA -#define GL_NEXT_BUFFER_NV -2 -#define GL_SKIP_COMPONENTS4_NV -3 -#define GL_SKIP_COMPONENTS3_NV -4 -#define GL_SKIP_COMPONENTS2_NV -5 -#define GL_SKIP_COMPONENTS1_NV -6 -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLenum bufferMode); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedbackNV (void); -GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLsizei count, const GLint *attribs, GLenum bufferMode); -GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name); -GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location); -GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); -#endif -#endif /* GL_NV_transform_feedback */ - -#ifndef GL_NV_transform_feedback2 -#define GL_NV_transform_feedback2 1 -#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids); -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids); -GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids); -GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id); -GLAPI void APIENTRY glPauseTransformFeedbackNV (void); -GLAPI void APIENTRY glResumeTransformFeedbackNV (void); -GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); -#endif -#endif /* GL_NV_transform_feedback2 */ - -#ifndef GL_NV_uniform_buffer_unified_memory -#define GL_NV_uniform_buffer_unified_memory 1 -#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E -#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F -#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 -#endif /* GL_NV_uniform_buffer_unified_memory */ - -#ifndef GL_NV_vdpau_interop -#define GL_NV_vdpau_interop 1 -typedef GLintptr GLvdpauSurfaceNV; -#define GL_SURFACE_STATE_NV 0x86EB -#define GL_SURFACE_REGISTERED_NV 0x86FD -#define GL_SURFACE_MAPPED_NV 0x8700 -#define GL_WRITE_DISCARD_NV 0x88BE -typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void *getProcAddress); -typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); -typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); -typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); -typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); -typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); -typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAddress); -GLAPI void APIENTRY glVDPAUFiniNV (void); -GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); -GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); -GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); -GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); -GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); -#endif -#endif /* GL_NV_vdpau_interop */ - -#ifndef GL_NV_vertex_array_range -#define GL_NV_vertex_array_range 1 -#define GL_VERTEX_ARRAY_RANGE_NV 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E -#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F -#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 -#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const void *pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); -GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const void *pointer); -#endif -#endif /* GL_NV_vertex_array_range */ - -#ifndef GL_NV_vertex_array_range2 -#define GL_NV_vertex_array_range2 1 -#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 -#endif /* GL_NV_vertex_array_range2 */ - -#ifndef GL_NV_vertex_attrib_integer_64bit -#define GL_NV_vertex_attrib_integer_64bit 1 -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x); -GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x); -GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params); -GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params); -GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); -#endif -#endif /* GL_NV_vertex_attrib_integer_64bit */ - -#ifndef GL_NV_vertex_buffer_unified_memory -#define GL_NV_vertex_buffer_unified_memory 1 -#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E -#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F -#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 -#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 -#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 -#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 -#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 -#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 -#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 -#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 -#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 -#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 -#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A -#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B -#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C -#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D -#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E -#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F -#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 -#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 -#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 -#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 -#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 -#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 -#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 -typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); -typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); -GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride); -GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride); -GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride); -GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride); -GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); -GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result); -#endif -#endif /* GL_NV_vertex_buffer_unified_memory */ - -#ifndef GL_NV_vertex_program -#define GL_NV_vertex_program 1 -#define GL_VERTEX_PROGRAM_NV 0x8620 -#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 -#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 -#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 -#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 -#define GL_CURRENT_ATTRIB_NV 0x8626 -#define GL_PROGRAM_LENGTH_NV 0x8627 -#define GL_PROGRAM_STRING_NV 0x8628 -#define GL_MODELVIEW_PROJECTION_NV 0x8629 -#define GL_IDENTITY_NV 0x862A -#define GL_INVERSE_NV 0x862B -#define GL_TRANSPOSE_NV 0x862C -#define GL_INVERSE_TRANSPOSE_NV 0x862D -#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E -#define GL_MAX_TRACK_MATRICES_NV 0x862F -#define GL_MATRIX0_NV 0x8630 -#define GL_MATRIX1_NV 0x8631 -#define GL_MATRIX2_NV 0x8632 -#define GL_MATRIX3_NV 0x8633 -#define GL_MATRIX4_NV 0x8634 -#define GL_MATRIX5_NV 0x8635 -#define GL_MATRIX6_NV 0x8636 -#define GL_MATRIX7_NV 0x8637 -#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 -#define GL_CURRENT_MATRIX_NV 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 -#define GL_PROGRAM_PARAMETER_NV 0x8644 -#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 -#define GL_PROGRAM_TARGET_NV 0x8646 -#define GL_PROGRAM_RESIDENT_NV 0x8647 -#define GL_TRACK_MATRIX_NV 0x8648 -#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 -#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A -#define GL_PROGRAM_ERROR_POSITION_NV 0x864B -#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 -#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 -#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 -#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 -#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 -#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 -#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 -#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 -#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 -#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 -#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A -#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B -#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C -#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D -#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E -#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F -#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 -#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 -#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 -#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 -#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 -#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 -#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 -#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 -#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 -#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 -#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A -#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B -#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C -#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D -#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E -#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F -#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 -#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 -#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 -#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 -#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 -#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 -#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 -#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 -#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 -#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 -#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A -#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B -#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C -#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D -#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E -#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F -typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); -typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); -typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void **pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences); -GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs); -GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params); -GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs); -GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program); -GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, void **pointer); -GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id); -GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v); -GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v); -GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs); -GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform); -GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v); -#endif -#endif /* GL_NV_vertex_program */ - -#ifndef GL_NV_vertex_program1_1 -#define GL_NV_vertex_program1_1 1 -#endif /* GL_NV_vertex_program1_1 */ - -#ifndef GL_NV_vertex_program2 -#define GL_NV_vertex_program2 1 -#endif /* GL_NV_vertex_program2 */ - -#ifndef GL_NV_vertex_program2_option -#define GL_NV_vertex_program2_option 1 -#endif /* GL_NV_vertex_program2_option */ - -#ifndef GL_NV_vertex_program3 -#define GL_NV_vertex_program3 1 -#endif /* GL_NV_vertex_program3 */ - -#ifndef GL_NV_vertex_program4 -#define GL_NV_vertex_program4 1 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); -#endif -#endif /* GL_NV_vertex_program4 */ - -#ifndef GL_NV_video_capture -#define GL_NV_video_capture 1 -#define GL_VIDEO_BUFFER_NV 0x9020 -#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 -#define GL_FIELD_UPPER_NV 0x9022 -#define GL_FIELD_LOWER_NV 0x9023 -#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 -#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 -#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 -#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 -#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 -#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 -#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A -#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B -#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C -#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D -#define GL_PARTIAL_SUCCESS_NV 0x902E -#define GL_SUCCESS_NV 0x902F -#define GL_FAILURE_NV 0x9030 -#define GL_YCBYCR8_422_NV 0x9031 -#define GL_YCBAYCR8A_4224_NV 0x9032 -#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 -#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 -#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 -#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 -#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 -#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 -#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 -#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A -#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B -#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C -typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); -typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); -typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); -typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); -typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot); -GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); -GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); -GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot); -GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); -GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); -GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); -GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); -#endif -#endif /* GL_NV_video_capture */ - -#ifndef GL_NV_viewport_array2 -#define GL_NV_viewport_array2 1 -#endif /* GL_NV_viewport_array2 */ - -#ifndef GL_NV_viewport_swizzle -#define GL_NV_viewport_swizzle 1 -#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 -#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 -#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 -#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 -#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 -#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 -#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 -#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 -#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 -#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 -#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A -#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B -typedef void (APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); -#endif -#endif /* GL_NV_viewport_swizzle */ - -#ifndef GL_OML_interlace -#define GL_OML_interlace 1 -#define GL_INTERLACE_OML 0x8980 -#define GL_INTERLACE_READ_OML 0x8981 -#endif /* GL_OML_interlace */ - -#ifndef GL_OML_resample -#define GL_OML_resample 1 -#define GL_PACK_RESAMPLE_OML 0x8984 -#define GL_UNPACK_RESAMPLE_OML 0x8985 -#define GL_RESAMPLE_REPLICATE_OML 0x8986 -#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 -#define GL_RESAMPLE_AVERAGE_OML 0x8988 -#define GL_RESAMPLE_DECIMATE_OML 0x8989 -#endif /* GL_OML_resample */ - -#ifndef GL_OML_subsample -#define GL_OML_subsample 1 -#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 -#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 -#endif /* GL_OML_subsample */ - -#ifndef GL_OVR_multiview -#define GL_OVR_multiview 1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 -#define GL_MAX_VIEWS_OVR 0x9631 -#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); -#endif -#endif /* GL_OVR_multiview */ - -#ifndef GL_OVR_multiview2 -#define GL_OVR_multiview2 1 -#endif /* GL_OVR_multiview2 */ - -#ifndef GL_PGI_misc_hints -#define GL_PGI_misc_hints 1 -#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 -#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD -#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE -#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 -#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 -#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 -#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C -#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D -#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E -#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F -#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 -#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 -#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 -#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 -#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 -#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 -#define GL_CLIP_NEAR_HINT_PGI 0x1A220 -#define GL_CLIP_FAR_HINT_PGI 0x1A221 -#define GL_WIDE_LINE_HINT_PGI 0x1A222 -#define GL_BACK_NORMALS_HINT_PGI 0x1A223 -typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode); -#endif -#endif /* GL_PGI_misc_hints */ - -#ifndef GL_PGI_vertex_hints -#define GL_PGI_vertex_hints 1 -#define GL_VERTEX_DATA_HINT_PGI 0x1A22A -#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B -#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C -#define GL_MAX_VERTEX_HINT_PGI 0x1A22D -#define GL_COLOR3_BIT_PGI 0x00010000 -#define GL_COLOR4_BIT_PGI 0x00020000 -#define GL_EDGEFLAG_BIT_PGI 0x00040000 -#define GL_INDEX_BIT_PGI 0x00080000 -#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 -#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 -#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 -#define GL_MAT_EMISSION_BIT_PGI 0x00800000 -#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 -#define GL_MAT_SHININESS_BIT_PGI 0x02000000 -#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 -#define GL_NORMAL_BIT_PGI 0x08000000 -#define GL_TEXCOORD1_BIT_PGI 0x10000000 -#define GL_TEXCOORD2_BIT_PGI 0x20000000 -#define GL_TEXCOORD3_BIT_PGI 0x40000000 -#define GL_TEXCOORD4_BIT_PGI 0x80000000 -#define GL_VERTEX23_BIT_PGI 0x00000004 -#define GL_VERTEX4_BIT_PGI 0x00000008 -#endif /* GL_PGI_vertex_hints */ - -#ifndef GL_REND_screen_coordinates -#define GL_REND_screen_coordinates 1 -#define GL_SCREEN_COORDINATES_REND 0x8490 -#define GL_INVERTED_SCREEN_W_REND 0x8491 -#endif /* GL_REND_screen_coordinates */ - -#ifndef GL_S3_s3tc -#define GL_S3_s3tc 1 -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 -#define GL_RGBA_S3TC 0x83A2 -#define GL_RGBA4_S3TC 0x83A3 -#define GL_RGBA_DXT5_S3TC 0x83A4 -#define GL_RGBA4_DXT5_S3TC 0x83A5 -#endif /* GL_S3_s3tc */ - -#ifndef GL_SGIS_detail_texture -#define GL_SGIS_detail_texture 1 -#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 -#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 -#define GL_LINEAR_DETAIL_SGIS 0x8097 -#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 -#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 -#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A -#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B -#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C -typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); -GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points); -#endif -#endif /* GL_SGIS_detail_texture */ - -#ifndef GL_SGIS_fog_function -#define GL_SGIS_fog_function 1 -#define GL_FOG_FUNC_SGIS 0x812A -#define GL_FOG_FUNC_POINTS_SGIS 0x812B -#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C -typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points); -GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points); -#endif -#endif /* GL_SGIS_fog_function */ - -#ifndef GL_SGIS_generate_mipmap -#define GL_SGIS_generate_mipmap 1 -#define GL_GENERATE_MIPMAP_SGIS 0x8191 -#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 -#endif /* GL_SGIS_generate_mipmap */ - -#ifndef GL_SGIS_multisample -#define GL_SGIS_multisample 1 -#define GL_MULTISAMPLE_SGIS 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F -#define GL_SAMPLE_MASK_SGIS 0x80A0 -#define GL_1PASS_SGIS 0x80A1 -#define GL_2PASS_0_SGIS 0x80A2 -#define GL_2PASS_1_SGIS 0x80A3 -#define GL_4PASS_0_SGIS 0x80A4 -#define GL_4PASS_1_SGIS 0x80A5 -#define GL_4PASS_2_SGIS 0x80A6 -#define GL_4PASS_3_SGIS 0x80A7 -#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 -#define GL_SAMPLES_SGIS 0x80A9 -#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA -#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB -#define GL_SAMPLE_PATTERN_SGIS 0x80AC -typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert); -GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern); -#endif -#endif /* GL_SGIS_multisample */ - -#ifndef GL_SGIS_pixel_texture -#define GL_SGIS_pixel_texture 1 -#define GL_PIXEL_TEXTURE_SGIS 0x8353 -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 -#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param); -GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params); -GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params); -GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params); -#endif -#endif /* GL_SGIS_pixel_texture */ - -#ifndef GL_SGIS_point_line_texgen -#define GL_SGIS_point_line_texgen 1 -#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 -#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 -#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 -#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 -#define GL_EYE_POINT_SGIS 0x81F4 -#define GL_OBJECT_POINT_SGIS 0x81F5 -#define GL_EYE_LINE_SGIS 0x81F6 -#define GL_OBJECT_LINE_SGIS 0x81F7 -#endif /* GL_SGIS_point_line_texgen */ - -#ifndef GL_SGIS_point_parameters -#define GL_SGIS_point_parameters 1 -#define GL_POINT_SIZE_MIN_SGIS 0x8126 -#define GL_POINT_SIZE_MAX_SGIS 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 -#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 -typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params); -#endif -#endif /* GL_SGIS_point_parameters */ - -#ifndef GL_SGIS_sharpen_texture -#define GL_SGIS_sharpen_texture 1 -#define GL_LINEAR_SHARPEN_SGIS 0x80AD -#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE -#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF -#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 -typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); -GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points); -#endif -#endif /* GL_SGIS_sharpen_texture */ - -#ifndef GL_SGIS_texture4D -#define GL_SGIS_texture4D 1 -#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 -#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 -#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 -#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 -#define GL_TEXTURE_4D_SGIS 0x8134 -#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 -#define GL_TEXTURE_4DSIZE_SGIS 0x8136 -#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 -#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 -#define GL_TEXTURE_4D_BINDING_SGIS 0x814F -typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels); -#endif -#endif /* GL_SGIS_texture4D */ - -#ifndef GL_SGIS_texture_border_clamp -#define GL_SGIS_texture_border_clamp 1 -#define GL_CLAMP_TO_BORDER_SGIS 0x812D -#endif /* GL_SGIS_texture_border_clamp */ - -#ifndef GL_SGIS_texture_color_mask -#define GL_SGIS_texture_color_mask 1 -#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF -typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif -#endif /* GL_SGIS_texture_color_mask */ - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_SGIS_texture_edge_clamp 1 -#define GL_CLAMP_TO_EDGE_SGIS 0x812F -#endif /* GL_SGIS_texture_edge_clamp */ - -#ifndef GL_SGIS_texture_filter4 -#define GL_SGIS_texture_filter4 1 -#define GL_FILTER4_SGIS 0x8146 -#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 -typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); -typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights); -GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#endif -#endif /* GL_SGIS_texture_filter4 */ - -#ifndef GL_SGIS_texture_lod -#define GL_SGIS_texture_lod 1 -#define GL_TEXTURE_MIN_LOD_SGIS 0x813A -#define GL_TEXTURE_MAX_LOD_SGIS 0x813B -#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C -#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D -#endif /* GL_SGIS_texture_lod */ - -#ifndef GL_SGIS_texture_select -#define GL_SGIS_texture_select 1 -#define GL_DUAL_ALPHA4_SGIS 0x8110 -#define GL_DUAL_ALPHA8_SGIS 0x8111 -#define GL_DUAL_ALPHA12_SGIS 0x8112 -#define GL_DUAL_ALPHA16_SGIS 0x8113 -#define GL_DUAL_LUMINANCE4_SGIS 0x8114 -#define GL_DUAL_LUMINANCE8_SGIS 0x8115 -#define GL_DUAL_LUMINANCE12_SGIS 0x8116 -#define GL_DUAL_LUMINANCE16_SGIS 0x8117 -#define GL_DUAL_INTENSITY4_SGIS 0x8118 -#define GL_DUAL_INTENSITY8_SGIS 0x8119 -#define GL_DUAL_INTENSITY12_SGIS 0x811A -#define GL_DUAL_INTENSITY16_SGIS 0x811B -#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C -#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D -#define GL_QUAD_ALPHA4_SGIS 0x811E -#define GL_QUAD_ALPHA8_SGIS 0x811F -#define GL_QUAD_LUMINANCE4_SGIS 0x8120 -#define GL_QUAD_LUMINANCE8_SGIS 0x8121 -#define GL_QUAD_INTENSITY4_SGIS 0x8122 -#define GL_QUAD_INTENSITY8_SGIS 0x8123 -#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 -#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 -#endif /* GL_SGIS_texture_select */ - -#ifndef GL_SGIX_async -#define GL_SGIX_async 1 -#define GL_ASYNC_MARKER_SGIX 0x8329 -typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); -typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); -typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); -typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); -typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); -typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker); -GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp); -GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp); -GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range); -GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range); -GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker); -#endif -#endif /* GL_SGIX_async */ - -#ifndef GL_SGIX_async_histogram -#define GL_SGIX_async_histogram 1 -#define GL_ASYNC_HISTOGRAM_SGIX 0x832C -#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D -#endif /* GL_SGIX_async_histogram */ - -#ifndef GL_SGIX_async_pixel -#define GL_SGIX_async_pixel 1 -#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C -#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D -#define GL_ASYNC_READ_PIXELS_SGIX 0x835E -#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F -#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 -#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 -#endif /* GL_SGIX_async_pixel */ - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_SGIX_blend_alpha_minmax 1 -#define GL_ALPHA_MIN_SGIX 0x8320 -#define GL_ALPHA_MAX_SGIX 0x8321 -#endif /* GL_SGIX_blend_alpha_minmax */ - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_SGIX_calligraphic_fragment 1 -#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 -#endif /* GL_SGIX_calligraphic_fragment */ - -#ifndef GL_SGIX_clipmap -#define GL_SGIX_clipmap 1 -#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 -#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 -#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 -#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 -#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 -#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 -#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 -#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 -#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 -#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D -#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E -#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F -#endif /* GL_SGIX_clipmap */ - -#ifndef GL_SGIX_convolution_accuracy -#define GL_SGIX_convolution_accuracy 1 -#define GL_CONVOLUTION_HINT_SGIX 0x8316 -#endif /* GL_SGIX_convolution_accuracy */ - -#ifndef GL_SGIX_depth_pass_instrument -#define GL_SGIX_depth_pass_instrument 1 -#endif /* GL_SGIX_depth_pass_instrument */ - -#ifndef GL_SGIX_depth_texture -#define GL_SGIX_depth_texture 1 -#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 -#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 -#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 -#endif /* GL_SGIX_depth_texture */ - -#ifndef GL_SGIX_flush_raster -#define GL_SGIX_flush_raster 1 -typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushRasterSGIX (void); -#endif -#endif /* GL_SGIX_flush_raster */ - -#ifndef GL_SGIX_fog_offset -#define GL_SGIX_fog_offset 1 -#define GL_FOG_OFFSET_SGIX 0x8198 -#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 -#endif /* GL_SGIX_fog_offset */ - -#ifndef GL_SGIX_fragment_lighting -#define GL_SGIX_fragment_lighting 1 -#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 -#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 -#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 -#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 -#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 -#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 -#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 -#define GL_LIGHT_ENV_MODE_SGIX 0x8407 -#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 -#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 -#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A -#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B -#define GL_FRAGMENT_LIGHT0_SGIX 0x840C -#define GL_FRAGMENT_LIGHT1_SGIX 0x840D -#define GL_FRAGMENT_LIGHT2_SGIX 0x840E -#define GL_FRAGMENT_LIGHT3_SGIX 0x840F -#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 -#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 -#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 -#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 -typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode); -GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param); -GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param); -GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params); -GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param); -GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param); -GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params); -GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param); -GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param); -GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params); -GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params); -GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param); -#endif -#endif /* GL_SGIX_fragment_lighting */ - -#ifndef GL_SGIX_framezoom -#define GL_SGIX_framezoom 1 -#define GL_FRAMEZOOM_SGIX 0x818B -#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C -#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D -typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameZoomSGIX (GLint factor); -#endif -#endif /* GL_SGIX_framezoom */ - -#ifndef GL_SGIX_igloo_interface -#define GL_SGIX_igloo_interface 1 -typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const void *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const void *params); -#endif -#endif /* GL_SGIX_igloo_interface */ - -#ifndef GL_SGIX_instruments -#define GL_SGIX_instruments 1 -#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 -#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 -typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); -typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); -typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); -typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); -GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer); -GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p); -GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker); -GLAPI void APIENTRY glStartInstrumentsSGIX (void); -GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker); -#endif -#endif /* GL_SGIX_instruments */ - -#ifndef GL_SGIX_interlace -#define GL_SGIX_interlace 1 -#define GL_INTERLACE_SGIX 0x8094 -#endif /* GL_SGIX_interlace */ - -#ifndef GL_SGIX_ir_instrument1 -#define GL_SGIX_ir_instrument1 1 -#define GL_IR_INSTRUMENT1_SGIX 0x817F -#endif /* GL_SGIX_ir_instrument1 */ - -#ifndef GL_SGIX_list_priority -#define GL_SGIX_list_priority 1 -#define GL_LIST_PRIORITY_SGIX 0x8182 -typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params); -GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param); -GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param); -GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params); -#endif -#endif /* GL_SGIX_list_priority */ - -#ifndef GL_SGIX_pixel_texture -#define GL_SGIX_pixel_texture 1 -#define GL_PIXEL_TEX_GEN_SGIX 0x8139 -#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B -typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode); -#endif -#endif /* GL_SGIX_pixel_texture */ - -#ifndef GL_SGIX_pixel_tiles -#define GL_SGIX_pixel_tiles 1 -#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E -#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F -#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 -#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 -#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 -#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 -#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 -#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 -#endif /* GL_SGIX_pixel_tiles */ - -#ifndef GL_SGIX_polynomial_ffd -#define GL_SGIX_polynomial_ffd 1 -#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 -#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 -#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 -#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 -#define GL_DEFORMATIONS_MASK_SGIX 0x8196 -#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -GLAPI void APIENTRY glDeformSGIX (GLbitfield mask); -GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask); -#endif -#endif /* GL_SGIX_polynomial_ffd */ - -#ifndef GL_SGIX_reference_plane -#define GL_SGIX_reference_plane 1 -#define GL_REFERENCE_PLANE_SGIX 0x817D -#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E -typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); -#endif -#endif /* GL_SGIX_reference_plane */ - -#ifndef GL_SGIX_resample -#define GL_SGIX_resample 1 -#define GL_PACK_RESAMPLE_SGIX 0x842E -#define GL_UNPACK_RESAMPLE_SGIX 0x842F -#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 -#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 -#endif /* GL_SGIX_resample */ - -#ifndef GL_SGIX_scalebias_hint -#define GL_SGIX_scalebias_hint 1 -#define GL_SCALEBIAS_HINT_SGIX 0x8322 -#endif /* GL_SGIX_scalebias_hint */ - -#ifndef GL_SGIX_shadow -#define GL_SGIX_shadow 1 -#define GL_TEXTURE_COMPARE_SGIX 0x819A -#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B -#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C -#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D -#endif /* GL_SGIX_shadow */ - -#ifndef GL_SGIX_shadow_ambient -#define GL_SGIX_shadow_ambient 1 -#define GL_SHADOW_AMBIENT_SGIX 0x80BF -#endif /* GL_SGIX_shadow_ambient */ - -#ifndef GL_SGIX_sprite -#define GL_SGIX_sprite 1 -#define GL_SPRITE_SGIX 0x8148 -#define GL_SPRITE_MODE_SGIX 0x8149 -#define GL_SPRITE_AXIS_SGIX 0x814A -#define GL_SPRITE_TRANSLATION_SGIX 0x814B -#define GL_SPRITE_AXIAL_SGIX 0x814C -#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D -#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param); -GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param); -GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params); -#endif -#endif /* GL_SGIX_sprite */ - -#ifndef GL_SGIX_subsample -#define GL_SGIX_subsample 1 -#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 -#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 -#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 -#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 -#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 -#endif /* GL_SGIX_subsample */ - -#ifndef GL_SGIX_tag_sample_buffer -#define GL_SGIX_tag_sample_buffer 1 -typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTagSampleBufferSGIX (void); -#endif -#endif /* GL_SGIX_tag_sample_buffer */ - -#ifndef GL_SGIX_texture_add_env -#define GL_SGIX_texture_add_env 1 -#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE -#endif /* GL_SGIX_texture_add_env */ - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_SGIX_texture_coordinate_clamp 1 -#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 -#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A -#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B -#endif /* GL_SGIX_texture_coordinate_clamp */ - -#ifndef GL_SGIX_texture_lod_bias -#define GL_SGIX_texture_lod_bias 1 -#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E -#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F -#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 -#endif /* GL_SGIX_texture_lod_bias */ - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_SGIX_texture_multi_buffer 1 -#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E -#endif /* GL_SGIX_texture_multi_buffer */ - -#ifndef GL_SGIX_texture_scale_bias -#define GL_SGIX_texture_scale_bias 1 -#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 -#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A -#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B -#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C -#endif /* GL_SGIX_texture_scale_bias */ - -#ifndef GL_SGIX_vertex_preclip -#define GL_SGIX_vertex_preclip 1 -#define GL_VERTEX_PRECLIP_SGIX 0x83EE -#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF -#endif /* GL_SGIX_vertex_preclip */ - -#ifndef GL_SGIX_ycrcb -#define GL_SGIX_ycrcb 1 -#define GL_YCRCB_422_SGIX 0x81BB -#define GL_YCRCB_444_SGIX 0x81BC -#endif /* GL_SGIX_ycrcb */ - -#ifndef GL_SGIX_ycrcb_subsample -#define GL_SGIX_ycrcb_subsample 1 -#endif /* GL_SGIX_ycrcb_subsample */ - -#ifndef GL_SGIX_ycrcba -#define GL_SGIX_ycrcba 1 -#define GL_YCRCB_SGIX 0x8318 -#define GL_YCRCBA_SGIX 0x8319 -#endif /* GL_SGIX_ycrcba */ - -#ifndef GL_SGI_color_matrix -#define GL_SGI_color_matrix 1 -#define GL_COLOR_MATRIX_SGI 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB -#endif /* GL_SGI_color_matrix */ - -#ifndef GL_SGI_color_table -#define GL_SGI_color_table 1 -#define GL_COLOR_TABLE_SGI 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 -#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 -#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 -#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF -typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); -GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, void *table); -GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params); -#endif -#endif /* GL_SGI_color_table */ - -#ifndef GL_SGI_texture_color_table -#define GL_SGI_texture_color_table 1 -#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC -#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD -#endif /* GL_SGI_texture_color_table */ - -#ifndef GL_SUNX_constant_data -#define GL_SUNX_constant_data 1 -#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 -#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 -typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFinishTextureSUNX (void); -#endif -#endif /* GL_SUNX_constant_data */ - -#ifndef GL_SUN_convolution_border_modes -#define GL_SUN_convolution_border_modes 1 -#define GL_WRAP_BORDER_SUN 0x81D4 -#endif /* GL_SUN_convolution_border_modes */ - -#ifndef GL_SUN_global_alpha -#define GL_SUN_global_alpha 1 -#define GL_GLOBAL_ALPHA_SUN 0x81D9 -#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor); -GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor); -GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor); -GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor); -GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor); -GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor); -GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor); -GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor); -#endif -#endif /* GL_SUN_global_alpha */ - -#ifndef GL_SUN_mesh_array -#define GL_SUN_mesh_array 1 -#define GL_QUAD_MESH_SUN 0x8614 -#define GL_TRIANGLE_MESH_SUN 0x8615 -typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width); -#endif -#endif /* GL_SUN_mesh_array */ - -#ifndef GL_SUN_slice_accum -#define GL_SUN_slice_accum 1 -#define GL_SLICE_ACCUM_SUN 0x85CC -#endif /* GL_SUN_slice_accum */ - -#ifndef GL_SUN_triangle_list -#define GL_SUN_triangle_list 1 -#define GL_RESTART_SUN 0x0001 -#define GL_REPLACE_MIDDLE_SUN 0x0002 -#define GL_REPLACE_OLDEST_SUN 0x0003 -#define GL_TRIANGLE_LIST_SUN 0x81D7 -#define GL_REPLACEMENT_CODE_SUN 0x81D8 -#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 -#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 -#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 -#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 -#define GL_R1UI_V3F_SUN 0x85C4 -#define GL_R1UI_C4UB_V3F_SUN 0x85C5 -#define GL_R1UI_C3F_V3F_SUN 0x85C6 -#define GL_R1UI_N3F_V3F_SUN 0x85C7 -#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 -#define GL_R1UI_T2F_V3F_SUN 0x85C9 -#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA -#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void **pointer); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code); -GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code); -GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code); -GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code); -GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code); -GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code); -GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const void **pointer); -#endif -#endif /* GL_SUN_triangle_list */ - -#ifndef GL_SUN_vertex -#define GL_SUN_vertex 1 -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v); -GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v); -GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#endif -#endif /* GL_SUN_vertex */ - -#ifndef GL_WIN_phong_shading -#define GL_WIN_phong_shading 1 -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB -#endif /* GL_WIN_phong_shading */ - -#ifndef GL_WIN_specular_fog -#define GL_WIN_specular_fog 1 -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC -#endif /* GL_WIN_specular_fog */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/GLideN64/src/inc/GL/glxext.h b/GLideN64/src/inc/GL/glxext.h deleted file mode 100644 index d5167a6..0000000 --- a/GLideN64/src/inc/GL/glxext.h +++ /dev/null @@ -1,936 +0,0 @@ -#ifndef __glxext_h_ -#define __glxext_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 33248 $ on $Date: 2016-10-24 01:22:03 -0400 (Mon, 24 Oct 2016) $ -*/ - -#define GLX_GLXEXT_VERSION 20161024 - -/* Generated C header for: - * API: glx - * Versions considered: .* - * Versions emitted: 1\.[3-9] - * Default extensions included: glx - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef GLX_VERSION_1_3 -#define GLX_VERSION_1_3 1 -typedef XID GLXContextID; -typedef struct __GLXFBConfigRec *GLXFBConfig; -typedef XID GLXWindow; -typedef XID GLXPbuffer; -#define GLX_WINDOW_BIT 0x00000001 -#define GLX_PIXMAP_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 -#define GLX_RGBA_BIT 0x00000001 -#define GLX_COLOR_INDEX_BIT 0x00000002 -#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 -#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 -#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 -#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 -#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 -#define GLX_AUX_BUFFERS_BIT 0x00000010 -#define GLX_DEPTH_BUFFER_BIT 0x00000020 -#define GLX_STENCIL_BUFFER_BIT 0x00000040 -#define GLX_ACCUM_BUFFER_BIT 0x00000080 -#define GLX_CONFIG_CAVEAT 0x20 -#define GLX_X_VISUAL_TYPE 0x22 -#define GLX_TRANSPARENT_TYPE 0x23 -#define GLX_TRANSPARENT_INDEX_VALUE 0x24 -#define GLX_TRANSPARENT_RED_VALUE 0x25 -#define GLX_TRANSPARENT_GREEN_VALUE 0x26 -#define GLX_TRANSPARENT_BLUE_VALUE 0x27 -#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 -#define GLX_DONT_CARE 0xFFFFFFFF -#define GLX_NONE 0x8000 -#define GLX_SLOW_CONFIG 0x8001 -#define GLX_TRUE_COLOR 0x8002 -#define GLX_DIRECT_COLOR 0x8003 -#define GLX_PSEUDO_COLOR 0x8004 -#define GLX_STATIC_COLOR 0x8005 -#define GLX_GRAY_SCALE 0x8006 -#define GLX_STATIC_GRAY 0x8007 -#define GLX_TRANSPARENT_RGB 0x8008 -#define GLX_TRANSPARENT_INDEX 0x8009 -#define GLX_VISUAL_ID 0x800B -#define GLX_SCREEN 0x800C -#define GLX_NON_CONFORMANT_CONFIG 0x800D -#define GLX_DRAWABLE_TYPE 0x8010 -#define GLX_RENDER_TYPE 0x8011 -#define GLX_X_RENDERABLE 0x8012 -#define GLX_FBCONFIG_ID 0x8013 -#define GLX_RGBA_TYPE 0x8014 -#define GLX_COLOR_INDEX_TYPE 0x8015 -#define GLX_MAX_PBUFFER_WIDTH 0x8016 -#define GLX_MAX_PBUFFER_HEIGHT 0x8017 -#define GLX_MAX_PBUFFER_PIXELS 0x8018 -#define GLX_PRESERVED_CONTENTS 0x801B -#define GLX_LARGEST_PBUFFER 0x801C -#define GLX_WIDTH 0x801D -#define GLX_HEIGHT 0x801E -#define GLX_EVENT_MASK 0x801F -#define GLX_DAMAGED 0x8020 -#define GLX_SAVED 0x8021 -#define GLX_WINDOW 0x8022 -#define GLX_PBUFFER 0x8023 -#define GLX_PBUFFER_HEIGHT 0x8040 -#define GLX_PBUFFER_WIDTH 0x8041 -typedef GLXFBConfig *( *PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); -typedef GLXFBConfig *( *PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); -typedef int ( *PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); -typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); -typedef GLXWindow ( *PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); -typedef void ( *PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); -typedef GLXPixmap ( *PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); -typedef void ( *PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); -typedef GLXPbuffer ( *PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); -typedef void ( *PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); -typedef void ( *PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); -typedef GLXContext ( *PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); -typedef Bool ( *PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLEPROC) (void); -typedef int ( *PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); -typedef void ( *PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); -typedef void ( *PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); -#ifdef GLX_GLXEXT_PROTOTYPES -GLXFBConfig *glXGetFBConfigs (Display *dpy, int screen, int *nelements); -GLXFBConfig *glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements); -int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value); -XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config); -GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); -void glXDestroyWindow (Display *dpy, GLXWindow win); -GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); -void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap); -GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list); -void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf); -void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); -GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); -Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -GLXDrawable glXGetCurrentReadDrawable (void); -int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value); -void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask); -void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask); -#endif -#endif /* GLX_VERSION_1_3 */ - -#ifndef GLX_VERSION_1_4 -#define GLX_VERSION_1_4 1 -typedef void ( *__GLXextFuncPtr)(void); -#define GLX_SAMPLE_BUFFERS 100000 -#define GLX_SAMPLES 100001 -typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); -#ifdef GLX_GLXEXT_PROTOTYPES -__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName); -#endif -#endif /* GLX_VERSION_1_4 */ - -#ifndef GLX_ARB_context_flush_control -#define GLX_ARB_context_flush_control 1 -#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 -#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 -#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 -#endif /* GLX_ARB_context_flush_control */ - -#ifndef GLX_ARB_create_context -#define GLX_ARB_create_context 1 -#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 -#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 -#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define GLX_CONTEXT_FLAGS_ARB 0x2094 -typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); -#ifdef GLX_GLXEXT_PROTOTYPES -GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); -#endif -#endif /* GLX_ARB_create_context */ - -#ifndef GLX_ARB_create_context_profile -#define GLX_ARB_create_context_profile 1 -#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 -#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 -#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 -#endif /* GLX_ARB_create_context_profile */ - -#ifndef GLX_ARB_create_context_robustness -#define GLX_ARB_create_context_robustness 1 -#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 -#endif /* GLX_ARB_create_context_robustness */ - -#ifndef GLX_ARB_fbconfig_float -#define GLX_ARB_fbconfig_float 1 -#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 -#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 -#endif /* GLX_ARB_fbconfig_float */ - -#ifndef GLX_ARB_framebuffer_sRGB -#define GLX_ARB_framebuffer_sRGB 1 -#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 -#endif /* GLX_ARB_framebuffer_sRGB */ - -#ifndef GLX_ARB_get_proc_address -#define GLX_ARB_get_proc_address 1 -typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); -#ifdef GLX_GLXEXT_PROTOTYPES -__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); -#endif -#endif /* GLX_ARB_get_proc_address */ - -#ifndef GLX_ARB_multisample -#define GLX_ARB_multisample 1 -#define GLX_SAMPLE_BUFFERS_ARB 100000 -#define GLX_SAMPLES_ARB 100001 -#endif /* GLX_ARB_multisample */ - -#ifndef GLX_ARB_robustness_application_isolation -#define GLX_ARB_robustness_application_isolation 1 -#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 -#endif /* GLX_ARB_robustness_application_isolation */ - -#ifndef GLX_ARB_robustness_share_group_isolation -#define GLX_ARB_robustness_share_group_isolation 1 -#endif /* GLX_ARB_robustness_share_group_isolation */ - -#ifndef GLX_ARB_vertex_buffer_object -#define GLX_ARB_vertex_buffer_object 1 -#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 -#endif /* GLX_ARB_vertex_buffer_object */ - -#ifndef GLX_3DFX_multisample -#define GLX_3DFX_multisample 1 -#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 -#define GLX_SAMPLES_3DFX 0x8051 -#endif /* GLX_3DFX_multisample */ - -#ifndef GLX_AMD_gpu_association -#define GLX_AMD_gpu_association 1 -#define GLX_GPU_VENDOR_AMD 0x1F00 -#define GLX_GPU_RENDERER_STRING_AMD 0x1F01 -#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 -#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 -#define GLX_GPU_RAM_AMD 0x21A3 -#define GLX_GPU_CLOCK_AMD 0x21A4 -#define GLX_GPU_NUM_PIPES_AMD 0x21A5 -#define GLX_GPU_NUM_SIMD_AMD 0x21A6 -#define GLX_GPU_NUM_RB_AMD 0x21A7 -#define GLX_GPU_NUM_SPI_AMD 0x21A8 -typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids); -typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); -typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx); -typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list); -typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList); -typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx); -typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); -typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); -typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#ifdef GLX_GLXEXT_PROTOTYPES -unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids); -int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); -unsigned int glXGetContextGPUIDAMD (GLXContext ctx); -GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list); -GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList); -Bool glXDeleteAssociatedContextAMD (GLXContext ctx); -Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx); -GLXContext glXGetCurrentAssociatedContextAMD (void); -void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -#endif /* GLX_AMD_gpu_association */ - -#ifndef GLX_EXT_buffer_age -#define GLX_EXT_buffer_age 1 -#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 -#endif /* GLX_EXT_buffer_age */ - -#ifndef GLX_EXT_create_context_es2_profile -#define GLX_EXT_create_context_es2_profile 1 -#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 -#endif /* GLX_EXT_create_context_es2_profile */ - -#ifndef GLX_EXT_create_context_es_profile -#define GLX_EXT_create_context_es_profile 1 -#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 -#endif /* GLX_EXT_create_context_es_profile */ - -#ifndef GLX_EXT_fbconfig_packed_float -#define GLX_EXT_fbconfig_packed_float 1 -#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 -#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 -#endif /* GLX_EXT_fbconfig_packed_float */ - -#ifndef GLX_EXT_framebuffer_sRGB -#define GLX_EXT_framebuffer_sRGB 1 -#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 -#endif /* GLX_EXT_framebuffer_sRGB */ - -#ifndef GLX_EXT_import_context -#define GLX_EXT_import_context 1 -#define GLX_SHARE_CONTEXT_EXT 0x800A -#define GLX_VISUAL_ID_EXT 0x800B -#define GLX_SCREEN_EXT 0x800C -typedef Display *( *PFNGLXGETCURRENTDISPLAYEXTPROC) (void); -typedef int ( *PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); -typedef GLXContextID ( *PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); -typedef GLXContext ( *PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); -typedef void ( *PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); -#ifdef GLX_GLXEXT_PROTOTYPES -Display *glXGetCurrentDisplayEXT (void); -int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value); -GLXContextID glXGetContextIDEXT (const GLXContext context); -GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID); -void glXFreeContextEXT (Display *dpy, GLXContext context); -#endif -#endif /* GLX_EXT_import_context */ - -#ifndef GLX_EXT_libglvnd -#define GLX_EXT_libglvnd 1 -#define GLX_VENDOR_NAMES_EXT 0x20F6 -#endif /* GLX_EXT_libglvnd */ - -#ifndef GLX_EXT_stereo_tree -#define GLX_EXT_stereo_tree 1 -typedef struct { - int type; - unsigned long serial; - Bool send_event; - Display *display; - int extension; - int evtype; - GLXDrawable window; - Bool stereo_tree; -} GLXStereoNotifyEventEXT; -#define GLX_STEREO_TREE_EXT 0x20F5 -#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001 -#define GLX_STEREO_NOTIFY_EXT 0x00000000 -#endif /* GLX_EXT_stereo_tree */ - -#ifndef GLX_EXT_swap_control -#define GLX_EXT_swap_control 1 -#define GLX_SWAP_INTERVAL_EXT 0x20F1 -#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 -typedef void ( *PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval); -#endif -#endif /* GLX_EXT_swap_control */ - -#ifndef GLX_EXT_swap_control_tear -#define GLX_EXT_swap_control_tear 1 -#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 -#endif /* GLX_EXT_swap_control_tear */ - -#ifndef GLX_EXT_texture_from_pixmap -#define GLX_EXT_texture_from_pixmap 1 -#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 -#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 -#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 -#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 -#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 -#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 -#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 -#define GLX_Y_INVERTED_EXT 0x20D4 -#define GLX_TEXTURE_FORMAT_EXT 0x20D5 -#define GLX_TEXTURE_TARGET_EXT 0x20D6 -#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 -#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 -#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 -#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA -#define GLX_TEXTURE_1D_EXT 0x20DB -#define GLX_TEXTURE_2D_EXT 0x20DC -#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD -#define GLX_FRONT_LEFT_EXT 0x20DE -#define GLX_FRONT_RIGHT_EXT 0x20DF -#define GLX_BACK_LEFT_EXT 0x20E0 -#define GLX_BACK_RIGHT_EXT 0x20E1 -#define GLX_FRONT_EXT 0x20DE -#define GLX_BACK_EXT 0x20E0 -#define GLX_AUX0_EXT 0x20E2 -#define GLX_AUX1_EXT 0x20E3 -#define GLX_AUX2_EXT 0x20E4 -#define GLX_AUX3_EXT 0x20E5 -#define GLX_AUX4_EXT 0x20E6 -#define GLX_AUX5_EXT 0x20E7 -#define GLX_AUX6_EXT 0x20E8 -#define GLX_AUX7_EXT 0x20E9 -#define GLX_AUX8_EXT 0x20EA -#define GLX_AUX9_EXT 0x20EB -typedef void ( *PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); -typedef void ( *PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); -void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer); -#endif -#endif /* GLX_EXT_texture_from_pixmap */ - -#ifndef GLX_EXT_visual_info -#define GLX_EXT_visual_info 1 -#define GLX_X_VISUAL_TYPE_EXT 0x22 -#define GLX_TRANSPARENT_TYPE_EXT 0x23 -#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 -#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 -#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 -#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 -#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 -#define GLX_NONE_EXT 0x8000 -#define GLX_TRUE_COLOR_EXT 0x8002 -#define GLX_DIRECT_COLOR_EXT 0x8003 -#define GLX_PSEUDO_COLOR_EXT 0x8004 -#define GLX_STATIC_COLOR_EXT 0x8005 -#define GLX_GRAY_SCALE_EXT 0x8006 -#define GLX_STATIC_GRAY_EXT 0x8007 -#define GLX_TRANSPARENT_RGB_EXT 0x8008 -#define GLX_TRANSPARENT_INDEX_EXT 0x8009 -#endif /* GLX_EXT_visual_info */ - -#ifndef GLX_EXT_visual_rating -#define GLX_EXT_visual_rating 1 -#define GLX_VISUAL_CAVEAT_EXT 0x20 -#define GLX_SLOW_VISUAL_EXT 0x8001 -#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D -#endif /* GLX_EXT_visual_rating */ - -#ifndef GLX_INTEL_swap_event -#define GLX_INTEL_swap_event 1 -#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 -#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 -#define GLX_COPY_COMPLETE_INTEL 0x8181 -#define GLX_FLIP_COMPLETE_INTEL 0x8182 -#endif /* GLX_INTEL_swap_event */ - -#ifndef GLX_MESA_agp_offset -#define GLX_MESA_agp_offset 1 -typedef unsigned int ( *PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); -#ifdef GLX_GLXEXT_PROTOTYPES -unsigned int glXGetAGPOffsetMESA (const void *pointer); -#endif -#endif /* GLX_MESA_agp_offset */ - -#ifndef GLX_MESA_copy_sub_buffer -#define GLX_MESA_copy_sub_buffer 1 -typedef void ( *PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); -#endif -#endif /* GLX_MESA_copy_sub_buffer */ - -#ifndef GLX_MESA_pixmap_colormap -#define GLX_MESA_pixmap_colormap 1 -typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); -#ifdef GLX_GLXEXT_PROTOTYPES -GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); -#endif -#endif /* GLX_MESA_pixmap_colormap */ - -#ifndef GLX_MESA_query_renderer -#define GLX_MESA_query_renderer 1 -#define GLX_RENDERER_VENDOR_ID_MESA 0x8183 -#define GLX_RENDERER_DEVICE_ID_MESA 0x8184 -#define GLX_RENDERER_VERSION_MESA 0x8185 -#define GLX_RENDERER_ACCELERATED_MESA 0x8186 -#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 -#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 -#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 -#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A -#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B -#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C -#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D -#define GLX_RENDERER_ID_MESA 0x818E -typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value); -typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute); -typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value); -typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value); -const char *glXQueryCurrentRendererStringMESA (int attribute); -Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value); -const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute); -#endif -#endif /* GLX_MESA_query_renderer */ - -#ifndef GLX_MESA_release_buffers -#define GLX_MESA_release_buffers 1 -typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable); -#endif -#endif /* GLX_MESA_release_buffers */ - -#ifndef GLX_MESA_set_3dfx_mode -#define GLX_MESA_set_3dfx_mode 1 -#define GLX_3DFX_WINDOW_MODE_MESA 0x1 -#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 -typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXSet3DfxModeMESA (int mode); -#endif -#endif /* GLX_MESA_set_3dfx_mode */ - -#ifndef GLX_NV_copy_buffer -#define GLX_NV_copy_buffer 1 -typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#endif -#endif /* GLX_NV_copy_buffer */ - -#ifndef GLX_NV_copy_image -#define GLX_NV_copy_image 1 -typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#endif -#endif /* GLX_NV_copy_image */ - -#ifndef GLX_NV_delay_before_swap -#define GLX_NV_delay_before_swap 1 -typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds); -#endif -#endif /* GLX_NV_delay_before_swap */ - -#ifndef GLX_NV_float_buffer -#define GLX_NV_float_buffer 1 -#define GLX_FLOAT_COMPONENTS_NV 0x20B0 -#endif /* GLX_NV_float_buffer */ - -#ifndef GLX_NV_multisample_coverage -#define GLX_NV_multisample_coverage 1 -#define GLX_COVERAGE_SAMPLES_NV 100001 -#define GLX_COLOR_SAMPLES_NV 0x20B3 -#endif /* GLX_NV_multisample_coverage */ - -#ifndef GLX_NV_present_video -#define GLX_NV_present_video 1 -#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 -typedef unsigned int *( *PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements); -typedef int ( *PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); -#ifdef GLX_GLXEXT_PROTOTYPES -unsigned int *glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements); -int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); -#endif -#endif /* GLX_NV_present_video */ - -#ifndef GLX_NV_robustness_video_memory_purge -#define GLX_NV_robustness_video_memory_purge 1 -#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 -#endif /* GLX_NV_robustness_video_memory_purge */ - -#ifndef GLX_NV_swap_group -#define GLX_NV_swap_group 1 -typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group); -typedef Bool ( *PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier); -typedef Bool ( *PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); -typedef Bool ( *PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); -typedef Bool ( *PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count); -typedef Bool ( *PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group); -Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier); -Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); -Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); -Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count); -Bool glXResetFrameCountNV (Display *dpy, int screen); -#endif -#endif /* GLX_NV_swap_group */ - -#ifndef GLX_NV_video_capture -#define GLX_NV_video_capture 1 -typedef XID GLXVideoCaptureDeviceNV; -#define GLX_DEVICE_ID_NV 0x20CD -#define GLX_UNIQUE_ID_NV 0x20CE -#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF -typedef int ( *PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); -typedef GLXVideoCaptureDeviceNV *( *PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements); -typedef void ( *PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); -typedef int ( *PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); -typedef void ( *PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); -#ifdef GLX_GLXEXT_PROTOTYPES -int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); -GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements); -void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device); -int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); -void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device); -#endif -#endif /* GLX_NV_video_capture */ - -#ifndef GLX_NV_video_out -#define GLX_NV_video_out 1 -typedef unsigned int GLXVideoDeviceNV; -#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 -#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 -#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 -#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 -#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 -#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 -#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 -#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA -#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB -#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC -typedef int ( *PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); -typedef int ( *PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); -typedef int ( *PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); -typedef int ( *PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf); -typedef int ( *PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); -typedef int ( *PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); -#ifdef GLX_GLXEXT_PROTOTYPES -int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); -int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); -int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); -int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf); -int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); -int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); -#endif -#endif /* GLX_NV_video_out */ - -#ifndef GLX_OML_swap_method -#define GLX_OML_swap_method 1 -#define GLX_SWAP_METHOD_OML 0x8060 -#define GLX_SWAP_EXCHANGE_OML 0x8061 -#define GLX_SWAP_COPY_OML 0x8062 -#define GLX_SWAP_UNDEFINED_OML 0x8063 -#endif /* GLX_OML_swap_method */ - -#ifndef GLX_OML_sync_control -#define GLX_OML_sync_control 1 -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GLX_OML_sync_control extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif -typedef Bool ( *PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); -typedef Bool ( *PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); -typedef int64_t ( *PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); -typedef Bool ( *PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); -typedef Bool ( *PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); -Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); -int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); -Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); -Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); -#endif -#endif /* GLX_OML_sync_control */ - -#ifndef GLX_SGIS_blended_overlay -#define GLX_SGIS_blended_overlay 1 -#define GLX_BLENDED_RGBA_SGIS 0x8025 -#endif /* GLX_SGIS_blended_overlay */ - -#ifndef GLX_SGIS_multisample -#define GLX_SGIS_multisample 1 -#define GLX_SAMPLE_BUFFERS_SGIS 100000 -#define GLX_SAMPLES_SGIS 100001 -#endif /* GLX_SGIS_multisample */ - -#ifndef GLX_SGIS_shared_multisample -#define GLX_SGIS_shared_multisample 1 -#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 -#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 -#endif /* GLX_SGIS_shared_multisample */ - -#ifndef GLX_SGIX_dmbuffer -#define GLX_SGIX_dmbuffer 1 -typedef XID GLXPbufferSGIX; -#ifdef _DM_BUFFER_H_ -#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 -typedef Bool ( *PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); -#endif -#endif /* _DM_BUFFER_H_ */ -#endif /* GLX_SGIX_dmbuffer */ - -#ifndef GLX_SGIX_fbconfig -#define GLX_SGIX_fbconfig 1 -typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; -#define GLX_WINDOW_BIT_SGIX 0x00000001 -#define GLX_PIXMAP_BIT_SGIX 0x00000002 -#define GLX_RGBA_BIT_SGIX 0x00000001 -#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 -#define GLX_DRAWABLE_TYPE_SGIX 0x8010 -#define GLX_RENDER_TYPE_SGIX 0x8011 -#define GLX_X_RENDERABLE_SGIX 0x8012 -#define GLX_FBCONFIG_ID_SGIX 0x8013 -#define GLX_RGBA_TYPE_SGIX 0x8014 -#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 -typedef int ( *PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); -typedef GLXFBConfigSGIX *( *PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); -typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); -typedef GLXContext ( *PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); -typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); -typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); -#ifdef GLX_GLXEXT_PROTOTYPES -int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); -GLXFBConfigSGIX *glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements); -GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); -GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); -XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config); -GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis); -#endif -#endif /* GLX_SGIX_fbconfig */ - -#ifndef GLX_SGIX_hyperpipe -#define GLX_SGIX_hyperpipe 1 -typedef struct { - char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ - int networkId; -} GLXHyperpipeNetworkSGIX; -typedef struct { - char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ - int channel; - unsigned int participationType; - int timeSlice; -} GLXHyperpipeConfigSGIX; -typedef struct { - char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ - int srcXOrigin, srcYOrigin, srcWidth, srcHeight; - int destXOrigin, destYOrigin, destWidth, destHeight; -} GLXPipeRect; -typedef struct { - char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ - int XOrigin, YOrigin, maxHeight, maxWidth; -} GLXPipeRectLimits; -#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 -#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 -#define GLX_BAD_HYPERPIPE_SGIX 92 -#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 -#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 -#define GLX_PIPE_RECT_SGIX 0x00000001 -#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 -#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 -#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 -#define GLX_HYPERPIPE_ID_SGIX 0x8030 -typedef GLXHyperpipeNetworkSGIX *( *PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); -typedef int ( *PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); -typedef GLXHyperpipeConfigSGIX *( *PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); -typedef int ( *PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); -typedef int ( *PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); -typedef int ( *PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); -typedef int ( *PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); -typedef int ( *PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); -#ifdef GLX_GLXEXT_PROTOTYPES -GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes); -int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); -GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes); -int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId); -int glXBindHyperpipeSGIX (Display *dpy, int hpId); -int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); -int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList); -int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); -#endif -#endif /* GLX_SGIX_hyperpipe */ - -#ifndef GLX_SGIX_pbuffer -#define GLX_SGIX_pbuffer 1 -#define GLX_PBUFFER_BIT_SGIX 0x00000004 -#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 -#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 -#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 -#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 -#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 -#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 -#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 -#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 -#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 -#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 -#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 -#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 -#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 -#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 -#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A -#define GLX_PRESERVED_CONTENTS_SGIX 0x801B -#define GLX_LARGEST_PBUFFER_SGIX 0x801C -#define GLX_WIDTH_SGIX 0x801D -#define GLX_HEIGHT_SGIX 0x801E -#define GLX_EVENT_MASK_SGIX 0x801F -#define GLX_DAMAGED_SGIX 0x8020 -#define GLX_SAVED_SGIX 0x8021 -#define GLX_WINDOW_SGIX 0x8022 -#define GLX_PBUFFER_SGIX 0x8023 -typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); -typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); -typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); -typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); -typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); -#ifdef GLX_GLXEXT_PROTOTYPES -GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); -void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf); -int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); -void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask); -void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask); -#endif -#endif /* GLX_SGIX_pbuffer */ - -#ifndef GLX_SGIX_swap_barrier -#define GLX_SGIX_swap_barrier 1 -typedef void ( *PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); -typedef Bool ( *PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier); -Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max); -#endif -#endif /* GLX_SGIX_swap_barrier */ - -#ifndef GLX_SGIX_swap_group -#define GLX_SGIX_swap_group 1 -typedef void ( *PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member); -#endif -#endif /* GLX_SGIX_swap_group */ - -#ifndef GLX_SGIX_video_resize -#define GLX_SGIX_video_resize 1 -#define GLX_SYNC_FRAME_SGIX 0x00000000 -#define GLX_SYNC_SWAP_SGIX 0x00000001 -typedef int ( *PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); -typedef int ( *PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); -typedef int ( *PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); -typedef int ( *PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); -typedef int ( *PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); -#ifdef GLX_GLXEXT_PROTOTYPES -int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window); -int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h); -int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); -int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); -int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype); -#endif -#endif /* GLX_SGIX_video_resize */ - -#ifndef GLX_SGIX_video_source -#define GLX_SGIX_video_source 1 -typedef XID GLXVideoSourceSGIX; -#ifdef _VL_H -typedef GLXVideoSourceSGIX ( *PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); -typedef void ( *PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); -#ifdef GLX_GLXEXT_PROTOTYPES -GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); -void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource); -#endif -#endif /* _VL_H */ -#endif /* GLX_SGIX_video_source */ - -#ifndef GLX_SGIX_visual_select_group -#define GLX_SGIX_visual_select_group 1 -#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 -#endif /* GLX_SGIX_visual_select_group */ - -#ifndef GLX_SGI_cushion -#define GLX_SGI_cushion 1 -typedef void ( *PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); -#ifdef GLX_GLXEXT_PROTOTYPES -void glXCushionSGI (Display *dpy, Window window, float cushion); -#endif -#endif /* GLX_SGI_cushion */ - -#ifndef GLX_SGI_make_current_read -#define GLX_SGI_make_current_read 1 -typedef Bool ( *PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); -#ifdef GLX_GLXEXT_PROTOTYPES -Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -GLXDrawable glXGetCurrentReadDrawableSGI (void); -#endif -#endif /* GLX_SGI_make_current_read */ - -#ifndef GLX_SGI_swap_control -#define GLX_SGI_swap_control 1 -typedef int ( *PFNGLXSWAPINTERVALSGIPROC) (int interval); -#ifdef GLX_GLXEXT_PROTOTYPES -int glXSwapIntervalSGI (int interval); -#endif -#endif /* GLX_SGI_swap_control */ - -#ifndef GLX_SGI_video_sync -#define GLX_SGI_video_sync 1 -typedef int ( *PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); -typedef int ( *PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); -#ifdef GLX_GLXEXT_PROTOTYPES -int glXGetVideoSyncSGI (unsigned int *count); -int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count); -#endif -#endif /* GLX_SGI_video_sync */ - -#ifndef GLX_SUN_get_transparent_index -#define GLX_SUN_get_transparent_index 1 -typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); -#ifdef GLX_GLXEXT_PROTOTYPES -Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); -#endif -#endif /* GLX_SUN_get_transparent_index */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/GLideN64/src/inc/GL/wglext.h b/GLideN64/src/inc/GL/wglext.h deleted file mode 100644 index a5e5a3c..0000000 --- a/GLideN64/src/inc/GL/wglext.h +++ /dev/null @@ -1,847 +0,0 @@ -#ifndef __wglext_h_ -#define __wglext_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 33340 $ on $Date: 2016-12-19 07:17:22 -0500 (Mon, 19 Dec 2016) $ -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#define WGL_WGLEXT_VERSION 20161219 - -/* Generated C header for: - * API: wgl - * Versions considered: .* - * Versions emitted: _nomatch_^ - * Default extensions included: wgl - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef WGL_ARB_buffer_region -#define WGL_ARB_buffer_region 1 -#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 -#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 -#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 -#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 -typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); -typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); -typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); -typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); -#ifdef WGL_WGLEXT_PROTOTYPES -HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType); -VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion); -BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height); -BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); -#endif -#endif /* WGL_ARB_buffer_region */ - -#ifndef WGL_ARB_context_flush_control -#define WGL_ARB_context_flush_control 1 -#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 -#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 -#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 -#endif /* WGL_ARB_context_flush_control */ - -#ifndef WGL_ARB_create_context -#define WGL_ARB_create_context 1 -#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 -#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 -#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 -#define WGL_CONTEXT_FLAGS_ARB 0x2094 -#define ERROR_INVALID_VERSION_ARB 0x2095 -typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); -#ifdef WGL_WGLEXT_PROTOTYPES -HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList); -#endif -#endif /* WGL_ARB_create_context */ - -#ifndef WGL_ARB_create_context_profile -#define WGL_ARB_create_context_profile 1 -#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 -#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 -#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 -#define ERROR_INVALID_PROFILE_ARB 0x2096 -#endif /* WGL_ARB_create_context_profile */ - -#ifndef WGL_ARB_create_context_robustness -#define WGL_ARB_create_context_robustness 1 -#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 -#endif /* WGL_ARB_create_context_robustness */ - -#ifndef WGL_ARB_extensions_string -#define WGL_ARB_extensions_string 1 -typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); -#ifdef WGL_WGLEXT_PROTOTYPES -const char *WINAPI wglGetExtensionsStringARB (HDC hdc); -#endif -#endif /* WGL_ARB_extensions_string */ - -#ifndef WGL_ARB_framebuffer_sRGB -#define WGL_ARB_framebuffer_sRGB 1 -#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 -#endif /* WGL_ARB_framebuffer_sRGB */ - -#ifndef WGL_ARB_make_current_read -#define WGL_ARB_make_current_read 1 -#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 -#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 -typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -HDC WINAPI wglGetCurrentReadDCARB (void); -#endif -#endif /* WGL_ARB_make_current_read */ - -#ifndef WGL_ARB_multisample -#define WGL_ARB_multisample 1 -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 -#endif /* WGL_ARB_multisample */ - -#ifndef WGL_ARB_pbuffer -#define WGL_ARB_pbuffer 1 -DECLARE_HANDLE(HPBUFFERARB); -#define WGL_DRAW_TO_PBUFFER_ARB 0x202D -#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E -#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F -#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 -#define WGL_PBUFFER_LARGEST_ARB 0x2033 -#define WGL_PBUFFER_WIDTH_ARB 0x2034 -#define WGL_PBUFFER_HEIGHT_ARB 0x2035 -#define WGL_PBUFFER_LOST_ARB 0x2036 -typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); -typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); -typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); -typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); -#ifdef WGL_WGLEXT_PROTOTYPES -HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer); -int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC); -BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer); -BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); -#endif -#endif /* WGL_ARB_pbuffer */ - -#ifndef WGL_ARB_pixel_format -#define WGL_ARB_pixel_format 1 -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); -BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); -BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -#endif -#endif /* WGL_ARB_pixel_format */ - -#ifndef WGL_ARB_pixel_format_float -#define WGL_ARB_pixel_format_float 1 -#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 -#endif /* WGL_ARB_pixel_format_float */ - -#ifndef WGL_ARB_render_texture -#define WGL_ARB_render_texture 1 -#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 -#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 -#define WGL_TEXTURE_FORMAT_ARB 0x2072 -#define WGL_TEXTURE_TARGET_ARB 0x2073 -#define WGL_MIPMAP_TEXTURE_ARB 0x2074 -#define WGL_TEXTURE_RGB_ARB 0x2075 -#define WGL_TEXTURE_RGBA_ARB 0x2076 -#define WGL_NO_TEXTURE_ARB 0x2077 -#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 -#define WGL_TEXTURE_1D_ARB 0x2079 -#define WGL_TEXTURE_2D_ARB 0x207A -#define WGL_MIPMAP_LEVEL_ARB 0x207B -#define WGL_CUBE_MAP_FACE_ARB 0x207C -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 -#define WGL_FRONT_LEFT_ARB 0x2083 -#define WGL_FRONT_RIGHT_ARB 0x2084 -#define WGL_BACK_LEFT_ARB 0x2085 -#define WGL_BACK_RIGHT_ARB 0x2086 -#define WGL_AUX0_ARB 0x2087 -#define WGL_AUX1_ARB 0x2088 -#define WGL_AUX2_ARB 0x2089 -#define WGL_AUX3_ARB 0x208A -#define WGL_AUX4_ARB 0x208B -#define WGL_AUX5_ARB 0x208C -#define WGL_AUX6_ARB 0x208D -#define WGL_AUX7_ARB 0x208E -#define WGL_AUX8_ARB 0x208F -#define WGL_AUX9_ARB 0x2090 -typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); -BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); -BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList); -#endif -#endif /* WGL_ARB_render_texture */ - -#ifndef WGL_ARB_robustness_application_isolation -#define WGL_ARB_robustness_application_isolation 1 -#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 -#endif /* WGL_ARB_robustness_application_isolation */ - -#ifndef WGL_ARB_robustness_share_group_isolation -#define WGL_ARB_robustness_share_group_isolation 1 -#endif /* WGL_ARB_robustness_share_group_isolation */ - -#ifndef WGL_3DFX_multisample -#define WGL_3DFX_multisample 1 -#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 -#define WGL_SAMPLES_3DFX 0x2061 -#endif /* WGL_3DFX_multisample */ - -#ifndef WGL_3DL_stereo_control -#define WGL_3DL_stereo_control 1 -#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 -#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 -#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 -#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 -typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState); -#endif -#endif /* WGL_3DL_stereo_control */ - -#ifndef WGL_AMD_gpu_association -#define WGL_AMD_gpu_association 1 -#define WGL_GPU_VENDOR_AMD 0x1F00 -#define WGL_GPU_RENDERER_STRING_AMD 0x1F01 -#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 -#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 -#define WGL_GPU_RAM_AMD 0x21A3 -#define WGL_GPU_CLOCK_AMD 0x21A4 -#define WGL_GPU_NUM_PIPES_AMD 0x21A5 -#define WGL_GPU_NUM_SIMD_AMD 0x21A6 -#define WGL_GPU_NUM_RB_AMD 0x21A7 -#define WGL_GPU_NUM_SPI_AMD 0x21A8 -typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids); -typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data); -typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); -typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); -typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList); -typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); -typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); -typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); -typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#ifdef WGL_WGLEXT_PROTOTYPES -UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids); -INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data); -UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc); -HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id); -HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList); -BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc); -BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc); -HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void); -VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -#endif /* WGL_AMD_gpu_association */ - -#ifndef WGL_ATI_pixel_format_float -#define WGL_ATI_pixel_format_float 1 -#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 -#endif /* WGL_ATI_pixel_format_float */ - -#ifndef WGL_EXT_colorspace -#define WGL_EXT_colorspace 1 -#define WGL_COLORSPACE_EXT 0x3087 -#define WGL_COLORSPACE_SRGB_EXT 0x3089 -#define WGL_COLORSPACE_LINEAR_EXT 0x308A -#endif /* WGL_EXT_colorspace */ - -#ifndef WGL_EXT_create_context_es2_profile -#define WGL_EXT_create_context_es2_profile 1 -#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 -#endif /* WGL_EXT_create_context_es2_profile */ - -#ifndef WGL_EXT_create_context_es_profile -#define WGL_EXT_create_context_es_profile 1 -#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 -#endif /* WGL_EXT_create_context_es_profile */ - -#ifndef WGL_EXT_depth_float -#define WGL_EXT_depth_float 1 -#define WGL_DEPTH_FLOAT_EXT 0x2040 -#endif /* WGL_EXT_depth_float */ - -#ifndef WGL_EXT_display_color_table -#define WGL_EXT_display_color_table 1 -typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); -typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); -typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); -typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); -#ifdef WGL_WGLEXT_PROTOTYPES -GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id); -GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length); -GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id); -VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id); -#endif -#endif /* WGL_EXT_display_color_table */ - -#ifndef WGL_EXT_extensions_string -#define WGL_EXT_extensions_string 1 -typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); -#ifdef WGL_WGLEXT_PROTOTYPES -const char *WINAPI wglGetExtensionsStringEXT (void); -#endif -#endif /* WGL_EXT_extensions_string */ - -#ifndef WGL_EXT_framebuffer_sRGB -#define WGL_EXT_framebuffer_sRGB 1 -#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 -#endif /* WGL_EXT_framebuffer_sRGB */ - -#ifndef WGL_EXT_make_current_read -#define WGL_EXT_make_current_read 1 -#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 -typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -HDC WINAPI wglGetCurrentReadDCEXT (void); -#endif -#endif /* WGL_EXT_make_current_read */ - -#ifndef WGL_EXT_multisample -#define WGL_EXT_multisample 1 -#define WGL_SAMPLE_BUFFERS_EXT 0x2041 -#define WGL_SAMPLES_EXT 0x2042 -#endif /* WGL_EXT_multisample */ - -#ifndef WGL_EXT_pbuffer -#define WGL_EXT_pbuffer 1 -DECLARE_HANDLE(HPBUFFEREXT); -#define WGL_DRAW_TO_PBUFFER_EXT 0x202D -#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E -#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F -#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 -#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 -#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 -#define WGL_PBUFFER_LARGEST_EXT 0x2033 -#define WGL_PBUFFER_WIDTH_EXT 0x2034 -#define WGL_PBUFFER_HEIGHT_EXT 0x2035 -typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); -typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); -typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); -typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); -#ifdef WGL_WGLEXT_PROTOTYPES -HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer); -int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC); -BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer); -BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); -#endif -#endif /* WGL_EXT_pbuffer */ - -#ifndef WGL_EXT_pixel_format -#define WGL_EXT_pixel_format 1 -#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 -#define WGL_DRAW_TO_WINDOW_EXT 0x2001 -#define WGL_DRAW_TO_BITMAP_EXT 0x2002 -#define WGL_ACCELERATION_EXT 0x2003 -#define WGL_NEED_PALETTE_EXT 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 -#define WGL_SWAP_METHOD_EXT 0x2007 -#define WGL_NUMBER_OVERLAYS_EXT 0x2008 -#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 -#define WGL_TRANSPARENT_EXT 0x200A -#define WGL_TRANSPARENT_VALUE_EXT 0x200B -#define WGL_SHARE_DEPTH_EXT 0x200C -#define WGL_SHARE_STENCIL_EXT 0x200D -#define WGL_SHARE_ACCUM_EXT 0x200E -#define WGL_SUPPORT_GDI_EXT 0x200F -#define WGL_SUPPORT_OPENGL_EXT 0x2010 -#define WGL_DOUBLE_BUFFER_EXT 0x2011 -#define WGL_STEREO_EXT 0x2012 -#define WGL_PIXEL_TYPE_EXT 0x2013 -#define WGL_COLOR_BITS_EXT 0x2014 -#define WGL_RED_BITS_EXT 0x2015 -#define WGL_RED_SHIFT_EXT 0x2016 -#define WGL_GREEN_BITS_EXT 0x2017 -#define WGL_GREEN_SHIFT_EXT 0x2018 -#define WGL_BLUE_BITS_EXT 0x2019 -#define WGL_BLUE_SHIFT_EXT 0x201A -#define WGL_ALPHA_BITS_EXT 0x201B -#define WGL_ALPHA_SHIFT_EXT 0x201C -#define WGL_ACCUM_BITS_EXT 0x201D -#define WGL_ACCUM_RED_BITS_EXT 0x201E -#define WGL_ACCUM_GREEN_BITS_EXT 0x201F -#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 -#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 -#define WGL_DEPTH_BITS_EXT 0x2022 -#define WGL_STENCIL_BITS_EXT 0x2023 -#define WGL_AUX_BUFFERS_EXT 0x2024 -#define WGL_NO_ACCELERATION_EXT 0x2025 -#define WGL_GENERIC_ACCELERATION_EXT 0x2026 -#define WGL_FULL_ACCELERATION_EXT 0x2027 -#define WGL_SWAP_EXCHANGE_EXT 0x2028 -#define WGL_SWAP_COPY_EXT 0x2029 -#define WGL_SWAP_UNDEFINED_EXT 0x202A -#define WGL_TYPE_RGBA_EXT 0x202B -#define WGL_TYPE_COLORINDEX_EXT 0x202C -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); -BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); -BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -#endif -#endif /* WGL_EXT_pixel_format */ - -#ifndef WGL_EXT_pixel_format_packed_float -#define WGL_EXT_pixel_format_packed_float 1 -#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 -#endif /* WGL_EXT_pixel_format_packed_float */ - -#ifndef WGL_EXT_swap_control -#define WGL_EXT_swap_control 1 -typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); -typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglSwapIntervalEXT (int interval); -int WINAPI wglGetSwapIntervalEXT (void); -#endif -#endif /* WGL_EXT_swap_control */ - -#ifndef WGL_EXT_swap_control_tear -#define WGL_EXT_swap_control_tear 1 -#endif /* WGL_EXT_swap_control_tear */ - -#ifndef WGL_I3D_digital_video_control -#define WGL_I3D_digital_video_control 1 -#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 -#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 -#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 -#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 -typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); -typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue); -BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue); -#endif -#endif /* WGL_I3D_digital_video_control */ - -#ifndef WGL_I3D_gamma -#define WGL_I3D_gamma 1 -#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E -#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F -typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); -typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); -typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); -typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue); -BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue); -BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); -BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); -#endif -#endif /* WGL_I3D_gamma */ - -#ifndef WGL_I3D_genlock -#define WGL_I3D_genlock 1 -#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 -#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 -#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 -#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 -#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 -#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 -#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A -#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B -#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C -typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); -typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); -typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); -typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); -typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); -typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); -typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); -typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglEnableGenlockI3D (HDC hDC); -BOOL WINAPI wglDisableGenlockI3D (HDC hDC); -BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag); -BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource); -BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource); -BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge); -BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge); -BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate); -BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate); -BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay); -BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay); -BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); -#endif -#endif /* WGL_I3D_genlock */ - -#ifndef WGL_I3D_image_buffer -#define WGL_I3D_image_buffer 1 -#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 -#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 -typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); -typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); -typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); -typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); -#ifdef WGL_WGLEXT_PROTOTYPES -LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags); -BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress); -BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); -BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count); -#endif -#endif /* WGL_I3D_image_buffer */ - -#ifndef WGL_I3D_swap_frame_lock -#define WGL_I3D_swap_frame_lock 1 -typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); -typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglEnableFrameLockI3D (void); -BOOL WINAPI wglDisableFrameLockI3D (void); -BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag); -BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag); -#endif -#endif /* WGL_I3D_swap_frame_lock */ - -#ifndef WGL_I3D_swap_frame_usage -#define WGL_I3D_swap_frame_usage 1 -typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); -typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetFrameUsageI3D (float *pUsage); -BOOL WINAPI wglBeginFrameTrackingI3D (void); -BOOL WINAPI wglEndFrameTrackingI3D (void); -BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); -#endif -#endif /* WGL_I3D_swap_frame_usage */ - -#ifndef WGL_NV_DX_interop -#define WGL_NV_DX_interop 1 -#define WGL_ACCESS_READ_ONLY_NV 0x00000000 -#define WGL_ACCESS_READ_WRITE_NV 0x00000001 -#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002 -typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle); -typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice); -typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); -typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); -typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); -typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); -typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); -typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle); -HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice); -BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice); -HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); -BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject); -BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access); -BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); -BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); -#endif -#endif /* WGL_NV_DX_interop */ - -#ifndef WGL_NV_DX_interop2 -#define WGL_NV_DX_interop2 1 -#endif /* WGL_NV_DX_interop2 */ - -#ifndef WGL_NV_copy_image -#define WGL_NV_copy_image 1 -typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#endif -#endif /* WGL_NV_copy_image */ - -#ifndef WGL_NV_delay_before_swap -#define WGL_NV_delay_before_swap 1 -typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds); -#endif -#endif /* WGL_NV_delay_before_swap */ - -#ifndef WGL_NV_float_buffer -#define WGL_NV_float_buffer 1 -#define WGL_FLOAT_COMPONENTS_NV 0x20B0 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 -#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 -#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 -#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 -#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 -#endif /* WGL_NV_float_buffer */ - -#ifndef WGL_NV_gpu_affinity -#define WGL_NV_gpu_affinity 1 -DECLARE_HANDLE(HGPUNV); -struct _GPU_DEVICE { - DWORD cb; - CHAR DeviceName[32]; - CHAR DeviceString[128]; - DWORD Flags; - RECT rcVirtualScreen; -}; -typedef struct _GPU_DEVICE *PGPU_DEVICE; -#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 -#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 -typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); -typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); -typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); -typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); -typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu); -BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); -HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList); -BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); -BOOL WINAPI wglDeleteDCNV (HDC hdc); -#endif -#endif /* WGL_NV_gpu_affinity */ - -#ifndef WGL_NV_multisample_coverage -#define WGL_NV_multisample_coverage 1 -#define WGL_COVERAGE_SAMPLES_NV 0x2042 -#define WGL_COLOR_SAMPLES_NV 0x20B9 -#endif /* WGL_NV_multisample_coverage */ - -#ifndef WGL_NV_present_video -#define WGL_NV_present_video 1 -DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); -#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 -typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); -typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); -typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); -#ifdef WGL_WGLEXT_PROTOTYPES -int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); -BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); -BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue); -#endif -#endif /* WGL_NV_present_video */ - -#ifndef WGL_NV_render_depth_texture -#define WGL_NV_render_depth_texture 1 -#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 -#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 -#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 -#define WGL_DEPTH_COMPONENT_NV 0x20A7 -#endif /* WGL_NV_render_depth_texture */ - -#ifndef WGL_NV_render_texture_rectangle -#define WGL_NV_render_texture_rectangle 1 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 -#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 -#endif /* WGL_NV_render_texture_rectangle */ - -#ifndef WGL_NV_swap_group -#define WGL_NV_swap_group 1 -typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); -typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); -typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier); -typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); -typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count); -typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group); -BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier); -BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier); -BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); -BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count); -BOOL WINAPI wglResetFrameCountNV (HDC hDC); -#endif -#endif /* WGL_NV_swap_group */ - -#ifndef WGL_NV_vertex_array_range -#define WGL_NV_vertex_array_range 1 -typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); -typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); -#ifdef WGL_WGLEXT_PROTOTYPES -void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); -void WINAPI wglFreeMemoryNV (void *pointer); -#endif -#endif /* WGL_NV_vertex_array_range */ - -#ifndef WGL_NV_video_capture -#define WGL_NV_video_capture 1 -DECLARE_HANDLE(HVIDEOINPUTDEVICENV); -#define WGL_UNIQUE_ID_NV 0x20CE -#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF -typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); -typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); -typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); -typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); -typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); -UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); -BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); -BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); -BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); -#endif -#endif /* WGL_NV_video_capture */ - -#ifndef WGL_NV_video_output -#define WGL_NV_video_output 1 -DECLARE_HANDLE(HPVIDEODEV); -#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 -#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 -#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 -#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 -#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 -#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 -#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 -#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 -#define WGL_VIDEO_OUT_FRAME 0x20C8 -#define WGL_VIDEO_OUT_FIELD_1 0x20C9 -#define WGL_VIDEO_OUT_FIELD_2 0x20CA -#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB -#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC -typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); -typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); -typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); -typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); -typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); -typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); -BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice); -BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); -BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer); -BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); -BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); -#endif -#endif /* WGL_NV_video_output */ - -#ifndef WGL_OML_sync_control -#define WGL_OML_sync_control 1 -typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); -typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); -typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); -typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); -typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); -typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); -#ifdef WGL_WGLEXT_PROTOTYPES -BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); -BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator); -INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); -INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); -BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); -BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); -#endif -#endif /* WGL_OML_sync_control */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/GLideN64/src/inc/callbacks.h b/GLideN64/src/inc/callbacks.h deleted file mode 100644 index 287f953..0000000 --- a/GLideN64/src/inc/callbacks.h +++ /dev/null @@ -1,45 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - api/callbacks.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This file contains the definitions for callback functions which will be - * called from the other Core modules - */ - -#if !defined(API_CALLBACKS_H) -#define API_CALLBACKS_H - -#include "m64p_frontend.h" -#include "m64p_types.h" - -#if defined(__GNUC__) -#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos))) -#else -#define ATTR_FMT(fmtpos, attrpos) -#endif - -/* Functions for use by the Core, to send information back to the front-end app */ -extern m64p_error SetDebugCallback(ptr_DebugCallback pFunc, void *Context); -extern m64p_error SetStateCallback(ptr_StateCallback pFunc, void *Context); -extern void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3); -extern void StateChanged(m64p_core_param param_type, int new_value); - -#endif /* API_CALLBACKS_H */ - diff --git a/GLideN64/src/inc/config.h b/GLideN64/src/inc/config.h deleted file mode 100644 index 8a71319..0000000 --- a/GLideN64/src/inc/config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - api/config.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This file contains the Core configuration functions - */ - -#include "m64p_types.h" - -/* these functions are only to be used within the Core library */ - -m64p_error ConfigInit(const char *ConfigDirOverride, const char *DataDirOverride); -m64p_error ConfigShutdown(void); diff --git a/GLideN64/src/inc/debugger.h b/GLideN64/src/inc/debugger.h deleted file mode 100644 index 469279e..0000000 --- a/GLideN64/src/inc/debugger.h +++ /dev/null @@ -1,47 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - api/debugger.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This file contains the definitions for debugger functions which will be - * called from the other Core modules - */ - -#if !defined(API_DEBUGGER_H) -#define API_DEBUGGER_H - -#include "m64p_types.h" - -/* Debugger Definitions */ - -typedef enum { - DEBUG_UI_INIT = 1, - DEBUG_UI_UPDATE, - DEBUG_UI_VI, - DEBUG_CORE_COMPARE - } eDbgCallbackType; - -/* Functions for use by the Core, to send information back to the front-end app */ -extern int DebuggerCallbacksAreSet(void); -extern void DebuggerCallback(eDbgCallbackType type, unsigned int param); -extern void CoreCompareCallback(void); -extern void CoreCompareDataSync(int length, void *ptr); - -#endif /* API_DEBUGGER_H */ - diff --git a/GLideN64/src/inc/freetype/include/config/ftconfig.h b/GLideN64/src/inc/freetype/include/config/ftconfig.h deleted file mode 100644 index d98a311..0000000 --- a/GLideN64/src/inc/freetype/include/config/ftconfig.h +++ /dev/null @@ -1,672 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftconfig.h */ -/* */ -/* ANSI-specific configuration file (specification only). */ -/* */ -/* Copyright 1996-2004, 2006-2008, 2010-2011, 2013, 2014 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This header file contains a number of macro definitions that are used */ - /* by the rest of the engine. Most of the macros here are automatically */ - /* determined at compile time, and you should not need to change it to */ - /* port FreeType, except to compile the library with a non-ANSI */ - /* compiler. */ - /* */ - /* Note however that if some specific modifications are needed, we */ - /* advise you to place a modified copy in your build directory. */ - /* */ - /* The build directory is usually `builds/', and contains */ - /* system-specific files that are always included first when building */ - /* the library. */ - /* */ - /* This ANSI version should stay in `include/config/'. */ - /* */ - /*************************************************************************/ - -#ifndef __FTCONFIG_H__ -#define __FTCONFIG_H__ - -#include -#include FT_CONFIG_OPTIONS_H -#include FT_CONFIG_STANDARD_LIBRARY_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ - /* */ - /* These macros can be toggled to suit a specific system. The current */ - /* ones are defaults used to compile FreeType in an ANSI C environment */ - /* (16bit compilers are also supported). Copy this file to your own */ - /* `builds/' directory, and edit it to port the engine. */ - /* */ - /*************************************************************************/ - - - /* There are systems (like the Texas Instruments 'C54x) where a `char' */ - /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ - /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ - /* is probably unexpected. */ - /* */ - /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ - /* `char' type. */ - -#ifndef FT_CHAR_BIT -#define FT_CHAR_BIT CHAR_BIT -#endif - - - /* The size of an `int' type. */ -#if FT_UINT_MAX == 0xFFFFUL -#define FT_SIZEOF_INT (16 / FT_CHAR_BIT) -#elif FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) -#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_INT (64 / FT_CHAR_BIT) -#else -#error "Unsupported size of `int' type!" -#endif - - /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ - /* DM642) is recognized but avoided. */ -#if FT_ULONG_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) -#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) -#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) -#else -#error "Unsupported size of `long' type!" -#endif - - - /* FT_UNUSED is a macro used to indicate that a given parameter is not */ - /* used -- this is only used to get rid of unpleasant compiler warnings */ -#ifndef FT_UNUSED -#define FT_UNUSED( arg ) ( (arg) = (arg) ) -#endif - - - /*************************************************************************/ - /* */ - /* AUTOMATIC CONFIGURATION MACROS */ - /* */ - /* These macros are computed from the ones defined above. Don't touch */ - /* their definition, unless you know precisely what you are doing. No */ - /* porter should need to mess with them. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Mac support */ - /* */ - /* This is the only necessary change, so it is defined here instead */ - /* providing a new configuration file. */ - /* */ -#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) - /* no Carbon frameworks for 64bit 10.4.x */ - /* AvailabilityMacros.h is available since Mac OS X 10.2, */ - /* so guess the system version by maximum errno before inclusion */ -#include -#ifdef ECANCELED /* defined since 10.2 */ -#include "AvailabilityMacros.h" -#endif -#if defined( __LP64__ ) && \ - ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) -#undef FT_MACINTOSH -#endif - -#elif defined( __SC__ ) || defined( __MRC__ ) - /* Classic MacOS compilers */ -#include "ConditionalMacros.h" -#if TARGET_OS_MAC -#define FT_MACINTOSH 1 -#endif - -#endif - - - /*************************************************************************/ - /* */ - /*

*/ - /* basic_types */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* FT_Int16 */ - /* */ - /* */ - /* A typedef for a 16bit signed integer type. */ - /* */ - typedef signed short FT_Int16; - - - /*************************************************************************/ - /* */ - /* */ - /* FT_UInt16 */ - /* */ - /* */ - /* A typedef for a 16bit unsigned integer type. */ - /* */ - typedef unsigned short FT_UInt16; - - /* */ - - - /* this #if 0 ... #endif clause is for documentation purposes */ -#if 0 - - /*************************************************************************/ - /* */ - /* */ - /* FT_Int32 */ - /* */ - /* */ - /* A typedef for a 32bit signed integer type. The size depends on */ - /* the configuration. */ - /* */ - typedef signed XXX FT_Int32; - - - /*************************************************************************/ - /* */ - /* */ - /* FT_UInt32 */ - /* */ - /* A typedef for a 32bit unsigned integer type. The size depends on */ - /* the configuration. */ - /* */ - typedef unsigned XXX FT_UInt32; - - - /*************************************************************************/ - /* */ - /* */ - /* FT_Int64 */ - /* */ - /* A typedef for a 64bit signed integer type. The size depends on */ - /* the configuration. Only defined if there is real 64bit support; */ - /* otherwise, it gets emulated with a structure (if necessary). */ - /* */ - typedef signed XXX FT_Int64; - - - /*************************************************************************/ - /* */ - /* */ - /* FT_UInt64 */ - /* */ - /* A typedef for a 64bit unsigned integer type. The size depends on */ - /* the configuration. Only defined if there is real 64bit support; */ - /* otherwise, it gets emulated with a structure (if necessary). */ - /* */ - typedef unsigned XXX FT_UInt64; - - /* */ - -#endif - -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) - - typedef signed int FT_Int32; - typedef unsigned int FT_UInt32; - -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) - - typedef signed long FT_Int32; - typedef unsigned long FT_UInt32; - -#else -#error "no 32bit type found -- please check your configuration files" -#endif - - - /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) - - typedef int FT_Fast; - typedef unsigned int FT_UFast; - -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) - - typedef long FT_Fast; - typedef unsigned long FT_UFast; - -#endif - - - /* determine whether we have a 64-bit int type for platforms without */ - /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) - - /* FT_LONG64 must be defined if a 64-bit type is available */ -#define FT_LONG64 -#define FT_INT64 long -#define FT_UINT64 unsigned long - -#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ - - /* this compiler provides the __int64 type */ -#define FT_LONG64 -#define FT_INT64 __int64 -#define FT_UINT64 unsigned __int64 - -#elif defined( __BORLANDC__ ) /* Borland C++ */ - - /* XXXX: We should probably check the value of __BORLANDC__ in order */ - /* to test the compiler version. */ - - /* this compiler provides the __int64 type */ -#define FT_LONG64 -#define FT_INT64 __int64 -#define FT_UINT64 unsigned __int64 - -#elif defined( __WATCOMC__ ) /* Watcom C++ */ - - /* Watcom doesn't provide 64-bit data types */ - -#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ - -#define FT_LONG64 -#define FT_INT64 long long int -#define FT_UINT64 unsigned long long int - -#elif defined( __GNUC__ ) - - /* GCC provides the `long long' type */ -#define FT_LONG64 -#define FT_INT64 long long int -#define FT_UINT64 unsigned long long int - -#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ - - - /*************************************************************************/ - /* */ - /* A 64-bit data type will create compilation problems if you compile */ - /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ - /* is defined. You can however ignore this rule by defining the */ - /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ - /* */ -#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) - -#ifdef __STDC__ - - /* undefine the 64-bit macros in strict ANSI compilation mode */ -#undef FT_LONG64 -#undef FT_INT64 - -#endif /* __STDC__ */ - -#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ - -#ifdef FT_LONG64 - typedef FT_INT64 FT_Int64; - typedef FT_UINT64 FT_UInt64; -#endif - - -#define FT_BEGIN_STMNT do { -#define FT_END_STMNT } while ( 0 ) -#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT - - -#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER - /* Provide assembler fragments for performance-critical functions. */ - /* These must be defined `static __inline__' with GCC. */ - -#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ - -#define FT_MULFIX_ASSEMBLER FT_MulFix_arm - - /* documentation is in freetype.h */ - - static __inline FT_Int32 - FT_MulFix_arm( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 t, t2; - - - __asm - { - smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ - mov a, t, asr #31 /* a = (hi >> 31) */ - add a, a, #0x8000 /* a += 0x8000 */ - adds t2, t2, a /* t2 += a */ - adc t, t, #0 /* t += carry */ - mov a, t2, lsr #16 /* a = t2 >> 16 */ - orr a, a, t, lsl #16 /* a |= t << 16 */ - } - return a; - } - -#endif /* __CC_ARM || __ARMCC__ */ - - -#ifdef __GNUC__ - -#if defined( __arm__ ) && \ - ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \ - !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) - -#define FT_MULFIX_ASSEMBLER FT_MulFix_arm - - /* documentation is in freetype.h */ - - static __inline__ FT_Int32 - FT_MulFix_arm( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 t, t2; - - - __asm__ __volatile__ ( - "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ - "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ -#if defined( __clang__ ) && defined( __thumb2__ ) - "add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ -#else - "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ -#endif - "adds %1, %1, %0\n\t" /* %1 += %0 */ - "adc %2, %2, #0\n\t" /* %2 += carry */ - "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ - "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ - : "=r"(a), "=&r"(t2), "=&r"(t) - : "r"(a), "r"(b) - : "cc" ); - return a; - } - -#endif /* __arm__ && */ - /* ( __thumb2__ || !__thumb__ ) && */ - /* !( __CC_ARM || __ARMCC__ ) */ - - -#if defined( __i386__ ) - -#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 - - /* documentation is in freetype.h */ - - static __inline__ FT_Int32 - FT_MulFix_i386( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 result; - - - __asm__ __volatile__ ( - "imul %%edx\n" - "movl %%edx, %%ecx\n" - "sarl $31, %%ecx\n" - "addl $0x8000, %%ecx\n" - "addl %%ecx, %%eax\n" - "adcl $0, %%edx\n" - "shrl $16, %%eax\n" - "shll $16, %%edx\n" - "addl %%edx, %%eax\n" - : "=a"(result), "=d"(b) - : "a"(a), "d"(b) - : "%ecx", "cc" ); - return result; - } - -#endif /* i386 */ - -#endif /* __GNUC__ */ - - -#ifdef _MSC_VER /* Visual C++ */ - -#ifdef _M_IX86 - -#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 - - /* documentation is in freetype.h */ - - static __inline FT_Int32 - FT_MulFix_i386( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 result; - - __asm - { - mov eax, a - mov edx, b - imul edx - mov ecx, edx - sar ecx, 31 - add ecx, 8000h - add eax, ecx - adc edx, 0 - shr eax, 16 - shl edx, 16 - add eax, edx - mov result, eax - } - return result; - } - -#endif /* _M_IX86 */ - -#endif /* _MSC_VER */ - - -#if defined( __GNUC__ ) && defined( __x86_64__ ) - -#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64 - - static __inline__ FT_Int32 - FT_MulFix_x86_64( FT_Int32 a, - FT_Int32 b ) - { - /* Temporarily disable the warning that C90 doesn't support */ - /* `long long'. */ -#if ( __GNUC__ > 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wlong-long" -#endif - -#if 1 - /* Technically not an assembly fragment, but GCC does a really good */ - /* job at inlining it and generating good machine code for it. */ - long long ret, tmp; - - - ret = (long long)a * b; - tmp = ret >> 63; - ret += 0x8000 + tmp; - - return (FT_Int32)( ret >> 16 ); -#else - - /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */ - /* code from the lines below. The main issue is that `wide_a' is not */ - /* properly initialized by sign-extending `a'. Instead, the generated */ - /* machine code assumes that the register that contains `a' on input */ - /* can be used directly as a 64-bit value, which is wrong most of the */ - /* time. */ - long long wide_a = (long long)a; - long long wide_b = (long long)b; - long long result; - - - __asm__ __volatile__ ( - "imul %2, %1\n" - "mov %1, %0\n" - "sar $63, %0\n" - "lea 0x8000(%1, %0), %0\n" - "sar $16, %0\n" - : "=&r"(result), "=&r"(wide_a) - : "r"(wide_b) - : "cc" ); - - return (FT_Int32)result; -#endif - -#if ( __GNUC__ > 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) -#pragma GCC diagnostic pop -#endif - } - -#endif /* __GNUC__ && __x86_64__ */ - -#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ - - -#ifdef FT_CONFIG_OPTION_INLINE_MULFIX -#ifdef FT_MULFIX_ASSEMBLER -#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER -#endif -#endif - - -#ifdef FT_MAKE_OPTION_SINGLE_OBJECT - -#define FT_LOCAL( x ) static x -#define FT_LOCAL_DEF( x ) static x - -#else - -#ifdef __cplusplus -#define FT_LOCAL( x ) extern "C" x -#define FT_LOCAL_DEF( x ) extern "C" x -#else -#define FT_LOCAL( x ) extern x -#define FT_LOCAL_DEF( x ) x -#endif - -#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ - -#define FT_LOCAL_ARRAY( x ) extern const x -#define FT_LOCAL_ARRAY_DEF( x ) const x - - -#ifndef FT_BASE - -#ifdef __cplusplus -#define FT_BASE( x ) extern "C" x -#else -#define FT_BASE( x ) extern x -#endif - -#endif /* !FT_BASE */ - - -#ifndef FT_BASE_DEF - -#ifdef __cplusplus -#define FT_BASE_DEF( x ) x -#else -#define FT_BASE_DEF( x ) x -#endif - -#endif /* !FT_BASE_DEF */ - - -#ifndef FT_EXPORT - -#ifdef __cplusplus -#define FT_EXPORT( x ) extern "C" x -#else -#define FT_EXPORT( x ) extern x -#endif - -#endif /* !FT_EXPORT */ - - -#ifndef FT_EXPORT_DEF - -#ifdef __cplusplus -#define FT_EXPORT_DEF( x ) extern "C" x -#else -#define FT_EXPORT_DEF( x ) extern x -#endif - -#endif /* !FT_EXPORT_DEF */ - - -#ifndef FT_EXPORT_VAR - -#ifdef __cplusplus -#define FT_EXPORT_VAR( x ) extern "C" x -#else -#define FT_EXPORT_VAR( x ) extern x -#endif - -#endif /* !FT_EXPORT_VAR */ - - /* The following macros are needed to compile the library with a */ - /* C++ compiler and with 16bit compilers. */ - /* */ - - /* This is special. Within C++, you must specify `extern "C"' for */ - /* functions which are used via function pointers, and you also */ - /* must do that for structures which contain function pointers to */ - /* assure C linkage -- it's not possible to have (local) anonymous */ - /* functions which are accessed by (global) function pointers. */ - /* */ - /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ - /* */ - /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ - /* contains pointers to callback functions. */ - /* */ - /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ - /* that contains pointers to callback functions. */ - /* */ - /* */ - /* Some 16bit compilers have to redefine these macros to insert */ - /* the infamous `_cdecl' or `__fastcall' declarations. */ - /* */ -#ifndef FT_CALLBACK_DEF -#ifdef __cplusplus -#define FT_CALLBACK_DEF( x ) extern "C" x -#else -#define FT_CALLBACK_DEF( x ) static x -#endif -#endif /* FT_CALLBACK_DEF */ - -#ifndef FT_CALLBACK_TABLE -#ifdef __cplusplus -#define FT_CALLBACK_TABLE extern "C" -#define FT_CALLBACK_TABLE_DEF extern "C" -#else -#define FT_CALLBACK_TABLE extern -#define FT_CALLBACK_TABLE_DEF /* nothing */ -#endif -#endif /* FT_CALLBACK_TABLE */ - - -FT_END_HEADER - - -#endif /* __FTCONFIG_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/config/ftheader.h b/GLideN64/src/inc/freetype/include/config/ftheader.h deleted file mode 100644 index b623629..0000000 --- a/GLideN64/src/inc/freetype/include/config/ftheader.h +++ /dev/null @@ -1,832 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftheader.h */ -/* */ -/* Build macros of the FreeType 2 library. */ -/* */ -/* Copyright 1996-2008, 2010, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FT_HEADER_H__ -#define __FT_HEADER_H__ - - - /*@***********************************************************************/ - /* */ - /* */ - /* FT_BEGIN_HEADER */ - /* */ - /* */ - /* This macro is used in association with @FT_END_HEADER in header */ - /* files to ensure that the declarations within are properly */ - /* encapsulated in an `extern "C" { .. }' block when included from a */ - /* C++ compiler. */ - /* */ -#ifdef __cplusplus -#define FT_BEGIN_HEADER extern "C" { -#else -#define FT_BEGIN_HEADER /* nothing */ -#endif - - - /*@***********************************************************************/ - /* */ - /* */ - /* FT_END_HEADER */ - /* */ - /* */ - /* This macro is used in association with @FT_BEGIN_HEADER in header */ - /* files to ensure that the declarations within are properly */ - /* encapsulated in an `extern "C" { .. }' block when included from a */ - /* C++ compiler. */ - /* */ -#ifdef __cplusplus -#define FT_END_HEADER } -#else -#define FT_END_HEADER /* nothing */ -#endif - - - /*************************************************************************/ - /* */ - /* Aliases for the FreeType 2 public and configuration files. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /*
*/ - /* header_file_macros */ - /* */ - /* */ - /* Header File Macros */ - /* */ - /* <Abstract> */ - /* Macro definitions used to #include specific header files. */ - /* */ - /* <Description> */ - /* The following macros are defined to the name of specific */ - /* FreeType~2 header files. They can be used directly in #include */ - /* statements as in: */ - /* */ - /* { */ - /* #include FT_FREETYPE_H */ - /* #include FT_MULTIPLE_MASTERS_H */ - /* #include FT_GLYPH_H */ - /* } */ - /* */ - /* There are several reasons why we are now using macros to name */ - /* public header files. The first one is that such macros are not */ - /* limited to the infamous 8.3~naming rule required by DOS (and */ - /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ - /* */ - /* The second reason is that it allows for more flexibility in the */ - /* way FreeType~2 is installed on a given system. */ - /* */ - /*************************************************************************/ - - - /* configuration files */ - - /************************************************************************* - * - * @macro: - * FT_CONFIG_CONFIG_H - * - * @description: - * A macro used in #include statements to name the file containing - * FreeType~2 configuration data. - * - */ -#ifndef FT_CONFIG_CONFIG_H -#define FT_CONFIG_CONFIG_H <config/ftconfig.h> -#endif - - - /************************************************************************* - * - * @macro: - * FT_CONFIG_STANDARD_LIBRARY_H - * - * @description: - * A macro used in #include statements to name the file containing - * FreeType~2 interface to the standard C library functions. - * - */ -#ifndef FT_CONFIG_STANDARD_LIBRARY_H -#define FT_CONFIG_STANDARD_LIBRARY_H <config/ftstdlib.h> -#endif - - - /************************************************************************* - * - * @macro: - * FT_CONFIG_OPTIONS_H - * - * @description: - * A macro used in #include statements to name the file containing - * FreeType~2 project-specific configuration options. - * - */ -#ifndef FT_CONFIG_OPTIONS_H -#define FT_CONFIG_OPTIONS_H <config/ftoption.h> -#endif - - - /************************************************************************* - * - * @macro: - * FT_CONFIG_MODULES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list of FreeType~2 modules that are statically linked to new library - * instances in @FT_Init_FreeType. - * - */ -#ifndef FT_CONFIG_MODULES_H -#define FT_CONFIG_MODULES_H <config/ftmodule.h> -#endif - - /* */ - - /* public headers */ - - /************************************************************************* - * - * @macro: - * FT_FREETYPE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * base FreeType~2 API. - * - */ -#define FT_FREETYPE_H <freetype.h> - - - /************************************************************************* - * - * @macro: - * FT_ERRORS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list of FreeType~2 error codes (and messages). - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_ERRORS_H <fterrors.h> - - - /************************************************************************* - * - * @macro: - * FT_MODULE_ERRORS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list of FreeType~2 module error offsets (and messages). - * - */ -#define FT_MODULE_ERRORS_H <ftmoderr.h> - - - /************************************************************************* - * - * @macro: - * FT_SYSTEM_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 interface to low-level operations (i.e., memory management - * and stream i/o). - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_SYSTEM_H <ftsystem.h> - - - /************************************************************************* - * - * @macro: - * FT_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing type - * definitions related to glyph images (i.e., bitmaps, outlines, - * scan-converter parameters). - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_IMAGE_H <ftimage.h> - - - /************************************************************************* - * - * @macro: - * FT_TYPES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * basic data types defined by FreeType~2. - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_TYPES_H <fttypes.h> - - - /************************************************************************* - * - * @macro: - * FT_LIST_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list management API of FreeType~2. - * - * (Most applications will never need to include this file.) - * - */ -#define FT_LIST_H <ftlist.h> - - - /************************************************************************* - * - * @macro: - * FT_OUTLINE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * scalable outline management API of FreeType~2. - * - */ -#define FT_OUTLINE_H <ftoutln.h> - - - /************************************************************************* - * - * @macro: - * FT_SIZES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API which manages multiple @FT_Size objects per face. - * - */ -#define FT_SIZES_H <ftsizes.h> - - - /************************************************************************* - * - * @macro: - * FT_MODULE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * module management API of FreeType~2. - * - */ -#define FT_MODULE_H <ftmodapi.h> - - - /************************************************************************* - * - * @macro: - * FT_RENDER_H - * - * @description: - * A macro used in #include statements to name the file containing the - * renderer module management API of FreeType~2. - * - */ -#define FT_RENDER_H <ftrender.h> - - - /************************************************************************* - * - * @macro: - * FT_AUTOHINTER_H - * - * @description: - * A macro used in #include statements to name the file containing - * structures and macros related to the auto-hinting module. - * - */ -#define FT_AUTOHINTER_H <ftautoh.h> - - - /************************************************************************* - * - * @macro: - * FT_CFF_DRIVER_H - * - * @description: - * A macro used in #include statements to name the file containing - * structures and macros related to the CFF driver module. - * - */ -#define FT_CFF_DRIVER_H <ftcffdrv.h> - - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_DRIVER_H - * - * @description: - * A macro used in #include statements to name the file containing - * structures and macros related to the TrueType driver module. - * - */ -#define FT_TRUETYPE_DRIVER_H <ftttdrv.h> - - - /************************************************************************* - * - * @macro: - * FT_TYPE1_TABLES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * types and API specific to the Type~1 format. - * - */ -#define FT_TYPE1_TABLES_H <t1tables.h> - - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_IDS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * enumeration values which identify name strings, languages, encodings, - * etc. This file really contains a _large_ set of constant macro - * definitions, taken from the TrueType and OpenType specifications. - * - */ -#define FT_TRUETYPE_IDS_H <ttnameid.h> - - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_TABLES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * types and API specific to the TrueType (as well as OpenType) format. - * - */ -#define FT_TRUETYPE_TABLES_H <tttables.h> - - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_TAGS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of TrueType four-byte `tags' which identify blocks in - * SFNT-based font formats (i.e., TrueType and OpenType). - * - */ -#define FT_TRUETYPE_TAGS_H <tttags.h> - - - /************************************************************************* - * - * @macro: - * FT_BDF_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which accesses BDF-specific strings from a - * face. - * - */ -#define FT_BDF_H <ftbdf.h> - - - /************************************************************************* - * - * @macro: - * FT_CID_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which access CID font information from a - * face. - * - */ -#define FT_CID_H <ftcid.h> - - - /************************************************************************* - * - * @macro: - * FT_GZIP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports gzip-compressed files. - * - */ -#define FT_GZIP_H <ftgzip.h> - - - /************************************************************************* - * - * @macro: - * FT_LZW_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports LZW-compressed files. - * - */ -#define FT_LZW_H <ftlzw.h> - - - /************************************************************************* - * - * @macro: - * FT_BZIP2_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports bzip2-compressed files. - * - */ -#define FT_BZIP2_H <ftbzip2.h> - - - /************************************************************************* - * - * @macro: - * FT_WINFONTS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports Windows FNT files. - * - */ -#define FT_WINFONTS_H <ftwinfnt.h> - - - /************************************************************************* - * - * @macro: - * FT_GLYPH_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional glyph management component. - * - */ -#define FT_GLYPH_H <ftglyph.h> - - - /************************************************************************* - * - * @macro: - * FT_BITMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional bitmap conversion component. - * - */ -#define FT_BITMAP_H <ftbitmap.h> - - - /************************************************************************* - * - * @macro: - * FT_BBOX_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional exact bounding box computation routines. - * - */ -#define FT_BBOX_H <ftbbox.h> - - - /************************************************************************* - * - * @macro: - * FT_CACHE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional FreeType~2 cache sub-system. - * - */ -#define FT_CACHE_H <ftcache.h> - - - /************************************************************************* - * - * @macro: - * FT_CACHE_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `glyph image' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for @FT_Glyph elements. You can also - * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to - * store small glyph bitmaps, as it will use less memory. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * glyph image-related cache declarations. - * - */ -#define FT_CACHE_IMAGE_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_SMALL_BITMAPS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `small bitmaps' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for small glyph bitmaps in a relatively - * memory-efficient way. You can also use the API defined in - * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, - * including scalable outlines. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * small bitmaps-related cache declarations. - * - */ -#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_CHARMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `charmap' API of the FreeType~2 cache sub-system. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * charmap-based cache declarations. - * - */ -#define FT_CACHE_CHARMAP_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_MAC_H - * - * @description: - * A macro used in #include statements to name the file containing the - * Macintosh-specific FreeType~2 API. The latter is used to access - * fonts embedded in resource forks. - * - * This header file must be explicitly included by client applications - * compiled on the Mac (note that the base API still works though). - * - */ -#define FT_MAC_H <ftmac.h> - - - /************************************************************************* - * - * @macro: - * FT_MULTIPLE_MASTERS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional multiple-masters management API of FreeType~2. - * - */ -#define FT_MULTIPLE_MASTERS_H <ftmm.h> - - - /************************************************************************* - * - * @macro: - * FT_SFNT_NAMES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional FreeType~2 API which accesses embedded `name' strings in - * SFNT-based font formats (i.e., TrueType and OpenType). - * - */ -#define FT_SFNT_NAMES_H <ftsnames.h> - - - /************************************************************************* - * - * @macro: - * FT_OPENTYPE_VALIDATE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional FreeType~2 API which validates OpenType tables (BASE, GDEF, - * GPOS, GSUB, JSTF). - * - */ -#define FT_OPENTYPE_VALIDATE_H <ftotval.h> - - - /************************************************************************* - * - * @macro: - * FT_GX_VALIDATE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat, - * mort, morx, bsln, just, kern, opbd, trak, prop). - * - */ -#define FT_GX_VALIDATE_H <ftgxval.h> - - - /************************************************************************* - * - * @macro: - * FT_PFR_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which accesses PFR-specific data. - * - */ -#define FT_PFR_H <ftpfr.h> - - - /************************************************************************* - * - * @macro: - * FT_STROKER_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which provides functions to stroke outline paths. - */ -#define FT_STROKER_H <ftstroke.h> - - - /************************************************************************* - * - * @macro: - * FT_SYNTHESIS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs artificial obliquing and emboldening. - */ -#define FT_SYNTHESIS_H <ftsynth.h> - - - /************************************************************************* - * - * @macro: - * FT_XFREE86_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which provides functions specific to the XFree86 and - * X.Org X11 servers. - */ -#define FT_XFREE86_H <ftxf86.h> - - - /************************************************************************* - * - * @macro: - * FT_TRIGONOMETRY_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs trigonometric computations (e.g., - * cosines and arc tangents). - */ -#define FT_TRIGONOMETRY_H <fttrigon.h> - - - /************************************************************************* - * - * @macro: - * FT_LCD_FILTER_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs color filtering for subpixel rendering. - */ -#define FT_LCD_FILTER_H <ftlcdfil.h> - - - /************************************************************************* - * - * @macro: - * FT_UNPATENTED_HINTING_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs color filtering for subpixel rendering. - */ -#define FT_UNPATENTED_HINTING_H <ttunpat.h> - - - /************************************************************************* - * - * @macro: - * FT_INCREMENTAL_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs color filtering for subpixel rendering. - */ -#define FT_INCREMENTAL_H <ftincrem.h> - - - /************************************************************************* - * - * @macro: - * FT_GASP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which returns entries from the TrueType GASP table. - */ -#define FT_GASP_H <ftgasp.h> - - - /************************************************************************* - * - * @macro: - * FT_ADVANCES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which returns individual and ranged glyph advances. - */ -#define FT_ADVANCES_H <ftadvanc.h> - - - /* */ - -#define FT_ERROR_DEFINITIONS_H <fterrdef.h> - - - /* The internals of the cache sub-system are no longer exposed. We */ - /* default to FT_CACHE_H at the moment just in case, but we know of */ - /* no rogue client that uses them. */ - /* */ -#define FT_CACHE_MANAGER_H <ftcache.h> -#define FT_CACHE_INTERNAL_MRU_H <ftcache.h> -#define FT_CACHE_INTERNAL_MANAGER_H <ftcache.h> -#define FT_CACHE_INTERNAL_CACHE_H <ftcache.h> -#define FT_CACHE_INTERNAL_GLYPH_H <ftcache.h> -#define FT_CACHE_INTERNAL_IMAGE_H <ftcache.h> -#define FT_CACHE_INTERNAL_SBITS_H <ftcache.h> - - -#define FT_INCREMENTAL_H <ftincrem.h> - -#define FT_TRUETYPE_UNPATENTED_H <ttunpat.h> - - - /* - * Include internal headers definitions from <internal/...> - * only when building the library. - */ -#ifdef FT2_BUILD_LIBRARY -#define FT_INTERNAL_INTERNAL_H <internal/internal.h> -#include FT_INTERNAL_INTERNAL_H -#endif /* FT2_BUILD_LIBRARY */ - - -#endif /* __FT2_BUILD_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/config/ftmodule.h b/GLideN64/src/inc/freetype/include/config/ftmodule.h deleted file mode 100644 index 76d271a..0000000 --- a/GLideN64/src/inc/freetype/include/config/ftmodule.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file registers the FreeType modules compiled into the library. - * - * If you use GNU make, this file IS NOT USED! Instead, it is created in - * the objects directory (normally `<topdir>/objs/') based on information - * from `<topdir>/modules.cfg'. - * - * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile - * FreeType without GNU make. - * - */ - -FT_USE_MODULE( FT_Module_Class, autofit_module_class ) -FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) -FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) -FT_USE_MODULE( FT_Module_Class, psaux_module_class ) -FT_USE_MODULE( FT_Module_Class, psnames_module_class ) -FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) -FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) -FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) -FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) -FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) -FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) -FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) - -/* EOF */ diff --git a/GLideN64/src/inc/freetype/include/config/ftoption.h b/GLideN64/src/inc/freetype/include/config/ftoption.h deleted file mode 100644 index 5b11f0e..0000000 --- a/GLideN64/src/inc/freetype/include/config/ftoption.h +++ /dev/null @@ -1,846 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftoption.h */ -/* */ -/* User-selectable configuration macros (specification only). */ -/* */ -/* Copyright 1996-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTOPTION_H__ -#define __FTOPTION_H__ - - -#include <ft2build.h> - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* USER-SELECTABLE CONFIGURATION MACROS */ - /* */ - /* This file contains the default configuration macro definitions for */ - /* a standard build of the FreeType library. There are three ways to */ - /* use this file to build project-specific versions of the library: */ - /* */ - /* - You can modify this file by hand, but this is not recommended in */ - /* cases where you would like to build several versions of the */ - /* library from a single source directory. */ - /* */ - /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/config/ftoption.h', where `$BUILD' is the */ - /* name of a directory that is included _before_ the FreeType include */ - /* path during compilation. */ - /* */ - /* The default FreeType Makefiles and Jamfiles use the build */ - /* directory `builds/<system>' by default, but you can easily change */ - /* that for your own projects. */ - /* */ - /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */ - /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ - /* locate this file during the build. For example, */ - /* */ - /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ - /* #include <config/ftheader.h> */ - /* */ - /* will use `$BUILD/myftoptions.h' instead of this file for macro */ - /* definitions. */ - /* */ - /* Note also that you can similarly pre-define the macro */ - /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ - /* that are statically linked to the library at compile time. By */ - /* default, this file is <config/ftmodule.h>. */ - /* */ - /* We highly recommend using the third method whenever possible. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ - /* */ - /* Note that this feature is covered by several Microsoft patents */ - /* and should not be activated in any default build of the library. */ - /* */ - /* This macro has no impact on the FreeType API, only on its */ - /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ - /* the original size in case this macro isn't defined; however, each */ - /* triplet of subpixels has R=G=B. */ - /* */ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - - /*************************************************************************/ - /* */ - /* Many compilers provide a non-ANSI 64-bit data type that can be used */ - /* by FreeType to speed up some computations. However, this will create */ - /* some problems when compiling the library in strict ANSI mode. */ - /* */ - /* For this reason, the use of 64-bit integers is normally disabled when */ - /* the __STDC__ macro is defined. You can however disable this by */ - /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ - /* */ - /* For most compilers, this will only create compilation warnings when */ - /* building the library. */ - /* */ - /* ObNote: The compiler-specific 64-bit integers are detected in the */ - /* file `ftconfig.h' either statically or through the */ - /* `configure' script on supported platforms. */ - /* */ -#undef FT_CONFIG_OPTION_FORCE_INT64 - - - /*************************************************************************/ - /* */ - /* If this macro is defined, do not try to use an assembler version of */ - /* performance-critical functions (e.g. FT_MulFix). You should only do */ - /* that to verify that the assembler function works properly, or to */ - /* execute benchmark tests of the various implementations. */ -/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ - - - /*************************************************************************/ - /* */ - /* If this macro is defined, try to use an inlined assembler version of */ - /* the `FT_MulFix' function, which is a `hotspot' when loading and */ - /* hinting glyphs, and which should be executed as fast as possible. */ - /* */ - /* Note that if your compiler or CPU is not supported, this will default */ - /* to the standard and portable implementation found in `ftcalc.c'. */ - /* */ -#define FT_CONFIG_OPTION_INLINE_MULFIX - - - /*************************************************************************/ - /* */ - /* LZW-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `compress' program. This is mostly used to parse many of the PCF */ - /* files that come with various X11 distributions. The implementation */ - /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ - /* (see src/lzw/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -#define FT_CONFIG_OPTION_USE_LZW - - - /*************************************************************************/ - /* */ - /* Gzip-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `gzip' program. This is mostly used to parse many of the PCF files */ - /* that come with XFree86. The implementation uses `zlib' to */ - /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. See also */ - /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ - /* */ -#define FT_CONFIG_OPTION_USE_ZLIB - - - /*************************************************************************/ - /* */ - /* ZLib library selection */ - /* */ - /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ - /* It allows FreeType's `ftgzip' component to link to the system's */ - /* installation of the ZLib library. This is useful on systems like */ - /* Unix or VMS where it generally is already available. */ - /* */ - /* If you let it undefined, the component will use its own copy */ - /* of the zlib sources instead. These have been modified to be */ - /* included directly within the component and *not* export external */ - /* function names. This allows you to link any program with FreeType */ - /* _and_ ZLib without linking conflicts. */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ - - - /*************************************************************************/ - /* */ - /* Bzip2-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `bzip2' program. This is mostly used to parse many of the PCF */ - /* files that come with XFree86. The implementation uses `libbz2' to */ - /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ - /* Contrary to gzip, bzip2 currently is not included and need to use */ - /* the system available bzip2 implementation. */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -/* #define FT_CONFIG_OPTION_USE_BZIP2 */ - - - /*************************************************************************/ - /* */ - /* Define to disable the use of file stream functions and types, FILE, */ - /* fopen() etc. Enables the use of smaller system libraries on embedded */ - /* systems that have multiple system libraries, some with or without */ - /* file stream support, in the cases where file stream support is not */ - /* necessary such as memory loading of font files. */ - /* */ -/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ - - - /*************************************************************************/ - /* */ - /* PNG bitmap support. */ - /* */ - /* FreeType now handles loading color bitmap glyphs in the PNG format. */ - /* This requires help from the external libpng library. Uncompressed */ - /* color bitmaps do not need any external libraries and will be */ - /* supported regardless of this configuration. */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -/* #define FT_CONFIG_OPTION_USE_PNG */ - - - /*************************************************************************/ - /* */ - /* HarfBuzz support. */ - /* */ - /* FreeType uses the HarfBuzz library to improve auto-hinting of */ - /* OpenType fonts. If available, many glyphs not directly addressable */ - /* by a font's character map will be hinted also. */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ - - - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - - /*************************************************************************/ - /* */ - /* Glyph Postscript Names handling */ - /* */ - /* By default, FreeType 2 is compiled with the `psnames' module. This */ - /* module is in charge of converting a glyph name string into a */ - /* Unicode value, or return a Macintosh standard glyph name for the */ - /* use with the TrueType `post' table. */ - /* */ - /* Undefine this macro if you do not want `psnames' compiled in your */ - /* build of FreeType. This has the following effects: */ - /* */ - /* - The TrueType driver will provide its own set of glyph names, */ - /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ - /* */ - /* - The Type 1 driver will not be able to synthesize a Unicode */ - /* charmap out of the glyphs found in the fonts. */ - /* */ - /* You would normally undefine this configuration macro when building */ - /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ - /* */ -#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Postscript Names to Unicode Values support */ - /* */ - /* By default, FreeType 2 is built with the `PSNames' module compiled */ - /* in. Among other things, the module is used to convert a glyph name */ - /* into a Unicode value. This is especially useful in order to */ - /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ - /* through a big table named the `Adobe Glyph List' (AGL). */ - /* */ - /* Undefine this macro if you do not want the Adobe Glyph List */ - /* compiled in your `PSNames' module. The Type 1 driver will not be */ - /* able to synthesize a Unicode charmap out of the glyphs found in the */ - /* fonts. */ - /* */ -#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - - /*************************************************************************/ - /* */ - /* Support for Mac fonts */ - /* */ - /* Define this macro if you want support for outline fonts in Mac */ - /* format (mac dfont, mac resource, macbinary containing a mac */ - /* resource) on non-Mac platforms. */ - /* */ - /* Note that the `FOND' resource isn't checked. */ - /* */ -#define FT_CONFIG_OPTION_MAC_FONTS - - - /*************************************************************************/ - /* */ - /* Guessing methods to access embedded resource forks */ - /* */ - /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ - /* GNU/Linux). */ - /* */ - /* Resource forks which include fonts data are stored sometimes in */ - /* locations which users or developers don't expected. In some cases, */ - /* resource forks start with some offset from the head of a file. In */ - /* other cases, the actual resource fork is stored in file different */ - /* from what the user specifies. If this option is activated, */ - /* FreeType tries to guess whether such offsets or different file */ - /* names must be used. */ - /* */ - /* Note that normal, direct access of resource forks is controlled via */ - /* the FT_CONFIG_OPTION_MAC_FONTS option. */ - /* */ -#ifdef FT_CONFIG_OPTION_MAC_FONTS -#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#endif - - - /*************************************************************************/ - /* */ - /* Allow the use of FT_Incremental_Interface to load typefaces that */ - /* contain no glyph data, but supply it via a callback function. */ - /* This is required by clients supporting document formats which */ - /* supply font data incrementally as the document is parsed, such */ - /* as the Ghostscript interpreter for the PostScript language. */ - /* */ -#define FT_CONFIG_OPTION_INCREMENTAL - - - /*************************************************************************/ - /* */ - /* The size in bytes of the render pool used by the scan-line converter */ - /* to do all of its work. */ - /* */ - /* This must be greater than 4KByte if you use FreeType to rasterize */ - /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ - /* allocation of the render pool. */ - /* */ -#define FT_RENDER_POOL_SIZE 16384L - - - /*************************************************************************/ - /* */ - /* FT_MAX_MODULES */ - /* */ - /* The maximum number of modules that can be registered in a single */ - /* FreeType library object. 32 is the default. */ - /* */ -#define FT_MAX_MODULES 32 - - - /*************************************************************************/ - /* */ - /* Debug level */ - /* */ - /* FreeType can be compiled in debug or trace mode. In debug mode, */ - /* errors are reported through the `ftdebug' component. In trace */ - /* mode, additional messages are sent to the standard output during */ - /* execution. */ - /* */ - /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ - /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ - /* */ - /* Don't define any of these macros to compile in `release' mode! */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_LEVEL_ERROR */ -/* #define FT_DEBUG_LEVEL_TRACE */ - - - /*************************************************************************/ - /* */ - /* Autofitter debugging */ - /* */ - /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ - /* control the autofitter behaviour for debugging purposes with global */ - /* boolean variables (consequently, you should *never* enable this */ - /* while compiling in `release' mode): */ - /* */ - /* _af_debug_disable_horz_hints */ - /* _af_debug_disable_vert_hints */ - /* _af_debug_disable_blue_hints */ - /* */ - /* Additionally, the following functions provide dumps of various */ - /* internal autofit structures to stdout (using `printf'): */ - /* */ - /* af_glyph_hints_dump_points */ - /* af_glyph_hints_dump_segments */ - /* af_glyph_hints_dump_edges */ - /* */ - /* As an argument, they use another global variable: */ - /* */ - /* _af_debug_hints */ - /* */ - /* Please have a look at the `ftgrid' demo program to see how those */ - /* variables and macros should be used. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_AUTOFIT */ - - - /*************************************************************************/ - /* */ - /* Memory Debugging */ - /* */ - /* FreeType now comes with an integrated memory debugger that is */ - /* capable of detecting simple errors like memory leaks or double */ - /* deletes. To compile it within your build of the library, you */ - /* should define FT_DEBUG_MEMORY here. */ - /* */ - /* Note that the memory debugger is only activated at runtime when */ - /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_DEBUG_MEMORY */ - - - /*************************************************************************/ - /* */ - /* Module errors */ - /* */ - /* If this macro is set (which is _not_ the default), the higher byte */ - /* of an error code gives the module in which the error has occurred, */ - /* while the lower byte is the real error code. */ - /* */ - /* Setting this macro makes sense for debugging purposes only, since */ - /* it would break source compatibility of certain programs that use */ - /* FreeType 2. */ - /* */ - /* More details can be found in the files ftmoderr.h and fterrors.h. */ - /* */ -#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS - - - /*************************************************************************/ - /* */ - /* Position Independent Code */ - /* */ - /* If this macro is set (which is _not_ the default), FreeType2 will */ - /* avoid creating constants that require address fixups. Instead the */ - /* constants will be moved into a struct and additional intialization */ - /* code will be used. */ - /* */ - /* Setting this macro is needed for systems that prohibit address */ - /* fixups, such as BREW. */ - /* */ -/* #define FT_CONFIG_OPTION_PIC */ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ - /* embedded bitmaps in all formats using the SFNT module (namely */ - /* TrueType & OpenType). */ - /* */ -#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ - /* load and enumerate the glyph Postscript names in a TrueType or */ - /* OpenType file. */ - /* */ - /* Note that when you do not compile the `PSNames' module by undefining */ - /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ - /* contain additional code used to read the PS Names table from a font. */ - /* */ - /* (By default, the module uses `PSNames' to extract glyph names.) */ - /* */ -#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ - /* access the internal name table in a SFNT-based format like TrueType */ - /* or OpenType. The name table contains various strings used to */ - /* describe the font, like family name, copyright, version, etc. It */ - /* does not contain any glyph name though. */ - /* */ - /* Accessing SFNT names is done through the functions declared in */ - /* `ftsnames.h'. */ - /* */ -#define TT_CONFIG_OPTION_SFNT_NAMES - - - /*************************************************************************/ - /* */ - /* TrueType CMap support */ - /* */ - /* Here you can fine-tune which TrueType CMap table format shall be */ - /* supported. */ -#define TT_CONFIG_CMAP_FORMAT_0 -#define TT_CONFIG_CMAP_FORMAT_2 -#define TT_CONFIG_CMAP_FORMAT_4 -#define TT_CONFIG_CMAP_FORMAT_6 -#define TT_CONFIG_CMAP_FORMAT_8 -#define TT_CONFIG_CMAP_FORMAT_10 -#define TT_CONFIG_CMAP_FORMAT_12 -#define TT_CONFIG_CMAP_FORMAT_13 -#define TT_CONFIG_CMAP_FORMAT_14 - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ - /* a bytecode interpreter in the TrueType driver. */ - /* */ - /* By undefining this, you will only compile the code necessary to load */ - /* TrueType glyphs without hinting. */ - /* */ - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ -#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ - /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */ - /* replaces the native TrueType hinting mechanism when anything but */ - /* FT_RENDER_MODE_MONO is requested. */ - /* */ - /* Enabling this causes the TrueType driver to ignore instructions under */ - /* certain conditions. This is done in accordance with the guide here, */ - /* with some minor differences: */ - /* */ - /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ - /* */ - /* By undefining this, you only compile the code necessary to hint */ - /* TrueType glyphs with native TT hinting. */ - /* */ - /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ - /* defined. */ - /* */ -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - - - /*************************************************************************/ - /* */ - /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ - /* of the TrueType bytecode interpreter is used that doesn't implement */ - /* any of the patented opcodes and algorithms. The patents related to */ - /* TrueType hinting have expired worldwide since May 2010; this option */ - /* is now deprecated. */ - /* */ - /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */ - /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */ - /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ - /* */ - /* This macro is only useful for a small number of font files (mostly */ - /* for Asian scripts) that require bytecode interpretation to properly */ - /* load glyphs. For all other fonts, this produces unpleasant results, */ - /* thus the unpatented interpreter is never used to load glyphs from */ - /* TrueType fonts unless one of the following two options is used. */ - /* */ - /* - The unpatented interpreter is explicitly activated by the user */ - /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ - /* when opening the FT_Face. */ - /* */ - /* - FreeType detects that the FT_Face corresponds to one of the */ - /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ - /* contains a hard-coded list of font names and other matching */ - /* parameters (see function `tt_face_init' in file */ - /* `src/truetype/ttobjs.c'). */ - /* */ - /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ - /* */ - /* { */ - /* FT_Parameter parameter; */ - /* FT_Open_Args open_args; */ - /* */ - /* */ - /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ - /* */ - /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ - /* open_args.pathname = my_font_pathname; */ - /* open_args.num_params = 1; */ - /* open_args.params = ¶meter; */ - /* */ - /* error = FT_Open_Face( library, &open_args, index, &face ); */ - /* ... */ - /* } */ - /* */ -/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ - /* bytecode interpreter with a huge switch statement, rather than a call */ - /* table. This results in smaller and faster code for a number of */ - /* architectures. */ - /* */ - /* Note however that on some compiler/processor combinations, undefining */ - /* this macro will generate faster, though larger, code. */ - /* */ -#define TT_CONFIG_OPTION_INTERPRETER_SWITCH - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ - /* TrueType glyph loader to use Apple's definition of how to handle */ - /* component offsets in composite glyphs. */ - /* */ - /* Apple and MS disagree on the default behavior of component offsets */ - /* in composites. Apple says that they should be scaled by the scaling */ - /* factors in the transformation matrix (roughly, it's more complex) */ - /* while MS says they should not. OpenType defines two bits in the */ - /* composite flags array which can be used to disambiguate, but old */ - /* fonts will not have them. */ - /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ - /* */ -#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ - /* support for Apple's distortable font technology (fvar, gvar, cvar, */ - /* and avar tables). This has many similarities to Type 1 Multiple */ - /* Masters support. */ - /* */ -#define TT_CONFIG_OPTION_GX_VAR_SUPPORT - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BDF if you want to include support for */ - /* an embedded `BDF ' table within SFNT-based bitmap formats. */ - /* */ -#define TT_CONFIG_OPTION_BDF - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ - /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ - /* required. */ - /* */ -#define T1_MAX_DICT_DEPTH 5 - - - /*************************************************************************/ - /* */ - /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ - /* calls during glyph loading. */ - /* */ -#define T1_MAX_SUBRS_CALLS 16 - - - /*************************************************************************/ - /* */ - /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ - /* minimum of 16 is required. */ - /* */ - /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ - /* */ -#define T1_MAX_CHARSTRINGS_OPERANDS 256 - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ - /* files into an existing face. Note that if set, the T1 driver will be */ - /* unable to produce kerning distances. */ - /* */ -#undef T1_CONFIG_OPTION_NO_AFM - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of the Multiple Masters font support in the Type 1 */ - /* driver. */ - /* */ -#undef T1_CONFIG_OPTION_NO_MM_SUPPORT - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** C F F D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */ - /* engine gets compiled into FreeType. If defined, it is possible to */ - /* switch between the two engines using the `hinting-engine' property of */ - /* the cff driver module. */ - /* */ -/* #define CFF_CONFIG_OPTION_OLD_ENGINE */ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ - /* support. */ - /* */ -#define AF_CONFIG_OPTION_CJK - - /*************************************************************************/ - /* */ - /* Compile autofit module with Indic script support. */ - /* */ -#define AF_CONFIG_OPTION_INDIC - - /*************************************************************************/ - /* */ - /* Compile autofit module with warp hinting. The idea of the warping */ - /* code is to slightly scale and shift a glyph within a single dimension */ - /* so that as much of its segments are aligned (more or less) on the */ - /* grid. To find out the optimal scaling and shifting value, various */ - /* parameter combinations are tried and scored. */ - /* */ - /* This experimental option is only active if the render mode is */ - /* FT_RENDER_MODE_LIGHT. */ - /* */ -/* #define AF_CONFIG_OPTION_USE_WARPER */ - - /* */ - - - /* - * This macro is obsolete. Support has been removed in FreeType - * version 2.5. - */ -/* #define FT_CONFIG_OPTION_OLD_INTERNALS */ - - - /* - * This macro is defined if either unpatented or native TrueType - * hinting is requested by the definitions above. - */ -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER -#define TT_USE_BYTECODE_INTERPRETER -#undef TT_CONFIG_OPTION_UNPATENTED_HINTING -#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING -#define TT_USE_BYTECODE_INTERPRETER -#endif - -FT_END_HEADER - - -#endif /* __FTOPTION_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/config/ftstdlib.h b/GLideN64/src/inc/freetype/include/config/ftstdlib.h deleted file mode 100644 index b940efc..0000000 --- a/GLideN64/src/inc/freetype/include/config/ftstdlib.h +++ /dev/null @@ -1,174 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftstdlib.h */ -/* */ -/* ANSI-specific library and header configuration file (specification */ -/* only). */ -/* */ -/* Copyright 2002-2007, 2009, 2011-2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to group all #includes to the ANSI C library that */ - /* FreeType normally requires. It also defines macros to rename the */ - /* standard functions within the FreeType source code. */ - /* */ - /* Load a file which defines __FTSTDLIB_H__ before this one to override */ - /* it. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTSTDLIB_H__ -#define __FTSTDLIB_H__ - - -#include <stddef.h> - -#define ft_ptrdiff_t ptrdiff_t - - - /**********************************************************************/ - /* */ - /* integer limits */ - /* */ - /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ - /* of `int' and `long' in bytes at compile-time. So far, this works */ - /* for all platforms the library has been tested on. */ - /* */ - /* Note that on the extremely rare platforms that do not provide */ - /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ - /* old Crays where `int' is 36 bits), we do not make any guarantee */ - /* about the correct behaviour of FT2 with all fonts. */ - /* */ - /* In these case, `ftconfig.h' will refuse to compile anyway with a */ - /* message like `couldn't find 32-bit type' or something similar. */ - /* */ - /**********************************************************************/ - - -#include <limits.h> - -#define FT_CHAR_BIT CHAR_BIT -#define FT_USHORT_MAX USHRT_MAX -#define FT_INT_MAX INT_MAX -#define FT_INT_MIN INT_MIN -#define FT_UINT_MAX UINT_MAX -#define FT_ULONG_MAX ULONG_MAX - - - /**********************************************************************/ - /* */ - /* character and string processing */ - /* */ - /**********************************************************************/ - - -#include <string.h> - -#define ft_memchr memchr -#define ft_memcmp memcmp -#define ft_memcpy memcpy -#define ft_memmove memmove -#define ft_memset memset -#define ft_strcat strcat -#define ft_strcmp strcmp -#define ft_strcpy strcpy -#define ft_strlen strlen -#define ft_strncmp strncmp -#define ft_strncpy strncpy -#define ft_strrchr strrchr -#define ft_strstr strstr - - - /**********************************************************************/ - /* */ - /* file handling */ - /* */ - /**********************************************************************/ - - -#include <stdio.h> - -#define FT_FILE FILE -#define ft_fclose fclose -#define ft_fopen fopen -#define ft_fread fread -#define ft_fseek fseek -#define ft_ftell ftell -#define ft_sprintf sprintf - - - /**********************************************************************/ - /* */ - /* sorting */ - /* */ - /**********************************************************************/ - - -#include <stdlib.h> - -#define ft_qsort qsort - - - /**********************************************************************/ - /* */ - /* memory allocation */ - /* */ - /**********************************************************************/ - - -#define ft_scalloc calloc -#define ft_sfree free -#define ft_smalloc malloc -#define ft_srealloc realloc - - - /**********************************************************************/ - /* */ - /* miscellaneous */ - /* */ - /**********************************************************************/ - - -#define ft_atol atol -#define ft_labs labs - - - /**********************************************************************/ - /* */ - /* execution control */ - /* */ - /**********************************************************************/ - - -#include <setjmp.h> - -#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ - /* jmp_buf is defined as a macro */ - /* on certain platforms */ - -#define ft_longjmp longjmp -#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ - - - /* the following is only used for debugging purposes, i.e., if */ - /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ - -#include <stdarg.h> - - -#endif /* __FTSTDLIB_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/freetype.h b/GLideN64/src/inc/freetype/include/freetype.h deleted file mode 100644 index fb62b62..0000000 --- a/GLideN64/src/inc/freetype/include/freetype.h +++ /dev/null @@ -1,4076 +0,0 @@ -/***************************************************************************/ -/* */ -/* freetype.h */ -/* */ -/* FreeType high-level API and common types (specification only). */ -/* */ -/* Copyright 1996-2014 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FREETYPE_H__ -#define __FREETYPE_H__ - - -#ifndef FT_FREETYPE_H -#error "`ft2build.h' hasn't been included yet!" -#error "Please always use macros to include FreeType header files." -#error "Example:" -#error " #include <ft2build.h>" -#error " #include FT_FREETYPE_H" -#endif - - -#include <ft2build.h> -#include FT_CONFIG_CONFIG_H -#include FT_TYPES_H -#include FT_ERRORS_H - - -FT_BEGIN_HEADER - - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* header_inclusion */ - /* */ - /* <Title> */ - /* FreeType's header inclusion scheme */ - /* */ - /* <Abstract> */ - /* How client applications should include FreeType header files. */ - /* */ - /* <Description> */ - /* To be as flexible as possible (and for historical reasons), */ - /* FreeType uses a very special inclusion scheme to load header */ - /* files, for example */ - /* */ - /* { */ - /* #include <ft2build.h> */ - /* */ - /* #include FT_FREETYPE_H */ - /* #include FT_OUTLINE_H */ - /* } */ - /* */ - /* A compiler and its preprocessor only needs an include path to find */ - /* the file `ft2build.h'; the exact locations and names of the other */ - /* FreeType header files are hidden by preprocessor macro names, */ - /* loaded by `ft2build.h'. The API documentation always gives the */ - /* header macro name needed for a particular function. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* user_allocation */ - /* */ - /* <Title> */ - /* User allocation */ - /* */ - /* <Abstract> */ - /* How client applications should allocate FreeType data structures. */ - /* */ - /* <Description> */ - /* FreeType assumes that structures allocated by the user and passed */ - /* as arguments are zeroed out except for the actual data. In other */ - /* words, it is recommended to use `calloc' (or variants of it) */ - /* instead of `malloc' for allocation. */ - /* */ - /*************************************************************************/ - - - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* B A S I C T Y P E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* base_interface */ - /* */ - /* <Title> */ - /* Base Interface */ - /* */ - /* <Abstract> */ - /* The FreeType~2 base font interface. */ - /* */ - /* <Description> */ - /* This section describes the public high-level API of FreeType~2. */ - /* */ - /* <Order> */ - /* FT_Library */ - /* FT_Face */ - /* FT_Size */ - /* FT_GlyphSlot */ - /* FT_CharMap */ - /* FT_Encoding */ - /* */ - /* FT_FaceRec */ - /* */ - /* FT_FACE_FLAG_SCALABLE */ - /* FT_FACE_FLAG_FIXED_SIZES */ - /* FT_FACE_FLAG_FIXED_WIDTH */ - /* FT_FACE_FLAG_HORIZONTAL */ - /* FT_FACE_FLAG_VERTICAL */ - /* FT_FACE_FLAG_COLOR */ - /* FT_FACE_FLAG_SFNT */ - /* FT_FACE_FLAG_CID_KEYED */ - /* FT_FACE_FLAG_TRICKY */ - /* FT_FACE_FLAG_KERNING */ - /* FT_FACE_FLAG_MULTIPLE_MASTERS */ - /* FT_FACE_FLAG_GLYPH_NAMES */ - /* FT_FACE_FLAG_EXTERNAL_STREAM */ - /* FT_FACE_FLAG_FAST_GLYPHS */ - /* FT_FACE_FLAG_HINTER */ - /* */ - /* FT_STYLE_FLAG_BOLD */ - /* FT_STYLE_FLAG_ITALIC */ - /* */ - /* FT_SizeRec */ - /* FT_Size_Metrics */ - /* */ - /* FT_GlyphSlotRec */ - /* FT_Glyph_Metrics */ - /* FT_SubGlyph */ - /* */ - /* FT_Bitmap_Size */ - /* */ - /* FT_Init_FreeType */ - /* FT_Done_FreeType */ - /* */ - /* FT_New_Face */ - /* FT_Done_Face */ - /* FT_New_Memory_Face */ - /* FT_Open_Face */ - /* FT_Open_Args */ - /* FT_Parameter */ - /* FT_Attach_File */ - /* FT_Attach_Stream */ - /* */ - /* FT_Set_Char_Size */ - /* FT_Set_Pixel_Sizes */ - /* FT_Request_Size */ - /* FT_Select_Size */ - /* FT_Size_Request_Type */ - /* FT_Size_Request */ - /* FT_Set_Transform */ - /* FT_Load_Glyph */ - /* FT_Get_Char_Index */ - /* FT_Get_Name_Index */ - /* FT_Load_Char */ - /* */ - /* FT_OPEN_MEMORY */ - /* FT_OPEN_STREAM */ - /* FT_OPEN_PATHNAME */ - /* FT_OPEN_DRIVER */ - /* FT_OPEN_PARAMS */ - /* */ - /* FT_LOAD_DEFAULT */ - /* FT_LOAD_RENDER */ - /* FT_LOAD_MONOCHROME */ - /* FT_LOAD_LINEAR_DESIGN */ - /* FT_LOAD_NO_SCALE */ - /* FT_LOAD_NO_HINTING */ - /* FT_LOAD_NO_BITMAP */ - /* FT_LOAD_CROP_BITMAP */ - /* */ - /* FT_LOAD_VERTICAL_LAYOUT */ - /* FT_LOAD_IGNORE_TRANSFORM */ - /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ - /* FT_LOAD_FORCE_AUTOHINT */ - /* FT_LOAD_NO_RECURSE */ - /* FT_LOAD_PEDANTIC */ - /* */ - /* FT_LOAD_TARGET_NORMAL */ - /* FT_LOAD_TARGET_LIGHT */ - /* FT_LOAD_TARGET_MONO */ - /* FT_LOAD_TARGET_LCD */ - /* FT_LOAD_TARGET_LCD_V */ - /* */ - /* FT_Render_Glyph */ - /* FT_Render_Mode */ - /* FT_Get_Kerning */ - /* FT_Kerning_Mode */ - /* FT_Get_Track_Kerning */ - /* FT_Get_Glyph_Name */ - /* FT_Get_Postscript_Name */ - /* */ - /* FT_CharMapRec */ - /* FT_Select_Charmap */ - /* FT_Set_Charmap */ - /* FT_Get_Charmap_Index */ - /* */ - /* FT_FSTYPE_INSTALLABLE_EMBEDDING */ - /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */ - /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */ - /* FT_FSTYPE_EDITABLE_EMBEDDING */ - /* FT_FSTYPE_NO_SUBSETTING */ - /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */ - /* */ - /* FT_Get_FSType_Flags */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Glyph_Metrics */ - /* */ - /* <Description> */ - /* A structure used to model the metrics of a single glyph. The */ - /* values are expressed in 26.6 fractional pixel format; if the flag */ - /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */ - /* are expressed in font units instead. */ - /* */ - /* <Fields> */ - /* width :: */ - /* The glyph's width. */ - /* */ - /* height :: */ - /* The glyph's height. */ - /* */ - /* horiBearingX :: */ - /* Left side bearing for horizontal layout. */ - /* */ - /* horiBearingY :: */ - /* Top side bearing for horizontal layout. */ - /* */ - /* horiAdvance :: */ - /* Advance width for horizontal layout. */ - /* */ - /* vertBearingX :: */ - /* Left side bearing for vertical layout. */ - /* */ - /* vertBearingY :: */ - /* Top side bearing for vertical layout. Larger positive values */ - /* mean further below the vertical glyph origin. */ - /* */ - /* vertAdvance :: */ - /* Advance height for vertical layout. Positive values mean the */ - /* glyph has a positive advance downward. */ - /* */ - /* <Note> */ - /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ - /* dimensions of the hinted glyph (in case hinting is applicable). */ - /* */ - /* Stroking a glyph with an outside border does not increase */ - /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */ - /* values to account for the added width and height. */ - /* */ - typedef struct FT_Glyph_Metrics_ - { - FT_Pos width; - FT_Pos height; - - FT_Pos horiBearingX; - FT_Pos horiBearingY; - FT_Pos horiAdvance; - - FT_Pos vertBearingX; - FT_Pos vertBearingY; - FT_Pos vertAdvance; - - } FT_Glyph_Metrics; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Bitmap_Size */ - /* */ - /* <Description> */ - /* This structure models the metrics of a bitmap strike (i.e., a set */ - /* of glyphs for a given point size and resolution) in a bitmap font. */ - /* It is used for the `available_sizes' field of @FT_Face. */ - /* */ - /* <Fields> */ - /* height :: The vertical distance, in pixels, between two */ - /* consecutive baselines. It is always positive. */ - /* */ - /* width :: The average width, in pixels, of all glyphs in the */ - /* strike. */ - /* */ - /* size :: The nominal size of the strike in 26.6 fractional */ - /* points. This field is not very useful. */ - /* */ - /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */ - /* pixels. */ - /* */ - /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */ - /* pixels. */ - /* */ - /* <Note> */ - /* Windows FNT: */ - /* The nominal size given in a FNT font is not reliable. Thus when */ - /* the driver finds it incorrect, it sets `size' to some calculated */ - /* values and sets `x_ppem' and `y_ppem' to the pixel width and */ - /* height given in the font, respectively. */ - /* */ - /* TrueType embedded bitmaps: */ - /* `size', `width', and `height' values are not contained in the */ - /* bitmap strike itself. They are computed from the global font */ - /* parameters. */ - /* */ - typedef struct FT_Bitmap_Size_ - { - FT_Short height; - FT_Short width; - - FT_Pos size; - - FT_Pos x_ppem; - FT_Pos y_ppem; - - } FT_Bitmap_Size; - - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* O B J E C T C L A S S E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Library */ - /* */ - /* <Description> */ - /* A handle to a FreeType library instance. Each `library' is */ - /* completely independent from the others; it is the `root' of a set */ - /* of objects like fonts, faces, sizes, etc. */ - /* */ - /* It also embeds a memory manager (see @FT_Memory), as well as a */ - /* scan-line converter object (see @FT_Raster). */ - /* */ - /* In multi-threaded applications, make sure that the same FT_Library */ - /* object or any of its children doesn't get accessed in parallel. */ - /* */ - /* <Note> */ - /* Library objects are normally created by @FT_Init_FreeType, and */ - /* destroyed with @FT_Done_FreeType. If you need reference-counting */ - /* (cf. @FT_Reference_Library), use @FT_New_Library and */ - /* @FT_Done_Library. */ - /* */ - typedef struct FT_LibraryRec_ *FT_Library; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Module */ - /* */ - /* <Description> */ - /* A handle to a given FreeType module object. Each module can be a */ - /* font driver, a renderer, or anything else that provides services */ - /* to the formers. */ - /* */ - typedef struct FT_ModuleRec_* FT_Module; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Driver */ - /* */ - /* <Description> */ - /* A handle to a given FreeType font driver object. Each font driver */ - /* is a special module capable of creating faces from font files. */ - /* */ - typedef struct FT_DriverRec_* FT_Driver; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Renderer */ - /* */ - /* <Description> */ - /* A handle to a given FreeType renderer. A renderer is a special */ - /* module in charge of converting a glyph image to a bitmap, when */ - /* necessary. Each renderer supports a given glyph image format, and */ - /* one or more target surface depths. */ - /* */ - typedef struct FT_RendererRec_* FT_Renderer; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Face */ - /* */ - /* <Description> */ - /* A handle to a given typographic face object. A face object models */ - /* a given typeface, in a given style. */ - /* */ - /* <Note> */ - /* Each face object also owns a single @FT_GlyphSlot object, as well */ - /* as one or more @FT_Size objects. */ - /* */ - /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ - /* a given filepathname or a custom input stream. */ - /* */ - /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ - /* */ - /* <Also> */ - /* See @FT_FaceRec for the publicly accessible fields of a given face */ - /* object. */ - /* */ - typedef struct FT_FaceRec_* FT_Face; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Size */ - /* */ - /* <Description> */ - /* A handle to an object used to model a face scaled to a given */ - /* character size. */ - /* */ - /* <Note> */ - /* Each @FT_Face has an _active_ @FT_Size object that is used by */ - /* functions like @FT_Load_Glyph to determine the scaling */ - /* transformation that in turn is used to load and hint glyphs and */ - /* metrics. */ - /* */ - /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ - /* @FT_Request_Size or even @FT_Select_Size to change the content */ - /* (i.e., the scaling values) of the active @FT_Size. */ - /* */ - /* You can use @FT_New_Size to create additional size objects for a */ - /* given @FT_Face, but they won't be used by other functions until */ - /* you activate it through @FT_Activate_Size. Only one size can be */ - /* activated at any given time per face. */ - /* */ - /* <Also> */ - /* See @FT_SizeRec for the publicly accessible fields of a given size */ - /* object. */ - /* */ - typedef struct FT_SizeRec_* FT_Size; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_GlyphSlot */ - /* */ - /* <Description> */ - /* A handle to a given `glyph slot'. A slot is a container where it */ - /* is possible to load any of the glyphs contained in its parent */ - /* face. */ - /* */ - /* In other words, each time you call @FT_Load_Glyph or */ - /* @FT_Load_Char, the slot's content is erased by the new glyph data, */ - /* i.e., the glyph's metrics, its image (bitmap or outline), and */ - /* other control information. */ - /* */ - /* <Also> */ - /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ - /* */ - typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_CharMap */ - /* */ - /* <Description> */ - /* A handle to a given character map. A charmap is used to translate */ - /* character codes in a given encoding into glyph indexes for its */ - /* parent's face. Some font formats may provide several charmaps per */ - /* font. */ - /* */ - /* Each face object owns zero or more charmaps, but only one of them */ - /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */ - /* */ - /* The list of available charmaps in a face is available through the */ - /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */ - /* */ - /* The currently active charmap is available as `face->charmap'. */ - /* You should call @FT_Set_Charmap to change it. */ - /* */ - /* <Note> */ - /* When a new face is created (either through @FT_New_Face or */ - /* @FT_Open_Face), the library looks for a Unicode charmap within */ - /* the list and automatically activates it. */ - /* */ - /* <Also> */ - /* See @FT_CharMapRec for the publicly accessible fields of a given */ - /* character map. */ - /* */ - typedef struct FT_CharMapRec_* FT_CharMap; - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_ENC_TAG */ - /* */ - /* <Description> */ - /* This macro converts four-letter tags into an unsigned long. It is */ - /* used to define `encoding' identifiers (see @FT_Encoding). */ - /* */ - /* <Note> */ - /* Since many 16-bit compilers don't like 32-bit enumerations, you */ - /* should redefine this macro in case of problems to something like */ - /* this: */ - /* */ - /* { */ - /* #define FT_ENC_TAG( value, a, b, c, d ) value */ - /* } */ - /* */ - /* to get a simple enumeration without assigning special numbers. */ - /* */ - -#ifndef FT_ENC_TAG -#define FT_ENC_TAG( value, a, b, c, d ) \ - value = ( ( (FT_UInt32)(a) << 24 ) | \ - ( (FT_UInt32)(b) << 16 ) | \ - ( (FT_UInt32)(c) << 8 ) | \ - (FT_UInt32)(d) ) - -#endif /* FT_ENC_TAG */ - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Encoding */ - /* */ - /* <Description> */ - /* An enumeration used to specify character sets supported by */ - /* charmaps. Used in the @FT_Select_Charmap API function. */ - /* */ - /* <Note> */ - /* Despite the name, this enumeration lists specific character */ - /* repertories (i.e., charsets), and not text encoding methods (e.g., */ - /* UTF-8, UTF-16, etc.). */ - /* */ - /* Other encodings might be defined in the future. */ - /* */ - /* <Values> */ - /* FT_ENCODING_NONE :: */ - /* The encoding value~0 is reserved. */ - /* */ - /* FT_ENCODING_UNICODE :: */ - /* Corresponds to the Unicode character set. This value covers */ - /* all versions of the Unicode repertoire, including ASCII and */ - /* Latin-1. Most fonts include a Unicode charmap, but not all */ - /* of them. */ - /* */ - /* For example, if you want to access Unicode value U+1F028 (and */ - /* the font contains it), use value 0x1F028 as the input value for */ - /* @FT_Get_Char_Index. */ - /* */ - /* FT_ENCODING_MS_SYMBOL :: */ - /* Corresponds to the Microsoft Symbol encoding, used to encode */ - /* mathematical symbols in the 32..255 character code range. For */ - /* more information, see */ - /* `http://www.kostis.net/charsets/symbol.htm'. */ - /* */ - /* FT_ENCODING_SJIS :: */ - /* Corresponds to Japanese SJIS encoding. More info at */ - /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */ - /* See note on multi-byte encodings below. */ - /* */ - /* FT_ENCODING_GB2312 :: */ - /* Corresponds to an encoding system for Simplified Chinese as used */ - /* used in mainland China. */ - /* */ - /* FT_ENCODING_BIG5 :: */ - /* Corresponds to an encoding system for Traditional Chinese as */ - /* used in Taiwan and Hong Kong. */ - /* */ - /* FT_ENCODING_WANSUNG :: */ - /* Corresponds to the Korean encoding system known as Wansung. */ - /* For more information see */ - /* `http://msdn.microsoft.com/en-US/goglobal/cc305154'. */ - /* */ - /* FT_ENCODING_JOHAB :: */ - /* The Korean standard character set (KS~C 5601-1992), which */ - /* corresponds to MS Windows code page 1361. This character set */ - /* includes all possible Hangeul character combinations. */ - /* */ - /* FT_ENCODING_ADOBE_LATIN_1 :: */ - /* Corresponds to a Latin-1 encoding as defined in a Type~1 */ - /* PostScript font. It is limited to 256 character codes. */ - /* */ - /* FT_ENCODING_ADOBE_STANDARD :: */ - /* Corresponds to the Adobe Standard encoding, as found in Type~1, */ - /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ - /* codes. */ - /* */ - /* FT_ENCODING_ADOBE_EXPERT :: */ - /* Corresponds to the Adobe Expert encoding, as found in Type~1, */ - /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ - /* codes. */ - /* */ - /* FT_ENCODING_ADOBE_CUSTOM :: */ - /* Corresponds to a custom encoding, as found in Type~1, CFF, and */ - /* OpenType/CFF fonts. It is limited to 256 character codes. */ - /* */ - /* FT_ENCODING_APPLE_ROMAN :: */ - /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */ - /* and OpenType fonts contain a charmap for this encoding, since */ - /* older versions of Mac OS are able to use it. */ - /* */ - /* FT_ENCODING_OLD_LATIN_2 :: */ - /* This value is deprecated and was never used nor reported by */ - /* FreeType. Don't use or test for it. */ - /* */ - /* FT_ENCODING_MS_SJIS :: */ - /* Same as FT_ENCODING_SJIS. Deprecated. */ - /* */ - /* FT_ENCODING_MS_GB2312 :: */ - /* Same as FT_ENCODING_GB2312. Deprecated. */ - /* */ - /* FT_ENCODING_MS_BIG5 :: */ - /* Same as FT_ENCODING_BIG5. Deprecated. */ - /* */ - /* FT_ENCODING_MS_WANSUNG :: */ - /* Same as FT_ENCODING_WANSUNG. Deprecated. */ - /* */ - /* FT_ENCODING_MS_JOHAB :: */ - /* Same as FT_ENCODING_JOHAB. Deprecated. */ - /* */ - /* <Note> */ - /* By default, FreeType automatically synthesizes a Unicode charmap */ - /* for PostScript fonts, using their glyph names dictionaries. */ - /* However, it also reports the encodings defined explicitly in the */ - /* font file, for the cases when they are needed, with the Adobe */ - /* values as well. */ - /* */ - /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ - /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ - /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */ - /* which encoding is really present. If, for example, the */ - /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ - /* the font is encoded in KOI8-R. */ - /* */ - /* FT_ENCODING_NONE is always set (with a single exception) by the */ - /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */ - /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */ - /* which encoding is really present. For example, */ - /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */ - /* Russian). */ - /* */ - /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */ - /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */ - /* FT_ENCODING_APPLE_ROMAN). */ - /* */ - /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ - /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ - /* be needed to be able to distinguish Apple encoding variants. See */ - /* */ - /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ - /* */ - /* to get an idea how to do that. Basically, if the language ID */ - /* is~0, don't use it, otherwise subtract 1 from the language ID. */ - /* Then examine `encoding_id'. If, for example, `encoding_id' is */ - /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */ - /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ - /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */ - /* variant the Arabic encoding. */ - /* */ - typedef enum FT_Encoding_ - { - FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), - - FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), - FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), - - FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), - FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), - FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), - FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), - FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), - - /* for backwards compatibility */ - FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, - FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, - FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, - FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, - FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, - - FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), - FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), - FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), - FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), - - FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), - - FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) - - } FT_Encoding; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_encoding_xxx */ - /* */ - /* <Description> */ - /* These constants are deprecated; use the corresponding @FT_Encoding */ - /* values instead. */ - /* */ -#define ft_encoding_none FT_ENCODING_NONE -#define ft_encoding_unicode FT_ENCODING_UNICODE -#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL -#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 -#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 -#define ft_encoding_sjis FT_ENCODING_SJIS -#define ft_encoding_gb2312 FT_ENCODING_GB2312 -#define ft_encoding_big5 FT_ENCODING_BIG5 -#define ft_encoding_wansung FT_ENCODING_WANSUNG -#define ft_encoding_johab FT_ENCODING_JOHAB - -#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD -#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT -#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM -#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_CharMapRec */ - /* */ - /* <Description> */ - /* The base charmap structure. */ - /* */ - /* <Fields> */ - /* face :: A handle to the parent face object. */ - /* */ - /* encoding :: An @FT_Encoding tag identifying the charmap. Use */ - /* this with @FT_Select_Charmap. */ - /* */ - /* platform_id :: An ID number describing the platform for the */ - /* following encoding ID. This comes directly from */ - /* the TrueType specification and should be emulated */ - /* for other formats. */ - /* */ - /* encoding_id :: A platform specific encoding number. This also */ - /* comes from the TrueType specification and should be */ - /* emulated similarly. */ - /* */ - typedef struct FT_CharMapRec_ - { - FT_Face face; - FT_Encoding encoding; - FT_UShort platform_id; - FT_UShort encoding_id; - - } FT_CharMapRec; - - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* B A S E O B J E C T C L A S S E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Face_Internal */ - /* */ - /* <Description> */ - /* An opaque handle to an `FT_Face_InternalRec' structure, used to */ - /* model private data of a given @FT_Face object. */ - /* */ - /* This structure might change between releases of FreeType~2 and is */ - /* not generally available to client applications. */ - /* */ - typedef struct FT_Face_InternalRec_* FT_Face_Internal; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_FaceRec */ - /* */ - /* <Description> */ - /* FreeType root face class structure. A face object models a */ - /* typeface in a font file. */ - /* */ - /* <Fields> */ - /* num_faces :: The number of faces in the font file. Some */ - /* font formats can have multiple faces in */ - /* a font file. */ - /* */ - /* face_index :: The index of the face in the font file. It */ - /* is set to~0 if there is only one face in */ - /* the font file. */ - /* */ - /* face_flags :: A set of bit flags that give important */ - /* information about the face; see */ - /* @FT_FACE_FLAG_XXX for the details. */ - /* */ - /* style_flags :: A set of bit flags indicating the style of */ - /* the face; see @FT_STYLE_FLAG_XXX for the */ - /* details. */ - /* */ - /* num_glyphs :: The number of glyphs in the face. If the */ - /* face is scalable and has sbits (see */ - /* `num_fixed_sizes'), it is set to the number */ - /* of outline glyphs. */ - /* */ - /* For CID-keyed fonts, this value gives the */ - /* highest CID used in the font. */ - /* */ - /* family_name :: The face's family name. This is an ASCII */ - /* string, usually in English, that describes */ - /* the typeface's family (like `Times New */ - /* Roman', `Bodoni', `Garamond', etc). This */ - /* is a least common denominator used to list */ - /* fonts. Some formats (TrueType & OpenType) */ - /* provide localized and Unicode versions of */ - /* this string. Applications should use the */ - /* format specific interface to access them. */ - /* Can be NULL (e.g., in fonts embedded in a */ - /* PDF file). */ - /* */ - /* style_name :: The face's style name. This is an ASCII */ - /* string, usually in English, that describes */ - /* the typeface's style (like `Italic', */ - /* `Bold', `Condensed', etc). Not all font */ - /* formats provide a style name, so this field */ - /* is optional, and can be set to NULL. As */ - /* for `family_name', some formats provide */ - /* localized and Unicode versions of this */ - /* string. Applications should use the format */ - /* specific interface to access them. */ - /* */ - /* num_fixed_sizes :: The number of bitmap strikes in the face. */ - /* Even if the face is scalable, there might */ - /* still be bitmap strikes, which are called */ - /* `sbits' in that case. */ - /* */ - /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */ - /* strikes in the face. It is set to NULL if */ - /* there is no bitmap strike. */ - /* */ - /* num_charmaps :: The number of charmaps in the face. */ - /* */ - /* charmaps :: An array of the charmaps of the face. */ - /* */ - /* generic :: A field reserved for client uses. See the */ - /* @FT_Generic type description. */ - /* */ - /* bbox :: The font bounding box. Coordinates are */ - /* expressed in font units (see */ - /* `units_per_EM'). The box is large enough */ - /* to contain any glyph from the font. Thus, */ - /* `bbox.yMax' can be seen as the `maximum */ - /* ascender', and `bbox.yMin' as the `minimum */ - /* descender'. Only relevant for scalable */ - /* formats. */ - /* */ - /* Note that the bounding box might be off by */ - /* (at least) one pixel for hinted fonts. See */ - /* @FT_Size_Metrics for further discussion. */ - /* */ - /* units_per_EM :: The number of font units per EM square for */ - /* this face. This is typically 2048 for */ - /* TrueType fonts, and 1000 for Type~1 fonts. */ - /* Only relevant for scalable formats. */ - /* */ - /* ascender :: The typographic ascender of the face, */ - /* expressed in font units. For font formats */ - /* not having this information, it is set to */ - /* `bbox.yMax'. Only relevant for scalable */ - /* formats. */ - /* */ - /* descender :: The typographic descender of the face, */ - /* expressed in font units. For font formats */ - /* not having this information, it is set to */ - /* `bbox.yMin'. Note that this field is */ - /* usually negative. Only relevant for */ - /* scalable formats. */ - /* */ - /* height :: This value is the vertical distance */ - /* between two consecutive baselines, */ - /* expressed in font units. It is always */ - /* positive. Only relevant for scalable */ - /* formats. */ - /* */ - /* If you want the global glyph height, use */ - /* `ascender - descender'. */ - /* */ - /* max_advance_width :: The maximum advance width, in font units, */ - /* for all glyphs in this face. This can be */ - /* used to make word wrapping computations */ - /* faster. Only relevant for scalable */ - /* formats. */ - /* */ - /* max_advance_height :: The maximum advance height, in font units, */ - /* for all glyphs in this face. This is only */ - /* relevant for vertical layouts, and is set */ - /* to `height' for fonts that do not provide */ - /* vertical metrics. Only relevant for */ - /* scalable formats. */ - /* */ - /* underline_position :: The position, in font units, of the */ - /* underline line for this face. It is the */ - /* center of the underlining stem. Only */ - /* relevant for scalable formats. */ - /* */ - /* underline_thickness :: The thickness, in font units, of the */ - /* underline for this face. Only relevant for */ - /* scalable formats. */ - /* */ - /* glyph :: The face's associated glyph slot(s). */ - /* */ - /* size :: The current active size for this face. */ - /* */ - /* charmap :: The current active charmap for this face. */ - /* */ - /* <Note> */ - /* Fields may be changed after a call to @FT_Attach_File or */ - /* @FT_Attach_Stream. */ - /* */ - typedef struct FT_FaceRec_ - { - FT_Long num_faces; - FT_Long face_index; - - FT_Long face_flags; - FT_Long style_flags; - - FT_Long num_glyphs; - - FT_String* family_name; - FT_String* style_name; - - FT_Int num_fixed_sizes; - FT_Bitmap_Size* available_sizes; - - FT_Int num_charmaps; - FT_CharMap* charmaps; - - FT_Generic generic; - - /*# The following member variables (down to `underline_thickness') */ - /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ - /*# for bitmap fonts. */ - FT_BBox bbox; - - FT_UShort units_per_EM; - FT_Short ascender; - FT_Short descender; - FT_Short height; - - FT_Short max_advance_width; - FT_Short max_advance_height; - - FT_Short underline_position; - FT_Short underline_thickness; - - FT_GlyphSlot glyph; - FT_Size size; - FT_CharMap charmap; - - /*@private begin */ - - FT_Driver driver; - FT_Memory memory; - FT_Stream stream; - - FT_ListRec sizes_list; - - FT_Generic autohint; /* face-specific auto-hinter data */ - void* extensions; /* unused */ - - FT_Face_Internal internal; - - /*@private end */ - - } FT_FaceRec; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_FACE_FLAG_XXX */ - /* */ - /* <Description> */ - /* A list of bit flags used in the `face_flags' field of the */ - /* @FT_FaceRec structure. They inform client applications of */ - /* properties of the corresponding face. */ - /* */ - /* <Values> */ - /* FT_FACE_FLAG_SCALABLE :: */ - /* Indicates that the face contains outline glyphs. This doesn't */ - /* prevent bitmap strikes, i.e., a face can have both this and */ - /* and @FT_FACE_FLAG_FIXED_SIZES set. */ - /* */ - /* FT_FACE_FLAG_FIXED_SIZES :: */ - /* Indicates that the face contains bitmap strikes. See also the */ - /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */ - /* */ - /* FT_FACE_FLAG_FIXED_WIDTH :: */ - /* Indicates that the face contains fixed-width characters (like */ - /* Courier, Lucido, MonoType, etc.). */ - /* */ - /* FT_FACE_FLAG_SFNT :: */ - /* Indicates that the face uses the `sfnt' storage scheme. For */ - /* now, this means TrueType and OpenType. */ - /* */ - /* FT_FACE_FLAG_HORIZONTAL :: */ - /* Indicates that the face contains horizontal glyph metrics. This */ - /* should be set for all common formats. */ - /* */ - /* FT_FACE_FLAG_VERTICAL :: */ - /* Indicates that the face contains vertical glyph metrics. This */ - /* is only available in some formats, not all of them. */ - /* */ - /* FT_FACE_FLAG_KERNING :: */ - /* Indicates that the face contains kerning information. If set, */ - /* the kerning distance can be retrieved through the function */ - /* @FT_Get_Kerning. Otherwise the function always return the */ - /* vector (0,0). Note that FreeType doesn't handle kerning data */ - /* from the `GPOS' table (as present in some OpenType fonts). */ - /* */ - /* FT_FACE_FLAG_FAST_GLYPHS :: */ - /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ - /* */ - /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ - /* Indicates that the font contains multiple masters and is capable */ - /* of interpolating between them. See the multiple-masters */ - /* specific API for details. */ - /* */ - /* FT_FACE_FLAG_GLYPH_NAMES :: */ - /* Indicates that the font contains glyph names that can be */ - /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */ - /* fonts contain broken glyph name tables. Use the function */ - /* @FT_Has_PS_Glyph_Names when needed. */ - /* */ - /* FT_FACE_FLAG_EXTERNAL_STREAM :: */ - /* Used internally by FreeType to indicate that a face's stream was */ - /* provided by the client application and should not be destroyed */ - /* when @FT_Done_Face is called. Don't read or test this flag. */ - /* */ - /* FT_FACE_FLAG_HINTER :: */ - /* Set if the font driver has a hinting machine of its own. For */ - /* example, with TrueType fonts, it makes sense to use data from */ - /* the SFNT `gasp' table only if the native TrueType hinting engine */ - /* (with the bytecode interpreter) is available and active. */ - /* */ - /* FT_FACE_FLAG_CID_KEYED :: */ - /* Set if the font is CID-keyed. In that case, the font is not */ - /* accessed by glyph indices but by CID values. For subsetted */ - /* CID-keyed fonts this has the consequence that not all index */ - /* values are a valid argument to FT_Load_Glyph. Only the CID */ - /* values for which corresponding glyphs in the subsetted font */ - /* exist make FT_Load_Glyph return successfully; in all other cases */ - /* you get an `FT_Err_Invalid_Argument' error. */ - /* */ - /* Note that CID-keyed fonts that are in an SFNT wrapper don't */ - /* have this flag set since the glyphs are accessed in the normal */ - /* way (using contiguous indices); the `CID-ness' isn't visible to */ - /* the application. */ - /* */ - /* FT_FACE_FLAG_TRICKY :: */ - /* Set if the font is `tricky', this is, it always needs the */ - /* font format's native hinting engine to get a reasonable result. */ - /* A typical example is the Chinese font `mingli.ttf' that uses */ - /* TrueType bytecode instructions to move and scale all of its */ - /* subglyphs. */ - /* */ - /* It is not possible to autohint such fonts using */ - /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ - /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ - /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ - /* probably never want this except for demonstration purposes. */ - /* */ - /* Currently, there are about a dozen TrueType fonts in the list of */ - /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ - /* */ - /* FT_FACE_FLAG_COLOR :: */ - /* Set if the font has color glyph tables. To access color glyphs */ - /* use @FT_LOAD_COLOR. */ - /* */ -#define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) -#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) -#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) -#define FT_FACE_FLAG_SFNT ( 1L << 3 ) -#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) -#define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) -#define FT_FACE_FLAG_KERNING ( 1L << 6 ) -#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) -#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) -#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) -#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) -#define FT_FACE_FLAG_HINTER ( 1L << 11 ) -#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) -#define FT_FACE_FLAG_TRICKY ( 1L << 13 ) -#define FT_FACE_FLAG_COLOR ( 1L << 14 ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_HORIZONTAL( face ) - * - * @description: - * A macro that returns true whenever a face object contains - * horizontal metrics (this is true for all font formats though). - * - * @also: - * @FT_HAS_VERTICAL can be used to check for vertical metrics. - * - */ -#define FT_HAS_HORIZONTAL( face ) \ - ( face->face_flags & FT_FACE_FLAG_HORIZONTAL ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_VERTICAL( face ) - * - * @description: - * A macro that returns true whenever a face object contains real - * vertical metrics (and not only synthesized ones). - * - */ -#define FT_HAS_VERTICAL( face ) \ - ( face->face_flags & FT_FACE_FLAG_VERTICAL ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_KERNING( face ) - * - * @description: - * A macro that returns true whenever a face object contains kerning - * data that can be accessed with @FT_Get_Kerning. - * - */ -#define FT_HAS_KERNING( face ) \ - ( face->face_flags & FT_FACE_FLAG_KERNING ) - - - /************************************************************************* - * - * @macro: - * FT_IS_SCALABLE( face ) - * - * @description: - * A macro that returns true whenever a face object contains a scalable - * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, - * and PFR font formats. - * - */ -#define FT_IS_SCALABLE( face ) \ - ( face->face_flags & FT_FACE_FLAG_SCALABLE ) - - - /************************************************************************* - * - * @macro: - * FT_IS_SFNT( face ) - * - * @description: - * A macro that returns true whenever a face object contains a font - * whose format is based on the SFNT storage scheme. This usually - * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded - * bitmap fonts. - * - * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and - * @FT_TRUETYPE_TABLES_H are available. - * - */ -#define FT_IS_SFNT( face ) \ - ( face->face_flags & FT_FACE_FLAG_SFNT ) - - - /************************************************************************* - * - * @macro: - * FT_IS_FIXED_WIDTH( face ) - * - * @description: - * A macro that returns true whenever a face object contains a font face - * that contains fixed-width (or `monospace', `fixed-pitch', etc.) - * glyphs. - * - */ -#define FT_IS_FIXED_WIDTH( face ) \ - ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_FIXED_SIZES( face ) - * - * @description: - * A macro that returns true whenever a face object contains some - * embedded bitmaps. See the `available_sizes' field of the - * @FT_FaceRec structure. - * - */ -#define FT_HAS_FIXED_SIZES( face ) \ - ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_FAST_GLYPHS( face ) - * - * @description: - * Deprecated. - * - */ -#define FT_HAS_FAST_GLYPHS( face ) 0 - - - /************************************************************************* - * - * @macro: - * FT_HAS_GLYPH_NAMES( face ) - * - * @description: - * A macro that returns true whenever a face object contains some glyph - * names that can be accessed through @FT_Get_Glyph_Name. - * - */ -#define FT_HAS_GLYPH_NAMES( face ) \ - ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_MULTIPLE_MASTERS( face ) - * - * @description: - * A macro that returns true whenever a face object contains some - * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H - * are then available to choose the exact design you want. - * - */ -#define FT_HAS_MULTIPLE_MASTERS( face ) \ - ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) - - - /************************************************************************* - * - * @macro: - * FT_IS_CID_KEYED( face ) - * - * @description: - * A macro that returns true whenever a face object contains a CID-keyed - * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more - * details. - * - * If this macro is true, all functions defined in @FT_CID_H are - * available. - * - */ -#define FT_IS_CID_KEYED( face ) \ - ( face->face_flags & FT_FACE_FLAG_CID_KEYED ) - - - /************************************************************************* - * - * @macro: - * FT_IS_TRICKY( face ) - * - * @description: - * A macro that returns true whenever a face represents a `tricky' font. - * See the discussion of @FT_FACE_FLAG_TRICKY for more details. - * - */ -#define FT_IS_TRICKY( face ) \ - ( face->face_flags & FT_FACE_FLAG_TRICKY ) - - - /************************************************************************* - * - * @macro: - * FT_HAS_COLOR( face ) - * - * @description: - * A macro that returns true whenever a face object contains - * tables for color glyphs. - * - */ -#define FT_HAS_COLOR( face ) \ - ( face->face_flags & FT_FACE_FLAG_COLOR ) - - - /*************************************************************************/ - /* */ - /* <Const> */ - /* FT_STYLE_FLAG_XXX */ - /* */ - /* <Description> */ - /* A list of bit-flags used to indicate the style of a given face. */ - /* These are used in the `style_flags' field of @FT_FaceRec. */ - /* */ - /* <Values> */ - /* FT_STYLE_FLAG_ITALIC :: */ - /* Indicates that a given face style is italic or oblique. */ - /* */ - /* FT_STYLE_FLAG_BOLD :: */ - /* Indicates that a given face is bold. */ - /* */ - /* <Note> */ - /* The style information as provided by FreeType is very basic. More */ - /* details are beyond the scope and should be done on a higher level */ - /* (for example, by analyzing various fields of the `OS/2' table in */ - /* SFNT based fonts). */ - /* */ -#define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) -#define FT_STYLE_FLAG_BOLD ( 1 << 1 ) - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Size_Internal */ - /* */ - /* <Description> */ - /* An opaque handle to an `FT_Size_InternalRec' structure, used to */ - /* model private data of a given @FT_Size object. */ - /* */ - typedef struct FT_Size_InternalRec_* FT_Size_Internal; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_Metrics */ - /* */ - /* <Description> */ - /* The size metrics structure gives the metrics of a size object. */ - /* */ - /* <Fields> */ - /* x_ppem :: The width of the scaled EM square in pixels, hence */ - /* the term `ppem' (pixels per EM). It is also */ - /* referred to as `nominal width'. */ - /* */ - /* y_ppem :: The height of the scaled EM square in pixels, */ - /* hence the term `ppem' (pixels per EM). It is also */ - /* referred to as `nominal height'. */ - /* */ - /* x_scale :: A 16.16 fractional scaling value used to convert */ - /* horizontal metrics from font units to 26.6 */ - /* fractional pixels. Only relevant for scalable */ - /* font formats. */ - /* */ - /* y_scale :: A 16.16 fractional scaling value used to convert */ - /* vertical metrics from font units to 26.6 */ - /* fractional pixels. Only relevant for scalable */ - /* font formats. */ - /* */ - /* ascender :: The ascender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ - /* */ - /* descender :: The descender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ - /* */ - /* height :: The height in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ - /* */ - /* max_advance :: The maximum advance width in 26.6 fractional */ - /* pixels. See @FT_FaceRec for the details. */ - /* */ - /* <Note> */ - /* The scaling values, if relevant, are determined first during a */ - /* size changing operation. The remaining fields are then set by the */ - /* driver. For scalable formats, they are usually set to scaled */ - /* values of the corresponding fields in @FT_FaceRec. */ - /* */ - /* Note that due to glyph hinting, these values might not be exact */ - /* for certain fonts. Thus they must be treated as unreliable */ - /* with an error margin of at least one pixel! */ - /* */ - /* Indeed, the only way to get the exact metrics is to render _all_ */ - /* glyphs. As this would be a definite performance hit, it is up to */ - /* client applications to perform such computations. */ - /* */ - /* The FT_Size_Metrics structure is valid for bitmap fonts also. */ - /* */ - typedef struct FT_Size_Metrics_ - { - FT_UShort x_ppem; /* horizontal pixels per EM */ - FT_UShort y_ppem; /* vertical pixels per EM */ - - FT_Fixed x_scale; /* scaling values used to convert font */ - FT_Fixed y_scale; /* units to 26.6 fractional pixels */ - - FT_Pos ascender; /* ascender in 26.6 frac. pixels */ - FT_Pos descender; /* descender in 26.6 frac. pixels */ - FT_Pos height; /* text height in 26.6 frac. pixels */ - FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ - - } FT_Size_Metrics; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_SizeRec */ - /* */ - /* <Description> */ - /* FreeType root size class structure. A size object models a face */ - /* object at a given size. */ - /* */ - /* <Fields> */ - /* face :: Handle to the parent face object. */ - /* */ - /* generic :: A typeless pointer, unused by the FreeType library or */ - /* any of its drivers. It can be used by client */ - /* applications to link their own data to each size */ - /* object. */ - /* */ - /* metrics :: Metrics for this size object. This field is read-only. */ - /* */ - typedef struct FT_SizeRec_ - { - FT_Face face; /* parent face object */ - FT_Generic generic; /* generic pointer for client uses */ - FT_Size_Metrics metrics; /* size metrics */ - FT_Size_Internal internal; - - } FT_SizeRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_SubGlyph */ - /* */ - /* <Description> */ - /* The subglyph structure is an internal object used to describe */ - /* subglyphs (for example, in the case of composites). */ - /* */ - /* <Note> */ - /* The subglyph implementation is not part of the high-level API, */ - /* hence the forward structure declaration. */ - /* */ - /* You can however retrieve subglyph information with */ - /* @FT_Get_SubGlyph_Info. */ - /* */ - typedef struct FT_SubGlyphRec_* FT_SubGlyph; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Slot_Internal */ - /* */ - /* <Description> */ - /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ - /* model private data of a given @FT_GlyphSlot object. */ - /* */ - typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_GlyphSlotRec */ - /* */ - /* <Description> */ - /* FreeType root glyph slot class structure. A glyph slot is a */ - /* container where individual glyphs can be loaded, be they in */ - /* outline or bitmap format. */ - /* */ - /* <Fields> */ - /* library :: A handle to the FreeType library instance */ - /* this slot belongs to. */ - /* */ - /* face :: A handle to the parent face object. */ - /* */ - /* next :: In some cases (like some font tools), several */ - /* glyph slots per face object can be a good */ - /* thing. As this is rare, the glyph slots are */ - /* listed through a direct, single-linked list */ - /* using its `next' field. */ - /* */ - /* generic :: A typeless pointer unused by the FreeType */ - /* library or any of its drivers. It can be */ - /* used by client applications to link their own */ - /* data to each glyph slot object. */ - /* */ - /* metrics :: The metrics of the last loaded glyph in the */ - /* slot. The returned values depend on the last */ - /* load flags (see the @FT_Load_Glyph API */ - /* function) and can be expressed either in 26.6 */ - /* fractional pixels or font units. */ - /* */ - /* Note that even when the glyph image is */ - /* transformed, the metrics are not. */ - /* */ - /* linearHoriAdvance :: The advance width of the unhinted glyph. */ - /* Its value is expressed in 16.16 fractional */ - /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ - /* when loading the glyph. This field can be */ - /* important to perform correct WYSIWYG layout. */ - /* Only relevant for outline glyphs. */ - /* */ - /* linearVertAdvance :: The advance height of the unhinted glyph. */ - /* Its value is expressed in 16.16 fractional */ - /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ - /* when loading the glyph. This field can be */ - /* important to perform correct WYSIWYG layout. */ - /* Only relevant for outline glyphs. */ - /* */ - /* advance :: This shorthand is, depending on */ - /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ - /* (hinted) advance width for the glyph, in 26.6 */ - /* fractional pixel format. As specified with */ - /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ - /* `horiAdvance' or the `vertAdvance' value of */ - /* `metrics' field. */ - /* */ - /* format :: This field indicates the format of the image */ - /* contained in the glyph slot. Typically */ - /* @FT_GLYPH_FORMAT_BITMAP, */ - /* @FT_GLYPH_FORMAT_OUTLINE, or */ - /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */ - /* possible. */ - /* */ - /* bitmap :: This field is used as a bitmap descriptor */ - /* when the slot format is */ - /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ - /* address and content of the bitmap buffer can */ - /* change between calls of @FT_Load_Glyph and a */ - /* few other functions. */ - /* */ - /* bitmap_left :: This is the bitmap's left bearing expressed */ - /* in integer pixels. Of course, this is only */ - /* valid if the format is */ - /* @FT_GLYPH_FORMAT_BITMAP. */ - /* */ - /* bitmap_top :: This is the bitmap's top bearing expressed in */ - /* integer pixels. Remember that this is the */ - /* distance from the baseline to the top-most */ - /* glyph scanline, upwards y~coordinates being */ - /* *positive*. */ - /* */ - /* outline :: The outline descriptor for the current glyph */ - /* image if its format is */ - /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ - /* loaded, `outline' can be transformed, */ - /* distorted, embolded, etc. However, it must */ - /* not be freed. */ - /* */ - /* num_subglyphs :: The number of subglyphs in a composite glyph. */ - /* This field is only valid for the composite */ - /* glyph format that should normally only be */ - /* loaded with the @FT_LOAD_NO_RECURSE flag. */ - /* For now this is internal to FreeType. */ - /* */ - /* subglyphs :: An array of subglyph descriptors for */ - /* composite glyphs. There are `num_subglyphs' */ - /* elements in there. Currently internal to */ - /* FreeType. */ - /* */ - /* control_data :: Certain font drivers can also return the */ - /* control data for a given glyph image (e.g. */ - /* TrueType bytecode, Type~1 charstrings, etc.). */ - /* This field is a pointer to such data. */ - /* */ - /* control_len :: This is the length in bytes of the control */ - /* data. */ - /* */ - /* other :: Really wicked formats can use this pointer to */ - /* present their own glyph image to client */ - /* applications. Note that the application */ - /* needs to know about the image format. */ - /* */ - /* lsb_delta :: The difference between hinted and unhinted */ - /* left side bearing while autohinting is */ - /* active. Zero otherwise. */ - /* */ - /* rsb_delta :: The difference between hinted and unhinted */ - /* right side bearing while autohinting is */ - /* active. Zero otherwise. */ - /* */ - /* <Note> */ - /* If @FT_Load_Glyph is called with default flags (see */ - /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ - /* its native format (e.g., an outline glyph for TrueType and Type~1 */ - /* formats). */ - /* */ - /* This image can later be converted into a bitmap by calling */ - /* @FT_Render_Glyph. This function finds the current renderer for */ - /* the native image's format, then invokes it. */ - /* */ - /* The renderer is in charge of transforming the native image through */ - /* the slot's face transformation fields, then converting it into a */ - /* bitmap that is returned in `slot->bitmap'. */ - /* */ - /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ - /* to specify the position of the bitmap relative to the current pen */ - /* position (e.g., coordinates (0,0) on the baseline). Of course, */ - /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ - /* */ - /* <Note> */ - /* Here a small pseudo code fragment that shows how to use */ - /* `lsb_delta' and `rsb_delta': */ - /* */ - /* { */ - /* FT_Pos origin_x = 0; */ - /* FT_Pos prev_rsb_delta = 0; */ - /* */ - /* */ - /* for all glyphs do */ - /* <compute kern between current and previous glyph and add it to */ - /* `origin_x'> */ - /* */ - /* <load glyph with `FT_Load_Glyph'> */ - /* */ - /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ - /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ - /* origin_x += 64; */ - /* */ - /* prev_rsb_delta = face->glyph->rsb_delta; */ - /* */ - /* <save glyph image, or render glyph, or ...> */ - /* */ - /* origin_x += face->glyph->advance.x; */ - /* endfor */ - /* } */ - /* */ - typedef struct FT_GlyphSlotRec_ - { - FT_Library library; - FT_Face face; - FT_GlyphSlot next; - FT_UInt reserved; /* retained for binary compatibility */ - FT_Generic generic; - - FT_Glyph_Metrics metrics; - FT_Fixed linearHoriAdvance; - FT_Fixed linearVertAdvance; - FT_Vector advance; - - FT_Glyph_Format format; - - FT_Bitmap bitmap; - FT_Int bitmap_left; - FT_Int bitmap_top; - - FT_Outline outline; - - FT_UInt num_subglyphs; - FT_SubGlyph subglyphs; - - void* control_data; - long control_len; - - FT_Pos lsb_delta; - FT_Pos rsb_delta; - - void* other; - - FT_Slot_Internal internal; - - } FT_GlyphSlotRec; - - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* F U N C T I O N S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Init_FreeType */ - /* */ - /* <Description> */ - /* Initialize a new FreeType library object. The set of modules */ - /* that are registered by this function is determined at build time. */ - /* */ - /* <Output> */ - /* alibrary :: A handle to a new library object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* In case you want to provide your own memory allocating routines, */ - /* use @FT_New_Library instead, followed by a call to */ - /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ - /* */ - /* For multi-threading applications each thread should have its own */ - /* FT_Library object. */ - /* */ - /* If you need reference-counting (cf. @FT_Reference_Library), use */ - /* @FT_New_Library and @FT_Done_Library. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Init_FreeType( FT_Library *alibrary ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_FreeType */ - /* */ - /* <Description> */ - /* Destroy a given FreeType library object and all of its children, */ - /* including resources, drivers, faces, sizes, etc. */ - /* */ - /* <Input> */ - /* library :: A handle to the target library object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Done_FreeType( FT_Library library ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_OPEN_XXX */ - /* */ - /* <Description> */ - /* A list of bit-field constants used within the `flags' field of the */ - /* @FT_Open_Args structure. */ - /* */ - /* <Values> */ - /* FT_OPEN_MEMORY :: This is a memory-based stream. */ - /* */ - /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ - /* */ - /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */ - /* name. */ - /* */ - /* FT_OPEN_DRIVER :: Use the `driver' field. */ - /* */ - /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */ - /* */ - /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */ - /* */ - /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */ - /* */ - /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */ - /* */ - /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */ - /* */ - /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */ - /* */ - /* <Note> */ - /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ - /* flags are mutually exclusive. */ - /* */ -#define FT_OPEN_MEMORY 0x1 -#define FT_OPEN_STREAM 0x2 -#define FT_OPEN_PATHNAME 0x4 -#define FT_OPEN_DRIVER 0x8 -#define FT_OPEN_PARAMS 0x10 - -#define ft_open_memory FT_OPEN_MEMORY /* deprecated */ -#define ft_open_stream FT_OPEN_STREAM /* deprecated */ -#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */ -#define ft_open_driver FT_OPEN_DRIVER /* deprecated */ -#define ft_open_params FT_OPEN_PARAMS /* deprecated */ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Parameter */ - /* */ - /* <Description> */ - /* A simple structure used to pass more or less generic parameters to */ - /* @FT_Open_Face. */ - /* */ - /* <Fields> */ - /* tag :: A four-byte identification tag. */ - /* */ - /* data :: A pointer to the parameter data. */ - /* */ - /* <Note> */ - /* The ID and function of parameters are driver-specific. See the */ - /* various FT_PARAM_TAG_XXX flags for more information. */ - /* */ - typedef struct FT_Parameter_ - { - FT_ULong tag; - FT_Pointer data; - - } FT_Parameter; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Open_Args */ - /* */ - /* <Description> */ - /* A structure used to indicate how to open a new font file or */ - /* stream. A pointer to such a structure can be used as a parameter */ - /* for the functions @FT_Open_Face and @FT_Attach_Stream. */ - /* */ - /* <Fields> */ - /* flags :: A set of bit flags indicating how to use the */ - /* structure. */ - /* */ - /* memory_base :: The first byte of the file in memory. */ - /* */ - /* memory_size :: The size in bytes of the file in memory. */ - /* */ - /* pathname :: A pointer to an 8-bit file pathname. */ - /* */ - /* stream :: A handle to a source stream object. */ - /* */ - /* driver :: This field is exclusively used by @FT_Open_Face; */ - /* it simply specifies the font driver to use to open */ - /* the face. If set to~0, FreeType tries to load the */ - /* face with each one of the drivers in its list. */ - /* */ - /* num_params :: The number of extra parameters. */ - /* */ - /* params :: Extra parameters passed to the font driver when */ - /* opening a new face. */ - /* */ - /* <Note> */ - /* The stream type is determined by the contents of `flags' that */ - /* are tested in the following order by @FT_Open_Face: */ - /* */ - /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ - /* memory file of `memory_size' bytes, located at `memory_address'. */ - /* The data are are not copied, and the client is responsible for */ - /* releasing and destroying them _after_ the corresponding call to */ - /* @FT_Done_Face. */ - /* */ - /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */ - /* custom input stream `stream' is used. */ - /* */ - /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */ - /* is a normal file and use `pathname' to open it. */ - /* */ - /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */ - /* open the file with the driver whose handler is in `driver'. */ - /* */ - /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */ - /* `num_params' and `params' is used. They are ignored otherwise. */ - /* */ - /* Ideally, both the `pathname' and `params' fields should be tagged */ - /* as `const'; this is missing for API backwards compatibility. In */ - /* other words, applications should treat them as read-only. */ - /* */ - typedef struct FT_Open_Args_ - { - FT_UInt flags; - const FT_Byte* memory_base; - FT_Long memory_size; - FT_String* pathname; - FT_Stream stream; - FT_Module driver; - FT_Int num_params; - FT_Parameter* params; - - } FT_Open_Args; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Face */ - /* */ - /* <Description> */ - /* This function calls @FT_Open_Face to open a font by its pathname. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* pathname :: A path to the font file. */ - /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. If `face_index' is */ - /* greater than or equal to zero, it must be non-NULL. */ - /* See @FT_Open_Face for more details. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Use @FT_Done_Face to destroy the created @FT_Face object (along */ - /* with its slot and sizes). */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Face( FT_Library library, - const char* filepathname, - FT_Long face_index, - FT_Face *aface ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Memory_Face */ - /* */ - /* <Description> */ - /* This function calls @FT_Open_Face to open a font that has been */ - /* loaded into memory. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* file_base :: A pointer to the beginning of the font data. */ - /* */ - /* file_size :: The size of the memory chunk used by the font data. */ - /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. If `face_index' is */ - /* greater than or equal to zero, it must be non-NULL. */ - /* See @FT_Open_Face for more details. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* You must not deallocate the memory before calling @FT_Done_Face. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Memory_Face( FT_Library library, - const FT_Byte* file_base, - FT_Long file_size, - FT_Long face_index, - FT_Face *aface ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Open_Face */ - /* */ - /* <Description> */ - /* Create a face object from a given resource described by */ - /* @FT_Open_Args. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* args :: A pointer to an `FT_Open_Args' structure that must */ - /* be filled by the caller. */ - /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. If `face_index' is */ - /* greater than or equal to zero, it must be non-NULL. */ - /* See note below. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Unlike FreeType 1.x, this function automatically creates a glyph */ - /* slot for the face object that can be accessed directly through */ - /* `face->glyph'. */ - /* */ - /* FT_Open_Face can be used to quickly check whether the font */ - /* format of a given font resource is supported by FreeType. If the */ - /* `face_index' field is negative, the function's return value is~0 */ - /* if the font format is recognized, or non-zero otherwise; */ - /* the function returns a more or less empty face handle in `*aface' */ - /* (if `aface' isn't NULL). The only useful field in this special */ - /* case is `face->num_faces' that gives the number of faces within */ - /* the font file. After examination, the returned @FT_Face structure */ - /* should be deallocated with a call to @FT_Done_Face. */ - /* */ - /* Each new face object created with this function also owns a */ - /* default @FT_Size object, accessible as `face->size'. */ - /* */ - /* One @FT_Library instance can have multiple face objects, this is, */ - /* @FT_Open_Face and its siblings can be called multiple times using */ - /* the same `library' argument. */ - /* */ - /* See the discussion of reference counters in the description of */ - /* @FT_Reference_Face. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Open_Face( FT_Library library, - const FT_Open_Args* args, - FT_Long face_index, - FT_Face *aface ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Attach_File */ - /* */ - /* <Description> */ - /* This function calls @FT_Attach_Stream to attach a file. */ - /* */ - /* <InOut> */ - /* face :: The target face object. */ - /* */ - /* <Input> */ - /* filepathname :: The pathname. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Attach_File( FT_Face face, - const char* filepathname ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Attach_Stream */ - /* */ - /* <Description> */ - /* `Attach' data to a face object. Normally, this is used to read */ - /* additional information for the face object. For example, you can */ - /* attach an AFM file that comes with a Type~1 font to get the */ - /* kerning values and other metrics. */ - /* */ - /* <InOut> */ - /* face :: The target face object. */ - /* */ - /* <Input> */ - /* parameters :: A pointer to @FT_Open_Args that must be filled by */ - /* the caller. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The meaning of the `attach' (i.e., what really happens when the */ - /* new file is read) is not fixed by FreeType itself. It really */ - /* depends on the font format (and thus the font driver). */ - /* */ - /* Client applications are expected to know what they are doing */ - /* when invoking this function. Most drivers simply do not implement */ - /* file attachments. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Attach_Stream( FT_Face face, - FT_Open_Args* parameters ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Reference_Face */ - /* */ - /* <Description> */ - /* A counter gets initialized to~1 at the time an @FT_Face structure */ - /* is created. This function increments the counter. @FT_Done_Face */ - /* then only destroys a face if the counter is~1, otherwise it simply */ - /* decrements the counter. */ - /* */ - /* This function helps in managing life-cycles of structures that */ - /* reference @FT_Face objects. */ - /* */ - /* <Input> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Since> */ - /* 2.4.2 */ - /* */ - FT_EXPORT( FT_Error ) - FT_Reference_Face( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Face */ - /* */ - /* <Description> */ - /* Discard a given face object, as well as all of its child slots and */ - /* sizes. */ - /* */ - /* <Input> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* See the discussion of reference counters in the description of */ - /* @FT_Reference_Face. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Done_Face( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Select_Size */ - /* */ - /* <Description> */ - /* Select a bitmap strike. */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Input> */ - /* strike_index :: The index of the bitmap strike in the */ - /* `available_sizes' field of @FT_FaceRec structure. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Select_Size( FT_Face face, - FT_Int strike_index ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Size_Request_Type */ - /* */ - /* <Description> */ - /* An enumeration type that lists the supported size request types. */ - /* */ - /* <Values> */ - /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */ - /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */ - /* used to determine both scaling values. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ - /* The real dimension. The sum of the the `ascender' and (minus */ - /* of) the `descender' fields of @FT_FaceRec are used to determine */ - /* both scaling values. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_BBOX :: */ - /* The font bounding box. The width and height of the `bbox' field */ - /* of @FT_FaceRec are used to determine the horizontal and vertical */ - /* scaling value, respectively. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_CELL :: */ - /* The `max_advance_width' field of @FT_FaceRec is used to */ - /* determine the horizontal scaling value; the vertical scaling */ - /* value is determined the same way as */ - /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */ - /* values are set to the smaller one. This type is useful if you */ - /* want to specify the font size for, say, a window of a given */ - /* dimension and 80x24 cells. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_SCALES :: */ - /* Specify the scaling values directly. */ - /* */ - /* <Note> */ - /* The above descriptions only apply to scalable formats. For bitmap */ - /* formats, the behaviour is up to the driver. */ - /* */ - /* See the note section of @FT_Size_Metrics if you wonder how size */ - /* requesting relates to scaling values. */ - /* */ - typedef enum FT_Size_Request_Type_ - { - FT_SIZE_REQUEST_TYPE_NOMINAL, - FT_SIZE_REQUEST_TYPE_REAL_DIM, - FT_SIZE_REQUEST_TYPE_BBOX, - FT_SIZE_REQUEST_TYPE_CELL, - FT_SIZE_REQUEST_TYPE_SCALES, - - FT_SIZE_REQUEST_TYPE_MAX - - } FT_Size_Request_Type; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_RequestRec */ - /* */ - /* <Description> */ - /* A structure used to model a size request. */ - /* */ - /* <Fields> */ - /* type :: See @FT_Size_Request_Type. */ - /* */ - /* width :: The desired width. */ - /* */ - /* height :: The desired height. */ - /* */ - /* horiResolution :: The horizontal resolution. If set to zero, */ - /* `width' is treated as a 26.6 fractional pixel */ - /* value. */ - /* */ - /* vertResolution :: The vertical resolution. If set to zero, */ - /* `height' is treated as a 26.6 fractional pixel */ - /* value. */ - /* */ - /* <Note> */ - /* If `width' is zero, then the horizontal scaling value is set equal */ - /* to the vertical scaling value, and vice versa. */ - /* */ - typedef struct FT_Size_RequestRec_ - { - FT_Size_Request_Type type; - FT_Long width; - FT_Long height; - FT_UInt horiResolution; - FT_UInt vertResolution; - - } FT_Size_RequestRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_Request */ - /* */ - /* <Description> */ - /* A handle to a size request structure. */ - /* */ - typedef struct FT_Size_RequestRec_ *FT_Size_Request; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Request_Size */ - /* */ - /* <Description> */ - /* Resize the scale of the active @FT_Size object in a face. */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Input> */ - /* req :: A pointer to a @FT_Size_RequestRec. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Although drivers may select the bitmap strike matching the */ - /* request, you should not rely on this if you intend to select a */ - /* particular bitmap strike. Use @FT_Select_Size instead in that */ - /* case. */ - /* */ - /* The relation between the requested size and the resulting glyph */ - /* size is dependent entirely on how the size is defined in the */ - /* source face. The font designer chooses the final size of each */ - /* glyph relative to this size. For more information refer to */ - /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */ - /* */ - /* Don't use this function if you are using the FreeType cache API. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Request_Size( FT_Face face, - FT_Size_Request req ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Char_Size */ - /* */ - /* <Description> */ - /* This function calls @FT_Request_Size to request the nominal size */ - /* (in points). */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Input> */ - /* char_width :: The nominal width, in 26.6 fractional points. */ - /* */ - /* char_height :: The nominal height, in 26.6 fractional points. */ - /* */ - /* horz_resolution :: The horizontal resolution in dpi. */ - /* */ - /* vert_resolution :: The vertical resolution in dpi. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* If either the character width or height is zero, it is set equal */ - /* to the other value. */ - /* */ - /* If either the horizontal or vertical resolution is zero, it is set */ - /* equal to the other value. */ - /* */ - /* A character width or height smaller than 1pt is set to 1pt; if */ - /* both resolution values are zero, they are set to 72dpi. */ - /* */ - /* Don't use this function if you are using the FreeType cache API. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Char_Size( FT_Face face, - FT_F26Dot6 char_width, - FT_F26Dot6 char_height, - FT_UInt horz_resolution, - FT_UInt vert_resolution ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Pixel_Sizes */ - /* */ - /* <Description> */ - /* This function calls @FT_Request_Size to request the nominal size */ - /* (in pixels). */ - /* */ - /* <InOut> */ - /* face :: A handle to the target face object. */ - /* */ - /* <Input> */ - /* pixel_width :: The nominal width, in pixels. */ - /* */ - /* pixel_height :: The nominal height, in pixels. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* You should not rely on the resulting glyphs matching, or being */ - /* constrained, to this pixel size. Refer to @FT_Request_Size to */ - /* understand how requested sizes relate to actual sizes. */ - /* */ - /* Don't use this function if you are using the FreeType cache API. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Pixel_Sizes( FT_Face face, - FT_UInt pixel_width, - FT_UInt pixel_height ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Load_Glyph */ - /* */ - /* <Description> */ - /* A function used to load a single glyph into the glyph slot of a */ - /* face object. */ - /* */ - /* <InOut> */ - /* face :: A handle to the target face object where the glyph */ - /* is loaded. */ - /* */ - /* <Input> */ - /* glyph_index :: The index of the glyph in the font file. For */ - /* CID-keyed fonts (either in PS or in CFF format) */ - /* this argument specifies the CID value. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* @FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The loaded glyph may be transformed. See @FT_Set_Transform for */ - /* the details. */ - /* */ - /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ - /* returned for invalid CID values (this is, for CID values that */ - /* don't have a corresponding glyph in the font). See the discussion */ - /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Load_Glyph( FT_Face face, - FT_UInt glyph_index, - FT_Int32 load_flags ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Load_Char */ - /* */ - /* <Description> */ - /* A function used to load a single glyph into the glyph slot of a */ - /* face object, according to its character code. */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object where the glyph */ - /* is loaded. */ - /* */ - /* <Input> */ - /* char_code :: The glyph's character code, according to the */ - /* current charmap used in the face. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* @FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Load_Char( FT_Face face, - FT_ULong char_code, - FT_Int32 load_flags ); - - - /************************************************************************* - * - * @enum: - * FT_LOAD_XXX - * - * @description: - * A list of bit-field constants used with @FT_Load_Glyph to indicate - * what kind of operations to perform during glyph loading. - * - * @values: - * FT_LOAD_DEFAULT :: - * Corresponding to~0, this value is used as the default glyph load - * operation. In this case, the following happens: - * - * 1. FreeType looks for a bitmap for the glyph corresponding to the - * face's current size. If one is found, the function returns. - * The bitmap data can be accessed from the glyph slot (see note - * below). - * - * 2. If no embedded bitmap is searched or found, FreeType looks for a - * scalable outline. If one is found, it is loaded from the font - * file, scaled to device pixels, then `hinted' to the pixel grid - * in order to optimize it. The outline data can be accessed from - * the glyph slot (see note below). - * - * Note that by default, the glyph loader doesn't render outlines into - * bitmaps. The following flags are used to modify this default - * behaviour to more specific and useful cases. - * - * FT_LOAD_NO_SCALE :: - * Don't scale the loaded outline glyph but keep it in font units. - * - * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and - * unsets @FT_LOAD_RENDER. - * - * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using - * FT_LOAD_NO_SCALE usually yields meaningless outlines because the - * subglyphs must be scaled and positioned with hinting instructions. - * This can be solved by loading the font without FT_LOAD_NO_SCALE and - * setting the character size to `font->units_per_EM'. - * - * FT_LOAD_NO_HINTING :: - * Disable hinting. This generally generates `blurrier' bitmap glyphs - * when the glyph are rendered in any of the anti-aliased modes. See - * also the note below. - * - * This flag is implied by @FT_LOAD_NO_SCALE. - * - * FT_LOAD_RENDER :: - * Call @FT_Render_Glyph after the glyph is loaded. By default, the - * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be - * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. - * - * This flag is unset by @FT_LOAD_NO_SCALE. - * - * FT_LOAD_NO_BITMAP :: - * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this - * flag. - * - * @FT_LOAD_NO_SCALE always sets this flag. - * - * FT_LOAD_VERTICAL_LAYOUT :: - * Load the glyph for vertical text layout. In particular, the - * `advance' value in the @FT_GlyphSlotRec structure is set to the - * `vertAdvance' value of the `metrics' field. - * - * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use - * this flag currently. Reason is that in this case vertical metrics - * get synthesized, and those values are not always consistent across - * various font formats. - * - * FT_LOAD_FORCE_AUTOHINT :: - * Indicates that the auto-hinter is preferred over the font's native - * hinter. See also the note below. - * - * FT_LOAD_CROP_BITMAP :: - * Indicates that the font driver should crop the loaded bitmap glyph - * (i.e., remove all space around its black bits). Not all drivers - * implement this. - * - * FT_LOAD_PEDANTIC :: - * Indicates that the font driver should perform pedantic verifications - * during glyph loading. This is mostly used to detect broken glyphs - * in fonts. By default, FreeType tries to handle broken fonts also. - * - * In particular, errors from the TrueType bytecode engine are not - * passed to the application if this flag is not set; this might - * result in partially hinted or distorted glyphs in case a glyph's - * bytecode is buggy. - * - * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: - * Ignored. Deprecated. - * - * FT_LOAD_NO_RECURSE :: - * This flag is only used internally. It merely indicates that the - * font driver should not load composite glyphs recursively. Instead, - * it should set the `num_subglyph' and `subglyphs' values of the - * glyph slot accordingly, and set `glyph->format' to - * @FT_GLYPH_FORMAT_COMPOSITE. - * - * The description of sub-glyphs is not available to client - * applications for now. - * - * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. - * - * FT_LOAD_IGNORE_TRANSFORM :: - * Indicates that the transform matrix set by @FT_Set_Transform should - * be ignored. - * - * FT_LOAD_MONOCHROME :: - * This flag is used with @FT_LOAD_RENDER to indicate that you want to - * render an outline glyph to a 1-bit monochrome bitmap glyph, with - * 8~pixels packed into each byte of the bitmap data. - * - * Note that this has no effect on the hinting algorithm used. You - * should rather use @FT_LOAD_TARGET_MONO so that the - * monochrome-optimized hinting algorithm is used. - * - * FT_LOAD_LINEAR_DESIGN :: - * Indicates that the `linearHoriAdvance' and `linearVertAdvance' - * fields of @FT_GlyphSlotRec should be kept in font units. See - * @FT_GlyphSlotRec for details. - * - * FT_LOAD_NO_AUTOHINT :: - * Disable auto-hinter. See also the note below. - * - * FT_LOAD_COLOR :: - * This flag is used to request loading of color embedded-bitmap - * images. The resulting color bitmaps, if available, will have the - * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color - * bitmaps are found, they will be converted to 256-level gray - * bitmaps transparently. Those bitmaps will be in the - * @FT_PIXEL_MODE_GRAY format. - * - * @note: - * By default, hinting is enabled and the font's native hinter (see - * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can - * disable hinting by setting @FT_LOAD_NO_HINTING or change the - * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set - * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be - * used at all. - * - * See the description of @FT_FACE_FLAG_TRICKY for a special exception - * (affecting only a handful of Asian fonts). - * - * Besides deciding which hinter to use, you can also decide which - * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. - * - * Note that the auto-hinter needs a valid Unicode cmap (either a native - * one or synthesized by FreeType) for producing correct results. If a - * font provides an incorrect mapping (for example, assigning the - * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a - * mathematical integral sign), the auto-hinter might produce useless - * results. - * - */ -#define FT_LOAD_DEFAULT 0x0 -#define FT_LOAD_NO_SCALE ( 1L << 0 ) -#define FT_LOAD_NO_HINTING ( 1L << 1 ) -#define FT_LOAD_RENDER ( 1L << 2 ) -#define FT_LOAD_NO_BITMAP ( 1L << 3 ) -#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) -#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) -#define FT_LOAD_CROP_BITMAP ( 1L << 6 ) -#define FT_LOAD_PEDANTIC ( 1L << 7 ) -#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) -#define FT_LOAD_NO_RECURSE ( 1L << 10 ) -#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) -#define FT_LOAD_MONOCHROME ( 1L << 12 ) -#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) -#define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) - /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ -#define FT_LOAD_COLOR ( 1L << 20 ) - - /* */ - - /* used internally only by certain font drivers! */ -#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) -#define FT_LOAD_SBITS_ONLY ( 1L << 14 ) - - - /************************************************************************** - * - * @enum: - * FT_LOAD_TARGET_XXX - * - * @description: - * A list of values that are used to select a specific hinting algorithm - * to use by the hinter. You should OR one of these values to your - * `load_flags' when calling @FT_Load_Glyph. - * - * Note that font's native hinters may ignore the hinting algorithm you - * have specified (e.g., the TrueType bytecode interpreter). You can set - * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used. - * - * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it - * always implies @FT_LOAD_FORCE_AUTOHINT. - * - * @values: - * FT_LOAD_TARGET_NORMAL :: - * This corresponds to the default hinting algorithm, optimized for - * standard gray-level rendering. For monochrome output, use - * @FT_LOAD_TARGET_MONO instead. - * - * FT_LOAD_TARGET_LIGHT :: - * A lighter hinting algorithm for non-monochrome modes. Many - * generated glyphs are more fuzzy but better resemble its original - * shape. A bit like rendering on Mac OS~X. - * - * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT. - * - * FT_LOAD_TARGET_MONO :: - * Strong hinting algorithm that should only be used for monochrome - * output. The result is probably unpleasant if the glyph is rendered - * in non-monochrome modes. - * - * FT_LOAD_TARGET_LCD :: - * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally - * decimated LCD displays. - * - * FT_LOAD_TARGET_LCD_V :: - * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically - * decimated LCD displays. - * - * @note: - * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your - * `load_flags'. They can't be ORed. - * - * If @FT_LOAD_RENDER is also set, the glyph is rendered in the - * corresponding mode (i.e., the mode that matches the used algorithm - * best). An exeption is FT_LOAD_TARGET_MONO since it implies - * @FT_LOAD_MONOCHROME. - * - * You can use a hinting algorithm that doesn't correspond to the same - * rendering mode. As an example, it is possible to use the `light' - * hinting algorithm and have the results rendered in horizontal LCD - * pixel mode, with code like - * - * { - * FT_Load_Glyph( face, glyph_index, - * load_flags | FT_LOAD_TARGET_LIGHT ); - * - * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); - * } - * - */ -#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) - -#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) -#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) -#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) -#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) -#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) - - - /************************************************************************** - * - * @macro: - * FT_LOAD_TARGET_MODE - * - * @description: - * Return the @FT_Render_Mode corresponding to a given - * @FT_LOAD_TARGET_XXX value. - * - */ -#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Transform */ - /* */ - /* <Description> */ - /* A function used to set the transformation that is applied to glyph */ - /* images when they are loaded into a glyph slot through */ - /* @FT_Load_Glyph. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */ - /* the identity matrix. */ - /* delta :: A pointer to the translation vector. Use~0 for the null */ - /* vector. */ - /* */ - /* <Note> */ - /* The transformation is only applied to scalable image formats after */ - /* the glyph has been loaded. It means that hinting is unaltered by */ - /* the transformation and is performed on the character size given in */ - /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ - /* */ - /* Note that this also transforms the `face.glyph.advance' field, but */ - /* *not* the values in `face.glyph.metrics'. */ - /* */ - FT_EXPORT( void ) - FT_Set_Transform( FT_Face face, - FT_Matrix* matrix, - FT_Vector* delta ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Render_Mode */ - /* */ - /* <Description> */ - /* An enumeration type that lists the render modes supported by */ - /* FreeType~2. Each mode corresponds to a specific type of scanline */ - /* conversion performed on the outline. */ - /* */ - /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */ - /* field in the @FT_GlyphSlotRec structure gives the format of the */ - /* returned bitmap. */ - /* */ - /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */ - /* */ - /* <Values> */ - /* FT_RENDER_MODE_NORMAL :: */ - /* This is the default render mode; it corresponds to 8-bit */ - /* anti-aliased bitmaps. */ - /* */ - /* FT_RENDER_MODE_LIGHT :: */ - /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ - /* defined as a separate value because render modes are also used */ - /* indirectly to define hinting algorithm selectors. See */ - /* @FT_LOAD_TARGET_XXX for details. */ - /* */ - /* FT_RENDER_MODE_MONO :: */ - /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ - /* opacity). */ - /* */ - /* FT_RENDER_MODE_LCD :: */ - /* This mode corresponds to horizontal RGB and BGR sub-pixel */ - /* displays like LCD screens. It produces 8-bit bitmaps that are */ - /* 3~times the width of the original glyph outline in pixels, and */ - /* which use the @FT_PIXEL_MODE_LCD mode. */ - /* */ - /* FT_RENDER_MODE_LCD_V :: */ - /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ - /* (like PDA screens, rotated LCD displays, etc.). It produces */ - /* 8-bit bitmaps that are 3~times the height of the original */ - /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ - /* */ - /* <Note> */ - /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */ - /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */ - /* (not active in the default builds). It is up to the caller to */ - /* either call @FT_Library_SetLcdFilter (if available) or do the */ - /* filtering itself. */ - /* */ - /* The selected render mode only affects vector glyphs of a font. */ - /* Embedded bitmaps often have a different pixel mode like */ - /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */ - /* them into 8-bit pixmaps. */ - /* */ - typedef enum FT_Render_Mode_ - { - FT_RENDER_MODE_NORMAL = 0, - FT_RENDER_MODE_LIGHT, - FT_RENDER_MODE_MONO, - FT_RENDER_MODE_LCD, - FT_RENDER_MODE_LCD_V, - - FT_RENDER_MODE_MAX - - } FT_Render_Mode; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_render_mode_xxx */ - /* */ - /* <Description> */ - /* These constants are deprecated. Use the corresponding */ - /* @FT_Render_Mode values instead. */ - /* */ - /* <Values> */ - /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */ - /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */ - /* */ -#define ft_render_mode_normal FT_RENDER_MODE_NORMAL -#define ft_render_mode_mono FT_RENDER_MODE_MONO - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Render_Glyph */ - /* */ - /* <Description> */ - /* Convert a given glyph image to a bitmap. It does so by inspecting */ - /* the glyph image format, finding the relevant renderer, and */ - /* invoking it. */ - /* */ - /* <InOut> */ - /* slot :: A handle to the glyph slot containing the image to */ - /* convert. */ - /* */ - /* <Input> */ - /* render_mode :: This is the render mode used to render the glyph */ - /* image into a bitmap. See @FT_Render_Mode for a */ - /* list of possible values. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* To get meaningful results, font scaling values must be set with */ - /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Render_Glyph( FT_GlyphSlot slot, - FT_Render_Mode render_mode ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Kerning_Mode */ - /* */ - /* <Description> */ - /* An enumeration used to specify which kerning values to return in */ - /* @FT_Get_Kerning. */ - /* */ - /* <Values> */ - /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ - /* distances (value is~0). */ - /* */ - /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ - /* distances. */ - /* */ - /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ - /* units. */ - /* */ - typedef enum FT_Kerning_Mode_ - { - FT_KERNING_DEFAULT = 0, - FT_KERNING_UNFITTED, - FT_KERNING_UNSCALED - - } FT_Kerning_Mode; - - - /*************************************************************************/ - /* */ - /* <Const> */ - /* ft_kerning_default */ - /* */ - /* <Description> */ - /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */ - /* instead. */ - /* */ -#define ft_kerning_default FT_KERNING_DEFAULT - - - /*************************************************************************/ - /* */ - /* <Const> */ - /* ft_kerning_unfitted */ - /* */ - /* <Description> */ - /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */ - /* instead. */ - /* */ -#define ft_kerning_unfitted FT_KERNING_UNFITTED - - - /*************************************************************************/ - /* */ - /* <Const> */ - /* ft_kerning_unscaled */ - /* */ - /* <Description> */ - /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */ - /* instead. */ - /* */ -#define ft_kerning_unscaled FT_KERNING_UNSCALED - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Kerning */ - /* */ - /* <Description> */ - /* Return the kerning vector between two glyphs of a same face. */ - /* */ - /* <Input> */ - /* face :: A handle to a source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* kern_mode :: See @FT_Kerning_Mode for more information. */ - /* Determines the scale and dimension of the returned */ - /* kerning vector. */ - /* */ - /* <Output> */ - /* akerning :: The kerning vector. This is either in font units */ - /* or in pixels (26.6 format) for scalable formats, */ - /* and in pixels for fixed-sizes formats. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this method. Other layouts, or more sophisticated */ - /* kernings, are out of the scope of this API function -- they can be */ - /* implemented through format-specific interfaces. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Kerning( FT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_UInt kern_mode, - FT_Vector *akerning ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Track_Kerning */ - /* */ - /* <Description> */ - /* Return the track kerning for a given face object at a given size. */ - /* */ - /* <Input> */ - /* face :: A handle to a source face object. */ - /* */ - /* point_size :: The point size in 16.16 fractional points. */ - /* */ - /* degree :: The degree of tightness. Increasingly negative */ - /* values represent tighter track kerning, while */ - /* increasingly positive values represent looser track */ - /* kerning. Value zero means no track kerning. */ - /* */ - /* <Output> */ - /* akerning :: The kerning in 16.16 fractional points, to be */ - /* uniformly applied between all glyphs. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Currently, only the Type~1 font driver supports track kerning, */ - /* using data from AFM files (if attached with @FT_Attach_File or */ - /* @FT_Attach_Stream). */ - /* */ - /* Only very few AFM files come with track kerning data; please refer */ - /* to the Adobe's AFM specification for more details. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Track_Kerning( FT_Face face, - FT_Fixed point_size, - FT_Int degree, - FT_Fixed* akerning ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Glyph_Name */ - /* */ - /* <Description> */ - /* Retrieve the ASCII name of a given glyph in a face. This only */ - /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */ - /* */ - /* <Input> */ - /* face :: A handle to a source face object. */ - /* */ - /* glyph_index :: The glyph index. */ - /* */ - /* buffer_max :: The maximum number of bytes available in the */ - /* buffer. */ - /* */ - /* <Output> */ - /* buffer :: A pointer to a target buffer where the name is */ - /* copied to. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* An error is returned if the face doesn't provide glyph names or if */ - /* the glyph index is invalid. In all cases of failure, the first */ - /* byte of `buffer' is set to~0 to indicate an empty name. */ - /* */ - /* The glyph name is truncated to fit within the buffer if it is too */ - /* long. The returned string is always zero-terminated. */ - /* */ - /* Be aware that FreeType reorders glyph indices internally so that */ - /* glyph index~0 always corresponds to the `missing glyph' (called */ - /* `.notdef'). */ - /* */ - /* This function is not compiled within the library if the config */ - /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ - /* `ftoptions.h'. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Glyph_Name( FT_Face face, - FT_UInt glyph_index, - FT_Pointer buffer, - FT_UInt buffer_max ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Postscript_Name */ - /* */ - /* <Description> */ - /* Retrieve the ASCII PostScript name of a given face, if available. */ - /* This only works with PostScript and TrueType fonts. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Return> */ - /* A pointer to the face's PostScript name. NULL if unavailable. */ - /* */ - /* <Note> */ - /* The returned pointer is owned by the face and is destroyed with */ - /* it. */ - /* */ - FT_EXPORT( const char* ) - FT_Get_Postscript_Name( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Select_Charmap */ - /* */ - /* <Description> */ - /* Select a given charmap by its encoding tag (as listed in */ - /* `freetype.h'). */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Input> */ - /* encoding :: A handle to the selected encoding. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function returns an error if no charmap in the face */ - /* corresponds to the encoding queried here. */ - /* */ - /* Because many fonts contain more than a single cmap for Unicode */ - /* encoding, this function has some special code to select the one */ - /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */ - /* preferred to a UCS-2 cmap). It is thus preferable to */ - /* @FT_Set_Charmap in this case. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Select_Charmap( FT_Face face, - FT_Encoding encoding ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Charmap */ - /* */ - /* <Description> */ - /* Select a given charmap for character code to glyph index mapping. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Input> */ - /* charmap :: A handle to the selected charmap. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function returns an error if the charmap is not part of */ - /* the face (i.e., if it is not listed in the `face->charmaps' */ - /* table). */ - /* */ - /* It also fails if a type~14 charmap is selected. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Charmap( FT_Face face, - FT_CharMap charmap ); - - - /************************************************************************* - * - * @function: - * FT_Get_Charmap_Index - * - * @description: - * Retrieve index of a given charmap. - * - * @input: - * charmap :: - * A handle to a charmap. - * - * @return: - * The index into the array of character maps within the face to which - * `charmap' belongs. If an error occurs, -1 is returned. - * - */ - FT_EXPORT( FT_Int ) - FT_Get_Charmap_Index( FT_CharMap charmap ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Char_Index */ - /* */ - /* <Description> */ - /* Return the glyph index of a given character code. This function */ - /* uses a charmap object to do the mapping. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* charcode :: The character code. */ - /* */ - /* <Return> */ - /* The glyph index. 0~means `undefined character code'. */ - /* */ - /* <Note> */ - /* If you use FreeType to manipulate the contents of font files */ - /* directly, be aware that the glyph index returned by this function */ - /* doesn't always correspond to the internal indices used within the */ - /* file. This is done to ensure that value~0 always corresponds to */ - /* the `missing glyph'. If the first glyph is not named `.notdef', */ - /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */ - /* the glyph ID~0 position, and whatever was there will be moved to */ - /* the position `.notdef' had. For Type~1 fonts, if there is no */ - /* `.notdef' glyph at all, then one will be created at index~0 and */ - /* whatever was there will be moved to the last index -- Type~42 */ - /* fonts are considered invalid under this condition. */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Get_Char_Index( FT_Face face, - FT_ULong charcode ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_First_Char */ - /* */ - /* <Description> */ - /* This function is used to return the first character code in the */ - /* current charmap of a given face. It also returns the */ - /* corresponding glyph index. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Output> */ - /* agindex :: Glyph index of first character code. 0~if charmap is */ - /* empty. */ - /* */ - /* <Return> */ - /* The charmap's first character code. */ - /* */ - /* <Note> */ - /* You should use this function with @FT_Get_Next_Char to be able to */ - /* parse all character codes available in a given charmap. The code */ - /* should look like this: */ - /* */ - /* { */ - /* FT_ULong charcode; */ - /* FT_UInt gindex; */ - /* */ - /* */ - /* charcode = FT_Get_First_Char( face, &gindex ); */ - /* while ( gindex != 0 ) */ - /* { */ - /* ... do something with (charcode,gindex) pair ... */ - /* */ - /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ - /* } */ - /* } */ - /* */ - /* Note that `*agindex' is set to~0 if the charmap is empty. The */ - /* result itself can be~0 in two cases: if the charmap is empty or */ - /* if the value~0 is the first valid character code. */ - /* */ - FT_EXPORT( FT_ULong ) - FT_Get_First_Char( FT_Face face, - FT_UInt *agindex ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Next_Char */ - /* */ - /* <Description> */ - /* This function is used to return the next character code in the */ - /* current charmap of a given face following the value `char_code', */ - /* as well as the corresponding glyph index. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* char_code :: The starting character code. */ - /* */ - /* <Output> */ - /* agindex :: Glyph index of next character code. 0~if charmap */ - /* is empty. */ - /* */ - /* <Return> */ - /* The charmap's next character code. */ - /* */ - /* <Note> */ - /* You should use this function with @FT_Get_First_Char to walk */ - /* over all character codes available in a given charmap. See the */ - /* note for this function for a simple code example. */ - /* */ - /* Note that `*agindex' is set to~0 when there are no more codes in */ - /* the charmap. */ - /* */ - FT_EXPORT( FT_ULong ) - FT_Get_Next_Char( FT_Face face, - FT_ULong char_code, - FT_UInt *agindex ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Name_Index */ - /* */ - /* <Description> */ - /* Return the glyph index of a given glyph name. This function uses */ - /* driver specific objects to do the translation. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* glyph_name :: The glyph name. */ - /* */ - /* <Return> */ - /* The glyph index. 0~means `undefined character code'. */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Get_Name_Index( FT_Face face, - FT_String* glyph_name ); - - - /************************************************************************* - * - * @macro: - * FT_SUBGLYPH_FLAG_XXX - * - * @description: - * A list of constants used to describe subglyphs. Please refer to the - * TrueType specification for the meaning of the various flags. - * - * @values: - * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: - * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: - * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: - * FT_SUBGLYPH_FLAG_SCALE :: - * FT_SUBGLYPH_FLAG_XY_SCALE :: - * FT_SUBGLYPH_FLAG_2X2 :: - * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: - * - */ -#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 -#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 -#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 -#define FT_SUBGLYPH_FLAG_SCALE 8 -#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 -#define FT_SUBGLYPH_FLAG_2X2 0x80 -#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 - - - /************************************************************************* - * - * @func: - * FT_Get_SubGlyph_Info - * - * @description: - * Retrieve a description of a given subglyph. Only use it if - * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is - * returned otherwise. - * - * @input: - * glyph :: - * The source glyph slot. - * - * sub_index :: - * The index of the subglyph. Must be less than - * `glyph->num_subglyphs'. - * - * @output: - * p_index :: - * The glyph index of the subglyph. - * - * p_flags :: - * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. - * - * p_arg1 :: - * The subglyph's first argument (if any). - * - * p_arg2 :: - * The subglyph's second argument (if any). - * - * p_transform :: - * The subglyph transformation (if any). - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be - * interpreted depending on the flags returned in `*p_flags'. See the - * TrueType specification for details. - * - */ - FT_EXPORT( FT_Error ) - FT_Get_SubGlyph_Info( FT_GlyphSlot glyph, - FT_UInt sub_index, - FT_Int *p_index, - FT_UInt *p_flags, - FT_Int *p_arg1, - FT_Int *p_arg2, - FT_Matrix *p_transform ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_FSTYPE_XXX */ - /* */ - /* <Description> */ - /* A list of bit flags used in the `fsType' field of the OS/2 table */ - /* in a TrueType or OpenType font and the `FSType' entry in a */ - /* PostScript font. These bit flags are returned by */ - /* @FT_Get_FSType_Flags; they inform client applications of embedding */ - /* and subsetting restrictions associated with a font. */ - /* */ - /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */ - /* more details. */ - /* */ - /* <Values> */ - /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ - /* Fonts with no fsType bit set may be embedded and permanently */ - /* installed on the remote system by an application. */ - /* */ - /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */ - /* Fonts that have only this bit set must not be modified, embedded */ - /* or exchanged in any manner without first obtaining permission of */ - /* the font software copyright owner. */ - /* */ - /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */ - /* If this bit is set, the font may be embedded and temporarily */ - /* loaded on the remote system. Documents containing Preview & */ - /* Print fonts must be opened `read-only'; no edits can be applied */ - /* to the document. */ - /* */ - /* FT_FSTYPE_EDITABLE_EMBEDDING :: */ - /* If this bit is set, the font may be embedded but must only be */ - /* installed temporarily on other systems. In contrast to Preview */ - /* & Print fonts, documents containing editable fonts may be opened */ - /* for reading, editing is permitted, and changes may be saved. */ - /* */ - /* FT_FSTYPE_NO_SUBSETTING :: */ - /* If this bit is set, the font may not be subsetted prior to */ - /* embedding. */ - /* */ - /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */ - /* If this bit is set, only bitmaps contained in the font may be */ - /* embedded; no outline data may be embedded. If there are no */ - /* bitmaps available in the font, then the font is unembeddable. */ - /* */ - /* <Note> */ - /* While the fsType flags can indicate that a font may be embedded, a */ - /* license with the font vendor may be separately required to use the */ - /* font in this way. */ - /* */ -#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 -#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 -#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 -#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 -#define FT_FSTYPE_NO_SUBSETTING 0x0100 -#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_FSType_Flags */ - /* */ - /* <Description> */ - /* Return the fsType flags for a font. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Return> */ - /* The fsType flags, @FT_FSTYPE_XXX. */ - /* */ - /* <Note> */ - /* Use this function rather than directly reading the `fs_type' field */ - /* in the @PS_FontInfoRec structure, which is only guaranteed to */ - /* return the correct results for Type~1 fonts. */ - /* */ - /* <Since> */ - /* 2.3.8 */ - /* */ - FT_EXPORT( FT_UShort ) - FT_Get_FSType_Flags( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* glyph_variants */ - /* */ - /* <Title> */ - /* Glyph Variants */ - /* */ - /* <Abstract> */ - /* The FreeType~2 interface to Unicode Ideographic Variation */ - /* Sequences (IVS), using the SFNT cmap format~14. */ - /* */ - /* <Description> */ - /* Many CJK characters have variant forms. They are a sort of grey */ - /* area somewhere between being totally irrelevant and semantically */ - /* distinct; for this reason, the Unicode consortium decided to */ - /* introduce Ideographic Variation Sequences (IVS), consisting of a */ - /* Unicode base character and one of 240 variant selectors */ - /* (U+E0100-U+E01EF), instead of further extending the already huge */ - /* code range for CJK characters. */ - /* */ - /* An IVS is registered and unique; for further details please refer */ - /* to Unicode Technical Standard #37, the Ideographic Variation */ - /* Database: */ - /* */ - /* http://www.unicode.org/reports/tr37/ */ - /* */ - /* To date (November 2012), the character with the most variants is */ - /* U+9089, having 31 such IVS. */ - /* */ - /* Adobe and MS decided to support IVS with a new cmap subtable */ - /* (format~14). It is an odd subtable because it is not a mapping of */ - /* input code points to glyphs, but contains lists of all variants */ - /* supported by the font. */ - /* */ - /* A variant may be either `default' or `non-default'. A default */ - /* variant is the one you will get for that code point if you look it */ - /* up in the standard Unicode cmap. A non-default variant is a */ - /* different glyph. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetCharVariantIndex */ - /* */ - /* <Description> */ - /* Return the glyph index of a given character code as modified by */ - /* the variation selector. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* charcode :: */ - /* The character code point in Unicode. */ - /* */ - /* variantSelector :: */ - /* The Unicode code point of the variation selector. */ - /* */ - /* <Return> */ - /* The glyph index. 0~means either `undefined character code', or */ - /* `undefined selector code', or `no variation selector cmap */ - /* subtable', or `current CharMap is not Unicode'. */ - /* */ - /* <Note> */ - /* If you use FreeType to manipulate the contents of font files */ - /* directly, be aware that the glyph index returned by this function */ - /* doesn't always correspond to the internal indices used within */ - /* the file. This is done to ensure that value~0 always corresponds */ - /* to the `missing glyph'. */ - /* */ - /* This function is only meaningful if */ - /* a) the font has a variation selector cmap sub table, */ - /* and */ - /* b) the current charmap has a Unicode encoding. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Face_GetCharVariantIndex( FT_Face face, - FT_ULong charcode, - FT_ULong variantSelector ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetCharVariantIsDefault */ - /* */ - /* <Description> */ - /* Check whether this variant of this Unicode character is the one to */ - /* be found in the `cmap'. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* charcode :: */ - /* The character codepoint in Unicode. */ - /* */ - /* variantSelector :: */ - /* The Unicode codepoint of the variation selector. */ - /* */ - /* <Return> */ - /* 1~if found in the standard (Unicode) cmap, 0~if found in the */ - /* variation selector cmap, or -1 if it is not a variant. */ - /* */ - /* <Note> */ - /* This function is only meaningful if the font has a variation */ - /* selector cmap subtable. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_Int ) - FT_Face_GetCharVariantIsDefault( FT_Face face, - FT_ULong charcode, - FT_ULong variantSelector ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetVariantSelectors */ - /* */ - /* <Description> */ - /* Return a zero-terminated list of Unicode variant selectors found */ - /* in the font. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* <Return> */ - /* A pointer to an array of selector code points, or NULL if there is */ - /* no valid variant selector cmap subtable. */ - /* */ - /* <Note> */ - /* The last item in the array is~0; the array is owned by the */ - /* @FT_Face object but can be overwritten or released on the next */ - /* call to a FreeType function. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt32* ) - FT_Face_GetVariantSelectors( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetVariantsOfChar */ - /* */ - /* <Description> */ - /* Return a zero-terminated list of Unicode variant selectors found */ - /* for the specified character code. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* charcode :: */ - /* The character codepoint in Unicode. */ - /* */ - /* <Return> */ - /* A pointer to an array of variant selector code points that are */ - /* active for the given character, or NULL if the corresponding list */ - /* is empty. */ - /* */ - /* <Note> */ - /* The last item in the array is~0; the array is owned by the */ - /* @FT_Face object but can be overwritten or released on the next */ - /* call to a FreeType function. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt32* ) - FT_Face_GetVariantsOfChar( FT_Face face, - FT_ULong charcode ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetCharsOfVariant */ - /* */ - /* <Description> */ - /* Return a zero-terminated list of Unicode character codes found for */ - /* the specified variant selector. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* variantSelector :: */ - /* The variant selector code point in Unicode. */ - /* */ - /* <Return> */ - /* A list of all the code points that are specified by this selector */ - /* (both default and non-default codes are returned) or NULL if there */ - /* is no valid cmap or the variant selector is invalid. */ - /* */ - /* <Note> */ - /* The last item in the array is~0; the array is owned by the */ - /* @FT_Face object but can be overwritten or released on the next */ - /* call to a FreeType function. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt32* ) - FT_Face_GetCharsOfVariant( FT_Face face, - FT_ULong variantSelector ); - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* computations */ - /* */ - /* <Title> */ - /* Computations */ - /* */ - /* <Abstract> */ - /* Crunching fixed numbers and vectors. */ - /* */ - /* <Description> */ - /* This section contains various functions used to perform */ - /* computations on 16.16 fixed-float numbers or 2d vectors. */ - /* */ - /* <Order> */ - /* FT_MulDiv */ - /* FT_MulFix */ - /* FT_DivFix */ - /* FT_RoundFix */ - /* FT_CeilFix */ - /* FT_FloorFix */ - /* FT_Vector_Transform */ - /* FT_Matrix_Multiply */ - /* FT_Matrix_Invert */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_MulDiv */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation `(a*b)/c' */ - /* with maximum accuracy (it uses a 64-bit intermediate integer */ - /* whenever necessary). */ - /* */ - /* This function isn't necessarily as fast as some processor specific */ - /* operations, but is at least completely portable. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. */ - /* c :: The divisor. */ - /* */ - /* <Return> */ - /* The result of `(a*b)/c'. This function never traps when trying to */ - /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ - /* on the signs of `a' and `b'. */ - /* */ - FT_EXPORT( FT_Long ) - FT_MulDiv( FT_Long a, - FT_Long b, - FT_Long c ); - - - /* */ - - /* The following #if 0 ... #endif is for the documentation formatter, */ - /* hiding the internal `FT_MULFIX_INLINED' macro. */ - -#if 0 - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_MulFix */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation */ - /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */ - /* used to multiply a given value by a 16.16 fixed-point factor. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* <Return> */ - /* The result of `(a*b)/0x10000'. */ - /* */ - /* <Note> */ - /* This function has been optimized for the case where the absolute */ - /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ - /* As this happens mainly when scaling from notional units to */ - /* fractional pixels in FreeType, it resulted in noticeable speed */ - /* improvements between versions 2.x and 1.x. */ - /* */ - /* As a conclusion, always try to place a 16.16 factor as the */ - /* _second_ argument of this function; this can make a great */ - /* difference. */ - /* */ - FT_EXPORT( FT_Long ) - FT_MulFix( FT_Long a, - FT_Long b ); - - /* */ -#endif - -#ifdef FT_MULFIX_INLINED -#define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b ) -#else - FT_EXPORT( FT_Long ) - FT_MulFix( FT_Long a, - FT_Long b ); -#endif - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_DivFix */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation */ - /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ - /* used to divide a given value by a 16.16 fixed-point factor. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* <Return> */ - /* The result of `(a*0x10000)/b'. */ - /* */ - /* <Note> */ - /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */ - /* 32~bits, then the division is computed directly. Otherwise, we */ - /* use a specialized version of @FT_MulDiv. */ - /* */ - FT_EXPORT( FT_Long ) - FT_DivFix( FT_Long a, - FT_Long b ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_RoundFix */ - /* */ - /* <Description> */ - /* A very simple function used to round a 16.16 fixed number. */ - /* */ - /* <Input> */ - /* a :: The number to be rounded. */ - /* */ - /* <Return> */ - /* The result of `(a + 0x8000) & -0x10000'. */ - /* */ - FT_EXPORT( FT_Fixed ) - FT_RoundFix( FT_Fixed a ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_CeilFix */ - /* */ - /* <Description> */ - /* A very simple function used to compute the ceiling function of a */ - /* 16.16 fixed number. */ - /* */ - /* <Input> */ - /* a :: The number for which the ceiling function is to be computed. */ - /* */ - /* <Return> */ - /* The result of `(a + 0x10000 - 1) & -0x10000'. */ - /* */ - FT_EXPORT( FT_Fixed ) - FT_CeilFix( FT_Fixed a ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_FloorFix */ - /* */ - /* <Description> */ - /* A very simple function used to compute the floor function of a */ - /* 16.16 fixed number. */ - /* */ - /* <Input> */ - /* a :: The number for which the floor function is to be computed. */ - /* */ - /* <Return> */ - /* The result of `a & -0x10000'. */ - /* */ - FT_EXPORT( FT_Fixed ) - FT_FloorFix( FT_Fixed a ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Vector_Transform */ - /* */ - /* <Description> */ - /* Transform a single vector through a 2x2 matrix. */ - /* */ - /* <InOut> */ - /* vector :: The target vector to transform. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to the source 2x2 matrix. */ - /* */ - /* <Note> */ - /* The result is undefined if either `vector' or `matrix' is invalid. */ - /* */ - FT_EXPORT( void ) - FT_Vector_Transform( FT_Vector* vec, - const FT_Matrix* matrix ); - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* version */ - /* */ - /* <Title> */ - /* FreeType Version */ - /* */ - /* <Abstract> */ - /* Functions and macros related to FreeType versions. */ - /* */ - /* <Description> */ - /* Note that those functions and macros are of limited use because */ - /* even a new release of FreeType with only documentation changes */ - /* increases the version number. */ - /* */ - /*************************************************************************/ - - - /************************************************************************* - * - * @enum: - * FREETYPE_XXX - * - * @description: - * These three macros identify the FreeType source code version. - * Use @FT_Library_Version to access them at runtime. - * - * @values: - * FREETYPE_MAJOR :: The major version number. - * FREETYPE_MINOR :: The minor version number. - * FREETYPE_PATCH :: The patch level. - * - * @note: - * The version number of FreeType if built as a dynamic link library - * with the `libtool' package is _not_ controlled by these three - * macros. - * - */ -#define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 5 -#define FREETYPE_PATCH 3 - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Library_Version */ - /* */ - /* <Description> */ - /* Return the version of the FreeType library being used. This is */ - /* useful when dynamically linking to the library, since one cannot */ - /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */ - /* @FREETYPE_PATCH. */ - /* */ - /* <Input> */ - /* library :: A source library handle. */ - /* */ - /* <Output> */ - /* amajor :: The major version number. */ - /* */ - /* aminor :: The minor version number. */ - /* */ - /* apatch :: The patch version number. */ - /* */ - /* <Note> */ - /* The reason why this function takes a `library' argument is because */ - /* certain programs implement library initialization in a custom way */ - /* that doesn't use @FT_Init_FreeType. */ - /* */ - /* In such cases, the library version might not be available before */ - /* the library object has been created. */ - /* */ - FT_EXPORT( void ) - FT_Library_Version( FT_Library library, - FT_Int *amajor, - FT_Int *aminor, - FT_Int *apatch ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_CheckTrueTypePatents */ - /* */ - /* <Description> */ - /* Parse all bytecode instructions of a TrueType font file to check */ - /* whether any of the patented opcodes are used. This is only useful */ - /* if you want to be able to use the unpatented hinter with */ - /* fonts that do *not* use these opcodes. */ - /* */ - /* Note that this function parses *all* glyph instructions in the */ - /* font file, which may be slow. */ - /* */ - /* <Input> */ - /* face :: A face handle. */ - /* */ - /* <Return> */ - /* 1~if this is a TrueType font that uses one of the patented */ - /* opcodes, 0~otherwise. */ - /* */ - /* <Note> */ - /* Since May 2010, TrueType hinting is no longer patented. */ - /* */ - /* <Since> */ - /* 2.3.5 */ - /* */ - FT_EXPORT( FT_Bool ) - FT_Face_CheckTrueTypePatents( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_SetUnpatentedHinting */ - /* */ - /* <Description> */ - /* Enable or disable the unpatented hinter for a given face. */ - /* Only enable it if you have determined that the face doesn't */ - /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */ - /* */ - /* <Input> */ - /* face :: A face handle. */ - /* */ - /* value :: New boolean setting. */ - /* */ - /* <Return> */ - /* The old setting value. This will always be false if this is not */ - /* an SFNT font, or if the unpatented hinter is not compiled in this */ - /* instance of the library. */ - /* */ - /* <Note> */ - /* Since May 2010, TrueType hinting is no longer patented. */ - /* */ - /* <Since> */ - /* 2.3.5 */ - /* */ - FT_EXPORT( FT_Bool ) - FT_Face_SetUnpatentedHinting( FT_Face face, - FT_Bool value ); - - /* */ - - -FT_END_HEADER - -#endif /* __FREETYPE_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ft2build.h b/GLideN64/src/inc/freetype/include/ft2build.h deleted file mode 100644 index 6f8eb7f..0000000 --- a/GLideN64/src/inc/freetype/include/ft2build.h +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************/ -/* */ -/* ft2build.h */ -/* */ -/* FreeType 2 build and setup macros. */ -/* */ -/* Copyright 1996-2001, 2006, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This is the `entry point' for FreeType header file inclusions. It is */ - /* the only header file which should be included directly; all other */ - /* FreeType header files should be accessed with macro names (after */ - /* including `ft2build.h'). */ - /* */ - /* A typical example is */ - /* */ - /* #include <ft2build.h> */ - /* #include FT_FREETYPE_H */ - /* */ - /*************************************************************************/ - - -#ifndef __FT2BUILD_H__ -#define __FT2BUILD_H__ - -#include <config/ftheader.h> - -#endif /* __FT2BUILD_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftadvanc.h b/GLideN64/src/inc/freetype/include/ftadvanc.h deleted file mode 100644 index 8f7e2fc..0000000 --- a/GLideN64/src/inc/freetype/include/ftadvanc.h +++ /dev/null @@ -1,182 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftadvanc.h */ -/* */ -/* Quick computation of advance widths (specification only). */ -/* */ -/* Copyright 2008, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTADVANC_H__ -#define __FTADVANC_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * quick_advance - * - * @title: - * Quick retrieval of advance values - * - * @abstract: - * Retrieve horizontal and vertical advance values without processing - * glyph outlines, if possible. - * - * @description: - * This section contains functions to quickly extract advance values - * without handling glyph outlines, if possible. - */ - - - /*************************************************************************/ - /* */ - /* <Const> */ - /* FT_ADVANCE_FLAG_FAST_ONLY */ - /* */ - /* <Description> */ - /* A bit-flag to be OR-ed with the `flags' parameter of the */ - /* @FT_Get_Advance and @FT_Get_Advances functions. */ - /* */ - /* If set, it indicates that you want these functions to fail if the */ - /* corresponding hinting mode or font driver doesn't allow for very */ - /* quick advance computation. */ - /* */ - /* Typically, glyphs that are either unscaled, unhinted, bitmapped, */ - /* or light-hinted can have their advance width computed very */ - /* quickly. */ - /* */ - /* Normal and bytecode hinted modes that require loading, scaling, */ - /* and hinting of the glyph outline, are extremely slow by */ - /* comparison. */ - /* */ -#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Advance */ - /* */ - /* <Description> */ - /* Retrieve the advance value of a given glyph outline in an */ - /* @FT_Face. */ - /* */ - /* <Input> */ - /* face :: The source @FT_Face handle. */ - /* */ - /* gindex :: The glyph index. */ - /* */ - /* load_flags :: A set of bit flags similar to those used when */ - /* calling @FT_Load_Glyph, used to determine what kind */ - /* of advances you need. */ - /* <Output> */ - /* padvance :: The advance value. If scaling is performed (based on */ - /* the value of `load_flags'), the advance value is in */ - /* 16.16 format. Otherwise, it is in font units. */ - /* */ - /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ - /* vertical advance corresponding to a vertical layout. */ - /* Otherwise, it is the horizontal advance in a */ - /* horizontal layout. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ - /* if the corresponding font backend doesn't have a quick way to */ - /* retrieve the advances. */ - /* */ - /* A scaled advance is returned in 16.16 format but isn't transformed */ - /* by the affine transformation specified by @FT_Set_Transform. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Advance( FT_Face face, - FT_UInt gindex, - FT_Int32 load_flags, - FT_Fixed *padvance ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Advances */ - /* */ - /* <Description> */ - /* Retrieve the advance values of several glyph outlines in an */ - /* @FT_Face. */ - /* */ - /* <Input> */ - /* face :: The source @FT_Face handle. */ - /* */ - /* start :: The first glyph index. */ - /* */ - /* count :: The number of advance values you want to retrieve. */ - /* */ - /* load_flags :: A set of bit flags similar to those used when */ - /* calling @FT_Load_Glyph. */ - /* */ - /* <Output> */ - /* padvance :: The advance values. This array, to be provided by the */ - /* caller, must contain at least `count' elements. */ - /* */ - /* If scaling is performed (based on the value of */ - /* `load_flags'), the advance values are in 16.16 format. */ - /* Otherwise, they are in font units. */ - /* */ - /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ - /* vertical advances corresponding to a vertical layout. */ - /* Otherwise, they are the horizontal advances in a */ - /* horizontal layout. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ - /* if the corresponding font backend doesn't have a quick way to */ - /* retrieve the advances. */ - /* */ - /* Scaled advances are returned in 16.16 format but aren't */ - /* transformed by the affine transformation specified by */ - /* @FT_Set_Transform. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Advances( FT_Face face, - FT_UInt start, - FT_UInt count, - FT_Int32 load_flags, - FT_Fixed *padvances ); - -/* */ - - -FT_END_HEADER - -#endif /* __FTADVANC_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftautoh.h b/GLideN64/src/inc/freetype/include/ftautoh.h deleted file mode 100644 index 936791e..0000000 --- a/GLideN64/src/inc/freetype/include/ftautoh.h +++ /dev/null @@ -1,402 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftautoh.h */ -/* */ -/* FreeType API for controlling the auto-hinter (specification only). */ -/* */ -/* Copyright 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTAUTOH_H__ -#define __FTAUTOH_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * auto_hinter - * - * @title: - * The auto-hinter - * - * @abstract: - * Controlling the auto-hinting module. - * - * @description: - * While FreeType's auto-hinter doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * Note that the auto-hinter's module name is `autofitter' for - * historical reasons. - * - */ - - - /************************************************************************** - * - * @property: - * glyph-to-script-map - * - * @description: - * *Experimental* *only* - * - * The auto-hinter provides various script modules to hint glyphs. - * Examples of supported scripts are Latin or CJK. Before a glyph is - * auto-hinted, the Unicode character map of the font gets examined, and - * the script is then determined based on Unicode character ranges, see - * below. - * - * OpenType fonts, however, often provide much more glyphs than - * character codes (small caps, superscripts, ligatures, swashes, etc.), - * to be controlled by so-called `features'. Handling OpenType features - * can be quite complicated and thus needs a separate library on top of - * FreeType. - * - * The mapping between glyph indices and scripts (in the auto-hinter - * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an - * array with `num_glyphs' elements, as found in the font's @FT_Face - * structure. The `glyph-to-script-map' property returns a pointer to - * this array, which can be modified as needed. Note that the - * modification should happen before the first glyph gets processed by - * the auto-hinter so that the global analysis of the font shapes - * actually uses the modified mapping. - * - * The following example code demonstrates how to access it (omitting - * the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_GlyphToScriptMap prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * - * prop.face = face; - * - * FT_Property_Get( library, "autofitter", - * "glyph-to-script-map", &prop ); - * - * // adjust `prop.map' as needed right here - * - * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); - * } - * - */ - - - /************************************************************************** - * - * @enum: - * FT_AUTOHINTER_SCRIPT_XXX - * - * @description: - * *Experimental* *only* - * - * A list of constants used for the @glyph-to-script-map property to - * specify the script submodule the auto-hinter should use for hinting a - * particular glyph. - * - * @values: - * FT_AUTOHINTER_SCRIPT_NONE :: - * Don't auto-hint this glyph. - * - * FT_AUTOHINTER_SCRIPT_LATIN :: - * Apply the latin auto-hinter. For the auto-hinter, `latin' is a - * very broad term, including Cyrillic and Greek also since characters - * from those scripts share the same design constraints. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0020 - U+007F // Basic Latin (no control characters) - * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) - * U+0100 - U+017F // Latin Extended-A - * U+0180 - U+024F // Latin Extended-B - * U+0250 - U+02AF // IPA Extensions - * U+02B0 - U+02FF // Spacing Modifier Letters - * U+0300 - U+036F // Combining Diacritical Marks - * U+0370 - U+03FF // Greek and Coptic - * U+0400 - U+04FF // Cyrillic - * U+0500 - U+052F // Cyrillic Supplement - * U+1D00 - U+1D7F // Phonetic Extensions - * U+1D80 - U+1DBF // Phonetic Extensions Supplement - * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement - * U+1E00 - U+1EFF // Latin Extended Additional - * U+1F00 - U+1FFF // Greek Extended - * U+2000 - U+206F // General Punctuation - * U+2070 - U+209F // Superscripts and Subscripts - * U+20A0 - U+20CF // Currency Symbols - * U+2150 - U+218F // Number Forms - * U+2460 - U+24FF // Enclosed Alphanumerics - * U+2C60 - U+2C7F // Latin Extended-C - * U+2DE0 - U+2DFF // Cyrillic Extended-A - * U+2E00 - U+2E7F // Supplemental Punctuation - * U+A640 - U+A69F // Cyrillic Extended-B - * U+A720 - U+A7FF // Latin Extended-D - * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) - * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols - * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_CJK :: - * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old - * Vietnamese, and some other scripts. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+1100 - U+11FF // Hangul Jamo - * U+2E80 - U+2EFF // CJK Radicals Supplement - * U+2F00 - U+2FDF // Kangxi Radicals - * U+2FF0 - U+2FFF // Ideographic Description Characters - * U+3000 - U+303F // CJK Symbols and Punctuation - * U+3040 - U+309F // Hiragana - * U+30A0 - U+30FF // Katakana - * U+3100 - U+312F // Bopomofo - * U+3130 - U+318F // Hangul Compatibility Jamo - * U+3190 - U+319F // Kanbun - * U+31A0 - U+31BF // Bopomofo Extended - * U+31C0 - U+31EF // CJK Strokes - * U+31F0 - U+31FF // Katakana Phonetic Extensions - * U+3200 - U+32FF // Enclosed CJK Letters and Months - * U+3300 - U+33FF // CJK Compatibility - * U+3400 - U+4DBF // CJK Unified Ideographs Extension A - * U+4DC0 - U+4DFF // Yijing Hexagram Symbols - * U+4E00 - U+9FFF // CJK Unified Ideographs - * U+A960 - U+A97F // Hangul Jamo Extended-A - * U+AC00 - U+D7AF // Hangul Syllables - * U+D7B0 - U+D7FF // Hangul Jamo Extended-B - * U+F900 - U+FAFF // CJK Compatibility Ideographs - * U+FE10 - U+FE1F // Vertical forms - * U+FE30 - U+FE4F // CJK Compatibility Forms - * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms - * U+1B000 - U+1B0FF // Kana Supplement - * U+1D300 - U+1D35F // Tai Xuan Hing Symbols - * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement - * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B - * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C - * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D - * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_INDIC :: - * Apply the indic auto-hinter, covering all major scripts from the - * Indian sub-continent and some other related scripts like Thai, Lao, - * or Tibetan. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0900 - U+0DFF // Indic Range - * U+0F00 - U+0FFF // Tibetan - * U+1900 - U+194F // Limbu - * U+1B80 - U+1BBF // Sundanese - * U+1C80 - U+1CDF // Meetei Mayak - * U+A800 - U+A82F // Syloti Nagri - * U+11800 - U+118DF // Sharada - * } - * - * Note that currently Indic support is rudimentary only, missing blue - * zone support. - * - */ -#define FT_AUTOHINTER_SCRIPT_NONE 0 -#define FT_AUTOHINTER_SCRIPT_LATIN 1 -#define FT_AUTOHINTER_SCRIPT_CJK 2 -#define FT_AUTOHINTER_SCRIPT_INDIC 3 - - - /************************************************************************** - * - * @struct: - * FT_Prop_GlyphToScriptMap - * - * @description: - * *Experimental* *only* - * - * The data exchange structure for the @glyph-to-script-map property. - * - */ - typedef struct FT_Prop_GlyphToScriptMap_ - { - FT_Face face; - FT_Byte* map; - - } FT_Prop_GlyphToScriptMap; - - - /************************************************************************** - * - * @property: - * fallback-script - * - * @description: - * *Experimental* *only* - * - * If no auto-hinter script module can be assigned to a glyph, a - * fallback script gets assigned to it (see also the - * @glyph-to-script-map property). By default, this is - * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, - * this fallback value can be changed. - * - * { - * FT_Library library; - * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "fallback-script", &fallback_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * fallback script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the fallback script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * default-script - * - * @description: - * *Experimental* *only* - * - * If Freetype gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make - * the HarfBuzz library access OpenType features for getting better - * glyph coverages, this property sets the (auto-fitter) script to be - * used for the default (OpenType) script data of a font's GSUB table. - * Features for the default script are intended for all scripts not - * explicitly handled in GSUB; an example is a `dlig' feature, - * containing the combination of the characters `T', `E', and `L' to - * form a `TEL' ligature. - * - * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the - * `default-script' property, this default value can be changed. - * - * { - * FT_Library library; - * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "default-script", &default_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * default script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the default script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * increase-x-height - * - * @description: - * For ppem values in the range 6~<= ppem <= `increase-x-height', round - * up the font's x~height much more often than normally. If the value - * is set to~0, which is the default, this feature is switched off. Use - * this property to improve the legibility of small font sizes if - * necessary. - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_IncreaseXHeight prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); - * - * prop.face = face; - * prop.limit = 14; - * - * FT_Property_Set( library, "autofitter", - * "increase-x-height", &prop ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * Set this value right after calling @FT_Set_Char_Size, but before - * loading any glyph (using the auto-hinter). - * - */ - - - /************************************************************************** - * - * @struct: - * FT_Prop_IncreaseXHeight - * - * @description: - * The data exchange structure for the @increase-x-height property. - * - */ - typedef struct FT_Prop_IncreaseXHeight_ - { - FT_Face face; - FT_UInt limit; - - } FT_Prop_IncreaseXHeight; - - - /* */ - -FT_END_HEADER - -#endif /* __FTAUTOH_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftbbox.h b/GLideN64/src/inc/freetype/include/ftbbox.h deleted file mode 100644 index 8938841..0000000 --- a/GLideN64/src/inc/freetype/include/ftbbox.h +++ /dev/null @@ -1,102 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftbbox.h */ -/* */ -/* FreeType exact bbox computation (specification). */ -/* */ -/* Copyright 1996-2001, 2003, 2007, 2011, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This component has a _single_ role: to compute exact outline bounding */ - /* boxes. */ - /* */ - /* It is separated from the rest of the engine for various technical */ - /* reasons. It may well be integrated in `ftoutln' later. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTBBOX_H__ -#define __FTBBOX_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* outline_processing */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Get_BBox */ - /* */ - /* <Description> */ - /* Compute the exact bounding box of an outline. This is slower */ - /* than computing the control box. However, it uses an advanced */ - /* algorithm that returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline Bézier arcs are traversed to */ - /* extract their extrema. */ - /* */ - /* <Input> */ - /* outline :: A pointer to the source outline. */ - /* */ - /* <Output> */ - /* abbox :: The outline's exact bounding box. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* If the font is tricky and the glyph has been loaded with */ - /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ - /* reasonable values for the BBox it is necessary to load the glyph */ - /* at a large ppem value (so that the hinting instructions can */ - /* properly shift and scale the subglyphs), then extracting the BBox, */ - /* which can be eventually converted back to font units. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Get_BBox( FT_Outline* outline, - FT_BBox *abbox ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTBBOX_H__ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/GLideN64/src/inc/freetype/include/ftbdf.h b/GLideN64/src/inc/freetype/include/ftbdf.h deleted file mode 100644 index 8b3c411..0000000 --- a/GLideN64/src/inc/freetype/include/ftbdf.h +++ /dev/null @@ -1,210 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftbdf.h */ -/* */ -/* FreeType API for accessing BDF-specific strings (specification). */ -/* */ -/* Copyright 2002-2004, 2006, 2009, 2014 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTBDF_H__ -#define __FTBDF_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* bdf_fonts */ - /* */ - /* <Title> */ - /* BDF and PCF Files */ - /* */ - /* <Abstract> */ - /* BDF and PCF specific API. */ - /* */ - /* <Description> */ - /* This section contains the declaration of functions specific to BDF */ - /* and PCF fonts. */ - /* */ - /*************************************************************************/ - - - /********************************************************************** - * - * @enum: - * FT_PropertyType - * - * @description: - * A list of BDF property types. - * - * @values: - * BDF_PROPERTY_TYPE_NONE :: - * Value~0 is used to indicate a missing property. - * - * BDF_PROPERTY_TYPE_ATOM :: - * Property is a string atom. - * - * BDF_PROPERTY_TYPE_INTEGER :: - * Property is a 32-bit signed integer. - * - * BDF_PROPERTY_TYPE_CARDINAL :: - * Property is a 32-bit unsigned integer. - */ - typedef enum BDF_PropertyType_ - { - BDF_PROPERTY_TYPE_NONE = 0, - BDF_PROPERTY_TYPE_ATOM = 1, - BDF_PROPERTY_TYPE_INTEGER = 2, - BDF_PROPERTY_TYPE_CARDINAL = 3 - - } BDF_PropertyType; - - - /********************************************************************** - * - * @type: - * BDF_Property - * - * @description: - * A handle to a @BDF_PropertyRec structure to model a given - * BDF/PCF property. - */ - typedef struct BDF_PropertyRec_* BDF_Property; - - - /********************************************************************** - * - * @struct: - * BDF_PropertyRec - * - * @description: - * This structure models a given BDF/PCF property. - * - * @fields: - * type :: - * The property type. - * - * u.atom :: - * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be - * NULL, indicating an empty string. - * - * u.integer :: - * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. - * - * u.cardinal :: - * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. - */ - typedef struct BDF_PropertyRec_ - { - BDF_PropertyType type; - union { - const char* atom; - FT_Int32 integer; - FT_UInt32 cardinal; - - } u; - - } BDF_PropertyRec; - - - /********************************************************************** - * - * @function: - * FT_Get_BDF_Charset_ID - * - * @description: - * Retrieve a BDF font character set identity, according to - * the BDF specification. - * - * @input: - * face :: - * A handle to the input face. - * - * @output: - * acharset_encoding :: - * Charset encoding, as a C~string, owned by the face. - * - * acharset_registry :: - * Charset registry, as a C~string, owned by the face. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with BDF faces, returning an error otherwise. - */ - FT_EXPORT( FT_Error ) - FT_Get_BDF_Charset_ID( FT_Face face, - const char* *acharset_encoding, - const char* *acharset_registry ); - - - /********************************************************************** - * - * @function: - * FT_Get_BDF_Property - * - * @description: - * Retrieve a BDF property from a BDF or PCF font file. - * - * @input: - * face :: A handle to the input face. - * - * name :: The property name. - * - * @output: - * aproperty :: The property. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function works with BDF _and_ PCF fonts. It returns an error - * otherwise. It also returns an error if the property is not in the - * font. - * - * A `property' is a either key-value pair within the STARTPROPERTIES - * ... ENDPROPERTIES block of a BDF font or a key-value pair from the - * `info->props' array within a `FontRec' structure of a PCF font. - * - * Integer properties are always stored as `signed' within PCF fonts; - * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value - * for BDF fonts only. - * - * In case of error, `aproperty->type' is always set to - * @BDF_PROPERTY_TYPE_NONE. - */ - FT_EXPORT( FT_Error ) - FT_Get_BDF_Property( FT_Face face, - const char* prop_name, - BDF_PropertyRec *aproperty ); - - /* */ - -FT_END_HEADER - -#endif /* __FTBDF_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftbitmap.h b/GLideN64/src/inc/freetype/include/ftbitmap.h deleted file mode 100644 index 7dbf5ba..0000000 --- a/GLideN64/src/inc/freetype/include/ftbitmap.h +++ /dev/null @@ -1,227 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftbitmap.h */ -/* */ -/* FreeType utility functions for bitmaps (specification). */ -/* */ -/* Copyright 2004-2006, 2008, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTBITMAP_H__ -#define __FTBITMAP_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* bitmap_handling */ - /* */ - /* <Title> */ - /* Bitmap Handling */ - /* */ - /* <Abstract> */ - /* Handling FT_Bitmap objects. */ - /* */ - /* <Description> */ - /* This section contains functions for converting FT_Bitmap objects. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Bitmap_New */ - /* */ - /* <Description> */ - /* Initialize a pointer to an @FT_Bitmap structure. */ - /* */ - /* <InOut> */ - /* abitmap :: A pointer to the bitmap structure. */ - /* */ - FT_EXPORT( void ) - FT_Bitmap_New( FT_Bitmap *abitmap ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Bitmap_Copy */ - /* */ - /* <Description> */ - /* Copy a bitmap into another one. */ - /* */ - /* <Input> */ - /* library :: A handle to a library object. */ - /* */ - /* source :: A handle to the source bitmap. */ - /* */ - /* <Output> */ - /* target :: A handle to the target bitmap. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Bitmap_Copy( FT_Library library, - const FT_Bitmap *source, - FT_Bitmap *target); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Bitmap_Embolden */ - /* */ - /* <Description> */ - /* Embolden a bitmap. The new bitmap will be about `xStrength' */ - /* pixels wider and `yStrength' pixels higher. The left and bottom */ - /* borders are kept unchanged. */ - /* */ - /* <Input> */ - /* library :: A handle to a library object. */ - /* */ - /* xStrength :: How strong the glyph is emboldened horizontally. */ - /* Expressed in 26.6 pixel format. */ - /* */ - /* yStrength :: How strong the glyph is emboldened vertically. */ - /* Expressed in 26.6 pixel format. */ - /* */ - /* <InOut> */ - /* bitmap :: A handle to the target bitmap. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The current implementation restricts `xStrength' to be less than */ - /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ - /* */ - /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */ - /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Bitmap_Embolden( FT_Library library, - FT_Bitmap* bitmap, - FT_Pos xStrength, - FT_Pos yStrength ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Bitmap_Convert */ - /* */ - /* <Description> */ - /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */ - /* to a bitmap object with depth 8bpp, making the number of used */ - /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */ - /* */ - /* <Input> */ - /* library :: A handle to a library object. */ - /* */ - /* source :: The source bitmap. */ - /* */ - /* alignment :: The pitch of the bitmap is a multiple of this */ - /* parameter. Common values are 1, 2, or 4. */ - /* */ - /* <Output> */ - /* target :: The target bitmap. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* It is possible to call @FT_Bitmap_Convert multiple times without */ - /* calling @FT_Bitmap_Done (the memory is simply reallocated). */ - /* */ - /* Use @FT_Bitmap_Done to finally remove the bitmap object. */ - /* */ - /* The `library' argument is taken to have access to FreeType's */ - /* memory handling functions. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Bitmap_Convert( FT_Library library, - const FT_Bitmap *source, - FT_Bitmap *target, - FT_Int alignment ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_GlyphSlot_Own_Bitmap */ - /* */ - /* <Description> */ - /* Make sure that a glyph slot owns `slot->bitmap'. */ - /* */ - /* <Input> */ - /* slot :: The glyph slot. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function is to be used in combination with */ - /* @FT_Bitmap_Embolden. */ - /* */ - FT_EXPORT( FT_Error ) - FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Bitmap_Done */ - /* */ - /* <Description> */ - /* Destroy a bitmap object created with @FT_Bitmap_New. */ - /* */ - /* <Input> */ - /* library :: A handle to a library object. */ - /* */ - /* bitmap :: The bitmap object to be freed. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The `library' argument is taken to have access to FreeType's */ - /* memory handling functions. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Bitmap_Done( FT_Library library, - FT_Bitmap *bitmap ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTBITMAP_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftbzip2.h b/GLideN64/src/inc/freetype/include/ftbzip2.h deleted file mode 100644 index 1bf81b1..0000000 --- a/GLideN64/src/inc/freetype/include/ftbzip2.h +++ /dev/null @@ -1,102 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftbzip2.h */ -/* */ -/* Bzip2-compressed stream support. */ -/* */ -/* Copyright 2010 by */ -/* Joel Klinghed. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTBZIP2_H__ -#define __FTBZIP2_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* bzip2 */ - /* */ - /* <Title> */ - /* BZIP2 Streams */ - /* */ - /* <Abstract> */ - /* Using bzip2-compressed font files. */ - /* */ - /* <Description> */ - /* This section contains the declaration of Bzip2-specific functions. */ - /* */ - /*************************************************************************/ - - - /************************************************************************ - * - * @function: - * FT_Stream_OpenBzip2 - * - * @description: - * Open a new stream to parse bzip2-compressed font files. This is - * mainly used to support the compressed `*.pcf.bz2' fonts that come - * with XFree86. - * - * @input: - * stream :: - * The target embedding stream. - * - * source :: - * The source stream. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The source stream must be opened _before_ calling this function. - * - * Calling the internal function `FT_Stream_Close' on the new stream will - * *not* call `FT_Stream_Close' on the source stream. None of the stream - * objects will be released to the heap. - * - * The stream implementation is very basic and resets the decompression - * process each time seeking backwards is needed within the stream. - * - * In certain builds of the library, bzip2 compression recognition is - * automatically handled when calling @FT_New_Face or @FT_Open_Face. - * This means that if no font driver is capable of handling the raw - * compressed file, the library will try to open a bzip2 compressed stream - * from it and re-open the face with it. - * - * This function may return `FT_Err_Unimplemented_Feature' if your build - * of FreeType was not compiled with bzip2 support. - */ - FT_EXPORT( FT_Error ) - FT_Stream_OpenBzip2( FT_Stream stream, - FT_Stream source ); - - /* */ - - -FT_END_HEADER - -#endif /* __FTBZIP2_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftcache.h b/GLideN64/src/inc/freetype/include/ftcache.h deleted file mode 100644 index a5d7100..0000000 --- a/GLideN64/src/inc/freetype/include/ftcache.h +++ /dev/null @@ -1,1057 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcache.h */ -/* */ -/* FreeType Cache subsystem (specification). */ -/* */ -/* Copyright 1996-2008, 2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTCACHE_H__ -#define __FTCACHE_H__ - - -#include <ft2build.h> -#include FT_GLYPH_H - - -FT_BEGIN_HEADER - - - /************************************************************************* - * - * <Section> - * cache_subsystem - * - * <Title> - * Cache Sub-System - * - * <Abstract> - * How to cache face, size, and glyph data with FreeType~2. - * - * <Description> - * This section describes the FreeType~2 cache sub-system, which is used - * to limit the number of concurrently opened @FT_Face and @FT_Size - * objects, as well as caching information like character maps and glyph - * images while limiting their maximum memory usage. - * - * Note that all types and functions begin with the `FTC_' prefix. - * - * The cache is highly portable and thus doesn't know anything about the - * fonts installed on your system, or how to access them. This implies - * the following scheme: - * - * First, available or installed font faces are uniquely identified by - * @FTC_FaceID values, provided to the cache by the client. Note that - * the cache only stores and compares these values, and doesn't try to - * interpret them in any way. - * - * Second, the cache calls, only when needed, a client-provided function - * to convert an @FTC_FaceID into a new @FT_Face object. The latter is - * then completely managed by the cache, including its termination - * through @FT_Done_Face. To monitor termination of face objects, the - * finalizer callback in the `generic' field of the @FT_Face object can - * be used, which might also be used to store the @FTC_FaceID of the - * face. - * - * Clients are free to map face IDs to anything else. The most simple - * usage is to associate them to a (pathname,face_index) pair that is - * used to call @FT_New_Face. However, more complex schemes are also - * possible. - * - * Note that for the cache to work correctly, the face ID values must be - * *persistent*, which means that the contents they point to should not - * change at runtime, or that their value should not become invalid. - * - * If this is unavoidable (e.g., when a font is uninstalled at runtime), - * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let - * the cache get rid of any references to the old @FTC_FaceID it may - * keep internally. Failure to do so will lead to incorrect behaviour - * or even crashes. - * - * To use the cache, start with calling @FTC_Manager_New to create a new - * @FTC_Manager object, which models a single cache instance. You can - * then look up @FT_Face and @FT_Size objects with - * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively. - * - * If you want to use the charmap caching, call @FTC_CMapCache_New, then - * later use @FTC_CMapCache_Lookup to perform the equivalent of - * @FT_Get_Char_Index, only much faster. - * - * If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then - * later use @FTC_ImageCache_Lookup to retrieve the corresponding - * @FT_Glyph objects from the cache. - * - * If you need lots of small bitmaps, it is much more memory efficient - * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This - * returns @FTC_SBitRec structures, which are used to store small - * bitmaps directly. (A small bitmap is one whose metrics and - * dimensions all fit into 8-bit integers). - * - * We hope to also provide a kerning cache in the near future. - * - * - * <Order> - * FTC_Manager - * FTC_FaceID - * FTC_Face_Requester - * - * FTC_Manager_New - * FTC_Manager_Reset - * FTC_Manager_Done - * FTC_Manager_LookupFace - * FTC_Manager_LookupSize - * FTC_Manager_RemoveFaceID - * - * FTC_Node - * FTC_Node_Unref - * - * FTC_ImageCache - * FTC_ImageCache_New - * FTC_ImageCache_Lookup - * - * FTC_SBit - * FTC_SBitCache - * FTC_SBitCache_New - * FTC_SBitCache_Lookup - * - * FTC_CMapCache - * FTC_CMapCache_New - * FTC_CMapCache_Lookup - * - *************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** BASIC TYPE DEFINITIONS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /************************************************************************* - * - * @type: FTC_FaceID - * - * @description: - * An opaque pointer type that is used to identity face objects. The - * contents of such objects is application-dependent. - * - * These pointers are typically used to point to a user-defined - * structure containing a font file path, and face index. - * - * @note: - * Never use NULL as a valid @FTC_FaceID. - * - * Face IDs are passed by the client to the cache manager that calls, - * when needed, the @FTC_Face_Requester to translate them into new - * @FT_Face objects. - * - * If the content of a given face ID changes at runtime, or if the value - * becomes invalid (e.g., when uninstalling a font), you should - * immediately call @FTC_Manager_RemoveFaceID before any other cache - * function. - * - * Failure to do so will result in incorrect behaviour or even - * memory leaks and crashes. - */ - typedef FT_Pointer FTC_FaceID; - - - /************************************************************************ - * - * @functype: - * FTC_Face_Requester - * - * @description: - * A callback function provided by client applications. It is used by - * the cache manager to translate a given @FTC_FaceID into a new valid - * @FT_Face object, on demand. - * - * <Input> - * face_id :: - * The face ID to resolve. - * - * library :: - * A handle to a FreeType library object. - * - * req_data :: - * Application-provided request data (see note below). - * - * <Output> - * aface :: - * A new @FT_Face handle. - * - * <Return> - * FreeType error code. 0~means success. - * - * <Note> - * The third parameter `req_data' is the same as the one passed by the - * client when @FTC_Manager_New is called. - * - * The face requester should not perform funny things on the returned - * face object, like creating a new @FT_Size for it, or setting a - * transformation through @FT_Set_Transform! - */ - typedef FT_Error - (*FTC_Face_Requester)( FTC_FaceID face_id, - FT_Library library, - FT_Pointer request_data, - FT_Face* aface ); - - /* */ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** CACHE MANAGER OBJECT *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FTC_Manager */ - /* */ - /* <Description> */ - /* This object corresponds to one instance of the cache-subsystem. */ - /* It is used to cache one or more @FT_Face objects, along with */ - /* corresponding @FT_Size objects. */ - /* */ - /* The manager intentionally limits the total number of opened */ - /* @FT_Face and @FT_Size objects to control memory usage. See the */ - /* `max_faces' and `max_sizes' parameters of @FTC_Manager_New. */ - /* */ - /* The manager is also used to cache `nodes' of various types while */ - /* limiting their total memory usage. */ - /* */ - /* All limitations are enforced by keeping lists of managed objects */ - /* in most-recently-used order, and flushing old nodes to make room */ - /* for new ones. */ - /* */ - typedef struct FTC_ManagerRec_* FTC_Manager; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FTC_Node */ - /* */ - /* <Description> */ - /* An opaque handle to a cache node object. Each cache node is */ - /* reference-counted. A node with a count of~0 might be flushed */ - /* out of a full cache whenever a lookup request is performed. */ - /* */ - /* If you look up nodes, you have the ability to `acquire' them, */ - /* i.e., to increment their reference count. This will prevent the */ - /* node from being flushed out of the cache until you explicitly */ - /* `release' it (see @FTC_Node_Unref). */ - /* */ - /* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */ - /* */ - typedef struct FTC_NodeRec_* FTC_Node; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_Manager_New */ - /* */ - /* <Description> */ - /* Create a new cache manager. */ - /* */ - /* <Input> */ - /* library :: The parent FreeType library handle to use. */ - /* */ - /* max_faces :: Maximum number of opened @FT_Face objects managed by */ - /* this cache instance. Use~0 for defaults. */ - /* */ - /* max_sizes :: Maximum number of opened @FT_Size objects managed by */ - /* this cache instance. Use~0 for defaults. */ - /* */ - /* max_bytes :: Maximum number of bytes to use for cached data nodes. */ - /* Use~0 for defaults. Note that this value does not */ - /* account for managed @FT_Face and @FT_Size objects. */ - /* */ - /* requester :: An application-provided callback used to translate */ - /* face IDs into real @FT_Face objects. */ - /* */ - /* req_data :: A generic pointer that is passed to the requester */ - /* each time it is called (see @FTC_Face_Requester). */ - /* */ - /* <Output> */ - /* amanager :: A handle to a new manager object. 0~in case of */ - /* failure. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FTC_Manager_New( FT_Library library, - FT_UInt max_faces, - FT_UInt max_sizes, - FT_ULong max_bytes, - FTC_Face_Requester requester, - FT_Pointer req_data, - FTC_Manager *amanager ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_Manager_Reset */ - /* */ - /* <Description> */ - /* Empty a given cache manager. This simply gets rid of all the */ - /* currently cached @FT_Face and @FT_Size objects within the manager. */ - /* */ - /* <InOut> */ - /* manager :: A handle to the manager. */ - /* */ - FT_EXPORT( void ) - FTC_Manager_Reset( FTC_Manager manager ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_Manager_Done */ - /* */ - /* <Description> */ - /* Destroy a given manager after emptying it. */ - /* */ - /* <Input> */ - /* manager :: A handle to the target cache manager object. */ - /* */ - FT_EXPORT( void ) - FTC_Manager_Done( FTC_Manager manager ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_Manager_LookupFace */ - /* */ - /* <Description> */ - /* Retrieve the @FT_Face object that corresponds to a given face ID */ - /* through a cache manager. */ - /* */ - /* <Input> */ - /* manager :: A handle to the cache manager. */ - /* */ - /* face_id :: The ID of the face object. */ - /* */ - /* <Output> */ - /* aface :: A handle to the face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The returned @FT_Face object is always owned by the manager. You */ - /* should never try to discard it yourself. */ - /* */ - /* The @FT_Face object doesn't necessarily have a current size object */ - /* (i.e., face->size can be~0). If you need a specific `font size', */ - /* use @FTC_Manager_LookupSize instead. */ - /* */ - /* Never change the face's transformation matrix (i.e., never call */ - /* the @FT_Set_Transform function) on a returned face! If you need */ - /* to transform glyphs, do it yourself after glyph loading. */ - /* */ - /* When you perform a lookup, out-of-memory errors are detected */ - /* _within_ the lookup and force incremental flushes of the cache */ - /* until enough memory is released for the lookup to succeed. */ - /* */ - /* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */ - /* already been completely flushed, and still no memory was available */ - /* for the operation. */ - /* */ - FT_EXPORT( FT_Error ) - FTC_Manager_LookupFace( FTC_Manager manager, - FTC_FaceID face_id, - FT_Face *aface ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FTC_ScalerRec */ - /* */ - /* <Description> */ - /* A structure used to describe a given character size in either */ - /* pixels or points to the cache manager. See */ - /* @FTC_Manager_LookupSize. */ - /* */ - /* <Fields> */ - /* face_id :: The source face ID. */ - /* */ - /* width :: The character width. */ - /* */ - /* height :: The character height. */ - /* */ - /* pixel :: A Boolean. If 1, the `width' and `height' fields are */ - /* interpreted as integer pixel character sizes. */ - /* Otherwise, they are expressed as 1/64th of points. */ - /* */ - /* x_res :: Only used when `pixel' is value~0 to indicate the */ - /* horizontal resolution in dpi. */ - /* */ - /* y_res :: Only used when `pixel' is value~0 to indicate the */ - /* vertical resolution in dpi. */ - /* */ - /* <Note> */ - /* This type is mainly used to retrieve @FT_Size objects through the */ - /* cache manager. */ - /* */ - typedef struct FTC_ScalerRec_ - { - FTC_FaceID face_id; - FT_UInt width; - FT_UInt height; - FT_Int pixel; - FT_UInt x_res; - FT_UInt y_res; - - } FTC_ScalerRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FTC_Scaler */ - /* */ - /* <Description> */ - /* A handle to an @FTC_ScalerRec structure. */ - /* */ - typedef struct FTC_ScalerRec_* FTC_Scaler; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_Manager_LookupSize */ - /* */ - /* <Description> */ - /* Retrieve the @FT_Size object that corresponds to a given */ - /* @FTC_ScalerRec pointer through a cache manager. */ - /* */ - /* <Input> */ - /* manager :: A handle to the cache manager. */ - /* */ - /* scaler :: A scaler handle. */ - /* */ - /* <Output> */ - /* asize :: A handle to the size object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The returned @FT_Size object is always owned by the manager. You */ - /* should never try to discard it by yourself. */ - /* */ - /* You can access the parent @FT_Face object simply as `size->face' */ - /* if you need it. Note that this object is also owned by the */ - /* manager. */ - /* */ - /* <Note> */ - /* When you perform a lookup, out-of-memory errors are detected */ - /* _within_ the lookup and force incremental flushes of the cache */ - /* until enough memory is released for the lookup to succeed. */ - /* */ - /* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */ - /* already been completely flushed, and still no memory is available */ - /* for the operation. */ - /* */ - FT_EXPORT( FT_Error ) - FTC_Manager_LookupSize( FTC_Manager manager, - FTC_Scaler scaler, - FT_Size *asize ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_Node_Unref */ - /* */ - /* <Description> */ - /* Decrement a cache node's internal reference count. When the count */ - /* reaches 0, it is not destroyed but becomes eligible for subsequent */ - /* cache flushes. */ - /* */ - /* <Input> */ - /* node :: The cache node handle. */ - /* */ - /* manager :: The cache manager handle. */ - /* */ - FT_EXPORT( void ) - FTC_Node_Unref( FTC_Node node, - FTC_Manager manager ); - - - /************************************************************************* - * - * @function: - * FTC_Manager_RemoveFaceID - * - * @description: - * A special function used to indicate to the cache manager that - * a given @FTC_FaceID is no longer valid, either because its - * content changed, or because it was deallocated or uninstalled. - * - * @input: - * manager :: - * The cache manager handle. - * - * face_id :: - * The @FTC_FaceID to be removed. - * - * @note: - * This function flushes all nodes from the cache corresponding to this - * `face_id', with the exception of nodes with a non-null reference - * count. - * - * Such nodes are however modified internally so as to never appear - * in later lookups with the same `face_id' value, and to be immediately - * destroyed when released by all their users. - * - */ - FT_EXPORT( void ) - FTC_Manager_RemoveFaceID( FTC_Manager manager, - FTC_FaceID face_id ); - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - - /************************************************************************* - * - * @type: - * FTC_CMapCache - * - * @description: - * An opaque handle used to model a charmap cache. This cache is to - * hold character codes -> glyph indices mappings. - * - */ - typedef struct FTC_CMapCacheRec_* FTC_CMapCache; - - - /************************************************************************* - * - * @function: - * FTC_CMapCache_New - * - * @description: - * Create a new charmap cache. - * - * @input: - * manager :: - * A handle to the cache manager. - * - * @output: - * acache :: - * A new cache handle. NULL in case of error. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * Like all other caches, this one will be destroyed with the cache - * manager. - * - */ - FT_EXPORT( FT_Error ) - FTC_CMapCache_New( FTC_Manager manager, - FTC_CMapCache *acache ); - - - /************************************************************************ - * - * @function: - * FTC_CMapCache_Lookup - * - * @description: - * Translate a character code into a glyph index, using the charmap - * cache. - * - * @input: - * cache :: - * A charmap cache handle. - * - * face_id :: - * The source face ID. - * - * cmap_index :: - * The index of the charmap in the source face. Any negative value - * means to use the cache @FT_Face's default charmap. - * - * char_code :: - * The character code (in the corresponding charmap). - * - * @return: - * Glyph index. 0~means `no glyph'. - * - */ - FT_EXPORT( FT_UInt ) - FTC_CMapCache_Lookup( FTC_CMapCache cache, - FTC_FaceID face_id, - FT_Int cmap_index, - FT_UInt32 char_code ); - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** IMAGE CACHE OBJECT *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /************************************************************************* - * - * @struct: - * FTC_ImageTypeRec - * - * @description: - * A structure used to model the type of images in a glyph cache. - * - * @fields: - * face_id :: - * The face ID. - * - * width :: - * The width in pixels. - * - * height :: - * The height in pixels. - * - * flags :: - * The load flags, as in @FT_Load_Glyph. - * - */ - typedef struct FTC_ImageTypeRec_ - { - FTC_FaceID face_id; - FT_Int width; - FT_Int height; - FT_Int32 flags; - - } FTC_ImageTypeRec; - - - /************************************************************************* - * - * @type: - * FTC_ImageType - * - * @description: - * A handle to an @FTC_ImageTypeRec structure. - * - */ - typedef struct FTC_ImageTypeRec_* FTC_ImageType; - - - /* */ - - -#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \ - ( (d1)->face_id == (d2)->face_id && \ - (d1)->width == (d2)->width && \ - (d1)->flags == (d2)->flags ) - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FTC_ImageCache */ - /* */ - /* <Description> */ - /* A handle to a glyph image cache object. They are designed to */ - /* hold many distinct glyph images while not exceeding a certain */ - /* memory threshold. */ - /* */ - typedef struct FTC_ImageCacheRec_* FTC_ImageCache; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_ImageCache_New */ - /* */ - /* <Description> */ - /* Create a new glyph image cache. */ - /* */ - /* <Input> */ - /* manager :: The parent manager for the image cache. */ - /* */ - /* <Output> */ - /* acache :: A handle to the new glyph image cache object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FTC_ImageCache_New( FTC_Manager manager, - FTC_ImageCache *acache ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_ImageCache_Lookup */ - /* */ - /* <Description> */ - /* Retrieve a given glyph image from a glyph image cache. */ - /* */ - /* <Input> */ - /* cache :: A handle to the source glyph image cache. */ - /* */ - /* type :: A pointer to a glyph image type descriptor. */ - /* */ - /* gindex :: The glyph index to retrieve. */ - /* */ - /* <Output> */ - /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */ - /* failure. */ - /* */ - /* anode :: Used to return the address of of the corresponding cache */ - /* node after incrementing its reference count (see note */ - /* below). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The returned glyph is owned and managed by the glyph image cache. */ - /* Never try to transform or discard it manually! You can however */ - /* create a copy with @FT_Glyph_Copy and modify the new one. */ - /* */ - /* If `anode' is _not_ NULL, it receives the address of the cache */ - /* node containing the glyph image, after increasing its reference */ - /* count. This ensures that the node (as well as the @FT_Glyph) will */ - /* always be kept in the cache until you call @FTC_Node_Unref to */ - /* `release' it. */ - /* */ - /* If `anode' is NULL, the cache node is left unchanged, which means */ - /* that the @FT_Glyph could be flushed out of the cache on the next */ - /* call to one of the caching sub-system APIs. Don't assume that it */ - /* is persistent! */ - /* */ - FT_EXPORT( FT_Error ) - FTC_ImageCache_Lookup( FTC_ImageCache cache, - FTC_ImageType type, - FT_UInt gindex, - FT_Glyph *aglyph, - FTC_Node *anode ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_ImageCache_LookupScaler */ - /* */ - /* <Description> */ - /* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec */ - /* to specify the face ID and its size. */ - /* */ - /* <Input> */ - /* cache :: A handle to the source glyph image cache. */ - /* */ - /* scaler :: A pointer to a scaler descriptor. */ - /* */ - /* load_flags :: The corresponding load flags. */ - /* */ - /* gindex :: The glyph index to retrieve. */ - /* */ - /* <Output> */ - /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */ - /* failure. */ - /* */ - /* anode :: Used to return the address of of the corresponding */ - /* cache node after incrementing its reference count */ - /* (see note below). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The returned glyph is owned and managed by the glyph image cache. */ - /* Never try to transform or discard it manually! You can however */ - /* create a copy with @FT_Glyph_Copy and modify the new one. */ - /* */ - /* If `anode' is _not_ NULL, it receives the address of the cache */ - /* node containing the glyph image, after increasing its reference */ - /* count. This ensures that the node (as well as the @FT_Glyph) will */ - /* always be kept in the cache until you call @FTC_Node_Unref to */ - /* `release' it. */ - /* */ - /* If `anode' is NULL, the cache node is left unchanged, which means */ - /* that the @FT_Glyph could be flushed out of the cache on the next */ - /* call to one of the caching sub-system APIs. Don't assume that it */ - /* is persistent! */ - /* */ - /* Calls to @FT_Set_Char_Size and friends have no effect on cached */ - /* glyphs; you should always use the FreeType cache API instead. */ - /* */ - FT_EXPORT( FT_Error ) - FTC_ImageCache_LookupScaler( FTC_ImageCache cache, - FTC_Scaler scaler, - FT_ULong load_flags, - FT_UInt gindex, - FT_Glyph *aglyph, - FTC_Node *anode ); - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FTC_SBit */ - /* */ - /* <Description> */ - /* A handle to a small bitmap descriptor. See the @FTC_SBitRec */ - /* structure for details. */ - /* */ - typedef struct FTC_SBitRec_* FTC_SBit; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FTC_SBitRec */ - /* */ - /* <Description> */ - /* A very compact structure used to describe a small glyph bitmap. */ - /* */ - /* <Fields> */ - /* width :: The bitmap width in pixels. */ - /* */ - /* height :: The bitmap height in pixels. */ - /* */ - /* left :: The horizontal distance from the pen position to the */ - /* left bitmap border (a.k.a. `left side bearing', or */ - /* `lsb'). */ - /* */ - /* top :: The vertical distance from the pen position (on the */ - /* baseline) to the upper bitmap border (a.k.a. `top */ - /* side bearing'). The distance is positive for upwards */ - /* y~coordinates. */ - /* */ - /* format :: The format of the glyph bitmap (monochrome or gray). */ - /* */ - /* max_grays :: Maximum gray level value (in the range 1 to~255). */ - /* */ - /* pitch :: The number of bytes per bitmap line. May be positive */ - /* or negative. */ - /* */ - /* xadvance :: The horizontal advance width in pixels. */ - /* */ - /* yadvance :: The vertical advance height in pixels. */ - /* */ - /* buffer :: A pointer to the bitmap pixels. */ - /* */ - typedef struct FTC_SBitRec_ - { - FT_Byte width; - FT_Byte height; - FT_Char left; - FT_Char top; - - FT_Byte format; - FT_Byte max_grays; - FT_Short pitch; - FT_Char xadvance; - FT_Char yadvance; - - FT_Byte* buffer; - - } FTC_SBitRec; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FTC_SBitCache */ - /* */ - /* <Description> */ - /* A handle to a small bitmap cache. These are special cache objects */ - /* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */ - /* much more efficient way than the traditional glyph image cache */ - /* implemented by @FTC_ImageCache. */ - /* */ - typedef struct FTC_SBitCacheRec_* FTC_SBitCache; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_SBitCache_New */ - /* */ - /* <Description> */ - /* Create a new cache to store small glyph bitmaps. */ - /* */ - /* <Input> */ - /* manager :: A handle to the source cache manager. */ - /* */ - /* <Output> */ - /* acache :: A handle to the new sbit cache. NULL in case of error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FTC_SBitCache_New( FTC_Manager manager, - FTC_SBitCache *acache ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_SBitCache_Lookup */ - /* */ - /* <Description> */ - /* Look up a given small glyph bitmap in a given sbit cache and */ - /* `lock' it to prevent its flushing from the cache until needed. */ - /* */ - /* <Input> */ - /* cache :: A handle to the source sbit cache. */ - /* */ - /* type :: A pointer to the glyph image type descriptor. */ - /* */ - /* gindex :: The glyph index. */ - /* */ - /* <Output> */ - /* sbit :: A handle to a small bitmap descriptor. */ - /* */ - /* anode :: Used to return the address of of the corresponding cache */ - /* node after incrementing its reference count (see note */ - /* below). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The small bitmap descriptor and its bit buffer are owned by the */ - /* cache and should never be freed by the application. They might */ - /* as well disappear from memory on the next cache lookup, so don't */ - /* treat them as persistent data. */ - /* */ - /* The descriptor's `buffer' field is set to~0 to indicate a missing */ - /* glyph bitmap. */ - /* */ - /* If `anode' is _not_ NULL, it receives the address of the cache */ - /* node containing the bitmap, after increasing its reference count. */ - /* This ensures that the node (as well as the image) will always be */ - /* kept in the cache until you call @FTC_Node_Unref to `release' it. */ - /* */ - /* If `anode' is NULL, the cache node is left unchanged, which means */ - /* that the bitmap could be flushed out of the cache on the next */ - /* call to one of the caching sub-system APIs. Don't assume that it */ - /* is persistent! */ - /* */ - FT_EXPORT( FT_Error ) - FTC_SBitCache_Lookup( FTC_SBitCache cache, - FTC_ImageType type, - FT_UInt gindex, - FTC_SBit *sbit, - FTC_Node *anode ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FTC_SBitCache_LookupScaler */ - /* */ - /* <Description> */ - /* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec */ - /* to specify the face ID and its size. */ - /* */ - /* <Input> */ - /* cache :: A handle to the source sbit cache. */ - /* */ - /* scaler :: A pointer to the scaler descriptor. */ - /* */ - /* load_flags :: The corresponding load flags. */ - /* */ - /* gindex :: The glyph index. */ - /* */ - /* <Output> */ - /* sbit :: A handle to a small bitmap descriptor. */ - /* */ - /* anode :: Used to return the address of of the corresponding */ - /* cache node after incrementing its reference count */ - /* (see note below). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The small bitmap descriptor and its bit buffer are owned by the */ - /* cache and should never be freed by the application. They might */ - /* as well disappear from memory on the next cache lookup, so don't */ - /* treat them as persistent data. */ - /* */ - /* The descriptor's `buffer' field is set to~0 to indicate a missing */ - /* glyph bitmap. */ - /* */ - /* If `anode' is _not_ NULL, it receives the address of the cache */ - /* node containing the bitmap, after increasing its reference count. */ - /* This ensures that the node (as well as the image) will always be */ - /* kept in the cache until you call @FTC_Node_Unref to `release' it. */ - /* */ - /* If `anode' is NULL, the cache node is left unchanged, which means */ - /* that the bitmap could be flushed out of the cache on the next */ - /* call to one of the caching sub-system APIs. Don't assume that it */ - /* is persistent! */ - /* */ - FT_EXPORT( FT_Error ) - FTC_SBitCache_LookupScaler( FTC_SBitCache cache, - FTC_Scaler scaler, - FT_ULong load_flags, - FT_UInt gindex, - FTC_SBit *sbit, - FTC_Node *anode ); - - - /* */ - -FT_END_HEADER - -#endif /* __FTCACHE_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftcffdrv.h b/GLideN64/src/inc/freetype/include/ftcffdrv.h deleted file mode 100644 index e4d039d..0000000 --- a/GLideN64/src/inc/freetype/include/ftcffdrv.h +++ /dev/null @@ -1,254 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcffdrv.h */ -/* */ -/* FreeType API for controlling the CFF driver (specification only). */ -/* */ -/* Copyright 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTCFFDRV_H__ -#define __FTCFFDRV_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * cff_driver - * - * @title: - * The CFF driver - * - * @abstract: - * Controlling the CFF driver module. - * - * @description: - * While FreeType's CFF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The list below gives the available properties - * together with the necessary macros and structures. - * - * The CFF driver's module name is `cff'. - * - * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* - * - * The rasterizer is positioning horizontal features (e.g., ascender - * height & x-height, or crossbars) on the pixel grid and minimizing the - * amount of antialiasing applied to them, while placing vertical - * features (vertical stems) on the pixel grid without hinting, thus - * representing the stem position and weight accurately. Sometimes the - * vertical stems may be only partially black. In this context, - * `antialiasing' means that stems are not positioned exactly on pixel - * borders, causing a fuzzy appearance. - * - * There are two principles behind this approach. - * - * 1) No hinting in the horizontal direction: Unlike `superhinted' - * TrueType, which changes glyph widths to accommodate regular - * inter-glyph spacing, Adobe's approach is `faithful to the design' in - * representing both the glyph width and the inter-glyph spacing - * designed for the font. This makes the screen display as close as it - * can be to the result one would get with infinite resolution, while - * preserving what is considered the key characteristics of each glyph. - * Note that the distances between unhinted and grid-fitted positions at - * small sizes are comparable to kerning values and thus would be - * noticeable (and distracting) while reading if hinting were applied. - * - * One of the reasons to not hint horizontally is antialiasing for LCD - * screens: The pixel geometry of modern displays supplies three - * vertical sub-pixels as the eye moves horizontally across each visible - * pixel. On devices where we can be certain this characteristic is - * present a rasterizer can take advantage of the sub-pixels to add - * increments of weight. In Western writing systems this turns out to - * be the more critical direction anyway; the weights and spacing of - * vertical stems (see above) are central to Armenian, Cyrillic, Greek, - * and Latin type designs. Even when the rasterizer uses greyscale - * antialiasing instead of color (a necessary compromise when one - * doesn't know the screen characteristics), the unhinted vertical - * features preserve the design's weight and spacing much better than - * aliased type would. - * - * 2) Aligment in the vertical direction: Weights and spacing along the - * y~axis are less critical; what is much more important is the visual - * alignment of related features (like cap-height and x-height). The - * sense of alignment for these is enhanced by the sharpness of grid-fit - * edges, while the cruder vertical resolution (full pixels instead of - * 1/3 pixels) is less of a problem. - * - * On the technical side, horizontal alignment zones for ascender, - * x-height, and other important height values (traditionally called - * `blue zones') as defined in the font are positioned independently, - * each being rounded to the nearest pixel edge, taking care of - * overshoot suppression at small sizes, stem darkening, and scaling. - * - * Hstems (this is, hint values defined in the font to help align - * horizontal features) that fall within a blue zone are said to be - * `captured' and are aligned to that zone. Uncaptured stems are moved - * in one of four ways, top edge up or down, bottom edge up or down. - * Unless there are conflicting hstems, the smallest movement is taken - * to minimize distortion. - */ - - - /************************************************************************** - * - * @property: - * hinting-engine - * - * @description: - * Thanks to Adobe, which contributed a new hinting (and parsing) - * engine, an application can select between `freetype' and `adobe' if - * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration - * macro isn't defined, `hinting-engine' does nothing. - * - * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is - * defined, and `adobe' otherwise. - * - * The following example code demonstrates how to select Adobe's hinting - * engine (omitting the error handling). - * - * { - * FT_Library library; - * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "hinting-engine", &hinting_engine ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - */ - - - /************************************************************************** - * - * @enum: - * FT_CFF_HINTING_XXX - * - * @description: - * A list of constants used for the @hinting-engine property to select - * the hinting engine for CFF fonts. - * - * @values: - * FT_CFF_HINTING_FREETYPE :: - * Use the old FreeType hinting engine. - * - * FT_CFF_HINTING_ADOBE :: - * Use the hinting engine contributed by Adobe. - * - */ -#define FT_CFF_HINTING_FREETYPE 0 -#define FT_CFF_HINTING_ADOBE 1 - - - /************************************************************************** - * - * @property: - * no-stem-darkening - * - * @description: - * By default, the Adobe CFF engine darkens stems at smaller sizes, - * regardless of hinting, to enhance contrast. This feature requires - * a rendering system with proper gamma correction. Setting this - * property, stem darkening gets switched off. - * - * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. - * - * { - * FT_Library library; - * FT_Bool no_stem_darkening = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "no-stem-darkening", &no_stem_darkening ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - */ - - - /************************************************************************** - * - * @property: - * darkening-parameters - * - * @description: - * By default, the Adobe CFF engine darkens stems as follows (if the - * `no-stem-darkening' property isn't set): - * - * { - * stem width <= 0.5px: darkening amount = 0.4px - * stem width = 1px: darkening amount = 0.275px - * stem width = 1.667px: darkening amount = 0.275px - * stem width >= 2.333px: darkening amount = 0px - * } - * - * and piecewise linear in-between. Using the `darkening-parameters' - * property, these four control points can be changed, as the following - * example demonstrates. - * - * { - * FT_Library library; - * FT_Int darken_params[8] = { 500, 300, // x1, y1 - * 1000, 200, // x2, y2 - * 1500, 100, // x3, y3 - * 2000, 0 }; // x4, y4 - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "darkening-parameters", darken_params ); - * } - * - * The x~values give the stem width, and the y~values the darkening - * amount. The unit is 1000th of pixels. All coordinate values must be - * positive; the x~values must be monotonically increasing; the - * y~values must be monotonically decreasing and smaller than or - * equal to 500 (corresponding to half a pixel); the slope of each - * linear piece must be shallower than -1 (e.g., -.4). - * - * @note: - * This property can be used with @FT_Property_Get also. - * - */ - - - /* */ - -FT_END_HEADER - - -#endif /* __FTCFFDRV_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftchapters.h b/GLideN64/src/inc/freetype/include/ftchapters.h deleted file mode 100644 index d333761..0000000 --- a/GLideN64/src/inc/freetype/include/ftchapters.h +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************/ -/* */ -/* This file defines the structure of the FreeType reference. */ -/* It is used by the python script that generates the HTML files. */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* <Chapter> */ -/* general_remarks */ -/* */ -/* <Title> */ -/* General Remarks */ -/* */ -/* <Sections> */ -/* header_inclusion */ -/* user_allocation */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* <Chapter> */ -/* core_api */ -/* */ -/* <Title> */ -/* Core API */ -/* */ -/* <Sections> */ -/* version */ -/* basic_types */ -/* base_interface */ -/* glyph_variants */ -/* glyph_management */ -/* mac_specific */ -/* sizes_management */ -/* header_file_macros */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* <Chapter> */ -/* format_specific */ -/* */ -/* <Title> */ -/* Format-Specific API */ -/* */ -/* <Sections> */ -/* multiple_masters */ -/* truetype_tables */ -/* type1_tables */ -/* sfnt_names */ -/* bdf_fonts */ -/* cid_fonts */ -/* pfr_fonts */ -/* winfnt_fonts */ -/* font_formats */ -/* gasp_table */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* <Chapter> */ -/* module_specific */ -/* */ -/* <Title> */ -/* Controlling FreeType Modules */ -/* */ -/* <Sections> */ -/* auto_hinter */ -/* cff_driver */ -/* tt_driver */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* <Chapter> */ -/* cache_subsystem */ -/* */ -/* <Title> */ -/* Cache Sub-System */ -/* */ -/* <Sections> */ -/* cache_subsystem */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* <Chapter> */ -/* support_api */ -/* */ -/* <Title> */ -/* Support API */ -/* */ -/* <Sections> */ -/* computations */ -/* list_processing */ -/* outline_processing */ -/* quick_advance */ -/* bitmap_handling */ -/* raster */ -/* glyph_stroker */ -/* system_interface */ -/* module_management */ -/* gzip */ -/* lzw */ -/* bzip2 */ -/* lcd_filtering */ -/* */ -/***************************************************************************/ diff --git a/GLideN64/src/inc/freetype/include/ftcid.h b/GLideN64/src/inc/freetype/include/ftcid.h deleted file mode 100644 index 203a30c..0000000 --- a/GLideN64/src/inc/freetype/include/ftcid.h +++ /dev/null @@ -1,166 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcid.h */ -/* */ -/* FreeType API for accessing CID font information (specification). */ -/* */ -/* Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTCID_H__ -#define __FTCID_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* cid_fonts */ - /* */ - /* <Title> */ - /* CID Fonts */ - /* */ - /* <Abstract> */ - /* CID-keyed font specific API. */ - /* */ - /* <Description> */ - /* This section contains the declaration of CID-keyed font specific */ - /* functions. */ - /* */ - /*************************************************************************/ - - - /********************************************************************** - * - * @function: - * FT_Get_CID_Registry_Ordering_Supplement - * - * @description: - * Retrieve the Registry/Ordering/Supplement triple (also known as the - * "R/O/S") from a CID-keyed font. - * - * @input: - * face :: - * A handle to the input face. - * - * @output: - * registry :: - * The registry, as a C~string, owned by the face. - * - * ordering :: - * The ordering, as a C~string, owned by the face. - * - * supplement :: - * The supplement. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with CID faces, returning an error - * otherwise. - * - * @since: - * 2.3.6 - */ - FT_EXPORT( FT_Error ) - FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, - const char* *registry, - const char* *ordering, - FT_Int *supplement); - - - /********************************************************************** - * - * @function: - * FT_Get_CID_Is_Internally_CID_Keyed - * - * @description: - * Retrieve the type of the input face, CID keyed or not. In - * constrast to the @FT_IS_CID_KEYED macro this function returns - * successfully also for CID-keyed fonts in an SNFT wrapper. - * - * @input: - * face :: - * A handle to the input face. - * - * @output: - * is_cid :: - * The type of the face as an @FT_Bool. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with CID faces and OpenType fonts, - * returning an error otherwise. - * - * @since: - * 2.3.9 - */ - FT_EXPORT( FT_Error ) - FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, - FT_Bool *is_cid ); - - - /********************************************************************** - * - * @function: - * FT_Get_CID_From_Glyph_Index - * - * @description: - * Retrieve the CID of the input glyph index. - * - * @input: - * face :: - * A handle to the input face. - * - * glyph_index :: - * The input glyph index. - * - * @output: - * cid :: - * The CID as an @FT_UInt. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with CID faces and OpenType fonts, - * returning an error otherwise. - * - * @since: - * 2.3.9 - */ - FT_EXPORT( FT_Error ) - FT_Get_CID_From_Glyph_Index( FT_Face face, - FT_UInt glyph_index, - FT_UInt *cid ); - - /* */ - -FT_END_HEADER - -#endif /* __FTCID_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/fterrdef.h b/GLideN64/src/inc/freetype/include/fterrdef.h deleted file mode 100644 index 76c7b9e..0000000 --- a/GLideN64/src/inc/freetype/include/fterrdef.h +++ /dev/null @@ -1,249 +0,0 @@ -/***************************************************************************/ -/* */ -/* fterrdef.h */ -/* */ -/* FreeType error codes (specification). */ -/* */ -/* Copyright 2002, 2004, 2006, 2007, 2010-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** LIST OF ERROR CODES/MESSAGES *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - - /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */ - /* including this file. */ - - - /* generic errors */ - - FT_NOERRORDEF_( Ok, 0x00, \ - "no error" ) - - FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \ - "cannot open resource" ) - FT_ERRORDEF_( Unknown_File_Format, 0x02, \ - "unknown file format" ) - FT_ERRORDEF_( Invalid_File_Format, 0x03, \ - "broken file" ) - FT_ERRORDEF_( Invalid_Version, 0x04, \ - "invalid FreeType version" ) - FT_ERRORDEF_( Lower_Module_Version, 0x05, \ - "module version is too low" ) - FT_ERRORDEF_( Invalid_Argument, 0x06, \ - "invalid argument" ) - FT_ERRORDEF_( Unimplemented_Feature, 0x07, \ - "unimplemented feature" ) - FT_ERRORDEF_( Invalid_Table, 0x08, \ - "broken table" ) - FT_ERRORDEF_( Invalid_Offset, 0x09, \ - "broken offset within table" ) - FT_ERRORDEF_( Array_Too_Large, 0x0A, \ - "array allocation size too large" ) - FT_ERRORDEF_( Missing_Module, 0x0B, \ - "missing module" ) - FT_ERRORDEF_( Missing_Property, 0x0C, \ - "missing property" ) - - /* glyph/character errors */ - - FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \ - "invalid glyph index" ) - FT_ERRORDEF_( Invalid_Character_Code, 0x11, \ - "invalid character code" ) - FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \ - "unsupported glyph image format" ) - FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \ - "cannot render this glyph format" ) - FT_ERRORDEF_( Invalid_Outline, 0x14, \ - "invalid outline" ) - FT_ERRORDEF_( Invalid_Composite, 0x15, \ - "invalid composite glyph" ) - FT_ERRORDEF_( Too_Many_Hints, 0x16, \ - "too many hints" ) - FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \ - "invalid pixel size" ) - - /* handle errors */ - - FT_ERRORDEF_( Invalid_Handle, 0x20, \ - "invalid object handle" ) - FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \ - "invalid library handle" ) - FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \ - "invalid module handle" ) - FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \ - "invalid face handle" ) - FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \ - "invalid size handle" ) - FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \ - "invalid glyph slot handle" ) - FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \ - "invalid charmap handle" ) - FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \ - "invalid cache manager handle" ) - FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \ - "invalid stream handle" ) - - /* driver errors */ - - FT_ERRORDEF_( Too_Many_Drivers, 0x30, \ - "too many modules" ) - FT_ERRORDEF_( Too_Many_Extensions, 0x31, \ - "too many extensions" ) - - /* memory errors */ - - FT_ERRORDEF_( Out_Of_Memory, 0x40, \ - "out of memory" ) - FT_ERRORDEF_( Unlisted_Object, 0x41, \ - "unlisted object" ) - - /* stream errors */ - - FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \ - "cannot open stream" ) - FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \ - "invalid stream seek" ) - FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \ - "invalid stream skip" ) - FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \ - "invalid stream read" ) - FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \ - "invalid stream operation" ) - FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \ - "invalid frame operation" ) - FT_ERRORDEF_( Nested_Frame_Access, 0x57, \ - "nested frame access" ) - FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \ - "invalid frame read" ) - - /* raster errors */ - - FT_ERRORDEF_( Raster_Uninitialized, 0x60, \ - "raster uninitialized" ) - FT_ERRORDEF_( Raster_Corrupted, 0x61, \ - "raster corrupted" ) - FT_ERRORDEF_( Raster_Overflow, 0x62, \ - "raster overflow" ) - FT_ERRORDEF_( Raster_Negative_Height, 0x63, \ - "negative height while rastering" ) - - /* cache errors */ - - FT_ERRORDEF_( Too_Many_Caches, 0x70, \ - "too many registered caches" ) - - /* TrueType and SFNT errors */ - - FT_ERRORDEF_( Invalid_Opcode, 0x80, \ - "invalid opcode" ) - FT_ERRORDEF_( Too_Few_Arguments, 0x81, \ - "too few arguments" ) - FT_ERRORDEF_( Stack_Overflow, 0x82, \ - "stack overflow" ) - FT_ERRORDEF_( Code_Overflow, 0x83, \ - "code overflow" ) - FT_ERRORDEF_( Bad_Argument, 0x84, \ - "bad argument" ) - FT_ERRORDEF_( Divide_By_Zero, 0x85, \ - "division by zero" ) - FT_ERRORDEF_( Invalid_Reference, 0x86, \ - "invalid reference" ) - FT_ERRORDEF_( Debug_OpCode, 0x87, \ - "found debug opcode" ) - FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \ - "found ENDF opcode in execution stream" ) - FT_ERRORDEF_( Nested_DEFS, 0x89, \ - "nested DEFS" ) - FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \ - "invalid code range" ) - FT_ERRORDEF_( Execution_Too_Long, 0x8B, \ - "execution context too long" ) - FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \ - "too many function definitions" ) - FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \ - "too many instruction definitions" ) - FT_ERRORDEF_( Table_Missing, 0x8E, \ - "SFNT font table missing" ) - FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \ - "horizontal header (hhea) table missing" ) - FT_ERRORDEF_( Locations_Missing, 0x90, \ - "locations (loca) table missing" ) - FT_ERRORDEF_( Name_Table_Missing, 0x91, \ - "name table missing" ) - FT_ERRORDEF_( CMap_Table_Missing, 0x92, \ - "character map (cmap) table missing" ) - FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \ - "horizontal metrics (hmtx) table missing" ) - FT_ERRORDEF_( Post_Table_Missing, 0x94, \ - "PostScript (post) table missing" ) - FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \ - "invalid horizontal metrics" ) - FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \ - "invalid character map (cmap) format" ) - FT_ERRORDEF_( Invalid_PPem, 0x97, \ - "invalid ppem value" ) - FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \ - "invalid vertical metrics" ) - FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \ - "could not find context" ) - FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \ - "invalid PostScript (post) table format" ) - FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \ - "invalid PostScript (post) table" ) - - /* CFF, CID, and Type 1 errors */ - - FT_ERRORDEF_( Syntax_Error, 0xA0, \ - "opcode syntax error" ) - FT_ERRORDEF_( Stack_Underflow, 0xA1, \ - "argument stack underflow" ) - FT_ERRORDEF_( Ignore, 0xA2, \ - "ignore" ) - FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \ - "no Unicode glyph name found" ) - FT_ERRORDEF_( Glyph_Too_Big, 0xA4, \ - "glyph to big for hinting" ) - - /* BDF errors */ - - FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \ - "`STARTFONT' field missing" ) - FT_ERRORDEF_( Missing_Font_Field, 0xB1, \ - "`FONT' field missing" ) - FT_ERRORDEF_( Missing_Size_Field, 0xB2, \ - "`SIZE' field missing" ) - FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, \ - "`FONTBOUNDINGBOX' field missing" ) - FT_ERRORDEF_( Missing_Chars_Field, 0xB4, \ - "`CHARS' field missing" ) - FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, \ - "`STARTCHAR' field missing" ) - FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, \ - "`ENCODING' field missing" ) - FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, \ - "`BBX' field missing" ) - FT_ERRORDEF_( Bbx_Too_Big, 0xB8, \ - "`BBX' too big" ) - FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, \ - "Font header corrupted or missing fields" ) - FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, \ - "Font glyphs corrupted or missing fields" ) - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/fterrors.h b/GLideN64/src/inc/freetype/include/fterrors.h deleted file mode 100644 index 0fa3e4d..0000000 --- a/GLideN64/src/inc/freetype/include/fterrors.h +++ /dev/null @@ -1,198 +0,0 @@ -/***************************************************************************/ -/* */ -/* fterrors.h */ -/* */ -/* FreeType error code handling (specification). */ -/* */ -/* Copyright 1996-2002, 2004, 2007, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This special header file is used to define the handling of FT2 */ - /* enumeration constants. It can also be used to generate error message */ - /* strings with a small macro trick explained below. */ - /* */ - /* I - Error Formats */ - /* ----------------- */ - /* */ - /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ - /* defined in ftoption.h in order to make the higher byte indicate */ - /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2). See the file `ftmoderr.h' for */ - /* more details. */ - /* */ - /* */ - /* II - Error Message strings */ - /* -------------------------- */ - /* */ - /* The error definitions below are made through special macros that */ - /* allow client applications to build a table of error message strings */ - /* if they need it. The strings are not included in a normal build of */ - /* FreeType 2 to save space (most client applications do not use */ - /* them). */ - /* */ - /* To do so, you have to define the following macros before including */ - /* this file: */ - /* */ - /* FT_ERROR_START_LIST :: */ - /* This macro is called before anything else to define the start of */ - /* the error list. It is followed by several FT_ERROR_DEF calls */ - /* (see below). */ - /* */ - /* FT_ERROR_DEF( e, v, s ) :: */ - /* This macro is called to define one single error. */ - /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ - /* `v' is the error numerical value. */ - /* `s' is the corresponding error string. */ - /* */ - /* FT_ERROR_END_LIST :: */ - /* This macro ends the list. */ - /* */ - /* Additionally, you have to undefine __FTERRORS_H__ before #including */ - /* this file. */ - /* */ - /* Here is a simple example: */ - /* */ - /* { */ - /* #undef __FTERRORS_H__ */ - /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ - /* #define FT_ERROR_START_LIST { */ - /* #define FT_ERROR_END_LIST { 0, 0 } }; */ - /* */ - /* const struct */ - /* { */ - /* int err_code; */ - /* const char* err_msg; */ - /* } ft_errors[] = */ - /* */ - /* #include FT_ERRORS_H */ - /* } */ - /* */ - /*************************************************************************/ - - -#ifndef __FTERRORS_H__ -#define __FTERRORS_H__ - - - /* include module base error codes */ -#include FT_MODULE_ERRORS_H - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** SETUP MACROS *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - -#undef FT_NEED_EXTERN_C - - - /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ - /* By default, we use `FT_Err_'. */ - /* */ -#ifndef FT_ERR_PREFIX -#define FT_ERR_PREFIX FT_Err_ -#endif - - - /* FT_ERR_BASE is used as the base for module-specific errors. */ - /* */ -#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS - -#ifndef FT_ERR_BASE -#define FT_ERR_BASE FT_Mod_Err_Base -#endif - -#else - -#undef FT_ERR_BASE -#define FT_ERR_BASE 0 - -#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ - - - /* If FT_ERRORDEF is not defined, we need to define a simple */ - /* enumeration type. */ - /* */ -#ifndef FT_ERRORDEF - -#define FT_ERRORDEF( e, v, s ) e = v, -#define FT_ERROR_START_LIST enum { -#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; - -#ifdef __cplusplus -#define FT_NEED_EXTERN_C - extern "C" { -#endif - -#endif /* !FT_ERRORDEF */ - - - /* this macro is used to define an error */ -#define FT_ERRORDEF_( e, v, s ) \ - FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) - - /* this is only used for <module>_Err_Ok, which must be 0! */ -#define FT_NOERRORDEF_( e, v, s ) \ - FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) - - -#ifdef FT_ERROR_START_LIST - FT_ERROR_START_LIST -#endif - - - /* now include the error codes */ -#include FT_ERROR_DEFINITIONS_H - - -#ifdef FT_ERROR_END_LIST - FT_ERROR_END_LIST -#endif - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** SIMPLE CLEANUP *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - -#ifdef FT_NEED_EXTERN_C - } -#endif - -#undef FT_ERROR_START_LIST -#undef FT_ERROR_END_LIST - -#undef FT_ERRORDEF -#undef FT_ERRORDEF_ -#undef FT_NOERRORDEF_ - -#undef FT_NEED_EXTERN_C -#undef FT_ERR_BASE - - /* FT_ERR_PREFIX is needed internally */ -#ifndef FT2_BUILD_LIBRARY -#undef FT_ERR_PREFIX -#endif - -#endif /* __FTERRORS_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftgasp.h b/GLideN64/src/inc/freetype/include/ftgasp.h deleted file mode 100644 index 453d4fa..0000000 --- a/GLideN64/src/inc/freetype/include/ftgasp.h +++ /dev/null @@ -1,128 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftgasp.h */ -/* */ -/* Access of TrueType's `gasp' table (specification). */ -/* */ -/* Copyright 2007, 2008, 2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef _FT_GASP_H_ -#define _FT_GASP_H_ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - - /*************************************************************************** - * - * @section: - * gasp_table - * - * @title: - * Gasp Table - * - * @abstract: - * Retrieving TrueType `gasp' table entries. - * - * @description: - * The function @FT_Get_Gasp can be used to query a TrueType or OpenType - * font for specific entries in its `gasp' table, if any. This is - * mainly useful when implementing native TrueType hinting with the - * bytecode interpreter to duplicate the Windows text rendering results. - */ - - /************************************************************************* - * - * @enum: - * FT_GASP_XXX - * - * @description: - * A list of values and/or bit-flags returned by the @FT_Get_Gasp - * function. - * - * @values: - * FT_GASP_NO_TABLE :: - * This special value means that there is no GASP table in this face. - * It is up to the client to decide what to do. - * - * FT_GASP_DO_GRIDFIT :: - * Grid-fitting and hinting should be performed at the specified ppem. - * This *really* means TrueType bytecode interpretation. If this bit - * is not set, no hinting gets applied. - * - * FT_GASP_DO_GRAY :: - * Anti-aliased rendering should be performed at the specified ppem. - * If not set, do monochrome rendering. - * - * FT_GASP_SYMMETRIC_SMOOTHING :: - * If set, smoothing along multiple axes must be used with ClearType. - * - * FT_GASP_SYMMETRIC_GRIDFIT :: - * Grid-fitting must be used with ClearType's symmetric smoothing. - * - * @note: - * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be - * used for standard font rasterization only. Independently of that, - * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to - * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and - * `FT_GASP_DO_GRAY' are consequently ignored). - * - * `ClearType' is Microsoft's implementation of LCD rendering, partly - * protected by patents. - * - * @since: - * 2.3.0 - */ -#define FT_GASP_NO_TABLE -1 -#define FT_GASP_DO_GRIDFIT 0x01 -#define FT_GASP_DO_GRAY 0x02 -#define FT_GASP_SYMMETRIC_SMOOTHING 0x08 -#define FT_GASP_SYMMETRIC_GRIDFIT 0x10 - - - /************************************************************************* - * - * @func: - * FT_Get_Gasp - * - * @description: - * Read the `gasp' table from a TrueType or OpenType font file and - * return the entry corresponding to a given character pixel size. - * - * @input: - * face :: The source face handle. - * ppem :: The vertical character pixel size. - * - * @return: - * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no - * `gasp' table in the face. - * - * @since: - * 2.3.0 - */ - FT_EXPORT( FT_Int ) - FT_Get_Gasp( FT_Face face, - FT_UInt ppem ); - -/* */ - -#endif /* _FT_GASP_H_ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftglyph.h b/GLideN64/src/inc/freetype/include/ftglyph.h deleted file mode 100644 index 2d30ed9..0000000 --- a/GLideN64/src/inc/freetype/include/ftglyph.h +++ /dev/null @@ -1,620 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftglyph.h */ -/* */ -/* FreeType convenience functions to handle glyphs (specification). */ -/* */ -/* Copyright 1996-2003, 2006, 2008, 2009, 2011, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file contains the definition of several convenience functions */ - /* that can be used by client applications to easily retrieve glyph */ - /* bitmaps and outlines from a given face. */ - /* */ - /* These functions should be optional if you are writing a font server */ - /* or text layout engine on top of FreeType. However, they are pretty */ - /* handy for many other simple uses of the library. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTGLYPH_H__ -#define __FTGLYPH_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* glyph_management */ - /* */ - /* <Title> */ - /* Glyph Management */ - /* */ - /* <Abstract> */ - /* Generic interface to manage individual glyph data. */ - /* */ - /* <Description> */ - /* This section contains definitions used to manage glyph data */ - /* through generic FT_Glyph objects. Each of them can contain a */ - /* bitmap, a vector outline, or even images in other formats. */ - /* */ - /*************************************************************************/ - - - /* forward declaration to a private type */ - typedef struct FT_Glyph_Class_ FT_Glyph_Class; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Glyph */ - /* */ - /* <Description> */ - /* Handle to an object used to model generic glyph images. It is a */ - /* pointer to the @FT_GlyphRec structure and can contain a glyph */ - /* bitmap or pointer. */ - /* */ - /* <Note> */ - /* Glyph objects are not owned by the library. You must thus release */ - /* them manually (through @FT_Done_Glyph) _before_ calling */ - /* @FT_Done_FreeType. */ - /* */ - typedef struct FT_GlyphRec_* FT_Glyph; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_GlyphRec */ - /* */ - /* <Description> */ - /* The root glyph structure contains a given glyph image plus its */ - /* advance width in 16.16 fixed-point format. */ - /* */ - /* <Fields> */ - /* library :: A handle to the FreeType library object. */ - /* */ - /* clazz :: A pointer to the glyph's class. Private. */ - /* */ - /* format :: The format of the glyph's image. */ - /* */ - /* advance :: A 16.16 vector that gives the glyph's advance width. */ - /* */ - typedef struct FT_GlyphRec_ - { - FT_Library library; - const FT_Glyph_Class* clazz; - FT_Glyph_Format format; - FT_Vector advance; - - } FT_GlyphRec; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_BitmapGlyph */ - /* */ - /* <Description> */ - /* A handle to an object used to model a bitmap glyph image. This is */ - /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */ - /* */ - typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_BitmapGlyphRec */ - /* */ - /* <Description> */ - /* A structure used for bitmap glyph images. This really is a */ - /* `sub-class' of @FT_GlyphRec. */ - /* */ - /* <Fields> */ - /* root :: The root @FT_Glyph fields. */ - /* */ - /* left :: The left-side bearing, i.e., the horizontal distance */ - /* from the current pen position to the left border of the */ - /* glyph bitmap. */ - /* */ - /* top :: The top-side bearing, i.e., the vertical distance from */ - /* the current pen position to the top border of the glyph */ - /* bitmap. This distance is positive for upwards~y! */ - /* */ - /* bitmap :: A descriptor for the bitmap. */ - /* */ - /* <Note> */ - /* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */ - /* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */ - /* the bitmap's contents easily. */ - /* */ - /* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */ - /* and is thus created and destroyed with it. */ - /* */ - typedef struct FT_BitmapGlyphRec_ - { - FT_GlyphRec root; - FT_Int left; - FT_Int top; - FT_Bitmap bitmap; - - } FT_BitmapGlyphRec; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_OutlineGlyph */ - /* */ - /* <Description> */ - /* A handle to an object used to model an outline glyph image. This */ - /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */ - /* */ - typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_OutlineGlyphRec */ - /* */ - /* <Description> */ - /* A structure used for outline (vectorial) glyph images. This */ - /* really is a `sub-class' of @FT_GlyphRec. */ - /* */ - /* <Fields> */ - /* root :: The root @FT_Glyph fields. */ - /* */ - /* outline :: A descriptor for the outline. */ - /* */ - /* <Note> */ - /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */ - /* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */ - /* the outline's content easily. */ - /* */ - /* As the outline is extracted from a glyph slot, its coordinates are */ - /* expressed normally in 26.6 pixels, unless the flag */ - /* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */ - /* */ - /* The outline's tables are always owned by the object and are */ - /* destroyed with it. */ - /* */ - typedef struct FT_OutlineGlyphRec_ - { - FT_GlyphRec root; - FT_Outline outline; - - } FT_OutlineGlyphRec; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Glyph */ - /* */ - /* <Description> */ - /* A function used to extract a glyph image from a slot. Note that */ - /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */ - /* */ - /* <Input> */ - /* slot :: A handle to the source glyph slot. */ - /* */ - /* <Output> */ - /* aglyph :: A handle to the glyph object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Glyph( FT_GlyphSlot slot, - FT_Glyph *aglyph ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_Copy */ - /* */ - /* <Description> */ - /* A function used to copy a glyph image. Note that the created */ - /* @FT_Glyph object must be released with @FT_Done_Glyph. */ - /* */ - /* <Input> */ - /* source :: A handle to the source glyph object. */ - /* */ - /* <Output> */ - /* target :: A handle to the target glyph object. 0~in case of */ - /* error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Glyph_Copy( FT_Glyph source, - FT_Glyph *target ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_Transform */ - /* */ - /* <Description> */ - /* Transform a glyph image if its format is scalable. */ - /* */ - /* <InOut> */ - /* glyph :: A handle to the target glyph object. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to a 2x2 matrix to apply. */ - /* */ - /* delta :: A pointer to a 2d vector to apply. Coordinates are */ - /* expressed in 1/64th of a pixel. */ - /* */ - /* <Return> */ - /* FreeType error code (if not 0, the glyph format is not scalable). */ - /* */ - /* <Note> */ - /* The 2x2 transformation matrix is also applied to the glyph's */ - /* advance vector. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Glyph_Transform( FT_Glyph glyph, - FT_Matrix* matrix, - FT_Vector* delta ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Glyph_BBox_Mode */ - /* */ - /* <Description> */ - /* The mode how the values of @FT_Glyph_Get_CBox are returned. */ - /* */ - /* <Values> */ - /* FT_GLYPH_BBOX_UNSCALED :: */ - /* Return unscaled font units. */ - /* */ - /* FT_GLYPH_BBOX_SUBPIXELS :: */ - /* Return unfitted 26.6 coordinates. */ - /* */ - /* FT_GLYPH_BBOX_GRIDFIT :: */ - /* Return grid-fitted 26.6 coordinates. */ - /* */ - /* FT_GLYPH_BBOX_TRUNCATE :: */ - /* Return coordinates in integer pixels. */ - /* */ - /* FT_GLYPH_BBOX_PIXELS :: */ - /* Return grid-fitted pixel coordinates. */ - /* */ - typedef enum FT_Glyph_BBox_Mode_ - { - FT_GLYPH_BBOX_UNSCALED = 0, - FT_GLYPH_BBOX_SUBPIXELS = 0, - FT_GLYPH_BBOX_GRIDFIT = 1, - FT_GLYPH_BBOX_TRUNCATE = 2, - FT_GLYPH_BBOX_PIXELS = 3 - - } FT_Glyph_BBox_Mode; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_glyph_bbox_xxx */ - /* */ - /* <Description> */ - /* These constants are deprecated. Use the corresponding */ - /* @FT_Glyph_BBox_Mode values instead. */ - /* */ - /* <Values> */ - /* ft_glyph_bbox_unscaled :: See @FT_GLYPH_BBOX_UNSCALED. */ - /* ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS. */ - /* ft_glyph_bbox_gridfit :: See @FT_GLYPH_BBOX_GRIDFIT. */ - /* ft_glyph_bbox_truncate :: See @FT_GLYPH_BBOX_TRUNCATE. */ - /* ft_glyph_bbox_pixels :: See @FT_GLYPH_BBOX_PIXELS. */ - /* */ -#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED -#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS -#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT -#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE -#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_Get_CBox */ - /* */ - /* <Description> */ - /* Return a glyph's `control box'. The control box encloses all the */ - /* outline's points, including Bézier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ - /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component, which is dedicated to this single task. */ - /* */ - /* <Input> */ - /* glyph :: A handle to the source glyph object. */ - /* */ - /* mode :: The mode that indicates how to interpret the returned */ - /* bounding box values. */ - /* */ - /* <Output> */ - /* acbox :: The glyph coordinate bounding box. Coordinates are */ - /* expressed in 1/64th of pixels if it is grid-fitted. */ - /* */ - /* <Note> */ - /* Coordinates are relative to the glyph origin, using the y~upwards */ - /* convention. */ - /* */ - /* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */ - /* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */ - /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */ - /* is another name for this constant. */ - /* */ - /* If the font is tricky and the glyph has been loaded with */ - /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */ - /* reasonable values for the CBox it is necessary to load the glyph */ - /* at a large ppem value (so that the hinting instructions can */ - /* properly shift and scale the subglyphs), then extracting the CBox, */ - /* which can be eventually converted back to font units. */ - /* */ - /* Note that the maximum coordinates are exclusive, which means that */ - /* one can compute the width and height of the glyph image (be it in */ - /* integer or 26.6 pixels) as: */ - /* */ - /* { */ - /* width = bbox.xMax - bbox.xMin; */ - /* height = bbox.yMax - bbox.yMin; */ - /* } */ - /* */ - /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ - /* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */ - /* which corresponds to: */ - /* */ - /* { */ - /* bbox.xMin = FLOOR(bbox.xMin); */ - /* bbox.yMin = FLOOR(bbox.yMin); */ - /* bbox.xMax = CEILING(bbox.xMax); */ - /* bbox.yMax = CEILING(bbox.yMax); */ - /* } */ - /* */ - /* To get the bbox in pixel coordinates, set `bbox_mode' to */ - /* @FT_GLYPH_BBOX_TRUNCATE. */ - /* */ - /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ - /* to @FT_GLYPH_BBOX_PIXELS. */ - /* */ - FT_EXPORT( void ) - FT_Glyph_Get_CBox( FT_Glyph glyph, - FT_UInt bbox_mode, - FT_BBox *acbox ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_To_Bitmap */ - /* */ - /* <Description> */ - /* Convert a given glyph object to a bitmap glyph object. */ - /* */ - /* <InOut> */ - /* the_glyph :: A pointer to a handle to the target glyph. */ - /* */ - /* <Input> */ - /* render_mode :: An enumeration that describes how the data is */ - /* rendered. */ - /* */ - /* origin :: A pointer to a vector used to translate the glyph */ - /* image before rendering. Can be~0 (if no */ - /* translation). The origin is expressed in */ - /* 26.6 pixels. */ - /* */ - /* destroy :: A boolean that indicates that the original glyph */ - /* image should be destroyed by this function. It is */ - /* never destroyed in case of error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function does nothing if the glyph format isn't scalable. */ - /* */ - /* The glyph image is translated with the `origin' vector before */ - /* rendering. */ - /* */ - /* The first parameter is a pointer to an @FT_Glyph handle, that will */ - /* be _replaced_ by this function (with newly allocated data). */ - /* Typically, you would use (omitting error handling): */ - /* */ - /* */ - /* { */ - /* FT_Glyph glyph; */ - /* FT_BitmapGlyph glyph_bitmap; */ - /* */ - /* */ - /* // load glyph */ - /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */ - /* */ - /* // extract glyph image */ - /* error = FT_Get_Glyph( face->glyph, &glyph ); */ - /* */ - /* // convert to a bitmap (default render mode + destroying old) */ - /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */ - /* { */ - /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */ - /* 0, 1 ); */ - /* if ( error ) // `glyph' unchanged */ - /* ... */ - /* } */ - /* */ - /* // access bitmap content by typecasting */ - /* glyph_bitmap = (FT_BitmapGlyph)glyph; */ - /* */ - /* // do funny stuff with it, like blitting/drawing */ - /* ... */ - /* */ - /* // discard glyph image (bitmap or not) */ - /* FT_Done_Glyph( glyph ); */ - /* } */ - /* */ - /* */ - /* Here another example, again without error handling: */ - /* */ - /* */ - /* { */ - /* FT_Glyph glyphs[MAX_GLYPHS] */ - /* */ - /* */ - /* ... */ - /* */ - /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ - /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */ - /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */ - /* */ - /* ... */ - /* */ - /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ - /* { */ - /* FT_Glyph bitmap = glyphs[idx]; */ - /* */ - /* */ - /* ... */ - /* */ - /* // after this call, `bitmap' no longer points into */ - /* // the `glyphs' array (and the old value isn't destroyed) */ - /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */ - /* */ - /* ... */ - /* */ - /* FT_Done_Glyph( bitmap ); */ - /* } */ - /* */ - /* ... */ - /* */ - /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ - /* FT_Done_Glyph( glyphs[idx] ); */ - /* } */ - /* */ - FT_EXPORT( FT_Error ) - FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, - FT_Render_Mode render_mode, - FT_Vector* origin, - FT_Bool destroy ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Glyph */ - /* */ - /* <Description> */ - /* Destroy a given glyph. */ - /* */ - /* <Input> */ - /* glyph :: A handle to the target glyph object. */ - /* */ - FT_EXPORT( void ) - FT_Done_Glyph( FT_Glyph glyph ); - - /* */ - - - /* other helpful functions */ - - /*************************************************************************/ - /* */ - /* <Section> */ - /* computations */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Matrix_Multiply */ - /* */ - /* <Description> */ - /* Perform the matrix operation `b = a*b'. */ - /* */ - /* <Input> */ - /* a :: A pointer to matrix `a'. */ - /* */ - /* <InOut> */ - /* b :: A pointer to matrix `b'. */ - /* */ - /* <Note> */ - /* The result is undefined if either `a' or `b' is zero. */ - /* */ - FT_EXPORT( void ) - FT_Matrix_Multiply( const FT_Matrix* a, - FT_Matrix* b ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Matrix_Invert */ - /* */ - /* <Description> */ - /* Invert a 2x2 matrix. Return an error if it can't be inverted. */ - /* */ - /* <InOut> */ - /* matrix :: A pointer to the target matrix. Remains untouched in */ - /* case of error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Matrix_Invert( FT_Matrix* matrix ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTGLYPH_H__ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/GLideN64/src/inc/freetype/include/ftgxval.h b/GLideN64/src/inc/freetype/include/ftgxval.h deleted file mode 100644 index 6d38e32..0000000 --- a/GLideN64/src/inc/freetype/include/ftgxval.h +++ /dev/null @@ -1,358 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftgxval.h */ -/* */ -/* FreeType API for validating TrueTypeGX/AAT tables (specification). */ -/* */ -/* Copyright 2004-2006, 2013 by */ -/* Masatake YAMATO, Redhat K.K, */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTGXVAL_H__ -#define __FTGXVAL_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* gx_validation */ - /* */ - /* <Title> */ - /* TrueTypeGX/AAT Validation */ - /* */ - /* <Abstract> */ - /* An API to validate TrueTypeGX/AAT tables. */ - /* */ - /* <Description> */ - /* This section contains the declaration of functions to validate */ - /* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */ - /* trak, prop, lcar). */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* Warning: Use FT_VALIDATE_XXX to validate a table. */ - /* Following definitions are for gxvalid developers. */ - /* */ - /* */ - /*************************************************************************/ - -#define FT_VALIDATE_feat_INDEX 0 -#define FT_VALIDATE_mort_INDEX 1 -#define FT_VALIDATE_morx_INDEX 2 -#define FT_VALIDATE_bsln_INDEX 3 -#define FT_VALIDATE_just_INDEX 4 -#define FT_VALIDATE_kern_INDEX 5 -#define FT_VALIDATE_opbd_INDEX 6 -#define FT_VALIDATE_trak_INDEX 7 -#define FT_VALIDATE_prop_INDEX 8 -#define FT_VALIDATE_lcar_INDEX 9 -#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX - - - /************************************************************************* - * - * @macro: - * FT_VALIDATE_GX_LENGTH - * - * @description: - * The number of tables checked in this module. Use it as a parameter - * for the `table-length' argument of function @FT_TrueTypeGX_Validate. - */ -#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) - - /* */ - - /* Up to 0x1000 is used by otvalid. - Ox2xxx is reserved for feature OT extension. */ -#define FT_VALIDATE_GX_START 0x4000 -#define FT_VALIDATE_GX_BITFIELD( tag ) \ - ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) - - - /********************************************************************** - * - * @enum: - * FT_VALIDATE_GXXXX - * - * @description: - * A list of bit-field constants used with @FT_TrueTypeGX_Validate to - * indicate which TrueTypeGX/AAT Type tables should be validated. - * - * @values: - * FT_VALIDATE_feat :: - * Validate `feat' table. - * - * FT_VALIDATE_mort :: - * Validate `mort' table. - * - * FT_VALIDATE_morx :: - * Validate `morx' table. - * - * FT_VALIDATE_bsln :: - * Validate `bsln' table. - * - * FT_VALIDATE_just :: - * Validate `just' table. - * - * FT_VALIDATE_kern :: - * Validate `kern' table. - * - * FT_VALIDATE_opbd :: - * Validate `opbd' table. - * - * FT_VALIDATE_trak :: - * Validate `trak' table. - * - * FT_VALIDATE_prop :: - * Validate `prop' table. - * - * FT_VALIDATE_lcar :: - * Validate `lcar' table. - * - * FT_VALIDATE_GX :: - * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern, - * opbd, trak, prop and lcar). - * - */ - -#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat ) -#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort ) -#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx ) -#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln ) -#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just ) -#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern ) -#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd ) -#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak ) -#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop ) -#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar ) - -#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \ - FT_VALIDATE_mort | \ - FT_VALIDATE_morx | \ - FT_VALIDATE_bsln | \ - FT_VALIDATE_just | \ - FT_VALIDATE_kern | \ - FT_VALIDATE_opbd | \ - FT_VALIDATE_trak | \ - FT_VALIDATE_prop | \ - FT_VALIDATE_lcar ) - - - /* */ - - /********************************************************************** - * - * @function: - * FT_TrueTypeGX_Validate - * - * @description: - * Validate various TrueTypeGX tables to assure that all offsets and - * indices are valid. The idea is that a higher-level library that - * actually does the text layout can access those tables without - * error checking (which can be quite time consuming). - * - * @input: - * face :: - * A handle to the input face. - * - * validation_flags :: - * A bit field that specifies the tables to be validated. See - * @FT_VALIDATE_GXXXX for possible values. - * - * table_length :: - * The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH - * should be passed. - * - * @output: - * tables :: - * The array where all validated sfnt tables are stored. - * The array itself must be allocated by a client. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with TrueTypeGX fonts, returning an error - * otherwise. - * - * After use, the application should deallocate the buffers pointed to by - * each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value - * indicates that the table either doesn't exist in the font, the - * application hasn't asked for validation, or the validator doesn't have - * the ability to validate the sfnt table. - */ - FT_EXPORT( FT_Error ) - FT_TrueTypeGX_Validate( FT_Face face, - FT_UInt validation_flags, - FT_Bytes tables[FT_VALIDATE_GX_LENGTH], - FT_UInt table_length ); - - - /* */ - - /********************************************************************** - * - * @function: - * FT_TrueTypeGX_Free - * - * @description: - * Free the buffer allocated by TrueTypeGX validator. - * - * @input: - * face :: - * A handle to the input face. - * - * table :: - * The pointer to the buffer allocated by - * @FT_TrueTypeGX_Validate. - * - * @note: - * This function must be used to free the buffer allocated by - * @FT_TrueTypeGX_Validate only. - */ - FT_EXPORT( void ) - FT_TrueTypeGX_Free( FT_Face face, - FT_Bytes table ); - - - /* */ - - /********************************************************************** - * - * @enum: - * FT_VALIDATE_CKERNXXX - * - * @description: - * A list of bit-field constants used with @FT_ClassicKern_Validate - * to indicate the classic kern dialect or dialects. If the selected - * type doesn't fit, @FT_ClassicKern_Validate regards the table as - * invalid. - * - * @values: - * FT_VALIDATE_MS :: - * Handle the `kern' table as a classic Microsoft kern table. - * - * FT_VALIDATE_APPLE :: - * Handle the `kern' table as a classic Apple kern table. - * - * FT_VALIDATE_CKERN :: - * Handle the `kern' as either classic Apple or Microsoft kern table. - */ -#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 ) -#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 ) - -#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) - - - /* */ - - /********************************************************************** - * - * @function: - * FT_ClassicKern_Validate - * - * @description: - * Validate classic (16-bit format) kern table to assure that the offsets - * and indices are valid. The idea is that a higher-level library that - * actually does the text layout can access those tables without error - * checking (which can be quite time consuming). - * - * The `kern' table validator in @FT_TrueTypeGX_Validate deals with both - * the new 32-bit format and the classic 16-bit format, while - * FT_ClassicKern_Validate only supports the classic 16-bit format. - * - * @input: - * face :: - * A handle to the input face. - * - * validation_flags :: - * A bit field that specifies the dialect to be validated. See - * @FT_VALIDATE_CKERNXXX for possible values. - * - * @output: - * ckern_table :: - * A pointer to the kern table. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * After use, the application should deallocate the buffers pointed to by - * `ckern_table', by calling @FT_ClassicKern_Free. A NULL value - * indicates that the table doesn't exist in the font. - */ - FT_EXPORT( FT_Error ) - FT_ClassicKern_Validate( FT_Face face, - FT_UInt validation_flags, - FT_Bytes *ckern_table ); - - - /* */ - - /********************************************************************** - * - * @function: - * FT_ClassicKern_Free - * - * @description: - * Free the buffer allocated by classic Kern validator. - * - * @input: - * face :: - * A handle to the input face. - * - * table :: - * The pointer to the buffer that is allocated by - * @FT_ClassicKern_Validate. - * - * @note: - * This function must be used to free the buffer allocated by - * @FT_ClassicKern_Validate only. - */ - FT_EXPORT( void ) - FT_ClassicKern_Free( FT_Face face, - FT_Bytes table ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTGXVAL_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftgzip.h b/GLideN64/src/inc/freetype/include/ftgzip.h deleted file mode 100644 index 78e7269..0000000 --- a/GLideN64/src/inc/freetype/include/ftgzip.h +++ /dev/null @@ -1,149 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftgzip.h */ -/* */ -/* Gzip-compressed stream support. */ -/* */ -/* Copyright 2002-2004, 2006, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTGZIP_H__ -#define __FTGZIP_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* gzip */ - /* */ - /* <Title> */ - /* GZIP Streams */ - /* */ - /* <Abstract> */ - /* Using gzip-compressed font files. */ - /* */ - /* <Description> */ - /* This section contains the declaration of Gzip-specific functions. */ - /* */ - /*************************************************************************/ - - - /************************************************************************ - * - * @function: - * FT_Stream_OpenGzip - * - * @description: - * Open a new stream to parse gzip-compressed font files. This is - * mainly used to support the compressed `*.pcf.gz' fonts that come - * with XFree86. - * - * @input: - * stream :: - * The target embedding stream. - * - * source :: - * The source stream. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The source stream must be opened _before_ calling this function. - * - * Calling the internal function `FT_Stream_Close' on the new stream will - * *not* call `FT_Stream_Close' on the source stream. None of the stream - * objects will be released to the heap. - * - * The stream implementation is very basic and resets the decompression - * process each time seeking backwards is needed within the stream. - * - * In certain builds of the library, gzip compression recognition is - * automatically handled when calling @FT_New_Face or @FT_Open_Face. - * This means that if no font driver is capable of handling the raw - * compressed file, the library will try to open a gzipped stream from - * it and re-open the face with it. - * - * This function may return `FT_Err_Unimplemented_Feature' if your build - * of FreeType was not compiled with zlib support. - */ - FT_EXPORT( FT_Error ) - FT_Stream_OpenGzip( FT_Stream stream, - FT_Stream source ); - - - /************************************************************************ - * - * @function: - * FT_Gzip_Uncompress - * - * @description: - * Decompress a zipped input buffer into an output buffer. This function - * is modeled after zlib's `uncompress' function. - * - * @input: - * memory :: - * A FreeType memory handle. - * - * input :: - * The input buffer. - * - * input_len :: - * The length of the input buffer. - * - * @output: - * output:: - * The output buffer. - * - * @inout: - * output_len :: - * Before calling the function, this is the the total size of the - * output buffer, which must be large enough to hold the entire - * uncompressed data (so the size of the uncompressed data must be - * known in advance). After calling the function, `output_len' is the - * size of the used data in `output'. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function may return `FT_Err_Unimplemented_Feature' if your build - * of FreeType was not compiled with zlib support. - */ - FT_EXPORT( FT_Error ) - FT_Gzip_Uncompress( FT_Memory memory, - FT_Byte* output, - FT_ULong* output_len, - const FT_Byte* input, - FT_ULong input_len ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTGZIP_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftimage.h b/GLideN64/src/inc/freetype/include/ftimage.h deleted file mode 100644 index ea71a78..0000000 --- a/GLideN64/src/inc/freetype/include/ftimage.h +++ /dev/null @@ -1,1322 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftimage.h */ -/* */ -/* FreeType glyph image formats and default raster interface */ -/* (specification). */ -/* */ -/* Copyright 1996-2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* Note: A `raster' is simply a scan-line converter, used to render */ - /* FT_Outlines into FT_Bitmaps. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTIMAGE_H__ -#define __FTIMAGE_H__ - - - /* _STANDALONE_ is from ftgrays.c */ -#ifndef _STANDALONE_ -#include <ft2build.h> -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Pos */ - /* */ - /* <Description> */ - /* The type FT_Pos is used to store vectorial coordinates. Depending */ - /* on the context, these can represent distances in integer font */ - /* units, or 16.16, or 26.6 fixed-point pixel coordinates. */ - /* */ - typedef signed long FT_Pos; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Vector */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2D vector; coordinates are of */ - /* the FT_Pos type. */ - /* */ - /* <Fields> */ - /* x :: The horizontal coordinate. */ - /* y :: The vertical coordinate. */ - /* */ - typedef struct FT_Vector_ - { - FT_Pos x; - FT_Pos y; - - } FT_Vector; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_BBox */ - /* */ - /* <Description> */ - /* A structure used to hold an outline's bounding box, i.e., the */ - /* coordinates of its extrema in the horizontal and vertical */ - /* directions. */ - /* */ - /* <Fields> */ - /* xMin :: The horizontal minimum (left-most). */ - /* */ - /* yMin :: The vertical minimum (bottom-most). */ - /* */ - /* xMax :: The horizontal maximum (right-most). */ - /* */ - /* yMax :: The vertical maximum (top-most). */ - /* */ - /* <Note> */ - /* The bounding box is specified with the coordinates of the lower */ - /* left and the upper right corner. In PostScript, those values are */ - /* often called (llx,lly) and (urx,ury), respectively. */ - /* */ - /* If `yMin' is negative, this value gives the glyph's descender. */ - /* Otherwise, the glyph doesn't descend below the baseline. */ - /* Similarly, if `ymax' is positive, this value gives the glyph's */ - /* ascender. */ - /* */ - /* `xMin' gives the horizontal distance from the glyph's origin to */ - /* the left edge of the glyph's bounding box. If `xMin' is negative, */ - /* the glyph extends to the left of the origin. */ - /* */ - typedef struct FT_BBox_ - { - FT_Pos xMin, yMin; - FT_Pos xMax, yMax; - - } FT_BBox; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Pixel_Mode */ - /* */ - /* <Description> */ - /* An enumeration type used to describe the format of pixels in a */ - /* given bitmap. Note that additional formats may be added in the */ - /* future. */ - /* */ - /* <Values> */ - /* FT_PIXEL_MODE_NONE :: */ - /* Value~0 is reserved. */ - /* */ - /* FT_PIXEL_MODE_MONO :: */ - /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */ - /* are stored in most-significant order (MSB), which means that */ - /* the left-most pixel in a byte has value 128. */ - /* */ - /* FT_PIXEL_MODE_GRAY :: */ - /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ - /* images. Each pixel is stored in one byte. Note that the number */ - /* of `gray' levels is stored in the `num_grays' field of the */ - /* @FT_Bitmap structure (it generally is 256). */ - /* */ - /* FT_PIXEL_MODE_GRAY2 :: */ - /* A 2-bit per pixel bitmap, used to represent embedded */ - /* anti-aliased bitmaps in font files according to the OpenType */ - /* specification. We haven't found a single font using this */ - /* format, however. */ - /* */ - /* FT_PIXEL_MODE_GRAY4 :: */ - /* A 4-bit per pixel bitmap, representing embedded anti-aliased */ - /* bitmaps in font files according to the OpenType specification. */ - /* We haven't found a single font using this format, however. */ - /* */ - /* FT_PIXEL_MODE_LCD :: */ - /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ - /* used for display on LCD displays; the bitmap is three times */ - /* wider than the original glyph image. See also */ - /* @FT_RENDER_MODE_LCD. */ - /* */ - /* FT_PIXEL_MODE_LCD_V :: */ - /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ - /* used for display on rotated LCD displays; the bitmap is three */ - /* times taller than the original glyph image. See also */ - /* @FT_RENDER_MODE_LCD_V. */ - /* */ - /* FT_PIXEL_MODE_BGRA :: */ - /* An image with four 8-bit channels per pixel, representing a */ - /* color image (such as emoticons) with alpha channel. For each */ - /* pixel, the format is BGRA, which means, the blue channel comes */ - /* first in memory. The color channels are pre-multiplied and in */ - /* the sRGB colorspace. For example, full red at half-translucent */ - /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ - /* See also @FT_LOAD_COLOR. */ - /* */ - typedef enum FT_Pixel_Mode_ - { - FT_PIXEL_MODE_NONE = 0, - FT_PIXEL_MODE_MONO, - FT_PIXEL_MODE_GRAY, - FT_PIXEL_MODE_GRAY2, - FT_PIXEL_MODE_GRAY4, - FT_PIXEL_MODE_LCD, - FT_PIXEL_MODE_LCD_V, - FT_PIXEL_MODE_BGRA, - - FT_PIXEL_MODE_MAX /* do not remove */ - - } FT_Pixel_Mode; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_pixel_mode_xxx */ - /* */ - /* <Description> */ - /* A list of deprecated constants. Use the corresponding */ - /* @FT_Pixel_Mode values instead. */ - /* */ - /* <Values> */ - /* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */ - /* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */ - /* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */ - /* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */ - /* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */ - /* */ -#define ft_pixel_mode_none FT_PIXEL_MODE_NONE -#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO -#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY -#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 -#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 - - /* */ - -#if 0 - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Palette_Mode */ - /* */ - /* <Description> */ - /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ - /* */ - /* An enumeration type to describe the format of a bitmap palette, */ - /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ - /* */ - /* <Values> */ - /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */ - /* records. */ - /* */ - /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */ - /* records. */ - /* */ - /* <Note> */ - /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ - /* FreeType, these types are not handled by the library itself. */ - /* */ - typedef enum FT_Palette_Mode_ - { - ft_palette_mode_rgb = 0, - ft_palette_mode_rgba, - - ft_palette_mode_max /* do not remove */ - - } FT_Palette_Mode; - - /* */ - -#endif - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Bitmap */ - /* */ - /* <Description> */ - /* A structure used to describe a bitmap or pixmap to the raster. */ - /* Note that we now manage pixmaps of various depths through the */ - /* `pixel_mode' field. */ - /* */ - /* <Fields> */ - /* rows :: The number of bitmap rows. */ - /* */ - /* width :: The number of pixels in bitmap row. */ - /* */ - /* pitch :: The pitch's absolute value is the number of bytes */ - /* taken by one bitmap row, including padding. */ - /* However, the pitch is positive when the bitmap has */ - /* a `down' flow, and negative when it has an `up' */ - /* flow. In all cases, the pitch is an offset to add */ - /* to a bitmap pointer in order to go down one row. */ - /* */ - /* Note that `padding' means the alignment of a */ - /* bitmap to a byte border, and FreeType functions */ - /* normally align to the smallest possible integer */ - /* value. */ - /* */ - /* For the B/W rasterizer, `pitch' is always an even */ - /* number. */ - /* */ - /* To change the pitch of a bitmap (say, to make it a */ - /* multiple of 4), use @FT_Bitmap_Convert. */ - /* Alternatively, you might use callback functions to */ - /* directly render to the application's surface; see */ - /* the file `example2.cpp' in the tutorial for a */ - /* demonstration. */ - /* */ - /* buffer :: A typeless pointer to the bitmap buffer. This */ - /* value should be aligned on 32-bit boundaries in */ - /* most cases. */ - /* */ - /* num_grays :: This field is only used with */ - /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */ - /* levels used in the bitmap. */ - /* */ - /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ - /* See @FT_Pixel_Mode for possible values. */ - /* */ - /* palette_mode :: This field is intended for paletted pixel modes; */ - /* it indicates how the palette is stored. Not */ - /* used currently. */ - /* */ - /* palette :: A typeless pointer to the bitmap palette; this */ - /* field is intended for paletted pixel modes. Not */ - /* used currently. */ - /* */ - /* <Note> */ - /* For now, the only pixel modes supported by FreeType are mono and */ - /* grays. However, drivers might be added in the future to support */ - /* more `colorful' options. */ - /* */ - typedef struct FT_Bitmap_ - { - int rows; - int width; - int pitch; - unsigned char* buffer; - short num_grays; - char pixel_mode; - char palette_mode; - void* palette; - - } FT_Bitmap; - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* outline_processing */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Outline */ - /* */ - /* <Description> */ - /* This structure is used to describe an outline to the scan-line */ - /* converter. */ - /* */ - /* <Fields> */ - /* n_contours :: The number of contours in the outline. */ - /* */ - /* n_points :: The number of points in the outline. */ - /* */ - /* points :: A pointer to an array of `n_points' @FT_Vector */ - /* elements, giving the outline's point coordinates. */ - /* */ - /* tags :: A pointer to an array of `n_points' chars, giving */ - /* each outline point's type. */ - /* */ - /* If bit~0 is unset, the point is `off' the curve, */ - /* i.e., a Bézier control point, while it is `on' if */ - /* set. */ - /* */ - /* Bit~1 is meaningful for `off' points only. If set, */ - /* it indicates a third-order Bézier arc control point; */ - /* and a second-order control point if unset. */ - /* */ - /* If bit~2 is set, bits 5-7 contain the drop-out mode */ - /* (as defined in the OpenType specification; the value */ - /* is the same as the argument to the SCANMODE */ - /* instruction). */ - /* */ - /* Bits 3 and~4 are reserved for internal purposes. */ - /* */ - /* contours :: An array of `n_contours' shorts, giving the end */ - /* point of each contour within the outline. For */ - /* example, the first contour is defined by the points */ - /* `0' to `contours[0]', the second one is defined by */ - /* the points `contours[0]+1' to `contours[1]', etc. */ - /* */ - /* flags :: A set of bit flags used to characterize the outline */ - /* and give hints to the scan-converter and hinter on */ - /* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */ - /* */ - /* <Note> */ - /* The B/W rasterizer only checks bit~2 in the `tags' array for the */ - /* first point of each contour. The drop-out mode as given with */ - /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */ - /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */ - /* */ - typedef struct FT_Outline_ - { - short n_contours; /* number of contours in glyph */ - short n_points; /* number of points in the glyph */ - - FT_Vector* points; /* the outline's points */ - char* tags; /* the points flags */ - short* contours; /* the contour end points */ - - int flags; /* outline masks */ - - } FT_Outline; - - /* Following limits must be consistent with */ - /* FT_Outline.{n_contours,n_points} */ -#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX -#define FT_OUTLINE_POINTS_MAX SHRT_MAX - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_OUTLINE_FLAGS */ - /* */ - /* <Description> */ - /* A list of bit-field constants use for the flags in an outline's */ - /* `flags' field. */ - /* */ - /* <Values> */ - /* FT_OUTLINE_NONE :: */ - /* Value~0 is reserved. */ - /* */ - /* FT_OUTLINE_OWNER :: */ - /* If set, this flag indicates that the outline's field arrays */ - /* (i.e., `points', `flags', and `contours') are `owned' by the */ - /* outline object, and should thus be freed when it is destroyed. */ - /* */ - /* FT_OUTLINE_EVEN_ODD_FILL :: */ - /* By default, outlines are filled using the non-zero winding rule. */ - /* If set to 1, the outline will be filled using the even-odd fill */ - /* rule (only works with the smooth rasterizer). */ - /* */ - /* FT_OUTLINE_REVERSE_FILL :: */ - /* By default, outside contours of an outline are oriented in */ - /* clock-wise direction, as defined in the TrueType specification. */ - /* This flag is set if the outline uses the opposite direction */ - /* (typically for Type~1 fonts). This flag is ignored by the scan */ - /* converter. */ - /* */ - /* FT_OUTLINE_IGNORE_DROPOUTS :: */ - /* By default, the scan converter will try to detect drop-outs in */ - /* an outline and correct the glyph bitmap to ensure consistent */ - /* shape continuity. If set, this flag hints the scan-line */ - /* converter to ignore such cases. See below for more information. */ - /* */ - /* FT_OUTLINE_SMART_DROPOUTS :: */ - /* Select smart dropout control. If unset, use simple dropout */ - /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */ - /* below for more information. */ - /* */ - /* FT_OUTLINE_INCLUDE_STUBS :: */ - /* If set, turn pixels on for `stubs', otherwise exclude them. */ - /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */ - /* more information. */ - /* */ - /* FT_OUTLINE_HIGH_PRECISION :: */ - /* This flag indicates that the scan-line converter should try to */ - /* convert this outline to bitmaps with the highest possible */ - /* quality. It is typically set for small character sizes. Note */ - /* that this is only a hint that might be completely ignored by a */ - /* given scan-converter. */ - /* */ - /* FT_OUTLINE_SINGLE_PASS :: */ - /* This flag is set to force a given scan-converter to only use a */ - /* single pass over the outline to render a bitmap glyph image. */ - /* Normally, it is set for very large character sizes. It is only */ - /* a hint that might be completely ignored by a given */ - /* scan-converter. */ - /* */ - /* <Note> */ - /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */ - /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */ - /* rasterizer. */ - /* */ - /* There exists a second mechanism to pass the drop-out mode to the */ - /* B/W rasterizer; see the `tags' field in @FT_Outline. */ - /* */ - /* Please refer to the description of the `SCANTYPE' instruction in */ - /* the OpenType specification (in file `ttinst1.doc') how simple */ - /* drop-outs, smart drop-outs, and stubs are defined. */ - /* */ -#define FT_OUTLINE_NONE 0x0 -#define FT_OUTLINE_OWNER 0x1 -#define FT_OUTLINE_EVEN_ODD_FILL 0x2 -#define FT_OUTLINE_REVERSE_FILL 0x4 -#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 -#define FT_OUTLINE_SMART_DROPOUTS 0x10 -#define FT_OUTLINE_INCLUDE_STUBS 0x20 - -#define FT_OUTLINE_HIGH_PRECISION 0x100 -#define FT_OUTLINE_SINGLE_PASS 0x200 - - - /************************************************************************* - * - * @enum: - * ft_outline_flags - * - * @description: - * These constants are deprecated. Please use the corresponding - * @FT_OUTLINE_FLAGS values. - * - * @values: - * ft_outline_none :: See @FT_OUTLINE_NONE. - * ft_outline_owner :: See @FT_OUTLINE_OWNER. - * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. - * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. - * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. - * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. - * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. - */ -#define ft_outline_none FT_OUTLINE_NONE -#define ft_outline_owner FT_OUTLINE_OWNER -#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL -#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL -#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS -#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION -#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS - - /* */ - -#define FT_CURVE_TAG( flag ) ( flag & 3 ) - -#define FT_CURVE_TAG_ON 1 -#define FT_CURVE_TAG_CONIC 0 -#define FT_CURVE_TAG_CUBIC 2 - -#define FT_CURVE_TAG_HAS_SCANMODE 4 - -#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ -#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ - -#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ - FT_CURVE_TAG_TOUCH_Y ) - -#define FT_Curve_Tag_On FT_CURVE_TAG_ON -#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC -#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC -#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X -#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_MoveToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `move */ - /* to' function during outline walking/decomposition. */ - /* */ - /* A `move to' is emitted to start a new contour in an outline. */ - /* */ - /* <Input> */ - /* to :: A pointer to the target point of the `move to'. */ - /* */ - /* user :: A typeless pointer, which is passed from the caller of the */ - /* decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_MoveToFunc)( const FT_Vector* to, - void* user ); - -#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_LineToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `line */ - /* to' function during outline walking/decomposition. */ - /* */ - /* A `line to' is emitted to indicate a segment in the outline. */ - /* */ - /* <Input> */ - /* to :: A pointer to the target point of the `line to'. */ - /* */ - /* user :: A typeless pointer, which is passed from the caller of the */ - /* decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_LineToFunc)( const FT_Vector* to, - void* user ); - -#define FT_Outline_LineTo_Func FT_Outline_LineToFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_ConicToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `conic */ - /* to' function during outline walking or decomposition. */ - /* */ - /* A `conic to' is emitted to indicate a second-order Bézier arc in */ - /* the outline. */ - /* */ - /* <Input> */ - /* control :: An intermediate control point between the last position */ - /* and the new target in `to'. */ - /* */ - /* to :: A pointer to the target end point of the conic arc. */ - /* */ - /* user :: A typeless pointer, which is passed from the caller of */ - /* the decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_ConicToFunc)( const FT_Vector* control, - const FT_Vector* to, - void* user ); - -#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_CubicToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `cubic */ - /* to' function during outline walking or decomposition. */ - /* */ - /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ - /* */ - /* <Input> */ - /* control1 :: A pointer to the first Bézier control point. */ - /* */ - /* control2 :: A pointer to the second Bézier control point. */ - /* */ - /* to :: A pointer to the target end point. */ - /* */ - /* user :: A typeless pointer, which is passed from the caller of */ - /* the decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_CubicToFunc)( const FT_Vector* control1, - const FT_Vector* control2, - const FT_Vector* to, - void* user ); - -#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Outline_Funcs */ - /* */ - /* <Description> */ - /* A structure to hold various function pointers used during outline */ - /* decomposition in order to emit segments, conic, and cubic Béziers. */ - /* */ - /* <Fields> */ - /* move_to :: The `move to' emitter. */ - /* */ - /* line_to :: The segment emitter. */ - /* */ - /* conic_to :: The second-order Bézier arc emitter. */ - /* */ - /* cubic_to :: The third-order Bézier arc emitter. */ - /* */ - /* shift :: The shift that is applied to coordinates before they */ - /* are sent to the emitter. */ - /* */ - /* delta :: The delta that is applied to coordinates before they */ - /* are sent to the emitter, but after the shift. */ - /* */ - /* <Note> */ - /* The point coordinates sent to the emitters are the transformed */ - /* version of the original coordinates (this is important for high */ - /* accuracy during scan-conversion). The transformation is simple: */ - /* */ - /* { */ - /* x' = (x << shift) - delta */ - /* y' = (x << shift) - delta */ - /* } */ - /* */ - /* Set the values of `shift' and `delta' to~0 to get the original */ - /* point coordinates. */ - /* */ - typedef struct FT_Outline_Funcs_ - { - FT_Outline_MoveToFunc move_to; - FT_Outline_LineToFunc line_to; - FT_Outline_ConicToFunc conic_to; - FT_Outline_CubicToFunc cubic_to; - - int shift; - FT_Pos delta; - - } FT_Outline_Funcs; - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_IMAGE_TAG */ - /* */ - /* <Description> */ - /* This macro converts four-letter tags to an unsigned long type. */ - /* */ - /* <Note> */ - /* Since many 16-bit compilers don't like 32-bit enumerations, you */ - /* should redefine this macro in case of problems to something like */ - /* this: */ - /* */ - /* { */ - /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ - /* } */ - /* */ - /* to get a simple enumeration without assigning special numbers. */ - /* */ -#ifndef FT_IMAGE_TAG -#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ - value = ( ( (unsigned long)_x1 << 24 ) | \ - ( (unsigned long)_x2 << 16 ) | \ - ( (unsigned long)_x3 << 8 ) | \ - (unsigned long)_x4 ) -#endif /* FT_IMAGE_TAG */ - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Glyph_Format */ - /* */ - /* <Description> */ - /* An enumeration type used to describe the format of a given glyph */ - /* image. Note that this version of FreeType only supports two image */ - /* formats, even though future font drivers will be able to register */ - /* their own format. */ - /* */ - /* <Values> */ - /* FT_GLYPH_FORMAT_NONE :: */ - /* The value~0 is reserved. */ - /* */ - /* FT_GLYPH_FORMAT_COMPOSITE :: */ - /* The glyph image is a composite of several other images. This */ - /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ - /* report compound glyphs (like accented characters). */ - /* */ - /* FT_GLYPH_FORMAT_BITMAP :: */ - /* The glyph image is a bitmap, and can be described as an */ - /* @FT_Bitmap. You generally need to access the `bitmap' field of */ - /* the @FT_GlyphSlotRec structure to read it. */ - /* */ - /* FT_GLYPH_FORMAT_OUTLINE :: */ - /* The glyph image is a vectorial outline made of line segments */ - /* and Bézier arcs; it can be described as an @FT_Outline; you */ - /* generally want to access the `outline' field of the */ - /* @FT_GlyphSlotRec structure to read it. */ - /* */ - /* FT_GLYPH_FORMAT_PLOTTER :: */ - /* The glyph image is a vectorial path with no inside and outside */ - /* contours. Some Type~1 fonts, like those in the Hershey family, */ - /* contain glyphs in this format. These are described as */ - /* @FT_Outline, but FreeType isn't currently capable of rendering */ - /* them correctly. */ - /* */ - typedef enum FT_Glyph_Format_ - { - FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), - - FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), - FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), - FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), - FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) - - } FT_Glyph_Format; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_glyph_format_xxx */ - /* */ - /* <Description> */ - /* A list of deprecated constants. Use the corresponding */ - /* @FT_Glyph_Format values instead. */ - /* */ - /* <Values> */ - /* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */ - /* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */ - /* ft_glyph_format_bitmap :: See @FT_GLYPH_FORMAT_BITMAP. */ - /* ft_glyph_format_outline :: See @FT_GLYPH_FORMAT_OUTLINE. */ - /* ft_glyph_format_plotter :: See @FT_GLYPH_FORMAT_PLOTTER. */ - /* */ -#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE -#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE -#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP -#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE -#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** R A S T E R D E F I N I T I O N S *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* A raster is a scan converter, in charge of rendering an outline into */ - /* a a bitmap. This section contains the public API for rasters. */ - /* */ - /* Note that in FreeType 2, all rasters are now encapsulated within */ - /* specific modules called `renderers'. See `ftrender.h' for more */ - /* details on renderers. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* raster */ - /* */ - /* <Title> */ - /* Scanline Converter */ - /* */ - /* <Abstract> */ - /* How vectorial outlines are converted into bitmaps and pixmaps. */ - /* */ - /* <Description> */ - /* This section contains technical definitions. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Raster */ - /* */ - /* <Description> */ - /* A handle (pointer) to a raster object. Each object can be used */ - /* independently to convert an outline into a bitmap or pixmap. */ - /* */ - typedef struct FT_RasterRec_* FT_Raster; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Span */ - /* */ - /* <Description> */ - /* A structure used to model a single span of gray (or black) pixels */ - /* when rendering a monochrome or anti-aliased bitmap. */ - /* */ - /* <Fields> */ - /* x :: The span's horizontal start position. */ - /* */ - /* len :: The span's length in pixels. */ - /* */ - /* coverage :: The span color/coverage, ranging from 0 (background) */ - /* to 255 (foreground). Only used for anti-aliased */ - /* rendering. */ - /* */ - /* <Note> */ - /* This structure is used by the span drawing callback type named */ - /* @FT_SpanFunc that takes the y~coordinate of the span as a */ - /* parameter. */ - /* */ - /* The coverage value is always between 0 and 255. If you want less */ - /* gray values, the callback function has to reduce them. */ - /* */ - typedef struct FT_Span_ - { - short x; - unsigned short len; - unsigned char coverage; - - } FT_Span; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_SpanFunc */ - /* */ - /* <Description> */ - /* A function used as a call-back by the anti-aliased renderer in */ - /* order to let client applications draw themselves the gray pixel */ - /* spans on each scan line. */ - /* */ - /* <Input> */ - /* y :: The scanline's y~coordinate. */ - /* */ - /* count :: The number of spans to draw on this scanline. */ - /* */ - /* spans :: A table of `count' spans to draw on the scanline. */ - /* */ - /* user :: User-supplied data that is passed to the callback. */ - /* */ - /* <Note> */ - /* This callback allows client applications to directly render the */ - /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ - /* */ - /* This can be used to write anti-aliased outlines directly to a */ - /* given background bitmap, and even perform translucency. */ - /* */ - /* Note that the `count' field cannot be greater than a fixed value */ - /* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */ - /* `ftoption.h'. By default, this value is set to~32, which means */ - /* that if there are more than 32~spans on a given scanline, the */ - /* callback is called several times with the same `y' parameter in */ - /* order to draw all callbacks. */ - /* */ - /* Otherwise, the callback is only called once per scan-line, and */ - /* only for those scanlines that do have `gray' pixels on them. */ - /* */ - typedef void - (*FT_SpanFunc)( int y, - int count, - const FT_Span* spans, - void* user ); - -#define FT_Raster_Span_Func FT_SpanFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_BitTest_Func */ - /* */ - /* <Description> */ - /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ - /* */ - /* A function used as a call-back by the monochrome scan-converter */ - /* to test whether a given target pixel is already set to the drawing */ - /* `color'. These tests are crucial to implement drop-out control */ - /* per-se the TrueType spec. */ - /* */ - /* <Input> */ - /* y :: The pixel's y~coordinate. */ - /* */ - /* x :: The pixel's x~coordinate. */ - /* */ - /* user :: User-supplied data that is passed to the callback. */ - /* */ - /* <Return> */ - /* 1~if the pixel is `set', 0~otherwise. */ - /* */ - typedef int - (*FT_Raster_BitTest_Func)( int y, - int x, - void* user ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_BitSet_Func */ - /* */ - /* <Description> */ - /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ - /* */ - /* A function used as a call-back by the monochrome scan-converter */ - /* to set an individual target pixel. This is crucial to implement */ - /* drop-out control according to the TrueType specification. */ - /* */ - /* <Input> */ - /* y :: The pixel's y~coordinate. */ - /* */ - /* x :: The pixel's x~coordinate. */ - /* */ - /* user :: User-supplied data that is passed to the callback. */ - /* */ - /* <Return> */ - /* 1~if the pixel is `set', 0~otherwise. */ - /* */ - typedef void - (*FT_Raster_BitSet_Func)( int y, - int x, - void* user ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_RASTER_FLAG_XXX */ - /* */ - /* <Description> */ - /* A list of bit flag constants as used in the `flags' field of a */ - /* @FT_Raster_Params structure. */ - /* */ - /* <Values> */ - /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ - /* */ - /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ - /* anti-aliased glyph image should be */ - /* generated. Otherwise, it will be */ - /* monochrome (1-bit). */ - /* */ - /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ - /* rendering. In this mode, client */ - /* applications must provide their own span */ - /* callback. This lets them directly */ - /* draw or compose over an existing bitmap. */ - /* If this bit is not set, the target */ - /* pixmap's buffer _must_ be zeroed before */ - /* rendering. */ - /* */ - /* Note that for now, direct rendering is */ - /* only possible with anti-aliased glyphs. */ - /* */ - /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ - /* rendering mode. If set, the output will */ - /* be clipped to a box specified in the */ - /* `clip_box' field of the */ - /* @FT_Raster_Params structure. */ - /* */ - /* Note that by default, the glyph bitmap */ - /* is clipped to the target pixmap, except */ - /* in direct rendering mode where all spans */ - /* are generated if no clipping box is set. */ - /* */ -#define FT_RASTER_FLAG_DEFAULT 0x0 -#define FT_RASTER_FLAG_AA 0x1 -#define FT_RASTER_FLAG_DIRECT 0x2 -#define FT_RASTER_FLAG_CLIP 0x4 - - /* deprecated */ -#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT -#define ft_raster_flag_aa FT_RASTER_FLAG_AA -#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT -#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Raster_Params */ - /* */ - /* <Description> */ - /* A structure to hold the arguments used by a raster's render */ - /* function. */ - /* */ - /* <Fields> */ - /* target :: The target bitmap. */ - /* */ - /* source :: A pointer to the source glyph image (e.g., an */ - /* @FT_Outline). */ - /* */ - /* flags :: The rendering flags. */ - /* */ - /* gray_spans :: The gray span drawing callback. */ - /* */ - /* black_spans :: The black span drawing callback. UNIMPLEMENTED! */ - /* */ - /* bit_test :: The bit test callback. UNIMPLEMENTED! */ - /* */ - /* bit_set :: The bit set callback. UNIMPLEMENTED! */ - /* */ - /* user :: User-supplied data that is passed to each drawing */ - /* callback. */ - /* */ - /* clip_box :: An optional clipping box. It is only used in */ - /* direct rendering mode. Note that coordinates here */ - /* should be expressed in _integer_ pixels (and not in */ - /* 26.6 fixed-point units). */ - /* */ - /* <Note> */ - /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */ - /* bit flag is set in the `flags' field, otherwise a monochrome */ - /* bitmap is generated. */ - /* */ - /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ - /* raster will call the `gray_spans' callback to draw gray pixel */ - /* spans, in the case of an aa glyph bitmap, it will call */ - /* `black_spans', and `bit_test' and `bit_set' in the case of a */ - /* monochrome bitmap. This allows direct composition over a */ - /* pre-existing bitmap through user-provided callbacks to perform the */ - /* span drawing/composition. */ - /* */ - /* Note that the `bit_test' and `bit_set' callbacks are required when */ - /* rendering a monochrome bitmap, as they are crucial to implement */ - /* correct drop-out control as defined in the TrueType specification. */ - /* */ - typedef struct FT_Raster_Params_ - { - const FT_Bitmap* target; - const void* source; - int flags; - FT_SpanFunc gray_spans; - FT_SpanFunc black_spans; /* doesn't work! */ - FT_Raster_BitTest_Func bit_test; /* doesn't work! */ - FT_Raster_BitSet_Func bit_set; /* doesn't work! */ - void* user; - FT_BBox clip_box; - - } FT_Raster_Params; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_NewFunc */ - /* */ - /* <Description> */ - /* A function used to create a new raster object. */ - /* */ - /* <Input> */ - /* memory :: A handle to the memory allocator. */ - /* */ - /* <Output> */ - /* raster :: A handle to the new raster object. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - /* <Note> */ - /* The `memory' parameter is a typeless pointer in order to avoid */ - /* un-wanted dependencies on the rest of the FreeType code. In */ - /* practice, it is an @FT_Memory object, i.e., a handle to the */ - /* standard FreeType memory allocator. However, this field can be */ - /* completely ignored by a given raster implementation. */ - /* */ - typedef int - (*FT_Raster_NewFunc)( void* memory, - FT_Raster* raster ); - -#define FT_Raster_New_Func FT_Raster_NewFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_DoneFunc */ - /* */ - /* <Description> */ - /* A function used to destroy a given raster object. */ - /* */ - /* <Input> */ - /* raster :: A handle to the raster object. */ - /* */ - typedef void - (*FT_Raster_DoneFunc)( FT_Raster raster ); - -#define FT_Raster_Done_Func FT_Raster_DoneFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_ResetFunc */ - /* */ - /* <Description> */ - /* FreeType provides an area of memory called the `render pool', */ - /* available to all registered rasters. This pool can be freely used */ - /* during a given scan-conversion but is shared by all rasters. Its */ - /* content is thus transient. */ - /* */ - /* This function is called each time the render pool changes, or just */ - /* after a new raster object is created. */ - /* */ - /* <Input> */ - /* raster :: A handle to the new raster object. */ - /* */ - /* pool_base :: The address in memory of the render pool. */ - /* */ - /* pool_size :: The size in bytes of the render pool. */ - /* */ - /* <Note> */ - /* Rasters can ignore the render pool and rely on dynamic memory */ - /* allocation if they want to (a handle to the memory allocator is */ - /* passed to the raster constructor). However, this is not */ - /* recommended for efficiency purposes. */ - /* */ - typedef void - (*FT_Raster_ResetFunc)( FT_Raster raster, - unsigned char* pool_base, - unsigned long pool_size ); - -#define FT_Raster_Reset_Func FT_Raster_ResetFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_SetModeFunc */ - /* */ - /* <Description> */ - /* This function is a generic facility to change modes or attributes */ - /* in a given raster. This can be used for debugging purposes, or */ - /* simply to allow implementation-specific `features' in a given */ - /* raster module. */ - /* */ - /* <Input> */ - /* raster :: A handle to the new raster object. */ - /* */ - /* mode :: A 4-byte tag used to name the mode or property. */ - /* */ - /* args :: A pointer to the new mode/property to use. */ - /* */ - typedef int - (*FT_Raster_SetModeFunc)( FT_Raster raster, - unsigned long mode, - void* args ); - -#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_RenderFunc */ - /* */ - /* <Description> */ - /* Invoke a given raster to scan-convert a given glyph image into a */ - /* target bitmap. */ - /* */ - /* <Input> */ - /* raster :: A handle to the raster object. */ - /* */ - /* params :: A pointer to an @FT_Raster_Params structure used to */ - /* store the rendering parameters. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - /* <Note> */ - /* The exact format of the source image depends on the raster's glyph */ - /* format defined in its @FT_Raster_Funcs structure. It can be an */ - /* @FT_Outline or anything else in order to support a large array of */ - /* glyph formats. */ - /* */ - /* Note also that the render function can fail and return a */ - /* `FT_Err_Unimplemented_Feature' error code if the raster used does */ - /* not support direct composition. */ - /* */ - /* XXX: For now, the standard raster doesn't support direct */ - /* composition but this should change for the final release (see */ - /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ - /* for examples of distinct implementations that support direct */ - /* composition). */ - /* */ - typedef int - (*FT_Raster_RenderFunc)( FT_Raster raster, - const FT_Raster_Params* params ); - -#define FT_Raster_Render_Func FT_Raster_RenderFunc - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Raster_Funcs */ - /* */ - /* <Description> */ - /* A structure used to describe a given raster class to the library. */ - /* */ - /* <Fields> */ - /* glyph_format :: The supported glyph format for this raster. */ - /* */ - /* raster_new :: The raster constructor. */ - /* */ - /* raster_reset :: Used to reset the render pool within the raster. */ - /* */ - /* raster_render :: A function to render a glyph into a given bitmap. */ - /* */ - /* raster_done :: The raster destructor. */ - /* */ - typedef struct FT_Raster_Funcs_ - { - FT_Glyph_Format glyph_format; - FT_Raster_NewFunc raster_new; - FT_Raster_ResetFunc raster_reset; - FT_Raster_SetModeFunc raster_set_mode; - FT_Raster_RenderFunc raster_render; - FT_Raster_DoneFunc raster_done; - - } FT_Raster_Funcs; - - - /* */ - - -FT_END_HEADER - -#endif /* __FTIMAGE_H__ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/GLideN64/src/inc/freetype/include/ftincrem.h b/GLideN64/src/inc/freetype/include/ftincrem.h deleted file mode 100644 index aaf689f..0000000 --- a/GLideN64/src/inc/freetype/include/ftincrem.h +++ /dev/null @@ -1,353 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftincrem.h */ -/* */ -/* FreeType incremental loading (specification). */ -/* */ -/* Copyright 2002, 2003, 2006, 2007, 2008, 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTINCREM_H__ -#define __FTINCREM_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /*************************************************************************** - * - * @section: - * incremental - * - * @title: - * Incremental Loading - * - * @abstract: - * Custom Glyph Loading. - * - * @description: - * This section contains various functions used to perform so-called - * `incremental' glyph loading. This is a mode where all glyphs loaded - * from a given @FT_Face are provided by the client application, - * - * Apart from that, all other tables are loaded normally from the font - * file. This mode is useful when FreeType is used within another - * engine, e.g., a PostScript Imaging Processor. - * - * To enable this mode, you must use @FT_Open_Face, passing an - * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an - * @FT_Incremental_Interface value. See the comments for - * @FT_Incremental_InterfaceRec for an example. - * - */ - - - /*************************************************************************** - * - * @type: - * FT_Incremental - * - * @description: - * An opaque type describing a user-provided object used to implement - * `incremental' glyph loading within FreeType. This is used to support - * embedded fonts in certain environments (e.g., PostScript interpreters), - * where the glyph data isn't in the font file, or must be overridden by - * different values. - * - * @note: - * It is up to client applications to create and implement @FT_Incremental - * objects, as long as they provide implementations for the methods - * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc - * and @FT_Incremental_GetGlyphMetricsFunc. - * - * See the description of @FT_Incremental_InterfaceRec to understand how - * to use incremental objects with FreeType. - * - */ - typedef struct FT_IncrementalRec_* FT_Incremental; - - - /*************************************************************************** - * - * @struct: - * FT_Incremental_MetricsRec - * - * @description: - * A small structure used to contain the basic glyph metrics returned - * by the @FT_Incremental_GetGlyphMetricsFunc method. - * - * @fields: - * bearing_x :: - * Left bearing, in font units. - * - * bearing_y :: - * Top bearing, in font units. - * - * advance :: - * Horizontal component of glyph advance, in font units. - * - * advance_v :: - * Vertical component of glyph advance, in font units. - * - * @note: - * These correspond to horizontal or vertical metrics depending on the - * value of the `vertical' argument to the function - * @FT_Incremental_GetGlyphMetricsFunc. - * - */ - typedef struct FT_Incremental_MetricsRec_ - { - FT_Long bearing_x; - FT_Long bearing_y; - FT_Long advance; - FT_Long advance_v; /* since 2.3.12 */ - - } FT_Incremental_MetricsRec; - - - /*************************************************************************** - * - * @struct: - * FT_Incremental_Metrics - * - * @description: - * A handle to an @FT_Incremental_MetricsRec structure. - * - */ - typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics; - - - /*************************************************************************** - * - * @type: - * FT_Incremental_GetGlyphDataFunc - * - * @description: - * A function called by FreeType to access a given glyph's data bytes - * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is - * enabled. - * - * Note that the format of the glyph's data bytes depends on the font - * file format. For TrueType, it must correspond to the raw bytes within - * the `glyf' table. For PostScript formats, it must correspond to the - * *unencrypted* charstring bytes, without any `lenIV' header. It is - * undefined for any other format. - * - * @input: - * incremental :: - * Handle to an opaque @FT_Incremental handle provided by the client - * application. - * - * glyph_index :: - * Index of relevant glyph. - * - * @output: - * adata :: - * A structure describing the returned glyph data bytes (which will be - * accessed as a read-only byte block). - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If this function returns successfully the method - * @FT_Incremental_FreeGlyphDataFunc will be called later to release - * the data bytes. - * - * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for - * compound glyphs. - * - */ - typedef FT_Error - (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental, - FT_UInt glyph_index, - FT_Data* adata ); - - - /*************************************************************************** - * - * @type: - * FT_Incremental_FreeGlyphDataFunc - * - * @description: - * A function used to release the glyph data bytes returned by a - * successful call to @FT_Incremental_GetGlyphDataFunc. - * - * @input: - * incremental :: - * A handle to an opaque @FT_Incremental handle provided by the client - * application. - * - * data :: - * A structure describing the glyph data bytes (which will be accessed - * as a read-only byte block). - * - */ - typedef void - (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental, - FT_Data* data ); - - - /*************************************************************************** - * - * @type: - * FT_Incremental_GetGlyphMetricsFunc - * - * @description: - * A function used to retrieve the basic metrics of a given glyph index - * before accessing its data. This is necessary because, in certain - * formats like TrueType, the metrics are stored in a different place from - * the glyph images proper. - * - * @input: - * incremental :: - * A handle to an opaque @FT_Incremental handle provided by the client - * application. - * - * glyph_index :: - * Index of relevant glyph. - * - * vertical :: - * If true, return vertical metrics. - * - * ametrics :: - * This parameter is used for both input and output. - * The original glyph metrics, if any, in font units. If metrics are - * not available all the values must be set to zero. - * - * @output: - * ametrics :: - * The replacement glyph metrics in font units. - * - */ - typedef FT_Error - (*FT_Incremental_GetGlyphMetricsFunc) - ( FT_Incremental incremental, - FT_UInt glyph_index, - FT_Bool vertical, - FT_Incremental_MetricsRec *ametrics ); - - - /************************************************************************** - * - * @struct: - * FT_Incremental_FuncsRec - * - * @description: - * A table of functions for accessing fonts that load data - * incrementally. Used in @FT_Incremental_InterfaceRec. - * - * @fields: - * get_glyph_data :: - * The function to get glyph data. Must not be null. - * - * free_glyph_data :: - * The function to release glyph data. Must not be null. - * - * get_glyph_metrics :: - * The function to get glyph metrics. May be null if the font does - * not provide overriding glyph metrics. - * - */ - typedef struct FT_Incremental_FuncsRec_ - { - FT_Incremental_GetGlyphDataFunc get_glyph_data; - FT_Incremental_FreeGlyphDataFunc free_glyph_data; - FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; - - } FT_Incremental_FuncsRec; - - - /*************************************************************************** - * - * @struct: - * FT_Incremental_InterfaceRec - * - * @description: - * A structure to be used with @FT_Open_Face to indicate that the user - * wants to support incremental glyph loading. You should use it with - * @FT_PARAM_TAG_INCREMENTAL as in the following example: - * - * { - * FT_Incremental_InterfaceRec inc_int; - * FT_Parameter parameter; - * FT_Open_Args open_args; - * - * - * // set up incremental descriptor - * inc_int.funcs = my_funcs; - * inc_int.object = my_object; - * - * // set up optional parameter - * parameter.tag = FT_PARAM_TAG_INCREMENTAL; - * parameter.data = &inc_int; - * - * // set up FT_Open_Args structure - * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; - * open_args.pathname = my_font_pathname; - * open_args.num_params = 1; - * open_args.params = ¶meter; // we use one optional argument - * - * // open the font - * error = FT_Open_Face( library, &open_args, index, &face ); - * ... - * } - * - */ - typedef struct FT_Incremental_InterfaceRec_ - { - const FT_Incremental_FuncsRec* funcs; - FT_Incremental object; - - } FT_Incremental_InterfaceRec; - - - /*************************************************************************** - * - * @type: - * FT_Incremental_Interface - * - * @description: - * A pointer to an @FT_Incremental_InterfaceRec structure. - * - */ - typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_INCREMENTAL - * - * @description: - * A constant used as the tag of @FT_Parameter structures to indicate - * an incremental loading object to be used by FreeType. - * - */ -#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) - - /* */ - -FT_END_HEADER - -#endif /* __FTINCREM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftlcdfil.h b/GLideN64/src/inc/freetype/include/ftlcdfil.h deleted file mode 100644 index 39206f0..0000000 --- a/GLideN64/src/inc/freetype/include/ftlcdfil.h +++ /dev/null @@ -1,251 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftlcdfil.h */ -/* */ -/* FreeType API for color filtering of subpixel bitmap glyphs */ -/* (specification). */ -/* */ -/* Copyright 2006-2008, 2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FT_LCD_FILTER_H__ -#define __FT_LCD_FILTER_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /*************************************************************************** - * - * @section: - * lcd_filtering - * - * @title: - * LCD Filtering - * - * @abstract: - * Reduce color fringes of LCD-optimized bitmaps. - * - * @description: - * The @FT_Library_SetLcdFilter API can be used to specify a low-pass - * filter, which is then applied to LCD-optimized bitmaps generated - * through @FT_Render_Glyph. This is useful to reduce color fringes - * that would occur with unfiltered rendering. - * - * Note that no filter is active by default, and that this function is - * *not* implemented in default builds of the library. You need to - * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file - * in order to activate it. - * - * FreeType generates alpha coverage maps, which are linear by nature. - * For instance, the value 0x80 in bitmap representation means that - * (within numerical precision) 0x80/0xff fraction of that pixel is - * covered by the glyph's outline. The blending function for placing - * text over a background is - * - * { - * dst = alpha * src + (1 - alpha) * dst , - * } - * - * which is known as OVER. However, when calculating the output of the - * OVER operator, the source colors should first be transformed to a - * linear color space, then alpha blended in that space, and transformed - * back to the output color space. - * - * When linear light blending is used, the default FIR5 filtering - * weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as - * they have been designed for black on white rendering while lacking - * gamma correction. To preserve color neutrality, weights for a FIR5 - * filter should be chosen according to two free parameters `a' and `c', - * and the FIR weights should be - * - * { - * [a - c, a + c, 2 * a, a + c, a - c] . - * } - * - * This formula generates equal weights for all the color primaries - * across the filter kernel, which makes it colorless. One suggested - * set of weights is - * - * { - * [0x10, 0x50, 0x60, 0x50, 0x10] , - * } - * - * where `a' has value 0x30 and `b' value 0x20. The weights in filter - * may have a sum larger than 0x100, which increases coloration slightly - * but also improves contrast. - */ - - - /**************************************************************************** - * - * @enum: - * FT_LcdFilter - * - * @description: - * A list of values to identify various types of LCD filters. - * - * @values: - * FT_LCD_FILTER_NONE :: - * Do not perform filtering. When used with subpixel rendering, this - * results in sometimes severe color fringes. - * - * FT_LCD_FILTER_DEFAULT :: - * The default filter reduces color fringes considerably, at the cost - * of a slight blurriness in the output. - * - * FT_LCD_FILTER_LIGHT :: - * The light filter is a variant that produces less blurriness at the - * cost of slightly more color fringes than the default one. It might - * be better, depending on taste, your monitor, or your personal vision. - * - * FT_LCD_FILTER_LEGACY :: - * This filter corresponds to the original libXft color filter. It - * provides high contrast output but can exhibit really bad color - * fringes if glyphs are not extremely well hinted to the pixel grid. - * In other words, it only works well if the TrueType bytecode - * interpreter is enabled *and* high-quality hinted fonts are used. - * - * This filter is only provided for comparison purposes, and might be - * disabled or stay unsupported in the future. - * - * @since: - * 2.3.0 - */ - typedef enum FT_LcdFilter_ - { - FT_LCD_FILTER_NONE = 0, - FT_LCD_FILTER_DEFAULT = 1, - FT_LCD_FILTER_LIGHT = 2, - FT_LCD_FILTER_LEGACY = 16, - - FT_LCD_FILTER_MAX /* do not remove */ - - } FT_LcdFilter; - - - /************************************************************************** - * - * @func: - * FT_Library_SetLcdFilter - * - * @description: - * This function is used to apply color filtering to LCD decimated - * bitmaps, like the ones used when calling @FT_Render_Glyph with - * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V. - * - * @input: - * library :: - * A handle to the target library instance. - * - * filter :: - * The filter type. - * - * You can use @FT_LCD_FILTER_NONE here to disable this feature, or - * @FT_LCD_FILTER_DEFAULT to use a default filter that should work - * well on most LCD screens. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This feature is always disabled by default. Clients must make an - * explicit call to this function with a `filter' value other than - * @FT_LCD_FILTER_NONE in order to enable it. - * - * Due to *PATENTS* covering subpixel rendering, this function doesn't - * do anything except returning `FT_Err_Unimplemented_Feature' if the - * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not - * defined in your build of the library, which should correspond to all - * default builds of FreeType. - * - * The filter affects glyph bitmaps rendered through @FT_Render_Glyph, - * @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char. - * - * It does _not_ affect the output of @FT_Outline_Render and - * @FT_Outline_Get_Bitmap. - * - * If this feature is activated, the dimensions of LCD glyph bitmaps are - * either larger or taller than the dimensions of the corresponding - * outline with regards to the pixel grid. For example, for - * @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and - * up to 3~pixels to the right. - * - * The bitmap offset values are adjusted correctly, so clients shouldn't - * need to modify their layout and glyph positioning code when enabling - * the filter. - * - * @since: - * 2.3.0 - */ - FT_EXPORT( FT_Error ) - FT_Library_SetLcdFilter( FT_Library library, - FT_LcdFilter filter ); - - - /************************************************************************** - * - * @func: - * FT_Library_SetLcdFilterWeights - * - * @description: - * Use this function to override the filter weights selected by - * @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple - * (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10, - * 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and - * FT_LCD_FILTER_LEGACY. - * - * @input: - * library :: - * A handle to the target library instance. - * - * weights :: - * A pointer to an array; the function copies the first five bytes and - * uses them to specify the filter weights. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * Due to *PATENTS* covering subpixel rendering, this function doesn't - * do anything except returning `FT_Err_Unimplemented_Feature' if the - * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not - * defined in your build of the library, which should correspond to all - * default builds of FreeType. - * - * This function must be called after @FT_Library_SetLcdFilter to have - * any effect. - * - * @since: - * 2.4.0 - */ - FT_EXPORT( FT_Error ) - FT_Library_SetLcdFilterWeights( FT_Library library, - unsigned char *weights ); - - /* */ - - -FT_END_HEADER - -#endif /* __FT_LCD_FILTER_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftlist.h b/GLideN64/src/inc/freetype/include/ftlist.h deleted file mode 100644 index 241e21e..0000000 --- a/GLideN64/src/inc/freetype/include/ftlist.h +++ /dev/null @@ -1,277 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftlist.h */ -/* */ -/* Generic list support for FreeType (specification). */ -/* */ -/* Copyright 1996-2001, 2003, 2007, 2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file implements functions relative to list processing. Its */ - /* data structures are defined in `freetype.h'. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTLIST_H__ -#define __FTLIST_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* list_processing */ - /* */ - /* <Title> */ - /* List Processing */ - /* */ - /* <Abstract> */ - /* Simple management of lists. */ - /* */ - /* <Description> */ - /* This section contains various definitions related to list */ - /* processing using doubly-linked nodes. */ - /* */ - /* <Order> */ - /* FT_List */ - /* FT_ListNode */ - /* FT_ListRec */ - /* FT_ListNodeRec */ - /* */ - /* FT_List_Add */ - /* FT_List_Insert */ - /* FT_List_Find */ - /* FT_List_Remove */ - /* FT_List_Up */ - /* FT_List_Iterate */ - /* FT_List_Iterator */ - /* FT_List_Finalize */ - /* FT_List_Destructor */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Find */ - /* */ - /* <Description> */ - /* Find the list node for a given listed object. */ - /* */ - /* <Input> */ - /* list :: A pointer to the parent list. */ - /* data :: The address of the listed object. */ - /* */ - /* <Return> */ - /* List node. NULL if it wasn't found. */ - /* */ - FT_EXPORT( FT_ListNode ) - FT_List_Find( FT_List list, - void* data ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Add */ - /* */ - /* <Description> */ - /* Append an element to the end of a list. */ - /* */ - /* <InOut> */ - /* list :: A pointer to the parent list. */ - /* node :: The node to append. */ - /* */ - FT_EXPORT( void ) - FT_List_Add( FT_List list, - FT_ListNode node ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Insert */ - /* */ - /* <Description> */ - /* Insert an element at the head of a list. */ - /* */ - /* <InOut> */ - /* list :: A pointer to parent list. */ - /* node :: The node to insert. */ - /* */ - FT_EXPORT( void ) - FT_List_Insert( FT_List list, - FT_ListNode node ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Remove */ - /* */ - /* <Description> */ - /* Remove a node from a list. This function doesn't check whether */ - /* the node is in the list! */ - /* */ - /* <Input> */ - /* node :: The node to remove. */ - /* */ - /* <InOut> */ - /* list :: A pointer to the parent list. */ - /* */ - FT_EXPORT( void ) - FT_List_Remove( FT_List list, - FT_ListNode node ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Up */ - /* */ - /* <Description> */ - /* Move a node to the head/top of a list. Used to maintain LRU */ - /* lists. */ - /* */ - /* <InOut> */ - /* list :: A pointer to the parent list. */ - /* node :: The node to move. */ - /* */ - FT_EXPORT( void ) - FT_List_Up( FT_List list, - FT_ListNode node ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_List_Iterator */ - /* */ - /* <Description> */ - /* An FT_List iterator function that is called during a list parse */ - /* by @FT_List_Iterate. */ - /* */ - /* <Input> */ - /* node :: The current iteration list node. */ - /* */ - /* user :: A typeless pointer passed to @FT_List_Iterate. */ - /* Can be used to point to the iteration's state. */ - /* */ - typedef FT_Error - (*FT_List_Iterator)( FT_ListNode node, - void* user ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Iterate */ - /* */ - /* <Description> */ - /* Parse a list and calls a given iterator function on each element. */ - /* Note that parsing is stopped as soon as one of the iterator calls */ - /* returns a non-zero value. */ - /* */ - /* <Input> */ - /* list :: A handle to the list. */ - /* iterator :: An iterator function, called on each node of the list. */ - /* user :: A user-supplied field that is passed as the second */ - /* argument to the iterator. */ - /* */ - /* <Return> */ - /* The result (a FreeType error code) of the last iterator call. */ - /* */ - FT_EXPORT( FT_Error ) - FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_List_Destructor */ - /* */ - /* <Description> */ - /* An @FT_List iterator function that is called during a list */ - /* finalization by @FT_List_Finalize to destroy all elements in a */ - /* given list. */ - /* */ - /* <Input> */ - /* system :: The current system object. */ - /* */ - /* data :: The current object to destroy. */ - /* */ - /* user :: A typeless pointer passed to @FT_List_Iterate. It can */ - /* be used to point to the iteration's state. */ - /* */ - typedef void - (*FT_List_Destructor)( FT_Memory memory, - void* data, - void* user ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_List_Finalize */ - /* */ - /* <Description> */ - /* Destroy all elements in the list as well as the list itself. */ - /* */ - /* <Input> */ - /* list :: A handle to the list. */ - /* */ - /* destroy :: A list destructor that will be applied to each element */ - /* of the list. */ - /* */ - /* memory :: The current memory object that handles deallocation. */ - /* */ - /* user :: A user-supplied field that is passed as the last */ - /* argument to the destructor. */ - /* */ - /* <Note> */ - /* This function expects that all nodes added by @FT_List_Add or */ - /* @FT_List_Insert have been dynamically allocated. */ - /* */ - FT_EXPORT( void ) - FT_List_Finalize( FT_List list, - FT_List_Destructor destroy, - FT_Memory memory, - void* user ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTLIST_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftlzw.h b/GLideN64/src/inc/freetype/include/ftlzw.h deleted file mode 100644 index 00d4016..0000000 --- a/GLideN64/src/inc/freetype/include/ftlzw.h +++ /dev/null @@ -1,99 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftlzw.h */ -/* */ -/* LZW-compressed stream support. */ -/* */ -/* Copyright 2004, 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTLZW_H__ -#define __FTLZW_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* lzw */ - /* */ - /* <Title> */ - /* LZW Streams */ - /* */ - /* <Abstract> */ - /* Using LZW-compressed font files. */ - /* */ - /* <Description> */ - /* This section contains the declaration of LZW-specific functions. */ - /* */ - /*************************************************************************/ - - /************************************************************************ - * - * @function: - * FT_Stream_OpenLZW - * - * @description: - * Open a new stream to parse LZW-compressed font files. This is - * mainly used to support the compressed `*.pcf.Z' fonts that come - * with XFree86. - * - * @input: - * stream :: The target embedding stream. - * - * source :: The source stream. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The source stream must be opened _before_ calling this function. - * - * Calling the internal function `FT_Stream_Close' on the new stream will - * *not* call `FT_Stream_Close' on the source stream. None of the stream - * objects will be released to the heap. - * - * The stream implementation is very basic and resets the decompression - * process each time seeking backwards is needed within the stream - * - * In certain builds of the library, LZW compression recognition is - * automatically handled when calling @FT_New_Face or @FT_Open_Face. - * This means that if no font driver is capable of handling the raw - * compressed file, the library will try to open a LZW stream from it - * and re-open the face with it. - * - * This function may return `FT_Err_Unimplemented_Feature' if your build - * of FreeType was not compiled with LZW support. - */ - FT_EXPORT( FT_Error ) - FT_Stream_OpenLZW( FT_Stream stream, - FT_Stream source ); - - /* */ - - -FT_END_HEADER - -#endif /* __FTLZW_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftmac.h b/GLideN64/src/inc/freetype/include/ftmac.h deleted file mode 100644 index 42874fe..0000000 --- a/GLideN64/src/inc/freetype/include/ftmac.h +++ /dev/null @@ -1,274 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftmac.h */ -/* */ -/* Additional Mac-specific API. */ -/* */ -/* Copyright 1996-2001, 2004, 2006, 2007, 2013 by */ -/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* NOTE: Include this file after FT_FREETYPE_H and after any */ -/* Mac-specific headers (because this header uses Mac types such as */ -/* Handle, FSSpec, FSRef, etc.) */ -/* */ -/***************************************************************************/ - - -#ifndef __FTMAC_H__ -#define __FTMAC_H__ - - -#include <ft2build.h> - - -FT_BEGIN_HEADER - - -/* gcc-3.4.1 and later can warn about functions tagged as deprecated */ -#ifndef FT_DEPRECATED_ATTRIBUTE -#if defined(__GNUC__) && \ - ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) -#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) -#else -#define FT_DEPRECATED_ATTRIBUTE -#endif -#endif - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* mac_specific */ - /* */ - /* <Title> */ - /* Mac Specific Interface */ - /* */ - /* <Abstract> */ - /* Only available on the Macintosh. */ - /* */ - /* <Description> */ - /* The following definitions are only available if FreeType is */ - /* compiled on a Macintosh. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Face_From_FOND */ - /* */ - /* <Description> */ - /* Create a new face object from a FOND resource. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* fond :: A FOND resource. */ - /* */ - /* face_index :: Only supported for the -1 `sanity check' special */ - /* case. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Notes> */ - /* This function can be used to create @FT_Face objects from fonts */ - /* that are installed in the system as follows. */ - /* */ - /* { */ - /* fond = GetResource( 'FOND', fontName ); */ - /* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */ - /* } */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Face_From_FOND( FT_Library library, - Handle fond, - FT_Long face_index, - FT_Face *aface ) - FT_DEPRECATED_ATTRIBUTE; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_GetFile_From_Mac_Name */ - /* */ - /* <Description> */ - /* Return an FSSpec for the disk file containing the named font. */ - /* */ - /* <Input> */ - /* fontName :: Mac OS name of the font (e.g., Times New Roman */ - /* Bold). */ - /* */ - /* <Output> */ - /* pathSpec :: FSSpec to the file. For passing to */ - /* @FT_New_Face_From_FSSpec. */ - /* */ - /* face_index :: Index of the face. For passing to */ - /* @FT_New_Face_From_FSSpec. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_GetFile_From_Mac_Name( const char* fontName, - FSSpec* pathSpec, - FT_Long* face_index ) - FT_DEPRECATED_ATTRIBUTE; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_GetFile_From_Mac_ATS_Name */ - /* */ - /* <Description> */ - /* Return an FSSpec for the disk file containing the named font. */ - /* */ - /* <Input> */ - /* fontName :: Mac OS name of the font in ATS framework. */ - /* */ - /* <Output> */ - /* pathSpec :: FSSpec to the file. For passing to */ - /* @FT_New_Face_From_FSSpec. */ - /* */ - /* face_index :: Index of the face. For passing to */ - /* @FT_New_Face_From_FSSpec. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_GetFile_From_Mac_ATS_Name( const char* fontName, - FSSpec* pathSpec, - FT_Long* face_index ) - FT_DEPRECATED_ATTRIBUTE; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_GetFilePath_From_Mac_ATS_Name */ - /* */ - /* <Description> */ - /* Return a pathname of the disk file and face index for given font */ - /* name that is handled by ATS framework. */ - /* */ - /* <Input> */ - /* fontName :: Mac OS name of the font in ATS framework. */ - /* */ - /* <Output> */ - /* path :: Buffer to store pathname of the file. For passing */ - /* to @FT_New_Face. The client must allocate this */ - /* buffer before calling this function. */ - /* */ - /* maxPathSize :: Lengths of the buffer `path' that client allocated. */ - /* */ - /* face_index :: Index of the face. For passing to @FT_New_Face. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_GetFilePath_From_Mac_ATS_Name( const char* fontName, - UInt8* path, - UInt32 maxPathSize, - FT_Long* face_index ) - FT_DEPRECATED_ATTRIBUTE; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Face_From_FSSpec */ - /* */ - /* <Description> */ - /* Create a new face object from a given resource and typeface index */ - /* using an FSSpec to the font file. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* spec :: FSSpec to the font file. */ - /* */ - /* face_index :: The index of the face within the resource. The */ - /* first face has index~0. */ - /* <Output> */ - /* aface :: A handle to a new face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */ - /* it accepts an FSSpec instead of a path. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Face_From_FSSpec( FT_Library library, - const FSSpec *spec, - FT_Long face_index, - FT_Face *aface ) - FT_DEPRECATED_ATTRIBUTE; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Face_From_FSRef */ - /* */ - /* <Description> */ - /* Create a new face object from a given resource and typeface index */ - /* using an FSRef to the font file. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* spec :: FSRef to the font file. */ - /* */ - /* face_index :: The index of the face within the resource. The */ - /* first face has index~0. */ - /* <Output> */ - /* aface :: A handle to a new face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* @FT_New_Face_From_FSRef is identical to @FT_New_Face except */ - /* it accepts an FSRef instead of a path. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Face_From_FSRef( FT_Library library, - const FSRef *ref, - FT_Long face_index, - FT_Face *aface ) - FT_DEPRECATED_ATTRIBUTE; - - /* */ - - -FT_END_HEADER - - -#endif /* __FTMAC_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftmm.h b/GLideN64/src/inc/freetype/include/ftmm.h deleted file mode 100644 index 837975a..0000000 --- a/GLideN64/src/inc/freetype/include/ftmm.h +++ /dev/null @@ -1,377 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftmm.h */ -/* */ -/* FreeType Multiple Master font interface (specification). */ -/* */ -/* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTMM_H__ -#define __FTMM_H__ - - -#include <ft2build.h> -#include FT_TYPE1_TABLES_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* multiple_masters */ - /* */ - /* <Title> */ - /* Multiple Masters */ - /* */ - /* <Abstract> */ - /* How to manage Multiple Masters fonts. */ - /* */ - /* <Description> */ - /* The following types and functions are used to manage Multiple */ - /* Master fonts, i.e., the selection of specific design instances by */ - /* setting design axis coordinates. */ - /* */ - /* George Williams has extended this interface to make it work with */ - /* both Type~1 Multiple Masters fonts and GX distortable (var) */ - /* fonts. Some of these routines only work with MM fonts, others */ - /* will work with both types. They are similar enough that a */ - /* consistent interface makes sense. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_MM_Axis */ - /* */ - /* <Description> */ - /* A simple structure used to model a given axis in design space for */ - /* Multiple Masters fonts. */ - /* */ - /* This structure can't be used for GX var fonts. */ - /* */ - /* <Fields> */ - /* name :: The axis's name. */ - /* */ - /* minimum :: The axis's minimum design coordinate. */ - /* */ - /* maximum :: The axis's maximum design coordinate. */ - /* */ - typedef struct FT_MM_Axis_ - { - FT_String* name; - FT_Long minimum; - FT_Long maximum; - - } FT_MM_Axis; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Multi_Master */ - /* */ - /* <Description> */ - /* A structure used to model the axes and space of a Multiple Masters */ - /* font. */ - /* */ - /* This structure can't be used for GX var fonts. */ - /* */ - /* <Fields> */ - /* num_axis :: Number of axes. Cannot exceed~4. */ - /* */ - /* num_designs :: Number of designs; should be normally 2^num_axis */ - /* even though the Type~1 specification strangely */ - /* allows for intermediate designs to be present. This */ - /* number cannot exceed~16. */ - /* */ - /* axis :: A table of axis descriptors. */ - /* */ - typedef struct FT_Multi_Master_ - { - FT_UInt num_axis; - FT_UInt num_designs; - FT_MM_Axis axis[T1_MAX_MM_AXIS]; - - } FT_Multi_Master; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Var_Axis */ - /* */ - /* <Description> */ - /* A simple structure used to model a given axis in design space for */ - /* Multiple Masters and GX var fonts. */ - /* */ - /* <Fields> */ - /* name :: The axis's name. */ - /* Not always meaningful for GX. */ - /* */ - /* minimum :: The axis's minimum design coordinate. */ - /* */ - /* def :: The axis's default design coordinate. */ - /* FreeType computes meaningful default values for MM; it */ - /* is then an integer value, not in 16.16 format. */ - /* */ - /* maximum :: The axis's maximum design coordinate. */ - /* */ - /* tag :: The axis's tag (the GX equivalent to `name'). */ - /* FreeType provides default values for MM if possible. */ - /* */ - /* strid :: The entry in `name' table (another GX version of */ - /* `name'). */ - /* Not meaningful for MM. */ - /* */ - typedef struct FT_Var_Axis_ - { - FT_String* name; - - FT_Fixed minimum; - FT_Fixed def; - FT_Fixed maximum; - - FT_ULong tag; - FT_UInt strid; - - } FT_Var_Axis; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Var_Named_Style */ - /* */ - /* <Description> */ - /* A simple structure used to model a named style in a GX var font. */ - /* */ - /* This structure can't be used for MM fonts. */ - /* */ - /* <Fields> */ - /* coords :: The design coordinates for this style. */ - /* This is an array with one entry for each axis. */ - /* */ - /* strid :: The entry in `name' table identifying this style. */ - /* */ - typedef struct FT_Var_Named_Style_ - { - FT_Fixed* coords; - FT_UInt strid; - - } FT_Var_Named_Style; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_MM_Var */ - /* */ - /* <Description> */ - /* A structure used to model the axes and space of a Multiple Masters */ - /* or GX var distortable font. */ - /* */ - /* Some fields are specific to one format and not to the other. */ - /* */ - /* <Fields> */ - /* num_axis :: The number of axes. The maximum value is~4 for */ - /* MM; no limit in GX. */ - /* */ - /* num_designs :: The number of designs; should be normally */ - /* 2^num_axis for MM fonts. Not meaningful for GX */ - /* (where every glyph could have a different */ - /* number of designs). */ - /* */ - /* num_namedstyles :: The number of named styles; only meaningful for */ - /* GX that allows certain design coordinates to */ - /* have a string ID (in the `name' table) */ - /* associated with them. The font can tell the */ - /* user that, for example, Weight=1.5 is `Bold'. */ - /* */ - /* axis :: A table of axis descriptors. */ - /* GX fonts contain slightly more data than MM. */ - /* */ - /* namedstyles :: A table of named styles. */ - /* Only meaningful with GX. */ - /* */ - typedef struct FT_MM_Var_ - { - FT_UInt num_axis; - FT_UInt num_designs; - FT_UInt num_namedstyles; - FT_Var_Axis* axis; - FT_Var_Named_Style* namedstyle; - - } FT_MM_Var; - - - /* */ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Multi_Master */ - /* */ - /* <Description> */ - /* Retrieve the Multiple Master descriptor of a given font. */ - /* */ - /* This function can't be used with GX fonts. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face. */ - /* */ - /* <Output> */ - /* amaster :: The Multiple Masters descriptor. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Multi_Master( FT_Face face, - FT_Multi_Master *amaster ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_MM_Var */ - /* */ - /* <Description> */ - /* Retrieve the Multiple Master/GX var descriptor of a given font. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face. */ - /* */ - /* <Output> */ - /* amaster :: The Multiple Masters/GX var descriptor. */ - /* Allocates a data structure, which the user must free. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_MM_Var( FT_Face face, - FT_MM_Var* *amaster ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_MM_Design_Coordinates */ - /* */ - /* <Description> */ - /* For Multiple Masters fonts, choose an interpolated font design */ - /* through design coordinates. */ - /* */ - /* This function can't be used with GX fonts. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face. */ - /* */ - /* <Input> */ - /* num_coords :: The number of design coordinates (must be equal to */ - /* the number of axes in the font). */ - /* */ - /* coords :: An array of design coordinates. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_MM_Design_Coordinates( FT_Face face, - FT_UInt num_coords, - FT_Long* coords ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Var_Design_Coordinates */ - /* */ - /* <Description> */ - /* For Multiple Master or GX Var fonts, choose an interpolated font */ - /* design through design coordinates. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face. */ - /* */ - /* <Input> */ - /* num_coords :: The number of design coordinates (must be equal to */ - /* the number of axes in the font). */ - /* */ - /* coords :: An array of design coordinates. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Var_Design_Coordinates( FT_Face face, - FT_UInt num_coords, - FT_Fixed* coords ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_MM_Blend_Coordinates */ - /* */ - /* <Description> */ - /* For Multiple Masters and GX var fonts, choose an interpolated font */ - /* design through normalized blend coordinates. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face. */ - /* */ - /* <Input> */ - /* num_coords :: The number of design coordinates (must be equal to */ - /* the number of axes in the font). */ - /* */ - /* coords :: The design coordinates array (each element must be */ - /* between 0 and 1.0). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_MM_Blend_Coordinates( FT_Face face, - FT_UInt num_coords, - FT_Fixed* coords ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Var_Blend_Coordinates */ - /* */ - /* <Description> */ - /* This is another name of @FT_Set_MM_Blend_Coordinates. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Var_Blend_Coordinates( FT_Face face, - FT_UInt num_coords, - FT_Fixed* coords ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTMM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftmodapi.h b/GLideN64/src/inc/freetype/include/ftmodapi.h deleted file mode 100644 index 22878f8..0000000 --- a/GLideN64/src/inc/freetype/include/ftmodapi.h +++ /dev/null @@ -1,641 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftmodapi.h */ -/* */ -/* FreeType modules public interface (specification). */ -/* */ -/* Copyright 1996-2003, 2006, 2008-2010, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTMODAPI_H__ -#define __FTMODAPI_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* module_management */ - /* */ - /* <Title> */ - /* Module Management */ - /* */ - /* <Abstract> */ - /* How to add, upgrade, remove, and control modules from FreeType. */ - /* */ - /* <Description> */ - /* The definitions below are used to manage modules within FreeType. */ - /* Modules can be added, upgraded, and removed at runtime. */ - /* Additionally, some module properties can be controlled also. */ - /* */ - /* Here is a list of possible values of the `module_name' field in */ - /* the @FT_Module_Class structure. */ - /* */ - /* { */ - /* autofitter */ - /* bdf */ - /* cff */ - /* gxvalid */ - /* otvalid */ - /* pcf */ - /* pfr */ - /* psaux */ - /* pshinter */ - /* psnames */ - /* raster1, raster5 */ - /* sfnt */ - /* smooth, smooth-lcd, smooth-lcdv */ - /* truetype */ - /* type1 */ - /* type42 */ - /* t1cid */ - /* winfonts */ - /* } */ - /* */ - /* Note that the FreeType Cache sub-system is not a FreeType module. */ - /* */ - /*************************************************************************/ - - - /* module bit flags */ -#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ -#define FT_MODULE_RENDERER 2 /* this module is a renderer */ -#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ -#define FT_MODULE_STYLER 8 /* this module is a styler */ - -#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ - /* scalable fonts */ -#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ - /* support vector outlines */ -#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ - /* own hinter */ - - - /* deprecated values */ -#define ft_module_font_driver FT_MODULE_FONT_DRIVER -#define ft_module_renderer FT_MODULE_RENDERER -#define ft_module_hinter FT_MODULE_HINTER -#define ft_module_styler FT_MODULE_STYLER - -#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE -#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES -#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER - - - typedef FT_Pointer FT_Module_Interface; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Module_Constructor */ - /* */ - /* <Description> */ - /* A function used to initialize (not create) a new module object. */ - /* */ - /* <Input> */ - /* module :: The module to initialize. */ - /* */ - typedef FT_Error - (*FT_Module_Constructor)( FT_Module module ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Module_Destructor */ - /* */ - /* <Description> */ - /* A function used to finalize (not destroy) a given module object. */ - /* */ - /* <Input> */ - /* module :: The module to finalize. */ - /* */ - typedef void - (*FT_Module_Destructor)( FT_Module module ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Module_Requester */ - /* */ - /* <Description> */ - /* A function used to query a given module for a specific interface. */ - /* */ - /* <Input> */ - /* module :: The module to be searched. */ - /* */ - /* name :: The name of the interface in the module. */ - /* */ - typedef FT_Module_Interface - (*FT_Module_Requester)( FT_Module module, - const char* name ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Module_Class */ - /* */ - /* <Description> */ - /* The module class descriptor. */ - /* */ - /* <Fields> */ - /* module_flags :: Bit flags describing the module. */ - /* */ - /* module_size :: The size of one module object/instance in */ - /* bytes. */ - /* */ - /* module_name :: The name of the module. */ - /* */ - /* module_version :: The version, as a 16.16 fixed number */ - /* (major.minor). */ - /* */ - /* module_requires :: The version of FreeType this module requires, */ - /* as a 16.16 fixed number (major.minor). Starts */ - /* at version 2.0, i.e., 0x20000. */ - /* */ - /* module_init :: The initializing function. */ - /* */ - /* module_done :: The finalizing function. */ - /* */ - /* get_interface :: The interface requesting function. */ - /* */ - typedef struct FT_Module_Class_ - { - FT_ULong module_flags; - FT_Long module_size; - const FT_String* module_name; - FT_Fixed module_version; - FT_Fixed module_requires; - - const void* module_interface; - - FT_Module_Constructor module_init; - FT_Module_Destructor module_done; - FT_Module_Requester get_interface; - - } FT_Module_Class; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Add_Module */ - /* */ - /* <Description> */ - /* Add a new module to a given library instance. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library object. */ - /* */ - /* <Input> */ - /* clazz :: A pointer to class descriptor for the module. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* An error will be returned if a module already exists by that name, */ - /* or if the module requires a version of FreeType that is too great. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Add_Module( FT_Library library, - const FT_Module_Class* clazz ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Module */ - /* */ - /* <Description> */ - /* Find a module by its name. */ - /* */ - /* <Input> */ - /* library :: A handle to the library object. */ - /* */ - /* module_name :: The module's name (as an ASCII string). */ - /* */ - /* <Return> */ - /* A module handle. 0~if none was found. */ - /* */ - /* <Note> */ - /* FreeType's internal modules aren't documented very well, and you */ - /* should look up the source code for details. */ - /* */ - FT_EXPORT( FT_Module ) - FT_Get_Module( FT_Library library, - const char* module_name ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Remove_Module */ - /* */ - /* <Description> */ - /* Remove a given module from a library instance. */ - /* */ - /* <InOut> */ - /* library :: A handle to a library object. */ - /* */ - /* <Input> */ - /* module :: A handle to a module object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The module object is destroyed by the function in case of success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Remove_Module( FT_Library library, - FT_Module module ); - - - /********************************************************************** - * - * @function: - * FT_Property_Set - * - * @description: - * Set a property for a given module. - * - * @input: - * library :: - * A handle to the library the module is part of. - * - * module_name :: - * The module name. - * - * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. - * - * Note that only a few modules have properties. - * - * value :: - * A generic pointer to a variable or structure that gives the new - * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If `module_name' isn't a valid module name, or `property_name' - * doesn't specify a valid property, or if `value' doesn't represent a - * valid value for the given property, an error is returned. - * - * The following example sets property `bar' (a simple integer) in - * module `foo' to value~1. - * - * { - * FT_UInt bar; - * - * - * bar = 1; - * FT_Property_Set( library, "foo", "bar", &bar ); - * } - * - * Note that the FreeType Cache sub-system doesn't recognize module - * property changes. To avoid glyph lookup confusion within the cache - * you should call @FTC_Manager_Reset to completely flush the cache if - * a module property gets changed after @FTC_Manager_New has been - * called. - * - * It is not possible to set properties of the FreeType Cache - * sub-system itself with FT_Property_Set; use @FTC_Property_Set - * instead. - * - * @since: - * 2.4.11 - * - */ - FT_EXPORT( FT_Error ) - FT_Property_Set( FT_Library library, - const FT_String* module_name, - const FT_String* property_name, - const void* value ); - - - /********************************************************************** - * - * @function: - * FT_Property_Get - * - * @description: - * Get a module's property value. - * - * @input: - * library :: - * A handle to the library the module is part of. - * - * module_name :: - * The module name. - * - * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. - * - * @inout: - * value :: - * A generic pointer to a variable or structure that gives the - * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If `module_name' isn't a valid module name, or `property_name' - * doesn't specify a valid property, or if `value' doesn't represent a - * valid value for the given property, an error is returned. - * - * The following example gets property `baz' (a range) in module `foo'. - * - * { - * typedef range_ - * { - * FT_Int32 min; - * FT_Int32 max; - * - * } range; - * - * range baz; - * - * - * FT_Property_Get( library, "foo", "baz", &baz ); - * } - * - * It is not possible to retrieve properties of the FreeType Cache - * sub-system with FT_Property_Get; use @FTC_Property_Get instead. - * - * @since: - * 2.4.11 - * - */ - FT_EXPORT( FT_Error ) - FT_Property_Get( FT_Library library, - const FT_String* module_name, - const FT_String* property_name, - void* value ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Reference_Library */ - /* */ - /* <Description> */ - /* A counter gets initialized to~1 at the time an @FT_Library */ - /* structure is created. This function increments the counter. */ - /* @FT_Done_Library then only destroys a library if the counter is~1, */ - /* otherwise it simply decrements the counter. */ - /* */ - /* This function helps in managing life-cycles of structures that */ - /* reference @FT_Library objects. */ - /* */ - /* <Input> */ - /* library :: A handle to a target library object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Since> */ - /* 2.4.2 */ - /* */ - FT_EXPORT( FT_Error ) - FT_Reference_Library( FT_Library library ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Library */ - /* */ - /* <Description> */ - /* This function is used to create a new FreeType library instance */ - /* from a given memory object. It is thus possible to use libraries */ - /* with distinct memory allocators within the same program. */ - /* */ - /* Normally, you would call this function (followed by a call to */ - /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */ - /* instead of @FT_Init_FreeType to initialize the FreeType library. */ - /* */ - /* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */ - /* library instance. */ - /* */ - /* <Input> */ - /* memory :: A handle to the original memory object. */ - /* */ - /* <Output> */ - /* alibrary :: A pointer to handle of a new library object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* See the discussion of reference counters in the description of */ - /* @FT_Reference_Library. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Library( FT_Memory memory, - FT_Library *alibrary ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Library */ - /* */ - /* <Description> */ - /* Discard a given library object. This closes all drivers and */ - /* discards all resource objects. */ - /* */ - /* <Input> */ - /* library :: A handle to the target library. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* See the discussion of reference counters in the description of */ - /* @FT_Reference_Library. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Done_Library( FT_Library library ); - -/* */ - - typedef void - (*FT_DebugHook_Func)( void* arg ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Debug_Hook */ - /* */ - /* <Description> */ - /* Set a debug hook function for debugging the interpreter of a font */ - /* format. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library object. */ - /* */ - /* <Input> */ - /* hook_index :: The index of the debug hook. You should use the */ - /* values defined in `ftobjs.h', e.g., */ - /* `FT_DEBUG_HOOK_TRUETYPE'. */ - /* */ - /* debug_hook :: The function used to debug the interpreter. */ - /* */ - /* <Note> */ - /* Currently, four debug hook slots are available, but only two (for */ - /* the TrueType and the Type~1 interpreter) are defined. */ - /* */ - /* Since the internal headers of FreeType are no longer installed, */ - /* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */ - /* This is a bug and will be fixed in a forthcoming release. */ - /* */ - FT_EXPORT( void ) - FT_Set_Debug_Hook( FT_Library library, - FT_UInt hook_index, - FT_DebugHook_Func debug_hook ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Add_Default_Modules */ - /* */ - /* <Description> */ - /* Add the set of default drivers to a given library object. */ - /* This is only useful when you create a library object with */ - /* @FT_New_Library (usually to plug a custom memory manager). */ - /* */ - /* <InOut> */ - /* library :: A handle to a new library object. */ - /* */ - FT_EXPORT( void ) - FT_Add_Default_Modules( FT_Library library ); - - - - /************************************************************************** - * - * @section: - * truetype_engine - * - * @title: - * The TrueType Engine - * - * @abstract: - * TrueType bytecode support. - * - * @description: - * This section contains a function used to query the level of TrueType - * bytecode support compiled in this version of the library. - * - */ - - - /************************************************************************** - * - * @enum: - * FT_TrueTypeEngineType - * - * @description: - * A list of values describing which kind of TrueType bytecode - * engine is implemented in a given FT_Library instance. It is used - * by the @FT_Get_TrueType_Engine_Type function. - * - * @values: - * FT_TRUETYPE_ENGINE_TYPE_NONE :: - * The library doesn't implement any kind of bytecode interpreter. - * - * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: - * The library implements a bytecode interpreter that doesn't - * support the patented operations of the TrueType virtual machine. - * - * Its main use is to load certain Asian fonts that position and - * scale glyph components with bytecode instructions. It produces - * bad output for most other fonts. - * - * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: - * The library implements a bytecode interpreter that covers - * the full instruction set of the TrueType virtual machine (this - * was governed by patents until May 2010, hence the name). - * - * @since: - * 2.2 - * - */ - typedef enum FT_TrueTypeEngineType_ - { - FT_TRUETYPE_ENGINE_TYPE_NONE = 0, - FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, - FT_TRUETYPE_ENGINE_TYPE_PATENTED - - } FT_TrueTypeEngineType; - - - /************************************************************************** - * - * @func: - * FT_Get_TrueType_Engine_Type - * - * @description: - * Return an @FT_TrueTypeEngineType value to indicate which level of - * the TrueType virtual machine a given library instance supports. - * - * @input: - * library :: - * A library instance. - * - * @return: - * A value indicating which level is supported. - * - * @since: - * 2.2 - * - */ - FT_EXPORT( FT_TrueTypeEngineType ) - FT_Get_TrueType_Engine_Type( FT_Library library ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTMODAPI_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftmoderr.h b/GLideN64/src/inc/freetype/include/ftmoderr.h deleted file mode 100644 index 5a27db1..0000000 --- a/GLideN64/src/inc/freetype/include/ftmoderr.h +++ /dev/null @@ -1,194 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftmoderr.h */ -/* */ -/* FreeType module error offsets (specification). */ -/* */ -/* Copyright 2001-2005, 2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the FreeType module error codes. */ - /* */ - /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ - /* set, the lower byte of an error value identifies the error code as */ - /* usual. In addition, the higher byte identifies the module. For */ - /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ - /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ - /* */ - /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ - /* including the high byte. */ - /* */ - /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ - /* an error value is set to zero. */ - /* */ - /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ - /* provides some macros in `fttypes.h'. */ - /* */ - /* FT_ERR( err ) */ - /* Add current error module prefix (as defined with the */ - /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ - /* the line */ - /* */ - /* error = FT_ERR( Invalid_Outline ); */ - /* */ - /* expands to */ - /* */ - /* error = BDF_Err_Invalid_Outline; */ - /* */ - /* For simplicity, you can always use `FT_Err_Ok' directly instead */ - /* of `FT_ERR( Ok )'. */ - /* */ - /* FT_ERR_EQ( errcode, err ) */ - /* FT_ERR_NEQ( errcode, err ) */ - /* Compare error code `errcode' with the error `err' for equality */ - /* and inequality, respectively. Example: */ - /* */ - /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ - /* ... */ - /* */ - /* Using this macro you don't have to think about error prefixes. */ - /* Of course, if module errors are not active, the above example is */ - /* the same as */ - /* */ - /* if ( error == FT_Err_Invalid_Outline ) */ - /* ... */ - /* */ - /* FT_ERROR_BASE( errcode ) */ - /* FT_ERROR_MODULE( errcode ) */ - /* Get base error and module error code, respectively. */ - /* */ - /* */ - /* It can also be used to create a module error message table easily */ - /* with something like */ - /* */ - /* { */ - /* #undef __FTMODERR_H__ */ - /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ - /* #define FT_MODERR_START_LIST { */ - /* #define FT_MODERR_END_LIST { 0, 0 } }; */ - /* */ - /* const struct */ - /* { */ - /* int mod_err_offset; */ - /* const char* mod_err_msg */ - /* } ft_mod_errors[] = */ - /* */ - /* #include FT_MODULE_ERRORS_H */ - /* } */ - /* */ - /*************************************************************************/ - - -#ifndef __FTMODERR_H__ -#define __FTMODERR_H__ - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** SETUP MACROS *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - -#undef FT_NEED_EXTERN_C - -#ifndef FT_MODERRDEF - -#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS -#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, -#else -#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, -#endif - -#define FT_MODERR_START_LIST enum { -#define FT_MODERR_END_LIST FT_Mod_Err_Max }; - -#ifdef __cplusplus -#define FT_NEED_EXTERN_C - extern "C" { -#endif - -#endif /* !FT_MODERRDEF */ - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** LIST MODULE ERROR BASES *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - -#ifdef FT_MODERR_START_LIST - FT_MODERR_START_LIST -#endif - - - FT_MODERRDEF( Base, 0x000, "base module" ) - FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) - FT_MODERRDEF( BDF, 0x200, "BDF module" ) - FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) - FT_MODERRDEF( Cache, 0x400, "cache module" ) - FT_MODERRDEF( CFF, 0x500, "CFF module" ) - FT_MODERRDEF( CID, 0x600, "CID module" ) - FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) - FT_MODERRDEF( LZW, 0x800, "LZW module" ) - FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) - FT_MODERRDEF( PCF, 0xA00, "PCF module" ) - FT_MODERRDEF( PFR, 0xB00, "PFR module" ) - FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) - FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) - FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) - FT_MODERRDEF( Raster, 0xF00, "raster module" ) - FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) - FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) - FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) - FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) - FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) - FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) - FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) - - -#ifdef FT_MODERR_END_LIST - FT_MODERR_END_LIST -#endif - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** CLEANUP *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - -#ifdef FT_NEED_EXTERN_C - } -#endif - -#undef FT_MODERR_START_LIST -#undef FT_MODERR_END_LIST -#undef FT_MODERRDEF -#undef FT_NEED_EXTERN_C - - -#endif /* __FTMODERR_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftotval.h b/GLideN64/src/inc/freetype/include/ftotval.h deleted file mode 100644 index bb52dc4..0000000 --- a/GLideN64/src/inc/freetype/include/ftotval.h +++ /dev/null @@ -1,203 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftotval.h */ -/* */ -/* FreeType API for validating OpenType tables (specification). */ -/* */ -/* Copyright 2004-2007, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -/***************************************************************************/ -/* */ -/* */ -/* Warning: This module might be moved to a different library in the */ -/* future to avoid a tight dependency between FreeType and the */ -/* OpenType specification. */ -/* */ -/* */ -/***************************************************************************/ - - -#ifndef __FTOTVAL_H__ -#define __FTOTVAL_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* ot_validation */ - /* */ - /* <Title> */ - /* OpenType Validation */ - /* */ - /* <Abstract> */ - /* An API to validate OpenType tables. */ - /* */ - /* <Description> */ - /* This section contains the declaration of functions to validate */ - /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */ - /* */ - /*************************************************************************/ - - - /********************************************************************** - * - * @enum: - * FT_VALIDATE_OTXXX - * - * @description: - * A list of bit-field constants used with @FT_OpenType_Validate to - * indicate which OpenType tables should be validated. - * - * @values: - * FT_VALIDATE_BASE :: - * Validate BASE table. - * - * FT_VALIDATE_GDEF :: - * Validate GDEF table. - * - * FT_VALIDATE_GPOS :: - * Validate GPOS table. - * - * FT_VALIDATE_GSUB :: - * Validate GSUB table. - * - * FT_VALIDATE_JSTF :: - * Validate JSTF table. - * - * FT_VALIDATE_MATH :: - * Validate MATH table. - * - * FT_VALIDATE_OT :: - * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). - * - */ -#define FT_VALIDATE_BASE 0x0100 -#define FT_VALIDATE_GDEF 0x0200 -#define FT_VALIDATE_GPOS 0x0400 -#define FT_VALIDATE_GSUB 0x0800 -#define FT_VALIDATE_JSTF 0x1000 -#define FT_VALIDATE_MATH 0x2000 - -#define FT_VALIDATE_OT FT_VALIDATE_BASE | \ - FT_VALIDATE_GDEF | \ - FT_VALIDATE_GPOS | \ - FT_VALIDATE_GSUB | \ - FT_VALIDATE_JSTF | \ - FT_VALIDATE_MATH - - /* */ - - /********************************************************************** - * - * @function: - * FT_OpenType_Validate - * - * @description: - * Validate various OpenType tables to assure that all offsets and - * indices are valid. The idea is that a higher-level library that - * actually does the text layout can access those tables without - * error checking (which can be quite time consuming). - * - * @input: - * face :: - * A handle to the input face. - * - * validation_flags :: - * A bit field that specifies the tables to be validated. See - * @FT_VALIDATE_OTXXX for possible values. - * - * @output: - * BASE_table :: - * A pointer to the BASE table. - * - * GDEF_table :: - * A pointer to the GDEF table. - * - * GPOS_table :: - * A pointer to the GPOS table. - * - * GSUB_table :: - * A pointer to the GSUB table. - * - * JSTF_table :: - * A pointer to the JSTF table. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with OpenType fonts, returning an error - * otherwise. - * - * After use, the application should deallocate the five tables with - * @FT_OpenType_Free. A NULL value indicates that the table either - * doesn't exist in the font, or the application hasn't asked for - * validation. - */ - FT_EXPORT( FT_Error ) - FT_OpenType_Validate( FT_Face face, - FT_UInt validation_flags, - FT_Bytes *BASE_table, - FT_Bytes *GDEF_table, - FT_Bytes *GPOS_table, - FT_Bytes *GSUB_table, - FT_Bytes *JSTF_table ); - - /* */ - - /********************************************************************** - * - * @function: - * FT_OpenType_Free - * - * @description: - * Free the buffer allocated by OpenType validator. - * - * @input: - * face :: - * A handle to the input face. - * - * table :: - * The pointer to the buffer that is allocated by - * @FT_OpenType_Validate. - * - * @note: - * This function must be used to free the buffer allocated by - * @FT_OpenType_Validate only. - */ - FT_EXPORT( void ) - FT_OpenType_Free( FT_Face face, - FT_Bytes table ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTOTVAL_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftoutln.h b/GLideN64/src/inc/freetype/include/ftoutln.h deleted file mode 100644 index 6c6d3f9..0000000 --- a/GLideN64/src/inc/freetype/include/ftoutln.h +++ /dev/null @@ -1,572 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftoutln.h */ -/* */ -/* Support for the FT_Outline type used to store glyph shapes of */ -/* most scalable font formats (specification). */ -/* */ -/* Copyright 1996-2003, 2005-2014 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTOUTLN_H__ -#define __FTOUTLN_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* outline_processing */ - /* */ - /* <Title> */ - /* Outline Processing */ - /* */ - /* <Abstract> */ - /* Functions to create, transform, and render vectorial glyph images. */ - /* */ - /* <Description> */ - /* This section contains routines used to create and destroy scalable */ - /* glyph images known as `outlines'. These can also be measured, */ - /* transformed, and converted into bitmaps and pixmaps. */ - /* */ - /* <Order> */ - /* FT_Outline */ - /* FT_OUTLINE_FLAGS */ - /* FT_Outline_New */ - /* FT_Outline_Done */ - /* FT_Outline_Copy */ - /* FT_Outline_Translate */ - /* FT_Outline_Transform */ - /* FT_Outline_Embolden */ - /* FT_Outline_EmboldenXY */ - /* FT_Outline_Reverse */ - /* FT_Outline_Check */ - /* */ - /* FT_Outline_Get_CBox */ - /* FT_Outline_Get_BBox */ - /* */ - /* FT_Outline_Get_Bitmap */ - /* FT_Outline_Render */ - /* */ - /* FT_Outline_Decompose */ - /* FT_Outline_Funcs */ - /* FT_Outline_MoveTo_Func */ - /* FT_Outline_LineTo_Func */ - /* FT_Outline_ConicTo_Func */ - /* FT_Outline_CubicTo_Func */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Decompose */ - /* */ - /* <Description> */ - /* Walk over an outline's structure to decompose it into individual */ - /* segments and Bézier arcs. This function also emits `move to' */ - /* operations to indicate the start of new contours in the outline. */ - /* */ - /* <Input> */ - /* outline :: A pointer to the source target. */ - /* */ - /* func_interface :: A table of `emitters', i.e., function pointers */ - /* called during decomposition to indicate path */ - /* operations. */ - /* */ - /* <InOut> */ - /* user :: A typeless pointer that is passed to each */ - /* emitter during the decomposition. It can be */ - /* used to store the state during the */ - /* decomposition. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* A contour that contains a single point only is represented by a */ - /* `move to' operation followed by `line to' to the same point. In */ - /* most cases, it is best to filter this out before using the */ - /* outline for stroking purposes (otherwise it would result in a */ - /* visible dot when round caps are used). */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Decompose( FT_Outline* outline, - const FT_Outline_Funcs* func_interface, - void* user ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_New */ - /* */ - /* <Description> */ - /* Create a new outline of a given size. */ - /* */ - /* <Input> */ - /* library :: A handle to the library object from where the */ - /* outline is allocated. Note however that the new */ - /* outline will *not* necessarily be *freed*, when */ - /* destroying the library, by @FT_Done_FreeType. */ - /* */ - /* numPoints :: The maximum number of points within the outline. */ - /* Must be smaller than or equal to 0xFFFF (65535). */ - /* */ - /* numContours :: The maximum number of contours within the outline. */ - /* This value must be in the range 0 to `numPoints'. */ - /* */ - /* <Output> */ - /* anoutline :: A handle to the new outline. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The reason why this function takes a `library' parameter is simply */ - /* to use the library's memory allocator. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_New( FT_Library library, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline *anoutline ); - - - FT_EXPORT( FT_Error ) - FT_Outline_New_Internal( FT_Memory memory, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline *anoutline ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Done */ - /* */ - /* <Description> */ - /* Destroy an outline created with @FT_Outline_New. */ - /* */ - /* <Input> */ - /* library :: A handle of the library object used to allocate the */ - /* outline. */ - /* */ - /* outline :: A pointer to the outline object to be discarded. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* If the outline's `owner' field is not set, only the outline */ - /* descriptor will be released. */ - /* */ - /* The reason why this function takes an `library' parameter is */ - /* simply to use ft_mem_free(). */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Done( FT_Library library, - FT_Outline* outline ); - - - FT_EXPORT( FT_Error ) - FT_Outline_Done_Internal( FT_Memory memory, - FT_Outline* outline ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Check */ - /* */ - /* <Description> */ - /* Check the contents of an outline descriptor. */ - /* */ - /* <Input> */ - /* outline :: A handle to a source outline. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Check( FT_Outline* outline ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Get_CBox */ - /* */ - /* <Description> */ - /* Return an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bézier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ - /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component, which is dedicated to this single task. */ - /* */ - /* <Input> */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* <Output> */ - /* acbox :: The outline's control box. */ - /* */ - /* <Note> */ - /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Get_CBox( const FT_Outline* outline, - FT_BBox *acbox ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Translate */ - /* */ - /* <Description> */ - /* Apply a simple translation to the points of an outline. */ - /* */ - /* <InOut> */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* <Input> */ - /* xOffset :: The horizontal offset. */ - /* */ - /* yOffset :: The vertical offset. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Translate( const FT_Outline* outline, - FT_Pos xOffset, - FT_Pos yOffset ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Copy */ - /* */ - /* <Description> */ - /* Copy an outline into another one. Both objects must have the */ - /* same sizes (number of points & number of contours) when this */ - /* function is called. */ - /* */ - /* <Input> */ - /* source :: A handle to the source outline. */ - /* */ - /* <Output> */ - /* target :: A handle to the target outline. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Copy( const FT_Outline* source, - FT_Outline *target ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Transform */ - /* */ - /* <Description> */ - /* Apply a simple 2x2 matrix to all of an outline's points. Useful */ - /* for applying rotations, slanting, flipping, etc. */ - /* */ - /* <InOut> */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to the transformation matrix. */ - /* */ - /* <Note> */ - /* You can use @FT_Outline_Translate if you need to translate the */ - /* outline's points. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Transform( const FT_Outline* outline, - const FT_Matrix* matrix ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Embolden */ - /* */ - /* <Description> */ - /* Embolden an outline. The new outline will be at most 4~times */ - /* `strength' pixels wider and higher. You may think of the left and */ - /* bottom borders as unchanged. */ - /* */ - /* Negative `strength' values to reduce the outline thickness are */ - /* possible also. */ - /* */ - /* <InOut> */ - /* outline :: A handle to the target outline. */ - /* */ - /* <Input> */ - /* strength :: How strong the glyph is emboldened. Expressed in */ - /* 26.6 pixel format. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The used algorithm to increase or decrease the thickness of the */ - /* glyph doesn't change the number of points; this means that certain */ - /* situations like acute angles or intersections are sometimes */ - /* handled incorrectly. */ - /* */ - /* If you need `better' metrics values you should call */ - /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ - /* */ - /* Example call: */ - /* */ - /* { */ - /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ - /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ - /* FT_Outline_Embolden( &face->slot->outline, strength ); */ - /* } */ - /* */ - /* To get meaningful results, font scaling values must be set with */ - /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Embolden( FT_Outline* outline, - FT_Pos strength ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_EmboldenXY */ - /* */ - /* <Description> */ - /* Embolden an outline. The new outline will be `xstrength' pixels */ - /* wider and `ystrength' pixels higher. Otherwise, it is similar to */ - /* @FT_Outline_Embolden, which uses the same strength in both */ - /* directions. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_EmboldenXY( FT_Outline* outline, - FT_Pos xstrength, - FT_Pos ystrength ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Reverse */ - /* */ - /* <Description> */ - /* Reverse the drawing direction of an outline. This is used to */ - /* ensure consistent fill conventions for mirrored glyphs. */ - /* */ - /* <InOut> */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* <Note> */ - /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ - /* the outline's `flags' field. */ - /* */ - /* It shouldn't be used by a normal client application, unless it */ - /* knows what it is doing. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Reverse( FT_Outline* outline ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Get_Bitmap */ - /* */ - /* <Description> */ - /* Render an outline within a bitmap. The outline's image is simply */ - /* OR-ed to the target bitmap. */ - /* */ - /* <Input> */ - /* library :: A handle to a FreeType library object. */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* <InOut> */ - /* abitmap :: A pointer to the target bitmap descriptor. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function does NOT CREATE the bitmap, it only renders an */ - /* outline image within the one you pass to it! Consequently, the */ - /* various fields in `abitmap' should be set accordingly. */ - /* */ - /* It will use the raster corresponding to the default glyph format. */ - /* */ - /* The value of the `num_grays' field in `abitmap' is ignored. If */ - /* you select the gray-level rasterizer, and you want less than 256 */ - /* gray levels, you have to use @FT_Outline_Render directly. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Get_Bitmap( FT_Library library, - FT_Outline* outline, - const FT_Bitmap *abitmap ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Render */ - /* */ - /* <Description> */ - /* Render an outline within a bitmap using the current scan-convert. */ - /* This function uses an @FT_Raster_Params structure as an argument, */ - /* allowing advanced features like direct composition, translucency, */ - /* etc. */ - /* */ - /* <Input> */ - /* library :: A handle to a FreeType library object. */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* <InOut> */ - /* params :: A pointer to an @FT_Raster_Params structure used to */ - /* describe the rendering operation. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* You should know what you are doing and how @FT_Raster_Params works */ - /* to use this function. */ - /* */ - /* The field `params.source' will be set to `outline' before the scan */ - /* converter is called, which means that the value you give to it is */ - /* actually ignored. */ - /* */ - /* The gray-level rasterizer always uses 256 gray levels. If you */ - /* want less gray levels, you have to provide your own span callback. */ - /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ - /* @FT_Raster_Params structure for more details. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Render( FT_Library library, - FT_Outline* outline, - FT_Raster_Params* params ); - - - /************************************************************************** - * - * @enum: - * FT_Orientation - * - * @description: - * A list of values used to describe an outline's contour orientation. - * - * The TrueType and PostScript specifications use different conventions - * to determine whether outline contours should be filled or unfilled. - * - * @values: - * FT_ORIENTATION_TRUETYPE :: - * According to the TrueType specification, clockwise contours must - * be filled, and counter-clockwise ones must be unfilled. - * - * FT_ORIENTATION_POSTSCRIPT :: - * According to the PostScript specification, counter-clockwise contours - * must be filled, and clockwise ones must be unfilled. - * - * FT_ORIENTATION_FILL_RIGHT :: - * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to - * remember that in TrueType, everything that is to the right of - * the drawing direction of a contour must be filled. - * - * FT_ORIENTATION_FILL_LEFT :: - * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to - * remember that in PostScript, everything that is to the left of - * the drawing direction of a contour must be filled. - * - * FT_ORIENTATION_NONE :: - * The orientation cannot be determined. That is, different parts of - * the glyph have different orientation. - * - */ - typedef enum FT_Orientation_ - { - FT_ORIENTATION_TRUETYPE = 0, - FT_ORIENTATION_POSTSCRIPT = 1, - FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, - FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, - FT_ORIENTATION_NONE - - } FT_Orientation; - - - /************************************************************************** - * - * @function: - * FT_Outline_Get_Orientation - * - * @description: - * This function analyzes a glyph outline and tries to compute its - * fill orientation (see @FT_Orientation). This is done by integrating - * the total area covered by the outline. The positive integral - * corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT - * is returned. The negative integral corresponds to the counter-clockwise - * orientation and @FT_ORIENTATION_TRUETYPE is returned. - * - * Note that this will return @FT_ORIENTATION_TRUETYPE for empty - * outlines. - * - * @input: - * outline :: - * A handle to the source outline. - * - * @return: - * The orientation. - * - */ - FT_EXPORT( FT_Orientation ) - FT_Outline_Get_Orientation( FT_Outline* outline ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTOUTLN_H__ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/GLideN64/src/inc/freetype/include/ftpfr.h b/GLideN64/src/inc/freetype/include/ftpfr.h deleted file mode 100644 index 0b7b7d4..0000000 --- a/GLideN64/src/inc/freetype/include/ftpfr.h +++ /dev/null @@ -1,172 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftpfr.h */ -/* */ -/* FreeType API for accessing PFR-specific data (specification only). */ -/* */ -/* Copyright 2002, 2003, 2004, 2006, 2008, 2009 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTPFR_H__ -#define __FTPFR_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* pfr_fonts */ - /* */ - /* <Title> */ - /* PFR Fonts */ - /* */ - /* <Abstract> */ - /* PFR/TrueDoc specific API. */ - /* */ - /* <Description> */ - /* This section contains the declaration of PFR-specific functions. */ - /* */ - /*************************************************************************/ - - - /********************************************************************** - * - * @function: - * FT_Get_PFR_Metrics - * - * @description: - * Return the outline and metrics resolutions of a given PFR face. - * - * @input: - * face :: Handle to the input face. It can be a non-PFR face. - * - * @output: - * aoutline_resolution :: - * Outline resolution. This is equivalent to `face->units_per_EM' - * for non-PFR fonts. Optional (parameter can be NULL). - * - * ametrics_resolution :: - * Metrics resolution. This is equivalent to `outline_resolution' - * for non-PFR fonts. Optional (parameter can be NULL). - * - * ametrics_x_scale :: - * A 16.16 fixed-point number used to scale distance expressed - * in metrics units to device sub-pixels. This is equivalent to - * `face->size->x_scale', but for metrics only. Optional (parameter - * can be NULL). - * - * ametrics_y_scale :: - * Same as `ametrics_x_scale' but for the vertical direction. - * optional (parameter can be NULL). - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If the input face is not a PFR, this function will return an error. - * However, in all cases, it will return valid values. - */ - FT_EXPORT( FT_Error ) - FT_Get_PFR_Metrics( FT_Face face, - FT_UInt *aoutline_resolution, - FT_UInt *ametrics_resolution, - FT_Fixed *ametrics_x_scale, - FT_Fixed *ametrics_y_scale ); - - - /********************************************************************** - * - * @function: - * FT_Get_PFR_Kerning - * - * @description: - * Return the kerning pair corresponding to two glyphs in a PFR face. - * The distance is expressed in metrics units, unlike the result of - * @FT_Get_Kerning. - * - * @input: - * face :: A handle to the input face. - * - * left :: Index of the left glyph. - * - * right :: Index of the right glyph. - * - * @output: - * avector :: A kerning vector. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function always return distances in original PFR metrics - * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED - * mode, which always returns distances converted to outline units. - * - * You can use the value of the `x_scale' and `y_scale' parameters - * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. - */ - FT_EXPORT( FT_Error ) - FT_Get_PFR_Kerning( FT_Face face, - FT_UInt left, - FT_UInt right, - FT_Vector *avector ); - - - /********************************************************************** - * - * @function: - * FT_Get_PFR_Advance - * - * @description: - * Return a given glyph advance, expressed in original metrics units, - * from a PFR font. - * - * @input: - * face :: A handle to the input face. - * - * gindex :: The glyph index. - * - * @output: - * aadvance :: The glyph advance in metrics units. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics - * to convert the advance to device sub-pixels (i.e., 1/64th of pixels). - */ - FT_EXPORT( FT_Error ) - FT_Get_PFR_Advance( FT_Face face, - FT_UInt gindex, - FT_Pos *aadvance ); - - /* */ - - -FT_END_HEADER - -#endif /* __FTPFR_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftrender.h b/GLideN64/src/inc/freetype/include/ftrender.h deleted file mode 100644 index dd0229b..0000000 --- a/GLideN64/src/inc/freetype/include/ftrender.h +++ /dev/null @@ -1,238 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftrender.h */ -/* */ -/* FreeType renderer modules public interface (specification). */ -/* */ -/* Copyright 1996-2001, 2005, 2006, 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTRENDER_H__ -#define __FTRENDER_H__ - - -#include <ft2build.h> -#include FT_MODULE_H -#include FT_GLYPH_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* module_management */ - /* */ - /*************************************************************************/ - - - /* create a new glyph object */ - typedef FT_Error - (*FT_Glyph_InitFunc)( FT_Glyph glyph, - FT_GlyphSlot slot ); - - /* destroys a given glyph object */ - typedef void - (*FT_Glyph_DoneFunc)( FT_Glyph glyph ); - - typedef void - (*FT_Glyph_TransformFunc)( FT_Glyph glyph, - const FT_Matrix* matrix, - const FT_Vector* delta ); - - typedef void - (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph, - FT_BBox* abbox ); - - typedef FT_Error - (*FT_Glyph_CopyFunc)( FT_Glyph source, - FT_Glyph target ); - - typedef FT_Error - (*FT_Glyph_PrepareFunc)( FT_Glyph glyph, - FT_GlyphSlot slot ); - -/* deprecated */ -#define FT_Glyph_Init_Func FT_Glyph_InitFunc -#define FT_Glyph_Done_Func FT_Glyph_DoneFunc -#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc -#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc -#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc -#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc - - - struct FT_Glyph_Class_ - { - FT_Long glyph_size; - FT_Glyph_Format glyph_format; - FT_Glyph_InitFunc glyph_init; - FT_Glyph_DoneFunc glyph_done; - FT_Glyph_CopyFunc glyph_copy; - FT_Glyph_TransformFunc glyph_transform; - FT_Glyph_GetBBoxFunc glyph_bbox; - FT_Glyph_PrepareFunc glyph_prepare; - }; - - - typedef FT_Error - (*FT_Renderer_RenderFunc)( FT_Renderer renderer, - FT_GlyphSlot slot, - FT_UInt mode, - const FT_Vector* origin ); - - typedef FT_Error - (*FT_Renderer_TransformFunc)( FT_Renderer renderer, - FT_GlyphSlot slot, - const FT_Matrix* matrix, - const FT_Vector* delta ); - - - typedef void - (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer, - FT_GlyphSlot slot, - FT_BBox* cbox ); - - - typedef FT_Error - (*FT_Renderer_SetModeFunc)( FT_Renderer renderer, - FT_ULong mode_tag, - FT_Pointer mode_ptr ); - -/* deprecated identifiers */ -#define FTRenderer_render FT_Renderer_RenderFunc -#define FTRenderer_transform FT_Renderer_TransformFunc -#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc -#define FTRenderer_setMode FT_Renderer_SetModeFunc - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Renderer_Class */ - /* */ - /* <Description> */ - /* The renderer module class descriptor. */ - /* */ - /* <Fields> */ - /* root :: The root @FT_Module_Class fields. */ - /* */ - /* glyph_format :: The glyph image format this renderer handles. */ - /* */ - /* render_glyph :: A method used to render the image that is in a */ - /* given glyph slot into a bitmap. */ - /* */ - /* transform_glyph :: A method used to transform the image that is in */ - /* a given glyph slot. */ - /* */ - /* get_glyph_cbox :: A method used to access the glyph's cbox. */ - /* */ - /* set_mode :: A method used to pass additional parameters. */ - /* */ - /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */ - /* This is a pointer to its raster's class. */ - /* */ - typedef struct FT_Renderer_Class_ - { - FT_Module_Class root; - - FT_Glyph_Format glyph_format; - - FT_Renderer_RenderFunc render_glyph; - FT_Renderer_TransformFunc transform_glyph; - FT_Renderer_GetCBoxFunc get_glyph_cbox; - FT_Renderer_SetModeFunc set_mode; - - FT_Raster_Funcs* raster_class; - - } FT_Renderer_Class; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Renderer */ - /* */ - /* <Description> */ - /* Retrieve the current renderer for a given glyph format. */ - /* */ - /* <Input> */ - /* library :: A handle to the library object. */ - /* */ - /* format :: The glyph format. */ - /* */ - /* <Return> */ - /* A renderer handle. 0~if none found. */ - /* */ - /* <Note> */ - /* An error will be returned if a module already exists by that name, */ - /* or if the module requires a version of FreeType that is too great. */ - /* */ - /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */ - /* renderer by its name, use @FT_Get_Module. */ - /* */ - FT_EXPORT( FT_Renderer ) - FT_Get_Renderer( FT_Library library, - FT_Glyph_Format format ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Renderer */ - /* */ - /* <Description> */ - /* Set the current renderer to use, and set additional mode. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library object. */ - /* */ - /* <Input> */ - /* renderer :: A handle to the renderer object. */ - /* */ - /* num_params :: The number of additional parameters. */ - /* */ - /* parameters :: Additional parameters. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* In case of success, the renderer will be used to convert glyph */ - /* images in the renderer's known format into bitmaps. */ - /* */ - /* This doesn't change the current renderer for other formats. */ - /* */ - /* Currently, only the B/W renderer, if compiled with */ - /* FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels */ - /* anti-aliasing mode; this option must be set directly in */ - /* `ftraster.c' and is undefined by default) accepts a single tag */ - /* `pal5' to set its gray palette as a character string with */ - /* 5~elements. Consequently, the third and fourth argument are zero */ - /* normally. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Renderer( FT_Library library, - FT_Renderer renderer, - FT_UInt num_params, - FT_Parameter* parameters ); - - - /* */ - - -FT_END_HEADER - -#endif /* __FTRENDER_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftsizes.h b/GLideN64/src/inc/freetype/include/ftsizes.h deleted file mode 100644 index 4167045..0000000 --- a/GLideN64/src/inc/freetype/include/ftsizes.h +++ /dev/null @@ -1,159 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftsizes.h */ -/* */ -/* FreeType size objects management (specification). */ -/* */ -/* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Typical application would normally not need to use these functions. */ - /* However, they have been placed in a public API for the rare cases */ - /* where they are needed. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTSIZES_H__ -#define __FTSIZES_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* sizes_management */ - /* */ - /* <Title> */ - /* Size Management */ - /* */ - /* <Abstract> */ - /* Managing multiple sizes per face. */ - /* */ - /* <Description> */ - /* When creating a new face object (e.g., with @FT_New_Face), an */ - /* @FT_Size object is automatically created and used to store all */ - /* pixel-size dependent information, available in the `face->size' */ - /* field. */ - /* */ - /* It is however possible to create more sizes for a given face, */ - /* mostly in order to manage several character pixel sizes of the */ - /* same font family and style. See @FT_New_Size and @FT_Done_Size. */ - /* */ - /* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */ - /* modify the contents of the current `active' size; you thus need */ - /* to use @FT_Activate_Size to change it. */ - /* */ - /* 99% of applications won't need the functions provided here, */ - /* especially if they use the caching sub-system, so be cautious */ - /* when using these. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Size */ - /* */ - /* <Description> */ - /* Create a new size object from a given face object. */ - /* */ - /* <Input> */ - /* face :: A handle to a parent face object. */ - /* */ - /* <Output> */ - /* asize :: A handle to a new size object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* You need to call @FT_Activate_Size in order to select the new size */ - /* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */ - /* @FT_Load_Glyph, @FT_Load_Char, etc. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Size( FT_Face face, - FT_Size* size ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Size */ - /* */ - /* <Description> */ - /* Discard a given size object. Note that @FT_Done_Face */ - /* automatically discards all size objects allocated with */ - /* @FT_New_Size. */ - /* */ - /* <Input> */ - /* size :: A handle to a target size object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Done_Size( FT_Size size ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Activate_Size */ - /* */ - /* <Description> */ - /* Even though it is possible to create several size objects for a */ - /* given face (see @FT_New_Size for details), functions like */ - /* @FT_Load_Glyph or @FT_Load_Char only use the one that has been */ - /* activated last to determine the `current character pixel size'. */ - /* */ - /* This function can be used to `activate' a previously created size */ - /* object. */ - /* */ - /* <Input> */ - /* size :: A handle to a target size object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* If `face' is the size's parent face object, this function changes */ - /* the value of `face->size' to the input size handle. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Activate_Size( FT_Size size ); - - /* */ - - -FT_END_HEADER - -#endif /* __FTSIZES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftsnames.h b/GLideN64/src/inc/freetype/include/ftsnames.h deleted file mode 100644 index 88af440..0000000 --- a/GLideN64/src/inc/freetype/include/ftsnames.h +++ /dev/null @@ -1,200 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftsnames.h */ -/* */ -/* Simple interface to access SFNT name tables (which are used */ -/* to hold font names, copyright info, notices, etc.) (specification). */ -/* */ -/* This is _not_ used to retrieve glyph names! */ -/* */ -/* Copyright 1996-2003, 2006, 2009, 2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FT_SFNT_NAMES_H__ -#define __FT_SFNT_NAMES_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* sfnt_names */ - /* */ - /* <Title> */ - /* SFNT Names */ - /* */ - /* <Abstract> */ - /* Access the names embedded in TrueType and OpenType files. */ - /* */ - /* <Description> */ - /* The TrueType and OpenType specifications allow the inclusion of */ - /* a special `names table' in font files. This table contains */ - /* textual (and internationalized) information regarding the font, */ - /* like family name, copyright, version, etc. */ - /* */ - /* The definitions below are used to access them if available. */ - /* */ - /* Note that this has nothing to do with glyph names! */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_SfntName */ - /* */ - /* <Description> */ - /* A structure used to model an SFNT `name' table entry. */ - /* */ - /* <Fields> */ - /* platform_id :: The platform ID for `string'. */ - /* */ - /* encoding_id :: The encoding ID for `string'. */ - /* */ - /* language_id :: The language ID for `string'. */ - /* */ - /* name_id :: An identifier for `string'. */ - /* */ - /* string :: The `name' string. Note that its format differs */ - /* depending on the (platform,encoding) pair. It can */ - /* be a Pascal String, a UTF-16 one, etc. */ - /* */ - /* Generally speaking, the string is not */ - /* zero-terminated. Please refer to the TrueType */ - /* specification for details. */ - /* */ - /* string_len :: The length of `string' in bytes. */ - /* */ - /* <Note> */ - /* Possible values for `platform_id', `encoding_id', `language_id', */ - /* and `name_id' are given in the file `ttnameid.h'. For details */ - /* please refer to the TrueType or OpenType specification. */ - /* */ - /* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */ - /* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */ - /* */ - typedef struct FT_SfntName_ - { - FT_UShort platform_id; - FT_UShort encoding_id; - FT_UShort language_id; - FT_UShort name_id; - - FT_Byte* string; /* this string is *not* null-terminated! */ - FT_UInt string_len; /* in bytes */ - - } FT_SfntName; - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Sfnt_Name_Count */ - /* */ - /* <Description> */ - /* Retrieve the number of name strings in the SFNT `name' table. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face. */ - /* */ - /* <Return> */ - /* The number of strings in the `name' table. */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Get_Sfnt_Name_Count( FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Sfnt_Name */ - /* */ - /* <Description> */ - /* Retrieve a string of the SFNT `name' table for a given index. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face. */ - /* */ - /* idx :: The index of the `name' string. */ - /* */ - /* <Output> */ - /* aname :: The indexed @FT_SfntName structure. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The `string' array returned in the `aname' structure is not */ - /* null-terminated. The application should deallocate it if it is no */ - /* longer in use. */ - /* */ - /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */ - /* `name' table entries, then do a loop until you get the right */ - /* platform, encoding, and name ID. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Sfnt_Name( FT_Face face, - FT_UInt idx, - FT_SfntName *aname ); - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY - * - * @description: - * A constant used as the tag of @FT_Parameter structures to make - * FT_Open_Face() ignore preferred family subfamily names in `name' - * table since OpenType version 1.4. For backwards compatibility with - * legacy systems that have a 4-face-per-family restriction. - * - */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY - * - * @description: - * A constant used as the tag of @FT_Parameter structures to make - * FT_Open_Face() ignore preferred subfamily names in `name' table since - * OpenType version 1.4. For backwards compatibility with legacy - * systems that have a 4-face-per-family restriction. - * - */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) - - /* */ - - -FT_END_HEADER - -#endif /* __FT_SFNT_NAMES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftstroke.h b/GLideN64/src/inc/freetype/include/ftstroke.h deleted file mode 100644 index a498e4a..0000000 --- a/GLideN64/src/inc/freetype/include/ftstroke.h +++ /dev/null @@ -1,751 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftstroke.h */ -/* */ -/* FreeType path stroker (specification). */ -/* */ -/* Copyright 2002-2006, 2008, 2009, 2011-2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FT_STROKE_H__ -#define __FT_STROKE_H__ - -#include <ft2build.h> -#include FT_OUTLINE_H -#include FT_GLYPH_H - - -FT_BEGIN_HEADER - - - /************************************************************************ - * - * @section: - * glyph_stroker - * - * @title: - * Glyph Stroker - * - * @abstract: - * Generating bordered and stroked glyphs. - * - * @description: - * This component generates stroked outlines of a given vectorial - * glyph. It also allows you to retrieve the `outside' and/or the - * `inside' borders of the stroke. - * - * This can be useful to generate `bordered' glyph, i.e., glyphs - * displayed with a coloured (and anti-aliased) border around their - * shape. - */ - - - /************************************************************** - * - * @type: - * FT_Stroker - * - * @description: - * Opaque handler to a path stroker object. - */ - typedef struct FT_StrokerRec_* FT_Stroker; - - - /************************************************************** - * - * @enum: - * FT_Stroker_LineJoin - * - * @description: - * These values determine how two joining lines are rendered - * in a stroker. - * - * @values: - * FT_STROKER_LINEJOIN_ROUND :: - * Used to render rounded line joins. Circular arcs are used - * to join two lines smoothly. - * - * FT_STROKER_LINEJOIN_BEVEL :: - * Used to render beveled line joins. The outer corner of - * the joined lines is filled by enclosing the triangular - * region of the corner with a straight line between the - * outer corners of each stroke. - * - * FT_STROKER_LINEJOIN_MITER_FIXED :: - * Used to render mitered line joins, with fixed bevels if the - * miter limit is exceeded. The outer edges of the strokes - * for the two segments are extended until they meet at an - * angle. If the segments meet at too sharp an angle (such - * that the miter would extend from the intersection of the - * segments a distance greater than the product of the miter - * limit value and the border radius), then a bevel join (see - * above) is used instead. This prevents long spikes being - * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter - * line join as used in PostScript and PDF. - * - * FT_STROKER_LINEJOIN_MITER_VARIABLE :: - * FT_STROKER_LINEJOIN_MITER :: - * Used to render mitered line joins, with variable bevels if - * the miter limit is exceeded. The intersection of the - * strokes is clipped at a line perpendicular to the bisector - * of the angle between the strokes, at the distance from the - * intersection of the segments equal to the product of the - * miter limit value and the border radius. This prevents - * long spikes being created. - * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line - * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias - * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for - * backwards compatibility. - */ - typedef enum FT_Stroker_LineJoin_ - { - FT_STROKER_LINEJOIN_ROUND = 0, - FT_STROKER_LINEJOIN_BEVEL = 1, - FT_STROKER_LINEJOIN_MITER_VARIABLE = 2, - FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE, - FT_STROKER_LINEJOIN_MITER_FIXED = 3 - - } FT_Stroker_LineJoin; - - - /************************************************************** - * - * @enum: - * FT_Stroker_LineCap - * - * @description: - * These values determine how the end of opened sub-paths are - * rendered in a stroke. - * - * @values: - * FT_STROKER_LINECAP_BUTT :: - * The end of lines is rendered as a full stop on the last - * point itself. - * - * FT_STROKER_LINECAP_ROUND :: - * The end of lines is rendered as a half-circle around the - * last point. - * - * FT_STROKER_LINECAP_SQUARE :: - * The end of lines is rendered as a square around the - * last point. - */ - typedef enum FT_Stroker_LineCap_ - { - FT_STROKER_LINECAP_BUTT = 0, - FT_STROKER_LINECAP_ROUND, - FT_STROKER_LINECAP_SQUARE - - } FT_Stroker_LineCap; - - - /************************************************************** - * - * @enum: - * FT_StrokerBorder - * - * @description: - * These values are used to select a given stroke border - * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder. - * - * @values: - * FT_STROKER_BORDER_LEFT :: - * Select the left border, relative to the drawing direction. - * - * FT_STROKER_BORDER_RIGHT :: - * Select the right border, relative to the drawing direction. - * - * @note: - * Applications are generally interested in the `inside' and `outside' - * borders. However, there is no direct mapping between these and the - * `left' and `right' ones, since this really depends on the glyph's - * drawing orientation, which varies between font formats. - * - * You can however use @FT_Outline_GetInsideBorder and - * @FT_Outline_GetOutsideBorder to get these. - */ - typedef enum FT_StrokerBorder_ - { - FT_STROKER_BORDER_LEFT = 0, - FT_STROKER_BORDER_RIGHT - - } FT_StrokerBorder; - - - /************************************************************** - * - * @function: - * FT_Outline_GetInsideBorder - * - * @description: - * Retrieve the @FT_StrokerBorder value corresponding to the - * `inside' borders of a given outline. - * - * @input: - * outline :: - * The source outline handle. - * - * @return: - * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid - * outlines. - */ - FT_EXPORT( FT_StrokerBorder ) - FT_Outline_GetInsideBorder( FT_Outline* outline ); - - - /************************************************************** - * - * @function: - * FT_Outline_GetOutsideBorder - * - * @description: - * Retrieve the @FT_StrokerBorder value corresponding to the - * `outside' borders of a given outline. - * - * @input: - * outline :: - * The source outline handle. - * - * @return: - * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid - * outlines. - */ - FT_EXPORT( FT_StrokerBorder ) - FT_Outline_GetOutsideBorder( FT_Outline* outline ); - - - /************************************************************** - * - * @function: - * FT_Stroker_New - * - * @description: - * Create a new stroker object. - * - * @input: - * library :: - * FreeType library handle. - * - * @output: - * astroker :: - * A new stroker object handle. NULL in case of error. - * - * @return: - * FreeType error code. 0~means success. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_New( FT_Library library, - FT_Stroker *astroker ); - - - /************************************************************** - * - * @function: - * FT_Stroker_Set - * - * @description: - * Reset a stroker object's attributes. - * - * @input: - * stroker :: - * The target stroker handle. - * - * radius :: - * The border radius. - * - * line_cap :: - * The line cap style. - * - * line_join :: - * The line join style. - * - * miter_limit :: - * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and - * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, - * expressed as 16.16 fixed-point value. - * - * @note: - * The radius is expressed in the same units as the outline - * coordinates. - */ - FT_EXPORT( void ) - FT_Stroker_Set( FT_Stroker stroker, - FT_Fixed radius, - FT_Stroker_LineCap line_cap, - FT_Stroker_LineJoin line_join, - FT_Fixed miter_limit ); - - - /************************************************************** - * - * @function: - * FT_Stroker_Rewind - * - * @description: - * Reset a stroker object without changing its attributes. - * You should call this function before beginning a new - * series of calls to @FT_Stroker_BeginSubPath or - * @FT_Stroker_EndSubPath. - * - * @input: - * stroker :: - * The target stroker handle. - */ - FT_EXPORT( void ) - FT_Stroker_Rewind( FT_Stroker stroker ); - - - /************************************************************** - * - * @function: - * FT_Stroker_ParseOutline - * - * @description: - * A convenience function used to parse a whole outline with - * the stroker. The resulting outline(s) can be retrieved - * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export. - * - * @input: - * stroker :: - * The target stroker handle. - * - * outline :: - * The source outline. - * - * opened :: - * A boolean. If~1, the outline is treated as an open path instead - * of a closed one. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If `opened' is~0 (the default), the outline is treated as a closed - * path, and the stroker generates two distinct `border' outlines. - * - * If `opened' is~1, the outline is processed as an open path, and the - * stroker generates a single `stroke' outline. - * - * This function calls @FT_Stroker_Rewind automatically. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_ParseOutline( FT_Stroker stroker, - FT_Outline* outline, - FT_Bool opened ); - - - /************************************************************** - * - * @function: - * FT_Stroker_BeginSubPath - * - * @description: - * Start a new sub-path in the stroker. - * - * @input: - * stroker :: - * The target stroker handle. - * - * to :: - * A pointer to the start vector. - * - * open :: - * A boolean. If~1, the sub-path is treated as an open one. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function is useful when you need to stroke a path that is - * not stored as an @FT_Outline object. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_BeginSubPath( FT_Stroker stroker, - FT_Vector* to, - FT_Bool open ); - - - /************************************************************** - * - * @function: - * FT_Stroker_EndSubPath - * - * @description: - * Close the current sub-path in the stroker. - * - * @input: - * stroker :: - * The target stroker handle. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * You should call this function after @FT_Stroker_BeginSubPath. - * If the subpath was not `opened', this function `draws' a - * single line segment to the start position when needed. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_EndSubPath( FT_Stroker stroker ); - - - /************************************************************** - * - * @function: - * FT_Stroker_LineTo - * - * @description: - * `Draw' a single line segment in the stroker's current sub-path, - * from the last position. - * - * @input: - * stroker :: - * The target stroker handle. - * - * to :: - * A pointer to the destination point. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * You should call this function between @FT_Stroker_BeginSubPath and - * @FT_Stroker_EndSubPath. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_LineTo( FT_Stroker stroker, - FT_Vector* to ); - - - /************************************************************** - * - * @function: - * FT_Stroker_ConicTo - * - * @description: - * `Draw' a single quadratic Bézier in the stroker's current sub-path, - * from the last position. - * - * @input: - * stroker :: - * The target stroker handle. - * - * control :: - * A pointer to a Bézier control point. - * - * to :: - * A pointer to the destination point. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * You should call this function between @FT_Stroker_BeginSubPath and - * @FT_Stroker_EndSubPath. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_ConicTo( FT_Stroker stroker, - FT_Vector* control, - FT_Vector* to ); - - - /************************************************************** - * - * @function: - * FT_Stroker_CubicTo - * - * @description: - * `Draw' a single cubic Bézier in the stroker's current sub-path, - * from the last position. - * - * @input: - * stroker :: - * The target stroker handle. - * - * control1 :: - * A pointer to the first Bézier control point. - * - * control2 :: - * A pointer to second Bézier control point. - * - * to :: - * A pointer to the destination point. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * You should call this function between @FT_Stroker_BeginSubPath and - * @FT_Stroker_EndSubPath. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_CubicTo( FT_Stroker stroker, - FT_Vector* control1, - FT_Vector* control2, - FT_Vector* to ); - - - /************************************************************** - * - * @function: - * FT_Stroker_GetBorderCounts - * - * @description: - * Call this function once you have finished parsing your paths - * with the stroker. It returns the number of points and - * contours necessary to export one of the `border' or `stroke' - * outlines generated by the stroker. - * - * @input: - * stroker :: - * The target stroker handle. - * - * border :: - * The border index. - * - * @output: - * anum_points :: - * The number of points. - * - * anum_contours :: - * The number of contours. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * When an outline, or a sub-path, is `closed', the stroker generates - * two independent `border' outlines, named `left' and `right'. - * - * When the outline, or a sub-path, is `opened', the stroker merges - * the `border' outlines with caps. The `left' border receives all - * points, while the `right' border becomes empty. - * - * Use the function @FT_Stroker_GetCounts instead if you want to - * retrieve the counts associated to both borders. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_GetBorderCounts( FT_Stroker stroker, - FT_StrokerBorder border, - FT_UInt *anum_points, - FT_UInt *anum_contours ); - - - /************************************************************** - * - * @function: - * FT_Stroker_ExportBorder - * - * @description: - * Call this function after @FT_Stroker_GetBorderCounts to - * export the corresponding border to your own @FT_Outline - * structure. - * - * Note that this function appends the border points and - * contours to your outline, but does not try to resize its - * arrays. - * - * @input: - * stroker :: - * The target stroker handle. - * - * border :: - * The border index. - * - * outline :: - * The target outline handle. - * - * @note: - * Always call this function after @FT_Stroker_GetBorderCounts to - * get sure that there is enough room in your @FT_Outline object to - * receive all new data. - * - * When an outline, or a sub-path, is `closed', the stroker generates - * two independent `border' outlines, named `left' and `right' - * - * When the outline, or a sub-path, is `opened', the stroker merges - * the `border' outlines with caps. The `left' border receives all - * points, while the `right' border becomes empty. - * - * Use the function @FT_Stroker_Export instead if you want to - * retrieve all borders at once. - */ - FT_EXPORT( void ) - FT_Stroker_ExportBorder( FT_Stroker stroker, - FT_StrokerBorder border, - FT_Outline* outline ); - - - /************************************************************** - * - * @function: - * FT_Stroker_GetCounts - * - * @description: - * Call this function once you have finished parsing your paths - * with the stroker. It returns the number of points and - * contours necessary to export all points/borders from the stroked - * outline/path. - * - * @input: - * stroker :: - * The target stroker handle. - * - * @output: - * anum_points :: - * The number of points. - * - * anum_contours :: - * The number of contours. - * - * @return: - * FreeType error code. 0~means success. - */ - FT_EXPORT( FT_Error ) - FT_Stroker_GetCounts( FT_Stroker stroker, - FT_UInt *anum_points, - FT_UInt *anum_contours ); - - - /************************************************************** - * - * @function: - * FT_Stroker_Export - * - * @description: - * Call this function after @FT_Stroker_GetBorderCounts to - * export all borders to your own @FT_Outline structure. - * - * Note that this function appends the border points and - * contours to your outline, but does not try to resize its - * arrays. - * - * @input: - * stroker :: - * The target stroker handle. - * - * outline :: - * The target outline handle. - */ - FT_EXPORT( void ) - FT_Stroker_Export( FT_Stroker stroker, - FT_Outline* outline ); - - - /************************************************************** - * - * @function: - * FT_Stroker_Done - * - * @description: - * Destroy a stroker object. - * - * @input: - * stroker :: - * A stroker handle. Can be NULL. - */ - FT_EXPORT( void ) - FT_Stroker_Done( FT_Stroker stroker ); - - - /************************************************************** - * - * @function: - * FT_Glyph_Stroke - * - * @description: - * Stroke a given outline glyph object with a given stroker. - * - * @inout: - * pglyph :: - * Source glyph handle on input, new glyph handle on output. - * - * @input: - * stroker :: - * A stroker handle. - * - * destroy :: - * A Boolean. If~1, the source glyph object is destroyed - * on success. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The source glyph is untouched in case of error. - * - * Adding stroke may yield a significantly wider and taller glyph - * depending on how large of a radius was used to stroke the glyph. You - * may need to manually adjust horizontal and vertical advance amounts - * to account for this added size. - */ - FT_EXPORT( FT_Error ) - FT_Glyph_Stroke( FT_Glyph *pglyph, - FT_Stroker stroker, - FT_Bool destroy ); - - - /************************************************************** - * - * @function: - * FT_Glyph_StrokeBorder - * - * @description: - * Stroke a given outline glyph object with a given stroker, but - * only return either its inside or outside border. - * - * @inout: - * pglyph :: - * Source glyph handle on input, new glyph handle on output. - * - * @input: - * stroker :: - * A stroker handle. - * - * inside :: - * A Boolean. If~1, return the inside border, otherwise - * the outside border. - * - * destroy :: - * A Boolean. If~1, the source glyph object is destroyed - * on success. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The source glyph is untouched in case of error. - * - * Adding stroke may yield a significantly wider and taller glyph - * depending on how large of a radius was used to stroke the glyph. You - * may need to manually adjust horizontal and vertical advance amounts - * to account for this added size. - */ - FT_EXPORT( FT_Error ) - FT_Glyph_StrokeBorder( FT_Glyph *pglyph, - FT_Stroker stroker, - FT_Bool inside, - FT_Bool destroy ); - - /* */ - -FT_END_HEADER - -#endif /* __FT_STROKE_H__ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/GLideN64/src/inc/freetype/include/ftsynth.h b/GLideN64/src/inc/freetype/include/ftsynth.h deleted file mode 100644 index 839ab5e..0000000 --- a/GLideN64/src/inc/freetype/include/ftsynth.h +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftsynth.h */ -/* */ -/* FreeType synthesizing code for emboldening and slanting */ -/* (specification). */ -/* */ -/* Copyright 2000-2001, 2003, 2006, 2008, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********* *********/ - /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ - /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ - /********* FREETYPE DEVELOPMENT TEAM *********/ - /********* *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* Main reason for not lifting the functions in this module to a */ - /* `standard' API is that the used parameters for emboldening and */ - /* slanting are not configurable. Consider the functions as a */ - /* code resource that should be copied into the application and */ - /* adapted to the particular needs. */ - - -#ifndef __FTSYNTH_H__ -#define __FTSYNTH_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /* Embolden a glyph by a `reasonable' value (which is highly a matter of */ - /* taste). This function is actually a convenience function, providing */ - /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ - /* */ - /* For emboldened outlines the height, width, and advance metrics are */ - /* increased by the strength of the emboldening. You can also call */ - /* @FT_Outline_Get_CBox to get precise values. */ - FT_EXPORT( void ) - FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); - - /* Slant an outline glyph to the right by about 12 degrees. */ - FT_EXPORT( void ) - FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); - - /* */ - -FT_END_HEADER - -#endif /* __FTSYNTH_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftsystem.h b/GLideN64/src/inc/freetype/include/ftsystem.h deleted file mode 100644 index e07460c..0000000 --- a/GLideN64/src/inc/freetype/include/ftsystem.h +++ /dev/null @@ -1,347 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftsystem.h */ -/* */ -/* FreeType low-level system interface definition (specification). */ -/* */ -/* Copyright 1996-2001, 2002, 2005, 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTSYSTEM_H__ -#define __FTSYSTEM_H__ - - -#include <ft2build.h> - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* system_interface */ - /* */ - /* <Title> */ - /* System Interface */ - /* */ - /* <Abstract> */ - /* How FreeType manages memory and i/o. */ - /* */ - /* <Description> */ - /* This section contains various definitions related to memory */ - /* management and i/o access. You need to understand this */ - /* information if you want to use a custom memory manager or you own */ - /* i/o streams. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* M E M O R Y M A N A G E M E N T */ - /* */ - /*************************************************************************/ - - - /************************************************************************* - * - * @type: - * FT_Memory - * - * @description: - * A handle to a given memory manager object, defined with an - * @FT_MemoryRec structure. - * - */ - typedef struct FT_MemoryRec_* FT_Memory; - - - /************************************************************************* - * - * @functype: - * FT_Alloc_Func - * - * @description: - * A function used to allocate `size' bytes from `memory'. - * - * @input: - * memory :: - * A handle to the source memory manager. - * - * size :: - * The size in bytes to allocate. - * - * @return: - * Address of new memory block. 0~in case of failure. - * - */ - typedef void* - (*FT_Alloc_Func)( FT_Memory memory, - long size ); - - - /************************************************************************* - * - * @functype: - * FT_Free_Func - * - * @description: - * A function used to release a given block of memory. - * - * @input: - * memory :: - * A handle to the source memory manager. - * - * block :: - * The address of the target memory block. - * - */ - typedef void - (*FT_Free_Func)( FT_Memory memory, - void* block ); - - - /************************************************************************* - * - * @functype: - * FT_Realloc_Func - * - * @description: - * A function used to re-allocate a given block of memory. - * - * @input: - * memory :: - * A handle to the source memory manager. - * - * cur_size :: - * The block's current size in bytes. - * - * new_size :: - * The block's requested new size. - * - * block :: - * The block's current address. - * - * @return: - * New block address. 0~in case of memory shortage. - * - * @note: - * In case of error, the old block must still be available. - * - */ - typedef void* - (*FT_Realloc_Func)( FT_Memory memory, - long cur_size, - long new_size, - void* block ); - - - /************************************************************************* - * - * @struct: - * FT_MemoryRec - * - * @description: - * A structure used to describe a given memory manager to FreeType~2. - * - * @fields: - * user :: - * A generic typeless pointer for user data. - * - * alloc :: - * A pointer type to an allocation function. - * - * free :: - * A pointer type to an memory freeing function. - * - * realloc :: - * A pointer type to a reallocation function. - * - */ - struct FT_MemoryRec_ - { - void* user; - FT_Alloc_Func alloc; - FT_Free_Func free; - FT_Realloc_Func realloc; - }; - - - /*************************************************************************/ - /* */ - /* I / O M A N A G E M E N T */ - /* */ - /*************************************************************************/ - - - /************************************************************************* - * - * @type: - * FT_Stream - * - * @description: - * A handle to an input stream. - * - */ - typedef struct FT_StreamRec_* FT_Stream; - - - /************************************************************************* - * - * @struct: - * FT_StreamDesc - * - * @description: - * A union type used to store either a long or a pointer. This is used - * to store a file descriptor or a `FILE*' in an input stream. - * - */ - typedef union FT_StreamDesc_ - { - long value; - void* pointer; - - } FT_StreamDesc; - - - /************************************************************************* - * - * @functype: - * FT_Stream_IoFunc - * - * @description: - * A function used to seek and read data from a given input stream. - * - * @input: - * stream :: - * A handle to the source stream. - * - * offset :: - * The offset of read in stream (always from start). - * - * buffer :: - * The address of the read buffer. - * - * count :: - * The number of bytes to read from the stream. - * - * @return: - * The number of bytes effectively read by the stream. - * - * @note: - * This function might be called to perform a seek or skip operation - * with a `count' of~0. A non-zero return value then indicates an - * error. - * - */ - typedef unsigned long - (*FT_Stream_IoFunc)( FT_Stream stream, - unsigned long offset, - unsigned char* buffer, - unsigned long count ); - - - /************************************************************************* - * - * @functype: - * FT_Stream_CloseFunc - * - * @description: - * A function used to close a given input stream. - * - * @input: - * stream :: - * A handle to the target stream. - * - */ - typedef void - (*FT_Stream_CloseFunc)( FT_Stream stream ); - - - /************************************************************************* - * - * @struct: - * FT_StreamRec - * - * @description: - * A structure used to describe an input stream. - * - * @input: - * base :: - * For memory-based streams, this is the address of the first stream - * byte in memory. This field should always be set to NULL for - * disk-based streams. - * - * size :: - * The stream size in bytes. - * - * pos :: - * The current position within the stream. - * - * descriptor :: - * This field is a union that can hold an integer or a pointer. It is - * used by stream implementations to store file descriptors or `FILE*' - * pointers. - * - * pathname :: - * This field is completely ignored by FreeType. However, it is often - * useful during debugging to use it to store the stream's filename - * (where available). - * - * read :: - * The stream's input function. - * - * close :: - * The stream's close function. - * - * memory :: - * The memory manager to use to preload frames. This is set - * internally by FreeType and shouldn't be touched by stream - * implementations. - * - * cursor :: - * This field is set and used internally by FreeType when parsing - * frames. - * - * limit :: - * This field is set and used internally by FreeType when parsing - * frames. - * - */ - typedef struct FT_StreamRec_ - { - unsigned char* base; - unsigned long size; - unsigned long pos; - - FT_StreamDesc descriptor; - FT_StreamDesc pathname; - FT_Stream_IoFunc read; - FT_Stream_CloseFunc close; - - FT_Memory memory; - unsigned char* cursor; - unsigned char* limit; - - } FT_StreamRec; - - - /* */ - - -FT_END_HEADER - -#endif /* __FTSYSTEM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/fttrigon.h b/GLideN64/src/inc/freetype/include/fttrigon.h deleted file mode 100644 index 65143cb..0000000 --- a/GLideN64/src/inc/freetype/include/fttrigon.h +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************/ -/* */ -/* fttrigon.h */ -/* */ -/* FreeType trigonometric functions (specification). */ -/* */ -/* Copyright 2001, 2003, 2005, 2007, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTTRIGON_H__ -#define __FTTRIGON_H__ - -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* computations */ - /* */ - /*************************************************************************/ - - - /************************************************************************* - * - * @type: - * FT_Angle - * - * @description: - * This type is used to model angle values in FreeType. Note that the - * angle is a 16.16 fixed-point value expressed in degrees. - * - */ - typedef FT_Fixed FT_Angle; - - - /************************************************************************* - * - * @macro: - * FT_ANGLE_PI - * - * @description: - * The angle pi expressed in @FT_Angle units. - * - */ -#define FT_ANGLE_PI ( 180L << 16 ) - - - /************************************************************************* - * - * @macro: - * FT_ANGLE_2PI - * - * @description: - * The angle 2*pi expressed in @FT_Angle units. - * - */ -#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) - - - /************************************************************************* - * - * @macro: - * FT_ANGLE_PI2 - * - * @description: - * The angle pi/2 expressed in @FT_Angle units. - * - */ -#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) - - - /************************************************************************* - * - * @macro: - * FT_ANGLE_PI4 - * - * @description: - * The angle pi/4 expressed in @FT_Angle units. - * - */ -#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) - - - /************************************************************************* - * - * @function: - * FT_Sin - * - * @description: - * Return the sinus of a given angle in fixed-point format. - * - * @input: - * angle :: - * The input angle. - * - * @return: - * The sinus value. - * - * @note: - * If you need both the sinus and cosinus for a given angle, use the - * function @FT_Vector_Unit. - * - */ - FT_EXPORT( FT_Fixed ) - FT_Sin( FT_Angle angle ); - - - /************************************************************************* - * - * @function: - * FT_Cos - * - * @description: - * Return the cosinus of a given angle in fixed-point format. - * - * @input: - * angle :: - * The input angle. - * - * @return: - * The cosinus value. - * - * @note: - * If you need both the sinus and cosinus for a given angle, use the - * function @FT_Vector_Unit. - * - */ - FT_EXPORT( FT_Fixed ) - FT_Cos( FT_Angle angle ); - - - /************************************************************************* - * - * @function: - * FT_Tan - * - * @description: - * Return the tangent of a given angle in fixed-point format. - * - * @input: - * angle :: - * The input angle. - * - * @return: - * The tangent value. - * - */ - FT_EXPORT( FT_Fixed ) - FT_Tan( FT_Angle angle ); - - - /************************************************************************* - * - * @function: - * FT_Atan2 - * - * @description: - * Return the arc-tangent corresponding to a given vector (x,y) in - * the 2d plane. - * - * @input: - * x :: - * The horizontal vector coordinate. - * - * y :: - * The vertical vector coordinate. - * - * @return: - * The arc-tangent value (i.e. angle). - * - */ - FT_EXPORT( FT_Angle ) - FT_Atan2( FT_Fixed x, - FT_Fixed y ); - - - /************************************************************************* - * - * @function: - * FT_Angle_Diff - * - * @description: - * Return the difference between two angles. The result is always - * constrained to the ]-PI..PI] interval. - * - * @input: - * angle1 :: - * First angle. - * - * angle2 :: - * Second angle. - * - * @return: - * Constrained value of `value2-value1'. - * - */ - FT_EXPORT( FT_Angle ) - FT_Angle_Diff( FT_Angle angle1, - FT_Angle angle2 ); - - - /************************************************************************* - * - * @function: - * FT_Vector_Unit - * - * @description: - * Return the unit vector corresponding to a given angle. After the - * call, the value of `vec.x' will be `sin(angle)', and the value of - * `vec.y' will be `cos(angle)'. - * - * This function is useful to retrieve both the sinus and cosinus of a - * given angle quickly. - * - * @output: - * vec :: - * The address of target vector. - * - * @input: - * angle :: - * The address of angle. - * - */ - FT_EXPORT( void ) - FT_Vector_Unit( FT_Vector* vec, - FT_Angle angle ); - - - /************************************************************************* - * - * @function: - * FT_Vector_Rotate - * - * @description: - * Rotate a vector by a given angle. - * - * @inout: - * vec :: - * The address of target vector. - * - * @input: - * angle :: - * The address of angle. - * - */ - FT_EXPORT( void ) - FT_Vector_Rotate( FT_Vector* vec, - FT_Angle angle ); - - - /************************************************************************* - * - * @function: - * FT_Vector_Length - * - * @description: - * Return the length of a given vector. - * - * @input: - * vec :: - * The address of target vector. - * - * @return: - * The vector length, expressed in the same units that the original - * vector coordinates. - * - */ - FT_EXPORT( FT_Fixed ) - FT_Vector_Length( FT_Vector* vec ); - - - /************************************************************************* - * - * @function: - * FT_Vector_Polarize - * - * @description: - * Compute both the length and angle of a given vector. - * - * @input: - * vec :: - * The address of source vector. - * - * @output: - * length :: - * The vector length. - * - * angle :: - * The vector angle. - * - */ - FT_EXPORT( void ) - FT_Vector_Polarize( FT_Vector* vec, - FT_Fixed *length, - FT_Angle *angle ); - - - /************************************************************************* - * - * @function: - * FT_Vector_From_Polar - * - * @description: - * Compute vector coordinates from a length and angle. - * - * @output: - * vec :: - * The address of source vector. - * - * @input: - * length :: - * The vector length. - * - * angle :: - * The vector angle. - * - */ - FT_EXPORT( void ) - FT_Vector_From_Polar( FT_Vector* vec, - FT_Fixed length, - FT_Angle angle ); - - /* */ - - -FT_END_HEADER - -#endif /* __FTTRIGON_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftttdrv.h b/GLideN64/src/inc/freetype/include/ftttdrv.h deleted file mode 100644 index 70ad3d5..0000000 --- a/GLideN64/src/inc/freetype/include/ftttdrv.h +++ /dev/null @@ -1,170 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftttdrv.h */ -/* */ -/* FreeType API for controlling the TrueType driver */ -/* (specification only). */ -/* */ -/* Copyright 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTTTDRV_H__ -#define __FTTTDRV_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * tt_driver - * - * @title: - * The TrueType driver - * - * @abstract: - * Controlling the TrueType driver module. - * - * @description: - * While FreeType's TrueType driver doesn't expose API functions by - * itself, it is possible to control its behaviour with @FT_Property_Set - * and @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * The TrueType driver's module name is `truetype'. - * - */ - - - /************************************************************************** - * - * @property: - * interpreter-version - * - * @description: - * Currently, two versions are available, representing the bytecode - * interpreter with and without subpixel hinting support, - * respectively. The default is subpixel support if - * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel - * support otherwise (since it isn't available then). - * - * If subpixel hinting is on, many TrueType bytecode instructions - * behave differently compared to B/W or grayscale rendering. The - * main idea is to render at a much increased horizontal resolution, - * then sampling down the created output to subpixel precision. - * However, many older fonts are not suited to this and must be - * specially taken care of by applying (hardcoded) font-specific - * tweaks. - * - * Details on subpixel hinting and some of the necessary tweaks can be - * found in Greg Hitchcock's whitepaper at - * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. - * - * The following example code demonstrates how to activate subpixel - * hinting (omitting the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "truetype", - * "interpreter-version", - * &interpreter_version ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - */ - - - /************************************************************************** - * - * @enum: - * TT_INTERPRETER_VERSION_XXX - * - * @description: - * A list of constants used for the @interpreter-version property to - * select the hinting engine for Truetype fonts. - * - * The numeric value in the constant names represents the version - * number as returned by the `GETINFO' bytecode instruction. - * - * @values: - * TT_INTERPRETER_VERSION_35 :: - * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in - * Windows~98; only grayscale and B/W rasterizing is supported. - * - * TT_INTERPRETER_VERSION_38 :: - * Version~38 corresponds to MS rasterizer v.1.9; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as - * can be found, for example, in the Internet Explorer~9 running on - * Windows~7). - * - * @note: - * This property controls the behaviour of the bytecode interpreter - * and thus how outlines get hinted. It does *not* control how glyph - * get rasterized! In particular, it does not control subpixel color - * filtering. - * - * If FreeType has not been compiled with configuration option - * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an - * `FT_Err_Unimplemented_Feature' error. - * - * Depending on the graphics framework, Microsoft uses different - * bytecode engines. As a consequence, the version numbers returned by - * a call to the `GETINFO[1]' bytecode instruction are more convoluted - * than desired. - * - * { - * framework Windows version result of GETINFO[1] - * ---------------------------------------------------- - * GDI before XP 35 - * GDI XP and later 37 - * GDI+ old before Vista 37 - * GDI+ old Vista, 7 38 - * GDI+ after 7 40 - * DWrite before 8 39 - * DWrite 8 and later 40 - * } - * - * Since FreeType doesn't provide all capabilities of DWrite ClearType, - * using version~38 seems justified. - * - */ -#define TT_INTERPRETER_VERSION_35 35 -#define TT_INTERPRETER_VERSION_38 38 - - - /* */ - -FT_END_HEADER - - -#endif /* __FTTTDRV_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/fttypes.h b/GLideN64/src/inc/freetype/include/fttypes.h deleted file mode 100644 index bd944a4..0000000 --- a/GLideN64/src/inc/freetype/include/fttypes.h +++ /dev/null @@ -1,598 +0,0 @@ -/***************************************************************************/ -/* */ -/* fttypes.h */ -/* */ -/* FreeType simple types definitions (specification only). */ -/* */ -/* Copyright 1996-2002, 2004, 2006-2009, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTTYPES_H__ -#define __FTTYPES_H__ - - -#include <ft2build.h> -#include FT_CONFIG_CONFIG_H -#include FT_SYSTEM_H -#include FT_IMAGE_H - -#include <stddef.h> - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /* <Title> */ - /* Basic Data Types */ - /* */ - /* <Abstract> */ - /* The basic data types defined by the library. */ - /* */ - /* <Description> */ - /* This section contains the basic data types defined by FreeType~2, */ - /* ranging from simple scalar types to bitmap descriptors. More */ - /* font-specific structures are defined in a different section. */ - /* */ - /* <Order> */ - /* FT_Byte */ - /* FT_Bytes */ - /* FT_Char */ - /* FT_Int */ - /* FT_UInt */ - /* FT_Int16 */ - /* FT_UInt16 */ - /* FT_Int32 */ - /* FT_UInt32 */ - /* FT_Short */ - /* FT_UShort */ - /* FT_Long */ - /* FT_ULong */ - /* FT_Bool */ - /* FT_Offset */ - /* FT_PtrDist */ - /* FT_String */ - /* FT_Tag */ - /* FT_Error */ - /* FT_Fixed */ - /* FT_Pointer */ - /* FT_Pos */ - /* FT_Vector */ - /* FT_BBox */ - /* FT_Matrix */ - /* FT_FWord */ - /* FT_UFWord */ - /* FT_F2Dot14 */ - /* FT_UnitVector */ - /* FT_F26Dot6 */ - /* */ - /* */ - /* FT_Generic */ - /* FT_Generic_Finalizer */ - /* */ - /* FT_Bitmap */ - /* FT_Pixel_Mode */ - /* FT_Palette_Mode */ - /* FT_Glyph_Format */ - /* FT_IMAGE_TAG */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Bool */ - /* */ - /* <Description> */ - /* A typedef of unsigned char, used for simple booleans. As usual, */ - /* values 1 and~0 represent true and false, respectively. */ - /* */ - typedef unsigned char FT_Bool; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_FWord */ - /* */ - /* <Description> */ - /* A signed 16-bit integer used to store a distance in original font */ - /* units. */ - /* */ - typedef signed short FT_FWord; /* distance in FUnits */ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UFWord */ - /* */ - /* <Description> */ - /* An unsigned 16-bit integer used to store a distance in original */ - /* font units. */ - /* */ - typedef unsigned short FT_UFWord; /* unsigned distance */ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Char */ - /* */ - /* <Description> */ - /* A simple typedef for the _signed_ char type. */ - /* */ - typedef signed char FT_Char; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Byte */ - /* */ - /* <Description> */ - /* A simple typedef for the _unsigned_ char type. */ - /* */ - typedef unsigned char FT_Byte; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Bytes */ - /* */ - /* <Description> */ - /* A typedef for constant memory areas. */ - /* */ - typedef const FT_Byte* FT_Bytes; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Tag */ - /* */ - /* <Description> */ - /* A typedef for 32-bit tags (as used in the SFNT format). */ - /* */ - typedef FT_UInt32 FT_Tag; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_String */ - /* */ - /* <Description> */ - /* A simple typedef for the char type, usually used for strings. */ - /* */ - typedef char FT_String; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Short */ - /* */ - /* <Description> */ - /* A typedef for signed short. */ - /* */ - typedef signed short FT_Short; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UShort */ - /* */ - /* <Description> */ - /* A typedef for unsigned short. */ - /* */ - typedef unsigned short FT_UShort; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Int */ - /* */ - /* <Description> */ - /* A typedef for the int type. */ - /* */ - typedef signed int FT_Int; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UInt */ - /* */ - /* <Description> */ - /* A typedef for the unsigned int type. */ - /* */ - typedef unsigned int FT_UInt; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Long */ - /* */ - /* <Description> */ - /* A typedef for signed long. */ - /* */ - typedef signed long FT_Long; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_ULong */ - /* */ - /* <Description> */ - /* A typedef for unsigned long. */ - /* */ - typedef unsigned long FT_ULong; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_F2Dot14 */ - /* */ - /* <Description> */ - /* A signed 2.14 fixed-point type used for unit vectors. */ - /* */ - typedef signed short FT_F2Dot14; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_F26Dot6 */ - /* */ - /* <Description> */ - /* A signed 26.6 fixed-point type used for vectorial pixel */ - /* coordinates. */ - /* */ - typedef signed long FT_F26Dot6; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Fixed */ - /* */ - /* <Description> */ - /* This type is used to store 16.16 fixed-point values, like scaling */ - /* values or matrix coefficients. */ - /* */ - typedef signed long FT_Fixed; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Error */ - /* */ - /* <Description> */ - /* The FreeType error code type. A value of~0 is always interpreted */ - /* as a successful operation. */ - /* */ - typedef int FT_Error; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Pointer */ - /* */ - /* <Description> */ - /* A simple typedef for a typeless pointer. */ - /* */ - typedef void* FT_Pointer; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Offset */ - /* */ - /* <Description> */ - /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */ - /* _unsigned_ integer type used to express a file size or position, */ - /* or a memory block size. */ - /* */ - typedef size_t FT_Offset; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_PtrDist */ - /* */ - /* <Description> */ - /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */ - /* largest _signed_ integer type used to express the distance */ - /* between two pointers. */ - /* */ - typedef ft_ptrdiff_t FT_PtrDist; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_UnitVector */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2D vector unit vector. Uses */ - /* FT_F2Dot14 types. */ - /* */ - /* <Fields> */ - /* x :: Horizontal coordinate. */ - /* */ - /* y :: Vertical coordinate. */ - /* */ - typedef struct FT_UnitVector_ - { - FT_F2Dot14 x; - FT_F2Dot14 y; - - } FT_UnitVector; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Matrix */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2x2 matrix. Coefficients are */ - /* in 16.16 fixed-point format. The computation performed is: */ - /* */ - /* { */ - /* x' = x*xx + y*xy */ - /* y' = x*yx + y*yy */ - /* } */ - /* */ - /* <Fields> */ - /* xx :: Matrix coefficient. */ - /* */ - /* xy :: Matrix coefficient. */ - /* */ - /* yx :: Matrix coefficient. */ - /* */ - /* yy :: Matrix coefficient. */ - /* */ - typedef struct FT_Matrix_ - { - FT_Fixed xx, xy; - FT_Fixed yx, yy; - - } FT_Matrix; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Data */ - /* */ - /* <Description> */ - /* Read-only binary data represented as a pointer and a length. */ - /* */ - /* <Fields> */ - /* pointer :: The data. */ - /* */ - /* length :: The length of the data in bytes. */ - /* */ - typedef struct FT_Data_ - { - const FT_Byte* pointer; - FT_Int length; - - } FT_Data; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Generic_Finalizer */ - /* */ - /* <Description> */ - /* Describe a function used to destroy the `client' data of any */ - /* FreeType object. See the description of the @FT_Generic type for */ - /* details of usage. */ - /* */ - /* <Input> */ - /* The address of the FreeType object that is under finalization. */ - /* Its client data is accessed through its `generic' field. */ - /* */ - typedef void (*FT_Generic_Finalizer)(void* object); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Generic */ - /* */ - /* <Description> */ - /* Client applications often need to associate their own data to a */ - /* variety of FreeType core objects. For example, a text layout API */ - /* might want to associate a glyph cache to a given size object. */ - /* */ - /* Some FreeType object contains a `generic' field, of type */ - /* FT_Generic, which usage is left to client applications and font */ - /* servers. */ - /* */ - /* It can be used to store a pointer to client-specific data, as well */ - /* as the address of a `finalizer' function, which will be called by */ - /* FreeType when the object is destroyed (for example, the previous */ - /* client example would put the address of the glyph cache destructor */ - /* in the `finalizer' field). */ - /* */ - /* <Fields> */ - /* data :: A typeless pointer to any client-specified data. This */ - /* field is completely ignored by the FreeType library. */ - /* */ - /* finalizer :: A pointer to a `generic finalizer' function, which */ - /* will be called when the object is destroyed. If this */ - /* field is set to NULL, no code will be called. */ - /* */ - typedef struct FT_Generic_ - { - void* data; - FT_Generic_Finalizer finalizer; - - } FT_Generic; - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_MAKE_TAG */ - /* */ - /* <Description> */ - /* This macro converts four-letter tags that are used to label */ - /* TrueType tables into an unsigned long, to be used within FreeType. */ - /* */ - /* <Note> */ - /* The produced values *must* be 32-bit integers. Don't redefine */ - /* this macro. */ - /* */ -#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ - (FT_Tag) \ - ( ( (FT_ULong)_x1 << 24 ) | \ - ( (FT_ULong)_x2 << 16 ) | \ - ( (FT_ULong)_x3 << 8 ) | \ - (FT_ULong)_x4 ) - - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* L I S T M A N A G E M E N T */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* list_processing */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_ListNode */ - /* */ - /* <Description> */ - /* Many elements and objects in FreeType are listed through an */ - /* @FT_List record (see @FT_ListRec). As its name suggests, an */ - /* FT_ListNode is a handle to a single list element. */ - /* */ - typedef struct FT_ListNodeRec_* FT_ListNode; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_List */ - /* */ - /* <Description> */ - /* A handle to a list record (see @FT_ListRec). */ - /* */ - typedef struct FT_ListRec_* FT_List; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ListNodeRec */ - /* */ - /* <Description> */ - /* A structure used to hold a single list element. */ - /* */ - /* <Fields> */ - /* prev :: The previous element in the list. NULL if first. */ - /* */ - /* next :: The next element in the list. NULL if last. */ - /* */ - /* data :: A typeless pointer to the listed object. */ - /* */ - typedef struct FT_ListNodeRec_ - { - FT_ListNode prev; - FT_ListNode next; - void* data; - - } FT_ListNodeRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ListRec */ - /* */ - /* <Description> */ - /* A structure used to hold a simple doubly-linked list. These are */ - /* used in many parts of FreeType. */ - /* */ - /* <Fields> */ - /* head :: The head (first element) of doubly-linked list. */ - /* */ - /* tail :: The tail (last element) of doubly-linked list. */ - /* */ - typedef struct FT_ListRec_ - { - FT_ListNode head; - FT_ListNode tail; - - } FT_ListRec; - - - /* */ - -#define FT_IS_EMPTY( list ) ( (list).head == 0 ) -#define FT_BOOL( x ) ( (FT_Bool)( x ) ) - - /* concatenate C tokens */ -#define FT_ERR_XCAT( x, y ) x ## y -#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) - - /* see `ftmoderr.h' for descriptions of the following macros */ - -#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) - -#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) -#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) - -#define FT_ERR_EQ( x, e ) \ - ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) ) -#define FT_ERR_NEQ( x, e ) \ - ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) ) - - -FT_END_HEADER - -#endif /* __FTTYPES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ftwinfnt.h b/GLideN64/src/inc/freetype/include/ftwinfnt.h deleted file mode 100644 index 0b67351..0000000 --- a/GLideN64/src/inc/freetype/include/ftwinfnt.h +++ /dev/null @@ -1,275 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftwinfnt.h */ -/* */ -/* FreeType API for accessing Windows fnt-specific data. */ -/* */ -/* Copyright 2003, 2004, 2008 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTWINFNT_H__ -#define __FTWINFNT_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* winfnt_fonts */ - /* */ - /* <Title> */ - /* Window FNT Files */ - /* */ - /* <Abstract> */ - /* Windows FNT specific API. */ - /* */ - /* <Description> */ - /* This section contains the declaration of Windows FNT specific */ - /* functions. */ - /* */ - /*************************************************************************/ - - - /************************************************************************* - * - * @enum: - * FT_WinFNT_ID_XXX - * - * @description: - * A list of valid values for the `charset' byte in - * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX - * encodings (except for cp1361) can be found at - * ftp://ftp.unicode.org/public in the MAPPINGS/VENDORS/MICSFT/WINDOWS - * subdirectory. cp1361 is roughly a superset of - * MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. - * - * @values: - * FT_WinFNT_ID_DEFAULT :: - * This is used for font enumeration and font creation as a - * `don't care' value. Valid font files don't contain this value. - * When querying for information about the character set of the font - * that is currently selected into a specified device context, this - * return value (of the related Windows API) simply denotes failure. - * - * FT_WinFNT_ID_SYMBOL :: - * There is no known mapping table available. - * - * FT_WinFNT_ID_MAC :: - * Mac Roman encoding. - * - * FT_WinFNT_ID_OEM :: - * From Michael Pöttgen <michael@poettgen.de>: - * - * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM - * is used for the charset of vector fonts, like `modern.fon', - * `roman.fon', and `script.fon' on Windows. - * - * The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value - * specifies a character set that is operating-system dependent. - * - * The `IFIMETRICS' documentation from the `Windows Driver - * Development Kit' says: This font supports an OEM-specific - * character set. The OEM character set is system dependent. - * - * In general OEM, as opposed to ANSI (i.e., cp1252), denotes the - * second default codepage that most international versions of - * Windows have. It is one of the OEM codepages from - * - * http://www.microsoft.com/globaldev/reference/cphome.mspx, - * - * and is used for the `DOS boxes', to support legacy applications. - * A German Windows version for example usually uses ANSI codepage - * 1252 and OEM codepage 850. - * - * FT_WinFNT_ID_CP874 :: - * A superset of Thai TIS 620 and ISO 8859-11. - * - * FT_WinFNT_ID_CP932 :: - * A superset of Japanese Shift-JIS (with minor deviations). - * - * FT_WinFNT_ID_CP936 :: - * A superset of simplified Chinese GB 2312-1980 (with different - * ordering and minor deviations). - * - * FT_WinFNT_ID_CP949 :: - * A superset of Korean Hangul KS~C 5601-1987 (with different - * ordering and minor deviations). - * - * FT_WinFNT_ID_CP950 :: - * A superset of traditional Chinese Big~5 ETen (with different - * ordering and minor deviations). - * - * FT_WinFNT_ID_CP1250 :: - * A superset of East European ISO 8859-2 (with slightly different - * ordering). - * - * FT_WinFNT_ID_CP1251 :: - * A superset of Russian ISO 8859-5 (with different ordering). - * - * FT_WinFNT_ID_CP1252 :: - * ANSI encoding. A superset of ISO 8859-1. - * - * FT_WinFNT_ID_CP1253 :: - * A superset of Greek ISO 8859-7 (with minor modifications). - * - * FT_WinFNT_ID_CP1254 :: - * A superset of Turkish ISO 8859-9. - * - * FT_WinFNT_ID_CP1255 :: - * A superset of Hebrew ISO 8859-8 (with some modifications). - * - * FT_WinFNT_ID_CP1256 :: - * A superset of Arabic ISO 8859-6 (with different ordering). - * - * FT_WinFNT_ID_CP1257 :: - * A superset of Baltic ISO 8859-13 (with some deviations). - * - * FT_WinFNT_ID_CP1258 :: - * For Vietnamese. This encoding doesn't cover all necessary - * characters. - * - * FT_WinFNT_ID_CP1361 :: - * Korean (Johab). - */ - -#define FT_WinFNT_ID_CP1252 0 -#define FT_WinFNT_ID_DEFAULT 1 -#define FT_WinFNT_ID_SYMBOL 2 -#define FT_WinFNT_ID_MAC 77 -#define FT_WinFNT_ID_CP932 128 -#define FT_WinFNT_ID_CP949 129 -#define FT_WinFNT_ID_CP1361 130 -#define FT_WinFNT_ID_CP936 134 -#define FT_WinFNT_ID_CP950 136 -#define FT_WinFNT_ID_CP1253 161 -#define FT_WinFNT_ID_CP1254 162 -#define FT_WinFNT_ID_CP1258 163 -#define FT_WinFNT_ID_CP1255 177 -#define FT_WinFNT_ID_CP1256 178 -#define FT_WinFNT_ID_CP1257 186 -#define FT_WinFNT_ID_CP1251 204 -#define FT_WinFNT_ID_CP874 222 -#define FT_WinFNT_ID_CP1250 238 -#define FT_WinFNT_ID_OEM 255 - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_WinFNT_HeaderRec */ - /* */ - /* <Description> */ - /* Windows FNT Header info. */ - /* */ - typedef struct FT_WinFNT_HeaderRec_ - { - FT_UShort version; - FT_ULong file_size; - FT_Byte copyright[60]; - FT_UShort file_type; - FT_UShort nominal_point_size; - FT_UShort vertical_resolution; - FT_UShort horizontal_resolution; - FT_UShort ascent; - FT_UShort internal_leading; - FT_UShort external_leading; - FT_Byte italic; - FT_Byte underline; - FT_Byte strike_out; - FT_UShort weight; - FT_Byte charset; - FT_UShort pixel_width; - FT_UShort pixel_height; - FT_Byte pitch_and_family; - FT_UShort avg_width; - FT_UShort max_width; - FT_Byte first_char; - FT_Byte last_char; - FT_Byte default_char; - FT_Byte break_char; - FT_UShort bytes_per_row; - FT_ULong device_offset; - FT_ULong face_name_offset; - FT_ULong bits_pointer; - FT_ULong bits_offset; - FT_Byte reserved; - FT_ULong flags; - FT_UShort A_space; - FT_UShort B_space; - FT_UShort C_space; - FT_UShort color_table_offset; - FT_ULong reserved1[4]; - - } FT_WinFNT_HeaderRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_WinFNT_Header */ - /* */ - /* <Description> */ - /* A handle to an @FT_WinFNT_HeaderRec structure. */ - /* */ - typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header; - - - /********************************************************************** - * - * @function: - * FT_Get_WinFNT_Header - * - * @description: - * Retrieve a Windows FNT font info header. - * - * @input: - * face :: A handle to the input face. - * - * @output: - * aheader :: The WinFNT header. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * This function only works with Windows FNT faces, returning an error - * otherwise. - */ - FT_EXPORT( FT_Error ) - FT_Get_WinFNT_Header( FT_Face face, - FT_WinFNT_HeaderRec *aheader ); - - - /* */ - -FT_END_HEADER - -#endif /* __FTWINFNT_H__ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/GLideN64/src/inc/freetype/include/ftxf86.h b/GLideN64/src/inc/freetype/include/ftxf86.h deleted file mode 100644 index 493cccd..0000000 --- a/GLideN64/src/inc/freetype/include/ftxf86.h +++ /dev/null @@ -1,83 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftxf86.h */ -/* */ -/* Support functions for X11. */ -/* */ -/* Copyright 2002-2004, 2006, 2007, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTXF86_H__ -#define __FTXF86_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* font_formats */ - /* */ - /* <Title> */ - /* Font Formats */ - /* */ - /* <Abstract> */ - /* Getting the font format. */ - /* */ - /* <Description> */ - /* The single function in this section can be used to get the font */ - /* format. Note that this information is not needed normally; */ - /* however, there are special cases (like in PDF devices) where it is */ - /* important to differentiate, in spite of FreeType's uniform API. */ - /* */ - /* This function is in the X11/xf86 namespace for historical reasons */ - /* and in no way depends on that windowing system. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_X11_Font_Format */ - /* */ - /* <Description> */ - /* Return a string describing the format of a given face, using values */ - /* that can be used as an X11 FONT_PROPERTY. Possible values are */ - /* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */ - /* `PFR', and `Windows~FNT'. */ - /* */ - /* <Input> */ - /* face :: */ - /* Input face handle. */ - /* */ - /* <Return> */ - /* Font format string. NULL in case of error. */ - /* */ - FT_EXPORT( const char* ) - FT_Get_X11_Font_Format( FT_Face face ); - - /* */ - -FT_END_HEADER - -#endif /* __FTXF86_H__ */ diff --git a/GLideN64/src/inc/freetype/include/internal/autohint.h b/GLideN64/src/inc/freetype/include/internal/autohint.h deleted file mode 100644 index 545de93..0000000 --- a/GLideN64/src/inc/freetype/include/internal/autohint.h +++ /dev/null @@ -1,244 +0,0 @@ -/***************************************************************************/ -/* */ -/* autohint.h */ -/* */ -/* High-level `autohint' module-specific interface (specification). */ -/* */ -/* Copyright 1996-2002, 2007, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* The auto-hinter is used to load and automatically hint glyphs if a */ - /* format-specific hinter isn't available. */ - /* */ - /*************************************************************************/ - - -#ifndef __AUTOHINT_H__ -#define __AUTOHINT_H__ - - - /*************************************************************************/ - /* */ - /* A small technical note regarding automatic hinting in order to */ - /* clarify this module interface. */ - /* */ - /* An automatic hinter might compute two kinds of data for a given face: */ - /* */ - /* - global hints: Usually some metrics that describe global properties */ - /* of the face. It is computed by scanning more or less */ - /* aggressively the glyphs in the face, and thus can be */ - /* very slow to compute (even if the size of global */ - /* hints is really small). */ - /* */ - /* - glyph hints: These describe some important features of the glyph */ - /* outline, as well as how to align them. They are */ - /* generally much faster to compute than global hints. */ - /* */ - /* The current FreeType auto-hinter does a pretty good job while */ - /* performing fast computations for both global and glyph hints. */ - /* However, we might be interested in introducing more complex and */ - /* powerful algorithms in the future, like the one described in the John */ - /* D. Hobby paper, which unfortunately requires a lot more horsepower. */ - /* */ - /* Because a sufficiently sophisticated font management system would */ - /* typically implement an LRU cache of opened face objects to reduce */ - /* memory usage, it is a good idea to be able to avoid recomputing */ - /* global hints every time the same face is re-opened. */ - /* */ - /* We thus provide the ability to cache global hints outside of the face */ - /* object, in order to speed up font re-opening time. Of course, this */ - /* feature is purely optional, so most client programs won't even notice */ - /* it. */ - /* */ - /* I initially thought that it would be a good idea to cache the glyph */ - /* hints too. However, my general idea now is that if you really need */ - /* to cache these too, you are simply in need of a new font format, */ - /* where all this information could be stored within the font file and */ - /* decoded on the fly. */ - /* */ - /*************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - typedef struct FT_AutoHinterRec_ *FT_AutoHinter; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_AutoHinter_GlobalGetFunc */ - /* */ - /* <Description> */ - /* Retrieve the global hints computed for a given face object. The */ - /* resulting data is dissociated from the face and will survive a */ - /* call to FT_Done_Face(). It must be discarded through the API */ - /* FT_AutoHinter_GlobalDoneFunc(). */ - /* */ - /* <Input> */ - /* hinter :: A handle to the source auto-hinter. */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* <Output> */ - /* global_hints :: A typeless pointer to the global hints. */ - /* */ - /* global_len :: The size in bytes of the global hints. */ - /* */ - typedef void - (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter, - FT_Face face, - void** global_hints, - long* global_len ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_AutoHinter_GlobalDoneFunc */ - /* */ - /* <Description> */ - /* Discard the global hints retrieved through */ - /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */ - /* are freed from memory. */ - /* */ - /* <Input> */ - /* hinter :: A handle to the auto-hinter module. */ - /* */ - /* global :: A pointer to retrieved global hints to discard. */ - /* */ - typedef void - (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter, - void* global ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_AutoHinter_GlobalResetFunc */ - /* */ - /* <Description> */ - /* This function is used to recompute the global metrics in a given */ - /* font. This is useful when global font data changes (e.g. Multiple */ - /* Masters fonts where blend coordinates change). */ - /* */ - /* <Input> */ - /* hinter :: A handle to the source auto-hinter. */ - /* */ - /* face :: A handle to the face. */ - /* */ - typedef void - (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter, - FT_Face face ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_AutoHinter_GlyphLoadFunc */ - /* */ - /* <Description> */ - /* This function is used to load, scale, and automatically hint a */ - /* glyph from a given face. */ - /* */ - /* <Input> */ - /* face :: A handle to the face. */ - /* */ - /* glyph_index :: The glyph index. */ - /* */ - /* load_flags :: The load flags. */ - /* */ - /* <Note> */ - /* This function is capable of loading composite glyphs by hinting */ - /* each sub-glyph independently (which improves quality). */ - /* */ - /* It will call the font driver with @FT_Load_Glyph, with */ - /* @FT_LOAD_NO_SCALE set. */ - /* */ - typedef FT_Error - (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter, - FT_GlyphSlot slot, - FT_Size size, - FT_UInt glyph_index, - FT_Int32 load_flags ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_AutoHinter_InterfaceRec */ - /* */ - /* <Description> */ - /* The auto-hinter module's interface. */ - /* */ - typedef struct FT_AutoHinter_InterfaceRec_ - { - FT_AutoHinter_GlobalResetFunc reset_face; - FT_AutoHinter_GlobalGetFunc get_global_hints; - FT_AutoHinter_GlobalDoneFunc done_global_hints; - FT_AutoHinter_GlyphLoadFunc load_glyph; - - } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_AUTOHINTER_INTERFACE( \ - class_, \ - reset_face_, \ - get_global_hints_, \ - done_global_hints_, \ - load_glyph_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_AutoHinter_InterfaceRec class_ = \ - { \ - reset_face_, \ - get_global_hints_, \ - done_global_hints_, \ - load_glyph_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_AUTOHINTER_INTERFACE( \ - class_, \ - reset_face_, \ - get_global_hints_, \ - done_global_hints_, \ - load_glyph_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_AutoHinter_InterfaceRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->reset_face = reset_face_; \ - clazz->get_global_hints = get_global_hints_; \ - clazz->done_global_hints = done_global_hints_; \ - clazz->load_glyph = load_glyph_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - -FT_END_HEADER - -#endif /* __AUTOHINT_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftcalc.h b/GLideN64/src/inc/freetype/include/internal/ftcalc.h deleted file mode 100644 index 03bd68e..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftcalc.h +++ /dev/null @@ -1,171 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcalc.h */ -/* */ -/* Arithmetic computations (specification). */ -/* */ -/* Copyright 1996-2006, 2008, 2009, 2012-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTCALC_H__ -#define __FTCALC_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - -#if 0 - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_SqrtFixed */ - /* */ - /* <Description> */ - /* Computes the square root of a 16.16 fixed-point value. */ - /* */ - /* <Input> */ - /* x :: The value to compute the root for. */ - /* */ - /* <Return> */ - /* The result of `sqrt(x)'. */ - /* */ - /* <Note> */ - /* This function is not very fast. */ - /* */ - FT_BASE( FT_Int32 ) - FT_SqrtFixed( FT_Int32 x ); - -#endif /* 0 */ - - - /*************************************************************************/ - /* */ - /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_MulDiv_No_Round */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation `(a*b)/c' */ - /* (without rounding) with maximum accuracy (it uses a 64-bit */ - /* intermediate integer whenever necessary). */ - /* */ - /* This function isn't necessarily as fast as some processor specific */ - /* operations, but is at least completely portable. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. */ - /* c :: The divisor. */ - /* */ - /* <Return> */ - /* The result of `(a*b)/c'. This function never traps when trying to */ - /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ - /* on the signs of `a' and `b'. */ - /* */ - FT_BASE( FT_Long ) - FT_MulDiv_No_Round( FT_Long a, - FT_Long b, - FT_Long c ); - - - /* - * A variant of FT_Matrix_Multiply which scales its result afterwards. - * The idea is that both `a' and `b' are scaled by factors of 10 so that - * the values are as precise as possible to get a correct result during - * the 64bit multiplication. Let `sa' and `sb' be the scaling factors of - * `a' and `b', respectively, then the scaling factor of the result is - * `sa*sb'. - */ - FT_BASE( void ) - FT_Matrix_Multiply_Scaled( const FT_Matrix* a, - FT_Matrix *b, - FT_Long scaling ); - - - /* - * A variant of FT_Vector_Transform. See comments for - * FT_Matrix_Multiply_Scaled. - */ - FT_BASE( void ) - FT_Vector_Transform_Scaled( FT_Vector* vector, - const FT_Matrix* matrix, - FT_Long scaling ); - - - /* - * Return -1, 0, or +1, depending on the orientation of a given corner. - * We use the Cartesian coordinate system, with positive vertical values - * going upwards. The function returns +1 if the corner turns to the - * left, -1 to the right, and 0 for undecidable cases. - */ - FT_BASE( FT_Int ) - ft_corner_orientation( FT_Pos in_x, - FT_Pos in_y, - FT_Pos out_x, - FT_Pos out_y ); - - /* - * Return TRUE if a corner is flat or nearly flat. This is equivalent to - * saying that the angle difference between the `in' and `out' vectors is - * very small. - */ - FT_BASE( FT_Int ) - ft_corner_is_flat( FT_Pos in_x, - FT_Pos in_y, - FT_Pos out_x, - FT_Pos out_y ); - - - /* - * Return the most significant bit index. - */ - FT_BASE( FT_Int ) - FT_MSB( FT_UInt32 z ); - - - /* - * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses - * two fixed-point arguments instead. - */ - FT_BASE( FT_Fixed ) - FT_Hypot( FT_Fixed x, - FT_Fixed y ); - - -#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) -#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) -#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) -#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) -#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) -#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) - -#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ - : ( -( ( 32 - (x) ) & -64 ) ) ) - - -FT_END_HEADER - -#endif /* __FTCALC_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftdebug.h b/GLideN64/src/inc/freetype/include/internal/ftdebug.h deleted file mode 100644 index 58a3916..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftdebug.h +++ /dev/null @@ -1,255 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftdebug.h */ -/* */ -/* Debugging and logging component (specification). */ -/* */ -/* Copyright 1996-2002, 2004, 2006-2009, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/* */ -/* IMPORTANT: A description of FreeType's debugging support can be */ -/* found in `docs/DEBUG.TXT'. Read it if you need to use or */ -/* understand this code. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTDEBUG_H__ -#define __FTDEBUG_H__ - - -#include <ft2build.h> -#include FT_CONFIG_CONFIG_H -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */ - /* is already defined; this simplifies the following #ifdefs */ - /* */ -#ifdef FT_DEBUG_LEVEL_TRACE -#undef FT_DEBUG_LEVEL_ERROR -#define FT_DEBUG_LEVEL_ERROR -#endif - - - /*************************************************************************/ - /* */ - /* Define the trace enums as well as the trace levels array when they */ - /* are needed. */ - /* */ - /*************************************************************************/ - -#ifdef FT_DEBUG_LEVEL_TRACE - -#define FT_TRACE_DEF( x ) trace_ ## x , - - /* defining the enumeration */ - typedef enum FT_Trace_ - { -#include FT_INTERNAL_TRACE_H - trace_count - - } FT_Trace; - - - /* defining the array of trace levels, provided by `src/base/ftdebug.c' */ - extern int ft_trace_levels[trace_count]; - -#undef FT_TRACE_DEF - -#endif /* FT_DEBUG_LEVEL_TRACE */ - - - /*************************************************************************/ - /* */ - /* Define the FT_TRACE macro */ - /* */ - /* IMPORTANT! */ - /* */ - /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */ - /* value before using any TRACE macro. */ - /* */ - /*************************************************************************/ - -#ifdef FT_DEBUG_LEVEL_TRACE - -#define FT_TRACE( level, varformat ) \ - do \ - { \ - if ( ft_trace_levels[FT_COMPONENT] >= level ) \ - FT_Message varformat; \ - } while ( 0 ) - -#else /* !FT_DEBUG_LEVEL_TRACE */ - -#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */ - -#endif /* !FT_DEBUG_LEVEL_TRACE */ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Trace_Get_Count */ - /* */ - /* <Description> */ - /* Return the number of available trace components. */ - /* */ - /* <Return> */ - /* The number of trace components. 0 if FreeType 2 is not built with */ - /* FT_DEBUG_LEVEL_TRACE definition. */ - /* */ - /* <Note> */ - /* This function may be useful if you want to access elements of */ - /* the internal `ft_trace_levels' array by an index. */ - /* */ - FT_BASE( FT_Int ) - FT_Trace_Get_Count( void ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Trace_Get_Name */ - /* */ - /* <Description> */ - /* Return the name of a trace component. */ - /* */ - /* <Input> */ - /* The index of the trace component. */ - /* */ - /* <Return> */ - /* The name of the trace component. This is a statically allocated */ - /* C string, so do not free it after use. NULL if FreeType 2 is not */ - /* built with FT_DEBUG_LEVEL_TRACE definition. */ - /* */ - /* <Note> */ - /* Use @FT_Trace_Get_Count to get the number of available trace */ - /* components. */ - /* */ - /* This function may be useful if you want to control FreeType 2's */ - /* debug level in your application. */ - /* */ - FT_BASE( const char * ) - FT_Trace_Get_Name( FT_Int idx ); - - - /*************************************************************************/ - /* */ - /* You need two opening and closing parentheses! */ - /* */ - /* Example: FT_TRACE0(( "Value is %i", foo )) */ - /* */ - /* Output of the FT_TRACEX macros is sent to stderr. */ - /* */ - /*************************************************************************/ - -#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat ) -#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat ) -#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat ) -#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat ) -#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat ) -#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat ) -#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat ) -#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat ) - - - /*************************************************************************/ - /* */ - /* Define the FT_ERROR macro. */ - /* */ - /* Output of this macro is sent to stderr. */ - /* */ - /*************************************************************************/ - -#ifdef FT_DEBUG_LEVEL_ERROR - -#define FT_ERROR( varformat ) FT_Message varformat - -#else /* !FT_DEBUG_LEVEL_ERROR */ - -#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */ - -#endif /* !FT_DEBUG_LEVEL_ERROR */ - - - /*************************************************************************/ - /* */ - /* Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw' */ - /* makes it possible to easily set a breakpoint at this function. */ - /* */ - /*************************************************************************/ - -#ifdef FT_DEBUG_LEVEL_ERROR - -#define FT_ASSERT( condition ) \ - do \ - { \ - if ( !( condition ) ) \ - FT_Panic( "assertion failed on line %d of file %s\n", \ - __LINE__, __FILE__ ); \ - } while ( 0 ) - -#define FT_THROW( e ) \ - ( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \ - __LINE__, \ - __FILE__ ) | \ - FT_ERR_CAT( FT_ERR_PREFIX, e ) ) - -#else /* !FT_DEBUG_LEVEL_ERROR */ - -#define FT_ASSERT( condition ) do { } while ( 0 ) - -#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) - -#endif /* !FT_DEBUG_LEVEL_ERROR */ - - - /*************************************************************************/ - /* */ - /* Define `FT_Message' and `FT_Panic' when needed. */ - /* */ - /*************************************************************************/ - -#ifdef FT_DEBUG_LEVEL_ERROR - -#include "stdio.h" /* for vfprintf() */ - - /* print a message */ - FT_BASE( void ) - FT_Message( const char* fmt, - ... ); - - /* print a message and exit */ - FT_BASE( void ) - FT_Panic( const char* fmt, - ... ); - - /* report file name and line number of an error */ - FT_BASE( int ) - FT_Throw( FT_Error error, - int line, - const char* file ); - -#endif /* FT_DEBUG_LEVEL_ERROR */ - - - FT_BASE( void ) - ft_debug_init( void ); - -FT_END_HEADER - -#endif /* __FTDEBUG_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftdriver.h b/GLideN64/src/inc/freetype/include/internal/ftdriver.h deleted file mode 100644 index 940218e..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftdriver.h +++ /dev/null @@ -1,409 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftdriver.h */ -/* */ -/* FreeType font driver interface (specification). */ -/* */ -/* Copyright 1996-2003, 2006, 2008, 2011-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTDRIVER_H__ -#define __FTDRIVER_H__ - - -#include <ft2build.h> -#include FT_MODULE_H - - -FT_BEGIN_HEADER - - - typedef FT_Error - (*FT_Face_InitFunc)( FT_Stream stream, - FT_Face face, - FT_Int typeface_index, - FT_Int num_params, - FT_Parameter* parameters ); - - typedef void - (*FT_Face_DoneFunc)( FT_Face face ); - - - typedef FT_Error - (*FT_Size_InitFunc)( FT_Size size ); - - typedef void - (*FT_Size_DoneFunc)( FT_Size size ); - - - typedef FT_Error - (*FT_Slot_InitFunc)( FT_GlyphSlot slot ); - - typedef void - (*FT_Slot_DoneFunc)( FT_GlyphSlot slot ); - - - typedef FT_Error - (*FT_Size_RequestFunc)( FT_Size size, - FT_Size_Request req ); - - typedef FT_Error - (*FT_Size_SelectFunc)( FT_Size size, - FT_ULong size_index ); - - typedef FT_Error - (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, - FT_Size size, - FT_UInt glyph_index, - FT_Int32 load_flags ); - - - typedef FT_UInt - (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap, - FT_Long charcode ); - - typedef FT_Long - (*FT_CharMap_CharNextFunc)( FT_CharMap charmap, - FT_Long charcode ); - - - typedef FT_Error - (*FT_Face_GetKerningFunc)( FT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_Vector* kerning ); - - - typedef FT_Error - (*FT_Face_AttachFunc)( FT_Face face, - FT_Stream stream ); - - - typedef FT_Error - (*FT_Face_GetAdvancesFunc)( FT_Face face, - FT_UInt first, - FT_UInt count, - FT_Int32 flags, - FT_Fixed* advances ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Driver_ClassRec */ - /* */ - /* <Description> */ - /* The font driver class. This structure mostly contains pointers to */ - /* driver methods. */ - /* */ - /* <Fields> */ - /* root :: The parent module. */ - /* */ - /* face_object_size :: The size of a face object in bytes. */ - /* */ - /* size_object_size :: The size of a size object in bytes. */ - /* */ - /* slot_object_size :: The size of a glyph object in bytes. */ - /* */ - /* init_face :: The format-specific face constructor. */ - /* */ - /* done_face :: The format-specific face destructor. */ - /* */ - /* init_size :: The format-specific size constructor. */ - /* */ - /* done_size :: The format-specific size destructor. */ - /* */ - /* init_slot :: The format-specific slot constructor. */ - /* */ - /* done_slot :: The format-specific slot destructor. */ - /* */ - /* */ - /* load_glyph :: A function handle to load a glyph to a slot. */ - /* This field is mandatory! */ - /* */ - /* get_kerning :: A function handle to return the unscaled */ - /* kerning for a given pair of glyphs. Can be */ - /* set to 0 if the format doesn't support */ - /* kerning. */ - /* */ - /* attach_file :: This function handle is used to read */ - /* additional data for a face from another */ - /* file/stream. For example, this can be used to */ - /* add data from AFM or PFM files on a Type 1 */ - /* face, or a CIDMap on a CID-keyed face. */ - /* */ - /* get_advances :: A function handle used to return advance */ - /* widths of `count' glyphs (in font units), */ - /* starting at `first'. The `vertical' flag must */ - /* be set to get vertical advance heights. The */ - /* `advances' buffer is caller-allocated. */ - /* The idea of this function is to be able to */ - /* perform device-independent text layout without */ - /* loading a single glyph image. */ - /* */ - /* request_size :: A handle to a function used to request the new */ - /* character size. Can be set to 0 if the */ - /* scaling done in the base layer suffices. */ - /* */ - /* select_size :: A handle to a function used to select a new */ - /* fixed size. It is used only if */ - /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ - /* to 0 if the scaling done in the base layer */ - /* suffices. */ - /* <Note> */ - /* Most function pointers, with the exception of `load_glyph', can be */ - /* set to 0 to indicate a default behaviour. */ - /* */ - typedef struct FT_Driver_ClassRec_ - { - FT_Module_Class root; - - FT_Long face_object_size; - FT_Long size_object_size; - FT_Long slot_object_size; - - FT_Face_InitFunc init_face; - FT_Face_DoneFunc done_face; - - FT_Size_InitFunc init_size; - FT_Size_DoneFunc done_size; - - FT_Slot_InitFunc init_slot; - FT_Slot_DoneFunc done_slot; - - FT_Slot_LoadFunc load_glyph; - - FT_Face_GetKerningFunc get_kerning; - FT_Face_AttachFunc attach_file; - FT_Face_GetAdvancesFunc get_advances; - - /* since version 2.2 */ - FT_Size_RequestFunc request_size; - FT_Size_SelectFunc select_size; - - } FT_Driver_ClassRec, *FT_Driver_Class; - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DECLARE_DRIVER */ - /* */ - /* <Description> */ - /* Used to create a forward declaration of an FT_Driver_ClassRec */ - /* struct instance. */ - /* */ - /* <Macro> */ - /* FT_DEFINE_DRIVER */ - /* */ - /* <Description> */ - /* Used to initialize an instance of FT_Driver_ClassRec struct. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */ - /* called with a pointer where the allocated structure is returned. */ - /* And when it is no longer needed a `destroy' function needs to be */ - /* called to release that allocation. */ - /* */ - /* `fcinit.c' (ft_create_default_module_classes) already contains a */ - /* mechanism to call these functions for the default modules */ - /* described in `ftmodule.h'. */ - /* */ - /* Notice that the created `create' and `destroy' functions call */ - /* `pic_init' and `pic_free' to allow you to manually allocate and */ - /* initialize any additional global data, like a module specific */ - /* interface, and put them in the global pic container defined in */ - /* `ftpic.h'. If you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the `pic_init' and */ - /* `pic_free' functions should be declared in `pic.h', to be referred */ - /* by driver definition calling `FT_DEFINE_DRIVER' in following. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro is */ - /* used). */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DECLARE_DRIVER( class_ ) \ - FT_CALLBACK_TABLE \ - const FT_Driver_ClassRec class_; - -#define FT_DEFINE_DRIVER( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_, \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - init_face_, \ - done_face_, \ - init_size_, \ - done_size_, \ - init_slot_, \ - done_slot_, \ - load_glyph_, \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - request_size_, \ - select_size_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Driver_ClassRec class_ = \ - { \ - FT_DEFINE_ROOT_MODULE( flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - \ - init_face_, \ - done_face_, \ - \ - init_size_, \ - done_size_, \ - \ - init_slot_, \ - done_slot_, \ - \ - load_glyph_, \ - \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - \ - request_size_, \ - select_size_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ ) - -#define FT_DEFINE_DRIVER( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_, \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - init_face_, \ - done_face_, \ - init_size_, \ - done_size_, \ - init_slot_, \ - done_slot_, \ - load_glyph_, \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - request_size_, \ - select_size_ ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ - \ - \ - class_ ## _pic_free( library ); \ - if ( dclazz ) \ - FT_FREE( dclazz ); \ - } \ - \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Driver_Class clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ - return error; \ - \ - error = class_ ## _pic_init( library ); \ - if ( error ) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE( flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - \ - clazz->face_object_size = face_object_size_; \ - clazz->size_object_size = size_object_size_; \ - clazz->slot_object_size = slot_object_size_; \ - \ - clazz->init_face = init_face_; \ - clazz->done_face = done_face_; \ - \ - clazz->init_size = init_size_; \ - clazz->done_size = done_size_; \ - \ - clazz->init_slot = init_slot_; \ - clazz->done_slot = done_slot_; \ - \ - clazz->load_glyph = load_glyph_; \ - \ - clazz->get_kerning = get_kerning_; \ - clazz->attach_file = attach_file_; \ - clazz->get_advances = get_advances_; \ - \ - clazz->request_size = request_size_; \ - clazz->select_size = select_size_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - \ - return FT_Err_Ok; \ - } - - -#endif /* FT_CONFIG_OPTION_PIC */ - -FT_END_HEADER - -#endif /* __FTDRIVER_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftgloadr.h b/GLideN64/src/inc/freetype/include/internal/ftgloadr.h deleted file mode 100644 index ce4dc6c..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftgloadr.h +++ /dev/null @@ -1,168 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftgloadr.h */ -/* */ -/* The FreeType glyph loader (specification). */ -/* */ -/* Copyright 2002, 2003, 2005, 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTGLOADR_H__ -#define __FTGLOADR_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_GlyphLoader */ - /* */ - /* <Description> */ - /* The glyph loader is an internal object used to load several glyphs */ - /* together (for example, in the case of composites). */ - /* */ - /* <Note> */ - /* The glyph loader implementation is not part of the high-level API, */ - /* hence the forward structure declaration. */ - /* */ - typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ; - - -#if 0 /* moved to freetype.h in version 2.2 */ -#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 -#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 -#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 -#define FT_SUBGLYPH_FLAG_SCALE 8 -#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 -#define FT_SUBGLYPH_FLAG_2X2 0x80 -#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 -#endif - - - typedef struct FT_SubGlyphRec_ - { - FT_Int index; - FT_UShort flags; - FT_Int arg1; - FT_Int arg2; - FT_Matrix transform; - - } FT_SubGlyphRec; - - - typedef struct FT_GlyphLoadRec_ - { - FT_Outline outline; /* outline */ - FT_Vector* extra_points; /* extra points table */ - FT_Vector* extra_points2; /* second extra points table */ - FT_UInt num_subglyphs; /* number of subglyphs */ - FT_SubGlyph subglyphs; /* subglyphs */ - - } FT_GlyphLoadRec, *FT_GlyphLoad; - - - typedef struct FT_GlyphLoaderRec_ - { - FT_Memory memory; - FT_UInt max_points; - FT_UInt max_contours; - FT_UInt max_subglyphs; - FT_Bool use_extra; - - FT_GlyphLoadRec base; - FT_GlyphLoadRec current; - - void* other; /* for possible future extension? */ - - } FT_GlyphLoaderRec; - - - /* create new empty glyph loader */ - FT_BASE( FT_Error ) - FT_GlyphLoader_New( FT_Memory memory, - FT_GlyphLoader *aloader ); - - /* add an extra points table to a glyph loader */ - FT_BASE( FT_Error ) - FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader ); - - /* destroy a glyph loader */ - FT_BASE( void ) - FT_GlyphLoader_Done( FT_GlyphLoader loader ); - - /* reset a glyph loader (frees everything int it) */ - FT_BASE( void ) - FT_GlyphLoader_Reset( FT_GlyphLoader loader ); - - /* rewind a glyph loader */ - FT_BASE( void ) - FT_GlyphLoader_Rewind( FT_GlyphLoader loader ); - - /* check that there is enough space to add `n_points' and `n_contours' */ - /* to the glyph loader */ - FT_BASE( FT_Error ) - FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader, - FT_UInt n_points, - FT_UInt n_contours ); - - -#define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \ - ( (_count) == 0 || ((_loader)->base.outline.n_points + \ - (_loader)->current.outline.n_points + \ - (unsigned long)(_count)) <= (_loader)->max_points ) - -#define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \ - ( (_count) == 0 || ((_loader)->base.outline.n_contours + \ - (_loader)->current.outline.n_contours + \ - (unsigned long)(_count)) <= (_loader)->max_contours ) - -#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours ) \ - ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \ - FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \ - ? 0 \ - : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) ) - - - /* check that there is enough space to add `n_subs' sub-glyphs to */ - /* a glyph loader */ - FT_BASE( FT_Error ) - FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader, - FT_UInt n_subs ); - - /* prepare a glyph loader, i.e. empty the current glyph */ - FT_BASE( void ) - FT_GlyphLoader_Prepare( FT_GlyphLoader loader ); - - /* add the current glyph to the base glyph */ - FT_BASE( void ) - FT_GlyphLoader_Add( FT_GlyphLoader loader ); - - /* copy points from one glyph loader to another */ - FT_BASE( FT_Error ) - FT_GlyphLoader_CopyPoints( FT_GlyphLoader target, - FT_GlyphLoader source ); - - /* */ - - -FT_END_HEADER - -#endif /* __FTGLOADR_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftmemory.h b/GLideN64/src/inc/freetype/include/internal/ftmemory.h deleted file mode 100644 index 3d51aee..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftmemory.h +++ /dev/null @@ -1,378 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftmemory.h */ -/* */ -/* The FreeType memory management macros (specification). */ -/* */ -/* Copyright 1996-2002, 2004-2007, 2010, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTMEMORY_H__ -#define __FTMEMORY_H__ - - -#include <ft2build.h> -#include FT_CONFIG_CONFIG_H -#include FT_TYPES_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_SET_ERROR */ - /* */ - /* <Description> */ - /* This macro is used to set an implicit `error' variable to a given */ - /* expression's value (usually a function call), and convert it to a */ - /* boolean which is set whenever the value is != 0. */ - /* */ -#undef FT_SET_ERROR -#define FT_SET_ERROR( expression ) \ - ( ( error = (expression) ) != 0 ) - - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** M E M O R Y ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* - * C++ refuses to handle statements like p = (void*)anything, with `p' a - * typed pointer. Since we don't have a `typeof' operator in standard - * C++, we have to use a template to emulate it. - */ - -#ifdef __cplusplus - - extern "C++" - template <typename T> inline T* - cplusplus_typeof( T*, - void *v ) - { - return static_cast <T*> ( v ); - } - -#define FT_ASSIGNP( p, val ) (p) = cplusplus_typeof( (p), (val) ) - -#else - -#define FT_ASSIGNP( p, val ) (p) = (val) - -#endif - - - -#ifdef FT_DEBUG_MEMORY - - FT_BASE( const char* ) _ft_debug_file; - FT_BASE( long ) _ft_debug_lineno; - -#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \ - _ft_debug_lineno = __LINE__, \ - (exp) ) - -#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \ - _ft_debug_lineno = __LINE__, \ - FT_ASSIGNP( p, exp ) ) - -#else /* !FT_DEBUG_MEMORY */ - -#define FT_DEBUG_INNER( exp ) (exp) -#define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp ) - -#endif /* !FT_DEBUG_MEMORY */ - - - /* - * The allocation functions return a pointer, and the error code - * is written to through the `p_error' parameter. See below for - * for documentation. - */ - - FT_BASE( FT_Pointer ) - ft_mem_alloc( FT_Memory memory, - FT_Long size, - FT_Error *p_error ); - - FT_BASE( FT_Pointer ) - ft_mem_qalloc( FT_Memory memory, - FT_Long size, - FT_Error *p_error ); - - FT_BASE( FT_Pointer ) - ft_mem_realloc( FT_Memory memory, - FT_Long item_size, - FT_Long cur_count, - FT_Long new_count, - void* block, - FT_Error *p_error ); - - FT_BASE( FT_Pointer ) - ft_mem_qrealloc( FT_Memory memory, - FT_Long item_size, - FT_Long cur_count, - FT_Long new_count, - void* block, - FT_Error *p_error ); - - FT_BASE( void ) - ft_mem_free( FT_Memory memory, - const void* P ); - - -#define FT_MEM_ALLOC( ptr, size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \ - (FT_Long)(size), \ - &error ) ) - -#define FT_MEM_FREE( ptr ) \ - FT_BEGIN_STMNT \ - ft_mem_free( memory, (ptr) ); \ - (ptr) = NULL; \ - FT_END_STMNT - -#define FT_MEM_NEW( ptr ) \ - FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) ) - -#define FT_MEM_REALLOC( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ - 1, \ - (FT_Long)(cursz), \ - (FT_Long)(newsz), \ - (ptr), \ - &error ) ) - -#define FT_MEM_QALLOC( ptr, size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \ - (FT_Long)(size), \ - &error ) ) - -#define FT_MEM_QNEW( ptr ) \ - FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) ) - -#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ - 1, \ - (FT_Long)(cursz), \ - (FT_Long)(newsz), \ - (ptr), \ - &error ) ) - -#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ - (FT_Long)(item_size), \ - 0, \ - (FT_Long)(count), \ - NULL, \ - &error ) ) - -#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ - (FT_Long)(itmsz), \ - (FT_Long)(oldcnt), \ - (FT_Long)(newcnt), \ - (ptr), \ - &error ) ) - -#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ - (FT_Long)(item_size), \ - 0, \ - (FT_Long)(count), \ - NULL, \ - &error ) ) - -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ - (FT_Long)(itmsz), \ - (FT_Long)(oldcnt), \ - (FT_Long)(newcnt), \ - (ptr), \ - &error ) ) - - -#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 ) - - -#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count ) - -#define FT_MEM_COPY( dest, source, count ) ft_memcpy( dest, source, count ) - -#define FT_MEM_MOVE( dest, source, count ) ft_memmove( dest, source, count ) - - -#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count ) - -#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) ) - - -#define FT_ARRAY_ZERO( dest, count ) \ - FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) ) - -#define FT_ARRAY_COPY( dest, source, count ) \ - FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) ) - -#define FT_ARRAY_MOVE( dest, source, count ) \ - FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) ) - - - /* - * Return the maximum number of addressable elements in an array. - * We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid - * any problems. - */ -#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) ) - -#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) ) - - - /*************************************************************************/ - /* */ - /* The following functions macros expect that their pointer argument is */ - /* _typed_ in order to automatically compute array element sizes. */ - /* */ - -#define FT_MEM_NEW_ARRAY( ptr, count ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ - sizeof ( *(ptr) ), \ - 0, \ - (FT_Long)(count), \ - NULL, \ - &error ) ) - -#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ - sizeof ( *(ptr) ), \ - (FT_Long)(cursz), \ - (FT_Long)(newsz), \ - (ptr), \ - &error ) ) - -#define FT_MEM_QNEW_ARRAY( ptr, count ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ - sizeof ( *(ptr) ), \ - 0, \ - (FT_Long)(count), \ - NULL, \ - &error ) ) - -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ - sizeof ( *(ptr) ), \ - (FT_Long)(cursz), \ - (FT_Long)(newsz), \ - (ptr), \ - &error ) ) - -#define FT_ALLOC( ptr, size ) \ - FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) ) - -#define FT_REALLOC( ptr, cursz, newsz ) \ - FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) ) - -#define FT_ALLOC_MULT( ptr, count, item_size ) \ - FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) ) - -#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ - FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \ - newcnt, itmsz ) ) - -#define FT_QALLOC( ptr, size ) \ - FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) ) - -#define FT_QREALLOC( ptr, cursz, newsz ) \ - FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) ) - -#define FT_QALLOC_MULT( ptr, count, item_size ) \ - FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) ) - -#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ - FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \ - newcnt, itmsz ) ) - -#define FT_FREE( ptr ) FT_MEM_FREE( ptr ) - -#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) ) - -#define FT_NEW_ARRAY( ptr, count ) \ - FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) ) - -#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \ - FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) ) - -#define FT_QNEW( ptr ) \ - FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) ) - -#define FT_QNEW_ARRAY( ptr, count ) \ - FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) ) - -#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \ - FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) ) - - - FT_BASE( FT_Pointer ) - ft_mem_strdup( FT_Memory memory, - const char* str, - FT_Error *p_error ); - - FT_BASE( FT_Pointer ) - ft_mem_dup( FT_Memory memory, - const void* address, - FT_ULong size, - FT_Error *p_error ); - - -#define FT_MEM_STRDUP( dst, str ) \ - (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error ) - -#define FT_STRDUP( dst, str ) \ - FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) ) - -#define FT_MEM_DUP( dst, address, size ) \ - (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error ) - -#define FT_DUP( dst, address, size ) \ - FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) ) - - - /* Return >= 1 if a truncation occurs. */ - /* Return 0 if the source string fits the buffer. */ - /* This is *not* the same as strlcpy(). */ - FT_BASE( FT_Int ) - ft_mem_strcpyn( char* dst, - const char* src, - FT_ULong size ); - -#define FT_STRCPYN( dst, src, size ) \ - ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) ) - - /* */ - - -FT_END_HEADER - -#endif /* __FTMEMORY_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftobjs.h b/GLideN64/src/inc/freetype/include/internal/ftobjs.h deleted file mode 100644 index 701c850..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftobjs.h +++ /dev/null @@ -1,1569 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftobjs.h */ -/* */ -/* The FreeType private base classes (specification). */ -/* */ -/* Copyright 1996-2006, 2008, 2010, 2012-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file contains the definition of all internal FreeType classes. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTOBJS_H__ -#define __FTOBJS_H__ - -#include <ft2build.h> -#include FT_RENDER_H -#include FT_SIZES_H -#include FT_LCD_FILTER_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_GLYPH_LOADER_H -#include FT_INTERNAL_DRIVER_H -#include FT_INTERNAL_AUTOHINT_H -#include FT_INTERNAL_SERVICE_H -#include FT_INTERNAL_PIC_H - -#ifdef FT_CONFIG_OPTION_INCREMENTAL -#include FT_INCREMENTAL_H -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* Some generic definitions. */ - /* */ -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef NULL -#define NULL (void*)0 -#endif - - - /*************************************************************************/ - /* */ - /* The min and max functions missing in C. As usual, be careful not to */ - /* write things like FT_MIN( a++, b++ ) to avoid side effects. */ - /* */ -#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) ) -#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) - -#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) - - -#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) -#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) -#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) - -#define FT_PIX_FLOOR( x ) ( (x) & ~63 ) -#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) -#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) - - - /* - * Return the highest power of 2 that is <= value; this correspond to - * the highest bit in a given 32-bit value. - */ - FT_BASE( FT_UInt32 ) - ft_highpow2( FT_UInt32 value ); - - - /* - * character classification functions -- since these are used to parse - * font files, we must not use those in <ctypes.h> which are - * locale-dependent - */ -#define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U ) - -#define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \ - ( (unsigned)(x) - 'a' ) < 6U || \ - ( (unsigned)(x) - 'A' ) < 6U ) - - /* the next two macros assume ASCII representation */ -#define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U ) -#define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U ) - -#define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) ) -#define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) ) - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** C H A R M A P S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /* handle to internal charmap object */ - typedef struct FT_CMapRec_* FT_CMap; - - /* handle to charmap class structure */ - typedef const struct FT_CMap_ClassRec_* FT_CMap_Class; - - /* internal charmap object structure */ - typedef struct FT_CMapRec_ - { - FT_CharMapRec charmap; - FT_CMap_Class clazz; - - } FT_CMapRec; - - /* typecase any pointer to a charmap handle */ -#define FT_CMAP( x ) ((FT_CMap)( x )) - - /* obvious macros */ -#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id -#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id -#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding -#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face - - - /* class method definitions */ - typedef FT_Error - (*FT_CMap_InitFunc)( FT_CMap cmap, - FT_Pointer init_data ); - - typedef void - (*FT_CMap_DoneFunc)( FT_CMap cmap ); - - typedef FT_UInt - (*FT_CMap_CharIndexFunc)( FT_CMap cmap, - FT_UInt32 char_code ); - - typedef FT_UInt - (*FT_CMap_CharNextFunc)( FT_CMap cmap, - FT_UInt32 *achar_code ); - - typedef FT_UInt - (*FT_CMap_CharVarIndexFunc)( FT_CMap cmap, - FT_CMap unicode_cmap, - FT_UInt32 char_code, - FT_UInt32 variant_selector ); - - typedef FT_Bool - (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap, - FT_UInt32 char_code, - FT_UInt32 variant_selector ); - - typedef FT_UInt32 * - (*FT_CMap_VariantListFunc)( FT_CMap cmap, - FT_Memory mem ); - - typedef FT_UInt32 * - (*FT_CMap_CharVariantListFunc)( FT_CMap cmap, - FT_Memory mem, - FT_UInt32 char_code ); - - typedef FT_UInt32 * - (*FT_CMap_VariantCharListFunc)( FT_CMap cmap, - FT_Memory mem, - FT_UInt32 variant_selector ); - - - typedef struct FT_CMap_ClassRec_ - { - FT_ULong size; - FT_CMap_InitFunc init; - FT_CMap_DoneFunc done; - FT_CMap_CharIndexFunc char_index; - FT_CMap_CharNextFunc char_next; - - /* Subsequent entries are special ones for format 14 -- the variant */ - /* selector subtable which behaves like no other */ - - FT_CMap_CharVarIndexFunc char_var_index; - FT_CMap_CharVarIsDefaultFunc char_var_default; - FT_CMap_VariantListFunc variant_list; - FT_CMap_CharVariantListFunc charvariant_list; - FT_CMap_VariantCharListFunc variantchar_list; - - } FT_CMap_ClassRec; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DECLARE_CMAP_CLASS( class_ ) \ - FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; - -#define FT_DEFINE_CMAP_CLASS( \ - class_, \ - size_, \ - init_, \ - done_, \ - char_index_, \ - char_next_, \ - char_var_index_, \ - char_var_default_, \ - variant_list_, \ - charvariant_list_, \ - variantchar_list_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_CMap_ClassRec class_ = \ - { \ - size_, \ - init_, \ - done_, \ - char_index_, \ - char_next_, \ - char_var_index_, \ - char_var_default_, \ - variant_list_, \ - charvariant_list_, \ - variantchar_list_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DECLARE_CMAP_CLASS( class_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_CMap_ClassRec* clazz ); - -#define FT_DEFINE_CMAP_CLASS( \ - class_, \ - size_, \ - init_, \ - done_, \ - char_index_, \ - char_next_, \ - char_var_index_, \ - char_var_default_, \ - variant_list_, \ - charvariant_list_, \ - variantchar_list_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_CMap_ClassRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->size = size_; \ - clazz->init = init_; \ - clazz->done = done_; \ - clazz->char_index = char_index_; \ - clazz->char_next = char_next_; \ - clazz->char_var_index = char_var_index_; \ - clazz->char_var_default = char_var_default_; \ - clazz->variant_list = variant_list_; \ - clazz->charvariant_list = charvariant_list_; \ - clazz->variantchar_list = variantchar_list_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - - /* create a new charmap and add it to charmap->face */ - FT_BASE( FT_Error ) - FT_CMap_New( FT_CMap_Class clazz, - FT_Pointer init_data, - FT_CharMap charmap, - FT_CMap *acmap ); - - /* destroy a charmap and remove it from face's list */ - FT_BASE( void ) - FT_CMap_Done( FT_CMap cmap ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Face_InternalRec */ - /* */ - /* <Description> */ - /* This structure contains the internal fields of each FT_Face */ - /* object. These fields may change between different releases of */ - /* FreeType. */ - /* */ - /* <Fields> */ - /* max_points :: */ - /* The maximum number of points used to store the vectorial outline */ - /* of any glyph in this face. If this value cannot be known in */ - /* advance, or if the face isn't scalable, this should be set to 0. */ - /* Only relevant for scalable formats. */ - /* */ - /* max_contours :: */ - /* The maximum number of contours used to store the vectorial */ - /* outline of any glyph in this face. If this value cannot be */ - /* known in advance, or if the face isn't scalable, this should be */ - /* set to 0. Only relevant for scalable formats. */ - /* */ - /* transform_matrix :: */ - /* A 2x2 matrix of 16.16 coefficients used to transform glyph */ - /* outlines after they are loaded from the font. Only used by the */ - /* convenience functions. */ - /* */ - /* transform_delta :: */ - /* A translation vector used to transform glyph outlines after they */ - /* are loaded from the font. Only used by the convenience */ - /* functions. */ - /* */ - /* transform_flags :: */ - /* Some flags used to classify the transform. Only used by the */ - /* convenience functions. */ - /* */ - /* services :: */ - /* A cache for frequently used services. It should be only */ - /* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */ - /* */ - /* incremental_interface :: */ - /* If non-null, the interface through which glyph data and metrics */ - /* are loaded incrementally for faces that do not provide all of */ - /* this data when first opened. This field exists only if */ - /* @FT_CONFIG_OPTION_INCREMENTAL is defined. */ - /* */ - /* ignore_unpatented_hinter :: */ - /* This boolean flag instructs the glyph loader to ignore the */ - /* native font hinter, if one is found. This is exclusively used */ - /* in the case when the unpatented hinter is compiled within the */ - /* library. */ - /* */ - /* refcount :: */ - /* A counter initialized to~1 at the time an @FT_Face structure is */ - /* created. @FT_Reference_Face increments this counter, and */ - /* @FT_Done_Face only destroys a face if the counter is~1, */ - /* otherwise it simply decrements it. */ - /* */ - typedef struct FT_Face_InternalRec_ - { - FT_Matrix transform_matrix; - FT_Vector transform_delta; - FT_Int transform_flags; - - FT_ServiceCacheRec services; - -#ifdef FT_CONFIG_OPTION_INCREMENTAL - FT_Incremental_InterfaceRec* incremental_interface; -#endif - - FT_Bool ignore_unpatented_hinter; - FT_Int refcount; - - } FT_Face_InternalRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Slot_InternalRec */ - /* */ - /* <Description> */ - /* This structure contains the internal fields of each FT_GlyphSlot */ - /* object. These fields may change between different releases of */ - /* FreeType. */ - /* */ - /* <Fields> */ - /* loader :: The glyph loader object used to load outlines */ - /* into the glyph slot. */ - /* */ - /* flags :: Possible values are zero or */ - /* FT_GLYPH_OWN_BITMAP. The latter indicates */ - /* that the FT_GlyphSlot structure owns the */ - /* bitmap buffer. */ - /* */ - /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */ - /* must be transformed through a specific */ - /* font transformation. This is _not_ the same */ - /* as the face transform set through */ - /* FT_Set_Transform(). */ - /* */ - /* glyph_matrix :: The 2x2 matrix corresponding to the glyph */ - /* transformation, if necessary. */ - /* */ - /* glyph_delta :: The 2d translation vector corresponding to */ - /* the glyph transformation, if necessary. */ - /* */ - /* glyph_hints :: Format-specific glyph hints management. */ - /* */ - -#define FT_GLYPH_OWN_BITMAP 0x1 - - typedef struct FT_Slot_InternalRec_ - { - FT_GlyphLoader loader; - FT_UInt flags; - FT_Bool glyph_transformed; - FT_Matrix glyph_matrix; - FT_Vector glyph_delta; - void* glyph_hints; - - } FT_GlyphSlot_InternalRec; - - -#if 0 - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_InternalRec */ - /* */ - /* <Description> */ - /* This structure contains the internal fields of each FT_Size */ - /* object. Currently, it's empty. */ - /* */ - /*************************************************************************/ - - typedef struct FT_Size_InternalRec_ - { - /* empty */ - - } FT_Size_InternalRec; - -#endif - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** M O D U L E S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ModuleRec */ - /* */ - /* <Description> */ - /* A module object instance. */ - /* */ - /* <Fields> */ - /* clazz :: A pointer to the module's class. */ - /* */ - /* library :: A handle to the parent library object. */ - /* */ - /* memory :: A handle to the memory manager. */ - /* */ - typedef struct FT_ModuleRec_ - { - FT_Module_Class* clazz; - FT_Library library; - FT_Memory memory; - - } FT_ModuleRec; - - - /* typecast an object to an FT_Module */ -#define FT_MODULE( x ) ((FT_Module)( x )) -#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz -#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library -#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory - - -#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_FONT_DRIVER ) - -#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_RENDERER ) - -#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_HINTER ) - -#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_STYLER ) - -#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_DRIVER_SCALABLE ) - -#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_DRIVER_NO_OUTLINES ) - -#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ - FT_MODULE_DRIVER_HAS_HINTER ) - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Module_Interface */ - /* */ - /* <Description> */ - /* Finds a module and returns its specific interface as a typeless */ - /* pointer. */ - /* */ - /* <Input> */ - /* library :: A handle to the library object. */ - /* */ - /* module_name :: The module's name (as an ASCII string). */ - /* */ - /* <Return> */ - /* A module-specific interface if available, 0 otherwise. */ - /* */ - /* <Note> */ - /* You should better be familiar with FreeType internals to know */ - /* which module to look for, and what its interface is :-) */ - /* */ - FT_BASE( const void* ) - FT_Get_Module_Interface( FT_Library library, - const char* mod_name ); - - FT_BASE( FT_Pointer ) - ft_module_get_service( FT_Module module, - const char* service_id ); - - /* */ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /* a few macros used to perform easy typecasts with minimal brain damage */ - -#define FT_FACE( x ) ((FT_Face)(x)) -#define FT_SIZE( x ) ((FT_Size)(x)) -#define FT_SLOT( x ) ((FT_GlyphSlot)(x)) - -#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver -#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library -#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory -#define FT_FACE_STREAM( x ) FT_FACE( x )->stream - -#define FT_SIZE_FACE( x ) FT_SIZE( x )->face -#define FT_SLOT_FACE( x ) FT_SLOT( x )->face - -#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph -#define FT_FACE_SIZE( x ) FT_FACE( x )->size - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_GlyphSlot */ - /* */ - /* <Description> */ - /* It is sometimes useful to have more than one glyph slot for a */ - /* given face object. This function is used to create additional */ - /* slots. All of them are automatically discarded when the face is */ - /* destroyed. */ - /* */ - /* <Input> */ - /* face :: A handle to a parent face object. */ - /* */ - /* <Output> */ - /* aslot :: A handle to a new glyph slot object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - FT_BASE( FT_Error ) - FT_New_GlyphSlot( FT_Face face, - FT_GlyphSlot *aslot ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_GlyphSlot */ - /* */ - /* <Description> */ - /* Destroys a given glyph slot. Remember however that all slots are */ - /* automatically destroyed with its parent. Using this function is */ - /* not always mandatory. */ - /* */ - /* <Input> */ - /* slot :: A handle to a target glyph slot. */ - /* */ - FT_BASE( void ) - FT_Done_GlyphSlot( FT_GlyphSlot slot ); - - /* */ - -#define FT_REQUEST_WIDTH( req ) \ - ( (req)->horiResolution \ - ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \ - : (req)->width ) - -#define FT_REQUEST_HEIGHT( req ) \ - ( (req)->vertResolution \ - ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \ - : (req)->height ) - - - /* Set the metrics according to a bitmap strike. */ - FT_BASE( void ) - FT_Select_Metrics( FT_Face face, - FT_ULong strike_index ); - - - /* Set the metrics according to a size request. */ - FT_BASE( void ) - FT_Request_Metrics( FT_Face face, - FT_Size_Request req ); - - - /* Match a size request against `available_sizes'. */ - FT_BASE( FT_Error ) - FT_Match_Size( FT_Face face, - FT_Size_Request req, - FT_Bool ignore_width, - FT_ULong* size_index ); - - - /* Use the horizontal metrics to synthesize the vertical metrics. */ - /* If `advance' is zero, it is also synthesized. */ - FT_BASE( void ) - ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics, - FT_Pos advance ); - - - /* Free the bitmap of a given glyphslot when needed (i.e., only when it */ - /* was allocated with ft_glyphslot_alloc_bitmap). */ - FT_BASE( void ) - ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); - - - /* Allocate a new bitmap buffer in a glyph slot. */ - FT_BASE( FT_Error ) - ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot, - FT_ULong size ); - - - /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */ - /* will not be freed by a later call to ft_glyphslot_free_bitmap. */ - FT_BASE( void ) - ft_glyphslot_set_bitmap( FT_GlyphSlot slot, - FT_Byte* buffer ); - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** R E N D E R E R S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - -#define FT_RENDERER( x ) ((FT_Renderer)( x )) -#define FT_GLYPH( x ) ((FT_Glyph)( x )) -#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) -#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) - - - typedef struct FT_RendererRec_ - { - FT_ModuleRec root; - FT_Renderer_Class* clazz; - FT_Glyph_Format glyph_format; - FT_Glyph_Class glyph_class; - - FT_Raster raster; - FT_Raster_Render_Func raster_render; - FT_Renderer_RenderFunc render; - - } FT_RendererRec; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** F O N T D R I V E R S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* typecast a module into a driver easily */ -#define FT_DRIVER( x ) ((FT_Driver)(x)) - - /* typecast a module as a driver, and get its driver class */ -#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_DriverRec */ - /* */ - /* <Description> */ - /* The root font driver class. A font driver is responsible for */ - /* managing and loading font files of a given format. */ - /* */ - /* <Fields> */ - /* root :: Contains the fields of the root module class. */ - /* */ - /* clazz :: A pointer to the font driver's class. Note that */ - /* this is NOT root.clazz. `class' wasn't used */ - /* as it is a reserved word in C++. */ - /* */ - /* faces_list :: The list of faces currently opened by this */ - /* driver. */ - /* */ - /* glyph_loader :: The glyph loader for all faces managed by this */ - /* driver. This object isn't defined for unscalable */ - /* formats. */ - /* */ - typedef struct FT_DriverRec_ - { - FT_ModuleRec root; - FT_Driver_Class clazz; - FT_ListRec faces_list; - FT_GlyphLoader glyph_loader; - - } FT_DriverRec; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** L I B R A R I E S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* This hook is used by the TrueType debugger. It must be set to an */ - /* alternate truetype bytecode interpreter function. */ -#define FT_DEBUG_HOOK_TRUETYPE 0 - - - /* Set this debug hook to a non-null pointer to force unpatented hinting */ - /* for all faces when both TT_USE_BYTECODE_INTERPRETER and */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. This is only used */ - /* during debugging. */ -#define FT_DEBUG_HOOK_UNPATENTED_HINTING 1 - - - typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, - FT_Render_Mode render_mode, - FT_Library library ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_LibraryRec */ - /* */ - /* <Description> */ - /* The FreeType library class. This is the root of all FreeType */ - /* data. Use FT_New_Library() to create a library object, and */ - /* FT_Done_Library() to discard it and all child objects. */ - /* */ - /* <Fields> */ - /* memory :: The library's memory object. Manages memory */ - /* allocation. */ - /* */ - /* version_major :: The major version number of the library. */ - /* */ - /* version_minor :: The minor version number of the library. */ - /* */ - /* version_patch :: The current patch level of the library. */ - /* */ - /* num_modules :: The number of modules currently registered */ - /* within this library. This is set to 0 for new */ - /* libraries. New modules are added through the */ - /* FT_Add_Module() API function. */ - /* */ - /* modules :: A table used to store handles to the currently */ - /* registered modules. Note that each font driver */ - /* contains a list of its opened faces. */ - /* */ - /* renderers :: The list of renderers currently registered */ - /* within the library. */ - /* */ - /* cur_renderer :: The current outline renderer. This is a */ - /* shortcut used to avoid parsing the list on */ - /* each call to FT_Outline_Render(). It is a */ - /* handle to the current renderer for the */ - /* FT_GLYPH_FORMAT_OUTLINE format. */ - /* */ - /* auto_hinter :: XXX */ - /* */ - /* raster_pool :: The raster object's render pool. This can */ - /* ideally be changed dynamically at run-time. */ - /* */ - /* raster_pool_size :: The size of the render pool in bytes. */ - /* */ - /* debug_hooks :: XXX */ - /* */ - /* lcd_filter :: If subpixel rendering is activated, the */ - /* selected LCD filter mode. */ - /* */ - /* lcd_extra :: If subpixel rendering is activated, the number */ - /* of extra pixels needed for the LCD filter. */ - /* */ - /* lcd_weights :: If subpixel rendering is activated, the LCD */ - /* filter weights, if any. */ - /* */ - /* lcd_filter_func :: If subpixel rendering is activated, the LCD */ - /* filtering callback function. */ - /* */ - /* pic_container :: Contains global structs and tables, instead */ - /* of defining them globallly. */ - /* */ - /* refcount :: A counter initialized to~1 at the time an */ - /* @FT_Library structure is created. */ - /* @FT_Reference_Library increments this counter, */ - /* and @FT_Done_Library only destroys a library */ - /* if the counter is~1, otherwise it simply */ - /* decrements it. */ - /* */ - typedef struct FT_LibraryRec_ - { - FT_Memory memory; /* library's memory manager */ - - FT_Int version_major; - FT_Int version_minor; - FT_Int version_patch; - - FT_UInt num_modules; - FT_Module modules[FT_MAX_MODULES]; /* module objects */ - - FT_ListRec renderers; /* list of renderers */ - FT_Renderer cur_renderer; /* current outline renderer */ - FT_Module auto_hinter; - - FT_Byte* raster_pool; /* scan-line conversion */ - /* render pool */ - FT_ULong raster_pool_size; /* size of render pool in bytes */ - - FT_DebugHook_Func debug_hooks[4]; - -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFilter lcd_filter; - FT_Int lcd_extra; /* number of extra pixels */ - FT_Byte lcd_weights[7]; /* filter weights, if any */ - FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ -#endif - -#ifdef FT_CONFIG_OPTION_PIC - FT_PIC_Container pic_container; -#endif - - FT_Int refcount; - - } FT_LibraryRec; - - - FT_BASE( FT_Renderer ) - FT_Lookup_Renderer( FT_Library library, - FT_Glyph_Format format, - FT_ListNode* node ); - - FT_BASE( FT_Error ) - FT_Render_Glyph_Internal( FT_Library library, - FT_GlyphSlot slot, - FT_Render_Mode render_mode ); - - typedef const char* - (*FT_Face_GetPostscriptNameFunc)( FT_Face face ); - - typedef FT_Error - (*FT_Face_GetGlyphNameFunc)( FT_Face face, - FT_UInt glyph_index, - FT_Pointer buffer, - FT_UInt buffer_max ); - - typedef FT_UInt - (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face, - FT_String* glyph_name ); - - -#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Memory */ - /* */ - /* <Description> */ - /* Creates a new memory object. */ - /* */ - /* <Return> */ - /* A pointer to the new memory object. 0 in case of error. */ - /* */ - FT_BASE( FT_Memory ) - FT_New_Memory( void ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Memory */ - /* */ - /* <Description> */ - /* Discards memory manager. */ - /* */ - /* <Input> */ - /* memory :: A handle to the memory manager. */ - /* */ - FT_BASE( void ) - FT_Done_Memory( FT_Memory memory ); - -#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ - - - /* Define default raster's interface. The default raster is located in */ - /* `src/base/ftraster.c'. */ - /* */ - /* Client applications can register new rasters through the */ - /* FT_Set_Raster() API. */ - -#ifndef FT_NO_DEFAULT_RASTER - FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; -#endif - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** P I C S U P P O R T ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* PIC support macros for ftimage.h */ - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DEFINE_OUTLINE_FUNCS */ - /* */ - /* <Description> */ - /* Used to initialize an instance of FT_Outline_Funcs struct. */ - /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* be called with a pre-allocated structure to be filled. */ - /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_OUTLINE_FUNCS( \ - class_, \ - move_to_, \ - line_to_, \ - conic_to_, \ - cubic_to_, \ - shift_, \ - delta_ ) \ - static const FT_Outline_Funcs class_ = \ - { \ - move_to_, \ - line_to_, \ - conic_to_, \ - cubic_to_, \ - shift_, \ - delta_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_OUTLINE_FUNCS( \ - class_, \ - move_to_, \ - line_to_, \ - conic_to_, \ - cubic_to_, \ - shift_, \ - delta_ ) \ - static FT_Error \ - Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \ - { \ - clazz->move_to = move_to_; \ - clazz->line_to = line_to_; \ - clazz->conic_to = conic_to_; \ - clazz->cubic_to = cubic_to_; \ - clazz->shift = shift_; \ - clazz->delta = delta_; \ - \ - return FT_Err_Ok; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DEFINE_RASTER_FUNCS */ - /* */ - /* <Description> */ - /* Used to initialize an instance of FT_Raster_Funcs struct. */ - /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* be called with a pre-allocated structure to be filled. */ - /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_RASTER_FUNCS( \ - class_, \ - glyph_format_, \ - raster_new_, \ - raster_reset_, \ - raster_set_mode_, \ - raster_render_, \ - raster_done_ ) \ - const FT_Raster_Funcs class_ = \ - { \ - glyph_format_, \ - raster_new_, \ - raster_reset_, \ - raster_set_mode_, \ - raster_render_, \ - raster_done_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_RASTER_FUNCS( \ - class_, \ - glyph_format_, \ - raster_new_, \ - raster_reset_, \ - raster_set_mode_, \ - raster_render_, \ - raster_done_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \ - { \ - clazz->glyph_format = glyph_format_; \ - clazz->raster_new = raster_new_; \ - clazz->raster_reset = raster_reset_; \ - clazz->raster_set_mode = raster_set_mode_; \ - clazz->raster_render = raster_render_; \ - clazz->raster_done = raster_done_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - - /* PIC support macros for ftrender.h */ - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DEFINE_GLYPH */ - /* */ - /* <Description> */ - /* Used to initialize an instance of FT_Glyph_Class struct. */ - /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* be called with a pre-allocated stcture to be filled. */ - /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_GLYPH( \ - class_, \ - size_, \ - format_, \ - init_, \ - done_, \ - copy_, \ - transform_, \ - bbox_, \ - prepare_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Glyph_Class class_ = \ - { \ - size_, \ - format_, \ - init_, \ - done_, \ - copy_, \ - transform_, \ - bbox_, \ - prepare_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_GLYPH( \ - class_, \ - size_, \ - format_, \ - init_, \ - done_, \ - copy_, \ - transform_, \ - bbox_, \ - prepare_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \ - { \ - clazz->glyph_size = size_; \ - clazz->glyph_format = format_; \ - clazz->glyph_init = init_; \ - clazz->glyph_done = done_; \ - clazz->glyph_copy = copy_; \ - clazz->glyph_transform = transform_; \ - clazz->glyph_bbox = bbox_; \ - clazz->glyph_prepare = prepare_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DECLARE_RENDERER */ - /* */ - /* <Description> */ - /* Used to create a forward declaration of a */ - /* FT_Renderer_Class struct instance. */ - /* */ - /* <Macro> */ - /* FT_DEFINE_RENDERER */ - /* */ - /* <Description> */ - /* Used to initialize an instance of FT_Renderer_Class struct. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */ - /* to be called with a pointer where the allocated structure is */ - /* returned. And when it is no longer needed a `destroy' function */ - /* needs to be called to release that allocation. */ - /* `fcinit.c' (ft_create_default_module_classes) already contains */ - /* a mechanism to call these functions for the default modules */ - /* described in `ftmodule.h'. */ - /* */ - /* Notice that the created `create' and `destroy' functions call */ - /* `pic_init' and `pic_free' to allow you to manually allocate and */ - /* initialize any additional global data, like a module specific */ - /* interface, and put them in the global pic container defined in */ - /* `ftpic.h'. If you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the `pic_init' and */ - /* `pic_free' functions should be declared in `pic.h', to be referred */ - /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */ - /* following. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DECLARE_RENDERER( class_ ) \ - FT_EXPORT_VAR( const FT_Renderer_Class ) class_; - -#define FT_DEFINE_RENDERER( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_, \ - glyph_format_, \ - render_glyph_, \ - transform_glyph_, \ - get_glyph_cbox_, \ - set_mode_, \ - raster_class_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Renderer_Class class_ = \ - { \ - FT_DEFINE_ROOT_MODULE( flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - glyph_format_, \ - \ - render_glyph_, \ - transform_glyph_, \ - get_glyph_cbox_, \ - set_mode_, \ - \ - raster_class_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ ) - -#define FT_DEFINE_RENDERER( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_, \ - glyph_format_, \ - render_glyph_, \ - transform_glyph_, \ - get_glyph_cbox_, \ - set_mode_, \ - raster_class_ ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ - FT_Memory memory = library->memory; \ - \ - \ - class_ ## _pic_free( library ); \ - if ( rclazz ) \ - FT_FREE( rclazz ); \ - } \ - \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Renderer_Class* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ - return error; \ - \ - error = class_ ## _pic_init( library ); \ - if ( error ) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE( flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - \ - clazz->glyph_format = glyph_format_; \ - \ - clazz->render_glyph = render_glyph_; \ - clazz->transform_glyph = transform_glyph_; \ - clazz->get_glyph_cbox = get_glyph_cbox_; \ - clazz->set_mode = set_mode_; \ - \ - clazz->raster_class = raster_class_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - \ - return FT_Err_Ok; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - - /* PIC support macros for ftmodapi.h **/ - - -#ifdef FT_CONFIG_OPTION_PIC - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Module_Creator */ - /* */ - /* <Description> */ - /* A function used to create (allocate) a new module class object. */ - /* The object's members are initialized, but the module itself is */ - /* not. */ - /* */ - /* <Input> */ - /* memory :: A handle to the memory manager. */ - /* output_class :: Initialized with the newly allocated class. */ - /* */ - typedef FT_Error - (*FT_Module_Creator)( FT_Memory memory, - FT_Module_Class** output_class ); - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Module_Destroyer */ - /* */ - /* <Description> */ - /* A function used to destroy (deallocate) a module class object. */ - /* */ - /* <Input> */ - /* memory :: A handle to the memory manager. */ - /* clazz :: Module class to destroy. */ - /* */ - typedef void - (*FT_Module_Destroyer)( FT_Memory memory, - FT_Module_Class* clazz ); - -#endif - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DECLARE_MODULE */ - /* */ - /* <Description> */ - /* Used to create a forward declaration of a */ - /* FT_Module_Class struct instance. */ - /* */ - /* <Macro> */ - /* FT_DEFINE_MODULE */ - /* */ - /* <Description> */ - /* Used to initialize an instance of an FT_Module_Class struct. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */ - /* be called with a pointer where the allocated structure is */ - /* returned. And when it is no longer needed a `destroy' function */ - /* needs to be called to release that allocation. */ - /* `fcinit.c' (ft_create_default_module_classes) already contains */ - /* a mechanism to call these functions for the default modules */ - /* described in `ftmodule.h'. */ - /* */ - /* Notice that the created `create' and `destroy' functions call */ - /* `pic_init' and `pic_free' to allow you to manually allocate and */ - /* initialize any additional global data, like a module specific */ - /* interface, and put them in the global pic container defined in */ - /* `ftpic.h'. If you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the `pic_init' and */ - /* `pic_free' functions should be declared in `pic.h', to be referred */ - /* by the module definition calling `FT_DEFINE_MODULE' in the */ - /* following. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ - /* */ - /* <Macro> */ - /* FT_DEFINE_ROOT_MODULE */ - /* */ - /* <Description> */ - /* Used to initialize an instance of an FT_Module_Class struct inside */ - /* another struct that contains it or in a function that initializes */ - /* that containing struct. */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DECLARE_MODULE( class_ ) \ - FT_CALLBACK_TABLE \ - const FT_Module_Class class_; - -#define FT_DEFINE_ROOT_MODULE( \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ - }, - -#define FT_DEFINE_MODULE( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Module_Class class_ = \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ - }; - - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DECLARE_MODULE( class_ ) \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_Module_Class** output_class ); \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_Module_Class* clazz ); - -#define FT_DEFINE_ROOT_MODULE( \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - clazz->root.module_flags = flags_; \ - clazz->root.module_size = size_; \ - clazz->root.module_name = name_; \ - clazz->root.module_version = version_; \ - clazz->root.module_requires = requires_; \ - \ - clazz->root.module_interface = interface_; \ - \ - clazz->root.module_init = init_; \ - clazz->root.module_done = done_; \ - clazz->root.get_interface = get_interface_; - -#define FT_DEFINE_MODULE( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - class_ ## _pic_free( library ); \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Module_Class* clazz = NULL; \ - FT_Error error; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ - return error; \ - error = class_ ## _pic_init( library ); \ - if ( error ) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - clazz->module_flags = flags_; \ - clazz->module_size = size_; \ - clazz->module_name = name_; \ - clazz->module_version = version_; \ - clazz->module_requires = requires_; \ - \ - clazz->module_interface = interface_; \ - \ - clazz->module_init = init_; \ - clazz->module_done = done_; \ - clazz->get_interface = get_interface_; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -FT_END_HEADER - -#endif /* __FTOBJS_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftpic.h b/GLideN64/src/inc/freetype/include/internal/ftpic.h deleted file mode 100644 index 485ce7a..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftpic.h +++ /dev/null @@ -1,71 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftpic.h */ -/* */ -/* The FreeType position independent code services (declaration). */ -/* */ -/* Copyright 2009, 2012 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* Modules that ordinarily have const global data that need address */ - /* can instead define pointers here. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTPIC_H__ -#define __FTPIC_H__ - - -FT_BEGIN_HEADER - -#ifdef FT_CONFIG_OPTION_PIC - - typedef struct FT_PIC_Container_ - { - /* pic containers for base */ - void* base; - - /* pic containers for modules */ - void* autofit; - void* cff; - void* pshinter; - void* psnames; - void* raster; - void* sfnt; - void* smooth; - void* truetype; - - } FT_PIC_Container; - - - /* Initialize the various function tables, structs, etc. */ - /* stored in the container. */ - FT_BASE( FT_Error ) - ft_pic_container_init( FT_Library library ); - - - /* Destroy the contents of the container. */ - FT_BASE( void ) - ft_pic_container_destroy( FT_Library library ); - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -FT_END_HEADER - -#endif /* __FTPIC_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftrfork.h b/GLideN64/src/inc/freetype/include/internal/ftrfork.h deleted file mode 100644 index d750cbe..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftrfork.h +++ /dev/null @@ -1,266 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftrfork.h */ -/* */ -/* Embedded resource forks accessor (specification). */ -/* */ -/* Copyright 2004, 2006, 2007, 2012, 2013 by */ -/* Masatake YAMATO and Redhat K.K. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* Development of the code in this file is support of */ -/* Information-technology Promotion Agency, Japan. */ -/***************************************************************************/ - - -#ifndef __FTRFORK_H__ -#define __FTRFORK_H__ - - -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H - - -FT_BEGIN_HEADER - - - /* Number of guessing rules supported in `FT_Raccess_Guess'. */ - /* Don't forget to increment the number if you add a new guessing rule. */ -#define FT_RACCESS_N_RULES 9 - - - /* A structure to describe a reference in a resource by its resource ID */ - /* and internal offset. The `POST' resource expects to be concatenated */ - /* by the order of resource IDs instead of its appearance in the file. */ - - typedef struct FT_RFork_Ref_ - { - FT_UShort res_id; - FT_ULong offset; - - } FT_RFork_Ref; - -#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK - typedef FT_Error - (*ft_raccess_guess_func)( FT_Library library, - FT_Stream stream, - char *base_file_name, - char **result_file_name, - FT_Long *result_offset ); - - typedef enum FT_RFork_Rule_ { - FT_RFork_Rule_invalid = -2, - FT_RFork_Rule_uknown, /* -1 */ - FT_RFork_Rule_apple_double, - FT_RFork_Rule_apple_single, - FT_RFork_Rule_darwin_ufs_export, - FT_RFork_Rule_darwin_newvfs, - FT_RFork_Rule_darwin_hfsplus, - FT_RFork_Rule_vfat, - FT_RFork_Rule_linux_cap, - FT_RFork_Rule_linux_double, - FT_RFork_Rule_linux_netatalk - } FT_RFork_Rule; - - /* For fast translation between rule index and rule type, - * the macros FT_RFORK_xxx should be kept consistent with - * the raccess_guess_funcs table - */ - typedef struct ft_raccess_guess_rec_ { - ft_raccess_guess_func func; - FT_RFork_Rule type; - } ft_raccess_guess_rec; - -#ifndef FT_CONFIG_OPTION_PIC - - /* this array is a storage in non-PIC mode, so ; is needed in END */ -#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ - const type name[] = { -#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ - { raccess_guess_ ## func_suffix, \ - FT_RFork_Rule_ ## type_suffix }, -#define CONST_FT_RFORK_RULE_ARRAY_END }; - -#else /* FT_CONFIG_OPTION_PIC */ - - /* this array is a function in PIC mode, so no ; is needed in END */ -#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ - void \ - FT_Init_Table_ ## name( type* storage ) \ - { \ - type* local = storage; \ - \ - \ - int i = 0; -#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ - local[i].func = raccess_guess_ ## func_suffix; \ - local[i].type = FT_RFork_Rule_ ## type_suffix; \ - i++; -#define CONST_FT_RFORK_RULE_ARRAY_END } - -#endif /* FT_CONFIG_OPTION_PIC */ - -#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Raccess_Guess */ - /* */ - /* <Description> */ - /* Guess a file name and offset where the actual resource fork is */ - /* stored. The macro FT_RACCESS_N_RULES holds the number of */ - /* guessing rules; the guessed result for the Nth rule is */ - /* represented as a triplet: a new file name (new_names[N]), a file */ - /* offset (offsets[N]), and an error code (errors[N]). */ - /* */ - /* <Input> */ - /* library :: */ - /* A FreeType library instance. */ - /* */ - /* stream :: */ - /* A file stream containing the resource fork. */ - /* */ - /* base_name :: */ - /* The (base) file name of the resource fork used for some */ - /* guessing rules. */ - /* */ - /* <Output> */ - /* new_names :: */ - /* An array of guessed file names in which the resource forks may */ - /* exist. If `new_names[N]' is NULL, the guessed file name is */ - /* equal to `base_name'. */ - /* */ - /* offsets :: */ - /* An array of guessed file offsets. `offsets[N]' holds the file */ - /* offset of the possible start of the resource fork in file */ - /* `new_names[N]'. */ - /* */ - /* errors :: */ - /* An array of FreeType error codes. `errors[N]' is the error */ - /* code of Nth guessing rule function. If `errors[N]' is not */ - /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */ - /* */ - FT_BASE( void ) - FT_Raccess_Guess( FT_Library library, - FT_Stream stream, - char* base_name, - char** new_names, - FT_Long* offsets, - FT_Error* errors ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Raccess_Get_HeaderInfo */ - /* */ - /* <Description> */ - /* Get the information from the header of resource fork. The */ - /* information includes the file offset where the resource map */ - /* starts, and the file offset where the resource data starts. */ - /* `FT_Raccess_Get_DataOffsets' requires these two data. */ - /* */ - /* <Input> */ - /* library :: */ - /* A FreeType library instance. */ - /* */ - /* stream :: */ - /* A file stream containing the resource fork. */ - /* */ - /* rfork_offset :: */ - /* The file offset where the resource fork starts. */ - /* */ - /* <Output> */ - /* map_offset :: */ - /* The file offset where the resource map starts. */ - /* */ - /* rdata_pos :: */ - /* The file offset where the resource data starts. */ - /* */ - /* <Return> */ - /* FreeType error code. FT_Err_Ok means success. */ - /* */ - FT_BASE( FT_Error ) - FT_Raccess_Get_HeaderInfo( FT_Library library, - FT_Stream stream, - FT_Long rfork_offset, - FT_Long *map_offset, - FT_Long *rdata_pos ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Raccess_Get_DataOffsets */ - /* */ - /* <Description> */ - /* Get the data offsets for a tag in a resource fork. Offsets are */ - /* stored in an array because, in some cases, resources in a resource */ - /* fork have the same tag. */ - /* */ - /* <Input> */ - /* library :: */ - /* A FreeType library instance. */ - /* */ - /* stream :: */ - /* A file stream containing the resource fork. */ - /* */ - /* map_offset :: */ - /* The file offset where the resource map starts. */ - /* */ - /* rdata_pos :: */ - /* The file offset where the resource data starts. */ - /* */ - /* tag :: */ - /* The resource tag. */ - /* */ - /* sort_by_res_id :: */ - /* A Boolean to sort the fragmented resource by their ids. */ - /* The fragmented resources for `POST' resource should be sorted */ - /* to restore Type1 font properly. For `snft' resources, sorting */ - /* may induce a different order of the faces in comparison to that */ - /* by QuickDraw API. */ - /* */ - /* <Output> */ - /* offsets :: */ - /* The stream offsets for the resource data specified by `tag'. */ - /* This array is allocated by the function, so you have to call */ - /* @ft_mem_free after use. */ - /* */ - /* count :: */ - /* The length of offsets array. */ - /* */ - /* <Return> */ - /* FreeType error code. FT_Err_Ok means success. */ - /* */ - /* <Note> */ - /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */ - /* value for `map_offset' and `rdata_pos'. */ - /* */ - FT_BASE( FT_Error ) - FT_Raccess_Get_DataOffsets( FT_Library library, - FT_Stream stream, - FT_Long map_offset, - FT_Long rdata_pos, - FT_Long tag, - FT_Bool sort_by_res_id, - FT_Long **offsets, - FT_Long *count ); - - -FT_END_HEADER - -#endif /* __FTRFORK_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftserv.h b/GLideN64/src/inc/freetype/include/internal/ftserv.h deleted file mode 100644 index 1203ec8..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftserv.h +++ /dev/null @@ -1,763 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftserv.h */ -/* */ -/* The FreeType services (specification only). */ -/* */ -/* Copyright 2003-2007, 2009, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* Each module can export one or more `services'. Each service is */ - /* identified by a constant string and modeled by a pointer; the latter */ - /* generally corresponds to a structure containing function pointers. */ - /* */ - /* Note that a service's data cannot be a mere function pointer because */ - /* in C it is possible that function pointers might be implemented */ - /* differently than data pointers (e.g. 48 bits instead of 32). */ - /* */ - /*************************************************************************/ - - -#ifndef __FTSERV_H__ -#define __FTSERV_H__ - - -FT_BEGIN_HEADER - - /* - * @macro: - * FT_FACE_FIND_SERVICE - * - * @description: - * This macro is used to look up a service from a face's driver module. - * - * @input: - * face :: - * The source face handle. - * - * id :: - * A string describing the service as defined in the service's - * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to - * `multi-masters'). It is automatically prefixed with - * `FT_SERVICE_ID_'. - * - * @output: - * ptr :: - * A variable that receives the service pointer. Will be NULL - * if not found. - */ -#ifdef __cplusplus - -#define FT_FACE_FIND_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ - FT_Pointer _tmp_ = NULL; \ - FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \ - \ - \ - if ( module->clazz->get_interface ) \ - _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ - *_pptr_ = _tmp_; \ - FT_END_STMNT - -#else /* !C++ */ - -#define FT_FACE_FIND_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ - FT_Pointer _tmp_ = NULL; \ - \ - if ( module->clazz->get_interface ) \ - _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ - ptr = _tmp_; \ - FT_END_STMNT - -#endif /* !C++ */ - - - /* - * @macro: - * FT_FACE_FIND_GLOBAL_SERVICE - * - * @description: - * This macro is used to look up a service from all modules. - * - * @input: - * face :: - * The source face handle. - * - * id :: - * A string describing the service as defined in the service's - * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to - * `multi-masters'). It is automatically prefixed with - * `FT_SERVICE_ID_'. - * - * @output: - * ptr :: - * A variable that receives the service pointer. Will be NULL - * if not found. - */ -#ifdef __cplusplus - -#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ - FT_Pointer _tmp_; \ - FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \ - \ - \ - _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ - *_pptr_ = _tmp_; \ - FT_END_STMNT - -#else /* !C++ */ - -#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ - FT_Pointer _tmp_; \ - \ - \ - _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ - ptr = _tmp_; \ - FT_END_STMNT - -#endif /* !C++ */ - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** S E R V I C E D E S C R I P T O R S *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - /* - * The following structure is used to _describe_ a given service - * to the library. This is useful to build simple static service lists. - */ - typedef struct FT_ServiceDescRec_ - { - const char* serv_id; /* service name */ - const void* serv_data; /* service pointer/data */ - - } FT_ServiceDescRec; - - typedef const FT_ServiceDescRec* FT_ServiceDesc; - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_DEFINE_SERVICEDESCREC1 */ - /* FT_DEFINE_SERVICEDESCREC2 */ - /* FT_DEFINE_SERVICEDESCREC3 */ - /* FT_DEFINE_SERVICEDESCREC4 */ - /* FT_DEFINE_SERVICEDESCREC5 */ - /* FT_DEFINE_SERVICEDESCREC6 */ - /* FT_DEFINE_SERVICEDESCREC7 */ - /* */ - /* <Description> */ - /* Used to initialize an array of FT_ServiceDescRec structures. */ - /* */ - /* When FT_CONFIG_OPTION_PIC is defined a `create' function needs to */ - /* be called with a pointer to return an allocated array. As soon as */ - /* it is no longer needed, a `destroy' function needs to be called to */ - /* release that allocation. */ - /* */ - /* These functions should be manually called from the `pic_init' and */ - /* `pic_free' functions of your module (see FT_DEFINE_MODULE). */ - /* */ - /* When FT_CONFIG_OPTION_PIC is not defined the array will be */ - /* allocated in the global scope (or the scope where the macro is */ - /* used). */ - /* */ -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICEDESCREC1( class_, \ - serv_id_1, serv_data_1 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { NULL, NULL } \ - }; - -#define FT_DEFINE_SERVICEDESCREC2( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { serv_id_2, serv_data_2 }, \ - { NULL, NULL } \ - }; - -#define FT_DEFINE_SERVICEDESCREC3( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { serv_id_2, serv_data_2 }, \ - { serv_id_3, serv_data_3 }, \ - { NULL, NULL } \ - }; - -#define FT_DEFINE_SERVICEDESCREC4( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { serv_id_2, serv_data_2 }, \ - { serv_id_3, serv_data_3 }, \ - { serv_id_4, serv_data_4 }, \ - { NULL, NULL } \ - }; - -#define FT_DEFINE_SERVICEDESCREC5( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, \ - serv_id_5, serv_data_5 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { serv_id_2, serv_data_2 }, \ - { serv_id_3, serv_data_3 }, \ - { serv_id_4, serv_data_4 }, \ - { serv_id_5, serv_data_5 }, \ - { NULL, NULL } \ - }; - -#define FT_DEFINE_SERVICEDESCREC6( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, \ - serv_id_5, serv_data_5, \ - serv_id_6, serv_data_6 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { serv_id_2, serv_data_2 }, \ - { serv_id_3, serv_data_3 }, \ - { serv_id_4, serv_data_4 }, \ - { serv_id_5, serv_data_5 }, \ - { serv_id_6, serv_data_6 }, \ - { NULL, NULL } \ - }; - -#define FT_DEFINE_SERVICEDESCREC7( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, \ - serv_id_5, serv_data_5, \ - serv_id_6, serv_data_6, \ - serv_id_7, serv_data_7 ) \ - static const FT_ServiceDescRec class_[] = \ - { \ - { serv_id_1, serv_data_1 }, \ - { serv_id_2, serv_data_2 }, \ - { serv_id_3, serv_data_3 }, \ - { serv_id_4, serv_data_4 }, \ - { serv_id_5, serv_data_5 }, \ - { serv_id_6, serv_data_6 }, \ - { serv_id_7, serv_data_7 }, \ - { NULL, NULL } \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICEDESCREC1( class_, \ - serv_id_1, serv_data_1 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class ) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 2 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = NULL; \ - clazz[1].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#define FT_DEFINE_SERVICEDESCREC2( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class ) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = NULL; \ - clazz[2].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#define FT_DEFINE_SERVICEDESCREC3( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class ) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = NULL; \ - clazz[3].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#define FT_DEFINE_SERVICEDESCREC4( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class ) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = NULL; \ - clazz[4].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#define FT_DEFINE_SERVICEDESCREC5( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, \ - serv_id_5, serv_data_5 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class ) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = serv_id_5; \ - clazz[4].serv_data = serv_data_5; \ - clazz[5].serv_id = NULL; \ - clazz[5].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#define FT_DEFINE_SERVICEDESCREC6( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, \ - serv_id_5, serv_data_5, \ - serv_id_6, serv_data_6 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = serv_id_5; \ - clazz[4].serv_data = serv_data_5; \ - clazz[5].serv_id = serv_id_6; \ - clazz[5].serv_data = serv_data_6; \ - clazz[6].serv_id = NULL; \ - clazz[6].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#define FT_DEFINE_SERVICEDESCREC7( class_, \ - serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, \ - serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, \ - serv_id_5, serv_data_5, \ - serv_id_6, serv_data_6, \ - serv_id_7, serv_data_7 ) \ - void \ - FT_Destroy_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - \ - \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz = NULL; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - \ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \ - return error; \ - \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = serv_id_5; \ - clazz[4].serv_data = serv_data_5; \ - clazz[5].serv_id = serv_id_6; \ - clazz[5].serv_data = serv_data_6; \ - clazz[6].serv_id = serv_id_7; \ - clazz[6].serv_data = serv_data_7; \ - clazz[7].serv_id = NULL; \ - clazz[7].serv_data = NULL; \ - \ - *output_class = clazz; \ - \ - return FT_Err_Ok; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - - /* - * Parse a list of FT_ServiceDescRec descriptors and look for - * a specific service by ID. Note that the last element in the - * array must be { NULL, NULL }, and that the function should - * return NULL if the service isn't available. - * - * This function can be used by modules to implement their - * `get_service' method. - */ - FT_BASE( FT_Pointer ) - ft_service_list_lookup( FT_ServiceDesc service_descriptors, - const char* service_id ); - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** S E R V I C E S C A C H E *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - /* - * This structure is used to store a cache for several frequently used - * services. It is the type of `face->internal->services'. You - * should only use FT_FACE_LOOKUP_SERVICE to access it. - * - * All fields should have the type FT_Pointer to relax compilation - * dependencies. We assume the developer isn't completely stupid. - * - * Each field must be named `service_XXXX' where `XXX' corresponds to - * the correct FT_SERVICE_ID_XXXX macro. See the definition of - * FT_FACE_LOOKUP_SERVICE below how this is implemented. - * - */ - typedef struct FT_ServiceCacheRec_ - { - FT_Pointer service_POSTSCRIPT_FONT_NAME; - FT_Pointer service_MULTI_MASTERS; - FT_Pointer service_GLYPH_DICT; - FT_Pointer service_PFR_METRICS; - FT_Pointer service_WINFNT; - - } FT_ServiceCacheRec, *FT_ServiceCache; - - - /* - * A magic number used within the services cache. - */ - - /* ensure that value `1' has the same width as a pointer */ -#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1) - - - /* - * @macro: - * FT_FACE_LOOKUP_SERVICE - * - * @description: - * This macro is used to lookup a service from a face's driver module - * using its cache. - * - * @input: - * face:: - * The source face handle containing the cache. - * - * field :: - * The field name in the cache. - * - * id :: - * The service ID. - * - * @output: - * ptr :: - * A variable receiving the service data. NULL if not available. - */ -#ifdef __cplusplus - -#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - FT_Pointer svc; \ - FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \ - \ - \ - svc = FT_FACE( face )->internal->services. service_ ## id; \ - if ( svc == FT_SERVICE_UNAVAILABLE ) \ - svc = NULL; \ - else if ( svc == NULL ) \ - { \ - FT_FACE_FIND_SERVICE( face, svc, id ); \ - \ - FT_FACE( face )->internal->services. service_ ## id = \ - (FT_Pointer)( svc != NULL ? svc \ - : FT_SERVICE_UNAVAILABLE ); \ - } \ - *Pptr = svc; \ - FT_END_STMNT - -#else /* !C++ */ - -#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - FT_Pointer svc; \ - \ - \ - svc = FT_FACE( face )->internal->services. service_ ## id; \ - if ( svc == FT_SERVICE_UNAVAILABLE ) \ - svc = NULL; \ - else if ( svc == NULL ) \ - { \ - FT_FACE_FIND_SERVICE( face, svc, id ); \ - \ - FT_FACE( face )->internal->services. service_ ## id = \ - (FT_Pointer)( svc != NULL ? svc \ - : FT_SERVICE_UNAVAILABLE ); \ - } \ - ptr = svc; \ - FT_END_STMNT - -#endif /* !C++ */ - - /* - * A macro used to define new service structure types. - */ - -#define FT_DEFINE_SERVICE( name ) \ - typedef struct FT_Service_ ## name ## Rec_ \ - FT_Service_ ## name ## Rec ; \ - typedef struct FT_Service_ ## name ## Rec_ \ - const * FT_Service_ ## name ; \ - struct FT_Service_ ## name ## Rec_ - - /* */ - - /* - * The header files containing the services. - */ - -#define FT_SERVICE_BDF_H <internal/services/svbdf.h> -#define FT_SERVICE_CID_H <internal/services/svcid.h> -#define FT_SERVICE_GLYPH_DICT_H <internal/services/svgldict.h> -#define FT_SERVICE_GX_VALIDATE_H <internal/services/svgxval.h> -#define FT_SERVICE_KERNING_H <internal/services/svkern.h> -#define FT_SERVICE_MULTIPLE_MASTERS_H <internal/services/svmm.h> -#define FT_SERVICE_OPENTYPE_VALIDATE_H <internal/services/svotval.h> -#define FT_SERVICE_PFR_H <internal/services/svpfr.h> -#define FT_SERVICE_POSTSCRIPT_CMAPS_H <internal/services/svpscmap.h> -#define FT_SERVICE_POSTSCRIPT_INFO_H <internal/services/svpsinfo.h> -#define FT_SERVICE_POSTSCRIPT_NAME_H <internal/services/svpostnm.h> -#define FT_SERVICE_PROPERTIES_H <internal/services/svprop.h> -#define FT_SERVICE_SFNT_H <internal/services/svsfnt.h> -#define FT_SERVICE_TRUETYPE_ENGINE_H <internal/services/svtteng.h> -#define FT_SERVICE_TT_CMAP_H <internal/services/svttcmap.h> -#define FT_SERVICE_WINFNT_H <internal/services/svwinfnt.h> -#define FT_SERVICE_XFREE86_NAME_H <internal/services/svxf86nm.h> -#define FT_SERVICE_TRUETYPE_GLYF_H <internal/services/svttglyf.h> - - /* */ - -FT_END_HEADER - -#endif /* __FTSERV_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftstream.h b/GLideN64/src/inc/freetype/include/internal/ftstream.h deleted file mode 100644 index 2661858..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftstream.h +++ /dev/null @@ -1,536 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftstream.h */ -/* */ -/* Stream handling (specification). */ -/* */ -/* Copyright 1996-2002, 2004-2006, 2011, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTSTREAM_H__ -#define __FTSTREAM_H__ - - -#include <ft2build.h> -#include FT_SYSTEM_H -#include FT_INTERNAL_OBJECTS_H - - -FT_BEGIN_HEADER - - - /* format of an 8-bit frame_op value: */ - /* */ - /* bit 76543210 */ - /* xxxxxxes */ - /* */ - /* s is set to 1 if the value is signed. */ - /* e is set to 1 if the value is little-endian. */ - /* xxx is a command. */ - -#define FT_FRAME_OP_SHIFT 2 -#define FT_FRAME_OP_SIGNED 1 -#define FT_FRAME_OP_LITTLE 2 -#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT ) - -#define FT_MAKE_FRAME_OP( command, little, sign ) \ - ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign ) - -#define FT_FRAME_OP_END 0 -#define FT_FRAME_OP_START 1 /* start a new frame */ -#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */ -#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */ -#define FT_FRAME_OP_LONG 4 /* read 4-byte value */ -#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */ -#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */ - - - typedef enum FT_Frame_Op_ - { - ft_frame_end = 0, - ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ), - - ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ), - ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ), - - ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ), - ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ), - ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ), - ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ), - - ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ), - ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ), - ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ), - ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ), - - ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ), - ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ), - ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ), - ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ), - - ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ), - ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 ) - - } FT_Frame_Op; - - - typedef struct FT_Frame_Field_ - { - FT_Byte value; - FT_Byte size; - FT_UShort offset; - - } FT_Frame_Field; - - - /* Construct an FT_Frame_Field out of a structure type and a field name. */ - /* The structure type must be set in the FT_STRUCTURE macro before */ - /* calling the FT_FRAME_START() macro. */ - /* */ -#define FT_FIELD_SIZE( f ) \ - (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f ) - -#define FT_FIELD_SIZE_DELTA( f ) \ - (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] ) - -#define FT_FIELD_OFFSET( f ) \ - (FT_UShort)( offsetof( FT_STRUCTURE, f ) ) - -#define FT_FRAME_FIELD( frame_op, field ) \ - { \ - frame_op, \ - FT_FIELD_SIZE( field ), \ - FT_FIELD_OFFSET( field ) \ - } - -#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 } - -#define FT_FRAME_START( size ) { ft_frame_start, 0, size } -#define FT_FRAME_END { ft_frame_end, 0, 0 } - -#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f ) -#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f ) -#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f ) -#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f ) -#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f ) -#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f ) -#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f ) -#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f ) - -#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f ) -#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f ) -#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f ) -#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f ) -#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f ) -#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f ) - -#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 } -#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 } -#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 } - -#define FT_FRAME_BYTES( field, count ) \ - { \ - ft_frame_bytes, \ - count, \ - FT_FIELD_OFFSET( field ) \ - } - -#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 } - - - /*************************************************************************/ - /* */ - /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */ - /* type `char*' or equivalent (1-byte elements). */ - /* */ - -#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] ) - -#define FT_INT16( x ) ( (FT_Int16)(x) ) -#define FT_UINT16( x ) ( (FT_UInt16)(x) ) -#define FT_INT32( x ) ( (FT_Int32)(x) ) -#define FT_UINT32( x ) ( (FT_UInt32)(x) ) - - -#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) ) -#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) - - -#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \ - FT_BYTE_U16( p, 1, 0) ) - -#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ - FT_BYTE_U16( p, 1, 0 ) ) - -#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \ - FT_BYTE_U32( p, 1, 16 ) | \ - FT_BYTE_U32( p, 2, 8 ) | \ - FT_BYTE_U32( p, 3, 0 ) ) - -#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \ - FT_BYTE_U32( p, 1, 16 ) | \ - FT_BYTE_U32( p, 2, 8 ) | \ - FT_BYTE_U32( p, 3, 0 ) ) - -#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \ - FT_BYTE_U32( p, 1, 8 ) | \ - FT_BYTE_U32( p, 2, 0 ) ) - -#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \ - FT_BYTE_U32( p, 1, 8 ) | \ - FT_BYTE_U32( p, 2, 0 ) ) - -#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \ - FT_BYTE_U16( p, 0, 0 ) ) - -#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \ - FT_BYTE_U16( p, 0, 0 ) ) - -#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \ - FT_BYTE_U32( p, 2, 16 ) | \ - FT_BYTE_U32( p, 1, 8 ) | \ - FT_BYTE_U32( p, 0, 0 ) ) - -#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \ - FT_BYTE_U32( p, 2, 16 ) | \ - FT_BYTE_U32( p, 1, 8 ) | \ - FT_BYTE_U32( p, 0, 0 ) ) - -#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \ - FT_BYTE_U32( p, 1, 8 ) | \ - FT_BYTE_U32( p, 0, 0 ) ) - -#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \ - FT_BYTE_U32( p, 1, 8 ) | \ - FT_BYTE_U32( p, 0, 0 ) ) - - -#define FT_NEXT_CHAR( buffer ) \ - ( (signed char)*buffer++ ) - -#define FT_NEXT_BYTE( buffer ) \ - ( (unsigned char)*buffer++ ) - -#define FT_NEXT_SHORT( buffer ) \ - ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) ) - -#define FT_NEXT_USHORT( buffer ) \ - ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) ) - -#define FT_NEXT_OFF3( buffer ) \ - ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) ) - -#define FT_NEXT_UOFF3( buffer ) \ - ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) ) - -#define FT_NEXT_LONG( buffer ) \ - ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) ) - -#define FT_NEXT_ULONG( buffer ) \ - ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) ) - - -#define FT_NEXT_SHORT_LE( buffer ) \ - ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) ) - -#define FT_NEXT_USHORT_LE( buffer ) \ - ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) - -#define FT_NEXT_OFF3_LE( buffer ) \ - ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) - -#define FT_NEXT_UOFF3_LE( buffer ) \ - ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) - -#define FT_NEXT_LONG_LE( buffer ) \ - ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) - -#define FT_NEXT_ULONG_LE( buffer ) \ - ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) ) - - - /*************************************************************************/ - /* */ - /* Each GET_xxxx() macro uses an implicit `stream' variable. */ - /* */ -#if 0 -#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor ) - -#define FT_GET_CHAR() FT_GET_MACRO( CHAR ) -#define FT_GET_BYTE() FT_GET_MACRO( BYTE ) -#define FT_GET_SHORT() FT_GET_MACRO( SHORT ) -#define FT_GET_USHORT() FT_GET_MACRO( USHORT ) -#define FT_GET_OFF3() FT_GET_MACRO( OFF3 ) -#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 ) -#define FT_GET_LONG() FT_GET_MACRO( LONG ) -#define FT_GET_ULONG() FT_GET_MACRO( ULONG ) -#define FT_GET_TAG4() FT_GET_MACRO( ULONG ) - -#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE ) -#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE ) -#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE ) -#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE ) - -#else -#define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) - -#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) -#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) -#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short ) -#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort ) -#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long ) -#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong ) -#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long ) -#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong ) -#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong ) - -#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short ) -#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort ) -#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long ) -#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong ) -#endif - -#define FT_READ_MACRO( func, type, var ) \ - ( var = (type)func( stream, &error ), \ - error != FT_Err_Ok ) - -#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) -#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) -#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var ) -#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var ) -#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var ) -#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var ) -#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var ) -#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var ) - -#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var ) -#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var ) -#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var ) -#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var ) - - -#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM - - /* initialize a stream for reading a regular system stream */ - FT_BASE( FT_Error ) - FT_Stream_Open( FT_Stream stream, - const char* filepathname ); - -#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ - - - /* create a new (input) stream from an FT_Open_Args structure */ - FT_BASE( FT_Error ) - FT_Stream_New( FT_Library library, - const FT_Open_Args* args, - FT_Stream *astream ); - - /* free a stream */ - FT_BASE( void ) - FT_Stream_Free( FT_Stream stream, - FT_Int external ); - - /* initialize a stream for reading in-memory data */ - FT_BASE( void ) - FT_Stream_OpenMemory( FT_Stream stream, - const FT_Byte* base, - FT_ULong size ); - - /* close a stream (does not destroy the stream structure) */ - FT_BASE( void ) - FT_Stream_Close( FT_Stream stream ); - - - /* seek within a stream. position is relative to start of stream */ - FT_BASE( FT_Error ) - FT_Stream_Seek( FT_Stream stream, - FT_ULong pos ); - - /* skip bytes in a stream */ - FT_BASE( FT_Error ) - FT_Stream_Skip( FT_Stream stream, - FT_Long distance ); - - /* return current stream position */ - FT_BASE( FT_Long ) - FT_Stream_Pos( FT_Stream stream ); - - /* read bytes from a stream into a user-allocated buffer, returns an */ - /* error if not all bytes could be read. */ - FT_BASE( FT_Error ) - FT_Stream_Read( FT_Stream stream, - FT_Byte* buffer, - FT_ULong count ); - - /* read bytes from a stream at a given position */ - FT_BASE( FT_Error ) - FT_Stream_ReadAt( FT_Stream stream, - FT_ULong pos, - FT_Byte* buffer, - FT_ULong count ); - - /* try to read bytes at the end of a stream; return number of bytes */ - /* really available */ - FT_BASE( FT_ULong ) - FT_Stream_TryRead( FT_Stream stream, - FT_Byte* buffer, - FT_ULong count ); - - /* Enter a frame of `count' consecutive bytes in a stream. Returns an */ - /* error if the frame could not be read/accessed. The caller can use */ - /* the FT_Stream_Get_XXX functions to retrieve frame data without */ - /* error checks. */ - /* */ - /* You must _always_ call FT_Stream_ExitFrame() once you have entered */ - /* a stream frame! */ - /* */ - FT_BASE( FT_Error ) - FT_Stream_EnterFrame( FT_Stream stream, - FT_ULong count ); - - /* exit a stream frame */ - FT_BASE( void ) - FT_Stream_ExitFrame( FT_Stream stream ); - - /* Extract a stream frame. If the stream is disk-based, a heap block */ - /* is allocated and the frame bytes are read into it. If the stream */ - /* is memory-based, this function simply set a pointer to the data. */ - /* */ - /* Useful to optimize access to memory-based streams transparently. */ - /* */ - /* All extracted frames must be `freed' with a call to the function */ - /* FT_Stream_ReleaseFrame(). */ - /* */ - FT_BASE( FT_Error ) - FT_Stream_ExtractFrame( FT_Stream stream, - FT_ULong count, - FT_Byte** pbytes ); - - /* release an extract frame (see FT_Stream_ExtractFrame) */ - FT_BASE( void ) - FT_Stream_ReleaseFrame( FT_Stream stream, - FT_Byte** pbytes ); - - /* read a byte from an entered frame */ - FT_BASE( FT_Char ) - FT_Stream_GetChar( FT_Stream stream ); - - /* read a 16-bit big-endian unsigned integer from an entered frame */ - FT_BASE( FT_UShort ) - FT_Stream_GetUShort( FT_Stream stream ); - - /* read a 24-bit big-endian unsigned integer from an entered frame */ - FT_BASE( FT_ULong ) - FT_Stream_GetUOffset( FT_Stream stream ); - - /* read a 32-bit big-endian unsigned integer from an entered frame */ - FT_BASE( FT_ULong ) - FT_Stream_GetULong( FT_Stream stream ); - - /* read a 16-bit little-endian unsigned integer from an entered frame */ - FT_BASE( FT_UShort ) - FT_Stream_GetUShortLE( FT_Stream stream ); - - /* read a 32-bit little-endian unsigned integer from an entered frame */ - FT_BASE( FT_ULong ) - FT_Stream_GetULongLE( FT_Stream stream ); - - - /* read a byte from a stream */ - FT_BASE( FT_Char ) - FT_Stream_ReadChar( FT_Stream stream, - FT_Error* error ); - - /* read a 16-bit big-endian unsigned integer from a stream */ - FT_BASE( FT_UShort ) - FT_Stream_ReadUShort( FT_Stream stream, - FT_Error* error ); - - /* read a 24-bit big-endian unsigned integer from a stream */ - FT_BASE( FT_ULong ) - FT_Stream_ReadUOffset( FT_Stream stream, - FT_Error* error ); - - /* read a 32-bit big-endian integer from a stream */ - FT_BASE( FT_ULong ) - FT_Stream_ReadULong( FT_Stream stream, - FT_Error* error ); - - /* read a 16-bit little-endian unsigned integer from a stream */ - FT_BASE( FT_UShort ) - FT_Stream_ReadUShortLE( FT_Stream stream, - FT_Error* error ); - - /* read a 32-bit little-endian unsigned integer from a stream */ - FT_BASE( FT_ULong ) - FT_Stream_ReadULongLE( FT_Stream stream, - FT_Error* error ); - - /* Read a structure from a stream. The structure must be described */ - /* by an array of FT_Frame_Field records. */ - FT_BASE( FT_Error ) - FT_Stream_ReadFields( FT_Stream stream, - const FT_Frame_Field* fields, - void* structure ); - - -#define FT_STREAM_POS() \ - FT_Stream_Pos( stream ) - -#define FT_STREAM_SEEK( position ) \ - FT_SET_ERROR( FT_Stream_Seek( stream, \ - (FT_ULong)(position) ) ) - -#define FT_STREAM_SKIP( distance ) \ - FT_SET_ERROR( FT_Stream_Skip( stream, \ - (FT_Long)(distance) ) ) - -#define FT_STREAM_READ( buffer, count ) \ - FT_SET_ERROR( FT_Stream_Read( stream, \ - (FT_Byte*)(buffer), \ - (FT_ULong)(count) ) ) - -#define FT_STREAM_READ_AT( position, buffer, count ) \ - FT_SET_ERROR( FT_Stream_ReadAt( stream, \ - (FT_ULong)(position), \ - (FT_Byte*)buffer, \ - (FT_ULong)(count) ) ) - -#define FT_STREAM_READ_FIELDS( fields, object ) \ - FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) ) - - -#define FT_FRAME_ENTER( size ) \ - FT_SET_ERROR( \ - FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \ - (FT_ULong)(size) ) ) ) - -#define FT_FRAME_EXIT() \ - FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) ) - -#define FT_FRAME_EXTRACT( size, bytes ) \ - FT_SET_ERROR( \ - FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \ - (FT_ULong)(size), \ - (FT_Byte**)&(bytes) ) ) ) - -#define FT_FRAME_RELEASE( bytes ) \ - FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \ - (FT_Byte**)&(bytes) ) ) - - -FT_END_HEADER - -#endif /* __FTSTREAM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/fttrace.h b/GLideN64/src/inc/freetype/include/internal/fttrace.h deleted file mode 100644 index d5253db..0000000 --- a/GLideN64/src/inc/freetype/include/internal/fttrace.h +++ /dev/null @@ -1,154 +0,0 @@ -/***************************************************************************/ -/* */ -/* fttrace.h */ -/* */ -/* Tracing handling (specification only). */ -/* */ -/* Copyright 2002, 2004-2007, 2009, 2011-2014 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /* definitions of trace levels for FreeType 2 */ - - /* the first level must always be `trace_any' */ -FT_TRACE_DEF( any ) - - /* base components */ -FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */ -FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */ -FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */ -FT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */ -FT_TRACE_DEF( list ) /* list management (ftlist.c) */ -FT_TRACE_DEF( init ) /* initialization (ftinit.c) */ -FT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */ -FT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */ -FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */ -FT_TRACE_DEF( gloader ) /* glyph loader (ftgloadr.c) */ - -FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */ -FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */ -FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ -FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ -FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */ -FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */ - - /* Cache sub-system */ -FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ - - /* SFNT driver components */ -FT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */ -FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */ -FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */ -FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */ -FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */ -FT_TRACE_DEF( ttmtx ) /* metrics-related tables (ttmtx.c) */ -FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */ -FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */ -FT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */ - - /* TrueType driver components */ -FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */ -FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */ -FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */ -FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */ -FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */ -FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */ - - /* Type 1 driver components */ -FT_TRACE_DEF( t1afm ) -FT_TRACE_DEF( t1driver ) -FT_TRACE_DEF( t1gload ) -FT_TRACE_DEF( t1hint ) -FT_TRACE_DEF( t1load ) -FT_TRACE_DEF( t1objs ) -FT_TRACE_DEF( t1parse ) - - /* PostScript helper module `psaux' */ -FT_TRACE_DEF( t1decode ) -FT_TRACE_DEF( psobjs ) -FT_TRACE_DEF( psconv ) - - /* PostScript hinting module `pshinter' */ -FT_TRACE_DEF( pshrec ) -FT_TRACE_DEF( pshalgo1 ) -FT_TRACE_DEF( pshalgo2 ) - - /* Type 2 driver components */ -FT_TRACE_DEF( cffdriver ) -FT_TRACE_DEF( cffgload ) -FT_TRACE_DEF( cffload ) -FT_TRACE_DEF( cffobjs ) -FT_TRACE_DEF( cffparse ) - -FT_TRACE_DEF( cf2blues ) -FT_TRACE_DEF( cf2hints ) -FT_TRACE_DEF( cf2interp ) - - /* Type 42 driver component */ -FT_TRACE_DEF( t42 ) - - /* CID driver components */ -FT_TRACE_DEF( cidafm ) -FT_TRACE_DEF( ciddriver ) -FT_TRACE_DEF( cidgload ) -FT_TRACE_DEF( cidload ) -FT_TRACE_DEF( cidobjs ) -FT_TRACE_DEF( cidparse ) - - /* Windows font component */ -FT_TRACE_DEF( winfnt ) - - /* PCF font components */ -FT_TRACE_DEF( pcfdriver ) -FT_TRACE_DEF( pcfread ) - - /* BDF font components */ -FT_TRACE_DEF( bdfdriver ) -FT_TRACE_DEF( bdflib ) - - /* PFR font component */ -FT_TRACE_DEF( pfr ) - - /* OpenType validation components */ -FT_TRACE_DEF( otvmodule ) -FT_TRACE_DEF( otvcommon ) -FT_TRACE_DEF( otvbase ) -FT_TRACE_DEF( otvgdef ) -FT_TRACE_DEF( otvgpos ) -FT_TRACE_DEF( otvgsub ) -FT_TRACE_DEF( otvjstf ) -FT_TRACE_DEF( otvmath ) - - /* TrueTypeGX/AAT validation components */ -FT_TRACE_DEF( gxvmodule ) -FT_TRACE_DEF( gxvcommon ) -FT_TRACE_DEF( gxvfeat ) -FT_TRACE_DEF( gxvmort ) -FT_TRACE_DEF( gxvmorx ) -FT_TRACE_DEF( gxvbsln ) -FT_TRACE_DEF( gxvjust ) -FT_TRACE_DEF( gxvkern ) -FT_TRACE_DEF( gxvopbd ) -FT_TRACE_DEF( gxvtrak ) -FT_TRACE_DEF( gxvprop ) -FT_TRACE_DEF( gxvlcar ) - - /* autofit components */ -FT_TRACE_DEF( afmodule ) -FT_TRACE_DEF( afhints ) -FT_TRACE_DEF( afcjk ) -FT_TRACE_DEF( aflatin ) -FT_TRACE_DEF( aflatin2 ) -FT_TRACE_DEF( afwarp ) -FT_TRACE_DEF( afharfbuzz ) -FT_TRACE_DEF( afglobal ) - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/ftvalid.h b/GLideN64/src/inc/freetype/include/internal/ftvalid.h deleted file mode 100644 index 12ad036..0000000 --- a/GLideN64/src/inc/freetype/include/internal/ftvalid.h +++ /dev/null @@ -1,161 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftvalid.h */ -/* */ -/* FreeType validation support (specification). */ -/* */ -/* Copyright 2004, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTVALID_H__ -#define __FTVALID_H__ - -#include <ft2build.h> -#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */ - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** V A L I D A T I O N ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /* handle to a validation object */ - typedef struct FT_ValidatorRec_ volatile* FT_Validator; - - - /*************************************************************************/ - /* */ - /* There are three distinct validation levels defined here: */ - /* */ - /* FT_VALIDATE_DEFAULT :: */ - /* A table that passes this validation level can be used reliably by */ - /* FreeType. It generally means that all offsets have been checked to */ - /* prevent out-of-bound reads, that array counts are correct, etc. */ - /* */ - /* FT_VALIDATE_TIGHT :: */ - /* A table that passes this validation level can be used reliably and */ - /* doesn't contain invalid data. For example, a charmap table that */ - /* returns invalid glyph indices will not pass, even though it can */ - /* be used with FreeType in default mode (the library will simply */ - /* return an error later when trying to load the glyph). */ - /* */ - /* It also checks that fields which must be a multiple of 2, 4, or 8, */ - /* don't have incorrect values, etc. */ - /* */ - /* FT_VALIDATE_PARANOID :: */ - /* Only for font debugging. Checks that a table follows the */ - /* specification by 100%. Very few fonts will be able to pass this */ - /* level anyway but it can be useful for certain tools like font */ - /* editors/converters. */ - /* */ - typedef enum FT_ValidationLevel_ - { - FT_VALIDATE_DEFAULT = 0, - FT_VALIDATE_TIGHT, - FT_VALIDATE_PARANOID - - } FT_ValidationLevel; - - -#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ - /* We disable the warning `structure was padded due to */ - /* __declspec(align())' in order to compile cleanly with */ - /* the maximum level of warnings. */ -#pragma warning( push ) -#pragma warning( disable : 4324 ) -#endif /* _MSC_VER */ - - /* validator structure */ - typedef struct FT_ValidatorRec_ - { - const FT_Byte* base; /* address of table in memory */ - const FT_Byte* limit; /* `base' + sizeof(table) in memory */ - FT_ValidationLevel level; /* validation level */ - FT_Error error; /* error returned. 0 means success */ - - ft_jmp_buf jump_buffer; /* used for exception handling */ - - } FT_ValidatorRec; - -#if defined( _MSC_VER ) -#pragma warning( pop ) -#endif - -#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) ) - - - FT_BASE( void ) - ft_validator_init( FT_Validator valid, - const FT_Byte* base, - const FT_Byte* limit, - FT_ValidationLevel level ); - - /* Do not use this. It's broken and will cause your validator to crash */ - /* if you run it on an invalid font. */ - FT_BASE( FT_Int ) - ft_validator_run( FT_Validator valid ); - - /* Sets the error field in a validator, then calls `longjmp' to return */ - /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */ - /* error checks within the validation routines. */ - /* */ - FT_BASE( void ) - ft_validator_error( FT_Validator valid, - FT_Error error ); - - - /* Calls ft_validate_error. Assumes that the `valid' local variable */ - /* holds a pointer to the current validator object. */ - /* */ - /* Use preprocessor prescan to pass FT_ERR_PREFIX. */ - /* */ -#define FT_INVALID( _prefix, _error ) FT_INVALID_( _prefix, _error ) -#define FT_INVALID_( _prefix, _error ) \ - ft_validator_error( valid, _prefix ## _error ) - - /* called when a broken table is detected */ -#define FT_INVALID_TOO_SHORT \ - FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) - - /* called when an invalid offset is detected */ -#define FT_INVALID_OFFSET \ - FT_INVALID( FT_ERR_PREFIX, Invalid_Offset ) - - /* called when an invalid format/value is detected */ -#define FT_INVALID_FORMAT \ - FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) - - /* called when an invalid glyph index is detected */ -#define FT_INVALID_GLYPH_ID \ - FT_INVALID( FT_ERR_PREFIX, Invalid_Glyph_Index ) - - /* called when an invalid field value is detected */ -#define FT_INVALID_DATA \ - FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) - - -FT_END_HEADER - -#endif /* __FTVALID_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/internal.h b/GLideN64/src/inc/freetype/include/internal/internal.h deleted file mode 100644 index e0ddb06..0000000 --- a/GLideN64/src/inc/freetype/include/internal/internal.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************/ -/* */ -/* internal.h */ -/* */ -/* Internal header files (specification only). */ -/* */ -/* Copyright 1996-2004, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is automatically included by `ft2build.h'. */ - /* Do not include it manually! */ - /* */ - /*************************************************************************/ - - -#define FT_INTERNAL_OBJECTS_H <internal/ftobjs.h> -#define FT_INTERNAL_PIC_H <internal/ftpic.h> -#define FT_INTERNAL_STREAM_H <internal/ftstream.h> -#define FT_INTERNAL_MEMORY_H <internal/ftmemory.h> -#define FT_INTERNAL_DEBUG_H <internal/ftdebug.h> -#define FT_INTERNAL_CALC_H <internal/ftcalc.h> -#define FT_INTERNAL_DRIVER_H <internal/ftdriver.h> -#define FT_INTERNAL_TRACE_H <internal/fttrace.h> -#define FT_INTERNAL_GLYPH_LOADER_H <internal/ftgloadr.h> -#define FT_INTERNAL_SFNT_H <internal/sfnt.h> -#define FT_INTERNAL_SERVICE_H <internal/ftserv.h> -#define FT_INTERNAL_RFORK_H <internal/ftrfork.h> -#define FT_INTERNAL_VALIDATE_H <internal/ftvalid.h> - -#define FT_INTERNAL_TRUETYPE_TYPES_H <internal/tttypes.h> -#define FT_INTERNAL_TYPE1_TYPES_H <internal/t1types.h> - -#define FT_INTERNAL_POSTSCRIPT_AUX_H <internal/psaux.h> -#define FT_INTERNAL_POSTSCRIPT_HINTS_H <internal/pshints.h> -#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <internal/psglobal.h> - -#define FT_INTERNAL_AUTOHINT_H <internal/autohint.h> - - -#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ - - /* We disable the warning `conditional expression is constant' here */ - /* in order to compile cleanly with the maximum level of warnings. */ - /* In particular, the warning complains about stuff like `while(0)' */ - /* which is very useful in macro definitions. There is no benefit */ - /* in having it enabled. */ -#pragma warning( disable : 4127 ) - -#endif /* _MSC_VER */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/psaux.h b/GLideN64/src/inc/freetype/include/internal/psaux.h deleted file mode 100644 index e903114..0000000 --- a/GLideN64/src/inc/freetype/include/internal/psaux.h +++ /dev/null @@ -1,877 +0,0 @@ -/***************************************************************************/ -/* */ -/* psaux.h */ -/* */ -/* Auxiliary functions and data structures related to PostScript fonts */ -/* (specification). */ -/* */ -/* Copyright 1996-2004, 2006, 2008, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __PSAUX_H__ -#define __PSAUX_H__ - - -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** T1_TABLE *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - - typedef struct PS_TableRec_* PS_Table; - typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_Table_FuncsRec */ - /* */ - /* <Description> */ - /* A set of function pointers to manage PS_Table objects. */ - /* */ - /* <Fields> */ - /* table_init :: Used to initialize a table. */ - /* */ - /* table_done :: Finalizes resp. destroy a given table. */ - /* */ - /* table_add :: Adds a new object to a table. */ - /* */ - /* table_release :: Releases table data, then finalizes it. */ - /* */ - typedef struct PS_Table_FuncsRec_ - { - FT_Error - (*init)( PS_Table table, - FT_Int count, - FT_Memory memory ); - - void - (*done)( PS_Table table ); - - FT_Error - (*add)( PS_Table table, - FT_Int idx, - void* object, - FT_PtrDist length ); - - void - (*release)( PS_Table table ); - - } PS_Table_FuncsRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_TableRec */ - /* */ - /* <Description> */ - /* A PS_Table is a simple object used to store an array of objects in */ - /* a single memory block. */ - /* */ - /* <Fields> */ - /* block :: The address in memory of the growheap's block. This */ - /* can change between two object adds, due to */ - /* reallocation. */ - /* */ - /* cursor :: The current top of the grow heap within its block. */ - /* */ - /* capacity :: The current size of the heap block. Increments by */ - /* 1kByte chunks. */ - /* */ - /* init :: Set to 0xDEADBEEF if `elements' and `lengths' have */ - /* been allocated. */ - /* */ - /* max_elems :: The maximum number of elements in table. */ - /* */ - /* num_elems :: The current number of elements in table. */ - /* */ - /* elements :: A table of element addresses within the block. */ - /* */ - /* lengths :: A table of element sizes within the block. */ - /* */ - /* memory :: The object used for memory operations */ - /* (alloc/realloc). */ - /* */ - /* funcs :: A table of method pointers for this object. */ - /* */ - typedef struct PS_TableRec_ - { - FT_Byte* block; /* current memory block */ - FT_Offset cursor; /* current cursor in memory block */ - FT_Offset capacity; /* current size of memory block */ - FT_Long init; - - FT_Int max_elems; - FT_Int num_elems; - FT_Byte** elements; /* addresses of table elements */ - FT_PtrDist* lengths; /* lengths of table elements */ - - FT_Memory memory; - PS_Table_FuncsRec funcs; - - } PS_TableRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** T1 FIELDS & TOKENS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - typedef struct PS_ParserRec_* PS_Parser; - - typedef struct T1_TokenRec_* T1_Token; - - typedef struct T1_FieldRec_* T1_Field; - - - /* simple enumeration type used to identify token types */ - typedef enum T1_TokenType_ - { - T1_TOKEN_TYPE_NONE = 0, - T1_TOKEN_TYPE_ANY, - T1_TOKEN_TYPE_STRING, - T1_TOKEN_TYPE_ARRAY, - T1_TOKEN_TYPE_KEY, /* aka `name' */ - - /* do not remove */ - T1_TOKEN_TYPE_MAX - - } T1_TokenType; - - - /* a simple structure used to identify tokens */ - typedef struct T1_TokenRec_ - { - FT_Byte* start; /* first character of token in input stream */ - FT_Byte* limit; /* first character after the token */ - T1_TokenType type; /* type of token */ - - } T1_TokenRec; - - - /* enumeration type used to identify object fields */ - typedef enum T1_FieldType_ - { - T1_FIELD_TYPE_NONE = 0, - T1_FIELD_TYPE_BOOL, - T1_FIELD_TYPE_INTEGER, - T1_FIELD_TYPE_FIXED, - T1_FIELD_TYPE_FIXED_1000, - T1_FIELD_TYPE_STRING, - T1_FIELD_TYPE_KEY, - T1_FIELD_TYPE_BBOX, - T1_FIELD_TYPE_MM_BBOX, - T1_FIELD_TYPE_INTEGER_ARRAY, - T1_FIELD_TYPE_FIXED_ARRAY, - T1_FIELD_TYPE_CALLBACK, - - /* do not remove */ - T1_FIELD_TYPE_MAX - - } T1_FieldType; - - - typedef enum T1_FieldLocation_ - { - T1_FIELD_LOCATION_CID_INFO, - T1_FIELD_LOCATION_FONT_DICT, - T1_FIELD_LOCATION_FONT_EXTRA, - T1_FIELD_LOCATION_FONT_INFO, - T1_FIELD_LOCATION_PRIVATE, - T1_FIELD_LOCATION_BBOX, - T1_FIELD_LOCATION_LOADER, - T1_FIELD_LOCATION_FACE, - T1_FIELD_LOCATION_BLEND, - - /* do not remove */ - T1_FIELD_LOCATION_MAX - - } T1_FieldLocation; - - - typedef void - (*T1_Field_ParseFunc)( FT_Face face, - FT_Pointer parser ); - - - /* structure type used to model object fields */ - typedef struct T1_FieldRec_ - { - const char* ident; /* field identifier */ - T1_FieldLocation location; - T1_FieldType type; /* type of field */ - T1_Field_ParseFunc reader; - FT_UInt offset; /* offset of field in object */ - FT_Byte size; /* size of field in bytes */ - FT_UInt array_max; /* maximum number of elements for */ - /* array */ - FT_UInt count_offset; /* offset of element count for */ - /* arrays; must not be zero if in */ - /* use -- in other words, a */ - /* `num_FOO' element must not */ - /* start the used structure if we */ - /* parse a `FOO' array */ - FT_UInt dict; /* where we expect it */ - } T1_FieldRec; - -#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */ -#define T1_FIELD_DICT_PRIVATE ( 1 << 1 ) - - - -#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \ - { \ - _ident, T1CODE, _type, \ - 0, \ - FT_FIELD_OFFSET( _fname ), \ - FT_FIELD_SIZE( _fname ), \ - 0, 0, \ - _dict \ - }, - -#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \ - { \ - _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \ - (T1_Field_ParseFunc)_reader, \ - 0, 0, \ - 0, 0, \ - _dict \ - }, - -#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \ - { \ - _ident, T1CODE, _type, \ - 0, \ - FT_FIELD_OFFSET( _fname ), \ - FT_FIELD_SIZE_DELTA( _fname ), \ - _max, \ - FT_FIELD_OFFSET( num_ ## _fname ), \ - _dict \ - }, - -#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \ - { \ - _ident, T1CODE, _type, \ - 0, \ - FT_FIELD_OFFSET( _fname ), \ - FT_FIELD_SIZE_DELTA( _fname ), \ - _max, 0, \ - _dict \ - }, - - -#define T1_FIELD_BOOL( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict ) - -#define T1_FIELD_NUM( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict ) - -#define T1_FIELD_FIXED( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict ) - -#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \ - _dict ) - -#define T1_FIELD_STRING( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict ) - -#define T1_FIELD_KEY( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict ) - -#define T1_FIELD_BBOX( _ident, _fname, _dict ) \ - T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict ) - - -#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \ - T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ - _fname, _fmax, _dict ) - -#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \ - T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ - _fname, _fmax, _dict ) - -#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \ - T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ - _fname, _fmax, _dict ) - -#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \ - T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ - _fname, _fmax, _dict ) - -#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \ - T1_NEW_CALLBACK_FIELD( _ident, _name, _dict ) - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** T1 PARSER *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs; - - typedef struct PS_Parser_FuncsRec_ - { - void - (*init)( PS_Parser parser, - FT_Byte* base, - FT_Byte* limit, - FT_Memory memory ); - - void - (*done)( PS_Parser parser ); - - void - (*skip_spaces)( PS_Parser parser ); - void - (*skip_PS_token)( PS_Parser parser ); - - FT_Long - (*to_int)( PS_Parser parser ); - FT_Fixed - (*to_fixed)( PS_Parser parser, - FT_Int power_ten ); - - FT_Error - (*to_bytes)( PS_Parser parser, - FT_Byte* bytes, - FT_Offset max_bytes, - FT_Long* pnum_bytes, - FT_Bool delimiters ); - - FT_Int - (*to_coord_array)( PS_Parser parser, - FT_Int max_coords, - FT_Short* coords ); - FT_Int - (*to_fixed_array)( PS_Parser parser, - FT_Int max_values, - FT_Fixed* values, - FT_Int power_ten ); - - void - (*to_token)( PS_Parser parser, - T1_Token token ); - void - (*to_token_array)( PS_Parser parser, - T1_Token tokens, - FT_UInt max_tokens, - FT_Int* pnum_tokens ); - - FT_Error - (*load_field)( PS_Parser parser, - const T1_Field field, - void** objects, - FT_UInt max_objects, - FT_ULong* pflags ); - - FT_Error - (*load_field_table)( PS_Parser parser, - const T1_Field field, - void** objects, - FT_UInt max_objects, - FT_ULong* pflags ); - - } PS_Parser_FuncsRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_ParserRec */ - /* */ - /* <Description> */ - /* A PS_Parser is an object used to parse a Type 1 font very quickly. */ - /* */ - /* <Fields> */ - /* cursor :: The current position in the text. */ - /* */ - /* base :: Start of the processed text. */ - /* */ - /* limit :: End of the processed text. */ - /* */ - /* error :: The last error returned. */ - /* */ - /* memory :: The object used for memory operations (alloc/realloc). */ - /* */ - /* funcs :: A table of functions for the parser. */ - /* */ - typedef struct PS_ParserRec_ - { - FT_Byte* cursor; - FT_Byte* base; - FT_Byte* limit; - FT_Error error; - FT_Memory memory; - - PS_Parser_FuncsRec funcs; - - } PS_ParserRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** T1 BUILDER *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - - typedef struct T1_BuilderRec_* T1_Builder; - - - typedef FT_Error - (*T1_Builder_Check_Points_Func)( T1_Builder builder, - FT_Int count ); - - typedef void - (*T1_Builder_Add_Point_Func)( T1_Builder builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ); - - typedef FT_Error - (*T1_Builder_Add_Point1_Func)( T1_Builder builder, - FT_Pos x, - FT_Pos y ); - - typedef FT_Error - (*T1_Builder_Add_Contour_Func)( T1_Builder builder ); - - typedef FT_Error - (*T1_Builder_Start_Point_Func)( T1_Builder builder, - FT_Pos x, - FT_Pos y ); - - typedef void - (*T1_Builder_Close_Contour_Func)( T1_Builder builder ); - - - typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs; - - typedef struct T1_Builder_FuncsRec_ - { - void - (*init)( T1_Builder builder, - FT_Face face, - FT_Size size, - FT_GlyphSlot slot, - FT_Bool hinting ); - - void - (*done)( T1_Builder builder ); - - T1_Builder_Check_Points_Func check_points; - T1_Builder_Add_Point_Func add_point; - T1_Builder_Add_Point1_Func add_point1; - T1_Builder_Add_Contour_Func add_contour; - T1_Builder_Start_Point_Func start_point; - T1_Builder_Close_Contour_Func close_contour; - - } T1_Builder_FuncsRec; - - - /* an enumeration type to handle charstring parsing states */ - typedef enum T1_ParseState_ - { - T1_Parse_Start, - T1_Parse_Have_Width, - T1_Parse_Have_Moveto, - T1_Parse_Have_Path - - } T1_ParseState; - - - /*************************************************************************/ - /* */ - /* <Structure> */ - /* T1_BuilderRec */ - /* */ - /* <Description> */ - /* A structure used during glyph loading to store its outline. */ - /* */ - /* <Fields> */ - /* memory :: The current memory object. */ - /* */ - /* face :: The current face object. */ - /* */ - /* glyph :: The current glyph slot. */ - /* */ - /* loader :: XXX */ - /* */ - /* base :: The base glyph outline. */ - /* */ - /* current :: The current glyph outline. */ - /* */ - /* max_points :: maximum points in builder outline */ - /* */ - /* max_contours :: Maximum number of contours in builder outline. */ - /* */ - /* pos_x :: The horizontal translation (if composite glyph). */ - /* */ - /* pos_y :: The vertical translation (if composite glyph). */ - /* */ - /* left_bearing :: The left side bearing point. */ - /* */ - /* advance :: The horizontal advance vector. */ - /* */ - /* bbox :: Unused. */ - /* */ - /* parse_state :: An enumeration which controls the charstring */ - /* parsing state. */ - /* */ - /* load_points :: If this flag is not set, no points are loaded. */ - /* */ - /* no_recurse :: Set but not used. */ - /* */ - /* metrics_only :: A boolean indicating that we only want to compute */ - /* the metrics of a given glyph, not load all of its */ - /* points. */ - /* */ - /* funcs :: An array of function pointers for the builder. */ - /* */ - typedef struct T1_BuilderRec_ - { - FT_Memory memory; - FT_Face face; - FT_GlyphSlot glyph; - FT_GlyphLoader loader; - FT_Outline* base; - FT_Outline* current; - - FT_Pos pos_x; - FT_Pos pos_y; - - FT_Vector left_bearing; - FT_Vector advance; - - FT_BBox bbox; /* bounding box */ - T1_ParseState parse_state; - FT_Bool load_points; - FT_Bool no_recurse; - - FT_Bool metrics_only; - - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ - - T1_Builder_FuncsRec funcs; - - } T1_BuilderRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** T1 DECODER *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - -#if 0 - - /*************************************************************************/ - /* */ - /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ - /* calls during glyph loading. */ - /* */ -#define T1_MAX_SUBRS_CALLS 8 - - - /*************************************************************************/ - /* */ - /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ - /* minimum of 16 is required. */ - /* */ -#define T1_MAX_CHARSTRINGS_OPERANDS 32 - -#endif /* 0 */ - - - typedef struct T1_Decoder_ZoneRec_ - { - FT_Byte* cursor; - FT_Byte* base; - FT_Byte* limit; - - } T1_Decoder_ZoneRec, *T1_Decoder_Zone; - - - typedef struct T1_DecoderRec_* T1_Decoder; - typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs; - - - typedef FT_Error - (*T1_Decoder_Callback)( T1_Decoder decoder, - FT_UInt glyph_index ); - - - typedef struct T1_Decoder_FuncsRec_ - { - FT_Error - (*init)( T1_Decoder decoder, - FT_Face face, - FT_Size size, - FT_GlyphSlot slot, - FT_Byte** glyph_names, - PS_Blend blend, - FT_Bool hinting, - FT_Render_Mode hint_mode, - T1_Decoder_Callback callback ); - - void - (*done)( T1_Decoder decoder ); - - FT_Error - (*parse_charstrings)( T1_Decoder decoder, - FT_Byte* base, - FT_UInt len ); - - } T1_Decoder_FuncsRec; - - - typedef struct T1_DecoderRec_ - { - T1_BuilderRec builder; - - FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS]; - FT_Long* top; - - T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; - T1_Decoder_Zone zone; - - FT_Service_PsCMaps psnames; /* for seac */ - FT_UInt num_glyphs; - FT_Byte** glyph_names; - - FT_Int lenIV; /* internal for sub routine calls */ - FT_UInt num_subrs; - FT_Byte** subrs; - FT_PtrDist* subrs_len; /* array of subrs length (optional) */ - - FT_Matrix font_matrix; - FT_Vector font_offset; - - FT_Int flex_state; - FT_Int num_flex_vectors; - FT_Vector flex_vectors[7]; - - PS_Blend blend; /* for multiple master support */ - - FT_Render_Mode hint_mode; - - T1_Decoder_Callback parse_callback; - T1_Decoder_FuncsRec funcs; - - FT_Long* buildchar; - FT_UInt len_buildchar; - - FT_Bool seac; - - } T1_DecoderRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** AFM PARSER *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - typedef struct AFM_ParserRec_* AFM_Parser; - - typedef struct AFM_Parser_FuncsRec_ - { - FT_Error - (*init)( AFM_Parser parser, - FT_Memory memory, - FT_Byte* base, - FT_Byte* limit ); - - void - (*done)( AFM_Parser parser ); - - FT_Error - (*parse)( AFM_Parser parser ); - - } AFM_Parser_FuncsRec; - - - typedef struct AFM_StreamRec_* AFM_Stream; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* AFM_ParserRec */ - /* */ - /* <Description> */ - /* An AFM_Parser is a parser for the AFM files. */ - /* */ - /* <Fields> */ - /* memory :: The object used for memory operations (alloc and */ - /* realloc). */ - /* */ - /* stream :: This is an opaque object. */ - /* */ - /* FontInfo :: The result will be stored here. */ - /* */ - /* get_index :: A user provided function to get a glyph index by its */ - /* name. */ - /* */ - typedef struct AFM_ParserRec_ - { - FT_Memory memory; - AFM_Stream stream; - - AFM_FontInfo FontInfo; - - FT_Int - (*get_index)( const char* name, - FT_Offset len, - void* user_data ); - - void* user_data; - - } AFM_ParserRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** TYPE1 CHARMAPS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes; - - typedef struct T1_CMap_ClassesRec_ - { - FT_CMap_Class standard; - FT_CMap_Class expert; - FT_CMap_Class custom; - FT_CMap_Class unicode; - - } T1_CMap_ClassesRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** PSAux Module Interface *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - typedef struct PSAux_ServiceRec_ - { - /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */ - const PS_Table_FuncsRec* ps_table_funcs; - const PS_Parser_FuncsRec* ps_parser_funcs; - const T1_Builder_FuncsRec* t1_builder_funcs; - const T1_Decoder_FuncsRec* t1_decoder_funcs; - - void - (*t1_decrypt)( FT_Byte* buffer, - FT_Offset length, - FT_UShort seed ); - - T1_CMap_Classes t1_cmap_classes; - - /* fields after this comment line were added after version 2.1.10 */ - const AFM_Parser_FuncsRec* afm_parser_funcs; - - } PSAux_ServiceRec, *PSAux_Service; - - /* backwards-compatible type definition */ - typedef PSAux_ServiceRec PSAux_Interface; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** Some convenience functions *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - -#define IS_PS_NEWLINE( ch ) \ - ( (ch) == '\r' || \ - (ch) == '\n' ) - -#define IS_PS_SPACE( ch ) \ - ( (ch) == ' ' || \ - IS_PS_NEWLINE( ch ) || \ - (ch) == '\t' || \ - (ch) == '\f' || \ - (ch) == '\0' ) - -#define IS_PS_SPECIAL( ch ) \ - ( (ch) == '/' || \ - (ch) == '(' || (ch) == ')' || \ - (ch) == '<' || (ch) == '>' || \ - (ch) == '[' || (ch) == ']' || \ - (ch) == '{' || (ch) == '}' || \ - (ch) == '%' ) - -#define IS_PS_DELIM( ch ) \ - ( IS_PS_SPACE( ch ) || \ - IS_PS_SPECIAL( ch ) ) - -#define IS_PS_DIGIT( ch ) \ - ( (ch) >= '0' && (ch) <= '9' ) - -#define IS_PS_XDIGIT( ch ) \ - ( IS_PS_DIGIT( ch ) || \ - ( (ch) >= 'A' && (ch) <= 'F' ) || \ - ( (ch) >= 'a' && (ch) <= 'f' ) ) - -#define IS_PS_BASE85( ch ) \ - ( (ch) >= '!' && (ch) <= 'u' ) - -#define IS_PS_TOKEN( cur, limit, token ) \ - ( (char)(cur)[0] == (token)[0] && \ - ( (cur) + sizeof ( (token) ) == (limit) || \ - ( (cur) + sizeof( (token) ) < (limit) && \ - IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \ - ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 ) - - -FT_END_HEADER - -#endif /* __PSAUX_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/pshints.h b/GLideN64/src/inc/freetype/include/internal/pshints.h deleted file mode 100644 index 3fb18dc..0000000 --- a/GLideN64/src/inc/freetype/include/internal/pshints.h +++ /dev/null @@ -1,722 +0,0 @@ -/***************************************************************************/ -/* */ -/* pshints.h */ -/* */ -/* Interface to Postscript-specific (Type 1 and Type 2) hints */ -/* recorders (specification only). These are used to support native */ -/* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */ -/* */ -/* Copyright 2001-2003, 2005-2007, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __PSHINTS_H__ -#define __PSHINTS_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TYPE1_TABLES_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** INTERNAL REPRESENTATION OF GLOBALS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - typedef struct PSH_GlobalsRec_* PSH_Globals; - - typedef FT_Error - (*PSH_Globals_NewFunc)( FT_Memory memory, - T1_Private* private_dict, - PSH_Globals* aglobals ); - - typedef FT_Error - (*PSH_Globals_SetScaleFunc)( PSH_Globals globals, - FT_Fixed x_scale, - FT_Fixed y_scale, - FT_Fixed x_delta, - FT_Fixed y_delta ); - - typedef void - (*PSH_Globals_DestroyFunc)( PSH_Globals globals ); - - - typedef struct PSH_Globals_FuncsRec_ - { - PSH_Globals_NewFunc create; - PSH_Globals_SetScaleFunc set_scale; - PSH_Globals_DestroyFunc destroy; - - } PSH_Globals_FuncsRec, *PSH_Globals_Funcs; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** PUBLIC TYPE 1 HINTS RECORDER *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - /************************************************************************* - * - * @type: - * T1_Hints - * - * @description: - * This is a handle to an opaque structure used to record glyph hints - * from a Type 1 character glyph character string. - * - * The methods used to operate on this object are defined by the - * @T1_Hints_FuncsRec structure. Recording glyph hints is normally - * achieved through the following scheme: - * - * - Open a new hint recording session by calling the `open' method. - * This rewinds the recorder and prepare it for new input. - * - * - For each hint found in the glyph charstring, call the corresponding - * method (`stem', `stem3', or `reset'). Note that these functions do - * not return an error code. - * - * - Close the recording session by calling the `close' method. It - * returns an error code if the hints were invalid or something - * strange happened (e.g., memory shortage). - * - * The hints accumulated in the object can later be used by the - * PostScript hinter. - * - */ - typedef struct T1_HintsRec_* T1_Hints; - - - /************************************************************************* - * - * @type: - * T1_Hints_Funcs - * - * @description: - * A pointer to the @T1_Hints_FuncsRec structure that defines the API of - * a given @T1_Hints object. - * - */ - typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs; - - - /************************************************************************* - * - * @functype: - * T1_Hints_OpenFunc - * - * @description: - * A method of the @T1_Hints class used to prepare it for a new Type 1 - * hints recording session. - * - * @input: - * hints :: - * A handle to the Type 1 hints recorder. - * - * @note: - * You should always call the @T1_Hints_CloseFunc method in order to - * close an opened recording session. - * - */ - typedef void - (*T1_Hints_OpenFunc)( T1_Hints hints ); - - - /************************************************************************* - * - * @functype: - * T1_Hints_SetStemFunc - * - * @description: - * A method of the @T1_Hints class used to record a new horizontal or - * vertical stem. This corresponds to the Type 1 `hstem' and `vstem' - * operators. - * - * @input: - * hints :: - * A handle to the Type 1 hints recorder. - * - * dimension :: - * 0 for horizontal stems (hstem), 1 for vertical ones (vstem). - * - * coords :: - * Array of 2 coordinates in 16.16 format, used as (position,length) - * stem descriptor. - * - * @note: - * Use vertical coordinates (y) for horizontal stems (dim=0). Use - * horizontal coordinates (x) for vertical stems (dim=1). - * - * `coords[0]' is the absolute stem position (lowest coordinate); - * `coords[1]' is the length. - * - * The length can be negative, in which case it must be either -20 or - * -21. It is interpreted as a `ghost' stem, according to the Type 1 - * specification. - * - * If the length is -21 (corresponding to a bottom ghost stem), then - * the real stem position is `coords[0]+coords[1]'. - * - */ - typedef void - (*T1_Hints_SetStemFunc)( T1_Hints hints, - FT_UInt dimension, - FT_Fixed* coords ); - - - /************************************************************************* - * - * @functype: - * T1_Hints_SetStem3Func - * - * @description: - * A method of the @T1_Hints class used to record three - * counter-controlled horizontal or vertical stems at once. - * - * @input: - * hints :: - * A handle to the Type 1 hints recorder. - * - * dimension :: - * 0 for horizontal stems, 1 for vertical ones. - * - * coords :: - * An array of 6 values in 16.16 format, holding 3 (position,length) - * pairs for the counter-controlled stems. - * - * @note: - * Use vertical coordinates (y) for horizontal stems (dim=0). Use - * horizontal coordinates (x) for vertical stems (dim=1). - * - * The lengths cannot be negative (ghost stems are never - * counter-controlled). - * - */ - typedef void - (*T1_Hints_SetStem3Func)( T1_Hints hints, - FT_UInt dimension, - FT_Fixed* coords ); - - - /************************************************************************* - * - * @functype: - * T1_Hints_ResetFunc - * - * @description: - * A method of the @T1_Hints class used to reset the stems hints in a - * recording session. - * - * @input: - * hints :: - * A handle to the Type 1 hints recorder. - * - * end_point :: - * The index of the last point in the input glyph in which the - * previously defined hints apply. - * - */ - typedef void - (*T1_Hints_ResetFunc)( T1_Hints hints, - FT_UInt end_point ); - - - /************************************************************************* - * - * @functype: - * T1_Hints_CloseFunc - * - * @description: - * A method of the @T1_Hints class used to close a hint recording - * session. - * - * @input: - * hints :: - * A handle to the Type 1 hints recorder. - * - * end_point :: - * The index of the last point in the input glyph. - * - * @return: - * FreeType error code. 0 means success. - * - * @note: - * The error code is set to indicate that an error occurred during the - * recording session. - * - */ - typedef FT_Error - (*T1_Hints_CloseFunc)( T1_Hints hints, - FT_UInt end_point ); - - - /************************************************************************* - * - * @functype: - * T1_Hints_ApplyFunc - * - * @description: - * A method of the @T1_Hints class used to apply hints to the - * corresponding glyph outline. Must be called once all hints have been - * recorded. - * - * @input: - * hints :: - * A handle to the Type 1 hints recorder. - * - * outline :: - * A pointer to the target outline descriptor. - * - * globals :: - * The hinter globals for this font. - * - * hint_mode :: - * Hinting information. - * - * @return: - * FreeType error code. 0 means success. - * - * @note: - * On input, all points within the outline are in font coordinates. On - * output, they are in 1/64th of pixels. - * - * The scaling transformation is taken from the `globals' object which - * must correspond to the same font as the glyph. - * - */ - typedef FT_Error - (*T1_Hints_ApplyFunc)( T1_Hints hints, - FT_Outline* outline, - PSH_Globals globals, - FT_Render_Mode hint_mode ); - - - /************************************************************************* - * - * @struct: - * T1_Hints_FuncsRec - * - * @description: - * The structure used to provide the API to @T1_Hints objects. - * - * @fields: - * hints :: - * A handle to the T1 Hints recorder. - * - * open :: - * The function to open a recording session. - * - * close :: - * The function to close a recording session. - * - * stem :: - * The function to set a simple stem. - * - * stem3 :: - * The function to set counter-controlled stems. - * - * reset :: - * The function to reset stem hints. - * - * apply :: - * The function to apply the hints to the corresponding glyph outline. - * - */ - typedef struct T1_Hints_FuncsRec_ - { - T1_Hints hints; - T1_Hints_OpenFunc open; - T1_Hints_CloseFunc close; - T1_Hints_SetStemFunc stem; - T1_Hints_SetStem3Func stem3; - T1_Hints_ResetFunc reset; - T1_Hints_ApplyFunc apply; - - } T1_Hints_FuncsRec; - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** PUBLIC TYPE 2 HINTS RECORDER *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - /************************************************************************* - * - * @type: - * T2_Hints - * - * @description: - * This is a handle to an opaque structure used to record glyph hints - * from a Type 2 character glyph character string. - * - * The methods used to operate on this object are defined by the - * @T2_Hints_FuncsRec structure. Recording glyph hints is normally - * achieved through the following scheme: - * - * - Open a new hint recording session by calling the `open' method. - * This rewinds the recorder and prepare it for new input. - * - * - For each hint found in the glyph charstring, call the corresponding - * method (`stems', `hintmask', `counters'). Note that these - * functions do not return an error code. - * - * - Close the recording session by calling the `close' method. It - * returns an error code if the hints were invalid or something - * strange happened (e.g., memory shortage). - * - * The hints accumulated in the object can later be used by the - * Postscript hinter. - * - */ - typedef struct T2_HintsRec_* T2_Hints; - - - /************************************************************************* - * - * @type: - * T2_Hints_Funcs - * - * @description: - * A pointer to the @T2_Hints_FuncsRec structure that defines the API of - * a given @T2_Hints object. - * - */ - typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs; - - - /************************************************************************* - * - * @functype: - * T2_Hints_OpenFunc - * - * @description: - * A method of the @T2_Hints class used to prepare it for a new Type 2 - * hints recording session. - * - * @input: - * hints :: - * A handle to the Type 2 hints recorder. - * - * @note: - * You should always call the @T2_Hints_CloseFunc method in order to - * close an opened recording session. - * - */ - typedef void - (*T2_Hints_OpenFunc)( T2_Hints hints ); - - - /************************************************************************* - * - * @functype: - * T2_Hints_StemsFunc - * - * @description: - * A method of the @T2_Hints class used to set the table of stems in - * either the vertical or horizontal dimension. Equivalent to the - * `hstem', `vstem', `hstemhm', and `vstemhm' Type 2 operators. - * - * @input: - * hints :: - * A handle to the Type 2 hints recorder. - * - * dimension :: - * 0 for horizontal stems (hstem), 1 for vertical ones (vstem). - * - * count :: - * The number of stems. - * - * coords :: - * An array of `count' (position,length) pairs in 16.16 format. - * - * @note: - * Use vertical coordinates (y) for horizontal stems (dim=0). Use - * horizontal coordinates (x) for vertical stems (dim=1). - * - * There are `2*count' elements in the `coords' array. Each even - * element is an absolute position in font units, each odd element is a - * length in font units. - * - * A length can be negative, in which case it must be either -20 or - * -21. It is interpreted as a `ghost' stem, according to the Type 1 - * specification. - * - */ - typedef void - (*T2_Hints_StemsFunc)( T2_Hints hints, - FT_UInt dimension, - FT_UInt count, - FT_Fixed* coordinates ); - - - /************************************************************************* - * - * @functype: - * T2_Hints_MaskFunc - * - * @description: - * A method of the @T2_Hints class used to set a given hintmask (this - * corresponds to the `hintmask' Type 2 operator). - * - * @input: - * hints :: - * A handle to the Type 2 hints recorder. - * - * end_point :: - * The glyph index of the last point to which the previously defined - * or activated hints apply. - * - * bit_count :: - * The number of bits in the hint mask. - * - * bytes :: - * An array of bytes modelling the hint mask. - * - * @note: - * If the hintmask starts the charstring (before any glyph point - * definition), the value of `end_point' should be 0. - * - * `bit_count' is the number of meaningful bits in the `bytes' array; it - * must be equal to the total number of hints defined so far (i.e., - * horizontal+verticals). - * - * The `bytes' array can come directly from the Type 2 charstring and - * respects the same format. - * - */ - typedef void - (*T2_Hints_MaskFunc)( T2_Hints hints, - FT_UInt end_point, - FT_UInt bit_count, - const FT_Byte* bytes ); - - - /************************************************************************* - * - * @functype: - * T2_Hints_CounterFunc - * - * @description: - * A method of the @T2_Hints class used to set a given counter mask - * (this corresponds to the `hintmask' Type 2 operator). - * - * @input: - * hints :: - * A handle to the Type 2 hints recorder. - * - * end_point :: - * A glyph index of the last point to which the previously defined or - * active hints apply. - * - * bit_count :: - * The number of bits in the hint mask. - * - * bytes :: - * An array of bytes modelling the hint mask. - * - * @note: - * If the hintmask starts the charstring (before any glyph point - * definition), the value of `end_point' should be 0. - * - * `bit_count' is the number of meaningful bits in the `bytes' array; it - * must be equal to the total number of hints defined so far (i.e., - * horizontal+verticals). - * - * The `bytes' array can come directly from the Type 2 charstring and - * respects the same format. - * - */ - typedef void - (*T2_Hints_CounterFunc)( T2_Hints hints, - FT_UInt bit_count, - const FT_Byte* bytes ); - - - /************************************************************************* - * - * @functype: - * T2_Hints_CloseFunc - * - * @description: - * A method of the @T2_Hints class used to close a hint recording - * session. - * - * @input: - * hints :: - * A handle to the Type 2 hints recorder. - * - * end_point :: - * The index of the last point in the input glyph. - * - * @return: - * FreeType error code. 0 means success. - * - * @note: - * The error code is set to indicate that an error occurred during the - * recording session. - * - */ - typedef FT_Error - (*T2_Hints_CloseFunc)( T2_Hints hints, - FT_UInt end_point ); - - - /************************************************************************* - * - * @functype: - * T2_Hints_ApplyFunc - * - * @description: - * A method of the @T2_Hints class used to apply hints to the - * corresponding glyph outline. Must be called after the `close' - * method. - * - * @input: - * hints :: - * A handle to the Type 2 hints recorder. - * - * outline :: - * A pointer to the target outline descriptor. - * - * globals :: - * The hinter globals for this font. - * - * hint_mode :: - * Hinting information. - * - * @return: - * FreeType error code. 0 means success. - * - * @note: - * On input, all points within the outline are in font coordinates. On - * output, they are in 1/64th of pixels. - * - * The scaling transformation is taken from the `globals' object which - * must correspond to the same font than the glyph. - * - */ - typedef FT_Error - (*T2_Hints_ApplyFunc)( T2_Hints hints, - FT_Outline* outline, - PSH_Globals globals, - FT_Render_Mode hint_mode ); - - - /************************************************************************* - * - * @struct: - * T2_Hints_FuncsRec - * - * @description: - * The structure used to provide the API to @T2_Hints objects. - * - * @fields: - * hints :: - * A handle to the T2 hints recorder object. - * - * open :: - * The function to open a recording session. - * - * close :: - * The function to close a recording session. - * - * stems :: - * The function to set the dimension's stems table. - * - * hintmask :: - * The function to set hint masks. - * - * counter :: - * The function to set counter masks. - * - * apply :: - * The function to apply the hints on the corresponding glyph outline. - * - */ - typedef struct T2_Hints_FuncsRec_ - { - T2_Hints hints; - T2_Hints_OpenFunc open; - T2_Hints_CloseFunc close; - T2_Hints_StemsFunc stems; - T2_Hints_MaskFunc hintmask; - T2_Hints_CounterFunc counter; - T2_Hints_ApplyFunc apply; - - } T2_Hints_FuncsRec; - - - /* */ - - - typedef struct PSHinter_Interface_ - { - PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module ); - T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module ); - T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module ); - - } PSHinter_Interface; - - typedef PSHinter_Interface* PSHinter_Service; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_PSHINTER_INTERFACE( \ - class_, \ - get_globals_funcs_, \ - get_t1_funcs_, \ - get_t2_funcs_ ) \ - static const PSHinter_Interface class_ = \ - { \ - get_globals_funcs_, \ - get_t1_funcs_, \ - get_t2_funcs_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_PSHINTER_INTERFACE( \ - class_, \ - get_globals_funcs_, \ - get_t1_funcs_, \ - get_t2_funcs_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - PSHinter_Interface* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->get_globals_funcs = get_globals_funcs_; \ - clazz->get_t1_funcs = get_t1_funcs_; \ - clazz->get_t2_funcs = get_t2_funcs_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - -FT_END_HEADER - -#endif /* __PSHINTS_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svbdf.h b/GLideN64/src/inc/freetype/include/internal/services/svbdf.h deleted file mode 100644 index 0974752..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svbdf.h +++ /dev/null @@ -1,82 +0,0 @@ -/***************************************************************************/ -/* */ -/* svbdf.h */ -/* */ -/* The FreeType BDF services (specification). */ -/* */ -/* Copyright 2003, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVBDF_H__ -#define __SVBDF_H__ - -#include FT_BDF_H -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_BDF "bdf" - - typedef FT_Error - (*FT_BDF_GetCharsetIdFunc)( FT_Face face, - const char* *acharset_encoding, - const char* *acharset_registry ); - - typedef FT_Error - (*FT_BDF_GetPropertyFunc)( FT_Face face, - const char* prop_name, - BDF_PropertyRec *aproperty ); - - - FT_DEFINE_SERVICE( BDF ) - { - FT_BDF_GetCharsetIdFunc get_charset_id; - FT_BDF_GetPropertyFunc get_property; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_BDFRec( class_, \ - get_charset_id_, \ - get_property_ ) \ - static const FT_Service_BDFRec class_ = \ - { \ - get_charset_id_, get_property_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_BDFRec( class_, \ - get_charset_id_, \ - get_property_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Service_BDFRec* clazz ) \ - { \ - clazz->get_charset_id = get_charset_id_; \ - clazz->get_property = get_property_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVBDF_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svcid.h b/GLideN64/src/inc/freetype/include/internal/services/svcid.h deleted file mode 100644 index 6be3f93..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svcid.h +++ /dev/null @@ -1,89 +0,0 @@ -/***************************************************************************/ -/* */ -/* svcid.h */ -/* */ -/* The FreeType CID font services (specification). */ -/* */ -/* Copyright 2007, 2009, 2012 by Derek Clegg, Michael Toftdal. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVCID_H__ -#define __SVCID_H__ - -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_CID "CID" - - typedef FT_Error - (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face, - const char* *registry, - const char* *ordering, - FT_Int *supplement ); - typedef FT_Error - (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face, - FT_Bool *is_cid ); - typedef FT_Error - (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face, - FT_UInt glyph_index, - FT_UInt *cid ); - - FT_DEFINE_SERVICE( CID ) - { - FT_CID_GetRegistryOrderingSupplementFunc get_ros; - FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid; - FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_CIDREC( class_, \ - get_ros_, \ - get_is_cid_, \ - get_cid_from_glyph_index_ ) \ - static const FT_Service_CIDRec class_ = \ - { \ - get_ros_, get_is_cid_, get_cid_from_glyph_index_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_CIDREC( class_, \ - get_ros_, \ - get_is_cid_, \ - get_cid_from_glyph_index_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_Service_CIDRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->get_ros = get_ros_; \ - clazz->get_is_cid = get_is_cid_; \ - clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVCID_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svgldict.h b/GLideN64/src/inc/freetype/include/internal/services/svgldict.h deleted file mode 100644 index 1d12534..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svgldict.h +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************/ -/* */ -/* svgldict.h */ -/* */ -/* The FreeType glyph dictionary services (specification). */ -/* */ -/* Copyright 2003, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVGLDICT_H__ -#define __SVGLDICT_H__ - -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - - /* - * A service used to retrieve glyph names, as well as to find the - * index of a given glyph name in a font. - * - */ - -#define FT_SERVICE_ID_GLYPH_DICT "glyph-dict" - - - typedef FT_Error - (*FT_GlyphDict_GetNameFunc)( FT_Face face, - FT_UInt glyph_index, - FT_Pointer buffer, - FT_UInt buffer_max ); - - typedef FT_UInt - (*FT_GlyphDict_NameIndexFunc)( FT_Face face, - FT_String* glyph_name ); - - - FT_DEFINE_SERVICE( GlyphDict ) - { - FT_GlyphDict_GetNameFunc get_name; - FT_GlyphDict_NameIndexFunc name_index; /* optional */ - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ - get_name_, \ - name_index_) \ - static const FT_Service_GlyphDictRec class_ = \ - { \ - get_name_, name_index_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ - get_name_, \ - name_index_) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_Service_GlyphDictRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->get_name = get_name_; \ - clazz->name_index = name_index_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVGLDICT_H__ */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svgxval.h b/GLideN64/src/inc/freetype/include/internal/services/svgxval.h deleted file mode 100644 index 2cdab50..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svgxval.h +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************/ -/* */ -/* svgxval.h */ -/* */ -/* FreeType API for validating TrueTypeGX/AAT tables (specification). */ -/* */ -/* Copyright 2004, 2005 by */ -/* Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVGXVAL_H__ -#define __SVGXVAL_H__ - -#include FT_GX_VALIDATE_H -#include FT_INTERNAL_VALIDATE_H - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_GX_VALIDATE "truetypegx-validate" -#define FT_SERVICE_ID_CLASSICKERN_VALIDATE "classickern-validate" - - typedef FT_Error - (*gxv_validate_func)( FT_Face face, - FT_UInt gx_flags, - FT_Bytes tables[FT_VALIDATE_GX_LENGTH], - FT_UInt table_length ); - - - typedef FT_Error - (*ckern_validate_func)( FT_Face face, - FT_UInt ckern_flags, - FT_Bytes *ckern_table ); - - - FT_DEFINE_SERVICE( GXvalidate ) - { - gxv_validate_func validate; - }; - - FT_DEFINE_SERVICE( CKERNvalidate ) - { - ckern_validate_func validate; - }; - - /* */ - - -FT_END_HEADER - - -#endif /* __SVGXVAL_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svkern.h b/GLideN64/src/inc/freetype/include/internal/services/svkern.h deleted file mode 100644 index 1488adf..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svkern.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************/ -/* */ -/* svkern.h */ -/* */ -/* The FreeType Kerning service (specification). */ -/* */ -/* Copyright 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVKERN_H__ -#define __SVKERN_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_TRUETYPE_TABLES_H - - -FT_BEGIN_HEADER - -#define FT_SERVICE_ID_KERNING "kerning" - - - typedef FT_Error - (*FT_Kerning_TrackGetFunc)( FT_Face face, - FT_Fixed point_size, - FT_Int degree, - FT_Fixed* akerning ); - - FT_DEFINE_SERVICE( Kerning ) - { - FT_Kerning_TrackGetFunc get_track; - }; - - /* */ - - -FT_END_HEADER - - -#endif /* __SVKERN_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svmm.h b/GLideN64/src/inc/freetype/include/internal/services/svmm.h deleted file mode 100644 index b08a663..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svmm.h +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************/ -/* */ -/* svmm.h */ -/* */ -/* The FreeType Multiple Masters and GX var services (specification). */ -/* */ -/* Copyright 2003, 2004, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVMM_H__ -#define __SVMM_H__ - -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - - /* - * A service used to manage multiple-masters data in a given face. - * - * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H). - * - */ - -#define FT_SERVICE_ID_MULTI_MASTERS "multi-masters" - - - typedef FT_Error - (*FT_Get_MM_Func)( FT_Face face, - FT_Multi_Master* master ); - - typedef FT_Error - (*FT_Get_MM_Var_Func)( FT_Face face, - FT_MM_Var* *master ); - - typedef FT_Error - (*FT_Set_MM_Design_Func)( FT_Face face, - FT_UInt num_coords, - FT_Long* coords ); - - typedef FT_Error - (*FT_Set_Var_Design_Func)( FT_Face face, - FT_UInt num_coords, - FT_Fixed* coords ); - - typedef FT_Error - (*FT_Set_MM_Blend_Func)( FT_Face face, - FT_UInt num_coords, - FT_Long* coords ); - - - FT_DEFINE_SERVICE( MultiMasters ) - { - FT_Get_MM_Func get_mm; - FT_Set_MM_Design_Func set_mm_design; - FT_Set_MM_Blend_Func set_mm_blend; - FT_Get_MM_Var_Func get_mm_var; - FT_Set_Var_Design_Func set_var_design; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_var_, \ - set_var_design_ ) \ - static const FT_Service_MultiMastersRec class_ = \ - { \ - get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_var_, \ - set_var_design_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \ - { \ - clazz->get_mm = get_mm_; \ - clazz->set_mm_design = set_mm_design_; \ - clazz->set_mm_blend = set_mm_blend_; \ - clazz->get_mm_var = get_mm_var_; \ - clazz->set_var_design = set_var_design_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - -#endif /* __SVMM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svotval.h b/GLideN64/src/inc/freetype/include/internal/services/svotval.h deleted file mode 100644 index 970bbd5..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svotval.h +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************/ -/* */ -/* svotval.h */ -/* */ -/* The FreeType OpenType validation service (specification). */ -/* */ -/* Copyright 2004, 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVOTVAL_H__ -#define __SVOTVAL_H__ - -#include FT_OPENTYPE_VALIDATE_H -#include FT_INTERNAL_VALIDATE_H - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate" - - - typedef FT_Error - (*otv_validate_func)( FT_Face volatile face, - FT_UInt ot_flags, - FT_Bytes *base, - FT_Bytes *gdef, - FT_Bytes *gpos, - FT_Bytes *gsub, - FT_Bytes *jstf ); - - - FT_DEFINE_SERVICE( OTvalidate ) - { - otv_validate_func validate; - }; - - /* */ - - -FT_END_HEADER - - -#endif /* __SVOTVAL_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svpfr.h b/GLideN64/src/inc/freetype/include/internal/services/svpfr.h deleted file mode 100644 index 462786f..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svpfr.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************/ -/* */ -/* svpfr.h */ -/* */ -/* Internal PFR service functions (specification). */ -/* */ -/* Copyright 2003, 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVPFR_H__ -#define __SVPFR_H__ - -#include FT_PFR_H -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_PFR_METRICS "pfr-metrics" - - - typedef FT_Error - (*FT_PFR_GetMetricsFunc)( FT_Face face, - FT_UInt *aoutline, - FT_UInt *ametrics, - FT_Fixed *ax_scale, - FT_Fixed *ay_scale ); - - typedef FT_Error - (*FT_PFR_GetKerningFunc)( FT_Face face, - FT_UInt left, - FT_UInt right, - FT_Vector *avector ); - - typedef FT_Error - (*FT_PFR_GetAdvanceFunc)( FT_Face face, - FT_UInt gindex, - FT_Pos *aadvance ); - - - FT_DEFINE_SERVICE( PfrMetrics ) - { - FT_PFR_GetMetricsFunc get_metrics; - FT_PFR_GetKerningFunc get_kerning; - FT_PFR_GetAdvanceFunc get_advance; - - }; - - /* */ - -FT_END_HEADER - -#endif /* __SVPFR_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svpostnm.h b/GLideN64/src/inc/freetype/include/internal/services/svpostnm.h deleted file mode 100644 index a76b4fe..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svpostnm.h +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************/ -/* */ -/* svpostnm.h */ -/* */ -/* The FreeType PostScript name services (specification). */ -/* */ -/* Copyright 2003, 2007, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVPOSTNM_H__ -#define __SVPOSTNM_H__ - -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - /* - * A trivial service used to retrieve the PostScript name of a given - * font when available. The `get_name' field should never be NULL. - * - * The corresponding function can return NULL to indicate that the - * PostScript name is not available. - * - * The name is owned by the face and will be destroyed with it. - */ - -#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name" - - - typedef const char* - (*FT_PsName_GetFunc)( FT_Face face ); - - - FT_DEFINE_SERVICE( PsFontName ) - { - FT_PsName_GetFunc get_ps_font_name; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \ - static const FT_Service_PsFontNameRec class_ = \ - { \ - get_ps_font_name_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_Service_PsFontNameRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->get_ps_font_name = get_ps_font_name_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVPOSTNM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svprop.h b/GLideN64/src/inc/freetype/include/internal/services/svprop.h deleted file mode 100644 index 22da0bb..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svprop.h +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************/ -/* */ -/* svprop.h */ -/* */ -/* The FreeType property service (specification). */ -/* */ -/* Copyright 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVPROP_H__ -#define __SVPROP_H__ - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_PROPERTIES "properties" - - - typedef FT_Error - (*FT_Properties_SetFunc)( FT_Module module, - const char* property_name, - const void* value ); - - typedef FT_Error - (*FT_Properties_GetFunc)( FT_Module module, - const char* property_name, - void* value ); - - - FT_DEFINE_SERVICE( Properties ) - { - FT_Properties_SetFunc set_property; - FT_Properties_GetFunc get_property; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \ - set_property_, \ - get_property_ ) \ - static const FT_Service_PropertiesRec class_ = \ - { \ - set_property_, \ - get_property_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \ - set_property_, \ - get_property_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Service_PropertiesRec* clazz ) \ - { \ - clazz->set_property = set_property_; \ - clazz->get_property = get_property_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVPROP_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svpscmap.h b/GLideN64/src/inc/freetype/include/internal/services/svpscmap.h deleted file mode 100644 index 030948e..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svpscmap.h +++ /dev/null @@ -1,177 +0,0 @@ -/***************************************************************************/ -/* */ -/* svpscmap.h */ -/* */ -/* The FreeType PostScript charmap service (specification). */ -/* */ -/* Copyright 2003, 2006, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVPSCMAP_H__ -#define __SVPSCMAP_H__ - -#include FT_INTERNAL_OBJECTS_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps" - - - /* - * Adobe glyph name to unicode value. - */ - typedef FT_UInt32 - (*PS_Unicode_ValueFunc)( const char* glyph_name ); - - /* - * Macintosh name id to glyph name. NULL if invalid index. - */ - typedef const char* - (*PS_Macintosh_NameFunc)( FT_UInt name_index ); - - /* - * Adobe standard string ID to glyph name. NULL if invalid index. - */ - typedef const char* - (*PS_Adobe_Std_StringsFunc)( FT_UInt string_index ); - - - /* - * Simple unicode -> glyph index charmap built from font glyph names - * table. - */ - typedef struct PS_UniMap_ - { - FT_UInt32 unicode; /* bit 31 set: is glyph variant */ - FT_UInt glyph_index; - - } PS_UniMap; - - - typedef struct PS_UnicodesRec_* PS_Unicodes; - - typedef struct PS_UnicodesRec_ - { - FT_CMapRec cmap; - FT_UInt num_maps; - PS_UniMap* maps; - - } PS_UnicodesRec; - - - /* - * A function which returns a glyph name for a given index. Returns - * NULL if invalid index. - */ - typedef const char* - (*PS_GetGlyphNameFunc)( FT_Pointer data, - FT_UInt string_index ); - - /* - * A function used to release the glyph name returned by - * PS_GetGlyphNameFunc, when needed - */ - typedef void - (*PS_FreeGlyphNameFunc)( FT_Pointer data, - const char* name ); - - typedef FT_Error - (*PS_Unicodes_InitFunc)( FT_Memory memory, - PS_Unicodes unicodes, - FT_UInt num_glyphs, - PS_GetGlyphNameFunc get_glyph_name, - PS_FreeGlyphNameFunc free_glyph_name, - FT_Pointer glyph_data ); - - typedef FT_UInt - (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes, - FT_UInt32 unicode ); - - typedef FT_UInt32 - (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes, - FT_UInt32 *unicode ); - - - FT_DEFINE_SERVICE( PsCMaps ) - { - PS_Unicode_ValueFunc unicode_value; - - PS_Unicodes_InitFunc unicodes_init; - PS_Unicodes_CharIndexFunc unicodes_char_index; - PS_Unicodes_CharNextFunc unicodes_char_next; - - PS_Macintosh_NameFunc macintosh_name; - PS_Adobe_Std_StringsFunc adobe_std_strings; - const unsigned short* adobe_std_encoding; - const unsigned short* adobe_expert_encoding; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \ - unicode_value_, \ - unicodes_init_, \ - unicodes_char_index_, \ - unicodes_char_next_, \ - macintosh_name_, \ - adobe_std_strings_, \ - adobe_std_encoding_, \ - adobe_expert_encoding_ ) \ - static const FT_Service_PsCMapsRec class_ = \ - { \ - unicode_value_, unicodes_init_, \ - unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ - adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \ - unicode_value_, \ - unicodes_init_, \ - unicodes_char_index_, \ - unicodes_char_next_, \ - macintosh_name_, \ - adobe_std_strings_, \ - adobe_std_encoding_, \ - adobe_expert_encoding_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_Service_PsCMapsRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->unicode_value = unicode_value_; \ - clazz->unicodes_init = unicodes_init_; \ - clazz->unicodes_char_index = unicodes_char_index_; \ - clazz->unicodes_char_next = unicodes_char_next_; \ - clazz->macintosh_name = macintosh_name_; \ - clazz->adobe_std_strings = adobe_std_strings_; \ - clazz->adobe_std_encoding = adobe_std_encoding_; \ - clazz->adobe_expert_encoding = adobe_expert_encoding_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVPSCMAP_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svpsinfo.h b/GLideN64/src/inc/freetype/include/internal/services/svpsinfo.h deleted file mode 100644 index 4bfb506..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svpsinfo.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************/ -/* */ -/* svpsinfo.h */ -/* */ -/* The FreeType PostScript info service (specification). */ -/* */ -/* Copyright 2003, 2004, 2009, 2011, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVPSINFO_H__ -#define __SVPSINFO_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_INTERNAL_TYPE1_TYPES_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info" - - - typedef FT_Error - (*PS_GetFontInfoFunc)( FT_Face face, - PS_FontInfoRec* afont_info ); - - typedef FT_Error - (*PS_GetFontExtraFunc)( FT_Face face, - PS_FontExtraRec* afont_extra ); - - typedef FT_Int - (*PS_HasGlyphNamesFunc)( FT_Face face ); - - typedef FT_Error - (*PS_GetFontPrivateFunc)( FT_Face face, - PS_PrivateRec* afont_private ); - - typedef FT_Long - (*PS_GetFontValueFunc)( FT_Face face, - PS_Dict_Keys key, - FT_UInt idx, - void *value, - FT_Long value_len ); - - - FT_DEFINE_SERVICE( PsInfo ) - { - PS_GetFontInfoFunc ps_get_font_info; - PS_GetFontExtraFunc ps_get_font_extra; - PS_HasGlyphNamesFunc ps_has_glyph_names; - PS_GetFontPrivateFunc ps_get_font_private; - PS_GetFontValueFunc ps_get_font_value; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_PSINFOREC( class_, \ - get_font_info_, \ - ps_get_font_extra_, \ - has_glyph_names_, \ - get_font_private_, \ - get_font_value_ ) \ - static const FT_Service_PsInfoRec class_ = \ - { \ - get_font_info_, ps_get_font_extra_, has_glyph_names_, \ - get_font_private_, get_font_value_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_PSINFOREC( class_, \ - get_font_info_, \ - ps_get_font_extra_, \ - has_glyph_names_, \ - get_font_private_, \ - get_font_value_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_Service_PsInfoRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->ps_get_font_info = get_font_info_; \ - clazz->ps_get_font_extra = ps_get_font_extra_; \ - clazz->ps_has_glyph_names = has_glyph_names_; \ - clazz->ps_get_font_private = get_font_private_; \ - clazz->ps_get_font_value = get_font_value_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVPSINFO_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svsfnt.h b/GLideN64/src/inc/freetype/include/internal/services/svsfnt.h deleted file mode 100644 index d3835aa..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svsfnt.h +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************/ -/* */ -/* svsfnt.h */ -/* */ -/* The FreeType SFNT table loading service (specification). */ -/* */ -/* Copyright 2003, 2004, 2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVSFNT_H__ -#define __SVSFNT_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_TRUETYPE_TABLES_H - - -FT_BEGIN_HEADER - - - /* - * SFNT table loading service. - */ - -#define FT_SERVICE_ID_SFNT_TABLE "sfnt-table" - - - /* - * Used to implement FT_Load_Sfnt_Table(). - */ - typedef FT_Error - (*FT_SFNT_TableLoadFunc)( FT_Face face, - FT_ULong tag, - FT_Long offset, - FT_Byte* buffer, - FT_ULong* length ); - - /* - * Used to implement FT_Get_Sfnt_Table(). - */ - typedef void* - (*FT_SFNT_TableGetFunc)( FT_Face face, - FT_Sfnt_Tag tag ); - - - /* - * Used to implement FT_Sfnt_Table_Info(). - */ - typedef FT_Error - (*FT_SFNT_TableInfoFunc)( FT_Face face, - FT_UInt idx, - FT_ULong *tag, - FT_ULong *offset, - FT_ULong *length ); - - - FT_DEFINE_SERVICE( SFNT_Table ) - { - FT_SFNT_TableLoadFunc load_table; - FT_SFNT_TableGetFunc get_table; - FT_SFNT_TableInfoFunc table_info; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \ - static const FT_Service_SFNT_TableRec class_ = \ - { \ - load_, get_, info_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec* clazz ) \ - { \ - clazz->load_table = load_; \ - clazz->get_table = get_; \ - clazz->table_info = info_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - - -#endif /* __SVSFNT_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svttcmap.h b/GLideN64/src/inc/freetype/include/internal/services/svttcmap.h deleted file mode 100644 index 4370f4c..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svttcmap.h +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************/ -/* */ -/* svttcmap.h */ -/* */ -/* The FreeType TrueType/sfnt cmap extra information service. */ -/* */ -/* Copyright 2003 by */ -/* Masatake YAMATO, Redhat K.K. */ -/* */ -/* Copyright 2003, 2008, 2009, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/* Development of this service is support of - Information-technology Promotion Agency, Japan. */ - -#ifndef __SVTTCMAP_H__ -#define __SVTTCMAP_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_TRUETYPE_TABLES_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_TT_CMAP "tt-cmaps" - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_CMapInfo */ - /* */ - /* <Description> */ - /* A structure used to store TrueType/sfnt specific cmap information */ - /* which is not covered by the generic @FT_CharMap structure. This */ - /* structure can be accessed with the @FT_Get_TT_CMap_Info function. */ - /* */ - /* <Fields> */ - /* language :: */ - /* The language ID used in Mac fonts. Definitions of values are in */ - /* `ttnameid.h'. */ - /* */ - /* format :: */ - /* The cmap format. OpenType 1.5 defines the formats 0 (byte */ - /* encoding table), 2~(high-byte mapping through table), 4~(segment */ - /* mapping to delta values), 6~(trimmed table mapping), 8~(mixed */ - /* 16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented */ - /* coverage), and 14 (Unicode Variation Sequences). */ - /* */ - typedef struct TT_CMapInfo_ - { - FT_ULong language; - FT_Long format; - - } TT_CMapInfo; - - - typedef FT_Error - (*TT_CMap_Info_GetFunc)( FT_CharMap charmap, - TT_CMapInfo *cmap_info ); - - - FT_DEFINE_SERVICE( TTCMaps ) - { - TT_CMap_Info_GetFunc get_cmap_info; - }; - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \ - static const FT_Service_TTCMapsRec class_ = \ - { \ - get_cmap_info_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - FT_Service_TTCMapsRec* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->get_cmap_info = get_cmap_info_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - -#endif /* __SVTTCMAP_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svtteng.h b/GLideN64/src/inc/freetype/include/internal/services/svtteng.h deleted file mode 100644 index 58e02a6..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svtteng.h +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************/ -/* */ -/* svtteng.h */ -/* */ -/* The FreeType TrueType engine query service (specification). */ -/* */ -/* Copyright 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVTTENG_H__ -#define __SVTTENG_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_MODULE_H - - -FT_BEGIN_HEADER - - - /* - * SFNT table loading service. - */ - -#define FT_SERVICE_ID_TRUETYPE_ENGINE "truetype-engine" - - /* - * Used to implement FT_Get_TrueType_Engine_Type - */ - - FT_DEFINE_SERVICE( TrueTypeEngine ) - { - FT_TrueTypeEngineType engine_type; - }; - - /* */ - - -FT_END_HEADER - - -#endif /* __SVTTENG_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svttglyf.h b/GLideN64/src/inc/freetype/include/internal/services/svttglyf.h deleted file mode 100644 index 369eb84..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svttglyf.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************/ -/* */ -/* svttglyf.h */ -/* */ -/* The FreeType TrueType glyph service. */ -/* */ -/* Copyright 2007, 2009, 2012 by David Turner. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __SVTTGLYF_H__ -#define __SVTTGLYF_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_TRUETYPE_TABLES_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_TT_GLYF "tt-glyf" - - - typedef FT_ULong - (*TT_Glyf_GetLocationFunc)( FT_Face face, - FT_UInt gindex, - FT_ULong *psize ); - - FT_DEFINE_SERVICE( TTGlyf ) - { - TT_Glyf_GetLocationFunc get_location; - }; - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \ - static const FT_Service_TTGlyfRec class_ = \ - { \ - get_location_ \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \ - { \ - clazz->get_location = get_location_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - - -FT_END_HEADER - -#endif /* __SVTTGLYF_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svwinfnt.h b/GLideN64/src/inc/freetype/include/internal/services/svwinfnt.h deleted file mode 100644 index 57f7765..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svwinfnt.h +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************/ -/* */ -/* svwinfnt.h */ -/* */ -/* The FreeType Windows FNT/FONT service (specification). */ -/* */ -/* Copyright 2003 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVWINFNT_H__ -#define __SVWINFNT_H__ - -#include FT_INTERNAL_SERVICE_H -#include FT_WINFONTS_H - - -FT_BEGIN_HEADER - - -#define FT_SERVICE_ID_WINFNT "winfonts" - - typedef FT_Error - (*FT_WinFnt_GetHeaderFunc)( FT_Face face, - FT_WinFNT_HeaderRec *aheader ); - - - FT_DEFINE_SERVICE( WinFnt ) - { - FT_WinFnt_GetHeaderFunc get_header; - }; - - /* */ - - -FT_END_HEADER - - -#endif /* __SVWINFNT_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/services/svxf86nm.h b/GLideN64/src/inc/freetype/include/internal/services/svxf86nm.h deleted file mode 100644 index ca5d884..0000000 --- a/GLideN64/src/inc/freetype/include/internal/services/svxf86nm.h +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************/ -/* */ -/* svxf86nm.h */ -/* */ -/* The FreeType XFree86 services (specification only). */ -/* */ -/* Copyright 2003 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SVXF86NM_H__ -#define __SVXF86NM_H__ - -#include FT_INTERNAL_SERVICE_H - - -FT_BEGIN_HEADER - - - /* - * A trivial service used to return the name of a face's font driver, - * according to the XFree86 nomenclature. Note that the service data - * is a simple constant string pointer. - */ - -#define FT_SERVICE_ID_XF86_NAME "xf86-driver-name" - -#define FT_XF86_FORMAT_TRUETYPE "TrueType" -#define FT_XF86_FORMAT_TYPE_1 "Type 1" -#define FT_XF86_FORMAT_BDF "BDF" -#define FT_XF86_FORMAT_PCF "PCF" -#define FT_XF86_FORMAT_TYPE_42 "Type 42" -#define FT_XF86_FORMAT_CID "CID Type 1" -#define FT_XF86_FORMAT_CFF "CFF" -#define FT_XF86_FORMAT_PFR "PFR" -#define FT_XF86_FORMAT_WINFNT "Windows FNT" - - /* */ - - -FT_END_HEADER - - -#endif /* __SVXF86NM_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/sfnt.h b/GLideN64/src/inc/freetype/include/internal/sfnt.h deleted file mode 100644 index 6b5e41f..0000000 --- a/GLideN64/src/inc/freetype/include/internal/sfnt.h +++ /dev/null @@ -1,707 +0,0 @@ -/***************************************************************************/ -/* */ -/* sfnt.h */ -/* */ -/* High-level `sfnt' driver interface (specification). */ -/* */ -/* Copyright 1996-2006, 2009, 2012-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __SFNT_H__ -#define __SFNT_H__ - - -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H -#include FT_INTERNAL_TRUETYPE_TYPES_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Init_Face_Func */ - /* */ - /* <Description> */ - /* First part of the SFNT face object initialization. This finds */ - /* the face in a SFNT file or collection, and load its format tag in */ - /* face->format_tag. */ - /* */ - /* <Input> */ - /* stream :: The input stream. */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection. */ - /* */ - /* num_params :: The number of additional parameters. */ - /* */ - /* params :: Optional additional parameters. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be at the font file's origin. */ - /* */ - /* This function recognizes fonts embedded in a `TrueType */ - /* collection'. */ - /* */ - /* Once the format tag has been validated by the font driver, it */ - /* should then call the TT_Load_Face_Func() callback to read the rest */ - /* of the SFNT tables in the object. */ - /* */ - typedef FT_Error - (*TT_Init_Face_Func)( FT_Stream stream, - TT_Face face, - FT_Int face_index, - FT_Int num_params, - FT_Parameter* params ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Face_Func */ - /* */ - /* <Description> */ - /* Second part of the SFNT face object initialization. This loads */ - /* the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the */ - /* face object. */ - /* */ - /* <Input> */ - /* stream :: The input stream. */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection. */ - /* */ - /* num_params :: The number of additional parameters. */ - /* */ - /* params :: Optional additional parameters. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* This function must be called after TT_Init_Face_Func(). */ - /* */ - typedef FT_Error - (*TT_Load_Face_Func)( FT_Stream stream, - TT_Face face, - FT_Int face_index, - FT_Int num_params, - FT_Parameter* params ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Done_Face_Func */ - /* */ - /* <Description> */ - /* A callback used to delete the common SFNT data from a face. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* <Note> */ - /* This function does NOT destroy the face object. */ - /* */ - typedef void - (*TT_Done_Face_Func)( TT_Face face ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Any_Func */ - /* */ - /* <Description> */ - /* Load any font table into client memory. */ - /* */ - /* <Input> */ - /* face :: The face object to look for. */ - /* */ - /* tag :: The tag of table to load. Use the value 0 if you want */ - /* to access the whole font file, else set this parameter */ - /* to a valid TrueType table tag that you can forge with */ - /* the MAKE_TT_TAG macro. */ - /* */ - /* offset :: The starting offset in the table (or the file if */ - /* tag == 0). */ - /* */ - /* length :: The address of the decision variable: */ - /* */ - /* If length == NULL: */ - /* Loads the whole table. Returns an error if */ - /* `offset' == 0! */ - /* */ - /* If *length == 0: */ - /* Exits immediately; returning the length of the given */ - /* table or of the font file, depending on the value of */ - /* `tag'. */ - /* */ - /* If *length != 0: */ - /* Loads the next `length' bytes of table or font, */ - /* starting at offset `offset' (in table or font too). */ - /* */ - /* <Output> */ - /* buffer :: The address of target buffer. */ - /* */ - /* <Return> */ - /* TrueType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_Load_Any_Func)( TT_Face face, - FT_ULong tag, - FT_Long offset, - FT_Byte *buffer, - FT_ULong* length ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Find_SBit_Image_Func */ - /* */ - /* <Description> */ - /* Check whether an embedded bitmap (an `sbit') exists for a given */ - /* glyph, at a given strike. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* glyph_index :: The glyph index. */ - /* */ - /* strike_index :: The current strike index. */ - /* */ - /* <Output> */ - /* arange :: The SBit range containing the glyph index. */ - /* */ - /* astrike :: The SBit strike containing the glyph index. */ - /* */ - /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns */ - /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */ - /* glyph. */ - /* */ - typedef FT_Error - (*TT_Find_SBit_Image_Func)( TT_Face face, - FT_UInt glyph_index, - FT_ULong strike_index, - TT_SBit_Range *arange, - TT_SBit_Strike *astrike, - FT_ULong *aglyph_offset ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_SBit_Metrics_Func */ - /* */ - /* <Description> */ - /* Get the big metrics for a given embedded bitmap. */ - /* */ - /* <Input> */ - /* stream :: The input stream. */ - /* */ - /* range :: The SBit range containing the glyph. */ - /* */ - /* <Output> */ - /* big_metrics :: A big SBit metrics structure for the glyph. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be positioned at the glyph's offset within */ - /* the `EBDT' table before the call. */ - /* */ - /* If the image format uses variable metrics, the stream cursor is */ - /* positioned just after the metrics header in the `EBDT' table on */ - /* function exit. */ - /* */ - typedef FT_Error - (*TT_Load_SBit_Metrics_Func)( FT_Stream stream, - TT_SBit_Range range, - TT_SBit_Metrics metrics ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_SBit_Image_Func */ - /* */ - /* <Description> */ - /* Load a given glyph sbit image from the font resource. This also */ - /* returns its metrics. */ - /* */ - /* <Input> */ - /* face :: */ - /* The target face object. */ - /* */ - /* strike_index :: */ - /* The strike index. */ - /* */ - /* glyph_index :: */ - /* The current glyph index. */ - /* */ - /* load_flags :: */ - /* The current load flags. */ - /* */ - /* stream :: */ - /* The input stream. */ - /* */ - /* <Output> */ - /* amap :: */ - /* The target pixmap. */ - /* */ - /* ametrics :: */ - /* A big sbit metrics structure for the glyph image. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns an error if no */ - /* glyph sbit exists for the index. */ - /* */ - /* <Note> */ - /* The `map.buffer' field is always freed before the glyph is loaded. */ - /* */ - typedef FT_Error - (*TT_Load_SBit_Image_Func)( TT_Face face, - FT_ULong strike_index, - FT_UInt glyph_index, - FT_UInt load_flags, - FT_Stream stream, - FT_Bitmap *amap, - TT_SBit_MetricsRec *ametrics ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Set_SBit_Strike_Func */ - /* */ - /* <Description> */ - /* Select an sbit strike for a given size request. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* req :: The size request. */ - /* */ - /* <Output> */ - /* astrike_index :: The index of the sbit strike. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns an error if no */ - /* sbit strike exists for the selected ppem values. */ - /* */ - typedef FT_Error - (*TT_Set_SBit_Strike_Func)( TT_Face face, - FT_Size_Request req, - FT_ULong* astrike_index ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Strike_Metrics_Func */ - /* */ - /* <Description> */ - /* Load the metrics of a given strike. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* strike_index :: The strike index. */ - /* */ - /* <Output> */ - /* metrics :: the metrics of the strike. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns an error if no */ - /* such sbit strike exists. */ - /* */ - typedef FT_Error - (*TT_Load_Strike_Metrics_Func)( TT_Face face, - FT_ULong strike_index, - FT_Size_Metrics* metrics ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Get_PS_Name_Func */ - /* */ - /* <Description> */ - /* Get the PostScript glyph name of a glyph. */ - /* */ - /* <Input> */ - /* idx :: The glyph index. */ - /* */ - /* PSname :: The address of a string pointer. Will be NULL in case */ - /* of error, otherwise it is a pointer to the glyph name. */ - /* */ - /* You must not modify the returned string! */ - /* */ - /* <Output> */ - /* FreeType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_Get_PS_Name_Func)( TT_Face face, - FT_UInt idx, - FT_String** PSname ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Metrics_Func */ - /* */ - /* <Description> */ - /* Load a metrics table, which is a table with a horizontal and a */ - /* vertical version. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* vertical :: A boolean flag. If set, load the vertical one. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_Load_Metrics_Func)( TT_Face face, - FT_Stream stream, - FT_Bool vertical ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Get_Metrics_Func */ - /* */ - /* <Description> */ - /* Load the horizontal or vertical header in a face object. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* vertical :: A boolean flag. If set, load vertical metrics. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_Get_Metrics_Func)( TT_Face face, - FT_Bool vertical, - FT_UInt gindex, - FT_Short* abearing, - FT_UShort* aadvance ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Table_Func */ - /* */ - /* <Description> */ - /* Load a given TrueType table. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The function uses `face->goto_table' to seek the stream to the */ - /* start of the table, except while loading the font directory. */ - /* */ - typedef FT_Error - (*TT_Load_Table_Func)( TT_Face face, - FT_Stream stream ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Free_Table_Func */ - /* */ - /* <Description> */ - /* Free a given TrueType table. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - typedef void - (*TT_Free_Table_Func)( TT_Face face ); - - - /* - * @functype: - * TT_Face_GetKerningFunc - * - * @description: - * Return the horizontal kerning value between two glyphs. - * - * @input: - * face :: A handle to the source face object. - * left_glyph :: The left glyph index. - * right_glyph :: The right glyph index. - * - * @return: - * The kerning value in font units. - */ - typedef FT_Int - (*TT_Face_GetKerningFunc)( TT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph ); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* SFNT_Interface */ - /* */ - /* <Description> */ - /* This structure holds pointers to the functions used to load and */ - /* free the basic tables that are required in a `sfnt' font file. */ - /* */ - /* <Fields> */ - /* Check the various xxx_Func() descriptions for details. */ - /* */ - typedef struct SFNT_Interface_ - { - TT_Loader_GotoTableFunc goto_table; - - TT_Init_Face_Func init_face; - TT_Load_Face_Func load_face; - TT_Done_Face_Func done_face; - FT_Module_Requester get_interface; - - TT_Load_Any_Func load_any; - - /* these functions are called by `load_face' but they can also */ - /* be called from external modules, if there is a need to do so */ - TT_Load_Table_Func load_head; - TT_Load_Metrics_Func load_hhea; - TT_Load_Table_Func load_cmap; - TT_Load_Table_Func load_maxp; - TT_Load_Table_Func load_os2; - TT_Load_Table_Func load_post; - - TT_Load_Table_Func load_name; - TT_Free_Table_Func free_name; - - /* this field was called `load_kerning' up to version 2.1.10 */ - TT_Load_Table_Func load_kern; - - TT_Load_Table_Func load_gasp; - TT_Load_Table_Func load_pclt; - - /* see `ttload.h'; this field was called `load_bitmap_header' up to */ - /* version 2.1.10 */ - TT_Load_Table_Func load_bhed; - - TT_Load_SBit_Image_Func load_sbit_image; - - /* see `ttpost.h' */ - TT_Get_PS_Name_Func get_psname; - TT_Free_Table_Func free_psnames; - - /* starting here, the structure differs from version 2.1.7 */ - - /* this field was introduced in version 2.1.8, named `get_psname' */ - TT_Face_GetKerningFunc get_kerning; - - /* new elements introduced after version 2.1.10 */ - - /* load the font directory, i.e., the offset table and */ - /* the table directory */ - TT_Load_Table_Func load_font_dir; - TT_Load_Metrics_Func load_hmtx; - - TT_Load_Table_Func load_eblc; - TT_Free_Table_Func free_eblc; - - TT_Set_SBit_Strike_Func set_sbit_strike; - TT_Load_Strike_Metrics_Func load_strike_metrics; - - TT_Get_Metrics_Func get_metrics; - - } SFNT_Interface; - - - /* transitional */ - typedef SFNT_Interface* SFNT_Service; - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_DEFINE_SFNT_INTERFACE( \ - class_, \ - goto_table_, \ - init_face_, \ - load_face_, \ - done_face_, \ - get_interface_, \ - load_any_, \ - load_head_, \ - load_hhea_, \ - load_cmap_, \ - load_maxp_, \ - load_os2_, \ - load_post_, \ - load_name_, \ - free_name_, \ - load_kern_, \ - load_gasp_, \ - load_pclt_, \ - load_bhed_, \ - load_sbit_image_, \ - get_psname_, \ - free_psnames_, \ - get_kerning_, \ - load_font_dir_, \ - load_hmtx_, \ - load_eblc_, \ - free_eblc_, \ - set_sbit_strike_, \ - load_strike_metrics_, \ - get_metrics_ ) \ - static const SFNT_Interface class_ = \ - { \ - goto_table_, \ - init_face_, \ - load_face_, \ - done_face_, \ - get_interface_, \ - load_any_, \ - load_head_, \ - load_hhea_, \ - load_cmap_, \ - load_maxp_, \ - load_os2_, \ - load_post_, \ - load_name_, \ - free_name_, \ - load_kern_, \ - load_gasp_, \ - load_pclt_, \ - load_bhed_, \ - load_sbit_image_, \ - get_psname_, \ - free_psnames_, \ - get_kerning_, \ - load_font_dir_, \ - load_hmtx_, \ - load_eblc_, \ - free_eblc_, \ - set_sbit_strike_, \ - load_strike_metrics_, \ - get_metrics_, \ - }; - -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_INTERNAL( a, a_ ) \ - clazz->a = a_; - -#define FT_DEFINE_SFNT_INTERFACE( \ - class_, \ - goto_table_, \ - init_face_, \ - load_face_, \ - done_face_, \ - get_interface_, \ - load_any_, \ - load_head_, \ - load_hhea_, \ - load_cmap_, \ - load_maxp_, \ - load_os2_, \ - load_post_, \ - load_name_, \ - free_name_, \ - load_kern_, \ - load_gasp_, \ - load_pclt_, \ - load_bhed_, \ - load_sbit_image_, \ - get_psname_, \ - free_psnames_, \ - get_kerning_, \ - load_font_dir_, \ - load_hmtx_, \ - load_eblc_, \ - free_eblc_, \ - set_sbit_strike_, \ - load_strike_metrics_, \ - get_metrics_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - SFNT_Interface* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - clazz->goto_table = goto_table_; \ - clazz->init_face = init_face_; \ - clazz->load_face = load_face_; \ - clazz->done_face = done_face_; \ - clazz->get_interface = get_interface_; \ - clazz->load_any = load_any_; \ - clazz->load_head = load_head_; \ - clazz->load_hhea = load_hhea_; \ - clazz->load_cmap = load_cmap_; \ - clazz->load_maxp = load_maxp_; \ - clazz->load_os2 = load_os2_; \ - clazz->load_post = load_post_; \ - clazz->load_name = load_name_; \ - clazz->free_name = free_name_; \ - clazz->load_kern = load_kern_; \ - clazz->load_gasp = load_gasp_; \ - clazz->load_pclt = load_pclt_; \ - clazz->load_bhed = load_bhed_; \ - clazz->load_sbit_image = load_sbit_image_; \ - clazz->get_psname = get_psname_; \ - clazz->free_psnames = free_psnames_; \ - clazz->get_kerning = get_kerning_; \ - clazz->load_font_dir = load_font_dir_; \ - clazz->load_hmtx = load_hmtx_; \ - clazz->load_eblc = load_eblc_; \ - clazz->free_eblc = free_eblc_; \ - clazz->set_sbit_strike = set_sbit_strike_; \ - clazz->load_strike_metrics = load_strike_metrics_; \ - clazz->get_metrics = get_metrics_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - -FT_END_HEADER - -#endif /* __SFNT_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/t1types.h b/GLideN64/src/inc/freetype/include/internal/t1types.h deleted file mode 100644 index e20237c..0000000 --- a/GLideN64/src/inc/freetype/include/internal/t1types.h +++ /dev/null @@ -1,255 +0,0 @@ -/***************************************************************************/ -/* */ -/* t1types.h */ -/* */ -/* Basic Type1/Type2 type definitions and interface (specification */ -/* only). */ -/* */ -/* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __T1TYPES_H__ -#define __T1TYPES_H__ - - -#include <ft2build.h> -#include FT_TYPE1_TABLES_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H -#include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* T1_EncodingRec */ - /* */ - /* <Description> */ - /* A structure modeling a custom encoding. */ - /* */ - /* <Fields> */ - /* num_chars :: The number of character codes in the encoding. */ - /* Usually 256. */ - /* */ - /* code_first :: The lowest valid character code in the encoding. */ - /* */ - /* code_last :: The highest valid character code in the encoding */ - /* + 1. When equal to code_first there are no valid */ - /* character codes. */ - /* */ - /* char_index :: An array of corresponding glyph indices. */ - /* */ - /* char_name :: An array of corresponding glyph names. */ - /* */ - typedef struct T1_EncodingRecRec_ - { - FT_Int num_chars; - FT_Int code_first; - FT_Int code_last; - - FT_UShort* char_index; - FT_String** char_name; - - } T1_EncodingRec, *T1_Encoding; - - - /* used to hold extra data of PS_FontInfoRec that - * cannot be stored in the publicly defined structure. - * - * Note these can't be blended with multiple-masters. - */ - typedef struct PS_FontExtraRec_ - { - FT_UShort fs_type; - - } PS_FontExtraRec; - - - typedef struct T1_FontRec_ - { - PS_FontInfoRec font_info; /* font info dictionary */ - PS_FontExtraRec font_extra; /* font info extra fields */ - PS_PrivateRec private_dict; /* private dictionary */ - FT_String* font_name; /* top-level dictionary */ - - T1_EncodingType encoding_type; - T1_EncodingRec encoding; - - FT_Byte* subrs_block; - FT_Byte* charstrings_block; - FT_Byte* glyph_names_block; - - FT_Int num_subrs; - FT_Byte** subrs; - FT_PtrDist* subrs_len; - - FT_Int num_glyphs; - FT_String** glyph_names; /* array of glyph names */ - FT_Byte** charstrings; /* array of glyph charstrings */ - FT_PtrDist* charstrings_len; - - FT_Byte paint_type; - FT_Byte font_type; - FT_Matrix font_matrix; - FT_Vector font_offset; - FT_BBox font_bbox; - FT_Long font_id; - - FT_Fixed stroke_width; - - } T1_FontRec, *T1_Font; - - - typedef struct CID_SubrsRec_ - { - FT_UInt num_subrs; - FT_Byte** code; - - } CID_SubrsRec, *CID_Subrs; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** AFM FONT INFORMATION STRUCTURES ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - typedef struct AFM_TrackKernRec_ - { - FT_Int degree; - FT_Fixed min_ptsize; - FT_Fixed min_kern; - FT_Fixed max_ptsize; - FT_Fixed max_kern; - - } AFM_TrackKernRec, *AFM_TrackKern; - - typedef struct AFM_KernPairRec_ - { - FT_Int index1; - FT_Int index2; - FT_Int x; - FT_Int y; - - } AFM_KernPairRec, *AFM_KernPair; - - typedef struct AFM_FontInfoRec_ - { - FT_Bool IsCIDFont; - FT_BBox FontBBox; - FT_Fixed Ascender; - FT_Fixed Descender; - AFM_TrackKern TrackKerns; /* free if non-NULL */ - FT_Int NumTrackKern; - AFM_KernPair KernPairs; /* free if non-NULL */ - FT_Int NumKernPair; - - } AFM_FontInfoRec, *AFM_FontInfo; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** ORIGINAL T1_FACE CLASS DEFINITION ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - typedef struct T1_FaceRec_* T1_Face; - typedef struct CID_FaceRec_* CID_Face; - - - typedef struct T1_FaceRec_ - { - FT_FaceRec root; - T1_FontRec type1; - const void* psnames; - const void* psaux; - const void* afm_data; - FT_CharMapRec charmaprecs[2]; - FT_CharMap charmaps[2]; - - /* support for Multiple Masters fonts */ - PS_Blend blend; - - /* undocumented, optional: indices of subroutines that express */ - /* the NormalizeDesignVector and the ConvertDesignVector procedure, */ - /* respectively, as Type 2 charstrings; -1 if keywords not present */ - FT_Int ndv_idx; - FT_Int cdv_idx; - - /* undocumented, optional: has the same meaning as len_buildchar */ - /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */ - FT_UInt len_buildchar; - FT_Long* buildchar; - - /* since version 2.1 - interface to PostScript hinter */ - const void* pshinter; - - } T1_FaceRec; - - - typedef struct CID_FaceRec_ - { - FT_FaceRec root; - void* psnames; - void* psaux; - CID_FaceInfoRec cid; - PS_FontExtraRec font_extra; -#if 0 - void* afm_data; -#endif - CID_Subrs subrs; - - /* since version 2.1 - interface to PostScript hinter */ - void* pshinter; - - /* since version 2.1.8, but was originally positioned after `afm_data' */ - FT_Byte* binary_data; /* used if hex data has been converted */ - FT_Stream cid_stream; - - } CID_FaceRec; - - -FT_END_HEADER - -#endif /* __T1TYPES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/internal/tttypes.h b/GLideN64/src/inc/freetype/include/internal/tttypes.h deleted file mode 100644 index ad302b8..0000000 --- a/GLideN64/src/inc/freetype/include/internal/tttypes.h +++ /dev/null @@ -1,1516 +0,0 @@ -/***************************************************************************/ -/* */ -/* tttypes.h */ -/* */ -/* Basic SFNT/TrueType type definitions and interface (specification */ -/* only). */ -/* */ -/* Copyright 1996-2002, 2004-2008, 2012-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __TTTYPES_H__ -#define __TTTYPES_H__ - - -#include <ft2build.h> -#include FT_TRUETYPE_TABLES_H -#include FT_INTERNAL_OBJECTS_H - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TTC_HeaderRec */ - /* */ - /* <Description> */ - /* TrueType collection header. This table contains the offsets of */ - /* the font headers of each distinct TrueType face in the file. */ - /* */ - /* <Fields> */ - /* tag :: Must be `ttc ' to indicate a TrueType collection. */ - /* */ - /* version :: The version number. */ - /* */ - /* count :: The number of faces in the collection. The */ - /* specification says this should be an unsigned long, but */ - /* we use a signed long since we need the value -1 for */ - /* specific purposes. */ - /* */ - /* offsets :: The offsets of the font headers, one per face. */ - /* */ - typedef struct TTC_HeaderRec_ - { - FT_ULong tag; - FT_Fixed version; - FT_Long count; - FT_ULong* offsets; - - } TTC_HeaderRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* SFNT_HeaderRec */ - /* */ - /* <Description> */ - /* SFNT file format header. */ - /* */ - /* <Fields> */ - /* format_tag :: The font format tag. */ - /* */ - /* num_tables :: The number of tables in file. */ - /* */ - /* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */ - /* */ - /* entry_selector :: Must be log2 of `search_range / 16'. */ - /* */ - /* range_shift :: Must be `num_tables * 16 - search_range'. */ - /* */ - typedef struct SFNT_HeaderRec_ - { - FT_ULong format_tag; - FT_UShort num_tables; - FT_UShort search_range; - FT_UShort entry_selector; - FT_UShort range_shift; - - FT_ULong offset; /* not in file */ - - } SFNT_HeaderRec, *SFNT_Header; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_TableRec */ - /* */ - /* <Description> */ - /* This structure describes a given table of a TrueType font. */ - /* */ - /* <Fields> */ - /* Tag :: A four-bytes tag describing the table. */ - /* */ - /* CheckSum :: The table checksum. This value can be ignored. */ - /* */ - /* Offset :: The offset of the table from the start of the TrueType */ - /* font in its resource. */ - /* */ - /* Length :: The table length (in bytes). */ - /* */ - typedef struct TT_TableRec_ - { - FT_ULong Tag; /* table type */ - FT_ULong CheckSum; /* table checksum */ - FT_ULong Offset; /* table file offset */ - FT_ULong Length; /* table length */ - - } TT_TableRec, *TT_Table; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* WOFF_HeaderRec */ - /* */ - /* <Description> */ - /* WOFF file format header. */ - /* */ - /* <Fields> */ - /* See */ - /* */ - /* http://www.w3.org/TR/WOFF/#WOFFHeader */ - /* */ - typedef struct WOFF_HeaderRec_ - { - FT_ULong signature; - FT_ULong flavor; - FT_ULong length; - FT_UShort num_tables; - FT_UShort reserved; - FT_ULong totalSfntSize; - FT_UShort majorVersion; - FT_UShort minorVersion; - FT_ULong metaOffset; - FT_ULong metaLength; - FT_ULong metaOrigLength; - FT_ULong privOffset; - FT_ULong privLength; - - } WOFF_HeaderRec, *WOFF_Header; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* WOFF_TableRec */ - /* */ - /* <Description> */ - /* This structure describes a given table of a WOFF font. */ - /* */ - /* <Fields> */ - /* Tag :: A four-bytes tag describing the table. */ - /* */ - /* Offset :: The offset of the table from the start of the WOFF */ - /* font in its resource. */ - /* */ - /* CompLength :: Compressed table length (in bytes). */ - /* */ - /* OrigLength :: Unompressed table length (in bytes). */ - /* */ - /* CheckSum :: The table checksum. This value can be ignored. */ - /* */ - /* OrigOffset :: The uncompressed table file offset. This value gets */ - /* computed while constructing the (uncompressed) SFNT */ - /* header. It is not contained in the WOFF file. */ - /* */ - typedef struct WOFF_TableRec_ - { - FT_ULong Tag; /* table ID */ - FT_ULong Offset; /* table file offset */ - FT_ULong CompLength; /* compressed table length */ - FT_ULong OrigLength; /* uncompressed table length */ - FT_ULong CheckSum; /* uncompressed checksum */ - - FT_ULong OrigOffset; /* uncompressed table file offset */ - /* (not in the WOFF file) */ - } WOFF_TableRec, *WOFF_Table; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_LongMetricsRec */ - /* */ - /* <Description> */ - /* A structure modeling the long metrics of the `hmtx' and `vmtx' */ - /* TrueType tables. The values are expressed in font units. */ - /* */ - /* <Fields> */ - /* advance :: The advance width or height for the glyph. */ - /* */ - /* bearing :: The left-side or top-side bearing for the glyph. */ - /* */ - typedef struct TT_LongMetricsRec_ - { - FT_UShort advance; - FT_Short bearing; - - } TT_LongMetricsRec, *TT_LongMetrics; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* TT_ShortMetrics */ - /* */ - /* <Description> */ - /* A simple type to model the short metrics of the `hmtx' and `vmtx' */ - /* tables. */ - /* */ - typedef FT_Short TT_ShortMetrics; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_NameEntryRec */ - /* */ - /* <Description> */ - /* A structure modeling TrueType name records. Name records are used */ - /* to store important strings like family name, style name, */ - /* copyright, etc. in _localized_ versions (i.e., language, encoding, */ - /* etc). */ - /* */ - /* <Fields> */ - /* platformID :: The ID of the name's encoding platform. */ - /* */ - /* encodingID :: The platform-specific ID for the name's encoding. */ - /* */ - /* languageID :: The platform-specific ID for the name's language. */ - /* */ - /* nameID :: The ID specifying what kind of name this is. */ - /* */ - /* stringLength :: The length of the string in bytes. */ - /* */ - /* stringOffset :: The offset to the string in the `name' table. */ - /* */ - /* string :: A pointer to the string's bytes. Note that these */ - /* are usually UTF-16 encoded characters. */ - /* */ - typedef struct TT_NameEntryRec_ - { - FT_UShort platformID; - FT_UShort encodingID; - FT_UShort languageID; - FT_UShort nameID; - FT_UShort stringLength; - FT_ULong stringOffset; - - /* this last field is not defined in the spec */ - /* but used by the FreeType engine */ - - FT_Byte* string; - - } TT_NameEntryRec, *TT_NameEntry; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_NameTableRec */ - /* */ - /* <Description> */ - /* A structure modeling the TrueType name table. */ - /* */ - /* <Fields> */ - /* format :: The format of the name table. */ - /* */ - /* numNameRecords :: The number of names in table. */ - /* */ - /* storageOffset :: The offset of the name table in the `name' */ - /* TrueType table. */ - /* */ - /* names :: An array of name records. */ - /* */ - /* stream :: the file's input stream. */ - /* */ - typedef struct TT_NameTableRec_ - { - FT_UShort format; - FT_UInt numNameRecords; - FT_UInt storageOffset; - TT_NameEntryRec* names; - FT_Stream stream; - - } TT_NameTableRec, *TT_NameTable; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_GaspRangeRec */ - /* */ - /* <Description> */ - /* A tiny structure used to model a gasp range according to the */ - /* TrueType specification. */ - /* */ - /* <Fields> */ - /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */ - /* */ - /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */ - /* modes to be used. */ - /* */ - typedef struct TT_GaspRangeRec_ - { - FT_UShort maxPPEM; - FT_UShort gaspFlag; - - } TT_GaspRangeRec, *TT_GaspRange; - - -#define TT_GASP_GRIDFIT 0x01 -#define TT_GASP_DOGRAY 0x02 - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_GaspRec */ - /* */ - /* <Description> */ - /* A structure modeling the TrueType `gasp' table used to specify */ - /* grid-fitting and anti-aliasing behaviour. */ - /* */ - /* <Fields> */ - /* version :: The version number. */ - /* */ - /* numRanges :: The number of gasp ranges in table. */ - /* */ - /* gaspRanges :: An array of gasp ranges. */ - /* */ - typedef struct TT_Gasp_ - { - FT_UShort version; - FT_UShort numRanges; - TT_GaspRange gaspRanges; - - } TT_GaspRec; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** EMBEDDED BITMAPS SUPPORT ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_MetricsRec */ - /* */ - /* <Description> */ - /* A structure used to hold the big metrics of a given glyph bitmap */ - /* in a TrueType or OpenType font. These are usually found in the */ - /* `EBDT' (Microsoft) or `bloc' (Apple) table. */ - /* */ - /* <Fields> */ - /* height :: The glyph height in pixels. */ - /* */ - /* width :: The glyph width in pixels. */ - /* */ - /* horiBearingX :: The horizontal left bearing. */ - /* */ - /* horiBearingY :: The horizontal top bearing. */ - /* */ - /* horiAdvance :: The horizontal advance. */ - /* */ - /* vertBearingX :: The vertical left bearing. */ - /* */ - /* vertBearingY :: The vertical top bearing. */ - /* */ - /* vertAdvance :: The vertical advance. */ - /* */ - typedef struct TT_SBit_MetricsRec_ - { - FT_UShort height; - FT_UShort width; - - FT_Short horiBearingX; - FT_Short horiBearingY; - FT_UShort horiAdvance; - - FT_Short vertBearingX; - FT_Short vertBearingY; - FT_UShort vertAdvance; - - } TT_SBit_MetricsRec, *TT_SBit_Metrics; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_SmallMetricsRec */ - /* */ - /* <Description> */ - /* A structure used to hold the small metrics of a given glyph bitmap */ - /* in a TrueType or OpenType font. These are usually found in the */ - /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */ - /* */ - /* <Fields> */ - /* height :: The glyph height in pixels. */ - /* */ - /* width :: The glyph width in pixels. */ - /* */ - /* bearingX :: The left-side bearing. */ - /* */ - /* bearingY :: The top-side bearing. */ - /* */ - /* advance :: The advance width or height. */ - /* */ - typedef struct TT_SBit_Small_Metrics_ - { - FT_Byte height; - FT_Byte width; - - FT_Char bearingX; - FT_Char bearingY; - FT_Byte advance; - - } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_LineMetricsRec */ - /* */ - /* <Description> */ - /* A structure used to describe the text line metrics of a given */ - /* bitmap strike, for either a horizontal or vertical layout. */ - /* */ - /* <Fields> */ - /* ascender :: The ascender in pixels. */ - /* */ - /* descender :: The descender in pixels. */ - /* */ - /* max_width :: The maximum glyph width in pixels. */ - /* */ - /* caret_slope_enumerator :: Rise of the caret slope, typically set */ - /* to 1 for non-italic fonts. */ - /* */ - /* caret_slope_denominator :: Rise of the caret slope, typically set */ - /* to 0 for non-italic fonts. */ - /* */ - /* caret_offset :: Offset in pixels to move the caret for */ - /* proper positioning. */ - /* */ - /* min_origin_SB :: Minimum of horiBearingX (resp. */ - /* vertBearingY). */ - /* min_advance_SB :: Minimum of */ - /* */ - /* horizontal advance - */ - /* ( horiBearingX + width ) */ - /* */ - /* resp. */ - /* */ - /* vertical advance - */ - /* ( vertBearingY + height ) */ - /* */ - /* max_before_BL :: Maximum of horiBearingY (resp. */ - /* vertBearingY). */ - /* */ - /* min_after_BL :: Minimum of */ - /* */ - /* horiBearingY - height */ - /* */ - /* resp. */ - /* */ - /* vertBearingX - width */ - /* */ - /* pads :: Unused (to make the size of the record */ - /* a multiple of 32 bits. */ - /* */ - typedef struct TT_SBit_LineMetricsRec_ - { - FT_Char ascender; - FT_Char descender; - FT_Byte max_width; - FT_Char caret_slope_numerator; - FT_Char caret_slope_denominator; - FT_Char caret_offset; - FT_Char min_origin_SB; - FT_Char min_advance_SB; - FT_Char max_before_BL; - FT_Char min_after_BL; - FT_Char pads[2]; - - } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_RangeRec */ - /* */ - /* <Description> */ - /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */ - /* (Microsoft) or `bloc' (Apple) tables. */ - /* */ - /* <Fields> */ - /* first_glyph :: The first glyph index in the range. */ - /* */ - /* last_glyph :: The last glyph index in the range. */ - /* */ - /* index_format :: The format of index table. Valid values are 1 */ - /* to 5. */ - /* */ - /* image_format :: The format of `EBDT' image data. */ - /* */ - /* image_offset :: The offset to image data in `EBDT'. */ - /* */ - /* image_size :: For index formats 2 and 5. This is the size in */ - /* bytes of each glyph bitmap. */ - /* */ - /* big_metrics :: For index formats 2 and 5. This is the big */ - /* metrics for each glyph bitmap. */ - /* */ - /* num_glyphs :: For index formats 4 and 5. This is the number of */ - /* glyphs in the code array. */ - /* */ - /* glyph_offsets :: For index formats 1 and 3. */ - /* */ - /* glyph_codes :: For index formats 4 and 5. */ - /* */ - /* table_offset :: The offset of the index table in the `EBLC' */ - /* table. Only used during strike loading. */ - /* */ - typedef struct TT_SBit_RangeRec_ - { - FT_UShort first_glyph; - FT_UShort last_glyph; - - FT_UShort index_format; - FT_UShort image_format; - FT_ULong image_offset; - - FT_ULong image_size; - TT_SBit_MetricsRec metrics; - FT_ULong num_glyphs; - - FT_ULong* glyph_offsets; - FT_UShort* glyph_codes; - - FT_ULong table_offset; - - } TT_SBit_RangeRec, *TT_SBit_Range; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_StrikeRec */ - /* */ - /* <Description> */ - /* A structure used describe a given bitmap strike in the `EBLC' */ - /* (Microsoft) or `bloc' (Apple) tables. */ - /* */ - /* <Fields> */ - /* num_index_ranges :: The number of index ranges. */ - /* */ - /* index_ranges :: An array of glyph index ranges. */ - /* */ - /* color_ref :: Unused. `color_ref' is put in for future */ - /* enhancements, but these fields are already */ - /* in use by other platforms (e.g. Newton). */ - /* For details, please see */ - /* */ - /* http://fonts.apple.com/ */ - /* TTRefMan/RM06/Chap6bloc.html */ - /* */ - /* hori :: The line metrics for horizontal layouts. */ - /* */ - /* vert :: The line metrics for vertical layouts. */ - /* */ - /* start_glyph :: The lowest glyph index for this strike. */ - /* */ - /* end_glyph :: The highest glyph index for this strike. */ - /* */ - /* x_ppem :: The number of horizontal pixels per EM. */ - /* */ - /* y_ppem :: The number of vertical pixels per EM. */ - /* */ - /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */ - /* and 8. */ - /* */ - /* flags :: Is this a vertical or horizontal strike? For */ - /* details, please see */ - /* */ - /* http://fonts.apple.com/ */ - /* TTRefMan/RM06/Chap6bloc.html */ - /* */ - typedef struct TT_SBit_StrikeRec_ - { - FT_Int num_ranges; - TT_SBit_Range sbit_ranges; - FT_ULong ranges_offset; - - FT_ULong color_ref; - - TT_SBit_LineMetricsRec hori; - TT_SBit_LineMetricsRec vert; - - FT_UShort start_glyph; - FT_UShort end_glyph; - - FT_Byte x_ppem; - FT_Byte y_ppem; - - FT_Byte bit_depth; - FT_Char flags; - - } TT_SBit_StrikeRec, *TT_SBit_Strike; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_ComponentRec */ - /* */ - /* <Description> */ - /* A simple structure to describe a compound sbit element. */ - /* */ - /* <Fields> */ - /* glyph_code :: The element's glyph index. */ - /* */ - /* x_offset :: The element's left bearing. */ - /* */ - /* y_offset :: The element's top bearing. */ - /* */ - typedef struct TT_SBit_ComponentRec_ - { - FT_UShort glyph_code; - FT_Char x_offset; - FT_Char y_offset; - - } TT_SBit_ComponentRec, *TT_SBit_Component; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_SBit_ScaleRec */ - /* */ - /* <Description> */ - /* A structure used describe a given bitmap scaling table, as defined */ - /* in the `EBSC' table. */ - /* */ - /* <Fields> */ - /* hori :: The horizontal line metrics. */ - /* */ - /* vert :: The vertical line metrics. */ - /* */ - /* x_ppem :: The number of horizontal pixels per EM. */ - /* */ - /* y_ppem :: The number of vertical pixels per EM. */ - /* */ - /* x_ppem_substitute :: Substitution x_ppem value. */ - /* */ - /* y_ppem_substitute :: Substitution y_ppem value. */ - /* */ - typedef struct TT_SBit_ScaleRec_ - { - TT_SBit_LineMetricsRec hori; - TT_SBit_LineMetricsRec vert; - - FT_Byte x_ppem; - FT_Byte y_ppem; - - FT_Byte x_ppem_substitute; - FT_Byte y_ppem_substitute; - - } TT_SBit_ScaleRec, *TT_SBit_Scale; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Post_20Rec */ - /* */ - /* <Description> */ - /* Postscript names sub-table, format 2.0. Stores the PS name of */ - /* each glyph in the font face. */ - /* */ - /* <Fields> */ - /* num_glyphs :: The number of named glyphs in the table. */ - /* */ - /* num_names :: The number of PS names stored in the table. */ - /* */ - /* glyph_indices :: The indices of the glyphs in the names arrays. */ - /* */ - /* glyph_names :: The PS names not in Mac Encoding. */ - /* */ - typedef struct TT_Post_20Rec_ - { - FT_UShort num_glyphs; - FT_UShort num_names; - FT_UShort* glyph_indices; - FT_Char** glyph_names; - - } TT_Post_20Rec, *TT_Post_20; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Post_25Rec */ - /* */ - /* <Description> */ - /* Postscript names sub-table, format 2.5. Stores the PS name of */ - /* each glyph in the font face. */ - /* */ - /* <Fields> */ - /* num_glyphs :: The number of glyphs in the table. */ - /* */ - /* offsets :: An array of signed offsets in a normal Mac */ - /* Postscript name encoding. */ - /* */ - typedef struct TT_Post_25_ - { - FT_UShort num_glyphs; - FT_Char* offsets; - - } TT_Post_25Rec, *TT_Post_25; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Post_NamesRec */ - /* */ - /* <Description> */ - /* Postscript names table, either format 2.0 or 2.5. */ - /* */ - /* <Fields> */ - /* loaded :: A flag to indicate whether the PS names are loaded. */ - /* */ - /* format_20 :: The sub-table used for format 2.0. */ - /* */ - /* format_25 :: The sub-table used for format 2.5. */ - /* */ - typedef struct TT_Post_NamesRec_ - { - FT_Bool loaded; - - union - { - TT_Post_20Rec format_20; - TT_Post_25Rec format_25; - - } names; - - } TT_Post_NamesRec, *TT_Post_Names; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** GX VARIATION TABLE SUPPORT ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - typedef struct GX_BlendRec_ *GX_Blend; -#endif - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /* - * These types are used to support a `BDF ' table that isn't part of the - * official TrueType specification. It is mainly used in SFNT-based - * bitmap fonts that were generated from a set of BDF fonts. - * - * The format of the table is as follows. - * - * USHORT version `BDF ' table version number, should be 0x0001. - * USHORT strikeCount Number of strikes (bitmap sizes) in this table. - * ULONG stringTable Offset (from start of BDF table) to string - * table. - * - * This is followed by an array of `strikeCount' descriptors, having the - * following format. - * - * USHORT ppem Vertical pixels per EM for this strike. - * USHORT numItems Number of items for this strike (properties and - * atoms). Maximum is 255. - * - * This array in turn is followed by `strikeCount' value sets. Each - * `value set' is an array of `numItems' items with the following format. - * - * ULONG item_name Offset in string table to item name. - * USHORT item_type The item type. Possible values are - * 0 => string (e.g., COMMENT) - * 1 => atom (e.g., FONT or even SIZE) - * 2 => int32 - * 3 => uint32 - * 0x10 => A flag to indicate a properties. This - * is ORed with the above values. - * ULONG item_value For strings => Offset into string table without - * the corresponding double quotes. - * For atoms => Offset into string table. - * For integers => Direct value. - * - * All strings in the string table consist of bytes and are - * zero-terminated. - * - */ - -#ifdef TT_CONFIG_OPTION_BDF - - typedef struct TT_BDFRec_ - { - FT_Byte* table; - FT_Byte* table_end; - FT_Byte* strings; - FT_ULong strings_size; - FT_UInt num_strikes; - FT_Bool loaded; - - } TT_BDFRec, *TT_BDF; - -#endif /* TT_CONFIG_OPTION_BDF */ - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** ORIGINAL TT_FACE CLASS DEFINITION ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This structure/class is defined here because it is common to the */ - /* following formats: TTF, OpenType-TT, and OpenType-CFF. */ - /* */ - /* Note, however, that the classes TT_Size and TT_GlyphSlot are not */ - /* shared between font drivers, and are thus defined in `ttobjs.h'. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* TT_Face */ - /* */ - /* <Description> */ - /* A handle to a TrueType face/font object. A TT_Face encapsulates */ - /* the resolution and scaling independent parts of a TrueType font */ - /* resource. */ - /* */ - /* <Note> */ - /* The TT_Face structure is also used as a `parent class' for the */ - /* OpenType-CFF class (T2_Face). */ - /* */ - typedef struct TT_FaceRec_* TT_Face; - - - /* a function type used for the truetype bytecode interpreter hooks */ - typedef FT_Error - (*TT_Interpreter)( void* exec_context ); - - /* forward declaration */ - typedef struct TT_LoaderRec_* TT_Loader; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Loader_GotoTableFunc */ - /* */ - /* <Description> */ - /* Seeks a stream to the start of a given TrueType table. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* tag :: A 4-byte tag used to name the table. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Output> */ - /* length :: The length of the table in bytes. Set to 0 if not */ - /* needed. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be at the font file's origin. */ - /* */ - typedef FT_Error - (*TT_Loader_GotoTableFunc)( TT_Face face, - FT_ULong tag, - FT_Stream stream, - FT_ULong* length ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Loader_StartGlyphFunc */ - /* */ - /* <Description> */ - /* Seeks a stream to the start of a given glyph element, and opens a */ - /* frame for it. */ - /* */ - /* <Input> */ - /* loader :: The current TrueType glyph loader object. */ - /* */ - /* glyph index :: The index of the glyph to access. */ - /* */ - /* offset :: The offset of the glyph according to the */ - /* `locations' table. */ - /* */ - /* byte_count :: The size of the frame in bytes. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* This function is normally equivalent to FT_STREAM_SEEK(offset) */ - /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */ - /* but alternative formats (e.g. compressed ones) might use something */ - /* different. */ - /* */ - typedef FT_Error - (*TT_Loader_StartGlyphFunc)( TT_Loader loader, - FT_UInt glyph_index, - FT_ULong offset, - FT_UInt byte_count ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Loader_ReadGlyphFunc */ - /* */ - /* <Description> */ - /* Reads one glyph element (its header, a simple glyph, or a */ - /* composite) from the loader's current stream frame. */ - /* */ - /* <Input> */ - /* loader :: The current TrueType glyph loader object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_Loader_ReadGlyphFunc)( TT_Loader loader ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Loader_EndGlyphFunc */ - /* */ - /* <Description> */ - /* Closes the current loader stream frame for the glyph. */ - /* */ - /* <Input> */ - /* loader :: The current TrueType glyph loader object. */ - /* */ - typedef void - (*TT_Loader_EndGlyphFunc)( TT_Loader loader ); - - - typedef enum TT_SbitTableType_ - { - TT_SBIT_TABLE_TYPE_NONE = 0, - TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */ - /* `bloc' (Apple) */ - TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */ - TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */ - - /* do not remove */ - TT_SBIT_TABLE_TYPE_MAX - - } TT_SbitTableType; - - - /*************************************************************************/ - /* */ - /* TrueType Face Type */ - /* */ - /* <Struct> */ - /* TT_Face */ - /* */ - /* <Description> */ - /* The TrueType face class. These objects model the resolution and */ - /* point-size independent data found in a TrueType font file. */ - /* */ - /* <Fields> */ - /* root :: The base FT_Face structure, managed by the */ - /* base layer. */ - /* */ - /* ttc_header :: The TrueType collection header, used when */ - /* the file is a `ttc' rather than a `ttf'. */ - /* For ordinary font files, the field */ - /* `ttc_header.count' is set to 0. */ - /* */ - /* format_tag :: The font format tag. */ - /* */ - /* num_tables :: The number of TrueType tables in this font */ - /* file. */ - /* */ - /* dir_tables :: The directory of TrueType tables for this */ - /* font file. */ - /* */ - /* header :: The font's font header (`head' table). */ - /* Read on font opening. */ - /* */ - /* horizontal :: The font's horizontal header (`hhea' */ - /* table). This field also contains the */ - /* associated horizontal metrics table */ - /* (`hmtx'). */ - /* */ - /* max_profile :: The font's maximum profile table. Read on */ - /* font opening. Note that some maximum */ - /* values cannot be taken directly from this */ - /* table. We thus define additional fields */ - /* below to hold the computed maxima. */ - /* */ - /* vertical_info :: A boolean which is set when the font file */ - /* contains vertical metrics. If not, the */ - /* value of the `vertical' field is */ - /* undefined. */ - /* */ - /* vertical :: The font's vertical header (`vhea' table). */ - /* This field also contains the associated */ - /* vertical metrics table (`vmtx'), if found. */ - /* IMPORTANT: The contents of this field is */ - /* undefined if the `verticalInfo' field is */ - /* unset. */ - /* */ - /* num_names :: The number of name records within this */ - /* TrueType font. */ - /* */ - /* name_table :: The table of name records (`name'). */ - /* */ - /* os2 :: The font's OS/2 table (`OS/2'). */ - /* */ - /* postscript :: The font's PostScript table (`post' */ - /* table). The PostScript glyph names are */ - /* not loaded by the driver on face opening. */ - /* See the `ttpost' module for more details. */ - /* */ - /* cmap_table :: Address of the face's `cmap' SFNT table */ - /* in memory (it's an extracted frame). */ - /* */ - /* cmap_size :: The size in bytes of the `cmap_table' */ - /* described above. */ - /* */ - /* goto_table :: A function called by each TrueType table */ - /* loader to position a stream's cursor to */ - /* the start of a given table according to */ - /* its tag. It defaults to TT_Goto_Face but */ - /* can be different for strange formats (e.g. */ - /* Type 42). */ - /* */ - /* access_glyph_frame :: A function used to access the frame of a */ - /* given glyph within the face's font file. */ - /* */ - /* forget_glyph_frame :: A function used to forget the frame of a */ - /* given glyph when all data has been loaded. */ - /* */ - /* read_glyph_header :: A function used to read a glyph header. */ - /* It must be called between an `access' and */ - /* `forget'. */ - /* */ - /* read_simple_glyph :: A function used to read a simple glyph. */ - /* It must be called after the header was */ - /* read, and before the `forget'. */ - /* */ - /* read_composite_glyph :: A function used to read a composite glyph. */ - /* It must be called after the header was */ - /* read, and before the `forget'. */ - /* */ - /* sfnt :: A pointer to the SFNT service. */ - /* */ - /* psnames :: A pointer to the PostScript names service. */ - /* */ - /* hdmx :: The face's horizontal device metrics */ - /* (`hdmx' table). This table is optional in */ - /* TrueType/OpenType fonts. */ - /* */ - /* gasp :: The grid-fitting and scaling properties */ - /* table (`gasp'). This table is optional in */ - /* TrueType/OpenType fonts. */ - /* */ - /* pclt :: The `pclt' SFNT table. */ - /* */ - /* num_sbit_scales :: The number of sbit scales for this font. */ - /* */ - /* sbit_scales :: Array of sbit scales embedded in this */ - /* font. This table is optional in a */ - /* TrueType/OpenType font. */ - /* */ - /* postscript_names :: A table used to store the Postscript names */ - /* of the glyphs for this font. See the */ - /* file `ttconfig.h' for comments on the */ - /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */ - /* */ - /* num_locations :: The number of glyph locations in this */ - /* TrueType file. This should be */ - /* identical to the number of glyphs. */ - /* Ignored for Type 2 fonts. */ - /* */ - /* glyph_locations :: An array of longs. These are offsets to */ - /* glyph data within the `glyf' table. */ - /* Ignored for Type 2 font faces. */ - /* */ - /* glyf_len :: The length of the `glyf' table. Needed */ - /* for malformed `loca' tables. */ - /* */ - /* font_program_size :: Size in bytecodes of the face's font */ - /* program. 0 if none defined. Ignored for */ - /* Type 2 fonts. */ - /* */ - /* font_program :: The face's font program (bytecode stream) */ - /* executed at load time, also used during */ - /* glyph rendering. Comes from the `fpgm' */ - /* table. Ignored for Type 2 font fonts. */ - /* */ - /* cvt_program_size :: The size in bytecodes of the face's cvt */ - /* program. Ignored for Type 2 fonts. */ - /* */ - /* cvt_program :: The face's cvt program (bytecode stream) */ - /* executed each time an instance/size is */ - /* changed/reset. Comes from the `prep' */ - /* table. Ignored for Type 2 fonts. */ - /* */ - /* cvt_size :: Size of the control value table (in */ - /* entries). Ignored for Type 2 fonts. */ - /* */ - /* cvt :: The face's original control value table. */ - /* Coordinates are expressed in unscaled font */ - /* units. Comes from the `cvt ' table. */ - /* Ignored for Type 2 fonts. */ - /* */ - /* num_kern_pairs :: The number of kerning pairs present in the */ - /* font file. The engine only loads the */ - /* first horizontal format 0 kern table it */ - /* finds in the font file. Ignored for */ - /* Type 2 fonts. */ - /* */ - /* kern_table_index :: The index of the kerning table in the font */ - /* kerning directory. Ignored for Type 2 */ - /* fonts. */ - /* */ - /* interpreter :: A pointer to the TrueType bytecode */ - /* interpreters field is also used to hook */ - /* the debugger in `ttdebug'. */ - /* */ - /* unpatented_hinting :: If true, use only unpatented methods in */ - /* the bytecode interpreter. */ - /* */ - /* doblend :: A boolean which is set if the font should */ - /* be blended (this is for GX var). */ - /* */ - /* blend :: Contains the data needed to control GX */ - /* variation tables (rather like Multiple */ - /* Master data). */ - /* */ - /* extra :: Reserved for third-party font drivers. */ - /* */ - /* postscript_name :: The PS name of the font. Used by the */ - /* postscript name service. */ - /* */ - typedef struct TT_FaceRec_ - { - FT_FaceRec root; - - TTC_HeaderRec ttc_header; - - FT_ULong format_tag; - FT_UShort num_tables; - TT_Table dir_tables; - - TT_Header header; /* TrueType header table */ - TT_HoriHeader horizontal; /* TrueType horizontal header */ - - TT_MaxProfile max_profile; - - FT_Bool vertical_info; - TT_VertHeader vertical; /* TT Vertical header, if present */ - - FT_UShort num_names; /* number of name records */ - TT_NameTableRec name_table; /* name table */ - - TT_OS2 os2; /* TrueType OS/2 table */ - TT_Postscript postscript; /* TrueType Postscript table */ - - FT_Byte* cmap_table; /* extracted `cmap' table */ - FT_ULong cmap_size; - - TT_Loader_GotoTableFunc goto_table; - - TT_Loader_StartGlyphFunc access_glyph_frame; - TT_Loader_EndGlyphFunc forget_glyph_frame; - TT_Loader_ReadGlyphFunc read_glyph_header; - TT_Loader_ReadGlyphFunc read_simple_glyph; - TT_Loader_ReadGlyphFunc read_composite_glyph; - - /* a typeless pointer to the SFNT_Interface table used to load */ - /* the basic TrueType tables in the face object */ - void* sfnt; - - /* a typeless pointer to the FT_Service_PsCMapsRec table used to */ - /* handle glyph names <-> unicode & Mac values */ - void* psnames; - - - /***********************************************************************/ - /* */ - /* Optional TrueType/OpenType tables */ - /* */ - /***********************************************************************/ - - /* grid-fitting and scaling table */ - TT_GaspRec gasp; /* the `gasp' table */ - - /* PCL 5 table */ - TT_PCLT pclt; - - /* embedded bitmaps support */ - FT_ULong num_sbit_scales; - TT_SBit_Scale sbit_scales; - - /* postscript names table */ - TT_Post_NamesRec postscript_names; - - - /***********************************************************************/ - /* */ - /* TrueType-specific fields (ignored by the OTF-Type2 driver) */ - /* */ - /***********************************************************************/ - - /* the font program, if any */ - FT_ULong font_program_size; - FT_Byte* font_program; - - /* the cvt program, if any */ - FT_ULong cvt_program_size; - FT_Byte* cvt_program; - - /* the original, unscaled, control value table */ - FT_ULong cvt_size; - FT_Short* cvt; - - /* A pointer to the bytecode interpreter to use. This is also */ - /* used to hook the debugger for the `ttdebug' utility. */ - TT_Interpreter interpreter; - -#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING - /* Use unpatented hinting only. */ - FT_Bool unpatented_hinting; -#endif - - /***********************************************************************/ - /* */ - /* Other tables or fields. This is used by derivative formats like */ - /* OpenType. */ - /* */ - /***********************************************************************/ - - FT_Generic extra; - - const char* postscript_name; - - FT_ULong glyf_len; - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Bool doblend; - GX_Blend blend; -#endif - - /* since version 2.2 */ - - FT_Byte* horz_metrics; - FT_ULong horz_metrics_size; - - FT_Byte* vert_metrics; - FT_ULong vert_metrics_size; - - FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */ - FT_Byte* glyph_locations; - - FT_Byte* hdmx_table; - FT_ULong hdmx_table_size; - FT_UInt hdmx_record_count; - FT_ULong hdmx_record_size; - FT_Byte* hdmx_record_sizes; - - FT_Byte* sbit_table; - FT_ULong sbit_table_size; - TT_SbitTableType sbit_table_type; - FT_UInt sbit_num_strikes; - - FT_Byte* kern_table; - FT_ULong kern_table_size; - FT_UInt num_kern_tables; - FT_UInt32 kern_avail_bits; - FT_UInt32 kern_order_bits; - -#ifdef TT_CONFIG_OPTION_BDF - TT_BDFRec bdf; -#endif /* TT_CONFIG_OPTION_BDF */ - - /* since 2.3.0 */ - FT_ULong horz_metrics_offset; - FT_ULong vert_metrics_offset; - -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - /* since 2.4.12 */ - FT_ULong sph_found_func_flags; /* special functions found */ - /* for this face */ - FT_Bool sph_compatibility_mode; -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - - } TT_FaceRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_GlyphZoneRec */ - /* */ - /* <Description> */ - /* A glyph zone is used to load, scale and hint glyph outline */ - /* coordinates. */ - /* */ - /* <Fields> */ - /* memory :: A handle to the memory manager. */ - /* */ - /* max_points :: The maximum size in points of the zone. */ - /* */ - /* max_contours :: Max size in links contours of the zone. */ - /* */ - /* n_points :: The current number of points in the zone. */ - /* */ - /* n_contours :: The current number of contours in the zone. */ - /* */ - /* org :: The original glyph coordinates (font */ - /* units/scaled). */ - /* */ - /* cur :: The current glyph coordinates (scaled/hinted). */ - /* */ - /* tags :: The point control tags. */ - /* */ - /* contours :: The contours end points. */ - /* */ - /* first_point :: Offset of the current subglyph's first point. */ - /* */ - typedef struct TT_GlyphZoneRec_ - { - FT_Memory memory; - FT_UShort max_points; - FT_UShort max_contours; - FT_UShort n_points; /* number of points in zone */ - FT_Short n_contours; /* number of contours */ - - FT_Vector* org; /* original point coordinates */ - FT_Vector* cur; /* current point coordinates */ - FT_Vector* orus; /* original (unscaled) point coordinates */ - - FT_Byte* tags; /* current touch flags */ - FT_UShort* contours; /* contour end points */ - - FT_UShort first_point; /* offset of first (#0) point */ - - } TT_GlyphZoneRec, *TT_GlyphZone; - - - /* handle to execution context */ - typedef struct TT_ExecContextRec_* TT_ExecContext; - - /* glyph loader structure */ - typedef struct TT_LoaderRec_ - { - FT_Face face; - FT_Size size; - FT_GlyphSlot glyph; - FT_GlyphLoader gloader; - - FT_ULong load_flags; - FT_UInt glyph_index; - - FT_Stream stream; - FT_Int byte_len; - - FT_Short n_contours; - FT_BBox bbox; - FT_Int left_bearing; - FT_Int advance; - FT_Int linear; - FT_Bool linear_def; - FT_Vector pp1; - FT_Vector pp2; - - FT_ULong glyf_offset; - - /* the zone where we load our glyphs */ - TT_GlyphZoneRec base; - TT_GlyphZoneRec zone; - - TT_ExecContext exec; - FT_Byte* instructions; - FT_ULong ins_pos; - - /* for possible extensibility in other formats */ - void* other; - - /* since version 2.1.8 */ - FT_Int top_bearing; - FT_Int vadvance; - FT_Vector pp3; - FT_Vector pp4; - - /* since version 2.2.1 */ - FT_Byte* cursor; - FT_Byte* limit; - - } TT_LoaderRec; - - -FT_END_HEADER - -#endif /* __TTTYPES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/t1tables.h b/GLideN64/src/inc/freetype/include/t1tables.h deleted file mode 100644 index a14255e..0000000 --- a/GLideN64/src/inc/freetype/include/t1tables.h +++ /dev/null @@ -1,662 +0,0 @@ -/***************************************************************************/ -/* */ -/* t1tables.h */ -/* */ -/* Basic Type 1/Type 2 tables definitions and interface (specification */ -/* only). */ -/* */ -/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __T1TABLES_H__ -#define __T1TABLES_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* type1_tables */ - /* */ - /* <Title> */ - /* Type 1 Tables */ - /* */ - /* <Abstract> */ - /* Type~1 (PostScript) specific font tables. */ - /* */ - /* <Description> */ - /* This section contains the definition of Type 1-specific tables, */ - /* including structures related to other PostScript font formats. */ - /* */ - /*************************************************************************/ - - - /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */ - /* structures in order to support Multiple Master fonts. */ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_FontInfoRec */ - /* */ - /* <Description> */ - /* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */ - /* Note that for Multiple Master fonts, each instance has its own */ - /* FontInfo dictionary. */ - /* */ - typedef struct PS_FontInfoRec_ - { - FT_String* version; - FT_String* notice; - FT_String* full_name; - FT_String* family_name; - FT_String* weight; - FT_Long italic_angle; - FT_Bool is_fixed_pitch; - FT_Short underline_position; - FT_UShort underline_thickness; - - } PS_FontInfoRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_FontInfo */ - /* */ - /* <Description> */ - /* A handle to a @PS_FontInfoRec structure. */ - /* */ - typedef struct PS_FontInfoRec_* PS_FontInfo; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* T1_FontInfo */ - /* */ - /* <Description> */ - /* This type is equivalent to @PS_FontInfoRec. It is deprecated but */ - /* kept to maintain source compatibility between various versions of */ - /* FreeType. */ - /* */ - typedef PS_FontInfoRec T1_FontInfo; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_PrivateRec */ - /* */ - /* <Description> */ - /* A structure used to model a Type~1 or Type~2 private dictionary. */ - /* Note that for Multiple Master fonts, each instance has its own */ - /* Private dictionary. */ - /* */ - typedef struct PS_PrivateRec_ - { - FT_Int unique_id; - FT_Int lenIV; - - FT_Byte num_blue_values; - FT_Byte num_other_blues; - FT_Byte num_family_blues; - FT_Byte num_family_other_blues; - - FT_Short blue_values[14]; - FT_Short other_blues[10]; - - FT_Short family_blues [14]; - FT_Short family_other_blues[10]; - - FT_Fixed blue_scale; - FT_Int blue_shift; - FT_Int blue_fuzz; - - FT_UShort standard_width[1]; - FT_UShort standard_height[1]; - - FT_Byte num_snap_widths; - FT_Byte num_snap_heights; - FT_Bool force_bold; - FT_Bool round_stem_up; - - FT_Short snap_widths [13]; /* including std width */ - FT_Short snap_heights[13]; /* including std height */ - - FT_Fixed expansion_factor; - - FT_Long language_group; - FT_Long password; - - FT_Short min_feature[2]; - - } PS_PrivateRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* PS_Private */ - /* */ - /* <Description> */ - /* A handle to a @PS_PrivateRec structure. */ - /* */ - typedef struct PS_PrivateRec_* PS_Private; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* T1_Private */ - /* */ - /* <Description> */ - /* This type is equivalent to @PS_PrivateRec. It is deprecated but */ - /* kept to maintain source compatibility between various versions of */ - /* FreeType. */ - /* */ - typedef PS_PrivateRec T1_Private; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* T1_Blend_Flags */ - /* */ - /* <Description> */ - /* A set of flags used to indicate which fields are present in a */ - /* given blend dictionary (font info or private). Used to support */ - /* Multiple Masters fonts. */ - /* */ - typedef enum T1_Blend_Flags_ - { - /*# required fields in a FontInfo blend dictionary */ - T1_BLEND_UNDERLINE_POSITION = 0, - T1_BLEND_UNDERLINE_THICKNESS, - T1_BLEND_ITALIC_ANGLE, - - /*# required fields in a Private blend dictionary */ - T1_BLEND_BLUE_VALUES, - T1_BLEND_OTHER_BLUES, - T1_BLEND_STANDARD_WIDTH, - T1_BLEND_STANDARD_HEIGHT, - T1_BLEND_STEM_SNAP_WIDTHS, - T1_BLEND_STEM_SNAP_HEIGHTS, - T1_BLEND_BLUE_SCALE, - T1_BLEND_BLUE_SHIFT, - T1_BLEND_FAMILY_BLUES, - T1_BLEND_FAMILY_OTHER_BLUES, - T1_BLEND_FORCE_BOLD, - - /*# never remove */ - T1_BLEND_MAX - - } T1_Blend_Flags; - - /* */ - - - /*# backwards compatible definitions */ -#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION -#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS -#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE -#define t1_blend_blue_values T1_BLEND_BLUE_VALUES -#define t1_blend_other_blues T1_BLEND_OTHER_BLUES -#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH -#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT -#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS -#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS -#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE -#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT -#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES -#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES -#define t1_blend_force_bold T1_BLEND_FORCE_BOLD -#define t1_blend_max T1_BLEND_MAX - - - /* maximum number of Multiple Masters designs, as defined in the spec */ -#define T1_MAX_MM_DESIGNS 16 - - /* maximum number of Multiple Masters axes, as defined in the spec */ -#define T1_MAX_MM_AXIS 4 - - /* maximum number of elements in a design map */ -#define T1_MAX_MM_MAP_POINTS 20 - - - /* this structure is used to store the BlendDesignMap entry for an axis */ - typedef struct PS_DesignMap_ - { - FT_Byte num_points; - FT_Long* design_points; - FT_Fixed* blend_points; - - } PS_DesignMapRec, *PS_DesignMap; - - /* backwards-compatible definition */ - typedef PS_DesignMapRec T1_DesignMap; - - - typedef struct PS_BlendRec_ - { - FT_UInt num_designs; - FT_UInt num_axis; - - FT_String* axis_names[T1_MAX_MM_AXIS]; - FT_Fixed* design_pos[T1_MAX_MM_DESIGNS]; - PS_DesignMapRec design_map[T1_MAX_MM_AXIS]; - - FT_Fixed* weight_vector; - FT_Fixed* default_weight_vector; - - PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1]; - PS_Private privates [T1_MAX_MM_DESIGNS + 1]; - - FT_ULong blend_bitflags; - - FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1]; - - /* since 2.3.0 */ - - /* undocumented, optional: the default design instance; */ - /* corresponds to default_weight_vector -- */ - /* num_default_design_vector == 0 means it is not present */ - /* in the font and associated metrics files */ - FT_UInt default_design_vector[T1_MAX_MM_DESIGNS]; - FT_UInt num_default_design_vector; - - } PS_BlendRec, *PS_Blend; - - - /* backwards-compatible definition */ - typedef PS_BlendRec T1_Blend; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* CID_FaceDictRec */ - /* */ - /* <Description> */ - /* A structure used to represent data in a CID top-level dictionary. */ - /* */ - typedef struct CID_FaceDictRec_ - { - PS_PrivateRec private_dict; - - FT_UInt len_buildchar; - FT_Fixed forcebold_threshold; - FT_Pos stroke_width; - FT_Fixed expansion_factor; - - FT_Byte paint_type; - FT_Byte font_type; - FT_Matrix font_matrix; - FT_Vector font_offset; - - FT_UInt num_subrs; - FT_ULong subrmap_offset; - FT_Int sd_bytes; - - } CID_FaceDictRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* CID_FaceDict */ - /* */ - /* <Description> */ - /* A handle to a @CID_FaceDictRec structure. */ - /* */ - typedef struct CID_FaceDictRec_* CID_FaceDict; - - /* */ - - - /* backwards-compatible definition */ - typedef CID_FaceDictRec CID_FontDict; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* CID_FaceInfoRec */ - /* */ - /* <Description> */ - /* A structure used to represent CID Face information. */ - /* */ - typedef struct CID_FaceInfoRec_ - { - FT_String* cid_font_name; - FT_Fixed cid_version; - FT_Int cid_font_type; - - FT_String* registry; - FT_String* ordering; - FT_Int supplement; - - PS_FontInfoRec font_info; - FT_BBox font_bbox; - FT_ULong uid_base; - - FT_Int num_xuid; - FT_ULong xuid[16]; - - FT_ULong cidmap_offset; - FT_Int fd_bytes; - FT_Int gd_bytes; - FT_ULong cid_count; - - FT_Int num_dicts; - CID_FaceDict font_dicts; - - FT_ULong data_offset; - - } CID_FaceInfoRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* CID_FaceInfo */ - /* */ - /* <Description> */ - /* A handle to a @CID_FaceInfoRec structure. */ - /* */ - typedef struct CID_FaceInfoRec_* CID_FaceInfo; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* CID_Info */ - /* */ - /* <Description> */ - /* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */ - /* kept to maintain source compatibility between various versions of */ - /* FreeType. */ - /* */ - typedef CID_FaceInfoRec CID_Info; - - - /************************************************************************ - * - * @function: - * FT_Has_PS_Glyph_Names - * - * @description: - * Return true if a given face provides reliable PostScript glyph - * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, - * except that certain fonts (mostly TrueType) contain incorrect - * glyph name tables. - * - * When this function returns true, the caller is sure that the glyph - * names returned by @FT_Get_Glyph_Name are reliable. - * - * @input: - * face :: - * face handle - * - * @return: - * Boolean. True if glyph names are reliable. - * - */ - FT_EXPORT( FT_Int ) - FT_Has_PS_Glyph_Names( FT_Face face ); - - - /************************************************************************ - * - * @function: - * FT_Get_PS_Font_Info - * - * @description: - * Retrieve the @PS_FontInfoRec structure corresponding to a given - * PostScript font. - * - * @input: - * face :: - * PostScript face handle. - * - * @output: - * afont_info :: - * Output font info structure pointer. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The string pointers within the font info structure are owned by - * the face and don't need to be freed by the caller. - * - * If the font's format is not PostScript-based, this function will - * return the `FT_Err_Invalid_Argument' error code. - * - */ - FT_EXPORT( FT_Error ) - FT_Get_PS_Font_Info( FT_Face face, - PS_FontInfo afont_info ); - - - /************************************************************************ - * - * @function: - * FT_Get_PS_Font_Private - * - * @description: - * Retrieve the @PS_PrivateRec structure corresponding to a given - * PostScript font. - * - * @input: - * face :: - * PostScript face handle. - * - * @output: - * afont_private :: - * Output private dictionary structure pointer. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The string pointers within the @PS_PrivateRec structure are owned by - * the face and don't need to be freed by the caller. - * - * If the font's format is not PostScript-based, this function returns - * the `FT_Err_Invalid_Argument' error code. - * - */ - FT_EXPORT( FT_Error ) - FT_Get_PS_Font_Private( FT_Face face, - PS_Private afont_private ); - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* T1_EncodingType */ - /* */ - /* <Description> */ - /* An enumeration describing the `Encoding' entry in a Type 1 */ - /* dictionary. */ - /* */ - typedef enum T1_EncodingType_ - { - T1_ENCODING_TYPE_NONE = 0, - T1_ENCODING_TYPE_ARRAY, - T1_ENCODING_TYPE_STANDARD, - T1_ENCODING_TYPE_ISOLATIN1, - T1_ENCODING_TYPE_EXPERT - - } T1_EncodingType; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* PS_Dict_Keys */ - /* */ - /* <Description> */ - /* An enumeration used in calls to @FT_Get_PS_Font_Value to identify */ - /* the Type~1 dictionary entry to retrieve. */ - /* */ - typedef enum PS_Dict_Keys_ - { - /* conventionally in the font dictionary */ - PS_DICT_FONT_TYPE, /* FT_Byte */ - PS_DICT_FONT_MATRIX, /* FT_Fixed */ - PS_DICT_FONT_BBOX, /* FT_Fixed */ - PS_DICT_PAINT_TYPE, /* FT_Byte */ - PS_DICT_FONT_NAME, /* FT_String* */ - PS_DICT_UNIQUE_ID, /* FT_Int */ - PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */ - PS_DICT_CHAR_STRING_KEY, /* FT_String* */ - PS_DICT_CHAR_STRING, /* FT_String* */ - PS_DICT_ENCODING_TYPE, /* T1_EncodingType */ - PS_DICT_ENCODING_ENTRY, /* FT_String* */ - - /* conventionally in the font Private dictionary */ - PS_DICT_NUM_SUBRS, /* FT_Int */ - PS_DICT_SUBR, /* FT_String* */ - PS_DICT_STD_HW, /* FT_UShort */ - PS_DICT_STD_VW, /* FT_UShort */ - PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */ - PS_DICT_BLUE_VALUE, /* FT_Short */ - PS_DICT_BLUE_FUZZ, /* FT_Int */ - PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */ - PS_DICT_OTHER_BLUE, /* FT_Short */ - PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */ - PS_DICT_FAMILY_BLUE, /* FT_Short */ - PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */ - PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */ - PS_DICT_BLUE_SCALE, /* FT_Fixed */ - PS_DICT_BLUE_SHIFT, /* FT_Int */ - PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */ - PS_DICT_STEM_SNAP_H, /* FT_Short */ - PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */ - PS_DICT_STEM_SNAP_V, /* FT_Short */ - PS_DICT_FORCE_BOLD, /* FT_Bool */ - PS_DICT_RND_STEM_UP, /* FT_Bool */ - PS_DICT_MIN_FEATURE, /* FT_Short */ - PS_DICT_LEN_IV, /* FT_Int */ - PS_DICT_PASSWORD, /* FT_Long */ - PS_DICT_LANGUAGE_GROUP, /* FT_Long */ - - /* conventionally in the font FontInfo dictionary */ - PS_DICT_VERSION, /* FT_String* */ - PS_DICT_NOTICE, /* FT_String* */ - PS_DICT_FULL_NAME, /* FT_String* */ - PS_DICT_FAMILY_NAME, /* FT_String* */ - PS_DICT_WEIGHT, /* FT_String* */ - PS_DICT_IS_FIXED_PITCH, /* FT_Bool */ - PS_DICT_UNDERLINE_POSITION, /* FT_Short */ - PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */ - PS_DICT_FS_TYPE, /* FT_UShort */ - PS_DICT_ITALIC_ANGLE, /* FT_Long */ - - PS_DICT_MAX = PS_DICT_ITALIC_ANGLE - - } PS_Dict_Keys; - - - /************************************************************************ - * - * @function: - * FT_Get_PS_Font_Value - * - * @description: - * Retrieve the value for the supplied key from a PostScript font. - * - * @input: - * face :: - * PostScript face handle. - * - * key :: - * An enumeration value representing the dictionary key to retrieve. - * - * idx :: - * For array values, this specifies the index to be returned. - * - * value :: - * A pointer to memory into which to write the value. - * - * valen_len :: - * The size, in bytes, of the memory supplied for the value. - * - * @output: - * value :: - * The value matching the above key, if it exists. - * - * @return: - * The amount of memory (in bytes) required to hold the requested - * value (if it exists, -1 otherwise). - * - * @note: - * The values returned are not pointers into the internal structures of - * the face, but are `fresh' copies, so that the memory containing them - * belongs to the calling application. This also enforces the - * `read-only' nature of these values, i.e., this function cannot be - * used to manipulate the face. - * - * `value' is a void pointer because the values returned can be of - * various types. - * - * If either `value' is NULL or `value_len' is too small, just the - * required memory size for the requested entry is returned. - * - * The `idx' parameter is used, not only to retrieve elements of, for - * example, the FontMatrix or FontBBox, but also to retrieve name keys - * from the CharStrings dictionary, and the charstrings themselves. It - * is ignored for atomic values. - * - * PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000. To - * get the value as in the font stream, you need to divide by - * 65536000.0 (to remove the FT_Fixed scale, and the x1000 scale). - * - * IMPORTANT: Only key/value pairs read by the FreeType interpreter can - * be retrieved. So, for example, PostScript procedures such as NP, - * ND, and RD are not available. Arbitrary keys are, obviously, not be - * available either. - * - * If the font's format is not PostScript-based, this function returns - * the `FT_Err_Invalid_Argument' error code. - * - */ - FT_EXPORT( FT_Long ) - FT_Get_PS_Font_Value( FT_Face face, - PS_Dict_Keys key, - FT_UInt idx, - void *value, - FT_Long value_len ); - - /* */ - -FT_END_HEADER - -#endif /* __T1TABLES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ttnameid.h b/GLideN64/src/inc/freetype/include/ttnameid.h deleted file mode 100644 index 9711d1d..0000000 --- a/GLideN64/src/inc/freetype/include/ttnameid.h +++ /dev/null @@ -1,1237 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttnameid.h */ -/* */ -/* TrueType name ID definitions (specification only). */ -/* */ -/* Copyright 1996-2004, 2006-2008, 2012, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __TTNAMEID_H__ -#define __TTNAMEID_H__ - - -#include <ft2build.h> - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* truetype_tables */ - /* */ - - - /*************************************************************************/ - /* */ - /* Possible values for the `platform' identifier code in the name */ - /* records of the TTF `name' table. */ - /* */ - /*************************************************************************/ - - - /*********************************************************************** - * - * @enum: - * TT_PLATFORM_XXX - * - * @description: - * A list of valid values for the `platform_id' identifier code in - * @FT_CharMapRec and @FT_SfntName structures. - * - * @values: - * TT_PLATFORM_APPLE_UNICODE :: - * Used by Apple to indicate a Unicode character map and/or name entry. - * See @TT_APPLE_ID_XXX for corresponding `encoding_id' values. Note - * that name entries in this format are coded as big-endian UCS-2 - * character codes _only_. - * - * TT_PLATFORM_MACINTOSH :: - * Used by Apple to indicate a MacOS-specific charmap and/or name entry. - * See @TT_MAC_ID_XXX for corresponding `encoding_id' values. Note that - * most TrueType fonts contain an Apple roman charmap to be usable on - * MacOS systems (even if they contain a Microsoft charmap as well). - * - * TT_PLATFORM_ISO :: - * This value was used to specify ISO/IEC 10646 charmaps. It is however - * now deprecated. See @TT_ISO_ID_XXX for a list of corresponding - * `encoding_id' values. - * - * TT_PLATFORM_MICROSOFT :: - * Used by Microsoft to indicate Windows-specific charmaps. See - * @TT_MS_ID_XXX for a list of corresponding `encoding_id' values. - * Note that most fonts contain a Unicode charmap using - * (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS). - * - * TT_PLATFORM_CUSTOM :: - * Used to indicate application-specific charmaps. - * - * TT_PLATFORM_ADOBE :: - * This value isn't part of any font format specification, but is used - * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec - * structure. See @TT_ADOBE_ID_XXX. - */ - -#define TT_PLATFORM_APPLE_UNICODE 0 -#define TT_PLATFORM_MACINTOSH 1 -#define TT_PLATFORM_ISO 2 /* deprecated */ -#define TT_PLATFORM_MICROSOFT 3 -#define TT_PLATFORM_CUSTOM 4 -#define TT_PLATFORM_ADOBE 7 /* artificial */ - - - /*********************************************************************** - * - * @enum: - * TT_APPLE_ID_XXX - * - * @description: - * A list of valid values for the `encoding_id' for - * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries. - * - * @values: - * TT_APPLE_ID_DEFAULT :: - * Unicode version 1.0. - * - * TT_APPLE_ID_UNICODE_1_1 :: - * Unicode 1.1; specifies Hangul characters starting at U+34xx. - * - * TT_APPLE_ID_ISO_10646 :: - * Deprecated (identical to preceding). - * - * TT_APPLE_ID_UNICODE_2_0 :: - * Unicode 2.0 and beyond (UTF-16 BMP only). - * - * TT_APPLE_ID_UNICODE_32 :: - * Unicode 3.1 and beyond, using UTF-32. - * - * TT_APPLE_ID_VARIANT_SELECTOR :: - * From Adobe, not Apple. Not a normal cmap. Specifies variations - * on a real cmap. - */ - -#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */ -#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */ -#define TT_APPLE_ID_ISO_10646 2 /* deprecated */ -#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */ -#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */ -#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */ - - - /*********************************************************************** - * - * @enum: - * TT_MAC_ID_XXX - * - * @description: - * A list of valid values for the `encoding_id' for - * @TT_PLATFORM_MACINTOSH charmaps and name entries. - * - * @values: - * TT_MAC_ID_ROMAN :: - * TT_MAC_ID_JAPANESE :: - * TT_MAC_ID_TRADITIONAL_CHINESE :: - * TT_MAC_ID_KOREAN :: - * TT_MAC_ID_ARABIC :: - * TT_MAC_ID_HEBREW :: - * TT_MAC_ID_GREEK :: - * TT_MAC_ID_RUSSIAN :: - * TT_MAC_ID_RSYMBOL :: - * TT_MAC_ID_DEVANAGARI :: - * TT_MAC_ID_GURMUKHI :: - * TT_MAC_ID_GUJARATI :: - * TT_MAC_ID_ORIYA :: - * TT_MAC_ID_BENGALI :: - * TT_MAC_ID_TAMIL :: - * TT_MAC_ID_TELUGU :: - * TT_MAC_ID_KANNADA :: - * TT_MAC_ID_MALAYALAM :: - * TT_MAC_ID_SINHALESE :: - * TT_MAC_ID_BURMESE :: - * TT_MAC_ID_KHMER :: - * TT_MAC_ID_THAI :: - * TT_MAC_ID_LAOTIAN :: - * TT_MAC_ID_GEORGIAN :: - * TT_MAC_ID_ARMENIAN :: - * TT_MAC_ID_MALDIVIAN :: - * TT_MAC_ID_SIMPLIFIED_CHINESE :: - * TT_MAC_ID_TIBETAN :: - * TT_MAC_ID_MONGOLIAN :: - * TT_MAC_ID_GEEZ :: - * TT_MAC_ID_SLAVIC :: - * TT_MAC_ID_VIETNAMESE :: - * TT_MAC_ID_SINDHI :: - * TT_MAC_ID_UNINTERP :: - */ - -#define TT_MAC_ID_ROMAN 0 -#define TT_MAC_ID_JAPANESE 1 -#define TT_MAC_ID_TRADITIONAL_CHINESE 2 -#define TT_MAC_ID_KOREAN 3 -#define TT_MAC_ID_ARABIC 4 -#define TT_MAC_ID_HEBREW 5 -#define TT_MAC_ID_GREEK 6 -#define TT_MAC_ID_RUSSIAN 7 -#define TT_MAC_ID_RSYMBOL 8 -#define TT_MAC_ID_DEVANAGARI 9 -#define TT_MAC_ID_GURMUKHI 10 -#define TT_MAC_ID_GUJARATI 11 -#define TT_MAC_ID_ORIYA 12 -#define TT_MAC_ID_BENGALI 13 -#define TT_MAC_ID_TAMIL 14 -#define TT_MAC_ID_TELUGU 15 -#define TT_MAC_ID_KANNADA 16 -#define TT_MAC_ID_MALAYALAM 17 -#define TT_MAC_ID_SINHALESE 18 -#define TT_MAC_ID_BURMESE 19 -#define TT_MAC_ID_KHMER 20 -#define TT_MAC_ID_THAI 21 -#define TT_MAC_ID_LAOTIAN 22 -#define TT_MAC_ID_GEORGIAN 23 -#define TT_MAC_ID_ARMENIAN 24 -#define TT_MAC_ID_MALDIVIAN 25 -#define TT_MAC_ID_SIMPLIFIED_CHINESE 25 -#define TT_MAC_ID_TIBETAN 26 -#define TT_MAC_ID_MONGOLIAN 27 -#define TT_MAC_ID_GEEZ 28 -#define TT_MAC_ID_SLAVIC 29 -#define TT_MAC_ID_VIETNAMESE 30 -#define TT_MAC_ID_SINDHI 31 -#define TT_MAC_ID_UNINTERP 32 - - - /*********************************************************************** - * - * @enum: - * TT_ISO_ID_XXX - * - * @description: - * A list of valid values for the `encoding_id' for - * @TT_PLATFORM_ISO charmaps and name entries. - * - * Their use is now deprecated. - * - * @values: - * TT_ISO_ID_7BIT_ASCII :: - * ASCII. - * TT_ISO_ID_10646 :: - * ISO/10646. - * TT_ISO_ID_8859_1 :: - * Also known as Latin-1. - */ - -#define TT_ISO_ID_7BIT_ASCII 0 -#define TT_ISO_ID_10646 1 -#define TT_ISO_ID_8859_1 2 - - - /*********************************************************************** - * - * @enum: - * TT_MS_ID_XXX - * - * @description: - * A list of valid values for the `encoding_id' for - * @TT_PLATFORM_MICROSOFT charmaps and name entries. - * - * @values: - * TT_MS_ID_SYMBOL_CS :: - * Corresponds to Microsoft symbol encoding. See - * @FT_ENCODING_MS_SYMBOL. - * - * TT_MS_ID_UNICODE_CS :: - * Corresponds to a Microsoft WGL4 charmap, matching Unicode. See - * @FT_ENCODING_UNICODE. - * - * TT_MS_ID_SJIS :: - * Corresponds to SJIS Japanese encoding. See @FT_ENCODING_SJIS. - * - * TT_MS_ID_GB2312 :: - * Corresponds to Simplified Chinese as used in Mainland China. See - * @FT_ENCODING_GB2312. - * - * TT_MS_ID_BIG_5 :: - * Corresponds to Traditional Chinese as used in Taiwan and Hong Kong. - * See @FT_ENCODING_BIG5. - * - * TT_MS_ID_WANSUNG :: - * Corresponds to Korean Wansung encoding. See @FT_ENCODING_WANSUNG. - * - * TT_MS_ID_JOHAB :: - * Corresponds to Johab encoding. See @FT_ENCODING_JOHAB. - * - * TT_MS_ID_UCS_4 :: - * Corresponds to UCS-4 or UTF-32 charmaps. This has been added to - * the OpenType specification version 1.4 (mid-2001.) - */ - -#define TT_MS_ID_SYMBOL_CS 0 -#define TT_MS_ID_UNICODE_CS 1 -#define TT_MS_ID_SJIS 2 -#define TT_MS_ID_GB2312 3 -#define TT_MS_ID_BIG_5 4 -#define TT_MS_ID_WANSUNG 5 -#define TT_MS_ID_JOHAB 6 -#define TT_MS_ID_UCS_4 10 - - - /*********************************************************************** - * - * @enum: - * TT_ADOBE_ID_XXX - * - * @description: - * A list of valid values for the `encoding_id' for - * @TT_PLATFORM_ADOBE charmaps. This is a FreeType-specific extension! - * - * @values: - * TT_ADOBE_ID_STANDARD :: - * Adobe standard encoding. - * TT_ADOBE_ID_EXPERT :: - * Adobe expert encoding. - * TT_ADOBE_ID_CUSTOM :: - * Adobe custom encoding. - * TT_ADOBE_ID_LATIN_1 :: - * Adobe Latin~1 encoding. - */ - -#define TT_ADOBE_ID_STANDARD 0 -#define TT_ADOBE_ID_EXPERT 1 -#define TT_ADOBE_ID_CUSTOM 2 -#define TT_ADOBE_ID_LATIN_1 3 - - - /*************************************************************************/ - /* */ - /* Possible values of the language identifier field in the name records */ - /* of the TTF `name' table if the `platform' identifier code is */ - /* TT_PLATFORM_MACINTOSH. These values are also used as return values */ - /* for function @FT_Get_CMap_Language_ID. */ - /* */ - /* The canonical source for the Apple assigned Language ID's is at */ - /* */ - /* https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html */ - /* */ -#define TT_MAC_LANGID_ENGLISH 0 -#define TT_MAC_LANGID_FRENCH 1 -#define TT_MAC_LANGID_GERMAN 2 -#define TT_MAC_LANGID_ITALIAN 3 -#define TT_MAC_LANGID_DUTCH 4 -#define TT_MAC_LANGID_SWEDISH 5 -#define TT_MAC_LANGID_SPANISH 6 -#define TT_MAC_LANGID_DANISH 7 -#define TT_MAC_LANGID_PORTUGUESE 8 -#define TT_MAC_LANGID_NORWEGIAN 9 -#define TT_MAC_LANGID_HEBREW 10 -#define TT_MAC_LANGID_JAPANESE 11 -#define TT_MAC_LANGID_ARABIC 12 -#define TT_MAC_LANGID_FINNISH 13 -#define TT_MAC_LANGID_GREEK 14 -#define TT_MAC_LANGID_ICELANDIC 15 -#define TT_MAC_LANGID_MALTESE 16 -#define TT_MAC_LANGID_TURKISH 17 -#define TT_MAC_LANGID_CROATIAN 18 -#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19 -#define TT_MAC_LANGID_URDU 20 -#define TT_MAC_LANGID_HINDI 21 -#define TT_MAC_LANGID_THAI 22 -#define TT_MAC_LANGID_KOREAN 23 -#define TT_MAC_LANGID_LITHUANIAN 24 -#define TT_MAC_LANGID_POLISH 25 -#define TT_MAC_LANGID_HUNGARIAN 26 -#define TT_MAC_LANGID_ESTONIAN 27 -#define TT_MAC_LANGID_LETTISH 28 -#define TT_MAC_LANGID_SAAMISK 29 -#define TT_MAC_LANGID_FAEROESE 30 -#define TT_MAC_LANGID_FARSI 31 -#define TT_MAC_LANGID_RUSSIAN 32 -#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33 -#define TT_MAC_LANGID_FLEMISH 34 -#define TT_MAC_LANGID_IRISH 35 -#define TT_MAC_LANGID_ALBANIAN 36 -#define TT_MAC_LANGID_ROMANIAN 37 -#define TT_MAC_LANGID_CZECH 38 -#define TT_MAC_LANGID_SLOVAK 39 -#define TT_MAC_LANGID_SLOVENIAN 40 -#define TT_MAC_LANGID_YIDDISH 41 -#define TT_MAC_LANGID_SERBIAN 42 -#define TT_MAC_LANGID_MACEDONIAN 43 -#define TT_MAC_LANGID_BULGARIAN 44 -#define TT_MAC_LANGID_UKRAINIAN 45 -#define TT_MAC_LANGID_BYELORUSSIAN 46 -#define TT_MAC_LANGID_UZBEK 47 -#define TT_MAC_LANGID_KAZAKH 48 -#define TT_MAC_LANGID_AZERBAIJANI 49 -#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49 -#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50 -#define TT_MAC_LANGID_ARMENIAN 51 -#define TT_MAC_LANGID_GEORGIAN 52 -#define TT_MAC_LANGID_MOLDAVIAN 53 -#define TT_MAC_LANGID_KIRGHIZ 54 -#define TT_MAC_LANGID_TAJIKI 55 -#define TT_MAC_LANGID_TURKMEN 56 -#define TT_MAC_LANGID_MONGOLIAN 57 -#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57 -#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58 -#define TT_MAC_LANGID_PASHTO 59 -#define TT_MAC_LANGID_KURDISH 60 -#define TT_MAC_LANGID_KASHMIRI 61 -#define TT_MAC_LANGID_SINDHI 62 -#define TT_MAC_LANGID_TIBETAN 63 -#define TT_MAC_LANGID_NEPALI 64 -#define TT_MAC_LANGID_SANSKRIT 65 -#define TT_MAC_LANGID_MARATHI 66 -#define TT_MAC_LANGID_BENGALI 67 -#define TT_MAC_LANGID_ASSAMESE 68 -#define TT_MAC_LANGID_GUJARATI 69 -#define TT_MAC_LANGID_PUNJABI 70 -#define TT_MAC_LANGID_ORIYA 71 -#define TT_MAC_LANGID_MALAYALAM 72 -#define TT_MAC_LANGID_KANNADA 73 -#define TT_MAC_LANGID_TAMIL 74 -#define TT_MAC_LANGID_TELUGU 75 -#define TT_MAC_LANGID_SINHALESE 76 -#define TT_MAC_LANGID_BURMESE 77 -#define TT_MAC_LANGID_KHMER 78 -#define TT_MAC_LANGID_LAO 79 -#define TT_MAC_LANGID_VIETNAMESE 80 -#define TT_MAC_LANGID_INDONESIAN 81 -#define TT_MAC_LANGID_TAGALOG 82 -#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83 -#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84 -#define TT_MAC_LANGID_AMHARIC 85 -#define TT_MAC_LANGID_TIGRINYA 86 -#define TT_MAC_LANGID_GALLA 87 -#define TT_MAC_LANGID_SOMALI 88 -#define TT_MAC_LANGID_SWAHILI 89 -#define TT_MAC_LANGID_RUANDA 90 -#define TT_MAC_LANGID_RUNDI 91 -#define TT_MAC_LANGID_CHEWA 92 -#define TT_MAC_LANGID_MALAGASY 93 -#define TT_MAC_LANGID_ESPERANTO 94 -#define TT_MAC_LANGID_WELSH 128 -#define TT_MAC_LANGID_BASQUE 129 -#define TT_MAC_LANGID_CATALAN 130 -#define TT_MAC_LANGID_LATIN 131 -#define TT_MAC_LANGID_QUECHUA 132 -#define TT_MAC_LANGID_GUARANI 133 -#define TT_MAC_LANGID_AYMARA 134 -#define TT_MAC_LANGID_TATAR 135 -#define TT_MAC_LANGID_UIGHUR 136 -#define TT_MAC_LANGID_DZONGKHA 137 -#define TT_MAC_LANGID_JAVANESE 138 -#define TT_MAC_LANGID_SUNDANESE 139 - - -#if 0 /* these seem to be errors that have been dropped */ - -#define TT_MAC_LANGID_SCOTTISH_GAELIC 140 -#define TT_MAC_LANGID_IRISH_GAELIC 141 - -#endif - - - /* The following codes are new as of 2000-03-10 */ -#define TT_MAC_LANGID_GALICIAN 140 -#define TT_MAC_LANGID_AFRIKAANS 141 -#define TT_MAC_LANGID_BRETON 142 -#define TT_MAC_LANGID_INUKTITUT 143 -#define TT_MAC_LANGID_SCOTTISH_GAELIC 144 -#define TT_MAC_LANGID_MANX_GAELIC 145 -#define TT_MAC_LANGID_IRISH_GAELIC 146 -#define TT_MAC_LANGID_TONGAN 147 -#define TT_MAC_LANGID_GREEK_POLYTONIC 148 -#define TT_MAC_LANGID_GREELANDIC 149 -#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150 - - - /*************************************************************************/ - /* */ - /* Possible values of the language identifier field in the name records */ - /* of the TTF `name' table if the `platform' identifier code is */ - /* TT_PLATFORM_MICROSOFT. */ - /* */ - /* The canonical source for the MS assigned LCIDs is */ - /* */ - /* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */ - /* */ - -#define TT_MS_LANGID_ARABIC_GENERAL 0x0001 -#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 -#define TT_MS_LANGID_ARABIC_IRAQ 0x0801 -#define TT_MS_LANGID_ARABIC_EGYPT 0x0c01 -#define TT_MS_LANGID_ARABIC_LIBYA 0x1001 -#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401 -#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801 -#define TT_MS_LANGID_ARABIC_TUNISIA 0x1c01 -#define TT_MS_LANGID_ARABIC_OMAN 0x2001 -#define TT_MS_LANGID_ARABIC_YEMEN 0x2401 -#define TT_MS_LANGID_ARABIC_SYRIA 0x2801 -#define TT_MS_LANGID_ARABIC_JORDAN 0x2c01 -#define TT_MS_LANGID_ARABIC_LEBANON 0x3001 -#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401 -#define TT_MS_LANGID_ARABIC_UAE 0x3801 -#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3c01 -#define TT_MS_LANGID_ARABIC_QATAR 0x4001 -#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402 -#define TT_MS_LANGID_CATALAN_SPAIN 0x0403 -#define TT_MS_LANGID_CHINESE_GENERAL 0x0004 -#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404 -#define TT_MS_LANGID_CHINESE_PRC 0x0804 -#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04 -#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004 - -#if 1 /* this looks like the correct value */ -#define TT_MS_LANGID_CHINESE_MACAU 0x1404 -#else /* but beware, Microsoft may change its mind... - the most recent Word reference has the following: */ -#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG -#endif - -#if 0 /* used only with .NET `cultures'; commented out */ -#define TT_MS_LANGID_CHINESE_TRADITIONAL 0x7C04 -#endif - -#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405 -#define TT_MS_LANGID_DANISH_DENMARK 0x0406 -#define TT_MS_LANGID_GERMAN_GERMANY 0x0407 -#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807 -#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0c07 -#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007 -#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407 -#define TT_MS_LANGID_GREEK_GREECE 0x0408 - - /* don't ask what this one means... It is commented out currently. */ -#if 0 -#define TT_MS_LANGID_GREEK_GREECE2 0x2008 -#endif - -#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 -#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409 -#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809 -#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09 -#define TT_MS_LANGID_ENGLISH_CANADA 0x1009 -#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409 -#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809 -#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1c09 -#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009 -#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409 -#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809 -#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09 -#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009 -#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409 -#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809 -#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09 -#define TT_MS_LANGID_ENGLISH_INDIA 0x4009 -#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 -#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 -#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a -#define TT_MS_LANGID_SPANISH_MEXICO 0x080a -#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a -#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100a -#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140a -#define TT_MS_LANGID_SPANISH_PANAMA 0x180a -#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1c0a -#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200a -#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240a -#define TT_MS_LANGID_SPANISH_PERU 0x280a -#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2c0a -#define TT_MS_LANGID_SPANISH_ECUADOR 0x300a -#define TT_MS_LANGID_SPANISH_CHILE 0x340a -#define TT_MS_LANGID_SPANISH_URUGUAY 0x380a -#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3c0a -#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400a -#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440a -#define TT_MS_LANGID_SPANISH_HONDURAS 0x480a -#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a -#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a -#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a - /* The following ID blatantly violate MS specs by using a */ - /* sublanguage > 0x1F. */ -#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40aU -#define TT_MS_LANGID_FINNISH_FINLAND 0x040b -#define TT_MS_LANGID_FRENCH_FRANCE 0x040c -#define TT_MS_LANGID_FRENCH_BELGIUM 0x080c -#define TT_MS_LANGID_FRENCH_CANADA 0x0c0c -#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c -#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c -#define TT_MS_LANGID_FRENCH_MONACO 0x180c -#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c -#define TT_MS_LANGID_FRENCH_REUNION 0x200c -#define TT_MS_LANGID_FRENCH_CONGO 0x240c - /* which was formerly: */ -#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO -#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c -#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c -#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300c -#define TT_MS_LANGID_FRENCH_MALI 0x340c -#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c -#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c - /* and another violation of the spec (see 0xE40aU) */ -#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40cU -#define TT_MS_LANGID_HEBREW_ISRAEL 0x040d -#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e -#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f -#define TT_MS_LANGID_ITALIAN_ITALY 0x0410 -#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810 -#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411 -#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412 -#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812 -#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413 -#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813 -#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414 -#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814 -#define TT_MS_LANGID_POLISH_POLAND 0x0415 -#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416 -#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816 -#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417 -#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418 -#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818 -#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419 -#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819 -#define TT_MS_LANGID_CROATIAN_CROATIA 0x041a -#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a -#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a - -#if 0 /* this used to be this value, but it looks like we were wrong */ -#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101a -#else /* current sources say */ -#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101a -#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141a - /* and XPsp2 Platform SDK added (2004-07-26) */ - /* Names are shortened to be significant within 40 chars. */ -#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181a -#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x181a -#endif - -#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b -#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c -#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d -#define TT_MS_LANGID_SWEDISH_FINLAND 0x081d -#define TT_MS_LANGID_THAI_THAILAND 0x041e -#define TT_MS_LANGID_TURKISH_TURKEY 0x041f -#define TT_MS_LANGID_URDU_PAKISTAN 0x0420 -#define TT_MS_LANGID_URDU_INDIA 0x0820 -#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421 -#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422 -#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423 -#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424 -#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425 -#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426 -#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427 -#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827 -#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 -#define TT_MS_LANGID_FARSI_IRAN 0x0429 -#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a -#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b -#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042c -#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082c -#define TT_MS_LANGID_BASQUE_SPAIN 0x042d -#define TT_MS_LANGID_SORBIAN_GERMANY 0x042e -#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042f -#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430 -#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431 -#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432 -#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433 -#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434 -#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435 -#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436 -#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437 -#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438 -#define TT_MS_LANGID_HINDI_INDIA 0x0439 -#define TT_MS_LANGID_MALTESE_MALTA 0x043a - /* Added by XPsp2 Platform SDK (2004-07-26) */ -#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043b -#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083b -#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3b -#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103b -#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143b -#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183b -#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3b -#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203b -#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243b - /* ... and we also keep our old identifier... */ -#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b - -#if 0 /* this seems to be a previous inversion */ -#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c -#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c -#else -#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c -#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c -#endif - -#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d -#define TT_MS_LANGID_MALAY_MALAYSIA 0x043e -#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e -#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f -#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440 - /* alias declared in Windows 2000 */ -#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ - TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN - -#define TT_MS_LANGID_SWAHILI_KENYA 0x0441 -#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 -#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443 -#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843 -#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444 -#define TT_MS_LANGID_BENGALI_INDIA 0x0445 -#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 -#define TT_MS_LANGID_PUNJABI_INDIA 0x0446 -#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 -#define TT_MS_LANGID_GUJARATI_INDIA 0x0447 -#define TT_MS_LANGID_ORIYA_INDIA 0x0448 -#define TT_MS_LANGID_TAMIL_INDIA 0x0449 -#define TT_MS_LANGID_TELUGU_INDIA 0x044a -#define TT_MS_LANGID_KANNADA_INDIA 0x044b -#define TT_MS_LANGID_MALAYALAM_INDIA 0x044c -#define TT_MS_LANGID_ASSAMESE_INDIA 0x044d -#define TT_MS_LANGID_MARATHI_INDIA 0x044e -#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f -#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450 -#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850 -#define TT_MS_LANGID_TIBETAN_CHINA 0x0451 - /* Don't use the next constant! It has */ - /* (1) the wrong spelling (Dzonghka) */ - /* (2) Microsoft doesn't officially define it -- */ - /* at least it is not in the List of Local */ - /* ID Values. */ - /* (3) Dzongkha is not the same language as */ - /* Tibetan, so merging it is wrong anyway. */ - /* */ - /* TT_MS_LANGID_TIBETAN_BHUTAN is correct, BTW. */ -#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851 - -#if 0 - /* the following used to be defined */ -#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451 - /* ... but it was changed; */ -#else - /* So we will continue to #define it, but with the correct value */ -#define TT_MS_LANGID_TIBETAN_BHUTAN TT_MS_LANGID_DZONGHKA_BHUTAN -#endif - -#define TT_MS_LANGID_WELSH_WALES 0x0452 -#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453 -#define TT_MS_LANGID_LAO_LAOS 0x0454 -#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455 -#define TT_MS_LANGID_GALICIAN_SPAIN 0x0456 -#define TT_MS_LANGID_KONKANI_INDIA 0x0457 -#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458 -#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459 -#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859 - /* Missing a LCID for Sindhi in Devanagari script */ -#define TT_MS_LANGID_SYRIAC_SYRIA 0x045a -#define TT_MS_LANGID_SINHALESE_SRI_LANKA 0x045b -#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045c -#define TT_MS_LANGID_INUKTITUT_CANADA 0x045d -#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045e -#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045f -#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN 0x085f - /* Missing a LCID for Tifinagh script */ -#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460 - /* Spelled this way by XPsp2 Platform SDK (2004-07-26) */ - /* script is yet unclear... might be Arabic, Nagari or Sharada */ -#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860 - /* ... and aliased (by MS) for compatibility reasons. */ -#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA -#define TT_MS_LANGID_NEPALI_NEPAL 0x0461 -#define TT_MS_LANGID_NEPALI_INDIA 0x0861 -#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 -#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463 -#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464 -#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465 - /* alias declared in Windows 2000 */ -#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES -#define TT_MS_LANGID_EDO_NIGERIA 0x0466 -#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467 -#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468 -#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469 -#define TT_MS_LANGID_YORUBA_NIGERIA 0x046a -#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046b -#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086b -#define TT_MS_LANGID_QUECHUA_PERU 0x0c6b -#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA 0x046c - /* Also spelled by XPsp2 Platform SDK (2004-07-26) */ -#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \ - TT_MS_LANGID_SEPEDI_SOUTH_AFRICA - /* language codes 0x046d, 0x046e and 0x046f are (still) unknown. */ -#define TT_MS_LANGID_IGBO_NIGERIA 0x0470 -#define TT_MS_LANGID_KANURI_NIGERIA 0x0471 -#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 -#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 -#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 - /* also spelled in the `Passport SDK' list as: */ -#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA -#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474 -#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475 -#define TT_MS_LANGID_LATIN 0x0476 -#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477 - /* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */ - /* not written (but OTOH the peculiar writing system is worth */ - /* studying). */ -#define TT_MS_LANGID_YI_CHINA 0x0478 -#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479 - /* language codes from 0x047a to 0x047f are (still) unknown. */ -#define TT_MS_LANGID_UIGHUR_CHINA 0x0480 -#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481 - -#if 0 /* not deemed useful for fonts */ -#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE 0x04ff -#endif - - - /*************************************************************************/ - /* */ - /* Possible values of the `name' identifier field in the name records of */ - /* the TTF `name' table. These values are platform independent. */ - /* */ -#define TT_NAME_ID_COPYRIGHT 0 -#define TT_NAME_ID_FONT_FAMILY 1 -#define TT_NAME_ID_FONT_SUBFAMILY 2 -#define TT_NAME_ID_UNIQUE_ID 3 -#define TT_NAME_ID_FULL_NAME 4 -#define TT_NAME_ID_VERSION_STRING 5 -#define TT_NAME_ID_PS_NAME 6 -#define TT_NAME_ID_TRADEMARK 7 - - /* the following values are from the OpenType spec */ -#define TT_NAME_ID_MANUFACTURER 8 -#define TT_NAME_ID_DESIGNER 9 -#define TT_NAME_ID_DESCRIPTION 10 -#define TT_NAME_ID_VENDOR_URL 11 -#define TT_NAME_ID_DESIGNER_URL 12 -#define TT_NAME_ID_LICENSE 13 -#define TT_NAME_ID_LICENSE_URL 14 - /* number 15 is reserved */ -#define TT_NAME_ID_PREFERRED_FAMILY 16 -#define TT_NAME_ID_PREFERRED_SUBFAMILY 17 -#define TT_NAME_ID_MAC_FULL_NAME 18 - - /* The following code is new as of 2000-01-21 */ -#define TT_NAME_ID_SAMPLE_TEXT 19 - - /* This is new in OpenType 1.3 */ -#define TT_NAME_ID_CID_FINDFONT_NAME 20 - - /* This is new in OpenType 1.5 */ -#define TT_NAME_ID_WWS_FAMILY 21 -#define TT_NAME_ID_WWS_SUBFAMILY 22 - - - /*************************************************************************/ - /* */ - /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table. */ - /* */ - /* Updated 08-Nov-2008. */ - /* */ - - /* Bit 0 Basic Latin */ -#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */ - /* Bit 1 C1 Controls and Latin-1 Supplement */ -#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */ - /* Bit 2 Latin Extended-A */ -#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */ - /* Bit 3 Latin Extended-B */ -#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */ - /* Bit 4 IPA Extensions */ - /* Phonetic Extensions */ - /* Phonetic Extensions Supplement */ -#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */ - /* U+1D00-U+1D7F */ - /* U+1D80-U+1DBF */ - /* Bit 5 Spacing Modifier Letters */ - /* Modifier Tone Letters */ -#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */ - /* U+A700-U+A71F */ - /* Bit 6 Combining Diacritical Marks */ - /* Combining Diacritical Marks Supplement */ -#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */ - /* U+1DC0-U+1DFF */ - /* Bit 7 Greek and Coptic */ -#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */ - /* Bit 8 Coptic */ -#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */ - /* Bit 9 Cyrillic */ - /* Cyrillic Supplement */ - /* Cyrillic Extended-A */ - /* Cyrillic Extended-B */ -#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */ - /* U+0500-U+052F */ - /* U+2DE0-U+2DFF */ - /* U+A640-U+A69F */ - /* Bit 10 Armenian */ -#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */ - /* Bit 11 Hebrew */ -#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */ - /* Bit 12 Vai */ -#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */ - /* Bit 13 Arabic */ - /* Arabic Supplement */ -#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */ - /* U+0750-U+077F */ - /* Bit 14 NKo */ -#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */ - /* Bit 15 Devanagari */ -#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */ - /* Bit 16 Bengali */ -#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */ - /* Bit 17 Gurmukhi */ -#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */ - /* Bit 18 Gujarati */ -#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */ - /* Bit 19 Oriya */ -#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */ - /* Bit 20 Tamil */ -#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */ - /* Bit 21 Telugu */ -#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */ - /* Bit 22 Kannada */ -#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */ - /* Bit 23 Malayalam */ -#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */ - /* Bit 24 Thai */ -#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */ - /* Bit 25 Lao */ -#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */ - /* Bit 26 Georgian */ - /* Georgian Supplement */ -#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */ - /* U+2D00-U+2D2F */ - /* Bit 27 Balinese */ -#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */ - /* Bit 28 Hangul Jamo */ -#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */ - /* Bit 29 Latin Extended Additional */ - /* Latin Extended-C */ - /* Latin Extended-D */ -#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */ - /* U+2C60-U+2C7F */ - /* U+A720-U+A7FF */ - /* Bit 30 Greek Extended */ -#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */ - /* Bit 31 General Punctuation */ - /* Supplemental Punctuation */ -#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */ - /* U+2E00-U+2E7F */ - /* Bit 32 Superscripts And Subscripts */ -#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */ - /* Bit 33 Currency Symbols */ -#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */ - /* Bit 34 Combining Diacritical Marks For Symbols */ -#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */ - /* Bit 35 Letterlike Symbols */ -#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */ - /* Bit 36 Number Forms */ -#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */ - /* Bit 37 Arrows */ - /* Supplemental Arrows-A */ - /* Supplemental Arrows-B */ - /* Miscellaneous Symbols and Arrows */ -#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */ - /* U+27F0-U+27FF */ - /* U+2900-U+297F */ - /* U+2B00-U+2BFF */ - /* Bit 38 Mathematical Operators */ - /* Supplemental Mathematical Operators */ - /* Miscellaneous Mathematical Symbols-A */ - /* Miscellaneous Mathematical Symbols-B */ -#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */ - /* U+2A00-U+2AFF */ - /* U+27C0-U+27EF */ - /* U+2980-U+29FF */ - /* Bit 39 Miscellaneous Technical */ -#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */ - /* Bit 40 Control Pictures */ -#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */ - /* Bit 41 Optical Character Recognition */ -#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */ - /* Bit 42 Enclosed Alphanumerics */ -#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */ - /* Bit 43 Box Drawing */ -#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */ - /* Bit 44 Block Elements */ -#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */ - /* Bit 45 Geometric Shapes */ -#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */ - /* Bit 46 Miscellaneous Symbols */ -#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */ - /* Bit 47 Dingbats */ -#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */ - /* Bit 48 CJK Symbols and Punctuation */ -#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */ - /* Bit 49 Hiragana */ -#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */ - /* Bit 50 Katakana */ - /* Katakana Phonetic Extensions */ -#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */ - /* U+31F0-U+31FF */ - /* Bit 51 Bopomofo */ - /* Bopomofo Extended */ -#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */ - /* U+31A0-U+31BF */ - /* Bit 52 Hangul Compatibility Jamo */ -#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */ - /* Bit 53 Phags-Pa */ -#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */ -#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */ -#define TT_UCR_PHAGSPA - /* Bit 54 Enclosed CJK Letters and Months */ -#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */ - /* Bit 55 CJK Compatibility */ -#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */ - /* Bit 56 Hangul Syllables */ -#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */ - /* Bit 57 High Surrogates */ - /* High Private Use Surrogates */ - /* Low Surrogates */ - /* */ - /* According to OpenType specs v.1.3+, */ - /* setting bit 57 implies that there is */ - /* at least one codepoint beyond the */ - /* Basic Multilingual Plane that is */ - /* supported by this font. So it really */ - /* means >= U+10000 */ -#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */ - /* U+DB80-U+DBFF */ - /* U+DC00-U+DFFF */ -#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES - /* Bit 58 Phoenician */ -#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/ - /* Bit 59 CJK Unified Ideographs */ - /* CJK Radicals Supplement */ - /* Kangxi Radicals */ - /* Ideographic Description Characters */ - /* CJK Unified Ideographs Extension A */ - /* CJK Unified Ideographs Extension B */ - /* Kanbun */ -#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */ - /* U+2E80-U+2EFF */ - /* U+2F00-U+2FDF */ - /* U+2FF0-U+2FFF */ - /* U+3400-U+4DB5 */ - /*U+20000-U+2A6DF*/ - /* U+3190-U+319F */ - /* Bit 60 Private Use */ -#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */ - /* Bit 61 CJK Strokes */ - /* CJK Compatibility Ideographs */ - /* CJK Compatibility Ideographs Supplement */ -#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */ - /* U+F900-U+FAFF */ - /*U+2F800-U+2FA1F*/ - /* Bit 62 Alphabetic Presentation Forms */ -#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */ - /* Bit 63 Arabic Presentation Forms-A */ -#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FDFF */ - /* Bit 64 Combining Half Marks */ -#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */ - /* Bit 65 Vertical forms */ - /* CJK Compatibility Forms */ -#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */ - /* U+FE30-U+FE4F */ - /* Bit 66 Small Form Variants */ -#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */ - /* Bit 67 Arabic Presentation Forms-B */ -#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFE */ - /* Bit 68 Halfwidth and Fullwidth Forms */ -#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */ - /* Bit 69 Specials */ -#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */ - /* Bit 70 Tibetan */ -#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */ - /* Bit 71 Syriac */ -#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */ - /* Bit 72 Thaana */ -#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */ - /* Bit 73 Sinhala */ -#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */ - /* Bit 74 Myanmar */ -#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */ - /* Bit 75 Ethiopic */ - /* Ethiopic Supplement */ - /* Ethiopic Extended */ -#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */ - /* U+1380-U+139F */ - /* U+2D80-U+2DDF */ - /* Bit 76 Cherokee */ -#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */ - /* Bit 77 Unified Canadian Aboriginal Syllabics */ -#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */ - /* Bit 78 Ogham */ -#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */ - /* Bit 79 Runic */ -#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */ - /* Bit 80 Khmer */ - /* Khmer Symbols */ -#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */ - /* U+19E0-U+19FF */ - /* Bit 81 Mongolian */ -#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */ - /* Bit 82 Braille Patterns */ -#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */ - /* Bit 83 Yi Syllables */ - /* Yi Radicals */ -#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */ - /* U+A490-U+A4CF */ - /* Bit 84 Tagalog */ - /* Hanunoo */ - /* Buhid */ - /* Tagbanwa */ -#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */ - /* U+1720-U+173F */ - /* U+1740-U+175F */ - /* U+1760-U+177F */ - /* Bit 85 Old Italic */ -#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/ - /* Bit 86 Gothic */ -#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/ - /* Bit 87 Deseret */ -#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/ - /* Bit 88 Byzantine Musical Symbols */ - /* Musical Symbols */ - /* Ancient Greek Musical Notation */ -#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/ - /*U+1D100-U+1D1FF*/ - /*U+1D200-U+1D24F*/ - /* Bit 89 Mathematical Alphanumeric Symbols */ -#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/ - /* Bit 90 Private Use (plane 15) */ - /* Private Use (plane 16) */ -#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/ - /*U+100000-U+10FFFD*/ - /* Bit 91 Variation Selectors */ - /* Variation Selectors Supplement */ -#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */ - /*U+E0100-U+E01EF*/ - /* Bit 92 Tags */ -#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/ - /* Bit 93 Limbu */ -#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */ - /* Bit 94 Tai Le */ -#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */ - /* Bit 95 New Tai Lue */ -#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */ - /* Bit 96 Buginese */ -#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */ - /* Bit 97 Glagolitic */ -#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */ - /* Bit 98 Tifinagh */ -#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */ - /* Bit 99 Yijing Hexagram Symbols */ -#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */ - /* Bit 100 Syloti Nagri */ -#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */ - /* Bit 101 Linear B Syllabary */ - /* Linear B Ideograms */ - /* Aegean Numbers */ -#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/ - /*U+10080-U+100FF*/ - /*U+10100-U+1013F*/ - /* Bit 102 Ancient Greek Numbers */ -#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/ - /* Bit 103 Ugaritic */ -#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/ - /* Bit 104 Old Persian */ -#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/ - /* Bit 105 Shavian */ -#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/ - /* Bit 106 Osmanya */ -#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/ - /* Bit 107 Cypriot Syllabary */ -#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/ - /* Bit 108 Kharoshthi */ -#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/ - /* Bit 109 Tai Xuan Jing Symbols */ -#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/ - /* Bit 110 Cuneiform */ - /* Cuneiform Numbers and Punctuation */ -#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/ - /*U+12400-U+1247F*/ - /* Bit 111 Counting Rod Numerals */ -#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/ - /* Bit 112 Sundanese */ -#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */ - /* Bit 113 Lepcha */ -#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */ - /* Bit 114 Ol Chiki */ -#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */ - /* Bit 115 Saurashtra */ -#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */ - /* Bit 116 Kayah Li */ -#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */ - /* Bit 117 Rejang */ -#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */ - /* Bit 118 Cham */ -#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */ - /* Bit 119 Ancient Symbols */ -#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/ - /* Bit 120 Phaistos Disc */ -#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/ - /* Bit 121 Carian */ - /* Lycian */ - /* Lydian */ -#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/ - /*U+10280-U+1029F*/ - /*U+10920-U+1093F*/ - /* Bit 122 Domino Tiles */ - /* Mahjong Tiles */ -#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/ - /*U+1F000-U+1F02F*/ - /* Bit 123-127 Reserved for process-internal usage */ - - - /*************************************************************************/ - /* */ - /* Some compilers have a very limited length of identifiers. */ - /* */ -#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ ) -#define HAVE_LIMIT_ON_IDENTS -#endif - - -#ifndef HAVE_LIMIT_ON_IDENTS - - - /*************************************************************************/ - /* */ - /* Here some alias #defines in order to be clearer. */ - /* */ - /* These are not always #defined to stay within the 31~character limit, */ - /* which some compilers have. */ - /* */ - /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern */ - /* Borland compilers (read: from BC++ 3.1 on) can increase this limit. */ - /* If you get a warning with such a compiler, use the -i40 switch. */ - /* */ -#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \ - TT_UCR_ARABIC_PRESENTATIONS_A -#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \ - TT_UCR_ARABIC_PRESENTATIONS_B - -#define TT_UCR_COMBINING_DIACRITICAL_MARKS \ - TT_UCR_COMBINING_DIACRITICS -#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \ - TT_UCR_COMBINING_DIACRITICS_SYMB - - -#endif /* !HAVE_LIMIT_ON_IDENTS */ - - -FT_END_HEADER - -#endif /* __TTNAMEID_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/tttables.h b/GLideN64/src/inc/freetype/include/tttables.h deleted file mode 100644 index bb49dc0..0000000 --- a/GLideN64/src/inc/freetype/include/tttables.h +++ /dev/null @@ -1,787 +0,0 @@ -/***************************************************************************/ -/* */ -/* tttables.h */ -/* */ -/* Basic SFNT/TrueType tables definitions and interface */ -/* (specification only). */ -/* */ -/* Copyright 1996-2005, 2008-2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __TTTABLES_H__ -#define __TTTABLES_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* truetype_tables */ - /* */ - /* <Title> */ - /* TrueType Tables */ - /* */ - /* <Abstract> */ - /* TrueType specific table types and functions. */ - /* */ - /* <Description> */ - /* This section contains the definition of TrueType-specific tables */ - /* as well as some routines used to access and process them. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Header */ - /* */ - /* <Description> */ - /* A structure used to model a TrueType font header table. All */ - /* fields follow the TrueType specification. */ - /* */ - typedef struct TT_Header_ - { - FT_Fixed Table_Version; - FT_Fixed Font_Revision; - - FT_Long CheckSum_Adjust; - FT_Long Magic_Number; - - FT_UShort Flags; - FT_UShort Units_Per_EM; - - FT_Long Created [2]; - FT_Long Modified[2]; - - FT_Short xMin; - FT_Short yMin; - FT_Short xMax; - FT_Short yMax; - - FT_UShort Mac_Style; - FT_UShort Lowest_Rec_PPEM; - - FT_Short Font_Direction; - FT_Short Index_To_Loc_Format; - FT_Short Glyph_Data_Format; - - } TT_Header; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_HoriHeader */ - /* */ - /* <Description> */ - /* A structure used to model a TrueType horizontal header, the `hhea' */ - /* table, as well as the corresponding horizontal metrics table, */ - /* i.e., the `hmtx' table. */ - /* */ - /* <Fields> */ - /* Version :: The table version. */ - /* */ - /* Ascender :: The font's ascender, i.e., the distance */ - /* from the baseline to the top-most of all */ - /* glyph points found in the font. */ - /* */ - /* This value is invalid in many fonts, as */ - /* it is usually set by the font designer, */ - /* and often reflects only a portion of the */ - /* glyphs found in the font (maybe ASCII). */ - /* */ - /* You should use the `sTypoAscender' field */ - /* of the OS/2 table instead if you want */ - /* the correct one. */ - /* */ - /* Descender :: The font's descender, i.e., the distance */ - /* from the baseline to the bottom-most of */ - /* all glyph points found in the font. It */ - /* is negative. */ - /* */ - /* This value is invalid in many fonts, as */ - /* it is usually set by the font designer, */ - /* and often reflects only a portion of the */ - /* glyphs found in the font (maybe ASCII). */ - /* */ - /* You should use the `sTypoDescender' */ - /* field of the OS/2 table instead if you */ - /* want the correct one. */ - /* */ - /* Line_Gap :: The font's line gap, i.e., the distance */ - /* to add to the ascender and descender to */ - /* get the BTB, i.e., the */ - /* baseline-to-baseline distance for the */ - /* font. */ - /* */ - /* advance_Width_Max :: This field is the maximum of all advance */ - /* widths found in the font. It can be */ - /* used to compute the maximum width of an */ - /* arbitrary string of text. */ - /* */ - /* min_Left_Side_Bearing :: The minimum left side bearing of all */ - /* glyphs within the font. */ - /* */ - /* min_Right_Side_Bearing :: The minimum right side bearing of all */ - /* glyphs within the font. */ - /* */ - /* xMax_Extent :: The maximum horizontal extent (i.e., the */ - /* `width' of a glyph's bounding box) for */ - /* all glyphs in the font. */ - /* */ - /* caret_Slope_Rise :: The rise coefficient of the cursor's */ - /* slope of the cursor (slope=rise/run). */ - /* */ - /* caret_Slope_Run :: The run coefficient of the cursor's */ - /* slope. */ - /* */ - /* Reserved :: 8~reserved bytes. */ - /* */ - /* metric_Data_Format :: Always~0. */ - /* */ - /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ - /* table -- this value can be smaller than */ - /* the total number of glyphs in the font. */ - /* */ - /* long_metrics :: A pointer into the `hmtx' table. */ - /* */ - /* short_metrics :: A pointer into the `hmtx' table. */ - /* */ - /* <Note> */ - /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ - /* be identical except for the names of their fields, */ - /* which are different. */ - /* */ - /* This ensures that a single function in the `ttload' */ - /* module is able to read both the horizontal and vertical */ - /* headers. */ - /* */ - typedef struct TT_HoriHeader_ - { - FT_Fixed Version; - FT_Short Ascender; - FT_Short Descender; - FT_Short Line_Gap; - - FT_UShort advance_Width_Max; /* advance width maximum */ - - FT_Short min_Left_Side_Bearing; /* minimum left-sb */ - FT_Short min_Right_Side_Bearing; /* minimum right-sb */ - FT_Short xMax_Extent; /* xmax extents */ - FT_Short caret_Slope_Rise; - FT_Short caret_Slope_Run; - FT_Short caret_Offset; - - FT_Short Reserved[4]; - - FT_Short metric_Data_Format; - FT_UShort number_Of_HMetrics; - - /* The following fields are not defined by the TrueType specification */ - /* but they are used to connect the metrics header to the relevant */ - /* `HMTX' table. */ - - void* long_metrics; - void* short_metrics; - - } TT_HoriHeader; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_VertHeader */ - /* */ - /* <Description> */ - /* A structure used to model a TrueType vertical header, the `vhea' */ - /* table, as well as the corresponding vertical metrics table, i.e., */ - /* the `vmtx' table. */ - /* */ - /* <Fields> */ - /* Version :: The table version. */ - /* */ - /* Ascender :: The font's ascender, i.e., the distance */ - /* from the baseline to the top-most of */ - /* all glyph points found in the font. */ - /* */ - /* This value is invalid in many fonts, as */ - /* it is usually set by the font designer, */ - /* and often reflects only a portion of */ - /* the glyphs found in the font (maybe */ - /* ASCII). */ - /* */ - /* You should use the `sTypoAscender' */ - /* field of the OS/2 table instead if you */ - /* want the correct one. */ - /* */ - /* Descender :: The font's descender, i.e., the */ - /* distance from the baseline to the */ - /* bottom-most of all glyph points found */ - /* in the font. It is negative. */ - /* */ - /* This value is invalid in many fonts, as */ - /* it is usually set by the font designer, */ - /* and often reflects only a portion of */ - /* the glyphs found in the font (maybe */ - /* ASCII). */ - /* */ - /* You should use the `sTypoDescender' */ - /* field of the OS/2 table instead if you */ - /* want the correct one. */ - /* */ - /* Line_Gap :: The font's line gap, i.e., the distance */ - /* to add to the ascender and descender to */ - /* get the BTB, i.e., the */ - /* baseline-to-baseline distance for the */ - /* font. */ - /* */ - /* advance_Height_Max :: This field is the maximum of all */ - /* advance heights found in the font. It */ - /* can be used to compute the maximum */ - /* height of an arbitrary string of text. */ - /* */ - /* min_Top_Side_Bearing :: The minimum top side bearing of all */ - /* glyphs within the font. */ - /* */ - /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ - /* glyphs within the font. */ - /* */ - /* yMax_Extent :: The maximum vertical extent (i.e., the */ - /* `height' of a glyph's bounding box) for */ - /* all glyphs in the font. */ - /* */ - /* caret_Slope_Rise :: The rise coefficient of the cursor's */ - /* slope of the cursor (slope=rise/run). */ - /* */ - /* caret_Slope_Run :: The run coefficient of the cursor's */ - /* slope. */ - /* */ - /* caret_Offset :: The cursor's offset for slanted fonts. */ - /* This value is `reserved' in vmtx */ - /* version 1.0. */ - /* */ - /* Reserved :: 8~reserved bytes. */ - /* */ - /* metric_Data_Format :: Always~0. */ - /* */ - /* number_Of_HMetrics :: Number of VMetrics entries in the */ - /* `vmtx' table -- this value can be */ - /* smaller than the total number of glyphs */ - /* in the font. */ - /* */ - /* long_metrics :: A pointer into the `vmtx' table. */ - /* */ - /* short_metrics :: A pointer into the `vmtx' table. */ - /* */ - /* <Note> */ - /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ - /* be identical except for the names of their fields, */ - /* which are different. */ - /* */ - /* This ensures that a single function in the `ttload' */ - /* module is able to read both the horizontal and vertical */ - /* headers. */ - /* */ - typedef struct TT_VertHeader_ - { - FT_Fixed Version; - FT_Short Ascender; - FT_Short Descender; - FT_Short Line_Gap; - - FT_UShort advance_Height_Max; /* advance height maximum */ - - FT_Short min_Top_Side_Bearing; /* minimum left-sb or top-sb */ - FT_Short min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */ - FT_Short yMax_Extent; /* xmax or ymax extents */ - FT_Short caret_Slope_Rise; - FT_Short caret_Slope_Run; - FT_Short caret_Offset; - - FT_Short Reserved[4]; - - FT_Short metric_Data_Format; - FT_UShort number_Of_VMetrics; - - /* The following fields are not defined by the TrueType specification */ - /* but they're used to connect the metrics header to the relevant */ - /* `HMTX' or `VMTX' table. */ - - void* long_metrics; - void* short_metrics; - - } TT_VertHeader; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_OS2 */ - /* */ - /* <Description> */ - /* A structure used to model a TrueType OS/2 table. All fields */ - /* comply to the OpenType specification. */ - /* */ - /* Note that we now support old Mac fonts that do not include an OS/2 */ - /* table. In this case, the `version' field is always set to 0xFFFF. */ - /* */ - typedef struct TT_OS2_ - { - FT_UShort version; /* 0x0001 - more or 0xFFFF */ - FT_Short xAvgCharWidth; - FT_UShort usWeightClass; - FT_UShort usWidthClass; - FT_Short fsType; - FT_Short ySubscriptXSize; - FT_Short ySubscriptYSize; - FT_Short ySubscriptXOffset; - FT_Short ySubscriptYOffset; - FT_Short ySuperscriptXSize; - FT_Short ySuperscriptYSize; - FT_Short ySuperscriptXOffset; - FT_Short ySuperscriptYOffset; - FT_Short yStrikeoutSize; - FT_Short yStrikeoutPosition; - FT_Short sFamilyClass; - - FT_Byte panose[10]; - - FT_ULong ulUnicodeRange1; /* Bits 0-31 */ - FT_ULong ulUnicodeRange2; /* Bits 32-63 */ - FT_ULong ulUnicodeRange3; /* Bits 64-95 */ - FT_ULong ulUnicodeRange4; /* Bits 96-127 */ - - FT_Char achVendID[4]; - - FT_UShort fsSelection; - FT_UShort usFirstCharIndex; - FT_UShort usLastCharIndex; - FT_Short sTypoAscender; - FT_Short sTypoDescender; - FT_Short sTypoLineGap; - FT_UShort usWinAscent; - FT_UShort usWinDescent; - - /* only version 1 and higher: */ - - FT_ULong ulCodePageRange1; /* Bits 0-31 */ - FT_ULong ulCodePageRange2; /* Bits 32-63 */ - - /* only version 2 and higher: */ - - FT_Short sxHeight; - FT_Short sCapHeight; - FT_UShort usDefaultChar; - FT_UShort usBreakChar; - FT_UShort usMaxContext; - - /* only version 5 and higher: */ - - FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */ - FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ - - } TT_OS2; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Postscript */ - /* */ - /* <Description> */ - /* A structure used to model a TrueType PostScript table. All fields */ - /* comply to the TrueType specification. This structure does not */ - /* reference the PostScript glyph names, which can be nevertheless */ - /* accessed with the `ttpost' module. */ - /* */ - typedef struct TT_Postscript_ - { - FT_Fixed FormatType; - FT_Fixed italicAngle; - FT_Short underlinePosition; - FT_Short underlineThickness; - FT_ULong isFixedPitch; - FT_ULong minMemType42; - FT_ULong maxMemType42; - FT_ULong minMemType1; - FT_ULong maxMemType1; - - /* Glyph names follow in the file, but we don't */ - /* load them by default. See the ttpost.c file. */ - - } TT_Postscript; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_PCLT */ - /* */ - /* <Description> */ - /* A structure used to model a TrueType PCLT table. All fields */ - /* comply to the TrueType specification. */ - /* */ - typedef struct TT_PCLT_ - { - FT_Fixed Version; - FT_ULong FontNumber; - FT_UShort Pitch; - FT_UShort xHeight; - FT_UShort Style; - FT_UShort TypeFamily; - FT_UShort CapHeight; - FT_UShort SymbolSet; - FT_Char TypeFace[16]; - FT_Char CharacterComplement[8]; - FT_Char FileName[6]; - FT_Char StrokeWeight; - FT_Char WidthType; - FT_Byte SerifStyle; - FT_Byte Reserved; - - } TT_PCLT; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_MaxProfile */ - /* */ - /* <Description> */ - /* The maximum profile is a table containing many max values, which */ - /* can be used to pre-allocate arrays. This ensures that no memory */ - /* allocation occurs during a glyph load. */ - /* */ - /* <Fields> */ - /* version :: The version number. */ - /* */ - /* numGlyphs :: The number of glyphs in this TrueType */ - /* font. */ - /* */ - /* maxPoints :: The maximum number of points in a */ - /* non-composite TrueType glyph. See also */ - /* the structure element */ - /* `maxCompositePoints'. */ - /* */ - /* maxContours :: The maximum number of contours in a */ - /* non-composite TrueType glyph. See also */ - /* the structure element */ - /* `maxCompositeContours'. */ - /* */ - /* maxCompositePoints :: The maximum number of points in a */ - /* composite TrueType glyph. See also the */ - /* structure element `maxPoints'. */ - /* */ - /* maxCompositeContours :: The maximum number of contours in a */ - /* composite TrueType glyph. See also the */ - /* structure element `maxContours'. */ - /* */ - /* maxZones :: The maximum number of zones used for */ - /* glyph hinting. */ - /* */ - /* maxTwilightPoints :: The maximum number of points in the */ - /* twilight zone used for glyph hinting. */ - /* */ - /* maxStorage :: The maximum number of elements in the */ - /* storage area used for glyph hinting. */ - /* */ - /* maxFunctionDefs :: The maximum number of function */ - /* definitions in the TrueType bytecode for */ - /* this font. */ - /* */ - /* maxInstructionDefs :: The maximum number of instruction */ - /* definitions in the TrueType bytecode for */ - /* this font. */ - /* */ - /* maxStackElements :: The maximum number of stack elements used */ - /* during bytecode interpretation. */ - /* */ - /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ - /* used for glyph hinting. */ - /* */ - /* maxComponentElements :: The maximum number of simple (i.e., non- */ - /* composite) glyphs in a composite glyph. */ - /* */ - /* maxComponentDepth :: The maximum nesting depth of composite */ - /* glyphs. */ - /* */ - /* <Note> */ - /* This structure is only used during font loading. */ - /* */ - typedef struct TT_MaxProfile_ - { - FT_Fixed version; - FT_UShort numGlyphs; - FT_UShort maxPoints; - FT_UShort maxContours; - FT_UShort maxCompositePoints; - FT_UShort maxCompositeContours; - FT_UShort maxZones; - FT_UShort maxTwilightPoints; - FT_UShort maxStorage; - FT_UShort maxFunctionDefs; - FT_UShort maxInstructionDefs; - FT_UShort maxStackElements; - FT_UShort maxSizeOfInstructions; - FT_UShort maxComponentElements; - FT_UShort maxComponentDepth; - - } TT_MaxProfile; - - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Sfnt_Tag */ - /* */ - /* <Description> */ - /* An enumeration used to specify the index of an SFNT table. */ - /* Used in the @FT_Get_Sfnt_Table API function. */ - /* */ - typedef enum FT_Sfnt_Tag_ - { - ft_sfnt_head = 0, /* TT_Header */ - ft_sfnt_maxp = 1, /* TT_MaxProfile */ - ft_sfnt_os2 = 2, /* TT_OS2 */ - ft_sfnt_hhea = 3, /* TT_HoriHeader */ - ft_sfnt_vhea = 4, /* TT_VertHeader */ - ft_sfnt_post = 5, /* TT_Postscript */ - ft_sfnt_pclt = 6, /* TT_PCLT */ - - sfnt_max /* internal end mark */ - - } FT_Sfnt_Tag; - - /* */ - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Sfnt_Table */ - /* */ - /* <Description> */ - /* Return a pointer to a given SFNT table within a face. */ - /* */ - /* <Input> */ - /* face :: A handle to the source. */ - /* */ - /* tag :: The index of the SFNT table. */ - /* */ - /* <Return> */ - /* A type-less pointer to the table. This will be~0 in case of */ - /* error, or if the corresponding table was not found *OR* loaded */ - /* from the file. */ - /* */ - /* Use a typecast according to `tag' to access the structure */ - /* elements. */ - /* */ - /* <Note> */ - /* The table is owned by the face object and disappears with it. */ - /* */ - /* This function is only useful to access SFNT tables that are loaded */ - /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ - /* a list. */ - /* */ - /* Here an example how to access the `vhea' table: */ - /* */ - /* { */ - /* TT_VertHeader* vert_header; */ - /* */ - /* */ - /* vert_header = */ - /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ - /* } */ - /* */ - FT_EXPORT( void* ) - FT_Get_Sfnt_Table( FT_Face face, - FT_Sfnt_Tag tag ); - - - /************************************************************************** - * - * @function: - * FT_Load_Sfnt_Table - * - * @description: - * Load any font table into client memory. - * - * @input: - * face :: - * A handle to the source face. - * - * tag :: - * The four-byte tag of the table to load. Use the value~0 if you want - * to access the whole font file. Otherwise, you can use one of the - * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new - * one with @FT_MAKE_TAG. - * - * offset :: - * The starting offset in the table (or file if tag == 0). - * - * @output: - * buffer :: - * The target buffer address. The client must ensure that the memory - * array is big enough to hold the data. - * - * @inout: - * length :: - * If the `length' parameter is NULL, then try to load the whole table. - * Return an error code if it fails. - * - * Else, if `*length' is~0, exit immediately while returning the - * table's (or file) full size in it. - * - * Else the number of bytes to read from the table or file, from the - * starting offset. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If you need to determine the table's length you should first call this - * function with `*length' set to~0, as in the following example: - * - * { - * FT_ULong length = 0; - * - * - * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); - * if ( error ) { ... table does not exist ... } - * - * buffer = malloc( length ); - * if ( buffer == NULL ) { ... not enough memory ... } - * - * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); - * if ( error ) { ... could not load table ... } - * } - * - * Note that structures like @TT_Header or @TT_OS2 can't be used with - * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that - * those structures depend on the processor architecture, with varying - * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). - * - */ - FT_EXPORT( FT_Error ) - FT_Load_Sfnt_Table( FT_Face face, - FT_ULong tag, - FT_Long offset, - FT_Byte* buffer, - FT_ULong* length ); - - - /************************************************************************** - * - * @function: - * FT_Sfnt_Table_Info - * - * @description: - * Return information on an SFNT table. - * - * @input: - * face :: - * A handle to the source face. - * - * table_index :: - * The index of an SFNT table. The function returns - * FT_Err_Table_Missing for an invalid value. - * - * @inout: - * tag :: - * The name tag of the SFNT table. If the value is NULL, `table_index' - * is ignored, and `length' returns the number of SFNT tables in the - * font. - * - * @output: - * length :: - * The length of the SFNT table (or the number of SFNT tables, depending - * on `tag'). - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * While parsing fonts, FreeType handles SFNT tables with length zero as - * missing. - * - */ - FT_EXPORT( FT_Error ) - FT_Sfnt_Table_Info( FT_Face face, - FT_UInt table_index, - FT_ULong *tag, - FT_ULong *length ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_CMap_Language_ID */ - /* */ - /* <Description> */ - /* Return TrueType/sfnt specific cmap language ID. Definitions of */ - /* language ID values are in `ttnameid.h'. */ - /* */ - /* <Input> */ - /* charmap :: */ - /* The target charmap. */ - /* */ - /* <Return> */ - /* The language ID of `charmap'. If `charmap' doesn't belong to a */ - /* TrueType/sfnt face, just return~0 as the default value. */ - /* */ - /* For a format~14 cmap (to access Unicode IVS), the return value is */ - /* 0xFFFFFFFF. */ - /* */ - FT_EXPORT( FT_ULong ) - FT_Get_CMap_Language_ID( FT_CharMap charmap ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_CMap_Format */ - /* */ - /* <Description> */ - /* Return TrueType/sfnt specific cmap format. */ - /* */ - /* <Input> */ - /* charmap :: */ - /* The target charmap. */ - /* */ - /* <Return> */ - /* The format of `charmap'. If `charmap' doesn't belong to a */ - /* TrueType/sfnt face, return -1. */ - /* */ - FT_EXPORT( FT_Long ) - FT_Get_CMap_Format( FT_CharMap charmap ); - - /* */ - - -FT_END_HEADER - -#endif /* __TTTABLES_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/tttags.h b/GLideN64/src/inc/freetype/include/tttags.h deleted file mode 100644 index d59aa19..0000000 --- a/GLideN64/src/inc/freetype/include/tttags.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************/ -/* */ -/* tttags.h */ -/* */ -/* Tags for TrueType and OpenType tables (specification only). */ -/* */ -/* Copyright 1996-2001, 2004, 2005, 2007, 2008, 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __TTAGS_H__ -#define __TTAGS_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - -#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) -#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) -#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) -#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) -#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) -#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) -#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) -#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) -#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) -#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) -#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) -#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) -#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) -#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) -#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) -#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) -#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) -#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) -#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) -#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) -#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) -#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) -#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) -#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) -#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) -#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) -#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) -#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) -#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) -#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) -#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) -#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) -#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) -#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) -#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) -#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) -#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) -#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) -#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) -#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) -#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) -#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) -#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) -#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) -#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) -#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) -#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) -#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) -#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) -#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) -#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) -#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) -#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) -#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) -#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) -#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' ) -#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) -#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) -#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) -#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) -#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) -#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) -#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) -#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) -#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) -#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) -#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) -#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) - - -FT_END_HEADER - -#endif /* __TTAGS_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/freetype/include/ttunpat.h b/GLideN64/src/inc/freetype/include/ttunpat.h deleted file mode 100644 index a016275..0000000 --- a/GLideN64/src/inc/freetype/include/ttunpat.h +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttunpat.h */ -/* */ -/* Definitions for the unpatented TrueType hinting system */ -/* */ -/* Copyright 2003, 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Written by Graham Asher <graham.asher@btinternet.com> */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __TTUNPAT_H__ -#define __TTUNPAT_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_UNPATENTED_HINTING - * - * @description: - * A constant used as the tag of an @FT_Parameter structure to indicate - * that unpatented methods only should be used by the TrueType bytecode - * interpreter for a typeface opened by @FT_Open_Face. - * - */ -#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) - - /* */ - -FT_END_HEADER - - -#endif /* __TTUNPAT_H__ */ - - -/* END */ diff --git a/GLideN64/src/inc/m64p_common.h b/GLideN64/src/inc/m64p_common.h deleted file mode 100644 index 3e80db6..0000000 --- a/GLideN64/src/inc/m64p_common.h +++ /dev/null @@ -1,90 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_common.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to common Core - * and plugin functions, for use by the front-end and plugin modules to attach - * to the dynamic libraries. - */ - -#if !defined(M64P_COMMON_H) -#define M64P_COMMON_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* PluginGetVersion() - * - * This function retrieves version information from a library. This - * function is the same for the core library and the plugins. - */ -typedef m64p_error (*ptr_PluginGetVersion)(m64p_plugin_type *, int *, int *, const char **, int *); -#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *, int *, int *, const char **, int *); -#endif - -/* CoreGetAPIVersions() - * - * This function retrieves API version information from the core. - */ -typedef m64p_error (*ptr_CoreGetAPIVersions)(int *, int *, int *, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreGetAPIVersions(int *, int *, int *, int *); -#endif - -/* CoreErrorMessage() - * - * This function returns a pointer to a NULL-terminated string giving a - * human-readable description of the error. -*/ -typedef const char * (*ptr_CoreErrorMessage)(m64p_error); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL CoreErrorMessage(m64p_error); -#endif - -/* PluginStartup() - * - * This function initializes a plugin for use by allocating memory, creating - * data structures, and loading the configuration data. -*/ -typedef m64p_error (*ptr_PluginStartup)(m64p_dynlib_handle, void *, void (*)(void *, int, const char *)); -#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle, void *, void (*)(void *, int, const char *)); -#endif - -/* PluginShutdown() - * - * This function destroys data structures and releases memory allocated by - * the plugin library. -*/ -typedef m64p_error (*ptr_PluginShutdown)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL PluginShutdown(void); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_COMMON_H */ - diff --git a/GLideN64/src/inc/m64p_config.h b/GLideN64/src/inc/m64p_config.h deleted file mode 100644 index 8519916..0000000 --- a/GLideN64/src/inc/m64p_config.h +++ /dev/null @@ -1,302 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_config.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to the Core's - * configuration handling functions. - */ - -#if !defined(M64P_CONFIG_H) -#define M64P_CONFIG_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* ConfigListSections() - * - * This function is called to enumerate the list of Sections in the Mupen64Plus - * configuration file. It is expected that there will be a section named "Core" - * for core-specific configuration data, "Graphics" for common graphics options, - * and one or more sections for each plugin library. - */ -typedef m64p_error (*ptr_ConfigListSections)(void *, void (*)(void *, const char *)); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigListSections(void *, void (*)(void *, const char *)); -#endif - -/* ConfigOpenSection() - * - * This function is used to give a configuration section handle to the front-end - * which may be used to read or write configuration parameter values in a given - * section of the configuration file. - */ -typedef m64p_error (*ptr_ConfigOpenSection)(const char *, m64p_handle *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigOpenSection(const char *, m64p_handle *); -#endif - -/* ConfigListParameters() - * - * This function is called to enumerate the list of Parameters in a given - * Section of the Mupen64Plus configuration file. - */ -typedef m64p_error (*ptr_ConfigListParameters)(m64p_handle, void *, void (*)(void *, const char *, m64p_type)); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigListParameters(m64p_handle, void *, void (*)(void *, const char *, m64p_type)); -#endif - -/* ConfigSaveFile() - * - * This function saves the entire current Mupen64Plus configuration to disk. - */ -typedef m64p_error (*ptr_ConfigSaveFile)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSaveFile(void); -#endif - -/* ConfigSaveSection() - * - * This function saves one section of the current Mupen64Plus configuration to disk. - */ -typedef m64p_error (*ptr_ConfigSaveSection)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSaveSection(const char *); -#endif - -/* ConfigHasUnsavedChanges() - * - * This function determines if a given Section (or all sections) of the Mupen64Plus Core configuration file has been modified since it was last saved or loaded. - */ -typedef int (*ptr_ConfigHasUnsavedChanges)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL ConfigHasUnsavedChanges(const char *); -#endif - -/* ConfigDeleteSection() - * - * This function deletes a section from the Mupen64Plus configuration data. - */ -typedef m64p_error (*ptr_ConfigDeleteSection)(const char *SectionName); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigDeleteSection(const char *SectionName); -#endif - -/* ConfigRevertChanges() - * - * This function reverts changes previously made to one section of the configuration file, so that it will match with the configuration at the last time that it was loaded from or saved to disk. - */ -typedef m64p_error (*ptr_ConfigRevertChanges)(const char *SectionName); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigRevertChanges(const char *SectionName); -#endif - -/* ConfigSetParameter() - * - * This function sets the value of one of the emulator's configuration - * parameters. - */ -typedef m64p_error (*ptr_ConfigSetParameter)(m64p_handle, const char *, m64p_type, const void *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSetParameter(m64p_handle, const char *, m64p_type, const void *); -#endif - -/* ConfigSetParameterHelp() - * - * This function sets the help string of one of the emulator's configuration - * parameters. - */ -typedef m64p_error (*ptr_ConfigSetParameterHelp)(m64p_handle, const char *, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSetParameterHelp(m64p_handle, const char *, const char *); -#endif - -/* ConfigGetParameter() - * - * This function retrieves the value of one of the emulator's parameters. - */ -typedef m64p_error (*ptr_ConfigGetParameter)(m64p_handle, const char *, m64p_type, void *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigGetParameter(m64p_handle, const char *, m64p_type, void *, int); -#endif - -/* ConfigGetParameterType() - * - * This function retrieves the type of one of the emulator's parameters. - */ -typedef m64p_error (*ptr_ConfigGetParameterType)(m64p_handle, const char *, m64p_type *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigGetParameterType(m64p_handle, const char *, m64p_type *); -#endif - -/* ConfigGetParameterHelp() - * - * This function retrieves the help information about one of the emulator's - * parameters. - */ -typedef const char * (*ptr_ConfigGetParameterHelp)(m64p_handle, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetParameterHelp(m64p_handle, const char *); -#endif - -/* ConfigSetDefault***() - * - * These functions are used to set the value of a configuration parameter if it - * is not already present in the configuration file. This may happen if a new - * user runs the emulator, or an upgraded module uses a new parameter, or the - * user deletes his or her configuration file. If the parameter is already - * present in the given section of the configuration file, then no action will - * be taken and this function will return successfully. - */ -typedef m64p_error (*ptr_ConfigSetDefaultInt)(m64p_handle, const char *, int, const char *); -typedef m64p_error (*ptr_ConfigSetDefaultFloat)(m64p_handle, const char *, float, const char *); -typedef m64p_error (*ptr_ConfigSetDefaultBool)(m64p_handle, const char *, int, const char *); -typedef m64p_error (*ptr_ConfigSetDefaultString)(m64p_handle, const char *, const char *, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSetDefaultInt(m64p_handle, const char *, int, const char *); -EXPORT m64p_error CALL ConfigSetDefaultFloat(m64p_handle, const char *, float, const char *); -EXPORT m64p_error CALL ConfigSetDefaultBool(m64p_handle, const char *, int, const char *); -EXPORT m64p_error CALL ConfigSetDefaultString(m64p_handle, const char *, const char *, const char *); -#endif - -/* ConfigGetParam***() - * - * These functions retrieve the value of one of the emulator's parameters in - * the given section, and return the value directly to the calling function. If - * an errors occurs (such as an invalid Section handle, or invalid - * configuration parameter name), then an error will be sent to the front-end - * via the DebugCallback() function, and either a 0 (zero) or an empty string - * will be returned. - */ -typedef int (*ptr_ConfigGetParamInt)(m64p_handle, const char *); -typedef float (*ptr_ConfigGetParamFloat)(m64p_handle, const char *); -typedef int (*ptr_ConfigGetParamBool)(m64p_handle, const char *); -typedef const char * (*ptr_ConfigGetParamString)(m64p_handle, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL ConfigGetParamInt(m64p_handle, const char *); -EXPORT float CALL ConfigGetParamFloat(m64p_handle, const char *); -EXPORT int CALL ConfigGetParamBool(m64p_handle, const char *); -EXPORT const char * CALL ConfigGetParamString(m64p_handle, const char *); -#endif - -/* ConfigGetSharedDataFilepath() - * - * This function is provided to allow a plugin to retrieve a full pathname to a - * given shared data file. This type of file is intended to be shared among - * multiple users on a system, so it is likely to be read-only. - */ -typedef const char * (*ptr_ConfigGetSharedDataFilepath)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetSharedDataFilepath(const char *); -#endif - -/* ConfigGetUserConfigPath() - * - * This function may be used by the plugins or front-end to get a path to the - * directory for storing user-specific configuration files. This will be the - * directory where "mupen64plus.cfg" is located. - */ -typedef const char * (*ptr_ConfigGetUserConfigPath)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetUserConfigPath(void); -#endif - -/* ConfigGetUserDataPath() - * - * This function may be used by the plugins or front-end to get a path to the - * directory for storing user-specific data files. This may be used to store - * files such as screenshots, saved game states, or hi-res textures. - */ -typedef const char * (*ptr_ConfigGetUserDataPath)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetUserDataPath(void); -#endif - -/* ConfigGetUserCachePath() - * - * This function may be used by the plugins or front-end to get a path to the - * directory for storing cached user-specific data files. Files in this - * directory may be deleted by the user to save space, so critical information - * should not be stored here. This directory may be used to store files such - * as the ROM browser cache. - */ -typedef const char * (*ptr_ConfigGetUserCachePath)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetUserCachePath(void); -#endif - -/* ConfigExternalOpen() - * - * This function reads the contents of the config file into memory - * and returns M64ERR_SUCCESS if successful. - */ -typedef m64p_error (*ptr_ConfigExternalOpen)(const char *, m64p_handle *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigExternalOpen(const char *, m64p_handle *); -#endif - -/* ConfigExternalClose() - * - * Frees the memory pointer created by ConfigExternalOpen. - */ -typedef m64p_error (*ptr_ConfigExternalClose)(m64p_handle); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigExternalClose(m64p_handle); -#endif - -/* ConfigExternalGetParameter() - * - * This functions allows a plugin to leverage the built-in ini parser to read - * any cfg/ini file. It will return M64ERR_SUCCESS if the item was found. - */ -typedef m64p_error (*ptr_ConfigExternalGetParameter)(m64p_handle, const char *, const char *, char *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigExternalGetParameter(m64p_handle, const char *, const char *, char *, int); -#endif - -/* ConfigSendNetplayConfig() - * - * This function allows plugins to take advantage of the netplay TCP connection - * to send configuration data to the netplay server. - */ - -typedef m64p_error (*ptr_ConfigSendNetplayConfig)(char*, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSendNetplayConfig(char*, int); -#endif - -/* ConfigReceiveNetplayConfig() - * - * This function allows plugins to take advantage of the netplay TCP connection - * to receive configuration data from the netplay server. - */ - -typedef m64p_error (*ptr_ConfigReceiveNetplayConfig)(char*, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigReceiveNetplayConfig(char*, int); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_CONFIG_H */ diff --git a/GLideN64/src/inc/m64p_debugger.h b/GLideN64/src/inc/m64p_debugger.h deleted file mode 100644 index f19e3d0..0000000 --- a/GLideN64/src/inc/m64p_debugger.h +++ /dev/null @@ -1,222 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_debugger.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to Core Debugger - * functions. - */ - -#if !defined(M64P_DEBUGGER_H) -#define M64P_DEBUGGER_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* DebugSetCallbacks() - * - * This function is called by the front-end to supply debugger callback - * function pointers. If debugger is enabled and then later disabled within the - * UI, this function may be called with NULL pointers in order to disable the - * callbacks. - */ -typedef m64p_error (*ptr_DebugSetCallbacks)(void (*)(void), void (*)(unsigned int), void (*)(void)); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL DebugSetCallbacks(void (*)(void), void (*)(unsigned int), void (*)(void)); -#endif - -/* DebugSetCoreCompare() - * - * This function is called by the front-end to supply callback function pointers - * for the Core Comparison feature. - */ -typedef m64p_error (*ptr_DebugSetCoreCompare)(void (*)(unsigned int), void (*)(int, void *)); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL DebugSetCoreCompare(void (*)(unsigned int), void (*)(int, void *)); -#endif - -/* DebugSetRunState() - * - * This function sets the run state of the R4300 CPU emulator. - */ -typedef m64p_error (*ptr_DebugSetRunState)(m64p_dbg_runstate); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL DebugSetRunState(m64p_dbg_runstate); -#endif - -/* DebugGetState() - * - * This function reads and returns a debugger state variable, which are - * enumerated in m64p_types.h. - */ -typedef int (*ptr_DebugGetState)(m64p_dbg_state); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL DebugGetState(m64p_dbg_state); -#endif - -/* DebugStep() - * - * This function signals the debugger to advance one instruction when in the - * stepping mode. - */ -typedef m64p_error (*ptr_DebugStep)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL DebugStep(void); -#endif - -/* DebugDecodeOp() - * - * This is a helper function for the debugger front-end. This instruction takes - * a PC value and an R4300 instruction opcode and writes the disassembled - * instruction mnemonic and arguments into character buffers. This is intended - * to be used to display disassembled code. - */ -typedef void (*ptr_DebugDecodeOp)(unsigned int, char *, char *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void CALL DebugDecodeOp(unsigned int, char *, char *, int); -#endif - -/* DebugMemGetRecompInfo() - * - * This function is used by the front-end to retrieve disassembly information - * about recompiled code. For example, the dynamic recompiler may take a single - * R4300 instruction and compile it into 10 x86 instructions. This function may - * then be used to retrieve the disassembled code of the 10 x86 instructions. - */ -typedef void * (*ptr_DebugMemGetRecompInfo)(m64p_dbg_mem_info, unsigned int, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void * CALL DebugMemGetRecompInfo(m64p_dbg_mem_info, unsigned int, int); -#endif - -/* DebugMemGetMemInfo() - * - * This function returns an integer value regarding the memory location address, - * corresponding to the information requested by mem_info_type, which is a type - * enumerated in m64p_types.h. - */ -typedef int (*ptr_DebugMemGetMemInfo)(m64p_dbg_mem_info, unsigned int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL DebugMemGetMemInfo(m64p_dbg_mem_info, unsigned int); -#endif - -/* DebugMemGetPointer() - * - * This function returns a memory pointer (in x86 memory space) to a block of - * emulated N64 memory. This may be used to retrieve a pointer to a special N64 - * block (such as the serial, video, or audio registers) or the RDRAM. - */ -typedef void * (*ptr_DebugMemGetPointer)(m64p_dbg_memptr_type); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void * CALL DebugMemGetPointer(m64p_dbg_memptr_type); -#endif - -/* DebugMemRead**() - * - * These functions retrieve a value from the emulated N64 memory. The returned - * value will be correctly byte-swapped for the host architecture. - */ -typedef unsigned long long (*ptr_DebugMemRead64)(unsigned int); -typedef unsigned int (*ptr_DebugMemRead32)(unsigned int); -typedef unsigned short (*ptr_DebugMemRead16)(unsigned int); -typedef unsigned char (*ptr_DebugMemRead8)(unsigned int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT unsigned long long CALL DebugMemRead64(unsigned int); -EXPORT unsigned int CALL DebugMemRead32(unsigned int); -EXPORT unsigned short CALL DebugMemRead16(unsigned int); -EXPORT unsigned char CALL DebugMemRead8(unsigned int); -#endif - -/* DebugMemWrite**() - * - * These functions write a value into the emulated N64 memory. The given value - * will be correctly byte-swapped before storage. - */ -typedef void (*ptr_DebugMemWrite64)(unsigned int, unsigned long long); -typedef void (*ptr_DebugMemWrite32)(unsigned int, unsigned int); -typedef void (*ptr_DebugMemWrite16)(unsigned int, unsigned short); -typedef void (*ptr_DebugMemWrite8)(unsigned int, unsigned char); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void CALL DebugMemWrite64(unsigned int, unsigned long long); -EXPORT void CALL DebugMemWrite32(unsigned int, unsigned int); -EXPORT void CALL DebugMemWrite16(unsigned int, unsigned short); -EXPORT void CALL DebugMemWrite8(unsigned int, unsigned char); -#endif - -/* DebugGetCPUDataPtr() - * - * This function returns a memory pointer (in x86 memory space) to a specific - * register in the emulated R4300 CPU. - */ -typedef void * (*ptr_DebugGetCPUDataPtr)(m64p_dbg_cpu_data); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void * CALL DebugGetCPUDataPtr(m64p_dbg_cpu_data); -#endif - -/* DebugBreakpointLookup() - * - * This function searches through all current breakpoints in the debugger to - * find one that matches the given input parameters. If a matching breakpoint - * is found, the index number is returned. If no breakpoints are found, -1 is - * returned. - */ -typedef int (*ptr_DebugBreakpointLookup)(unsigned int, unsigned int, unsigned int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL DebugBreakpointLookup(unsigned int, unsigned int, unsigned int); -#endif - -/* DebugBreakpointCommand() - * - * This function is used to process common breakpoint commands, such as adding, - * removing, or searching the breakpoints. The meanings of the index and ptr - * input parameters vary by command. - */ -typedef int (*ptr_DebugBreakpointCommand)(m64p_dbg_bkp_command, unsigned int, m64p_breakpoint *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL DebugBreakpointCommand(m64p_dbg_bkp_command, unsigned int, m64p_breakpoint *); -#endif - -/* DebugBreakpointTriggeredBy() - * - * This function is used to retrieve the trigger flags and address for the - * most recently triggered breakpoint. - */ -typedef void (*ptr_DebugBreakpointTriggeredBy)(uint32_t *, uint32_t *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void CALL DebugBreakpointTriggeredBy(uint32_t *, uint32_t *); -#endif - -/* DebugVirtualToPhysical() - * - * This function is used to translate virtual addresses to physical addresses. - * Memory read/write breakpoints operate on physical addresses. - */ -typedef uint32_t (*ptr_DebugVirtualToPhysical)(uint32_t); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT uint32_t CALL DebugVirtualToPhysical(uint32_t); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_DEBUGGER_H */ - diff --git a/GLideN64/src/inc/m64p_frontend.h b/GLideN64/src/inc/m64p_frontend.h deleted file mode 100644 index 0853eaa..0000000 --- a/GLideN64/src/inc/m64p_frontend.h +++ /dev/null @@ -1,141 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_frontend.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to Core functions - * designed for use by the front-end user interface. - */ - -#if !defined(M64P_FRONTEND_H) -#define M64P_FRONTEND_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/* pointer types to the callback functions in the front-end application */ -typedef void (*ptr_DebugCallback)(void *Context, int level, const char *message); -typedef void (*ptr_StateCallback)(void *Context, m64p_core_param param_type, int new_value); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void CALL DebugCallback(void *Context, int level, const char *message); -EXPORT void CALL StateCallback(void *Context, m64p_core_param param_type, int new_value); -#endif - -/* CoreStartup() - * - * This function initializes libmupen64plus for use by allocating memory, - * creating data structures, and loading the configuration file. - */ -typedef m64p_error (*ptr_CoreStartup)(int, const char *, const char *, void *, ptr_DebugCallback, void *, ptr_StateCallback); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreStartup(int, const char *, const char *, void *, ptr_DebugCallback, void *, ptr_StateCallback); -#endif - -/* CoreShutdown() - * - * This function saves the configuration file, then destroys data structures - * and releases memory allocated by the core library. - */ -typedef m64p_error (*ptr_CoreShutdown)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreShutdown(void); -#endif - -/* CoreAttachPlugin() - * - * This function attaches the given plugin to the emulator core. There can only - * be one plugin of each type attached to the core at any given time. - */ -typedef m64p_error (*ptr_CoreAttachPlugin)(m64p_plugin_type, m64p_dynlib_handle); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreAttachPlugin(m64p_plugin_type, m64p_dynlib_handle); -#endif - -/* CoreDetachPlugin() - * - * This function detaches the given plugin from the emulator core, and re-attaches - * the 'dummy' plugin functions. - */ -typedef m64p_error (*ptr_CoreDetachPlugin)(m64p_plugin_type); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreDetachPlugin(m64p_plugin_type); -#endif - -/* CoreDoCommand() - * - * This function sends a command to the emulator core. - */ -typedef m64p_error (*ptr_CoreDoCommand)(m64p_command, int, void *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreDoCommand(m64p_command, int, void *); -#endif - -/* CoreOverrideVidExt() - * - * This function overrides the core's internal SDL-based OpenGL functions. This - * override functionality allows a front-end to define its own video extension - * functions to be used instead of the SDL functions. If any of the function - * pointers in the structure are NULL, the override function will be disabled - * and the core's internal SDL functions will be used. - */ -typedef m64p_error (*ptr_CoreOverrideVidExt)(m64p_video_extension_functions *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreOverrideVidExt(m64p_video_extension_functions *); -#endif - -/* CoreAddCheat() - * - * This function will add a Cheat Function to a list of currently active cheats - * which are applied to the open ROM. - */ -typedef m64p_error (*ptr_CoreAddCheat)(const char *, m64p_cheat_code *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreAddCheat(const char *, m64p_cheat_code *, int); -#endif - -/* CoreCheatEnabled() - * - * This function will enable or disable a Cheat Function which is in the list of - * currently active cheats. - */ -typedef m64p_error (*ptr_CoreCheatEnabled)(const char *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreCheatEnabled(const char *, int); -#endif - -/* CoreGetRomSettings() - * - * This function will retrieve the ROM settings from the mupen64plus INI file for - * the ROM image corresponding to the given CRC values. - */ -typedef m64p_error (*ptr_CoreGetRomSettings)(m64p_rom_settings *, int, int, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreGetRomSettings(m64p_rom_settings *, int, int, int); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_FRONTEND_H */ - diff --git a/GLideN64/src/inc/m64p_plugin.h b/GLideN64/src/inc/m64p_plugin.h deleted file mode 100644 index 0f5a95d..0000000 --- a/GLideN64/src/inc/m64p_plugin.h +++ /dev/null @@ -1,287 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_plugin.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2002 Hacktarux * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#if !defined(M64P_PLUGIN_H) -#define M64P_PLUGIN_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*** Controller plugin's ****/ -#define PLUGIN_NONE 1 -#define PLUGIN_MEMPAK 2 -#define PLUGIN_RUMBLE_PAK 3 /* not implemented for non raw data */ -#define PLUGIN_TRANSFER_PAK 4 /* not implemented for non raw data */ -#define PLUGIN_RAW 5 /* the controller plugin is passed in raw data */ -#define PLUGIN_BIO_PAK 6 - -/***** Structures *****/ -typedef struct { - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * SP_MEM_ADDR_REG; - unsigned int * SP_DRAM_ADDR_REG; - unsigned int * SP_RD_LEN_REG; - unsigned int * SP_WR_LEN_REG; - unsigned int * SP_STATUS_REG; - unsigned int * SP_DMA_FULL_REG; - unsigned int * SP_DMA_BUSY_REG; - unsigned int * SP_PC_REG; - unsigned int * SP_SEMAPHORE_REG; - - unsigned int * DPC_START_REG; - unsigned int * DPC_END_REG; - unsigned int * DPC_CURRENT_REG; - unsigned int * DPC_STATUS_REG; - unsigned int * DPC_CLOCK_REG; - unsigned int * DPC_BUFBUSY_REG; - unsigned int * DPC_PIPEBUSY_REG; - unsigned int * DPC_TMEM_REG; - - void (*CheckInterrupts)(void); - void (*ProcessDlistList)(void); - void (*ProcessAlistList)(void); - void (*ProcessRdpList)(void); - void (*ShowCFB)(void); -} RSP_INFO; - -typedef struct { - unsigned char * HEADER; /* This is the rom header (first 40h bytes of the rom) */ - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * DPC_START_REG; - unsigned int * DPC_END_REG; - unsigned int * DPC_CURRENT_REG; - unsigned int * DPC_STATUS_REG; - unsigned int * DPC_CLOCK_REG; - unsigned int * DPC_BUFBUSY_REG; - unsigned int * DPC_PIPEBUSY_REG; - unsigned int * DPC_TMEM_REG; - - unsigned int * VI_STATUS_REG; - unsigned int * VI_ORIGIN_REG; - unsigned int * VI_WIDTH_REG; - unsigned int * VI_INTR_REG; - unsigned int * VI_V_CURRENT_LINE_REG; - unsigned int * VI_TIMING_REG; - unsigned int * VI_V_SYNC_REG; - unsigned int * VI_H_SYNC_REG; - unsigned int * VI_LEAP_REG; - unsigned int * VI_H_START_REG; - unsigned int * VI_V_START_REG; - unsigned int * VI_V_BURST_REG; - unsigned int * VI_X_SCALE_REG; - unsigned int * VI_Y_SCALE_REG; - - void (*CheckInterrupts)(void); - - /* The GFX_INFO.version parameter was added in version 2.5.1 of the core. - Plugins should ensure the core is at least this version before - attempting to read GFX_INFO.version. */ - unsigned int version; - /* SP_STATUS_REG and RDRAM_SIZE were added in version 2 of GFX_INFO.version. - Plugins should only attempt to read these values if GFX_INFO.version is at least 2. */ - - /* The RSP plugin should set (HALT | BROKE | TASKDONE) *before* calling ProcessDList. - It should not modify SP_STATUS_REG after ProcessDList has returned. - This will allow the GFX plugin to unset these bits if it needs. */ - unsigned int * SP_STATUS_REG; - const unsigned int * RDRAM_SIZE; -} GFX_INFO; - -typedef struct { - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * AI_DRAM_ADDR_REG; - unsigned int * AI_LEN_REG; - unsigned int * AI_CONTROL_REG; - unsigned int * AI_STATUS_REG; - unsigned int * AI_DACRATE_REG; - unsigned int * AI_BITRATE_REG; - - void (*CheckInterrupts)(void); -} AUDIO_INFO; - -typedef struct { - int Present; - int RawData; - int Plugin; -} CONTROL; - -typedef union { - unsigned int Value; - struct { - unsigned R_DPAD : 1; - unsigned L_DPAD : 1; - unsigned D_DPAD : 1; - unsigned U_DPAD : 1; - unsigned START_BUTTON : 1; - unsigned Z_TRIG : 1; - unsigned B_BUTTON : 1; - unsigned A_BUTTON : 1; - - unsigned R_CBUTTON : 1; - unsigned L_CBUTTON : 1; - unsigned D_CBUTTON : 1; - unsigned U_CBUTTON : 1; - unsigned R_TRIG : 1; - unsigned L_TRIG : 1; - unsigned Reserved1 : 1; - unsigned Reserved2 : 1; - - signed X_AXIS : 8; - signed Y_AXIS : 8; - }; -} BUTTONS; - -typedef struct { - CONTROL *Controls; /* A pointer to an array of 4 controllers .. eg: - CONTROL Controls[4]; */ -} CONTROL_INFO; - -/* common plugin function pointer types */ -typedef void (*ptr_RomClosed)(void); -typedef int (*ptr_RomOpen)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT int CALL RomOpen(void); -EXPORT void CALL RomClosed(void); -#endif - -/* video plugin function pointer types */ -typedef void (*ptr_ChangeWindow)(void); -typedef int (*ptr_InitiateGFX)(GFX_INFO Gfx_Info); -typedef void (*ptr_MoveScreen)(int x, int y); -typedef void (*ptr_ProcessDList)(void); -typedef void (*ptr_ProcessRDPList)(void); -typedef void (*ptr_ShowCFB)(void); -typedef void (*ptr_UpdateScreen)(void); -typedef void (*ptr_ViStatusChanged)(void); -typedef void (*ptr_ViWidthChanged)(void); -typedef void (*ptr_ReadScreen2)(void *dest, int *width, int *height, int front); -typedef void (*ptr_SetRenderingCallback)(void (*callback)(int)); -typedef void (*ptr_ResizeVideoOutput)(int width, int height); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL ChangeWindow(void); -EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info); -EXPORT void CALL MoveScreen(int x, int y); -EXPORT void CALL ProcessDList(void); -EXPORT void CALL ProcessRDPList(void); -EXPORT void CALL ShowCFB(void); -EXPORT void CALL UpdateScreen(void); -EXPORT void CALL ViStatusChanged(void); -EXPORT void CALL ViWidthChanged(void); -EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front); -EXPORT void CALL SetRenderingCallback(void (*callback)(int)); -EXPORT void CALL ResizeVideoOutput(int width, int height); -#endif - -/* frame buffer plugin spec extension */ -typedef struct -{ - unsigned int addr; - unsigned int size; - unsigned int width; - unsigned int height; -} FrameBufferInfo; -typedef void (*ptr_FBRead)(unsigned int addr); -typedef void (*ptr_FBWrite)(unsigned int addr, unsigned int size); -typedef void (*ptr_FBGetFrameBufferInfo)(void *p); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL FBRead(unsigned int addr); -EXPORT void CALL FBWrite(unsigned int addr, unsigned int size); -EXPORT void CALL FBGetFrameBufferInfo(void *p); -#endif - -/* audio plugin function pointers */ -typedef void (*ptr_AiDacrateChanged)(int SystemType); -typedef void (*ptr_AiLenChanged)(void); -typedef int (*ptr_InitiateAudio)(AUDIO_INFO Audio_Info); -typedef void (*ptr_ProcessAList)(void); -typedef void (*ptr_SetSpeedFactor)(int percent); -typedef void (*ptr_VolumeUp)(void); -typedef void (*ptr_VolumeDown)(void); -typedef int (*ptr_VolumeGetLevel)(void); -typedef void (*ptr_VolumeSetLevel)(int level); -typedef void (*ptr_VolumeMute)(void); -typedef const char * (*ptr_VolumeGetString)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL AiDacrateChanged(int SystemType); -EXPORT void CALL AiLenChanged(void); -EXPORT int CALL InitiateAudio(AUDIO_INFO Audio_Info); -EXPORT void CALL ProcessAList(void); -EXPORT void CALL SetSpeedFactor(int percent); -EXPORT void CALL VolumeUp(void); -EXPORT void CALL VolumeDown(void); -EXPORT int CALL VolumeGetLevel(void); -EXPORT void CALL VolumeSetLevel(int level); -EXPORT void CALL VolumeMute(void); -EXPORT const char * CALL VolumeGetString(void); -#endif - -/* input plugin function pointers */ -typedef void (*ptr_ControllerCommand)(int Control, unsigned char *Command); -typedef void (*ptr_GetKeys)(int Control, BUTTONS *Keys); -typedef void (*ptr_InitiateControllers)(CONTROL_INFO ControlInfo); -typedef void (*ptr_ReadController)(int Control, unsigned char *Command); -typedef void (*ptr_SDL_KeyDown)(int keymod, int keysym); -typedef void (*ptr_SDL_KeyUp)(int keymod, int keysym); -typedef void (*ptr_RenderCallback)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL ControllerCommand(int Control, unsigned char *Command); -EXPORT void CALL GetKeys(int Control, BUTTONS *Keys); -EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo); -EXPORT void CALL ReadController(int Control, unsigned char *Command); -EXPORT void CALL SDL_KeyDown(int keymod, int keysym); -EXPORT void CALL SDL_KeyUp(int keymod, int keysym); -EXPORT void CALL RenderCallback(void); -#endif - -/* RSP plugin function pointers */ -typedef unsigned int (*ptr_DoRspCycles)(unsigned int Cycles); -typedef void (*ptr_InitiateRSP)(RSP_INFO Rsp_Info, unsigned int *CycleCount); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT unsigned int CALL DoRspCycles(unsigned int Cycles); -EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int *CycleCount); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* M64P_PLUGIN_H */ - - diff --git a/GLideN64/src/inc/m64p_types.h b/GLideN64/src/inc/m64p_types.h deleted file mode 100644 index e915e7b..0000000 --- a/GLideN64/src/inc/m64p_types.h +++ /dev/null @@ -1,417 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_types.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2012 CasualJames * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#if !defined(M64P_TYPES_H) -#define M64P_TYPES_H - -/* ----------------------------------------- */ -/* Platform-specific stuff */ -/* ----------------------------------------- */ - -/* necessary headers */ -#include <stdint.h> -#if defined(WIN32) || defined(WIN64) - #include <windows.h> -#endif - -/* DLL handles and function declaration specifiers */ -#if defined(WIN32) || defined(WIN64) - #define IMPORT extern "C" __declspec(dllimport) - #define EXPORT __declspec(dllexport) - #define CALL __cdecl - typedef HMODULE m64p_dynlib_handle; -#else - #define IMPORT extern "C" - #define EXPORT __attribute__((visibility("default"))) - #define CALL - typedef void * m64p_dynlib_handle; -#endif - -/* ----------------------------------------- */ -/* Structures and Types for Core library API */ -/* ----------------------------------------- */ - -typedef void * m64p_handle; - -/* Generic function pointer returned from osal_dynlib_getproc (and the like) - * Don't use it directly, cast to proper type before using it. - */ -typedef void (*m64p_function)(void); - -typedef void (*m64p_frame_callback)(unsigned int FrameIndex); -typedef void (*m64p_input_callback)(void); -typedef void (*m64p_audio_callback)(void); -typedef void (*m64p_vi_callback)(void); - -typedef enum { - M64TYPE_INT = 1, - M64TYPE_FLOAT, - M64TYPE_BOOL, - M64TYPE_STRING -} m64p_type; - -typedef enum { - M64MSG_ERROR = 1, - M64MSG_WARNING, - M64MSG_INFO, - M64MSG_STATUS, - M64MSG_VERBOSE -} m64p_msg_level; - -typedef enum { - M64ERR_SUCCESS = 0, - M64ERR_NOT_INIT, /* Function is disallowed before InitMupen64Plus() is called */ - M64ERR_ALREADY_INIT, /* InitMupen64Plus() was called twice */ - M64ERR_INCOMPATIBLE, /* API versions between components are incompatible */ - M64ERR_INPUT_ASSERT, /* Invalid parameters for function call, such as ParamValue=NULL for GetCoreParameter() */ - M64ERR_INPUT_INVALID, /* Invalid input data, such as ParamValue="maybe" for SetCoreParameter() to set a BOOL-type value */ - M64ERR_INPUT_NOT_FOUND, /* The input parameter(s) specified a particular item which was not found */ - M64ERR_NO_MEMORY, /* Memory allocation failed */ - M64ERR_FILES, /* Error opening, creating, reading, or writing to a file */ - M64ERR_INTERNAL, /* Internal error (bug) */ - M64ERR_INVALID_STATE, /* Current program state does not allow operation */ - M64ERR_PLUGIN_FAIL, /* A plugin function returned a fatal error */ - M64ERR_SYSTEM_FAIL, /* A system function call, such as an SDL or file operation, failed */ - M64ERR_UNSUPPORTED, /* Function call is not supported (ie, core not built with debugger) */ - M64ERR_WRONG_TYPE /* A given input type parameter cannot be used for desired operation */ -} m64p_error; - -typedef enum { - M64CAPS_DYNAREC = 1, - M64CAPS_DEBUGGER = 2, - M64CAPS_CORE_COMPARE = 4 -} m64p_core_caps; - -typedef enum { - M64PLUGIN_NULL = 0, - M64PLUGIN_RSP = 1, - M64PLUGIN_GFX, - M64PLUGIN_AUDIO, - M64PLUGIN_INPUT, - M64PLUGIN_CORE -} m64p_plugin_type; - -typedef enum { - M64EMU_STOPPED = 1, - M64EMU_RUNNING, - M64EMU_PAUSED -} m64p_emu_state; - -typedef enum { - M64VIDEO_NONE = 1, - M64VIDEO_WINDOWED, - M64VIDEO_FULLSCREEN -} m64p_video_mode; - -typedef enum { - M64VIDEOFLAG_SUPPORT_RESIZING = 1 -} m64p_video_flags; - -typedef enum { - M64CORE_EMU_STATE = 1, - M64CORE_VIDEO_MODE, - M64CORE_SAVESTATE_SLOT, - M64CORE_SPEED_FACTOR, - M64CORE_SPEED_LIMITER, - M64CORE_VIDEO_SIZE, - M64CORE_AUDIO_VOLUME, - M64CORE_AUDIO_MUTE, - M64CORE_INPUT_GAMESHARK, - M64CORE_STATE_LOADCOMPLETE, - M64CORE_STATE_SAVECOMPLETE -} m64p_core_param; - -typedef enum { - M64CMD_NOP = 0, - M64CMD_ROM_OPEN, - M64CMD_ROM_CLOSE, - M64CMD_ROM_GET_HEADER, - M64CMD_ROM_GET_SETTINGS, - M64CMD_EXECUTE, - M64CMD_STOP, - M64CMD_PAUSE, - M64CMD_RESUME, - M64CMD_CORE_STATE_QUERY, - M64CMD_STATE_LOAD, - M64CMD_STATE_SAVE, - M64CMD_STATE_SET_SLOT, - M64CMD_SEND_SDL_KEYDOWN, - M64CMD_SEND_SDL_KEYUP, - M64CMD_SET_FRAME_CALLBACK, - M64CMD_TAKE_NEXT_SCREENSHOT, - M64CMD_CORE_STATE_SET, - M64CMD_READ_SCREEN, - M64CMD_RESET, - M64CMD_ADVANCE_FRAME, - M64CMD_SET_MEDIA_LOADER, - M64CMD_NETPLAY_INIT, - M64CMD_NETPLAY_CONTROL_PLAYER, - M64CMD_NETPLAY_GET_VERSION, - M64CMD_NETPLAY_CLOSE -} m64p_command; - -typedef struct { - uint32_t address; - int value; -} m64p_cheat_code; - -typedef struct { - /* Frontend-defined callback data. */ - void* cb_data; - - /* Allow the frontend to specify the GB cart ROM file to load - * cb_data: points to frontend-defined callback data. - * controller_num: (0-3) tell the frontend which controller is about to load a GB cart - * Returns a NULL-terminated string owned by the core specifying the GB cart ROM filename to load. - * Empty or NULL string results in no GB cart being loaded (eg. empty transferpak). - */ - char* (*get_gb_cart_rom)(void* cb_data, int controller_num); - - /* Allow the frontend to specify the GB cart RAM file to load - * cb_data: points to frontend-defined callback data. - * controller_num: (0-3) tell the frontend which controller is about to load a GB cart - * Returns a NULL-terminated string owned by the core specifying the GB cart RAM filename to load - * Empty or NULL string results in the core generating a default save file with empty content. - */ - char* (*get_gb_cart_ram)(void* cb_data, int controller_num); - - /* Allow the frontend to specify the DD IPL ROM file to load - * cb_data: points to frontend-defined callback data. - * Returns a NULL-terminated string owned by the core specifying the DD IPL ROM filename to load - * Empty or NULL string results in disabled 64DD. - */ - char* (*get_dd_rom)(void* cb_data); - - /* Allow the frontend to specify the DD disk file to load - * cb_data: points to frontend-defined callback data. - * Returns a NULL-terminated string owned by the core specifying the DD disk filename to load - * Empty or NULL string results in no DD disk being loaded (eg. empty disk drive). - */ - char* (*get_dd_disk)(void* cb_data); -} m64p_media_loader; - -/* ----------------------------------------- */ -/* Structures to hold ROM image information */ -/* ----------------------------------------- */ - -typedef enum -{ - SYSTEM_NTSC = 0, - SYSTEM_PAL, - SYSTEM_MPAL -} m64p_system_type; - -typedef struct -{ - uint8_t init_PI_BSB_DOM1_LAT_REG; /* 0x00 */ - uint8_t init_PI_BSB_DOM1_PGS_REG; /* 0x01 */ - uint8_t init_PI_BSB_DOM1_PWD_REG; /* 0x02 */ - uint8_t init_PI_BSB_DOM1_PGS_REG2; /* 0x03 */ - uint32_t ClockRate; /* 0x04 */ - uint32_t PC; /* 0x08 */ - uint32_t Release; /* 0x0C */ - uint32_t CRC1; /* 0x10 */ - uint32_t CRC2; /* 0x14 */ - uint32_t Unknown[2]; /* 0x18 */ - uint8_t Name[20]; /* 0x20 */ - uint32_t unknown; /* 0x34 */ - uint32_t Manufacturer_ID; /* 0x38 */ - uint16_t Cartridge_ID; /* 0x3C - Game serial number */ - uint16_t Country_code; /* 0x3E */ -} m64p_rom_header; - -typedef struct -{ - char goodname[256]; - char MD5[33]; - unsigned char savetype; - unsigned char status; /* Rom status on a scale from 0-5. */ - unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */ - unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */ - unsigned char transferpak; /* 0 - No, 1 - Yes boolean for transfer pak support. */ - unsigned char mempak; /* 0 - No, 1 - Yes boolean for memory pak support. */ - unsigned char biopak; /* 0 - No, 1 - Yes boolean for bio pak support. */ -} m64p_rom_settings; - -/* ----------------------------------------- */ -/* Structures and Types for the Debugger */ -/* ----------------------------------------- */ - -typedef enum { - M64P_DBG_RUN_STATE = 1, - M64P_DBG_PREVIOUS_PC, - M64P_DBG_NUM_BREAKPOINTS, - M64P_DBG_CPU_DYNACORE, - M64P_DBG_CPU_NEXT_INTERRUPT -} m64p_dbg_state; - -typedef enum { - M64P_DBG_RUNSTATE_PAUSED = 0, - M64P_DBG_RUNSTATE_STEPPING, - M64P_DBG_RUNSTATE_RUNNING -} m64p_dbg_runstate; - -typedef enum { - M64P_DBG_MEM_TYPE = 1, - M64P_DBG_MEM_FLAGS, - M64P_DBG_MEM_HAS_RECOMPILED, - M64P_DBG_MEM_NUM_RECOMPILED, - M64P_DBG_RECOMP_OPCODE = 16, - M64P_DBG_RECOMP_ARGS, - M64P_DBG_RECOMP_ADDR -} m64p_dbg_mem_info; - -typedef enum { - M64P_MEM_NOMEM = 0, - M64P_MEM_NOTHING, - M64P_MEM_RDRAM, - M64P_MEM_RDRAMREG, - M64P_MEM_RSPMEM, - M64P_MEM_RSPREG, - M64P_MEM_RSP, - M64P_MEM_DP, - M64P_MEM_DPS, - M64P_MEM_VI, - M64P_MEM_AI, - M64P_MEM_PI, - M64P_MEM_RI, - M64P_MEM_SI, - M64P_MEM_FLASHRAMSTAT, - M64P_MEM_ROM, - M64P_MEM_PIF, - M64P_MEM_MI, - M64P_MEM_BREAKPOINT -} m64p_dbg_mem_type; - -typedef enum { - M64P_MEM_FLAG_READABLE = 0x01, - M64P_MEM_FLAG_WRITABLE = 0x02, - M64P_MEM_FLAG_READABLE_EMUONLY = 0x04, /* the EMUONLY flags signify that emulated code can read/write here, but debugger cannot */ - M64P_MEM_FLAG_WRITABLE_EMUONLY = 0x08 -} m64p_dbg_mem_flags; - -typedef enum { - M64P_DBG_PTR_RDRAM = 1, - M64P_DBG_PTR_PI_REG, - M64P_DBG_PTR_SI_REG, - M64P_DBG_PTR_VI_REG, - M64P_DBG_PTR_RI_REG, - M64P_DBG_PTR_AI_REG -} m64p_dbg_memptr_type; - -typedef enum { - M64P_CPU_PC = 1, - M64P_CPU_REG_REG, - M64P_CPU_REG_HI, - M64P_CPU_REG_LO, - M64P_CPU_REG_COP0, - M64P_CPU_REG_COP1_DOUBLE_PTR, - M64P_CPU_REG_COP1_SIMPLE_PTR, - M64P_CPU_REG_COP1_FGR_64, - M64P_CPU_TLB -} m64p_dbg_cpu_data; - -typedef enum { - M64P_BKP_CMD_ADD_ADDR = 1, - M64P_BKP_CMD_ADD_STRUCT, - M64P_BKP_CMD_REPLACE, - M64P_BKP_CMD_REMOVE_ADDR, - M64P_BKP_CMD_REMOVE_IDX, - M64P_BKP_CMD_ENABLE, - M64P_BKP_CMD_DISABLE, - M64P_BKP_CMD_CHECK -} m64p_dbg_bkp_command; - -#define M64P_MEM_INVALID 0xFFFFFFFF /* invalid memory read will return this */ - -#define BREAKPOINTS_MAX_NUMBER 128 - -typedef enum { - M64P_BKP_FLAG_ENABLED = 0x01, - M64P_BKP_FLAG_READ = 0x02, - M64P_BKP_FLAG_WRITE = 0x04, - M64P_BKP_FLAG_EXEC = 0x08, - M64P_BKP_FLAG_LOG = 0x10 /* Log to the console when this breakpoint hits */ -} m64p_dbg_bkp_flags; - -#define BPT_CHECK_FLAG(a, b) ((a.flags & b) == b) -#define BPT_SET_FLAG(a, b) a.flags = (a.flags | b); -#define BPT_CLEAR_FLAG(a, b) a.flags = (a.flags & (~b)); -#define BPT_TOGGLE_FLAG(a, b) a.flags = (a.flags ^ b); - -typedef struct { - uint32_t address; - uint32_t endaddr; - unsigned int flags; -} m64p_breakpoint; - -/* ------------------------------------------------- */ -/* Structures and Types for Core Video Extension API */ -/* ------------------------------------------------- */ - -typedef struct { - unsigned int uiWidth; - unsigned int uiHeight; -} m64p_2d_size; - -typedef enum { - M64P_GL_DOUBLEBUFFER = 1, - M64P_GL_BUFFER_SIZE, - M64P_GL_DEPTH_SIZE, - M64P_GL_RED_SIZE, - M64P_GL_GREEN_SIZE, - M64P_GL_BLUE_SIZE, - M64P_GL_ALPHA_SIZE, - M64P_GL_SWAP_CONTROL, - M64P_GL_MULTISAMPLEBUFFERS, - M64P_GL_MULTISAMPLESAMPLES, - M64P_GL_CONTEXT_MAJOR_VERSION, - M64P_GL_CONTEXT_MINOR_VERSION, - M64P_GL_CONTEXT_PROFILE_MASK -} m64p_GLattr; - -typedef enum { - M64P_GL_CONTEXT_PROFILE_CORE, - M64P_GL_CONTEXT_PROFILE_COMPATIBILITY, - M64P_GL_CONTEXT_PROFILE_ES -} m64p_GLContextType; - -typedef struct { - unsigned int Functions; - m64p_error (*VidExtFuncInit)(void); - m64p_error (*VidExtFuncQuit)(void); - m64p_error (*VidExtFuncListModes)(m64p_2d_size *, int *); - m64p_error (*VidExtFuncListRates)(m64p_2d_size, int *, int *); - m64p_error (*VidExtFuncSetMode)(int, int, int, int, int); - m64p_error (*VidExtFuncSetModeWithRate)(int, int, int, int, int, int); - m64p_function (*VidExtFuncGLGetProc)(const char*); - m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int); - m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int *); - m64p_error (*VidExtFuncGLSwapBuf)(void); - m64p_error (*VidExtFuncSetCaption)(const char *); - m64p_error (*VidExtFuncToggleFS)(void); - m64p_error (*VidExtFuncResizeWindow)(int, int); - uint32_t (*VidExtFuncGLGetDefaultFramebuffer)(void); -} m64p_video_extension_functions; - -#endif /* define M64P_TYPES_H */ - diff --git a/GLideN64/src/inc/m64p_vidext.h b/GLideN64/src/inc/m64p_vidext.h deleted file mode 100644 index 9e2a338..0000000 --- a/GLideN64/src/inc/m64p_vidext.h +++ /dev/null @@ -1,190 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_vidext.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to the core's - * video extension functions. - */ - -#if !defined(M64P_VIDEXT_H) -#define M64P_VIDEXT_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* VidExt_Init() - * - * This function should be called from within the InitiateGFX() video plugin - * function call. The default SDL implementation of this function simply calls - * SDL_InitSubSystem(SDL_INIT_VIDEO). It does not open a rendering window or - * switch video modes. - */ -typedef m64p_error (*ptr_VidExt_Init)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_Init(void); -#endif - -/* VidExt_Quit() - * - * This function closes any open rendering window and shuts down the video - * system. The default SDL implementation of this function calls - * SDL_QuitSubSystem(SDL_INIT_VIDEO). This function should be called from - * within the RomClose() video plugin function. - */ -typedef m64p_error (*ptr_VidExt_Quit)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_Quit(void); -#endif - -/* VidExt_ListFullscreenModes() - * - * This function is used to enumerate the available resolutions for fullscreen - * video modes. A pointer to an array is passed into the function, which is - * then filled with resolution sizes. - */ -typedef m64p_error (*ptr_VidExt_ListFullscreenModes)(m64p_2d_size *, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ListFullscreenModes(m64p_2d_size *, int *); -#endif - -/* VidExt_ListFullscreenRates() - * - * This function is used to enumerate the available refresh rates for a fullscreen - * video mode. - * - */ -typedef m64p_error (*ptr_VidExt_ListFullscreenRates)(m64p_2d_size, int *, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size, int *, int *); -#endif - -/* VidExt_SetVideoMode() - * - * This function creates a rendering window or switches into a fullscreen - * video mode. Any desired OpenGL attributes should be set before calling - * this function. - */ -typedef m64p_error (*ptr_VidExt_SetVideoMode)(int, int, int, m64p_video_mode, m64p_video_flags); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_SetVideoMode(int, int, int, m64p_video_mode, m64p_video_flags); -#endif - -/* VidExt_SetVideoModeWithRate() - * - * This function creates a rendering window or switches into a fullscreen - * video mode. Any desired OpenGL attributes should be set before calling - * this function. - */ -typedef m64p_error (*ptr_VidExt_SetVideoModeWithRate)(int, int, int, int, m64p_video_mode, m64p_video_flags); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int, int, int, int, m64p_video_mode, m64p_video_flags); -#endif - -/* VidExt_ResizeWindow() - * - * This function resizes the opengl rendering window to match the given size. - */ -typedef m64p_error (*ptr_VidExt_ResizeWindow)(int, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ResizeWindow(int, int); -#endif - -/* VidExt_SetCaption() - * - * This function sets the caption text of the emulator rendering window. - */ -typedef m64p_error (*ptr_VidExt_SetCaption)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_SetCaption(const char *); -#endif - -/* VidExt_ToggleFullScreen() - * - * This function toggles between fullscreen and windowed rendering modes. - */ -typedef m64p_error (*ptr_VidExt_ToggleFullScreen)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ToggleFullScreen(void); -#endif - -/* VidExt_GL_GetProcAddress() - * - * This function is used to get a pointer to an OpenGL extension function. This - * is only necessary on the Windows platform, because the OpenGL implementation - * shipped with Windows only supports OpenGL version 1.1. - */ -typedef m64p_function (*ptr_VidExt_GL_GetProcAddress)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_function CALL VidExt_GL_GetProcAddress(const char *); -#endif - -/* VidExt_GL_SetAttribute() - * - * This function is used to set certain OpenGL attributes which must be - * specified before creating the rendering window with VidExt_SetVideoMode. - */ -typedef m64p_error (*ptr_VidExt_GL_SetAttribute)(m64p_GLattr, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr, int); -#endif - -/* VidExt_GL_GetAttribute() - * - * This function is used to get the value of OpenGL attributes. These values may - * be changed when calling VidExt_SetVideoMode. - */ -typedef m64p_error (*ptr_VidExt_GL_GetAttribute)(m64p_GLattr, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr, int *); -#endif - -/* VidExt_GL_SwapBuffers() - * - * This function is used to swap the front/back buffers after rendering an - * output video frame. - */ -typedef m64p_error (*ptr_VidExt_GL_SwapBuffers)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_GL_SwapBuffers(void); -#endif - -/* VidExt_GL_GetDefaultFramebuffer() - * - * On some platforms (for instance, iOS) the default framebuffer object - * depends on the surface being rendered to, and might be different from 0. - * This function should be called after VidExt_SetVideoMode to retrieve the - * name of the default FBO. - * Calling this function may have performance implications - * and it should not be called every time the default FBO is bound. - */ -typedef uint32_t (*ptr_VidExt_GL_GetDefaultFramebuffer)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT uint32_t CALL VidExt_GL_GetDefaultFramebuffer(void); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_VIDEXT_H */ - diff --git a/GLideN64/src/iob.cpp b/GLideN64/src/iob.cpp deleted file mode 100644 index ea180e1..0000000 --- a/GLideN64/src/iob.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include <stdio.h> - -FILE _iob[] = { *stdin, *stdout, *stderr }; -extern "C" FILE * __cdecl __iob_func(void) { return _iob; } diff --git a/GLideN64/src/mupenplus/CommonAPIImpl_mupenplus.cpp b/GLideN64/src/mupenplus/CommonAPIImpl_mupenplus.cpp deleted file mode 100644 index aea5a1f..0000000 --- a/GLideN64/src/mupenplus/CommonAPIImpl_mupenplus.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "GLideN64_mupenplus.h" -#include <algorithm> -#include <string> -#include <sstream> -#include <iostream> -#include <fstream> -#include <Platform.h> -#include "../PluginAPI.h" -#include "../RSP.h" - -#if defined(OS_WINDOWS) -EXTERN_C IMAGE_DOS_HEADER __ImageBase; -#elif defined(OS_MAC_OS_X) -#include <mach-o/dyld.h> -#endif - -int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo) -{ - _initiateGFX(_gfxInfo); - - int core_version; - unsigned int gfx_info_version = 1; - CoreGetVersion(NULL, &core_version, NULL, NULL, NULL); - if (core_version >= 0x020501) - gfx_info_version = _gfxInfo.version; - if (gfx_info_version >= 2) { - REG.SP_STATUS = _gfxInfo.SP_STATUS_REG; - rdram_size = _gfxInfo.RDRAM_SIZE; - } - - return TRUE; -} - -static -void _cutLastPathSeparator(wchar_t * _strPath) -{ -#ifdef OS_ANDROID - const u32 bufSize = 512; - char cbuf[bufSize]; - wcstombs(cbuf, _strPath, bufSize); - std::string pluginPath(cbuf); - std::string::size_type pos = pluginPath.find_last_of("/"); - mbstowcs(_strPath, pluginPath.c_str(), PLUGIN_PATH_SIZE); -#else - std::wstring pluginPath(_strPath); - std::replace(pluginPath.begin(), pluginPath.end(), L'\\', L'/'); - std::wstring::size_type pos = pluginPath.find_last_of(L"/"); - wcscpy(_strPath, pluginPath.substr(0, pos).c_str()); -#endif -} - -static -void _getWSPath(const char * _path, wchar_t * _strPath) -{ - ::mbstowcs(_strPath, _path, PLUGIN_PATH_SIZE); - _cutLastPathSeparator(_strPath); -} - -void PluginAPI::GetUserDataPath(wchar_t * _strPath) -{ - _getWSPath(ConfigGetUserDataPath(), _strPath); -} - -void PluginAPI::GetUserCachePath(wchar_t * _strPath) -{ - _getWSPath(ConfigGetUserCachePath(), _strPath); -} - -void PluginAPI::FindPluginPath(wchar_t * _strPath) -{ - if (_strPath == nullptr) - return; -#ifdef OS_WINDOWS - GetModuleFileNameW((HINSTANCE)&__ImageBase, _strPath, PLUGIN_PATH_SIZE); - _cutLastPathSeparator(_strPath); -#elif defined(OS_LINUX) - std::ifstream maps; - std::string line; - std::size_t loc; - maps.open("/proc/self/maps"); - - if (maps.is_open()) - { - while (getline(maps, line)) - { - loc = line.find('/'); - if (loc == std::string::npos) - continue; - - line = line.substr(loc); - - if (line.find("GLideN64") != std::string::npos) - { - _getWSPath(line.c_str(), _strPath); - maps.close(); - return; - } - } - - maps.close(); - } - - char path[512]; - int res = readlink("/proc/self/exe", path, 510); - if (res != -1) { - path[res] = 0; - _getWSPath(path, _strPath); - } -#elif defined(OS_MAC_OS_X) -#define MAXPATHLEN 256 - char path[MAXPATHLEN]; - uint32_t pathLen = MAXPATHLEN * 2; - if (_NSGetExecutablePath(path, &pathLen) == 0) { - _getWSPath(path, _strPath); - } -#elif defined(OS_ANDROID) - GetUserCachePath(_strPath); -#endif -} diff --git a/GLideN64/src/mupenplus/Config_mupenplus.cpp b/GLideN64/src/mupenplus/Config_mupenplus.cpp deleted file mode 100644 index 29f6df4..0000000 --- a/GLideN64/src/mupenplus/Config_mupenplus.cpp +++ /dev/null @@ -1,609 +0,0 @@ -#include "GLideN64_mupenplus.h" -#include <assert.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <osal_files.h> -#include <algorithm> - -#include "../Textures.h" -#include "../Config.h" -#include "../GLideN64.h" -#include "../GBI.h" -#include "../RSP.h" -#include "../Log.h" - -Config config; - -m64p_handle g_configVideoGeneral = nullptr; -m64p_handle g_configVideoGliden64 = nullptr; - -static -const char* _hotkeyDescription(u32 _idx) -{ - switch (_idx) - { - case Config::HotKey::hkTexDump: - return "Hotkey: toggle textures dump"; - case Config::HotKey::hkHdTexReload: - return "Hotkey: reload HD textures"; - case Config::HotKey::hkHdTexToggle: - return "Hotkey: toggle HD textures"; - case Config::HotKey::hkTexCoordBounds: - return "Hotkey: toggle texcoords bounds"; - case Config::HotKey::hkNativeResTexrects: - return "Hotkey: toggle 2D texrects in native resolution"; - case Config::HotKey::hkVsync: - return "Hotkey: toggle VSync"; - case Config::HotKey::hkFBEmulation: - return "Hotkey: toggle frame buffer emulation"; - case Config::HotKey::hkN64DepthCompare: - return "Hotkey: toggle N64 depth compare"; - case Config::HotKey::hkOsdVis: - return "Hotkey: toggle OSD VI/S"; - case Config::HotKey::hkOsdFps: - return "Hotkey: toggle OSD FPS"; - case Config::HotKey::hkOsdPercent: - return "Hotkey: toggle OSD percent"; - case Config::HotKey::hkOsdInternalResolution: - return "Hotkey: toggle OSD internal resolution"; - case Config::HotKey::hkOsdRenderingResolution: - return "Hotkey: toggle OSD rendering resolution"; - case Config::HotKey::hkForceGammaCorrection: - return "Hotkey: toggle force gamma correction"; - } - return "Unknown hotkey"; -} - -//static const unsigned char HID_TO_ASCII[256] = { -// 0, 0, 0, 0, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, -// 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 49, 50, -// 51, 52, 53, 54, 55, 56, 57, 48, 0, 0, 0, 32, 45, 43, 91, 93, -// 92, 59, 34, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -//}; - -static -u8 ASCIItoHID(const char * pStr) { - static const unsigned char ASCII_TO_HID[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, 0, 0, 0, 0, 0, - 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - if (strlen(pStr) != 1 || pStr[0] < 0) - return 0; - return ASCII_TO_HID[pStr[0]]; -} - -bool Config_SetDefault() -{ - if (ConfigOpenSection("Video-General", &g_configVideoGeneral) != M64ERR_SUCCESS) { - LOG(LOG_ERROR, "Unable to open Video-General configuration section"); - g_configVideoGeneral = nullptr; - return false; - } - if (ConfigOpenSection("Video-GLideN64", &g_configVideoGliden64) != M64ERR_SUCCESS) { - LOG(LOG_ERROR, "Unable to open GLideN64 configuration section"); - g_configVideoGliden64 = nullptr; - return false; - } - - config.resetToDefaults(); - // Set default values for "Video-General" section, if they are not set yet. Taken from RiceVideo - m64p_error res = ConfigSetDefaultBool(g_configVideoGeneral, "Fullscreen", config.video.fullscreen, "Use fullscreen mode if True, or windowed mode if False "); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGeneral, "ScreenWidth", config.video.windowedWidth, "Width of output window or fullscreen width"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGeneral, "ScreenHeight", config.video.windowedHeight, "Height of output window or fullscreen height"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGeneral, "VerticalSync", config.video.verticalSync, "If true, activate the SDL_GL_SWAP_CONTROL attribute"); - assert(res == M64ERR_SUCCESS); - - res = ConfigSetDefaultInt(g_configVideoGliden64, "configVersion", CONFIG_VERSION_CURRENT, "Settings version. Don't touch it."); - assert(res == M64ERR_SUCCESS); - - res = ConfigSetDefaultBool(g_configVideoGliden64, "ThreadedVideo", config.video.threadedVideo, "Enable threaded video backend"); - assert(res == M64ERR_SUCCESS); - - res = ConfigSetDefaultInt(g_configVideoGliden64, "MultiSampling", config.video.multisampling, "Enable/Disable MultiSampling (0=off, 2,4,8,16=quality)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "FXAA", config.video.fxaa, "Enable/Disable Fast Approximate Anti-Aliasing FXAA"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "AspectRatio", config.frameBufferEmulation.aspect, "Screen aspect ratio (0=stretch, 1=force 4:3, 2=force 16:9, 3=adjust)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "BufferSwapMode", config.frameBufferEmulation.bufferSwapMode, "Swap frame buffers (0=On VI update call, 1=On VI origin change, 2=On buffer update)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "UseNativeResolutionFactor", config.frameBufferEmulation.nativeResFactor, "Frame buffer size is the factor of N64 native resolution."); - assert(res == M64ERR_SUCCESS); - - //#Texture Settings - res = ConfigSetDefaultBool(g_configVideoGliden64, "bilinearMode", config.texture.bilinearMode, "Bilinear filtering mode (0=N64 3point, 1=standard)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "enableHalosRemoval", config.texture.enableHalosRemoval, "Remove halos around filtered textures."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "MaxAnisotropy", config.texture.maxAnisotropy, "Max level of Anisotropic Filtering, 0 for off"); - assert(res == M64ERR_SUCCESS); - //#Emulation Settings - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableDitheringPattern", config.generalEmulation.enableDitheringPattern, "Enable dithering pattern on output image."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHiresNoiseDithering", config.generalEmulation.enableHiresNoiseDithering, "Enable hi-res noise dithering."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "DitheringQuantization", config.generalEmulation.enableDitheringQuantization, "Dither with color quantization."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "RDRAMImageDitheringMode", config.generalEmulation.rdramImageDitheringMode, "Dithering mode for image in RDRAM. (0=disable, 1=bayer, 2=magic square, 3=blue noise)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableLOD", config.generalEmulation.enableLOD, "Enable LOD emulation."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHWLighting", config.generalEmulation.enableHWLighting, "Enable hardware per-pixel lighting."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCoverage", config.generalEmulation.enableCoverage, "Enable pixel coverage calculation. Used for better blending emulation and wire-frame mode. Needs fast GPU."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableClipping", config.generalEmulation.enableClipping, "Enable software vertices clipping. Brings various benefits."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableShadersStorage", config.generalEmulation.enableShadersStorage, "Use persistent storage for compiled shaders."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableLegacyBlending", config.generalEmulation.enableLegacyBlending, "Do not use shaders to emulate N64 blending modes. Works faster on slow GPU. Can cause glitches."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHybridFilter", config.generalEmulation.enableHybridFilter, "Enable hybrid integer scaling filter, this can be slow with low-end GPUs"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableFragmentDepthWrite", config.generalEmulation.enableFragmentDepthWrite, "Enable writing of fragment depth. Some mobile GPUs do not support it, thus it made optional. Leave enabled."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCustomSettings", config.generalEmulation.enableCustomSettings, "Use GLideN64 per-game settings."); - assert(res == M64ERR_SUCCESS); -#if defined(OS_ANDROID) || defined(OS_IOS) - res = ConfigSetDefaultBool(g_configVideoGliden64, "ForcePolygonOffset", config.generalEmulation.forcePolygonOffset, "If true, use polygon offset values specified below"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultFloat(g_configVideoGliden64, "PolygonOffsetFactor", config.generalEmulation.polygonOffsetFactor, "Specifies a scale factor that is used to create a variable depth offset for each polygon"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultFloat(g_configVideoGliden64, "PolygonOffsetUnits", config.generalEmulation.polygonOffsetUnits, "Is multiplied by an implementation-specific value to create a constant depth offset"); - assert(res == M64ERR_SUCCESS); -#endif - //#2D graphics Settings - res = ConfigSetDefaultInt(g_configVideoGliden64, "CorrectTexrectCoords", config.graphics2D.correctTexrectCoords, "Make texrect coordinates continuous to avoid black lines between them. (0=Off, 1=Auto, 2=Force)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "EnableNativeResTexrects", config.graphics2D.enableNativeResTexrects, "Render 2D texrects in native resolution to fix misalignment between parts of 2D image. (0=Off, 1=Optimized, 2=Unoptimized)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "BackgroundsMode", config.graphics2D.bgMode, "Render backgrounds mode (HLE only). (0=One piece (fast), 1=Stripped (precise))"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "EnableTexCoordBounds", config.graphics2D.enableTexCoordBounds, "Bound texture rectangle texture coordinates to the values they take in native resolutions. It prevents garbage due to fetching out of texture bounds, but can result in hard edges. (0=Off, 1=On)"); - assert(res == M64ERR_SUCCESS); - - //#Frame Buffer Settings:" - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableFBEmulation", config.frameBufferEmulation.enable, "Enable frame and|or depth buffer emulation."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCopyAuxiliaryToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM, "Copy auxiliary buffers to RDRAM"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "EnableN64DepthCompare", config.frameBufferEmulation.N64DepthCompare, "Enable N64 depth compare instead of OpenGL standard one. Experimental. (0=Off, 1=Fast, 2=Compatible)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "ForceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear, "Force depth buffer clear. Hack. Needed for Eikou no Saint Andrews."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "DisableFBInfo", config.frameBufferEmulation.fbInfoDisabled, "Disable buffers read/write with FBInfo. Use for games, which do not work with FBInfo."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "FBInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk, "Read color buffer by 4kb chunks (strict follow to FBRead specification)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "FBInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk, "Read depth buffer by 4kb chunks (strict follow to FBRead specification)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "EnableCopyColorToRDRAM", config.frameBufferEmulation.copyToRDRAM, "Enable color buffer copy to RDRAM (0=do not copy, 1=copy in sync mode, 2=Double Buffer, 3=Triple Buffer)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "EnableCopyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM, "Enable depth buffer copy to RDRAM (0=do not copy, 1=copy from video memory, 2=use software render)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCopyColorFromRDRAM", config.frameBufferEmulation.copyFromRDRAM, "Enable color buffer copy from RDRAM."); - assert(res == M64ERR_SUCCESS); -#if defined(OS_WINDOWS) - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCopyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer, "Enable copy of depth information from FBO to main depth buffer. Required for some Reshade shaders."); - assert(res == M64ERR_SUCCESS); -#endif - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableOverscan", config.frameBufferEmulation.enableOverscan, "Enable resulted image crop by Overscan."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanPalLeft", config.frameBufferEmulation.overscanPAL.left, "PAL mode. Left bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanPalRight", config.frameBufferEmulation.overscanPAL.right, "PAL mode. Right bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanPalTop", config.frameBufferEmulation.overscanPAL.top, "PAL mode. Top bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom, "PAL mode. Bottom bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left, "NTSC mode. Left bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanNtscRight", config.frameBufferEmulation.overscanNTSC.right, "NTSC mode. Right bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanNtscTop", config.frameBufferEmulation.overscanNTSC.top, "NTSC mode. Top bound of Overscan"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "OverscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom, "NTSC mode. Bottom bound of Overscan"); - assert(res == M64ERR_SUCCESS); - //#Texture filter settings - res = ConfigSetDefaultInt(g_configVideoGliden64, "txFilterMode", config.textureFilter.txFilterMode, "Texture filter (0=none, 1=Smooth filtering 1, 2=Smooth filtering 2, 3=Smooth filtering 3, 4=Smooth filtering 4, 5=Sharp filtering 1, 6=Sharp filtering 2)"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "txEnhancementMode", config.textureFilter.txEnhancementMode, "Texture Enhancement (0=none, 1=store as is, 2=X2, 3=X2SAI, 4=HQ2X, 5=HQ2XS, 6=LQ2X, 7=LQ2XS, 8=HQ4X, 9=2xBRZ, 10=3xBRZ, 11=4xBRZ, 12=5xBRZ), 13=6xBRZ"); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txDeposterize", config.textureFilter.txDeposterize, "Deposterize texture before enhancement."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG, "Don't filter background textures."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "txCacheSize", config.textureFilter.txCacheSize/ gc_uMegabyte, "Size of memory cache for enhanced textures in megabytes."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txHiresEnable", config.textureFilter.txHiresEnable, "Use high-resolution texture packs if available."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel, "Allow to use alpha channel of high-res texture fully."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txHresAltCRC", config.textureFilter.txHresAltCRC, "Use alternative method of paletted textures CRC calculation."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txCacheCompression", config.textureFilter.txCacheCompression, "Zip textures cache."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txForce16bpp", config.textureFilter.txForce16bpp, "Force use 16bit texture formats for HD textures."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txSaveCache", config.textureFilter.txSaveCache, "Save texture cache to hard disk."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage, "Use file storage instead of memory cache for enhanced textures."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage, "Use file storage instead of memory cache for HD textures."); - assert(res == M64ERR_SUCCESS); - // Convert to multibyte - char txPath[PLUGIN_PATH_SIZE * 2]; - wcstombs(txPath, config.textureFilter.txPath, PLUGIN_PATH_SIZE * 2); - res = ConfigSetDefaultString(g_configVideoGliden64, "txPath", txPath, "Path to folder with hi-res texture packs."); - assert(res == M64ERR_SUCCESS); - wcstombs(txPath, config.textureFilter.txCachePath, PLUGIN_PATH_SIZE * 2); - res = ConfigSetDefaultString(g_configVideoGliden64, "txCachePath", txPath, "Path to folder where plugin saves texture cache files."); - assert(res == M64ERR_SUCCESS); - wcstombs(txPath, config.textureFilter.txDumpPath, PLUGIN_PATH_SIZE * 2); - res = ConfigSetDefaultString(g_configVideoGliden64, "txDumpPath", txPath, "Path to folder where plugin saves dumped textures."); - assert(res == M64ERR_SUCCESS); - - res = ConfigSetDefaultString(g_configVideoGliden64, "fontName", config.font.name.c_str(), "File name of True Type Font for text messages."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "fontSize", config.font.size, "Font size."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultString(g_configVideoGliden64, "fontColor", "B5E61D", "Font color in RGB format."); - assert(res == M64ERR_SUCCESS); - - //#Gamma correction settings - res = ConfigSetDefaultBool(g_configVideoGliden64, "ForceGammaCorrection", config.gammaCorrection.force, "Force gamma correction."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultFloat(g_configVideoGliden64, "GammaCorrectionLevel", config.gammaCorrection.level, "Gamma correction level."); - assert(res == M64ERR_SUCCESS); - - //#On screen display settings - res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowFPS", config.onScreenDisplay.fps, "Show FPS counter."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowVIS", config.onScreenDisplay.vis, "Show VI/S counter."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowPercent", config.onScreenDisplay.percent, "Show percent counter."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowInternalResolution", config.onScreenDisplay.internalResolution, "Show internal resolution."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowRenderingResolution", config.onScreenDisplay.renderingResolution, "Show rendering resolution."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowStatistics", config.onScreenDisplay.percent, "Show statistics for drawn elements."); - assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultInt(g_configVideoGliden64, "CountersPos", config.onScreenDisplay.pos, - "Counters position (1=top left, 2=top center, 4=top right, 8=bottom left, 16=bottom center, 32=bottom right)"); - assert(res == M64ERR_SUCCESS); - - //#Hotkey settings - for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - res = ConfigSetDefaultString(g_configVideoGliden64, Config::hotkeyIniName(idx), "", _hotkeyDescription(idx)); - assert(res == M64ERR_SUCCESS); - } - -#ifdef DEBUG_DUMP - //#Debug settings - res = ConfigSetDefaultInt(g_configVideoGliden64, "DebugDumpMode", config.debug.dumpMode, "Enable debug dump. Set 3 to normal or 7 to detailed dump."); - assert(res == M64ERR_SUCCESS); -#endif - - return ConfigSaveSection("Video-GLideN64") == M64ERR_SUCCESS; -} - -void Config_LoadCustomConfig() -{ - if (ConfigExternalGetParameter == nullptr || ConfigExternalOpen == nullptr || ConfigExternalClose == nullptr) - return; - char value[PATH_MAX]; - m64p_error result; - std::string ROMname = RSP.romname; - const char* pathName = ConfigGetSharedDataFilepath("GLideN64.custom.ini"); - if (pathName == nullptr) - return; - for (size_t pos = ROMname.find(' '); pos != std::string::npos; pos = ROMname.find(' ', pos)) - ROMname.replace(pos, 1, "%20"); - for (size_t pos = ROMname.find('\''); pos != std::string::npos; pos = ROMname.find('\'', pos)) - ROMname.replace(pos, 1, "%27"); - std::transform(ROMname.begin(), ROMname.end(), ROMname.begin(), ::toupper); - const char* sectionName = ROMname.c_str(); - m64p_handle fileHandle; - result = ConfigExternalOpen(pathName, &fileHandle); - if (result != M64ERR_SUCCESS) - return; - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\fullscreenWidth", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.video.fullscreenWidth = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\fullscreenHeight", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.video.fullscreenHeight = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\windowedWidth", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.video.windowedWidth = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\windowedHeight", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.video.windowedHeight = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\fullscreenRefresh", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.video.fullscreenRefresh = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\multisampling", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.video.multisampling = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "video\\FXAA", value, sizeof(value)); - if (result == M64ERR_SUCCESS) { - config.video.fxaa = atoi(value); - if (config.video.fxaa != 0) - config.video.multisampling = 0; - } - - result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\maxAnisotropy", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.texture.maxAnisotropy = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\bilinearMode", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.texture.bilinearMode = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\enableHalosRemoval", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.texture.enableHalosRemoval = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\screenShotFormat", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.texture.screenShotFormat = atoi(value); - - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableDitheringPattern", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableDitheringPattern = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableHiresNoiseDithering", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableHiresNoiseDithering = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableDitheringQuantization", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableDitheringQuantization = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\rdramImageDitheringMode", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.rdramImageDitheringMode = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableLOD", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableLOD = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableHWLighting", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableHWLighting = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableCoverage", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableCoverage = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableClipping", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableClipping = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableShadersStorage", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableShadersStorage = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableLegacyBlending", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableLegacyBlending = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableFragmentDepthWrite", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.generalEmulation.enableFragmentDepthWrite = atoi(value); - - result = ConfigExternalGetParameter(fileHandle, sectionName, "graphics2D\\correctTexrectCoords", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.graphics2D.correctTexrectCoords = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "graphics2D\\enableNativeResTexrects", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.graphics2D.enableNativeResTexrects = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "graphics2D\\bgMode", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.graphics2D.bgMode = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "graphics2D\\enableTexCoordBounds", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.graphics2D.enableTexCoordBounds = atoi(value); - - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\enable", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.enable = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\aspect", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.aspect = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\nativeResFactor", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.nativeResFactor = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\bufferSwapMode", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.bufferSwapMode = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\N64DepthCompare", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.N64DepthCompare = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\forceDepthBufferClear", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.forceDepthBufferClear = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\copyAuxToRDRAM", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.copyAuxToRDRAM = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\copyToRDRAM", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.copyToRDRAM = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\copyDepthToRDRAM", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.copyDepthToRDRAM = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\copyFromRDRAM", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.copyFromRDRAM = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\fbInfoDisabled", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.fbInfoDisabled = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\fbInfoReadColorChunk", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.fbInfoReadColorChunk = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\fbInfoReadDepthChunk", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.fbInfoReadDepthChunk = atoi(value); -#if defined(OS_WINDOWS) - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\EnableCopyDepthToMainDepthBuffer", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.copyDepthToMainDepthBuffer = atoi(value); -#endif - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\EnableOverscan", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.enableOverscan = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanPalLeft", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanPAL.left = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanPalRight", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanPAL.right = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanPalTop", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanPAL.top = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanPalBottom", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanPAL.bottom = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanNtscLeft", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanNTSC.left = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanNtscRight", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanNTSC.right = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanNtscTop", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanNTSC.top = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "frameBufferEmulation\\OverscanNtscBottom", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.frameBufferEmulation.overscanNTSC.bottom = atoi(value); - - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txFilterMode", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txFilterMode = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txEnhancementMode", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txEnhancementMode = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txDeposterize", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txDeposterize = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txFilterIgnoreBG", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txFilterIgnoreBG = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txCacheSize", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txCacheSize = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txHiresEnable", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txHiresEnable = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txHiresFullAlphaChannel", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txHiresFullAlphaChannel = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txHresAltCRC", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txHresAltCRC = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txDump", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txForce16bpp = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txCacheCompression", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txCacheCompression = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txSaveCache", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txSaveCache = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txEnhancedTextureFileStorage", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txEnhancedTextureFileStorage = atoi(value); - result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txHiresTextureFileStorage", value, sizeof(value)); - if (result == M64ERR_SUCCESS) config.textureFilter.txHiresTextureFileStorage = atoi(value); - ConfigExternalClose(fileHandle); -} - -void Config_LoadConfig() -{ - if (g_configVideoGeneral == nullptr || g_configVideoGliden64 == nullptr) - return; - - config.video.fullscreen = ConfigGetParamBool(g_configVideoGeneral, "Fullscreen"); - config.video.windowedWidth = ConfigGetParamInt(g_configVideoGeneral, "ScreenWidth"); - config.video.windowedHeight = ConfigGetParamInt(g_configVideoGeneral, "ScreenHeight"); - config.video.verticalSync = ConfigGetParamBool(g_configVideoGeneral, "VerticalSync"); - config.video.threadedVideo = ConfigGetParamBool(g_configVideoGliden64, "ThreadedVideo"); - const u32 multisampling = ConfigGetParamInt(g_configVideoGliden64, "MultiSampling"); - config.video.multisampling = multisampling == 0 ? 0 : pow2(multisampling); - config.video.fxaa = ConfigGetParamBool(g_configVideoGliden64, "FXAA"); - if (config.video.fxaa != 0) - config.video.multisampling = 0; - config.frameBufferEmulation.aspect = ConfigGetParamInt(g_configVideoGliden64, "AspectRatio"); - config.frameBufferEmulation.bufferSwapMode = ConfigGetParamInt(g_configVideoGliden64, "BufferSwapMode"); - config.frameBufferEmulation.nativeResFactor = ConfigGetParamInt(g_configVideoGliden64, "UseNativeResolutionFactor"); - - //#Texture Settings - config.texture.bilinearMode = ConfigGetParamBool(g_configVideoGliden64, "bilinearMode"); - config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy"); - config.texture.enableHalosRemoval = ConfigGetParamBool(g_configVideoGliden64, "enableHalosRemoval"); - //#Emulation Settings - config.generalEmulation.enableDitheringPattern = ConfigGetParamBool(g_configVideoGliden64, "EnableDitheringPattern"); - config.generalEmulation.enableHiresNoiseDithering = ConfigGetParamBool(g_configVideoGliden64, "EnableHiresNoiseDithering"); - config.generalEmulation.enableDitheringQuantization = ConfigGetParamBool(g_configVideoGliden64, "DitheringQuantization"); - config.generalEmulation.rdramImageDitheringMode = ConfigGetParamInt(g_configVideoGliden64, "RDRAMImageDitheringMode"); - - config.generalEmulation.enableLOD = ConfigGetParamBool(g_configVideoGliden64, "EnableLOD"); - config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting"); - config.generalEmulation.enableCoverage = ConfigGetParamBool(g_configVideoGliden64, "EnableCoverage"); - config.generalEmulation.enableClipping = ConfigGetParamBool(g_configVideoGliden64, "enableClipping"); - config.generalEmulation.enableShadersStorage = ConfigGetParamBool(g_configVideoGliden64, "EnableShadersStorage"); - config.generalEmulation.enableLegacyBlending = ConfigGetParamBool(g_configVideoGliden64, "EnableLegacyBlending"); - config.generalEmulation.enableHybridFilter = ConfigGetParamBool(g_configVideoGliden64, "EnableHybridFilter"); - config.generalEmulation.enableFragmentDepthWrite = ConfigGetParamBool(g_configVideoGliden64, "EnableFragmentDepthWrite"); - config.generalEmulation.enableCustomSettings = ConfigGetParamBool(g_configVideoGliden64, "EnableCustomSettings"); -#if defined(OS_ANDROID) || defined(OS_IOS) - config.generalEmulation.forcePolygonOffset = ConfigGetParamBool(g_configVideoGliden64, "ForcePolygonOffset"); - config.generalEmulation.polygonOffsetFactor = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetFactor"); - config.generalEmulation.polygonOffsetUnits = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetUnits"); -#endif - //#2D graphics Settings - config.graphics2D.correctTexrectCoords = ConfigGetParamInt(g_configVideoGliden64, "CorrectTexrectCoords"); - config.graphics2D.enableNativeResTexrects = ConfigGetParamInt(g_configVideoGliden64, "EnableNativeResTexrects"); - config.graphics2D.bgMode = ConfigGetParamInt(g_configVideoGliden64, "BackgroundsMode"); - config.graphics2D.enableTexCoordBounds = ConfigGetParamInt(g_configVideoGliden64, "EnableTexCoordBounds"); - //#Frame Buffer Settings:" - config.frameBufferEmulation.enable = ConfigGetParamBool(g_configVideoGliden64, "EnableFBEmulation"); - config.frameBufferEmulation.copyAuxToRDRAM = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyAuxiliaryToRDRAM"); - config.frameBufferEmulation.copyToRDRAM = ConfigGetParamInt(g_configVideoGliden64, "EnableCopyColorToRDRAM"); - config.frameBufferEmulation.copyDepthToRDRAM = ConfigGetParamInt(g_configVideoGliden64, "EnableCopyDepthToRDRAM"); - config.frameBufferEmulation.copyFromRDRAM = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyColorFromRDRAM"); - config.frameBufferEmulation.N64DepthCompare = ConfigGetParamInt(g_configVideoGliden64, "EnableN64DepthCompare"); - config.frameBufferEmulation.forceDepthBufferClear = ConfigGetParamBool(g_configVideoGliden64, "ForceDepthBufferClear"); - config.frameBufferEmulation.fbInfoDisabled = ConfigGetParamBool(g_configVideoGliden64, "DisableFBInfo"); - config.frameBufferEmulation.fbInfoReadColorChunk = ConfigGetParamBool(g_configVideoGliden64, "FBInfoReadColorChunk"); - config.frameBufferEmulation.fbInfoReadDepthChunk = ConfigGetParamBool(g_configVideoGliden64, "FBInfoReadDepthChunk"); -#if defined(OS_WINDOWS) - config.frameBufferEmulation.copyDepthToMainDepthBuffer = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyDepthToMainDepthBuffer"); -#endif - config.frameBufferEmulation.enableOverscan = ConfigGetParamBool(g_configVideoGliden64, "EnableOverscan"); - config.frameBufferEmulation.overscanPAL.left = ConfigGetParamInt(g_configVideoGliden64, "OverscanPalLeft"); - config.frameBufferEmulation.overscanPAL.right = ConfigGetParamInt(g_configVideoGliden64, "OverscanPalRight"); - config.frameBufferEmulation.overscanPAL.top = ConfigGetParamInt(g_configVideoGliden64, "OverscanPalTop"); - config.frameBufferEmulation.overscanPAL.bottom = ConfigGetParamInt(g_configVideoGliden64, "OverscanPalBottom"); - config.frameBufferEmulation.overscanNTSC.left = ConfigGetParamInt(g_configVideoGliden64, "OverscanNtscLeft"); - config.frameBufferEmulation.overscanNTSC.right = ConfigGetParamInt(g_configVideoGliden64, "OverscanNtscRight"); - config.frameBufferEmulation.overscanNTSC.top = ConfigGetParamInt(g_configVideoGliden64, "OverscanNtscTop"); - config.frameBufferEmulation.overscanNTSC.bottom = ConfigGetParamInt(g_configVideoGliden64, "OverscanNtscBottom"); - //#Texture filter settings - config.textureFilter.txFilterMode = ConfigGetParamInt(g_configVideoGliden64, "txFilterMode"); - config.textureFilter.txEnhancementMode = ConfigGetParamInt(g_configVideoGliden64, "txEnhancementMode"); - config.textureFilter.txDeposterize = ConfigGetParamInt(g_configVideoGliden64, "txDeposterize"); - config.textureFilter.txFilterIgnoreBG = ConfigGetParamBool(g_configVideoGliden64, "txFilterIgnoreBG"); - config.textureFilter.txCacheSize = ConfigGetParamInt(g_configVideoGliden64, "txCacheSize") * gc_uMegabyte; - config.textureFilter.txHiresEnable = ConfigGetParamBool(g_configVideoGliden64, "txHiresEnable"); - config.textureFilter.txHiresFullAlphaChannel = ConfigGetParamBool(g_configVideoGliden64, "txHiresFullAlphaChannel"); - config.textureFilter.txHresAltCRC = ConfigGetParamBool(g_configVideoGliden64, "txHresAltCRC"); - config.textureFilter.txForce16bpp = ConfigGetParamBool(g_configVideoGliden64, "txForce16bpp"); - config.textureFilter.txCacheCompression = ConfigGetParamBool(g_configVideoGliden64, "txCacheCompression"); - config.textureFilter.txSaveCache = ConfigGetParamBool(g_configVideoGliden64, "txSaveCache"); - config.textureFilter.txEnhancedTextureFileStorage = ConfigGetParamBool(g_configVideoGliden64, "txEnhancedTextureFileStorage"); - config.textureFilter.txHiresTextureFileStorage = ConfigGetParamBool(g_configVideoGliden64, "txHiresTextureFileStorage"); - ::mbstowcs(config.textureFilter.txPath, ConfigGetParamString(g_configVideoGliden64, "txPath"), PLUGIN_PATH_SIZE); - ::mbstowcs(config.textureFilter.txCachePath, ConfigGetParamString(g_configVideoGliden64, "txCachePath"), PLUGIN_PATH_SIZE); - ::mbstowcs(config.textureFilter.txDumpPath, ConfigGetParamString(g_configVideoGliden64, "txDumpPath"), PLUGIN_PATH_SIZE); - - //#Font settings - config.font.name = ConfigGetParamString(g_configVideoGliden64, "fontName"); - if (config.font.name.empty()) - config.font.name = "arial.ttf"; - char buf[16]; - sprintf(buf, "0x%s", ConfigGetParamString(g_configVideoGliden64, "fontColor")); - long int uColor = strtol(buf, nullptr, 16); - if (uColor != 0) { - config.font.color[0] = _SHIFTR(uColor, 16, 8); - config.font.color[1] = _SHIFTR(uColor, 8, 8); - config.font.color[2] = _SHIFTR(uColor, 0, 8); - config.font.color[3] = 0xFF; - config.font.colorf[0] = _FIXED2FLOAT(config.font.color[0], 8); - config.font.colorf[1] = _FIXED2FLOAT(config.font.color[1], 8); - config.font.colorf[2] = _FIXED2FLOAT(config.font.color[2], 8); - config.font.colorf[3] = 1.0f; - } - config.font.size = ConfigGetParamInt(g_configVideoGliden64, "fontSize"); - if (config.font.size == 0) - config.font.size = 30; - - //#Gamma correction settings - config.gammaCorrection.force = ConfigGetParamBool(g_configVideoGliden64, "ForceGammaCorrection"); - config.gammaCorrection.level = ConfigGetParamFloat(g_configVideoGliden64, "GammaCorrectionLevel"); - - //#On screen display settings - config.onScreenDisplay.fps = ConfigGetParamBool(g_configVideoGliden64, "ShowFPS"); - config.onScreenDisplay.vis = ConfigGetParamBool(g_configVideoGliden64, "ShowVIS"); - config.onScreenDisplay.percent = ConfigGetParamBool(g_configVideoGliden64, "ShowPercent"); - config.onScreenDisplay.internalResolution = ConfigGetParamBool(g_configVideoGliden64, "ShowInternalResolution"); - config.onScreenDisplay.renderingResolution = ConfigGetParamBool(g_configVideoGliden64, "ShowRenderingResolution"); - config.onScreenDisplay.statistics = ConfigGetParamBool(g_configVideoGliden64, "ShowStatistics"); - config.onScreenDisplay.pos = ConfigGetParamInt(g_configVideoGliden64, "CountersPos"); - - //#Hotkey settings - for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) { - config.hotkeys.keys[idx] = ASCIItoHID(ConfigGetParamString(g_configVideoGliden64, Config::hotkeyIniName(idx))); - } - -#ifdef DEBUG_DUMP - config.debug.dumpMode = ConfigGetParamInt(g_configVideoGliden64, "DebugDumpMode"); -#endif - - if (config.generalEmulation.enableCustomSettings) - Config_LoadCustomConfig(); - - config.validate(); -} diff --git a/GLideN64/src/mupenplus/GLideN64_mupenplus.h b/GLideN64/src/mupenplus/GLideN64_mupenplus.h deleted file mode 100644 index 9e5ea6a..0000000 --- a/GLideN64/src/mupenplus/GLideN64_mupenplus.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef GLIDEN64_MUPENPLUS_H -#define GLIDEN64_MUPENPLUS_H - -#include "m64p_common.h" -#include "m64p_config.h" -#include "m64p_vidext.h" - -#define PLUGIN_VERSION 0x020000 -#define VIDEO_PLUGIN_API_VERSION 0x020200 -#define CONFIG_API_VERSION 0x020000 -#define VIDEXT_API_VERSION 0x030000 - -/* definitions of pointers to Core config functions */ -extern ptr_ConfigOpenSection ConfigOpenSection; -extern ptr_ConfigDeleteSection ConfigDeleteSection; -extern ptr_ConfigSaveSection ConfigSaveSection; -extern ptr_ConfigSaveFile ConfigSaveFile; -extern ptr_ConfigSetParameter ConfigSetParameter; -extern ptr_ConfigGetParameter ConfigGetParameter; -extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp; -extern ptr_ConfigSetDefaultInt ConfigSetDefaultInt; -extern ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat; -extern ptr_ConfigSetDefaultBool ConfigSetDefaultBool; -extern ptr_ConfigSetDefaultString ConfigSetDefaultString; -extern ptr_ConfigGetParamInt ConfigGetParamInt; -extern ptr_ConfigGetParamFloat ConfigGetParamFloat; -extern ptr_ConfigGetParamBool ConfigGetParamBool; -extern ptr_ConfigGetParamString ConfigGetParamString; -extern ptr_ConfigExternalGetParameter ConfigExternalGetParameter; -extern ptr_ConfigExternalOpen ConfigExternalOpen; -extern ptr_ConfigExternalClose ConfigExternalClose; -extern ptr_ConfigSendNetplayConfig ConfigSendNetplayConfig; -extern ptr_ConfigReceiveNetplayConfig ConfigReceiveNetplayConfig; - -extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath; -extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath; -extern ptr_ConfigGetUserDataPath ConfigGetUserDataPath; -extern ptr_ConfigGetUserCachePath ConfigGetUserCachePath; - - -extern ptr_VidExt_Init CoreVideo_Init; -extern ptr_VidExt_Quit CoreVideo_Quit; -extern ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes; -extern ptr_VidExt_ListFullscreenRates CoreVideo_ListFullscreenRates; -extern ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode; -extern ptr_VidExt_SetVideoModeWithRate CoreVideo_SetVideoModeWithRate; -extern ptr_VidExt_SetCaption CoreVideo_SetCaption; -extern ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen; -extern ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow; -extern ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress; -extern ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute; -extern ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute; -extern ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers; -extern ptr_VidExt_GL_GetDefaultFramebuffer CoreVideo_GL_GetDefaultFramebuffer; - -extern ptr_PluginGetVersion CoreGetVersion; - -extern const unsigned int* rdram_size; - -extern void(*renderCallback)(int); - -extern m64p_handle g_configVideoGeneral; - -#ifndef M64P_GLIDENUI -extern m64p_handle g_configVideoGliden64; -bool Config_SetDefault(); -#endif // M64P_GLIDENUI - -#endif // GLIDEN64_MUPENPLUS_H diff --git a/GLideN64/src/mupenplus/MemoryStatus_mupenplus.cpp b/GLideN64/src/mupenplus/MemoryStatus_mupenplus.cpp deleted file mode 100644 index d678914..0000000 --- a/GLideN64/src/mupenplus/MemoryStatus_mupenplus.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "../MemoryStatus.h" - -bool isMemoryWritable(void * ptr, size_t byteCount) -{ - return true; -} diff --git a/GLideN64/src/mupenplus/MupenPlusAPIImpl.cpp b/GLideN64/src/mupenplus/MupenPlusAPIImpl.cpp deleted file mode 100644 index 270d427..0000000 --- a/GLideN64/src/mupenplus/MupenPlusAPIImpl.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include "GLideN64_mupenplus.h" -#include "../PluginAPI.h" -#include "../GLideN64.h" -#include "../Config.h" -#include <DisplayWindow.h> - -#ifdef OS_WINDOWS -#define DLSYM(a, b) GetProcAddress(a, b) -#else -#include <dlfcn.h> -#define DLSYM(a, b) dlsym(a, b) -#endif // OS_WINDOWS - -ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = nullptr; -ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = nullptr; -ptr_ConfigGetUserDataPath ConfigGetUserDataPath = nullptr; -ptr_ConfigGetUserCachePath ConfigGetUserCachePath = nullptr; -ptr_ConfigOpenSection ConfigOpenSection = nullptr; -ptr_ConfigDeleteSection ConfigDeleteSection = nullptr; -ptr_ConfigSaveSection ConfigSaveSection = nullptr; -ptr_ConfigSaveFile ConfigSaveFile = nullptr; -ptr_ConfigSetDefaultInt ConfigSetDefaultInt = nullptr; -ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = nullptr; -ptr_ConfigSetDefaultBool ConfigSetDefaultBool = nullptr; -ptr_ConfigSetDefaultString ConfigSetDefaultString = nullptr; -ptr_ConfigGetParamInt ConfigGetParamInt = nullptr; -ptr_ConfigGetParamFloat ConfigGetParamFloat = nullptr; -ptr_ConfigGetParamBool ConfigGetParamBool = nullptr; -ptr_ConfigGetParamString ConfigGetParamString = nullptr; -ptr_ConfigExternalGetParameter ConfigExternalGetParameter = nullptr; -ptr_ConfigExternalOpen ConfigExternalOpen = nullptr; -ptr_ConfigExternalClose ConfigExternalClose = nullptr; -ptr_ConfigSendNetplayConfig ConfigSendNetplayConfig = nullptr; -ptr_ConfigReceiveNetplayConfig ConfigReceiveNetplayConfig = nullptr; - -/* definitions of pointers to Core video extension functions */ -ptr_VidExt_Init CoreVideo_Init = nullptr; -ptr_VidExt_Quit CoreVideo_Quit = nullptr; -ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = nullptr; -ptr_VidExt_ListFullscreenRates CoreVideo_ListFullscreenRates = nullptr; -ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = nullptr; -ptr_VidExt_SetVideoModeWithRate CoreVideo_SetVideoModeWithRate = nullptr; -ptr_VidExt_SetCaption CoreVideo_SetCaption = nullptr; -ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = nullptr; -ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = nullptr; -ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = nullptr; -ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = nullptr; -ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = nullptr; -ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = nullptr; -ptr_VidExt_GL_GetDefaultFramebuffer CoreVideo_GL_GetDefaultFramebuffer = nullptr; - -ptr_PluginGetVersion CoreGetVersion = nullptr; - -const unsigned int* rdram_size = nullptr; - -void(*renderCallback)(int) = nullptr; - -m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle) -{ - ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) DLSYM(_CoreLibHandle, "ConfigGetSharedDataFilepath"); - ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) DLSYM(_CoreLibHandle, "ConfigGetUserConfigPath"); - ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath)DLSYM(_CoreLibHandle, "ConfigGetUserCachePath"); - ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath)DLSYM(_CoreLibHandle, "ConfigGetUserDataPath"); - - ConfigOpenSection = (ptr_ConfigOpenSection)DLSYM(_CoreLibHandle, "ConfigOpenSection"); - ConfigDeleteSection = (ptr_ConfigDeleteSection)DLSYM(_CoreLibHandle, "ConfigDeleteSection"); - ConfigSaveSection = (ptr_ConfigSaveSection)DLSYM(_CoreLibHandle, "ConfigSaveSection"); - ConfigSaveFile = (ptr_ConfigSaveFile)DLSYM(_CoreLibHandle, "ConfigSaveFile"); - ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt)DLSYM(_CoreLibHandle, "ConfigSetDefaultInt"); - ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat)DLSYM(_CoreLibHandle, "ConfigSetDefaultFloat"); - ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool)DLSYM(_CoreLibHandle, "ConfigSetDefaultBool"); - ConfigSetDefaultString = (ptr_ConfigSetDefaultString)DLSYM(_CoreLibHandle, "ConfigSetDefaultString"); - ConfigGetParamInt = (ptr_ConfigGetParamInt)DLSYM(_CoreLibHandle, "ConfigGetParamInt"); - ConfigGetParamFloat = (ptr_ConfigGetParamFloat)DLSYM(_CoreLibHandle, "ConfigGetParamFloat"); - ConfigGetParamBool = (ptr_ConfigGetParamBool)DLSYM(_CoreLibHandle, "ConfigGetParamBool"); - ConfigGetParamString = (ptr_ConfigGetParamString)DLSYM(_CoreLibHandle, "ConfigGetParamString"); - ConfigExternalGetParameter = (ptr_ConfigExternalGetParameter)DLSYM(_CoreLibHandle, "ConfigExternalGetParameter"); - ConfigExternalOpen = (ptr_ConfigExternalOpen)DLSYM(_CoreLibHandle, "ConfigExternalOpen"); - ConfigExternalClose = (ptr_ConfigExternalClose)DLSYM(_CoreLibHandle, "ConfigExternalClose"); - ConfigSendNetplayConfig = (ptr_ConfigSendNetplayConfig)DLSYM(_CoreLibHandle, "ConfigSendNetplayConfig"); - ConfigReceiveNetplayConfig = (ptr_ConfigReceiveNetplayConfig)DLSYM(_CoreLibHandle, "ConfigReceiveNetplayConfig"); - - /* Get the core Video Extension function pointers from the library handle */ - CoreVideo_Init = (ptr_VidExt_Init) DLSYM(_CoreLibHandle, "VidExt_Init"); - CoreVideo_Quit = (ptr_VidExt_Quit) DLSYM(_CoreLibHandle, "VidExt_Quit"); - CoreVideo_ListFullscreenModes = (ptr_VidExt_ListFullscreenModes) DLSYM(_CoreLibHandle, "VidExt_ListFullscreenModes"); - CoreVideo_ListFullscreenRates = (ptr_VidExt_ListFullscreenRates) DLSYM(_CoreLibHandle, "VidExt_ListFullscreenRates"); - CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode) DLSYM(_CoreLibHandle, "VidExt_SetVideoMode"); - CoreVideo_SetVideoModeWithRate = (ptr_VidExt_SetVideoModeWithRate) DLSYM(_CoreLibHandle, "VidExt_SetVideoModeWithRate"); - CoreVideo_SetCaption = (ptr_VidExt_SetCaption) DLSYM(_CoreLibHandle, "VidExt_SetCaption"); - CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen) DLSYM(_CoreLibHandle, "VidExt_ToggleFullScreen"); - CoreVideo_ResizeWindow = (ptr_VidExt_ResizeWindow) DLSYM(_CoreLibHandle, "VidExt_ResizeWindow"); - CoreVideo_GL_GetProcAddress = (ptr_VidExt_GL_GetProcAddress) DLSYM(_CoreLibHandle, "VidExt_GL_GetProcAddress"); - CoreVideo_GL_SetAttribute = (ptr_VidExt_GL_SetAttribute) DLSYM(_CoreLibHandle, "VidExt_GL_SetAttribute"); - CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) DLSYM(_CoreLibHandle, "VidExt_GL_GetAttribute"); - CoreVideo_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) DLSYM(_CoreLibHandle, "VidExt_GL_SwapBuffers"); - CoreVideo_GL_GetDefaultFramebuffer = (ptr_VidExt_GL_GetDefaultFramebuffer) DLSYM(_CoreLibHandle, "VidExt_GL_GetDefaultFramebuffer"); - - CoreGetVersion = (ptr_PluginGetVersion) DLSYM(_CoreLibHandle, "PluginGetVersion"); - -#ifndef M64P_GLIDENUI - if (Config_SetDefault()) { - config.version = ConfigGetParamInt(g_configVideoGliden64, "configVersion"); - if (config.version != CONFIG_VERSION_CURRENT) { - ConfigDeleteSection("Video-GLideN64"); - ConfigSaveFile(); - Config_SetDefault(); - } - } -#endif // M64P_GLIDENUI - - config.netplay = 0; - - return M64ERR_SUCCESS; -} - -#ifdef M64P_GLIDENUI -m64p_error PluginAPI::PluginConfig() -{ - Config_DoConfig(); - return M64ERR_SUCCESS; -} -#endif // M64P_GLIDENUI - -m64p_error PluginAPI::PluginShutdown() -{ -#ifdef RSPTHREAD - _callAPICommand(acRomClosed); - delete m_pRspThread; - m_pRspThread = nullptr; -#endif - return M64ERR_SUCCESS; -} - -m64p_error PluginAPI::PluginGetVersion( - m64p_plugin_type * _PluginType, - int * _PluginVersion, - int * _APIVersion, - const char ** _PluginNamePtr, - int * _Capabilities -) -{ - /* set version info */ - if (_PluginType != nullptr) - *_PluginType = M64PLUGIN_GFX; - - if (_PluginVersion != nullptr) - *_PluginVersion = PLUGIN_VERSION; - - if (_APIVersion != nullptr) - *_APIVersion = VIDEO_PLUGIN_API_VERSION; - - if (_PluginNamePtr != nullptr) - *_PluginNamePtr = pluginNameWithRevision; - - if (_Capabilities != nullptr) - { - *_Capabilities = 0; - } - - return M64ERR_SUCCESS; -} - -void PluginAPI::SetRenderingCallback(void (*callback)(int)) -{ - renderCallback = callback; -} - -void PluginAPI::ResizeVideoOutput(int _Width, int _Height) -{ - dwnd().setWindowSize(_Width, _Height); -} - -void PluginAPI::ReadScreen2(void * _dest, int * _width, int * _height, int _front) -{ - dwnd().readScreen2(_dest, _width, _height, _front); -} diff --git a/GLideN64/src/mupenplus/video_api_export.ver b/GLideN64/src/mupenplus/video_api_export.ver deleted file mode 100644 index 7acc31d..0000000 --- a/GLideN64/src/mupenplus/video_api_export.ver +++ /dev/null @@ -1,23 +0,0 @@ -{ global: -PluginStartup; -PluginConfig; -PluginShutdown; -PluginGetVersion; -ChangeWindow; -InitiateGFX; -MoveScreen; -ProcessDList; -ProcessRDPList; -RomClosed; -RomOpen; -ShowCFB; -UpdateScreen; -ViStatusChanged; -ViWidthChanged; -ReadScreen2; -SetRenderingCallback; -ResizeVideoOutput; -FBRead; -FBWrite; -FBGetFrameBufferInfo; -local: *; }; diff --git a/GLideN64/src/osal/CMakeLists.txt b/GLideN64/src/osal/CMakeLists.txt deleted file mode 100644 index ef8c620..0000000 --- a/GLideN64/src/osal/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.9) - -project( osal ) - -LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/lib ) - -if(UNIX) - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(OSAL_SOURCES osal_files_unix.c osal_keys_linux.c) - add_definitions( - -DOS_LINUX -DNDEBUG - ) - else() - set(OSAL_SOURCES osal_files_unix.c osal_keys_unix.c) - add_definitions( - -DNDEBUG - ) - endif() -endif(UNIX) - -if(WIN32) - set(OSAL_SOURCES osal_files_win32.c osal_keys_win.c) - add_definitions( - -DOS_WINDOWS - -D_CRT_SECURE_NO_WARNINGS - ) -endif(WIN32) - -# Build type - -if( NOT CMAKE_BUILD_TYPE) - set( CMAKE_BUILD_TYPE Release) -endif( NOT CMAKE_BUILD_TYPE) - -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - set( CMAKE_BUILD_TYPE Debug) - set( DEBUG_BUILD TRUE) - add_definitions( - -DDEBUG - ) -endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - add_definitions( -D__MSC__) -endif() - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(GCC_CPP11_COMPILE_FLAGS "-std=c++0x") - if (NOT MINGW) - SET( PIC_FLAGS "-fPIC") - endif(NOT MINGW) - SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} -static ${PIC_FLAGS} " ) - SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static ${PIC_FLAGS} " ) -endif() - -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - add_library( osald STATIC ${OSAL_SOURCES}) -endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - -if( CMAKE_BUILD_TYPE STREQUAL "Release") - add_library( osal STATIC ${OSAL_SOURCES}) -endif( CMAKE_BUILD_TYPE STREQUAL "Release") diff --git a/GLideN64/src/osal/keycode/keycode.h b/GLideN64/src/osal/keycode/keycode.h deleted file mode 100644 index 0dea72a..0000000 --- a/GLideN64/src/osal/keycode/keycode.h +++ /dev/null @@ -1,148 +0,0 @@ -/* This file is automatically generated. */ -#ifndef KEYCODE_KEYCODE_H -#define KEYCODE_KEYCODE_H - -/* HID keycode definitions. These keycodes are portable, and correspond to - locations on the keyboard. For example, the keycode KEY_A corresponds to the - "A" key on US keyboard layouts, but KEY_A corresponds to the "Q" key on - French keyboard layouts. In either case, KEY_A is in the same physical - location on the keyboard. - - Platform-specific scancodes can be converted to the HID keycodes defined - here, see keytable.h. All keycodes which can be generated on at least one - platform are included here, but not all platforms will produce all keycodes. - The names of these keycodes are taken, with some modifications, from the HID - usage tables. Key codes starting with KEY are general keys, and the keys on - the numeric keypad have key codes starting with KP. */ -enum { - /* Zero, does not correspond to any key. */ - KEY_None = 0, - - /* Keycode definitions. */ - KEY_A = 4, - KEY_B = 5, - KEY_C = 6, - KEY_D = 7, - KEY_E = 8, - KEY_F = 9, - KEY_G = 10, - KEY_H = 11, - KEY_I = 12, - KEY_J = 13, - KEY_K = 14, - KEY_L = 15, - KEY_M = 16, - KEY_N = 17, - KEY_O = 18, - KEY_P = 19, - KEY_Q = 20, - KEY_R = 21, - KEY_S = 22, - KEY_T = 23, - KEY_U = 24, - KEY_V = 25, - KEY_W = 26, - KEY_X = 27, - KEY_Y = 28, - KEY_Z = 29, - KEY_1 = 30, - KEY_2 = 31, - KEY_3 = 32, - KEY_4 = 33, - KEY_5 = 34, - KEY_6 = 35, - KEY_7 = 36, - KEY_8 = 37, - KEY_9 = 38, - KEY_0 = 39, - KEY_Escape = 41, - KEY_Delete = 42, - KEY_Tab = 43, - KEY_Space = 44, - KEY_Minus = 45, - KEY_Equals = 46, - KEY_LeftBracket = 47, - KEY_RightBracket = 48, - KEY_Backslash = 49, - KEY_Semicolon = 51, - KEY_Quote = 52, - KEY_Grave = 53, - KEY_Comma = 54, - KEY_Period = 55, - KEY_Slash = 56, - KEY_CapsLock = 57, - KEY_F1 = 58, - KEY_F2 = 59, - KEY_F3 = 60, - KEY_F4 = 61, - KEY_F5 = 62, - KEY_F6 = 63, - KEY_F7 = 64, - KEY_F8 = 65, - KEY_F9 = 66, - KEY_F10 = 67, - KEY_F11 = 68, - KEY_F12 = 69, - KEY_PrintScreen = 70, - KEY_ScrollLock = 71, - KEY_Pause = 72, - KEY_Insert = 73, - KEY_Home = 74, - KEY_PageUp = 75, - KEY_DeleteForward = 76, - KEY_End = 77, - KEY_PageDown = 78, - KEY_Right = 79, - KEY_Left = 80, - KEY_Down = 81, - KEY_Up = 82, - KP_NumLock = 83, - KP_Divide = 84, - KP_Multiply = 85, - KP_Subtract = 86, - KP_Add = 87, - KP_Enter = 88, - KP_1 = 89, - KP_2 = 90, - KP_3 = 91, - KP_4 = 92, - KP_5 = 93, - KP_6 = 94, - KP_7 = 95, - KP_8 = 96, - KP_9 = 97, - KP_0 = 98, - KP_Point = 99, - KEY_NonUSBackslash = 100, - KP_Equals = 103, - KEY_F13 = 104, - KEY_F14 = 105, - KEY_F15 = 106, - KEY_F16 = 107, - KEY_F17 = 108, - KEY_F18 = 109, - KEY_F19 = 110, - KEY_F20 = 111, - KEY_F21 = 112, - KEY_F22 = 113, - KEY_F23 = 114, - KEY_F24 = 115, - KEY_Help = 117, - KEY_Menu = 118, - KEY_Mute = 127, - KEY_SysReq = 154, - KEY_Return = 158, - KP_Clear = 216, - KP_Decimal = 220, - KEY_LeftControl = 224, - KEY_LeftShift = 225, - KEY_LeftAlt = 226, - KEY_LeftGUI = 227, - KEY_RightControl = 228, - KEY_RightShift = 229, - KEY_RightAlt = 230, - KEY_RightGUI = 231, - MB_Left = 233 // GLideN64 - specific. Not an actual HID keycode. -}; - -#endif diff --git a/GLideN64/src/osal/osal_export.h b/GLideN64/src/osal/osal_export.h deleted file mode 100644 index 85e1d62..0000000 --- a/GLideN64/src/osal/osal_export.h +++ /dev/null @@ -1,12 +0,0 @@ -#if !defined(OSAL_EXPORT_H) -#define OSAL_EXPORT_H - -#if defined(OS_WINDOWS) -#define EXPORT __declspec(dllexport) -#define CALL __cdecl -#else /* Not WINDOWS */ -#define EXPORT __attribute__((visibility("default"))) -#define CALL -#endif - -#endif /* #define OSAL_EXPORT_H */ diff --git a/GLideN64/src/osal/osal_files.h b/GLideN64/src/osal/osal_files.h deleted file mode 100644 index a512556..0000000 --- a/GLideN64/src/osal/osal_files.h +++ /dev/null @@ -1,71 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-ui-console - osal_files.h * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file is for all kinds of system-dependent file handling - * - */ - -#if !defined(OSAL_FILES_H) -#define OSAL_FILES_H - -#include "osal_export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define OSAL_DIR_SEPARATOR_STR L"/" -#define OSAL_DIR_SEPARATOR_CHAR L'/' - -#if defined(OS_WINDOWS) -#ifndef PATH_MAX -#define PATH_MAX _MAX_PATH -#endif -#define strdup _strdup -#else /* Not WINDOWS */ -#ifndef PATH_MAX -#define PATH_MAX 260 -#endif -#endif - -// Returns 1 if name contains path to a directory, 0 otherwise -EXPORT int CALL osal_is_directory(const wchar_t* name); -// Returns 1 if name contains an absolute path, 0 otherwise. Path validity not tested. -EXPORT int CALL osal_is_absolute_path(const wchar_t* name); -// Returns 1 if path points to file or directory, 0 otherwise -EXPORT int CALL osal_path_existsA(const char *path); -// Returns 1 if path points to file or directory, 0 otherwise -EXPORT int CALL osal_path_existsW(const wchar_t *path); -// Returns 0 if all directories on the path exist or successfully created -// Returns 1 if path is bad -// Returns 2 if we can't create some directory on the path -EXPORT int CALL osal_mkdirp(const wchar_t *dirpath); - -EXPORT void * CALL osal_search_dir_open(const wchar_t *_pathname); -EXPORT const wchar_t * CALL osal_search_dir_read_next(void * dir_handle); -EXPORT void CALL osal_search_dir_close(void * dir_handle); - -#ifdef __cplusplus -} -#endif - -#endif /* #define OSAL_FILES_H */ - diff --git a/GLideN64/src/osal/osal_files_ios.mm b/GLideN64/src/osal/osal_files_ios.mm deleted file mode 100644 index d550509..0000000 --- a/GLideN64/src/osal/osal_files_ios.mm +++ /dev/null @@ -1,93 +0,0 @@ -#include "osal_files.h" -#import <Foundation/Foundation.h> -#include <string> - -/* global functions */ - -#ifdef __cplusplus -extern "C"{ -#endif - -EXPORT int CALL osal_path_existsA(const char *path) -{ - NSString* nsPath = [NSString stringWithUTF8String:path]; - return [[NSFileManager defaultManager] fileExistsAtPath:nsPath]; -} - -EXPORT int CALL osal_path_existsW(const wchar_t *_path) -{ - NSString* nsPath = [[NSString alloc] initWithBytes:_path length:wcslen(_path)*sizeof(*_path) encoding:NSUTF32LittleEndianStringEncoding]; - return [[NSFileManager defaultManager] fileExistsAtPath:nsPath]; -} - -EXPORT int CALL osal_is_absolute_path(const wchar_t* name) -{ - return name[0] == L'/'; -} - -EXPORT int CALL osal_is_directory(const wchar_t * _name) -{ - NSString* nsPath = [[NSString alloc] initWithBytes:_name length:wcslen(_name)*sizeof(*_name) encoding:NSUTF32LittleEndianStringEncoding]; - BOOL isDirectory; - if ([[NSFileManager defaultManager] fileExistsAtPath:nsPath isDirectory:&isDirectory] && isDirectory) - { - return 1; - } - return 0; -} - -EXPORT int CALL osal_mkdirp(const wchar_t *_dirpath) -{ - NSString* nsPath = [[NSString alloc] initWithBytes:_dirpath length:wcslen(_dirpath)*sizeof(*_dirpath) encoding:NSUTF32LittleEndianStringEncoding]; - if (![[NSFileManager defaultManager] createDirectoryAtPath:nsPath withIntermediateDirectories:YES attributes:nil error:nil]) - { - return 1; - } - return 0; -} - -struct IOSDirSearch -{ - const void *dirNSString; - const void *enumerator; - std::wstring currentFilePath; -}; - -EXPORT void * CALL osal_search_dir_open(const wchar_t *_pathname) -{ - NSString *nsPath = [[NSString alloc] initWithBytes:_pathname length:wcslen(_pathname)*sizeof(*_pathname) encoding:NSUTF32LittleEndianStringEncoding]; - IOSDirSearch *dirSearch = new IOSDirSearch; - dirSearch->dirNSString = CFBridgingRetain(nsPath); - dirSearch->enumerator = CFBridgingRetain([[NSFileManager defaultManager] enumeratorAtPath:nsPath]); - return dirSearch; -} - -EXPORT const wchar_t * CALL osal_search_dir_read_next(void * dir_handle) -{ - IOSDirSearch *dirSearch = (IOSDirSearch*)dir_handle; - NSString *dirPath = (__bridge NSString *)dirSearch->dirNSString; - NSDirectoryEnumerator *dirEnum = (__bridge NSDirectoryEnumerator *)dirSearch->enumerator; - - NSString *file = [dirEnum nextObject]; - NSString *filePath = [dirPath stringByAppendingPathComponent:file]; - BOOL isDirectory; - if ([[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDirectory] && isDirectory) - { - [dirEnum skipDescendants]; - } - NSData* data = [filePath dataUsingEncoding:NSUTF32LittleEndianStringEncoding]; - dirSearch->currentFilePath = (const wchar_t *)[data bytes]; - return dirSearch->currentFilePath.c_str(); -} - -EXPORT void CALL osal_search_dir_close(void * dir_handle) -{ - IOSDirSearch *dirSearch = (IOSDirSearch*)dir_handle; - CFRelease(dirSearch->dirNSString); - CFRelease(dirSearch->enumerator); - delete dirSearch; -} - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/osal/osal_files_unix.c b/GLideN64/src/osal/osal_files_unix.c deleted file mode 100644 index 578a133..0000000 --- a/GLideN64/src/osal/osal_files_unix.c +++ /dev/null @@ -1,150 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - osal_files_unix.c * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This file contains the definitions for the unix-specific file handling - * functions - */ - -#include <dirent.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#include "osal_files.h" - -/* global functions */ - -#ifdef __cplusplus -extern "C"{ -#endif - -EXPORT int CALL osal_path_existsA(const char *path) -{ - struct stat fileinfo; - return stat(path, &fileinfo) == 0 ? 1 : 0; -} - -EXPORT int CALL osal_path_existsW(const wchar_t *_path) -{ - char path[PATH_MAX]; - wcstombs(path, _path, PATH_MAX); - struct stat fileinfo; - return stat(path, &fileinfo) == 0 ? 1 : 0; -} - -EXPORT int CALL osal_is_absolute_path(const wchar_t* name) -{ - return name[0] == L'/'; -} - -EXPORT int CALL osal_is_directory(const wchar_t * _name) -{ - char name[PATH_MAX + 1]; - wcstombs(name, _name, PATH_MAX); - DIR* dir; - dir = opendir(name); - if(dir != NULL) - { - closedir(dir); - return 1; - } - return 0; -} - -EXPORT int CALL osal_mkdirp(const wchar_t *_dirpath) -{ - char dirpath[PATH_MAX]; - wcstombs(dirpath, _dirpath, PATH_MAX); - struct stat fileinfo; - int dirpathlen = strlen(dirpath); - char *currpath = strdup(dirpath); - - /* first, break the path into pieces by replacing all of the slashes wil NULL chars */ - while (strlen(currpath) > 1) - { - char *lastslash = strrchr(currpath, '/'); - if (lastslash == NULL) - break; - *lastslash = 0; - } - - /* then re-assemble the path from left to right until we get to a directory that doesn't exist */ - while (strlen(currpath) < dirpathlen) - { - if (strlen(currpath) > 0 && stat(currpath, &fileinfo) != 0) - break; - currpath[strlen(currpath)] = '/'; - } - - /* then walk up the path chain, creating directories along the way */ - do - { - if (stat(currpath, &fileinfo) != 0) - { - if (mkdir(currpath, 0700) != 0) - { - free(currpath); - return 1; /* mkdir failed */ - } - } - if (strlen(currpath) == dirpathlen) - break; - else - currpath[strlen(currpath)] = '/'; - } while (1); - - free(currpath); - return 0; -} - -EXPORT void * CALL osal_search_dir_open(const wchar_t *_pathname) -{ - char pathname[PATH_MAX]; - wcstombs(pathname, _pathname, PATH_MAX); - DIR *dir; - dir = opendir(pathname); - return dir; -} - -EXPORT const wchar_t * CALL osal_search_dir_read_next(void * dir_handle) -{ - static wchar_t last_filename[PATH_MAX]; - DIR *dir = (DIR *) dir_handle; - struct dirent *entry; - - entry = readdir(dir); - if (entry == NULL) - return NULL; - mbstowcs(last_filename, entry->d_name, PATH_MAX); - return last_filename; -} - -EXPORT void CALL osal_search_dir_close(void * dir_handle) -{ - closedir((DIR *) dir_handle); -} - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/osal/osal_files_win32.c b/GLideN64/src/osal/osal_files_win32.c deleted file mode 100644 index ab50439..0000000 --- a/GLideN64/src/osal/osal_files_win32.c +++ /dev/null @@ -1,167 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - osal_files_win32.c * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This file contains the definitions for the unix-specific file handling - * functions - */ - -#include <direct.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <windows.h> - -#include "osal_files.h" - -/* global functions */ - -#ifdef __cplusplus -extern "C"{ -#endif - -EXPORT int CALL osal_path_existsA(const char *path) -{ - struct _stat fileinfo; - return _stat(path, &fileinfo) == 0 ? 1 : 0; -} - -EXPORT int CALL osal_path_existsW(const wchar_t *path) -{ - struct _stat fileinfo; - return _wstat(path, &fileinfo) == 0 ? 1 : 0; -} - -EXPORT int CALL osal_is_absolute_path(const wchar_t* name) -{ - return wcschr(name, L':') != NULL || name[0] == L'\\' || name[0] == L'/'; -} - -EXPORT int CALL osal_is_directory(const wchar_t* _name) -{ - wchar_t DirName[MAX_PATH + 1]; - int namelen = 0; - - /* we must remove any trailing backslash on the end of the pathname, or this will fail */ - wcsncpy(DirName, _name, MAX_PATH); - DirName[MAX_PATH] = 0; - namelen = wcslen(DirName); - if (namelen > 0 && DirName[namelen - 1] == OSAL_DIR_SEPARATOR_CHAR) - DirName[namelen - 1] = L'\0'; - return (GetFileAttributes(DirName) & FILE_ATTRIBUTE_DIRECTORY); -} - -EXPORT int CALL osal_mkdirp(const wchar_t * dirpath) -{ - struct _stat fileinfo; - size_t dirpathlen = wcslen(dirpath); - wchar_t *currpath = _wcsdup(dirpath); - - /* first, remove sub-dirs on the end (by replacing slashes with NULL chars) until we find an existing directory */ - while (wcslen(currpath) > 1 && _wstat(currpath, &fileinfo) != 0) { - wchar_t *lastslash = wcsrchr(currpath, OSAL_DIR_SEPARATOR_CHAR); - if (lastslash == NULL) { - free(currpath); - return 1; /* error: we never found an existing directory, this path is bad */ - } - *lastslash = 0; - } - - /* then walk up the path chain, creating directories along the way */ - do { - if (currpath[wcslen(currpath) - 1] != OSAL_DIR_SEPARATOR_CHAR && _wstat(currpath, &fileinfo) != 0) - { - if (_wmkdir(currpath) != 0) - { - free(currpath); - return 2; /* mkdir failed */ - } - } - if (wcslen(currpath) == dirpathlen) - break; - else - currpath[wcslen(currpath)] = OSAL_DIR_SEPARATOR_CHAR; - } while (1); - - free(currpath); - return 0; -} - -typedef struct { - HANDLE hFind; - WIN32_FIND_DATA find_data; -} dir_search_info; - -EXPORT void * CALL osal_search_dir_open(const wchar_t *pathname) -{ - wchar_t SearchString[MAX_PATH + 1]; - dir_search_info *pInfo = (dir_search_info *)malloc(sizeof(dir_search_info)); - - if (pInfo == NULL) - return NULL; - - pInfo->hFind = INVALID_HANDLE_VALUE; - pInfo->find_data.cFileName[0] = 0; - - if (pathname[wcslen(pathname) - 1] == OSAL_DIR_SEPARATOR_CHAR) - swprintf(SearchString, MAX_PATH, L"%ls*", pathname); - else - swprintf(SearchString, MAX_PATH, L"%ls%ls*", pathname, OSAL_DIR_SEPARATOR_STR); - SearchString[MAX_PATH] = 0; - - pInfo->hFind = FindFirstFile(SearchString, &pInfo->find_data); - return (void *) pInfo; -} - -EXPORT const wchar_t * CALL osal_search_dir_read_next(void * search_info) -{ - static wchar_t last_filename[_MAX_PATH]; - dir_search_info *pInfo = (dir_search_info *) search_info; - - if (pInfo == NULL || pInfo->hFind == INVALID_HANDLE_VALUE || pInfo->find_data.cFileName[0] == 0) - return NULL; - - wcscpy(last_filename, pInfo->find_data.cFileName); - - if (FindNextFile(pInfo->hFind, &pInfo->find_data) == 0) - { - pInfo->find_data.cFileName[0] = 0; - } - - return last_filename; -} - -EXPORT void CALL osal_search_dir_close(void * search_info) -{ - dir_search_info *pInfo = (dir_search_info *) search_info; - - if (pInfo != NULL) - { - if (pInfo->hFind != INVALID_HANDLE_VALUE) - FindClose(pInfo->hFind); - free(pInfo); - } -} - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/osal/osal_keys.h b/GLideN64/src/osal/osal_keys.h deleted file mode 100644 index f102a0d..0000000 --- a/GLideN64/src/osal/osal_keys.h +++ /dev/null @@ -1,26 +0,0 @@ -#if !defined(OSAL_KEYS_H) -#define OSAL_KEYS_H - -#include "osal_export.h" -#include "keycode/keycode.h" - -#ifdef __cplusplus -extern "C" { -#endif - -EXPORT void CALL osal_keys_init(); - -EXPORT void CALL osal_keys_quit(); - -EXPORT void CALL osal_keys_update_state(); - -EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask); - -EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode); - -#ifdef __cplusplus -} -#endif - -#endif /* #define OSAL_KEYS_H */ - diff --git a/GLideN64/src/osal/osal_keys_linux.c b/GLideN64/src/osal/osal_keys_linux.c deleted file mode 100644 index fd310a0..0000000 --- a/GLideN64/src/osal/osal_keys_linux.c +++ /dev/null @@ -1,203 +0,0 @@ -#include "osal_keys.h" - -#include <linux/limits.h> -#include <linux/input.h> -#include <dirent.h> -#include <stddef.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -static const unsigned char LINUX_HID_TO_NATIVE[256] = { - 255, 255, 255, 255, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, - KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, - KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, - KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2, KEY_3, - KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, 255, KEY_ESC, - KEY_DELETE, KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE, - KEY_RIGHTBRACE, KEY_BACKSLASH, 255, KEY_SEMICOLON, KEY_APOSTROPHE, - KEY_GRAVE, KEY_COMMA, KEY_DOT, KEY_SLASH, KEY_CAPSLOCK, - KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, - KEY_F10, KEY_F11, KEY_F12, KEY_PRINT, KEY_SCROLLLOCK, KEY_PAUSE, - KEY_INSERT, KEY_HOME, KEY_PAGEUP, KEY_DELETE, - KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP, - KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, - KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP4, - KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT, - KEY_BACKSLASH, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15, KEY_F16, - KEY_F17, KEY_F18, KEY_F19, KEY_F20, KEY_F21, KEY_F22, KEY_F23, - KEY_F24, 255, KEY_HELP, KEY_MENU, 255, 255, 255, 255, 255, 255, - 255, 255, KEY_MUTE, KEY_SYSRQ, KEY_ENTER, - 255 /* KP_Clear */, KEY_KPCOMMA, - KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT, KEY_LEFTMETA, - KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT, KEY_RIGHTMETA, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 -}; - -static const char* LINUX_HID_NAME[256] = { - 0, 0, 0, 0, "A", "B", "C", "D", "E", - "F", "G", "H", "I", "J", "K", "L", "M", - "N", "O", "P", "Q", "R", "S", "T", "U", - "V", "W", "X", "Y", "Z", "1", "2", "3", - "4", "5", "6", "7", "8", "9", "0", 0, - "Escape", "Delete", "Tab", "Space", "-", "=", - "[", "]", "Backslash", 0, ";", - "'", "Grave", ",", ".", "/", "Capslock", - "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", - "F10", "F11", "F12", "Print", "Scrolllock", "Pause", - "Insert", "Home", "Page Up", "Delete", "End", "Page Down", - "Right", "Left", "Down", "Up", "Numlock", "/", "*", "-", "+", - "Enter", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", - "\\", "=", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", - "F21", "F22", "F23", "F24", 0, "Help", "Menu", 0, 0, 0, 0, 0, 0, - 0, 0, "Mute", "Sysrq", "Enter", "Clear", ",", "Left Control", "Left Shift", - "Left Alt", "Left Meta", "Right Control", "Right Shift", "Right Alt", "Right Meta", - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -typedef struct { - FILE* file; - char key_map[KEY_MAX/8 + 1]; - int last_key; -} keyboard_t; - -#define KEYBOARD_MAX 4 -#define DEVINPUTPATH "/dev/input/by-id" -#define KEYBOARD_VAR "GLIDEN64_KEYBOARD" - -static keyboard_t l_Keyboards[KEYBOARD_MAX] = { 0 }; -static int l_KeyBoardCount = 0; - -EXPORT void CALL osal_keys_init() -{ - DIR* dir; - struct dirent* entry; - char file_name[PATH_MAX]; - char real_file_name[PATH_MAX]; - char* env_var; - FILE* kbd_file; - int kbd_index = 0; - - /* if a keyboard file has been specified, use that */ - if ((env_var = getenv(KEYBOARD_VAR)) != NULL) - { - l_Keyboards[0].file = fopen(env_var, "r"); - l_KeyBoardCount++; - return; - } - - dir = opendir(DEVINPUTPATH); - if (dir == NULL) - return; - - while ((entry = readdir(dir)) != NULL) { - sprintf(file_name, "%s/%s", DEVINPUTPATH, entry->d_name); - - /* check if file_name contains kbd */ - if (strstr(file_name, "kbd") != NULL) { - /* follow symlink and get full path */ - if (realpath(file_name, real_file_name) == NULL) - continue; - - /* attempt to open the file */ - kbd_file = l_Keyboards[kbd_index].file = fopen(real_file_name, "r"); - if (kbd_file != NULL) { - /* if we can open it, use it */ - if (kbd_index++ >= KEYBOARD_MAX) - break; - } - } - } - - l_KeyBoardCount = kbd_index; - closedir(dir); -} - -EXPORT void CALL osal_keys_quit() -{ - FILE* file; - for (int i = 0; i < l_KeyBoardCount; i++) { - file = l_Keyboards[i].file; - if (file != NULL) - fclose(file); - } -} - -EXPORT void CALL osal_keys_update_state() -{ -#ifdef OS_LINUX - keyboard_t* keyboard; - for (int i = 0; i < l_KeyBoardCount; i++) { - keyboard = &l_Keyboards[i]; - if (keyboard->file == NULL) - continue; - - // query keyboard state - ioctl(fileno(keyboard->file), EVIOCGKEY(sizeof(keyboard->key_map)), keyboard->key_map); - } -#endif // OS_LINUX -} - -EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask) -{ - if (_key == 0 || _key > 255) - return 0; - - int key = LINUX_HID_TO_NATIVE[_key]; - - keyboard_t* keyboard; - int keys, mask; - for (int i = 0; i < l_KeyBoardCount; i++) { - keyboard = &l_Keyboards[i]; - if (keyboard->file == NULL) - continue; - - keys = keyboard->key_map[key/8]; - mask = 1 << (key % 8); - - if ((keys & mask)) { - /* if key is pressed, but key hasn't been released yet, return */ - if (keyboard->last_key == key) - return 0; - keyboard->last_key = key; - return 1; - } - else if (keyboard->last_key == key) { - /* if key has been let go, remove last_key */ - keyboard->last_key = 0; - } - } - - return 0; -} - -EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode) -{ - return LINUX_HID_NAME[_hidCode]; -} - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/osal/osal_keys_unix.c b/GLideN64/src/osal/osal_keys_unix.c deleted file mode 100644 index 7b7d754..0000000 --- a/GLideN64/src/osal/osal_keys_unix.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "osal_keys.h" - -#ifdef __cplusplus -extern "C" { -#endif - -EXPORT void CALL osal_keys_init() -{ -} - -EXPORT void CALL osal_keys_quit() -{ -} - -EXPORT void CALL osal_keys_update_state() -{ -} - -EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask) -{ - return 0; -} - -EXPORT unsigned int CALL osal_virtual_key_to_hid(unsigned int _key, unsigned int _hidKey) -{ - return 0; -} - -EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode) -{ - return 0; -} - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/osal/osal_keys_win.c b/GLideN64/src/osal/osal_keys_win.c deleted file mode 100644 index e1e55e7..0000000 --- a/GLideN64/src/osal/osal_keys_win.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <windows.h> -#include "osal_keys.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static const unsigned char WIN_HID_TO_NATIVE[256] = { -255,255,255,255, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 48, 13, 27, 8, 9, 32,189,187,219, -221,220,255,186,222,192,188,190,191, 20,112,113,114,115,116,117, -118,119,120,121,122,123, 44,145, 19, 45, 36, 33, 46, 35, 34, 39, - 37, 40, 38,144,111,106,109,107,255, 97, 98, 99,100,101,102,103, -104,105, 96,110,255,255,255,255,124,125,126,127,128,129,130,131, -132,133,134,135,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 17, 16, 18,255,255,255,255,255,255, 1,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 -}; - -static const char KEYCODE_WINDOWS_NAME_DATA[] = -"\0'\0,\0-\0.\0/\0;\0=\0A\0B\0Backspace\0C\0Caps Lock\0D\0Delete\0E\0End\0" -"Enter\0Escape\0F\0F1\0F10\0F11\0F12\0F2\0F3\0F4\0F5\0F6\0F7\0F8\0F9\0G\0H" -"\0Home\0I\0Insert\0J\0K\0L\0Left\0Left Alt\0Left Control\0Left Shift\0Lef" -"t Windows\0M\0N\0O\0P\0Page Down\0Page Up\0Pause\0Print Screen\0Q\0R\0Rig" -"ht\0Right Alt\0Right Control\0Right Shift\0Right Windows\0S\0Scroll Lock" -"\0T\0Tab\0U\0V\0W\0X\0Y\0Z\0[\0\\\0]\0`"; -static const unsigned short KEYCODE_WINDOWS_NAME_OFFSET[] = { - 0,0,0,0,15,17,29,41,50,69,110,112,119,128,130,132,185,187,189,191,230,232, - 290,304,310,312,314,316,318,320,72,84,90,93,96,99,102,105,108,76,0,62,19, - 306,0,5,13,322,326,324,0,11,1,328,3,7,9,31,71,86,89,92,95,98,101,104,107,74, - 78,82,217,292,211,121,114,203,43,52,193,234,134,198,208,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,161,139,172,250,264,240,276 -}; - -EXPORT void CALL osal_keys_init() -{ -} - -EXPORT void CALL osal_keys_quit() -{ -} - -EXPORT void CALL osal_keys_update_state() -{ -} - -EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask) -{ - if (_key == 0 || _key > 255) - return 0; - return GetAsyncKeyState(WIN_HID_TO_NATIVE[_key]) & _mask; -} - -EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode) -{ - unsigned offset; - if (232 <= _hidCode) - return NULL; - offset = KEYCODE_WINDOWS_NAME_OFFSET[_hidCode]; - if (offset == 0) - return NULL; - return KEYCODE_WINDOWS_NAME_DATA + offset; -} - -#ifdef __cplusplus -} -#endif diff --git a/GLideN64/src/resource.h b/GLideN64/src/resource.h deleted file mode 100644 index 11bee0a..0000000 Binary files a/GLideN64/src/resource.h and /dev/null differ diff --git a/GLideN64/src/sdl2_compat.h b/GLideN64/src/sdl2_compat.h deleted file mode 100644 index 9f77089..0000000 --- a/GLideN64/src/sdl2_compat.h +++ /dev/null @@ -1,783 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include <SDL_surface.h> - -typedef struct -{ - Uint8 *src; - int src_w, src_h; - int src_pitch; - int src_skip; - Uint8 *dst; - int dst_w, dst_h; - int dst_pitch; - int dst_skip; - SDL_PixelFormat *src_fmt; - SDL_PixelFormat *dst_fmt; - Uint8 *table; - int flags; - Uint32 colorkey; - Uint8 r, g, b, a; -} SDL_BlitInfo; - -/* Blit mapping definition */ -typedef struct SDL_BlitMap -{ - SDL_Surface *dst; - int identity; - SDL_blit blit; - void *data; - SDL_BlitInfo info; - - /* the version count matches the destination; mismatch indicates - an invalid mapping */ - Uint32 dst_palette_version; - Uint32 src_palette_version; -} SDL_BlitMap; - -typedef struct SDL_VideoInfo -{ - Uint32 hw_available:1; - Uint32 wm_available:1; - Uint32 UnusedBits1:6; - Uint32 UnusedBits2:1; - Uint32 blit_hw:1; - Uint32 blit_hw_CC:1; - Uint32 blit_hw_A:1; - Uint32 blit_sw:1; - Uint32 blit_sw_CC:1; - Uint32 blit_sw_A:1; - Uint32 blit_fill:1; - Uint32 UnusedBits3:16; - Uint32 video_mem; - - SDL_PixelFormat *vfmt; - - int current_w; - int current_h; -} SDL_VideoInfo; - -#define SDL_ANYFORMAT 0x00100000 -#define SDL_HWPALETTE 0x00200000 -#define SDL_FULLSCREEN 0x00800000 -#define SDL_RESIZABLE 0x01000000 -#define SDL_NOFRAME 0x02000000 -#define SDL_OPENGL 0x04000000 -#define SDL_HWSURFACE 0x08000001 /**< \note Not used */ - -#define SDL_BUTTON_WHEELUP 4 -#define SDL_BUTTON_WHEELDOWN 5 - -int initialized_video = 0; - -static SDL_Window *SDL_VideoWindow = NULL; -static SDL_Surface *SDL_WindowSurface = NULL; -static SDL_Surface *SDL_VideoSurface = NULL; -static SDL_Surface *SDL_ShadowSurface = NULL; -static SDL_Surface *SDL_PublicSurface = NULL; -static SDL_Rect SDL_VideoViewport; -static char *wm_title = NULL; -static Uint32 SDL_VideoFlags = 0; -static SDL_GLContext *SDL_VideoContext = NULL; -static SDL_Surface *SDL_VideoIcon; - -static void -SDL_WM_SetCaption(const char *title, const char *icon) -{ - if (wm_title) { - SDL_free(wm_title); - } - if (title) { - wm_title = SDL_strdup(title); - } else { - wm_title = NULL; - } - SDL_SetWindowTitle(SDL_VideoWindow, wm_title); -} - -static int -GetVideoDisplay() -{ - const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY"); - if ( !variable ) { - variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD"); - } - if ( variable ) { - return SDL_atoi(variable); - } else { - return 0; - } -} - -static const SDL_VideoInfo * -SDL_GetVideoInfo(void) -{ - static SDL_VideoInfo info; - SDL_DisplayMode mode; - - /* Memory leak, compatibility code, who cares? */ - if (!info.vfmt && SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode) == 0) { - info.vfmt = SDL_AllocFormat(mode.format); - info.current_w = mode.w; - info.current_h = mode.h; - } - return &info; -} - -static SDL_Rect ** -SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags) -{ - int i, nmodes; - SDL_Rect **modes; - - if (!initialized_video) { - return NULL; - } - - if (!(flags & SDL_FULLSCREEN)) { - return (SDL_Rect **) (-1); - } - - if (!format) { - format = SDL_GetVideoInfo()->vfmt; - } - - /* Memory leak, but this is a compatibility function, who cares? */ - nmodes = 0; - modes = NULL; - for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) { - SDL_DisplayMode mode; - int bpp; - - SDL_GetDisplayMode(GetVideoDisplay(), i, &mode); - if (!mode.w || !mode.h) { - return (SDL_Rect **) (-1); - } - - /* Copied from src/video/SDL_pixels.c:SDL_PixelFormatEnumToMasks */ - if (SDL_BYTESPERPIXEL(mode.format) <= 2) { - bpp = SDL_BITSPERPIXEL(mode.format); - } else { - bpp = SDL_BYTESPERPIXEL(mode.format) * 8; - } - - if (bpp != format->BitsPerPixel) { - continue; - } - if (nmodes > 0 && modes[nmodes - 1]->w == mode.w - && modes[nmodes - 1]->h == mode.h) { - continue; - } - - modes = (SDL_Rect**)SDL_realloc(modes, (nmodes + 2) * sizeof(*modes)); - if (!modes) { - return NULL; - } - modes[nmodes] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect)); - if (!modes[nmodes]) { - return NULL; - } - modes[nmodes]->x = 0; - modes[nmodes]->y = 0; - modes[nmodes]->w = mode.w; - modes[nmodes]->h = mode.h; - ++nmodes; - } - if (modes) { - modes[nmodes] = NULL; - } - return modes; -} - -static void -SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) -{ - int i; - - if (screen == SDL_ShadowSurface) { - for (i = 0; i < numrects; ++i) { - SDL_BlitSurface(SDL_ShadowSurface, &rects[i], SDL_VideoSurface, - &rects[i]); - } - - /* Fall through to video surface update */ - screen = SDL_VideoSurface; - } - if (screen == SDL_VideoSurface) { - if (SDL_VideoViewport.x || SDL_VideoViewport.y) { - SDL_Rect *stackrects = SDL_stack_alloc(SDL_Rect, numrects); - SDL_Rect *stackrect; - const SDL_Rect *rect; - - /* Offset all the rectangles before updating */ - for (i = 0; i < numrects; ++i) { - rect = &rects[i]; - stackrect = &stackrects[i]; - stackrect->x = SDL_VideoViewport.x + rect->x; - stackrect->y = SDL_VideoViewport.y + rect->y; - stackrect->w = rect->w; - stackrect->h = rect->h; - } - SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, stackrects, numrects); - SDL_stack_free(stackrects); - } else { - SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, rects, numrects); - } - } -} - -static void -SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) -{ - if (screen) { - SDL_Rect rect; - - /* Fill the rectangle */ - rect.x = (int) x; - rect.y = (int) y; - rect.w = (int) (w ? w : screen->w); - rect.h = (int) (h ? h : screen->h); - SDL_UpdateRects(screen, 1, &rect); - } -} - -static int -SDL_Flip(SDL_Surface * screen) -{ - SDL_UpdateRect(screen, 0, 0, 0, 0); - return 0; -} - -/* - * Calculate the pad-aligned scanline width of a surface - */ -static int -SDL_CalculatePitch(SDL_Surface * surface) -{ - int pitch; - - /* Surface should be 4-byte aligned for speed */ - pitch = surface->w * surface->format->BytesPerPixel; - switch (surface->format->BitsPerPixel) { - case 1: - pitch = (pitch + 7) / 8; - break; - case 4: - pitch = (pitch + 1) / 2; - break; - default: - break; - } - pitch = (pitch + 3) & ~3; /* 4-byte aligning */ - return (pitch); -} - -static void -SDL_InvalidateMap(SDL_BlitMap * map) -{ - if (!map) { - return; - } - if (map->dst) { - /* Release our reference to the surface - see the note below */ - if (--map->dst->refcount <= 0) { - SDL_FreeSurface(map->dst); - } - } - map->dst = NULL; - map->src_palette_version = 0; - map->dst_palette_version = 0; - if (map->info.table) { - SDL_free(map->info.table); - map->info.table = NULL; - } -} - -static void -SDL_GL_SwapBuffers(void) -{ - SDL_GL_SwapWindow(SDL_VideoWindow); -} - -static int -SDL_WM_ToggleFullScreen(SDL_Surface * surface) -{ - int length; - void *pixels; - Uint8 *src, *dst; - int row; - int window_w; - int window_h; - - if (!SDL_PublicSurface) { - SDL_SetError("SDL_SetVideoMode() hasn't been called"); - return 0; - } - - /* Copy the old bits out */ - length = SDL_PublicSurface->w * SDL_PublicSurface->format->BytesPerPixel; - pixels = SDL_malloc(SDL_PublicSurface->h * length); - if (pixels && SDL_PublicSurface->pixels) { - src = (Uint8*)SDL_PublicSurface->pixels; - dst = (Uint8*)pixels; - for (row = 0; row < SDL_PublicSurface->h; ++row) { - SDL_memcpy(dst, src, length); - src += SDL_PublicSurface->pitch; - dst += length; - } - } - - /* Do the physical mode switch */ - if (SDL_GetWindowFlags(SDL_VideoWindow) & SDL_WINDOW_FULLSCREEN) { - if (SDL_SetWindowFullscreen(SDL_VideoWindow, 0) < 0) { - return 0; - } - SDL_PublicSurface->flags &= ~SDL_FULLSCREEN; - } else { - if (SDL_SetWindowFullscreen(SDL_VideoWindow, 1) < 0) { - return 0; - } - SDL_PublicSurface->flags |= SDL_FULLSCREEN; - } - - /* Recreate the screen surface */ - SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); - if (!SDL_WindowSurface) { - /* We're totally hosed... */ - return 0; - } - - /* Center the public surface in the window surface */ - SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h); - SDL_VideoViewport.x = (window_w - SDL_VideoSurface->w)/2; - SDL_VideoViewport.y = (window_h - SDL_VideoSurface->h)/2; - SDL_VideoViewport.w = SDL_VideoSurface->w; - SDL_VideoViewport.h = SDL_VideoSurface->h; - - /* Do some shuffling behind the application's back if format changes */ - if (SDL_VideoSurface->format->format != SDL_WindowSurface->format->format) { - if (SDL_ShadowSurface) { - if (SDL_ShadowSurface->format->format == SDL_WindowSurface->format->format) { - /* Whee! We don't need a shadow surface anymore! */ - SDL_VideoSurface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(SDL_VideoSurface); - SDL_free(SDL_ShadowSurface->pixels); - SDL_VideoSurface = SDL_ShadowSurface; - SDL_VideoSurface->flags |= SDL_PREALLOC; - SDL_ShadowSurface = NULL; - } else { - /* No problem, just change the video surface format */ - SDL_FreeFormat(SDL_VideoSurface->format); - SDL_VideoSurface->format = SDL_WindowSurface->format; - SDL_VideoSurface->format->refcount++; - SDL_InvalidateMap(SDL_ShadowSurface->map); - } - } else { - /* We can make the video surface the shadow surface */ - SDL_ShadowSurface = SDL_VideoSurface; - SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface); - SDL_ShadowSurface->pixels = SDL_malloc(SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); - if (!SDL_ShadowSurface->pixels) { - /* Uh oh, we're hosed */ - SDL_ShadowSurface = NULL; - return 0; - } - SDL_ShadowSurface->flags &= ~SDL_PREALLOC; - - SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, 32, 0, 0, 0, 0, 0); - SDL_VideoSurface->flags = SDL_ShadowSurface->flags; - SDL_VideoSurface->flags |= SDL_PREALLOC; - SDL_FreeFormat(SDL_VideoSurface->format); - SDL_VideoSurface->format = SDL_WindowSurface->format; - SDL_VideoSurface->format->refcount++; - SDL_VideoSurface->w = SDL_ShadowSurface->w; - SDL_VideoSurface->h = SDL_ShadowSurface->h; - } - } - - /* Update the video surface */ - SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; - SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels + - SDL_VideoViewport.y * SDL_VideoSurface->pitch + - SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel); - SDL_SetClipRect(SDL_VideoSurface, NULL); - - /* Copy the old bits back */ - if (pixels) { - src = (Uint8*)pixels; - dst = (Uint8*)SDL_PublicSurface->pixels; - for (row = 0; row < SDL_PublicSurface->h; ++row) { - SDL_memcpy(dst, src, length); - src += length; - dst += SDL_PublicSurface->pitch; - } - SDL_Flip(SDL_PublicSurface); - SDL_free(pixels); - } - - /* We're done! */ - return 1; -} - -static void -ClearVideoSurface() -{ - if (SDL_ShadowSurface) { - SDL_FillRect(SDL_ShadowSurface, NULL, - SDL_MapRGB(SDL_ShadowSurface->format, 0, 0, 0)); - } - SDL_FillRect(SDL_WindowSurface, NULL, 0); - SDL_UpdateWindowSurface(SDL_VideoWindow); -} - -static int -SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) -{ - int w, h; - - /* We can't resize something we don't have... */ - if (!SDL_VideoSurface) { - return -1; - } - - /* We probably have to recreate the window in fullscreen mode */ - if (flags & SDL_FULLSCREEN) { - return -1; - } - - /* I don't think there's any change we can gracefully make in flags */ - if (flags != SDL_VideoFlags) { - return -1; - } - if (bpp != SDL_VideoSurface->format->BitsPerPixel) { - return -1; - } - - /* Resize the window */ - SDL_GetWindowSize(SDL_VideoWindow, &w, &h); - if (w != width || h != height) { - SDL_SetWindowSize(SDL_VideoWindow, width, height); - } - - /* If we're in OpenGL mode, just resize the stub surface and we're done! */ - if (flags & SDL_OPENGL) { - SDL_VideoSurface->w = width; - SDL_VideoSurface->h = height; - return 0; - } - - SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); - if (!SDL_WindowSurface) { - return -1; - } - if (SDL_VideoSurface->format != SDL_WindowSurface->format) { - return -1; - } - SDL_VideoSurface->w = width; - SDL_VideoSurface->h = height; - SDL_VideoSurface->pixels = SDL_WindowSurface->pixels; - SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; - SDL_SetClipRect(SDL_VideoSurface, NULL); - - if (SDL_ShadowSurface) { - SDL_ShadowSurface->w = width; - SDL_ShadowSurface->h = height; - SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface); - SDL_ShadowSurface->pixels = - SDL_realloc(SDL_ShadowSurface->pixels, - SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); - SDL_SetClipRect(SDL_ShadowSurface, NULL); - SDL_InvalidateMap(SDL_ShadowSurface->map); - } else { - SDL_PublicSurface = SDL_VideoSurface; - } - - ClearVideoSurface(); - - return 0; -} - -static int -SDL_CompatEventFilter(void *userdata, SDL_Event * event) -{ - SDL_Event fake; - - switch (event->type) { - case SDL_WINDOWEVENT: - switch (event->window.event) { - case SDL_WINDOWEVENT_CLOSE: - fake.type = SDL_QUIT; - SDL_PushEvent(&fake); - break; - } - case SDL_TEXTINPUT: - { - /* FIXME: Generate an old style key repeat event if needed */ - //printf("TEXTINPUT: '%s'\n", event->text.text); - break; - } - case SDL_MOUSEMOTION: - { - event->motion.x -= SDL_VideoViewport.x; - event->motion.y -= SDL_VideoViewport.y; - break; - } - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - { - event->button.x -= SDL_VideoViewport.x; - event->button.y -= SDL_VideoViewport.y; - break; - } - case SDL_MOUSEWHEEL: - { - Uint8 button; - int x, y; - - if (event->wheel.y == 0) { - break; - } - - SDL_GetMouseState(&x, &y); - - if (event->wheel.y > 0) { - button = SDL_BUTTON_WHEELUP; - } else { - button = SDL_BUTTON_WHEELDOWN; - } - - fake.button.button = button; - fake.button.x = x; - fake.button.y = y; - fake.button.windowID = event->wheel.windowID; - - fake.type = SDL_MOUSEBUTTONDOWN; - fake.button.state = SDL_PRESSED; - SDL_PushEvent(&fake); - - fake.type = SDL_MOUSEBUTTONUP; - fake.button.state = SDL_RELEASED; - SDL_PushEvent(&fake); - break; - } - - } - return 1; -} - -static void -GetEnvironmentWindowPosition(int w, int h, int *x, int *y) -{ - int display = GetVideoDisplay(); - const char *window = SDL_getenv("SDL_VIDEO_WINDOW_POS"); - const char *center = SDL_getenv("SDL_VIDEO_CENTERED"); - if (window) { - if (SDL_sscanf(window, "%d,%d", x, y) == 2) { - return; - } - if (SDL_strcmp(window, "center") == 0) { - center = window; - } - } - if (center) { - *x = SDL_WINDOWPOS_CENTERED_DISPLAY(display); - *y = SDL_WINDOWPOS_CENTERED_DISPLAY(display); - } -} - -static SDL_Surface * -SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) -{ - SDL_DisplayMode desktop_mode; - int display = GetVideoDisplay(); - int window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display); - int window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display); - int window_w; - int window_h; - Uint32 window_flags; - Uint32 surface_flags; - - if (!initialized_video) { - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { - return NULL; - } - initialized_video = 1; - } - - SDL_GetDesktopDisplayMode(display, &desktop_mode); - - if (width == 0) { - width = desktop_mode.w; - } - if (height == 0) { - height = desktop_mode.h; - } - if (bpp == 0) { - bpp = SDL_BITSPERPIXEL(desktop_mode.format); - } - - /* See if we can simply resize the existing window and surface */ - if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) { - return SDL_PublicSurface; - } - - /* Destroy existing window */ - SDL_PublicSurface = NULL; - if (SDL_ShadowSurface) { - SDL_ShadowSurface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(SDL_ShadowSurface); - SDL_ShadowSurface = NULL; - } - if (SDL_VideoSurface) { - SDL_VideoSurface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(SDL_VideoSurface); - SDL_VideoSurface = NULL; - } - if (SDL_VideoContext) { - /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */ - SDL_GL_DeleteContext(SDL_VideoContext); - SDL_VideoContext = NULL; - } - if (SDL_VideoWindow) { - SDL_GetWindowPosition(SDL_VideoWindow, &window_x, &window_y); - SDL_DestroyWindow(SDL_VideoWindow); - } - - /* Set up the event filter */ - if (!SDL_GetEventFilter(NULL, NULL)) { - SDL_SetEventFilter(SDL_CompatEventFilter, NULL); - } - - /* Create a new window */ - window_flags = SDL_WINDOW_SHOWN; - if (flags & SDL_FULLSCREEN) { - window_flags |= SDL_WINDOW_FULLSCREEN; - } - if (flags & SDL_OPENGL) { - window_flags |= SDL_WINDOW_OPENGL; - } - if (flags & SDL_RESIZABLE) { - window_flags |= SDL_WINDOW_RESIZABLE; - } - if (flags & SDL_NOFRAME) { - window_flags |= SDL_WINDOW_BORDERLESS; - } - GetEnvironmentWindowPosition(width, height, &window_x, &window_y); - SDL_VideoWindow = - SDL_CreateWindow(wm_title, window_x, window_y, width, height, - window_flags); - if (!SDL_VideoWindow) { - return NULL; - } - SDL_SetWindowIcon(SDL_VideoWindow, SDL_VideoIcon); - - window_flags = SDL_GetWindowFlags(SDL_VideoWindow); - surface_flags = 0; - if (window_flags & SDL_WINDOW_FULLSCREEN) { - surface_flags |= SDL_FULLSCREEN; - } - if ((window_flags & SDL_WINDOW_OPENGL) && (flags & SDL_OPENGL)) { - surface_flags |= SDL_OPENGL; - } - if (window_flags & SDL_WINDOW_RESIZABLE) { - surface_flags |= SDL_RESIZABLE; - } - if (window_flags & SDL_WINDOW_BORDERLESS) { - surface_flags |= SDL_NOFRAME; - } - - SDL_VideoFlags = flags; - - /* If we're in OpenGL mode, just create a stub surface and we're done! */ - if (flags & SDL_OPENGL) { - SDL_VideoContext = (SDL_GLContext *)SDL_GL_CreateContext(SDL_VideoWindow); - if (!SDL_VideoContext) { - return NULL; - } - if (SDL_GL_MakeCurrent(SDL_VideoWindow, SDL_VideoContext) < 0) { - return NULL; - } - SDL_VideoSurface = - SDL_CreateRGBSurfaceFrom(NULL, width, height, bpp, 0, 0, 0, 0, 0); - if (!SDL_VideoSurface) { - return NULL; - } - SDL_VideoSurface->flags |= surface_flags; - SDL_PublicSurface = SDL_VideoSurface; - return SDL_PublicSurface; - } - - /* Create the screen surface */ - SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); - if (!SDL_WindowSurface) { - return NULL; - } - - /* Center the public surface in the window surface */ - SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h); - SDL_VideoViewport.x = (window_w - width)/2; - SDL_VideoViewport.y = (window_h - height)/2; - SDL_VideoViewport.w = width; - SDL_VideoViewport.h = height; - - SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, 32, 0, 0, 0, 0, 0); - SDL_VideoSurface->flags |= surface_flags; - SDL_VideoSurface->flags |= SDL_DONTFREE; - SDL_FreeFormat(SDL_VideoSurface->format); - SDL_VideoSurface->format = SDL_WindowSurface->format; - SDL_VideoSurface->format->refcount++; - SDL_VideoSurface->w = width; - SDL_VideoSurface->h = height; - SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; - SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels + - SDL_VideoViewport.y * SDL_VideoSurface->pitch + - SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel); - SDL_SetClipRect(SDL_VideoSurface, NULL); - - /* Create a shadow surface if necessary */ - if ((bpp != SDL_VideoSurface->format->BitsPerPixel) - && !(flags & SDL_ANYFORMAT)) { - SDL_ShadowSurface = - SDL_CreateRGBSurface(0, width, height, bpp, 0, 0, 0, 0); - if (!SDL_ShadowSurface) { - return NULL; - } - SDL_ShadowSurface->flags |= surface_flags; - SDL_ShadowSurface->flags |= SDL_DONTFREE; - - /* 8-bit SDL_ShadowSurface surfaces report that they have exclusive palette */ - if (SDL_ShadowSurface->format->palette) { - SDL_ShadowSurface->flags |= SDL_HWPALETTE; - //TODO SDL_DitherColors(SDL_ShadowSurface->format->palette->colors, - // SDL_ShadowSurface->format->BitsPerPixel); - } - SDL_FillRect(SDL_ShadowSurface, NULL, - SDL_MapRGB(SDL_ShadowSurface->format, 0, 0, 0)); - } - SDL_PublicSurface = - (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); - - ClearVideoSurface(); - - /* We're finally done! */ - return SDL_PublicSurface; -} diff --git a/GLideN64/src/uCodes/F3D.cpp b/GLideN64/src/uCodes/F3D.cpp deleted file mode 100644 index aaad542..0000000 --- a/GLideN64/src/uCodes/F3D.cpp +++ /dev/null @@ -1,287 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void F3D_SPNoOp( u32 w0, u32 w1 ) -{ - gSPNoOp(); -} - -void F3D_Mtx( u32 w0, u32 w1 ) -{ - if (_SHIFTR( w0, 0, 16 ) != 64) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "G_MTX: address = 0x%08X length = %i params = 0x%02X\n", w1, _SHIFTR(w0, 0, 16), _SHIFTR(w0, 16, 8)); - return; - } - - gSPMatrix( w1, _SHIFTR( w0, 16, 8 ) ); -} - -void F3D_Reserved0( u32 w0, u32 w1 ) -{ - DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "G_RESERVED0: w0=0x%08lX w1=0x%08lX\n", w0, w1); -} - -void F3D_MoveMem( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 16, 8 )) { - case F3D_MV_VIEWPORT: - gSPViewport( w1 ); - break; - case G_MV_MATRIX_1: - gSPForceMatrix( w1 ); - - // force matrix takes four commands - RSP.PC[RSP.PCi] += 24; - break; - case G_MV_L0: - gSPLight( w1, LIGHT_1 ); - break; - case G_MV_L1: - gSPLight( w1, LIGHT_2 ); - break; - case G_MV_L2: - gSPLight( w1, LIGHT_3 ); - break; - case G_MV_L3: - gSPLight( w1, LIGHT_4 ); - break; - case G_MV_L4: - gSPLight( w1, LIGHT_5 ); - break; - case G_MV_L5: - gSPLight( w1, LIGHT_6 ); - break; - case G_MV_L6: - gSPLight( w1, LIGHT_7 ); - break; - case G_MV_L7: - gSPLight( w1, LIGHT_8 ); - break; - case G_MV_LOOKATX: - gSPLookAt(w1, 0); - break; - case G_MV_LOOKATY: - gSPLookAt(w1, 1); - break; - } -} - -void F3D_Vtx( u32 w0, u32 w1 ) -{ - gSPVertex( w1, _SHIFTR( w0, 20, 4 ) + 1, _SHIFTR( w0, 16, 4 ) ); -} - -void F3D_Reserved1( u32 w0, u32 w1 ) -{ -} - -void F3D_DList( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 16, 8 )) - { - case G_DL_PUSH: - gSPDisplayList( w1 ); - break; - case G_DL_NOPUSH: - gSPBranchList( w1 ); - break; - } -} - -void F3D_Reserved2( u32 w0, u32 w1 ) -{ -} - -void F3D_Reserved3( u32 w0, u32 w1 ) -{ -} - -void F3D_Sprite2D_Base( u32 w0, u32 w1 ) -{ - gSPSprite2DBase( w1 ); -} - -void F3D_Tri1( u32 w0, u32 w1 ) -{ - gSP1Triangle( _SHIFTR( w1, 16, 8 ) / 10, - _SHIFTR( w1, 8, 8 ) / 10, - _SHIFTR( w1, 0, 8 ) / 10); -} - -void F3D_CullDL( u32 w0, u32 w1 ) -{ - gSPCullDisplayList( _SHIFTR( w0, 0, 24 ) / 40, (w1 / 40) - 1 ); -} - -void F3D_PopMtx( u32 w0, u32 w1 ) -{ - gSPPopMatrix( w1 ); -} - -void F3D_MoveWord( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 0, 8 )) { - case G_MW_MATRIX: - gSPInsertMatrix( _SHIFTR( w0, 8, 16 ), w1 ); - break; - case G_MW_NUMLIGHT: - gSPNumLights( ((w1 - 0x80000000) >> 5) - 1 ); - break; - case G_MW_CLIP: - gSPClipRatio( w1 ); - break; - case G_MW_SEGMENT: - gSPSegment( _SHIFTR( w0, 10, 4 ), w1 & 0x00FFFFFF ); - break; - case G_MW_FOG: -/* u32 fm, fo, min, max; - - fm = _SHIFTR( w1, 16, 16 ); - fo = _SHIFTR( w1, 0, 16 ); - - min = 500 - (fo * (128000 / fm)) / 256; - max = (128000 / fm) + min;*/ - - gSPFogFactor( (s16)_SHIFTR( w1, 16, 16 ), (s16)_SHIFTR( w1, 0, 16 ) ); - break; - case G_MW_LIGHTCOL: - switch (_SHIFTR( w0, 8, 16 )) - { - case F3D_MWO_aLIGHT_1: - gSPLightColor( LIGHT_1, w1 ); - break; - case F3D_MWO_aLIGHT_2: - gSPLightColor( LIGHT_2, w1 ); - break; - case F3D_MWO_aLIGHT_3: - gSPLightColor( LIGHT_3, w1 ); - break; - case F3D_MWO_aLIGHT_4: - gSPLightColor( LIGHT_4, w1 ); - break; - case F3D_MWO_aLIGHT_5: - gSPLightColor( LIGHT_5, w1 ); - break; - case F3D_MWO_aLIGHT_6: - gSPLightColor( LIGHT_6, w1 ); - break; - case F3D_MWO_aLIGHT_7: - gSPLightColor( LIGHT_7, w1 ); - break; - case F3D_MWO_aLIGHT_8: - gSPLightColor( LIGHT_8, w1 ); - break; - } - break; - case G_MW_POINTS: - { - const u32 val = _SHIFTR(w0, 8, 16); - gSPModifyVertex(val / 40, val % 40, w1); - } - break; - case G_MW_PERSPNORM: - gSPPerspNormalize( w1 ); - break; - } -} - -void F3D_Texture( u32 w0, u32 w1 ) -{ - gSPTexture( _FIXED2FLOAT( _SHIFTR( w1, 16, 16 ), 16 ), - _FIXED2FLOAT( _SHIFTR( w1, 0, 16 ), 16 ), - _SHIFTR( w0, 11, 3 ), - _SHIFTR( w0, 8, 3 ), - _SHIFTR( w0, 0, 8 ) ); -} - -void F3D_SetOtherMode_H( u32 w0, u32 w1 ) -{ - const u32 length = _SHIFTR(w0, 0, 8); - const u32 shift = _SHIFTR(w0, 8, 8); - gSPSetOtherMode_H(length, shift, w1); -} - -void F3D_SetOtherMode_L( u32 w0, u32 w1 ) -{ - const u32 length = _SHIFTR(w0, 0, 8); - const u32 shift = _SHIFTR(w0, 8, 8); - gSPSetOtherMode_L(length, shift, w1); -} - -void F3D_EndDL( u32 w0, u32 w1 ) -{ - gSPEndDisplayList(); -} - -void F3D_SetGeometryMode( u32 w0, u32 w1 ) -{ - gSPSetGeometryMode( w1 ); -} - -void F3D_ClearGeometryMode( u32 w0, u32 w1 ) -{ - gSPClearGeometryMode( w1 ); -} - -void F3D_Quad( u32 w0, u32 w1 ) -{ - gSP1Quadrangle( _SHIFTR( w1, 24, 8 ) / 10, _SHIFTR( w1, 16, 8 ) / 10, _SHIFTR( w1, 8, 8 ) / 10, _SHIFTR( w1, 0, 8 ) / 10 ); -} - -void F3D_RDPHalf_1( u32 w0, u32 w1 ) -{ - gDP.half_1 = w1; - RDP_Half_1(w1); -} - -void F3D_RDPHalf_2( u32 w0, u32 w1 ) -{ - gDP.half_2 = w1; -} - -void F3D_RDPHalf_Cont( u32 w0, u32 w1 ) -{ -} - -void F3D_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3D_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - - GBI_SetGBI( G_TRI1, F3D_TRI1, F3D_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3D_Quad ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3D_RDPHALF_CONT, F3D_RDPHalf_Cont ); -} diff --git a/GLideN64/src/uCodes/F3D.h b/GLideN64/src/uCodes/F3D.h deleted file mode 100644 index 85ab9c0..0000000 --- a/GLideN64/src/uCodes/F3D.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef F3D_H -#define F3D_H -#include "Types.h" - -#define F3D_MTX_STACKSIZE 10 - -#define F3D_MTX_MODELVIEW 0x00 -#define F3D_MTX_PROJECTION 0x01 -#define F3D_MTX_MUL 0x00 -#define F3D_MTX_LOAD 0x02 -#define F3D_MTX_NOPUSH 0x00 -#define F3D_MTX_PUSH 0x04 - -#define F3D_TEXTURE_ENABLE 0x00000002 -#define F3D_SHADING_SMOOTH 0x00000200 -#define F3D_CULL_FRONT 0x00001000 -#define F3D_CULL_BACK 0x00002000 -#define F3D_CULL_BOTH 0x00003000 -#define F3D_CLIPPING 0x00000000 - -#define F3D_MV_VIEWPORT 0x80 - -#define F3D_MWO_aLIGHT_1 0x00 -#define F3D_MWO_bLIGHT_1 0x04 -#define F3D_MWO_aLIGHT_2 0x20 -#define F3D_MWO_bLIGHT_2 0x24 -#define F3D_MWO_aLIGHT_3 0x40 -#define F3D_MWO_bLIGHT_3 0x44 -#define F3D_MWO_aLIGHT_4 0x60 -#define F3D_MWO_bLIGHT_4 0x64 -#define F3D_MWO_aLIGHT_5 0x80 -#define F3D_MWO_bLIGHT_5 0x84 -#define F3D_MWO_aLIGHT_6 0xa0 -#define F3D_MWO_bLIGHT_6 0xa4 -#define F3D_MWO_aLIGHT_7 0xc0 -#define F3D_MWO_bLIGHT_7 0xc4 -#define F3D_MWO_aLIGHT_8 0xe0 -#define F3D_MWO_bLIGHT_8 0xe4 - -// FAST3D commands -#define F3D_SPNOOP 0x00 -#define F3D_MTX 0x01 -#define F3D_RESERVED0 0x02 -#define F3D_MOVEMEM 0x03 -#define F3D_VTX 0x04 -#define F3D_RESERVED1 0x05 -#define F3D_DL 0x06 -#define F3D_RESERVED2 0x07 -#define F3D_RESERVED3 0x08 -#define F3D_SPRITE2D_BASE 0x09 - -#define F3D_TRI1 0xBF -#define F3D_CULLDL 0xBE -#define F3D_POPMTX 0xBD -#define F3D_MOVEWORD 0xBC -#define F3D_TEXTURE 0xBB -#define F3D_SETOTHERMODE_H 0xBA -#define F3D_SETOTHERMODE_L 0xB9 -#define F3D_ENDDL 0xB8 -#define F3D_SETGEOMETRYMODE 0xB7 -#define F3D_CLEARGEOMETRYMODE 0xB6 -//#define F3D_LINE3D 0xB5 // Only used in Line3D -#define F3D_QUAD 0xB5 -#define F3D_RDPHALF_1 0xB4 -#define F3D_RDPHALF_2 0xB3 -#define F3D_RDPHALF_CONT 0xB2 -#define F3D_TRI4 0xB1 - -void F3D_SPNoOp( u32 w0, u32 w1 ); -void F3D_Mtx( u32 w0, u32 w1 ); -void F3D_Reserved0( u32 w0, u32 w1 ); -void F3D_MoveMem( u32 w0, u32 w1 ); -void F3D_Vtx( u32 w0, u32 w1 ); -void F3D_Reserved1( u32 w0, u32 w1 ); -void F3D_DList( u32 w0, u32 w1 ); -void F3D_Reserved2( u32 w0, u32 w1 ); -void F3D_Reserved3( u32 w0, u32 w1 ); -void F3D_Sprite2D_Base( u32 w0, u32 w1 ); -void F3D_Tri1( u32 w0, u32 w1 ); -void F3D_CullDL( u32 w0, u32 w1 ); -void F3D_PopMtx( u32 w0, u32 w1 ); -void F3D_MoveWord( u32 w0, u32 w1 ); -void F3D_Texture( u32 w0, u32 w1 ); -void F3D_SetOtherMode_H( u32 w0, u32 w1 ); -void F3D_SetOtherMode_L( u32 w0, u32 w1 ); -void F3D_EndDL( u32 w0, u32 w1 ); -void F3D_SetGeometryMode( u32 w0, u32 w1 ); -void F3D_ClearGeometryMode( u32 w0, u32 w1 ); -//void F3D_Line3D( u32 w0, u32 w1 ); -void F3D_Quad( u32 w0, u32 w1 ); -void F3D_RDPHalf_1( u32 w0, u32 w1 ); -void F3D_RDPHalf_2( u32 w0, u32 w1 ); -void F3D_RDPHalf_Cont( u32 w0, u32 w1 ); -void F3D_Init(); -#endif - diff --git a/GLideN64/src/uCodes/F3DAM.cpp b/GLideN64/src/uCodes/F3DAM.cpp deleted file mode 100644 index 162606c..0000000 --- a/GLideN64/src/uCodes/F3DAM.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "GLideN64.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "F3DAM.h" -#include "gSP.h" - -void F3DAM_MoveWord(u32 w0, u32 w1) -{ - switch (_SHIFTR(w0, 16, 8)) { - case G_MW_FOG: - switch (_SHIFTR(w0, 0, 8)) { - case 0: - gSPFogFactor((s16)_SHIFTR(w1, 16, 16), (s16)_SHIFTR(w1, 0, 16)); - break; - case 0x0C: - gSP.textureCoordScale[0] = w1; - break; - case 0x10: - gSP.textureCoordScale[1] = w1; - break; - } - break; - default: - F3DEX2_MoveWord(w0, w1); - break; - } -} - -void F3DAM_Vtx( u32 w0, u32 w1 ) -{ - u32 n = _SHIFTR( w0, 12, 8 ); - - gSPF3DAMVertex( w1, n, _SHIFTR( w0, 1, 7 ) - n ); -} - -void F3DAM_Texture( u32 w0, u32 w1 ) -{ - gSP.textureCoordScaleOrg = w1; - gSPTexture( 1.0f, - 1.0f, - _SHIFTR( w0, 11, 3 ), - _SHIFTR( w0, 8, 3 ), - _SHIFTR( w0, 1, 7 ) ); -} - -void F3DAM_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DEX2_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DAM_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DAM_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DAM_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_Z, F3DEX2_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); - GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, F3DEX2_LINE3D, F3DEX2_Line3D ); -} diff --git a/GLideN64/src/uCodes/F3DAM.h b/GLideN64/src/uCodes/F3DAM.h deleted file mode 100644 index 172a8ee..0000000 --- a/GLideN64/src/uCodes/F3DAM.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef F3DAM_H -#define F3DAM_H - -void F3DAM_Init(); - -#endif // F3DAM_H diff --git a/GLideN64/src/uCodes/F3DBETA.cpp b/GLideN64/src/uCodes/F3DBETA.cpp deleted file mode 100644 index 457ea6f..0000000 --- a/GLideN64/src/uCodes/F3DBETA.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DBETA.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void F3DBETA_Vtx( u32 w0, u32 w1 ) -{ - gSPVertex( w1, _SHIFTR( w0, 9, 7 ), _SHIFTR( w0, 16, 8 ) / 5 ); -} - -void F3DBETA_Tri1( u32 w0, u32 w1 ) -{ - gSP1Triangle( _SHIFTR( w1, 16, 8 ) / 5, - _SHIFTR( w1, 8, 8 ) / 5, - _SHIFTR( w1, 0, 8 ) / 5); -} - -void F3DBETA_Tri2( u32 w0, u32 w1 ) -{ - gSP2Triangles( _SHIFTR( w0, 16, 8 ) / 5, _SHIFTR( w0, 8, 8 ) / 5, _SHIFTR( w0, 0, 8 ) / 5, 0, - _SHIFTR( w1, 16, 8 ) / 5, _SHIFTR( w1, 8, 8 ) / 5, _SHIFTR( w1, 0, 8 ) / 5, 0); -} - -void F3DBETA_Quad( u32 w0, u32 w1 ) -{ - gSP1Quadrangle( _SHIFTR( w1, 24, 8 ) / 5, _SHIFTR( w1, 16, 8 ) / 5, _SHIFTR( w1, 8, 8 ) / 5, _SHIFTR( w1, 0, 8 ) / 5 ); -} - -void F3DBETA_Perpnorm(u32 w0, u32 w1) -{ - gSPPerspNormalize(w1); -} - -void F3DBETA_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3DBETA_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - - GBI_SetGBI( G_TRI1, F3D_TRI1, F3DBETA_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3DBETA_Quad ); - GBI_SetGBI( G_PERSPNORM, F3DBETA_PERSPNORM, F3DBETA_Perpnorm); - GBI_SetGBI( G_RDPHALF_1, F3DBETA_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3DBETA_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_TRI2, F3DBETA_TRI2, F3DBETA_Tri2 ); -} - diff --git a/GLideN64/src/uCodes/F3DBETA.h b/GLideN64/src/uCodes/F3DBETA.h deleted file mode 100644 index 1d07768..0000000 --- a/GLideN64/src/uCodes/F3DBETA.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef F3DBETA_H -#define F3DBETA_H - -#define F3DBETA_PERSPNORM 0xB4 -#define F3DBETA_RDPHALF_1 0xB3 -#define F3DBETA_RDPHALF_2 0xB2 -#define F3DBETA_TRI2 0xB1 - -void F3DBETA_Init(); - -void F3DBETA_Perpnorm(u32 w0, u32 w1); - -#endif - diff --git a/GLideN64/src/uCodes/F3DDKR.cpp b/GLideN64/src/uCodes/F3DDKR.cpp deleted file mode 100644 index e38cfa4..0000000 --- a/GLideN64/src/uCodes/F3DDKR.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DDKR.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void F3DDKR_DMA_Mtx( u32 w0, u32 w1 ) -{ - if (_SHIFTR( w0, 0, 16 ) != 64) { - DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "G_MTX: address = 0x%08X length = %i params = 0x%02X\n", w1, _SHIFTR(w0, 0, 16), _SHIFTR(w0, 16, 8)); - return; - } - - u32 index = _SHIFTR( w0, 16, 4 ); - u32 multiply; - - if (index == 0) {// DKR - index = _SHIFTR( w0, 22, 2 ); - multiply = 0; - } - else { // JFG - multiply = _SHIFTR( w0, 23, 1 ); - } - - gSPDMAMatrix( w1, index, multiply ); -} - -void F3DDKR_DMA_Vtx( u32 w0, u32 w1 ) -{ - if ((w0 & F3DDKR_VTX_APPEND)) { - if (gSP.matrix.billboard) - gSP.vertexi = 1; - } else - gSP.vertexi = 0; - - u32 n = _SHIFTR( w0, 19, 5 ) + 1; - - gSPDMAVertex( w1, n, gSP.vertexi + _SHIFTR( w0, 9, 5 ) ); - - gSP.vertexi += n; -} - -void F3DJFG_DMA_Vtx(u32 w0, u32 w1) -{ - if ((w0 & F3DDKR_VTX_APPEND)) { - if (gSP.matrix.billboard) - gSP.vertexi = 1; - } else - gSP.vertexi = 0; - - u32 n = _SHIFTR(w0, 19, 5); - - gSPDMAVertex(w1, n, gSP.vertexi + _SHIFTR(w0, 9, 5)); - - gSP.vertexi += n; -} - -void F3DDKR_DMA_Tri(u32 w0, u32 w1) -{ - gSPDMATriangles( w1, _SHIFTR( w0, 4, 12 ) ); - gSP.vertexi = 0; -} - -void F3DDKR_DMA_DList( u32 w0, u32 w1 ) -{ - gSPDlistCount(_SHIFTR(w0, 16, 8), w1); -} - -void F3DDKR_DMA_Offsets( u32 w0, u32 w1 ) -{ - gSPSetDMAOffsets( _SHIFTR( w0, 0, 24 ), _SHIFTR( w1, 0, 24 ) ); -} - -void F3DDKR_DMA_Tex_Offset(u32 w0, u32 w1) -{ - gSPSetDMATexOffset(w1); -} - -void F3DDKR_MoveWord( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 0, 8 )) { - case 0x02: - gSP.matrix.billboard = w1 & 1; - break; - case 0x0A: - gSP.matrix.modelViewi = _SHIFTR( w1, 6, 2 ); - gSP.changed |= CHANGED_MATRIX; - break; - default: - F3D_MoveWord( w0, w1 ); - break; - } -} - -void F3DDKR_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_DMA_MTX, F3DDKR_DMA_MTX, F3DDKR_DMA_Mtx ); - GBI_SetGBI( G_DMA_TEX_OFFSET, F3DDKR_DMA_TEX_OFFSET, F3DDKR_DMA_Tex_Offset ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_DMA_VTX, F3DDKR_DMA_VTX, F3DDKR_DMA_Vtx ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_DMA_DL, F3DDKR_DMA_DL, F3DDKR_DMA_DList ); - GBI_SetGBI( G_DMA_TRI, F3DDKR_DMA_TRI, F3DDKR_DMA_Tri ); - - GBI_SetGBI( G_DMA_OFFSETS, F3DDKR_DMA_OFFSETS, F3DDKR_DMA_Offsets ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3DDKR_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3D_Quad ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3D_RDPHALF_CONT, F3D_RDPHalf_Cont ); - - gSPSetDMAOffsets( 0, 0 ); -} - -void F3DJFG_Init() -{ - F3DDKR_Init(); - GBI_SetGBI(G_DMA_VTX, F3DDKR_DMA_VTX, F3DJFG_DMA_Vtx); -} diff --git a/GLideN64/src/uCodes/F3DDKR.h b/GLideN64/src/uCodes/F3DDKR.h deleted file mode 100644 index a4b8cf3..0000000 --- a/GLideN64/src/uCodes/F3DDKR.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef F3DDKR_H -#define F3DDKR_H - -#define F3DDKR_VTX_APPEND 0x00010000 - -#define F3DDKR_DMA_MTX 0x01 -#define F3DDKR_DMA_TEX_OFFSET 0x02 -#define F3DDKR_DMA_VTX 0x04 -#define F3DDKR_DMA_TRI 0x05 -#define F3DDKR_DMA_DL 0x07 -#define F3DDKR_DMA_OFFSETS 0xBF - -void F3DDKR_Init(); -void F3DJFG_Init(); -#endif - diff --git a/GLideN64/src/uCodes/F3DEX.cpp b/GLideN64/src/uCodes/F3DEX.cpp deleted file mode 100644 index 6ea624a..0000000 --- a/GLideN64/src/uCodes/F3DEX.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void F3DEX_Vtx( u32 w0, u32 w1 ) -{ - gSPVertex( w1, _SHIFTR( w0, 10, 6 ), _SHIFTR( w0, 17, 7 ) ); -} - -void F3DEX_Tri1( u32 w0, u32 w1 ) -{ - gSP1Triangle( _SHIFTR( w1, 17, 7 ), _SHIFTR( w1, 9, 7 ), _SHIFTR( w1, 1, 7 )); -} - -void F3DEX_CullDL( u32 w0, u32 w1 ) -{ - gSPCullDisplayList( _SHIFTR( w0, 1, 15 ), _SHIFTR( w1, 1, 15 ) ); -} - -void F3DEX_ModifyVtx( u32 w0, u32 w1 ) -{ - gSPModifyVertex( _SHIFTR( w0, 1, 15 ), _SHIFTR( w0, 16, 8 ), w1 ); -} - -void F3DEX_Tri2( u32 w0, u32 w1 ) -{ - gSP2Triangles( _SHIFTR( w0, 17, 7 ), _SHIFTR( w0, 9, 7 ), _SHIFTR( w0, 1, 7 ), 0, - _SHIFTR( w1, 17, 7 ), _SHIFTR( w1, 9, 7 ), _SHIFTR( w1, 1, 7 ), 0); -} - -void F3DEX_Quad( u32 w0, u32 w1 ) -{ - gSP1Quadrangle( _SHIFTR( w1, 25, 7 ), _SHIFTR( w1, 17, 7 ), _SHIFTR( w1, 9, 7 ), _SHIFTR( w1, 1, 7 ) ); -} - -void F3DEX_Branch_Z( u32 w0, u32 w1 ) -{ - gSPBranchLessZ(gDP.half_1, _SHIFTR(w0, 1, 11), _SHIFTR(w1, 16, 16)); -} - -void F3DEX_Load_uCode( u32 w0, u32 w1 ) -{ - gSPLoadUcodeEx( w1, gDP.half_1, _SHIFTR( w0, 0, 16 ) + 1 ); -} - -void F3DEX_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3DEX_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - - GBI_SetGBI( G_TRI1, F3D_TRI1, F3DEX_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3DEX_Quad ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_MODIFYVTX, F3DEX_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_TRI2, F3DEX_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_BRANCH_Z, F3DEX_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX_LOAD_UCODE, F3DEX_Load_uCode ); -} - diff --git a/GLideN64/src/uCodes/F3DEX.h b/GLideN64/src/uCodes/F3DEX.h deleted file mode 100644 index 429f4d9..0000000 --- a/GLideN64/src/uCodes/F3DEX.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef F3DEX_H -#define F3DEX_H - -#define F3DEX_MTX_STACKSIZE 18 - -#define F3DEX_MTX_MODELVIEW 0x00 -#define F3DEX_MTX_PROJECTION 0x01 -#define F3DEX_MTX_MUL 0x00 -#define F3DEX_MTX_LOAD 0x02 -#define F3DEX_MTX_NOPUSH 0x00 -#define F3DEX_MTX_PUSH 0x04 - -#define F3DEX_TEXTURE_ENABLE 0x00000002 -#define F3DEX_SHADING_SMOOTH 0x00000200 -#define F3DEX_CULL_FRONT 0x00001000 -#define F3DEX_CULL_BACK 0x00002000 -#define F3DEX_CULL_BOTH 0x00003000 -#define F3DEX_CLIPPING 0x00800000 - -#define F3DEX_MV_VIEWPORT 0x80 - -#define F3DEX_MWO_aLIGHT_1 0x00 -#define F3DEX_MWO_bLIGHT_1 0x04 -#define F3DEX_MWO_aLIGHT_2 0x20 -#define F3DEX_MWO_bLIGHT_2 0x24 -#define F3DEX_MWO_aLIGHT_3 0x40 -#define F3DEX_MWO_bLIGHT_3 0x44 -#define F3DEX_MWO_aLIGHT_4 0x60 -#define F3DEX_MWO_bLIGHT_4 0x64 -#define F3DEX_MWO_aLIGHT_5 0x80 -#define F3DEX_MWO_bLIGHT_5 0x84 -#define F3DEX_MWO_aLIGHT_6 0xa0 -#define F3DEX_MWO_bLIGHT_6 0xa4 -#define F3DEX_MWO_aLIGHT_7 0xc0 -#define F3DEX_MWO_bLIGHT_7 0xc4 -#define F3DEX_MWO_aLIGHT_8 0xe0 -#define F3DEX_MWO_bLIGHT_8 0xe4 - -// F3DEX commands -#define F3DEX_MODIFYVTX 0xB2 -#define F3DEX_TRI2 0xB1 -#define F3DEX_BRANCH_Z 0xB0 -#define F3DEX_LOAD_UCODE 0xAF // 0xCF - -void F3DEX_Vtx( u32 w0, u32 w1 ); -void F3DEX_Tri1( u32 w0, u32 w1 ); -void F3DEX_CullDL( u32 w0, u32 w1 ); -void F3DEX_ModifyVtx( u32 w0, u32 w1 ); -void F3DEX_Tri2( u32 w0, u32 w1 ); -void F3DEX_Branch_Z( u32 w0, u32 w1 ); -void F3DEX_Load_uCode( u32 w0, u32 w1 ); -void F3DEX_Init(); -#endif - diff --git a/GLideN64/src/uCodes/F3DEX2.cpp b/GLideN64/src/uCodes/F3DEX2.cpp deleted file mode 100644 index a3c28b9..0000000 --- a/GLideN64/src/uCodes/F3DEX2.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include <algorithm> -#include <assert.h> -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -using namespace std; - -void F3DEX2_Mtx( u32 w0, u32 w1 ) -{ - gSPMatrix( w1, _SHIFTR( w0, 0, 8 ) ^ G_MTX_PUSH ); -} - -void F3DEX2_MoveMem( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 0, 8 )) - { - case F3DEX2_MV_VIEWPORT: - gSPViewport( w1 ); - break; - case G_MV_MATRIX: - gSPForceMatrix( w1 ); - - // force matrix takes two commands - RSP.PC[RSP.PCi] += 8; - break; - case G_MV_LIGHT: - { - const u32 offset = (_SHIFTR(w0, 5, 11))&0x7F8; - const u32 n = offset / 24; - if (n < 2) - gSPLookAt(w1, n); - else - gSPLight(w1, n - 1); - } - break; - } -} - -void F3DEX2_Vtx( u32 w0, u32 w1 ) -{ - u32 n = _SHIFTR( w0, 12, 8 ); - - gSPVertex( w1, n, _SHIFTR( w0, 1, 7 ) - n ); -} - -void F3DEX2_Reserved1( u32 w0, u32 w1 ) -{ -} - -void F3DEX2_Tri1( u32 w0, u32 w1 ) -{ - gSP1Triangle( _SHIFTR( w0, 17, 7 ), - _SHIFTR( w0, 9, 7 ), - _SHIFTR( w0, 1, 7 )); -} - -void F3DEX2_Line3D( u32 w0, u32 w1 ) -{ - assert(false); -} - -void F3DEX2_PopMtx( u32 w0, u32 w1 ) -{ - gSPPopMatrixN( 0, w1 >> 6 ); -} - -void F3DEX2_MoveWord( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 16, 8 )) - { - case G_MW_FORCEMTX: - if (w1 == 0) - gSP.changed |= CHANGED_MATRIX; - else - gSP.changed &= ~CHANGED_MATRIX; - break; - case G_MW_MATRIX: - gSPInsertMatrix( _SHIFTR( w0, 0, 16 ), w1 ); - break; - case G_MW_NUMLIGHT: - gSPNumLights( w1 / 24 ); - break; - case G_MW_CLIP: - gSPClipRatio( w1 ); - break; - case G_MW_SEGMENT: - gSPSegment( _SHIFTR( w0, 2, 4 ) , w1 & 0x00FFFFFF ); - break; - case G_MW_FOG: - gSPFogFactor( (s16)_SHIFTR( w1, 16, 16 ), (s16)_SHIFTR( w1, 0, 16 ) ); - break; - case G_MW_LIGHTCOL: - gSPLightColor((_SHIFTR( w0, 0, 16 ) / 24) + 1, w1 ); - break; - case G_MW_PERSPNORM: - gSPPerspNormalize( w1 ); - break; - } -} - -void F3DEX2_Texture( u32 w0, u32 w1 ) -{ - gSPTexture( _FIXED2FLOAT( _SHIFTR( w1, 16, 16 ), 16 ), - _FIXED2FLOAT( _SHIFTR( w1, 0, 16 ), 16 ), - _SHIFTR( w0, 11, 3 ), - _SHIFTR( w0, 8, 3 ), - _SHIFTR( w0, 1, 7 ) ); -} - -void F3DEX2_SetOtherMode_H( u32 w0, u32 w1 ) -{ - const u32 length = _SHIFTR(w0, 0, 8) + 1; - const u32 shift = max(0, (s32)(32 - _SHIFTR(w0, 8, 8) - length)); - gSPSetOtherMode_H(length, shift, w1); -} - -void F3DEX2_SetOtherMode_L( u32 w0, u32 w1 ) -{ - const u32 length = _SHIFTR(w0, 0, 8) + 1; - const u32 shift = max(0, (s32)(32 - _SHIFTR(w0, 8, 8) - length)); - gSPSetOtherMode_L(length, shift, w1); -} - -void F3DEX2_GeometryMode( u32 w0, u32 w1 ) -{ - gSPGeometryMode( ~_SHIFTR( w0, 0, 24 ), w1 ); -} - -void F3DEX2_DMAIO( u32 w0, u32 w1 ) -{ - gSP.DMAIO_address = RSP_SegmentToPhysical(w1); -} - -void F3DEX2_Special_1( u32 w0, u32 w1 ) -{ - const u32 param = _SHIFTR(w0, 0, 8); - if (GBI.isCombineMatrices()) - gSPCombineMatrices(param); - else - gSPDlistCount(param, w1); -} - -void F3DEX2_Special_2( u32 w0, u32 w1 ) -{ -} - -void F3DEX2_Special_3( u32 w0, u32 w1 ) -{ -} - -void F3DEX2_Quad( u32 w0, u32 w1 ) -{ - gSP2Triangles( _SHIFTR( w0, 17, 7 ), - _SHIFTR( w0, 9, 7 ), - _SHIFTR( w0, 1, 7 ), - 0, - _SHIFTR( w1, 17, 7 ), - _SHIFTR( w1, 9, 7 ), - _SHIFTR( w1, 1, 7 ), - 0 ); -} - -void F3DEX2_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DEX2_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DEX2_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DEX2_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DEX2_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_Z, F3DEX2_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); - GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, F3DEX2_LINE3D, F3DEX2_Line3D ); -} - diff --git a/GLideN64/src/uCodes/F3DEX2.h b/GLideN64/src/uCodes/F3DEX2.h deleted file mode 100644 index 9f81420..0000000 --- a/GLideN64/src/uCodes/F3DEX2.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef F3DEX2_H -#define F3DEX2_H - -#define F3DEX2_MTX_STACKSIZE 18 - -#define F3DEX2_MTX_MODELVIEW 0x00 -#define F3DEX2_MTX_PROJECTION 0x04 -#define F3DEX2_MTX_MUL 0x00 -#define F3DEX2_MTX_LOAD 0x02 -#define F3DEX2_MTX_NOPUSH 0x00 -#define F3DEX2_MTX_PUSH 0x01 - -#define F3DEX2_TEXTURE_ENABLE 0x00000000 -#define F3DEX2_SHADING_SMOOTH 0x00200000 -#define F3DEX2_CULL_FRONT 0x00000200 -#define F3DEX2_CULL_BACK 0x00000400 -#define F3DEX2_CULL_BOTH 0x00000600 -#define F3DEX2_CLIPPING 0x00800000 - -#define F3DEX2_MV_VIEWPORT 8 - -#define F3DEX2_MWO_aLIGHT_1 0x00 -#define F3DEX2_MWO_bLIGHT_1 0x04 -#define F3DEX2_MWO_aLIGHT_2 0x18 -#define F3DEX2_MWO_bLIGHT_2 0x1c -#define F3DEX2_MWO_aLIGHT_3 0x30 -#define F3DEX2_MWO_bLIGHT_3 0x34 -#define F3DEX2_MWO_aLIGHT_4 0x48 -#define F3DEX2_MWO_bLIGHT_4 0x4c -#define F3DEX2_MWO_aLIGHT_5 0x60 -#define F3DEX2_MWO_bLIGHT_5 0x64 -#define F3DEX2_MWO_aLIGHT_6 0x78 -#define F3DEX2_MWO_bLIGHT_6 0x7c -#define F3DEX2_MWO_aLIGHT_7 0x90 -#define F3DEX2_MWO_bLIGHT_7 0x94 -#define F3DEX2_MWO_aLIGHT_8 0xa8 -#define F3DEX2_MWO_bLIGHT_8 0xac - - -#define F3DEX2_RDPHALF_2 0xF1 -#define F3DEX2_SETOTHERMODE_H 0xE3 -#define F3DEX2_SETOTHERMODE_L 0xE2 -#define F3DEX2_RDPHALF_1 0xE1 -#define F3DEX2_SPNOOP 0xE0 -#define F3DEX2_ENDDL 0xDF -#define F3DEX2_DL 0xDE -#define F3DEX2_LOAD_UCODE 0xDD -#define F3DEX2_MOVEMEM 0xDC -#define F3DEX2_MOVEWORD 0xDB -#define F3DEX2_MTX 0xDA -#define F3DEX2_GEOMETRYMODE 0xD9 -#define F3DEX2_POPMTX 0xD8 -#define F3DEX2_TEXTURE 0xD7 -#define F3DEX2_DMA_IO 0xD6 -#define F3DEX2_SPECIAL_1 0xD5 -#define F3DEX2_SPECIAL_2 0xD4 -#define F3DEX2_SPECIAL_3 0xD3 - -#define F3DEX2_VTX 0x01 -#define F3DEX2_MODIFYVTX 0x02 -#define F3DEX2_CULLDL 0x03 -#define F3DEX2_BRANCH_Z 0x04 -#define F3DEX2_TRI1 0x05 -#define F3DEX2_TRI2 0x06 -#define F3DEX2_QUAD 0x07 -#define F3DEX2_LINE3D 0x08 - - -void F3DEX2_Mtx( u32 w0, u32 w1 ); -void F3DEX2_MoveMem( u32 w0, u32 w1 ); -void F3DEX2_Vtx( u32 w0, u32 w1 ); -void F3DEX2_Reserved1( u32 w0, u32 w1 ); -void F3DEX2_Tri1( u32 w0, u32 w1 ); -void F3DEX2_PopMtx( u32 w0, u32 w1 ); -void F3DEX2_MoveWord( u32 w0, u32 w1 ); -void F3DEX2_Texture( u32 w0, u32 w1 ); -void F3DEX2_SetOtherMode_H( u32 w0, u32 w1 ); -void F3DEX2_SetOtherMode_L( u32 w0, u32 w1 ); -void F3DEX2_GeometryMode( u32 w0, u32 w1 ); -void F3DEX2_Line3D( u32 w0, u32 w1 ); -void F3DEX2_DMAIO( u32 w0, u32 w1 ); -void F3DEX2_Special_1( u32 w0, u32 w1 ); -void F3DEX2_Special_2( u32 w0, u32 w1 ); -void F3DEX2_Special_3( u32 w0, u32 w1 ); -void F3DEX2_Quad( u32 w0, u32 w1 ); -void F3DEX2_Init(); -#endif - diff --git a/GLideN64/src/uCodes/F3DEX2ACCLAIM.cpp b/GLideN64/src/uCodes/F3DEX2ACCLAIM.cpp deleted file mode 100644 index 69bb821..0000000 --- a/GLideN64/src/uCodes/F3DEX2ACCLAIM.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include <algorithm> -#include <assert.h> -#include "GLideN64.h" -#include "RSP.h" -#include "gSP.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "F3DEX2ACCLAIM.h" - -using namespace std; - -void F3DEX2ACCLAIM_MoveMem( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 0, 8 )) - { - case F3DEX2_MV_VIEWPORT: - gSPViewport( w1 ); - break; - case G_MV_MATRIX: - gSPForceMatrix( w1 ); - - // force matrix takes two commands - RSP.PC[RSP.PCi] += 8; - break; - case G_MV_LIGHT: - { - const u32 offset = (_SHIFTR(w0, 5, 11))&0x7F8; - if (offset <= 24 * 3) { - const u32 n = offset / 24; - if (n < 2) - gSPLookAt(w1, n); - else - gSPLight(w1, n - 1); - } else { - const u32 n = 2 + (offset - 24 * 4) / 16; - gSPLightAcclaim(w1, n); - } - } - break; - } -} - -void F3DEX2ACCLAIM_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DEX2ACCLAIM_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DEX2_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DEX2_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DEX2_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_Z, F3DEX2_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); - GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, F3DEX2_LINE3D, F3DEX2_Line3D ); -} - diff --git a/GLideN64/src/uCodes/F3DEX2ACCLAIM.h b/GLideN64/src/uCodes/F3DEX2ACCLAIM.h deleted file mode 100644 index e6d5047..0000000 --- a/GLideN64/src/uCodes/F3DEX2ACCLAIM.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef F3DEX2_ACCLAIM_H -#define F3DEX2_ACCLAIM_H - -void F3DEX2ACCLAIM_Init(); - -#endif - diff --git a/GLideN64/src/uCodes/F3DEX2CBFD.cpp b/GLideN64/src/uCodes/F3DEX2CBFD.cpp deleted file mode 100644 index a740aad..0000000 --- a/GLideN64/src/uCodes/F3DEX2CBFD.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "F3DEX2CBFD.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -static -void F3DEX2CBFD_Vtx( u32 w0, u32 w1 ) -{ - u32 n = _SHIFTR( w0, 12, 8 ); - - gSPCBFDVertex( w1, n, _SHIFTR( w0, 1, 7 ) - n ); -} - -static -void F3DEX2CBFD_CoordMod(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "gSPCoordMod( %u, %u );\n", _w0, _w1); - if ((_w0 & 8) != 0) - return; - u32 idx = _SHIFTR(_w0, 1, 2); - u32 pos = _w0 & 0x30; - if (pos == 0) { - gSP.cbfd.vertexCoordMod[0 + idx] = (f32)(s16)_SHIFTR(_w1, 16, 16); - gSP.cbfd.vertexCoordMod[1 + idx] = (f32)(s16)_SHIFTR(_w1, 0, 16); - } - else if (pos == 0x10) { - gSP.cbfd.vertexCoordMod[4 + idx] = _FIXED2FLOAT(_SHIFTR(_w1, 16, 16), 16); - gSP.cbfd.vertexCoordMod[5 + idx] = _FIXED2FLOAT(_SHIFTR(_w1, 0, 16), 16); - gSP.cbfd.vertexCoordMod[12 + idx] = gSP.cbfd.vertexCoordMod[0 + idx] + gSP.cbfd.vertexCoordMod[4 + idx]; - gSP.cbfd.vertexCoordMod[13 + idx] = gSP.cbfd.vertexCoordMod[1 + idx] + gSP.cbfd.vertexCoordMod[5 + idx]; - } - else if (pos == 0x20) { - gSP.cbfd.vertexCoordMod[8 + idx] = (f32)(s16)_SHIFTR(_w1, 16, 16); - gSP.cbfd.vertexCoordMod[9 + idx] = (f32)(s16)_SHIFTR(_w1, 0, 16); - } -} - -static -void F3DEX2CBFD_MoveWord( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 16, 8 )) - { - case G_MW_NUMLIGHT: - gSPNumLights( w1 / 48 ); - break; - case G_MW_CLIP: - gSPClipRatio( w1 ); - break; - case G_MW_SEGMENT: - gSPSegment( _SHIFTR( w0, 0, 16 ) >> 2, w1 & 0x00FFFFFF ); - break; - case G_MW_FOG: - gSPFogFactor( (s16)_SHIFTR( w1, 16, 16 ), (s16)_SHIFTR( w1, 0, 16 ) ); - break; - case G_MW_PERSPNORM: - gSPPerspNormalize( w1 ); - break; - case G_MW_COORD_MOD: - F3DEX2CBFD_CoordMod( w0, w1 ); - break; - } -} - -static -void F3DEX2CBFD_MoveMem( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 0, 8 )) - { - case F3DEX2_MV_VIEWPORT: - gSPViewport( w1 ); - break; - case G_MV_LIGHT: - { - const u32 offset = _SHIFTR(w0, 5, 14); - const u32 n = offset / 48; - if (n < 2) - gSPLookAt(w1, n); - else - gSPLightCBFD(w1, n - 2); - } - break; - case G_MV_NORMALES: - gSP.cbfd.vertexNormalBase = RSP_SegmentToPhysical(w1); - DebugMsg(DEBUG_NORMAL, "gSPSetVertexNormaleBase( 0x%08X );\n", w1); - break; - } -} - -static -void F3DEX2CBFD_Tri4( u32 w0, u32 w1 ) -{ - gSP4Triangles( _SHIFTR( w0, 23, 5 ), _SHIFTR( w0, 18, 5 ), (_SHIFTR( w0, 15, 3 )<<2)|_SHIFTR( w1, 30, 2 ), - _SHIFTR( w0, 10, 5 ), _SHIFTR( w0, 5, 5 ), _SHIFTR( w0, 0, 5 ), - _SHIFTR( w1, 25, 5 ), _SHIFTR( w1, 20, 5 ), _SHIFTR( w1, 15, 5 ), - _SHIFTR( w1, 10, 5 ), _SHIFTR( w1, 5, 5 ), _SHIFTR( w1, 0, 5 ) ); -} - -static -void F3DEX2CBFD_SwitchLightingMode(u32, u32) -{ - gSP.cbfd.advancedLighting = true; -} - -void F3DEX2CBFD_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX2CBFD_SwitchLightingMode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DEX2CBFD_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DEX2CBFD_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DEX2_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DEX2CBFD_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_Z, F3DEX2_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); - GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, F3DEX2_LINE3D, F3DEX2_Line3D ); - for (u32 i = 0; i < 16; ++i) - GBI.cmd[F3DEX2CBFD_TRI4+i] = F3DEX2CBFD_Tri4; -} diff --git a/GLideN64/src/uCodes/F3DEX2CBFD.h b/GLideN64/src/uCodes/F3DEX2CBFD.h deleted file mode 100644 index 03989a0..0000000 --- a/GLideN64/src/uCodes/F3DEX2CBFD.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef F3DEX2CBFD_H -#define F3DEX2CBFD_H - -#define F3DEX2CBFD_TRI4 16 - -void F3DEX2CBFD_Init(); - -#endif // F3DEX2CBFD_H diff --git a/GLideN64/src/uCodes/F3DFLX2.cpp b/GLideN64/src/uCodes/F3DFLX2.cpp deleted file mode 100644 index 640359c..0000000 --- a/GLideN64/src/uCodes/F3DFLX2.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "GLideN64.h" -#include "3DMath.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "F3DFLX2.h" -#include "RSP.h" -#include "gSP.h" -#include "DebugDump.h" - -inline -void F3DFLX2_LoadAlphaLight(u32 _a) -{ - const u32 address = RSP_SegmentToPhysical(_a); - - const s16* const data = reinterpret_cast<const s16*>(RDRAM + address); - -// gSP.lookat.xyz[0][X] = static_cast<f32>(data[4 ^ 1]); -// gSP.lookat.xyz[0][Y] = static_cast<f32>(data[5 ^ 1]); -// gSP.lookat.xyz[0][Z] = static_cast<f32>(data[6 ^ 1]); - gSP.lookat.xyz[0][X] = _FIXED2FLOAT(data[4 ^ 1], 8); - gSP.lookat.xyz[0][Y] = _FIXED2FLOAT(data[5 ^ 1], 8); - gSP.lookat.xyz[0][Z] = _FIXED2FLOAT(data[6 ^ 1], 8); - - gSP.lookatEnable = true; - - Normalize(gSP.lookat.xyz[0]); - gSP.changed |= CHANGED_LOOKAT; - DebugMsg(DEBUG_NORMAL, "F3DFLX2_LoadAlphaLight( 0x%08X );\n", _a); -} - -static -void F3DFLX2_MoveMem(u32 w0, u32 w1) -{ - switch (_SHIFTR(w0, 0, 8)) - { - case G_MV_LIGHT: - { - const u32 offset = (w0 >> 5) & 0x7F8; - const u32 n = offset / 24; - if (n == 1) - F3DFLX2_LoadAlphaLight(w1); - else - gSPLight(w1, n - 1); - } - break; - default: - F3DEX2_MoveMem(w0, w1); - break; - } -} - - -void F3DFLX2_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DFLX2_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DEX2_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DEX2_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DEX2_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_Z, F3DEX2_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); - GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, F3DEX2_LINE3D, F3DEX2_Line3D ); -} diff --git a/GLideN64/src/uCodes/F3DFLX2.h b/GLideN64/src/uCodes/F3DFLX2.h deleted file mode 100644 index 518369e..0000000 --- a/GLideN64/src/uCodes/F3DFLX2.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef F3DFLX2_H -#define F3DFLX2_H - -void F3DFLX2_Init(); - -#endif // F3DFLX2_H diff --git a/GLideN64/src/uCodes/F3DGOLDEN.cpp b/GLideN64/src/uCodes/F3DGOLDEN.cpp deleted file mode 100644 index 2e6736b..0000000 --- a/GLideN64/src/uCodes/F3DGOLDEN.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include <assert.h> -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DGOLDEN.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -#define F3DGOLDEN_MOVEWORD 0xBD - -u32 G_GOLDEN_MOVEWORD; - -void F3D_TriX(u32 w0, u32 w1) -{ - while(w1 != 0) { - u32 v0 = w1 & 0xf; - w1 >>= 4; - - u32 v1 = w1 & 0xf; - w1 >>= 4; - - u32 v2 = w0 & 0xf; - w0 >>= 4; - - gSPTriangle(v0, v1, v2); - } - gSPFlushTriangles(); -} - -void F3DGOLDEN_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3D_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - - GBI_SetGBI( G_TRI1, F3D_TRI1, F3D_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_GOLDEN_MOVEWORD, F3DGOLDEN_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3D_Quad ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3D_RDPHALF_CONT, F3D_RDPHalf_Cont ); - GBI_SetGBI( G_TRIX, F3D_TRIX, F3D_TriX ); -} diff --git a/GLideN64/src/uCodes/F3DGOLDEN.h b/GLideN64/src/uCodes/F3DGOLDEN.h deleted file mode 100644 index 4849b7a..0000000 --- a/GLideN64/src/uCodes/F3DGOLDEN.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef F3DGOLDEN_H -#define F3DGOLDEN_H - -#define F3D_TRIX 0xB1 - -void F3DGOLDEN_Init(); - -void F3D_TriX(u32 w0, u32 w1); - -#endif - diff --git a/GLideN64/src/uCodes/F3DPD.cpp b/GLideN64/src/uCodes/F3DPD.cpp deleted file mode 100644 index 9ec2a1c..0000000 --- a/GLideN64/src/uCodes/F3DPD.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DGOLDEN.h" -#include "F3DPD.h" -#include "N64.h" -#include "gSP.h" - -#define F3DPD_VTXCOLORBASE 0x07 - -void F3DPD_Vtx( u32 w0, u32 w1 ) -{ - gSPCIVertex( w1, _SHIFTR( w0, 20, 4 ) + 1, _SHIFTR( w0, 16, 4 ) ); -} - -void F3DPD_VtxColorBase( u32 w0, u32 w1 ) -{ - gSPSetVertexColorBase( w1 ); -} - -void F3DPD_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3DPD_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_VTXCOLORBASE, F3DPD_VTXCOLORBASE, F3DPD_VtxColorBase ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - - GBI_SetGBI( G_TRI1, F3D_TRI1, F3D_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3D_Quad ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3D_RDPHALF_CONT, F3D_RDPHalf_Cont ); - GBI_SetGBI( G_TRIX, F3D_TRIX, F3D_TriX ); - - gSPSetDMAOffsets( 0, 0 ); -} - diff --git a/GLideN64/src/uCodes/F3DPD.h b/GLideN64/src/uCodes/F3DPD.h deleted file mode 100644 index 27e0dfd..0000000 --- a/GLideN64/src/uCodes/F3DPD.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef F3DPD_H -#define F3DPD_H - -void F3DPD_Init(); - -#endif - diff --git a/GLideN64/src/uCodes/F3DSETA.cpp b/GLideN64/src/uCodes/F3DSETA.cpp deleted file mode 100644 index aec37e2..0000000 --- a/GLideN64/src/uCodes/F3DSETA.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include <assert.h> -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DSETA.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -#define F3DSETA_PERSPNORM 0xB4 -#define F3DSETA_RDPHALF_1 0xB3 -#define F3DSETA_RDPHALF_2 0xB2 -#define F3DSETA_RDPHALF_CONT 0xB1 - -#define F3DSETA_MW_NUMLIGHT 0x00 -#define F3DSETA_MW_CLIP 0x02 -#define F3DSETA_MW_SEGMENT 0x04 -#define F3DSETA_MW_FOG 0x06 -#define F3DSETA_MW_LIGHTCOL 0x08 - -void F3DSETA_MoveWord(u32 w0, u32 w1) -{ - switch (_SHIFTR( w0, 8, 8 )) { - case F3DSETA_MW_NUMLIGHT: - gSPNumLights( ((w1 - 0x80000000) >> 5) - 1 ); - break; - case F3DSETA_MW_CLIP: - gSPClipRatio( w1 ); - break; - case F3DSETA_MW_SEGMENT: - gSPSegment( _SHIFTR( w0, 10, 4 ), w1 & 0x00FFFFFF ); - break; - case F3DSETA_MW_FOG: - gSPFogFactor( (s16)_SHIFTR( w1, 16, 16 ), (s16)_SHIFTR( w1, 0, 16 ) ); - break; - case F3DSETA_MW_LIGHTCOL: - switch (_SHIFTR( w0, 0, 8 )) - { - case F3D_MWO_aLIGHT_1: - gSPLightColor( LIGHT_1, w1 ); - break; - case F3D_MWO_aLIGHT_2: - gSPLightColor( LIGHT_2, w1 ); - break; - case F3D_MWO_aLIGHT_3: - gSPLightColor( LIGHT_3, w1 ); - break; - case F3D_MWO_aLIGHT_4: - gSPLightColor( LIGHT_4, w1 ); - break; - case F3D_MWO_aLIGHT_5: - gSPLightColor( LIGHT_5, w1 ); - break; - case F3D_MWO_aLIGHT_6: - gSPLightColor( LIGHT_6, w1 ); - break; - case F3D_MWO_aLIGHT_7: - gSPLightColor( LIGHT_7, w1 ); - break; - case F3D_MWO_aLIGHT_8: - gSPLightColor( LIGHT_8, w1 ); - break; - } - break; - default: - assert(false && "F3DSETA unknown MoveWord"); - } -} - -void F3DSETA_Perpnorm(u32 w0, u32 w1) -{ - gSPPerspNormalize(w1); -} - -void F3DSETA_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3D_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - - GBI_SetGBI( G_TRI1, F3D_TRI1, F3D_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3DSETA_MoveWord ); - GBI_SetGBI( G_PERSPNORM, F3DSETA_PERSPNORM, F3DSETA_Perpnorm); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_QUAD, F3D_QUAD, F3D_Quad ); - GBI_SetGBI( G_RDPHALF_1, F3DSETA_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3DSETA_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3DSETA_RDPHALF_CONT, F3D_RDPHalf_Cont ); -} diff --git a/GLideN64/src/uCodes/F3DSETA.h b/GLideN64/src/uCodes/F3DSETA.h deleted file mode 100644 index 13c92be..0000000 --- a/GLideN64/src/uCodes/F3DSETA.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef F3DSETA_H -#define F3DSETA_H - -void F3DSETA_Init(); - -#endif - diff --git a/GLideN64/src/uCodes/F3DTEXA.cpp b/GLideN64/src/uCodes/F3DTEXA.cpp deleted file mode 100644 index 1fa8faf..0000000 --- a/GLideN64/src/uCodes/F3DTEXA.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "GLideN64.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DTEXA.h" -#include "N64.h" -#include "RDP.h" -#include "gSP.h" -#include "GBI.h" - -#define F3DTEXA_LOADTEX 0xB5 -#define F3DTEXA_SETTILESIZE 0xBE - -u32 G_TEXA_LOADTEX, G_TEXA_SETTILESIZE; - -void F3DTTEXA_LoadTex(u32 w0, u32 w1) -{ - RDP_SetTImg(0x3d100000, w1); - RDP_SetTile(0x35100000, 0x07000000); - RDP_LoadBlock(0x33000000, 0x27000000 | _SHIFTR(w0, 0, 24)); -} - -void F3DTTEXA_SetTileSize(u32 w0, u32 w1) -{ - const u32 firstHalf = _SHIFTL(_SHIFTR(w1, 24, 8), 9, 8); - RDP_SetTile(0x35400000 | firstHalf, _SHIFTR(w0, 0, 24)); - RDP_SetTileSize(0x32000000, _SHIFTR(w1, 0, 24)); -} - -void F3DTEXA_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags(F3DEX); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI(G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp); - GBI_SetGBI(G_MTX, F3D_MTX, F3D_Mtx); - GBI_SetGBI(G_RESERVED0, F3D_RESERVED0, F3D_Reserved0); - GBI_SetGBI(G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem); - GBI_SetGBI(G_VTX, F3D_VTX, F3DEX_Vtx); - GBI_SetGBI(G_RESERVED1, F3D_RESERVED1, F3D_Reserved1); - GBI_SetGBI(G_DL, F3D_DL, F3D_DList); - GBI_SetGBI(G_RESERVED2, F3D_RESERVED2, F3D_Reserved2); - GBI_SetGBI(G_RESERVED3, F3D_RESERVED3, F3D_Reserved3); - GBI_SetGBI(G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base); - - GBI_SetGBI(G_TRI1, F3D_TRI1, F3DEX_Tri1); - GBI_SetGBI(G_TEXA_SETTILESIZE, F3DTEXA_SETTILESIZE, F3DTTEXA_SetTileSize); - GBI_SetGBI(G_POPMTX, F3D_POPMTX, F3D_PopMtx); - GBI_SetGBI(G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord); - GBI_SetGBI(G_TEXTURE, F3D_TEXTURE, F3D_Texture); - GBI_SetGBI(G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H); - GBI_SetGBI(G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L); - GBI_SetGBI(G_ENDDL, F3D_ENDDL, F3D_EndDL); - GBI_SetGBI(G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode); - GBI_SetGBI(G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode); - GBI_SetGBI(G_TEXA_LOADTEX, F3DTEXA_LOADTEX, F3DTTEXA_LoadTex); - GBI_SetGBI(G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1); - GBI_SetGBI(G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2); - GBI_SetGBI(G_MODIFYVTX, F3DEX_MODIFYVTX, F3DEX_ModifyVtx); - GBI_SetGBI(G_TRI2, F3DEX_TRI2, F3DEX_Tri2); - GBI_SetGBI(G_BRANCH_Z, F3DEX_BRANCH_Z, F3DEX_Branch_Z); - GBI_SetGBI(G_LOAD_UCODE, F3DEX_LOAD_UCODE, F3DEX_Load_uCode); -} diff --git a/GLideN64/src/uCodes/F3DTEXA.h b/GLideN64/src/uCodes/F3DTEXA.h deleted file mode 100644 index e6ffe59..0000000 --- a/GLideN64/src/uCodes/F3DTEXA.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef F3DTEXA_H -#define F3DTEXA_H - -void F3DTEXA_Init(); - -#endif diff --git a/GLideN64/src/uCodes/F3DZEX2.cpp b/GLideN64/src/uCodes/F3DZEX2.cpp deleted file mode 100644 index 600f9f7..0000000 --- a/GLideN64/src/uCodes/F3DZEX2.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "GLideN64.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "F3DZEX2.h" -#include "gSP.h" - -#define F3DZEX2_BRANCH_W 0x04 - -void F3DZEX2_Branch_W( u32 w0, u32 w1 ) -{ - gSPBranchLessW(gDP.half_1, _SHIFTR( w0, 1, 7 ), w1); -} - -void F3DZEX2_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DEX2_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DEX2_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DEX2_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DEX2_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_W, F3DZEX2_BRANCH_W, F3DZEX2_Branch_W ); - GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); - GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, F3DEX2_LINE3D, F3DEX2_Line3D ); -} diff --git a/GLideN64/src/uCodes/F3DZEX2.h b/GLideN64/src/uCodes/F3DZEX2.h deleted file mode 100644 index 793793a..0000000 --- a/GLideN64/src/uCodes/F3DZEX2.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef F3DZEX2_H -#define F3DZEX2_H - -void F3DZEX2_Init(); - -#endif // F3DEX2M_H diff --git a/GLideN64/src/uCodes/F5Indi_Naboo.cpp b/GLideN64/src/uCodes/F5Indi_Naboo.cpp deleted file mode 100644 index 428cdfc..0000000 --- a/GLideN64/src/uCodes/F5Indi_Naboo.cpp +++ /dev/null @@ -1,2354 +0,0 @@ -/* Ucodes for "Indiana Jones and the Infernal Machine" and "Star Wars Episode I - Battle for Naboo". - * Microcode decoding: olivieryuyu - */ - -#include <assert.h> -#include <stdlib.h> -#include <time.h> -#include <memory.h> -#include <cmath> -#include <vector> -#include "GLideN64.h" -#include "F3D.h" -#include "F5Indi_Naboo.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "Config.h" -#include "Combiner.h" -#include "FrameBuffer.h" -#include "DisplayWindow.h" -#include "Debugger.h" - -#include "DebugDump.h" -#include "Log.h" - -#define F5INDI_MOVEMEM 0x01 -#define F5INDI_SET_DLIST_ADDR 0x02 -#define F5INDI_GEOMETRY_GEN 0x05 -#define F5INDI_DL 0x06 -#define F5INDI_BRANCHDL 0x07 -#define F5INDI_TRI2 0xB4 -#define F5INDI_JUMPDL 0xB5 -#define F5INDI_ENDDL 0xB8 -#define F5INDI_MOVEWORD 0xBC -#define F5INDI_TRI1 0xBF -#define F5INDI_TEXRECT 0xE4 -#define F5INDI_SETOTHERMODE 0xBA -#define F5INDI_SETOTHERMODE_C 0xB9 -#define F5NABOO_BE 0xBE - -#define CAST_DMEM(type, addr) reinterpret_cast<type>(DMEM + addr) -#define CAST_RDRAM(type, addr) reinterpret_cast<type>(RDRAM + addr) - -static u32 G_SET_DLIST_ADDR, G_BE, G_JUMPDL, G_INDI_TEXRECT; - -struct IndiData { - s32 mtx_st_adjust[16]; - f32 mtx_vtx_gen[4][4]; -}; - -IndiData & getIndiData() -{ - static IndiData data; - return data; -} - -struct NabooData { - u16 AA; - s16 BB; - s16 EE; - s16 HH; - u8 DD; - u8 CC; - u8 TT; - u8 pad; -}; - -static -NabooData & getNabooData() -{ - static NabooData data; - return data; -} - -static -void _updateF5DL() -{ - RSP.F5DL[RSP.PCi] = _SHIFTR(*CAST_RDRAM(u32*, RSP.PC[RSP.PCi]), 0, 24); -} - -static -void F5INDI_LoadSTMatrix() -{ - const u16* mtx_i = CAST_DMEM(const u16*, 0xE40); - const u16* mtx_f = CAST_DMEM(const u16*, 0xE60); - s32 * mtx = getIndiData().mtx_st_adjust; - for (u32 i = 0; i < 16; ++i) - mtx[i] = (mtx_i[i ^ 1] << 16) | mtx_f[i ^ 1]; -} - -static -void F5INDI_DMA_Direct(u32 _w0, u32 _w1) -{ - u32 * pSrc = CAST_RDRAM(u32*, _SHIFTR(_w1, 0, 24)); - u32 * pDst = CAST_DMEM(u32*, _SHIFTR(_w0, 8, 12)); - const u32 count = (_SHIFTR(_w0, 0, 8) + 1) >> 2; - for (u32 i = 0; i < count; ++i) { - pDst[i] = pSrc[i]; - } -} - -static -void F5INDI_DMA_Segmented(u32 _w0, u32 _w1) -{ - if (_SHIFTR(_w0, 0, 8) == 0) - return; - u32 * FD4 = CAST_DMEM(u32*, 0xFD4); - u32 * FD8 = CAST_DMEM(u32*, 0xFD8); - u32 * FDC = CAST_DMEM(u32*, 0xFDC); - s32 A0 = _SHIFTR(_w0, 0, 8); - u32 A2 = *FDC; - s32 A3 = A0 + 1; - s32 A1 = A2 - A3; - u32 V1 = _SHIFTR(_w0, 8, 12); - while (A1 < 0) { - u32 V0 = *FD4; - A3 = A0 - A2; - memcpy(DMEM + V1, RDRAM + _SHIFTR(V0, 0, 24), A2); - - V1 += A2; - A0 = A3; - _w1 = *FD8; - - u32 * pSrc = CAST_RDRAM(u32*, _SHIFTR(_w1, 0, 24)); - *FD8 = *pSrc; - *FDC = 0x100; - *FD4 = _w1 + 0x08; - - A2 = *FDC; - A3 = A0 + 1; - A1 = A2 - A3; - } - - u32 V0 = *FD4; - u32 T0 = V0 + A3; - memcpy(DMEM + V1, RDRAM + _SHIFTR(V0, 0, 24), A0 + 1); - *FDC = A1; - *FD4 = T0; -} - -static -void F5INDI_Lighting_Overlay1(u32 _w0, u32 _w1) -{ - const u32 S = ((_SHIFTR(_w1, 24, 7) << 2) + 4) & 0xFFF8; - memset(DMEM + 0xD40, 0, S); - - u8 L = *(DMEM + (0x58B ^ 3)); - if (L == 0) { - *CAST_DMEM(u64*, 0x05B0) = 0U; - return; - } - - u32 lightAddr = 0xB10; - const u32 dataAddr = _SHIFTR(_w0, 8, 12); - - while (true) { - u8 * dst = DMEM + 0xD40; - const u8* data = DMEM + dataAddr; - const u8* light = DMEM + lightAddr; - if (*light == 0) { - const u32 count = S >> 3; - for (u32 i = 0; i < count; ++i) { - const u8* factor = DMEM + 0x158; - dst[0] = (data[0] * factor[0]) >> 8; - for (u32 j = 1; j < 4; ++j) { - dst[j] = std::min(((data[j] * factor[j] * light[j]) >> 16) + dst[j], 0xFF); - } - factor += 4; - dst += 4; - data += 4; - dst[0] = (data[0] * factor[0]) >> 8; - for (u32 j = 1; j < 4; ++j) { - dst[j] = std::min(((data[j] * factor[j] * light[j]) >> 16) + dst[j], 0xFF); - } - dst += 4; - data += 4; - } - } else { - u8* offsetAddr = DMEM + 0x380; - u32 offsetAddrIdx = 0; - u64 vtxAddrPos = *CAST_DMEM(u64*, 0x05B0); - const u32 factors[2] = { *CAST_DMEM(u32*, 0x158), *CAST_DMEM(u32*, 0x15C) }; - const u32 count = S >> 3; - for (u32 i = 0; i < count; ++i) { - u32 vtxAddr[2]; - switch (vtxAddrPos & 3) { - case 0: - vtxAddr[0] = vtxAddr[1] = lightAddr - 0x10; - break; - case 1: - vtxAddr[0] = lightAddr - 0x08; - vtxAddr[1] = lightAddr - 0x10; - break; - case 2: - vtxAddr[0] = lightAddr - 0x10; - vtxAddr[1] = lightAddr - 0x08; - break; - case 3: - vtxAddr[0] = vtxAddr[1] = lightAddr - 0x08; - break; - } - vtxAddrPos >>= 2; - for (u32 j = 0; j < 2; ++j) { - const u32 * V = CAST_DMEM(const u32*, vtxAddr[j]); - s16 X1 = (s16)_SHIFTR(*V, 16, 16); - s16 Y1 = (s16)_SHIFTR(*V, 0, 16); - ++V; - s16 Z1 = (s16)_SHIFTR(*V, 16, 16); - - V = CAST_DMEM(const u32*, 0x170 + offsetAddr[offsetAddrIdx^3]); - offsetAddrIdx++; - s16 X = (s16)_SHIFTR(*V, 16, 16); - s16 Y = (s16)_SHIFTR(*V, 0, 16); - ++V; - s16 Z = (s16)_SHIFTR(*V, 16, 16); - X -= X1; - Y -= Y1; - Z -= Z1; - - u64 T = *CAST_DMEM(const u32*, lightAddr + 4); - T = 0xFFFF000000000000 | (T << 16); - u64 K = (X * X + Y * Y + Z * Z) * T; - u32 P = K >> 32; - u32 P1 = 0; - if ((P & 0xFFFF0000) == 0xFFFF0000) - P1 = P & 0xFFFF; - - V = CAST_DMEM(const u32*, lightAddr); - - u32 D = (_SHIFTR(*V, 24, 8) * P1) >> 16; - u32 E = (_SHIFTR(*V, 16, 8) * P1) >> 16; - u32 F = (_SHIFTR(*V, 8, 8) * P1) >> 16; - u32 J = (_SHIFTR(factors[j], 0, 8) * data[0x3 ^ 3]) >> 8; - - if (*light == 4) { - *dst = J; - dst++; - *dst = std::min(*dst + F, 0xFFU); - dst++; - *dst = std::min(*dst + E, 0xFFU); - dst++; - *dst = std::min(*dst + D, 0xFFU); - dst++; - } else { - D += (_SHIFTR(factors[j], 24, 8) * data[0x0 ^ 3]) >> 8; - E += (_SHIFTR(factors[j], 16, 8) * data[0x1 ^ 3]) >> 8; - F += (_SHIFTR(factors[j], 8, 8) * data[0x2 ^ 3]) >> 8; - *dst = J; - dst++; - *dst = std::min(F >> 1, 0xFFU); - dst++; - *dst = std::min(E >> 1, 0xFFU); - dst++; - *dst = std::min(D >> 1, 0xFFU); - dst++; - } - data += 4; - } - } - } - - --L; - if (L == 0) { - *CAST_DMEM(u64*, 0x05B0) = 0U; - const u32 A = *CAST_DMEM(const u32*, 0x5A8); - if (A == 0xFFFFFFFF) - return; - u8 * dst = DMEM + 0xD40; - const u8* factor = DMEM + 0x5A8; - const u32 count = S >> 2; - for (u32 i = 0; i < count; ++i) { - for (u32 j = 0; j < 4; ++j) { - dst[j] = (dst[j] * factor[j]) >> 8; - } - dst += 4; - } - return; - } - - lightAddr += 0x18; - } -} - -static -void F5INDI_Lighting_Overlay2(u32 _w0, u32 _w1) -{ - const u32 S = ((_SHIFTR(_w1, 24, 7) << 2) + 4) & 0xFFF8; - memset(DMEM + 0xD40, 0, S + 8); - - u8 L = *(DMEM + (0x58B ^ 3)); - if (L == 0) { - *CAST_DMEM(u64*, 0x05B0) = 0U; - return; - } - - u32 lightAddr = 0xB10; - const u32 dataAddr = _SHIFTR(_w0, 8, 12); - - while (true) { - u8 * dst = DMEM + 0xD40; - const u8* data = DMEM + dataAddr; - const u8* light = DMEM + lightAddr; - if (*light == 0) { - const u32 count = S >> 3; - for (u32 i = 0; i < count; ++i) { - const u8* factor = DMEM + 0x158; - dst[0] = (data[0] * factor[0]) >> 8; - for (u32 j = 1; j < 4; ++j) { - dst[j] = std::min(((data[j] * factor[j] * light[j]) >> 16) + dst[j], 0xFF); - } - factor += 4; - dst += 4; - data += 4; - dst[0] = (data[0] * factor[0]) >> 8; - for (u32 j = 1; j < 4; ++j) { - dst[j] = std::min(((data[j] * factor[j] * light[j]) >> 16) + dst[j], 0xFF); - } - dst += 4; - data += 4; - } - } else if (*light == 1) { - u32 factor2Addr = 0x380; - u64 vtxAddrPos = *CAST_DMEM(const u64*, 0x05B0); - const u32 factors[2] = { *CAST_DMEM(const u32*, 0x158), *CAST_DMEM(const u32*, 0x15C) }; - const u32 count = S >> 3; - for (u32 i = 0; i < count; ++i) { - u32 vtxAddr[2]; - switch (vtxAddrPos & 3) { - case 0: - vtxAddr[0] = vtxAddr[1] = lightAddr - 0x10; - break; - case 1: - vtxAddr[0] = lightAddr - 0x08; - vtxAddr[1] = lightAddr - 0x10; - break; - case 2: - vtxAddr[0] = lightAddr - 0x10; - vtxAddr[1] = lightAddr - 0x08; - break; - case 3: - vtxAddr[0] = vtxAddr[1] = lightAddr - 0x08; - break; - } - vtxAddrPos >>= 2; - for (u32 j = 0; j < 2; ++j) { - u32 V = *CAST_DMEM(const u32*, vtxAddr[j]); - s16 X = (s16)_SHIFTR(V, 16, 16); - s16 Y = (s16)_SHIFTR(V, 0, 16); - V = *CAST_DMEM(const u32*, vtxAddr[j] + 0x04); - s16 Z = (s16)_SHIFTR(V, 16, 16); - - V = *CAST_DMEM(const u32*, factor2Addr); - u32 I = (u32)(((X * char(_SHIFTR(V, 24, 8)) + Y * char(_SHIFTR(V, 16, 8)) + Z * char(_SHIFTR(V, 8, 8))) >> 8) & 0xFFFF); - if ((I & 0x8000) != 0) - I = 0; - V = *CAST_DMEM(const u32*, lightAddr); - u32 D = (_SHIFTR(V, 24, 8) * I) >> 8; - u32 E = (_SHIFTR(V, 16, 8) * I) >> 8; - u32 F = (_SHIFTR(V, 8, 8) * I) >> 8; - V = factors[j]; - u32 K = _SHIFTR(V, 0, 8) * (*data++); - u32 J = _SHIFTR(V, 8, 8) * (*data++); - u32 H = _SHIFTR(V, 16, 8) * (*data++); - u32 G = _SHIFTR(V, 24, 8) * (*data++); - *dst = K >> 8; - dst++; - *dst = std::min(*dst + ((F * J) >> 22), 0xFFU); - dst++; - *dst = std::min(*dst + ((E * H) >> 22), 0xFFU); - dst++; - *dst = std::min(*dst + ((D * G) >> 22), 0xFFU); - dst++; - factor2Addr += 4; - } - } - } else { - u32 offsetAddr = 0x380; - const u32 factors[2] = { *CAST_DMEM(const u32*, 0x158), *CAST_DMEM(const u32*, 0x15C) }; - const u32 count = S >> 3; - u32 vtxAddr[2] = { lightAddr - 0x10, lightAddr - 0x10 }; - for (u32 i = 0; i < count; ++i) { - for (u32 j = 0; j < 2; ++j) { - const u32 * V = CAST_DMEM(const u32*, vtxAddr[j]); - s16 X1 = (s16)_SHIFTR(*V, 16, 16); - s16 Y1 = (s16)_SHIFTR(*V, 0, 16); - ++V; - s16 Z1 = (s16)_SHIFTR(*V, 16, 16); - - u32 offset = *CAST_DMEM(const u32*, offsetAddr + j * 4); - V = CAST_DMEM(const u32*, 0x170 + _SHIFTR(offset, 0, 8)); - s16 X = (s16)_SHIFTR(*V, 16, 16); - s16 Y = (s16)_SHIFTR(*V, 0, 16); - ++V; - s16 Z = (s16)_SHIFTR(*V, 16, 16); - X -= X1; - Y -= Y1; - Z -= Z1; - - u64 T = *CAST_DMEM(const u32*, lightAddr + 4); - T = 0xFFFF000000000000 | (T << 16); - u64 K = (X * X + Y * Y + Z * Z) * T; - u32 P = static_cast<u32>(K >> 32); - u32 P1 = 0; - if ((P & 0xFFFF0000) == 0xFFFF0000) - P1 = P & 0xFFFF; - - const u8* factor = DMEM + 0x158 + j * 4; - dst[0] = (data[0] * factor[0]) >> 8; - const u8* light = DMEM + lightAddr; - for (u32 k = 1; k < 4; ++k) { - dst[k] = std::min(((((light[k] * P1) >> 16) * data[k] * factor[k] + 0x8000) >> 16) + dst[k], 0xFFU); - } - dst += 4; - data += 4; - } - offsetAddr += 8; - } - } - - --L; - if (L == 0) { - *CAST_DMEM(u64*, 0x05B0) = 0U; - return; - } - - lightAddr += 0x18; - } -} - -static -void F5INDI_Lighting_Basic(u32 _w0, u32 _w1) -{ - s32 count = _SHIFTR(_w1, 24, 7); - const u8* factor = DMEM + 0x158; - const u8* data = DMEM + _SHIFTR(_w0, 8, 12); - u8 * dst = DMEM + 0xD40; - while (count > 0) { - for (u32 j = 0; j < 8; ++j) { - dst[j] = (data[j] * factor[j]) >> 8; - } - dst += 8; - data += 8; - for (u32 j = 0; j < 8; ++j) { - dst[j] = (data[j] * factor[j]) >> 8; - } - dst += 8; - data += 8; - count -= 4; - } -} - -static -void F5INDI_RebuildAndAdjustColors(u32 _w0, u32 _w1) -{ - const u32 addr = _SHIFTR(_w0, 8, 12); - const u32 count = std::min(_SHIFTR(_w1, 24, 8), (0x588 - addr) >> 2); - const u16* data = CAST_DMEM(const u16*, addr); - std::vector<u32> vres(count); - for (u32 i = 0; i < count; ++i) { - u16 V = data[i ^ 1]; - u32 R = (V >> 8) & 0xF8; - u32 G = (V & 0x7E0) >> 3; - u32 B = (V & 0x1F) << 3; - vres[i] = (R << 24) | (G << 16) | (B << 8) | 0xFF; - } - memcpy(DMEM + addr, vres.data(), count << 2); -} - -static -const SWVertex * F5INDI_LoadVtx(u32 _w0, u32 _w1, std::vector<SWVertex> & _vres) -{ - const u32 count = _SHIFTR(_w1, 24, 8); - const u32 dmem_addr = _SHIFTR(_w0, 8, 12); - const u16* dmem_data = CAST_DMEM(const u16*, dmem_addr); - const u32 base_addr = *CAST_DMEM(const u32*, 0x154); - u32 * pres = reinterpret_cast<u32*>(_vres.data()); - const u16* v0_data = CAST_DMEM(const u16*, 0x128); - const u16 X0 = v0_data[0x0 ^ 1]; - const u16 Y0 = v0_data[0x1 ^ 1]; - const u16 Z0 = v0_data[0x2 ^ 1]; - for (u32 i = 0; i < count; ++i) { - const u32 rdram_addr = dmem_data[i ^ 1] * 6 + base_addr; - const u16* rdram_data = CAST_RDRAM(const u16*, (rdram_addr & 0x00FFFFF8)); - const u32 shift = (rdram_addr & 7) >> 1; - const u16 X = rdram_data[(shift + 0) ^ 1] + X0; - const u16 Y = rdram_data[(shift + 1) ^ 1] + Y0; - const u16 Z = rdram_data[(shift + 2) ^ 1] + Z0; - *pres++ = (X << 16) | Y; - *pres++ = Z << 16; - } - return _vres.data(); -} - -static -const SWVertex * F5INDI_AdjustVtx(u32 _w0, u32 _w1, std::vector<SWVertex> & _vres) -{ - const u32 dmem_addr = _SHIFTR(_w0, 8, 12); - if (*CAST_DMEM(const u64*, 0x128) == 0) - return CAST_DMEM(const SWVertex*, dmem_addr); - const u16* v0_data = CAST_DMEM(const u16*, 0x128); - const u16 X0 = v0_data[0x0 ^ 1]; - const u16 Y0 = v0_data[0x1 ^ 1]; - const u16 Z0 = v0_data[0x2 ^ 1]; - const u32 count = _SHIFTR(_w1, 24, 7); - _vres.resize(count); - u32 * pres = reinterpret_cast<u32*>(_vres.data()); - const u16* dmem_data = CAST_DMEM(const u16*, dmem_addr); - for (u32 i = 0; i < count; ++i) { - const u16 X = dmem_data[0x0 ^ 1] + X0; - const u16 Y = dmem_data[0x1 ^ 1] + Y0; - const u16 Z = dmem_data[0x2 ^ 1] + Z0; - *pres++ = (X << 16) | Y; - *pres++ = Z << 16; - dmem_data += 4; - } - return _vres.data(); -} - -static -void F5INDI_MoveMem(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_01Cmd (0x%08x, 0x%08x)\n", _w0, _w1); - - if (_SHIFTR(_w1, 0, 24) != 0) - F5INDI_DMA_Direct(_w0, _w1); - else - F5INDI_DMA_Segmented(_w0, _w1); - - switch (_w0 & 0x00f00000) { - case 0x00000000: - switch (_w0) { - case 0x0101300F: - gSPViewport(_w1); - break; - case 0x0105C03F: - gSPForceMatrix(_w1); - break; - case 0x010E403F: - RSP_LoadMatrix(getIndiData().mtx_vtx_gen, _SHIFTR(_w1, 0, 24)); - F5INDI_LoadSTMatrix(); - break; - } - break; - - case 0x00100000: - { - std::vector<SWVertex> vertices; - const u32 n = _SHIFTR(_w1, 24, 7); - gSPSWVertex(F5INDI_AdjustVtx(_w0, _w1, vertices), n, nullptr); - } - break; - - case 0x00300000: - // Set num of lights - *(DMEM + (0x058B^3)) = static_cast<u8>(_w1 >> 24); - break; - - case 0x00500000: - { - const u32 n = _SHIFTR(_w1, 24, 7); - std::vector<SWVertex> vres(n); - gSPSWVertex(F5INDI_LoadVtx(_w0, _w1, vres), n, nullptr); - } - break; - - default: - if (_SHIFTR(_w0, 8, 12) == 0x480) { - // Lighting - const u32 F = (_w0 >> 22); - if ((F & 2) != 0) - F5INDI_RebuildAndAdjustColors(_w0, _w1); - const u8 L = *(DMEM + (0x58B ^ 3)); - const u32 C = _SHIFTR(_w1, 24, 8) | L; - if ((C & 0x80) == 0) { - if ((F & 1) != 0) - F5INDI_Lighting_Overlay1(_w0, _w1); - else - F5INDI_Lighting_Overlay2(_w0, _w1); - } else - F5INDI_Lighting_Basic(_w0, _w1); - } - break; - } -} - -static -void F5INDI_SetDListAddr(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_SetDListAddr (0x%08x, 0x%08x)\n", _w0, _w1); - const u32 count = _w0 & 0x1FF; - const u32 * pSrc = CAST_RDRAM(const u32*, _SHIFTR(_w1, 0, 24)); - u32 * pDst = CAST_DMEM(u32*, 0xFD4); - pDst[0] = _w1 + 8; - pDst[1] = *pSrc; - pDst[2] = count; -} - -static -void F5INDI_DList(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_DList (0x%08x)\n", _w1); - gSPDisplayList(_w1); - _updateF5DL(); -} - -static -void F5INDI_BranchDList(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_BranchDList (0x%08x)\n", _w1); - gSPBranchList(_w1); - _updateF5DL(); -} - -static -void F5INDI_CalcST(const u32* params, u32 * _st) -{ - const s16 * subs = CAST_DMEM(const s16*, 0x0F0); - const u16 * muls = CAST_DMEM(const u16*, 0x0EC); - const s32 * mtx = getIndiData().mtx_st_adjust; - - const u32 num = (RSP.cmd == F5INDI_TRI2) ? 4 : 3; - - for (u32 i = 0; i < num; ++i) { - const u32 idx = _SHIFTR(params[i + 4], 0, 8); - const s16 * coords = CAST_DMEM(const s16*, 0x170 + idx); - s16 X = coords[0x0 ^ 1]; - s16 Y = coords[0x1 ^ 1]; - s16 Z = coords[0x2 ^ 1]; - s32 X1 = X * mtx[0 + 4 * 0] + Y * mtx[0 + 4 * 1] + Z * mtx[0 + 4 * 2] + mtx[0 + 4 * 3]; - s32 Y1 = X * mtx[1 + 4 * 0] + Y * mtx[1 + 4 * 1] + Z * mtx[1 + 4 * 2] + mtx[1 + 4 * 3]; - s32 Z1 = X * mtx[2 + 4 * 0] + Y * mtx[2 + 4 * 1] + Z * mtx[2 + 4 * 2] + mtx[2 + 4 * 3]; - X1 -= static_cast<s32>(static_cast<u32>(subs[0x0 ^ 1]) << 16); - Y1 -= static_cast<s32>(static_cast<u32>(subs[0x1 ^ 1]) << 16); - Z1 -= static_cast<s32>(static_cast<u32>(subs[0x2 ^ 1]) << 16); - u64 X2 = static_cast<u64>(X1); - u64 X2_2 = (X2 * X2) >> 16; - u64 Y2 = static_cast<u64>(Y1); - u64 Y2_2 = (Y2 * Y2) >> 16; - u64 Z2 = static_cast<u64>(Z1); - u64 Z2_2 = (Z2 * Z2) >> 16; - u64 R = X2_2 + Y2_2 + Z2_2; - u32 R1 = static_cast<u32>(R); - if (R > 0x0000FFFFFFFF) - R1 = 0x7FFF0000 | (R & 0xFFFF); - u32 D = static_cast<u32>(sqrt(R1)); - D = 0xFFFFFFFF / (D * 0x300); - u32 V = static_cast<u32>((D * X2) >> 16); - u32 W = static_cast<u32>((D * Y2) >> 16); - u32 S = (V * muls[0x0 ^ 1]) >> 16; - u32 T = (W * muls[0x1 ^ 1]) >> 16; - _st[i] = (S << 16) | T; - } -} - -static -void F5INDI_DoSubDList() -{ - const u32 dlistAddr = _SHIFTR(*CAST_DMEM(const u32*, 0x58C), 0, 24); - if (dlistAddr == 0) - return; - - DebugMsg(DEBUG_LOW, "Start Sub DList\n"); - - RSP.PCi++; - RSP.F5DL[RSP.PCi] = _SHIFTR(*CAST_RDRAM(const u32*, dlistAddr), 0, 24); - RSP.PC[RSP.PCi] = dlistAddr + 8; - - while (true) { - RSP.w0 = *CAST_RDRAM(u32*, RSP.PC[RSP.PCi]); - RSP.w1 = *CAST_RDRAM(u32*, RSP.PC[RSP.PCi] + 4); - - RSP.cmd = _SHIFTR(RSP.w0, 24, 8); - - DebugMsg(DEBUG_LOW, "0x%08lX: CMD=0x%02X W0=0x%08X W1=0x%08X\n", RSP.PC[RSP.PCi], RSP.cmd, RSP.w0, RSP.w1); - - if (RSP.w0 == 0xB8000000 && RSP.w1 == 0xFFFFFFFF) - break; - - RSP.nextCmd = _SHIFTR(*CAST_RDRAM(const u32*, RSP.PC[RSP.PCi] + 8), 24, 8); - - GBI.cmd[RSP.cmd](RSP.w0, RSP.w1); - RSP.PC[RSP.PCi] += 8; - - if (RSP.nextCmd == 0xBD) { - // Naboo - u32* command = CAST_DMEM(u32*, 0xE58); - command[0] = RSP.w0; - command[1] = RSP.w1; - break; - } - } - - RSP.PCi--; - *CAST_DMEM(u32*, 0x58C) = 0U; - DebugMsg(DEBUG_LOW, "End Sub DList\n"); -} - -static -bool F5INDI_AddVertices(const u32 _vert[3], GraphicsDrawer & _drawer) -{ - if (_drawer.isClipped(_vert[0], _vert[1], _vert[2])) { - return false; - } - - for (u32 i = 0; i < 3; ++i) { - SPVertex & vtx = _drawer.getVertex(_vert[i]); - - if ((gSP.geometryMode & G_SHADE) == 0) { - // Prim shading - vtx.flat_r = gDP.primColor.r; - vtx.flat_g = gDP.primColor.g; - vtx.flat_b = gDP.primColor.b; - vtx.flat_a = gDP.primColor.a; - } - - if (gDP.otherMode.depthSource == G_ZS_PRIM) - vtx.z = gDP.primDepth.z * vtx.w; - - _drawer.getCurrentDMAVertex() = vtx; - } - - return true; -} - -void F5INDI_Tri(u32 _w0, u32 _w1) -{ - const bool bTri2 = RSP.cmd == F5INDI_TRI2; - DebugMsg(DEBUG_NORMAL, "F5INDI_Tri%d (0x%08x, 0x%08x)\n", bTri2 ? 2 : 1, _w0, _w1); - - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - const u32 w3 = params[3]; - const u32 v1 = (_SHIFTR(_w1, 16, 12) - 0x600) / 40; - const u32 v2 = (_SHIFTR(_w1, 0, 12) - 0x600) / 40; - const u32 v3 = (_SHIFTR( w3, 16, 12) - 0x600) / 40; - const u32 v4 = (_SHIFTR( w3, 0, 12) - 0x600) / 40; - const u32 vert[4] = { v1, v2, v3, v4 }; - - const u32 w2 = params[2]; - const u32 S1 = _SHIFTR(w2, 16, 8); - const u32 S2 = _SHIFTR(w2, 8, 8); - const u32 S3 = _SHIFTR(w2, 0, 8); - const u32 S4 = _SHIFTR(w2, 24, 8); - - const u32 C1 = *CAST_DMEM(const u32*, 0xD40 + S1); - const u32 C2 = *CAST_DMEM(const u32*, 0xD40 + S2); - const u32 C3 = *CAST_DMEM(const u32*, 0xD40 + S3); - const u32 C4 = *CAST_DMEM(const u32*, 0xD40 + S4); - const u32 colors[4] = { C1, C2, C3, C4 }; - - const bool useTex = (_w0 & 0x0200) != 0; - - u32 ST[4]; - const u32 * texbase; - if ((_w0 & 0x0800) != 0) { - F5INDI_CalcST(params, ST); - texbase = ST; - } else { - texbase = params + 4; - } - - // PrepareVertices - const bool persp = gDP.otherMode.texturePersp != 0; - const u8* colorbase = reinterpret_cast<const u8*>(colors); - const u32 count = bTri2 ? 4 : 3; - GraphicsDrawer & drawer = dwnd().getDrawer(); - for (u32 i = 0; i < count; ++i) { - SPVertex & vtx = drawer.getVertex(vert[i]); - const u8 *color = colorbase; - colorbase += 4; - vtx.r = color[3] * 0.0039215689f; - vtx.g = color[2] * 0.0039215689f; - vtx.b = color[1] * 0.0039215689f; - vtx.a = color[0] * 0.0039215689f; - - if (useTex) { - const u32 st = texbase[i]; - s16 s = (s16)_SHIFTR(st, 16, 16); - s16 t = (s16)_SHIFTR(st, 0, 16); - if (persp) { - vtx.s = _FIXED2FLOAT(s, 5); - vtx.t = _FIXED2FLOAT(t, 5); - } else { - vtx.s = _FIXED2FLOAT(s, 4); - vtx.t = _FIXED2FLOAT(t, 4); - } - } - } - - const u32 vert1[3] = { v1, v2, v3 }; - bool triAdded = F5INDI_AddVertices(vert1, drawer); - if (bTri2) { - const u32 vert2[3] = { v1, v3, v4 }; - triAdded |= F5INDI_AddVertices(vert2, drawer); - } - - if (triAdded) - F5INDI_DoSubDList(); - - RSP.nextCmd = _SHIFTR(params[8], 24, 8); - if (RSP.nextCmd != G_TRI1 && RSP.nextCmd != G_TRI2) { - const u32 geometryMode = gSP.geometryMode; - if (useTex) { - if ((gSP.geometryMode & G_CULL_BOTH) == G_CULL_BOTH) - gSP.geometryMode &= ~(G_CULL_FRONT); - } else { - // culling not used for polygons without textures. - gSP.geometryMode &= ~(G_CULL_BOTH); - } - drawer.drawDMATriangles(drawer.getDMAVerticesCount()); - gSP.geometryMode = geometryMode; - } - - if (useTex) - RSP.PC[RSP.PCi] += 16; - - RSP.PC[RSP.PCi] += 8; -} - -void F5INDI_GenVertices(u32 _w0, u32 _w1) -{ - f32 combined[4][4]; - memcpy(combined, gSP.matrix.combined, sizeof(combined)); - memcpy(gSP.matrix.combined, getIndiData().mtx_vtx_gen, sizeof(gSP.matrix.combined)); - - const SWVertex * vertex = CAST_DMEM(const SWVertex*, 0x170); - bool verticesToProcess[32]; - - u32 A = (_w0 & 0x0000FFFF) | (_w1 & 0xFFFF0000); - u32 B = 1; - u32 count = 0; - - while (A != 0) { - u32 C = A & B; - verticesToProcess[count++] = C != 0; - if (C != 0) { - A ^= C; - } - B <<= 1; - } - - gSPSWVertex(vertex, count, verticesToProcess); - - memcpy(gSP.matrix.combined, combined, sizeof(gSP.matrix.combined)); -} - -void F5INDI_GenParticlesVertices() -{ - static const u32 dpc_clock0 = static_cast<u32>(time(NULL)); - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - *CAST_DMEM(u64*, 0xC10) = *CAST_RDRAM(const u64*, _SHIFTR(params[3], 0, 24)); - const u32 L = *CAST_DMEM(const u32*, 0xC10); - if (L == 0) - return; - u32 U = L; - memcpy(DMEM + 0x170, RDRAM + _SHIFTR(params[2], 0, 24), 256); - const u32 corrector = _SHIFTR(params[0], 0, 16); - const u32 M = _SHIFTR(params[5], 0, 16); - u32 vtxAddr = 0x170; - u32 lightAddr = 0xB00; - u32 factorAddr = 0x380; - u32 colorAddr = 0x480; - u32 count = 0; - u32 Q = 0; - while (U != 0) { - SWVertex * vertex = CAST_DMEM(SWVertex*, vtxAddr); - u16* light = CAST_DMEM(u16*, lightAddr); - u16 F = (((light[0x0 ^ 1] << 12) + light[0x1 ^ 1] * corrector) << 4) >> 16; - bool endCycle = false; - if ((M & 0x2000) == 0) { - // Step 2 - s16 F1; - do { - F = (((light[0x0 ^ 1] << 12) + light[0x1 ^ 1] * corrector) << 4) >> 16; - F1 = F + 0xF000; - if (F1 < 0) { - light[0x0 ^ 1] = F; - if ((M & 0x40) != 0) - vertex->flag = (((F >> 4)&0xFC) << 8) | (vertex->flag & 0xFF); - if ((M & 0x20) != 0) - vertex->flag = ((F >> 4) & 0xFC) | (vertex->flag & 0xFF00); - } else { - light[0x0 ^ 1] = 0U; - if ((M & 0x4000) != 0) { - //const u32 dpc_clock = *REG.DPC_CLOCK; - const u32 dpc_clock = static_cast<u32>(time(NULL)) - dpc_clock0; - const u32* V = CAST_DMEM(const u32*, 0xC18); - vertex->x = (dpc_clock & _SHIFTR(V[0], 16, 16)) + _SHIFTR(V[2], 16, 16); - vertex->y = ((dpc_clock >> 3) & _SHIFTR(V[0], 0, 16)) + _SHIFTR(V[2], 0, 16); - vertex->z = ((dpc_clock >> 6) & _SHIFTR(V[1], 16, 16)) + _SHIFTR(V[3], 16, 16); - vertex->flag &= _SHIFTR(V[1], 0, 16); - } else { - Q |= 1 << count; - endCycle = true; - break; - } - } - } while (F1 >= 0); - } - if (!endCycle) { - // Step 3 - u32 X = (u32)_SHIFTL(vertex->x, 12, 16) + (u32)(static_cast<s16>(_SHIFTR(params[4], 16, 16)) * corrector); - u32 Y = (u32)_SHIFTL(vertex->y, 12, 16) + (u32)(static_cast<s16>(_SHIFTR(params[4], 0, 16)) * corrector); - u32 Z = (u32)_SHIFTL(vertex->z, 12, 16) + (u32)(static_cast<s16>(_SHIFTR(params[5], 16, 16)) * corrector); - if ((M & 0x0380) != 0) { - u32 offset = factorAddr - 0x380; - if ((M & 0x0200) == 0) { - if ((M & 0x080) != 0) { - offset = _SHIFTR(F, 4, 8) & 0xF8; - } else { - const u32 p = *CAST_DMEM(const u32*, lightAddr + 4); - offset = _SHIFTR(p, 24, 8) << 3; - } - } - const u32* factor = CAST_DMEM(const u32*, 0x380 + offset); - X += static_cast<s16>(_SHIFTR(factor[0], 16, 16)) * corrector; - Y += static_cast<s16>(_SHIFTR(factor[0], 0, 16)) * corrector; - Z += static_cast<s16>(_SHIFTR(factor[1], 16, 16)) * corrector; - } - // Step 4 - if ((M & 0x1C00) != 0) { - u32 offset = colorAddr - 0x480; - if ((M & 0x1000) == 0) { - if ((M & 0x0400) != 0) { - offset = _SHIFTR(F, 4, 8) & 0xF8; - } else { - const u32 p = *CAST_DMEM(const u32*, lightAddr + 4); - offset = _SHIFTR(p, 16, 8) << 3; - } - } - const u32* factor = CAST_DMEM(const u32*, 0x480 + offset); - X += static_cast<s16>(_SHIFTR(factor[0], 16, 16)) * corrector; - Y += static_cast<s16>(_SHIFTR(factor[0], 0, 16)) * corrector; - Z += static_cast<s16>(_SHIFTR(factor[1], 16, 16)) * corrector; - } - // Step 5 - X = (X << 4) >> 16; - Y = (Y << 4) >> 16; - Z = (Z << 4) >> 16; - vertex->x = X; - vertex->y = Y; - vertex->z = Z; - if ((M & 0x0008) != 0) { - const u32* V = CAST_DMEM(const u32*, 0xC00); - if (vertex->x < static_cast<s16>(_SHIFTR(V[0], 16, 16))) - vertex->x += static_cast<s16>(_SHIFTR(V[2], 16, 16)); - if (vertex->x > static_cast<s16>(_SHIFTR(V[0], 16, 16)) + static_cast<s16>(_SHIFTR(V[2], 16, 16))) - vertex->x -= static_cast<s16>(_SHIFTR(V[2], 16, 16)); - - if (vertex->y < static_cast<s16>(_SHIFTR(V[0], 0, 16))) - vertex->y += static_cast<s16>(_SHIFTR(V[2], 0, 16)); - if (vertex->y > static_cast<s16>(_SHIFTR(V[0], 0, 16)) + static_cast<s16>(_SHIFTR(V[2], 0, 16))) - vertex->y -= static_cast<s16>(_SHIFTR(V[2], 0, 16)); - - if (vertex->z < static_cast<s16>(_SHIFTR(V[1], 16, 16))) - vertex->z += static_cast<s16>(_SHIFTR(V[3], 16, 16)); - if (vertex->z > static_cast<s16>(_SHIFTR(V[1], 16, 16)) + static_cast<s16>(_SHIFTR(V[3], 16, 16))) - vertex->z -= static_cast<s16>(_SHIFTR(V[3], 16, 16)); - } - } - vtxAddr += 8; - lightAddr += 8; - factorAddr += 8; - colorAddr += 8; - U >>= 1; - count++; - } - - memcpy(RDRAM + _SHIFTR(params[2], 0, 24), DMEM + 0x170, 256); - - if ((M & 0x04) == 0) { - *CAST_RDRAM(u32*, _SHIFTR(params[3], 0, 24)) = L & (~Q); - memcpy(RDRAM + _SHIFTR(params[1], 8, 24), DMEM + 0xB00, count * 8); - } -} - -static -u32 F5INDI_TexrectGenVertexMask(u32 _mask, u32 _limAddr, u32 _vtxAddr) -{ - const u32* V = CAST_DMEM(const u32*, _limAddr); - const s16 XL = _SHIFTR(*V, 16, 16); - const s16 YL = _SHIFTR(*V, 0, 16); - ++V; - const s16 ZL = _SHIFTR(*V, 16, 16); - ++V; - const s16 XR = _SHIFTR(*V, 16, 16); - const s16 YR = _SHIFTR(*V, 0, 16); - ++V; - const s16 ZR = _SHIFTR(*V, 16, 16); - - u32 S = 0xFFFFFFFE; - const SWVertex * vertex = CAST_RDRAM(const SWVertex*, _vtxAddr); - for (u32 i = 0; i < 0x20; ++i) { - if (vertex[i].x > XL && vertex[i].x < XR && - vertex[i].y > YL && vertex[i].y < YR && - vertex[i].z > ZL && vertex[i].z < ZR) { - _mask &= S; - } - S = (S << 1) | 1; - } - return _mask; -} - -#ifdef F5INDI_PARTICLE_OPT -static -void F5INDI_AddParticle(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, s16 _s0, s16 _t0, f32 _dsdx, f32 _dtdy) -{ - const f32 Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f; - const f32 W = 1.0f; - - const f32 offsetX = (_lrx - _ulx) * _dsdx; - const f32 offsetY = (_lry - _uly) * _dtdy; - const f32 uls = _FIXED2FLOAT(_s0, 5); - const f32 lrs = uls + offsetX; - const f32 ult = _FIXED2FLOAT(_t0, 5); - const f32 lrt = ult + offsetY; - - GraphicsDrawer & drawer = dwnd().getDrawer(); - auto setupVertex = [&](f32 _x, f32 _y, f32 _s, f32 _t) - { - SPVertex & vtx = drawer.getCurrentDMAVertex(); - vtx.x = _x; - vtx.y = _y; - vtx.z = Z; - vtx.w = W; - vtx.s = _s; - vtx.t = _t; - vtx.r = gDP.primColor.r; - vtx.g = gDP.primColor.g; - vtx.b = gDP.primColor.b; - vtx.a = gDP.primColor.a; - }; - - setupVertex(_ulx, _uly, uls, ult); - setupVertex(_lrx, _uly, lrs, ult); - setupVertex(_ulx, _lry, uls, lrt); - setupVertex(_lrx, _uly, lrs, ult); - setupVertex(_ulx, _lry, uls, lrt); - setupVertex(_lrx, _lry, lrs, lrt); -} - -static -void F5INDI_DrawParticle() -{ - const u32* pNextCmd = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi] + 40); - if (_SHIFTR(pNextCmd[0], 24, 8) != F5INDI_GEOMETRY_GEN || - _SHIFTR(pNextCmd[1], 0, 8) != 0x24) { - // Replace combiner to use vertex color instead of PRIMITIVE - const gDPCombine curCombine = gDP.combine; - if (gDP.combine.mRGB0 == G_CCMUX_PRIMITIVE) - gDP.combine.mRGB0 = G_CCMUX_SHADE; - if (gDP.combine.mA0 == G_ACMUX_PRIMITIVE) - gDP.combine.mA0 = G_ACMUX_SHADE; - if (gDP.combine.mRGB1 == G_CCMUX_PRIMITIVE) - gDP.combine.mRGB1 = G_CCMUX_SHADE; - if (gDP.combine.mA1 == G_ACMUX_PRIMITIVE) - gDP.combine.mA1 = G_ACMUX_SHADE; - const u32 othermodeL = gDP.otherMode.l; - gDP.otherMode.depthSource = G_ZS_PIXEL; - // Replace blending mode - gDP.otherMode.l = 0x00550000 | (gDP.otherMode.l & 0xFFFF); - const u32 geometryMode = gSP.geometryMode; - gSP.geometryMode |= G_ZBUFFER; - gSP.geometryMode &= ~G_FOG; - CombinerInfo::get().setCombine(gDP.combine.mux); - const u32 enableLegacyBlending = config.generalEmulation.enableLegacyBlending; - config.generalEmulation.enableLegacyBlending = 1; - gDP.changed |= CHANGED_COMBINE | CHANGED_RENDERMODE; - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.drawScreenSpaceTriangle(drawer.getDMAVerticesCount(), graphics::drawmode::TRIANGLES); - gDP.combine = curCombine; - gDP.otherMode.l = othermodeL; - gSP.geometryMode = geometryMode; - config.generalEmulation.enableLegacyBlending = enableLegacyBlending; - gDP.changed |= CHANGED_COMBINE | CHANGED_RENDERMODE; - } -} -#endif //F5INDI_PARTICLE_OPT - -static -void F5INDI_TexrectGen() -{ - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - GraphicsDrawer & drawer = dwnd().getDrawer(); -// const u32 perspNorm = *CAST_DMEM(const u32*, 0x14C); - const u32 vp = *CAST_DMEM(const u32*, 0x130); - const u32 vpx = _SHIFTR(vp, 17, 15); - const u32 vpy = _SHIFTR(vp, 1, 15); - const u32 maxX = (_SHIFTR(params[0], 0, 16) * vpx) >> 16; - const u32 maxY = (_SHIFTR(params[1], 16, 16) * vpy) >> 16; - const u64 MX = (params[4] & 0xFFFF0000) | _SHIFTR(params[5], 16, 16); - const u64 xScale = MX * _SHIFTR(params[7], 16, 16) * 1 * vpx; - const u64 MY = (_SHIFTL(params[4], 16, 16)) | _SHIFTR(params[5], 0, 16); - const u64 yScale = MY * _SHIFTR(params[7], 0, 16) * vpy; - const u32 mp = *CAST_DMEM(const u32*, 0x5C8); - const u64 Q = (params[6] & 0xFFFF0000) | _SHIFTR(mp, 16, 16); - const u64 R = (_SHIFTL(params[6], 16, 16)) | _SHIFTR(mp, 0, 16); - const u32 colorScale = params[3]; - - s32 count = _SHIFTR(params[0], 16, 8); - u32 vtxAddr = _SHIFTR(params[2], 0, 24); - for (; count > 0; --count) { - const SWVertex * vertex = CAST_RDRAM(const SWVertex*, vtxAddr); - gSPSWVertex(vertex, 0x20, nullptr); - u32 K = params[8]; - u32 B = params[9] & 0xFF; - u32 limAddr = 0xC28; - while (B != 0) { - K = F5INDI_TexrectGenVertexMask(K, limAddr, vtxAddr); - B--; - limAddr += 0x10; - } - for (u32 i = 0; i < 0x20; ++i) { - const u32 D = K & 1; - K >>= 1; - if (D == 0) - continue; - - const SPVertex & v = drawer.getVertex(i); - if (v.clip != 0) - continue; - const f32 screenX = v.x / v.w * gSP.viewport.vscale[0] + gSP.viewport.vtrans[0]; - const f32 screenY = -v.y / v.w * gSP.viewport.vscale[1] + gSP.viewport.vtrans[1]; - const u32 w_i = std::max(1U, u32(v.w)); - const u32 inv_w = 0xFFFFFFFF / w_i; - - const u32 val = *CAST_DMEM(const u32*, 0x480 + _SHIFTR(vertex[i].flag, 8, 8)); - const u32 A = _SHIFTR(val, 16, 16); - const u32 C = _SHIFTR(val, 0, 16); - - u64 offset_x_i = (xScale * inv_w) >> 32; - offset_x_i = (offset_x_i * A) >> 32; - if (offset_x_i > maxX) - offset_x_i = maxX; - if (offset_x_i < 4) - offset_x_i = 4; - const f32 offset_x_f = _FIXED2FLOAT(static_cast<u32>(offset_x_i), 2); - const f32 ulx = screenX - offset_x_f; - s32 G = screenX - offset_x_f > 0.0f ? 0 : static_cast<s32>(screenX - offset_x_f); - const f32 lrx = std::max(0.0f, screenX + offset_x_f); - if (lrx - ulx <= 0.0f) - continue; - - u64 offset_y_i = (yScale * inv_w) >> 32; - offset_y_i = (offset_y_i * C) >> 32; - if (offset_y_i > maxY) - offset_y_i = maxY; - if (offset_y_i < 4) - offset_y_i = 4; - const f32 offset_y_f = _FIXED2FLOAT(static_cast<u32>(offset_y_i), 2); - const f32 uly = screenY - offset_y_f; - s32 H = screenY - offset_y_f > 0.0f ? 0 : static_cast<s32>(screenY - offset_y_f); - const f32 lry = std::max(0.0f, screenY + offset_y_f); - if (lry - uly <= 0.0f) - continue; - - const u64 Q1 = Q * 0x40 / offset_x_i; - const u16 dsdx_i = static_cast<u16>(Q1 >> 16); - const u64 R1 = R * 0x40 / offset_y_i; - const u16 dtdy_i = static_cast<u16>(R1 >> 16); - - const u64 U = std::min(Q1 * 0x40U, static_cast<u64>(0x7FFFFFFFU)); - const u16 U1 = static_cast<u16>(((0-U) * G) >> 16); - const s16 S = (U1 - 2) * 8; - - const u64 V = std::min(R1 * 0x40U, static_cast<u64>(0x7FFFFFFFU)); - const u16 V1 = static_cast<u16>(((0-V) * H) >> 16); - const s16 T = (V1 - 2) * 8; - - const f32 dsdx = _FIXED2FLOAT((s16)dsdx_i, 10); - const f32 dtdy = _FIXED2FLOAT((s16)dtdy_i, 10); - - gDP.primDepth.z = v.z / v.w * gSP.viewport.vscale[2] + gSP.viewport.vtrans[2]; - gDP.primDepth.deltaZ = 0.0f; - DebugMsg(DEBUG_NORMAL, "SetPrimDepth( %f, %f );\n", gDP.primDepth.z, gDP.primDepth.deltaZ); - - const u32 primColor = *CAST_DMEM(const u32*, 0x380 + _SHIFTR(vertex[i].flag, 0, 8)); - gDP.primColor.r = _FIXED2FLOATCOLOR(((_SHIFTR(primColor, 24, 8) * _SHIFTR(colorScale, 24, 8)) >> 8), 8); - gDP.primColor.g = _FIXED2FLOATCOLOR(((_SHIFTR(primColor, 16, 8) * _SHIFTR(colorScale, 16, 8)) >> 8), 8); - gDP.primColor.b = _FIXED2FLOATCOLOR(((_SHIFTR(primColor, 8, 8) * _SHIFTR(colorScale, 8, 8)) >> 8), 8); - gDP.primColor.a = _FIXED2FLOATCOLOR(((_SHIFTR(primColor, 0, 8) * _SHIFTR(colorScale, 0, 8)) >> 8), 8); - DebugMsg(DEBUG_NORMAL, "SetPrimColor( %f, %f, %f, %f )\n", - gDP.primColor.r, gDP.primColor.g, gDP.primColor.b, gDP.primColor.a); - -#ifdef F5INDI_PARTICLE_OPT - F5INDI_AddParticle(ulx, uly, lrx, lry, S, T, dsdx, dtdy); -#else - gDPTextureRectangle(ulx, uly, lrx, lry, 0, S, T, dsdx, dtdy, false); -#endif - } - vtxAddr += 0x100; - } - -#ifdef F5INDI_PARTICLE_OPT - F5INDI_DrawParticle(); -#endif -} - -static -void F5Naboo_TexrectGen() -{ - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - - const u32 vtxIdx = ((params[0] >> 5) & 0x07F8) / 40; - const SPVertex & v = dwnd().getDrawer().getVertex(vtxIdx); - if (v.clip != 0) - return; - - const f32 screenX = v.x / v.w * gSP.viewport.vscale[0] + gSP.viewport.vtrans[0]; - const f32 screenY = -v.y / v.w * gSP.viewport.vscale[1] + gSP.viewport.vtrans[1]; - - const bool flip = (params[0] & 1) != 0; - - const u32 w_i = std::max(1U, u32(v.w)); - const u32 viewport = *CAST_DMEM(const u32*, 0x130); - const u32 viewportX = _SHIFTR(viewport, 17, 15); - const u32 viewportY = _SHIFTR(viewport, 1, 15); - - const u32 perspMatrixX = (params[5] & 0xFFFF0000) | _SHIFTR(params[6], 16, 16); - const u32 perspMatrixY = _SHIFTL(params[5], 16, 16) | _SHIFTR(params[6], 0, 16); - u64 param3X = _SHIFTR(params[3], 16, 16); - u64 param3Y = _SHIFTR(params[3], 0, 16); - if (flip) - std::swap(param3X, param3Y); - - u32 offset_x_i = static_cast<u32>(((param3X * viewportX * perspMatrixX) / w_i) >> 16); - u32 offset_y_i = static_cast<u32>(((param3Y * viewportY * perspMatrixY) / w_i) >> 16); - const f32 offset_x_f = _FIXED2FLOAT(offset_x_i, 2); - const f32 offset_y_f = _FIXED2FLOAT(offset_y_i, 2); - - const f32 ulx = screenX - offset_x_f; - const f32 lrx = screenX + offset_x_f; - if (lrx - ulx <= 0.0f) - return; - const f32 uly = screenY - offset_y_f; - const f32 lry = screenY + offset_y_f; - if (lry - uly <= 0.0f) - return; - - u32 param4X = params[4] & 0xFFFF0000; - u32 param4Y = _SHIFTL(params[4], 16, 16); - float intpart; - const f32 frac_x_f = fabs(modff(gSP.matrix.combined[0][0], &intpart)); - const u32 combMatrixFracX = u32(frac_x_f*65536.0f); - const f32 frac_y_f = fabs(modff(gSP.matrix.combined[0][1], &intpart)); - const u32 combMatrixFracY = u32(frac_y_f*65536.0f); - param4X |= combMatrixFracX; - param4Y |= combMatrixFracY; - - if (flip) - std::swap(offset_x_i, offset_y_i); - - u16 dsdx_i = (u16)((param4X / offset_x_i) >> 10); - u16 dtdy_i = (u16)((param4Y / offset_y_i) >> 10); - u16 E = 0, F = 0; - - if ((params[0] & 2) != 0) { - dsdx_i = -dsdx_i; - E = _SHIFTR(params[4], 16, 16);; - } - - if ((params[0] & 4) != 0) { - dtdy_i = -dtdy_i; - F = _SHIFTR(params[4], 0, 16);; - } - - const f32 dsdx = _FIXED2FLOAT((s16)dsdx_i, 10); - const f32 dtdy = _FIXED2FLOAT((s16)dtdy_i, 10); - - if (flip) - std::swap(dsdx_i, dtdy_i); - - u16 S, T; - - if (ulx > 0) { - S = E + 0xFFF0; - } else { - const int ulx_i = int(ulx * 4.0f); - S = ((0 - (dsdx_i << 6) * ulx_i) << 3) + E + 0xFFF0; - } - - if (uly > 0) { - T = F + 0xFFF0; - } else { - const int uly_i = int(uly * 4.0f); - T = ((0 - (dtdy_i << 6) * uly_i) << 3) + F + 0xFFF0; - } - - F5INDI_DoSubDList(); - - gDP.primDepth.z = v.z / v.w * gSP.viewport.vscale[2] + gSP.viewport.vtrans[2]; - gDP.primDepth.deltaZ = 0.0f; - - const u32 primColor = params[7]; - gDP.primColor.r = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 24, 8), 8); - gDP.primColor.g = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 16, 8), 8); - gDP.primColor.b = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 8, 8), 8); - gDP.primColor.a = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 0, 8), 8); - DebugMsg(DEBUG_NORMAL, "SetPrimColor( %f, %f, %f, %f )\n", - gDP.primColor.r, gDP.primColor.g, gDP.primColor.b, gDP.primColor.a); - - if ((gSP.geometryMode & G_FOG) != 0) { - const u32 fogColor = (params[7] & 0xFFFFFF00) | u32(v.a*255.0f); - gDPSetFogColor(_SHIFTR(fogColor, 24, 8), // r - _SHIFTR(fogColor, 16, 8), // g - _SHIFTR(fogColor, 8, 8), // b - _SHIFTR(fogColor, 0, 8)); // a - } - - gDPTextureRectangle(ulx, uly, lrx, lry, gSP.texture.tile, (s16)S, (s16)T, dsdx, dtdy, flip); -} - -static -void F5Naboo_CopyDataFF() -{ - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - *CAST_DMEM(u32*, 0x100) = 0; - u32* data = CAST_DMEM(u32*, 0xDB8); - data[0] = _SHIFTR(data[0], 0, 16); - data[1] = _SHIFTL(params[0], 16, 16) | _SHIFTR(data[1], 0, 16); - u32 V = _SHIFTR(params[0], 16, 8); - data[2] = _SHIFTL(V, 24, 8) | 0x00FFFF; - data[3] = V * 2; - data[4] = _SHIFTL(V, 24, 8); - V = _SHIFTR(params[1], 24, 8); - data[5] = V; - //data[6] - data[7] = (data[7] & 0xFFFF0000) | V * 2; - //data[8] - //data[9] - V = _SHIFTR(params[2], 16, 16); - data[10] = (data[10] & 0xFFFF0000) | V; - //data[11] - data[12] = (data[12] & 0xFFFF0000) | V; - //data[13] - V = _SHIFTR(params[2], 0, 16); - data[14] = (data[14] & 0xFFFF0000) | V; - //data[15] - data[16] = (data[16] & 0xFFFF0000) | V; - //data[17] - V = _SHIFTR(params[3], 16, 16); - data[18] = (data[18] & 0xFFFF0000) | V; - //data[19] - data[20] = (data[20] & 0xFFFF0000) | V; - //data[21] - V = _SHIFTR(params[3], 0, 16); - data[22] = (data[22] & 0xFFFF0000) | V; - //data[23] - data[24] = (data[24] & 0xFFFF0000) | V; - //data[25] - //data[26] - V = _SHIFTR(params[1], 8, 16); - data[27] = (data[27] & 0xFFFF0000) | V; - //data[28] - data[29] = (data[29] & 0xFFFF0000) | V; -} - -static -void F5Naboo_CopyData00() -{ - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - - // Step 1 - *CAST_DMEM(u32*, 0x0F8) = params[3]; - u32 V = _SHIFTR(params[0], 16, 8); - *CAST_DMEM(u32*, 0x0FC) = (V << 24) | _SHIFTL(params[10], 16, 8); - - // Step 2 - u32* data = CAST_DMEM(u32*, 0xDD0); - data[0] = (params[2] & 0xFFFF0000) | _SHIFTR(params[14], 16, 16); - data[1] = _SHIFTL(params[2], 16, 16) | _SHIFTR(data[1], 0, 16); - data[2] = (params[2] & 0xFFFF0000) | _SHIFTR(params[14], 0, 16); - data[3] = _SHIFTL(params[2], 16, 16) | 0x0100; - V = (params[4] & 0xFFFF0000); - data[4] = V | _SHIFTR(data[4], 0, 16); - //data[5] - data[6] = V | _SHIFTR(data[6], 0, 16); - //data[7] - V = _SHIFTL(params[4], 16, 16); - data[8] = V | _SHIFTR(data[8], 0, 16); - //data[9] - data[10] = V | _SHIFTR(data[10], 0, 16); - //data[11] - V = (params[5] & 0xFFFF0000); - data[12] = V | _SHIFTR(data[12], 0, 16); - //data[13] - data[14] = V | _SHIFTR(data[14], 0, 16); - //data[15] - V = _SHIFTL(params[5], 16, 16); - data[16] = V | _SHIFTR(data[16], 0, 16); - //data[17] - data[18] = V | _SHIFTR(data[18], 0, 16); - - // Step 3 - V = (params[6] & 0xFFFF0000) | _SHIFTR(params[8], 16, 16); - data[5] = V; - data[7] = V; - V = _SHIFTL(params[6], 16, 16) | _SHIFTR(params[8], 0, 16); - data[9] = V; - data[11] = V; - V = (params[7] & 0xFFFF0000) | _SHIFTR(params[9], 16, 16); - data[13] = V; - data[15] = V; - V = _SHIFTL(params[7], 16, 16) | _SHIFTR(params[9], 0, 16); - data[17] = V; - data[19] = V; - - // Step 4 - V = _SHIFTL(params[0], 16, 16) | _SHIFTR(params[13], 16, 16); - data[20] = V; - data[21] = (params[15] & 0xFFFF0000) | _SHIFTR(data[21], 0, 16); - data[22] = _SHIFTR(params[11], 0, 8); - if (data[22] > 127) - data[22] |= 0xFF00; - V = (_SHIFTR(params[0], 0, 16) + 0x00FF) & 0xFF00; - data[22] |= V << 16; - data[23] = _SHIFTL(params[15], 16, 16) | _SHIFTR(data[23], 0, 16); - data[24] = 0x7FFF7FFF; - data[25] = params[12]; - data[26] = 0x7FFF7FFF; - data[27] = params[12]; - data[28] = params[10]; - data[29] = params[10]; - data[30] = params[11]; - data[31] = params[11]; - - // Step 5 - memcpy(DMEM + 0xC68, RDRAM + _SHIFTR(params[1], 8, 24), 0xF0); - - // Step 6 - *(DMEM + (0x37E ^ 3)) = 0xFF; - - const u32 data_D58[] = { - 0x06000628 - ,0x06500678 - ,0x06A006C8 - ,0x06F00718 - ,0x07400768 - ,0x079007B8 - ,0x07E00808 - ,0x08300858 - ,0x088008A8 - ,0x08D008F8 - ,0x09200948 - ,0x09700998 - ,0x09C009E8 - ,0x0A100A38 - }; - - memcpy(DMEM + 0xD58, data_D58, sizeof(data_D58)); - u32* _D90 = CAST_DMEM(u32*, 0xD90); - _D90[0] = 0x0A600000 | _SHIFTR(_D90[0], 0, 16); -} - -static -void F5Naboo_PrepareAndDrawTriangle(const u32 _vert[3], GraphicsDrawer & _drawer) -{ - if (!F5INDI_AddVertices(_vert, _drawer)) - return; - - const u16 A = _SHIFTR(*CAST_DMEM(const u32*, 0x100), 8, 16); - const u8 B = *(DMEM + (0x103 ^ 3)); - const u32 C = A | B; - CAST_DMEM(u16*, 0x100)[0x0 ^ 1] = C; - - auto doCommands = [](u32 addr) - { - const u32 * commands = CAST_DMEM(const u32*, addr); - u32 w0 = commands[0]; - u32 w1 = commands[1]; - u32 cmd = _SHIFTR(w0, 24, 8); - GBI.cmd[cmd](w0, w1); - w0 = commands[2]; - w1 = commands[3]; - cmd = _SHIFTR(w0, 24, 8); - GBI.cmd[cmd](w0, w1); - }; - - const u32 dlistAddr = _SHIFTR(*CAST_DMEM(const u32*, 0x58C), 0, 24); - if (dlistAddr == 0) { - if ((C << 8) != B) - doCommands(0xE50 + B); - _drawer.drawDMATriangles(_drawer.getDMAVerticesCount()); - return; - } - - F5INDI_DoSubDList(); - - gDPInfo::OtherMode curOtherMode; - curOtherMode._u64 = gDP.otherMode._u64; - curOtherMode.h = 0xEF000000 | (curOtherMode.h & 0x00FFFFFF); - u32 * pOtherMode = CAST_DMEM(u32*, 0xE50); - pOtherMode[0] = curOtherMode.h; - pOtherMode[1] = curOtherMode.l; - const u32 E = curOtherMode.h & 0xFFCFFFFF; - - *CAST_DMEM(u32*, 0xE70) = E; - const u32 F = E | 0x00100000; - *CAST_DMEM(u32*, 0xE60) = F; - const u8 G = *(DMEM + (0x101 ^ 3)); - if (G != 0) { - doCommands(0xE50 + G); - } - _drawer.drawDMATriangles(_drawer.getDMAVerticesCount()); -} - -static -void F5Naboo_DrawPolygons() -{ - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - NabooData & data = getNabooData(); - GraphicsDrawer & drawer = dwnd().getDrawer(); - const u32 cmd = _SHIFTR(params[0], 24, 8); - u32 step = 5; - - if (cmd == 0xBE) { - // Step 1 - data.HH = _SHIFTR(params[0], 0, 16); - - // Step 2 - u32 GG = data.EE - data.DD; - const u16* idx16 = CAST_DMEM(const u16*, GG); - const u32 Idx1 = (idx16[0x09 ^ 1] + data.CC) >> 1; - const u32 Idx2 = (idx16[0x0A ^ 1] + data.CC) >> 1; - const u32 Idx3 = (idx16[0x0B ^ 1] + data.CC) >> 1; - const u32 Idx4 = (idx16[0x0E ^ 1] + data.CC) >> 1; - - idx16 = CAST_DMEM(const u16*, 0xD58); - const u32 VtxAddr1 = idx16[Idx1 ^ 1]; - const u32 VtxAddr2 = idx16[Idx2 ^ 1]; - const u32 VtxAddr3 = idx16[Idx3 ^ 1]; - const u32 VtxAddr4 = idx16[Idx4 ^ 1]; - - const u32 v1 = (VtxAddr1 - 0x600) / 40; - const u32 v2 = (VtxAddr2 - 0x600) / 40; - const u32 v3 = (VtxAddr3 - 0x600) / 40; - const u32 v4 = (VtxAddr4 - 0x600) / 40; - - SPVertex & vtx1 = drawer.getVertex(v1); - vtx1.s = 0.0f; - vtx1.t = _FIXED2FLOAT((s16)_SHIFTR(params[1], 0, 16), 5); - SPVertex & vtx2 = drawer.getVertex(v2); - vtx2.s = _FIXED2FLOAT((s16)_SHIFTR(params[1], 16, 16), 5); - vtx2.t = 0.0f; - SPVertex & vtx3 = drawer.getVertex(v3); - vtx3.s = 0.0f; - vtx3.t = 0.0f; - SPVertex & vtx4 = drawer.getVertex(v4); - vtx4.s = vtx2.s; - vtx4.t = vtx1.t; - - step = 3; - } - - auto Step3 = [&](u32 GG) { - const u16* idx16 = CAST_DMEM(const u16*, GG); - const u32 Idx1 = idx16[0x09 ^ 1] + data.CC; - const u32 Idx2 = idx16[0x0A ^ 1] + data.CC; - const u32 Idx3 = idx16[0x0B ^ 1] + data.CC; - const u32 idxs[3] = { Idx1, Idx2, Idx3 }; - idx16 = CAST_DMEM(const u16*, 0xD58); - u32 vtxIdx[3]; - u32 alphaSum = 0; - for (u32 i = 0; i < 3; ++i) - { - const u32 vtxAddr = idx16[(idxs[i]/2) ^ 1]; - vtxIdx[i] = (vtxAddr - 0x600) / 40; - SPVertex & vtx = drawer.getVertex(vtxIdx[i]); - u8* color = DMEM + 0x0B78 + idxs[i] * 2 + (data.HH & 0xFFF); - vtx.r = _FIXED2FLOATCOLOR(color[0x0 ^ 3], 8); - vtx.g = _FIXED2FLOATCOLOR(color[0x1 ^ 3], 8); - vtx.b = _FIXED2FLOATCOLOR(color[0x2 ^ 3], 8); - vtx.a = _FIXED2FLOATCOLOR(color[0x3 ^ 3], 8); - alphaSum += color[0x3 ^ 3]; - } - if (data.HH == 0) { - *CAST_DMEM(u32*, 0x100) = 0; - F5Naboo_PrepareAndDrawTriangle(vtxIdx, drawer); - } else { - if (alphaSum == 0) { - *(DMEM + (0x103 ^ 3)) = 0x00; - F5Naboo_PrepareAndDrawTriangle(vtxIdx, drawer); - } else { - if (data.HH > 0) { - *(DMEM + (0x103 ^ 3)) = 0x10; - F5Naboo_PrepareAndDrawTriangle(vtxIdx, drawer); - } else { - if (alphaSum != 0x02FD) { // 0xFF * 3 - *(DMEM + (0x103 ^ 3)) = 0x00; - F5Naboo_PrepareAndDrawTriangle(vtxIdx, drawer); - } else { - u32 alphaSum2 = 0; - u8 alphas[3]; - for (u32 i = 0; i < 3; ++i) { - u32 offset = 0xB00 + idxs[i] * 2 + (data.HH & 0xFFF); - u8* color = DMEM + offset; - alphas[i] = color[0x3 ^ 3]; - alphaSum2 += alphas[i]; - } - if (alphaSum2 == 0) { - SPVertex & vtx = drawer.getVertex(vtxIdx[0]); - vtx.a = _FIXED2FLOATCOLOR(alphas[0], 8); - *(DMEM + (0x103 ^ 3)) = 0x20; - F5Naboo_PrepareAndDrawTriangle(vtxIdx, drawer); - } else { - *(DMEM + (0x103 ^ 3)) = 0x10; - for (u32 i = 0; i < 3; ++i) { - SPVertex & vtx = drawer.getVertex(vtxIdx[i]); - vtx.a = _FIXED2FLOATCOLOR(alphas[i], 8); - } - F5Naboo_PrepareAndDrawTriangle(vtxIdx, drawer); - } - } - } - } - } - }; - - while (true) { - switch (step) - { - case 3: - Step3(data.EE - data.DD); - Step3(data.EE - data.DD + 0x08); - step = 4; - break; - case 4: - if (data.DD == 0x10) { - step = 6; - } else { - data.CC += data.TT; - if (((data.AA & 0xFF) | (data.BB & 0xFF)) == 0) - return; - step = 5; - } - break; - case 5: - data.DD = 0x10; - if ((data.AA & 0x80) == 0) { - data.AA <<= 1; - step = 6; - } else { - if ((data.AA & 0x8000) == 0) { - data.AA <<= 1; - step = 3; - } else { - data.AA <<= 1; - return; - } - } - break; - case 6: - data.DD = 0; - if ((data.BB & 0x80) == 0) { - data.BB <<= 1; - step = 4; - } else { - if ((data.BB & 0x8000) == 0) { - data.BB <<= 1; - step = 3; - } else { - data.BB <<= 1; - return; - } - } - break; - } - } -} - -static -struct NabooVertexData { - SWVertex vtx; - u32 E; - u16 K, L, M, N, I, J; - union { - struct { - u8 a, b, g, r; - }; - u32 color; - } color1, color2; -} vd1, vd2; - -static -s32 multAndClip(s32 s, s32 t, s32 max) -{ - const u32 sign1 = s & 0x80000000; - const u32 sign2 = t & 0x80000000; - s32 res = 0; - if ((sign1 ^ sign2) == 0) { - // both positive or both negative - res = static_cast<s32>(std::min(s64(max), (s64(s) * s64(t)) >> 32)); - } - return res; -} - -static -void F5Naboo_GenVertices0C() -{ - const u32 rdramAddr0 = _SHIFTR(*CAST_DMEM(const u32*, 0x0F8), 0, 24); - memcpy(DMEM + 0x380, RDRAM + rdramAddr0, 512); - - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - - // Step 1 - u32 dmemSrcAddr = (params[0] & 0xFFF); - u32 dmemDstAddr = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr), 16, 16); - u32 rdramAddr = _SHIFTR(params[4], 0, 24); - memcpy(DMEM + dmemDstAddr, RDRAM + rdramAddr, 40); - - u32 dmemSrcAddr2 = dmemSrcAddr + 8; - u32 dmemDstAddr2 = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr2), 16, 16); - u32 rdramAddrShift = _SHIFTR(*CAST_DMEM(const u32*, 0xDBC), 16, 16); - memcpy(DMEM + dmemDstAddr2, RDRAM + rdramAddr + rdramAddrShift, 40); - - const u32 flag = _SHIFTR(params[0], 12, 4); - if (flag > 7) { - u32 rdramAddr2 = _SHIFTR(params[5], 0, 24); - memcpy(DMEM + dmemDstAddr + 0x78, RDRAM + rdramAddr2, 40); - memcpy(DMEM + dmemDstAddr2 + 0x78, RDRAM + rdramAddr2 + rdramAddrShift, 40); - } - - // Step 2 - const u32 A = s8(_SHIFTR(params[1], 24, 8)) * 0x10000; - const u32 C32 = A - _SHIFTR(*CAST_DMEM(const u32*, 0xDD0), 16, 16); - const s64 C64 = s64(s32(C32)); - const u32 C2 = static_cast<u32>((C64 * C64) >> 16); - const u32 F = _SHIFTL(*CAST_DMEM(const u32*, 0xDCC), 16, 16); - u32 G = C32 * _SHIFTR(*CAST_DMEM(const u32*, 0xDC4), 0, 16) + F; - - auto PrepareVertexDataStep2 = [&](u32 _V, const u32* _p, NabooVertexData & _vd) { - _vd.vtx.x = _SHIFTL(_SHIFTR(_V, 24, 8), 8, 8); - _vd.vtx.z = _SHIFTL(_SHIFTR(_V, 8, 8), 8, 8); - _vd.vtx.flag = _SHIFTL(_SHIFTR(_V, 0, 8), 8, 8); - u32 B = s8(_SHIFTR(_V, 8, 8)) * 0x10000; - u32 D = B - _SHIFTR(_p[1], 16, 16); - s64 D64 = s64(s32(D)); - _vd.E = C2 + static_cast<u32>((D64 * D64) >> 16); - }; - - PrepareVertexDataStep2(params[1] + _SHIFTR(*CAST_DMEM(const u32*, 0xDC0), 16, 16), CAST_DMEM(const u32*, 0xDD0), vd1); - PrepareVertexDataStep2(params[1], CAST_DMEM(const u32*, 0xDD8), vd2); - - const u32 _E20 = *CAST_DMEM(const u32*, 0xE20); - const u32 _E24 = *CAST_DMEM(const u32*, 0xE24); - const u32 _E28 = *CAST_DMEM(const u32*, 0xE28); - const u32 _E2C = *CAST_DMEM(const u32*, 0xE2C); - const u32 I = (_E2C & 0xFFFF0000) | _SHIFTR(_E24, 16, 16); - - const u32 _DE0 = *CAST_DMEM(const u32*, 0xDE0); - const u32 _DE4 = *CAST_DMEM(const u32*, 0xDE4); - const u32 _DF0 = *CAST_DMEM(const u32*, 0xDF0); - const u32 _DF4 = *CAST_DMEM(const u32*, 0xDF4); - const s32 K = (s32((_DF0 & 0xFFFF0000) | _SHIFTR(_DE0, 16, 16))); - const s32 L = (s32(_SHIFTL(_SHIFTR(_DF0, 0, 16), 16, 16) | _SHIFTR(_DE0, 0, 16))); - const s32 M = (s32((_DF4 & 0xFFFF0000) | _SHIFTR(_DE4, 16, 16))); - const s32 N = (s32(_SHIFTL(_SHIFTR(_DF4, 0, 16), 16, 16) | _SHIFTR(_DE4, 0, 16))); - - const u32 _E00 = *CAST_DMEM(const u32*, 0xE00); - const u32 _E04 = *CAST_DMEM(const u32*, 0xE04); - const u32 _E10 = *CAST_DMEM(const u32*, 0xE10); - const u32 _E14 = *CAST_DMEM(const u32*, 0xE14); - const s32 O = (s32((_E10 & 0xFFFF0000) | _SHIFTR(_E00, 16, 16))); - const s32 P = (s32(_SHIFTL(_SHIFTR(_E10, 0, 16), 16, 16) | _SHIFTR(_E00, 0, 16))); - const s32 Q = (s32((_E14 & 0xFFFF0000) | _SHIFTR(_E04, 16, 16))); - const s32 R = (s32(_SHIFTL(_SHIFTR(_E14, 0, 16), 16, 16) | _SHIFTR(_E04, 0, 16))); - - const u32 _E34 = *CAST_DMEM(const u32*, 0xE34); - const u32 startAddr = _SHIFTR(params[4], 24, 8); - const u32 endAddr = _SHIFTR(params[5], 24, 8); - - // Step 3 - auto PrepareVertexDataStep3 = [&](NabooVertexData & _vd) { - s32 K1 = (K - _vd.E); - s32 K2 = multAndClip(K1, O, 0x7FFF); - s32 L1 = (L - _vd.E); - s32 L2 = multAndClip(L1, P, 0x7FFF); - s32 M1 = (M - _vd.E); - const s32 maxM = _SHIFTR(_E34, 16, 16); - s32 M2 = multAndClip(M1, Q, maxM); - s32 N1 = (N - _vd.E); - const u32 maxN = _SHIFTR(_E34, 0, 16); - s32 N2 = multAndClip(N1, R, maxN); - u64 J = (u64(_vd.E) * u64(I)) >> 16; - J *= J; - _vd.K = static_cast<u16>(K2); - _vd.L = static_cast<u16>(L2); - _vd.M = static_cast<u16>(M2); - _vd.N = static_cast<u16>(N2); - _vd.J = std::min(u16(0x7FFF), static_cast<u16>(J >> 47)); - }; - - const u32 _E40 = *CAST_DMEM(const u32*, 0xE40); - const u32 _E48 = *CAST_DMEM(const u32*, 0xE48); - const u32 _DD0 = *CAST_DMEM(const u32*, 0xDD0); - const u32 _DD4 = *CAST_DMEM(const u32*, 0xDD4); - const u32 _DD6 = _SHIFTL(_SHIFTR(_DD4, 0, 16), 16, 16); - const u32 _DD8 = *CAST_DMEM(const u32*, 0xDD8); - const u8 RR = *(DMEM + (0x0FC ^ 3)); - const u8 HH = *(DMEM + (0x0FD ^ 3)); - - auto PrepareVertexDataStep4_7 = [&](u32 _addr, NabooVertexData & _vd) { - const u32 factor = 0xFFFE - _vd.M - _vd.N; - u32 U1 = *CAST_DMEM(const u32*, _addr); - _vd.color1.r = static_cast<u8>((factor * _SHIFTR(U1, 24, 8) + _vd.M * _SHIFTR(_E40, 24, 8) + _vd.N * _SHIFTR(_E48, 24, 8)) >> 16); - _vd.color1.g = static_cast<u8>((factor * _SHIFTR(U1, 16, 8) + _vd.M * _SHIFTR(_E40, 16, 8) + _vd.N * _SHIFTR(_E48, 16, 8)) >> 16); - _vd.color1.b = static_cast<u8>((factor * _SHIFTR(U1, 8, 8) + _vd.M * _SHIFTR(_E40, 8, 8) + _vd.N * _SHIFTR(_E48, 8, 8)) >> 16); - - // Step 5 - u32 U2 = *CAST_DMEM(const u32*, _addr + 0x78); - u8 u1 = ((U1 & 0xFF) + RR) & 0xFF; - u8 u2 = ((U2 & 0xFF) + HH) & 0xFF; - u32 u3 = u32(static_cast<s8>(*(DMEM + ((0x380 + u1) ^ 3)))); - u32 u4 = u32(static_cast<s8>(*(DMEM + ((0x380 + u2) ^ 3)))); - u32 L1 = _SHIFTL(_SHIFTR(_E28, 0, 16), 16, 16) | _SHIFTR(_E20, 0, 16); - u32 L2 = _SHIFTL(_SHIFTR(_DD8, 0, 16), 16, 16) | _SHIFTR(_DD0, 0, 16); - u16 u5 = (u3 * L1 + u4 * L2) >> 16; - u16 u6 = (u5 + _SHIFTR(_E20, 16, 16)) & 0xFFFF; - u16 u7 = ((0x7FFF - _vd.K) * u6 + _vd.K * _SHIFTR(_E28, 16, 16)) >> 16; - _vd.vtx.y = ((0x7FFF - _vd.J) * u7 + _vd.J * _SHIFTR(_E24, 0, 16)) >> 16; - - // Step 6 - u8 A1 = *(DMEM + ((0x4FF + u4)^3)); - u16 factor1 = 0xFF - A1; - u16 factor2 = 0xFF * A1; - u8 Va = (factor1 * _SHIFTR(U2, 24, 8) + factor2) >> 8; - u8 Vb = (factor1 * _SHIFTR(U2, 16, 8) + factor2) >> 8; - u8 Vc = (factor1 * _SHIFTR(U2, 8, 8) + factor2) >> 8; - - _vd.color2.r = static_cast<u8>((factor * Va + _vd.M * _SHIFTR(_E40, 24, 8) + _vd.N * _SHIFTR(_E48, 24, 8)) >> 16); - _vd.color2.g = static_cast<u8>((factor * Vb + _vd.M * _SHIFTR(_E40, 16, 8) + _vd.N * _SHIFTR(_E48, 16, 8)) >> 16); - _vd.color2.b = static_cast<u8>((factor * Vc + _vd.M * _SHIFTR(_E40, 8, 8) + _vd.N * _SHIFTR(_E48, 8, 8)) >> 16); - - // Step 7 - const u32 factor3 = 0x7FFF - _vd.K; - _vd.color2.r = (((factor3 * _vd.color2.r + _vd.K * _vd.color1.r) << 1) >> 16) + 1; - _vd.color2.g = (((factor3 * _vd.color2.g + _vd.K * _vd.color1.g) << 1) >> 16) + 1; - _vd.color2.b = (((factor3 * _vd.color2.b + _vd.K * _vd.color1.b) << 1) >> 16) + 1; - - _vd.color1.a = static_cast<u8>((_vd.K * _vd.K) >> 22); - _vd.color2.a = static_cast<u8>(((((0x7FFF - _vd.L) * A1 + _vd.L * 0xFF) << 1) >> 16) + 1); - - *CAST_DMEM(u32*, _addr + 0x0F0) = _vd.color1.color; - *CAST_DMEM(u32*, _addr + 0x168) = _vd.color2.color; - - }; - - for (u32 addrShift = startAddr; addrShift <= endAddr; addrShift += 4) { - - PrepareVertexDataStep3(vd1); - PrepareVertexDataStep3(vd2); - - // Step 4 - const u32 addr1 = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr), 16, 16) + addrShift; - const u32 addr2 = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr + 8), 16, 16) + addrShift; - PrepareVertexDataStep4_7(addr1, vd1); - PrepareVertexDataStep4_7(addr2, vd2); - - // Step 8 - *CAST_DMEM(SWVertex*, 0x170 + addrShift * 2) = vd1.vtx; - *CAST_DMEM(SWVertex*, 0x1C0 + addrShift * 2) = vd2.vtx; - - // Step 9 - const u32* V = CAST_DMEM(const u32*, 0xDC0); - vd1.vtx.x += _SHIFTR(V[0], 16, 16); - vd1.vtx.flag += _SHIFTR(V[1], 0, 16); - vd2.vtx.x += _SHIFTR(V[0], 16, 16); - vd2.vtx.flag += _SHIFTR(V[3], 0, 16); - - vd1.E += G; - vd2.E += G; - - G += _DD6; - } - - // Step 10 - const u16* v0_data = CAST_DMEM(const u16*, 0x128); - const u16 X0 = v0_data[0x0 ^ 1]; - const u16 Y0 = v0_data[0x1 ^ 1]; - const u16 Z0 = v0_data[0x2 ^ 1]; - const bool needAdjustVertices = (X0 | Y0 | Z0) != 0; - - auto processVertices = [&](u32 _param, u32 _dmemSrcAddr, u32 _dstOffset) { - const u32 numVtx = _param & 0x1F; - if (numVtx == 0) - return; - const u32 offset = _param >> 5; - const u32 vtxSrcAddr = _dmemSrcAddr + offset; - const u32 vtxDstAddr = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr + _dstOffset), 16, 16) + offset * 5; - DebugMsg(DEBUG_NORMAL, "GenVetices srcAddr = 0x%04x, dstAddr = 0x%04x, n = %i\n", vtxSrcAddr, vtxDstAddr, numVtx); - if (!needAdjustVertices) { - gSPSWVertex(CAST_DMEM(const SWVertex*, vtxSrcAddr), (vtxDstAddr - 0x600) / 40, numVtx); - return; - } - std::vector<SWVertex> vtxData(numVtx); - const SWVertex * pVtxSrc = CAST_DMEM(const SWVertex*, vtxSrcAddr); - for (size_t i = 0; i < numVtx; ++i) { - vtxData[i] = pVtxSrc[i]; - vtxData[i].x += X0; - vtxData[i].y += Y0; - vtxData[i].x += Z0; - } - gSPSWVertex(vtxData.data(), (vtxDstAddr - 0x600) / 40, numVtx); - }; - processVertices(_SHIFTR(params[2], 16, 16), 0x170, 0x10); - processVertices(_SHIFTR(params[2], 0, 16), 0x1C0, 0x18); - - // Step 11 - NabooData & data = getNabooData(); - u8* params8 = RDRAM + RSP.PC[RSP.PCi]; - u16* params16 = reinterpret_cast<u16*>(params8); - data.AA = params16[0x6 ^ 1]; - data.BB = params16[0x7 ^ 1]; - data.CC = params8[0x1 ^ 3]; - data.TT = params8[0x5 ^ 3]; - data.EE = dmemSrcAddr; - data.HH = _SHIFTR(*CAST_DMEM(const u32*, 0xDB8), 16, 16); - data.DD = 0; - F5Naboo_DrawPolygons(); -} - -static -void F5Naboo_GenVertices09() -{ - const u32* params = CAST_RDRAM(const u32*, RSP.PC[RSP.PCi]); - - // Step 1 - u32 dmemSrcAddr = (params[0] & 0xFFF); - u32 dmemDstAddr = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr), 16, 16); - u32 rdramAddr = _SHIFTR(params[4], 0, 24); - memcpy(DMEM + dmemDstAddr, RDRAM + rdramAddr, 40); - - u32 dmemSrcAddr2 = dmemSrcAddr + 8; - u32 dmemDstAddr2 = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr2), 16, 16); - u32 rdramAddrShift = _SHIFTR(*CAST_DMEM(const u32*, 0xDBC), 16, 16); - memcpy(DMEM + dmemDstAddr2, RDRAM + rdramAddr + rdramAddrShift, 40); - - const u32 flag = _SHIFTR(params[0], 12, 4); - if (flag > 7) { - u32 rdramAddr2 = _SHIFTR(params[5], 0, 24); - memcpy(DMEM + dmemDstAddr + 0x78, RDRAM + rdramAddr2, 40); - memcpy(DMEM + dmemDstAddr2 + 0x78, RDRAM + rdramAddr2 + rdramAddrShift, 40); - } - - // Step 2 - const u32 A = s8(_SHIFTR(params[1], 24, 8)) * 0x10000; - const u32 C32 = A - _SHIFTR(*CAST_DMEM(const u32*, 0xDD0), 16, 16); - const s64 C64 = s64(s32(C32)); - const u32 C2 = static_cast<u32>((C64 * C64) >> 16); - const u32 F = _SHIFTL(*CAST_DMEM(const u32*, 0xDCC), 16, 16); - u32 G = C32 * _SHIFTR(*CAST_DMEM(const u32*, 0xDC4), 0, 16) + F; - - auto PrepareVertexDataStep2 = [&](u32 _V, const u32* _p, NabooVertexData & _vd) { - _vd.vtx.x = _SHIFTL(_SHIFTR(_V, 24, 8), 8, 8); - _vd.vtx.z = _SHIFTL(_SHIFTR(_V, 8, 8), 8, 8); - _vd.vtx.flag = _SHIFTL(_SHIFTR(_V, 0, 8), 8, 8); - u32 B = s8(_SHIFTR(_V, 8, 8)) * 0x10000; - u32 D = B - _SHIFTR(_p[1], 16, 16); - s64 D64 = s64(s32(D)); - _vd.E = C2 + static_cast<u32>((D64 * D64) >> 16); - }; - - PrepareVertexDataStep2(params[1] + _SHIFTR(*CAST_DMEM(const u32*, 0xDC0), 16, 16), CAST_DMEM(const u32*, 0xDD0), vd1); - PrepareVertexDataStep2(params[1], CAST_DMEM(const u32*, 0xDD8), vd2); - - const u32 _E24 = *CAST_DMEM(const u32*, 0xE24); - const u32 _E2C = *CAST_DMEM(const u32*, 0xE2C); - const u32 I = (_E2C & 0xFFFF0000) | _SHIFTR(_E24, 16, 16); - - const u32 _DE0 = *CAST_DMEM(const u32*, 0xDE0); - const u32 _DE4 = *CAST_DMEM(const u32*, 0xDE4); - const u32 _DF0 = *CAST_DMEM(const u32*, 0xDF0); - const u32 _DF4 = *CAST_DMEM(const u32*, 0xDF4); - const s32 K = (s32((_DF0 & 0xFFFF0000) | _SHIFTR(_DE0, 16, 16))); - const s32 L = (s32(_SHIFTL(_SHIFTR(_DF0, 0, 16), 16, 16) | _SHIFTR(_DE0, 0, 16))); - const s32 M = (s32((_DF4 & 0xFFFF0000) | _SHIFTR(_DE4, 16, 16))); - const s32 N = (s32(_SHIFTL(_SHIFTR(_DF4, 0, 16), 16, 16) | _SHIFTR(_DE4, 0, 16))); - - const u32 _E00 = *CAST_DMEM(const u32*, 0xE00); - const u32 _E04 = *CAST_DMEM(const u32*, 0xE04); - const u32 _E10 = *CAST_DMEM(const u32*, 0xE10); - const u32 _E14 = *CAST_DMEM(const u32*, 0xE14); - const s32 O = (s32((_E10 & 0xFFFF0000) | _SHIFTR(_E00, 16, 16))); - const s32 P = (s32(_SHIFTL(_SHIFTR(_E10, 0, 16), 16, 16) | _SHIFTR(_E00, 0, 16))); - const s32 Q = (s32((_E14 & 0xFFFF0000) | _SHIFTR(_E04, 16, 16))); - const s32 R = (s32(_SHIFTL(_SHIFTR(_E14, 0, 16), 16, 16) | _SHIFTR(_E04, 0, 16))); - - const u32 _E34 = *CAST_DMEM(const u32*, 0xE34); - const u32 startAddr = _SHIFTR(params[4], 24, 8); - const u32 endAddr = _SHIFTR(params[5], 24, 8); - - // Step 3 - auto PrepareVertexDataStep3 = [&](NabooVertexData & _vd) { - s32 K1 = (K - _vd.E); - s32 K2 = multAndClip(K1, O, 0x7FFF); - s32 L1 = (L - _vd.E); - s32 L2 = multAndClip(L1, P, 0x7FFF); - s32 M1 = (M - _vd.E); - const s32 maxM = _SHIFTR(_E34, 16, 16); - s32 M2 = multAndClip(M1, Q, maxM); - s32 N1 = (N - _vd.E); - const u32 maxN = _SHIFTR(_E34, 0, 16); - s32 N2 = multAndClip(N1, R, maxN); - u64 J = (u64(_vd.E) * u64(I)) >> 16; - J *= J; - _vd.K = static_cast<u16>(K2); - _vd.L = static_cast<u16>(L2); - _vd.M = static_cast<u16>(M2); - _vd.N = static_cast<u16>(N2); - _vd.J = std::min(u16(0x7FFF), static_cast<u16>(J >> 47)); - }; - - const u32 _E40 = *CAST_DMEM(const u32*, 0xE40); - const u32 _E48 = *CAST_DMEM(const u32*, 0xE48); - - auto PrepareVertexDataStep4 = [&](u32 _addr, u32 _V, u32 _addrShift, NabooVertexData & _vd) { - auto sumBytes = [](u32 src1, u32 src2, u8* pDst) { - const u8* pSrc1 = DMEM + src1; - const u8* pSrc2 = DMEM + src2; - for (u32 i = 0; i < 4; ++i) - pDst[i] = (pSrc1[i] + pSrc2[i]) >> 1; - }; - const u32 addr3 = _SHIFTR(_V, 16, 16) + _addrShift + (_addrShift & 4); - const u32 addr4 = _SHIFTR(_V, 0, 16) + _addrShift - (_addrShift & 4); - const u32 factor1 = 0x7FFF - _vd.L; - const u32 factor2 = 0xFFFE - _vd.M - _vd.N; - u32 U = *CAST_DMEM(const u32*, _addr); - u32 T = 0; - sumBytes(addr3, addr4, reinterpret_cast<u8*>(&T)); - u64 Va = factor1 * _SHIFTR(U, 24, 8) + _vd.L * _SHIFTR(T, 24, 8); - Va *= factor2; - Va >>= 16; - u64 Vb = factor1 * _SHIFTR(U, 16, 8) + _vd.L * _SHIFTR(T, 16, 8); - Vb *= factor2; - Vb >>= 16; - u64 Vc = factor1 * _SHIFTR(U, 8, 8) + _vd.L * _SHIFTR(T, 8, 8); - Vc *= factor2; - Vc >>= 16; - u32 TA = ((*CAST_DMEM(const u32*, addr3) & 0xFF) << 7) + - ((*CAST_DMEM(const u32*, addr4) & 0xFF) << 7); - u32 Vy1 = (factor1 * (_SHIFTR(U, 0, 8) << 8)) >> 16; - u32 Vy2 = (_vd.L * TA) >> 16; - u32 Vy = Vy1 + Vy2; - _vd.color1.r = static_cast<u8>(((Va << 1) + _vd.M * _SHIFTR(_E40, 24, 8) + _vd.N * _SHIFTR(_E48, 24, 8)) >> 16); - _vd.color1.g = static_cast<u8>(((Vb << 1) + _vd.M * _SHIFTR(_E40, 16, 8) + _vd.N * _SHIFTR(_E48, 16, 8)) >> 16); - _vd.color1.b = static_cast<u8>(((Vc << 1) + _vd.M * _SHIFTR(_E40, 8, 8) + _vd.N * _SHIFTR(_E48, 8, 8)) >> 16); - const u16 Y1 = static_cast<u16>((Vy * (0x7FFF - _vd.J) + _vd.J * _SHIFTR(_E24, 0, 16)) >> 16); - - U = *CAST_DMEM(const u32*, _addr + 0x78); - sumBytes(addr3 + 0x78, addr4 + 0x78, reinterpret_cast<u8*>(&T)); - Va = factor1 * _SHIFTR(U, 24, 8) + _vd.L * _SHIFTR(T, 24, 8); - Va *= factor2; - Va >>= 16; - Vb = factor1 * _SHIFTR(U, 16, 8) + _vd.L * _SHIFTR(T, 16, 8); - Vb *= factor2; - Vb >>= 16; - Vc = factor1 * _SHIFTR(U, 8, 8) + _vd.L * _SHIFTR(T, 8, 8); - Vc *= factor2; - Vc >>= 16; - TA = ((*CAST_DMEM(const u32*, addr3 + 0x78) & 0xFF) << 7) + - ((*CAST_DMEM(const u32*, addr4 + 0x78) & 0xFF) << 7); - Vy1 = (factor1 * (_SHIFTR(U, 0, 8) << 8)) >> 16; - Vy2 = (_vd.L * TA) >> 16; - Vy = Vy1 + Vy2; - _vd.color2.r = static_cast<u8>(((Va << 1) + _vd.M * _SHIFTR(_E40, 24, 8) + _vd.N * _SHIFTR(_E48, 24, 8)) >> 16); - _vd.color2.g = static_cast<u8>(((Vb << 1) + _vd.M * _SHIFTR(_E40, 16, 8) + _vd.N * _SHIFTR(_E48, 16, 8)) >> 16); - _vd.color2.b = static_cast<u8>(((Vc << 1) + _vd.M * _SHIFTR(_E40, 8, 8) + _vd.N * _SHIFTR(_E48, 8, 8)) >> 16); - const u16 Y2 = static_cast<u16>((Vy * (0x7FFF - _vd.J) + _vd.J * _SHIFTR(_E24, 0, 16)) >> 16); - - // Step 5 - const u32 factor3 = 0x7FFF - _vd.K; - _vd.color2.r = (((factor3 * _vd.color2.r + _vd.K * _vd.color1.r) << 1) >> 16) + 1; - _vd.color2.g = (((factor3 * _vd.color2.g + _vd.K * _vd.color1.g) << 1) >> 16) + 1; - _vd.color2.b = (((factor3 * _vd.color2.b + _vd.K * _vd.color1.b) << 1) >> 16) + 1; - _vd.vtx.y = ((factor3 * Y2 + _vd.K * Y1) << 1) >> 16; - - // Step 7 - _vd.color1.a = _vd.color2.a = static_cast<u8>((_vd.K * _vd.K) >> 22); - *CAST_DMEM(u32*, _addr + 0x0F0) = _vd.color1.color; - *CAST_DMEM(u32*, _addr + 0x168) = _vd.color2.color; - }; - - for (u32 addrShift = startAddr; addrShift <= endAddr; addrShift += 4) { - - PrepareVertexDataStep3(vd1); - PrepareVertexDataStep3(vd2); - - // Step 4 - const u32 addr1 = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr), 16, 16) + addrShift; - const u32 addr2 = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr + 8), 16, 16) + addrShift; - //const u32 addrShift2 = addrShift + (addrShift & 4); - - PrepareVertexDataStep4(addr1, *CAST_DMEM(const u32*, dmemSrcAddr + 0x20), addrShift, vd1); - PrepareVertexDataStep4(addr2, *CAST_DMEM(const u32*, dmemSrcAddr + 0x24), addrShift, vd2); - - // Step 6 - *CAST_DMEM(SWVertex*, 0x170 + addrShift * 2) = vd1.vtx; - *CAST_DMEM(SWVertex*, 0x1C0 + addrShift * 2) = vd2.vtx; - - // Step 8 - const u32* V = CAST_DMEM(const u32*, 0xDC0); - vd1.vtx.x += _SHIFTR(V[0], 16, 16); - vd1.vtx.flag += _SHIFTR(V[1], 0, 16); - vd2.vtx.x += _SHIFTR(V[0], 16, 16); - vd2.vtx.flag += _SHIFTR(V[3], 0, 16); - - vd1.E += G; - vd2.E += G; - - const u32 _DD4 = *CAST_DMEM(const u32*, 0xDD4); - const u32 _DD6 = _SHIFTL(_SHIFTR(_DD4, 0, 16), 16, 16); - G += _DD6; - } - - // Step 9 - const u16* v0_data = CAST_DMEM(const u16*, 0x128); - const u16 X0 = v0_data[0x0 ^ 1]; - const u16 Y0 = v0_data[0x1 ^ 1]; - const u16 Z0 = v0_data[0x2 ^ 1]; - const bool needAdjustVertices = (X0 | Y0 | Z0) != 0; - - auto processVertices = [&](u32 _param, u32 _dmemSrcAddr, u32 _dstOffset) { - const u32 numVtx = _param & 0x1F; - if (numVtx == 0) - return; - const u32 offset = _param >> 5; - const u32 vtxSrcAddr = _dmemSrcAddr + offset; - const u32 vtxDstAddr = _SHIFTR(*CAST_DMEM(const u32*, dmemSrcAddr + _dstOffset), 16, 16) + offset * 5; - DebugMsg(DEBUG_NORMAL, "GenVetices srcAddr = 0x%04x, dstAddr = 0x%04x, n = %i\n", vtxSrcAddr, vtxDstAddr, numVtx); - if (!needAdjustVertices) { - gSPSWVertex(CAST_DMEM(const SWVertex*, vtxSrcAddr), (vtxDstAddr - 0x600) / 40, numVtx); - return; - } - std::vector<SWVertex> vtxData(numVtx); - const SWVertex * pVtxSrc = CAST_DMEM(const SWVertex*, vtxSrcAddr); - for (size_t i = 0; i < numVtx; ++i) { - vtxData[i] = pVtxSrc[i]; - vtxData[i].x += X0; - vtxData[i].y += Y0; - vtxData[i].x += Z0; - } - gSPSWVertex(vtxData.data(), (vtxDstAddr - 0x600) / 40, numVtx); - }; - processVertices(_SHIFTR(params[2], 16, 16), 0x170, 0x10); - processVertices(_SHIFTR(params[2], 0, 16), 0x1C0, 0x18); - - // Step 10 - NabooData & data = getNabooData(); - u8* params8 = RDRAM + RSP.PC[RSP.PCi]; - u16* params16 = reinterpret_cast<u16*>(params8); - data.AA = params16[0x6 ^ 1]; - data.BB = params16[0x7 ^ 1]; - data.CC = params8[0x1 ^ 3]; - data.TT = params8[0x5 ^ 3]; - data.EE = dmemSrcAddr; - data.HH = _SHIFTR(*CAST_DMEM(const u32*, 0xDB8), 16, 16); - data.DD = 0; - F5Naboo_DrawPolygons(); -} - -static -void F5NABOO_TexturedPolygons(u32, u32) -{ - F5Naboo_DrawPolygons(); -} - -static -void F5INDI_GeometryGen(u32 _w0, u32 _w1) -{ - const u32 mode = _SHIFTR(_w1, 0, 8); - DebugMsg(DEBUG_NORMAL, "F5INDI_GeometryGen (0x%08x, 0x%08x): mode=0x%02x\n", _w0, _w1, mode); - switch (mode) { - case 0x09: // Naboo - F5Naboo_GenVertices09(); - RSP.PC[RSP.PCi] += 16; - break; - case 0x0C: // Naboo - F5Naboo_GenVertices0C(); - RSP.PC[RSP.PCi] += 16; - break; - case 0x0F: // Naboo - if (*(DMEM + (0x37E ^ 3)) == 0) { - F5Naboo_CopyData00(); - RSP.PC[RSP.PCi] += 56; - } else { - F5Naboo_CopyDataFF(); - RSP.PC[RSP.PCi] += 8; - } - break; - case 0x15: // Naboo - F5Naboo_TexrectGen(); - RSP.PC[RSP.PCi] += 24; - break; - case 0x18: - F5INDI_GenVertices(_w0, _w1); - break; - case 0x24: - F5INDI_DoSubDList(); - F5INDI_TexrectGen(); - RSP.PC[RSP.PCi] += 32; - break; - case 0x27: - F5INDI_GenParticlesVertices(); - RSP.PC[RSP.PCi] += 16; - break; - case 0x4F: // Naboo - *(DMEM + (0x37E ^ 3)) = 0; - break; - } -} - -static -void F5INDI_Texrect(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_Texrect (0x%08x, 0x%08x)\n", _w0, _w1); - F5INDI_DoSubDList(); - RDP_TexRect(_w0, _w1); -} - -static -void F5INDI_JumpDL(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_JumpDL\n"); - RSP.PC[RSP.PCi] = RSP.F5DL[RSP.PCi]; - _updateF5DL(); -} - -static -void F5INDI_EndDisplayList(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_EndDisplayList\n"); - gSPEndDisplayList(); -} - -static -void F5INDI_MoveWord(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F5INDI_MoveWord (0x%08x, 0x%08x)\n", _w0, _w1); - const u32 destAddr = _SHIFTR(_w0, 0, 12); - *CAST_DMEM(u32*, destAddr) = _w1; - - switch (destAddr) { - case G_MWO_CLIP_RNX: - case G_MWO_CLIP_RNY: - case G_MWO_CLIP_RPX: - case G_MWO_CLIP_RPY: - gSPClipRatio(_w1); - break; - case G_MW_SEGMENT: - assert(false); - break; - case 0x158: - case 0x15C: - // Used to adjust colors (See command 0x01 - Case 02) - break; - case 0x160: - gSP.fog.multiplierf = _FIXED2FLOAT((s32)_w1, 16); - gSP.changed |= CHANGED_FOGPOSITION; - break; - case 0x164: - gSP.fog.offsetf = _FIXED2FLOAT((s32)_w1, 16); - gSP.changed |= CHANGED_FOGPOSITION; - break; - case 0x14C: - gSPPerspNormalize(_w1); - break; - case 0x58C: - // sub dlist address; - break; - case 0x5B0: - case 0x5B4: - // Used to adjust colors (See command 0x01 - Case 02) - break; - } -} - -static -void F5INDI_SetOtherMode(u32 w0, u32 w1) -{ - //u32 mask = (s32)0x80000000 >> _SHIFTR(w0, 0, 5); // unspecified behaviour - u32 mask = static_cast<u32>(s32(0x80000000) / (1 << _SHIFTR(w0, 0, 5))); - mask >>= _SHIFTR(w0, 8, 5); - - const u32 A0 = _SHIFTR(w0, 16, 3); - if (A0 == 0) { - gDP.otherMode.h = (gDP.otherMode.h&(~mask)) | w1; - if (mask & 0x00300000) // cycle type - gDP.changed |= CHANGED_CYCLETYPE; - } else if (A0 == 4) { - gDP.otherMode.l = (gDP.otherMode.l&(~mask)) | w1; - - if (mask & 0x00000003) // alpha compare - gDP.changed |= CHANGED_ALPHACOMPARE; - - if (mask & 0xFFFFFFF8) // rendermode / blender bits - gDP.changed |= CHANGED_RENDERMODE; - } -} - -static -void F5INDI_SetOtherMode_Conditional(u32 w0, u32 w1) -{ - if (_SHIFTR(w0, 23, 1) != *CAST_DMEM(const u32*, 0x11C)) - return; - - F5INDI_SetOtherMode(w0, w1); -} - -static -void F5INDI_ClearGeometryMode(u32 w0, u32 w1) -{ - gSPClearGeometryMode(~w1); -} - -static -void F5INDI_Texture(u32 w0, u32 w1) -{ - F3D_Texture(w0, w1); - *CAST_DMEM(u32*, 0x148) = w0; - const u32 V0 = (gSP.geometryMode ^ w0) & 2; - gSP.geometryMode ^= V0; -} - -void F5Indi_Naboo_Init() -{ - srand((unsigned int)time(NULL)); - - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags(F3D); - G_SHADING_SMOOTH = G_SHADE; - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI(G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp); - GBI_SetGBI(G_MOVEMEM, F5INDI_MOVEMEM, F5INDI_MoveMem); - GBI_SetGBI(G_SET_DLIST_ADDR, F5INDI_SET_DLIST_ADDR, F5INDI_SetDListAddr); - GBI_SetGBI(G_RESERVED1, F5INDI_GEOMETRY_GEN, F5INDI_GeometryGen); - GBI_SetGBI(G_DL, F5INDI_DL, F5INDI_DList); - GBI_SetGBI(G_RESERVED2, F5INDI_BRANCHDL, F5INDI_BranchDList); - GBI_SetGBI(G_TRI2, F5INDI_TRI2, F5INDI_Tri); - GBI_SetGBI(G_JUMPDL, F5INDI_JUMPDL, F5INDI_JumpDL); - GBI_SetGBI(G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode); - GBI_SetGBI(G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F5INDI_ClearGeometryMode); - GBI_SetGBI(G_ENDDL, F5INDI_ENDDL, F5INDI_EndDisplayList); - GBI_SetGBI(G_SETOTHERMODE_L, F5INDI_SETOTHERMODE_C, F5INDI_SetOtherMode_Conditional); - GBI_SetGBI(G_SETOTHERMODE_H, F5INDI_SETOTHERMODE, F5INDI_SetOtherMode); - GBI_SetGBI(G_TEXTURE, F3D_TEXTURE, F5INDI_Texture ); - GBI_SetGBI(G_MOVEWORD, F5INDI_MOVEWORD, F5INDI_MoveWord); - GBI_SetGBI(G_BE, F5NABOO_BE, F5NABOO_TexturedPolygons); - GBI_SetGBI(G_TRI1, F5INDI_TRI1, F5INDI_Tri); - GBI_SetGBI(G_INDI_TEXRECT, F5INDI_TEXRECT, F5INDI_Texrect); -} diff --git a/GLideN64/src/uCodes/F5Indi_Naboo.h b/GLideN64/src/uCodes/F5Indi_Naboo.h deleted file mode 100644 index 7c2eec1..0000000 --- a/GLideN64/src/uCodes/F5Indi_Naboo.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef F5INDI_NABOO_H -#define F5INDI_NABOO_H - -void F5Indi_Naboo_Init(); - -#endif diff --git a/GLideN64/src/uCodes/F5Rogue.cpp b/GLideN64/src/uCodes/F5Rogue.cpp deleted file mode 100644 index 3648c05..0000000 --- a/GLideN64/src/uCodes/F5Rogue.cpp +++ /dev/null @@ -1,1295 +0,0 @@ -/* Star Wars Rogue Squadron ucode - * Initial implementation ported from Lemmy's LemNemu plugin - * Microcode decoding: olivieryuyu - */ - -#include <assert.h> -#include <array> -#include <algorithm> -#include <cmath> -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F5Rogue.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" -#include "FrameBuffer.h" -#include "DisplayWindow.h" - -#define F3DSWRS_VTXCOLOR 0x02 -#define F3DSWRS_MOVEMEM 0x03 -#define F3DSWRS_VTX 0x04 -#define F3DSWRS_TRI_GEN 0x05 -#define F3DSWRS_DL 0x06 -#define F3DSWRS_BRANCHDL 0x07 - -#define F3DSWRS_SETOTHERMODE_L_EX 0xB3 -#define F3DSWRS_TRI2 0xB4 -#define F3DSWRS_JUMPSWDL 0xB5 -#define F3DSWRS_ENDDL 0xB8 -#define F3DSWRS_MOVEWORD 0xBC -#define F3DSWRS_TEXRECT_GEN 0xBD -#define F3DSWRS_SETOTHERMODE_H_EX 0xBE -#define F3DSWRS_TRI1 0xBF - -#define F3DSWRS_MV_TEXSCALE 0x82 -#define F3DSWRS_MW_FOG_MULTIPLIER 0x08 -#define F3DSWRS_MW_FOG_OFFSET 0x0A - -static u32 G_SETOTHERMODE_H_EX, G_SETOTHERMODE_L_EX, G_JUMPSWDL; -static u32 F3DSWRS_ViewportAddress; -static u32 F3DSWRS_PerspMatrixAddress; - -struct SWRSTriangle -{ - u32 V0, V1, V2; - int avrgZ; - -}; - -bool SWRSTriangleCompare(const SWRSTriangle & _first, const SWRSTriangle & _second) -{ - return _first.avrgZ > _second.avrgZ; -} - -static -SWRSTriangle TriGen0000_defaultTriangleOrder[32] = { - // D1 D1 D2 D2 D3 D6 D3 D6 D4 D4 - // D7 D6 D8 D7 D9 D12 D8 D11 D10 D9 - // D2 D7 D3 D8 D4 D7 D9 D12 D5 D10 - { 0, 6, 1, 0 }, - { 0, 5, 6, 0 }, - { 1, 7, 2, 0 }, - { 1, 6, 7, 0 }, - { 2, 8, 3, 0 }, - { 5, 11, 6, 0 }, - { 2, 7, 8, 0 }, - { 5, 10, 11, 0 }, - { 3, 9, 4, 0 }, - { 3, 8, 9, 0 }, - - // D7 D7 D11 D8 D11 D8 D9 D12 D9 D12 - // D13 D12 D17 D14 D16 D13 D15 D18 D14 D17 - // D8 D13 D12 D9 D17 D14 D10 D13 D15 D18 - { 6, 12, 7, 0 }, - { 6, 11, 12, 0 }, - { 10, 16, 11, 0 }, - { 7, 13, 8, 0 }, - { 10, 15, 16, 0 }, - { 7, 12, 13, 0 }, - { 8, 14, 9, 0 }, - { 11, 17, 12, 0 }, - { 8, 13, 14, 0 }, - { 11, 16, 17, 0 }, - - // D16 D13 D16 D13 D14 D17 D17 D14 D18 D18 - // D22 D19 D21 D18 D20 D23 D22 D19 D24 D23 - // D17 D14 D22 D19 D15 D18 D23 D20 D19 D24 - { 15, 21, 16, 0 }, - { 12, 18, 13, 0 }, - { 15, 20, 21, 0 }, - { 12, 17, 18, 0 }, - { 13, 19, 14, 0 }, - { 16, 22, 17, 0 }, - { 16, 21, 22, 0 }, - { 13, 18, 19, 0 }, - { 17, 23, 18, 0 }, - { 17, 22, 23, 0 }, - - // D19 D19 - // D25 D24 - // D20 D25 - { 18, 24, 19, 0 }, - { 18, 23, 24, 0 } -}; - -static -SWRSTriangle TriGen0001_defaultTriangleOrder[8] = { - // D1 D1 D2 D2 D4 D4 D5 D5 - // D4 D5 D5 D6 D7 D8 D8 D9 - // D5 D2 D6 D3 D8 D5 D9 D6 - { 0, 3, 4, 0 }, - { 0, 4, 1, 0 }, - { 1, 4, 5, 0 }, - { 1, 5, 2, 0 }, - { 3, 6, 7, 0 }, - { 3, 7, 4, 0 }, - { 4, 7, 8, 0 }, - { 4, 8, 5, 0 } -}; - -inline -void _updateF5DL() -{ - // Lemmy's note: - // differs from the other DL commands because it does skip the first command - // the first 32 bits are stored, because they are - // used as branch target address in the command in the QUAD "slot" - RSP.F5DL[RSP.PCi] = _SHIFTR(*(u32*)&RDRAM[RSP.PC[RSP.PCi]], 0, 24); -} - -void F3DSWRS_Mtx(u32 w0, u32 w1) -{ - const u32 param = _SHIFTR(w0, 16, 8); - if ((param & G_MTX_PROJECTION) != 0) - F3DSWRS_PerspMatrixAddress = _SHIFTR(w1, 0, 24); - F3D_Mtx(w0, w1); -} - -void F3DSWRS_VertexColor(u32, u32 _w1) -{ - gSPSetVertexColorBase(_w1); -} - -void F3DSWRS_MoveMem(u32 _w0, u32) -{ - switch (_SHIFTR(_w0, 16, 8)) { - case F3D_MV_VIEWPORT://G_MV_VIEWPORT: - F3DSWRS_ViewportAddress = _SHIFTR((RSP.PC[RSP.PCi] + 8), 0, 24); - gSPViewport(F3DSWRS_ViewportAddress); - break; - case F3DSWRS_MV_TEXSCALE: - gSP.textureCoordScale[0] = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 16]; - gSP.textureCoordScale[1] = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 12]; - DebugMsg(DEBUG_NORMAL, "F3DSWRS_MoveMem Texscale(0x%08x, 0x%08x)\n", - gSP.textureCoordScale[0], gSP.textureCoordScale[1]); - break; - } - RSP.PC[RSP.PCi] += 16; -} - -void F3DSWRS_Vtx(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_Vtx (0x%08x, 0x%08x)\n", _w0, _w1); - - const u32 address = RSP_SegmentToPhysical(_w1); - const u32 n = _SHIFTR(_w0, 10, 6); - - if ((address + sizeof(SWVertex)* n) > RDRAMSize) - return; - - const SWVertex * vertex = (const SWVertex*)&RDRAM[address]; - gSPSWVertex(vertex, n, nullptr ); -} - -static -void F3DSWRS_PrepareVertices(const u32* _vert, - const u8* _colorbase, - const u32* _colorIdx, - const u8* _texbase, - bool _useTex, - bool _persp, - u32 _num) -{ - const u32 sscale = _SHIFTR(gSP.textureCoordScale[0], 16, 16); - const u32 tscale = _SHIFTR(gSP.textureCoordScale[0], 0, 16); - const u32 sscale1 = _SHIFTR(gSP.textureCoordScale[1], 16, 16); - const u32 tscale1 = _SHIFTR(gSP.textureCoordScale[1], 0, 16); - - GraphicsDrawer & drawer = dwnd().getDrawer(); - - for (u32 i = 0; i < _num; ++i) { - SPVertex & vtx = drawer.getVertex(_vert != nullptr ? _vert[i] : i); - const u8 *color = _colorbase + _colorIdx[i]; - vtx.r = _FIXED2FLOATCOLOR(color[3], 8 ); - vtx.g = _FIXED2FLOATCOLOR(color[2], 8 ); - vtx.b = _FIXED2FLOATCOLOR(color[1], 8 ); - vtx.a = _FIXED2FLOATCOLOR(color[0], 8 ); - - if (_useTex) { - const u32 st = *(u32*)&_texbase[4 * i]; - u32 s = (s16)_SHIFTR(st, 16, 16); - u32 t = (s16)_SHIFTR(st, 0, 16); - if ((s & 0x8000) != 0) - s |= ~0xffff; - if ((t & 0x8000) != 0) - t |= ~0xffff; - const u32 VMUDN_S = s * sscale; - const u32 VMUDN_T = t * tscale; - const s16 low_acum_S = _SHIFTR(VMUDN_S, 16, 16); - const s16 low_acum_T = _SHIFTR(VMUDN_T, 16, 16); - const u32 VMADH_S = s * sscale1; - const u32 VMADH_T = t * tscale1; - const s16 hi_acum_S = _SHIFTR(VMADH_S, 0, 16); - const s16 hi_acum_T = _SHIFTR(VMADH_T, 0, 16); - const s16 scaledS = low_acum_S + hi_acum_S; - const s16 scaledT = low_acum_T + hi_acum_T; - - if (_persp) { - vtx.s = _FIXED2FLOAT(scaledS, 5); - vtx.t = _FIXED2FLOAT(scaledT, 5); - } else { - vtx.s = _FIXED2FLOAT(scaledS, 4); - vtx.t = _FIXED2FLOAT(scaledT, 4); - } - } - } -} - -static -void TriGen0000_PrepareColorData(const u32 * _params, std::vector<u32> & _data) -{ - assert((_params[3] & 0x07) % 4 == 0); - const u32* data32 = (const u32*)&RDRAM[_SHIFTR(_params[3], 0, 24)]; - std::copy_n(data32, 25, _data.begin()); -} - -static -void TriGen0001_PrepareColorData(const u32 * _params, std::vector<u32> & _data) -{ - assert((_params[3] & 0x07) % 4 == 0); - const u32 dataSize = (((_SHIFTR(_params[4], 0, 16) + 0x13) & 0xFF0) - (_params[3] & 0x07)) / 4; - const u32 dataAddr = (_SHIFTR(_params[3], 0, 24) & 0x00FFFFF8) +(_params[3] & 0x07); - const u32* data32 = (const u32*)&RDRAM[dataAddr]; - - u32 idx32 = 0; - do { - _data.push_back(data32[idx32++]); - idx32++; - _data.push_back(data32[idx32++]); - idx32++; - _data.push_back(data32[idx32]); - idx32 += 6; - } while(dataSize > idx32); - - const size_t colorDataSize = _data.size(); -} - -static -void TriGen0000_PrepareVtxData(const u32 * _params, std::vector<u16> & _data) -{ - const u32 dataAddr = _SHIFTR(_params[2], 0, 24) & 0x00FFFFF8; - const s8* rdram_data8 = (const s8*)(RDRAM + dataAddr); - - u32 idx8 = _params[2] & 0x07; - u32 dataIdx = 0; - - for (u32 i = 0; i < 25; ++i) { - const s8 val = rdram_data8[idx8^3]; - ++idx8; - u16 res = _SHIFTL(val, 4, 8) | (val < 0 ? 0xF000 : 0); - _data[dataIdx^1] = res; - ++dataIdx; - } -} - -static -void TriGen0001_PrepareVtxData(const u32 * _params, std::vector<u16> & _data) -{ - const u32 dataSize = (_SHIFTR(_params[4], 16, 16) + 0x16) & 0xFF0; - _data.resize(dataSize / 2); - const u32 dataAddr = _SHIFTR(_params[2], 0, 24) & 0x00FFFFF8; - - const s8* rdram_data8 = (const s8*)(RDRAM + dataAddr); - - u32 idx8 = _params[2] & 0x07; - u32 dataIdx = 0; - - do { - for (u32 i = 0; i < 3; ++i) { - const s8 val = rdram_data8[idx8^3]; - idx8 += 2; - u16 res = _SHIFTL(val, 4, 8) | (val < 0 ? 0xF000 : 0); - _data[dataIdx^1] = res; - ++dataIdx; - } - idx8 += 4; - } while(dataSize > idx8); -} - -inline -void TriGen00_correctVertexForOption(std::vector<u16> & _vtxData, u32 _src1, u32 _src2, u32 _dst) -{ - const s16 vd = (s16)_vtxData[_src1] + (s16)_vtxData[_src2]; - _vtxData[_dst] = (u16)(vd / 2); -} - -inline -void TriGen00_correctColorForOption(u32* _pColor, u32 _src1, u32 _src2, u32 _dst) -{ - u8* pSrc1 = (u8*)(_pColor + _src1); - u8* pSrc2 = (u8*)(_pColor + _src2); - u8* pDst = (u8*)(_pColor + _dst); - for (u32 i = 0; i < 4; ++i) { - const u16 c = pSrc1[i] + pSrc2[i]; - pDst[i] = _SHIFTR(c, 1, 8); - } -} - -inline -void TriGen00_correctVertexForPonderation(std::vector<u16> & _vtxData, u32 _src1, u32 _src2, u32 _dst, u16 ponderation) -{ - const s16 * vtxData = (const s16*)_vtxData.data(); - s32 vd = vtxData[_dst] * (0x10000 - ponderation); - vd += ((vtxData[_src1] + vtxData[_src2]) * ponderation) >> 1; - _vtxData[_dst] = _SHIFTR(vd, 16, 16); -} - -inline -void TriGen00_correctColorForPonderation(u32* _pColor, u32 _src1, u32 _src2, u32 _dst, u16 ponderation) -{ - u8* pSrc1 = (u8*)(_pColor + _src1); - u8* pSrc2 = (u8*)(_pColor + _src2); - u8* pDst = (u8*)(_pColor + _dst); - for (u32 i = 0; i < 4; ++i) { - const u32 c = pDst[i] * (0x10000 - ponderation) + (((pSrc1[i] + pSrc2[i]) * ponderation) >> 1); - pDst[i] = _SHIFTR(c, 16, 8); - } -} - -static -void TriGen0000_option_00000100(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData, std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF00) != 0x0100) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 1, 3, 0); - TriGen00_correctVertexForOption(_vtxData, 3, 5, 2); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 0, 2, 1); - TriGen00_correctColorForOption(_colorData.data(), 2, 4, 3); - - // Additional triangle - SWRSTriangle t1 = { 0, 10, 5, 0 }; - _triangles.push_back(t1); - SWRSTriangle t2 = { 10, 20, 15, 0 }; - _triangles.push_back(t2); -} - -static -void TriGen0000_ponderation1(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation1 = _SHIFTR(_params[6], 0, 16); - if (ponderation1 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 1, 3, 0, ponderation1); - TriGen00_correctVertexForPonderation(_vtxData, 3, 5, 2, ponderation1); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 0, 2, 1, ponderation1); - TriGen00_correctColorForPonderation(_colorData.data(), 2, 4, 3, ponderation1); -} - -static -void TriGen0000_option_00000001(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData, std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF) != 0x01) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 21, 23, 20); - TriGen00_correctVertexForOption(_vtxData, 23, 25, 22); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 20, 22, 21); - TriGen00_correctColorForOption(_colorData.data(), 22, 24, 23); - - // Additional triangle - SWRSTriangle t1 = { 4, 9, 14, 0 }; - _triangles.push_back(t1); - SWRSTriangle t2 = { 14, 19, 24, 0 }; - _triangles.push_back(t2); -} - -static -void TriGen0000_ponderation2(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation2 = _SHIFTR(_params[7], 16, 16); - if (ponderation2 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 21, 23, 20, ponderation2); - TriGen00_correctVertexForPonderation(_vtxData, 23, 25, 22, ponderation2); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 20, 22, 21, ponderation2); - TriGen00_correctColorForPonderation(_colorData.data(), 22, 24, 23, ponderation2); -} - -static -void TriGen0000_option_01000000(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData, std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF000000) != 0x01000000) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 1, 11, 4); - TriGen00_correctVertexForOption(_vtxData, 11, 21, 14); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 0, 10, 5); - TriGen00_correctColorForOption(_colorData.data(), 10, 20, 15); - - // Additional triangle - SWRSTriangle t1 = { 0, 1, 2, 0 }; - _triangles.push_back(t1); - SWRSTriangle t2 = { 2, 3, 4, 0 }; - _triangles.push_back(t2); -} - -static -void TriGen0000_ponderation3(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation3 = _SHIFTR(_params[5], 0, 16); - if (ponderation3 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 1, 11, 4, ponderation3); - TriGen00_correctVertexForPonderation(_vtxData, 11, 21, 14, ponderation3); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 0, 10, 5, ponderation3); - TriGen00_correctColorForPonderation(_colorData.data(), 10, 20, 15, ponderation3); -} - -static -void TriGen0000_option_00010000(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData, std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF0000) != 0x010000) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 5, 15, 8); - TriGen00_correctVertexForOption(_vtxData, 15, 25, 18); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 4, 14, 9); - TriGen00_correctColorForOption(_colorData.data(), 14, 24, 19); - - // Additional triangle - SWRSTriangle t1 = { 22, 24, 23, 0 }; - _triangles.push_back(t1); - SWRSTriangle t2 = { 20, 22, 21, 0 }; - _triangles.push_back(t2); -} - -static -void TriGen0000_ponderation4(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation4 = _SHIFTR(_params[6], 16, 16); - if (ponderation4 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 5, 15, 8, ponderation4); - TriGen00_correctVertexForPonderation(_vtxData, 15, 25, 18, ponderation4); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 4, 14, 9, ponderation4); - TriGen00_correctColorForPonderation(_colorData.data(), 14, 24, 19, ponderation4); -} - -static -void TriGen0000_ponderation5(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation5 = _SHIFTR(_params[5], 16, 16); - if (ponderation5 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 1, 13, 7, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 3, 13, 6, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 3, 15, 9, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 11, 13, 10, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 13, 15, 12, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 11, 23, 17, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 13, 23, 16, ponderation5); - TriGen00_correctVertexForPonderation(_vtxData, 13, 25, 19, ponderation5); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 0, 12, 6, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 2, 12, 7, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 2, 14, 8, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 10, 12, 11, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 12, 14, 13, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 10, 22, 16, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 12, 22, 17, ponderation5); - TriGen00_correctColorForPonderation(_colorData.data(), 12, 24, 18, ponderation5); -} - -static -void TriGen0001_option_01010201(const u32 * _params, - std::vector<u16> & _vtxData, - std::vector<u32> & _colorData, - std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF00) != 0x0200) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 1, 3, 0); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 0, 2, 1); - - // Additional triangle - SWRSTriangle t = { 0, 6, 3, 0 }; - _triangles.push_back(t); -} - -static -void TriGen0001_ponderation1(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation1 = _SHIFTR(_params[6], 0, 16); - if (ponderation1 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 1, 3, 0, ponderation1); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 0, 2, 1, ponderation1); -} - -static -void TriGen0001_option_01010102(const u32 * _params, - std::vector<u16> & _vtxData, - std::vector<u32> & _colorData, - std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF) != 0x02) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 7, 9, 8); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 6, 8, 7); - - // Additional triangle - SWRSTriangle t = { 2, 5, 8, 0 }; - _triangles.push_back(t); -} - -static -void TriGen0001_ponderation2(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation2 = _SHIFTR(_params[7], 16, 16); - if (ponderation2 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 7, 9, 6, ponderation2); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 6, 8, 7, ponderation2); -} - -static -void TriGen0001_option_02010101(const u32 * _params, - std::vector<u16> & _vtxData, - std::vector<u32> & _colorData, - std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0xFF000000) != 0x02000000) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 1, 7, 2); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 0, 6, 3); - - // Additional triangle - SWRSTriangle t = { 0, 1, 2, 0 }; - _triangles.push_back(t); -} - -static -void TriGen0001_ponderation3(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation3 = _SHIFTR(_params[5], 0, 16); - if (ponderation3 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 1, 7, 2, ponderation3); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 0, 6, 3, ponderation3); -} - -static -void TriGen0001_option_01020101(const u32 * _params, - std::vector<u16> & _vtxData, - std::vector<u32> & _colorData, - std::vector<SWRSTriangle> & _triangles) -{ - if ((_params[1] & 0x00FF0000) != 0x00020000) - return; - - // Correct vertex data - TriGen00_correctVertexForOption(_vtxData, 3, 9, 4); - - // Correct color data - TriGen00_correctColorForOption(_colorData.data(), 2, 8, 5); - - // Additional triangle - SWRSTriangle t = { 6, 8, 7, 0 }; - _triangles.push_back(t); -} - -static -void TriGen0001_ponderation4(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation4 = _SHIFTR(_params[6], 16, 16); - if (ponderation4 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 3, 9, 4, ponderation4); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 2, 8, 5, ponderation4); -} - -static -void TriGen0001_ponderation5(const u32 * _params, std::vector<u16> & _vtxData, std::vector<u32> & _colorData) -{ - const u16 ponderation5 = _SHIFTR(_params[5], 16, 16); - if (ponderation5 == 0) - return; - - // Correct vertex data - TriGen00_correctVertexForPonderation(_vtxData, 1, 9, 5, ponderation5); - - // Correct color data - TriGen00_correctColorForPonderation(_colorData.data(), 0, 8, 4, ponderation5); -} - -struct Vector2 { - union { - u16 vec16[4]; - u32 vec32[2]; - u64 qw; - } data; - - Vector2() { - data.qw = 0; - } - - Vector2 ADD(const Vector2 & _v) const { - Vector2 res; - for (u32 i = 0; i < 4; ++i) - res.data.vec16[i] = data.vec16[i] + _v.data.vec16[i]; - return res; - } - - void VAL(u32 _idx, u16 _val) { - data.vec16[_idx] = _val; - } -}; - -static -void TriGen02_BuildVtxData(const u32 * _params, u32 * _output) -{ - Vector2 v0, v1, v2, v3; - u16 V0 = _SHIFTR(_params[9], 0, 16); - u16 V1 = _SHIFTR(_params[8], 0, 16); - V1 <<= 4; - v0.VAL(1, _SHIFTR(_params[8], 16, 16)); - v0.VAL(0, V1); - v0.VAL(3, _SHIFTR(_params[9], 16, 16)); - v2.VAL(1, V0); - v3.VAL(3, V0); - v1.VAL(0, _SHIFTR(_params[1], 16, 16)); - v1 = v1.ADD(v0); - _output[0] = v1.data.vec32[0]; - _output[1] = v1.data.vec32[1]; - v1 = v2; - v1.VAL(0, _SHIFTR(_params[1], 0, 16)); - v1 = v1.ADD(v0); - _output[2] = v1.data.vec32[0]; - _output[3] = v1.data.vec32[1]; - v1 = v3; - v1.VAL(0, _SHIFTR(_params[2], 16, 16)); - v1 = v1.ADD(v0); - _output[4] = v1.data.vec32[0]; - _output[5] = v1.data.vec32[1]; - v1 = v2.ADD(v3); - v1.VAL(0, _SHIFTR(_params[2], 0, 16)); - v1 = v1.ADD(v0); - _output[6] = v1.data.vec32[0]; - _output[7] = v1.data.vec32[1]; -} - -static -void TriGen00_BuildVtxData(const u32 * _params, u32 _step, const std::vector<u16> & _input, std::vector<u32> & _output) -{ - u16 V0 = _SHIFTR(_params[9], 0, 16); - u16 V1 = _SHIFTR(_params[8], 0, 16); - V1 <<= 4; - Vector2 v0; - v0.VAL(1, _SHIFTR(_params[8], 16, 16)); - v0.VAL(3, _SHIFTR(_params[9], 16, 16)); - v0.VAL(0, V1); - Vector2 v2; - v2.VAL(1, V0); - Vector2 v3; - v3.VAL(3, V0); - Vector2 v1; - - const u32 bound = _step * (_step - 1) + 1; - for (u32 startDataIdx = 0; startDataIdx < _step; ++startDataIdx) { - for (u32 idx = 0; idx < bound; idx += _step) { - v1.VAL(0, _input[(startDataIdx + idx) ^ 1]); - Vector2 v4 = v1.ADD(v0); - _output.push_back(v4.data.vec32[0]); - _output.push_back(v4.data.vec32[1]); - v1 = v1.ADD(v3); - } - v1 = v1.ADD(v2); - v1.VAL(3, 0); - } -} - -static -void TriGen00_BuildColorIndices(u32 _step, u32 _vtxSize, std::vector<u32> & _colorIndices) -{ - u32 startColorIdx = 0; - u32 colorIdx = 0; - for (u32 i = 0; i < _vtxSize; i += _step) { - for (u32 j = 0; j < _step; ++j) { - _colorIndices[colorIdx++] = (startColorIdx + j * _step) << 2; - } - startColorIdx++; - } -} - -static -void TriGen00_BuildTextureCoords(u32 _step, const u32 * _params, std::vector<u32> & _texCoords) -{ - const u16 tex = _SHIFTR(_params[7], 0, 16); - union { - u16 w[2]; - u32 dw; - } texCoord; - u32 texIdx = 0; - for (u32 i = 0; i < _step; ++i) { - texCoord.w[0] = tex * (_step - 1); - texCoord.w[1] = tex * i; - for (u32 j = 0; j < _step; ++j) { - _texCoords[texIdx++] = texCoord.dw; - texCoord.dw -= tex; - } - } -} - -inline -int screenZ(const SPVertex & _v) -{ - return int(((_v.z / _v.w) * gSP.viewport.vscale[2] + gSP.viewport.vtrans[2])*32768.0f); -} - -static -int calcAvrgZ(GraphicsDrawer & drawer, const SWRSTriangle & t) -{ - int zsum = screenZ(drawer.getVertex(t.V0)); - zsum += screenZ(drawer.getVertex(t.V1)); - zsum += screenZ(drawer.getVertex(t.V2)); - return zsum / 3; -} - -static -void TriGen0000() -{ - const u32* params = (const u32*)&RDRAM[RSP.PC[RSP.PCi]]; - - // Step 1. Load data from RDRAM - - std::vector<u32> colorData(25); - TriGen0000_PrepareColorData(params, colorData); - - std::vector<u16> vtxData16(26, 0); - TriGen0000_PrepareVtxData(params, vtxData16); - - std::vector<SWRSTriangle> triangles; - - // Step 1.1 Options - - TriGen0000_option_00000100(params, vtxData16, colorData, triangles); - TriGen0000_ponderation1(params, vtxData16, colorData); - TriGen0000_option_00000001(params, vtxData16, colorData, triangles); - TriGen0000_ponderation2(params, vtxData16, colorData); - TriGen0000_option_01000000(params, vtxData16, colorData, triangles); - TriGen0000_ponderation3(params, vtxData16, colorData); - TriGen0000_option_00010000(params, vtxData16, colorData, triangles); - TriGen0000_ponderation4(params, vtxData16, colorData); - TriGen0000_ponderation5(params, vtxData16, colorData); - - // Step 2. Build vertex data from bytes obtained on Step 1. - - std::vector<u32> vtxData32; - TriGen00_BuildVtxData(params, 5, vtxData16, vtxData32); - - // Step 3. Process vertices - const SWVertex * vertex = (const SWVertex*)vtxData32.data(); - const u32 vtxSize = static_cast<u32>(vtxData32.size()) / 2; - gSPSWVertex(vertex, vtxSize, nullptr); - - // Step 4. Prepare color indices and texture coordinates. Prepare vertices for rendering - - std::vector<u32> colorIndices(vtxSize); - TriGen00_BuildColorIndices(5, vtxSize, colorIndices); - - std::vector<u32> texCoords(vtxSize); - TriGen00_BuildTextureCoords(5, params, texCoords); - - F3DSWRS_PrepareVertices(nullptr, (u8*)colorData.data(), - colorIndices.data(), (u8*)texCoords.data(), true, false, vtxSize); - - // Step 5. Prepare triangles, sort them by z and draw. - - GraphicsDrawer & drawer = dwnd().getDrawer(); - - for (auto& t : triangles) { - t.avrgZ = calcAvrgZ(drawer, t); - } - for (u32 i = 0; i < 32; ++i) { - const SWRSTriangle & t = TriGen0000_defaultTriangleOrder[i]; - triangles.push_back(t); - triangles.back().avrgZ = calcAvrgZ(drawer, t); - } - std::stable_sort(triangles.begin(), triangles.end(), SWRSTriangleCompare); - - for (const auto& t : triangles) { - gSP1Triangle(t.V0, t.V1, t.V2); - } - drawer.drawTriangles(); -} - -static -void TriGen0001() -{ - const u32* params = (const u32*)&RDRAM[RSP.PC[RSP.PCi]]; - - // Step 1. Load data from RDRAM - - std::vector<u32> colorData; - TriGen0001_PrepareColorData(params, colorData); - - std::vector<u16> vtxData16; - TriGen0001_PrepareVtxData(params, vtxData16); - - std::vector<SWRSTriangle> triangles; - - // Step 1.1 Options - - TriGen0001_option_01010201(params, vtxData16, colorData, triangles); - TriGen0001_ponderation1(params, vtxData16, colorData); - TriGen0001_option_01010102(params, vtxData16, colorData, triangles); - TriGen0001_ponderation2(params, vtxData16, colorData); - TriGen0001_option_02010101(params, vtxData16, colorData, triangles); - TriGen0001_ponderation3(params, vtxData16, colorData); - TriGen0001_option_01020101(params, vtxData16, colorData, triangles); - TriGen0001_ponderation4(params, vtxData16, colorData); - TriGen0001_ponderation5(params, vtxData16, colorData); - - // Step 2. Build vertex data from bytes obtained on Step 1. - - std::vector<u32> vtxData32; - TriGen00_BuildVtxData(params, 3, vtxData16, vtxData32); - - // Step 3. Process vertices - const SWVertex * vertex = (const SWVertex*)vtxData32.data(); - const u32 vtxSize = static_cast<u32>(vtxData32.size()) / 2; - gSPSWVertex(vertex, vtxSize, nullptr); - - // Step 4. Prepare color indices and texture coordinates. Prepare vertices for rendering - - std::vector<u32> colorIndices(vtxSize); - TriGen00_BuildColorIndices(3, vtxSize, colorIndices); - - std::vector<u32> texCoords(vtxSize); - TriGen00_BuildTextureCoords(3, params, texCoords); - - F3DSWRS_PrepareVertices(nullptr, (u8*)colorData.data(), - colorIndices.data(), (u8*)texCoords.data(), true, false, vtxSize); - - // Step 5. Prepare triangles, sort them by z and draw. - - GraphicsDrawer & drawer = dwnd().getDrawer(); - - for (auto& t : triangles) { - t.avrgZ = calcAvrgZ(drawer, t); - } - for (u32 i = 0; i < 8; ++i) { - const SWRSTriangle & t = TriGen0001_defaultTriangleOrder[i]; - triangles.push_back(t); - triangles.back().avrgZ = calcAvrgZ(drawer, t); - } - std::stable_sort(triangles.begin(), triangles.end(), SWRSTriangleCompare); - - for (const auto& t : triangles) { - gSP1Triangle(t.V0, t.V1, t.V2); - } - drawer.drawTriangles(); -} - -static -void TriGen02() -{ - const u32* params = (const u32*)&RDRAM[RSP.PC[RSP.PCi]]; - - u32 vecdata[8]; - TriGen02_BuildVtxData(params, vecdata); - const SWVertex * vertex = (const SWVertex*)&vecdata[0]; - gSPSWVertex(vertex, 4, nullptr); - GraphicsDrawer & drawer = dwnd().getDrawer(); - - const u32 v1 = 0; - const u32 v2 = 1; - const u32 v3 = 2; - const u32 v4 = 3; - const u32 vert[4] = { v1, v2, v3, v4 }; - - const u32 colorbase[4] = { params[3], params[4], params[5], params[6] }; - const u32 color[4] = { 0, 4, 8, 12 }; - - const u32 tex = _SHIFTR(params[7], 0, 16); - const u32 texbase[4] = { tex, tex | (tex << 16), 0, (tex << 16) }; - - F3DSWRS_PrepareVertices(vert, (u8*)colorbase, color, (u8*)texbase, true, false, 4); - - SPVertex & vtx2 = drawer.getVertex(v2); - SPVertex & vtx3 = drawer.getVertex(v3); - - if (vtx3.z / vtx3.w > vtx2.z / vtx2.w) - gSP2Triangles(v1, v2, v4, 0, v1, v4, v3, 0); - else - gSP2Triangles(v1, v4, v3, 0, v1, v2, v4, 0); - drawer.drawTriangles(); -} - -void F3DSWRS_TriGen(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_TriGen (0x%08x, 0x%08x)\n", _w0, _w1); - - const u32 nextCmd = RSP.nextCmd; - RSP.nextCmd = G_TRI1; - - const u32 mode = _SHIFTR(_w0, 8, 8); - switch (mode) { - case 0x00: - { - const u32 mode00 = _SHIFTR(_w0, 0, 8); - switch (mode00) { - case 0x00: - TriGen0000(); - break; - case 0x01: - TriGen0001(); - break; - default: - break; - } - } - break; - case 0x02: - TriGen02(); - break; - default: - break; - } - - RSP.nextCmd = nextCmd; - RSP.PC[RSP.PCi] += 32; -} - -void F3DSWRS_JumpSWDL(u32, u32) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_JumpSWDL\n"); - RSP.PC[RSP.PCi] = RSP.F5DL[RSP.PCi]; - _updateF5DL(); -} - -void F3DSWRS_DList(u32, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_DList (0x%08x)\n", _w1); - gSPDisplayList(_w1); - _updateF5DL(); -} - -void F3DSWRS_BranchDList(u32, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_BranchDList (0x%08x)\n", _w1); - gSPBranchList(_w1); - _updateF5DL(); -} - -void F3DSWRS_EndDisplayList(u32, u32) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_EndDisplayList\n"); - gSPEndDisplayList(); -// _updateSWDL(); -} - -static -void _addVertices(const u32 _vert[3], GraphicsDrawer & _drawer) -{ - if (_drawer.isClipped(_vert[0], _vert[1], _vert[2])) - return; - - SPVertex & vtx0 = _drawer.getVertex(_vert[(((RSP.w1 >> 24) & 3) % 3)]); - - for (u32 i = 0; i < 3; ++i) { - SPVertex & vtx = _drawer.getVertex(_vert[i]); - - if ((gSP.geometryMode & G_SHADE) == 0) { - // Prim shading - vtx.flat_r = gDP.primColor.r; - vtx.flat_g = gDP.primColor.g; - vtx.flat_b = gDP.primColor.b; - vtx.flat_a = gDP.primColor.a; - } else if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) { - // Flat shading - vtx.r = vtx.flat_r = vtx0.r; - vtx.g = vtx.flat_g = vtx0.g; - vtx.b = vtx.flat_b = vtx0.b; - vtx.a = vtx.flat_a = vtx0.a; - } - - if (gDP.otherMode.depthSource == G_ZS_PRIM) - vtx.z = gDP.primDepth.z * vtx.w; - - _drawer.getCurrentDMAVertex() = vtx; - } -} - -void F3DSWRS_Tri(u32 _w0, u32 _w1) -{ - const bool bTri2 = RSP.cmd == F3DSWRS_TRI2; - DebugMsg(DEBUG_NORMAL, "F3DSWRS_Tri%d (0x%08x, 0x%08x)\n", bTri2 ? 2 : 1, _w0, _w1); - const u32 v1 = (_SHIFTR(_w1, 13, 11) & 0x7F8) / 40; - const u32 v2 = (_SHIFTR( _w1, 5, 11 ) & 0x7F8) / 40; - const u32 v3 = ((_w1 << 3) & 0x7F8) / 40; - const u32 v4 = (_SHIFTR( _w1, 21, 11 ) & 0x7F8) / 40; - const u32 vert[4] = { v1, v2, v3, v4 }; - - const u32 colorParam = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 8]; - const u32 colorIdx[4] = { _SHIFTR(colorParam, 16, 8), _SHIFTR(colorParam, 8, 8), - _SHIFTR(colorParam, 0, 8), _SHIFTR(colorParam, 24, 8) }; - - const bool useTex = (_w0 & 2) != 0; - const u8 * texbase = RDRAM + RSP.PC[RSP.PCi] + 16; - F3DSWRS_PrepareVertices(vert, RDRAM + gSP.vertexColorBase, colorIdx, texbase, useTex, gDP.otherMode.texturePersp != 0, bTri2 ? 4 : 3); - - if (useTex) - RSP.PC[RSP.PCi] += 16; - - RSP.nextCmd = _SHIFTR(*(u32*)&RDRAM[RSP.PC[RSP.PCi] + 16], 24, 8); - GraphicsDrawer & drawer = dwnd().getDrawer(); - const u32 vert1[3] = { v1, v2, v3 }; - _addVertices(vert1, drawer); - if (bTri2) { - const u32 vert2[3] = { v1, v3, v4 }; - _addVertices(vert2, drawer); - } - if (RSP.nextCmd != G_TRI1 && RSP.nextCmd != G_TRI2) { - const u32 geometryMode = gSP.geometryMode; - if ((gSP.geometryMode & G_CULL_BOTH) == G_CULL_BOTH) - gSP.geometryMode &= ~(G_CULL_FRONT); - drawer.drawDMATriangles(drawer.getDMAVerticesCount()); - gSP.geometryMode = geometryMode; - } - RSP.PC[RSP.PCi] += 8; -} - -void F3DSWRS_MoveWord(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_MoveWord (0x%08x, 0x%08x)\n", _w0, _w1); - switch (_SHIFTR(_w0, 0, 8)){ - case G_MW_CLIP: - gSPClipRatio( _w1 ); - break; - case G_MW_SEGMENT: - gSPSegment( _SHIFTR( _w0, 8, 16 ) >> 2, _w1 & 0x00FFFFFF ); - break; - case F3DSWRS_MW_FOG_MULTIPLIER: - gSP.fog.multiplierf = _FIXED2FLOAT((s32)_w1, 16); - gSP.changed |= CHANGED_FOGPOSITION; - break; - case F3DSWRS_MW_FOG_OFFSET: - gSP.fog.offsetf = _FIXED2FLOAT((s32)_w1, 16); - gSP.changed |= CHANGED_FOGPOSITION; - break; - case G_MW_PERSPNORM: - gSPPerspNormalize( _w1 ); - break; - } -} - -void F3DSWRS_TexrectGen(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_TexrectGen (0x%08x, 0x%08x)\n", _w0, _w1); - - const u32 vtxIdx = ((_w0 >> 5) & 0x07F8) / 40; - - const u32* params = (const u32*)&RDRAM[RSP.PC[RSP.PCi]]; - - RSP.PC[RSP.PCi] += 16; - - const SPVertex & v = dwnd().getDrawer().getVertex(vtxIdx); - if (v.clip != 0) - return; - - const f32 screenX = v.x / v.w * gSP.viewport.vscale[0] + gSP.viewport.vtrans[0]; - const f32 screenY = -v.y / v.w * gSP.viewport.vscale[1] + gSP.viewport.vtrans[1]; - - const bool flip = (_w0 & 1) != 0; - - const u32 w_i = std::max(1U, u32(v.w)); - const u32 viewport = *(u32*)&RDRAM[F3DSWRS_ViewportAddress]; - const u32 viewportX = _SHIFTR(viewport, 17, 15); - const u32 viewportY = _SHIFTR(viewport, 1, 15); - const u32* const perspMatrix = (u32*)&RDRAM[F3DSWRS_PerspMatrixAddress]; - const u32 perspMatrixX = (perspMatrix[0] & 0xFFFF0000) | _SHIFTR(perspMatrix[8], 16, 16); - const u32 perspMatrixY = _SHIFTL(perspMatrix[2], 16, 16) | _SHIFTR(perspMatrix[10], 0, 16); - u64 param3X = _SHIFTR(params[3], 16, 16); - u64 param3Y = _SHIFTR(params[3], 0, 16); - if (flip) - std::swap(param3X, param3Y); - - u32 offset_x_i = (u32)(((param3X * viewportX * perspMatrixX) / w_i) >> 16); - u32 offset_y_i = (u32)(((param3Y * viewportY * perspMatrixY) / w_i) >> 16); - const f32 offset_x_f = _FIXED2FLOAT(offset_x_i, 2); - const f32 offset_y_f = _FIXED2FLOAT(offset_y_i, 2); - - const f32 ulx = screenX - offset_x_f; - const f32 lrx = screenX + offset_x_f; - if (lrx - ulx <= 0.0f) - return; - const f32 uly = screenY - offset_y_f; - const f32 lry = screenY + offset_y_f; - if (lry - uly <= 0.0f) - return; - - u32 param4X = params[4] & 0xFFFF0000; - u32 param4Y = _SHIFTL(params[4], 16, 16); - float intpart; - const f32 frac_x_f = fabs(modff(gSP.matrix.combined[0][0], &intpart)); - const u32 combMatrixFracX = u32(frac_x_f*65536.0f); - const f32 frac_y_f = fabs(modff(gSP.matrix.combined[0][1], &intpart)); - const u32 combMatrixFracY = u32(frac_y_f*65536.0f); - param4X |= combMatrixFracX; - param4Y |= combMatrixFracY; - - if (flip) - std::swap(offset_x_i, offset_y_i); - - u16 dsdx_i = (u16)((param4X / offset_x_i) >> 10); - u16 dtdy_i = (u16)((param4Y / offset_y_i) >> 10); - u16 E = 0, F = 0; - - if ((_w0 & 2) != 0) { - dsdx_i = -dsdx_i; - E = _SHIFTR(params[4], 16, 16);; - } - - if ((_w0 & 4) != 0) { - dtdy_i = -dtdy_i; - F = _SHIFTR(params[4], 0, 16);; - } - - const f32 dsdx = _FIXED2FLOAT((s16)dsdx_i, 10); - const f32 dtdy = _FIXED2FLOAT((s16)dtdy_i, 10); - - if (flip) - std::swap(dsdx_i, dtdy_i); - - u16 S, T; - - if (ulx > 0) { - S = E + 0xFFF0; - } else { - const int ulx_i = int(ulx * 4.0f); - S = ((0 - (dsdx_i << 6) * ulx_i) << 3) + E + 0xFFF0; - } - - if (uly > 0) { - T = F + 0xFFF0; - } else { - const int uly_i = int(uly * 4.0f); - T = ((0 - (dtdy_i << 6) * uly_i) << 3) + F + 0xFFF0; - } - - gDP.primDepth.z = v.z / v.w * gSP.viewport.vscale[2] + gSP.viewport.vtrans[2]; - gDP.primDepth.deltaZ = 0.0f; - - const u32 primColor = params[1]; - gDP.primColor.r = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 24, 8), 8); - gDP.primColor.g = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 16, 8), 8); - gDP.primColor.b = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 8, 8), 8); - gDP.primColor.a = _FIXED2FLOATCOLOR(_SHIFTR(primColor, 0, 8), 8); - - if ((gSP.geometryMode & G_FOG) != 0) { - const u32 fogColor = (params[1] & 0xFFFFFF00) | u32(v.a*255.0f); - gDPSetFogColor( _SHIFTR( fogColor, 24, 8 ), // r - _SHIFTR( fogColor, 16, 8 ), // g - _SHIFTR( fogColor, 8, 8 ), // b - _SHIFTR( fogColor, 0, 8 ) ); // a - } - - gDPTextureRectangle(ulx, uly, lrx, lry, gSP.texture.tile, (s16)S, (s16)T, dsdx, dtdy, flip); -} - -void F3DSWRS_SetOtherMode_H_EX(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_SetOtherMode_H_EX (0x%08x, 0x%08x)\n", _w0, _w1); - RSP.PC[RSP.PCi] += 8; - gDP.otherMode.h &= *(u32*)&RDRAM[RSP.PC[RSP.PCi]]; - gDP.otherMode.h |= _w1; -} - -void F3DSWRS_SetOtherMode_L_EX(u32 _w0, u32 _w1) -{ - DebugMsg(DEBUG_NORMAL, "F3DSWRS_SetOtherMode_L_EX (0x%08x, 0x%08x)\n", _w0, _w1); - RSP.PC[RSP.PCi] += 8; - gDP.otherMode.l &= *(u32*)&RDRAM[RSP.PC[RSP.PCi]]; - gDP.otherMode.l |= _w1; -} - -void F5Rogue_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3DSWRS_Mtx ); - GBI_SetGBI( G_RESERVED0, F3DSWRS_VTXCOLOR, F3DSWRS_VertexColor ); - GBI_SetGBI( G_MOVEMEM, F3DSWRS_MOVEMEM, F3DSWRS_MoveMem ); - GBI_SetGBI( G_VTX, F3DSWRS_VTX, F3DSWRS_Vtx ); - GBI_SetGBI( G_RESERVED1, F3DSWRS_TRI_GEN, F3DSWRS_TriGen ); - GBI_SetGBI( G_DL, F3DSWRS_DL, F3DSWRS_DList ); - GBI_SetGBI( G_RESERVED2, F3DSWRS_BRANCHDL, F3DSWRS_BranchDList ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - - GBI_SetGBI( G_TRI1, F3DSWRS_TRI1, F3DSWRS_Tri ); - GBI_SetGBI( G_SETOTHERMODE_H_EX, F3DSWRS_SETOTHERMODE_H_EX, F3DSWRS_SetOtherMode_H_EX ); - GBI_SetGBI( G_POPMTX, F3DSWRS_TEXRECT_GEN, F3DSWRS_TexrectGen ); - GBI_SetGBI( G_MOVEWORD, F3DSWRS_MOVEWORD, F3DSWRS_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3DSWRS_ENDDL, F3DSWRS_EndDisplayList ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_JUMPSWDL, F3DSWRS_JUMPSWDL, F3DSWRS_JumpSWDL ); - GBI_SetGBI( G_TRI2, F3DSWRS_TRI2, F3DSWRS_Tri ); - GBI_SetGBI( G_SETOTHERMODE_L_EX, F3DSWRS_SETOTHERMODE_L_EX, F3DSWRS_SetOtherMode_L_EX ); -} diff --git a/GLideN64/src/uCodes/F5Rogue.h b/GLideN64/src/uCodes/F5Rogue.h deleted file mode 100644 index 76ac8c0..0000000 --- a/GLideN64/src/uCodes/F5Rogue.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef F5ROGUE_H -#define F5ROGUE_H - -void F5Rogue_Init(); - -#endif // F5ROGUE_H diff --git a/GLideN64/src/uCodes/L3D.cpp b/GLideN64/src/uCodes/L3D.cpp deleted file mode 100644 index 6fc8e1f..0000000 --- a/GLideN64/src/uCodes/L3D.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "L3D.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void L3D_Line3D( u32 w0, u32 w1 ) -{ - u32 wd = _SHIFTR( w1, 0, 8 ); - - if (wd == 0) - gSPLine3D( _SHIFTR( w1, 16, 8 ) / 10, _SHIFTR( w1, 8, 8 ) / 10, _SHIFTR( w1, 24, 8 ) ); - else - gSPLineW3D( _SHIFTR( w1, 16, 8 ) / 10, _SHIFTR( w1, 8, 8 ) / 10, wd, _SHIFTR( w1, 24, 8 ) ); -} - -void L3D_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3D_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - -// GBI_SetGBI( G_TRI1, F3D_TRI1, F3D_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_LINE3D, L3D_LINE3D, L3D_Line3D ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3D_RDPHALF_CONT, F3D_RDPHalf_Cont ); -// GBI_SetGBI( G_TRI4, F3D_TRI4, F3D_Tri4 ); -} - diff --git a/GLideN64/src/uCodes/L3D.h b/GLideN64/src/uCodes/L3D.h deleted file mode 100644 index 485293b..0000000 --- a/GLideN64/src/uCodes/L3D.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef L3D_H -#define L3D_H -#include "Types.h" - -#define L3D_LINE3D 0xB5 - -void L3D_Line3D( u32 w0, u32 w1 ); -void L3D_Init(); -#endif - diff --git a/GLideN64/src/uCodes/L3DEX.cpp b/GLideN64/src/uCodes/L3DEX.cpp deleted file mode 100644 index f8ddf63..0000000 --- a/GLideN64/src/uCodes/L3DEX.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "L3D.h" -#include "L3DEX.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void L3DEX_Line3D( u32 w0, u32 w1 ) -{ - u32 wd = _SHIFTR( w1, 0, 8 ); - - if (wd == 0) - gSPLine3D( _SHIFTR( w1, 17, 7 ), _SHIFTR( w1, 9, 7 ), 0 ); - else - gSPLineW3D( _SHIFTR( w1, 17, 7 ), _SHIFTR( w1, 9, 7 ), wd, 0 ); -} - -void L3DEX_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_MTX, F3D_MTX, F3D_Mtx ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_MOVEMEM, F3D_MOVEMEM, F3D_MoveMem ); - GBI_SetGBI( G_VTX, F3D_VTX, F3DEX_Vtx ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - GBI_SetGBI( G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, F3D_Sprite2D_Base ); - -// GBI_SetGBI( G_TRI1, F3D_TRI1, F3DEX_Tri1 ); - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_POPMTX, F3D_POPMTX, F3D_PopMtx ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_LINE3D, L3D_LINE3D, L3DEX_Line3D ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_MODIFYVTX, F3DEX_MODIFYVTX, F3DEX_ModifyVtx ); -// GBI_SetGBI( G_TRI2, F3DEX_TRI2, F3DEX_Tri2 ); - GBI_SetGBI( G_BRANCH_Z, F3DEX_BRANCH_Z, F3DEX_Branch_Z ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX_LOAD_UCODE, F3DEX_Load_uCode ); -} - diff --git a/GLideN64/src/uCodes/L3DEX.h b/GLideN64/src/uCodes/L3DEX.h deleted file mode 100644 index ddcfb41..0000000 --- a/GLideN64/src/uCodes/L3DEX.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef L3DEX_H -#define L3DEX_H -#include "Types.h" - -void L3DEX_Line3D( u32 w0, u32 w1 ); -void L3DEX_Init(); -#endif - diff --git a/GLideN64/src/uCodes/L3DEX2.cpp b/GLideN64/src/uCodes/L3DEX2.cpp deleted file mode 100644 index eaa01a6..0000000 --- a/GLideN64/src/uCodes/L3DEX2.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "GLideN64.h" -#include "DebugDump.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "L3DEX2.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "GBI.h" - -void L3DEX2_Line3D( u32 w0, u32 w1 ) -{ - u32 wd = _SHIFTR( (w0 + 1), 0, 8 ); - - if (wd == 0) - gSPLine3D( _SHIFTR( w0, 17, 7 ), _SHIFTR( w0, 9, 7 ), 0 ); - else - gSPLineW3D( _SHIFTR( w0, 17, 7 ), _SHIFTR( w0, 9, 7 ), wd, 0 ); -} - -void L3DEX2_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function -// GBI_SetGBI( G_BG_COPY, 0x0A, S2DEX_BG_Copy ); - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); - GBI_SetGBI( G_MOVEMEM, F3DEX2_MOVEMEM, F3DEX2_MoveMem ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, F3DEX2_MoveWord ); - GBI_SetGBI( G_MTX, F3DEX2_MTX, F3DEX2_Mtx ); - GBI_SetGBI( G_GEOMETRYMODE, F3DEX2_GEOMETRYMODE, F3DEX2_GeometryMode ); - GBI_SetGBI( G_POPMTX, F3DEX2_POPMTX, F3DEX2_PopMtx ); - GBI_SetGBI( G_TEXTURE, F3DEX2_TEXTURE, F3DEX2_Texture ); - GBI_SetGBI( G_DMA_IO, F3DEX2_DMA_IO, F3DEX2_DMAIO ); - GBI_SetGBI( G_SPECIAL_1, F3DEX2_SPECIAL_1, F3DEX2_Special_1 ); - GBI_SetGBI( G_SPECIAL_2, F3DEX2_SPECIAL_2, F3DEX2_Special_2 ); - GBI_SetGBI( G_SPECIAL_3, F3DEX2_SPECIAL_3, F3DEX2_Special_3 ); - - GBI_SetGBI( G_VTX, F3DEX2_VTX, F3DEX2_Vtx ); - GBI_SetGBI( G_MODIFYVTX, F3DEX2_MODIFYVTX, F3DEX_ModifyVtx ); - GBI_SetGBI( G_CULLDL, F3DEX2_CULLDL, F3DEX_CullDL ); - GBI_SetGBI( G_BRANCH_Z, F3DEX2_BRANCH_Z, F3DEX_Branch_Z ); -// GBI_SetGBI( G_TRI1, F3DEX2_TRI1, F3DEX2_Tri1 ); -// GBI_SetGBI( G_TRI2, F3DEX2_TRI2, F3DEX_Tri2 ); -// GBI_SetGBI( G_QUAD, F3DEX2_QUAD, F3DEX2_Quad ); - GBI_SetGBI( G_LINE3D, L3DEX2_LINE3D, L3DEX2_Line3D ); -} - diff --git a/GLideN64/src/uCodes/L3DEX2.h b/GLideN64/src/uCodes/L3DEX2.h deleted file mode 100644 index b957efe..0000000 --- a/GLideN64/src/uCodes/L3DEX2.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef L3DEX2_H -#define L3DEX2_H -#include "Types.h" - -#define L3DEX2_LINE3D 0x08 - -void L3DEX2_Line3D( u32 w0, u32 w1 ); -void L3DEX2_Init(); -#endif - diff --git a/GLideN64/src/uCodes/S2DEX.cpp b/GLideN64/src/uCodes/S2DEX.cpp deleted file mode 100644 index 88acd5d..0000000 --- a/GLideN64/src/uCodes/S2DEX.cpp +++ /dev/null @@ -1,1720 +0,0 @@ -#include <assert.h> -#include <algorithm> -#include "S2DEX.h" -#include "F3D.h" -#include "F3DEX.h" -#include "GBI.h" -#include "gSP.h" -#include "gDP.h" -#include "RSP.h" -#include "RDP.h" -#include "Config.h" -#include "Log.h" -#include "DebugDump.h" -#include "DepthBuffer.h" -#include "FrameBuffer.h" - -#include <Graphics/Context.h> -#include <Graphics/Parameters.h> -#include "DisplayWindow.h" - -using namespace graphics; - -#define S2DEX_MV_MATRIX 0 -#define S2DEX_MV_SUBMUTRIX 2 -#define S2DEX_MV_VIEWPORT 8 - -#define S2DEX_BG_1CYC 0x01 -#define S2DEX_BG_COPY 0x02 -#define S2DEX_OBJ_RECTANGLE 0x03 -#define S2DEX_OBJ_SPRITE 0x04 -#define S2DEX_OBJ_MOVEMEM 0x05 -#define S2DEX_LOAD_UCODE 0xAF -#define S2DEX_SELECT_DL 0xB0 -#define S2DEX_OBJ_RENDERMODE 0xB1 -#define S2DEX_OBJ_RECTANGLE_R 0xB2 -#define S2DEX_OBJ_LOADTXTR 0xC1 -#define S2DEX_OBJ_LDTX_SPRITE 0xC2 -#define S2DEX_OBJ_LDTX_RECT 0xC3 -#define S2DEX_OBJ_LDTX_RECT_R 0xC4 -#define S2DEX_RDPHALF_0 0xE4 - -// BG flags -#define G_BGLT_LOADBLOCK 0x0033 -#define G_BGLT_LOADTILE 0xFFF4 - -#define G_BG_FLAG_FLIPS 0x01 -#define G_BG_FLAG_FLIPT 0x10 - -// Sprite object render modes -#define G_OBJRM_NOTXCLAMP 0x01 -#define G_OBJRM_XLU 0x02 /* Ignored */ -#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */ -#define G_OBJRM_BILERP 0x08 -#define G_OBJRM_SHRINKSIZE_1 0x10 -#define G_OBJRM_SHRINKSIZE_2 0x20 -#define G_OBJRM_WIDEN 0x40 - -// Sprite texture loading types -#define G_OBJLT_TXTRBLOCK 0x00001033 -#define G_OBJLT_TXTRTILE 0x00fc1034 -#define G_OBJLT_TLUT 0x00000030 - -// Tile indices -#define G_TX_LOADTILE 0x07 -#define G_TX_RENDERTILE 0x00 - -struct uObjBg { - u16 imageW; /* Texture width (8-byte alignment, u10.2) */ - u16 imageX; /* x-coordinate of upper-left - position of texture (u10.5) */ - u16 frameW; /* Transfer destination frame width (u10.2) */ - s16 frameX; /* x-coordinate of upper-left - position of transfer destination frame (s10.2) */ - u16 imageH; /* Texture height (u10.2) */ - u16 imageY; /* y-coordinate of upper-left position of - texture (u10.5) */ - u16 frameH; /* Transfer destination frame height (u10.2) */ - s16 frameY; /* y-coordinate of upper-left position of transfer - destination frame (s10.2) */ - u32 imagePtr; /* Address of texture source in DRAM*/ - u8 imageSiz; /* Texel size - G_IM_SIZ_4b (4 bits/texel) - G_IM_SIZ_8b (8 bits/texel) - G_IM_SIZ_16b (16 bits/texel) - G_IM_SIZ_32b (32 bits/texel) */ - u8 imageFmt; /*Texel format - G_IM_FMT_RGBA (RGBA format) - G_IM_FMT_YUV (YUV format) - G_IM_FMT_CI (CI format) - G_IM_FMT_IA (IA format) - G_IM_FMT_I (I format) */ - u16 imageLoad; /* Method for loading the BG image texture - G_BGLT_LOADBLOCK (use LoadBlock) - G_BGLT_LOADTILE (use LoadTile) */ - u16 imageFlip; /* Image inversion on/off (horizontal - direction only) - 0 (normal display (no inversion)) - G_BG_FLAG_FLIPS (horizontal inversion of texture image) */ - u16 imagePal; /* Position of palette for 4-bit color - index texture (4-bit precision, 0~15) */ - u16 tmemH; /* Quadruple TMEM height(s13.2) which can be loaded at once - When normal texture 512/tmemW*4 - When CI Texture 256/tmemW*4 */ - u16 tmemW; /* TMEM width Word size for frame 1 line - When LoadBlock GS_PIX2TMEM(imageW/4,imageSiz) - When LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */ - u16 tmemLoadTH; /* TH value or Stride value - When LoadBlock GS_CALC_DXT(tmemW) - When LoadTile tmemH-1 */ - u16 tmemLoadSH; /* SH value - When LoadBlock tmemSize/2-1 - When LoadTile tmemW*16-1 */ - u16 tmemSize; /* imagePtr skip value for one load iteration - = tmemSizeW*tmemH */ - u16 tmemSizeW; /* imagePtr skip value for one line of image 1 - When LoadBlock tmemW*2 - When LoadTile GS_PIX2TMEM(imageW/4,imageSiz)*2 */ -}; /* 40 bytes */ - -struct uObjScaleBg -{ - u16 imageW; /* Texture width (8-byte alignment, u10.2) */ - u16 imageX; /* x-coordinate of upper-left - position of texture (u10.5) */ - u16 frameW; /* Transfer destination frame width (u10.2) */ - s16 frameX; /* x-coordinate of upper-left - position of transfer destination frame (s10.2) */ - - u16 imageH; /* Texture height (u10.2) */ - u16 imageY; /* y-coordinate of upper-left position of - texture (u10.5) */ - u16 frameH; /* Transfer destination frame height (u10.2) */ - s16 frameY; /* y-coordinate of upper-left position of transfer - destination frame (s10.2) */ - - u32 imagePtr; /* Address of texture source in DRAM*/ - u8 imageSiz; /* Texel size - G_IM_SIZ_4b (4 bits/texel) - G_IM_SIZ_8b (8 bits/texel) - G_IM_SIZ_16b (16 bits/texel) - G_IM_SIZ_32b (32 bits/texel) */ - u8 imageFmt; /*Texel format - G_IM_FMT_RGBA (RGBA format) - G_IM_FMT_YUV (YUV format) - G_IM_FMT_CI (CI format) - G_IM_FMT_IA (IA format) - G_IM_FMT_I (I format) */ - u16 imageLoad; /* Method for loading the BG image texture - G_BGLT_LOADBLOCK (use LoadBlock) - G_BGLT_LOADTILE (use LoadTile) */ - u16 imageFlip; /* Image inversion on/off (horizontal - direction only) - 0 (normal display (no inversion)) - G_BG_FLAG_FLIPS (horizontal inversion of texture image) */ - u16 imagePal; /* Position of palette for 4-bit color - index texture (4-bit precision, 0~15) */ - - u16 scaleH; /* y-direction scale value (u5.10) */ - u16 scaleW; /* x-direction scale value (u5.10) */ - s32 imageYorig; /* image drawing origin (s20.5)*/ - - u8 padding[4]; /* Padding */ -}; /* 40 bytes */ - -struct uObjSprite -{ - u16 scaleW; /* Width-direction scaling (u5.10) */ - s16 objX; /* x-coordinate of upper-left corner of OBJ (s10.2) */ - u16 paddingX; /* Unused (always 0) */ - u16 imageW; /* Texture width (length in s direction, u10.5) */ - u16 scaleH; /* Height-direction scaling (u5.10) */ - s16 objY; /* y-coordinate of upper-left corner of OBJ (s10.2) */ - u16 paddingY; /* Unused (always 0) */ - u16 imageH; /* Texture height (length in t direction, u10.5) */ - u16 imageAdrs; /* Texture starting position in TMEM (In units of 64-bit words) */ - u16 imageStride; /* Texel wrapping width (In units of 64-bit words) */ - u8 imageFlags; /* Display flag - (*) More than one of the following flags can be specified as the bit sum of the flags: - 0 (Normal display (no inversion)) - G_OBJ_FLAG_FLIPS (s-direction (x) inversion) - G_OBJ_FLAG_FLIPT (t-direction (y) inversion) */ - u8 imagePal; /* Position of palette for 4-bit color index texture (4-bit precision, 0~7) */ - u8 imageSiz; /* Texel size - G_IM_SIZ_4b (4 bits/texel) - G_IM_SIZ_8b (8 bits/texel) - G_IM_SIZ_16b (16 bits/texel) - G_IM_SIZ_32b (32 bits/texel) */ - u8 imageFmt; /* Texel format - G_IM_FMT_RGBA (RGBA format) - G_IM_FMT_YUV (YUV format) - G_IM_FMT_CI (CI format) - G_IM_FMT_IA (IA format) - G_IM_FMT_I (I format) */ -}; /* 24 bytes */ - -struct uObjTxtrBlock -{ - u32 type; /* Structure identifier (G_OBJLT_TXTRBLOCK) */ - u32 image; /* Texture source address in DRAM (8-byte alignment) */ - u16 tsize; /* Texture size (specified by GS_TB_TSIZE) */ - u16 tmem; /* TMEM word address where texture will be loaded (8-byte word) */ - u16 sid; /* Status ID (multiple of 4: either 0, 4, 8, or 12) */ - u16 tline; /* Texture line width (specified by GS_TB_TLINE) */ - u32 flag; /* Status flag */ - u32 mask; /* Status mask */ -}; /* 24 bytes */ - -struct uObjTxtrTile -{ - u32 type; /* Structure identifier (G_OBJLT_TXTRTILE) */ - u32 image; /* Texture source address in DRAM (8-byte alignment) */ - u16 twidth; /* Texture width (specified by GS_TT_TWIDTH) */ - u16 tmem; /* TMEM word address where texture will be loaded (8-byte word) */ - u16 sid; /* Status ID (multiple of 4: either 0, 4, 8, or 12) */ - u16 theight;/* Texture height (specified by GS_TT_THEIGHT) */ - u32 flag; /* Status flag */ - u32 mask; /* Status mask */ -}; /* 24 bytes */ - -struct uObjTxtrTLUT -{ - u32 type; /* Structure identifier (G_OBJLT_TLUT) */ - u32 image; /* Texture source address in DRAM */ - u16 pnum; /* Number of palettes to load - 1 */ - u16 phead; /* Palette position at start of load (256~511) */ - u16 sid; /* Status ID (multiple of 4: either 0, 4, 8, or 12) */ - u16 zero; /* Always assign 0 */ - u32 flag; /* Status flag */ - u32 mask; /* Status mask */ -}; /* 24 bytes */ - -typedef union -{ - uObjTxtrBlock block; - uObjTxtrTile tile; - uObjTxtrTLUT tlut; -} uObjTxtr; - -struct uObjTxSprite -{ - uObjTxtr txtr; - uObjSprite sprite; -}; - -struct uObjMtx -{ - s32 A, B, C, D; /* s15.16 */ - s16 Y, X; /* s10.2 */ - u16 BaseScaleY; /* u5.10 */ - u16 BaseScaleX; /* u5.10 */ -}; - -struct uObjSubMtx -{ - s16 Y, X; /* s10.2 */ - u16 BaseScaleY; /* u5.10 */ - u16 BaseScaleX; /* u5.10 */ -}; - -static uObjMtx objMtx; - -void resetObjMtx() -{ - objMtx.A = 1 << 16; - objMtx.B = 0; - objMtx.C = 0; - objMtx.D = 1 << 16; - objMtx.X = 0; - objMtx.Y = 0; - objMtx.BaseScaleX = 1 << 10; - objMtx.BaseScaleY = 1 << 10; -} - -enum S2DEXVersion -{ - eVer1_3, - eVer1_5, - eVer1_7 -}; - -static -S2DEXVersion gs_s2dexversion = S2DEXVersion::eVer1_7; - -struct S2DEXCoordCorrector -{ - S2DEXCoordCorrector() - { - static const u32 CorrectorsA01[] = { - 0x00000000, - 0x00100020, - 0x00200040, - 0x00300060, - 0x0000FFF4, - 0x00100014, - 0x00200034, - 0x00300054 - }; - static const s16 * CorrectorsA01_16 = reinterpret_cast<const s16*>(CorrectorsA01); - - static const u32 CorrectorsA23[] = { - 0x0001FFFE, - 0xFFFEFFFE, - 0x00010000, - 0x00000000 - }; - static const s16 * CorrectorsA23_16 = reinterpret_cast<const s16*>(CorrectorsA23); - - const u32 O1 = (gSP.objRendermode & (G_OBJRM_SHRINKSIZE_1 | G_OBJRM_SHRINKSIZE_2 | G_OBJRM_WIDEN)) >> 3; - A0 = CorrectorsA01_16[(0 + O1) ^ 1]; - A1 = CorrectorsA01_16[(1 + O1) ^ 1]; - const u32 O2 = (gSP.objRendermode & (G_OBJRM_SHRINKSIZE_1 | G_OBJRM_BILERP)) >> 2; - A2 = CorrectorsA23_16[(0 + O2) ^ 1]; - A3 = CorrectorsA23_16[(1 + O2) ^ 1]; - - const s16 * CorrectorsB03_16 = nullptr; - u32 O3 = 0; - if (gs_s2dexversion == eVer1_3) { - static const u32 CorrectorsB03_v1_3[] = { - 0xFFFC0000, - 0x00000000, - 0x00000001, - 0x00000000, - 0xFFFC0000, - 0x00000000, - 0x00000001, - 0xFFFF0001, - 0xFFFC0000, - 0x00030000, - 0x00000001, - 0x00000000, - 0xFFFC0000, - 0x00030000, - 0x00000001, - 0xFFFF0000, - 0xFFFF0003, - 0x0000FFF0, - 0x00000001, - 0x0000FFFF, - 0xFFFF0003, - 0x0000FFF0, - 0x00000001, - 0xFFFFFFFF, - 0xFFFF0003, - 0x0000FFF0, - 0x00000000, - 0x00000000, - 0xFFFF0003, - 0x0000FFF0, - 0x00000000, - 0xFFFF0000 - }; - CorrectorsB03_16 = reinterpret_cast<const s16*>(CorrectorsB03_v1_3); - O3 = (_SHIFTL(gSP.objRendermode, 3, 16) & (G_OBJRM_SHRINKSIZE_1 | G_OBJRM_SHRINKSIZE_2 | G_OBJRM_WIDEN)) >> 1; - B0 = CorrectorsB03_16[(0 + O3) ^ 1]; - B2 = CorrectorsB03_16[(2 + O3) ^ 1]; - B3 = CorrectorsB03_16[(3 + O3) ^ 1]; - B5 = CorrectorsB03_16[(5 + O3) ^ 1]; - B7 = CorrectorsB03_16[(7 + O3) ^ 1]; - } else { - static const u32 CorrectorsB03[] = { - 0xFFFC0000, - 0x00000001, - 0xFFFF0003, - 0xFFF00000 - }; - CorrectorsB03_16 = reinterpret_cast<const s16*>(CorrectorsB03); - O3 = (gSP.objRendermode & G_OBJRM_BILERP) >> 1; - B0 = CorrectorsB03_16[(0 + O3) ^ 1]; - B2 = CorrectorsB03_16[(2 + O3) ^ 1]; - B3 = CorrectorsB03_16[(3 + O3) ^ 1]; - B5 = 0; - B7 = 0; - } - } - - s16 A0, A1, A2, A3, B0, B2, B3, B5, B7; -}; - -struct ObjCoordinates -{ - f32 ulx, uly, lrx, lry; - f32 uls, ult, lrs, lrt; - f32 z, w; - - ObjCoordinates(const uObjSprite *_pObjSprite, bool _useMatrix) - { - /* Fixed point coordinates calculation. Decoded by olivieryuyu */ - S2DEXCoordCorrector CC; - s16 xh, xl, yh, yl; - s16 sh, sl, th, tl; - auto calcST = [&](s16 B, u32 scaleH) { - sh = CC.A0 + B; - sl = sh + _pObjSprite->imageW + CC.A0 - CC.A1 - 1; - th = sh - (((yh & 3) * 0x0200 * scaleH) >> 16); - tl = th + _pObjSprite->imageH + CC.A0 - CC.A1 - 1; - }; - const u16 objSpriteScaleW = std::max(_pObjSprite->scaleW, u16(1)); - const u16 objSpriteScaleH = std::max(_pObjSprite->scaleH, u16(1)); - if (_useMatrix) { - const u32 scaleW = (u32(objMtx.BaseScaleX) * 0x40 * objSpriteScaleW) >> 16; - const u32 scaleH = (u32(objMtx.BaseScaleY) * 0x40 * objSpriteScaleH) >> 16; - if (gs_s2dexversion == eVer1_3) { - // XH = AND ((((objX << 0x10) * 0x0800 * (0x80007FFF/BaseScaleX)) >> 0x30) + X + A2) by B0 - // XL = XH + AND (((((imageW - A1) * 0x100) * (0x80007FFF/scaleW)) >> 0x20) + B2) by B0 - // YH = AND ((((objY << 0x10) * 0x0800 * (0x80007FFF/BaseScaleY)) >> 0x30) + Y + A2) by B0 - // YL = YH + AND (((((imageH - A1) * 0x100) * (0x80007FFF/scaleH)) >> 0x20) + B2) by B0 - xh = static_cast<s16>(((((s64(_pObjSprite->objX) << 27) * (0x80007FFFU / u32(objMtx.BaseScaleX))) >> 0x30) + objMtx.X + CC.A2) & CC.B0); - xl = static_cast<s16>((((((s64(_pObjSprite->imageW) - CC.A1) << 8) * (0x80007FFFU / scaleW)) >> 0x20) + CC.B2) & CC.B0) + xh; - yh = static_cast<s16>(((((s64(_pObjSprite->objY) << 27) * (0x80007FFFU / u32(objMtx.BaseScaleY))) >> 0x30) + objMtx.Y + CC.A2) & CC.B0); - yl = static_cast<s16>((((((s64(_pObjSprite->imageH) - CC.A1) << 8) * (0x80007FFFU / scaleH)) >> 0x20) + CC.B2) & CC.B0) + yh; - calcST(CC.B3, scaleH); - } else { - // XHP = ((objX << 16) * 0x0800 * (0x80007FFF / BaseScaleX)) >> 16 + ((AND(X + A2) by B0) << 16)) - // XH = XHP >> 16 - // XLP = XHP + (((ImageW - A1) << 24) * (0x80007FFF / scaleW)) >> 32 - // XL = XLP >> 16 - // YHP = ((objY << 16) * 0x0800 * (0x80007FFF / BaseScaleY)) >> 16 + ((AND(Y + A2) by B0) << 16)) - // YH = YHP >> 16 - // YLP = YHP + (((ImageH - A1) << 24) * (0x80007FFF / scaleH)) >> 32 - // YL = YLP >> 16 - const s32 xhp = ((((s64(_pObjSprite->objX) << 16) * 0x0800) * (0x80007FFFU / u32(objMtx.BaseScaleX))) >> 32) + (((objMtx.X + CC.A2) & CC.B0) << 16); - xh = static_cast<s16>(xhp >> 16); - const s32 xlp = xhp + ((((u64(_pObjSprite->imageW) - CC.A1) << 24) * (0x80007FFFU / scaleW)) >> 32); - xl = static_cast<s16>(xlp >> 16); - const s32 yhp = ((((s64(_pObjSprite->objY) << 16) * 0x0800) * (0x80007FFFU / u32(objMtx.BaseScaleY))) >> 32) + (((objMtx.Y + CC.A2) & CC.B0) << 16); - yh = static_cast<s16>(yhp >> 16); - const s32 ylp = yhp + ((((u64(_pObjSprite->imageH) - CC.A1) << 24) * (0x80007FFFU / scaleH)) >> 32); - yl = static_cast<s16>(ylp >> 16); - calcST(CC.B2, scaleH); - } - } else { - // XH = AND(objX + A2) by B0 - // XL = ((AND(objX + A2) by B0) << 16) + (((ImageW - A1) << 24)*(0x80007FFF / scaleW)) >> 48 - // YH = AND(objY + A2) by B0 - // YL = ((AND(objY + A2) by B0) << 16) + (((ImageH - A1) << 24)*(0x80007FFF / scaleH)) >> 48 - xh = (_pObjSprite->objX + CC.A2) & CC.B0; - xl = static_cast<s16>((((u64(_pObjSprite->imageW) - CC.A1) << 24) * (0x80007FFFU / u32(objSpriteScaleW))) >> 48) + xh; - yh = (_pObjSprite->objY + CC.A2) & CC.B0; - yl = static_cast<s16>((((u64(_pObjSprite->imageH) - CC.A1) << 24) * (0x80007FFFU / u32(objSpriteScaleH))) >> 48) + yh; - calcST(CC.B2, objSpriteScaleH); - } - - ulx = _FIXED2FLOAT(xh, 2); - lrx = _FIXED2FLOAT(xl, 2); - uly = _FIXED2FLOAT(yh, 2); - lry = _FIXED2FLOAT(yl, 2); - - uls = _FIXED2FLOAT(sh, 5); - lrs = _FIXED2FLOAT(sl, 5); - ult = _FIXED2FLOAT(th, 5); - lrt = _FIXED2FLOAT(tl, 5); - - if ((_pObjSprite->imageFlags & G_BG_FLAG_FLIPS) != 0) - std::swap(uls, lrs); - if ((_pObjSprite->imageFlags & G_BG_FLAG_FLIPT) != 0) - std::swap(ult, lrt); - - z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz; - w = 1.0f; - } - - ObjCoordinates(const uObjScaleBg * _pObjScaleBg) - { - const f32 frameX = _FIXED2FLOAT(_pObjScaleBg->frameX, 2); - const f32 frameY = _FIXED2FLOAT(_pObjScaleBg->frameY, 2); - const f32 imageX = gSP.bgImage.imageX; - const f32 imageY = gSP.bgImage.imageY; - f32 scaleW = gSP.bgImage.scaleW; - f32 scaleH = gSP.bgImage.scaleH; - - // BgRectCopyOnePiece() does not support scaleW and scaleH - if (gDP.otherMode.cycleType == G_CYC_COPY) { - scaleW = 1.0f; - scaleH = 1.0f; - } - - f32 frameW = _FIXED2FLOAT(_pObjScaleBg->frameW, 2); - f32 frameH = _FIXED2FLOAT(_pObjScaleBg->frameH, 2); - f32 imageW = (f32)(_pObjScaleBg->imageW >> 2); - f32 imageH = (f32)(_pObjScaleBg->imageH >> 2); - // const f32 imageW = (f32)gSP.bgImage.width; - // const f32 imageH = (f32)gSP.bgImage.height; - - if (u32(imageW) == 512 && (config.generalEmulation.hacks & hack_RE2) != 0) { - const f32 width = f32(*REG.VI_WIDTH); - const f32 scale = imageW / width; - imageW = width; - frameW = width; - imageH *= scale; - frameH *= scale; - scaleW = 1.0f; - scaleH = 1.0f; - } - - uls = imageX; - ult = imageY; - lrs = uls + std::min(imageW, frameW * scaleW) - 1; - lrt = ult + std::min(imageH, frameH * scaleH) - 1; - - gSP.bgImage.clampS = lrs <= (imageW - 1) ? 1 : 0 ; - gSP.bgImage.clampT = lrt <= (imageH - 1) ? 1 : 0 ; - - // G_CYC_COPY (BgRectCopyOnePiece()) does not allow texture filtering - if (gDP.otherMode.cycleType != G_CYC_COPY) { - // Correct texture coordinates -0.5f and +0.5 if G_OBJRM_BILERP - // bilinear interpolation is set - if (gDP.otherMode.textureFilter == G_TF_BILERP) { - uls -= 0.5f; - ult -= 0.5f; - lrs += 0.5f; - lrt += 0.5f; - } - // SHRINKSIZE_1 adds a 0.5f perimeter around the image - // upper left texture coords += 0.5f; lower left texture coords -= 0.5f - if ((gSP.objRendermode&G_OBJRM_SHRINKSIZE_1) != 0) { - uls += 0.5f; - ult += 0.5f; - lrs -= 0.5f; - lrt -= 0.5f; - // SHRINKSIZE_2 adds a 1.0f perimeter - // upper left texture coords += 1.0f; lower left texture coords -= 1.0f - } - else if ((gSP.objRendermode&G_OBJRM_SHRINKSIZE_2) != 0) { - uls += 1.0f; - ult += 1.0f; - lrs -= 1.0f; - lrt -= 1.0f; - } - } - - // Calculate lrx and lry width new ST values - ulx = frameX; - uly = frameY; - lrx = ulx + (lrs - uls) / scaleW; - lry = uly + (lrt - ult) / scaleH; - if (((gSP.objRendermode&G_OBJRM_BILERP) == 0 && gDP.otherMode.textureFilter != G_TF_BILERP) || - ((gSP.objRendermode&G_OBJRM_BILERP) != 0 && gDP.otherMode.textureFilter == G_TF_POINT && (gSP.objRendermode&G_OBJRM_NOTXCLAMP) != 0)) { - lrx += 1.0f / scaleW; - lry += 1.0f / scaleH; - } - - // BgRect1CycOnePiece() and BgRectCopyOnePiece() do only support - // imageFlip in horizontal direction - if ((_pObjScaleBg->imageFlip & G_BG_FLAG_FLIPS) != 0) { - std::swap(ulx, lrx); - } - - z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz; - w = 1.0f; - } -}; - -static -u16 _YUVtoRGBA(u8 y, u8 u, u8 v) -{ - float r = y + (1.370705f * (v - 128)); - float g = y - (0.698001f * (v - 128)) - (0.337633f * (u - 128)); - float b = y + (1.732446f * (u - 128)); - r *= 0.125f; - g *= 0.125f; - b *= 0.125f; - //clipping the result - if (r > 31) r = 31; - if (g > 31) g = 31; - if (b > 31) b = 31; - if (r < 0) r = 0; - if (g < 0) g = 0; - if (b < 0) b = 0; - - u16 c = (u16)(((u16)(r) << 11) | - ((u16)(g) << 6) | - ((u16)(b) << 1) | 1); - return c; -} - -static -void _drawYUVImageToFrameBuffer(const ObjCoordinates & _objCoords) -{ - const u32 ulx = (u32)_objCoords.ulx; - const u32 uly = (u32)_objCoords.uly; - const u32 lrx = (u32)_objCoords.lrx; - const u32 lry = (u32)_objCoords.lry; - const u32 ci_width = gDP.colorImage.width; - const u32 ci_height = (u32)gDP.scissor.lry; - if (ulx >= ci_width) - return; - if (uly >= ci_height) - return; - u32 width = 16, height = 16; - if (lrx > ci_width) - width = ci_width - ulx; - if (lry > ci_height) - height = ci_height - uly; - u32 * mb = (u32*)(RDRAM + gDP.textureImage.address); //pointer to the first macro block - u16 * dst = (u16*)(RDRAM + gDP.colorImage.address); - dst += ulx + uly * ci_width; - //yuv macro block contains 16x16 texture. we need to put it in the proper place inside cimg - for (u16 h = 0; h < 16; h++) { - for (u16 w = 0; w < 16; w += 2) { - u32 t = *(mb++); //each u32 contains 2 pixels - if ((h < height) && (w < width)) //clipping. texture image may be larger than color image - { - u8 y0 = (u8)t & 0xFF; - u8 v = (u8)(t >> 8) & 0xFF; - u8 y1 = (u8)(t >> 16) & 0xFF; - u8 u = (u8)(t >> 24) & 0xFF; - *(dst++) = _YUVtoRGBA(y0, u, v); - *(dst++) = _YUVtoRGBA(y1, u, v); - } - } - dst += ci_width - 16; - } - FrameBuffer *pBuffer = frameBufferList().getCurrent(); - if (pBuffer != nullptr) - pBuffer->m_isOBScreen = true; -} - -static -void gSPDrawObjRect(const ObjCoordinates & _coords) -{ - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(4); - SPVertex * pVtx = drawer.getDMAVerticesData(); - SPVertex & vtx0 = pVtx[0]; - vtx0.x = _coords.ulx; - vtx0.y = _coords.uly; - vtx0.z = _coords.z; - vtx0.w = _coords.w; - vtx0.s = _coords.uls; - vtx0.t = _coords.ult; - SPVertex & vtx1 = pVtx[1]; - vtx1.x = _coords.lrx; - vtx1.y = _coords.uly; - vtx1.z = _coords.z; - vtx1.w = _coords.w; - vtx1.s = _coords.lrs; - vtx1.t = _coords.ult; - SPVertex & vtx2 = pVtx[2]; - vtx2.x = _coords.ulx; - vtx2.y = _coords.lry; - vtx2.z = _coords.z; - vtx2.w = _coords.w; - vtx2.s = _coords.uls; - vtx2.t = _coords.lrt; - SPVertex & vtx3 = pVtx[3]; - vtx3.x = _coords.lrx; - vtx3.y = _coords.lry; - vtx3.z = _coords.z; - vtx3.w = _coords.w; - vtx3.s = _coords.lrs; - vtx3.t = _coords.lrt; - - drawer.drawScreenSpaceTriangle(4); -} - -static -void gSPSetSpriteTile(const uObjSprite *_pObjSprite) -{ - const u32 w = std::max(_pObjSprite->imageW >> 5, 1); - const u32 h = std::max(_pObjSprite->imageH >> 5, 1); - - gDPSetTile( _pObjSprite->imageFmt, _pObjSprite->imageSiz, _pObjSprite->imageStride, _pObjSprite->imageAdrs, G_TX_RENDERTILE, _pObjSprite->imagePal, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, 0, 0 ); - gDPSetTileSize( G_TX_RENDERTILE, 0, 0, (w - 1) << 2, (h - 1) << 2 ); - gSPTexture(1.0f, 1.0f, 0, 0, TRUE); -} - -static -void gSPObjLoadTxtr(u32 tx) -{ - const u32 address = RSP_SegmentToPhysical(tx); - uObjTxtr *objTxtr = (uObjTxtr*)&RDRAM[address]; - - if ((gSP.status[objTxtr->block.sid >> 2] & objTxtr->block.mask) != objTxtr->block.flag) { - switch (objTxtr->block.type) { - case G_OBJLT_TXTRBLOCK: - gDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, objTxtr->block.tsize + 1, objTxtr->block.image); - gDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, objTxtr->block.tmem, - G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 0, 0, 0, 0); - gDPLoadBlock( G_TX_LOADTILE, 0, 0, objTxtr->block.tsize << 2, objTxtr->block.tline ); - DebugMsg(DEBUG_NORMAL, "gSPObjLoadTxtr: load block\n"); - break; - case G_OBJLT_TXTRTILE: - gDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, objTxtr->tile.twidth + 1, objTxtr->tile.image); - gDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, (objTxtr->tile.twidth + 1) >> 2, objTxtr->tile.tmem, - G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 0, 0, 0, 0); - gDPLoadTile( G_TX_LOADTILE, 0, 0, objTxtr->tile.twidth << 2, objTxtr->tile.theight ); - DebugMsg(DEBUG_NORMAL, "gSPObjLoadTxtr: load tile\n"); - break; - case G_OBJLT_TLUT: - gDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, objTxtr->tlut.image); - gDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_4b, 0, objTxtr->tlut.phead, - G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 0, 0, 0, 0); - gDPLoadTLUT( G_TX_LOADTILE, 0, 0, objTxtr->tlut.pnum << 2, 0 ); - DebugMsg(DEBUG_NORMAL, "gSPObjLoadTxtr: load tlut\n"); - break; - } - gSP.status[objTxtr->block.sid >> 2] = - (gSP.status[objTxtr->block.sid >> 2] & ~objTxtr->block.mask) | (objTxtr->block.flag & objTxtr->block.mask); - } -} - -static -void gSPObjRectangle(u32 _sp) -{ - const u32 address = RSP_SegmentToPhysical(_sp); - uObjSprite *objSprite = (uObjSprite*)&RDRAM[address]; - gSPSetSpriteTile(objSprite); - - ObjCoordinates objCoords(objSprite, false); - gSPDrawObjRect(objCoords); - DebugMsg(DEBUG_NORMAL, "gSPObjRectangle\n"); -} - -static -void gSPObjRectangleR(u32 _sp) -{ - const u32 address = RSP_SegmentToPhysical(_sp); - const uObjSprite *objSprite = (uObjSprite*)&RDRAM[address]; - gSPSetSpriteTile(objSprite); - ObjCoordinates objCoords(objSprite, true); - - if (objSprite->imageFmt == G_IM_FMT_YUV && (config.generalEmulation.hacks&hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer - _drawYUVImageToFrameBuffer(objCoords); - gSPDrawObjRect(objCoords); - - DebugMsg(DEBUG_NORMAL, "gSPObjRectangleR\n"); -} - -static -void gSPObjSprite(u32 _sp) -{ - const u32 address = RSP_SegmentToPhysical(_sp); - uObjSprite *pObjSprite = (uObjSprite*)&RDRAM[address]; - gSPSetSpriteTile(pObjSprite); - - /* Fixed point coordinates calculation. Decoded by olivieryuyu */ - // X1 = AND (X + B3) by B0 + ((objX + A3) * A) >> 16 + ((objY + A3) * B) >> 16 - // Y1 = AND (Y + B3) by B0 + ((objX + A3) * C) >> 16 + ((objY + A3) * D) >> 16 - // X2 = AND (X + B3) by B0 + (((((imageW - A1) * 0x0100)* (0x80007FFF/scaleW)) >> 32+ objX + A3) * A) >> 16 + (((((imageH - A1) * 0x0100)* (0x80007FFF/scaleH)) >> 32 + objY + A3) * B) >> 16 - // Y2 = AND (Y + B3) by B0 + (((((imageW - A1) * 0x0100)* (0x80007FFF/scaleW)) >> 32 + objX + A3) * C) >> 16 + (((((imageH - A1) * 0x0100)* (0x80007FFF/scaleH)) >> 32 + objY + A3) * D) >> 16 - S2DEXCoordCorrector CC; - const s16 x0 = (gs_s2dexversion == eVer1_3) ? - ((objMtx.X + CC.B5) & CC.B0) + CC.B7 : - ((objMtx.X + CC.B3) & CC.B0); - const s16 y0 = (gs_s2dexversion == eVer1_3) ? - ((objMtx.Y + CC.B5) & CC.B0) + CC.B7 : - ((objMtx.Y + CC.B3) & CC.B0); - const s16 ulx = pObjSprite->objX + CC.A3; - const s16 uly = pObjSprite->objY + CC.A3; - const u32 objSpriteScaleW = std::max(u32(pObjSprite->scaleW), 1U); - const u32 objSpriteScaleH = std::max(u32(pObjSprite->scaleH), 1U); - const s16 lrx = ((((u64(pObjSprite->imageW) - CC.A1) << 8) * (0x80007FFFU / objSpriteScaleW)) >> 32) + ulx; - const s16 lry = ((((u64(pObjSprite->imageH) - CC.A1) << 8) * (0x80007FFFU / objSpriteScaleH)) >> 32) + uly; - - auto calcX = [&](s16 _x, s16 _y) -> f32 - { - const s16 X = x0 + static_cast<s16>(((_x * objMtx.A) >> 16)) + static_cast<s16>(((_y * objMtx.B) >> 16)); - return _FIXED2FLOAT(X, 2); - }; - - auto calcY = [&](s16 _x, s16 _y) -> f32 - { - const s16 Y = y0 + static_cast<s16>(((_x * objMtx.C) >> 16)) + static_cast<s16>(((_y * objMtx.D) >> 16)); - return _FIXED2FLOAT(Y, 2); - }; - - f32 uls = 0.0f; - f32 lrs = _FIXED2FLOAT(pObjSprite->imageW, 5) - 1.0f; - f32 ult = 0.0f; - f32 lrt = _FIXED2FLOAT(pObjSprite->imageH, 5) - 1.0f; - - if (pObjSprite->imageFlags & G_BG_FLAG_FLIPS) - std::swap(uls, lrs); - - if (pObjSprite->imageFlags & G_BG_FLAG_FLIPT) - std::swap(ult, lrt); - - const float z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz; - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(4); - SPVertex * pVtx = drawer.getDMAVerticesData(); - - SPVertex & vtx0 = pVtx[0]; - vtx0.x = calcX(ulx, uly); - vtx0.y = calcY(ulx, uly); - vtx0.z = z; - vtx0.w = 1.0f; - vtx0.s = uls; - vtx0.t = ult; - SPVertex & vtx1 = pVtx[1]; - vtx1.x = calcX(lrx, uly); - vtx1.y = calcY(lrx, uly); - vtx1.z = z; - vtx1.w = 1.0f; - vtx1.s = lrs; - vtx1.t = ult; - SPVertex & vtx2 = pVtx[2]; - vtx2.x = calcX(ulx, lry); - vtx2.y = calcY(ulx, lry); - vtx2.z = z; - vtx2.w = 1.0f; - vtx2.s = uls; - vtx2.t = lrt; - SPVertex & vtx3 = pVtx[3]; - vtx3.x = calcX(lrx, lry); - vtx3.y = calcY(lrx, lry); - vtx3.z = z; - vtx3.w = 1.0f; - vtx3.s = lrs; - vtx3.t = lrt; - - drawer.drawScreenSpaceTriangle(4); - - DebugMsg(DEBUG_NORMAL, "gSPObjSprite\n"); -} - -static -void gSPObjMatrix(u32 mtx) -{ - objMtx = *reinterpret_cast<const uObjMtx *>(RDRAM + RSP_SegmentToPhysical(mtx)); - DebugMsg(DEBUG_NORMAL, "gSPObjMatrix\n"); -} - -static -void gSPObjSubMatrix(u32 mtx) -{ - const uObjSubMtx * pObjSubMtx = reinterpret_cast<const uObjSubMtx*>(RDRAM + RSP_SegmentToPhysical(mtx)); - objMtx.X = pObjSubMtx->X; - objMtx.Y = pObjSubMtx->Y; - objMtx.BaseScaleX = pObjSubMtx->BaseScaleX; - objMtx.BaseScaleY = pObjSubMtx->BaseScaleY; - DebugMsg(DEBUG_NORMAL, "gSPObjSubMatrix\n"); -} - -static -void _copyDepthBuffer() -{ - if (!config.frameBufferEmulation.enable) - return; - - if (!Context::BlitFramebuffer) - return; - - // The game copies content of depth buffer into current color buffer - // OpenGL has different format for color and depth buffers, so this trick can't be performed directly - // To do that, depth buffer with address of current color buffer created and attached to the current FBO - // It will be copy depth buffer - DepthBufferList & dbList = depthBufferList(); - dbList.saveBuffer(gDP.colorImage.address); - // Take any frame buffer and attach source depth buffer to it, to blit it into copy depth buffer - FrameBufferList & fbList = frameBufferList(); - FrameBuffer * pTmpBuffer = fbList.findTmpBuffer(fbList.getCurrent()->m_startAddress); - if (pTmpBuffer == nullptr) - return; - DepthBuffer * pCopyBufferDepth = dbList.findBuffer(gSP.bgImage.address); - if (pCopyBufferDepth == nullptr) - return; - pCopyBufferDepth->setDepthAttachment(pTmpBuffer->m_FBO, bufferTarget::READ_FRAMEBUFFER); - - DisplayWindow & wnd = dwnd(); - Context::BlitFramebuffersParams blitParams; - blitParams.readBuffer = pTmpBuffer->m_FBO; - blitParams.drawBuffer = fbList.getCurrent()->m_FBO; - blitParams.srcX0 = 0; - blitParams.srcY0 = 0; - blitParams.srcX1 = wnd.getWidth(); - blitParams.srcY1 = wnd.getHeight(); - blitParams.dstX0 = 0; - blitParams.dstY0 = 0; - blitParams.dstX1 = wnd.getWidth(); - blitParams.dstY1 = wnd.getHeight(); - blitParams.mask = blitMask::DEPTH_BUFFER; - blitParams.filter = textureParameters::FILTER_NEAREST; - - gfxContext.blitFramebuffers(blitParams); - - // Restore objects - if (pTmpBuffer->m_pDepthBuffer != nullptr) - pTmpBuffer->m_pDepthBuffer->setDepthAttachment(fbList.getCurrent()->m_FBO, bufferTarget::READ_FRAMEBUFFER); - gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::defaultFramebuffer); - - // Set back current depth buffer - dbList.saveBuffer(gDP.depthImageAddress); -} - -static -void _loadBGImage(const uObjScaleBg * _pBgInfo, bool _loadScale, bool _fbImage) -{ - gSP.bgImage.address = RSP_SegmentToPhysical(_pBgInfo->imagePtr); - - const u32 imageW = _pBgInfo->imageW >> 2; - const u32 imageH = _pBgInfo->imageH >> 2; - if (imageW == 512 && (config.generalEmulation.hacks & hack_RE2) != 0) { - gSP.bgImage.width = *REG.VI_WIDTH; - gSP.bgImage.height = (imageH * imageW) / gSP.bgImage.width; - } - else { - gSP.bgImage.width = imageW - imageW % 2; - gSP.bgImage.height = imageH - imageH % 2; - } - gSP.bgImage.format = _pBgInfo->imageFmt; - gSP.bgImage.size = _pBgInfo->imageSiz; - gSP.bgImage.palette = _pBgInfo->imagePal; - gSP.bgImage.imageX = _FIXED2FLOAT(_pBgInfo->imageX, 5); - gSP.bgImage.imageY = _FIXED2FLOAT(_pBgInfo->imageY, 5); - if (_loadScale) { - gSP.bgImage.scaleW = _FIXED2FLOAT(_pBgInfo->scaleW, 10); - gSP.bgImage.scaleH = _FIXED2FLOAT(_pBgInfo->scaleH, 10); - } - else - gSP.bgImage.scaleW = gSP.bgImage.scaleH = 1.0f; - - gDP.tiles[0].textureMode = TEXTUREMODE_BGIMAGE; - - if (_fbImage) { - FrameBuffer *pBuffer = frameBufferList().findBuffer(gSP.bgImage.address); - gDP.tiles[0].frameBufferAddress = pBuffer->m_startAddress; - gDP.tiles[0].textureMode = TEXTUREMODE_FRAMEBUFFER_BG; - gDP.tiles[0].loadType = LOADTYPE_TILE; - gDP.changed |= CHANGED_TMEM; - - if ((config.generalEmulation.hacks & hack_ZeldaMM) != 0) { - if (gDP.colorImage.address == gDP.depthImageAddress) - frameBufferList().setCopyBuffer(frameBufferList().getCurrent()); - } - } -} - -static -bool _useOnePieceBgCode(u32 address, bool & fbImage) -{ - fbImage = false; - if (config.frameBufferEmulation.enable != 0) { - uObjScaleBg *pObjScaleBg = (uObjScaleBg*)&RDRAM[address]; - FrameBuffer *pBuffer = frameBufferList().findBuffer(RSP_SegmentToPhysical(pObjScaleBg->imagePtr)); - fbImage = pBuffer != nullptr && - pBuffer->m_size == pObjScaleBg->imageSiz && - (!pBuffer->m_isDepthBuffer || pBuffer->m_changed) && - (pObjScaleBg->imageFmt != G_IM_FMT_CI || pObjScaleBg->imageSiz != G_IM_SIZ_8b); - if (fbImage && (pBuffer->m_cfb || !pBuffer->isValid(false))) { - frameBufferList().removeBuffer(pBuffer->m_startAddress); - fbImage = false; - } - } - - if (config.graphics2D.bgMode == Config::BGMode::bgOnePiece) - return true; - - if ((config.generalEmulation.hacks & hack_RE2) != 0) - return true; - - return fbImage; -} - -static -void BgRect1CycOnePiece(u32 _bg, bool _fbImage) -{ - uObjScaleBg *pObjScaleBg = (uObjScaleBg*)&RDRAM[_bg]; - _loadBGImage(pObjScaleBg, true, _fbImage); - - // Zelda MM uses depth buffer copy in LoT and in pause screen. - // In later case depth buffer is used as temporal color buffer, and usual rendering must be used. - // Since both situations are hard to distinguish, do the both depth buffer copy and bg rendering. - if ((config.generalEmulation.hacks & hack_ZeldaMM) != 0 && - (gSP.bgImage.address == gDP.depthImageAddress || depthBufferList().findBuffer(gSP.bgImage.address) != nullptr) - ) - _copyDepthBuffer(); - - gDP.otherMode.cycleType = G_CYC_1CYCLE; - gDP.changed |= CHANGED_CYCLETYPE; - gSPTexture(1.0f, 1.0f, 0, 0, TRUE); - - ObjCoordinates objCoords(pObjScaleBg); - gSPDrawObjRect(objCoords); - - DebugMsg(DEBUG_NORMAL, "BgRect1CycOnePiece\n"); -} - -static -void BgRectCopyOnePiece(u32 _bg, bool _fbImage) -{ - uObjScaleBg *pObjBg = (uObjScaleBg*)&RDRAM[_bg]; - _loadBGImage(pObjBg, false, _fbImage); - - // See comment to BgRect1CycOnePiece - if ((config.generalEmulation.hacks & hack_ZeldaMM) != 0 && - (gSP.bgImage.address == gDP.depthImageAddress || depthBufferList().findBuffer(gSP.bgImage.address) != nullptr) - ) - _copyDepthBuffer(); - - gDP.otherMode.cycleType = G_CYC_COPY; - gDP.changed |= CHANGED_CYCLETYPE; - gSPTexture(1.0f, 1.0f, 0, 0, TRUE); - - ObjCoordinates objCoords(pObjBg); - gSPDrawObjRect(objCoords); - - DebugMsg(DEBUG_NORMAL, "BgRectCopyOnePiece\n"); -} - -//#define runCommand(w0, w1) GBI.cmd[_SHIFTR(w0, 24, 8)](w0, w1) -inline -void runCommand(u32 w0, u32 w1) -{ - GBI.cmd[_SHIFTR(w0, 24, 8)](w0, w1); -}; - -static -void BgRect1CycStripped(u32 _bgAddr) -{ - uObjScaleBg objBg = *reinterpret_cast<const uObjScaleBg*>(RDRAM + _bgAddr); - const u32 imagePtr = RSP_SegmentToPhysical(objBg.imagePtr); - gDP.otherMode.cycleType = G_CYC_1CYCLE; - gDP.changed |= CHANGED_CYCLETYPE; - ValueKeeper<bool> otherMode(RSP.LLE, true); - - s32 E2_1; - u16 F1_1; - u16 P; - s16 H2; - - // Part 1 - { - // Step 1 & 2 - s16 Aw = objBg.frameW - ((((objBg.imageW << 10) / objBg.scaleW) - 1) & 0xFFFC); - if (Aw < 0) - Aw = 0; - if ((objBg.imageFlip & G_BG_FLAG_FLIPS) != 0) - objBg.frameX += Aw; - s16 Bw = std::max(0, gDP.scissor.xh - objBg.frameX); - s16 Cw = std::max(0, objBg.frameX + objBg.frameW - gDP.scissor.xl - Aw); - if ((s16)objBg.frameW - Aw - Bw - Cw <= 0) - return; - s16 Dw = objBg.frameX + Bw; - s16 Ew = objBg.frameX + objBg.frameW - Aw - Cw; - - s16 Ah = objBg.frameH - ((((objBg.imageH << 10) / objBg.scaleH) - 1) & 0xFFFC); - if (Ah < 0) - Ah = 0; - s16 Bh = std::max(0, gDP.scissor.yh - objBg.frameY); - s16 Ch = std::max(0, objBg.frameY + objBg.frameH - gDP.scissor.yl - Ah); - if ((s16)objBg.frameH - Ah - Bh - Ch <= 0) - return; - s16 Dh = ((objBg.frameY + Bh) * 0x4000) >> 16; - s16 Eh = ((objBg.frameH - Ah - Bh - Ch) * 0x4000) >> 16; - - *reinterpret_cast<u32*>(DMEM + 0x548) = (Dw << 16) | Ew; - *reinterpret_cast<u32*>(DMEM + 0x54C) = (Dh << 16) | Eh; - - // Step 3 - u16 Fw = objBg.imageW << 3; - if ((objBg.imageFlip & G_BG_FLAG_FLIPS) != 0) - Bw = Cw; - s16 Gw = ((objBg.scaleW * Bw * 0x0200) >> 16) + objBg.imageX; - s32 Hw = Gw - Fw; - u16 Fh = objBg.imageH << 3; - s16 Gh = ((objBg.scaleH * Bh * 0x0200) >> 16) + objBg.imageY; - while (Hw >= 0) { - Gw -= Fw; - Gh += 0x20; - objBg.imageYorig += 0x20; - Hw = Gw - Fw; - } - s32 Hh = Gh - Fh; - while (Hh >= 0) { - Gh -= Fh; - objBg.imageYorig -= Fh; - Hh = Gh - Fh; - } - - s32 I = (s32(Gh) - objBg.imageYorig) << 5; - s16 J = (objBg.scaleW * (objBg.frameW - Aw - Bw - Cw)) >> 7; - u8 J_2 = 1; - if (J + Gw + 0x0B < Fw) - J_2 = 0; - u8 K = (gSP.objRendermode & 0x08) >> 3; - - // Step 4 - static const u32 aSize[] = { - 0x01FF0080, - 0x00FF0100, - 0x007F0200, - 0x003F0400 - }; - static const u32 aFormat[] = { - 0x04000400, - 0x02000400, - 0x04000000 - }; - const u16 * aFormat16 = reinterpret_cast<const u16*>(aFormat); - u16 L = aFormat16[objBg.imageFmt ^ 1]; - u32 M = aSize[objBg.imageSiz]; - u16 N = ((objBg.frameW * objBg.scaleW) >> 7) + (K << 5); - u16 O = N; - if (N >= Fw) - O = Fw; - P = (((O + (M >> 16)) * (M & 0xFFFF)) >> 16) + 1; - - *reinterpret_cast<u32*>(DMEM + 0x550) = (K << 24) | (J_2 << 16) | P; - *reinterpret_cast<s32*>(DMEM + 0x554) = I; - - // Step 5 - u16 Q = L / (P * 2) + K * 0xFFFF; - s32 R = (0x100000 * Q) / objBg.scaleH; - - *reinterpret_cast<u32*>(DMEM + 0x558) = R; - - // Step 6 - s32 S = ((s64(I) * 0x4000000 / objBg.scaleH) >> 16) & 0xFFFFFC00; - //s16 T = (S / R); - s16 T = static_cast<s16>(((0xFFFFFFFF / R) * s64(S)) >> 0x20); - s32 U = R * (T + 1); - s16 V = T; - if (U <= S) - V += 1; - s32 W = R * V; - s32 Z = R - S + W; - - *reinterpret_cast<u32*>(DMEM + 0x55C) = Z; - *reinterpret_cast<s32*>(DMEM + 0x560) = objBg.imageYorig; - - // Step 7 - u32 A1 = S - (W & 0xFFFFFC00); - u32 B1 = (A1 * 0x0040) >> 16; - u32 C1 = B1 * objBg.scaleH; - u16 D1 = static_cast<u16>(((C1 * 0x0040) >> 16) & 0x0000FFFF); - u16 E1 = Q - D1; - u16 F1 = C1 & 0xFFFF; - F1_1 = ((F1 <<11) >> 16) & 0x001F; - - // Step 8 - s16 A2 = static_cast<s16>((u32(Q) * u32(V) + u32(D1) + ((objBg.imageYorig << 11) >> 16)) & 0xFFFF); - u16 B2 = (objBg.imageH << 14) >> 16; - s16 A2_1 = (A2 >= 0) ? A2 : A2 + B2; - if (A2 - B2 >= 0) - A2_1 -= B2; - s16 C2 = static_cast<s16>(((s32(Gw) * (M & 0xFFFF)) >> 16) << 3); - s16 D2 = static_cast<s16>(((s32(Fw) * (M & 0xFFFF)) >> 16) << 3); - s32 E2 = A2_1 * D2 + C2; - E2_1 = E2 + imagePtr; - s32 F2 = E1 * D2; - s32 G2 = Q * D2; - H2 = Gw & (M >> 16); - if ((objBg.imageFlip & G_BG_FLAG_FLIPS) != 0) - H2 = (H2 + J) * 0xFFFF; - u32 I2 = 0xFD100000 | ((D2 >> 1) - 1); - u32 J2 = 0xF5100000 | (P << 9); - u32 J2_1 = (J2 & 0xFF00FFFF) | (((objBg.imageFmt << 5) | (objBg.imageSiz << 3)) << 16); - u32 K2 = (objBg.imagePal << 20) | 0x0007C1F0; - u16 L2 = objBg.imageH >> 2; - - *reinterpret_cast<u32*>(DMEM + 0x564) = (C2 << 16) | D2; - *reinterpret_cast<u32*>(DMEM + 0x568) = I2; - *reinterpret_cast<u32*>(DMEM + 0x56C) = J2; - //*reinterpret_cast<u32*>(DMEM + 0x570) = (Q << 16) | E1; - *reinterpret_cast<u32*>(DMEM + 0x570) = (E1 << 16) | Q; - *reinterpret_cast<u32*>(DMEM + 0x574) = F2; - *reinterpret_cast<u32*>(DMEM + 0x578) = G2; - *reinterpret_cast<u32*>(DMEM + 0x57C) = (L2 << 16) | A2_1; - - runCommand(J2, 0x27000000); - runCommand(J2_1, K2); - runCommand((G_SETTILESIZE<<24), 0); - } - - if (config.graphics2D.enableNativeResTexrects != 0) - dwnd().getDrawer().setBackgroundDrawingMode(true); - - //Part two - { - - u32 VV = *reinterpret_cast<u32*>(DMEM + 0x57C); - s16 AA = _SHIFTR(VV, 16, 16) - _SHIFTR(VV, 0, 16); - VV = *reinterpret_cast<u32*>(DMEM + 0x570); - s32 CC = VV >> 16; - u32 DD = *reinterpret_cast<u32*>(DMEM + 0x55C); - u32 EE = *reinterpret_cast<u32*>(DMEM + 0x558); - VV = *reinterpret_cast<u32*>(DMEM + 0x54C); - s32 FF = _SHIFTR(VV, 0, 16); - u16 JJ = _SHIFTR(VV, 16, 16); - u32 GG = *reinterpret_cast<u32*>(DMEM + 0x574); - VV = *reinterpret_cast<u32*>(DMEM + 0x548); - u32 HH = _SHIFTR(VV, 16, 16) << 0x0C; - u32 II = _SHIFTR(VV, 0, 16) << 0x0C; - - u32 step = 2; - s32 KK; - s16 LL, MM, NN, RR, AAA; - u32 SS; - - auto setTexture = [&]() { -// 0x28000000, 0x00000000 - runCommand((*reinterpret_cast<u32*>(DMEM + 0x56C) | AAA), 0x27000000); - runCommand((*reinterpret_cast<u32*>(DMEM + 0x568)), SS); -// 0x26000000, 0x00000000 - runCommand(0xF4000000, (((P + 0x6FF)<<16) | ((RR << 2) - 1))); - }; - - bool stop = false; - while (!stop) { - switch (step) { - case 2: - KK = DD >> 10; - if (KK > 0) - step = 5; - else - step = 3; - break; - case 3: - AA -= CC; - if (AA > 0) - E2_1 += GG; - else { - VV = *reinterpret_cast<u32*>(DMEM + 0x564); - E2_1 = imagePtr + _SHIFTR(VV, 16, 16) + _SHIFTR(VV, 0, 16) * (-AA); - VV = *reinterpret_cast<u32*>(DMEM + 0x57C); - AA += _SHIFTR(VV, 16, 16); - } - step = 4; - break; - case 4: - DD += EE; - VV = *reinterpret_cast<u32*>(DMEM + 0x570); - CC = s32(_SHIFTR(VV, 0, 16)); - GG = *reinterpret_cast<u32*>(DMEM + 0x578); - F1_1 = 0; - step = 2; - break; - case 5: - FF -= KK; - DD &= 0x03FF; - if (FF < 0) { - CC += ((objBg.scaleH * FF) >> 10) + 1; - KK += FF; - VV = *reinterpret_cast<u32*>(DMEM + 0x570); - if (CC - s32(_SHIFTR(VV, 0, 16)) > 0) - CC = s32(_SHIFTR(VV, 0, 16)); - } - step = 6; - break; - case 6: - LL = JJ + KK; - VV = *reinterpret_cast<u32*>(DMEM + 0x550); - P = _SHIFTR(VV, 0, 16); - MM = CC + _SHIFTR(VV, 24, 8); - NN = AA - _SHIFTR(VV, 16, 8); - if (NN - MM < 0) - step = 7; - else - step = 77; - break; - case 7: - RR = MM - AA; - AAA = AA; - if (RR > 0) { - VV = *reinterpret_cast<u32*>(DMEM + 0x564); - SS = imagePtr + _SHIFTR(VV, 16, 16); - if ((AAA & 1) != 0) { - AAA--; - RR++; - SS -= _SHIFTR(VV, 0, 16); - } - AAA *= P; - setTexture(); - } - step = 8; - break; - case 77: - RR = MM; - SS = E2_1; - runCommand(*reinterpret_cast<u32*>(DMEM + 0x568), SS); - //0x26000000, 0x00000000 - runCommand(0xF4000000, (((P + 0x6FF) << 16) | ((RR << 2) - 1))); - AA -= CC; - E2_1 += GG; - step = 11; - break; - case 8: - VV = *reinterpret_cast<u32*>(DMEM + 0x550); - if (_SHIFTR(VV, 16, 8) != 0) { - SS = imagePtr; - s16 BBB = NN; - RR = NN & 1; - VV = *reinterpret_cast<u32*>(DMEM + 0x564); - if (RR != 0) { - BBB--; - SS -= _SHIFTR(VV, 0, 16); - } - u32 CCC = E2_1 + BBB * _SHIFTR(VV, 0, 16); - RR++; - u16 DDD = ((_SHIFTR(VV, 0, 16) - _SHIFTR(VV, 16, 16)) * 0x2000) >> 16; - u32 ZZZ = BBB * P; - P -= DDD; - AAA = ZZZ + DDD; - setTexture(); - SS = CCC; - AAA = ZZZ; - P = DDD; - setTexture(); - } - step = 9; - break; - case 9: - AA -= CC; - if (NN <= 0) { - runCommand(*reinterpret_cast<u32*>(DMEM + 0x56C), 0x27000000); - } else { - VV = *reinterpret_cast<u32*>(DMEM + 0x550); - P = _SHIFTR(VV, 0, 16); - SS = E2_1; - RR = NN; - AAA = 0; - setTexture(); - } - step = 10; - break; - case 10: - if (AA > 0) { - E2_1 += GG; - } else { - VV = *reinterpret_cast<u32*>(DMEM + 0x564); - E2_1 = imagePtr + _SHIFTR(VV, 16, 16) + _SHIFTR(VV, 0, 16) * (-AA); - VV = *reinterpret_cast<u32*>(DMEM + 0x57C); - AA += _SHIFTR(VV, 16, 16); - } - step = 11; - break; - case 11: - //0x27000000, 0x00000000 - const u32 w0 = (G_TEXRECT << 24) | (LL << 2) | II; - const u32 w1 = (JJ << 2) | HH; - RDP.w2 = (H2 << 16) | F1_1; - RDP.w3 = (objBg.scaleW << 16) | objBg.scaleH; - RDP_TexRect(w0, w1); - if (FF <= 0) - stop = true; - else { - JJ = LL; - DD = DD + EE; - VV = *reinterpret_cast<u32*>(DMEM + 0x570); - CC = _SHIFTR(VV, 0, 16); - GG = *reinterpret_cast<u32*>(DMEM + 0x578); - F1_1 = 0; - step = 2; - } - break; - } - } - } - - if (config.graphics2D.enableNativeResTexrects != 0) { - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.flush(); - drawer.setBackgroundDrawingMode(false); - } -} - -static -void BgRectCopyStripped(u32 _bgAddr) -{ - // Step 1 - uObjBg objBg = *reinterpret_cast<const uObjBg*>(RDRAM + _bgAddr); - const u32 imagePtr = RSP_SegmentToPhysical(objBg.imagePtr); - gDP.otherMode.cycleType = G_CYC_COPY; - gDP.changed |= CHANGED_CYCLETYPE; - ValueKeeper<bool> otherMode(RSP.LLE, true); - - // Step 2 - s16 Aw = std::max(0, objBg.frameX + objBg.frameW - gDP.scissor.xl); - s16 Bw = std::min(0, objBg.frameX - gDP.scissor.xh); - s16 Cw = objBg.frameW + Bw - Aw; - if (Cw <= 0) - return; - s16 Dw = (((objBg.imageX * 0x2000) >> 16) & 0xFFFC) - Bw; - s16 Ew = objBg.frameX - Bw; - - s16 Ah = std::max(0, objBg.frameY + objBg.frameH - gDP.scissor.yl); - s16 Bh = std::min(0, objBg.frameY - gDP.scissor.yh); - s16 Ch = objBg.frameH + Bh - Ah; - if (Ch <= 0) - return; - s16 Dh = (((objBg.imageY * 0x2000) >> 16) & 0xFFFC) - Bh; - s16 Eh = objBg.frameY - Bh; - - s16 F = Dh - objBg.imageH; - s16 G = (F >= 0) ? F : Dh; - s16 H= (objBg.imageFlip != 0) ? Dw + Aw : Dw; - - // Step 3 - u32 I = (objBg.imageLoad == G_BGLT_LOADTILE) ? 0xFFFFFFFF : 0U; - u32 J = objBg.tmemW << 9; - u32 K = (G_SETTILE << 24) | 0x100000 | (J & I); - u32 L = (objBg.imageFmt << 2) | objBg.imageSiz; - L = (L << 0x13) | J; - u32 M = (objBg.imagePal << 0x14) | 0x0007C1F0; - - runCommand(K, 0x27000000); - runCommand((G_SETTILESIZE<<24), 0); - runCommand(((G_SETTILE<<24) | L), M); - - // Step 4 - static const u32 aSize[] = { - 0x003F0800, - 0x10000080, - 0x001F1000, - 0x20000100, - 0x000F2000, - 0x40000200, - 0x00074000, - 0x80000400 - }; - const u16 * aSize16 = reinterpret_cast<const u16*>(aSize); - u16 imageSzIdx = objBg.imageSiz << 2; - u16 N0 = aSize16[(0 + imageSzIdx) ^ 1]; - u16 N1 = aSize16[(1 + imageSzIdx) ^ 1]; - u16 N2 = aSize16[(2 + imageSzIdx) ^ 1]; - G = (G * 0x4000) >> 16; - u16 O = (N0 & H) + Cw; - u32 P = ((N1 * H) >> 16) + objBg.tmemSizeW * G; - u16 Q = (N2 * O) >> 16; - u32 R = (objBg.imageFlip != 0) ? (((1 - O) * 8) << 16) : (((N0 & H) * 8) << 16); - u32 S = ((P >> 1) << 3) + imagePtr; - u16 T = Ew + Cw - 1; - - u16 A1 = objBg.imageH & 0xFFFC; - u16 A2 = G <<2; - u16 A3 = (N1 * H) >> 16; - u32 T0 = Ew << 0x0C; - u16 T1 = Eh; - u32 T2 = T << 0x0C; - s16 AT = Ch; - s16 U = A1 - A2; - - if (config.graphics2D.enableNativeResTexrects != 0) - dwnd().getDrawer().setBackgroundDrawingMode(true); - - u32 V, X, Y, Z, AA, w0, w1; - u16 S5, BB; - u32 step = 4; - bool stop = false; - while (!stop) { - switch (step) { - case 4: - if (U <= 0) - stop = true; - step = 5; - break; - case 5: - if (A3 > 0) - U -= 4; - if (U > AT) - U = AT; - V = 0xE4000000 | T2; - if (gs_s2dexversion == eVer1_7) - X = (objBg.imageLoad == G_BGLT_LOADTILE) ? (Q << 2) - 1 : objBg.tmemLoadSH; - else - X = (objBg.imageLoad == G_BGLT_LOADTILE) ? (Q << 2) : objBg.tmemLoadSH; - X = (X | 0x7000) << 0x0C; - Y = 0xFD100000 | ((objBg.tmemSizeW << 1) - 1); - AT -= U; - step = (U <= 0) ? 8 : 55; - break; - case 55: - if (gs_s2dexversion == eVer1_7) - Z = (objBg.imageLoad == G_BGLT_LOADTILE) ? (objBg.tmemSize << 0x10) | objBg.tmemLoadSH : objBg.tmemSize; - else - Z = objBg.tmemSize; - S5 = objBg.tmemH; - AA = X | objBg.tmemLoadTH; - step = 6; - break; - case 6: - U -= S5; - if (U < 0) { - Z += objBg.tmemSizeW * U; - S5 += U; - AA = (objBg.imageLoad == G_BGLT_LOADTILE) ? X | (S5 - 1) : (((Z - 2) | 0xE000) << 0x0B) | objBg.tmemLoadTH; - } - step = 7; - break; - case 7: - BB = T1 + S5 - 1; - runCommand(Y, S); - if (objBg.imageLoad == G_BGLT_LOADTILE) - runCommand((G_LOADTILE<<24), AA); - else - runCommand((G_LOADBLOCK<<24), AA); - w0 = V | BB; - w1 = T0 | T1; - RDP.w2 = R; - RDP.w3 = 0x10000400; - RDP_TexRect(w0, w1); - T1 = BB + 1; - S += Z; - if (U > 0) - step = 6; - else { - if (AT <= 0) - stop = true; - step = 8; - } - break; - case 8: - if (A3 > 0) { - A3 >>= 1; - runCommand(Y, S); - runCommand(((G_SETTILE<<24) | 0x35100000), 0x06000000); - runCommand((G_LOADBLOCK<<24), (0x06000000 | (((((objBg.tmemSizeW >> 1) - A3) << 2) - 1) << 12))); - runCommand(Y, imagePtr); - runCommand(((G_SETTILE << 24) | 0x35100000 | ((objBg.tmemSizeW >> 1) - A3)), 0x06000000); - runCommand((G_LOADBLOCK<<24), (0x06000000 | (((A3 << 2) - 1) << 12))); - w0 = V | T1; - w1 = T0 | T1; - RDP.w2 = R; - RDP.w3 = 0x10000400; - RDP_TexRect(w0, w1); - T1 += 4; - AT -= 4; - if (AT <= 0) - stop = true; - } - step = 9; - break; - case 9: - S = imagePtr + (A3 << 3); - U = AT; - AT = 0; - step = 55; - break; - } - } - - if (config.graphics2D.enableNativeResTexrects != 0) { - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.flush(); - drawer.setBackgroundDrawingMode(false); - } -} - -void S2DEX_BG_1Cyc(u32 w0, u32 w1) -{ - const u32 bgAddr = RSP_SegmentToPhysical(w1); - bool fbImage = false; - if (_useOnePieceBgCode(bgAddr, fbImage)) - BgRect1CycOnePiece(bgAddr, fbImage); - else - BgRect1CycStripped(bgAddr); -} - -void S2DEX_BG_Copy(u32 w0, u32 w1) -{ - const u32 bgAddr = RSP_SegmentToPhysical(w1); - bool fbImage = false; - if (_useOnePieceBgCode(bgAddr, fbImage)) - BgRectCopyOnePiece(bgAddr, fbImage); - else - BgRectCopyStripped(bgAddr); -} - -void S2DEX_Obj_MoveMem(u32 w0, u32 w1) -{ - switch (_SHIFTR(w0, 0, 16)) { - case S2DEX_MV_MATRIX: - gSPObjMatrix(w1); - break; - case S2DEX_MV_SUBMUTRIX: - gSPObjSubMatrix(w1); - break; - case S2DEX_MV_VIEWPORT: - gSPViewport(w1); - break; - } -} - -void S2DEX_MoveWord(u32 w0, u32 w1) -{ - switch (_SHIFTR(w0, 0, 8)) - { - case G_MW_GENSTAT: - gSPSetStatus(_SHIFTR(w0, 0, 16), w1); - break; - default: - F3D_MoveWord(w0, w1); - break; - } -} - -void S2DEX_RDPHalf_0(u32 w0, u32 w1) { - if (RSP.nextCmd == G_SELECT_DL) { - gSP.selectDL.addr = _SHIFTR(w0, 0, 16); - gSP.selectDL.sid = _SHIFTR(w0, 18, 8); - gSP.selectDL.flag = w1; - return; - } - if (RSP.nextCmd == G_RDPHALF_1) { - RDP_TexRect(w0, w1); - return; - } - assert(false); -} - -void S2DEX_Select_DL(u32 w0, u32 w1) -{ - gSP.selectDL.addr |= (_SHIFTR(w0, 0, 16)) << 16; - const u8 sid = gSP.selectDL.sid; - const u32 flag = gSP.selectDL.flag; - const u32 mask = w1; - if ((gSP.status[sid] & mask) == flag) - // Do nothing; - return; - - gSP.status[sid] = (gSP.status[sid] & ~mask) | (flag & mask); - - switch (_SHIFTR(w0, 16, 8)) - { - case G_DL_PUSH: - gSPDisplayList(gSP.selectDL.addr); - break; - case G_DL_NOPUSH: - gSPBranchList(gSP.selectDL.addr); - break; - } -} - -void S2DEX_Obj_RenderMode(u32 w0, u32 w1) -{ - gSP.objRendermode = w1; - DebugMsg(DEBUG_NORMAL, "gSPObjRendermode(0x%08x)\n", gSP.objRendermode); -} - -void S2DEX_Obj_Rectangle(u32 w0, u32 w1) -{ - gSPObjRectangle(w1); -} - -void S2DEX_Obj_Rectangle_R(u32 w0, u32 w1) -{ - gSPObjRectangleR(w1); -} - -void S2DEX_Obj_Sprite(u32 w0, u32 w1) -{ - gSPObjSprite(w1); -} - -void S2DEX_Obj_LoadTxtr(u32 w0, u32 w1) -{ - gSPObjLoadTxtr(w1); -} - -void S2DEX_Obj_LdTx_Rect(u32 w0, u32 w1) -{ - gSPObjLoadTxtr(w1); - gSPObjRectangle(w1 + sizeof(uObjTxtr)); -} - -void S2DEX_Obj_LdTx_Rect_R(u32 w0, u32 w1) -{ - gSPObjLoadTxtr(w1); - gSPObjRectangleR(w1 + sizeof(uObjTxtr)); -} - -void S2DEX_Obj_LdTx_Sprite(u32 w0, u32 w1) -{ - gSPObjLoadTxtr(w1); - gSPObjSprite(w1 + sizeof(uObjTxtr)); -} - -void S2DEX_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX ); - resetObjMtx(); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_BG_1CYC, S2DEX_BG_1CYC, S2DEX_BG_1Cyc ); - GBI_SetGBI( G_BG_COPY, S2DEX_BG_COPY, S2DEX_BG_Copy ); - GBI_SetGBI( G_OBJ_RECTANGLE, S2DEX_OBJ_RECTANGLE, S2DEX_Obj_Rectangle ); - GBI_SetGBI( G_OBJ_SPRITE, S2DEX_OBJ_SPRITE, S2DEX_Obj_Sprite ); - GBI_SetGBI( G_OBJ_MOVEMEM, S2DEX_OBJ_MOVEMEM, S2DEX_Obj_MoveMem ); - GBI_SetGBI( G_DL, F3D_DL, F3D_DList ); - GBI_SetGBI( G_SELECT_DL, S2DEX_SELECT_DL, S2DEX_Select_DL ); - GBI_SetGBI( G_OBJ_RENDERMODE, S2DEX_OBJ_RENDERMODE, S2DEX_Obj_RenderMode ); - GBI_SetGBI( G_OBJ_RECTANGLE_R, S2DEX_OBJ_RECTANGLE_R, S2DEX_Obj_Rectangle_R ); - GBI_SetGBI( G_OBJ_LOADTXTR, S2DEX_OBJ_LOADTXTR, S2DEX_Obj_LoadTxtr ); - GBI_SetGBI( G_OBJ_LDTX_SPRITE, S2DEX_OBJ_LDTX_SPRITE, S2DEX_Obj_LdTx_Sprite ); - GBI_SetGBI( G_OBJ_LDTX_RECT, S2DEX_OBJ_LDTX_RECT, S2DEX_Obj_LdTx_Rect ); - GBI_SetGBI( G_OBJ_LDTX_RECT_R, S2DEX_OBJ_LDTX_RECT_R, S2DEX_Obj_LdTx_Rect_R ); - GBI_SetGBI( G_MOVEWORD, F3D_MOVEWORD, S2DEX_MoveWord ); - GBI_SetGBI( G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3D_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_RDPHALF_0, S2DEX_RDPHALF_0, S2DEX_RDPHalf_0 ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_LOAD_UCODE, S2DEX_LOAD_UCODE, F3DEX_Load_uCode ); -} - -void S2DEX_1_03_Init() -{ - S2DEX_Init(); - gs_s2dexversion = eVer1_3; -} - -void S2DEX_1_05_Init() -{ - S2DEX_Init(); - gs_s2dexversion = eVer1_5; -} - -void S2DEX_1_07_Init() -{ - S2DEX_Init(); - gs_s2dexversion = eVer1_7; -} diff --git a/GLideN64/src/uCodes/S2DEX.h b/GLideN64/src/uCodes/S2DEX.h deleted file mode 100644 index 7096f7c..0000000 --- a/GLideN64/src/uCodes/S2DEX.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef S2DEX_H -#define S2DEX_H - -#include "Types.h" - -void S2DEX_BG_1Cyc(u32 w0, u32 w1); -void S2DEX_BG_Copy( u32 w0, u32 w1 ); -void S2DEX_Obj_Rectangle( u32 w0, u32 w1 ); -void S2DEX_Obj_Sprite( u32 w0, u32 w1 ); -void S2DEX_Obj_MoveMem( u32 w0, u32 w1 ); -void S2DEX_RDPHalf_0( u32 w0, u32 w1 ); -void S2DEX_Select_DL( u32 w0, u32 w1 ); -void S2DEX_Obj_RenderMode( u32 w0, u32 w1 ); -void S2DEX_Obj_Rectangle_R( u32 w0, u32 w1 ); -void S2DEX_Obj_LoadTxtr( u32 w0, u32 w1 ); -void S2DEX_Obj_LdTx_Sprite( u32 w0, u32 w1 ); -void S2DEX_Obj_LdTx_Rect( u32 w0, u32 w1 ); -void S2DEX_Obj_LdTx_Rect_R( u32 w0, u32 w1 ); -void S2DEX_1_03_Init(); -void S2DEX_1_05_Init(); -void S2DEX_1_07_Init(); -void resetObjMtx(); - -#endif diff --git a/GLideN64/src/uCodes/S2DEX2.cpp b/GLideN64/src/uCodes/S2DEX2.cpp deleted file mode 100644 index dd8d153..0000000 --- a/GLideN64/src/uCodes/S2DEX2.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "S2DEX.h" -#include "S2DEX2.h" -#include "F3D.h" -#include "F3DEX.h" -#include "F3DEX2.h" -#include "GBI.h" -#include "gSP.h" -#include "gDP.h" -#include "RSP.h" -#include "Types.h" - -#define S2DEX2_OBJ_RECTANGLE_R 0xDA -#define S2DEX2_OBJ_MOVEMEM 0xDC -#define S2DEX2_RDPHALF_0 0xE4 -#define S2DEX2_OBJ_RECTANGLE 0x01 -#define S2DEX2_OBJ_SPRITE 0x02 -#define S2DEX2_SELECT_DL 0x04 -#define S2DEX2_OBJ_LOADTXTR 0x05 -#define S2DEX2_OBJ_LDTX_SPRITE 0x06 -#define S2DEX2_OBJ_LDTX_RECT 0x07 -#define S2DEX2_OBJ_LDTX_RECT_R 0x08 -#define S2DEX2_BG_1CYC 0x09 -#define S2DEX2_BG_COPY 0x0A -#define S2DEX2_OBJ_RENDERMODE 0x0B - -void S2DEX2_MoveWord( u32 w0, u32 w1 ) -{ - switch (_SHIFTR( w0, 16, 8 )) - { - case G_MW_GENSTAT: - gSPSetStatus(_SHIFTR(w0, 0, 16), w1); - break; - default: - F3DEX2_MoveWord(w0, w1); - break; - } -} - -void S2DEX2_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3DEX2 ); - resetObjMtx(); - - GBI.PCStackSize = 18; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3DEX2_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_BG_1CYC, S2DEX2_BG_1CYC, S2DEX_BG_1Cyc ); - GBI_SetGBI( G_BG_COPY, S2DEX2_BG_COPY, S2DEX_BG_Copy ); - GBI_SetGBI( G_OBJ_RECTANGLE, S2DEX2_OBJ_RECTANGLE, S2DEX_Obj_Rectangle ); - GBI_SetGBI( G_OBJ_SPRITE, S2DEX2_OBJ_SPRITE, S2DEX_Obj_Sprite ); - GBI_SetGBI( G_OBJ_MOVEMEM, S2DEX2_OBJ_MOVEMEM, S2DEX_Obj_MoveMem ); - GBI_SetGBI( G_DL, F3DEX2_DL, F3D_DList ); - GBI_SetGBI( G_SELECT_DL, S2DEX2_SELECT_DL, S2DEX_Select_DL ); - GBI_SetGBI( G_OBJ_RENDERMODE, S2DEX2_OBJ_RENDERMODE, S2DEX_Obj_RenderMode ); - GBI_SetGBI( G_OBJ_RECTANGLE_R, S2DEX2_OBJ_RECTANGLE_R, S2DEX_Obj_Rectangle_R ); - GBI_SetGBI( G_OBJ_LOADTXTR, S2DEX2_OBJ_LOADTXTR, S2DEX_Obj_LoadTxtr ); - GBI_SetGBI( G_OBJ_LDTX_SPRITE, S2DEX2_OBJ_LDTX_SPRITE, S2DEX_Obj_LdTx_Sprite ); - GBI_SetGBI( G_OBJ_LDTX_RECT, S2DEX2_OBJ_LDTX_RECT, S2DEX_Obj_LdTx_Rect ); - GBI_SetGBI( G_OBJ_LDTX_RECT_R, S2DEX2_OBJ_LDTX_RECT_R, S2DEX_Obj_LdTx_Rect_R ); - GBI_SetGBI( G_MOVEWORD, F3DEX2_MOVEWORD, S2DEX2_MoveWord ); - GBI_SetGBI( G_SETOTHERMODE_H, F3DEX2_SETOTHERMODE_H, F3DEX2_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, F3DEX2_SETOTHERMODE_L, F3DEX2_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, F3DEX2_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_RDPHALF_0, S2DEX2_RDPHALF_0, S2DEX_RDPHalf_0 ); - GBI_SetGBI( G_RDPHALF_1, F3DEX2_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3DEX2_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_LOAD_UCODE, F3DEX2_LOAD_UCODE, F3DEX_Load_uCode ); -} - diff --git a/GLideN64/src/uCodes/S2DEX2.h b/GLideN64/src/uCodes/S2DEX2.h deleted file mode 100644 index c693776..0000000 --- a/GLideN64/src/uCodes/S2DEX2.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef S2DEX2_H -#define S2DEX2_H - -void S2DEX2_Init(); - -#endif diff --git a/GLideN64/src/uCodes/T3DUX.cpp b/GLideN64/src/uCodes/T3DUX.cpp deleted file mode 100644 index 0241efb..0000000 --- a/GLideN64/src/uCodes/T3DUX.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "T3DUX.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "DisplayWindow.h" - -/******************T3DUX microcode*************************/ - -struct T3DUXGlobState -{ - u16 pad0; - u16 perspNorm; - u32 flag; - u32 othermode0; - u32 othermode1; - u32 segBases[16]; - /* the viewport to use */ - s16 vsacle1; - s16 vsacle0; - s16 vsacle3; - s16 vsacle2; - s16 vtrans1; - s16 vtrans0; - s16 vtrans3; - s16 vtrans2; - u32 rdpCmds; -}; - -struct T3DUXState -{ - u32 renderState; /* render state */ - - u8 dmemVtxAddr; - u8 vtxCount; /* number of verts */ - u8 texmode; - u8 geommode; - - u8 dmemVtxAttribsAddr; - u8 attribsCount; /* number of colors and texture coords */ - u8 matrixFlag; - u8 triCount; /* how many tris? */ - - u32 rdpCmds; /* ptr (segment address) to RDP DL */ - u32 othermode0; - u32 othermode1; -}; - - -struct T3DUXTriN -{ - u8 flag, v2, v1, v0; /* flag is which one for flat shade */ - u8 pal, v2tex, v1tex, v0tex; /* indexes in texture coords list */ -}; - -static u32 t32uxSetTileW0 = 0; -static u32 t32uxSetTileW1 = 0; - -static -void T3DUX_ProcessRDP(u32 _cmds) -{ - u32 addr = RSP_SegmentToPhysical(_cmds) >> 2; - if (addr != 0) { - RSP.LLE = true; - u32 w0 = ((u32*)RDRAM)[addr++]; - u32 w1 = ((u32*)RDRAM)[addr++]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - while (w0 + w1 != 0) { - GBI.cmd[RSP.cmd]( w0, w1 ); - w0 = ((u32*)RDRAM)[addr++]; - w1 = ((u32*)RDRAM)[addr++]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - switch (RSP.cmd) { - case G_TEXRECT: - case G_TEXRECTFLIP: - RDP.w2 = ((u32*)RDRAM)[addr++]; - RDP.w3 = ((u32*)RDRAM)[addr++]; - break; - case G_SETTILE: - t32uxSetTileW0 = w0; - t32uxSetTileW1 = w1; - break; - } - } - RSP.LLE = false; - } -} - -static -void T3DUX_LoadGlobState(u32 pgstate) -{ - const u32 addr = RSP_SegmentToPhysical(pgstate); - T3DUXGlobState *gstate = (T3DUXGlobState*)&RDRAM[addr]; - const u32 w0 = gstate->othermode0; - const u32 w1 = gstate->othermode1; - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 - - for (int s = 0; s < 16; ++s) - gSPSegment(s, gstate->segBases[s] & 0x00FFFFFF); - - gSPViewport(pgstate + 80); - - T3DUX_ProcessRDP(gstate->rdpCmds); -} - -static -void T3DUX_LoadObject(u32 pstate, u32 pvtx, u32 ptri, u32 pcol) -{ - T3DUXState *ostate = (T3DUXState*)&RDRAM[RSP_SegmentToPhysical(pstate)]; - // TODO: fix me - const u32 tile = 0; - gSP.texture.tile = tile; - gSP.textureTile[0] = &gDP.tiles[tile]; - gSP.textureTile[1] = &gDP.tiles[(tile + 1) & 7]; - gSP.texture.scales = 1.0f; - gSP.texture.scalet = 1.0f; - - { - const u32 w0 = ostate->othermode0; - const u32 w1 = ostate->othermode1; - gDPSetOtherMode( - _SHIFTR(w0, 0, 24), // mode0 - w1); // mode1 - } - - if ((ostate->matrixFlag & 1) == 0) //load matrix - gSPForceMatrix(pstate + sizeof(T3DUXState)); - - gSPClearGeometryMode(G_LIGHTING | G_FOG); - gSPSetGeometryMode(ostate->renderState | G_SHADING_SMOOTH | G_SHADE | G_ZBUFFER | G_CULL_BACK); - - if (pvtx != 0) //load vtx - gSPT3DUXVertex(pvtx, ostate->vtxCount, pcol); - - T3DUX_ProcessRDP(ostate->rdpCmds); - - if (ptri == 0) - return; - - GraphicsDrawer & drawer = dwnd().getDrawer(); - const u32 coladdr = RSP_SegmentToPhysical(pcol); - const T3DUXTriN * tri = (const T3DUXTriN*)&RDRAM[RSP_SegmentToPhysical(ptri)]; - u8 pal = _SHIFTR(t32uxSetTileW1, 20, 4); - t32uxSetTileW1 &= 0xFF0FFFFF; - const bool flatShading = (ostate->geommode & 0x0F) == 0; - const bool texturing = ostate->texmode != 1; - f32 flatr, flatg, flatb, flata; - - drawer.setDMAVerticesSize(ostate->triCount * 3); - SPVertex * pVtx = drawer.getDMAVerticesData(); - for (int t = 0; t < ostate->triCount; ++t, ++tri) { - if (texturing && tri->pal != 0) { - const u32 w1 = t32uxSetTileW1 | (tri->pal << 20); - const u32 newPal = _SHIFTR(w1, 20, 4); - if (pal != newPal) { - drawer.drawDMATriangles(static_cast<u32>(pVtx - drawer.getDMAVerticesData())); - pVtx = drawer.getDMAVerticesData(); - pal = newPal; - RDP_SetTile(t32uxSetTileW0, w1); - } - } - - if (tri->v0 >= ostate->vtxCount || tri->v1 >= ostate->vtxCount || tri->v2 >= ostate->vtxCount) - continue; - - if (drawer.isClipped(tri->v0, tri->v1, tri->v2)) - continue; - - if (flatShading) { - struct T3DUXColor - { - u8 a; - u8 b; - u8 g; - u8 r; - } color = *(T3DUXColor*)&RDRAM[coladdr + ((tri->flag << 2) & 0x03FC)]; - flata = _FIXED2FLOAT(color.a, 8); - flatb = _FIXED2FLOAT(color.b, 8); - flatg = _FIXED2FLOAT(color.g, 8); - flatr = _FIXED2FLOAT(color.r, 8); - } - - u32 vtxIdx[3] = { tri->v0, tri->v1, tri->v2 }; - u32 texIdx[3] = { tri->v0tex, tri->v1tex, tri->v2tex }; - for (u32 v = 0; v < 3; ++v) { - *pVtx = drawer.getVertex(vtxIdx[v]); - - if (texturing) { - u32 texcoords = *(const u32*)&RDRAM[coladdr + (texIdx[v] << 2)]; - pVtx->s = _FIXED2FLOAT(_SHIFTR(texcoords, 16, 16), 5); - pVtx->t = _FIXED2FLOAT(_SHIFTR(texcoords, 0, 16), 5); - } else { - pVtx->s = 0.0f; - pVtx->t = 0.0f; - } - - if (flatShading) { - pVtx->r = flatr; - pVtx->g = flatg; - pVtx->b = flatb; - pVtx->a = flata; - } - - ++pVtx; - } - } - - drawer.drawDMATriangles(static_cast<u32>(pVtx - drawer.getDMAVerticesData())); -} - -void RunT3DUX() -{ - while (true) { - u32 addr = RSP.PC[RSP.PCi] >> 2; - const u32 pgstate = ((u32*)RDRAM)[addr++]; - const u32 pstate = ((u32*)RDRAM)[addr++]; - const u32 pvtx = ((u32*)RDRAM)[addr++]; - const u32 ptri = ((u32*)RDRAM)[addr++]; - const u32 pcol = ((u32*)RDRAM)[addr++]; - //const u32 pstore = ((u32*)RDRAM)[addr]; - if (pstate == 0) { - RSP.halt = true; - break; - } - if (pgstate != 0) - T3DUX_LoadGlobState(pgstate); - T3DUX_LoadObject(pstate, pvtx, ptri, pcol); - // Go to the next instruction - RSP.PC[RSP.PCi] += 24; - }; -} diff --git a/GLideN64/src/uCodes/T3DUX.h b/GLideN64/src/uCodes/T3DUX.h deleted file mode 100644 index 587fde4..0000000 --- a/GLideN64/src/uCodes/T3DUX.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef T3DUX_H -#define T3DUX_H - -void RunT3DUX(); - -#endif // T3DUX_H diff --git a/GLideN64/src/uCodes/Turbo3D.cpp b/GLideN64/src/uCodes/Turbo3D.cpp deleted file mode 100644 index 2b33637..0000000 --- a/GLideN64/src/uCodes/Turbo3D.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "Turbo3D.h" -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "DisplayWindow.h" - -/******************Turbo3D microcode*************************/ - -#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */ -#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */ -#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */ - -struct T3DGlobState -{ - u16 pad0; - u16 perspNorm; - u32 flag; - u32 othermode0; - u32 othermode1; - u32 segBases[16]; - /* the viewport to use */ - s16 vsacle1; - s16 vsacle0; - s16 vsacle3; - s16 vsacle2; - s16 vtrans1; - s16 vtrans0; - s16 vtrans3; - s16 vtrans2; - u32 rdpCmds; -}; - -struct T3DState -{ - u32 renderState; /* render state */ - u32 textureState; /* texture state */ - u8 flag; - u8 triCount; /* how many tris? */ - u8 vtxV0; /* where to load verts? */ - u8 vtxCount; /* how many verts? */ - u32 rdpCmds; /* ptr (segment address) to RDP DL */ - u32 othermode0; - u32 othermode1; -}; - -struct T3DTriN -{ - u8 flag, v2, v1, v0; /* flag is which one for flat shade */ -}; - -struct VtxOut { - s16 yscrn; /* x,y screen coordinates are SSSS10.2 */ - s16 xscrn; - s32 zscrn; /* z screen is S15.16 */ - - s16 t; - s16 s; - - union { - struct - { - u8 a; - u8 b; - u8 g; - u8 r; - } color; - struct - { - s8 a; - s8 z; // b - s8 y; //g - s8 x; //r - } normal; - }; -}; - -static -void Turbo3D_ProcessRDP(u32 _cmds) -{ - u32 addr = RSP_SegmentToPhysical(_cmds) >> 2; - if (addr != 0) { - RSP.LLE = true; - u32 w0 = ((u32*)RDRAM)[addr++]; - u32 w1 = ((u32*)RDRAM)[addr++]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - while (w0 + w1 != 0) { - GBI.cmd[RSP.cmd]( w0, w1 ); - w0 = ((u32*)RDRAM)[addr++]; - w1 = ((u32*)RDRAM)[addr++]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - if (RSP.cmd == G_TEXRECT || RSP.cmd == G_TEXRECTFLIP) { - RDP.w2 = ((u32*)RDRAM)[addr++]; - RDP.w3 = ((u32*)RDRAM)[addr++]; - } - } - RSP.LLE = false; - } -} - -static -void Turbo3D_LoadGlobState(u32 pgstate) -{ - const u32 addr = RSP_SegmentToPhysical(pgstate); - T3DGlobState *gstate = (T3DGlobState*)&RDRAM[addr]; - const u32 w0 = gstate->othermode0; - const u32 w1 = gstate->othermode1; - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 - - for (int s = 0; s < 16; ++s) - gSPSegment(s, gstate->segBases[s] & 0x00FFFFFF); - - gSPViewport(pgstate + 80); - - Turbo3D_ProcessRDP(gstate->rdpCmds); -} - -static -void Turbo3D_LoadObject(u32 pstate, u32 pvtx, u32 ptri) -{ - u32 addr = RSP_SegmentToPhysical(pstate); - T3DState *ostate = (T3DState*)&RDRAM[addr]; - const u32 tile = (ostate->textureState)&7; - gSP.texture.tile = tile; - gSP.textureTile[0] = &gDP.tiles[tile]; - gSP.textureTile[1] = &gDP.tiles[(tile + 1) & 7]; - gSP.texture.scales = 1.0f; - gSP.texture.scalet = 1.0f; - - const u32 w0 = ostate->othermode0; - const u32 w1 = ostate->othermode1; - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 - - if (ostate->flag != GT_FLAG_NOMTX) - gSPForceMatrix(pstate + sizeof(T3DState)); - - gSPClearGeometryMode(G_LIGHTING | G_FOG); - gSPSetGeometryMode(ostate->renderState | G_SHADING_SMOOTH | G_SHADE | G_ZBUFFER | G_CULL_BACK); - - if (pvtx != 0) - gSPVertex(pvtx, ostate->vtxCount, ostate->vtxV0); - - Turbo3D_ProcessRDP(ostate->rdpCmds); - - GraphicsDrawer & drawer = dwnd().getDrawer(); - if (ptri != 0) { - addr = RSP_SegmentToPhysical(ptri); - if (ostate->flag != GT_FLAG_NO_XFM) { - for (int t = 0; t < ostate->triCount; ++t) { - T3DTriN * tri = (T3DTriN*)&RDRAM[addr]; - addr += 4; - gSPTriangle(tri->v0, tri->v1, tri->v2); - } - drawer.drawTriangles(); - } else { - const u32 vtxAddr = RSP_SegmentToPhysical(pvtx); - const VtxOut *pVertices = (VtxOut*)&RDRAM[vtxAddr]; - for (u32 i = 0; i < ostate->vtxCount; ++i) { - SPVertex & vtx = drawer.getVertex(i); - vtx.x = _FIXED2FLOAT(pVertices[i].xscrn, 2); - vtx.y = _FIXED2FLOAT(pVertices[i].yscrn, 2); - vtx.z = _FIXED2FLOAT(pVertices[i].zscrn, 16); - vtx.w = 1.0f; - } - for (int t = 0; t < ostate->triCount; ++t) { - T3DTriN * tri = (T3DTriN*)&RDRAM[addr]; - addr += 4; - u32 vtxIdx[3] = { tri->v0, tri->v1, tri->v2 }; - for (u32 i = 0; i < 3; ++i) { - SPVertex & vtx = drawer.getCurrentDMAVertex(); - vtx = drawer.getVertex(vtxIdx[i]); - } - } - drawer.drawScreenSpaceTriangle(drawer.getDMAVerticesCount(), graphics::drawmode::TRIANGLES); - } - } -} - -void RunTurbo3D() -{ - while (true) { - u32 addr = RSP.PC[RSP.PCi] >> 2; - const u32 pgstate = ((u32*)RDRAM)[addr++]; - const u32 pstate = ((u32*)RDRAM)[addr++]; - const u32 pvtx = ((u32*)RDRAM)[addr++]; - const u32 ptri = ((u32*)RDRAM)[addr]; - if (pstate == 0) { - RSP.halt = true; - break; - } - if (pgstate != 0) - Turbo3D_LoadGlobState(pgstate); - Turbo3D_LoadObject(pstate, pvtx, ptri); - // Go to the next instruction - RSP.PC[RSP.PCi] += 16; - }; -} diff --git a/GLideN64/src/uCodes/Turbo3D.h b/GLideN64/src/uCodes/Turbo3D.h deleted file mode 100644 index 4677fb5..0000000 --- a/GLideN64/src/uCodes/Turbo3D.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef TURBO3D_H -#define TURBO3D_H - -void RunTurbo3D(); - -#endif // TURBO3D_H diff --git a/GLideN64/src/uCodes/ZSort.cpp b/GLideN64/src/uCodes/ZSort.cpp deleted file mode 100644 index d7d667c..0000000 --- a/GLideN64/src/uCodes/ZSort.cpp +++ /dev/null @@ -1,603 +0,0 @@ -#include <assert.h> -#include <math.h> -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "Log.h" -#include "F3D.h" -#include "ZSort.h" -#include "3DMath.h" -#include "DisplayWindow.h" - -#define GZM_USER0 0 -#define GZM_USER1 2 -#define GZM_MMTX 4 -#define GZM_PMTX 6 -#define GZM_MPMTX 8 -#define GZM_OTHERMODE 10 -#define GZM_VIEWPORT 12 -#define GZF_LOAD 0 -#define GZF_SAVE 1 - -#define ZH_NULL 0 -#define ZH_SHTRI 1 -#define ZH_TXTRI 2 -#define ZH_SHQUAD 3 -#define ZH_TXQUAD 4 - -struct ZSORTRDP -{ - f32 view_scale[2]; - f32 view_trans[2]; -} zSortRdp = {{0, 0}, {0, 0}}; - -void ZSort_RDPCMD( u32, u32 _w1 ) -{ - u32 addr = RSP_SegmentToPhysical(_w1) >> 2; - if (addr) { - RSP.LLE = true; - while(true) - { - u32 w0 = ((u32*)RDRAM)[addr++]; - RSP.cmd = _SHIFTR( w0, 24, 8 ); - if (RSP.cmd == 0xDF) - break; - u32 w1 = ((u32*)RDRAM)[addr++]; - if (RSP.cmd == G_TEXRECT || RSP.cmd == G_TEXRECTFLIP) { - addr++; - RDP.w2 = ((u32*)RDRAM)[addr++]; - addr++; - RDP.w3 = ((u32*)RDRAM)[addr++]; - } - GBI.cmd[RSP.cmd]( w0, w1 ); - }; - RSP.LLE = false; - } -} - -int Calc_invw (int _w) { - if (_w == 0) - return 0x7FFFFFFF; - return 0x7FFFFFFF / _w; -} - -static -void ZSort_DrawObject (u8 * _addr, u32 _type) -{ - u32 textured = 0, vnum = 0, vsize = 0; - switch (_type) { - case ZH_NULL: - textured = vnum = vsize = 0; - break; - case ZH_SHTRI: - textured = 0; - vnum = 3; - vsize = 8; - break; - case ZH_TXTRI: - textured = 1; - vnum = 3; - vsize = 16; - break; - case ZH_SHQUAD: - textured = 0; - vnum = 4; - vsize = 8; - break; - case ZH_TXQUAD: - textured = 1; - vnum = 4; - vsize = 16; - break; - } - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(vnum); - SPVertex * pVtx = drawer.getDMAVerticesData(); - for (u32 i = 0; i < vnum; ++i) { - SPVertex & vtx = pVtx[i]; - vtx.x = _FIXED2FLOAT(((s16*)_addr)[0 ^ 1], 2); - vtx.y = _FIXED2FLOAT(((s16*)_addr)[1 ^ 1], 2); - vtx.z = 0.0f; - vtx.r = _addr[4^3] * 0.0039215689f; - vtx.g = _addr[5^3] * 0.0039215689f; - vtx.b = _addr[6^3] * 0.0039215689f; - vtx.a = _addr[7^3] * 0.0039215689f; - vtx.flag = 0; - vtx.HWLight = 0; - vtx.clip = 0; - if (textured != 0) { - if (gDP.otherMode.texturePersp != 0) { - vtx.s = _FIXED2FLOAT(((s16*)_addr)[4 ^ 1], 5); - vtx.t = _FIXED2FLOAT(((s16*)_addr)[5 ^ 1], 5); - } else { - vtx.s = _FIXED2FLOAT(((s16*)_addr)[4 ^ 1], 6); - vtx.t = _FIXED2FLOAT(((s16*)_addr)[5 ^ 1], 6); - } - vtx.w = Calc_invw(((int*)_addr)[3]) / 31.0f; - } else - vtx.w = 1.0f; - - _addr += vsize; - } - drawer.drawScreenSpaceTriangle(vnum); -} - -static -u32 ZSort_LoadObject (u32 _zHeader, u32 * _pRdpCmds) -{ - const u32 type = _zHeader & 7; - u8 * addr = RDRAM + (_zHeader&0xFFFFFFF8); - u32 w1; - switch (type) { - case ZH_SHTRI: - case ZH_SHQUAD: - { - w1 = ((u32*)addr)[1]; - if (w1 != _pRdpCmds[0]) { - _pRdpCmds[0] = w1; - ZSort_RDPCMD (0, w1); - } - ZSort_DrawObject(addr + 8, type); - } - break; - case ZH_NULL: - case ZH_TXTRI: - case ZH_TXQUAD: - { - w1 = ((u32*)addr)[1]; - if (w1 != _pRdpCmds[0]) { - _pRdpCmds[0] = w1; - ZSort_RDPCMD (0, w1); - } - w1 = ((u32*)addr)[2]; - if (w1 != _pRdpCmds[1]) { - ZSort_RDPCMD (0, w1); - _pRdpCmds[1] = w1; - } - w1 = ((u32*)addr)[3]; - if (w1 != _pRdpCmds[2]) { - ZSort_RDPCMD (0, w1); - _pRdpCmds[2] = w1; - } - if (type != 0) { - ZSort_DrawObject(addr + 16, type); - } - } - break; - } - return RSP_SegmentToPhysical(((u32*)addr)[0]); -} - -void ZSort_Obj( u32 _w0, u32 _w1 ) -{ - u32 rdpcmds[3] = {0, 0, 0}; - u32 cmd1 = _w1; - u32 zHeader = RSP_SegmentToPhysical(_w0); - while (zHeader) - zHeader = ZSort_LoadObject(zHeader, rdpcmds); - zHeader = RSP_SegmentToPhysical(cmd1); - while (zHeader) - zHeader = ZSort_LoadObject(zHeader, rdpcmds); -} - -void ZSort_Interpolate( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_Interpolate Ignored"); -} - -void ZSort_XFMLight( u32 _w0, u32 _w1 ) -{ - int mid = _SHIFTR(_w0, 0, 8); - gSPNumLights(1 + _SHIFTR(_w1, 12, 8)); - u32 addr = -1024 + _SHIFTR(_w1, 0, 12); - - assert(mid == GZM_MMTX); -/* - M44 *m; - switch (mid) { - case 4: - m = (M44*)rdp.model; - break; - case 6: - m = (M44*)rdp.proj; - break; - case 8: - m = (M44*)gSP.matrix.combined; - break; - } -*/ - - - gSP.lights.rgb[gSP.numLights][R] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+0)^3], 8 ); - gSP.lights.rgb[gSP.numLights][G] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+1)^3], 8 ); - gSP.lights.rgb[gSP.numLights][B] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+2)^3], 8 ); - addr += 8; - u32 i; - for (i = 0; i < gSP.numLights; ++i) - { - gSP.lights.rgb[i][R] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+0)^3], 8 ); - gSP.lights.rgb[i][G] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+1)^3], 8 ); - gSP.lights.rgb[i][B] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+2)^3], 8 ); - gSP.lights.xyz[i][X] = (f32)(((s8*)DMEM)[(addr+8)^3]); - gSP.lights.xyz[i][Y] = (f32)(((s8*)DMEM)[(addr+9)^3]); - gSP.lights.xyz[i][Z] = (f32)(((s8*)DMEM)[(addr+10)^3]); - addr += 24; - } - for (i = 0; i < 2; i++) - { - gSP.lookat.xyz[i][X] = (f32)(((s8*)DMEM)[(addr+8)^3]); - gSP.lookat.xyz[i][Y] = (f32)(((s8*)DMEM)[(addr+9)^3]); - gSP.lookat.xyz[i][Z] = (f32)(((s8*)DMEM)[(addr+10)^3]); - gSP.lookatEnable = (i == 0) || (gSP.lookat.xyz[i][X] != 0 && gSP.lookat.xyz[i][Y] != 0); - addr += 24; - } -} - -void ZSort_LightingL( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_LightingL Ignored"); -} - - -void ZSort_Lighting( u32 _w0, u32 _w1 ) -{ - u32 csrs = -1024 + _SHIFTR(_w0, 12, 12); - u32 nsrs = -1024 + _SHIFTR(_w0, 0, 12); - u32 num = 1 + _SHIFTR(_w1, 24, 8); - u32 cdest = -1024 + _SHIFTR(_w1, 12, 12); - u32 tdest = -1024 + _SHIFTR(_w1, 0, 12); - int use_material = (csrs != 0x0ff0); - tdest >>= 1; - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(num); - SPVertex * pVtx = drawer.getDMAVerticesData(); - for (u32 i = 0; i < num; i++) { - SPVertex & vtx = pVtx[i]; - - vtx.nx = ((s8*)DMEM)[(nsrs++)^3]; - vtx.ny = ((s8*)DMEM)[(nsrs++)^3]; - vtx.nz = ((s8*)DMEM)[(nsrs++)^3]; - TransformVectorNormalize( &vtx.nx, gSP.matrix.modelView[gSP.matrix.modelViewi] ); - gSPLightVertex(vtx); - f32 fLightDir[3] = {vtx.nx, vtx.ny, vtx.nz}; - TransformVectorNormalize(fLightDir, gSP.matrix.projection); - f32 x, y; - if (gSP.lookatEnable) { - x = DotProduct(gSP.lookat.xyz[0], fLightDir); - y = DotProduct(gSP.lookat.xyz[1], fLightDir); - } else { - x = fLightDir[0]; - y = fLightDir[1]; - } - vtx.s = (x + 1.0f) * 512.0f; - vtx.t = (y + 1.0f) * 512.0f; - - vtx.a = 1.0f; - if (use_material) - { - vtx.r *= _FIXED2FLOATCOLOR(DMEM[(csrs++)^3], 8 ); - vtx.g *= _FIXED2FLOATCOLOR(DMEM[(csrs++)^3], 8 ); - vtx.b *= _FIXED2FLOATCOLOR(DMEM[(csrs++)^3], 8 ); - vtx.a = _FIXED2FLOATCOLOR(DMEM[(csrs++)^3], 8 ); - } - DMEM[(cdest++)^3] = (u8)(vtx.r * 255.0f); - DMEM[(cdest++)^3] = (u8)(vtx.g * 255.0f); - DMEM[(cdest++)^3] = (u8)(vtx.b * 255.0f); - DMEM[(cdest++)^3] = (u8)(vtx.a * 255.0f); - ((s16*)DMEM)[(tdest++)^1] = (s16)(vtx.s * 32.0f); - ((s16*)DMEM)[(tdest++)^1] = (s16)(vtx.t * 32.0f); - } -} - -void ZSort_MTXRNSP( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_MTXRNSP Ignored"); -} - -void ZSort_MTXCAT(u32 _w0, u32 _w1) -{ - M44 *s = nullptr; - M44 *t = nullptr; - u32 S = _SHIFTR(_w0, 0, 4); - u32 T = _SHIFTR(_w1, 16, 4); - u32 D = _SHIFTR(_w1, 0, 4); - switch (S) { - case GZM_MMTX: - s = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - case GZM_PMTX: - s = (M44*)gSP.matrix.projection; - break; - case GZM_MPMTX: - s = (M44*)gSP.matrix.combined; - break; - } - switch (T) { - case GZM_MMTX: - t = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - case GZM_PMTX: - t = (M44*)gSP.matrix.projection; - break; - case GZM_MPMTX: - t = (M44*)gSP.matrix.combined; - break; - } - assert(s != nullptr && t != nullptr); - f32 m[4][4]; - MultMatrix(*s, *t, m); - - switch (D) { - case GZM_MMTX: - memcpy (gSP.matrix.modelView[gSP.matrix.modelViewi], m, 64);; - break; - case GZM_PMTX: - memcpy (gSP.matrix.projection, m, 64);; - break; - case GZM_MPMTX: - memcpy (gSP.matrix.combined, m, 64);; - break; - } -} - -void ZSort_MultMPMTX( u32 _w0, u32 _w1 ) -{ - int num = 1 + _SHIFTR(_w1, 24, 8); - int src = -1024 + _SHIFTR(_w1, 12, 12); - int dst = -1024 + _SHIFTR(_w1, 0, 12); - s16 * saddr = (s16*)(DMEM+src); - zSortVDest * daddr = (zSortVDest*)(DMEM+dst); - int idx = 0; - zSortVDest v; - memset(&v, 0, sizeof(zSortVDest)); - for (int i = 0; i < num; ++i) { - s16 sx = saddr[(idx++)^1]; - s16 sy = saddr[(idx++)^1]; - s16 sz = saddr[(idx++)^1]; - f32 x = sx*gSP.matrix.combined[0][0] + sy*gSP.matrix.combined[1][0] + sz*gSP.matrix.combined[2][0] + gSP.matrix.combined[3][0]; - f32 y = sx*gSP.matrix.combined[0][1] + sy*gSP.matrix.combined[1][1] + sz*gSP.matrix.combined[2][1] + gSP.matrix.combined[3][1]; - f32 z = sx*gSP.matrix.combined[0][2] + sy*gSP.matrix.combined[1][2] + sz*gSP.matrix.combined[2][2] + gSP.matrix.combined[3][2]; - f32 w = sx*gSP.matrix.combined[0][3] + sy*gSP.matrix.combined[1][3] + sz*gSP.matrix.combined[2][3] + gSP.matrix.combined[3][3]; - v.sx = (s16)(zSortRdp.view_trans[0] + x / w * zSortRdp.view_scale[0]); - v.sy = (s16)(zSortRdp.view_trans[1] + y / w * zSortRdp.view_scale[1]); - - v.xi = (s16)x; - v.yi = (s16)y; - v.wi = (s16)w; - v.invw = Calc_invw((int)(w * 31.0)); - - if (w < 0.0f) - v.fog = 0; - else { - int fog = (int)(z / w * gSP.fog.multiplier + gSP.fog.offset); - if (fog > 255) - fog = 255; - v.fog = (fog >= 0) ? (u8)fog : 0; - } - - v.cc = 0; - if (x < -w) v.cc |= 0x10; - if (x > w) v.cc |= 0x01; - if (y < -w) v.cc |= 0x20; - if (y > w) v.cc |= 0x02; - if (w < 0.1f) v.cc |= 0x04; - - daddr[i] = v; - } -} - -void ZSort_LinkSubDL( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_LinkSubDL Ignored"); -} - -void ZSort_SetSubDL( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_SetSubDL Ignored"); -} - -void ZSort_WaitSignal( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_WaitSignal Ignored"); -} - -void ZSort_SendSignal( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSort_SendSignal Ignored"); -} - -static -void ZSort_SetTexture() -{ - gSP.texture.scales = 1.0f; - gSP.texture.scalet = 1.0f; - gSP.texture.level = 0; - gSP.texture.on = 1; - gSP.texture.tile = 0; - - gSPSetGeometryMode(G_SHADING_SMOOTH | G_SHADE); -} - -void ZSort_MoveMem( u32 _w0, u32 _w1 ) -{ - int idx = _w0 & 0x0E; - int ofs = _SHIFTR(_w0, 6, 9)<<3; - int len = 1 + (_SHIFTR(_w0, 15, 9)<<3); - int flag = _w0 & 0x01; - u32 addr = RSP_SegmentToPhysical(_w1); - switch (idx) - { - - case GZF_LOAD: //save/load - if (flag == 0) { - int dmem_addr = (idx<<3) + ofs; - memcpy(DMEM + dmem_addr, RDRAM + addr, len); - } else { - int dmem_addr = (idx<<3) + ofs; - memcpy(RDRAM + addr, DMEM + dmem_addr, len); - } - break; - - case GZM_MMTX: // model matrix - RSP_LoadMatrix(gSP.matrix.modelView[gSP.matrix.modelViewi], addr); - gSP.changed |= CHANGED_MATRIX; - break; - - case GZM_PMTX: // projection matrix - RSP_LoadMatrix(gSP.matrix.projection, addr); - gSP.changed |= CHANGED_MATRIX; - break; - - case GZM_MPMTX: // combined matrix - RSP_LoadMatrix(gSP.matrix.combined, addr); - gSP.changed &= ~CHANGED_MATRIX; - break; - - case GZM_OTHERMODE: - LOG(LOG_VERBOSE, "MoveMem Othermode Ignored"); - break; - - case GZM_VIEWPORT: // VIEWPORT - { - u32 a = addr >> 1; - const f32 scale_x = _FIXED2FLOAT( *(s16*)&RDRAM[(a+0)^1], 2 ); - const f32 scale_y = _FIXED2FLOAT( *(s16*)&RDRAM[(a+1)^1], 2 ); - const f32 scale_z = _FIXED2FLOAT( *(s16*)&RDRAM[(a+2)^1], 10 ); - const s16 fm = ((s16*)RDRAM)[(a+3)^1]; - const f32 trans_x = _FIXED2FLOAT( *(s16*)&RDRAM[(a+4)^1], 2 ); - const f32 trans_y = _FIXED2FLOAT( *(s16*)&RDRAM[(a+5)^1], 2 ); - const f32 trans_z = _FIXED2FLOAT( *(s16*)&RDRAM[(a+6)^1], 10 ); - const s16 fo = ((s16*)RDRAM)[(a+7)^1]; - gSPFogFactor(fm, fo); - - gSP.viewport.vscale[0] = scale_x; - gSP.viewport.vscale[1] = scale_y; - gSP.viewport.vscale[2] = scale_z; - gSP.viewport.vtrans[0] = trans_x; - gSP.viewport.vtrans[1] = trans_y; - gSP.viewport.vtrans[2] = trans_z; - - gSP.viewport.x = gSP.viewport.vtrans[0] - gSP.viewport.vscale[0]; - gSP.viewport.y = gSP.viewport.vtrans[1] - gSP.viewport.vscale[1]; - gSP.viewport.width = gSP.viewport.vscale[0] * 2; - gSP.viewport.height = gSP.viewport.vscale[1] * 2; - gSP.viewport.nearz = gSP.viewport.vtrans[2] - gSP.viewport.vscale[2]; - gSP.viewport.farz = (gSP.viewport.vtrans[2] + gSP.viewport.vscale[2]) ; - - zSortRdp.view_scale[0] = scale_x*4.0f; - zSortRdp.view_scale[1] = scale_y*4.0f; - zSortRdp.view_trans[0] = trans_x*4.0f; - zSortRdp.view_trans[1] = trans_y*4.0f; - - gSP.changed |= CHANGED_VIEWPORT; - - ZSort_SetTexture(); - } - break; - - default: - LOG(LOG_ERROR, "ZSort_MoveMem UNKNOWN %d", idx); - } - -} - -void SZort_SetScissor(u32 _w0, u32 _w1) -{ - RDP_SetScissor(_w0, _w1); - - if ((gDP.scissor.lrx - gDP.scissor.ulx) > (zSortRdp.view_scale[0] - zSortRdp.view_trans[0])) - { - f32 w = (gDP.scissor.lrx - gDP.scissor.ulx) / 2.0f; - f32 h = (gDP.scissor.lry - gDP.scissor.uly) / 2.0f; - - gSP.viewport.vscale[0] = w; - gSP.viewport.vscale[1] = h; - gSP.viewport.vtrans[0] = w; - gSP.viewport.vtrans[1] = h; - - gSP.viewport.x = gSP.viewport.vtrans[0] - gSP.viewport.vscale[0]; - gSP.viewport.y = gSP.viewport.vtrans[1] - gSP.viewport.vscale[1]; - gSP.viewport.width = gSP.viewport.vscale[0] * 2; - gSP.viewport.height = gSP.viewport.vscale[1] * 2; - - zSortRdp.view_scale[0] = w * 4.0f; - zSortRdp.view_scale[1] = h * 4.0f; - zSortRdp.view_trans[0] = w * 4.0f; - zSortRdp.view_trans[1] = h * 4.0f; - - gSP.changed |= CHANGED_VIEWPORT; - - ZSort_SetTexture(); - } -} - -#define G_ZS_ZOBJ 0x80 -#define G_ZS_RDPCMD 0x81 -#define G_ZS_SETOTHERMODE_H 0xE3 -#define G_ZS_SETOTHERMODE_L 0xE2 -#define G_ZS_ENDDL 0xDF -#define G_ZS_DL 0xDE -#define G_ZS_MOVEMEM 0xDC -#define G_ZS_MOVEWORD 0xDB -#define G_ZS_SENDSIGNAL 0xDA -#define G_ZS_WAITSIGNAL 0xD9 -#define G_ZS_SETSUBDL 0xD8 -#define G_ZS_LINKSUBDL 0xD7 -#define G_ZS_MULT_MPMTX 0xD6 -#define G_ZS_MTXCAT 0xD5 -#define G_ZS_MTXTRNSP 0xD4 -#define G_ZS_LIGHTING_L 0xD3 -#define G_ZS_LIGHTING 0xD2 -#define G_ZS_XFMLIGHT 0xD1 -#define G_ZS_INTERPOLATE 0xD0 - -u32 G_ZSENDSIGNAL, G_ZSETSUBDL, G_ZLINKSUBDL, G_ZMTXTRNSP; -u32 G_ZLIGHTING_L, G_ZXFMLIGHT, G_ZINTERPOLATE, G_ZSETSCISSOR; - -void ZSort_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_RESERVED0, F3D_RESERVED0, F3D_Reserved0 ); - GBI_SetGBI( G_RESERVED1, F3D_RESERVED1, F3D_Reserved1 ); - GBI_SetGBI( G_DL, G_ZS_DL, F3D_DList ); - GBI_SetGBI( G_RESERVED2, F3D_RESERVED2, F3D_Reserved2 ); - GBI_SetGBI( G_RESERVED3, F3D_RESERVED3, F3D_Reserved3 ); - - GBI_SetGBI( G_CULLDL, F3D_CULLDL, F3D_CullDL ); - GBI_SetGBI( G_MOVEWORD, G_ZS_MOVEWORD, F3D_MoveWord ); - GBI_SetGBI( G_TEXTURE, F3D_TEXTURE, F3D_Texture ); - GBI_SetGBI( G_ZSETSCISSOR, G_SETSCISSOR, SZort_SetScissor ); - GBI_SetGBI( G_SETOTHERMODE_H, G_ZS_SETOTHERMODE_H, F3D_SetOtherMode_H ); - GBI_SetGBI( G_SETOTHERMODE_L, G_ZS_SETOTHERMODE_L, F3D_SetOtherMode_L ); - GBI_SetGBI( G_ENDDL, G_ZS_ENDDL, F3D_EndDL ); - GBI_SetGBI( G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, F3D_SetGeometryMode ); - GBI_SetGBI( G_CLEARGEOMETRYMODE, F3D_CLEARGEOMETRYMODE, F3D_ClearGeometryMode ); - GBI_SetGBI( G_RDPHALF_1, F3D_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_RDPHALF_2, F3D_RDPHALF_2, F3D_RDPHalf_2 ); - GBI_SetGBI( G_RDPHALF_CONT, F3D_RDPHALF_CONT, F3D_RDPHalf_Cont ); - - GBI_SetGBI( G_ZOBJ, G_ZS_ZOBJ, ZSort_Obj ); - GBI_SetGBI( G_ZRDPCMD, G_ZS_RDPCMD, ZSort_RDPCMD ); - GBI_SetGBI( G_MOVEMEM, G_ZS_MOVEMEM, ZSort_MoveMem ); - GBI_SetGBI( G_ZSENDSIGNAL, G_ZS_SENDSIGNAL, ZSort_SendSignal ); - GBI_SetGBI( G_ZWAITSIGNAL, G_ZS_WAITSIGNAL, ZSort_WaitSignal ); - GBI_SetGBI( G_ZSETSUBDL, G_ZS_SETSUBDL, ZSort_SetSubDL ); - GBI_SetGBI( G_ZLINKSUBDL, G_ZS_LINKSUBDL, ZSort_LinkSubDL ); - GBI_SetGBI( G_ZMULT_MPMTX, G_ZS_MULT_MPMTX, ZSort_MultMPMTX ); - GBI_SetGBI( G_ZMTXCAT, G_ZS_MTXCAT, ZSort_MTXCAT ); - GBI_SetGBI( G_ZMTXTRNSP, G_ZS_MTXTRNSP, ZSort_MTXRNSP ); - GBI_SetGBI( G_ZLIGHTING_L, G_ZS_LIGHTING_L, ZSort_LightingL ); - GBI_SetGBI( G_ZLIGHTING, G_ZS_LIGHTING, ZSort_Lighting ); - GBI_SetGBI( G_ZXFMLIGHT, G_ZS_XFMLIGHT, ZSort_XFMLight ); - GBI_SetGBI( G_ZINTERPOLATE, G_ZS_INTERPOLATE, ZSort_Interpolate ); -} diff --git a/GLideN64/src/uCodes/ZSort.h b/GLideN64/src/uCodes/ZSort.h deleted file mode 100644 index fa91797..0000000 --- a/GLideN64/src/uCodes/ZSort.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ZSORT_H -#define ZSORT_H - -struct zSortVDest{ - s16 sy; - s16 sx; - s32 invw; - s16 yi; - s16 xi; - s16 wi; - u8 fog; - u8 cc; -}; - -typedef f32 M44[4][4]; - -void ZSort_Init(); -void ZSort_RDPCMD( u32, u32 _w1 ); -int Calc_invw( int _w ); - -#endif // ZSORT_H diff --git a/GLideN64/src/uCodes/ZSortBOSS.cpp b/GLideN64/src/uCodes/ZSortBOSS.cpp deleted file mode 100644 index 8b0d561..0000000 --- a/GLideN64/src/uCodes/ZSortBOSS.cpp +++ /dev/null @@ -1,924 +0,0 @@ -#include <assert.h> -#include <math.h> -#include "N64.h" -#include "RSP.h" -#include "RDP.h" -#include "gSP.h" -#include "gDP.h" -#include "Log.h" -#include "F3D.h" -#include "ZSort.h" -#include "3DMath.h" -#include "DisplayWindow.h" - -#define CLAMP(x, min, max) ((x > max) ? max : ((x < min) ? min: x)) -#define SATURATES8(x) ((x > 127) ? 127 : ((x < -128) ? -128: x)) - -#define ZH_NULL 0 -#define ZH_TXTRI 4 -#define ZH_TXQUAD 8 - -#define DEFAULT 0 -#define PROCESSED 1 - -struct ZSortBOSSState { - u32 maindl; - u32 subdl; - u32 updatemask[2]; - f32 view_scale[2]; - f32 view_trans[2]; - u32 rdpcmds[3]; - f32 invw_factor; - u8 fogtable[256]; - s16 table[8][8]; - bool waiting_for_signal; -}; - -struct ZSortBOSSState gstate; - -void ZSortBOSS_EndMainDL( u32, u32 ) -{ - if(gstate.subdl == PROCESSED) { - // is this really happening? - assert(0); - RSP.halt = true; - gstate.maindl = DEFAULT; - gstate.subdl = DEFAULT; - } - else { - gstate.maindl = PROCESSED; - - if((*REG.SP_STATUS & 0x80) == 0) { - // wait for sig0 - RSP.PC[RSP.PCi] -= 8; - RSP.infloop = true; - RSP.halt = true; - } - else { - // process sub dlist - RSP.PCi = 1; - *REG.SP_STATUS &= ~0x80; // clear sig0 - } - } - LOG(LOG_VERBOSE, "ZSortBOSS_EndMainDL"); -} - -void ZSortBOSS_EndSubDL( u32, u32 ) -{ - if(gstate.maindl == PROCESSED) { - RSP.halt = true; - gstate.maindl = DEFAULT; - gstate.subdl = DEFAULT; - } - else { - // is this really happening? - assert(0); - //process main dlist - RSP.PCi = 0; - gstate.subdl = PROCESSED; - } - LOG(LOG_VERBOSE, "ZSortBOSS_EndSubDL"); -} - -void ZSortBOSS_WaitSignal( u32 , u32 ) -{ - if(!gstate.waiting_for_signal) { - // *REG.MI_INTR |= MI_INTR_SP; - *REG.SP_STATUS &= ~0x300; // clear sig1 | sig2 - *REG.SP_STATUS |= 0x400; // set sig3 - } - - if((*REG.SP_STATUS & 0x400)) { - // wait !sig3 - RSP.PC[RSP.PCi] -= 8; - RSP.infloop = true; - RSP.halt = true; - gstate.waiting_for_signal = true; - } - else - gstate.waiting_for_signal = false; - - LOG(LOG_VERBOSE, "ZSortBOSS_WaitSignal"); -} - -void ZSortBOSS_MoveWord( u32 _w0, u32 _w1 ) -{ - assert((_w0 & 3) == 0); - - if(((_w0 & 0xfff) == 0x10) && (RSP.nextCmd == 0x04)) { // Next cmd is G_ZSBOSS_MOVEMEM - gstate.invw_factor = (f32)_w1; - } - - memcpy((DMEM + (_w0 & 0xfff)), &_w1, sizeof(u32)); - LOG(LOG_VERBOSE, "ZSortBOSS_MoveWord (Write 0x%08x to DMEM: 0x%04x)", _w1, (_w0 & 0xfff)); -} - -void ZSortBOSS_ClearBuffer( u32, u32 ) -{ - memset((DMEM + 0xc20), 0, 512); - LOG(LOG_VERBOSE, "ZSortBOSS_ClearBuffer (Write 0x0 to DMEM: 0x0c20 -> 0x0e20)"); -} - -static -void StoreMatrix( f32 mtx[4][4], u32 address ) -{ - struct _N64Matrix - { - s16 integer[4][4]; - u16 fraction[4][4]; - } *n64Mat = (struct _N64Matrix *)&RDRAM[address]; - - for (u32 i = 0; i < 4; i++) { - for (u32 j = 0; j < 4; j++) { - const auto element = GetIntMatrixElement(mtx[i][j]); - n64Mat->fraction[i][j^1] = element.second; - n64Mat->integer[i][j^1] = element.first; - } - } -} - -void ZSortBOSS_MoveMem( u32 _w0, u32 _w1 ) -{ - int flag = (_w0 >> 23) & 0x01; - int len = 1 + (_w0 >> 12) & 0x7ff; - u32 addr = RSP_SegmentToPhysical(_w1); - assert((addr & 3) == 0); - assert((_w0 & 3) == 0); - - LOG(LOG_VERBOSE, "ZSortBOSS_MoveMem (R/W: %d, RDRAM: 0x%08x, DMEM: 0x%04x; len: %d)", flag, addr, (_w0 & 0xfff), len); - - // model matrix - if((_w0 & 0xfff) == 0x830) { - assert(flag == 0); - RSP_LoadMatrix(gSP.matrix.modelView[gSP.matrix.modelViewi], addr); - gSP.changed |= CHANGED_MATRIX; - return; - } - - // projection matrix - if((_w0 & 0xfff) == 0x870) { - assert(flag == 0); - RSP_LoadMatrix(gSP.matrix.projection, addr); - gSP.changed |= CHANGED_MATRIX; - return; - } - - // combined matrix - if((_w0 & 0xfff) == 0x8b0) { - if(flag == 0) { - RSP_LoadMatrix(gSP.matrix.combined, addr); - gSP.changed &= ~CHANGED_MATRIX; - } else { - StoreMatrix(gSP.matrix.combined, addr); - } - return; - } - - // VIEWPORT - if((_w0 & 0xfff) == 0x0) { - u32 a = addr >> 1; - - const f32 scale_x = _FIXED2FLOAT( ((s16*)RDRAM)[(a+0)^1], 2 ); - const f32 scale_y = _FIXED2FLOAT( ((s16*)RDRAM)[(a+1)^1], 2 ); - const f32 scale_z = _FIXED2FLOAT( ((s16*)RDRAM)[(a+2)^1], 10 ); - const s16 fm = ((s16*)RDRAM)[(a+3)^1]; - const f32 trans_x = _FIXED2FLOAT( ((s16*)RDRAM)[(a+4)^1], 2 ); - const f32 trans_y = _FIXED2FLOAT( ((s16*)RDRAM)[(a+5)^1], 2 ); - const f32 trans_z = _FIXED2FLOAT( ((s16*)RDRAM)[(a+6)^1], 10 ); - const s16 fo = ((s16*)RDRAM)[(a+7)^1]; - gSPFogFactor(fm, fo); - - gSP.viewport.vscale[0] = scale_x; - gSP.viewport.vscale[1] = scale_y; - gSP.viewport.vscale[2] = scale_z; - gSP.viewport.vtrans[0] = trans_x; - gSP.viewport.vtrans[1] = trans_y; - gSP.viewport.vtrans[2] = trans_z; - - gSP.viewport.x = gSP.viewport.vtrans[0] - gSP.viewport.vscale[0]; - gSP.viewport.y = gSP.viewport.vtrans[1] - gSP.viewport.vscale[1]; - gSP.viewport.width = gSP.viewport.vscale[0] * 2; - gSP.viewport.height = gSP.viewport.vscale[1] * 2; - gSP.viewport.nearz = gSP.viewport.vtrans[2] - gSP.viewport.vscale[2]; - gSP.viewport.farz = (gSP.viewport.vtrans[2] + gSP.viewport.vscale[2]); - - gstate.view_scale[0] = scale_x*4.0f; - gstate.view_scale[1] = scale_y*4.0f; - gstate.view_trans[0] = trans_x*4.0f; - gstate.view_trans[1] = trans_y*4.0f; - - gSP.changed |= CHANGED_VIEWPORT; - return; - } - - if((_w0 & 0xfff) == 0x730) { - assert(len == 256); - memcpy(gstate.fogtable, (RDRAM + addr), len); - } - - if(flag == 0) { - memcpy((DMEM + (_w0 & 0xfff)), (RDRAM + addr), len); - } else { - memcpy((RDRAM + addr), (DMEM + (_w0 & 0xfff)), len); - } -} - -void ZSortBOSS_MTXCAT(u32 _w0, u32 _w1) -{ - M44 *s = nullptr; - M44 *t = nullptr; - M44 *d = nullptr; - u32 S = (_w1 >> 16) & 0xfff; - u32 T = _w0 & 0xfff; - u32 D = _w1 & 0xfff; - - switch(S) { - // model matrix - case 0x830: - s = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - - // projection matrix - case 0x870: - s = (M44*)gSP.matrix.projection; - break; - - // combined matrix - case 0x8b0: - s = (M44*)gSP.matrix.combined; - break; - } - - switch(T) { - // model matrix - case 0x830: - t = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - - // projection matrix - case 0x870: - t = (M44*)gSP.matrix.projection; - break; - - // combined matrix - case 0x8b0: - t = (M44*)gSP.matrix.combined; - break; - } - - assert(s != nullptr && t != nullptr); - f32 m[4][4]; - MultMatrix(*s, *t, m); - - switch(D) { - // model matrix - case 0x830: - d = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - - // projection matrix - case 0x870: - d = (M44*)gSP.matrix.projection; - break; - - // combined matrix - case 0x8b0: - d = (M44*)gSP.matrix.combined; - break; - } - - assert(d != nullptr); - memcpy(*d, m, 64); - - LOG(LOG_VERBOSE, "ZSortBOSS_MTXCAT (S: 0x%04x, T: 0x%04x, D: 0x%04x)", S, T, D); -} - -void ZSortBOSS_MultMPMTX( u32 _w0, u32 _w1 ) -{ - assert((_w0 & 0xfff) == 0x8b0); // combined matrix - int num = 1 + _SHIFTR(_w1, 24, 8); - int src = (_w1 >> 12) & 0xfff; - int dst = _w1 & 0xfff; - - assert((src & 3) == 0); - assert((dst & 3) == 0); - - s16 * saddr = (s16*)(DMEM+src); - zSortVDest * daddr = (zSortVDest*)(DMEM+dst); - int idx = 0; - zSortVDest v; - memset(&v, 0, sizeof(zSortVDest)); - - for(int i = 0; i < num; ++i) { - s16 sx = saddr[(idx++)^1]; - s16 sy = saddr[(idx++)^1]; - s16 sz = saddr[(idx++)^1]; - f32 x = sx*gSP.matrix.combined[0][0] + sy*gSP.matrix.combined[1][0] + sz*gSP.matrix.combined[2][0] + gSP.matrix.combined[3][0]; - f32 y = sx*gSP.matrix.combined[0][1] + sy*gSP.matrix.combined[1][1] + sz*gSP.matrix.combined[2][1] + gSP.matrix.combined[3][1]; - f32 z = sx*gSP.matrix.combined[0][2] + sy*gSP.matrix.combined[1][2] + sz*gSP.matrix.combined[2][2] + gSP.matrix.combined[3][2]; - f32 w = sx*gSP.matrix.combined[0][3] + sy*gSP.matrix.combined[1][3] + sz*gSP.matrix.combined[2][3] + gSP.matrix.combined[3][3]; - - v.xi = (s16)x; - v.yi = (s16)y; - v.wi = (s16)w; - - v.invw = Calc_invw((int)(w * gstate.invw_factor)); - - f32 invw = (w <= 0.f) ? gstate.invw_factor : (1.f / w); - - f32 x_w = CLAMP((x * invw), -gstate.invw_factor, gstate.invw_factor); - f32 y_w = CLAMP((y * invw), -gstate.invw_factor, gstate.invw_factor); - - v.sx = (s16)(gstate.view_trans[0] + x_w * gstate.view_scale[0]); - v.sy = (s16)(gstate.view_trans[1] + y_w * gstate.view_scale[1]); - - int fog = (int)(w * _FIXED2FLOAT(gSP.fog.multiplier, 16) + gSP.fog.offset); - fog = SATURATES8(fog); - v.fog = gstate.fogtable[fog+128]; - - v.cc = 0; - if(x >= w) v.cc |= 0x10; - if(y >= w) v.cc |= 0x20; - if(z >= w) v.cc |= 0x40; - if(x <= -w) v.cc |= 0x01; - if(y <= -w) v.cc |= 0x02; - if(z <= -w) v.cc |= 0x04; - - daddr[i] = v; - } - - LOG(LOG_VERBOSE, "ZSortBOSS_MultMPMTX (src: 0x%04x, dest: 0x%04x, num: %d)", src, dst, num); -} - -static -void ZSortBOSS_DrawObject(u8 * _addr, u32 _type) -{ - u32 textured = 0, vnum = 0, vsize = 0; - switch(_type) { - case ZH_NULL: - assert(0); - textured = vnum = vsize = 0; - break; - case ZH_TXTRI: - textured = 1; - vnum = 3; - vsize = 16; - break; - case ZH_TXQUAD: - textured = 1; - vnum = 4; - vsize = 16; - break; - } - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(vnum); - SPVertex * pVtx = drawer.getDMAVerticesData(); - - for(u32 i = 0; i < vnum; ++i) { - SPVertex & vtx = pVtx[i]; - vtx.x = _FIXED2FLOAT(((s16*)_addr)[0 ^ 1], 2); - vtx.y = _FIXED2FLOAT(((s16*)_addr)[1 ^ 1], 2); - vtx.z = 0.0f; - vtx.r = _FIXED2FLOATCOLOR(_addr[4^3], 8 ); - vtx.g = _FIXED2FLOATCOLOR(_addr[5^3], 8 ); - vtx.b = _FIXED2FLOATCOLOR(_addr[6^3], 8 ); - vtx.a = _FIXED2FLOATCOLOR(_addr[7^3], 8 ); - vtx.flag = 0; - vtx.HWLight = 0; - vtx.clip = 0; - if(textured != 0) { - if (gDP.otherMode.texturePersp != 0) { - vtx.s = _FIXED2FLOAT(((s16*)_addr)[4 ^ 1], 5); - vtx.t = _FIXED2FLOAT(((s16*)_addr)[5 ^ 1], 5); - } else { - vtx.s = _FIXED2FLOAT(((s16*)_addr)[4 ^ 1], 6); - vtx.t = _FIXED2FLOAT(((s16*)_addr)[5 ^ 1], 6); - } - - int invw = ((int*)_addr)[3]; - int rgba = ((int*)_addr)[1]; - - if((invw == rgba) || (invw < 0)) - vtx.w = 1.0f; - else - vtx.w = Calc_invw(invw) / gstate.invw_factor; - - } else - vtx.w = 1.0f; - - _addr += vsize; - } - drawer.drawScreenSpaceTriangle(vnum); -} - -static -u32 ZSortBOSS_LoadObject(u32 _zHeader) -{ - const u32 type = (_zHeader & 7) << 1; - u8 * addr = RDRAM + (_zHeader&0xFFFFFFF8); - u32 w1; - switch(type) { - case ZH_NULL: - case ZH_TXTRI: - case ZH_TXQUAD: - { - w1 = ((u32*)addr)[1]; - if(w1 != gstate.rdpcmds[0]) { - gstate.rdpcmds[0] = w1; - ZSort_RDPCMD (0, w1); - } - w1 = ((u32*)addr)[2]; - if(w1 != gstate.rdpcmds[1]) { - ZSort_RDPCMD (0, w1); - gstate.rdpcmds[1] = w1; - } - w1 = ((u32*)addr)[3]; - if(w1 != gstate.rdpcmds[2]) { - ZSort_RDPCMD (0, w1); - gstate.rdpcmds[2] = w1; - } - if(type != ZH_NULL) { - ZSortBOSS_DrawObject(addr + 16, type); - } - } - break; - } - return RSP_SegmentToPhysical(((u32*)addr)[0]); -} - -void ZSortBOSS_Obj( u32 _w0, u32 _w1 ) -{ - // make sure no pending subdl - assert((*REG.SP_STATUS & 0x80) == 0); - - u32 zHeader = RSP_SegmentToPhysical(_w0); - while(zHeader) - zHeader = ZSortBOSS_LoadObject(zHeader); - zHeader = RSP_SegmentToPhysical(_w1); - while(zHeader) - zHeader = ZSortBOSS_LoadObject(zHeader); -} - -void ZSortBOSS_TransposeMTX( u32, u32 _w1 ) -{ - M44 *mtx = nullptr; - f32 m[4][4]; - assert((_w1 & 0xfff) == 0x830); // model matrix - - switch(_w1 & 0xfff) { - // model matrix - case 0x830: - mtx = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - - // projection matrix - case 0x870: - mtx = (M44*)gSP.matrix.projection; - break; - - // combined matrix - case 0x8b0: - mtx = (M44*)gSP.matrix.combined; - break; - - default: - assert(false); - return; - } - - memcpy(m, mtx, 64); - - for(int i = 0; i < 3; i++) { - for(int j = 0; j < 3; j++) { - (*mtx)[j][i] = m[i][j]; - } - } - - LOG(LOG_VERBOSE, "ZSortBOSS_TransposeMTX (MTX: 0x%04x)", (_w1 & 0xfff)); -} - -void ZSortBOSS_Lighting( u32 _w0, u32 _w1 ) -{ - u32 num = 1 + (_w1 >> 24); - u32 nsrs = _w0 & 0xfff; - u32 csrs = (_w0 >> 12) & 0xfff; - u32 cdest = (_w1 >> 12) & 0xfff; - u32 tdest = _w1 & 0xfff; - assert((tdest & 3) == 0); - tdest >>= 1; - - u32 r4 = _w0 << 7; - u32 r9 = DMEM[0x944]; - assert(r9 == 0); - - GraphicsDrawer & drawer = dwnd().getDrawer(); - drawer.setDMAVerticesSize(num); - SPVertex * pVtx = drawer.getDMAVerticesData(); - - for(u32 i = 0; i < num; i++) { - SPVertex & vtx = pVtx[i]; - - vtx.nx = _FIXED2FLOAT(((s8*)DMEM)[(nsrs++)^3],8); - vtx.ny = _FIXED2FLOAT(((s8*)DMEM)[(nsrs++)^3],8); - vtx.nz = _FIXED2FLOAT(((s8*)DMEM)[(nsrs++)^3],8); - - // TODO: implement light vertex if ever needed - //gSPLightVertex(vtx); - - f32 fLightDir[3] = {vtx.nx, vtx.ny, vtx.nz}; - f32 x, y; - x = DotProduct(gSP.lookat.xyz[0], fLightDir); - y = DotProduct(gSP.lookat.xyz[1], fLightDir); - vtx.s = (x + 0.5f) * 1024.0f; - vtx.t = (y + 0.5f) * 1024.0f; - - // TODO: is this ever send to RDRAM? - //DMEM[(cdest++)^3] = (u8)(vtx.r * 255.0f); - //DMEM[(cdest++)^3] = (u8)(vtx.g * 255.0f); - //DMEM[(cdest++)^3] = (u8)(vtx.b * 255.0f); - //DMEM[(cdest++)^3] = (u8)(vtx.a * 255.0f); - - ((s16*)DMEM)[(tdest++)^1] = (s16)vtx.s; - ((s16*)DMEM)[(tdest++)^1] = (s16)vtx.t; - } - - LOG(LOG_VERBOSE, "ZSortBOSS_Lighting (0x%08x, 0x%08x)", _w0, _w1); -} - -static -void ZSortBOSS_TransformVectorNormalize(float vec[3], float mtx[4][4]) -{ - float vres[3]; - float len; - float recip = 256.f; - - vres[0] = mtx[0][0] * vec[0] + mtx[1][0] * vec[1] + mtx[2][0] * vec[2]; - vres[1] = mtx[0][1] * vec[0] + mtx[1][1] * vec[1] + mtx[2][1] * vec[2]; - vres[2] = mtx[0][2] * vec[0] + mtx[1][2] * vec[1] + mtx[2][2] * vec[2]; - - len = vres[0]*vres[0] + vres[1]*vres[1] + vres[2]*vres[2]; - - if(len != 0.0) - recip = 1.f / sqrtf( len ); - - if(recip > 256.f) recip = 256.f; - vec[0] = vres[0] * recip; - vec[1] = vres[1] * recip; - vec[2] = vres[2] * recip; -} - -void ZSortBOSS_TransformLights( u32 _w0, u32 _w1 ) -{ - assert((_w0 & 0xfff) == 0x830); // model matrix - assert(_w1 == 0x1630); // no light only lookat - assert((_w1 & 3) == 0); - - M44 *mtx = nullptr; - int addr = _w1 & 0xfff; - gSP.numLights = 1 - (_w1 >> 12); - - /* - switch(_w0 & 0xfff) { - // model matrix - case 0x830: - mtx = (M44*)gSP.matrix.modelView[gSP.matrix.modelViewi]; - break; - - // projection matrix - case 0x870: - mtx = (M44*)gSP.matrix.projection; - break; - - // combined matrix - case 0x8b0: - mtx = (M44*)gSP.matrix.combined; - break; - } - */ - - for(u32 i = 0; i < gSP.numLights; ++i) - { - assert(0); - - gSP.lights.rgb[i][R] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+8+0)^3], 8 ); - gSP.lights.rgb[i][G] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+8+1)^3], 8 ); - gSP.lights.rgb[i][B] = _FIXED2FLOATCOLOR(((u8*)DMEM)[(addr+8+2)^3], 8 ); - - gSP.lights.xyz[i][X] = _FIXED2FLOAT((((s8*)DMEM)[(addr+16+0)^3]),8); - gSP.lights.xyz[i][Y] = _FIXED2FLOAT((((s8*)DMEM)[(addr+16+1)^3]),8); - gSP.lights.xyz[i][Z] = _FIXED2FLOAT((((s8*)DMEM)[(addr+16+2)^3]),8); - ZSortBOSS_TransformVectorNormalize( gSP.lights.xyz[i], gSP.matrix.modelView[gSP.matrix.modelViewi] ); - addr += 24; - } - for(int i = 0; i < 2; i++) - { - gSP.lookat.xyz[i][X] = _FIXED2FLOAT((((s8*)DMEM)[(addr+16+0)^3]),8); - gSP.lookat.xyz[i][Y] = _FIXED2FLOAT((((s8*)DMEM)[(addr+16+1)^3]),8); - gSP.lookat.xyz[i][Z] = _FIXED2FLOAT((((s8*)DMEM)[(addr+16+2)^3]),8); - ZSortBOSS_TransformVectorNormalize( gSP.lookat.xyz[i], gSP.matrix.modelView[gSP.matrix.modelViewi] ); - addr += 24; - } - - LOG(LOG_VERBOSE, "ZSortBOSS_TransformLights (0x%08x, 0x%08x)", _w0, _w1); -} - -void ZSortBOSS_Audio1( u32 _w0, u32 _w1 ) -{ - u32 addr = RSP_SegmentToPhysical(_w1); - u32 val = ((u32*)DMEM)[(_w0 & 0xfff) >> 2]; - ((u32*)DMEM)[0] = val; - memcpy(RDRAM+addr, DMEM, 0x8); - LOG(LOG_VERBOSE, "ZSortBOSS_Audio1 (0x%08x, 0x%08x)", _w0, _w1); -} - -void ZSortBOSS_Audio2( u32 _w0, u32 _w1 ) -{ - int len = _w1 >> 24; - - // Written by previous ZSortBOSS_MoveWord - u32 dst = ((u32*)DMEM)[0x10>>2]; - - f32 f1 = (f32)((_w0>>16) & 0xff) + (f32)(_w0 & 0xffff) / 65536.f; - f32 f2 = (f32)((_w1>>16) & 0xff) + (f32)(_w1 & 0xffff) / 65536.f; - - // Written by previous ZSortBOSS_MoveWord - u16 v11[2]; - v11[0] = ((u16*)DMEM)[(0x904>>1)^1]; - v11[1] = ((u16*)DMEM)[((0x904+2)>>1)^1]; - - for(int i = 0; i < len; i+=4) { - - for(int j = 0; j < 4; j++) { - - f32 intpart, fractpart; - f32 val = i*f1 + j*f1 + f2; - - fractpart = fabsf(modff(val, &intpart)); - int index = ((int)intpart) << 1; - - s16 v9 = ((s16*)DMEM)[((0x30+index)>>1)^1]; - s16 v10 = ((s16*)DMEM)[((0x32+index)>>1)^1]; - s16 v12 = v10 - v9; - s16 v13 = ((s16*)DMEM)[(dst>>1)^1]; - - for(int k = 0; k < 2; k++) { - - s32 res1 = v12 * (u16)(fractpart * 65536.f); - s32 res2 = v9 << 16; - s16 res3 = (res2 + res1) >> 16; - - res1 = v11[k] * res3; - res2 = v13 << 16; - res3 = (res2 + res1) >> 16; - - ((s16*)DMEM)[(dst>>1)^1] = res3; - dst+=2; - } - } - } - - LOG(LOG_VERBOSE, "ZSortBOSS_Audio2 (0x%08x, 0x%08x)", _w0, _w1); -} - -void ZSortBOSS_Audio3( u32 _w0, u32 _w1 ) -{ - u32 addr = RSP_SegmentToPhysical(_w0); - assert((addr & 3) == 0); - - for(int i = 0; i < 8; i++) { - for(int j = 0; j < 8; j++) { - gstate.table[i][j] = ((s16*)RDRAM)[((addr+(i<<4)+(j<<1))>>1)^1]; - } - } - - addr = RSP_SegmentToPhysical(_w1); - assert((addr & 3) == 0); - - // What is this? - memcpy(DMEM, (RDRAM + addr), 0x8); - memcpy((DMEM+8), &addr, sizeof(addr)); - - LOG(LOG_VERBOSE, "ZSortBOSS_Audio3 (0x%08x, 0x%08x)", _w0, _w1); -} - -void ZSortBOSS_Audio4( u32 _w0, u32 _w1 ) -{ - u32 addr = RSP_SegmentToPhysical(_w1); - assert((addr & 3) == 0); - - u32 src = ((_w0 & 0xf000) >> 12) + addr; - s16 * dst = (s16*)(DMEM+0x30); - int len = (_w0 & 0xfff); - - // Written by previous ZSortBOSS_MoveWord - s16 v1 = ((s16*)DMEM)[(0>>1)^1]; - s16 v2 = ((s16*)DMEM)[(2>>1)^1]; - - for(int l1 = len; l1 != 0; l1-=9) { - - u32 r9 = ((u8*)RDRAM)[(src++)^3]; - int index = (r9 & 0xf) << 1; - - if(index > 6) { - LOG(LOG_VERBOSE, "ZSortBOSS_Audio4: Index out of bound"); - break; - } - - assert(index <= 6); - assert((index&1) == 0); - - s16 c1 = 1 << ((r9>>4) & 0x1f); - s16 c2 = 0x20; - - for(int l2 = 0; l2 < 2; l2++) { - - s32 a = ((s8*)RDRAM)[(src++)^3]; - s32 b = ((s8*)RDRAM)[(src++)^3]; - s32 c = ((s8*)RDRAM)[(src++)^3]; - s32 d = ((s8*)RDRAM)[(src++)^3]; - - s16 coeff[8]; - coeff[0] = a>>4; - coeff[1] = (a<<28)>>28; - coeff[2] = b>>4; - coeff[3] = (b<<28)>>28; - coeff[4] = c>>4; - coeff[5] = (c<<28)>>28; - coeff[6] = d>>4; - coeff[7] = (d<<28)>>28; - - int i, j, k; - - for(i = 0; i < 8; i++) { - s32 res1 = 0; - - for(j = 0, k = i; j < i; j++, k--) - res1 += gstate.table[index+1][k-1] * coeff[j]; - - res1 += coeff[i] * (s16)0x0800; - res1 *= c1; - - s32 res2 = v1*gstate.table[index][i] + v2*gstate.table[index+1][i]; - - dst[i^1] = (res1*c2 + res2*c2) >> 16; - } - v1 = dst[6^1]; - v2 = dst[7^1]; - dst += 8; - } - } - - LOG(LOG_VERBOSE, "ZSortBOSS_Audio4 (0x%08x, 0x%08x)", _w0, _w1); -} - -// RDP Commands -void ZSortBOSS_UpdateMask( u32 _w0, u32 _w1 ) -{ - gstate.updatemask[0] = _w0 | 0xff000000; - gstate.updatemask[1] = _w1; - LOG(LOG_VERBOSE, "ZSortBOSS_UpdateMask (mask0: 0x%08x, mask1: 0x%08x)", gstate.updatemask[0], gstate.updatemask[1]); -} - -void ZSortBOSS_SetOtherMode_L( u32 _w0, u32 _w1 ) -{ - //u32 mask = (s32)0x80000000 >> (_w0 & 0x1f); // unspecified behaviour - u32 mask = static_cast<u32>(s32(0x80000000) / (1 << (_w0 & 0x1f))); - mask >>= (_w0 >> 8) & 0x1f; - gDP.otherMode.l = (gDP.otherMode.l & ~mask) | _w1; - - const u32 w0 = gDP.otherMode.h; - const u32 w1 = gDP.otherMode.l; - - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 - - LOG(LOG_VERBOSE, "ZSortBOSS_SetOtherMode_L (mode0: 0x%08x, mode1: 0x%08x)", gDP.otherMode.h, gDP.otherMode.l); -} - -void ZSortBOSS_SetOtherMode_H( u32 _w0, u32 _w1 ) -{ - //u32 mask = (s32)0x80000000 >> (_w0 & 0x1f); // unspecified behaviour - u32 mask = static_cast<u32>(s32(0x80000000) / (1 << (_w0 & 0x1f))); - mask >>= (_w0 >> 8) & 0x1f; - gDP.otherMode.h = (gDP.otherMode.h & ~mask) | _w1; - - const u32 w0 = gDP.otherMode.h; - const u32 w1 = gDP.otherMode.l; - - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 - - LOG(LOG_VERBOSE, "ZSortBOSS_SetOtherMode_H (mode0: 0x%08x, mode1: 0x%08x)", gDP.otherMode.h, gDP.otherMode.l); -} - -void ZSortBOSS_SetOtherMode( u32 _w0, u32 _w1 ) -{ - gDP.otherMode.h = (_w0 & gstate.updatemask[0]) | (gDP.otherMode.h & ~gstate.updatemask[0]); - gDP.otherMode.l = (_w1 & gstate.updatemask[1]) | (gDP.otherMode.l & ~gstate.updatemask[1]); - - const u32 w0 = gDP.otherMode.h; - const u32 w1 = gDP.otherMode.l; - - gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 - w1 ); // mode1 - - LOG(LOG_VERBOSE, "ZSortBOSS_SetOtherMode (mode0: 0x%08x, mode1: 0x%08x)", gDP.otherMode.h, gDP.otherMode.l); -} - -void ZSortBOSS_TriangleCommand( u32, u32 _w1 ) -{ - assert(((_w1 >> 8) & 0x3f) == 0x0e); //Shade, Texture Triangle - gSP.texture.scales = 1.0f; - gSP.texture.scalet = 1.0f; - gSP.texture.level = (_w1 >> 3) & 0x7; - gSP.texture.on = 1; - gSP.texture.tile = _w1 & 0x7; - - gSPSetGeometryMode(G_SHADING_SMOOTH | G_SHADE); - LOG(LOG_VERBOSE, "ZSortBOSS_TriangleCommand (cmd: 0x%02x, level: %d, tile: %d)", ((_w1 >> 8) & 0x3f), gSP.texture.level, gSP.texture.tile); -} - -void ZSortBOSS_FlushRDPCMDBuffer( u32, u32 ) -{ - LOG(LOG_VERBOSE, "ZSortBOSS_FlushRDPCMDBuffer Ignored"); -} - -void ZSortBOSS_Reserved( u32, u32 ) -{ - assert(0); -} - -#define G_ZSBOSS_ENDMAINDL 0x02 -#define G_ZSBOSS_MOVEMEM 0x04 -#define G_ZSBOSS_MTXCAT 0x0A -#define G_ZSBOSS_MULT_MPMTX 0x0C -#define G_ZSBOSS_MOVEWORD 0x06 -#define G_ZSBOSS_TRANSPOSEMTX 0x08 -#define G_ZSBOSS_RDPCMD 0x0E -#define G_ZSBOSS_OBJ 0x10 -#define G_ZSBOSS_WAITSIGNAL 0x12 -#define G_ZSBOSS_LIGHTING 0x14 -#define G_ZSBOSS_RESERVED0 0x16 -#define G_ZSBOSS_TRANSFORMLIGHTS 0x18 -#define G_ZSBOSS_ENDSUBDL 0x1A -#define G_ZSBOSS_AUDIO2 0x1C -#define G_ZSBOSS_CLEARBUFFER 0x1E -#define G_ZSBOSS_RESERVED1 0x20 -#define G_ZSBOSS_AUDIO3 0x22 -#define G_ZSBOSS_AUDIO4 0x24 -#define G_ZSBOSS_AUDIO1 0x26 -#define G_ZSBOSS_UPDATEMASK 0xDD -#define G_ZSBOSS_TRIANGLECOMMAND 0xDE -#define G_ZSBOSS_FLUSHRDPCMDBUFFER 0xDF -#define G_ZSBOSS_RDPHALF_1 0xE1 -#define G_ZSBOSS_SETOTHERMODE_H 0xE3 -#define G_ZSBOSS_SETOTHERMODE_L 0xE2 -#define G_ZSBOSS_RDPSETOTHERMODE 0xEF -#define G_ZSBOSS_RDPHALF_2 0xF1 - -u32 G_ZENDMAINDL, G_ZENDSUBDL, G_ZUPDATEMASK, G_ZSETOTHERMODE, G_ZFLUSHRDPCMDBUFFER, G_ZMOVEWORD, G_ZCLEARBUFFER, G_ZTRIANGLECOMMAND, G_ZTRANSPOSEMTX, G_ZTRANSFORMLIGHTS, G_ZAUDIO1, G_ZAUDIO2, G_ZAUDIO3, G_ZAUDIO4; - -void ZSortBOSS_Init() -{ - gSPSetupFunctions(); - // Set GeometryMode flags - GBI_InitFlags( F3D ); - - GBI.PCStackSize = 10; - - memset(&gstate, 0, sizeof(gstate)); - gstate.invw_factor = 10.0f; - - // GBI Command Command Value Command Function - GBI_SetGBI( G_SPNOOP, F3D_SPNOOP, F3D_SPNoOp ); - GBI_SetGBI( G_ZENDMAINDL, G_ZSBOSS_ENDMAINDL, ZSortBOSS_EndMainDL ); - GBI_SetGBI( G_MOVEMEM, G_ZSBOSS_MOVEMEM, ZSortBOSS_MoveMem ); - GBI_SetGBI( G_ZMOVEWORD, G_ZSBOSS_MOVEWORD, ZSortBOSS_MoveWord ); - GBI_SetGBI( G_ZTRANSPOSEMTX, G_ZSBOSS_TRANSPOSEMTX, ZSortBOSS_TransposeMTX ); - GBI_SetGBI( G_ZMTXCAT, G_ZSBOSS_MTXCAT, ZSortBOSS_MTXCAT ); - GBI_SetGBI( G_ZMULT_MPMTX, G_ZSBOSS_MULT_MPMTX, ZSortBOSS_MultMPMTX ); - GBI_SetGBI( G_ZRDPCMD, G_ZSBOSS_RDPCMD, ZSort_RDPCMD ); - GBI_SetGBI( G_ZOBJ, G_ZSBOSS_OBJ, ZSortBOSS_Obj ); - GBI_SetGBI( G_ZWAITSIGNAL, G_ZSBOSS_WAITSIGNAL, ZSortBOSS_WaitSignal ); - GBI_SetGBI( G_ZLIGHTING, G_ZSBOSS_LIGHTING, ZSortBOSS_Lighting ); - GBI_SetGBI( G_RESERVED0, G_ZSBOSS_RESERVED0, ZSortBOSS_Reserved ); - GBI_SetGBI( G_ZTRANSFORMLIGHTS, G_ZSBOSS_TRANSFORMLIGHTS, ZSortBOSS_TransformLights ); - GBI_SetGBI( G_ZENDSUBDL, G_ZSBOSS_ENDSUBDL, ZSortBOSS_EndSubDL ); - GBI_SetGBI( G_ZAUDIO2, G_ZSBOSS_AUDIO2, ZSortBOSS_Audio2 ); - GBI_SetGBI( G_ZCLEARBUFFER, G_ZSBOSS_CLEARBUFFER, ZSortBOSS_ClearBuffer ); - GBI_SetGBI( G_RESERVED1, G_ZSBOSS_RESERVED1, ZSortBOSS_Reserved ); - GBI_SetGBI( G_ZAUDIO3, G_ZSBOSS_AUDIO3, ZSortBOSS_Audio3 ); - GBI_SetGBI( G_ZAUDIO4, G_ZSBOSS_AUDIO4, ZSortBOSS_Audio4 ); - GBI_SetGBI( G_ZAUDIO1, G_ZSBOSS_AUDIO1, ZSortBOSS_Audio1 ); - - // RDP Commands - GBI_SetGBI( G_ZUPDATEMASK, G_ZSBOSS_UPDATEMASK, ZSortBOSS_UpdateMask ); - GBI_SetGBI( G_ZTRIANGLECOMMAND, G_ZSBOSS_TRIANGLECOMMAND, ZSortBOSS_TriangleCommand ); - GBI_SetGBI( G_ZFLUSHRDPCMDBUFFER, G_ZSBOSS_FLUSHRDPCMDBUFFER, ZSortBOSS_FlushRDPCMDBuffer ); - GBI_SetGBI( G_RDPHALF_1, G_ZSBOSS_RDPHALF_1, F3D_RDPHalf_1 ); - GBI_SetGBI( G_SETOTHERMODE_L, G_ZSBOSS_SETOTHERMODE_L, ZSortBOSS_SetOtherMode_L ); - GBI_SetGBI( G_SETOTHERMODE_H, G_ZSBOSS_SETOTHERMODE_H, ZSortBOSS_SetOtherMode_H ); - GBI_SetGBI( G_ZSETOTHERMODE, G_ZSBOSS_RDPSETOTHERMODE, ZSortBOSS_SetOtherMode ); - GBI_SetGBI( G_RDPHALF_2, G_ZSBOSS_RDPHALF_2, F3D_RDPHalf_2 ); -} diff --git a/GLideN64/src/uCodes/ZSortBOSS.h b/GLideN64/src/uCodes/ZSortBOSS.h deleted file mode 100644 index 3d540ab..0000000 --- a/GLideN64/src/uCodes/ZSortBOSS.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ZSORTBOSS_H -#define ZSORTBOSS_H - -void ZSortBOSS_Init(); - -#endif // ZSORTBOSS_H diff --git a/GLideN64/src/windows/CommonAPIImpl_windows.cpp b/GLideN64/src/windows/CommonAPIImpl_windows.cpp deleted file mode 100644 index 4fd4912..0000000 --- a/GLideN64/src/windows/CommonAPIImpl_windows.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <algorithm> -#include <string> -#include "GLideN64_Windows.h" -#include <commctrl.h> -#include "../PluginAPI.h" -#include "../RSP.h" - -#ifdef OS_WINDOWS -EXTERN_C IMAGE_DOS_HEADER __ImageBase; -#endif - -BOOL CALLBACK FindToolBarProc( HWND _hWnd, LPARAM lParam ) -{ - if (GetWindowLong( _hWnd, GWL_STYLE ) & RBS_VARHEIGHT) { - hToolBar = _hWnd; - return FALSE; - } - return TRUE; -} - -int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo) -{ - _initiateGFX(_gfxInfo); - - hWnd = _gfxInfo.hWnd; - hStatusBar = _gfxInfo.hStatusBar; - hToolBar = NULL; - - EnumChildWindows( hWnd, FindToolBarProc, 0 ); - return TRUE; -} - -void PluginAPI::FindPluginPath(wchar_t * _strPath) -{ - if (_strPath == NULL) - return; - ::GetModuleFileName((HINSTANCE)&__ImageBase, _strPath, PLUGIN_PATH_SIZE); - std::wstring pluginPath(_strPath); - std::replace(pluginPath.begin(), pluginPath.end(), L'\\', L'/'); - std::wstring::size_type pos = pluginPath.find_last_of(L"/"); - wcscpy(_strPath, pluginPath.substr(0, pos).c_str()); -} - -void PluginAPI::GetUserDataPath(wchar_t * _strPath) -{ - FindPluginPath(_strPath); -} - -void PluginAPI::GetUserCachePath(wchar_t * _strPath) -{ - FindPluginPath(_strPath); -} diff --git a/GLideN64/src/windows/GLideN64_windows.cpp b/GLideN64/src/windows/GLideN64_windows.cpp deleted file mode 100644 index 1da1274..0000000 --- a/GLideN64/src/windows/GLideN64_windows.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "GLideN64_Windows.h" - -HWND hWnd; -HWND hStatusBar; -HWND hToolBar; -HINSTANCE hInstance; - -#ifdef WTL_UI -void ConfigInit(void * hinst); -void ConfigCleanup(void); -#endif - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID /*lpvReserved*/) -{ -#ifdef WTL_UI - if (dwReason == DLL_PROCESS_ATTACH) - { - hInstance = hinstDLL; - ConfigInit(hinstDLL); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - ConfigCleanup(); - } -#else - hInstance = hinstDLL; -#endif - return TRUE; -} diff --git a/GLideN64/src/windows/GLideN64_windows.h b/GLideN64/src/windows/GLideN64_windows.h deleted file mode 100644 index 13e6ec4..0000000 --- a/GLideN64/src/windows/GLideN64_windows.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef GLIDEN64_WINDOWS_H -#define GLIDEN64_WINDOWS_H - -#include <windows.h> - -extern HWND hWnd; -extern HWND hStatusBar; -extern HWND hToolBar; -extern HINSTANCE hInstance; - -#endif // GLIDEN64_WINDOWS_H diff --git a/GLideN64/src/windows/MemoryStatus_windows.cpp b/GLideN64/src/windows/MemoryStatus_windows.cpp deleted file mode 100644 index 495ef5e..0000000 --- a/GLideN64/src/windows/MemoryStatus_windows.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "../MemoryStatus.h" - -/* Code taken from stackoverflow.com/questions/18394647 */ -bool isMemoryWritable(void * ptr, size_t byteCount) -{ - MEMORY_BASIC_INFORMATION mbi; - if (VirtualQuery(ptr, &mbi, sizeof(MEMORY_BASIC_INFORMATION)) == 0) - return false; - - if (mbi.State != MEM_COMMIT) - return false; - - if ((mbi.Protect & (PAGE_NOACCESS | PAGE_EXECUTE | PAGE_READONLY)) != 0) - return false; - - // Check that the start of memory block is in the same "region" as the end. - // If it isn't, "simplify" the problem into checking that the rest of the memory is writeable. - size_t blockOffset = (size_t)(reinterpret_cast<u8*>(ptr) - reinterpret_cast<u8*>(mbi.BaseAddress)); - size_t blockBytesPostPtr = mbi.RegionSize - blockOffset; - - if (blockBytesPostPtr < byteCount) - return isMemoryWritable(reinterpret_cast<u8*>(ptr) + blockBytesPostPtr, byteCount - blockBytesPostPtr); - - return true; -} diff --git a/GLideN64/src/windows/ZilmarAPIImpl_windows.cpp b/GLideN64/src/windows/ZilmarAPIImpl_windows.cpp deleted file mode 100644 index b82c0bf..0000000 --- a/GLideN64/src/windows/ZilmarAPIImpl_windows.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "GLideN64_Windows.h" -#include "../PluginAPI.h" -#include "../GLideN64.h" -#include "../GLideNUI/GLideNUI.h" -#include "../Config.h" -#include "../Revision.h" -#include <DisplayWindow.h> - -void PluginAPI::DllAbout(/*HWND _hParent*/) -{ - Config_LoadConfig(); - wchar_t strIniFolderPath[PLUGIN_PATH_SIZE]; - api().FindPluginPath(strIniFolderPath); - RunAbout(strIniFolderPath); -} - -void PluginAPI::CaptureScreen(char * _Directory) -{ - dwnd().setCaptureScreen(_Directory); -} - -void PluginAPI::DllConfig(HWND _hParent) -{ - Config_DoConfig(/*_hParent*/); -} - -void PluginAPI::GetDllInfo(PLUGIN_INFO * PluginInfo) -{ - PluginInfo->Version = 0x103; - PluginInfo->Type = PLUGIN_TYPE_GFX; - sprintf(PluginInfo->Name, "%s", pluginNameWithRevision); - PluginInfo->NormalMemory = FALSE; - PluginInfo->MemoryBswaped = TRUE; -} diff --git a/GLideN64/src/winlnxdefs.h b/GLideN64/src/winlnxdefs.h deleted file mode 100644 index 2255194..0000000 --- a/GLideN64/src/winlnxdefs.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Mupen64 - winlnxdefs.h - * Copyright (C) 2002 Hacktarux - * - * Mupen64 homepage: http://mupen64.emulation64.com - * email address: hacktarux@yahoo.fr - * - * If you want to contribute to the project please contact - * me first (maybe someone is already making what you are - * planning to do). - * - * - * This program is free software; you can redistribute it and/ - * or modify it under the terms of the GNU General Public Li- - * cence as published by the Free Software Foundation; either - * version 2 of the Licence, or any later version. - * - * This program is distributed in the hope that it will be use- - * ful, but WITHOUT ANY WARRANTY; without even the implied war- - * ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public Licence for more details. - * - * You should have received a copy of the GNU General Public - * Licence along with this program; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, - * USA. - * -**/ - -#ifndef WINLNXDEFS_H -#define WINLNXDEFS_H - -#include <dlfcn.h> -#include <errno.h> -#include <limits.h> // PATH_MAX -#include <stdlib.h> // malloc(), srand() -#include <stdio.h> -#include <string.h> -#include <time.h> // time() -#include <unistd.h> // readlink() - -#define timeGetTime() time( 0 ) - -typedef unsigned int BOOL, BOOLEAN; -typedef unsigned int DWORD; -typedef unsigned long long DWORD64, QWORD; -typedef unsigned short WORD; -typedef unsigned char BYTE, byte; -typedef unsigned int UINT; - -typedef char CHAR; -typedef short SHORT; -typedef long LONG; -typedef float FLOAT; - -typedef long __int32; -typedef int HINSTANCE; -typedef int HWND; -typedef int WPARAM; -typedef int LPARAM; -typedef void* LPVOID; - -typedef const char *LPCSTR; - -// types -/*#define BOOL unsigned int -#define BOOLEAN unsigned int -#define DWORD unsigned long -#define WORD unsigned short -#define BYTE unsigned char*/ - -#define __declspec(dllexport) -#define _cdecl -#define WINAPI -//#define APIENTRY -//#define EXPORT -//#define CALL - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef false -#define false 0 -#endif - -#ifndef true -#define true 1 -#endif - -static inline const char *GetPluginDir() -{ - static char path[PATH_MAX]; - -#ifdef __USE_GNU - Dl_info info; - void *addr = (void *)GetPluginDir; - //__asm__( "movl %%eip, %%eax" : "=a"(addr) ); - if (dladdr( addr, &info ) != 0) - { - strncpy( path, info.dli_fname, PATH_MAX ); - *(strrchr( path, '/' )) = '\0'; - } - else - { - fprintf( stderr, "(WW) Couldn't get path of .so, trying to get emulator's path\n" ); -#endif // __USE_GNU - if (readlink( "/proc/self/exe", path, PATH_MAX ) == -1) - { - fprintf( stderr, "(WW) readlink() /proc/self/exe failed: %s\n", strerror( errno ) ); - path[0] = '.'; - path[1] = '\0'; - } - *(strrchr( path, '/' )) = '\0'; - strncat( path, "/plugins", PATH_MAX ); -#ifdef __USE_GNU - } -#endif - - return path; -} - -#endif diff --git a/GLideN64/src/wst.h b/GLideN64/src/wst.h deleted file mode 100644 index 832d2f1..0000000 --- a/GLideN64/src/wst.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef WST_H -#define WST_H - -#include <cstdlib> - -#ifdef OS_ANDROID -static -void gln_wcscat(wchar_t* destination, const wchar_t* source) -{ - const u32 bufSize = 512; - char cbuf[bufSize]; - wcstombs(cbuf, destination, bufSize); - std::string dest(cbuf); - wcstombs(cbuf, source, bufSize); - dest.append(cbuf); - mbstowcs(destination, dest.c_str(), PLUGIN_PATH_SIZE); -} - -class dummyWString -{ -public: - dummyWString(const char * _str) - { - wchar_t buf[512]; - mbstowcs(buf, _str, 512); - _wstr.assign(buf); - } - - const wchar_t * c_str() const { - return _wstr.c_str(); - } - -private: - std::wstring _wstr; -}; - -#define wst(A) dummyWString(A).c_str() -#else // OS_ANDROID -#define gln_wcscat wcscat -#define wst(A) L##A -#endif // OS_ANDROID - -#endif // WST_H diff --git a/GLideN64/src/xxHash/xxhash.h b/GLideN64/src/xxHash/xxhash.h deleted file mode 100644 index 2d56d23..0000000 --- a/GLideN64/src/xxHash/xxhash.h +++ /dev/null @@ -1,4766 +0,0 @@ -/* - * xxHash - Extremely Fast Hash algorithm - * Header File - * Copyright (C) 2012-2020 Yann Collet - * - * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * You can contact the author at: - * - xxHash homepage: https://www.xxhash.com - * - xxHash source repository: https://github.com/Cyan4973/xxHash - */ - -/* TODO: update */ -/* Notice extracted from xxHash homepage: - -xxHash is an extremely fast hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MumurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -Note: SMHasher's CRC32 implementation is not the fastest one. -Other speed-oriented implementations can be faster, -especially in combination with PCLMUL instruction: -https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html?showComment=1552696407071#c3490092340461170735 - -A 64-bit version, named XXH64, is available since r35. -It offers much better speed, but for 64-bit applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ - -#if defined (__cplusplus) -extern "C" { -#endif - -/* **************************** - * INLINE mode - ******************************/ -/*! - * XXH_INLINE_ALL (and XXH_PRIVATE_API) - * Use these build macros to inline xxhash into the target unit. - * Inlining improves performance on small inputs, especially when the length is - * expressed as a compile-time constant: - * - * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html - * - * It also keeps xxHash symbols private to the unit, so they are not exported. - * - * Usage: - * #define XXH_INLINE_ALL - * #include "xxhash.h" - * - * Do not compile and link xxhash.o as a separate object, as it is not useful. - */ -#if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ - && !defined(XXH_INLINE_ALL_31684351384) - /* this section should be traversed only once */ -# define XXH_INLINE_ALL_31684351384 - /* give access to the advanced API, required to compile implementations */ -# undef XXH_STATIC_LINKING_ONLY /* avoid macro redef */ -# define XXH_STATIC_LINKING_ONLY - /* make all functions private */ -# undef XXH_PUBLIC_API -# if defined(__GNUC__) -# define XXH_PUBLIC_API static __inline __attribute__((unused)) -# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define XXH_PUBLIC_API static inline -# elif defined(_MSC_VER) -# define XXH_PUBLIC_API static __inline -# else - /* note: this version may generate warnings for unused static functions */ -# define XXH_PUBLIC_API static -# endif - - /* - * This part deals with the special case where a unit wants to inline xxHash, - * but "xxhash.h" has previously been included without XXH_INLINE_ALL, such - * as part of some previously included *.h header file. - * Without further action, the new include would just be ignored, - * and functions would effectively _not_ be inlined (silent failure). - * The following macros solve this situation by prefixing all inlined names, - * avoiding naming collision with previous inclusions. - */ -# ifdef XXH_NAMESPACE -# error "XXH_INLINE_ALL with XXH_NAMESPACE is not supported" - /* - * Note: Alternative: #undef all symbols (it's a pretty large list). - * Without #error: it compiles, but functions are actually not inlined. - */ -# endif -# define XXH_NAMESPACE XXH_INLINE_ - /* - * Some identifiers (enums, type names) are not symbols, but they must - * still be renamed to avoid redeclaration. - * Alternative solution: do not redeclare them. - * However, this requires some #ifdefs, and is a more dispersed action. - * Meanwhile, renaming can be achieved in a single block - */ -# define XXH_IPREF(Id) XXH_INLINE_ ## Id -# define XXH_OK XXH_IPREF(XXH_OK) -# define XXH_ERROR XXH_IPREF(XXH_ERROR) -# define XXH_errorcode XXH_IPREF(XXH_errorcode) -# define XXH32_canonical_t XXH_IPREF(XXH32_canonical_t) -# define XXH64_canonical_t XXH_IPREF(XXH64_canonical_t) -# define XXH128_canonical_t XXH_IPREF(XXH128_canonical_t) -# define XXH32_state_s XXH_IPREF(XXH32_state_s) -# define XXH32_state_t XXH_IPREF(XXH32_state_t) -# define XXH64_state_s XXH_IPREF(XXH64_state_s) -# define XXH64_state_t XXH_IPREF(XXH64_state_t) -# define XXH3_state_s XXH_IPREF(XXH3_state_s) -# define XXH3_state_t XXH_IPREF(XXH3_state_t) -# define XXH128_hash_t XXH_IPREF(XXH128_hash_t) - /* Ensure the header is parsed again, even if it was previously included */ -# undef XXHASH_H_5627135585666179 -# undef XXHASH_H_STATIC_13879238742 -#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ - - - -/* **************************************************************** - * Stable API - *****************************************************************/ -#ifndef XXHASH_H_5627135585666179 -#define XXHASH_H_5627135585666179 1 - -/* specific declaration modes for Windows */ -#if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) -# if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) -# ifdef XXH_EXPORT -# define XXH_PUBLIC_API __declspec(dllexport) -# elif XXH_IMPORT -# define XXH_PUBLIC_API __declspec(dllimport) -# endif -# else -# define XXH_PUBLIC_API /* do nothing */ -# endif -#endif - -/*! - * XXH_NAMESPACE, aka Namespace Emulation: - * - * If you want to include _and expose_ xxHash functions from within your own - * library, but also want to avoid symbol collisions with other libraries which - * may also include xxHash, you can use XXH_NAMESPACE to automatically prefix - * any public symbol from xxhash library with the value of XXH_NAMESPACE - * (therefore, avoid empty or numeric values). - * - * Note that no change is required within the calling program as long as it - * includes `xxhash.h`: Regular symbol names will be automatically translated - * by this header. - */ -#ifdef XXH_NAMESPACE -# define XXH_CAT(A,B) A##B -# define XXH_NAME2(A,B) XXH_CAT(A,B) -# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) -/* XXH32 */ -# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) -# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) -# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) -# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) -# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) -# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) -# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) -# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) -# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) -/* XXH64 */ -# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) -# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) -# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) -# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) -# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) -# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) -# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) -# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) -# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) -/* XXH3_64bits */ -# define XXH3_64bits XXH_NAME2(XXH_NAMESPACE, XXH3_64bits) -# define XXH3_64bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecret) -# define XXH3_64bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSeed) -# define XXH3_createState XXH_NAME2(XXH_NAMESPACE, XXH3_createState) -# define XXH3_freeState XXH_NAME2(XXH_NAMESPACE, XXH3_freeState) -# define XXH3_copyState XXH_NAME2(XXH_NAMESPACE, XXH3_copyState) -# define XXH3_64bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset) -# define XXH3_64bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSeed) -# define XXH3_64bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecret) -# define XXH3_64bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_update) -# define XXH3_64bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_digest) -# define XXH3_generateSecret XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret) -/* XXH3_128bits */ -# define XXH128 XXH_NAME2(XXH_NAMESPACE, XXH128) -# define XXH3_128bits XXH_NAME2(XXH_NAMESPACE, XXH3_128bits) -# define XXH3_128bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSeed) -# define XXH3_128bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecret) -# define XXH3_128bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset) -# define XXH3_128bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSeed) -# define XXH3_128bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecret) -# define XXH3_128bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_update) -# define XXH3_128bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_digest) -# define XXH128_isEqual XXH_NAME2(XXH_NAMESPACE, XXH128_isEqual) -# define XXH128_cmp XXH_NAME2(XXH_NAMESPACE, XXH128_cmp) -# define XXH128_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH128_canonicalFromHash) -# define XXH128_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH128_hashFromCanonical) -#endif - - -/* ************************************* -* Version -***************************************/ -#define XXH_VERSION_MAJOR 0 -#define XXH_VERSION_MINOR 8 -#define XXH_VERSION_RELEASE 0 -#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) -XXH_PUBLIC_API unsigned XXH_versionNumber (void); - - -/* **************************** -* Definitions -******************************/ -#include <stddef.h> /* size_t */ -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; - - -/*-********************************************************************** -* 32-bit hash -************************************************************************/ -#if !defined (__VMS) \ - && (defined (__cplusplus) \ - || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include <stdint.h> - typedef uint32_t XXH32_hash_t; -#else -# include <limits.h> -# if UINT_MAX == 0xFFFFFFFFUL - typedef unsigned int XXH32_hash_t; -# else -# if ULONG_MAX == 0xFFFFFFFFUL - typedef unsigned long XXH32_hash_t; -# else -# error "unsupported platform: need a 32-bit type" -# endif -# endif -#endif - -/*! - * XXH32(): - * Calculate the 32-bit hash of sequence "length" bytes stored at memory address "input". - * The memory between input & input+length must be valid (allocated and read-accessible). - * "seed" can be used to alter the result predictably. - * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s - * - * Note: XXH3 provides competitive speed for both 32-bit and 64-bit systems, - * and offers true 64/128 bit hash results. It provides a superior level of - * dispersion, and greatly reduces the risks of collisions. - */ -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); - -/******* Streaming *******/ - -/* - * Streaming functions generate the xxHash value from an incrememtal input. - * This method is slower than single-call functions, due to state management. - * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. - * - * An XXH state must first be allocated using `XXH*_createState()`. - * - * Start a new hash by initializing the state with a seed using `XXH*_reset()`. - * - * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. - * - * The function returns an error code, with 0 meaning OK, and any other value - * meaning there is an error. - * - * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. - * This function returns the nn-bits hash as an int or long long. - * - * It's still possible to continue inserting input into the hash state after a - * digest, and generate new hash values later on by invoking `XXH*_digest()`. - * - * When done, release the state using `XXH*_freeState()`. - */ - -typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state); - -XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); - -/******* Canonical representation *******/ - -/* - * The default return values from XXH functions are unsigned 32 and 64 bit - * integers. - * This the simplest and fastest format for further post-processing. - * - * However, this leaves open the question of what is the order on the byte level, - * since little and big endian conventions will store the same number differently. - * - * The canonical representation settles this issue by mandating big-endian - * convention, the same convention as human-readable numbers (large digits first). - * - * When writing hash values to storage, sending them over a network, or printing - * them, it's highly recommended to use the canonical representation to ensure - * portability across a wider range of systems, present and future. - * - * The following functions allow transformation of hash values to and from - * canonical format. - */ - -typedef struct { unsigned char digest[4]; } XXH32_canonical_t; -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); - - -#ifndef XXH_NO_LONG_LONG -/*-********************************************************************** -* 64-bit hash -************************************************************************/ -#if !defined (__VMS) \ - && (defined (__cplusplus) \ - || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include <stdint.h> - typedef uint64_t XXH64_hash_t; -#else - /* the following type must have a width of 64-bit */ - typedef unsigned long long XXH64_hash_t; -#endif - -/*! - * XXH64(): - * Returns the 64-bit hash of sequence of length @length stored at memory - * address @input. - * @seed can be used to alter the result predictably. - * - * This function usually runs faster on 64-bit systems, but slower on 32-bit - * systems (see benchmark). - * - * Note: XXH3 provides competitive speed for both 32-bit and 64-bit systems, - * and offers true 64/128 bit hash results. It provides a superior level of - * dispersion, and greatly reduces the risks of collisions. - */ -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, XXH64_hash_t seed); - -/******* Streaming *******/ -typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); - -XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, XXH64_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); - -/******* Canonical representation *******/ -typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); - - -/*-********************************************************************** -* XXH3 64-bit variant -************************************************************************/ - -/* ************************************************************************ - * XXH3 is a new hash algorithm featuring: - * - Improved speed for both small and large inputs - * - True 64-bit and 128-bit outputs - * - SIMD acceleration - * - Improved 32-bit viability - * - * Speed analysis methodology is explained here: - * - * https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html - * - * In general, expect XXH3 to run about ~2x faster on large inputs and >3x - * faster on small ones compared to XXH64, though exact differences depend on - * the platform. - * - * The algorithm is portable: Like XXH32 and XXH64, it generates the same hash - * on all platforms. - * - * It benefits greatly from SIMD and 64-bit arithmetic, but does not require it. - * - * Almost all 32-bit and 64-bit targets that can run XXH32 smoothly can run - * XXH3 at competitive speeds, even if XXH64 runs slowly. Further details are - * explained in the implementation. - * - * Optimized implementations are provided for AVX512, AVX2, SSE2, NEON, POWER8, - * ZVector and scalar targets. This can be controlled with the XXH_VECTOR macro. - * - * XXH3 offers 2 variants, _64bits and _128bits. - * When only 64 bits are needed, prefer calling the _64bits variant, as it - * reduces the amount of mixing, resulting in faster speed on small inputs. - * - * It's also generally simpler to manipulate a scalar return type than a struct. - * - * The 128-bit version adds additional strength, but it is slightly slower. - * - * The XXH3 algorithm is still in development. - * The results it produces may still change in future versions. - * - * Results produced by v0.7.x are not comparable with results from v0.7.y. - * However, the API is completely stable, and it can safely be used for - * ephemeral data (local sessions). - * - * Avoid storing values in long-term storage until the algorithm is finalized. - * XXH3's return values will be officially finalized upon reaching v0.8.0. - * - * After which, return values of XXH3 and XXH128 will no longer change in - * future versions. - * - * The API supports one-shot hashing, streaming mode, and custom secrets. - */ - -/* XXH3_64bits(): - * default 64-bit variant, using default secret and default seed of 0. - * It's the fastest variant. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* data, size_t len); - -/* - * XXH3_64bits_withSeed(): - * This variant generates a custom secret on the fly - * based on default secret altered using the `seed` value. - * While this operation is decently fast, note that it's not completely free. - * Note: seed==0 produces the same results as XXH3_64bits(). - */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); - -/* - * XXH3_64bits_withSecret(): - * It's possible to provide any blob of bytes as a "secret" to generate the hash. - * This makes it more difficult for an external actor to prepare an intentional collision. - * The main condition is that secretSize *must* be large enough (>= XXH3_SECRET_SIZE_MIN). - * However, the quality of produced hash values depends on secret's entropy. - * Technically, the secret must look like a bunch of random bytes. - * Avoid "trivial" or structured data such as repeated sequences or a text document. - * Whenever unsure about the "randomness" of the blob of bytes, - * consider relabelling it as a "custom seed" instead, - * and employ "XXH3_generateSecret()" (see below) - * to generate a high entropy secret derived from the custom seed. - */ -#define XXH3_SECRET_SIZE_MIN 136 -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); - - -/******* Streaming *******/ -/* - * Streaming requires state maintenance. - * This operation costs memory and CPU. - * As a consequence, streaming is slower than one-shot hashing. - * For better performance, prefer one-shot functions whenever applicable. - */ -typedef struct XXH3_state_s XXH3_state_t; -XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); -XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state); - -/* - * XXH3_64bits_reset(): - * Initialize with default parameters. - * digest will be equivalent to `XXH3_64bits()`. - */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr); -/* - * XXH3_64bits_reset_withSeed(): - * Generate a custom secret from `seed`, and store it into `statePtr`. - * digest will be equivalent to `XXH3_64bits_withSeed()`. - */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); -/* - * XXH3_64bits_reset_withSecret(): - * `secret` is referenced, it _must outlive_ the hash streaming session. - * Similar to one-shot API, `secretSize` must be >= `XXH3_SECRET_SIZE_MIN`, - * and the quality of produced hash values depends on secret's entropy - * (secret's content should look like a bunch of random bytes). - * When in doubt about the randomness of a candidate `secret`, - * consider employing `XXH3_generateSecret()` instead (see below). - */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); - -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr); - -/* note : canonical representation of XXH3 is the same as XXH64 - * since they both produce XXH64_hash_t values */ - - -/*-********************************************************************** -* XXH3 128-bit variant -************************************************************************/ - -typedef struct { - XXH64_hash_t low64; - XXH64_hash_t high64; -} XXH128_hash_t; - -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* data, size_t len); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); - -/******* Streaming *******/ -/* - * Streaming requires state maintenance. - * This operation costs memory and CPU. - * As a consequence, streaming is slower than one-shot hashing. - * For better performance, prefer one-shot functions whenever applicable. - * - * XXH3_128bits uses the same XXH3_state_t as XXH3_64bits(). - * Use already declared XXH3_createState() and XXH3_freeState(). - * - * All reset and streaming functions have same meaning as their 64-bit counterpart. - */ - -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t* statePtr); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); - -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH3_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* statePtr); - -/* Following helper functions make it possible to compare XXH128_hast_t values. - * Since XXH128_hash_t is a structure, this capability is not offered by the language. - * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ - -/*! - * XXH128_isEqual(): - * Return: 1 if `h1` and `h2` are equal, 0 if they are not. - */ -XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); - -/*! - * XXH128_cmp(): - * - * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. - * - * return: >0 if *h128_1 > *h128_2 - * =0 if *h128_1 == *h128_2 - * <0 if *h128_1 < *h128_2 - */ -XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2); - - -/******* Canonical representation *******/ -typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; -XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash); -XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); - - -#endif /* XXH_NO_LONG_LONG */ - -#endif /* XXHASH_H_5627135585666179 */ - - - -#if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) -#define XXHASH_H_STATIC_13879238742 -/* **************************************************************************** - * This section contains declarations which are not guaranteed to remain stable. - * They may change in future versions, becoming incompatible with a different - * version of the library. - * These declarations should only be used with static linking. - * Never use them in association with dynamic linking! - ***************************************************************************** */ - -/* - * These definitions are only present to allow static allocation - * of XXH states, on stack or in a struct, for example. - * Never **ever** access their members directly. - */ - -struct XXH32_state_s { - XXH32_hash_t total_len_32; - XXH32_hash_t large_len; - XXH32_hash_t v1; - XXH32_hash_t v2; - XXH32_hash_t v3; - XXH32_hash_t v4; - XXH32_hash_t mem32[4]; - XXH32_hash_t memsize; - XXH32_hash_t reserved; /* never read nor write, might be removed in a future version */ -}; /* typedef'd to XXH32_state_t */ - - -#ifndef XXH_NO_LONG_LONG /* defined when there is no 64-bit support */ - -struct XXH64_state_s { - XXH64_hash_t total_len; - XXH64_hash_t v1; - XXH64_hash_t v2; - XXH64_hash_t v3; - XXH64_hash_t v4; - XXH64_hash_t mem64[4]; - XXH32_hash_t memsize; - XXH32_hash_t reserved32; /* required for padding anyway */ - XXH64_hash_t reserved64; /* never read nor write, might be removed in a future version */ -}; /* typedef'd to XXH64_state_t */ - -#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11+ */ -# include <stdalign.h> -# define XXH_ALIGN(n) alignas(n) -#elif defined(__GNUC__) -# define XXH_ALIGN(n) __attribute__ ((aligned(n))) -#elif defined(_MSC_VER) -# define XXH_ALIGN(n) __declspec(align(n)) -#else -# define XXH_ALIGN(n) /* disabled */ -#endif - -/* Old GCC versions only accept the attribute after the type in structures. */ -#if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) /* C11+ */ \ - && defined(__GNUC__) -# define XXH_ALIGN_MEMBER(align, type) type XXH_ALIGN(align) -#else -# define XXH_ALIGN_MEMBER(align, type) XXH_ALIGN(align) type -#endif - -#define XXH3_INTERNALBUFFER_SIZE 256 -#define XXH3_SECRET_DEFAULT_SIZE 192 -struct XXH3_state_s { - XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); - /* used to store a custom secret generated from a seed */ - XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); - XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); - XXH32_hash_t bufferedSize; - XXH32_hash_t reserved32; - size_t nbStripesSoFar; - XXH64_hash_t totalLen; - size_t nbStripesPerBlock; - size_t secretLimit; - XXH64_hash_t seed; - XXH64_hash_t reserved64; - const unsigned char* extSecret; /* reference to external secret; - * if == NULL, use .customSecret instead */ - /* note: there may be some padding at the end due to alignment on 64 bytes */ -}; /* typedef'd to XXH3_state_t */ - -#undef XXH_ALIGN_MEMBER - -/* When the XXH3_state_t structure is merely emplaced on stack, - * it should be initialized with XXH3_INITSTATE() or a memset() - * in case its first reset uses XXH3_NNbits_reset_withSeed(). - * This init can be omitted if the first reset uses default or _withSecret mode. - * This operation isn't necessary when the state is created with XXH3_createState(). - * Note that this doesn't prepare the state for a streaming operation, - * it's still necessary to use XXH3_NNbits_reset*() afterwards. - */ -#define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; } - - -/* === Experimental API === */ -/* Symbols defined below must be considered tied to a specific library version. */ - -/* - * XXH3_generateSecret(): - * - * Derive a high-entropy secret from any user-defined content, named customSeed. - * The generated secret can be used in combination with `*_withSecret()` functions. - * The `_withSecret()` variants are useful to provide a higher level of protection than 64-bit seed, - * as it becomes much more difficult for an external actor to guess how to impact the calculation logic. - * - * The function accepts as input a custom seed of any length and any content, - * and derives from it a high-entropy secret of length XXH3_SECRET_DEFAULT_SIZE - * into an already allocated buffer secretBuffer. - * The generated secret is _always_ XXH_SECRET_DEFAULT_SIZE bytes long. - * - * The generated secret can then be used with any `*_withSecret()` variant. - * Functions `XXH3_128bits_withSecret()`, `XXH3_64bits_withSecret()`, - * `XXH3_128bits_reset_withSecret()` and `XXH3_64bits_reset_withSecret()` - * are part of this list. They all accept a `secret` parameter - * which must be very long for implementation reasons (>= XXH3_SECRET_SIZE_MIN) - * _and_ feature very high entropy (consist of random-looking bytes). - * These conditions can be a high bar to meet, so - * this function can be used to generate a secret of proper quality. - * - * customSeed can be anything. It can have any size, even small ones, - * and its content can be anything, even stupidly "low entropy" source such as a bunch of zeroes. - * The resulting `secret` will nonetheless provide all expected qualities. - * - * Supplying NULL as the customSeed copies the default secret into `secretBuffer`. - * When customSeedSize > 0, supplying NULL as customSeed is undefined behavior. - */ -XXH_PUBLIC_API void XXH3_generateSecret(void* secretBuffer, const void* customSeed, size_t customSeedSize); - - -/* simple short-cut to pre-selected XXH3_128bits variant */ -XXH_PUBLIC_API XXH128_hash_t XXH128(const void* data, size_t len, XXH64_hash_t seed); - - -#endif /* XXH_NO_LONG_LONG */ - - -#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) -# define XXH_IMPLEMENTATION -#endif - -#endif /* defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) */ - - -/* ======================================================================== */ -/* ======================================================================== */ -/* ======================================================================== */ - - -/*-********************************************************************** - * xxHash implementation - *-********************************************************************** - * xxHash's implementation used to be hosted inside xxhash.c. - * - * However, inlining requires implementation to be visible to the compiler, - * hence be included alongside the header. - * Previously, implementation was hosted inside xxhash.c, - * which was then #included when inlining was activated. - * This construction created issues with a few build and install systems, - * as it required xxhash.c to be stored in /include directory. - * - * xxHash implementation is now directly integrated within xxhash.h. - * As a consequence, xxhash.c is no longer needed in /include. - * - * xxhash.c is still available and is still useful. - * In a "normal" setup, when xxhash is not inlined, - * xxhash.h only exposes the prototypes and public symbols, - * while xxhash.c can be built into an object file xxhash.o - * which can then be linked into the final binary. - ************************************************************************/ - -#if ( defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) \ - || defined(XXH_IMPLEMENTATION) ) && !defined(XXH_IMPLEM_13a8737387) -# define XXH_IMPLEM_13a8737387 - -/* ************************************* -* Tuning parameters -***************************************/ -/*! - * XXH_FORCE_MEMORY_ACCESS: - * By default, access to unaligned memory is controlled by `memcpy()`, which is - * safe and portable. - * - * Unfortunately, on some target/compiler combinations, the generated assembly - * is sub-optimal. - * - * The below switch allow selection of a different access method - * in the search for improved performance. - * Method 0 (default): - * Use `memcpy()`. Safe and portable. Default. - * Method 1: - * `__attribute__((packed))` statement. It depends on compiler extensions - * and is therefore not portable. - * This method is safe if your compiler supports it, and *generally* as - * fast or faster than `memcpy`. - * Method 2: - * Direct access via cast. This method doesn't depend on the compiler but - * violates the C standard. - * It can generate buggy code on targets which do not support unaligned - * memory accesses. - * But in some circumstances, it's the only known way to get the most - * performance (example: GCC + ARMv6) - * Method 3: - * Byteshift. This can generate the best code on old compilers which don't - * inline small `memcpy()` calls, and it might also be faster on big-endian - * systems which lack a native byteswap instruction. - * See https://stackoverflow.com/a/32095106/646947 for details. - * Prefer these methods in priority order (0 > 1 > 2 > 3) - */ -#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if !defined(__clang__) && defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED) && defined(__ARM_ARCH) && (__ARM_ARCH == 6) -# define XXH_FORCE_MEMORY_ACCESS 2 -# elif !defined(__clang__) && ((defined(__INTEL_COMPILER) && !defined(_WIN32)) || \ - (defined(__GNUC__) && (defined(__ARM_ARCH) && __ARM_ARCH >= 7))) -# define XXH_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -/*! - * XXH_ACCEPT_NULL_INPUT_POINTER: - * If the input pointer is NULL, xxHash's default behavior is to dereference it, - * triggering a segfault. - * When this macro is enabled, xxHash actively checks the input for a null pointer. - * If it is, the result for null input pointers is the same as a zero-length input. - */ -#ifndef XXH_ACCEPT_NULL_INPUT_POINTER /* can be defined externally */ -# define XXH_ACCEPT_NULL_INPUT_POINTER 0 -#endif - -/*! - * XXH_FORCE_ALIGN_CHECK: - * This is an important performance trick - * for architectures without decent unaligned memory access performance. - * It checks for input alignment, and when conditions are met, - * uses a "fast path" employing direct 32-bit/64-bit read, - * resulting in _dramatically faster_ read speed. - * - * The check costs one initial branch per hash, which is generally negligible, but not zero. - * Moreover, it's not useful to generate binary for an additional code path - * if memory access uses same instruction for both aligned and unaligned adresses. - * - * In these cases, the alignment check can be removed by setting this macro to 0. - * Then the code will always use unaligned memory access. - * Align check is automatically disabled on x86, x64 & arm64, - * which are platforms known to offer good unaligned memory accesses performance. - * - * This option does not affect XXH3 (only XXH32 and XXH64). - */ -#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \ - || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */ -# define XXH_FORCE_ALIGN_CHECK 0 -# else -# define XXH_FORCE_ALIGN_CHECK 1 -# endif -#endif - -/*! - * XXH_NO_INLINE_HINTS: - * - * By default, xxHash tries to force the compiler to inline almost all internal - * functions. - * - * This can usually improve performance due to reduced jumping and improved - * constant folding, but significantly increases the size of the binary which - * might not be favorable. - * - * Additionally, sometimes the forced inlining can be detrimental to performance, - * depending on the architecture. - * - * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the - * compiler full control on whether to inline or not. - * - * When not optimizing (-O0), optimizing for size (-Os, -Oz), or using - * -fno-inline with GCC or Clang, this will automatically be defined. - */ -#ifndef XXH_NO_INLINE_HINTS -# if defined(__OPTIMIZE_SIZE__) /* -Os, -Oz */ \ - || defined(__NO_INLINE__) /* -O0, -fno-inline */ -# define XXH_NO_INLINE_HINTS 1 -# else -# define XXH_NO_INLINE_HINTS 0 -# endif -#endif - -/*! - * XXH_REROLL: - * Whether to reroll XXH32_finalize, and XXH64_finalize, - * instead of using an unrolled jump table/if statement loop. - * - * This is automatically defined on -Os/-Oz on GCC and Clang. - */ -#ifndef XXH_REROLL -# if defined(__OPTIMIZE_SIZE__) -# define XXH_REROLL 1 -# else -# define XXH_REROLL 0 -# endif -#endif - - -/* ************************************* -* Includes & Memory related functions -***************************************/ -/*! - * Modify the local functions below should you wish to use - * different memory routines for malloc() and free() - */ -#include <stdlib.h> - -static void* XXH_malloc(size_t s) { return malloc(s); } -static void XXH_free(void* p) { free(p); } - -/*! and for memcpy() */ -#include <string.h> -static void* XXH_memcpy(void* dest, const void* src, size_t size) -{ - return memcpy(dest,src,size); -} - -#include <limits.h> /* ULLONG_MAX */ - - -/* ************************************* -* Compiler Specific Options -***************************************/ -#ifdef _MSC_VER /* Visual Studio warning fix */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -#endif - -#if XXH_NO_INLINE_HINTS /* disable inlining hints */ -# if defined(__GNUC__) -# define XXH_FORCE_INLINE static __attribute__((unused)) -# else -# define XXH_FORCE_INLINE static -# endif -# define XXH_NO_INLINE static -/* enable inlining hints */ -#elif defined(_MSC_VER) /* Visual Studio */ -# define XXH_FORCE_INLINE static __forceinline -# define XXH_NO_INLINE static __declspec(noinline) -#elif defined(__GNUC__) -# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused)) -# define XXH_NO_INLINE static __attribute__((noinline)) -#elif defined (__cplusplus) \ - || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* C99 */ -# define XXH_FORCE_INLINE static inline -# define XXH_NO_INLINE static -#else -# define XXH_FORCE_INLINE static -# define XXH_NO_INLINE static -#endif - - - -/* ************************************* -* Debug -***************************************/ -/* - * XXH_DEBUGLEVEL is expected to be defined externally, typically via the - * compiler's command line options. The value must be a number. - */ -#ifndef XXH_DEBUGLEVEL -# ifdef DEBUGLEVEL /* backwards compat */ -# define XXH_DEBUGLEVEL DEBUGLEVEL -# else -# define XXH_DEBUGLEVEL 0 -# endif -#endif - -#if (XXH_DEBUGLEVEL>=1) -# include <assert.h> /* note: can still be disabled with NDEBUG */ -# define XXH_ASSERT(c) assert(c) -#else -# define XXH_ASSERT(c) ((void)0) -#endif - -/* note: use after variable declarations */ -#define XXH_STATIC_ASSERT(c) do { enum { XXH_sa = 1/(int)(!!(c)) }; } while (0) - - -/* ************************************* -* Basic Types -***************************************/ -#if !defined (__VMS) \ - && (defined (__cplusplus) \ - || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include <stdint.h> - typedef uint8_t xxh_u8; -#else - typedef unsigned char xxh_u8; -#endif -typedef XXH32_hash_t xxh_u32; - -#ifdef XXH_OLD_NAMES -# define BYTE xxh_u8 -# define U8 xxh_u8 -# define U32 xxh_u32 -#endif - -/* *** Memory access *** */ - -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) -/* - * Manual byteshift. Best for old compilers which don't inline memcpy. - * We actually directly use XXH_readLE32 and XXH_readBE32. - */ -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) - -/* - * Force direct memory access. Only works on CPU which support unaligned memory - * access in hardware. - */ -static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; } - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) - -/* - * __pack instructions are safer but compiler specific, hence potentially - * problematic for some compilers. - * - * Currently only defined for GCC and ICC. - */ -#ifdef XXH_OLD_NAMES -typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; -#endif -static xxh_u32 XXH_read32(const void* ptr) -{ - typedef union { xxh_u32 u32; } __attribute__((packed)) xxh_unalign; - return ((const xxh_unalign*)ptr)->u32; -} - -#else - -/* - * Portable and safe solution. Generally efficient. - * see: https://stackoverflow.com/a/32095106/646947 - */ -static xxh_u32 XXH_read32(const void* memPtr) -{ - xxh_u32 val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - - -/* *** Endianess *** */ -typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; - -/*! - * XXH_CPU_LITTLE_ENDIAN: - * Defined to 1 if the target is little endian, or 0 if it is big endian. - * It can be defined externally, for example on the compiler command line. - * - * If it is not defined, a runtime check (which is usually constant folded) - * is used instead. - */ -#ifndef XXH_CPU_LITTLE_ENDIAN -/* - * Try to detect endianness automatically, to avoid the nonstandard behavior - * in `XXH_isLittleEndian()` - */ -# if defined(_WIN32) /* Windows is always little endian */ \ - || defined(__LITTLE_ENDIAN__) \ - || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) -# define XXH_CPU_LITTLE_ENDIAN 1 -# elif defined(__BIG_ENDIAN__) \ - || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) -# define XXH_CPU_LITTLE_ENDIAN 0 -# else -/* - * runtime test, presumed to simplify to a constant by compiler - */ -static int XXH_isLittleEndian(void) -{ - /* - * Portable and well-defined behavior. - * Don't use static: it is detrimental to performance. - */ - const union { xxh_u32 u; xxh_u8 c[4]; } one = { 1 }; - return one.c[0]; -} -# define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian() -# endif -#endif - - - - -/* **************************************** -* Compiler-specific Functions and Macros -******************************************/ -#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -#ifdef __has_builtin -# define XXH_HAS_BUILTIN(x) __has_builtin(x) -#else -# define XXH_HAS_BUILTIN(x) 0 -#endif - -#if !defined(NO_CLANG_BUILTIN) && XXH_HAS_BUILTIN(__builtin_rotateleft32) \ - && XXH_HAS_BUILTIN(__builtin_rotateleft64) -# define XXH_rotl32 __builtin_rotateleft32 -# define XXH_rotl64 __builtin_rotateleft64 -/* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ -#elif defined(_MSC_VER) -# define XXH_rotl32(x,r) _rotl(x,r) -# define XXH_rotl64(x,r) _rotl64(x,r) -#else -# define XXH_rotl32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) -# define XXH_rotl64(x,r) (((x) << (r)) | ((x) >> (64 - (r)))) -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap32 _byteswap_ulong -#elif XXH_GCC_VERSION >= 403 -# define XXH_swap32 __builtin_bswap32 -#else -static xxh_u32 XXH_swap32 (xxh_u32 x) -{ - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} -#endif - - -/* *************************** -* Memory reads -*****************************/ -typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; - -/* - * XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. - * - * This is ideal for older compilers which don't inline memcpy. - */ -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) - -XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* memPtr) -{ - const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; - return bytePtr[0] - | ((xxh_u32)bytePtr[1] << 8) - | ((xxh_u32)bytePtr[2] << 16) - | ((xxh_u32)bytePtr[3] << 24); -} - -XXH_FORCE_INLINE xxh_u32 XXH_readBE32(const void* memPtr) -{ - const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; - return bytePtr[3] - | ((xxh_u32)bytePtr[2] << 8) - | ((xxh_u32)bytePtr[1] << 16) - | ((xxh_u32)bytePtr[0] << 24); -} - -#else -XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); -} - -static xxh_u32 XXH_readBE32(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); -} -#endif - -XXH_FORCE_INLINE xxh_u32 -XXH_readLE32_align(const void* ptr, XXH_alignment align) -{ - if (align==XXH_unaligned) { - return XXH_readLE32(ptr); - } else { - return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr); - } -} - - -/* ************************************* -* Misc -***************************************/ -XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } - - -/* ******************************************************************* -* 32-bit hash functions -*********************************************************************/ -static const xxh_u32 XXH_PRIME32_1 = 0x9E3779B1U; /* 0b10011110001101110111100110110001 */ -static const xxh_u32 XXH_PRIME32_2 = 0x85EBCA77U; /* 0b10000101111010111100101001110111 */ -static const xxh_u32 XXH_PRIME32_3 = 0xC2B2AE3DU; /* 0b11000010101100101010111000111101 */ -static const xxh_u32 XXH_PRIME32_4 = 0x27D4EB2FU; /* 0b00100111110101001110101100101111 */ -static const xxh_u32 XXH_PRIME32_5 = 0x165667B1U; /* 0b00010110010101100110011110110001 */ - -#ifdef XXH_OLD_NAMES -# define PRIME32_1 XXH_PRIME32_1 -# define PRIME32_2 XXH_PRIME32_2 -# define PRIME32_3 XXH_PRIME32_3 -# define PRIME32_4 XXH_PRIME32_4 -# define PRIME32_5 XXH_PRIME32_5 -#endif - -static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) -{ - acc += input * XXH_PRIME32_2; - acc = XXH_rotl32(acc, 13); - acc *= XXH_PRIME32_1; -#if defined(__GNUC__) && defined(__SSE4_1__) && !defined(XXH_ENABLE_AUTOVECTORIZE) - /* - * UGLY HACK: - * This inline assembly hack forces acc into a normal register. This is the - * only thing that prevents GCC and Clang from autovectorizing the XXH32 - * loop (pragmas and attributes don't work for some resason) without globally - * disabling SSE4.1. - * - * The reason we want to avoid vectorization is because despite working on - * 4 integers at a time, there are multiple factors slowing XXH32 down on - * SSE4: - * - There's a ridiculous amount of lag from pmulld (10 cycles of latency on - * newer chips!) making it slightly slower to multiply four integers at - * once compared to four integers independently. Even when pmulld was - * fastest, Sandy/Ivy Bridge, it is still not worth it to go into SSE - * just to multiply unless doing a long operation. - * - * - Four instructions are required to rotate, - * movqda tmp, v // not required with VEX encoding - * pslld tmp, 13 // tmp <<= 13 - * psrld v, 19 // x >>= 19 - * por v, tmp // x |= tmp - * compared to one for scalar: - * roll v, 13 // reliably fast across the board - * shldl v, v, 13 // Sandy Bridge and later prefer this for some reason - * - * - Instruction level parallelism is actually more beneficial here because - * the SIMD actually serializes this operation: While v1 is rotating, v2 - * can load data, while v3 can multiply. SSE forces them to operate - * together. - * - * How this hack works: - * __asm__("" // Declare an assembly block but don't declare any instructions - * : // However, as an Input/Output Operand, - * "+r" // constrain a read/write operand (+) as a general purpose register (r). - * (acc) // and set acc as the operand - * ); - * - * Because of the 'r', the compiler has promised that seed will be in a - * general purpose register and the '+' says that it will be 'read/write', - * so it has to assume it has changed. It is like volatile without all the - * loads and stores. - * - * Since the argument has to be in a normal register (not an SSE register), - * each time XXH32_round is called, it is impossible to vectorize. - */ - __asm__("" : "+r" (acc)); -#endif - return acc; -} - -/* mix all bits */ -static xxh_u32 XXH32_avalanche(xxh_u32 h32) -{ - h32 ^= h32 >> 15; - h32 *= XXH_PRIME32_2; - h32 ^= h32 >> 13; - h32 *= XXH_PRIME32_3; - h32 ^= h32 >> 16; - return(h32); -} - -#define XXH_get32bits(p) XXH_readLE32_align(p, align) - -static xxh_u32 -XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) -{ -#define XXH_PROCESS1 do { \ - h32 += (*ptr++) * XXH_PRIME32_5; \ - h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \ -} while (0) - -#define XXH_PROCESS4 do { \ - h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \ - ptr += 4; \ - h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \ -} while (0) - - /* Compact rerolled version */ - if (XXH_REROLL) { - len &= 15; - while (len >= 4) { - XXH_PROCESS4; - len -= 4; - } - while (len > 0) { - XXH_PROCESS1; - --len; - } - return XXH32_avalanche(h32); - } else { - switch(len&15) /* or switch(bEnd - p) */ { - case 12: XXH_PROCESS4; - /* fallthrough */ - case 8: XXH_PROCESS4; - /* fallthrough */ - case 4: XXH_PROCESS4; - return XXH32_avalanche(h32); - - case 13: XXH_PROCESS4; - /* fallthrough */ - case 9: XXH_PROCESS4; - /* fallthrough */ - case 5: XXH_PROCESS4; - XXH_PROCESS1; - return XXH32_avalanche(h32); - - case 14: XXH_PROCESS4; - /* fallthrough */ - case 10: XXH_PROCESS4; - /* fallthrough */ - case 6: XXH_PROCESS4; - XXH_PROCESS1; - XXH_PROCESS1; - return XXH32_avalanche(h32); - - case 15: XXH_PROCESS4; - /* fallthrough */ - case 11: XXH_PROCESS4; - /* fallthrough */ - case 7: XXH_PROCESS4; - /* fallthrough */ - case 3: XXH_PROCESS1; - /* fallthrough */ - case 2: XXH_PROCESS1; - /* fallthrough */ - case 1: XXH_PROCESS1; - /* fallthrough */ - case 0: return XXH32_avalanche(h32); - } - XXH_ASSERT(0); - return h32; /* reaching this point is deemed impossible */ - } -} - -#ifdef XXH_OLD_NAMES -# define PROCESS1 XXH_PROCESS1 -# define PROCESS4 XXH_PROCESS4 -#else -# undef XXH_PROCESS1 -# undef XXH_PROCESS4 -#endif - -XXH_FORCE_INLINE xxh_u32 -XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) -{ - const xxh_u8* bEnd = input + len; - xxh_u32 h32; - -#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) - if (input==NULL) { - len=0; - bEnd=input=(const xxh_u8*)(size_t)16; - } -#endif - - if (len>=16) { - const xxh_u8* const limit = bEnd - 15; - xxh_u32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; - xxh_u32 v2 = seed + XXH_PRIME32_2; - xxh_u32 v3 = seed + 0; - xxh_u32 v4 = seed - XXH_PRIME32_1; - - do { - v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; - v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; - v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4; - v4 = XXH32_round(v4, XXH_get32bits(input)); input += 4; - } while (input < limit); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) - + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); - } else { - h32 = seed + XXH_PRIME32_5; - } - - h32 += (xxh_u32)len; - - return XXH32_finalize(h32, input, len&15, align); -} - - -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH32_state_t state; - XXH32_reset(&state, seed); - XXH32_update(&state, (const xxh_u8*)input, len); - return XXH32_digest(&state); - -#else - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ - return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); - } } - - return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); -#endif -} - - - -/******* Hash streaming *******/ - -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) -{ - return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) -{ - memcpy(dstState, srcState, sizeof(*dstState)); -} - -XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) -{ - XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)); - state.v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; - state.v2 = seed + XXH_PRIME32_2; - state.v3 = seed + 0; - state.v4 = seed - XXH_PRIME32_1; - /* do not write into reserved, planned to be removed in a future version */ - memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved)); - return XXH_OK; -} - - -XXH_PUBLIC_API XXH_errorcode -XXH32_update(XXH32_state_t* state, const void* input, size_t len) -{ - if (input==NULL) -#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) - return XXH_OK; -#else - return XXH_ERROR; -#endif - - { const xxh_u8* p = (const xxh_u8*)input; - const xxh_u8* const bEnd = p + len; - - state->total_len_32 += (XXH32_hash_t)len; - state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); - - if (state->memsize + len < 16) { /* fill in tmp buffer */ - XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len); - state->memsize += (XXH32_hash_t)len; - return XXH_OK; - } - - if (state->memsize) { /* some data left from previous update */ - XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize); - { const xxh_u32* p32 = state->mem32; - state->v1 = XXH32_round(state->v1, XXH_readLE32(p32)); p32++; - state->v2 = XXH32_round(state->v2, XXH_readLE32(p32)); p32++; - state->v3 = XXH32_round(state->v3, XXH_readLE32(p32)); p32++; - state->v4 = XXH32_round(state->v4, XXH_readLE32(p32)); - } - p += 16-state->memsize; - state->memsize = 0; - } - - if (p <= bEnd-16) { - const xxh_u8* const limit = bEnd - 16; - xxh_u32 v1 = state->v1; - xxh_u32 v2 = state->v2; - xxh_u32 v3 = state->v3; - xxh_u32 v4 = state->v4; - - do { - v1 = XXH32_round(v1, XXH_readLE32(p)); p+=4; - v2 = XXH32_round(v2, XXH_readLE32(p)); p+=4; - v3 = XXH32_round(v3, XXH_readLE32(p)); p+=4; - v4 = XXH32_round(v4, XXH_readLE32(p)); p+=4; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - } - - return XXH_OK; -} - - -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* state) -{ - xxh_u32 h32; - - if (state->large_len) { - h32 = XXH_rotl32(state->v1, 1) - + XXH_rotl32(state->v2, 7) - + XXH_rotl32(state->v3, 12) - + XXH_rotl32(state->v4, 18); - } else { - h32 = state->v3 /* == seed */ + XXH_PRIME32_5; - } - - h32 += state->total_len_32; - - return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); -} - - -/******* Canonical representation *******/ - -/* - * The default return values from XXH functions are unsigned 32 and 64 bit - * integers. - * - * The canonical representation uses big endian convention, the same convention - * as human-readable numbers (large digits first). - * - * This way, hash values can be written into a file or buffer, remaining - * comparable across different systems. - * - * The following functions allow transformation of hash values to and from their - * canonical format. - */ -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); - memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) -{ - return XXH_readBE32(src); -} - - -#ifndef XXH_NO_LONG_LONG - -/* ******************************************************************* -* 64-bit hash functions -*********************************************************************/ - -/******* Memory access *******/ - -typedef XXH64_hash_t xxh_u64; - -#ifdef XXH_OLD_NAMES -# define U64 xxh_u64 -#endif - -/*! - * XXH_REROLL_XXH64: - * Whether to reroll the XXH64_finalize() loop. - * - * Just like XXH32, we can unroll the XXH64_finalize() loop. This can be a - * performance gain on 64-bit hosts, as only one jump is required. - * - * However, on 32-bit hosts, because arithmetic needs to be done with two 32-bit - * registers, and 64-bit arithmetic needs to be simulated, it isn't beneficial - * to unroll. The code becomes ridiculously large (the largest function in the - * binary on i386!), and rerolling it saves anywhere from 3kB to 20kB. It is - * also slightly faster because it fits into cache better and is more likely - * to be inlined by the compiler. - * - * If XXH_REROLL is defined, this is ignored and the loop is always rerolled. - */ -#ifndef XXH_REROLL_XXH64 -# if (defined(__ILP32__) || defined(_ILP32)) /* ILP32 is often defined on 32-bit GCC family */ \ - || !(defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) /* x86-64 */ \ - || defined(_M_ARM64) || defined(__aarch64__) || defined(__arm64__) /* aarch64 */ \ - || defined(__PPC64__) || defined(__PPC64LE__) || defined(__ppc64__) || defined(__powerpc64__) /* ppc64 */ \ - || defined(__mips64__) || defined(__mips64)) /* mips64 */ \ - || (!defined(SIZE_MAX) || SIZE_MAX < ULLONG_MAX) /* check limits */ -# define XXH_REROLL_XXH64 1 -# else -# define XXH_REROLL_XXH64 0 -# endif -#endif /* !defined(XXH_REROLL_XXH64) */ - -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) -/* - * Manual byteshift. Best for old compilers which don't inline memcpy. - * We actually directly use XXH_readLE64 and XXH_readBE64. - */ -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) - -/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ -static xxh_u64 XXH_read64(const void* memPtr) { return *(const xxh_u64*) memPtr; } - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) - -/* - * __pack instructions are safer, but compiler specific, hence potentially - * problematic for some compilers. - * - * Currently only defined for GCC and ICC. - */ -#ifdef XXH_OLD_NAMES -typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; -#endif -static xxh_u64 XXH_read64(const void* ptr) -{ - typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) xxh_unalign64; - return ((const xxh_unalign64*)ptr)->u64; -} - -#else - -/* - * Portable and safe solution. Generally efficient. - * see: https://stackoverflow.com/a/32095106/646947 - */ -static xxh_u64 XXH_read64(const void* memPtr) -{ - xxh_u64 val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap64 _byteswap_uint64 -#elif XXH_GCC_VERSION >= 403 -# define XXH_swap64 __builtin_bswap64 -#else -static xxh_u64 XXH_swap64 (xxh_u64 x) -{ - return ((x << 56) & 0xff00000000000000ULL) | - ((x << 40) & 0x00ff000000000000ULL) | - ((x << 24) & 0x0000ff0000000000ULL) | - ((x << 8) & 0x000000ff00000000ULL) | - ((x >> 8) & 0x00000000ff000000ULL) | - ((x >> 24) & 0x0000000000ff0000ULL) | - ((x >> 40) & 0x000000000000ff00ULL) | - ((x >> 56) & 0x00000000000000ffULL); -} -#endif - - -/* XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. */ -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) - -XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* memPtr) -{ - const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; - return bytePtr[0] - | ((xxh_u64)bytePtr[1] << 8) - | ((xxh_u64)bytePtr[2] << 16) - | ((xxh_u64)bytePtr[3] << 24) - | ((xxh_u64)bytePtr[4] << 32) - | ((xxh_u64)bytePtr[5] << 40) - | ((xxh_u64)bytePtr[6] << 48) - | ((xxh_u64)bytePtr[7] << 56); -} - -XXH_FORCE_INLINE xxh_u64 XXH_readBE64(const void* memPtr) -{ - const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; - return bytePtr[7] - | ((xxh_u64)bytePtr[6] << 8) - | ((xxh_u64)bytePtr[5] << 16) - | ((xxh_u64)bytePtr[4] << 24) - | ((xxh_u64)bytePtr[3] << 32) - | ((xxh_u64)bytePtr[2] << 40) - | ((xxh_u64)bytePtr[1] << 48) - | ((xxh_u64)bytePtr[0] << 56); -} - -#else -XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); -} - -static xxh_u64 XXH_readBE64(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); -} -#endif - -XXH_FORCE_INLINE xxh_u64 -XXH_readLE64_align(const void* ptr, XXH_alignment align) -{ - if (align==XXH_unaligned) - return XXH_readLE64(ptr); - else - return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr); -} - - -/******* xxh64 *******/ - -static const xxh_u64 XXH_PRIME64_1 = 0x9E3779B185EBCA87ULL; /* 0b1001111000110111011110011011000110000101111010111100101010000111 */ -static const xxh_u64 XXH_PRIME64_2 = 0xC2B2AE3D27D4EB4FULL; /* 0b1100001010110010101011100011110100100111110101001110101101001111 */ -static const xxh_u64 XXH_PRIME64_3 = 0x165667B19E3779F9ULL; /* 0b0001011001010110011001111011000110011110001101110111100111111001 */ -static const xxh_u64 XXH_PRIME64_4 = 0x85EBCA77C2B2AE63ULL; /* 0b1000010111101011110010100111011111000010101100101010111001100011 */ -static const xxh_u64 XXH_PRIME64_5 = 0x27D4EB2F165667C5ULL; /* 0b0010011111010100111010110010111100010110010101100110011111000101 */ - -#ifdef XXH_OLD_NAMES -# define PRIME64_1 XXH_PRIME64_1 -# define PRIME64_2 XXH_PRIME64_2 -# define PRIME64_3 XXH_PRIME64_3 -# define PRIME64_4 XXH_PRIME64_4 -# define PRIME64_5 XXH_PRIME64_5 -#endif - -static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) -{ - acc += input * XXH_PRIME64_2; - acc = XXH_rotl64(acc, 31); - acc *= XXH_PRIME64_1; - return acc; -} - -static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) -{ - val = XXH64_round(0, val); - acc ^= val; - acc = acc * XXH_PRIME64_1 + XXH_PRIME64_4; - return acc; -} - -static xxh_u64 XXH64_avalanche(xxh_u64 h64) -{ - h64 ^= h64 >> 33; - h64 *= XXH_PRIME64_2; - h64 ^= h64 >> 29; - h64 *= XXH_PRIME64_3; - h64 ^= h64 >> 32; - return h64; -} - - -#define XXH_get64bits(p) XXH_readLE64_align(p, align) - -static xxh_u64 -XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) -{ -#define XXH_PROCESS1_64 do { \ - h64 ^= (*ptr++) * XXH_PRIME64_5; \ - h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; \ -} while (0) - -#define XXH_PROCESS4_64 do { \ - h64 ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; \ - ptr += 4; \ - h64 = XXH_rotl64(h64, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; \ -} while (0) - -#define XXH_PROCESS8_64 do { \ - xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); \ - ptr += 8; \ - h64 ^= k1; \ - h64 = XXH_rotl64(h64,27) * XXH_PRIME64_1 + XXH_PRIME64_4; \ -} while (0) - - /* Rerolled version for 32-bit targets is faster and much smaller. */ - if (XXH_REROLL || XXH_REROLL_XXH64) { - len &= 31; - while (len >= 8) { - XXH_PROCESS8_64; - len -= 8; - } - if (len >= 4) { - XXH_PROCESS4_64; - len -= 4; - } - while (len > 0) { - XXH_PROCESS1_64; - --len; - } - return XXH64_avalanche(h64); - } else { - switch(len & 31) { - case 24: XXH_PROCESS8_64; - /* fallthrough */ - case 16: XXH_PROCESS8_64; - /* fallthrough */ - case 8: XXH_PROCESS8_64; - return XXH64_avalanche(h64); - - case 28: XXH_PROCESS8_64; - /* fallthrough */ - case 20: XXH_PROCESS8_64; - /* fallthrough */ - case 12: XXH_PROCESS8_64; - /* fallthrough */ - case 4: XXH_PROCESS4_64; - return XXH64_avalanche(h64); - - case 25: XXH_PROCESS8_64; - /* fallthrough */ - case 17: XXH_PROCESS8_64; - /* fallthrough */ - case 9: XXH_PROCESS8_64; - XXH_PROCESS1_64; - return XXH64_avalanche(h64); - - case 29: XXH_PROCESS8_64; - /* fallthrough */ - case 21: XXH_PROCESS8_64; - /* fallthrough */ - case 13: XXH_PROCESS8_64; - /* fallthrough */ - case 5: XXH_PROCESS4_64; - XXH_PROCESS1_64; - return XXH64_avalanche(h64); - - case 26: XXH_PROCESS8_64; - /* fallthrough */ - case 18: XXH_PROCESS8_64; - /* fallthrough */ - case 10: XXH_PROCESS8_64; - XXH_PROCESS1_64; - XXH_PROCESS1_64; - return XXH64_avalanche(h64); - - case 30: XXH_PROCESS8_64; - /* fallthrough */ - case 22: XXH_PROCESS8_64; - /* fallthrough */ - case 14: XXH_PROCESS8_64; - /* fallthrough */ - case 6: XXH_PROCESS4_64; - XXH_PROCESS1_64; - XXH_PROCESS1_64; - return XXH64_avalanche(h64); - - case 27: XXH_PROCESS8_64; - /* fallthrough */ - case 19: XXH_PROCESS8_64; - /* fallthrough */ - case 11: XXH_PROCESS8_64; - XXH_PROCESS1_64; - XXH_PROCESS1_64; - XXH_PROCESS1_64; - return XXH64_avalanche(h64); - - case 31: XXH_PROCESS8_64; - /* fallthrough */ - case 23: XXH_PROCESS8_64; - /* fallthrough */ - case 15: XXH_PROCESS8_64; - /* fallthrough */ - case 7: XXH_PROCESS4_64; - /* fallthrough */ - case 3: XXH_PROCESS1_64; - /* fallthrough */ - case 2: XXH_PROCESS1_64; - /* fallthrough */ - case 1: XXH_PROCESS1_64; - /* fallthrough */ - case 0: return XXH64_avalanche(h64); - } - } - /* impossible to reach */ - XXH_ASSERT(0); - return 0; /* unreachable, but some compilers complain without it */ -} - -#ifdef XXH_OLD_NAMES -# define PROCESS1_64 XXH_PROCESS1_64 -# define PROCESS4_64 XXH_PROCESS4_64 -# define PROCESS8_64 XXH_PROCESS8_64 -#else -# undef XXH_PROCESS1_64 -# undef XXH_PROCESS4_64 -# undef XXH_PROCESS8_64 -#endif - -XXH_FORCE_INLINE xxh_u64 -XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) -{ - const xxh_u8* bEnd = input + len; - xxh_u64 h64; - -#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) - if (input==NULL) { - len=0; - bEnd=input=(const xxh_u8*)(size_t)32; - } -#endif - - if (len>=32) { - const xxh_u8* const limit = bEnd - 32; - xxh_u64 v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; - xxh_u64 v2 = seed + XXH_PRIME64_2; - xxh_u64 v3 = seed + 0; - xxh_u64 v4 = seed - XXH_PRIME64_1; - - do { - v1 = XXH64_round(v1, XXH_get64bits(input)); input+=8; - v2 = XXH64_round(v2, XXH_get64bits(input)); input+=8; - v3 = XXH64_round(v3, XXH_get64bits(input)); input+=8; - v4 = XXH64_round(v4, XXH_get64bits(input)); input+=8; - } while (input<=limit); - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - - } else { - h64 = seed + XXH_PRIME64_5; - } - - h64 += (xxh_u64) len; - - return XXH64_finalize(h64, input, len, align); -} - - -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t len, XXH64_hash_t seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH64_state_t state; - XXH64_reset(&state, seed); - XXH64_update(&state, (const xxh_u8*)input, len); - return XXH64_digest(&state); - -#else - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ - return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); - } } - - return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); - -#endif -} - -/******* Hash Streaming *******/ - -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) -{ - return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState) -{ - memcpy(dstState, srcState, sizeof(*dstState)); -} - -XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, XXH64_hash_t seed) -{ - XXH64_state_t state; /* use a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)); - state.v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; - state.v2 = seed + XXH_PRIME64_2; - state.v3 = seed + 0; - state.v4 = seed - XXH_PRIME64_1; - /* do not write into reserved64, might be removed in a future version */ - memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved64)); - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH64_update (XXH64_state_t* state, const void* input, size_t len) -{ - if (input==NULL) -#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) - return XXH_OK; -#else - return XXH_ERROR; -#endif - - { const xxh_u8* p = (const xxh_u8*)input; - const xxh_u8* const bEnd = p + len; - - state->total_len += len; - - if (state->memsize + len < 32) { /* fill in tmp buffer */ - XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len); - state->memsize += (xxh_u32)len; - return XXH_OK; - } - - if (state->memsize) { /* tmp buffer is full */ - XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize); - state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0)); - state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1)); - state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2)); - state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3)); - p += 32-state->memsize; - state->memsize = 0; - } - - if (p+32 <= bEnd) { - const xxh_u8* const limit = bEnd - 32; - xxh_u64 v1 = state->v1; - xxh_u64 v2 = state->v2; - xxh_u64 v3 = state->v3; - xxh_u64 v4 = state->v4; - - do { - v1 = XXH64_round(v1, XXH_readLE64(p)); p+=8; - v2 = XXH64_round(v2, XXH_readLE64(p)); p+=8; - v3 = XXH64_round(v3, XXH_readLE64(p)); p+=8; - v4 = XXH64_round(v4, XXH_readLE64(p)); p+=8; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - } - - return XXH_OK; -} - - -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* state) -{ - xxh_u64 h64; - - if (state->total_len >= 32) { - xxh_u64 const v1 = state->v1; - xxh_u64 const v2 = state->v2; - xxh_u64 const v3 = state->v3; - xxh_u64 const v4 = state->v4; - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - } else { - h64 = state->v3 /*seed*/ + XXH_PRIME64_5; - } - - h64 += (xxh_u64) state->total_len; - - return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); -} - - -/******* Canonical representation *******/ - -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); - memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) -{ - return XXH_readBE64(src); -} - - - -/* ********************************************************************* -* XXH3 -* New generation hash designed for speed on small keys and vectorization -************************************************************************ */ - -/* === Compiler specifics === */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ -# define XXH_RESTRICT restrict -#else -/* Note: it might be useful to define __restrict or __restrict__ for some C++ compilers */ -# define XXH_RESTRICT /* disable */ -#endif - -#if (defined(__GNUC__) && (__GNUC__ >= 3)) \ - || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ - || defined(__clang__) -# define XXH_likely(x) __builtin_expect(x, 1) -# define XXH_unlikely(x) __builtin_expect(x, 0) -#else -# define XXH_likely(x) (x) -# define XXH_unlikely(x) (x) -#endif - -#if defined(__GNUC__) -# if defined(__AVX2__) -# include <immintrin.h> -# elif defined(__SSE2__) -# include <emmintrin.h> -# elif defined(__ARM_NEON__) || defined(__ARM_NEON) -# define inline __inline__ /* circumvent a clang bug */ -# include <arm_neon.h> -# undef inline -# endif -#elif defined(_MSC_VER) -# include <intrin.h> -#endif - -/* - * One goal of XXH3 is to make it fast on both 32-bit and 64-bit, while - * remaining a true 64-bit/128-bit hash function. - * - * This is done by prioritizing a subset of 64-bit operations that can be - * emulated without too many steps on the average 32-bit machine. - * - * For example, these two lines seem similar, and run equally fast on 64-bit: - * - * xxh_u64 x; - * x ^= (x >> 47); // good - * x ^= (x >> 13); // bad - * - * However, to a 32-bit machine, there is a major difference. - * - * x ^= (x >> 47) looks like this: - * - * x.lo ^= (x.hi >> (47 - 32)); - * - * while x ^= (x >> 13) looks like this: - * - * // note: funnel shifts are not usually cheap. - * x.lo ^= (x.lo >> 13) | (x.hi << (32 - 13)); - * x.hi ^= (x.hi >> 13); - * - * The first one is significantly faster than the second, simply because the - * shift is larger than 32. This means: - * - All the bits we need are in the upper 32 bits, so we can ignore the lower - * 32 bits in the shift. - * - The shift result will always fit in the lower 32 bits, and therefore, - * we can ignore the upper 32 bits in the xor. - * - * Thanks to this optimization, XXH3 only requires these features to be efficient: - * - * - Usable unaligned access - * - A 32-bit or 64-bit ALU - * - If 32-bit, a decent ADC instruction - * - A 32 or 64-bit multiply with a 64-bit result - * - For the 128-bit variant, a decent byteswap helps short inputs. - * - * The first two are already required by XXH32, and almost all 32-bit and 64-bit - * platforms which can run XXH32 can run XXH3 efficiently. - * - * Thumb-1, the classic 16-bit only subset of ARM's instruction set, is one - * notable exception. - * - * First of all, Thumb-1 lacks support for the UMULL instruction which - * performs the important long multiply. This means numerous __aeabi_lmul - * calls. - * - * Second of all, the 8 functional registers are just not enough. - * Setup for __aeabi_lmul, byteshift loads, pointers, and all arithmetic need - * Lo registers, and this shuffling results in thousands more MOVs than A32. - * - * A32 and T32 don't have this limitation. They can access all 14 registers, - * do a 32->64 multiply with UMULL, and the flexible operand allowing free - * shifts is helpful, too. - * - * Therefore, we do a quick sanity check. - * - * If compiling Thumb-1 for a target which supports ARM instructions, we will - * emit a warning, as it is not a "sane" platform to compile for. - * - * Usually, if this happens, it is because of an accident and you probably need - * to specify -march, as you likely meant to compile for a newer architecture. - * - * Credit: large sections of the vectorial and asm source code paths - * have been contributed by @easyaspi314 - */ -#if defined(__thumb__) && !defined(__thumb2__) && defined(__ARM_ARCH_ISA_ARM) -# warning "XXH3 is highly inefficient without ARM or Thumb-2." -#endif - -/* ========================================== - * Vectorization detection - * ========================================== */ -#define XXH_SCALAR 0 /* Portable scalar version */ -#define XXH_SSE2 1 /* SSE2 for Pentium 4 and all x86_64 */ -#define XXH_AVX2 2 /* AVX2 for Haswell and Bulldozer */ -#define XXH_AVX512 3 /* AVX512 for Skylake and Icelake */ -#define XXH_NEON 4 /* NEON for most ARMv7-A and all AArch64 */ -#define XXH_VSX 5 /* VSX and ZVector for POWER8/z13 */ - -#ifndef XXH_VECTOR /* can be defined on command line */ -# if defined(__AVX512F__) -# define XXH_VECTOR XXH_AVX512 -# elif defined(__AVX2__) -# define XXH_VECTOR XXH_AVX2 -# elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) -# define XXH_VECTOR XXH_SSE2 -# elif defined(__GNUC__) /* msvc support maybe later */ \ - && (defined(__ARM_NEON__) || defined(__ARM_NEON)) \ - && (defined(__LITTLE_ENDIAN__) /* We only support little endian NEON */ \ - || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) -# define XXH_VECTOR XXH_NEON -# elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ - || (defined(__s390x__) && defined(__VEC__)) \ - && defined(__GNUC__) /* TODO: IBM XL */ -# define XXH_VECTOR XXH_VSX -# else -# define XXH_VECTOR XXH_SCALAR -# endif -#endif - -/* - * Controls the alignment of the accumulator, - * for compatibility with aligned vector loads, which are usually faster. - */ -#ifndef XXH_ACC_ALIGN -# if defined(XXH_X86DISPATCH) -# define XXH_ACC_ALIGN 64 /* for compatibility with avx512 */ -# elif XXH_VECTOR == XXH_SCALAR /* scalar */ -# define XXH_ACC_ALIGN 8 -# elif XXH_VECTOR == XXH_SSE2 /* sse2 */ -# define XXH_ACC_ALIGN 16 -# elif XXH_VECTOR == XXH_AVX2 /* avx2 */ -# define XXH_ACC_ALIGN 32 -# elif XXH_VECTOR == XXH_NEON /* neon */ -# define XXH_ACC_ALIGN 16 -# elif XXH_VECTOR == XXH_VSX /* vsx */ -# define XXH_ACC_ALIGN 16 -# elif XXH_VECTOR == XXH_AVX512 /* avx512 */ -# define XXH_ACC_ALIGN 64 -# endif -#endif - -#if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ - || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 -# define XXH_SEC_ALIGN XXH_ACC_ALIGN -#else -# define XXH_SEC_ALIGN 8 -#endif - -/* - * UGLY HACK: - * GCC usually generates the best code with -O3 for xxHash. - * - * However, when targeting AVX2, it is overzealous in its unrolling resulting - * in code roughly 3/4 the speed of Clang. - * - * There are other issues, such as GCC splitting _mm256_loadu_si256 into - * _mm_loadu_si128 + _mm256_inserti128_si256. This is an optimization which - * only applies to Sandy and Ivy Bridge... which don't even support AVX2. - * - * That is why when compiling the AVX2 version, it is recommended to use either - * -O2 -mavx2 -march=haswell - * or - * -O2 -mavx2 -mno-avx256-split-unaligned-load - * for decent performance, or to use Clang instead. - * - * Fortunately, we can control the first one with a pragma that forces GCC into - * -O2, but the other one we can't control without "failed to inline always - * inline function due to target mismatch" warnings. - */ -#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ - && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ -# pragma GCC push_options -# pragma GCC optimize("-O2") -#endif - - -#if XXH_VECTOR == XXH_NEON -/* - * NEON's setup for vmlal_u32 is a little more complicated than it is on - * SSE2, AVX2, and VSX. - * - * While PMULUDQ and VMULEUW both perform a mask, VMLAL.U32 performs an upcast. - * - * To do the same operation, the 128-bit 'Q' register needs to be split into - * two 64-bit 'D' registers, performing this operation:: - * - * [ a | b ] - * | '---------. .--------' | - * | x | - * | .---------' '--------. | - * [ a & 0xFFFFFFFF | b & 0xFFFFFFFF ],[ a >> 32 | b >> 32 ] - * - * Due to significant changes in aarch64, the fastest method for aarch64 is - * completely different than the fastest method for ARMv7-A. - * - * ARMv7-A treats D registers as unions overlaying Q registers, so modifying - * D11 will modify the high half of Q5. This is similar to how modifying AH - * will only affect bits 8-15 of AX on x86. - * - * VZIP takes two registers, and puts even lanes in one register and odd lanes - * in the other. - * - * On ARMv7-A, this strangely modifies both parameters in place instead of - * taking the usual 3-operand form. - * - * Therefore, if we want to do this, we can simply use a D-form VZIP.32 on the - * lower and upper halves of the Q register to end up with the high and low - * halves where we want - all in one instruction. - * - * vzip.32 d10, d11 @ d10 = { d10[0], d11[0] }; d11 = { d10[1], d11[1] } - * - * Unfortunately we need inline assembly for this: Instructions modifying two - * registers at once is not possible in GCC or Clang's IR, and they have to - * create a copy. - * - * aarch64 requires a different approach. - * - * In order to make it easier to write a decent compiler for aarch64, many - * quirks were removed, such as conditional execution. - * - * NEON was also affected by this. - * - * aarch64 cannot access the high bits of a Q-form register, and writes to a - * D-form register zero the high bits, similar to how writes to W-form scalar - * registers (or DWORD registers on x86_64) work. - * - * The formerly free vget_high intrinsics now require a vext (with a few - * exceptions) - * - * Additionally, VZIP was replaced by ZIP1 and ZIP2, which are the equivalent - * of PUNPCKL* and PUNPCKH* in SSE, respectively, in order to only modify one - * operand. - * - * The equivalent of the VZIP.32 on the lower and upper halves would be this - * mess: - * - * ext v2.4s, v0.4s, v0.4s, #2 // v2 = { v0[2], v0[3], v0[0], v0[1] } - * zip1 v1.2s, v0.2s, v2.2s // v1 = { v0[0], v2[0] } - * zip2 v0.2s, v0.2s, v1.2s // v0 = { v0[1], v2[1] } - * - * Instead, we use a literal downcast, vmovn_u64 (XTN), and vshrn_n_u64 (SHRN): - * - * shrn v1.2s, v0.2d, #32 // v1 = (uint32x2_t)(v0 >> 32); - * xtn v0.2s, v0.2d // v0 = (uint32x2_t)(v0 & 0xFFFFFFFF); - * - * This is available on ARMv7-A, but is less efficient than a single VZIP.32. - */ - -/* - * Function-like macro: - * void XXH_SPLIT_IN_PLACE(uint64x2_t &in, uint32x2_t &outLo, uint32x2_t &outHi) - * { - * outLo = (uint32x2_t)(in & 0xFFFFFFFF); - * outHi = (uint32x2_t)(in >> 32); - * in = UNDEFINED; - * } - */ -# if !defined(XXH_NO_VZIP_HACK) /* define to disable */ \ - && defined(__GNUC__) \ - && !defined(__aarch64__) && !defined(__arm64__) -# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ - do { \ - /* Undocumented GCC/Clang operand modifier: %e0 = lower D half, %f0 = upper D half */ \ - /* https://github.com/gcc-mirror/gcc/blob/38cf91e5/gcc/config/arm/arm.c#L22486 */ \ - /* https://github.com/llvm-mirror/llvm/blob/2c4ca683/lib/Target/ARM/ARMAsmPrinter.cpp#L399 */ \ - __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ - (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ - (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ - } while (0) -# else -# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ - do { \ - (outLo) = vmovn_u64 (in); \ - (outHi) = vshrn_n_u64 ((in), 32); \ - } while (0) -# endif -#endif /* XXH_VECTOR == XXH_NEON */ - -/* - * VSX and Z Vector helpers. - * - * This is very messy, and any pull requests to clean this up are welcome. - * - * There are a lot of problems with supporting VSX and s390x, due to - * inconsistent intrinsics, spotty coverage, and multiple endiannesses. - */ -#if XXH_VECTOR == XXH_VSX -# if defined(__s390x__) -# include <s390intrin.h> -# else -/* gcc's altivec.h can have the unwanted consequence to unconditionally - * #define bool, vector, and pixel keywords, - * with bad consequences for programs already using these keywords for other purposes. - * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined. - * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler, - * but it seems that, in some cases, it isn't. - * Force the build macro to be defined, so that keywords are not altered. - */ -# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__) -# define __APPLE_ALTIVEC__ -# endif -# include <altivec.h> -# endif - -typedef __vector unsigned long long xxh_u64x2; -typedef __vector unsigned char xxh_u8x16; -typedef __vector unsigned xxh_u32x4; - -# ifndef XXH_VSX_BE -# if defined(__BIG_ENDIAN__) \ - || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) -# define XXH_VSX_BE 1 -# elif defined(__VEC_ELEMENT_REG_ORDER__) && __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__ -# warning "-maltivec=be is not recommended. Please use native endianness." -# define XXH_VSX_BE 1 -# else -# define XXH_VSX_BE 0 -# endif -# endif /* !defined(XXH_VSX_BE) */ - -# if XXH_VSX_BE -/* A wrapper for POWER9's vec_revb. */ -# if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__)) -# define XXH_vec_revb vec_revb -# else -XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val) -{ - xxh_u8x16 const vByteSwap = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, - 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; - return vec_perm(val, val, vByteSwap); -} -# endif -# endif /* XXH_VSX_BE */ - -/* - * Performs an unaligned load and byte swaps it on big endian. - */ -XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) -{ - xxh_u64x2 ret; - memcpy(&ret, ptr, sizeof(xxh_u64x2)); -# if XXH_VSX_BE - ret = XXH_vec_revb(ret); -# endif - return ret; -} - -/* - * vec_mulo and vec_mule are very problematic intrinsics on PowerPC - * - * These intrinsics weren't added until GCC 8, despite existing for a while, - * and they are endian dependent. Also, their meaning swap depending on version. - * */ -# if defined(__s390x__) - /* s390x is always big endian, no issue on this platform */ -# define XXH_vec_mulo vec_mulo -# define XXH_vec_mule vec_mule -# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) -/* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ -# define XXH_vec_mulo __builtin_altivec_vmulouw -# define XXH_vec_mule __builtin_altivec_vmuleuw -# else -/* gcc needs inline assembly */ -/* Adapted from https://github.com/google/highwayhash/blob/master/highwayhash/hh_vsx.h. */ -XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mulo(xxh_u32x4 a, xxh_u32x4 b) -{ - xxh_u64x2 result; - __asm__("vmulouw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); - return result; -} -XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) -{ - xxh_u64x2 result; - __asm__("vmuleuw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); - return result; -} -# endif /* XXH_vec_mulo, XXH_vec_mule */ -#endif /* XXH_VECTOR == XXH_VSX */ - - -/* prefetch - * can be disabled, by declaring XXH_NO_PREFETCH build macro */ -#if defined(XXH_NO_PREFETCH) -# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ -#else -# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ -# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ -# define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) -# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) -# define XXH_PREFETCH(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) -# else -# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ -# endif -#endif /* XXH_NO_PREFETCH */ - - -/* ========================================== - * XXH3 default settings - * ========================================== */ - -#define XXH_SECRET_DEFAULT_SIZE 192 /* minimum XXH3_SECRET_SIZE_MIN */ - -#if (XXH_SECRET_DEFAULT_SIZE < XXH3_SECRET_SIZE_MIN) -# error "default keyset is not large enough" -#endif - -/* Pseudorandom secret taken directly from FARSH */ -XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { - 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, - 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, - 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, - 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, - 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, - 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, - 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, - 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, - 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, - 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, - 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, - 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, -}; - - -#ifdef XXH_OLD_NAMES -# define kSecret XXH3_kSecret -#endif - -/* - * Calculates a 32-bit to 64-bit long multiply. - * - * Wraps __emulu on MSVC x86 because it tends to call __allmul when it doesn't - * need to (but it shouldn't need to anyways, it is about 7 instructions to do - * a 64x64 multiply...). Since we know that this will _always_ emit MULL, we - * use that instead of the normal method. - * - * If you are compiling for platforms like Thumb-1 and don't have a better option, - * you may also want to write your own long multiply routine here. - * - * XXH_FORCE_INLINE xxh_u64 XXH_mult32to64(xxh_u64 x, xxh_u64 y) - * { - * return (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF); - * } - */ -#if defined(_MSC_VER) && defined(_M_IX86) -# include <intrin.h> -# define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) -#else -/* - * Downcast + upcast is usually better than masking on older compilers like - * GCC 4.2 (especially 32-bit ones), all without affecting newer compilers. - * - * The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both operands - * and perform a full 64x64 multiply -- entirely redundant on 32-bit. - */ -# define XXH_mult32to64(x, y) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) -#endif - -/* - * Calculates a 64->128-bit long multiply. - * - * Uses __uint128_t and _umul128 if available, otherwise uses a scalar version. - */ -static XXH128_hash_t -XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) -{ - /* - * GCC/Clang __uint128_t method. - * - * On most 64-bit targets, GCC and Clang define a __uint128_t type. - * This is usually the best way as it usually uses a native long 64-bit - * multiply, such as MULQ on x86_64 or MUL + UMULH on aarch64. - * - * Usually. - * - * Despite being a 32-bit platform, Clang (and emscripten) define this type - * despite not having the arithmetic for it. This results in a laggy - * compiler builtin call which calculates a full 128-bit multiply. - * In that case it is best to use the portable one. - * https://github.com/Cyan4973/xxHash/issues/211#issuecomment-515575677 - */ -#if defined(__GNUC__) && !defined(__wasm__) \ - && defined(__SIZEOF_INT128__) \ - || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) - - __uint128_t const product = (__uint128_t)lhs * (__uint128_t)rhs; - XXH128_hash_t r128; - r128.low64 = (xxh_u64)(product); - r128.high64 = (xxh_u64)(product >> 64); - return r128; - - /* - * MSVC for x64's _umul128 method. - * - * xxh_u64 _umul128(xxh_u64 Multiplier, xxh_u64 Multiplicand, xxh_u64 *HighProduct); - * - * This compiles to single operand MUL on x64. - */ -#elif defined(_M_X64) || defined(_M_IA64) - -#ifndef _MSC_VER -# pragma intrinsic(_umul128) -#endif - xxh_u64 product_high; - xxh_u64 const product_low = _umul128(lhs, rhs, &product_high); - XXH128_hash_t r128; - r128.low64 = product_low; - r128.high64 = product_high; - return r128; - -#else - /* - * Portable scalar method. Optimized for 32-bit and 64-bit ALUs. - * - * This is a fast and simple grade school multiply, which is shown below - * with base 10 arithmetic instead of base 0x100000000. - * - * 9 3 // D2 lhs = 93 - * x 7 5 // D2 rhs = 75 - * ---------- - * 1 5 // D2 lo_lo = (93 % 10) * (75 % 10) = 15 - * 4 5 | // D2 hi_lo = (93 / 10) * (75 % 10) = 45 - * 2 1 | // D2 lo_hi = (93 % 10) * (75 / 10) = 21 - * + 6 3 | | // D2 hi_hi = (93 / 10) * (75 / 10) = 63 - * --------- - * 2 7 | // D2 cross = (15 / 10) + (45 % 10) + 21 = 27 - * + 6 7 | | // D2 upper = (27 / 10) + (45 / 10) + 63 = 67 - * --------- - * 6 9 7 5 // D4 res = (27 * 10) + (15 % 10) + (67 * 100) = 6975 - * - * The reasons for adding the products like this are: - * 1. It avoids manual carry tracking. Just like how - * (9 * 9) + 9 + 9 = 99, the same applies with this for UINT64_MAX. - * This avoids a lot of complexity. - * - * 2. It hints for, and on Clang, compiles to, the powerful UMAAL - * instruction available in ARM's Digital Signal Processing extension - * in 32-bit ARMv6 and later, which is shown below: - * - * void UMAAL(xxh_u32 *RdLo, xxh_u32 *RdHi, xxh_u32 Rn, xxh_u32 Rm) - * { - * xxh_u64 product = (xxh_u64)*RdLo * (xxh_u64)*RdHi + Rn + Rm; - * *RdLo = (xxh_u32)(product & 0xFFFFFFFF); - * *RdHi = (xxh_u32)(product >> 32); - * } - * - * This instruction was designed for efficient long multiplication, and - * allows this to be calculated in only 4 instructions at speeds - * comparable to some 64-bit ALUs. - * - * 3. It isn't terrible on other platforms. Usually this will be a couple - * of 32-bit ADD/ADCs. - */ - - /* First calculate all of the cross products. */ - xxh_u64 const lo_lo = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs & 0xFFFFFFFF); - xxh_u64 const hi_lo = XXH_mult32to64(lhs >> 32, rhs & 0xFFFFFFFF); - xxh_u64 const lo_hi = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs >> 32); - xxh_u64 const hi_hi = XXH_mult32to64(lhs >> 32, rhs >> 32); - - /* Now add the products together. These will never overflow. */ - xxh_u64 const cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi; - xxh_u64 const upper = (hi_lo >> 32) + (cross >> 32) + hi_hi; - xxh_u64 const lower = (cross << 32) | (lo_lo & 0xFFFFFFFF); - - XXH128_hash_t r128; - r128.low64 = lower; - r128.high64 = upper; - return r128; -#endif -} - -/* - * Does a 64-bit to 128-bit multiply, then XOR folds it. - * - * The reason for the separate function is to prevent passing too many structs - * around by value. This will hopefully inline the multiply, but we don't force it. - */ -static xxh_u64 -XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) -{ - XXH128_hash_t product = XXH_mult64to128(lhs, rhs); - return product.low64 ^ product.high64; -} - -/* Seems to produce slightly better code on GCC for some reason. */ -XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) -{ - XXH_ASSERT(0 <= shift && shift < 64); - return v64 ^ (v64 >> shift); -} - -/* - * This is a fast avalanche stage, - * suitable when input bits are already partially mixed - */ -static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) -{ - h64 = XXH_xorshift64(h64, 37); - h64 *= 0x165667919E3779F9ULL; - h64 = XXH_xorshift64(h64, 32); - return h64; -} - -/* - * This is a stronger avalanche, - * inspired by Pelle Evensen's rrmxmx - * preferable when input has not been previously mixed - */ -static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) -{ - /* this mix is inspired by Pelle Evensen's rrmxmx */ - h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); - h64 *= 0x9FB21C651E98DF25ULL; - h64 ^= (h64 >> 35) + len ; - h64 *= 0x9FB21C651E98DF25ULL; - return XXH_xorshift64(h64, 28); -} - - -/* ========================================== - * Short keys - * ========================================== - * One of the shortcomings of XXH32 and XXH64 was that their performance was - * sub-optimal on short lengths. It used an iterative algorithm which strongly - * favored lengths that were a multiple of 4 or 8. - * - * Instead of iterating over individual inputs, we use a set of single shot - * functions which piece together a range of lengths and operate in constant time. - * - * Additionally, the number of multiplies has been significantly reduced. This - * reduces latency, especially when emulating 64-bit multiplies on 32-bit. - * - * Depending on the platform, this may or may not be faster than XXH32, but it - * is almost guaranteed to be faster than XXH64. - */ - -/* - * At very short lengths, there isn't enough input to fully hide secrets, or use - * the entire secret. - * - * There is also only a limited amount of mixing we can do before significantly - * impacting performance. - * - * Therefore, we use different sections of the secret and always mix two secret - * samples with an XOR. This should have no effect on performance on the - * seedless or withSeed variants because everything _should_ be constant folded - * by modern compilers. - * - * The XOR mixing hides individual parts of the secret and increases entropy. - * - * This adds an extra layer of strength for custom secrets. - */ -XXH_FORCE_INLINE XXH64_hash_t -XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(input != NULL); - XXH_ASSERT(1 <= len && len <= 3); - XXH_ASSERT(secret != NULL); - /* - * len = 1: combined = { input[0], 0x01, input[0], input[0] } - * len = 2: combined = { input[1], 0x02, input[0], input[1] } - * len = 3: combined = { input[2], 0x03, input[0], input[1] } - */ - { xxh_u8 const c1 = input[0]; - xxh_u8 const c2 = input[len >> 1]; - xxh_u8 const c3 = input[len - 1]; - xxh_u32 const combined = ((xxh_u32)c1 << 16) | ((xxh_u32)c2 << 24) - | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); - xxh_u64 const bitflip = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; - xxh_u64 const keyed = (xxh_u64)combined ^ bitflip; - return XXH64_avalanche(keyed); - } -} - -XXH_FORCE_INLINE XXH64_hash_t -XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(input != NULL); - XXH_ASSERT(secret != NULL); - XXH_ASSERT(4 <= len && len < 8); - seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; - { xxh_u32 const input1 = XXH_readLE32(input); - xxh_u32 const input2 = XXH_readLE32(input + len - 4); - xxh_u64 const bitflip = (XXH_readLE64(secret+8) ^ XXH_readLE64(secret+16)) - seed; - xxh_u64 const input64 = input2 + (((xxh_u64)input1) << 32); - xxh_u64 const keyed = input64 ^ bitflip; - return XXH3_rrmxmx(keyed, len); - } -} - -XXH_FORCE_INLINE XXH64_hash_t -XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(input != NULL); - XXH_ASSERT(secret != NULL); - XXH_ASSERT(8 <= len && len <= 16); - { xxh_u64 const bitflip1 = (XXH_readLE64(secret+24) ^ XXH_readLE64(secret+32)) + seed; - xxh_u64 const bitflip2 = (XXH_readLE64(secret+40) ^ XXH_readLE64(secret+48)) - seed; - xxh_u64 const input_lo = XXH_readLE64(input) ^ bitflip1; - xxh_u64 const input_hi = XXH_readLE64(input + len - 8) ^ bitflip2; - xxh_u64 const acc = len - + XXH_swap64(input_lo) + input_hi - + XXH3_mul128_fold64(input_lo, input_hi); - return XXH3_avalanche(acc); - } -} - -XXH_FORCE_INLINE XXH64_hash_t -XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(len <= 16); - { if (XXH_likely(len > 8)) return XXH3_len_9to16_64b(input, len, secret, seed); - if (XXH_likely(len >= 4)) return XXH3_len_4to8_64b(input, len, secret, seed); - if (len) return XXH3_len_1to3_64b(input, len, secret, seed); - return XXH64_avalanche(seed ^ (XXH_readLE64(secret+56) ^ XXH_readLE64(secret+64))); - } -} - -/* - * DISCLAIMER: There are known *seed-dependent* multicollisions here due to - * multiplication by zero, affecting hashes of lengths 17 to 240. - * - * However, they are very unlikely. - * - * Keep this in mind when using the unseeded XXH3_64bits() variant: As with all - * unseeded non-cryptographic hashes, it does not attempt to defend itself - * against specially crafted inputs, only random inputs. - * - * Compared to classic UMAC where a 1 in 2^31 chance of 4 consecutive bytes - * cancelling out the secret is taken an arbitrary number of times (addressed - * in XXH3_accumulate_512), this collision is very unlikely with random inputs - * and/or proper seeding: - * - * This only has a 1 in 2^63 chance of 8 consecutive bytes cancelling out, in a - * function that is only called up to 16 times per hash with up to 240 bytes of - * input. - * - * This is not too bad for a non-cryptographic hash function, especially with - * only 64 bit outputs. - * - * The 128-bit variant (which trades some speed for strength) is NOT affected - * by this, although it is always a good idea to use a proper seed if you care - * about strength. - */ -XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, - const xxh_u8* XXH_RESTRICT secret, xxh_u64 seed64) -{ -#if defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__i386__) && defined(__SSE2__) /* x86 + SSE2 */ \ - && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable like XXH32 hack */ - /* - * UGLY HACK: - * GCC for x86 tends to autovectorize the 128-bit multiply, resulting in - * slower code. - * - * By forcing seed64 into a register, we disrupt the cost model and - * cause it to scalarize. See `XXH32_round()` - * - * FIXME: Clang's output is still _much_ faster -- On an AMD Ryzen 3600, - * XXH3_64bits @ len=240 runs at 4.6 GB/s with Clang 9, but 3.3 GB/s on - * GCC 9.2, despite both emitting scalar code. - * - * GCC generates much better scalar code than Clang for the rest of XXH3, - * which is why finding a more optimal codepath is an interest. - */ - __asm__ ("" : "+r" (seed64)); -#endif - { xxh_u64 const input_lo = XXH_readLE64(input); - xxh_u64 const input_hi = XXH_readLE64(input+8); - return XXH3_mul128_fold64( - input_lo ^ (XXH_readLE64(secret) + seed64), - input_hi ^ (XXH_readLE64(secret+8) - seed64) - ); - } -} - -/* For mid range keys, XXH3 uses a Mum-hash variant. */ -XXH_FORCE_INLINE XXH64_hash_t -XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, - const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH64_hash_t seed) -{ - XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; - XXH_ASSERT(16 < len && len <= 128); - - { xxh_u64 acc = len * XXH_PRIME64_1; - if (len > 32) { - if (len > 64) { - if (len > 96) { - acc += XXH3_mix16B(input+48, secret+96, seed); - acc += XXH3_mix16B(input+len-64, secret+112, seed); - } - acc += XXH3_mix16B(input+32, secret+64, seed); - acc += XXH3_mix16B(input+len-48, secret+80, seed); - } - acc += XXH3_mix16B(input+16, secret+32, seed); - acc += XXH3_mix16B(input+len-32, secret+48, seed); - } - acc += XXH3_mix16B(input+0, secret+0, seed); - acc += XXH3_mix16B(input+len-16, secret+16, seed); - - return XXH3_avalanche(acc); - } -} - -#define XXH3_MIDSIZE_MAX 240 - -XXH_NO_INLINE XXH64_hash_t -XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, - const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH64_hash_t seed) -{ - XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; - XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); - - #define XXH3_MIDSIZE_STARTOFFSET 3 - #define XXH3_MIDSIZE_LASTOFFSET 17 - - { xxh_u64 acc = len * XXH_PRIME64_1; - int const nbRounds = (int)len / 16; - int i; - for (i=0; i<8; i++) { - acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); - } - acc = XXH3_avalanche(acc); - XXH_ASSERT(nbRounds >= 8); -#if defined(__clang__) /* Clang */ \ - && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ - && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ - /* - * UGLY HACK: - * Clang for ARMv7-A tries to vectorize this loop, similar to GCC x86. - * In everywhere else, it uses scalar code. - * - * For 64->128-bit multiplies, even if the NEON was 100% optimal, it - * would still be slower than UMAAL (see XXH_mult64to128). - * - * Unfortunately, Clang doesn't handle the long multiplies properly and - * converts them to the nonexistent "vmulq_u64" intrinsic, which is then - * scalarized into an ugly mess of VMOV.32 instructions. - * - * This mess is difficult to avoid without turning autovectorization - * off completely, but they are usually relatively minor and/or not - * worth it to fix. - * - * This loop is the easiest to fix, as unlike XXH32, this pragma - * _actually works_ because it is a loop vectorization instead of an - * SLP vectorization. - */ - #pragma clang loop vectorize(disable) -#endif - for (i=8 ; i < nbRounds; i++) { - acc += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); - } - /* last bytes */ - acc += XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); - return XXH3_avalanche(acc); - } -} - - -/* ======= Long Keys ======= */ - -#define XXH_STRIPE_LEN 64 -#define XXH_SECRET_CONSUME_RATE 8 /* nb of secret bytes consumed at each accumulation */ -#define XXH_ACC_NB (XXH_STRIPE_LEN / sizeof(xxh_u64)) - -#ifdef XXH_OLD_NAMES -# define STRIPE_LEN XXH_STRIPE_LEN -# define ACC_NB XXH_ACC_NB -#endif - -XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) -{ - if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); - memcpy(dst, &v64, sizeof(v64)); -} - -/* Several intrinsic functions below are supposed to accept __int64 as argument, - * as documented in https://software.intel.com/sites/landingpage/IntrinsicsGuide/ . - * However, several environments do not define __int64 type, - * requiring a workaround. - */ -#if !defined (__VMS) \ - && (defined (__cplusplus) \ - || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) - typedef int64_t xxh_i64; -#else - /* the following type must have a width of 64-bit */ - typedef long long xxh_i64; -#endif - -/* - * XXH3_accumulate_512 is the tightest loop for long inputs, and it is the most optimized. - * - * It is a hardened version of UMAC, based off of FARSH's implementation. - * - * This was chosen because it adapts quite well to 32-bit, 64-bit, and SIMD - * implementations, and it is ridiculously fast. - * - * We harden it by mixing the original input to the accumulators as well as the product. - * - * This means that in the (relatively likely) case of a multiply by zero, the - * original input is preserved. - * - * On 128-bit inputs, we swap 64-bit pairs when we add the input to improve - * cross-pollination, as otherwise the upper and lower halves would be - * essentially independent. - * - * This doesn't matter on 64-bit hashes since they all get merged together in - * the end, so we skip the extra step. - * - * Both XXH3_64bits and XXH3_128bits use this subroutine. - */ - -#if (XXH_VECTOR == XXH_AVX512) || defined(XXH_X86DISPATCH) - -#ifndef XXH_TARGET_AVX512 -# define XXH_TARGET_AVX512 /* disable attribute target */ -#endif - -XXH_FORCE_INLINE XXH_TARGET_AVX512 void -XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, - const void* XXH_RESTRICT input, - const void* XXH_RESTRICT secret) -{ - XXH_ALIGN(64) __m512i* const xacc = (__m512i *) acc; - XXH_ASSERT((((size_t)acc) & 63) == 0); - XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); - - { - /* data_vec = input[0]; */ - __m512i const data_vec = _mm512_loadu_si512 (input); - /* key_vec = secret[0]; */ - __m512i const key_vec = _mm512_loadu_si512 (secret); - /* data_key = data_vec ^ key_vec; */ - __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); - /* data_key_lo = data_key >> 32; */ - __m512i const data_key_lo = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); - /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ - __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); - /* xacc[0] += swap(data_vec); */ - __m512i const data_swap = _mm512_shuffle_epi32(data_vec, (_MM_PERM_ENUM)_MM_SHUFFLE(1, 0, 3, 2)); - __m512i const sum = _mm512_add_epi64(*xacc, data_swap); - /* xacc[0] += product; */ - *xacc = _mm512_add_epi64(product, sum); - } -} - -/* - * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. - * - * Multiplication isn't perfect, as explained by Google in HighwayHash: - * - * // Multiplication mixes/scrambles bytes 0-7 of the 64-bit result to - * // varying degrees. In descending order of goodness, bytes - * // 3 4 2 5 1 6 0 7 have quality 228 224 164 160 100 96 36 32. - * // As expected, the upper and lower bytes are much worse. - * - * Source: https://github.com/google/highwayhash/blob/0aaf66b/highwayhash/hh_avx2.h#L291 - * - * Since our algorithm uses a pseudorandom secret to add some variance into the - * mix, we don't need to (or want to) mix as often or as much as HighwayHash does. - * - * This isn't as tight as XXH3_accumulate, but still written in SIMD to avoid - * extraction. - * - * Both XXH3_64bits and XXH3_128bits use this subroutine. - */ - -XXH_FORCE_INLINE XXH_TARGET_AVX512 void -XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 63) == 0); - XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); - { XXH_ALIGN(64) __m512i* const xacc = (__m512i*) acc; - const __m512i prime32 = _mm512_set1_epi32((int)XXH_PRIME32_1); - - /* xacc[0] ^= (xacc[0] >> 47) */ - __m512i const acc_vec = *xacc; - __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); - __m512i const data_vec = _mm512_xor_si512 (acc_vec, shifted); - /* xacc[0] ^= secret; */ - __m512i const key_vec = _mm512_loadu_si512 (secret); - __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); - - /* xacc[0] *= XXH_PRIME32_1; */ - __m512i const data_key_hi = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); - __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); - __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); - *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); - } -} - -XXH_FORCE_INLINE XXH_TARGET_AVX512 void -XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) -{ - XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 63) == 0); - XXH_STATIC_ASSERT(XXH_SEC_ALIGN == 64); - XXH_ASSERT(((size_t)customSecret & 63) == 0); - (void)(&XXH_writeLE64); - { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); - __m512i const seed = _mm512_mask_set1_epi64(_mm512_set1_epi64((xxh_i64)seed64), 0xAA, -(xxh_i64)seed64); - - XXH_ALIGN(64) const __m512i* const src = (const __m512i*) XXH3_kSecret; - XXH_ALIGN(64) __m512i* const dest = ( __m512i*) customSecret; - int i; - for (i=0; i < nbRounds; ++i) { - /* GCC has a bug, _mm512_stream_load_si512 accepts 'void*', not 'void const*', - * this will warn "discards ‘const’ qualifier". */ - union { - XXH_ALIGN(64) const __m512i* cp; - XXH_ALIGN(64) void* p; - } remote_const_void; - remote_const_void.cp = src + i; - dest[i] = _mm512_add_epi64(_mm512_stream_load_si512(remote_const_void.p), seed); - } } -} - -#endif - -#if (XXH_VECTOR == XXH_AVX2) || defined(XXH_X86DISPATCH) - -#ifndef XXH_TARGET_AVX2 -# define XXH_TARGET_AVX2 /* disable attribute target */ -#endif - -XXH_FORCE_INLINE XXH_TARGET_AVX2 void -XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, - const void* XXH_RESTRICT input, - const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 31) == 0); - { XXH_ALIGN(32) __m256i* const xacc = (__m256i *) acc; - /* Unaligned. This is mainly for pointer arithmetic, and because - * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ - const __m256i* const xinput = (const __m256i *) input; - /* Unaligned. This is mainly for pointer arithmetic, and because - * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ - const __m256i* const xsecret = (const __m256i *) secret; - - size_t i; - for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { - /* data_vec = xinput[i]; */ - __m256i const data_vec = _mm256_loadu_si256 (xinput+i); - /* key_vec = xsecret[i]; */ - __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); - /* data_key = data_vec ^ key_vec; */ - __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); - /* data_key_lo = data_key >> 32; */ - __m256i const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); - /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ - __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); - /* xacc[i] += swap(data_vec); */ - __m256i const data_swap = _mm256_shuffle_epi32(data_vec, _MM_SHUFFLE(1, 0, 3, 2)); - __m256i const sum = _mm256_add_epi64(xacc[i], data_swap); - /* xacc[i] += product; */ - xacc[i] = _mm256_add_epi64(product, sum); - } } -} - -XXH_FORCE_INLINE XXH_TARGET_AVX2 void -XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 31) == 0); - { XXH_ALIGN(32) __m256i* const xacc = (__m256i*) acc; - /* Unaligned. This is mainly for pointer arithmetic, and because - * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ - const __m256i* const xsecret = (const __m256i *) secret; - const __m256i prime32 = _mm256_set1_epi32((int)XXH_PRIME32_1); - - size_t i; - for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { - /* xacc[i] ^= (xacc[i] >> 47) */ - __m256i const acc_vec = xacc[i]; - __m256i const shifted = _mm256_srli_epi64 (acc_vec, 47); - __m256i const data_vec = _mm256_xor_si256 (acc_vec, shifted); - /* xacc[i] ^= xsecret; */ - __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); - __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); - - /* xacc[i] *= XXH_PRIME32_1; */ - __m256i const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); - __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); - __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); - xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); - } - } -} - -XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) -{ - XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 31) == 0); - XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE / sizeof(__m256i)) == 6); - XXH_STATIC_ASSERT(XXH_SEC_ALIGN <= 64); - (void)(&XXH_writeLE64); - XXH_PREFETCH(customSecret); - { __m256i const seed = _mm256_set_epi64x(-(xxh_i64)seed64, (xxh_i64)seed64, -(xxh_i64)seed64, (xxh_i64)seed64); - - XXH_ALIGN(64) const __m256i* const src = (const __m256i*) XXH3_kSecret; - XXH_ALIGN(64) __m256i* dest = ( __m256i*) customSecret; - -# if defined(__GNUC__) || defined(__clang__) - /* - * On GCC & Clang, marking 'dest' as modified will cause the compiler: - * - do not extract the secret from sse registers in the internal loop - * - use less common registers, and avoid pushing these reg into stack - * The asm hack causes Clang to assume that XXH3_kSecretPtr aliases with - * customSecret, and on aarch64, this prevented LDP from merging two - * loads together for free. Putting the loads together before the stores - * properly generates LDP. - */ - __asm__("" : "+r" (dest)); -# endif - - /* GCC -O2 need unroll loop manually */ - dest[0] = _mm256_add_epi64(_mm256_stream_load_si256(src+0), seed); - dest[1] = _mm256_add_epi64(_mm256_stream_load_si256(src+1), seed); - dest[2] = _mm256_add_epi64(_mm256_stream_load_si256(src+2), seed); - dest[3] = _mm256_add_epi64(_mm256_stream_load_si256(src+3), seed); - dest[4] = _mm256_add_epi64(_mm256_stream_load_si256(src+4), seed); - dest[5] = _mm256_add_epi64(_mm256_stream_load_si256(src+5), seed); - } -} - -#endif - -#if (XXH_VECTOR == XXH_SSE2) || defined(XXH_X86DISPATCH) - -#ifndef XXH_TARGET_SSE2 -# define XXH_TARGET_SSE2 /* disable attribute target */ -#endif - -XXH_FORCE_INLINE XXH_TARGET_SSE2 void -XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, - const void* XXH_RESTRICT input, - const void* XXH_RESTRICT secret) -{ - /* SSE2 is just a half-scale version of the AVX2 version. */ - XXH_ASSERT((((size_t)acc) & 15) == 0); - { XXH_ALIGN(16) __m128i* const xacc = (__m128i *) acc; - /* Unaligned. This is mainly for pointer arithmetic, and because - * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ - const __m128i* const xinput = (const __m128i *) input; - /* Unaligned. This is mainly for pointer arithmetic, and because - * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ - const __m128i* const xsecret = (const __m128i *) secret; - - size_t i; - for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { - /* data_vec = xinput[i]; */ - __m128i const data_vec = _mm_loadu_si128 (xinput+i); - /* key_vec = xsecret[i]; */ - __m128i const key_vec = _mm_loadu_si128 (xsecret+i); - /* data_key = data_vec ^ key_vec; */ - __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); - /* data_key_lo = data_key >> 32; */ - __m128i const data_key_lo = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); - /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ - __m128i const product = _mm_mul_epu32 (data_key, data_key_lo); - /* xacc[i] += swap(data_vec); */ - __m128i const data_swap = _mm_shuffle_epi32(data_vec, _MM_SHUFFLE(1,0,3,2)); - __m128i const sum = _mm_add_epi64(xacc[i], data_swap); - /* xacc[i] += product; */ - xacc[i] = _mm_add_epi64(product, sum); - } } -} - -XXH_FORCE_INLINE XXH_TARGET_SSE2 void -XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 15) == 0); - { XXH_ALIGN(16) __m128i* const xacc = (__m128i*) acc; - /* Unaligned. This is mainly for pointer arithmetic, and because - * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ - const __m128i* const xsecret = (const __m128i *) secret; - const __m128i prime32 = _mm_set1_epi32((int)XXH_PRIME32_1); - - size_t i; - for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { - /* xacc[i] ^= (xacc[i] >> 47) */ - __m128i const acc_vec = xacc[i]; - __m128i const shifted = _mm_srli_epi64 (acc_vec, 47); - __m128i const data_vec = _mm_xor_si128 (acc_vec, shifted); - /* xacc[i] ^= xsecret[i]; */ - __m128i const key_vec = _mm_loadu_si128 (xsecret+i); - __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); - - /* xacc[i] *= XXH_PRIME32_1; */ - __m128i const data_key_hi = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); - __m128i const prod_lo = _mm_mul_epu32 (data_key, prime32); - __m128i const prod_hi = _mm_mul_epu32 (data_key_hi, prime32); - xacc[i] = _mm_add_epi64(prod_lo, _mm_slli_epi64(prod_hi, 32)); - } - } -} - -XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) -{ - XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); - (void)(&XXH_writeLE64); - { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m128i); - -# if defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER < 1900 - // MSVC 32bit mode does not support _mm_set_epi64x before 2015 - XXH_ALIGN(16) const xxh_i64 seed64x2[2] = { (xxh_i64)seed64, -(xxh_i64)seed64 }; - __m128i const seed = _mm_load_si128((__m128i const*)seed64x2); -# else - __m128i const seed = _mm_set_epi64x(-(xxh_i64)seed64, (xxh_i64)seed64); -# endif - int i; - - XXH_ALIGN(64) const float* const src = (float const*) XXH3_kSecret; - XXH_ALIGN(XXH_SEC_ALIGN) __m128i* dest = (__m128i*) customSecret; -# if defined(__GNUC__) || defined(__clang__) - /* - * On GCC & Clang, marking 'dest' as modified will cause the compiler: - * - do not extract the secret from sse registers in the internal loop - * - use less common registers, and avoid pushing these reg into stack - */ - __asm__("" : "+r" (dest)); -# endif - - for (i=0; i < nbRounds; ++i) { - dest[i] = _mm_add_epi64(_mm_castps_si128(_mm_load_ps(src+i*4)), seed); - } } -} - -#endif - -#if (XXH_VECTOR == XXH_NEON) - -XXH_FORCE_INLINE void -XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, - const void* XXH_RESTRICT input, - const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 15) == 0); - { - XXH_ALIGN(16) uint64x2_t* const xacc = (uint64x2_t *) acc; - /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ - uint8_t const* const xinput = (const uint8_t *) input; - uint8_t const* const xsecret = (const uint8_t *) secret; - - size_t i; - for (i=0; i < XXH_STRIPE_LEN / sizeof(uint64x2_t); i++) { - /* data_vec = xinput[i]; */ - uint8x16_t data_vec = vld1q_u8(xinput + (i * 16)); - /* key_vec = xsecret[i]; */ - uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); - uint64x2_t data_key; - uint32x2_t data_key_lo, data_key_hi; - /* xacc[i] += swap(data_vec); */ - uint64x2_t const data64 = vreinterpretq_u64_u8(data_vec); - uint64x2_t const swapped = vextq_u64(data64, data64, 1); - xacc[i] = vaddq_u64 (xacc[i], swapped); - /* data_key = data_vec ^ key_vec; */ - data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec)); - /* data_key_lo = (uint32x2_t) (data_key & 0xFFFFFFFF); - * data_key_hi = (uint32x2_t) (data_key >> 32); - * data_key = UNDEFINED; */ - XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); - /* xacc[i] += (uint64x2_t) data_key_lo * (uint64x2_t) data_key_hi; */ - xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi); - - } - } -} - -XXH_FORCE_INLINE void -XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 15) == 0); - - { uint64x2_t* xacc = (uint64x2_t*) acc; - uint8_t const* xsecret = (uint8_t const*) secret; - uint32x2_t prime = vdup_n_u32 (XXH_PRIME32_1); - - size_t i; - for (i=0; i < XXH_STRIPE_LEN/sizeof(uint64x2_t); i++) { - /* xacc[i] ^= (xacc[i] >> 47); */ - uint64x2_t acc_vec = xacc[i]; - uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47); - uint64x2_t data_vec = veorq_u64 (acc_vec, shifted); - - /* xacc[i] ^= xsecret[i]; */ - uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); - uint64x2_t data_key = veorq_u64(data_vec, vreinterpretq_u64_u8(key_vec)); - - /* xacc[i] *= XXH_PRIME32_1 */ - uint32x2_t data_key_lo, data_key_hi; - /* data_key_lo = (uint32x2_t) (xacc[i] & 0xFFFFFFFF); - * data_key_hi = (uint32x2_t) (xacc[i] >> 32); - * xacc[i] = UNDEFINED; */ - XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); - { /* - * prod_hi = (data_key >> 32) * XXH_PRIME32_1; - * - * Avoid vmul_u32 + vshll_n_u32 since Clang 6 and 7 will - * incorrectly "optimize" this: - * tmp = vmul_u32(vmovn_u64(a), vmovn_u64(b)); - * shifted = vshll_n_u32(tmp, 32); - * to this: - * tmp = "vmulq_u64"(a, b); // no such thing! - * shifted = vshlq_n_u64(tmp, 32); - * - * However, unlike SSE, Clang lacks a 64-bit multiply routine - * for NEON, and it scalarizes two 64-bit multiplies instead. - * - * vmull_u32 has the same timing as vmul_u32, and it avoids - * this bug completely. - * See https://bugs.llvm.org/show_bug.cgi?id=39967 - */ - uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime); - /* xacc[i] = prod_hi << 32; */ - xacc[i] = vshlq_n_u64(prod_hi, 32); - /* xacc[i] += (prod_hi & 0xFFFFFFFF) * XXH_PRIME32_1; */ - xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime); - } - } } -} - -#endif - -#if (XXH_VECTOR == XXH_VSX) - -XXH_FORCE_INLINE void -XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, - const void* XXH_RESTRICT input, - const void* XXH_RESTRICT secret) -{ - xxh_u64x2* const xacc = (xxh_u64x2*) acc; /* presumed aligned */ - xxh_u64x2 const* const xinput = (xxh_u64x2 const*) input; /* no alignment restriction */ - xxh_u64x2 const* const xsecret = (xxh_u64x2 const*) secret; /* no alignment restriction */ - xxh_u64x2 const v32 = { 32, 32 }; - size_t i; - for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { - /* data_vec = xinput[i]; */ - xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + i); - /* key_vec = xsecret[i]; */ - xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); - xxh_u64x2 const data_key = data_vec ^ key_vec; - /* shuffled = (data_key << 32) | (data_key >> 32); */ - xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); - /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ - xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); - xacc[i] += product; - - /* swap high and low halves */ -#ifdef __s390x__ - xacc[i] += vec_permi(data_vec, data_vec, 2); -#else - xacc[i] += vec_xxpermdi(data_vec, data_vec, 2); -#endif - } -} - -XXH_FORCE_INLINE void -XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) -{ - XXH_ASSERT((((size_t)acc) & 15) == 0); - - { xxh_u64x2* const xacc = (xxh_u64x2*) acc; - const xxh_u64x2* const xsecret = (const xxh_u64x2*) secret; - /* constants */ - xxh_u64x2 const v32 = { 32, 32 }; - xxh_u64x2 const v47 = { 47, 47 }; - xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; - size_t i; - for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { - /* xacc[i] ^= (xacc[i] >> 47); */ - xxh_u64x2 const acc_vec = xacc[i]; - xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); - - /* xacc[i] ^= xsecret[i]; */ - xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); - xxh_u64x2 const data_key = data_vec ^ key_vec; - - /* xacc[i] *= XXH_PRIME32_1 */ - /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ - xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); - /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ - xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); - xacc[i] = prod_odd + (prod_even << v32); - } } -} - -#endif - -/* scalar variants - universal */ - -XXH_FORCE_INLINE void -XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, - const void* XXH_RESTRICT input, - const void* XXH_RESTRICT secret) -{ - XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ - const xxh_u8* const xinput = (const xxh_u8*) input; /* no alignment restriction */ - const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ - size_t i; - XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); - for (i=0; i < XXH_ACC_NB; i++) { - xxh_u64 const data_val = XXH_readLE64(xinput + 8*i); - xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + i*8); - xacc[i ^ 1] += data_val; /* swap adjacent lanes */ - xacc[i] += XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32); - } -} - -XXH_FORCE_INLINE void -XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) -{ - XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ - const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ - size_t i; - XXH_ASSERT((((size_t)acc) & (XXH_ACC_ALIGN-1)) == 0); - for (i=0; i < XXH_ACC_NB; i++) { - xxh_u64 const key64 = XXH_readLE64(xsecret + 8*i); - xxh_u64 acc64 = xacc[i]; - acc64 = XXH_xorshift64(acc64, 47); - acc64 ^= key64; - acc64 *= XXH_PRIME32_1; - xacc[i] = acc64; - } -} - -XXH_FORCE_INLINE void -XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) -{ - /* - * We need a separate pointer for the hack below, - * which requires a non-const pointer. - * Any decent compiler will optimize this out otherwise. - */ - const xxh_u8* kSecretPtr = XXH3_kSecret; - XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); - -#if defined(__clang__) && defined(__aarch64__) - /* - * UGLY HACK: - * Clang generates a bunch of MOV/MOVK pairs for aarch64, and they are - * placed sequentially, in order, at the top of the unrolled loop. - * - * While MOVK is great for generating constants (2 cycles for a 64-bit - * constant compared to 4 cycles for LDR), long MOVK chains stall the - * integer pipelines: - * I L S - * MOVK - * MOVK - * MOVK - * MOVK - * ADD - * SUB STR - * STR - * By forcing loads from memory (as the asm line causes Clang to assume - * that XXH3_kSecretPtr has been changed), the pipelines are used more - * efficiently: - * I L S - * LDR - * ADD LDR - * SUB STR - * STR - * XXH3_64bits_withSeed, len == 256, Snapdragon 835 - * without hack: 2654.4 MB/s - * with hack: 3202.9 MB/s - */ - __asm__("" : "+r" (kSecretPtr)); -#endif - /* - * Note: in debug mode, this overrides the asm optimization - * and Clang will emit MOVK chains again. - */ - XXH_ASSERT(kSecretPtr == XXH3_kSecret); - - { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; - int i; - for (i=0; i < nbRounds; i++) { - /* - * The asm hack causes Clang to assume that kSecretPtr aliases with - * customSecret, and on aarch64, this prevented LDP from merging two - * loads together for free. Putting the loads together before the stores - * properly generates LDP. - */ - xxh_u64 lo = XXH_readLE64(kSecretPtr + 16*i) + seed64; - xxh_u64 hi = XXH_readLE64(kSecretPtr + 16*i + 8) - seed64; - XXH_writeLE64((xxh_u8*)customSecret + 16*i, lo); - XXH_writeLE64((xxh_u8*)customSecret + 16*i + 8, hi); - } } -} - - -typedef void (*XXH3_f_accumulate_512)(void* XXH_RESTRICT, const void*, const void*); -typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); -typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); - - -#if (XXH_VECTOR == XXH_AVX512) - -#define XXH3_accumulate_512 XXH3_accumulate_512_avx512 -#define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 -#define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 - -#elif (XXH_VECTOR == XXH_AVX2) - -#define XXH3_accumulate_512 XXH3_accumulate_512_avx2 -#define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 -#define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 - -#elif (XXH_VECTOR == XXH_SSE2) - -#define XXH3_accumulate_512 XXH3_accumulate_512_sse2 -#define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 -#define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 - -#elif (XXH_VECTOR == XXH_NEON) - -#define XXH3_accumulate_512 XXH3_accumulate_512_neon -#define XXH3_scrambleAcc XXH3_scrambleAcc_neon -#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar - -#elif (XXH_VECTOR == XXH_VSX) - -#define XXH3_accumulate_512 XXH3_accumulate_512_vsx -#define XXH3_scrambleAcc XXH3_scrambleAcc_vsx -#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar - -#else /* scalar */ - -#define XXH3_accumulate_512 XXH3_accumulate_512_scalar -#define XXH3_scrambleAcc XXH3_scrambleAcc_scalar -#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar - -#endif - - - -#ifndef XXH_PREFETCH_DIST -# ifdef __clang__ -# define XXH_PREFETCH_DIST 320 -# else -# if (XXH_VECTOR == XXH_AVX512) -# define XXH_PREFETCH_DIST 512 -# else -# define XXH_PREFETCH_DIST 384 -# endif -# endif /* __clang__ */ -#endif /* XXH_PREFETCH_DIST */ - -/* - * XXH3_accumulate() - * Loops over XXH3_accumulate_512(). - * Assumption: nbStripes will not overflow the secret size - */ -XXH_FORCE_INLINE void -XXH3_accumulate( xxh_u64* XXH_RESTRICT acc, - const xxh_u8* XXH_RESTRICT input, - const xxh_u8* XXH_RESTRICT secret, - size_t nbStripes, - XXH3_f_accumulate_512 f_acc512) -{ - size_t n; - for (n = 0; n < nbStripes; n++ ) { - const xxh_u8* const in = input + n*XXH_STRIPE_LEN; - XXH_PREFETCH(in + XXH_PREFETCH_DIST); - f_acc512(acc, - in, - secret + n*XXH_SECRET_CONSUME_RATE); - } -} - -XXH_FORCE_INLINE void -XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, - const xxh_u8* XXH_RESTRICT input, size_t len, - const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble) -{ - size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; - size_t const block_len = XXH_STRIPE_LEN * nbStripesPerBlock; - size_t const nb_blocks = (len - 1) / block_len; - - size_t n; - - XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); - - for (n = 0; n < nb_blocks; n++) { - XXH3_accumulate(acc, input + n*block_len, secret, nbStripesPerBlock, f_acc512); - f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); - } - - /* last partial block */ - XXH_ASSERT(len > XXH_STRIPE_LEN); - { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; - XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); - XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, f_acc512); - - /* last stripe */ - { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; -#define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ - f_acc512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); - } } -} - -XXH_FORCE_INLINE xxh_u64 -XXH3_mix2Accs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret) -{ - return XXH3_mul128_fold64( - acc[0] ^ XXH_readLE64(secret), - acc[1] ^ XXH_readLE64(secret+8) ); -} - -static XXH64_hash_t -XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 start) -{ - xxh_u64 result64 = start; - size_t i = 0; - - for (i = 0; i < 4; i++) { - result64 += XXH3_mix2Accs(acc+2*i, secret + 16*i); -#if defined(__clang__) /* Clang */ \ - && (defined(__arm__) || defined(__thumb__)) /* ARMv7 */ \ - && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ - && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ - /* - * UGLY HACK: - * Prevent autovectorization on Clang ARMv7-a. Exact same problem as - * the one in XXH3_len_129to240_64b. Speeds up shorter keys > 240b. - * XXH3_64bits, len == 256, Snapdragon 835: - * without hack: 2063.7 MB/s - * with hack: 2560.7 MB/s - */ - __asm__("" : "+r" (result64)); -#endif - } - - return XXH3_avalanche(result64); -} - -#define XXH3_INIT_ACC { XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \ - XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 } - -XXH_FORCE_INLINE XXH64_hash_t -XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, - const void* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble) -{ - XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; - - XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc512, f_scramble); - - /* converge into final hash */ - XXH_STATIC_ASSERT(sizeof(acc) == 64); - /* do not align on 8, so that the secret is different from the accumulator */ -#define XXH_SECRET_MERGEACCS_START 11 - XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); - return XXH3_mergeAccs(acc, (const xxh_u8*)secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); -} - -/* - * It's important for performance that XXH3_hashLong is not inlined. - */ -XXH_NO_INLINE XXH64_hash_t -XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, - XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) -{ - (void)seed64; - return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate_512, XXH3_scrambleAcc); -} - -/* - * It's important for performance that XXH3_hashLong is not inlined. - * Since the function is not inlined, the compiler may not be able to understand that, - * in some scenarios, its `secret` argument is actually a compile time constant. - * This variant enforces that the compiler can detect that, - * and uses this opportunity to streamline the generated code for better performance. - */ -XXH_NO_INLINE XXH64_hash_t -XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, - XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) -{ - (void)seed64; (void)secret; (void)secretLen; - return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc); -} - -/* - * XXH3_hashLong_64b_withSeed(): - * Generate a custom key based on alteration of default XXH3_kSecret with the seed, - * and then use this key for long mode hashing. - * - * This operation is decently fast but nonetheless costs a little bit of time. - * Try to avoid it whenever possible (typically when seed==0). - * - * It's important for performance that XXH3_hashLong is not inlined. Not sure - * why (uop cache maybe?), but the difference is large and easily measurable. - */ -XXH_FORCE_INLINE XXH64_hash_t -XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, - XXH64_hash_t seed, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble, - XXH3_f_initCustomSecret f_initSec) -{ - if (seed == 0) - return XXH3_hashLong_64b_internal(input, len, - XXH3_kSecret, sizeof(XXH3_kSecret), - f_acc512, f_scramble); - { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; - f_initSec(secret, seed); - return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), - f_acc512, f_scramble); - } -} - -/* - * It's important for performance that XXH3_hashLong is not inlined. - */ -XXH_NO_INLINE XXH64_hash_t -XXH3_hashLong_64b_withSeed(const void* input, size_t len, - XXH64_hash_t seed, const xxh_u8* secret, size_t secretLen) -{ - (void)secret; (void)secretLen; - return XXH3_hashLong_64b_withSeed_internal(input, len, seed, - XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); -} - - -typedef XXH64_hash_t (*XXH3_hashLong64_f)(const void* XXH_RESTRICT, size_t, - XXH64_hash_t, const xxh_u8* XXH_RESTRICT, size_t); - -XXH_FORCE_INLINE XXH64_hash_t -XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, - XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, - XXH3_hashLong64_f f_hashLong) -{ - XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); - /* - * If an action is to be taken if `secretLen` condition is not respected, - * it should be done here. - * For now, it's a contract pre-condition. - * Adding a check and a branch here would cost performance at every hash. - * Also, note that function signature doesn't offer room to return an error. - */ - if (len <= 16) - return XXH3_len_0to16_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); - if (len <= 128) - return XXH3_len_17to128_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); - if (len <= XXH3_MIDSIZE_MAX) - return XXH3_len_129to240_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); - return f_hashLong(input, len, seed64, (const xxh_u8*)secret, secretLen); -} - - -/* === Public entry point === */ - -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* input, size_t len) -{ - return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); -} - -XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) -{ - return XXH3_64bits_internal(input, len, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); -} - -XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) -{ - return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); -} - - -/* === XXH3 streaming === */ - -/* - * Malloc's a pointer that is always aligned to align. - * - * This must be freed with `XXH_alignedFree()`. - * - * malloc typically guarantees 16 byte alignment on 64-bit systems and 8 byte - * alignment on 32-bit. This isn't enough for the 32 byte aligned loads in AVX2 - * or on 32-bit, the 16 byte aligned loads in SSE2 and NEON. - * - * This underalignment previously caused a rather obvious crash which went - * completely unnoticed due to XXH3_createState() not actually being tested. - * Credit to RedSpah for noticing this bug. - * - * The alignment is done manually: Functions like posix_memalign or _mm_malloc - * are avoided: To maintain portability, we would have to write a fallback - * like this anyways, and besides, testing for the existence of library - * functions without relying on external build tools is impossible. - * - * The method is simple: Overallocate, manually align, and store the offset - * to the original behind the returned pointer. - * - * Align must be a power of 2 and 8 <= align <= 128. - */ -static void* XXH_alignedMalloc(size_t s, size_t align) -{ - XXH_ASSERT(align <= 128 && align >= 8); /* range check */ - XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ - XXH_ASSERT(s != 0 && s < (s + align)); /* empty/overflow */ - { /* Overallocate to make room for manual realignment and an offset byte */ - xxh_u8* base = (xxh_u8*)XXH_malloc(s + align); - if (base != NULL) { - /* - * Get the offset needed to align this pointer. - * - * Even if the returned pointer is aligned, there will always be - * at least one byte to store the offset to the original pointer. - */ - size_t offset = align - ((size_t)base & (align - 1)); /* base % align */ - /* Add the offset for the now-aligned pointer */ - xxh_u8* ptr = base + offset; - - XXH_ASSERT((size_t)ptr % align == 0); - - /* Store the offset immediately before the returned pointer. */ - ptr[-1] = (xxh_u8)offset; - return ptr; - } - return NULL; - } -} -/* - * Frees an aligned pointer allocated by XXH_alignedMalloc(). Don't pass - * normal malloc'd pointers, XXH_alignedMalloc has a specific data layout. - */ -static void XXH_alignedFree(void* p) -{ - if (p != NULL) { - xxh_u8* ptr = (xxh_u8*)p; - /* Get the offset byte we added in XXH_malloc. */ - xxh_u8 offset = ptr[-1]; - /* Free the original malloc'd pointer */ - xxh_u8* base = ptr - offset; - XXH_free(base); - } -} -XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) -{ - XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); - if (state==NULL) return NULL; - XXH3_INITSTATE(state); - return state; -} - -XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) -{ - XXH_alignedFree(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API void -XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state) -{ - memcpy(dst_state, src_state, sizeof(*dst_state)); -} - -static void -XXH3_64bits_reset_internal(XXH3_state_t* statePtr, - XXH64_hash_t seed, - const void* secret, size_t secretSize) -{ - size_t const initStart = offsetof(XXH3_state_t, bufferedSize); - size_t const initLength = offsetof(XXH3_state_t, nbStripesPerBlock) - initStart; - XXH_ASSERT(offsetof(XXH3_state_t, nbStripesPerBlock) > initStart); - XXH_ASSERT(statePtr != NULL); - /* set members from bufferedSize to nbStripesPerBlock (excluded) to 0 */ - memset((char*)statePtr + initStart, 0, initLength); - statePtr->acc[0] = XXH_PRIME32_3; - statePtr->acc[1] = XXH_PRIME64_1; - statePtr->acc[2] = XXH_PRIME64_2; - statePtr->acc[3] = XXH_PRIME64_3; - statePtr->acc[4] = XXH_PRIME64_4; - statePtr->acc[5] = XXH_PRIME32_2; - statePtr->acc[6] = XXH_PRIME64_5; - statePtr->acc[7] = XXH_PRIME32_1; - statePtr->seed = seed; - statePtr->extSecret = (const unsigned char*)secret; - XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); - statePtr->secretLimit = secretSize - XXH_STRIPE_LEN; - statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset(XXH3_state_t* statePtr) -{ - if (statePtr == NULL) return XXH_ERROR; - XXH3_64bits_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) -{ - if (statePtr == NULL) return XXH_ERROR; - XXH3_64bits_reset_internal(statePtr, 0, secret, secretSize); - if (secret == NULL) return XXH_ERROR; - if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) -{ - if (statePtr == NULL) return XXH_ERROR; - if (seed==0) return XXH3_64bits_reset(statePtr); - if (seed != statePtr->seed) XXH3_initCustomSecret(statePtr->customSecret, seed); - XXH3_64bits_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); - return XXH_OK; -} - -/* Note : when XXH3_consumeStripes() is invoked, - * there must be a guarantee that at least one more byte must be consumed from input - * so that the function can blindly consume all stripes using the "normal" secret segment */ -XXH_FORCE_INLINE void -XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, - size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, - const xxh_u8* XXH_RESTRICT input, size_t nbStripes, - const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble) -{ - XXH_ASSERT(nbStripes <= nbStripesPerBlock); /* can handle max 1 scramble per invocation */ - XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock); - if (nbStripesPerBlock - *nbStripesSoFarPtr <= nbStripes) { - /* need a scrambling operation */ - size_t const nbStripesToEndofBlock = nbStripesPerBlock - *nbStripesSoFarPtr; - size_t const nbStripesAfterBlock = nbStripes - nbStripesToEndofBlock; - XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripesToEndofBlock, f_acc512); - f_scramble(acc, secret + secretLimit); - XXH3_accumulate(acc, input + nbStripesToEndofBlock * XXH_STRIPE_LEN, secret, nbStripesAfterBlock, f_acc512); - *nbStripesSoFarPtr = nbStripesAfterBlock; - } else { - XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripes, f_acc512); - *nbStripesSoFarPtr += nbStripes; - } -} - -/* - * Both XXH3_64bits_update and XXH3_128bits_update use this routine. - */ -XXH_FORCE_INLINE XXH_errorcode -XXH3_update(XXH3_state_t* state, - const xxh_u8* input, size_t len, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble) -{ - if (input==NULL) -#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) - return XXH_OK; -#else - return XXH_ERROR; -#endif - - { const xxh_u8* const bEnd = input + len; - const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; - - state->totalLen += len; - - if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) { /* fill in tmp buffer */ - XXH_memcpy(state->buffer + state->bufferedSize, input, len); - state->bufferedSize += (XXH32_hash_t)len; - return XXH_OK; - } - /* total input is now > XXH3_INTERNALBUFFER_SIZE */ - - #define XXH3_INTERNALBUFFER_STRIPES (XXH3_INTERNALBUFFER_SIZE / XXH_STRIPE_LEN) - XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN == 0); /* clean multiple */ - - /* - * Internal buffer is partially filled (always, except at beginning) - * Complete it, then consume it. - */ - if (state->bufferedSize) { - size_t const loadSize = XXH3_INTERNALBUFFER_SIZE - state->bufferedSize; - XXH_memcpy(state->buffer + state->bufferedSize, input, loadSize); - input += loadSize; - XXH3_consumeStripes(state->acc, - &state->nbStripesSoFar, state->nbStripesPerBlock, - state->buffer, XXH3_INTERNALBUFFER_STRIPES, - secret, state->secretLimit, - f_acc512, f_scramble); - state->bufferedSize = 0; - } - XXH_ASSERT(input < bEnd); - - /* Consume input by a multiple of internal buffer size */ - if (input+XXH3_INTERNALBUFFER_SIZE < bEnd) { - const xxh_u8* const limit = bEnd - XXH3_INTERNALBUFFER_SIZE; - do { - XXH3_consumeStripes(state->acc, - &state->nbStripesSoFar, state->nbStripesPerBlock, - input, XXH3_INTERNALBUFFER_STRIPES, - secret, state->secretLimit, - f_acc512, f_scramble); - input += XXH3_INTERNALBUFFER_SIZE; - } while (input<limit); - /* for last partial stripe */ - memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); - } - XXH_ASSERT(input < bEnd); - - /* Some remaining input (always) : buffer it */ - XXH_memcpy(state->buffer, input, (size_t)(bEnd-input)); - state->bufferedSize = (XXH32_hash_t)(bEnd-input); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_update(XXH3_state_t* state, const void* input, size_t len) -{ - return XXH3_update(state, (const xxh_u8*)input, len, - XXH3_accumulate_512, XXH3_scrambleAcc); -} - - -XXH_FORCE_INLINE void -XXH3_digest_long (XXH64_hash_t* acc, - const XXH3_state_t* state, - const unsigned char* secret) -{ - /* - * Digest on a local copy. This way, the state remains unaltered, and it can - * continue ingesting more input afterwards. - */ - memcpy(acc, state->acc, sizeof(state->acc)); - if (state->bufferedSize >= XXH_STRIPE_LEN) { - size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; - size_t nbStripesSoFar = state->nbStripesSoFar; - XXH3_consumeStripes(acc, - &nbStripesSoFar, state->nbStripesPerBlock, - state->buffer, nbStripes, - secret, state->secretLimit, - XXH3_accumulate_512, XXH3_scrambleAcc); - /* last stripe */ - XXH3_accumulate_512(acc, - state->buffer + state->bufferedSize - XXH_STRIPE_LEN, - secret + state->secretLimit - XXH_SECRET_LASTACC_START); - } else { /* bufferedSize < XXH_STRIPE_LEN */ - xxh_u8 lastStripe[XXH_STRIPE_LEN]; - size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; - XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ - memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); - memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); - XXH3_accumulate_512(acc, - lastStripe, - secret + state->secretLimit - XXH_SECRET_LASTACC_START); - } -} - -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) -{ - const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; - if (state->totalLen > XXH3_MIDSIZE_MAX) { - XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; - XXH3_digest_long(acc, state, secret); - return XXH3_mergeAccs(acc, - secret + XXH_SECRET_MERGEACCS_START, - (xxh_u64)state->totalLen * XXH_PRIME64_1); - } - /* totalLen <= XXH3_MIDSIZE_MAX: digesting a short input */ - if (state->seed) - return XXH3_64bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); - return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), - secret, state->secretLimit + XXH_STRIPE_LEN); -} - - -#define XXH_MIN(x, y) (((x) > (y)) ? (y) : (x)) - -XXH_PUBLIC_API void -XXH3_generateSecret(void* secretBuffer, const void* customSeed, size_t customSeedSize) -{ - XXH_ASSERT(secretBuffer != NULL); - if (customSeedSize == 0) { - memcpy(secretBuffer, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); - return; - } - XXH_ASSERT(customSeed != NULL); - - { size_t const segmentSize = sizeof(XXH128_hash_t); - size_t const nbSegments = XXH_SECRET_DEFAULT_SIZE / segmentSize; - XXH128_canonical_t scrambler; - XXH64_hash_t seeds[12]; - size_t segnb; - XXH_ASSERT(nbSegments == 12); - XXH_ASSERT(segmentSize * nbSegments == XXH_SECRET_DEFAULT_SIZE); /* exact multiple */ - XXH128_canonicalFromHash(&scrambler, XXH128(customSeed, customSeedSize, 0)); - - /* - * Copy customSeed to seeds[], truncating or repeating as necessary. - */ - { size_t toFill = XXH_MIN(customSeedSize, sizeof(seeds)); - size_t filled = toFill; - memcpy(seeds, customSeed, toFill); - while (filled < sizeof(seeds)) { - toFill = XXH_MIN(filled, sizeof(seeds) - filled); - memcpy((char*)seeds + filled, seeds, toFill); - filled += toFill; - } } - - /* generate secret */ - memcpy(secretBuffer, &scrambler, sizeof(scrambler)); - for (segnb=1; segnb < nbSegments; segnb++) { - size_t const segmentStart = segnb * segmentSize; - XXH128_canonical_t segment; - XXH128_canonicalFromHash(&segment, - XXH128(&scrambler, sizeof(scrambler), XXH_readLE64(seeds + segnb) + segnb) ); - memcpy((char*)secretBuffer + segmentStart, &segment, sizeof(segment)); - } } -} - - -/* ========================================== - * XXH3 128 bits (a.k.a XXH128) - * ========================================== - * XXH3's 128-bit variant has better mixing and strength than the 64-bit variant, - * even without counting the significantly larger output size. - * - * For example, extra steps are taken to avoid the seed-dependent collisions - * in 17-240 byte inputs (See XXH3_mix16B and XXH128_mix32B). - * - * This strength naturally comes at the cost of some speed, especially on short - * lengths. Note that longer hashes are about as fast as the 64-bit version - * due to it using only a slight modification of the 64-bit loop. - * - * XXH128 is also more oriented towards 64-bit machines. It is still extremely - * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). - */ - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - /* A doubled version of 1to3_64b with different constants. */ - XXH_ASSERT(input != NULL); - XXH_ASSERT(1 <= len && len <= 3); - XXH_ASSERT(secret != NULL); - /* - * len = 1: combinedl = { input[0], 0x01, input[0], input[0] } - * len = 2: combinedl = { input[1], 0x02, input[0], input[1] } - * len = 3: combinedl = { input[2], 0x03, input[0], input[1] } - */ - { xxh_u8 const c1 = input[0]; - xxh_u8 const c2 = input[len >> 1]; - xxh_u8 const c3 = input[len - 1]; - xxh_u32 const combinedl = ((xxh_u32)c1 <<16) | ((xxh_u32)c2 << 24) - | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); - xxh_u32 const combinedh = XXH_rotl32(XXH_swap32(combinedl), 13); - xxh_u64 const bitflipl = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; - xxh_u64 const bitfliph = (XXH_readLE32(secret+8) ^ XXH_readLE32(secret+12)) - seed; - xxh_u64 const keyed_lo = (xxh_u64)combinedl ^ bitflipl; - xxh_u64 const keyed_hi = (xxh_u64)combinedh ^ bitfliph; - XXH128_hash_t h128; - h128.low64 = XXH64_avalanche(keyed_lo); - h128.high64 = XXH64_avalanche(keyed_hi); - return h128; - } -} - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(input != NULL); - XXH_ASSERT(secret != NULL); - XXH_ASSERT(4 <= len && len <= 8); - seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; - { xxh_u32 const input_lo = XXH_readLE32(input); - xxh_u32 const input_hi = XXH_readLE32(input + len - 4); - xxh_u64 const input_64 = input_lo + ((xxh_u64)input_hi << 32); - xxh_u64 const bitflip = (XXH_readLE64(secret+16) ^ XXH_readLE64(secret+24)) + seed; - xxh_u64 const keyed = input_64 ^ bitflip; - - /* Shift len to the left to ensure it is even, this avoids even multiplies. */ - XXH128_hash_t m128 = XXH_mult64to128(keyed, XXH_PRIME64_1 + (len << 2)); - - m128.high64 += (m128.low64 << 1); - m128.low64 ^= (m128.high64 >> 3); - - m128.low64 = XXH_xorshift64(m128.low64, 35); - m128.low64 *= 0x9FB21C651E98DF25ULL; - m128.low64 = XXH_xorshift64(m128.low64, 28); - m128.high64 = XXH3_avalanche(m128.high64); - return m128; - } -} - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(input != NULL); - XXH_ASSERT(secret != NULL); - XXH_ASSERT(9 <= len && len <= 16); - { xxh_u64 const bitflipl = (XXH_readLE64(secret+32) ^ XXH_readLE64(secret+40)) - seed; - xxh_u64 const bitfliph = (XXH_readLE64(secret+48) ^ XXH_readLE64(secret+56)) + seed; - xxh_u64 const input_lo = XXH_readLE64(input); - xxh_u64 input_hi = XXH_readLE64(input + len - 8); - XXH128_hash_t m128 = XXH_mult64to128(input_lo ^ input_hi ^ bitflipl, XXH_PRIME64_1); - /* - * Put len in the middle of m128 to ensure that the length gets mixed to - * both the low and high bits in the 128x64 multiply below. - */ - m128.low64 += (xxh_u64)(len - 1) << 54; - input_hi ^= bitfliph; - /* - * Add the high 32 bits of input_hi to the high 32 bits of m128, then - * add the long product of the low 32 bits of input_hi and XXH_PRIME32_2 to - * the high 64 bits of m128. - * - * The best approach to this operation is different on 32-bit and 64-bit. - */ - if (sizeof(void *) < sizeof(xxh_u64)) { /* 32-bit */ - /* - * 32-bit optimized version, which is more readable. - * - * On 32-bit, it removes an ADC and delays a dependency between the two - * halves of m128.high64, but it generates an extra mask on 64-bit. - */ - m128.high64 += (input_hi & 0xFFFFFFFF00000000ULL) + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2); - } else { - /* - * 64-bit optimized (albeit more confusing) version. - * - * Uses some properties of addition and multiplication to remove the mask: - * - * Let: - * a = input_hi.lo = (input_hi & 0x00000000FFFFFFFF) - * b = input_hi.hi = (input_hi & 0xFFFFFFFF00000000) - * c = XXH_PRIME32_2 - * - * a + (b * c) - * Inverse Property: x + y - x == y - * a + (b * (1 + c - 1)) - * Distributive Property: x * (y + z) == (x * y) + (x * z) - * a + (b * 1) + (b * (c - 1)) - * Identity Property: x * 1 == x - * a + b + (b * (c - 1)) - * - * Substitute a, b, and c: - * input_hi.hi + input_hi.lo + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) - * - * Since input_hi.hi + input_hi.lo == input_hi, we get this: - * input_hi + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) - */ - m128.high64 += input_hi + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2 - 1); - } - /* m128 ^= XXH_swap64(m128 >> 64); */ - m128.low64 ^= XXH_swap64(m128.high64); - - { /* 128x64 multiply: h128 = m128 * XXH_PRIME64_2; */ - XXH128_hash_t h128 = XXH_mult64to128(m128.low64, XXH_PRIME64_2); - h128.high64 += m128.high64 * XXH_PRIME64_2; - - h128.low64 = XXH3_avalanche(h128.low64); - h128.high64 = XXH3_avalanche(h128.high64); - return h128; - } } -} - -/* - * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN - */ -XXH_FORCE_INLINE XXH128_hash_t -XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) -{ - XXH_ASSERT(len <= 16); - { if (len > 8) return XXH3_len_9to16_128b(input, len, secret, seed); - if (len >= 4) return XXH3_len_4to8_128b(input, len, secret, seed); - if (len) return XXH3_len_1to3_128b(input, len, secret, seed); - { XXH128_hash_t h128; - xxh_u64 const bitflipl = XXH_readLE64(secret+64) ^ XXH_readLE64(secret+72); - xxh_u64 const bitfliph = XXH_readLE64(secret+80) ^ XXH_readLE64(secret+88); - h128.low64 = XXH64_avalanche(seed ^ bitflipl); - h128.high64 = XXH64_avalanche( seed ^ bitfliph); - return h128; - } } -} - -/* - * A bit slower than XXH3_mix16B, but handles multiply by zero better. - */ -XXH_FORCE_INLINE XXH128_hash_t -XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, - const xxh_u8* secret, XXH64_hash_t seed) -{ - acc.low64 += XXH3_mix16B (input_1, secret+0, seed); - acc.low64 ^= XXH_readLE64(input_2) + XXH_readLE64(input_2 + 8); - acc.high64 += XXH3_mix16B (input_2, secret+16, seed); - acc.high64 ^= XXH_readLE64(input_1) + XXH_readLE64(input_1 + 8); - return acc; -} - - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, - const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH64_hash_t seed) -{ - XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; - XXH_ASSERT(16 < len && len <= 128); - - { XXH128_hash_t acc; - acc.low64 = len * XXH_PRIME64_1; - acc.high64 = 0; - if (len > 32) { - if (len > 64) { - if (len > 96) { - acc = XXH128_mix32B(acc, input+48, input+len-64, secret+96, seed); - } - acc = XXH128_mix32B(acc, input+32, input+len-48, secret+64, seed); - } - acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); - } - acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); - { XXH128_hash_t h128; - h128.low64 = acc.low64 + acc.high64; - h128.high64 = (acc.low64 * XXH_PRIME64_1) - + (acc.high64 * XXH_PRIME64_4) - + ((len - seed) * XXH_PRIME64_2); - h128.low64 = XXH3_avalanche(h128.low64); - h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); - return h128; - } - } -} - -XXH_NO_INLINE XXH128_hash_t -XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, - const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH64_hash_t seed) -{ - XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; - XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); - - { XXH128_hash_t acc; - int const nbRounds = (int)len / 32; - int i; - acc.low64 = len * XXH_PRIME64_1; - acc.high64 = 0; - for (i=0; i<4; i++) { - acc = XXH128_mix32B(acc, - input + (32 * i), - input + (32 * i) + 16, - secret + (32 * i), - seed); - } - acc.low64 = XXH3_avalanche(acc.low64); - acc.high64 = XXH3_avalanche(acc.high64); - XXH_ASSERT(nbRounds >= 4); - for (i=4 ; i < nbRounds; i++) { - acc = XXH128_mix32B(acc, - input + (32 * i), - input + (32 * i) + 16, - secret + XXH3_MIDSIZE_STARTOFFSET + (32 * (i - 4)), - seed); - } - /* last bytes */ - acc = XXH128_mix32B(acc, - input + len - 16, - input + len - 32, - secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, - 0ULL - seed); - - { XXH128_hash_t h128; - h128.low64 = acc.low64 + acc.high64; - h128.high64 = (acc.low64 * XXH_PRIME64_1) - + (acc.high64 * XXH_PRIME64_4) - + ((len - seed) * XXH_PRIME64_2); - h128.low64 = XXH3_avalanche(h128.low64); - h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); - return h128; - } - } -} - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, - const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble) -{ - XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; - - XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc512, f_scramble); - - /* converge into final hash */ - XXH_STATIC_ASSERT(sizeof(acc) == 64); - XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); - { XXH128_hash_t h128; - h128.low64 = XXH3_mergeAccs(acc, - secret + XXH_SECRET_MERGEACCS_START, - (xxh_u64)len * XXH_PRIME64_1); - h128.high64 = XXH3_mergeAccs(acc, - secret + secretSize - - sizeof(acc) - XXH_SECRET_MERGEACCS_START, - ~((xxh_u64)len * XXH_PRIME64_2)); - return h128; - } -} - -/* - * It's important for performance that XXH3_hashLong is not inlined. - */ -XXH_NO_INLINE XXH128_hash_t -XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, - XXH64_hash_t seed64, - const void* XXH_RESTRICT secret, size_t secretLen) -{ - (void)seed64; (void)secret; (void)secretLen; - return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - XXH3_accumulate_512, XXH3_scrambleAcc); -} - -/* - * It's important for performance that XXH3_hashLong is not inlined. - */ -XXH_NO_INLINE XXH128_hash_t -XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, - XXH64_hash_t seed64, - const void* XXH_RESTRICT secret, size_t secretLen) -{ - (void)seed64; - return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, - XXH3_accumulate_512, XXH3_scrambleAcc); -} - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, - XXH64_hash_t seed64, - XXH3_f_accumulate_512 f_acc512, - XXH3_f_scrambleAcc f_scramble, - XXH3_f_initCustomSecret f_initSec) -{ - if (seed64 == 0) - return XXH3_hashLong_128b_internal(input, len, - XXH3_kSecret, sizeof(XXH3_kSecret), - f_acc512, f_scramble); - { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; - f_initSec(secret, seed64); - return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), - f_acc512, f_scramble); - } -} - -/* - * It's important for performance that XXH3_hashLong is not inlined. - */ -XXH_NO_INLINE XXH128_hash_t -XXH3_hashLong_128b_withSeed(const void* input, size_t len, - XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) -{ - (void)secret; (void)secretLen; - return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, - XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); -} - -typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, - XXH64_hash_t, const void* XXH_RESTRICT, size_t); - -XXH_FORCE_INLINE XXH128_hash_t -XXH3_128bits_internal(const void* input, size_t len, - XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, - XXH3_hashLong128_f f_hl128) -{ - XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); - /* - * If an action is to be taken if `secret` conditions are not respected, - * it should be done here. - * For now, it's a contract pre-condition. - * Adding a check and a branch here would cost performance at every hash. - */ - if (len <= 16) - return XXH3_len_0to16_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); - if (len <= 128) - return XXH3_len_17to128_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); - if (len <= XXH3_MIDSIZE_MAX) - return XXH3_len_129to240_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); - return f_hl128(input, len, seed64, secret, secretLen); -} - - -/* === Public XXH128 API === */ - -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* input, size_t len) -{ - return XXH3_128bits_internal(input, len, 0, - XXH3_kSecret, sizeof(XXH3_kSecret), - XXH3_hashLong_128b_default); -} - -XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) -{ - return XXH3_128bits_internal(input, len, 0, - (const xxh_u8*)secret, secretSize, - XXH3_hashLong_128b_withSecret); -} - -XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) -{ - return XXH3_128bits_internal(input, len, seed, - XXH3_kSecret, sizeof(XXH3_kSecret), - XXH3_hashLong_128b_withSeed); -} - -XXH_PUBLIC_API XXH128_hash_t -XXH128(const void* input, size_t len, XXH64_hash_t seed) -{ - return XXH3_128bits_withSeed(input, len, seed); -} - - -/* === XXH3 128-bit streaming === */ - -/* - * All the functions are actually the same as for 64-bit streaming variant. - * The only difference is the finalizatiom routine. - */ - -static void -XXH3_128bits_reset_internal(XXH3_state_t* statePtr, - XXH64_hash_t seed, - const void* secret, size_t secretSize) -{ - XXH3_64bits_reset_internal(statePtr, seed, secret, secretSize); -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset(XXH3_state_t* statePtr) -{ - if (statePtr == NULL) return XXH_ERROR; - XXH3_128bits_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) -{ - if (statePtr == NULL) return XXH_ERROR; - XXH3_128bits_reset_internal(statePtr, 0, secret, secretSize); - if (secret == NULL) return XXH_ERROR; - if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) -{ - if (statePtr == NULL) return XXH_ERROR; - if (seed==0) return XXH3_128bits_reset(statePtr); - if (seed != statePtr->seed) XXH3_initCustomSecret(statePtr->customSecret, seed); - XXH3_128bits_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_update(XXH3_state_t* state, const void* input, size_t len) -{ - return XXH3_update(state, (const xxh_u8*)input, len, - XXH3_accumulate_512, XXH3_scrambleAcc); -} - -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) -{ - const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; - if (state->totalLen > XXH3_MIDSIZE_MAX) { - XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; - XXH3_digest_long(acc, state, secret); - XXH_ASSERT(state->secretLimit + XXH_STRIPE_LEN >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); - { XXH128_hash_t h128; - h128.low64 = XXH3_mergeAccs(acc, - secret + XXH_SECRET_MERGEACCS_START, - (xxh_u64)state->totalLen * XXH_PRIME64_1); - h128.high64 = XXH3_mergeAccs(acc, - secret + state->secretLimit + XXH_STRIPE_LEN - - sizeof(acc) - XXH_SECRET_MERGEACCS_START, - ~((xxh_u64)state->totalLen * XXH_PRIME64_2)); - return h128; - } - } - /* len <= XXH3_MIDSIZE_MAX : short code */ - if (state->seed) - return XXH3_128bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); - return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), - secret, state->secretLimit + XXH_STRIPE_LEN); -} - -/* 128-bit utility functions */ - -#include <string.h> /* memcmp, memcpy */ - -/* return : 1 is equal, 0 if different */ -XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) -{ - /* note : XXH128_hash_t is compact, it has no padding byte */ - return !(memcmp(&h1, &h2, sizeof(h1))); -} - -/* This prototype is compatible with stdlib's qsort(). - * return : >0 if *h128_1 > *h128_2 - * <0 if *h128_1 < *h128_2 - * =0 if *h128_1 == *h128_2 */ -XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) -{ - XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; - XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; - int const hcmp = (h1.high64 > h2.high64) - (h2.high64 > h1.high64); - /* note : bets that, in most cases, hash values are different */ - if (hcmp) return hcmp; - return (h1.low64 > h2.low64) - (h2.low64 > h1.low64); -} - - -/*====== Canonical representation ======*/ -XXH_PUBLIC_API void -XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) { - hash.high64 = XXH_swap64(hash.high64); - hash.low64 = XXH_swap64(hash.low64); - } - memcpy(dst, &hash.high64, sizeof(hash.high64)); - memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); -} - -XXH_PUBLIC_API XXH128_hash_t -XXH128_hashFromCanonical(const XXH128_canonical_t* src) -{ - XXH128_hash_t h; - h.high64 = XXH_readBE64(src); - h.low64 = XXH_readBE64(src->digest + 8); - return h; -} - -/* Pop our optimization override from above */ -#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ - && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ -# pragma GCC pop_options -#endif - -#endif /* XXH_NO_LONG_LONG */ - - -#endif /* XXH_IMPLEMENTATION */ - - -#if defined (__cplusplus) -} -#endif diff --git a/GLideN64/translations/gliden64_de.ts b/GLideN64/translations/gliden64_de.ts deleted file mode 100644 index 95ac8eb..0000000 --- a/GLideN64/translations/gliden64_de.ts +++ /dev/null @@ -1,1252 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="de_DE"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>Über GLideN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation>Über</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation>Das N64 Open-Source Grafik-Plugin der nächsten Generation.</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>Autoren</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation>Entwickler</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation>Betatester</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation>Oberflächendesigner</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation>Beiträger</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation>... und mehr</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation>Autor des originalen glN64 Grafikplugins</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation>Autor des glesn64 Grafikplugins, einem GLES 2.0 Port von glN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation>Autor der GlideHQ Texturbibliothek</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation>Autor von z64, einem OpenGL LLE Grafikplugin</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>Finanzierer</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <translation>Danksagung</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation>Schließen</translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation>Video</translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>Vollbild-Auflösung:</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>Fenster-Auflösung:</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>Aktualisierungsrate:</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>Strecken</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation>16:9</translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Option wählt die Auflösung für den Fenstermodus aus. Du kannst auch eine benutzerdefinierte Fenstergröße eingeben.</p><p>[Empfehlung: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation><html><head/><body><p>Threaded Video kann die Leistung mit schlechten OpenGL-Treibern auf Kosten einer sehr marginalen Eingangsverzögerung, normalerweise weniger als ein halbes Frame, verbessern.</p><p>[Empfehlung: <span style=" font-style:italic;">Gewöhnlich aus, es sei denn, es gibt Leistungsprobleme</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation>Threaded Video aktivieren</translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation>Wenn aktiviert, wird das Bild um die in N64 Pixel angegebenen Werte beschnitten. Nützlich, um schwarze Ränder in einigen Spielen zu entfernen.</translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation>Overscan</translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation>NTSC</translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation>PAL</translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation>Antialiasing</translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation><html><head/><body><p>GLideN64 bietet zwei Methoden zur Kantenglättung an:</p><p><span style=" font-weight:600;">Fast Approximate Antialiasing (FXAA)</span>: FXAA ist ein Nachbearbeitungsfilter, der ein anständiges Ergebnis liefern kann, aber so gut wie MSAA ist. Der Hauptgrund für die Verwendung von FXAA ist die Verwendung mit <span style=" font-weight:600;">N64-Style-Tiefenvergleich</span>. FXAA fügt dem Ausgabebild etwas Unschärfe hinzu, wodurch einige Texturen wie Text möglicherweise schlechter aussehen.</p><p><span style=" font-weight:600;">Multisample-Antialiasing (MSAA)</span>: MSAA ist eine Standard-Antialiasing-Technik, die in der Computergrafik zur Verbesserung der Bildqualität eingesetzt wird. Die meisten modernen GPUs unterstützen 2, 4, 8 und 16 Samples. Mehr Samples bedeuten bessere Qualität, sind aber langsamer. Es gibt zwei Nachteile: Es ist inkompatibel mit <span style=" font-weight:600;">N64-Style-Tiefenvergleich</span> und kann bei einigen Spielen zu kleineren Störungen führen.</p><p>Empfehlung: [<span style=" font-style:italic;">Normalerweise 16x MSAA, oder FXAA mit N64-Style-Tiefenvergleich</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation>Kein Antialiasing</translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation>Fast Approximate Antialiasing (FXAA)</translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation>Multisample-Antialiasing (MSAA):</translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation>Multisample-Antialiasing ist nicht kompatibel mit <a href="#n64DepthCompare">N64-Style-Tiefenvergleich</a>.</translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation>Filtern</translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>Anisotrope Filterung:</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation>PNG</translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>Sprache:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation>Einige der Optionen auf dieser Registerkarte wurden deaktiviert, weil <a href="#frameBuffer">Framebuffer-Emulation</a> ausgeschaltet wurde.</translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>Emulation</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Wenn aktiviert, werden alle nicht standardmäßigen Einstellungen für jedes Spiel einzeln gespeichert.</p><p>Wenn ein Spiel läuft, werden die Einstellungen für das aktuell laufende Spiel angezeigt und gespeichert.</p><p><span style=" font-weight:600;">Hinweis:</span> GLideN64 enthält bereits Einstellungen für die optimale Leistung der meisten Spiele. Sei vorsichtig wenn du Optionen auf den Registerkarten 'Emulation' und 'Frame-Buffer' änderst.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation>Spieleinstellungen verwenden</translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation>Interne Auflösung</translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation>x</translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation>Gamma</translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation>Benutzerdefinierte Gammakorrekturstufe:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation>Die Auswahl dieser Option setzt die vom Spiel vorgegebene Gammakorrektur außer Kraft.</translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation>2D-Elemente</translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation>Rendern von 2D-Elementen in N64-Auflösung (beste Qualität, kann langsam sein):</translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation>Aktiviere optimiert</translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation>Aktiviere nicht optimiert</translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation>Versuche farbige Halos um transparente Objekte zu entfernen</translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation><html><head/><body><p>Hintergrund-Rendering ist ein komplexer Makrobefehl zum Rendern großer (normalerweise bildschirmfüllender) Bilder. Da Hintergrundbilder normalerweise nicht in den Texturspeicher passen, werden sie vom Mikrocode auf schmale Streifen aufgeteilt und einzeln gerendert. HLE-Code hat zwei Modi zur Emulation von Hintergrundbefehlen:</p><p><span style=" font-weight:600;">An einem Stück</span>: Das gesamte Hintergrundbild wird als ein texturiertes Rechteck dargestellt. Diese Methode ist normalerweise viel schneller, aber das Ergebnis ist nicht immer korrekt.</p><p><span style=" font-weight:600;">In Streifen</span>: Diese Methode emuliert Hintergrundbefehle so nah wie möglich zur tatsächlichen Mikrocode-Implementierung. Ist langsamer, aber präziser. Ein weiteres Problem: Bei einigen Spielen können Lücken zwischen den gerenderten Streifen in hoher Auflösung auftreten. Verwende die &quot;Rendern von 2D-Elementen in N64-Auflösung&quot; -Option zum Entfernen der Lücken.</p><p>[Empfehlung: <span style=" font-style:italic;">Spielabhängig, meistens in Streifen</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation>Hintergrund-Renderingmodus (nur HLE):</translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation>An einem Stück</translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation>In Streifen</translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>Framebuffer emulieren</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation>FPS anzeigen</translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation>VI/s anzeigen</translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation>Interne Auflösung anzeigen</translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation>Rendering-Auflösung anzeigen</translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation>Schriftart</translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translatorcomment>Schriftgröße</translatorcomment> - <translation>Größe:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translatorcomment>Abkürzung für die Schriftgröße der Pixel; ggf. mit einem führenden Leerzeichen</translatorcomment> - <translation> px</translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation>████</translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation>Die Schriftvorschau zeigt nur den regulären Stil für die Schriftfamilie an. Einige Stile wie fett und kursiv werden nur im Spiel angezeigt.</translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation>Debuggen</translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation>Low-Level-Info ausgeben</translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation>Display-Listen-Befehle ausgeben</translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation>Detaillierte Informationen ausgeben (Matrizen, Eckpunkte, etc.)</translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation>Dieses Spiel</translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation>Einstellungen speichern für:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation>Einstellungen Profil:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation>Entfernen</translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation>Textur-Verbesserungen</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>Filter:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>Verbesserungen:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>Verwende Texturpaket</translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation>Deaktivieren</translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation>Anpassung</translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation><html><head/><body><p>Wenn diese Einstellung nicht ausgewählt ist, sind viele Effekte deaktiviert wie z.B. Kantenglättung, Beschneiden, Seitenverhältnis, N64 Auflösungsfaktor, N64-Style Tiefenvergleich und mehr. Diese Einstellung sollte nur deaktiviert werden, falls es Geschwindigkeitsprobleme gibt.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Vertikaler Interrupt (empfohlen, wenigste Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>VI Ursprung hat sich geändert (schneller, wenige Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Farbbuffer Änderung (am schnellsten, einige Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Niemals (am schnellsten, viele Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Synchron (am langsamsten, die wenigsten Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Asynchron (schnell, wenige Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Niemals (am schnellsten, die meisten Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Vom VRAM (langsam, einige Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>In Software (schnell, am wenigsten Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation><html><head/><body><p>Aktiviere Tiefenpuffer löschen erzwingen. Erforderlich für Eikou no Saint Andrews.</p><p>Empfehlung: <span style=" font-style:italic;">Aus, außer für Eikou no Saint Andrews</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation>Tiefenpuffer löschen erzwingen</translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>Pfad für Texturpakete:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation>Größe des Speichercaches für erweiterte Texturen:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>Textur-Cache komprimieren</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation>GLideN64 Einstellungen</translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation><html><head/><body><p>Alle von der Grafikkarte/Monitor unterstützten Auflösungen sollten angezeigt werden.</p><p>[Empfehlung:<span style=" font-style:italic;"> Die maximale Auflösung des Monitors, außer es gibt Geschwindigkeitprobleme</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation><html><head/><body><p>Vertikale Synchronisation, oder VSync, kann die Bildqualität durch die Synchronisation der Aktualisierungsrate des Spiels mit der Bildwiederholrate des Monitors verbessern. Dies verhindert Bildversatz/Tearing, kann zu Leistungseinbrüchen führen.</p><p>[Empfehlung: <span style=" font-style:italic;">Gewöhnlich aus, außer es gibt Tearing</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation>Aktiviere VSync</translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung legt das Seitenverhältnis der Ausgabe fest. Alle N64 Spiele unterstützen <span style=" font-weight:600;">4:3</span>. Einige Spiele unterstützen <span style=" font-weight:600;">16:9</span> innerhalb der Spieleinstellungen. Verwende <span style=" font-weight:600;">Strecken</span> um den kompletten Bildschirm ohne schwarze Ränder anzuzeigen.</p><p><span style=" font-weight:600;">Versuche das Spiel passend einzustellen</span> versucht den Betrachtungsraum ohne Strecken anzupassen. Viele Spiele funktionieren gut. Einige nicht.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation><html><head/><body><p>Seitenverhältnis:</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation>4:3 (empfohlen)</translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation>Versuche das Spiel passend einzustellen</translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation>Aus</translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation>Hoch</translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation><html><head/><body><p><span style=" font-weight:600;">Bilineare Filterung</span>: Texturen verwenden standard PC-Style bilineare Filtering.</p><p><span style=" font-weight:600;">N64-Style 3 point</span>: Texturen werden ähnlich dem N64 gefiltert. Das Resultat sieht nicht so weich aus, entspricht aber ehr dem N64.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation>Bilineare Filterung:</translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation>Standard</translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation>N64-Style 3 Punkt</translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translatorcomment>Megabytes</translatorcomment> - <translation> MB</translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation>Screenshot Format:</translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation>JPEG</translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation><html><head/><body><p>Die gewählte Sprache wird übernommen, nachdem das Fenster geschlossen und wieder geöffnet wird.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Das N64 verwendet eine einzigartige Art des Mip-Mappings, welche nur schwer auf einem PC nachzustellen ist. Wenn diese Einstellung ausgewählt ist wird N64 Mip-Mapping emuliert. Wenn diese Einstellung nicht ausgewählt ist sehen bei einigen Spielen Texturen in der Ferne schärfer aus.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation>Aktiviere N64-Style Mip-Mapping</translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation type="unfinished"><html><head/><body><p>Diese Einstellung emuliert Effekte, welche zufällige Farbeingaben verwenden. Diese Einstellung kann sporadisch zu Geschwindigkeitsproblemen führen.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation>Aktiviere Per-Pixel Lighting (Bessere Qualität, nur HLE)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Verwende einen dauerhaften Speicher für kompilierte Shader Programme.<br/>Jedes Spiel verwendet einen Satz an Combinern. Ein Combiner ist eine Gleichung, welche beschreibt wie aus verschiedenen Farbeingängen eine Ausgangsfarbe erzeugt wird. GLideN64 übersetzt und kompiliert Shader während der Laufzeit. Shader sind groß und komplex.Wenn ein Spiel mehrere neue Combiner verwendet dauert das kompilieren neuer Shader einige Zeit, was zu Stottern führen kann. Wenn diese einstellung ausgewählt ist werden diese Shader gesichert, damit sie beim nächsten Mal nicht neu kompiliert werden müssen.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation>Speichere kompilierte Shader für Geschwindigkeit (Empfehlung)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung legt die Render-Buffer-Größe der Ausgabe fest. Standardmäßig ist die Render-Buffer-Größe <span style=" font-weight:600;">Wie die Auflösung der Ausgabe</span>, oder alternativ auch die <span style=" font-weight:600;">Original N64 Auflösung</span> oder ein <span style=" font-weight:600;">Vielfaches der N64 Auflösung</span>.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation>Wie Ausgabeauflösung</translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation>Originale N64 Auflösung (höchste Genauigkeit)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation>Mehrfaches der N64 Auflösung:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation><html><head/><body><p>Wenn diese Option ausgewählt ist, werden 2D Elemente in der originalen N64 Auflösung gezeichnet, bevor sie zur Ausgabe gegeben werden. Normalerweise werden durch diese Einstellung Anzeigeprobleme von 2D Elementen beseitigt. Die Ausführungsgeschwindigkeit kann aber beeinträchtigt werden. Diese Einstellung verwendet Heuristik um benachbarte 2D Elemente zu erkennen, welche nicht in jedem Spiel funktionieren.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt, außer es bestehen Geschwindigkeitsprobleme</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation><html><head/><body><p>In einigen Spielen sind die Koordinaten von 2D Elemente nicht richtig ausgerichtet. Zwischen zwei benachbarten Elementen besteht eine Lücke von einem halben Pixel. Bei der originalen N64 Auflösung tritt dieses Problem nicht aus. Bei höheren Auflösungen ist aber eine schwarze Linie zwischen den Elementen sichtbar. Diese Einstellung verhindert schwarze Linien zwischen benachbarten 2D Elementen.</p><p><span style=" font-weight:600;">Für benachbarte 2D Elemente</span>: Wendet die Korrektur bei Polygonen an, welche sie benötigen. Bei auswählen, welche Probleme mit schwarzen Linien haben.</p><p><span style=" font-weight:600;">Immer</span>: Wende Korrektur bei allen 2D Elementen an. Wähle diese Einstellung aus, falls <span style=" font-weight:600;">Für benachbarte 2D Elemente</span> nicht hilft.</p><p><span style=" font-weight:600;">Niemals</span>: Keine Korrektur von schwarzen Linien zwischen 2D Elementen.</p><p>[Empfehlung: <span style=" font-style:italic;">Spielabhängig, in der Regel Niemals</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation>Beseitige schwarze Linien zwischen 2D Elementen:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Nur benachbarte 2D Elemente</translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Immer</translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Niemals</translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation>Frame-Buffer</translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Wenn diese Einstellung ausgewählt ist wird der Hilfs-Farb-Buffer, direkt nachdem er aktualisiert wurde, in den N64 Speicher geschrieben. Diese Einstellung hilft Frame-Buffer-Effekte in einigen Spielen richtig zu emulieren. Sie kann aber deutlich die Leistung reduzieren.</p><p>[Empfehlung: <span style=" font-style:italic;">Nicht ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation>Kopiere den Hilfs-Farb-Buffer in den N64 Speicher (manchmal langsam, wenige Spielprobleme)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation><html><head/><body><p>Die Einstellung legt fest, wie oft GLideN64 den Haupt-Frame-Buffer aktualisiert.</p><p><span style=" font-weight:600;">Vertikaler Interrupt</span>: Aktualisiert den Buffer so schnell wie möglich, d.h. bei jedem vertikalen Interrupt in der Sekunde (50Hz für PAL und 60Hz für NTSC Spiele). Diese Einstellung hat die höchste Kompatibilität. Verwende diese Einstellung solange es keine Leistungseinbußen gibt.</p><p><span style=" font-weight:600;">VI-Ursprungsänderung</span>: Die VI-Ursprungsänderung korrespondiert mit den eigentlichen FPS eines Spiels. N64 Spiele laufen in der Regel mit 20 bis 30 FPS. Der Buffer wird nicht so oft wie beim ersten Modus aktualisiert. Dieser Modus funktioniert nicht bei Spielen, welche einen einzigen Buffer verwenden, was selten vorkommt.</p><p><span style=" font-weight:600;">Farb-Buffer-Änderung</span>: Diese Einstellung überprüft, ob sich der Frame-Buffer geändert hat. Bei einigen Spielen funktioniert diese Einstellung nicht.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation>Frame-Bufferwechsel an:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Einige Emulatoren erkennen nur schlecht, ob der Frame-Buffer gelesen oder geschrieben wurden. Die Erkennung des Emulators kann deaktiviert werden, damit GLideN64 selbst Frame-Buffer lesen und schreiben kann.</p><p>[Empfehlung: <span style=" font-style:italic;">Gewöhnlich nicht ausgewählt, aber manche Spiele laufen mit dieser Einstellung schneller</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation>Benutze die Hilfe des Emulators zum Lesen/Schreiben des Frame-Buffers</translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation><html><head/><body><p>Wenn diese Einstellung ausgewählt ist, wird der Farb-Buffer in Stücken gelesen. Andernfalls wird der Buffer in einem Rutsch gelesen. Wenn ein Spiel den kompletten Buffer lesen muss, kann diese Einstellung zu Verzögerungen führen.</p><p>[Empfehlung: <span style=" font-style:italic;">Gewöhnlich nicht ausgewählt, weil der Farb-Buffer in der Regel komplett gelesen wird</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation>Lese Farb-Buffer in 4kB Stücken</translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation><html><head/><body><p>Wenn diese Einstellung ausgewählt ist, wird der Depth-Buffer in Stücken gelesen. Andernfalls wird der Buffer in einem Rutsch gelesen. Wenn ein Spiel den kompletten Buffer lesen muss, kann diese Einstellung zu Verzögerungen führen.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt, weil der Depth-Buffer in der Regel nicht komplett gelesen wird</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation>Lese Depth-Buffer in 4kB Stücken</translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation><html><head/><body><p>Bei einigen Spielen kann GLideN64 nicht feststellen, ob der Frame-Buffer verwendet wird. Mit diesen Einstellungen kann festgelegt werde, ob GLideN64 jeden Frame des Grafikkarten-Frame-Buffers in den N64 Speicher kopiert.</p><p><span style=" font-weight:600;">Niemals</span>: Deaktivert das Kopieren des Grafikkarten-Buffers.</p><p><span style=" font-weight:600;">Synchron</span>: Effekte aller Spiele werden erkannt. Die Leistung kann beeinträchtigt werden. Verwende diese Einstellung für alle Spiele, welche mit <span style=" font-weight:600;">Asynchron</span> nicht funktionieren.</p><p><span style=" font-weight:600;">Asynchron</span>: Die Effekte der meisten Spiele werden erkannt.</p><p>[Empfehlung: <span style=" font-style:italic;">Asynchron</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation>Kopiere den Frame-Buffer der Grafikkarte in den N64 Speicher:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation><html><head/><body><p>Der Depth Buffer wird benötigt um einige Effekte zu emulieren (z.B. Koronas):</p><p><span style=" font-weight:600;">Niemals</span>: Depth-Buffer ist deaktiviert.</p><p><span style=" font-weight:600;">Vom VRAM</span>: Der Depth-Buffer der Grafikkarte wird bei jedem Fraem in den N64 Speicher kopiert, was bei einigen Spielen zu Verzögerungen führt.</p><p><span style=" font-weight:600;">In Software</span>: Allgemein schneller als den VRAM zu kopieren. Das Ergebnis kann aber fehlerhaft sein.</p><p>[Empfehlung:<span style=" font-style:italic;"> In Software</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation>Kopiere den Depth-Buffer der Grafikkarte in den N64 Speicher:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Wenn diese Einstellung ausgewählt ist, wird der Frame-Buffer direkt ausgegeben. Dies verhindert einige Grafikprobleme, kann aber zu Verzögerungen und visuellen Problemem führen.</p><p>[Empfehlung: <span style=" font-style:italic;">In der Regel nicht ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation>Übergebe den N64 Frame-Buffer an die Ausgabe</translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Option ist für einige von der Reshade-Tiefe abhängige Effekte, wie SSAO und Tiefenschärfe, erforderlich.</p><p>[Empfehlung: <span style=" font-style:italic;">nur wenn du Reshade verwendest und tiefenabhängige Effekte benötigst</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation>Tiefe in Haupttiefenpuffer kopieren</translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation>N64 Texturen</translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Filter glätten oder schärfen Texturen. Es gibt vier Filter zum Glätten und zwei Filter zum Schärfen. Um so höher die Nummer, umso stärker der Effekt. Die Geschwindigkeit kann je nach Spiel und/oder PC beeinträchtigt werden.</p><p>[Empfehlung: <span style=" font-style:italic;">Eigene Vorliebe</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation>Kein</translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation>Glatte Filterung 1</translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation>Glatte Filterung 2</translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation>Glatte Filterung 3</translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation>Glatte Filterung 4</translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation>Scharfe Filterung 1</translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation>Scharfe Filterung 2</translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation><html><head/><body><p>Es können 12 verschiedene Filter ausgewählt werden. Abhängig vom Filter kann die Ausführungsgeschwindigkeit beeinträchtigt werden.</p><p>Wenn <span style=" font-weight:600;">Abspeichern</span> ausgewählt ist werden Texturen im Cache gespeichert. Dies steigert die Ausführungsgeschwindigkeit. Deaktiviere <span style=" font-weight:600;">Ausgeschaltet für Hintergründe</span> für die beste Ausführungsgeschwindikeit.</p><p>[Empfehlung: <span style=" font-style:italic;">Eigene Vorliebe</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation>Abspeichern</translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung aktiviert eine Vorverarbeitungsstufe, welche Farbtontrennungsprobleme bei hochauflösenden Texturen reduziert.</p><p>[Empfehlung:<span style=" font-style:italic;"> Ausgewählt für xBRZ</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation>Verringere Color-Banding (empfohlen für xBRZ Verbesserung)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung verwirft Texturverbesserungen für lange, schmale Texturen, welche gewöhnlich für Hintergründe verwendet werden. Dies spart Texturspeicher und kann die Ausführungsgeschwindigkeit steigern.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation>Für Hintergünde deaktiviert</translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation>Dateispeicher anstelle des Cache-Speichers verwenden</translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation>Textur-Cache-Pfad:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation>Textur-Dump-Pfad:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation><html><head/><body><p>Verbesserte und gefilterte Texturen können zwischengespeichert werden, um die Leistung zu erhöhen. Diese Einstellung legt fest wieviel Speicher für den Texture-Cache reserviert wird. Dies kann bei vielen Anfragen die Leistung erhöhen, was normalerweise der Fall ist. Eigentlich sollten 128MB mehr als genug sein. Der beste Wert ist aber spielabhängig. Super Mario 64 reichen z.B. 32 MB. Conker's Bad Fur Day kann aber noch von 256 MB+ providieren. Beim Wert 0 ist der Cache deaktiviert.</p><p>[Empfehlung: <span style=" font-style:italic;">abhängig von PC und Spiel</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation><html><head/><body><p>Pfad für Textur-Packs auswählen.<br/>Standard: Plugin/hires_texture</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation><html><head/><body><p>Falls diese Einstellung nicht ausgewählt ist, werden Texturen wie beim Rice-Video-Plugin geladen: Transparenzen sind entweder an oder aus. Wenn diese Einstellung ausgewählt ist untersucht GlideN64 wie der Alpha Channel der Texturen aufgebaut ist und wählt das beste Format aus. Dies gibt dem Ersteller von Textur-Packs die Möglichkeit halbtransparente Texturen zu verwenden.</p><p>Diese Einstellung sollte bei alten oder schlecht entworfenen Texture-Packs nicht ausgewählt werden.</p><p>[Empfehlung:<span style=" font-style:italic;"> Textur-Pack abhängig</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation>Benutze volle Transparenz (empfohlen für neuere Texturepacks)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung emuliert einen CRC Berechnungsfehler des Rice-Video-Plugins. Wenn Fehler beim Laden von Texturen auftauchen aktiviere oder deaktiviere diese Einstellung.</p><p>[Empfehlung: <span style=" font-style:italic;">Nicht ausgewählt, ausgewählt für ältere Textur-Packs</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation>Alternative CRC-Berechnung (für ältere Rice-Video-Packs)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung speichert alle vorher geladenen oder verbesserten Texturen auf dem PC. Wenn das Spiel noch einmal gestartet wird müssen die Texturen nicht neu erstellt werden.</p><p>Wenn Texture-Packs verwendet werden dauert das Laden eines Packs nur wenige Sekunden gegenüber dem normalen Ladevorgang von 5-60 Sekunden. Wird jedoch das Texture Pack verändert, muss der Texture Cache manuell gelöscht werden um die Änderung zu übernehmen. Cache Dateien werden im Plugin Verzeichnis im Verzeichnis Cache gespeichert.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation>Speichere den Cache für verbesserte Texturen auf der Festplatte</translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Texturen werden komprimiert, damit mehr Texturen im Cache gehalten werden können. Die Kompressionsrate variiert je nach Textur, aber ist normalerweise 1/5 der Originalgröße.</p><p>[Empfehlung: <span style=" font-style:italic;">Ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Diese Einstellung halbiert den Speicherbedarf von Texturen im Texture-Cache und VRAM um die Leistung zu steigern. Wenn die Farbtiefe reduziert wird versucht GLideN64 die originale Qualität so gut wie möglich zu erhalten. Bei den meisten Texturen ist es kaum wahrnehmbar, aber einige Texturen, wie z.B. für den Himmel, können schlechter aussehen.</p><p>[Empfehlung: <span style=" font-style:italic;">Nicht ausgewählt</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation>Konvertiere Texturen zu 16Bit</translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation><html><head/><body><p>Einige N64 Spiele verwenden Gammakorrektur um das Bild aufzuhellen. Wenn Frame-Buffer-Emulation aktiviert ist wird Gammakorrektur automatisch bei allen Spielen angewandt, welche Gammakorrektur auf dem N64 verwenden. Alternativ kann über diese Einstellung der Gammakorrekturwert selbst ausgewählt werden. Der Standardwert des N64 ist 2.</p><p>[Empfehlung: <span style=" font-style:italic;">Nicht ausgewählt; 2.00</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translation>OSD</translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation>Bildschirmanzeige (OSD)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation>Position</translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation>Oben links</translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation>Oben</translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation>Oben rechts</translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation>Links</translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation>Rechts</translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation>Unten links</translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation>Unten</translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation>Unten rechts</translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation>Farbe:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation>Vorschau</translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation>Anzeige in Prozent</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation>Speichern und schließen</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation>Speichern</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation>Schließen</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation>Standardeinstellungen wiederherstellen</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation>Neu...</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation>Der Texturpack-Ordner fehlt. Bitte wechsel den Ordner oder schalte die Texturpakete aus.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation>Der Texturpack-Cache-Ordner fehlt. Bitte wechsel den Ordner oder schalte die Texturpakete aus.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation>Der Textur-Dump-Ordner fehlt. Bitte wechsel den Ordner oder schalte das Dumping von Texturpaketen aus.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation>Bist du sicher, dass du alle Einstellungen auf die Standardeinstellungen zurücksetzen möchtest?</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation>Abbrechen</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation>Neues Profil</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation>Neuer Profilname:</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation>Neue Einstellungsprofile können nicht als "Neu..." bezeichnet werden.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation>Bitte gebe einen Namen für dein neues Einstellungsprofil ein.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation>Dieses Einstellungsprofil ist bereits vorhanden.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation>Bist du sicher, dass du das Einstellungsprofil entfernen willst "</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation>"?</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation>Profil entfernen</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translatorcomment>Abkürzung für Hertz; ggf. mit einem führenden Leerzeichen</translatorcomment> - <translation> Hz</translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/gliden64_es.ts b/GLideN64/translations/gliden64_es.ts deleted file mode 100644 index 5502f03..0000000 --- a/GLideN64/translations/gliden64_es.ts +++ /dev/null @@ -1,1248 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="es_ES"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>Acerca de GLideN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation>Acerca de</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation>La nueva generación de los plugins gráficos de código abierto para emuladores de N64.</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>Autores</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation>Desarrollo</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation>Testeo de las betas</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation>Diseñador de la interfaz</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation>Contribuyentes</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation>y más...</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation>Autor del plugin gráfico original glN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation>Autor de gles2n64, una conversión de glN64 a GL ES 2.0</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation>Autor de la librería de texturas GlideHQ</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation>Autor de z64, un plugin LLE para OpenGL</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>Financiadores</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <translation>Créditos</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation>Cerrar</translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation>Vídeo</translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>Resolución de pantalla completa:</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>Resolución de ventana:</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>Frecuencia de actualización:</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>Estirar</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation>16:9</translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción selecciona la resolución del modo ventana. Puedes introducir un tamaño personalizado.</p><p>[Recomendación: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation><html><head/><body><p>El vídeo multihilo puede mejorar el rendimiento con controladores inferiores de OpenGL a costa de provocar un retraso de entrada (input lag) muy escaso, por lo general de menos de medio fotograma.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado, a menos que haya problemas de rendimiento</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation>Activar vídeo multihilo</translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation>Al activar esta opción, se recortará la imagen utilizando un valor específicado en píxeles de N64. Es útil para quitar los bordes negros en ciertos juegos.</translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation>Overscan</translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation>NTSC</translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation>PAL</translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation>Suavizado de bordes</translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation><html><head/><body><p>GLideN64 ofrece dos métodos para suavizar los dientes de sierra entre polígonos:</p><p><span style=" font-weight:600;">Fast Approximate Anti-Aliasing (FXAA)</span>: FXAA es un filtro de posprocesado que puede ofrecer un resultado decente, casi tan bueno como el MSAA. El principal motivo para usar FXAA es en conjunto con la <span style=" font-weight:600;">comparación de profundidad al estilo de N64</span>. FXAA genera una imagen algo borrosa y hará que ciertas texturas, como los textos, puedan tener una peor calidad.</p><p><span style=" font-weight:600;">Multisample Anti-Aliasing (MSAA)</span>: MSAA es una técnica estándar para suavizar de bordes en gráficos informáticos y mejorar la calidad de imagen. La mayoría de GPU modernas admiten 2, 4, 8 y 16 muestras. A mayor muestras, mayor calidad, pero mayor lentitud. Hay dos inconvenientes: es incompatible con la <span style=" font-weight:600;">comparación de profundidad al estilo de N64</span> y puede provocar defectos leves en ciertos juegos.</p><p>Recomendación: [<span style=" font-style:italic;">Por norma general MSAA 16x o FSAA si se utiliza la comparación de profundidad al estilo de N64</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation>Desactivado</translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation>Fast Approximate Anti-Aliasing (FXAA)</translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation>Multisample Anti-Aliasing (MSAA):</translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation>El Multisample Anti-Aliasing no es compatible con la <a href="#n64DepthCompare">comparación de profundidad al estilo de N64</a>.</translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation>Filtrado</translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>Filtro anisotrópico:</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation>PNG</translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>Idioma:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation>Alguna opciones de esta pestaña han sido desactivadas porque se ha desactivado la <a href="#frameBuffer">emulación del «frame buffer»</a>.</translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>Emulación</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Al activar esta opción, se almacenarán todos los ajustes diferentes a los predeterminados en función de cada juego.</p><p>Cuando se ejecute un juego, se mostrarán los ajustes y se guardarán para el juego cargado.</p><p><span style=" font-weight:600;">Nota:</span> GLideN64 ya contiene ajustes para conseguir un rendimiento óptimo en la mayoría de juegos. Ten cuidado al cambiar las opciones de las pestañas Emulación y «Frame buffer».</p><p>[Recomendación: <span style=" font-style:italic;">Activada</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation>Usar ajustes individuales por juego</translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation>Resolución interna</translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation>x</translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation>Gamma</translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation>Corrección de gamma personalizada:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation>Al seleccionar esta opción, se ignorará la corrección de gamma especificada por el juego.</translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation>Tramado</translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation><html><head/><body><p>Tal y como pasaría en un hardware real, este ajuste reduce el número de colores usando un tramado. Elimina fragmentos tramados indeseados. Valor predeterminado: activado.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation>Activar cuantificación a 5 bits</translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation><html><head/><body><p>Duplica la resolución del ruido para producir un efecto de ruido más fino en resoluciones más altas. Valor predeterminado: desactivado.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation>Tramado de ruido en alta resolución</translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation><html><head/><body><p>Activa el tramado de cuadrícula organizada según el juego. Produce una imagen más fiel al original. Valor predeterminado: desactivado.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation>Patrón de tramado en la imagen de salida</translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation><html><head/><body><p>El tramado en la RDRAM evita que los colores en los juegos con efectos del «frame buffer» se muestren bandeados.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation>Tramado de imagen en la RDRAM:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation><html><head/><body><p>Ajustes disponibles: desactivado, tramado de cuadrícula organizada Bayer, tramado de cuadrícula organizada Cuadrado mágico o tramado de ruido azul. El tramado de ruido azul genera resultados más discretos. Valor predeterminado: tramado de ruido azul.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation>Desactivar</translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation>Bayer</translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation>Cuadrado mágico</translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation>Ruido azul</translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation>Elementos 2D</translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation>Renderizar elementos 2D en la resolución de N64 (mejor calidad, podría ser lento):</translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation>Optimizados</translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation>Sin optimizar</translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation>Intenta eliminar los bordes de colores alrededor de los objetos transparentes</translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation><html><head/><body><p>El fondo es un comando complejo de macros utilizado para renderizar imágenes grandes (por lo general, a pantalla completa). Ya que las imágenes de fondo no suelen caber en la memoria de texturas, el microcódigo las fragmenta en franjas estrechas y las renderiza una por una. El código HLE tiene dos modos de emular los comandos de fondo:</p><p><span style=" font-weight:600;">Monopieza</span>: Toda la imagen de fondo se renderiza como un rectángulo texturizado. Este método suele ser mucho más rápido, pero el resultado no siempre es el correcto.</p><p><span style=" font-weight:600;">Por franjas</span>: Este método emula los comandos de fondo de una forma lo más fiel posible a la implementación real del microcódigo. Es más lento, pero más preciso. Tiene otro problema: algunos juegos pueden mostrar desajustes entre franja y franja a resoluciones elevadas. Utiliza la opción «Renderizar elementos 2D en la resolución de N64» para eliminar los desajustes.</p><p>[Recomendación: <span style=" font-style:italic;">En función de cada juego, por lo general, por franjas</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation>Modo de renderizado de fondos (solo HLE):</translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation>Monopieza</translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation>Por franjas</translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>Emular «frame buffer»</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation><html><head/><body><p>N64 utiliza un método especial para calcular la profundidad que hay hasta la cámara. Al activar esta opción, GlideN64 utilizará shaders para intentar emular estos cálculos correctamente. No es compatible con el suavizado de bordes. <span style=" font-weight:600;">¡Experimental!</span></p><p>El modo rápido requiere OpenGL 4.y las extensiones «fragment shader interlock».</p><p>El modo compatible solo necesita el modo básico de OpenGL 4.2 <span style=" font-weight:600;">¡Puede ser lento!</span></p><p>[Recomendación: <span style=" font-style:italic;">Activar solo en ciertos juegos</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation>Comparación de profundidad de N64 (experimental, desactivará el MSAA)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation>Rápida</translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation>Compatible</translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation><html><head/><body><p>Permite almacenar las texturas en alta resolución en un sitio alternativo.</p><p>Normalmente se utiliza la caché de memoria para mantener todas las texturas en alta resolución dentro de la RAM, por lo que hay un límite impuesto por la cantidad de RAM disponible.</p><p>El almacenamiento en archivo mantiene la caché de texturas en el disco duro. Es más lenta que la caché de memoria, pero prácticamente no tiene límite de tamaño.</p><p>Desactiva la opción «comprimir caché de texturas» para mejorar el rendimiento.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation><html><head/><body><p>Esta opción vuelca las texturas que aparezcan en pantalla a una carpeta con un paquete de texturas. </p><p>Tecla de acceso directo:<br/>Utiliza <span style=" font-weight:600;">D</span> para activar o desactivar el volcado de texturas.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation>Pulsa D para volcar las texturas de N64 (para diseñadores de texturas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation><html><head/><body><p>Esta opción permite a los diseñadores recargar las texturas en alta definición mientras el juego está en marcha, de esta forma podrán ver al instante cómo quedarán. ¡Ahorra mucho tiempo!</p><p>Tecla de acceso directo:<br/>Utiliza <span style=" font-weight:600;">R</span> para recargar las texturas que se encuentren en el paquete de texturas.<br/></p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation>Pulsa R para recargar las texturas en alta resolución (para diseñadores de texturas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation>Mostrar FPS</translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation>Mostrar VI/s</translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation>Mostrar resolución interna</translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation>Mostrar resolución de renderizado</translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation>Fuente de letra</translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translation>Tamaño:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translation> px</translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation>████</translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation>La previsualización de la fuente de letra solo muestra la fuente normal de la familia. Ciertos estilos, como negritas e itálicas, solo se mostrarán dentro del juego.</translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation>Depuración</translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation>Volcar información de bajo nivel</translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation>Volcar comandos de la lista de visualización</translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation>Volcar información detallada (matrices, vértices, etc.)</translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation>En este juego</translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation>Guardar configuración para:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation>Perfil de configuración:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation>Eliminar</translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation>Mejora de texturas</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>Filtro:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>Mejora:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>Usar paquete de texturas</translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation>Desactivado</translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation>Personalizado</translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation><html><head/><body><p>Al desactivar esta opción desactivarás muchos efectos, como el recorte de imagen, la proporción de aspecto, el factor de resolución de N64 y la comparación de profundidad al estilo de N64, entre otros. No desactives esta opción salvo que tengas problemas de rendimiento.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Interrupción vertical (recomendado, problemas mínimos)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Cambio en el origen de la VI (más rápido, da pocos problemas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Cambio en el búfer de color (más rápido, da algunos problemas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Nunca (lo más rápido, da más problemas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Síncrono (lo más lento, problemas mínimos)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Asíncrono (rápido, da pocos problemas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Nunca (lo más rápido, lo más problemático)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Copiar de la VRAM (lento, da algunos problemas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Por software (rápido, problemas mínimos)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation><html><head/><body><p>Fuerza la limpieza del búfer de profundidad. Un apaño necesario para Eikou no Saint Andrews.</p><p>[Recomendación: <span style=" font-style:italic;">desactivado salvo para Eikou no Saint Andrews</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation>Forzar limpieza del búfer de profundidad</translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>Ruta de paquetes de texturas:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation>Tamaño de la caché de memoria para texturas mejoradas:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>Comprimir caché de texturas</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation>Configuración de GlideN64</translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation><html><head/><body><p>Aquí deberían aparecer todas las resoluciones que admite tu tarjeta gráfica o monitor.</p><p>[Recomendación:<span style=" font-style:italic;"> La resolución máxima que permita tu monitor salvo que haya problemas de rendimiento</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation><html><head/><body><p>La sincronía vertical (también llamada VSync) puede mejorar la calidad de imagen sincronizando la velocidad de fotogramas del juego con la frecuencia de actualización de tu monitor. Esto evita que la imagen aparezca cortada, pero podría provocar problemas de rendimiento.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado, activar si las imágenes salen cortadas</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation>Sincronía vertical</translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation><html><head/><body><p>Ajusta la proporción de aspecto de la salida de vídeo. Todos los juegos de N64 admiten la proporción <span style=" font-weight:600;">4:3</span>. Algunos son compatibles con <span style=" font-weight:600;">16:9</span> dentro de las opciones de cada juego. Utiliza la opción <span style=" font-weight:600;">«estirar»</span> para llenar toda la pantalla sin provocar bordes en cualquier punto de la pantalla.</p><p><span style=" font-weight:600;">«Intentar ajustar el tamaño del juego»</span> intentará ajustar el espacio de la pantalla sin estirar la imagen. Muchos juegos funcionan correctamente bajo este ajuste, pero algunos no funcionarán bien.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation><html><head/><body><p>Proporción de aspecto:</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation>4:3 (recomendado)</translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation>Intentar ajustar el tamaño del juego</translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation>Desactivado</translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation>Alto</translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation><html><head/><body><p><span style=" font-weight:600;">Filtrado bilineal</span>: Las texturas utilizarán el filtro bilineal estándar de PC.</p><p><span style=" font-weight:600;">Tripunto N64</span>: Las texturas se filtrarán de una forma más parecida a la que hace la N64. El resultado será menos suave, pero más preciso.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation>Filtrado bilineal:</translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation>Estándar</translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation>Tripunto N64</translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translation> MB</translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation>Formato de capturas de pantalla:</translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation>JPEG</translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation><html><head/><body><p>>El idioma seleccionado se mostrará una vez cierres y vuelvas a abrir esta ventana.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>La N64 utiliza un sistema de mip-mapping que es difícil de reproducir correctamente en PCs. Al activar esta opción se emulará el mip-mapping de N64. Si se desactiva, algunos juegos tendrán texturas más definidas a lo lejos.</p><p>[Recomendación: <span style=" font-style:italic;">Activado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation>Mip-mapping de N64</translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation><html><head/><body><p>Emula los efectos que utilizan una generación de colores aleatorios. Esta opción podría provocar problemas de rendimiento en casos puntuales.</p><p>[Recomendación: <span style=" font-style:italic;">Activado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation>Iluminación por píxel (mejor calidad, sólo en HLE)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Guarda de forma persistente los programas de shaders compilados.<br/>Cada juego utiliza un conjunto de combinadores. Un combinador es una ecuación que define el color que se muestra a partir de varios colores de la imagen original. GLideN64 traduce los shaders y compila los programas de shaders al vuelo. Los shaders ocupan mucho espacio y son complejos. Si una escena nueva utiliza varios combinadores nuevos, se tardará más en compilar un shader nuevo y eso puede provocar trompicones. Al activar esta opción se guardarán los shaders para no tener que recompilarlos la próxima vez que ejecutes el juego.</p><p>[Recomendación: <span style=" font-style:italic;">Activado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation>Guardar shaders compilados para mejorar el rendimiento (recomendado)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation><html><head/><body><p>Esta opción asigna el tamaño del búfer de renderizado de salida. La configuración prdeterminada del búfer de renderizado es <span style=" font-weight:600;">«Idéntica a la resolución de salida»</span>, pero puedes utilizar la <span style=" font-weight:600;">«Resolución original de N64»</span> o un <span style=" font-weight:600;">«Múltiplo de la resolución de N64»</span>.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation>Idéntica a la resolución de salida</translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation>Resolución original de N64 (más precisa)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation>Múltiplo de la resolución de N64:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation><html><head/><body><p>Si se activa esta opción, el plugin renderizará los elementos 2D en la resolución nativa de N64 y después copiará el resultado al búfer principal. Esto debería eliminar los problemas gráficos en los elementos 2D, pero puede provocar ralentizaciones. Esta opción utiliza heurística para detectar los elementos 2D adyacentes, pero no funcionará en todos los juegos.</p><p>[Recomendación: <span style=" font-style:italic;">Activado salvo que tengas problemas de rendimiento</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation><html><head/><body><p>En algunos juegos no se alinean las coordenadas de los elementos en 2D: Hay una separación de medio píxel entre cada elemento adyacente. No es algo visible cuando se renderizan en la resolución nativa de N64, pero provoca líneas negras cuando se escala la imagen. Esta opción intenta unir estos elementos en 2D.</p><p><span style=" font-weight:600;">Para elementos en 2D adyacentes</span>: Aplica la corrección sólo en los polígonos que la necesiten. Selecciona esta opción para los juegos que tengan problemas de líneas negras.</p><p><span style=" font-weight:600;">Siempre</span>: Aplica la corrección en todos los elementos en 2D. Selecciona esta opción cuando <span style=" font-weight:600;">«Para elementos adyacentes»</span> no funcione.</p><p><span style=" font-weight:600;">Nunca</span>: No corregir las líneas negras entre los elementos en 2D.</p><p>[Recomendación: <span style=" font-style:italic;">En función de cada juego, por lo general «Nunca»</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation>Corregir líneas negras entre elementos en 2D:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Para elementos en 2D adyacentes</translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Siempre</translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Nunca</translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation>«Frame buffer»</translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Al activar esta opción,se copiará el búfer auxiliar de color a la memoria de N64 nada más sea renderizado. Permite emular correctamente los efectos basados en «frame buffer» de algunos juegos. Esta opción podría reducir visiblemente el rendimiento.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation>Copiar búferes auxiliares de color a la memoria de N64 (a veces va lento, puede dar problemas)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation><html><head/><body><p>Esta opción controla la frecuencia con la que GlideN64 actualizará el «frame buffer» principal.</p><p><span style=" font-weight:600;">Interrupción vertical</span>: Actualiza el búfer lo más rápido posible, en cada interrupción vertical por segundo (50 en juegos PAL y 60 en juegos NTSC). Es la opción más compatible. Utilízala salvo que tengas problemas de rendimiento.</p><p><span style=" font-weight:600;">Cambio en el origen de la VI</span>: El origen del VI cambia en función de los FPS que tenga el juego. Los juegos de N64 suelen funcionar a una velocidad de entre 20 y 30 FPS, así que los búferes se actualizan menos que en el primer modo. Este modo no funciona en los juegos monobúfer, lo que es poco habitual.</p><p><span style=" font-weight:600;">Cambio en el búfer de color</span>: Esta opción verifica que se haya cambiado el «frame buffer». No funciona en algunos juegos.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation>Actualización del «frame buffer»:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Algunos emuladores no son muy buenos a la hora de detectar el momento de leer o escribir en los «frame buffers». Puedes desactivar la ayuda del emulador para que GlideN64 se encargue de leer y escribir los «frame buffers» por su cuenta.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado, aunque algunos juegos o emuladores pueden ir más rápidos si se deja activado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation>Utilizar las ayudas del emulador para leer/escribir los «frame buffers»</translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation><html><head/><body><p>Al activar esta opción, el búfer de color se leerá por fragmentos. En caso contrario, el búfer se leerá en su totalidad. Si algún juego necesita leer el búfer entero, esta opción podría ralentizarlo.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado, ya que suele leerse el búfer de color en su totalidad</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation>Leer el búfer de color por fragmentos de 4 KB</translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation><html><head/><body><p>Al activar esta opción, el búfer de profundidad se leerá por fragmentos. En caso contrario, el búfer se leerá en su totalidad. Si algún juego necesita leer el búfer entero, esta opción podría ralentizarlo.</p><p>[Recomendación: <span style=" font-style:italic;">Activado, ya que el búfer de profundidad no suele leerse en su totalidad</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation>Leer el búfer de profundidad por fragmentos de 4 KB</translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation><html><head/><body><p>GlideN64 no podrá detectar el uso del «frame buffer» en algunos juegos. Con estas opciones podrás hacer que GlideN64 copie cada fotograma del «frame buffer» de tu tarjeta gráfica a la memoria de N64.</p><p><span style=" font-weight:600;">Nunca</span>: No copiar los búferes de la tarjeta gráfica.</p><p><span style=" font-weight:600;">Síncrono</span>: Detecta los efectos de todos los juegos, pero puede ser lento. Utilízalo en los juegos en los que no funcione la opción <span style=" font-weight:600;">«Asíncrono»</span>.</p><p><span style=" font-weight:600;">Asíncrono</span>: Detecta los efectos en casi todos los juegos.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general asíncrono</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation>Copiar el «frame buffer» de la tarjeta gráfica a la memoria de N64:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation><html><head/><body><p>El búfer de profundidad se utiliza para emular ciertos efectos (por ejemplo, reflejos del sol):</p><p><span style=" font-weight:600;">Nunca</span>: Desactivará el búfer de profundidad.</p><p><span style=" font-weight:600;">Copiar de la VRAM</span>: Se copiará el búfer de profundidad de tu tarjeta gráfica a la memoria de N64 en cada fotograma, lo que puede ralentizar algunos juegos.</p><p><span style=" font-weight:600;">Por software</span>: Suele ser más rápido que copiando de la VRAM, pero el resultado podría ser imperfecto.</p><p>[Recomendación:<span style=" font-style:italic;"> Por software</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation>Copiar búfer de profundidad de la tarjeta gráfica a la memoria de N64:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Al activar esta opción se renderizará el «frame buffer» directamente en pantalla. Esto evita algunos problemas gráficos pero puede provocar ralentizaciones o problemas de calidad visual.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation>Renderizar el «frame buffer» de N64 a la imagen</translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción es necesaria para ciertos efectos de Reshade que dependen de la profundidad, como SSAO y la profundidad de campo.</p><p>[Recomendación: <span style=" font-style:italic;">activar solo si utilizas Reshade y necesitas los efectos que dependen de la profundidad</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation>Copiar profundidad al búfer principal de profundidad</translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation>Texturas de N64</translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation><html><head/><body><p>Este filtro suaviza o perfila las texturas. Hay cuatro filtros de suavizado y dos de perfilado. Cuanto más alto sea el número, más fuerte será el efecto. Podría afectar al rendimiento según el juego o tu equipo.</p><p>[Recomendación: <span style=" font-style:italic;">Lo que prefieras</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation>Desactivar</translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation>Filtro suave 1</translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation>Filtro suave 2</translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation>Filtro suave 3</translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation>Filtro suave 4</translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation>Filtro nítido 1</translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation>Filtro nítido 2</translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation><html><head/><body><p>Tienes 12 filtros distintos a elegir. Algunos filtros podrían provocar problemas de rendimiento.</p><p>Cuando se selecciona la opción <span style=" font-weight:600;">«Almacenar»</span>, las texturas se guardarán en la caché tal cual estén. Esto mejorará el rendimiento en los juegos que utilizan muchas texturas. Desactiva la opción <span style=" font-weight:600;">«Desactivar en fondos»</span> para obtener el mejor rendimiento posible.</p><p>[Recomendación: <span style=" font-style:italic;">Lo que prefieras</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation>Almacenar</translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción activa un paso de preprocesado que reduce los efectos de posterización en las texturas modificadas.</p><p>[Recomendación:<span style=" font-style:italic;"> Activado para el efecto xBRZ</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation>Reducir las bandas de color (recomendado para el filtro xBRZ)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción evita aplicar las mejoras de texturas en aquellas que sean largas y estrechas, ya que suelen utilizarse para los fondos. Podría reducir el consumo de texturas y mejorar el rendimiento.</p><p>[Recomendación: <span style=" font-style:italic;">Activado salvo que las mejoras de texturas estén configuradas en «Almacenar»</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation>Desactivar en fondos</translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation>Usar almacenamiento de archivos en lugar de la caché de memoria</translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation>Ruta de la caché de texturas:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation>Ruta de volcado de texturas:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation><html><head/><body><p>Las texturas mejoradas y filtradas pueden guardarse en una caché para mejorar el rendimiento. Esta opción ajusta la cantidad de memoria que se dedicará a la caché de texturas. Puede mejorar el rendimiento si hay peticiones repetidas de la misma textura, que suele ocurrir. Normalmente deberían bastar 128 MB, pero cada juego tiene su valor ideal. Puede que Super Mario 64 no necesite más de 32 MB, pero Conker's Bad Fur Day puede aprovechar más de 256 MB. Cambia este parámetro si tienes problemas de velocidad. Si la opción está a 0 desactivará la caché.</p><p>[Recomendación: <span style=" font-style:italic;">En función del juego y de tu equipo</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation><html><head/><body><p>Selecciona la carpeta donde se encuentren los paquetes de texturas.<br/>Carpeta predeterminada: Plugin/hires_texture</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation><html><head/><body><p>Si se desactiva esta opción, las texturas se cargarán igual que con Rice Video: Las transparencias son absolutas o nulas. Al activar esta opción GlideN64 comprobará la forma en la que se ha diseñado el canal alfa de la textura y seleccionará el formato más adecuado. Esto da a los diseñadores de paquetes libertad para utilizar texturas semitransparentes.</p><p>Desactiva esta opción si utilizas paquetes antiguos o pobremente diseñados.</p><p>[Recomendación:<span style=" font-style:italic;"> Según cada paquete de texturas</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation>Utilizar transparencias totales (recomendado para paquetes nuevos)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción emula un fallo en el cálculo del CRC de las paletas de RiceVideo. Si no se cargan algunas texturas, prueba a activar o desactivar esta opción.</p><p>[Recomendación: <span style=" font-style:italic;">Por norma general desactivado, activar para paquetes muy antiguos</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation>Cálculo alternativo de CRC (para paquetes antiguos para Rice Video)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción guarda todas las texturas cargadas y mejoradas a tu PC. Cuando vuelvas a ejecutar el juego, no hará falta recrear las texturas y mejorará el rendimiento.</p><p>Cuando utilices paquetes de texturas, su carga sólo tardará unos segundos en vez de la media de 5 a 60 segundos que suele tardar. Sin embargo, si cambias el paquete de texturas, tendrás que borrar la caché de texturas de forma manual. Los archivos de caché se guardan en una carpeta llamada «Cache», dentro de la carpeta plugins.</p><p>[Recomendación: <span style=" font-style:italic;">Activado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation>Guardar una caché de texturas mejoradas al disco duro</translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Se comprimirán las texturas para que entren más texturas en la caché. La proporción de compresión cambia según la textura, pero suele ser de 1/5 del tamaño original.</p><p>[Recomendación: <span style=" font-style:italic;">Activado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Esta opción reduce a la mitad el tamaño que utilizan las texturas de la caché de texturas y de la memoria de la tarjeta gráfica para mejorar el rendimiento. A la hora de reducir el color, GlideN64 intentará preservar la calidad original en la medida de lo posible. Es apenas imperceptible en la mayoría de las texturas, pero algunas como los cielos quedarán peor.</p><p>[Recomendación: <span style=" font-style:italic;">Desactivado</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation>Convertir texturas a 16 BPP</translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation><html><head/><body><p>Algunos juegos de N64 utilizan la corrección de gamma para que la imagen sea más brillante. Si se activa el «frame buffer», la corrección de gamma se aplicará automáticamente a todos los juegos que la utilicen en N64. Con esta opción puedes utilizar la corrección de gamma que quieras. El valor predeterminado de la N64 es 2.</p><p>[Recomendación: <span style=" font-style:italic;">Desactivado; 2.00</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translation>OSD</translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation>Mensajes en pantalla</translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation>Posición</translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation>Superior izquierda</translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation>Superior</translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation>Superior derecha</translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation>Izquierda</translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation>Derecha</translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation>Inferior izquierda</translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation>Inferior</translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation>Inferior derecha</translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation>Color:</translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation>Demostración</translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation>Mostrar porcentaje</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation>Guardar y cerrar</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation>Guardar</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation>Cerrar</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation>Restaurar valores predeterminados</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation>Nuevo...</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation>No se encuentra la carpeta de paquetes de texturas. Cambia la carpeta o desactiva los paquetes de texturas.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation>No se encuentra la carpeta de la caché de paquetes de texturas. Cambia la carpeta o desactiva los paquetes de texturas.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation>No se encuentra la carpeta de volcado de texturas. Cambia la carpeta o desactiva el volcado de paquetes de texturas.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation>¿Seguro que quieres reiniciar toda la configuración a sus valores predeterminados?</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation>Cancelar</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation>Perfil nuevo</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation>Nombre del perfil nuevo:</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation>Los perfiles nuevos de configuración no pueden llamarse «Nuevo...».</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation>Introduce un nombre para el perfil nuevo de configuración.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation>Este perfil de configuración ya existe.</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation>¿Seguro que quieres eliminar el perfil de configuración «</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation>»?</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation>Eliminar perfil</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translation> Hz</translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/gliden64_fr.ts b/GLideN64/translations/gliden64_fr.ts deleted file mode 100644 index 5d5699c..0000000 --- a/GLideN64/translations/gliden64_fr.ts +++ /dev/null @@ -1,1249 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="fr_FR"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>A Propos De GLideN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation>A Propos De</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation>La nouvelle génération de plugin graphique open source pour les émulateurs N64.</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>Auteurs</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation>Développeur</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation>Bêta testeur</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation>Concepteur de l'interface graphique</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation>Contributeurs</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation>Auteur du plugin graphique original glN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation>Auteur de gles2n64, un portage de glN64 vers GL ES 2.0</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation>Auteur de la librairie de texture GlideHQ</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation>Auteur de z64, un plugin OpenGL LLE</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>Donateurs</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation>... et plus</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <translation>Crédits</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation>Vidéo</translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>Résolution Plein Ecran :</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>Résolution en Mode Fenêtré :</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>Taux de rafraîchissement :</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>Étiré</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation>16:9</translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>Filtrage Anisotropique :</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>Langue :</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>Émulation</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>Émuler le Tampon Image</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation>Désactivé</translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation>Personalisé</translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation><html><head/><body><p>Décocher cette option désactive de nombreux effets tels que le recadrage, le format d'écran, le facteur de résolution N64, la comparaison de profondeur de la N64 et autres. Veuillez ne pas décocher cette option sauf si vous avez des problèmes de performance.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>À l'interruption verticale (recommandé, le moins de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Au changement d'origine VI (plus rapide, peu de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation>Au changement du Tampon Couleur (le plus rapide, quelques problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Jamais (le plus rapide, nombreux problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Synchrone (le plus lent, le moins de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Asynchrone (rapide, peu de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Jamais (le plus rapide, le plus de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Depuis la VRAM (lent, quelques problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation>Dans le logiciel (rapide, le moins de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation>Améliorations des Textures</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>Filtre :</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>Améliorations :</translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>Utiliser un Pack de Textures</translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>Chemin des Packs de Textures :</translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>Compresser le Cache de Texture</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation>Paramètres de GLideN64</translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation><html><head/><body><p>Toutes les résolutions supportées par votre carte graphique / moniteur devraient être affichées.</p><p>[Recommandé :<span style=" font-style:italic;"> Résolution native (maximum) de votre moniteur - sauf si les performances sont dégradées</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation><html><head/><body><p>La synchronisation verticale, ou VSync, peut améliorer l'image en synchronisant le taux d'échantillonage du jeu à celui du taux de rafraîchissement de votre écran. Cela évite la déchirure de l'image, mais peut engendrer des problèmes de performance.</p><p>[Recommandé : <span style=" font-style:italic;">Généralement désactivé, sauf si vous avez des problèmes de déchirure d'image</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation>Activer la synchro verticale</translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation><html><head/><body><p>Cette option ajuste le format d'écran de la sortie vidéo. Tous les jeux N64 supportent <span style=" font-weight:600;">4:3</span>. Quelques jeux supportent <span style=" font-weight:600;">16:9</span> dans leurs paramétrages. Utilisez <span style=" font-weight:600;">Étiré</span> pour remplir l'écran sans bords noirs.</p><p><span style=" font-weight:600;">Ajusté à l'écran sans étirer</span> tente d'ajuster l'espace de vue afin de remplir sans étirer. De nombreux jeux fonctionnent correctement en mode ajusté, mais d'autres non.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation><html><head/><body><p>Format d'écran :</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation>4:3 (recommandé)</translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation>Ajusté à l'écran sans étirer</translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation>Off</translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation>Max</translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation><html><head/><body><p><span style=" font-weight:600;">Filtrage bilinéaire</span>: les textures vont utiliser le filtrage bilinéaire standard d'un PC.</p><p><span style=" font-weight:600;">Style N64 3 points</span>: Les textures seront filtrés comme sur la N64. Le résultat est moins lisse mais plus authentique.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation>Filtrage bilinéaire :</translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation>Standard</translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation>Style N64 3 points</translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translation>Mo</translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation>Format des captures d'écran :</translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation>JPEG</translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation><html><head/><body><p>La langue sélectionnée sera affichée après la fermeture/réouvertue de cette fenêtre.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>La N64 utilise une méthode unique de mip-mapping qu'il est difficile de reproduire correctement sur les PCs. Quand elle est cochée, cette option émule un mip-mapping N64 précis. Quand elle est décochée, certains jeux ont des textures distantes plus nettes.</p><p>[Recommandé : <span style=" font-style:italic;">Activé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation>Activer le mip-mapping N64</translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation type="unfinished"><html><head/><body><p>Cette option émulé des effets qui utilisent des saisies de couleurs aléatoires. Activer cette option peut engendrer de rares problèmes de performance.</p><p>[Recommandé : <span style=" font-style:italic;">Activé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation>Activer l'éclairage matériel (meilleure qualité, HLE seulement)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Utiliser un stockage persistent pour compiler les Shaders.<br/>Chaque jeu utilise un ensemble de combinateurs. Un combinateur est une équation qui définie couleur depuis des entrées de couleurs diverses. GLideN64 traduit les Shaders, et les compile à la volée. Les Shaders sont larges et complexes. Si le jeu utilise de nombreux mélangeurs, la compilation des Shaders prendra du temps et engendrera des saccades. Quand cette option est cochée, ces Shaders sont sauvegardés et ne seront donc pas recompilés la prochaine fois que vous lancerez le jeu.</p><p>[Recommandé : <span style=" font-style:italic;">Activé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation>Stocker les Shaders compilés pour plus de performance (recommandé)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation><html><head/><body><p>Cette option définie la taille de rendu du tampon de sortie. Par défaut, le rendu est défini sur <span style=" font-weight:600;">Identique à la résolution de sortie</span>, mais vous pouvez la définir comme identique à la <span style=" font-weight:600;">Résolution N64 d'origine</span> ou à un <span style=" font-weight:600;">Multiple de la résolution N64</span>.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation>Identique à la résolution de sortie</translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation>Résolution N64 d'origine (le plus précis)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation>Multiple de la résolution N64 :</translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation><html><head/><body><p>Quand cette option est activée, les éléments 2D sont restitués à la même résolution que la N64 avant de les copier vers la sortie. Généralement, cela elimine les erreurs d'affichage avec les éléments 2D, mais cela peut être lent. Cette option utilise des heuristiques pour détecter les éléments 2D adjacents, cela ne fonctionne pas pour tous les jeux.</p><p>[Recommandé : <span style=" font-style:italic;">Coché, sauf si vous avez des problèmes de performance</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation><html><head/><body><p>Dans certains jeux les coordonées des sections d'éléments 2D ne sont pas alignés : il y a un demi-pixel d'écart entre les éléments adjacents. Quand le rendu est défini à la résolution N64 d'origine cela n'est pas visible, mais quand l'image est mise à l'échelle supérieure cela résulte en l'affichage de lignes noires. Cette option tente de connecter les éléments 2D.</p><p><span style=" font-weight:600;">Pour les éléments 2D adjacents</span> : Applique la correction seulement pour les polygones qui la nécessite. Sélectionnez cette option pour les jeux qui affiche des lignes noires.</p><p><span style=" font-weight:600;">Toujours</span> : Applique la correction pour tous les éléments 2D. Sélectionnez cette option quand <span style=" font-weight:600;">Pour les éléments 2D adjacents</span> ne fonctionne pas.</p><p><span style=" font-weight:600;">Jamais</span> : N'essaye pas de corriger les lignes noires entre les éléments 2D.</p><p>[Recommandé : <span style=" font-style:italic;">En fonction du jeu, généralement Jamais</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation>Fixer les lignes noires entre les éléments 2D :</translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Pour les éléments 2D adjacents</translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Toujours</translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation>Jamais</translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation>Tampon image</translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Quand l'option est cochée, le tampon couleur auxiliaire est copié vers la mémoire de la N64 juste après la restitution. Cette option aide à corriger des effets du tampon image dans quelques jeux. Cela peut réduire significativement les performances.</p><p>[Recommandé : <span style=" font-style:italic;">Généralement désactivé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation>Copier les tampons couleur auxiliaires vers la mémoire de la N64 (parfois lent, moins de problèmes en jeu)</translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation><html><head/><body><p>Cette option contrôle la fréquence de mise à jour du tampon image principal.</p><p><span style=" font-weight:600;">À l'interruption verticale</span> : Met à jour le tampon aussi rapidement que possible : à chaque interruption verticale par seconde (50 pour les jeux PAL et 60 pour les jeux NTSC). C'est l'option qui offre la meilleure compatibilité. Utilisez ce mode sauf si vous avez des problèmes de performance.</p><p><span style=" font-weight:600;">Au changement d'origine VI</span> : Le changement d'origine VI correspond au FPS actuel du jeu. Les jeux N64 tournent généralement entre 20 et 30 FPS donc le tampon change moins souvent que le premier mode. Il ne fonctionne pas pour les jeux qui utilisent une mise en tampon unique, ce qui est rare.</p><p><span style=" font-weight:600;">Au changement du Tampon Couleur</span> : Cette option vérifie si le tampon image a changé. Il y a quelques jeux où cela ne fonctionne pas.</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation>Changer le tampon image :</translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Certains émulateurs ne détectent pas ou mal quand lire/écrire dans le tampon image. Vous pouvez désactiver l'aide de l'émulateur pour laisser GLideN64 lire/écrire dans le tampon image.</p><p>[Recommandé : <span style=" font-style:italic;">Généralement désactivé, mais avec certains jeux/émulateurs les performances sont meilleures quand l'option est activée</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation>Utiliser l'aide de l'émulateur pour lire/écrire dans le tampon image</translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation><html><head/><body><p>Quand l'option est activée, le tampon couleur sera lu par blocs. Sinon il sera lu dans son intégralité. Si un jeu a besoin de lire entièrement le tampon, sélectionner cette option peut réduire les performances.</p><p>[Recommandé : <span style=" font-style:italic;">Généralement désactivé, car le tampon de couleur est souvent lu dans son intégralité</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation>Lire les tampons couleur par blocs de 4 Ko</translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation><html><head/><body><p>Quand l'option est activée, le tampon de profondeur sera lu par blocs. Sinon il sera lu dans son intégralité. Si un jeu a besoin de lire entièrement le tampon, sélectionner cette option peut réduire les performances.</p><p>[Recommandé : <span style=" font-style:italic;">Activé, car le tampon de profondeur n'est pas souvent lu dans son intégralité</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation>Lire les tampons de profondeur par blocs de 4 Ko</translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation><html><head/><body><p>Dans certains jeux GLideN64 ne peut pas détecter l'utilisation du tampon image. Avec ces options, GLideN64 copie chaque image du tamon image de votre carte graphique vers la mémoire N64.</p><p><span style=" font-weight:600;">Jamais</span> : Désactive la copie du tampon de votre carte graphique.</p><p><span style=" font-weight:600;">Synchrone</span> : Les effets sont détectés pour tous les jeux, mais cela peut être lent. Utilisez cette option pour les jeux où <span style=" font-weight:600;">Asynchrone</span> ne fonctionne pas.</p><p><span style=" font-weight:600;">Asynchrone</span> : Les effets sont détectés pour de nombreux jeux.</p><p>[Recommandé : <span style=" font-style:italic;">Généralement Asynchrone</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation>Copier le tampon image de votre carte graphique vers la mémoire N64 :</translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation><html><head/><body><p>Le tampon de profondeur est utilisé pour émuler certains effets (ex : les couronnes de feu):</p><p><span style=" font-weight:600;">Jamais</span> : Le tampon image est désactivé.</p><p><span style=" font-weight:600;">Depuis la VRAM</span> : Le tampon de profondeur de votre carte graphique est copié vers la mémoire de la N64 à chaque image, ce qui peut être lent dans certains jeux.</p><p><span style=" font-weight:600;">Dans le logiciel</span> : Généralement plus rapide que la copie depuis la VRAM, mais le résultat peut être imparfait.</p><p>[Recommandé : <span style=" font-style:italic;">Dans le logiciel</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation>Copier le tampon de profondeur de votre carte graphique vers la mémoire N64 :</translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Quand cette option est activée, le tampon image est restitué directement vers l'écran. Cela permet de corriger certains problèmes graphiques mais peut causer des ralentissements et réduire la qualité visuelle.</p><p>[Recommandé : <span style=" font-style:italic;">Généralement désactivé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation>Restituer le tampon image N64 vers la sortie</translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation>Textures N64</translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation><html><head/><body><p>Ce filtre lisse ou affine les textures. Il y a 4 filtres de lissage et 2 filtres d'affinement. Plus le nombre est élevé, plus l'effet est important. Veuillez noter que les performances peuvent être impactées suivant le jeu et/ou le PC.</p><p>[Recommandé : <span style=" font-style:italic;">selon votre préférence</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation>Aucun</translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation>Filtrage lisse 1</translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation>Filtrage lisse 2</translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation>Filtrage lisse 3</translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation>Filtrage lisse 4</translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation>Filtrage affiné 1</translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation>Filtrage affiné 2</translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation><html><head/><body><p>12 filtres différents sont sélectionnables. Selon le filtre, il peut y avoir un impact sur les performances.</p><p>Quand le mode <span style=" font-weight:600;">Stocker</span> est sélectionné, les textures sont sauvegardées dans le cache 'tel quel'. Cela augmente les performances dans les jeux chargeant de nombreuses textures. Décoché <span style=" font-weight:600;">Désactiver pour les arrière-plans</span> pour un meilleur résultat.</p><p>[Recommandé : <span style=" font-style:italic;">selon votre préférence</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation>Stocker</translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation><html><head/><body><p>Cette option active une étape de pré-processing qui réduit les problèmes de postérisation sur les textures améliorées.</p><p>[Recommandé : <span style=" font-style:italic;">Activé pour le filtre xBRZ</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation>Réduire les bandes de couleur (recommandé pour l'amélioration xBRZ)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation><html><head/><body><p>Cette option ignore l'amélioration pour les textures lointaines et étroites généralement utilisées pour les arrière-plans. Cela peut réduire la mémoire utilisée pour la sauvegarde des textures et augmenter les performances.</p><p>[Recommandé : <span style=" font-style:italic;">Activé, sauf si l'option Améliorations est définie sur 'Store'</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation>Désactiver pour les arrière-plans</translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation><html><head/><body><p>Les textures améliorées et filtrées peuvent être mises en cache. Ce paramètre ajustera la quantité de mémoire allouée pour le cache des textures. Cela améliore les performances si un nombre conséquent de requêtes appelle les mêmes textures, ce qui est généralement le cas. Par défaut, 128 Mo devraient être suffisant mais cela peut varier selon les jeux. Super Mario 64 peut nécessiter moins de 32 Mo, mais Conker's Bad Fur Day peut nécessiter plus de 256 Mo. Ajustez la valeur si vous rencontrez des problèmes de performances. La valeur '0' désactive le cache.</p><p>[Recommandé : <span style=" font-style:italic;">en fonction du jeu et du PC</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation><html><head/><body><p>Sélectionne le répertoire contenant les packs de textures.<br/>Par défaut : Plugin/hires_texture</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation><html><head/><body><p>Quand cette option est désactivée, les textures seront chargées tel qu'elles le seraient avec Rice Video : la transparence est soit active, soit inactive. Quand cette option est sélectionnée, GlideN64 vérifie comment le canal alpha de la texture a été conçu et utilise le format le plus approprié. Cela donne aux développeurs de pack de textures la liberté d'utiliser des textures semi-transparentes.</p><p>Désactivez cette option pour les vieux pack de textures ou ceux mal conçus.</p><p>[Recommandé : <span style=" font-style:italic;">en fonction du pack de textures</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation>Utiliser les transparences complètes (recommandé pour les packs de textures récents)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation><html><head/><body><p>Cette option émule un bug dans le plugin RiceVideo sur le calcul CRC de la palette. Si certaines textures ne sont pas chargées, positionnez cette option à 'activé' ou 'désactivé'.</p><p>[Recommandé : <span style=" font-style:italic;">principalement désactivé, activé pour les vieux packs de textures</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation>Calcul alternatif du CRC (pour les vieux packs Rice Video)</translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Cette option sauvegardera toutes les textures précédemment chargées et celles améliorées sur le disque. Au prochain démarrage du jeu, les textures n'auront pas à être recréées, ce qui améliore les performances.</p><p>Quand vous utilisez des packs de textures, leur chargement ne prendra que quelques secondes au lancement du jeu, au lieu de 5 à 60 secondes habituellement. Par contre, si le pack de texture est modifié vous devrez supprimer manuellement le cache. Les fichiers de cache sont sauvegardés dans le sous-dossier 'Cache' du dossier contenant le plugin.</p><p>[Recommandé : <span style=" font-style:italic;">Activé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation>Sauvegarder le cache d'amélioration des textures sur le disque</translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation><html><head/><body><p>Les textures seront compressées, ainsi plus de textures pourront être mises en cache. Le ratio de compression varie suivant les textures, mais il est en moyenne de 1/5 par rapport à la taille originale.</p><p>[Recommandé : <span style=" font-style:italic;">Activé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation><html><head/><body><p>Cette option réduit de moitié l'espace occupé par les textures dans le cache ainsi que celui de la mémoire de votre carte graphique, cela afin d'améliorer les performances. Quand la taille du codage de la couleur est réduite, GLideN64 essaye de préserver la qualité originale autant que possible. Sur certaines textures c'est difficilement visible, mais sur d'autres, tel le ciel, le rendu peut être mauvais.</p><p>[Recommandé : <span style=" font-style:italic;">Désactivé</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation>Convertir les textures en 16 bits</translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation><html><head/><body><p>Certains jeux N64 utilisent la correction gamma pour augmenter la luminosité de l'image. Quand le tampon image est activé, la correction gamma est appliquée automatiquement pour tous les jeux qui l'utilisent. Vous pouvez, à la place, utiliser votre propre correction gamma avec cette option. Le niveau par défaut, utilisé sur la N64, est 2.</p><p>[Recommandé : <span style=" font-style:italic;">Désactivé; 2.00</span>]</p></body></html></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translatorcomment>impossible à traduire ?</translatorcomment> - <translation>OSD</translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation>Affichage sur l'écran</translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation>Position</translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation>En haut à gauche</translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation>En haut</translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation>En haut à droite</translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation>À gauche</translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation>À droite</translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation>En bas à gauche</translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation>En bas</translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation>En bas à droite</translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation>Couleur :</translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation>Prévisualisation</translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation>Afficher le pourcentage</translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/gliden64_it.ts b/GLideN64/translations/gliden64_it.ts deleted file mode 100644 index b5cc4b7..0000000 --- a/GLideN64/translations/gliden64_it.ts +++ /dev/null @@ -1,1248 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="it_IT"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>Riguardo a GlideN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>Autori</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>Finanziatori</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <translation>Crediti</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation></translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>Risoluzione a schermo intero:</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>Risoluzione finestra:</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>Frequenza di aggiornamento:</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>Adatta</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation></translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>Filtro Anisotropico:</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>Lingua:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>Emulazione</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>Emula il frame buffer</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation>Miglioramenti texture</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>Filtro:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>Miglioramento:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>Utilizza un pacchetto texture modificate</translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>Percorso cartella pacchetti texture:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>Comprimi cache texture</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/gliden64_ja.ts b/GLideN64/translations/gliden64_ja.ts deleted file mode 100644 index 3cfcad7..0000000 --- a/GLideN64/translations/gliden64_ja.ts +++ /dev/null @@ -1,1248 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="ja_JP"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>GLideN64����</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>作者</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>寄付</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <translation>クレジット</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation>ビデオ</translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>フルスクリーン解�度:</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>ウィンドウ解�度:</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>リフレッシュレート:</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>引�伸��</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation>16:9</translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>異方性フィルタリング:</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>言語:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>エミュレーション</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>フレーム�ッファ�エミュレート</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation type="unfinished">テクス�ャ拡張</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>フィルタ :</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>拡張:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>テクス�ャパックを使用�る</translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>テクス�ャパック�パス:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>テクス�ャキャッシュを圧縮</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/gliden64_pl.ts b/GLideN64/translations/gliden64_pl.ts deleted file mode 100644 index 88da2d8..0000000 --- a/GLideN64/translations/gliden64_pl.ts +++ /dev/null @@ -1,1248 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="pl_PL"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>O GLideN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>Autorzy</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>Darczyńcy</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <translation>Inni twórcy</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation>Obraz</translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>Rozdzielczość pełnoekranowa:</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>Rozdzielczość w oknie:</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>Częstotliwość odświeżania:</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>Rozciągnij</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation>16:9</translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>Filtrowanie anizotropowe:</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>Język:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>Emulacja</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>Emuluj bufor ramki</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation>Uwydatnienie tekstur</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>Filtr:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>Uwydatnienie:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>Użyj paczki tekstur</translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>Ścieżka paczek tekstur:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>Kompresuj pamięć podręczną tekstur</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/gliden64_pt_BR.ts b/GLideN64/translations/gliden64_pt_BR.ts deleted file mode 100644 index a55c195..0000000 --- a/GLideN64/translations/gliden64_pt_BR.ts +++ /dev/null @@ -1,1249 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="pt_BR"> -<context> - <name>AboutDialog</name> - <message> - <location filename="AboutDialog.ui" line="17"/> - <source>About GLideN64</source> - <translation>Sobre GLideN64</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="80"/> - <source>About</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="102"/> - <source>The next generation open source graphics plugin for N64 emulators.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="125"/> - <source>Authors</source> - <translation>Autores</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="145"/> - <source>Developer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="169"/> - <source>Beta tester</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="193"/> - <source>GUI designer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="207"/> - <source>Contributors</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="438"/> - <source>... and more</source> - <extracomment>Refers to more funders</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="470"/> - <source>Author of the original glN64 graphics plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="494"/> - <source>Author of gles2n64, a port of glN64 to GL ES 2.0</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="518"/> - <source>Author of the GlideHQ texture library</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="542"/> - <source>Author of z64, an OpenGL LLE plugin</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="AboutDialog.ui" line="240"/> - <source>Funders</source> - <translation>Financiadores</translation> - </message> - <message> - <location filename="AboutDialog.ui" line="450"/> - <source>Credits</source> - <oldsource>Kredits</oldsource> - <translation>Créditos</translation> - </message> - <message> - <location filename="AboutDialog.cpp" line="20"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>ConfigDialog</name> - <message> - <location filename="configDialog.ui" line="37"/> - <location filename="configDialog.ui" line="48"/> - <source>Video</source> - <translation>Vídeo</translation> - </message> - <message> - <location filename="configDialog.ui" line="78"/> - <source>Full screen resolution:</source> - <translation>Resolução Tela Cheia:</translation> - </message> - <message> - <location filename="configDialog.ui" line="129"/> - <source>Windowed resolution:</source> - <translation>Resolução de Janela:</translation> - </message> - <message> - <location filename="configDialog.ui" line="90"/> - <source>Refresh rate:</source> - <translation>Freqüência do Refresh:</translation> - </message> - <message> - <location filename="configDialog.ui" line="190"/> - <source>Stretch</source> - <translation>Estendido</translation> - </message> - <message> - <location filename="configDialog.ui" line="185"/> - <source>16:9</source> - <translation>16:9</translation> - </message> - <message> - <location filename="configDialog.ui" line="108"/> - <source><html><head/><body><p>This option selects the resolution for windowed mode. You can also type in a custom window size.</p><p>[Recommended: <span style=" font-style:italic;">640 x 480, 800 x 600, 1024 x 768, 1280 x 960</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="216"/> - <source><html><head/><body><p>Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, unless there are performance issues</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="219"/> - <source>Enable threaded video</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="232"/> - <source>When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="253"/> - <location filename="ConfigDialog.cpp" line="767"/> - <source>Overscan</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="267"/> - <source>NTSC</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="320"/> - <source>PAL</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="388"/> - <source>Anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="397"/> - <source><html><head/><body><p>GLideN64 offers two methods to smooth jagged polygons:</p><p><span style=" font-weight:600;">Fast approximate anti-aliasing (FXAA)</span>: FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with <span style=" font-weight:600;">N64-style depth compare</span>. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.</p><p><span style=" font-weight:600;">Multisample anti-aliasing (MSAA)</span>: MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with <span style=" font-weight:600;">N64-style depth compare</span> and may cause minor glitches in some games.</p><p>Recommendation: [<span style=" font-style:italic;">Usually 16x MSAA, or FXAA with N64-style depth compare</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="418"/> - <source>No anti-aliasing</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="425"/> - <source>Fast approximate anti-aliasing (FXAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="432"/> - <source>Multisample anti-aliasing (MSAA):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="616"/> - <source>Multisample anti-aliasing is not compatible with <a href="#n64DepthCompare">N64-style depth compare</a>.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="638"/> - <source>Filtering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="662"/> - <source>Anisotropic filtering:</source> - <translation>Filtragem Anisotrópica:</translation> - </message> - <message> - <location filename="configDialog.ui" line="927"/> - <source>PNG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="977"/> - <source>Language:</source> - <translation>Língua:</translation> - </message> - <message> - <location filename="configDialog.ui" line="1043"/> - <location filename="configDialog.ui" line="1743"/> - <source>Some of the options on this tab have been disabled because <a href="#frameBuffer">frame buffer emulation</a> has been turned off.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1066"/> - <source>Emulation</source> - <translation>Emulação</translation> - </message> - <message> - <location filename="configDialog.ui" line="1086"/> - <source><html><head/><body><p>When enabled, all non-default values of settings are stored individually for each game.</p><p>When a game is running, settings are displayed and saved for the currently running game.</p><p><span style=" font-weight:600;">Note:</span> GLideN64 already contains settings for the optimal performance of most games. Be careful when altering options on 'Emulation' and 'Frame buffer' tab.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1089"/> - <source>Use per-game settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1170"/> - <source>Internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1218"/> - <source>x</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1252"/> - <source>Gamma</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1263"/> - <source>Custom gamma correction level:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1355"/> - <source>Selecting this option overrides gamma correction specified by the game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1386"/> - <source>Dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1392"/> - <source><html><head/><body><p>Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1395"/> - <source>Enable 5bit quantization</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1402"/> - <source><html><head/><body><p>This setting doubles noise resolution to get a finer noise effect at higher resolutions. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1405"/> - <source>High resolution noise dithering</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1412"/> - <source><html><head/><body><p>This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1415"/> - <source>Dithering pattern on output image</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1424"/> - <source><html><head/><body><p>RDRAM dithering prevents color banding in games with framebuffer effects.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1427"/> - <source>RDRAM image dithering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1434"/> - <source><html><head/><body><p>Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1438"/> - <source>disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1443"/> - <source>Bayer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1448"/> - <source>Magic square</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1453"/> - <source>Blue noise</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1466"/> - <source>2D elements</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1497"/> - <source>Render 2D elements in N64 resolution (best quality, can be slow):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1513"/> - <source>Enable optimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1518"/> - <source>Enable unoptimized</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1528"/> - <source>Try to remove colored halos around transparent objects</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1628"/> - <source><html><head/><body><p>Background is a complex macro command used to render large (normally full screen) images. Since background images usually don't fit texture memory, the microcode splits them on narrow strips and renders them one by one. HLE code has two modes to emulate background commands:</p><p><span style=" font-weight:600;">One piece</span>: The whole background image rendred as one textured rectangle. This method is normally much faster, but the result is not always correct.</p><p><span style=" font-weight:600;">Stripped</span>: This method emulates background commands as close as possible to actual microcode implementation. It's slower but more precise. Another problem: some games may have gaps between rendered strips in high resolution. Use &quot;Render 2D elements in N64 resolution&quot; option to remove the gaps.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Stripped</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1649"/> - <source>Background rendering mode (HLE only):</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1656"/> - <source>One piece</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1663"/> - <source>Stripped</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1789"/> - <source>Emulate frame buffer</source> - <translation>Emula frame buffer</translation> - </message> - <message> - <location filename="configDialog.ui" line="2133"/> - <location filename="configDialog.ui" line="2143"/> - <source><html><head/><body><p>The N64 uses a unique method of calculating depth to the camera. When enabled, GlideN64 uses shaders to try to emulate these calculations correctly. Not compatible with anti-aliasing. <span style=" font-weight:600;">Experimental!</span></p><p>Fast mode requires OpenGL 4.2 and &quot;fragment shader interlock&quot; extensions.</p><p>Compatible mode requires only core OpenGL 4.2 <span style=" font-weight:600;">Can be slow!</span></p><p>[Recommended: <span style=" font-style:italic;">Sometimes checked, for several games</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2136"/> - <source>N64-style depth compare (experimental, disables MSAA)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2152"/> - <source>Fast</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2157"/> - <source>Compatible</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2683"/> - <source><html><head/><body><p>This option enables alternative storage for hi-res textures.</p><p>Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.</p><p>File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.</p><p>Disable &quot;Compress texture cache&quot; option for better performance.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2696"/> - <source><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2699"/> - <source>Press 'd' to dump N64 textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2706"/> - <source><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2709"/> - <source>Press 'r' to reload hi-res textures (for texture artists)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3350"/> - <source>Display FPS</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3357"/> - <source>Display VI/s</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3371"/> - <source>Display internal resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3378"/> - <source>Display rendering resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3402"/> - <source>Font</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3458"/> - <source>Size:</source> - <extracomment>Font size</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3471"/> - <source> px</source> - <extracomment>Short for font size pixels; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3534"/> - <source>████</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3616"/> - <source>The font preview only shows the regular style for the font family. Some styles like bold and italic display only in game.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3661"/> - <location filename="ConfigDialog.cpp" line="342"/> - <source>Debug</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3670"/> - <source>Dump low-level info</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3677"/> - <source>Dump display list commands</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3684"/> - <source>Dump detailed info (matrices, vertices, etc.)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3741"/> - <source>This game</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3748"/> - <source>Save settings for:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3755"/> - <location filename="configDialog.ui" line="3765"/> - <source>Settings profile:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3785"/> - <location filename="ConfigDialog.cpp" line="972"/> - <source>Remove</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1508"/> - <location filename="configDialog.ui" line="2147"/> - <source>Disable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="140"/> - <location filename="ConfigDialog.cpp" line="761"/> - <source>Custom</source> - <extracomment>In the dropdown for windowed resolutions</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1830"/> - <source><html><head/><body><p>Unchecking this option disables many effects including cropping, aspect ratio, N64 resolution factor, N64-style depth compare and more. Don't uncheck this option unless you have performance issues.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1935"/> - <source>Vertical interrupt (recommended, fewest game issues)</source> - <extracomment>"Vertical interrupt" is frequently abbreviated as "VI". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1940"/> - <source>VI origin change (faster, few game issues)</source> - <extracomment>"VI" stands for "vertical interrupt". This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1945"/> - <source>Color buffer change (fastest, some game issues)</source> - <extracomment>This control is a combobox labelled "Frame buffer swap on:"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2047"/> - <source>Never (fastest, many game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2052"/> - <source>Synchronous (slowest, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2057"/> - <source>Asynchronous (fast, few game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2103"/> - <source>Never (fastest, most game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2108"/> - <source>From VRAM (slow, some game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2113"/> - <source>In software (fast, fewest game issues)</source> - <extracomment>This is a combobox option with the label "Copy video card frame buffer to N64 memory".</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2167"/> - <source><html><head/><body><p>Enable force depth buffer clear. A hack. Necessary for Eikou no Saint Andrews.</p><p>[Recommended: <span style=" font-style:italic;">off, except for Eikou no Saint Andrews</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2170"/> - <source>Force depth buffer clear</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2187"/> - <source><html><head/><body><p>This option is required for some Reshade depth dependant effects, such as SSAO and depth of field.</p><p>[Recommended: <span style=" font-style:italic;">only if you use Reshade and need depth dependant effects</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2190"/> - <source>Copy depth to main depth buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2238"/> - <source>Texture enhancement</source> - <translation>Melhoramento de Textura</translation> - </message> - <message> - <location filename="configDialog.ui" line="2284"/> - <source>Filter:</source> - <translation>Filtro:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2354"/> - <source>Enhancement:</source> - <translation>Melhoramento:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2491"/> - <location filename="configDialog.ui" line="2686"/> - <source>Use file storage instead of memory cache</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2505"/> - <source>Use texture pack</source> - <translation>Usa pacote de textura</translation> - </message> - <message> - <location filename="configDialog.ui" line="2565"/> - <source>Texture pack path:</source> - <translation>Local dos pacotes de textura:</translation> - </message> - <message> - <location filename="configDialog.ui" line="2578"/> - <source>Texture cache path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2600"/> - <location filename="configDialog.ui" line="2616"/> - <location filename="configDialog.ui" line="2632"/> - <source>...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2648"/> - <source>Texture dump path:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2751"/> - <source>Size of memory cache for enhanced textures:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2814"/> - <source>Compress texture cache</source> - <translation>Compacta cache de textura</translation> - </message> - <message> - <location filename="configDialog.ui" line="17"/> - <location filename="ConfigDialog.cpp" line="900"/> - <source>GLideN64 Settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="57"/> - <source><html><head/><body><p>All the resolutions that your video card/monitor supports should be displayed.</p><p>[Recommended:<span style=" font-style:italic;"> Maximum resolution for your monitor unless performance becomes an issue</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="206"/> - <source><html><head/><body><p>Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually off, on if you have image tearing problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="209"/> - <source>Enable VSync</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="151"/> - <source><html><head/><body><p>This setting adjusts the aspect ratio of the video output. All N64 games support <span style=" font-weight:600;">4:3</span>. Some games support <span style=" font-weight:600;">16:9</span> within game settings. Use <span style=" font-weight:600;">Stretch</span> to fill the screen without pillar or letterboxing.</p><p><span style=" font-weight:600;">Try to adjust game to fit</span> tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="172"/> - <source><html><head/><body><p>Aspect ratio:</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="180"/> - <source>4:3 (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="195"/> - <source>Try to adjust game to fit</source> - <extracomment>This option activates a widescreen hack. The language "Try to" implies it may it may not work and the language "adjust game" implies the emulation will be inaccurate.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="465"/> - <location filename="configDialog.ui" line="679"/> - <source>Off</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="573"/> - <location filename="configDialog.ui" line="793"/> - <source>High</source> - <extracomment>The highest of a set of numbers</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="807"/> - <source><html><head/><body><p><span style=" font-weight:600;">Bilinear filtering</span>: Textures will use standard PC-style bilinear filtering.</p><p><span style=" font-weight:600;">N64-style 3 point</span>: Textures will be filtered more like the N64. The result is less smooth but more accurate.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="836"/> - <source>Bilinear filtering:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="845"/> - <source>Standard</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="852"/> - <source>N64-style 3 point</source> - <extracomment>3 point bilinear filtering as used by the Nintendo 64.</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2764"/> - <source> MB</source> - <extracomment>Megabytes</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="901"/> - <source>Screenshot format:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="914"/> - <source>JPEG</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="953"/> - <source><html><head/><body><p>The selected language will display after this window is closed and reopened.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1123"/> - <source><html><head/><body><p>The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1126"/> - <source>Enable N64-style mip-mapping</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1136"/> - <source><html><head/><body><p>In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.<br/><br/>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <oldsource><html><head/><body><p>This option emulates effects that use random color input. Checking this option may cause rare performance problems.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></oldsource> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1139"/> - <source>Enable per-pixel lighting (better quality, HLE only)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1146"/> - <source><html><head/><body><p>Use persistent storage for compiled shader programs.<br/>Each game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1149"/> - <source>Store compiled shaders for performance (recommended)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1167"/> - <source><html><head/><body><p>This option sets the output render buffer size. By default, the render buffer is set to the <span style=" font-weight:600;">Same as output resolution</span>, but you can set it to the <span style=" font-weight:600;">Original N64 resolution</span> or a <span style=" font-weight:600;">Multiple of N64 resolution</span>.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1179"/> - <source>Same as output resolution</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1189"/> - <source>Original N64 resolution (most accurate)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1206"/> - <source>Multiple of N64 resolution:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1494"/> - <location filename="configDialog.ui" line="1504"/> - <source><html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1542"/> - <source><html><head/><body><p>In some games the coordinates for parts of 2D elements are not aligned: there is a half-pixel split between adjacent elements. When rendering at the N64's original resolution it isn't visible, but when the image is scaled up it results in black lines. This option attempts to connect these 2D elements.</p><p><span style=" font-weight:600;">For adjacent 2D elements</span>: Apply the correction only for polygons that need it. Select this option for games that have issues with black lines.</p><p><span style=" font-weight:600;">Always</span>: Apply the correction for every 2D element. Select this option when <span style=" font-weight:600;">For adjacent 2D elements</span> doesn't help.</p><p><span style=" font-weight:600;">Never</span>: Don't attempt to correct black lines between 2D elements.</p><p>[Recommended: <span style=" font-style:italic;">Game dependent, mostly Never</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1563"/> - <source>Fix black lines between 2D elements:</source> - <extracomment>2D elements, formerly labelled texrects, are usually used for title screens or HUDs</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1579"/> - <source>For adjacent 2D elements</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1589"/> - <source>Always</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1599"/> - <source>Never</source> - <extracomment>The label for this control is "Fix black lines between 2D elements"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1760"/> - <source>Frame buffer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1889"/> - <source><html><head/><body><p>When checked, the auxiliary color buffer is copied to N64 memory right after rendering to it is finished. This option helps to correctly emulate frame buffer effects in some games. This option may noticeably reduce performance.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1892"/> - <source>Copy auxiliary color buffers to N64 memory (sometimes slow, fewer game issues)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1906"/> - <source><html><head/><body><p>This option controls how often GLideN64 updates the main frame buffer.</p><p><span style=" font-weight:600;">Vertical interrupt</span>: Update the buffer as quickly as possible, every vertical interrupt per second (50 for PAL and 60 for NTSC games). This option is the most compatible. Use this mode unless you have performance problems.</p><p><span style=" font-weight:600;">VI origin change</span>: The VI origin changes corresponding to the game's actual FPS. N64 games typically run between 20 to 30 FPS so the buffers swap less often than the first mode. This mode does not work for games that use single buffering, which is rare.</p><p><span style=" font-weight:600;">Color buffer change</span>: This option checks to see if the frame buffer has been changed. There are some games where this doesn't work.</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1927"/> - <source>Frame buffer swap on:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1974"/> - <source><html><head/><body><p>Some emulators do a poor job of detecting when to read/write frame buffers. You can disable emulator help to let GLideN64 read/write frame buffers itself.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, but for some games/emulators it may be faster checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1977"/> - <source>Use emulator help to read/write frame buffers</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1987"/> - <source><html><head/><body><p>When checked, the color buffer will be read in chunks. Otherwise, the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked, because the color buffer is usually read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1990"/> - <source>Read color buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1997"/> - <source><html><head/><body><p>When checked, the depth buffer will be read in chunks. Otherwise the buffer will be read in its entirety. If a game needs to read the entire buffer, selecting this option may be slow.</p><p>[Recommended: <span style=" font-style:italic;">Checked, because the depth buffer is not often read entirely</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2000"/> - <source>Read depth buffer in 4 KB chunks</source> - <extracomment>"Read" refers to "Use emulator help to read/write frame buffers"</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2018"/> - <source><html><head/><body><p>In some games GLideN64 can't detect when the game uses the frame buffer. With these options, you can have GLideN64 copy each frame of your video card's frame buffer to N64 memory.</p><p><span style=" font-weight:600;">Never</span>: Disable copying buffers from video card.</p><p><span style=" font-weight:600;">Synchronous</span>: Effects are detected for all games, but it can be slow. Use for games where <span style=" font-weight:600;">Asynchronous</span> doesn't work.</p><p><span style=" font-weight:600;">Asynchronous</span>: Effects are detected for most games.</p><p>[Recommended: <span style=" font-style:italic;">Usually Asynchronous</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2039"/> - <source>Copy video card frame buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2068"/> - <source><html><head/><body><p>The depth buffer is used to emulate some effects (e.g. coronas):</p><p><span style=" font-weight:600;">Never</span>: Depth buffer is disabled.</p><p><span style=" font-weight:600;">From VRAM</span>: Your video card's depth buffer is copied to N64 memory each frame, which can be slow on some games.</p><p><span style=" font-weight:600;">In software</span>: Generally faster than copying from VRAM, but the result can be imperfect.</p><p>[Recommended:<span style=" font-style:italic;"> In software</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2095"/> - <source>Copy video card depth buffer to N64 memory:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2177"/> - <source><html><head/><body><p>When this option is checked, the frame buffer is rendered directly to the screen. This prevents some graphic problems but may cause slowdowns or visual quality problems.</p><p>[Recommended: <span style=" font-style:italic;">Usually unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2180"/> - <source>Render N64 frame buffer to output</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2247"/> - <source>N64 textures</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2266"/> - <source><html><head/><body><p>This filter smooths or sharpens textures. There are four smoothing filters and two sharpening filters. The higher the number, the stronger the effect. Performance may be affected depending on the game and/or your PC.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2292"/> - <location filename="configDialog.ui" line="2362"/> - <source>None</source> - <extracomment>No texture filtering ----------- -No texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2297"/> - <source>Smooth filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2302"/> - <source>Smooth filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2307"/> - <source>Smooth filtering 3</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2312"/> - <source>Smooth filtering 4</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2317"/> - <source>Sharp filtering 1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2322"/> - <source>Sharp filtering 2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2333"/> - <source><html><head/><body><p>There are 12 distinct filters to select. Depending on which filter, they may cause performance problems.</p><p>When <span style=" font-weight:600;">Store</span> is selected, textures are saved to the cache as-is. This improves performance in games that load many textures. Uncheck <span style=" font-weight:600;">Disable for backgrounds</span> for the best performance.</p><p>[Recommended: <span style=" font-style:italic;">Your preference</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2367"/> - <source>Store</source> - <extracomment>Store texture enhancement</extracomment> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2471"/> - <source><html><head/><body><p>This option enables a pre-processing step that reduces posterization issues on enhanced textures.</p><p>[Recommended:<span style=" font-style:italic;"> Checked for xBRZ</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2474"/> - <source>Decrease color banding (recommended for xBRZ enhancement)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2481"/> - <source><html><head/><body><p>This option skips texture enhancements for long, narrow textures that are usually used for backgrounds. This may save texture memory and improve performance.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless Enhancement is set to Store</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2484"/> - <source>Disable for backgrounds</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2724"/> - <source><html><head/><body><p>Enhanced and filtered textures can be cached to improve performance. This option adjusts how much memory is dedicated to the texture cache. This can improve performance if there are many requests for the same texture, which is usually the case. Normally 128 MB should be more than enough, but the best option is different for each game. Super Mario 64 may not need more than 32 MB, but Conker's Bad Fur Day can take advantage of 256 MB+. Adjust accordingly if you are having performance problems. Setting this option to 0 disables the cache.</p><p>[Recommended: <span style=" font-style:italic;">PC and game dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2535"/> - <source><html><head/><body><p>Select path to the folder with texture packs.<br/>Default: Plugin/hires_texture</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2663"/> - <source><html><head/><body><p>When this option is cleared, textures will be loaded as they are when using Rice Video: transparencies either on or off. When this option is selected, GlideN64 will check how the texture's alpha channel was designed and will select the most appropriate format. This gives texture pack designers freedom to use semi-transparent textures.</p><p>Clear this option for older or poorly designed texture packs.</p><p>[Recommended:<span style=" font-style:italic;"> Texture pack dependent</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2666"/> - <source>Use full transparencies (recommended for newer texture packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2673"/> - <source><html><head/><body><p>This option emulates a palette CRC calculation bug in Rice Video. If you have problems loading textures, try checking or unchecking this option.</p><p>[Recommended: <span style=" font-style:italic;">Mostly unchecked, checked for old texture packs</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2676"/> - <source>Alternative CRC calculation (for old Rice Video packs)</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2798"/> - <source><html><head/><body><p>This option saves all previously loaded and enhanced textures to your PC. When the game is next launched, textures don't have to be recreated, causing smoother performance.</p><p>When using texture packs, loading packs will take only a few seconds when the game is launched as opposed to the 5–60 seconds that loading usually takes. However, if you change the texture pack you'll have to manually delete the texture cache. Saved cache files are saved to a folder called Cache within the plugins folder.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2801"/> - <source>Save enhanced texture cache to hard disk</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2811"/> - <source><html><head/><body><p>Textures will be compressed so more textures can be held in the cache. The compression ratio varies per texture, but the compression is typically 1/5 of the original size.</p><p>[Recommended: <span style=" font-style:italic;">Checked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2821"/> - <source><html><head/><body><p>This option halves the space used by textures in the texture cache and video card memory to improve performance. When reducing the color, GLideN64 tries to perserve the original quality as much as possible. On most textures it's hardly noticeable, but some textures, like skies, can look noticeably worse.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2824"/> - <source>Convert textures to 16 bpp</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="1249"/> - <source><html><head/><body><p>Some N64 games use gamma correction to brighten the image. When the frame buffer is enabled, gamma correction is applied automatically for all games that use it on the N64. You can use your own gamma correction instead with this option. The default level, used on the N64, is 2.</p><p>[Recommended: <span style=" font-style:italic;">Unchecked; 2.00</span>]</p></body></html></source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2847"/> - <location filename="ConfigDialog.cpp" line="858"/> - <source>OSD</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2850"/> - <source>On-screen display</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2863"/> - <source>Position</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3209"/> - <source>Top left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3011"/> - <source>Top</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3313"/> - <source>Top right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3118"/> - <source>Left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2907"/> - <source>Right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="2959"/> - <source>Bottom left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3261"/> - <source>Bottom</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3063"/> - <source>Bottom right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3506"/> - <source>Color:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3572"/> - <source>Preview</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="configDialog.ui" line="3364"/> - <source>Display percentage</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="331"/> - <source>Save and Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="332"/> - <source>Save</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="333"/> - <source>Close</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="334"/> - <location filename="ConfigDialog.cpp" line="688"/> - <location filename="ConfigDialog.cpp" line="693"/> - <source>Restore Defaults</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="393"/> - <location filename="ConfigDialog.cpp" line="906"/> - <location filename="ConfigDialog.cpp" line="914"/> - <source>New...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="567"/> - <source>The texture pack folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="582"/> - <source>The texture pack cache folder is missing. Please change the folder or turn off texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="597"/> - <source>The texture dump folder is missing. Please change the folder or turn off dumping texture packs.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="689"/> - <source>Are you sure you want to reset all settings to default?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="694"/> - <location filename="ConfigDialog.cpp" line="973"/> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <location filename="ConfigDialog.cpp" line="915"/> - <location filename="ConfigDialog.cpp" line="921"/> - <location filename="ConfigDialog.cpp" line="927"/> - <source>New Profile</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="910"/> - <source>New profile name:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="916"/> - <source>New settings profiles cannot be called "New...".</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="922"/> - <source>Please type a name for your new settings profile.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="928"/> - <source>This settings profile already exists.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="967"/> - <source>Are you sure you want to remove the settings profile "</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="968"/> - <source>"?</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="ConfigDialog.cpp" line="969"/> - <source>Remove Profile</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="FullscreenResolutions_windows.cpp" line="82"/> - <source> Hz</source> - <extracomment>Abbreviation for Hertz; include a leading space if appropriate</extracomment> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/GLideN64/translations/release/gliden64_de.qm b/GLideN64/translations/release/gliden64_de.qm deleted file mode 100644 index 66cac77..0000000 Binary files a/GLideN64/translations/release/gliden64_de.qm and /dev/null differ diff --git a/GLideN64/translations/release/gliden64_es.qm b/GLideN64/translations/release/gliden64_es.qm deleted file mode 100644 index 88802e6..0000000 Binary files a/GLideN64/translations/release/gliden64_es.qm and /dev/null differ diff --git a/GLideN64/translations/release/gliden64_fr.qm b/GLideN64/translations/release/gliden64_fr.qm deleted file mode 100644 index 2b0c723..0000000 Binary files a/GLideN64/translations/release/gliden64_fr.qm and /dev/null differ diff --git a/GLideN64/translations/release/gliden64_it.qm b/GLideN64/translations/release/gliden64_it.qm deleted file mode 100644 index 1e138e0..0000000 Binary files a/GLideN64/translations/release/gliden64_it.qm and /dev/null differ diff --git a/GLideN64/translations/release/gliden64_ja.qm b/GLideN64/translations/release/gliden64_ja.qm deleted file mode 100644 index 2a775c3..0000000 Binary files a/GLideN64/translations/release/gliden64_ja.qm and /dev/null differ diff --git a/GLideN64/translations/release/gliden64_pl.qm b/GLideN64/translations/release/gliden64_pl.qm deleted file mode 100644 index 8fbb497..0000000 Binary files a/GLideN64/translations/release/gliden64_pl.qm and /dev/null differ diff --git a/GLideN64/translations/release/gliden64_pt_BR.qm b/GLideN64/translations/release/gliden64_pt_BR.qm deleted file mode 100644 index a358a4a..0000000 Binary files a/GLideN64/translations/release/gliden64_pt_BR.qm and /dev/null differ diff --git a/angrylion-rdp-plus/.github/stale.yml b/angrylion-rdp-plus/.github/stale.yml deleted file mode 100644 index dc90e5a..0000000 --- a/angrylion-rdp-plus/.github/stale.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security -# Label to use when marking an issue as stale -staleLabel: wontfix -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/angrylion-rdp-plus/.gitignore b/angrylion-rdp-plus/.gitignore deleted file mode 100644 index bafc9c0..0000000 --- a/angrylion-rdp-plus/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Visual Studio cache/options directory -.vs/ - -# Visual C++ cache files -*.aps - -src/core/version.h -private/ -build/ diff --git a/angrylion-rdp-plus/CMakeLists.txt b/angrylion-rdp-plus/CMakeLists.txt deleted file mode 100644 index e69f154..0000000 --- a/angrylion-rdp-plus/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -option(GLES "Set to ON to use OpenGL ES 3.0 renderer instead of OpenGL 3.3 core") - -project(angrylion-plus) - -set(OpenGL_GL_PREFERENCE GLVND) - -if(GLES) - message("OpenGL ES 3.0 renderer enabled") - add_definitions(-DGLES) -endif(GLES) - -if(ANDROID) - add_definitions(-DANDROID) -endif() - -# set policy CMP0042 for MacOS X -set(CMAKE_MACOSX_RPATH 1) - -# check for INTERPROCEDURAL_OPTIMIZATION support -if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9)) - cmake_policy(SET CMP0069 NEW) - - include(CheckIPOSupported) - check_ipo_supported(RESULT ENABLE_IPO) - if(ENABLE_IPO) - message("Interprocedural optimizations enabled") - endif(ENABLE_IPO) -endif() - -# C++14 is required for the Parallel utility class -set(CMAKE_CXX_STANDARD 14) - -# disable warnings to use unportable secure file IO -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif(MSVC) - -# default to release build -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif(NOT CMAKE_BUILD_TYPE) - -find_package(Git REQUIRED) -find_package(PythonInterp 3.2 REQUIRED) - -if (NOT ANDROID) - find_package(PythonLibs) - find_package(OpenGL REQUIRED) -endif() - -# use warning levels as recommended by -# https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md -if ( CMAKE_COMPILER_IS_GNUCC ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic") -endif() -if ( MSVC ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /w14640 /permissive-") -endif() - -set(PATH_SRC "src") - -# RDP core library -set(PATH_CORE "${PATH_SRC}/core") - -# run script to generate version.h -set(PATH_VERSION "${PATH_CORE}/version.h") - -add_custom_command( - OUTPUT ${PATH_VERSION} - COMMAND - ${PYTHON_EXECUTABLE} - "${CMAKE_SOURCE_DIR}/make_version.py" - COMMENT "Generate Git version" -) - -# static core library -file(GLOB SOURCES_CORE "${PATH_CORE}/*.c" "${PATH_CORE}/*.cpp") - -if (ANDROID) - find_library( # Defines the name of the path variable that stores the - # location of the NDK library. - OPENGL_LIBRARIES - - # Specifies the name of the NDK library that - # CMake needs to locate. - GLESv3 ) -endif() - -add_library(alp-core STATIC ${SOURCES_CORE} ${PATH_VERSION}) - -# output library -set(PATH_OUTPUT "${PATH_SRC}/output") - -file(GLOB SOURCES_OUTPUT "${PATH_OUTPUT}/*.c" "${PATH_OUTPUT}/*.cpp") - -add_library(alp-output STATIC ${SOURCES_OUTPUT}) - -if(MINGW) - # link libgcc/libstdc++ statically, fixes cryptic "_ZNSt13runtime_errorC1EPKc" error - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") -else(MINGW) - # set PIC option for non-MinGW targets - set_target_properties(alp-core PROPERTIES POSITION_INDEPENDENT_CODE ON) - set_target_properties(alp-output PROPERTIES POSITION_INDEPENDENT_CODE ON) -endif(MINGW) - -# set IPO option, if supported -if(ENABLE_IPO AND (CMAKE_BUILD_TYPE STREQUAL "Release")) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -O3") -endif() - -include_directories(${PATH_SRC}) - -# Project64 GFX Plugin (Windows only) -if(WIN32) - set(NAME_PLUGIN_ZILMAR ${CMAKE_PROJECT_NAME}) - set(PATH_PLUGIN_ZILMAR "${PATH_SRC}/plugin/zilmar") - - enable_language(RC) - file(GLOB SOURCES_PLUGIN_ZILMAR "${PATH_PLUGIN_ZILMAR}/*.c" "${PATH_PLUGIN_ZILMAR}/*.rc") - add_library(${NAME_PLUGIN_ZILMAR} SHARED ${SOURCES_PLUGIN_ZILMAR}) - - set_target_properties(${NAME_PLUGIN_ZILMAR} PROPERTIES PREFIX "") - - target_link_libraries(${NAME_PLUGIN_ZILMAR} alp-core alp-output shlwapi ${OPENGL_LIBRARIES}) -endif(WIN32) - -# Mupen64Plus GFX plugin -set(NAME_PLUGIN_M64P "mupen64plus-video-${CMAKE_PROJECT_NAME}") - -set(PATH_PLUGIN_M64P "${PATH_SRC}/plugin/mupen64plus") - -file(GLOB SOURCES_PLUGIN_M64P "${PATH_PLUGIN_M64P}/*.c") -add_library(${NAME_PLUGIN_M64P} SHARED ${SOURCES_PLUGIN_M64P}) - -if(NOT ANDROID) - set_target_properties(${NAME_PLUGIN_M64P} PROPERTIES PREFIX "") -endif() - -target_link_libraries(${NAME_PLUGIN_M64P} alp-core alp-output ${CMAKE_THREAD_LIBS_INIT} ${OPENGL_LIBRARIES}) diff --git a/angrylion-rdp-plus/CREDITS.txt b/angrylion-rdp-plus/CREDITS.txt deleted file mode 100644 index 74844df..0000000 --- a/angrylion-rdp-plus/CREDITS.txt +++ /dev/null @@ -1,7 +0,0 @@ -This little RDP plugin was initially based on MESS 0.128 source code. -Many thanks to Ville Linde, MooglyGuy and other people who wrote the RDP implementation in MESS 0.128. The rest of the code is by me, angrylion. -Many thanks to people who helped me in various ways: olivieryuyu, marshallh, LaC, oman, pinchy, ziggy, FatCat, LegendOfDragoon and other folks I forgot. -The code comes under MAME license. -Sorry for my terrible English. - -angrylion diff --git a/angrylion-rdp-plus/MAME License.txt b/angrylion-rdp-plus/MAME License.txt deleted file mode 100644 index 6224204..0000000 --- a/angrylion-rdp-plus/MAME License.txt +++ /dev/null @@ -1,53 +0,0 @@ -MAME Legal Information -License - -Redistribution and use of the MAME code or any derivative works are permitted provided that the following conditions are met: - - * Redistributions may not be sold, nor may they be used in a commercial product or activity. - * Redistributions that are modified from the original source must include the complete source code, including the source code for all components used by a binary built from the modified sources. However, as a special exception, the source code 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. - * Redistributions must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Trademark - -MAME® is a registered trademark of Nicola Salmoria. The "MAME" name and MAME logo may not be used without first obtaining permission of the trademark holder. -Copyright - -The code in MAME is the work of hundreds of developers, each of whom owns the copyright to the code they wrote. There is no central copyright authority you can license the code from. The proper way to use the MAME source code is to examine it, using it to understand how the games worked, and then write your own emulation code. Sorry, there is no free lunch here. -Common Questions - -Q. Can I include MAME with my product? -A. No. MAME is not licensed for commercial use. Using MAME as a "freebie" or including it at "no cost" with your product still constitutes commerical usage and is forbidden by the license. - -Q. Can I sell my product with the MAME logo on it? -A. No. Putting the logo on your product makes it appear that the product is something officially endorsed by Nicola Salmoria, and constitutes trademark infringement. - -Q. Can I use the MAME logo to advertise my product? -A. No. Using the logo in your advertising makes it appear that the product is something officially endorsed by Nicola Salmoria, and constitutes trademark infringement. - -Q. Can I use the term "MAME" in the name of my software? -A. Generally, no, especially if it is something that is sold. However, if you are producing a free MAME-related piece of software, it is common that permission is granted. Send a query to double- check first, please. - -Q. Can I put an arcade cabinet running MAME in a public location? -A. No. This this a commercial use of MAME and is prohibited by the license. Even if you don't charge money, putting a machine in a public location is "operating" an arcade machine and falls under commercial rules in most locations. - -Q. Can my non-profit use MAME or an arcade cabinet running MAME to help raise money? -A. No, sorry. Even for the most worthwhile cause, this still is a commercial use of MAME and is prohibited by the license. - -Q. How do I obtain a license to the MAME source code? -A. You can't. See the Copyright section above. - -Q. Is it legal to download ROMs for a game when I own the PCB? -A. This is unclear and depends on where you live. In most cases you would need to obtain permission from the original manufacturer to do so. - -Q. What about the free ROMs on the MAME site? Can I use those with my product? -A. Almost all of the free ROMs on the MAME site are licensed only for non- commercial use, and only for distribution from the MAME site. Just because they are available for "free" here does not grant further redistribution rights, nor does it allow you to treat them as "freebies" for commercial use. - -Q. If I obtain a license from an original manufacturer to distribute the ROMs can I use MAME to run them? -A. Generally, no, because it constitutes a commercial use of MAME. However, we have in the past made a couple of exceptions for this particular case. We will not consider making any further exceptions without proof that such a license has already been obtained. - -Q. Can I use a PC running MAME to replace a real arcade PCB? -A. In order to do this you would have to use a copy of the original ROMs, which would require obtaining permission from the original manufacturer. Once you had permission from them, if it was used for non-commercial purposes, then you would not technically be violating the MAME license. However we still do not explicitly give permission to use MAME in this way because of the possibility of the game being sold sometime later, which would constitute commercial use of MAME. If you sell your game later you must sell it without MAME included. - -Q. Can I ask for donations for the work I did on my port of MAME to platform X? -A. No. You would be earning money from the MAME trademark and copyrights, and that would be a commercial use, which is prohibited by the license. It is our wish that MAME remain free. diff --git a/angrylion-rdp-plus/README.md b/angrylion-rdp-plus/README.md deleted file mode 100644 index 711767d..0000000 --- a/angrylion-rdp-plus/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Angrylion RDP Plus - -This is a conservative fork of angrylion's RDP plugin that aims to improve performance and add new features while retaining the accuracy of the original plugin. - -### Current features -* More maintainable code base by dividing the huge n64video.cpp into smaller pieces. -* Improved portability by separating the emulator plugin interface and window management from the RDP emulation core. -* Improved performance on multi-core CPUs by using multi-threaded rendering with scan line interleaving. -* Replaced deprecated DirectDraw interface with a modern OpenGL 3.3 implementation. -* Added fullscreen support and manual window sizing. -* Added BMP screenshot support. -* Added settings GUI. -* Added Mupen64Plus support. - -Tested with Project64 2.3+. May also work with Project64 1.7 with a RSP plugin of newer builds (1.7.1+). - -The Mupen64Plus plugin was tested with Mupen64Plus 2.5 using the [mupen64plus-rsp-cxd4](https://github.com/mupen64plus/mupen64plus-rsp-cxd4) plugin. - -### Building - -#### Visual Studio - -To build the project with Visual Studio (2015+), you currently need to have Python 3 installed, which is used to fetch Git metadata and write it to `version.h`. -You can also build without, but then you have to copy `version.h.in` to `version.h` and disable the custom build event in the core project. - -The glLoadGen files (`gl_core_3_3` and `wgl_ext`) were generated using the following parameters: - - lua LoadGen.lua core_3_3 -style=pointer_c -spec=gl -version=3.3 -profile=core - lua LoadGen.lua ext -style=pointer_c -spec=wgl -ext WGL_EXT_swap_control -ext ARB_create_context -ext ARB_create_context_profile - -#### CMake - -Install dependencies: - - apt install cmake freeglut3-dev - -Building: - - mkdir build - cd build - cmake .. - make - -To create an OpenGL ES 3 build, add ``-DGLES=ON`` to the cmake arguments. - -### Credits -* Angrylion, Ville Linde, MooglyGuy and others involved for creating an awesome N64 RDP reference software. -* theboy181 - Testing. Lots of testing. -* fallaha56 - Donator. -* loganmc10 - Mupen64Plus plugin implementation. diff --git a/angrylion-rdp-plus/make_version.py b/angrylion-rdp-plus/make_version.py deleted file mode 100755 index f975cc5..0000000 --- a/angrylion-rdp-plus/make_version.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os, subprocess - -def system(cmd, default): - args = cmd.split() - try: - return subprocess.check_output(args).decode("ascii").strip() - except: - return default - -if __name__ == "__main__": - branch = system("git rev-parse --abbrev-ref HEAD", "master") - hash = system("git show -s --format=%h", "0" * 40) - date = system("git show -s --format=%ci", "")[:10] - tag = system("git describe --dirty --always --tags", "") - - # remove hash from git describe output - tag = tag.split("-") - if len(tag) > 2 and tag[2][1:] in hash: - del tag[2] - tag = "-".join(tag) - - mappings = { - "GIT_BRANCH": branch, - "GIT_TAG": tag, - "GIT_COMMIT_HASH": hash, - "GIT_COMMIT_DATE": date, - } - - base_path = os.path.dirname(sys.argv[0]) - core_path = os.path.join(base_path, "src", "core") - in_path = os.path.join(core_path, "version.h.in") - out_path = os.path.join(core_path, "version.h") - - with open(in_path, "r") as f: - version_str = f.read() - - for mapping, value in mappings.items(): - version_str = version_str.replace("@" + mapping + "@", value) - - with open(out_path, "w") as f: - f.write(version_str) diff --git a/angrylion-rdp-plus/msvc/.gitignore b/angrylion-rdp-plus/msvc/.gitignore deleted file mode 100644 index 3a2238d..0000000 --- a/angrylion-rdp-plus/msvc/.gitignore +++ /dev/null @@ -1,245 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -[Xx]64/ -[Xx]86/ -[Bb]uild/ -bld/ -[Bb]in/ -[Oo]bj/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml - -# TODO: Un-comment the next line if you do not want to checkin -# your web deploy settings because they may include unencrypted -# passwords -#*.pubxml -*.publishproj - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Microsoft Azure ApplicationInsights config file -ApplicationInsights.config - -# Windows Store app package directory -AppPackages/ -BundleArtifacts/ - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# LightSwitch generated files -GeneratedArtifacts/ -ModelManifest.xml - -# Paket dependency manager -.paket/paket.exe - -# FAKE - F# Make -.fake/ \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/angrylion-plus.sln b/angrylion-rdp-plus/msvc/angrylion-plus.sln deleted file mode 100644 index 8ec2f41..0000000 --- a/angrylion-rdp-plus/msvc/angrylion-plus.sln +++ /dev/null @@ -1,68 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29806.167 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "core.vcxproj", "{D86C6E84-3371-4B20-8620-A703FF3F2CC5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin-mupen64plus", "plugin-mupen64plus.vcxproj", "{54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}" - ProjectSection(ProjectDependencies) = postProject - {D86C6E84-3371-4B20-8620-A703FF3F2CC5} = {D86C6E84-3371-4B20-8620-A703FF3F2CC5} - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE} = {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin-zilmar", "plugin-zilmar.vcxproj", "{722AD25D-C281-48FB-9A58-7699E50F8E6D}" - ProjectSection(ProjectDependencies) = postProject - {D86C6E84-3371-4B20-8620-A703FF3F2CC5} = {D86C6E84-3371-4B20-8620-A703FF3F2CC5} - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE} = {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "output", "output.vcxproj", "{B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Debug|x64.ActiveCfg = Debug|x64 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Debug|x64.Build.0 = Debug|x64 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Debug|x86.ActiveCfg = Debug|Win32 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Debug|x86.Build.0 = Debug|Win32 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Release|x64.ActiveCfg = Release|x64 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Release|x64.Build.0 = Release|x64 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Release|x86.ActiveCfg = Release|Win32 - {D86C6E84-3371-4B20-8620-A703FF3F2CC5}.Release|x86.Build.0 = Release|Win32 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Debug|x64.ActiveCfg = Debug|x64 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Debug|x64.Build.0 = Debug|x64 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Debug|x86.ActiveCfg = Debug|Win32 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Debug|x86.Build.0 = Debug|Win32 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Release|x64.ActiveCfg = Release|x64 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Release|x64.Build.0 = Release|x64 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Release|x86.ActiveCfg = Release|Win32 - {54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}.Release|x86.Build.0 = Release|Win32 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Debug|x64.ActiveCfg = Debug|x64 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Debug|x64.Build.0 = Debug|x64 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Debug|x86.ActiveCfg = Debug|Win32 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Debug|x86.Build.0 = Debug|Win32 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Release|x64.ActiveCfg = Release|x64 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Release|x64.Build.0 = Release|x64 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Release|x86.ActiveCfg = Release|Win32 - {722AD25D-C281-48FB-9A58-7699E50F8E6D}.Release|x86.Build.0 = Release|Win32 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Debug|x64.ActiveCfg = Debug|x64 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Debug|x64.Build.0 = Debug|x64 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Debug|x86.ActiveCfg = Debug|Win32 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Debug|x86.Build.0 = Debug|Win32 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Release|x64.ActiveCfg = Release|x64 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Release|x64.Build.0 = Release|x64 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Release|x86.ActiveCfg = Release|Win32 - {B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2896B5DF-D1A8-4A2B-BB7D-835C07F05863} - EndGlobalSection -EndGlobal diff --git a/angrylion-rdp-plus/msvc/core.vcxproj b/angrylion-rdp-plus/msvc/core.vcxproj deleted file mode 100644 index 0dc02e5..0000000 --- a/angrylion-rdp-plus/msvc/core.vcxproj +++ /dev/null @@ -1,338 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\core\n64video\rdp.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\blender.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\combiner.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\coverage.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\dither.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\fbuffer.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\rasterizer.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\rdram.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\tcoord.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\tex.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\tmem.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\zbuffer.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\divot.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\fetch.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\gamma.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\lerp.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\restore.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\video.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\src\core\parallel.cpp" /> - <ClCompile Include="..\src\core\n64video.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\core\common.h" /> - <ClInclude Include="..\src\core\msg.h" /> - <ClInclude Include="..\src\core\parallel.h" /> - <ClInclude Include="..\src\core\n64video.h" /> - </ItemGroup> - <ItemGroup> - <None Include="..\src\core\version.h.in" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{D86C6E84-3371-4B20-8620-A703FF3F2CC5}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''"> - <!-- Latest Target Version property --> - <LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> - <TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader /> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX86</TargetMachine> - </Link> - <PreBuildEvent> - <Command>python "$(SolutionDir)..\make_version.py"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - </Link> - <PreBuildEvent> - <Command>python "$(SolutionDir)..\make_version.py"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader /> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <IntrinsicFunctions>true</IntrinsicFunctions> - <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX86</TargetMachine> - </Link> - <PreBuildEvent> - <Command>python "$(SolutionDir)..\make_version.py"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader> - </PrecompiledHeader> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <IntrinsicFunctions>true</IntrinsicFunctions> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - </Link> - <PreBuildEvent> - <Command>python "$(SolutionDir)..\make_version.py"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/core.vcxproj.filters b/angrylion-rdp-plus/msvc/core.vcxproj.filters deleted file mode 100644 index ec0a550..0000000 --- a/angrylion-rdp-plus/msvc/core.vcxproj.filters +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{5467dd49-ff5e-4be4-93ad-8291721fc00d}</UniqueIdentifier> - <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{142a5325-573c-4fde-9d8f-af10cb6e28e5}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> - </Filter> - <Filter Include="Source Files\n64video"> - <UniqueIdentifier>{201fc67f-a10c-47a3-a9f6-47b9ccdf155a}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\n64video\vi"> - <UniqueIdentifier>{9ac263b1-1e35-44a3-8368-2c88ff3bb096}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\n64video\rdp"> - <UniqueIdentifier>{0def43d5-fe85-4dc1-9b3e-264603cca8fa}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\core\parallel.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\blender.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\combiner.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\coverage.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\dither.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\fbuffer.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\rasterizer.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\rdram.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\tcoord.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\tex.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\tmem.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp\zbuffer.c"> - <Filter>Source Files\n64video\rdp</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\divot.c"> - <Filter>Source Files\n64video\vi</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\fetch.c"> - <Filter>Source Files\n64video\vi</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\gamma.c"> - <Filter>Source Files\n64video\vi</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\lerp.c"> - <Filter>Source Files\n64video\vi</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\restore.c"> - <Filter>Source Files\n64video\vi</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi\video.c"> - <Filter>Source Files\n64video\vi</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\rdp.c"> - <Filter>Source Files\n64video</Filter> - </ClCompile> - <ClCompile Include="..\src\core\n64video\vi.c"> - <Filter>Source Files\n64video</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\core\common.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\core\msg.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\core\parallel.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\core\n64video.h"> - <Filter>Source Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <None Include="..\src\core\version.h.in"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/output.vcxproj b/angrylion-rdp-plus/msvc/output.vcxproj deleted file mode 100644 index ad64bfc..0000000 --- a/angrylion-rdp-plus/msvc/output.vcxproj +++ /dev/null @@ -1,217 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\output\gl_core_3_3.c" /> - <ClCompile Include="..\src\output\vdac.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\output\gl_core_3_3.h" /> - <ClInclude Include="..\src\output\gl_proc.h" /> - <ClInclude Include="..\src\output\screen.h" /> - <ClInclude Include="..\src\output\vdac.h" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{B74D5BAF-38F4-4233-9FC1-BE7E02E81FDE}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''"> - <!-- Latest Target Version property --> - <LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> - <TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader /> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX86</TargetMachine> - </Link> - <PreBuildEvent /> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - </Link> - <PreBuildEvent /> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader /> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <IntrinsicFunctions>true</IntrinsicFunctions> - <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX86</TargetMachine> - </Link> - <PreBuildEvent /> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader> - </PrecompiledHeader> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <IntrinsicFunctions>true</IntrinsicFunctions> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableSpecificWarnings>4204</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - </Link> - <PreBuildEvent /> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/output.vcxproj.filters b/angrylion-rdp-plus/msvc/output.vcxproj.filters deleted file mode 100644 index 0f3fc09..0000000 --- a/angrylion-rdp-plus/msvc/output.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\output\gl_core_3_3.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\output\vdac.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\output\gl_core_3_3.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\output\gl_proc.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\output\screen.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\output\vdac.h"> - <Filter>Source Files</Filter> - </ClInclude> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/plugin-mupen64plus.vcxproj b/angrylion-rdp-plus/msvc/plugin-mupen64plus.vcxproj deleted file mode 100644 index c62fed0..0000000 --- a/angrylion-rdp-plus/msvc/plugin-mupen64plus.vcxproj +++ /dev/null @@ -1,238 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_common.h" /> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_config.h" /> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_plugin.h" /> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_types.h" /> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_vidext.h" /> - <ClInclude Include="..\src\plugin\mupen64plus\gfx_m64p.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\plugin\mupen64plus\gfx_m64p.c" /> - <ClCompile Include="..\src\plugin\mupen64plus\msg.c" /> - <ClCompile Include="..\src\plugin\mupen64plus\screen.c" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{54BDC4EF-2526-47F7-A73E-C1C0FBC0237C}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''"> - <!-- Latest Target Version property --> - <LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> - <TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - <TargetName>mupen64plus-video-$(SolutionName)</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>mupen64plus-video-$(SolutionName)</TargetName> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - <TargetName>mupen64plus-video-$(SolutionName)</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>mupen64plus-video-$(SolutionName)</TargetName> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader /> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4201</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention /> - <TargetMachine>MachineX86</TargetMachine> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4201</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BasicRuntimeChecks>Default</BasicRuntimeChecks> - <SmallerTypeCheck>false</SmallerTypeCheck> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader /> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <IntrinsicFunctions>true</IntrinsicFunctions> - <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableSpecificWarnings>4201</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention /> - <TargetMachine>MachineX86</TargetMachine> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BasicRuntimeChecks>Default</BasicRuntimeChecks> - <SmallerTypeCheck>false</SmallerTypeCheck> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader> - </PrecompiledHeader> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <IntrinsicFunctions>true</IntrinsicFunctions> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableSpecificWarnings>4201</DisableSpecificWarnings> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/plugin-mupen64plus.vcxproj.filters b/angrylion-rdp-plus/msvc/plugin-mupen64plus.vcxproj.filters deleted file mode 100644 index e00219c..0000000 --- a/angrylion-rdp-plus/msvc/plugin-mupen64plus.vcxproj.filters +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{5467dd49-ff5e-4be4-93ad-8291721fc00d}</UniqueIdentifier> - <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{142a5325-573c-4fde-9d8f-af10cb6e28e5}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> - </Filter> - <Filter Include="Source Files\api"> - <UniqueIdentifier>{363d4ce3-41b8-4b23-8739-7618a5da0345}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_common.h"> - <Filter>Source Files\api</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_config.h"> - <Filter>Source Files\api</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_plugin.h"> - <Filter>Source Files\api</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_types.h"> - <Filter>Source Files\api</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\mupen64plus\api\m64p_vidext.h"> - <Filter>Source Files\api</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\mupen64plus\gfx_m64p.h"> - <Filter>Source Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\plugin\mupen64plus\gfx_m64p.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\plugin\mupen64plus\msg.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\plugin\mupen64plus\screen.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/plugin-zilmar.vcxproj b/angrylion-rdp-plus/msvc/plugin-zilmar.vcxproj deleted file mode 100644 index 929811a..0000000 --- a/angrylion-rdp-plus/msvc/plugin-zilmar.vcxproj +++ /dev/null @@ -1,241 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="..\src\plugin\zilmar\config.rc" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\plugin\zilmar\config.c" /> - <ClCompile Include="..\src\plugin\zilmar\gfx_1.3.c" /> - <ClCompile Include="..\src\plugin\zilmar\msg.c" /> - <ClCompile Include="..\src\plugin\zilmar\screen.c" /> - <ClCompile Include="..\src\plugin\zilmar\wgl_ext.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\plugin\zilmar\config.h" /> - <ClInclude Include="..\src\plugin\zilmar\gfx_1.3.h" /> - <ClInclude Include="..\src\plugin\zilmar\resource.h" /> - <ClInclude Include="..\src\plugin\zilmar\wgl_ext.h" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{722AD25D-C281-48FB-9A58-7699E50F8E6D}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''"> - <!-- Latest Target Version property --> - <LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> - <TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - <TargetName>$(SolutionName)</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>$(SolutionName)</TargetName> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - <TargetName>$(SolutionName)</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>$(SolutionName)</TargetName> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> - <IntDir>$(SolutionDir)build\$(Configuration)\$(ProjectName)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader /> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention /> - <ImportLibrary>$(OutDir)angrylion.lib</ImportLibrary> - <TargetMachine>MachineX86</TargetMachine> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <ImportLibrary>$(OutDir)angrylion.lib</ImportLibrary> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BasicRuntimeChecks>Default</BasicRuntimeChecks> - <SmallerTypeCheck>false</SmallerTypeCheck> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader /> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <IntrinsicFunctions>true</IntrinsicFunctions> - <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention /> - <ImportLibrary>$(OutDir)angrylion.lib</ImportLibrary> - <TargetMachine>MachineX86</TargetMachine> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <OmitFramePointers>true</OmitFramePointers> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BasicRuntimeChecks>Default</BasicRuntimeChecks> - <SmallerTypeCheck>false</SmallerTypeCheck> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader> - </PrecompiledHeader> - <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <FloatingPointModel>Fast</FloatingPointModel> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <IntrinsicFunctions>true</IntrinsicFunctions> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <GenerateMapFile>true</GenerateMapFile> - <MapExports>true</MapExports> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <ImportLibrary>$(OutDir)angrylion.lib</ImportLibrary> - <AdditionalDependencies>opengl32.lib;core.lib;output.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/msvc/plugin-zilmar.vcxproj.filters b/angrylion-rdp-plus/msvc/plugin-zilmar.vcxproj.filters deleted file mode 100644 index a700750..0000000 --- a/angrylion-rdp-plus/msvc/plugin-zilmar.vcxproj.filters +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{5467dd49-ff5e-4be4-93ad-8291721fc00d}</UniqueIdentifier> - <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{142a5325-573c-4fde-9d8f-af10cb6e28e5}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\plugin\zilmar\config.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\plugin\zilmar\gfx_1.3.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\plugin\zilmar\msg.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\plugin\zilmar\screen.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\plugin\zilmar\wgl_ext.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\src\plugin\zilmar\config.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\zilmar\gfx_1.3.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\zilmar\resource.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\src\plugin\zilmar\wgl_ext.h"> - <Filter>Source Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="..\src\plugin\zilmar\config.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/angrylion-rdp-plus/src/core/common.h b/angrylion-rdp-plus/src/core/common.h deleted file mode 100644 index 2c56bc1..0000000 --- a/angrylion-rdp-plus/src/core/common.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -// endianness -#define LSB_FIRST 1 -#ifdef LSB_FIRST - #define BYTE_ADDR_XOR 3 - #define WORD_ADDR_XOR 1 - #define BYTE4_XOR_BE(a) ((a) ^ BYTE_ADDR_XOR) -#else - #define BYTE_ADDR_XOR 0 - #define WORD_ADDR_XOR 0 - #define BYTE4_XOR_BE(a) (a) -#endif - -#ifdef LSB_FIRST - #define BYTE_XOR_DWORD_SWAP 7 - #define WORD_XOR_DWORD_SWAP 3 -#else - #define BYTE_XOR_DWORD_SWAP 4 - #define WORD_XOR_DWORD_SWAP 2 -#endif - -#define DWORD_XOR_DWORD_SWAP 1 - -// inlining -#define INLINE inline - -#ifdef _MSC_VER -#define STRICTINLINE __forceinline -#elif defined(__GNUC__) -#define STRICTINLINE __attribute__((always_inline)) inline -#else -#define STRICTINLINE inline -#endif - -// misc -#define UNUSED(x) (void)(x) diff --git a/angrylion-rdp-plus/src/core/msg.h b/angrylion-rdp-plus/src/core/msg.h deleted file mode 100644 index d5edbc3..0000000 --- a/angrylion-rdp-plus/src/core/msg.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -void msg_error(const char * err, ...); -void msg_warning(const char* err, ...); -void msg_debug(const char* err, ...); diff --git a/angrylion-rdp-plus/src/core/n64video.c b/angrylion-rdp-plus/src/core/n64video.c deleted file mode 100644 index 327969b..0000000 --- a/angrylion-rdp-plus/src/core/n64video.c +++ /dev/null @@ -1,321 +0,0 @@ -#include "n64video.h" -#include "common.h" -#include "msg.h" -#include "parallel.h" - -#include <memory.h> -#include <string.h> -#include <stdlib.h> -#include <stdio.h> - -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#define CLAMP(x, lo, hi) (((x) > (hi)) ? (hi) : (((x) < (lo)) ? (lo) : (x))) - -#define SIGN16(x) ((int16_t)(x)) -#define SIGN8(x) ((int8_t)(x)) - -#define SIGN(x, numb) (((x) & ((1 << (numb)) - 1)) | -((x) & (1 << ((numb) - 1)))) -#define SIGNF(x, numb) ((x) | -((x) & (1 << ((numb) - 1)))) - -#define TRELATIVE(x, y) ((x) - ((y) << 3)) - -#define PIXELS_TO_BYTES(pix, siz) (((pix) << (siz)) >> 1) - -// RGBA5551 to RGBA8888 helper -#define RGBA16_R(x) (((x) >> 8) & 0xf8) -#define RGBA16_G(x) (((x) & 0x7c0) >> 3) -#define RGBA16_B(x) (((x) & 0x3e) << 2) - -// RGBA8888 helper -#define RGBA32_R(x) (((x) >> 24) & 0xff) -#define RGBA32_G(x) (((x) >> 16) & 0xff) -#define RGBA32_B(x) (((x) >> 8) & 0xff) -#define RGBA32_A(x) ((x) & 0xff) - -// maximum number of commands to buffer for parallel processing -#define CMD_BUFFER_SIZE 1024 - -// maximum data size of a single command in bytes -#define CMD_MAX_SIZE 176 - -// maximum data size of a single command in 32 bit integers -#define CMD_MAX_INTS (CMD_MAX_SIZE / sizeof(int32_t)) - -// extracts the command ID from a command buffer -#define CMD_ID(cmd) ((*(cmd) >> 24) & 0x3f) - -// list of command IDs -#define CMD_ID_NO_OP 0x00 -#define CMD_ID_FILL_TRIANGLE 0x08 -#define CMD_ID_FILL_ZBUFFER_TRIANGLE 0x09 -#define CMD_ID_TEXTURE_TRIANGLE 0x0a -#define CMD_ID_TEXTURE_ZBUFFER_TRIANGLE 0x0b -#define CMD_ID_SHADE_TRIANGLE 0x0c -#define CMD_ID_SHADE_ZBUFFER_TRIANGLE 0x0d -#define CMD_ID_SHADE_TEXTURE_TRIANGLE 0x0e -#define CMD_ID_SHADE_TEXTURE_Z_BUFFER_TRIANGLE 0x0f -#define CMD_ID_TEXTURE_RECTANGLE 0x24 -#define CMD_ID_TEXTURE_RECTANGLE_FLIP 0x25 -#define CMD_ID_SYNC_LOAD 0x26 -#define CMD_ID_SYNC_PIPE 0x27 -#define CMD_ID_SYNC_TILE 0x28 -#define CMD_ID_SYNC_FULL 0x29 -#define CMD_ID_SET_KEY_GB 0x2a -#define CMD_ID_SET_KEY_R 0x2b -#define CMD_ID_SET_CONVERT 0x2c -#define CMD_ID_SET_SCISSOR 0x2d -#define CMD_ID_SET_PRIM_DEPTH 0x2e -#define CMD_ID_SET_OTHER_MODES 0x2f -#define CMD_ID_LOAD_TLUT 0x30 -#define CMD_ID_SET_TILE_SIZE 0x32 -#define CMD_ID_LOAD_BLOCK 0x33 -#define CMD_ID_LOAD_TILE 0x34 -#define CMD_ID_SET_TILE 0x35 -#define CMD_ID_FILL_RECTANGLE 0x36 -#define CMD_ID_SET_FILL_COLOR 0x37 -#define CMD_ID_SET_FOG_COLOR 0x38 -#define CMD_ID_SET_BLEND_COLOR 0x39 -#define CMD_ID_SET_PRIM_COLOR 0x3a -#define CMD_ID_SET_ENV_COLOR 0x3b -#define CMD_ID_SET_COMBINE 0x3c -#define CMD_ID_SET_TEXTURE_IMAGE 0x3d -#define CMD_ID_SET_MASK_IMAGE 0x3e -#define CMD_ID_SET_COLOR_IMAGE 0x3f - -static struct n64video_config config; - -static struct -{ - bool fillmbitcrashes, vbusclock, nolerp; -} onetimewarnings; - -static int rdp_pipeline_crashed = 0; - -static STRICTINLINE int32_t clamp(int32_t value, int32_t min, int32_t max) -{ - if (value < min) - return min; - else if (value > max) - return max; - else - return value; -} - -static STRICTINLINE uint32_t irand(uint32_t* state) -{ - *state = *state * 0x343fd + 0x269ec3; - return ((*state >> 16) & 0x7fff); -} - -// include guard to prevent compilation of code modules -// as translation units -#define N64VIDEO_C - -#include "n64video/rdp.c" -#include "n64video/vi.c" - -static uint32_t rdp_cmd_buf[CMD_BUFFER_SIZE][CMD_MAX_INTS]; -static uint32_t rdp_cmd_buf_pos; - -static uint32_t rdp_cmd_pos; -static uint32_t rdp_cmd_id; -static uint32_t rdp_cmd_len; - -// table of commands that require thread synchronization in -// multithreaded mode -static bool rdp_cmd_sync[64]; - -static void cmd_run_buffered(uint32_t worker_id) -{ - uint32_t pos; - for (pos = 0; pos < rdp_cmd_buf_pos; pos++) { - rdp_cmd(&state[worker_id], rdp_cmd_buf[pos]); - } -} - -static void cmd_flush(void) -{ - // only run if there's something buffered - if (rdp_cmd_buf_pos) { - // let workers run all buffered commands in parallel - parallel_run(cmd_run_buffered); - // reset buffer by starting from the beginning - rdp_cmd_buf_pos = 0; - } -} - -static void cmd_init(void) -{ - rdp_cmd_pos = 0; - rdp_cmd_id = 0; - rdp_cmd_len = CMD_MAX_INTS; -} - -void n64video_config_init(struct n64video_config* conf) -{ - memset(conf, 0, sizeof(*conf)); - - // config defaults that aren't false or 0 - conf->parallel = true; - conf->vi.vsync = true; - conf->vi.interp = VI_INTERP_HYBRID; -} - -static void n64video_init_parallel(uint32_t worker_id) -{ - struct rdp_state* wstate = &state[worker_id]; - - wstate->stride = parallel_num_workers(); - wstate->offset = worker_id; - wstate->rseed = 3 + worker_id * 13; -} - -void n64video_init(struct n64video_config* _config) -{ - if (_config) { - config = *_config; - } - - // initialize static lookup tables and RDP state, once is enough - static bool static_init; - if (!static_init) { - blender_init_lut(); - coverage_init_lut(); - combiner_init_lut(); - tex_init_lut(); - z_init_lut(); - - for (uint32_t i = 1; i < PARALLEL_MAX_WORKERS; i++) { - rdp_init(&state[i]); - } - - static_init = true; - } - - // enable sync switches depending on compatibility mode - memset(rdp_cmd_sync, 0, sizeof(rdp_cmd_sync)); - switch (config.dp.compat) { - case DP_COMPAT_HIGH: - rdp_cmd_sync[CMD_ID_SET_TEXTURE_IMAGE] = true; - case DP_COMPAT_MEDIUM: - rdp_cmd_sync[CMD_ID_SET_MASK_IMAGE] = true; - rdp_cmd_sync[CMD_ID_SET_COLOR_IMAGE] = true; - case DP_COMPAT_LOW: - rdp_cmd_sync[CMD_ID_SYNC_FULL] = true; - } - - // init internals - rdram_init(); - vi_init(); - cmd_init(); - - rdp_pipeline_crashed = 0; - memset(&onetimewarnings, 0, sizeof(onetimewarnings)); - - if (config.parallel) { - // init worker system, use busy looping - parallel_init(config.num_workers, config.busyloop); - - // sync states from main worker - for (uint32_t i = 1; i < parallel_num_workers(); i++) { - memcpy(&state[i], &state[0], sizeof(struct rdp_state)); - } - - // init workers - parallel_run(n64video_init_parallel); - } else { - struct rdp_state* wstate = &state[0]; - wstate->stride = 1; - wstate->offset = 0; - wstate->rseed = 3; - } -} - -void n64video_process_list(void) -{ - uint32_t** dp_reg = config.gfx.dp_reg; - uint32_t dp_current_al = (*dp_reg[DP_CURRENT] & ~7) >> 2; - uint32_t dp_end_al = (*dp_reg[DP_END] & ~7) >> 2; - - // don't do anything if the RDP has crashed or the registers are not set up correctly - if (rdp_pipeline_crashed || dp_end_al <= dp_current_al) { - return; - } - - // while there's data in the command buffer... - while (dp_end_al - dp_current_al > 0) { - uint32_t i, toload; - bool xbus_dma = (*dp_reg[DP_STATUS] & DP_STATUS_XBUS_DMA) != 0; - uint32_t* dmem = (uint32_t*)config.gfx.dmem; - uint32_t* cmd_buf = rdp_cmd_buf[rdp_cmd_buf_pos]; - - // when reading the first int, extract the command ID and update the buffer length - if (rdp_cmd_pos == 0) { - if (xbus_dma) { - cmd_buf[rdp_cmd_pos++] = dmem[dp_current_al++ & 0x3ff]; - } else { - cmd_buf[rdp_cmd_pos++] = rdram_read_idx32(dp_current_al++); - } - - rdp_cmd_id = CMD_ID(cmd_buf); - rdp_cmd_len = rdp_commands[rdp_cmd_id].length >> 2; - } - - // copy more data from the N64 to the local command buffer - toload = MIN(dp_end_al - dp_current_al, rdp_cmd_len - 1); - - if (xbus_dma) { - for (i = 0; i < toload; i++) { - cmd_buf[rdp_cmd_pos++] = dmem[dp_current_al++ & 0x3ff]; - } - } else { - for (i = 0; i < toload; i++) { - cmd_buf[rdp_cmd_pos++] = rdram_read_idx32(dp_current_al++); - } - } - - // if there's enough data for the current command... - if (rdp_cmd_pos == rdp_cmd_len) { - // check if parallel processing is enabled - if (config.parallel) { - // special case: sync_full always needs to be run in main thread - if (rdp_cmd_id == CMD_ID_SYNC_FULL) { - // first, run all pending commands - cmd_flush(); - - // parameters are unused, so NULL is fine - rdp_sync_full(NULL, NULL); - } else { - // increment buffer position - rdp_cmd_buf_pos++; - - // flush buffer when it is full or when the current command requires a sync - if (rdp_cmd_buf_pos >= CMD_BUFFER_SIZE || rdp_cmd_sync[rdp_cmd_id]) { - cmd_flush(); - } - } - } else { - // run command directly - rdp_cmd(&state[0], cmd_buf); - } - - // send Z-buffer address to VI for "depth" output mode - if (rdp_cmd_id == CMD_ID_SET_MASK_IMAGE) { - vi_set_zbuffer_address(cmd_buf[1] & 0x0ffffff); - } - - // reset current command buffer to prepare for the next one - cmd_init(); - } - } - - // update DP registers to indicate that all bytes have been read - *dp_reg[DP_START] = *dp_reg[DP_CURRENT] = *dp_reg[DP_END]; -} - -void n64video_close(void) -{ - vi_close(); - parallel_close(); -} diff --git a/angrylion-rdp-plus/src/core/n64video.h b/angrylion-rdp-plus/src/core/n64video.h deleted file mode 100644 index f01d031..0000000 --- a/angrylion-rdp-plus/src/core/n64video.h +++ /dev/null @@ -1,117 +0,0 @@ -#pragma once - -#include <stdint.h> -#include <stdbool.h> - -#define RDRAM_MAX_SIZE 0x800000 - -// register enums -enum dp_register -{ - DP_START, - DP_END, - DP_CURRENT, - DP_STATUS, - DP_CLOCK, - DP_BUFBUSY, - DP_PIPEBUSY, - DP_TMEM, - DP_NUM_REG -}; - -enum vi_register -{ - VI_STATUS, // aka VI_CONTROL - VI_ORIGIN, // aka VI_DRAM_ADDR - VI_WIDTH, - VI_INTR, - VI_V_CURRENT_LINE, - VI_TIMING, - VI_V_SYNC, - VI_H_SYNC, - VI_LEAP, // aka VI_H_SYNC_LEAP - VI_H_START, // aka VI_H_VIDEO - VI_V_START, // aka VI_V_VIDEO - VI_V_BURST, - VI_X_SCALE, - VI_Y_SCALE, - VI_NUM_REG -}; - -// config enums -enum vi_mode -{ - VI_MODE_NORMAL, // color buffer with VI filter - VI_MODE_COLOR, // direct color buffer, unfiltered - VI_MODE_DEPTH, // depth buffer as grayscale - VI_MODE_COVERAGE, // coverage as grayscale - VI_MODE_NUM -}; - -enum vi_interp -{ - VI_INTERP_NEAREST, - VI_INTERP_LINEAR, - VI_INTERP_HYBRID, - VI_INTERP_NUM -}; - -enum dp_compat_profile -{ - DP_COMPAT_LOW, - DP_COMPAT_MEDIUM, - DP_COMPAT_HIGH, - DP_COMPAT_NUM -}; - -struct n64video_pixel -{ - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; -}; - -struct n64video_frame_buffer -{ - struct n64video_pixel* pixels; - uint32_t width; - uint32_t height; - uint32_t height_out; - uint32_t pitch; - bool valid; -}; - -struct n64video_config -{ - struct { - uint8_t* rdram; // RDRAM pointer - uint32_t rdram_size; // size of RDRAM, typically 4 or 8 MiB - uint8_t* dmem; // RSP data memory pointer - uint32_t** vi_reg; // video interface registers - uint32_t** dp_reg; // display processor registers - uint32_t* mi_intr_reg; // MIPS interface interrupt register - void (*mi_intr_cb)(void); // interrupt callback function - } gfx; - struct { - enum vi_mode mode; // output mode - enum vi_interp interp; // output interpolation method - bool widescreen; // force 16:9 aspect ratio if true - bool hide_overscan; // crop to visible area if true - bool vsync; // enable vsync if true - bool exclusive; // run in exclusive mode when in fullscreen if true - bool integer_scaling; // one native pixel is displayed as a multiple of a screen pixel if true - } vi; - struct { - enum dp_compat_profile compat; // multithreading compatibility mode - } dp; - bool parallel; // use multithreaded renderer if true - bool busyloop; // use a busyloop while waiting for work - uint32_t num_workers; // number of rendering workers -}; - -void n64video_config_init(struct n64video_config* config); -void n64video_init(struct n64video_config* config); -void n64video_update_screen(struct n64video_frame_buffer* fb); -void n64video_process_list(void); -void n64video_close(void); diff --git a/angrylion-rdp-plus/src/core/n64video/rdp.c b/angrylion-rdp-plus/src/core/n64video/rdp.c deleted file mode 100644 index 8b13e4c..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp.c +++ /dev/null @@ -1,672 +0,0 @@ -#ifdef N64VIDEO_C - -// bit constants for DP_STATUS -#define DP_STATUS_XBUS_DMA 0x001 // DMEM DMA mode is set -#define DP_STATUS_FREEZE 0x002 // Freeze has been set -#define DP_STATUS_FLUSH 0x004 // Flush has been set -#define DP_STATUS_START_GCLK 0x008 // Unknown -#define DP_STATUS_TMEM_BUSY 0x010 // TMEM is in use on the RDP -#define DP_STATUS_PIPE_BUSY 0x020 // Graphics pipe is in use on the RDP -#define DP_STATUS_CMD_BUSY 0x040 // RDP is currently executing a command -#define DP_STATUS_CBUF_BUSY 0x080 // RDRAM RDP command buffer is in use -#define DP_STATUS_DMA_BUSY 0x100 // DMEM RDP command buffer is in use -#define DP_STATUS_END_VALID 0x200 // Unknown -#define DP_STATUS_START_VALID 0x400 // Unknown - -#define PIXEL_SIZE_4BIT 0 -#define PIXEL_SIZE_8BIT 1 -#define PIXEL_SIZE_16BIT 2 -#define PIXEL_SIZE_32BIT 3 - -#define CYCLE_TYPE_1 0 -#define CYCLE_TYPE_2 1 -#define CYCLE_TYPE_COPY 2 -#define CYCLE_TYPE_FILL 3 - - -#define FORMAT_RGBA 0 -#define FORMAT_YUV 1 -#define FORMAT_CI 2 -#define FORMAT_IA 3 -#define FORMAT_I 4 - - -#define TEXEL_RGBA4 0 -#define TEXEL_RGBA8 1 -#define TEXEL_RGBA16 2 -#define TEXEL_RGBA32 3 -#define TEXEL_YUV4 4 -#define TEXEL_YUV8 5 -#define TEXEL_YUV16 6 -#define TEXEL_YUV32 7 -#define TEXEL_CI4 8 -#define TEXEL_CI8 9 -#define TEXEL_CI16 0xa -#define TEXEL_CI32 0xb -#define TEXEL_IA4 0xc -#define TEXEL_IA8 0xd -#define TEXEL_IA16 0xe -#define TEXEL_IA32 0xf -#define TEXEL_I4 0x10 -#define TEXEL_I8 0x11 -#define TEXEL_I16 0x12 -#define TEXEL_I32 0x13 - - -#define SP_INTERRUPT 0x1 -#define SI_INTERRUPT 0x2 -#define AI_INTERRUPT 0x4 -#define VI_INTERRUPT 0x8 -#define PI_INTERRUPT 0x10 -#define DP_INTERRUPT 0x20 - -struct color -{ - int32_t r, g, b, a; -}; - -struct rectangle -{ - uint16_t xl, yl, xh, yh; -}; - -struct other_modes -{ - int cycle_type; - int persp_tex_en; - int detail_tex_en; - int sharpen_tex_en; - int tex_lod_en; - int en_tlut; - int tlut_type; - int sample_type; - int mid_texel; - int bi_lerp0; - int bi_lerp1; - int convert_one; - int key_en; - int rgb_dither_sel; - int alpha_dither_sel; - int blend_m1a_0; - int blend_m1a_1; - int blend_m1b_0; - int blend_m1b_1; - int blend_m2a_0; - int blend_m2a_1; - int blend_m2b_0; - int blend_m2b_1; - int force_blend; - int alpha_cvg_select; - int cvg_times_alpha; - int z_mode; - int cvg_dest; - int color_on_cvg; - int image_read_en; - int z_update_en; - int z_compare_en; - int antialias_en; - int z_source_sel; - int dither_alpha_en; - int alpha_compare_en; - - struct - { - int stalederivs; - int dolod; - int partialreject_1cycle; - int partialreject_2cycle; - int rgb_alpha_dither; - int realblendershiftersneeded; - int interpixelblendershiftersneeded; - int getditherlevel; - int textureuselevel0; - int textureuselevel1; - } f; -}; - -struct spansigs -{ - int endspan; - int preendspan; - int nextspan; - int midspan; - int longspan; - int onelessthanmid; -}; - -struct tile -{ - int format; - int size; - int line; - int tmem; - int palette; - int ct, mt, cs, ms; - int mask_t, shift_t, mask_s, shift_s; - - uint16_t sl, tl, sh, th; - - struct - { - int clampdiffs, clampdifft; - int clampens, clampent; - int masksclamped, masktclamped; - int notlutswitch, tlutswitch; - } f; -}; - -struct span -{ - int lx, rx; - int unscrx; - int validline; - int32_t r, g, b, a, s, t, w, z; - int32_t majorx[4]; - int32_t minorx[4]; - int32_t invalyscan[4]; -}; - -struct combiner_inputs -{ - int sub_a_rgb0; - int sub_b_rgb0; - int mul_rgb0; - int add_rgb0; - int sub_a_a0; - int sub_b_a0; - int mul_a0; - int add_a0; - - int sub_a_rgb1; - int sub_b_rgb1; - int mul_rgb1; - int add_rgb1; - int sub_a_a1; - int sub_b_a1; - int mul_a1; - int add_a1; -}; - -struct rdp_state -{ - uint32_t stride; - uint32_t offset; - - int blshifta; - int blshiftb; - int pastblshifta; - int pastblshiftb; - - struct span span[1024]; - - // span states - int spans_ds; - int spans_dt; - int spans_dw; - int spans_dr; - int spans_dg; - int spans_db; - int spans_da; - int spans_dz; - int spans_dzpix; - - int spans_drdy; - int spans_dgdy; - int spans_dbdy; - int spans_dady; - int spans_dzdy; - int spans_cdr; - int spans_cdg; - int spans_cdb; - int spans_cda; - int spans_cdz; - - int spans_dsdy; - int spans_dtdy; - int spans_dwdy; - - struct other_modes other_modes; - - struct color combined_color; - struct color texel0_color; - struct color texel1_color; - struct color nexttexel_color; - struct color shade_color; - int32_t noise; - int32_t primitive_lod_frac; - - struct color pixel_color; - struct color memory_color; - struct color pre_memory_color; - - struct tile tile[8]; - - int32_t k0_tf; - int32_t k1_tf; - int32_t k2_tf; - int32_t k3_tf; - int32_t k4; - int32_t k5; - int32_t lod_frac; - - uint32_t max_level; - int32_t min_level; - - // irand - uint32_t rseed; - - // blender - int32_t *blender1a_r[2]; - int32_t *blender1a_g[2]; - int32_t *blender1a_b[2]; - int32_t *blender1b_a[2]; - int32_t *blender2a_r[2]; - int32_t *blender2a_g[2]; - int32_t *blender2a_b[2]; - int32_t *blender2b_a[2]; - - int32_t blender_shade_alpha; - - struct color blend_color; - struct color fog_color; - struct color inv_pixel_color; - struct color blended_pixel_color; - - // combiner - struct combiner_inputs combine; - - int32_t *combiner_rgbsub_a_r[2]; - int32_t *combiner_rgbsub_a_g[2]; - int32_t *combiner_rgbsub_a_b[2]; - int32_t *combiner_rgbsub_b_r[2]; - int32_t *combiner_rgbsub_b_g[2]; - int32_t *combiner_rgbsub_b_b[2]; - int32_t *combiner_rgbmul_r[2]; - int32_t *combiner_rgbmul_g[2]; - int32_t *combiner_rgbmul_b[2]; - int32_t *combiner_rgbadd_r[2]; - int32_t *combiner_rgbadd_g[2]; - int32_t *combiner_rgbadd_b[2]; - - int32_t *combiner_alphasub_a[2]; - int32_t *combiner_alphasub_b[2]; - int32_t *combiner_alphamul[2]; - int32_t *combiner_alphaadd[2]; - - struct color prim_color; - struct color env_color; - struct color key_scale; - struct color key_center; - struct color key_width; - - int32_t keyalpha; - - // tcoord - void (*tcdiv_ptr)(int32_t, int32_t, int32_t, int32_t*, int32_t*); - - // fbuffer - void (*fbread1_ptr)(struct rdp_state*, uint32_t, uint32_t*); - void (*fbread2_ptr)(struct rdp_state*, uint32_t, uint32_t*); - void (*fbwrite_ptr)(struct rdp_state*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); - - int fb_format; - int fb_size; - int fb_width; - uint32_t fb_address; - uint32_t fill_color; - - // rasterizer - struct rectangle clip; - int scfield; - int sckeepodd; - - uint32_t primitive_z; - uint16_t primitive_delta_z; - - // tex - int ti_format; - int ti_size; - int ti_width; - uint32_t ti_address; - - // coverage - uint8_t cvgbuf[1024]; - - // tmem - uint8_t tmem[0x1000]; - - // zbuffer - uint32_t zb_address; - int32_t pastrawdzmem; -}; - -struct rdp_state state[PARALLEL_MAX_WORKERS]; - -static int32_t one_color = 0x100; -static int32_t zero_color = 0x00; - -void rdp_init(struct rdp_state* wstate); -void rdp_invalid(struct rdp_state* wstate, const uint32_t* args); -void rdp_noop(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_noshade(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_noshade_z(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_tex(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_tex_z(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_shade(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_shade_z(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_texshade(struct rdp_state* wstate, const uint32_t* args); -void rdp_tri_texshade_z(struct rdp_state* wstate, const uint32_t* args); -void rdp_tex_rect(struct rdp_state* wstate, const uint32_t* args); -void rdp_tex_rect_flip(struct rdp_state* wstate, const uint32_t* args); -void rdp_sync_load(struct rdp_state* wstate, const uint32_t* args); -void rdp_sync_pipe(struct rdp_state* wstate, const uint32_t* args); -void rdp_sync_tile(struct rdp_state* wstate, const uint32_t* args); -void rdp_sync_full(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_key_gb(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_key_r(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_convert(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_scissor(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_prim_depth(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_other_modes(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_tile_size(struct rdp_state* wstate, const uint32_t* args); -void rdp_load_block(struct rdp_state* wstate, const uint32_t* args); -void rdp_load_tlut(struct rdp_state* wstate, const uint32_t* args); -void rdp_load_tile(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_tile(struct rdp_state* wstate, const uint32_t* args); -void rdp_fill_rect(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_fill_color(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_fog_color(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_blend_color(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_prim_color(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_env_color(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_combine(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_texture_image(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_mask_image(struct rdp_state* wstate, const uint32_t* args); -void rdp_set_color_image(struct rdp_state* wstate, const uint32_t* args); -void rdp_cmd(struct rdp_state* wstate, const uint32_t* args); - -static const struct -{ - // command handler function pointer - void (*handler)(struct rdp_state* wstate, const uint32_t*); - // command data length in bytes - uint32_t length; -} rdp_commands[] = { - {rdp_noop, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_tri_noshade, 32}, - {rdp_tri_noshade_z, 48}, - {rdp_tri_tex, 96}, - {rdp_tri_tex_z, 112}, - {rdp_tri_shade, 96}, - {rdp_tri_shade_z, 112}, - {rdp_tri_texshade, 160}, - {rdp_tri_texshade_z, 176}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_invalid, 8}, - {rdp_tex_rect, 16}, - {rdp_tex_rect_flip, 16}, - {rdp_sync_load, 8}, - {rdp_sync_pipe, 8}, - {rdp_sync_tile, 8}, - {rdp_sync_full, 8}, - {rdp_set_key_gb, 8}, - {rdp_set_key_r, 8}, - {rdp_set_convert, 8}, - {rdp_set_scissor, 8}, - {rdp_set_prim_depth, 8}, - {rdp_set_other_modes, 8}, - {rdp_load_tlut, 8}, - {rdp_invalid, 8}, - {rdp_set_tile_size, 8}, - {rdp_load_block, 8}, - {rdp_load_tile, 8}, - {rdp_set_tile, 8}, - {rdp_fill_rect, 8}, - {rdp_set_fill_color, 8}, - {rdp_set_fog_color, 8}, - {rdp_set_blend_color, 8}, - {rdp_set_prim_color, 8}, - {rdp_set_env_color, 8}, - {rdp_set_combine, 8}, - {rdp_set_texture_image, 8}, - {rdp_set_mask_image, 8}, - {rdp_set_color_image, 8} -}; - -static void deduce_derivatives(struct rdp_state* wstate); - -#include "rdp/rdram.c" -#include "rdp/dither.c" -#include "rdp/blender.c" -#include "rdp/combiner.c" -#include "rdp/coverage.c" -#include "rdp/zbuffer.c" -#include "rdp/fbuffer.c" -#include "rdp/tmem.c" -#include "rdp/tcoord.c" -#include "rdp/tex.c" -#include "rdp/rasterizer.c" - -static void deduce_derivatives(struct rdp_state* wstate) -{ - int special_bsel0, special_bsel1; - - - wstate->other_modes.f.partialreject_1cycle = (wstate->blender2b_a[0] == &wstate->inv_pixel_color.a && wstate->blender1b_a[0] == &wstate->pixel_color.a); - wstate->other_modes.f.partialreject_2cycle = (wstate->blender2b_a[1] == &wstate->inv_pixel_color.a && wstate->blender1b_a[1] == &wstate->pixel_color.a); - - - special_bsel0 = (wstate->blender2b_a[0] == &wstate->memory_color.a); - special_bsel1 = (wstate->blender2b_a[1] == &wstate->memory_color.a); - - - wstate->other_modes.f.realblendershiftersneeded = (special_bsel0 && wstate->other_modes.cycle_type == CYCLE_TYPE_1) || (special_bsel1 && wstate->other_modes.cycle_type == CYCLE_TYPE_2); - wstate->other_modes.f.interpixelblendershiftersneeded = (special_bsel0 && wstate->other_modes.cycle_type == CYCLE_TYPE_2); - - wstate->other_modes.f.rgb_alpha_dither = (wstate->other_modes.rgb_dither_sel << 2) | wstate->other_modes.alpha_dither_sel; - - wstate->tcdiv_ptr = tcdiv_func[wstate->other_modes.persp_tex_en]; - - - int texel1_used_in_cc1 = 0, texel0_used_in_cc1 = 0, texel0_used_in_cc0 = 0, texel1_used_in_cc0 = 0; - //int texels_in_cc0 = 0, texels_in_cc1 = 0; - int lod_frac_used_in_cc1 = 0, lod_frac_used_in_cc0 = 0; - int texels_or_lf_used_in_ac0 = 0, texel0_used_in_ac0 = 0, texel1_used_in_ac0 = 0; - - if ((wstate->combiner_rgbmul_r[1] == &wstate->lod_frac) || (wstate->combiner_alphamul[1] == &wstate->lod_frac)) - lod_frac_used_in_cc1 = 1; - if ((wstate->combiner_rgbmul_r[0] == &wstate->lod_frac) || (wstate->combiner_alphamul[0] == &wstate->lod_frac)) - lod_frac_used_in_cc0 = 1; - - if (wstate->combiner_rgbmul_r[1] == &wstate->texel1_color.r || wstate->combiner_rgbsub_a_r[1] == &wstate->texel1_color.r || wstate->combiner_rgbsub_b_r[1] == &wstate->texel1_color.r || wstate->combiner_rgbadd_r[1] == &wstate->texel1_color.r || \ - wstate->combiner_alphamul[1] == &wstate->texel1_color.a || wstate->combiner_alphasub_a[1] == &wstate->texel1_color.a || wstate->combiner_alphasub_b[1] == &wstate->texel1_color.a || wstate->combiner_alphaadd[1] == &wstate->texel1_color.a || \ - wstate->combiner_rgbmul_r[1] == &wstate->texel1_color.a) - texel1_used_in_cc1 = 1; - if (wstate->combiner_rgbmul_r[1] == &wstate->texel0_color.r || wstate->combiner_rgbsub_a_r[1] == &wstate->texel0_color.r || wstate->combiner_rgbsub_b_r[1] == &wstate->texel0_color.r || wstate->combiner_rgbadd_r[1] == &wstate->texel0_color.r || \ - wstate->combiner_alphamul[1] == &wstate->texel0_color.a || wstate->combiner_alphasub_a[1] == &wstate->texel0_color.a || wstate->combiner_alphasub_b[1] == &wstate->texel0_color.a || wstate->combiner_alphaadd[1] == &wstate->texel0_color.a || \ - wstate->combiner_rgbmul_r[1] == &wstate->texel0_color.a) - texel0_used_in_cc1 = 1; - if (wstate->combiner_alphamul[0] == &wstate->texel1_color.a || wstate->combiner_alphasub_a[0] == &wstate->texel1_color.a || wstate->combiner_alphasub_b[0] == &wstate->texel1_color.a || wstate->combiner_alphaadd[0] == &wstate->texel1_color.a) - texel1_used_in_ac0 = 1; - if (wstate->combiner_alphamul[0] == &wstate->texel0_color.a || wstate->combiner_alphasub_a[0] == &wstate->texel0_color.a || wstate->combiner_alphasub_b[0] == &wstate->texel0_color.a || wstate->combiner_alphaadd[0] == &wstate->texel0_color.a) - texel0_used_in_ac0 = 1; - if (wstate->combiner_rgbmul_r[0] == &wstate->texel1_color.r || wstate->combiner_rgbsub_a_r[0] == &wstate->texel1_color.r || wstate->combiner_rgbsub_b_r[0] == &wstate->texel1_color.r || wstate->combiner_rgbadd_r[0] == &wstate->texel1_color.r || \ - texel1_used_in_ac0 || wstate->combiner_rgbmul_r[0] == &wstate->texel1_color.a) - texel1_used_in_cc0 = 1; - if (wstate->combiner_rgbmul_r[0] == &wstate->texel0_color.r || wstate->combiner_rgbsub_a_r[0] == &wstate->texel0_color.r || wstate->combiner_rgbsub_b_r[0] == &wstate->texel0_color.r || wstate->combiner_rgbadd_r[0] == &wstate->texel0_color.r || \ - texel0_used_in_ac0 || wstate->combiner_rgbmul_r[0] == &wstate->texel0_color.a) - texel0_used_in_cc0 = 1; - texels_or_lf_used_in_ac0 = texel0_used_in_ac0 || texel1_used_in_ac0 || (wstate->combiner_alphamul[0] == &wstate->lod_frac); - //texels_in_cc0 = texel0_used_in_cc0 || texel1_used_in_cc0; - //texels_in_cc1 = texel0_used_in_cc1 || texel1_used_in_cc1; - - - if (texel1_used_in_cc1) - wstate->other_modes.f.textureuselevel0 = 0; - else if (texel0_used_in_cc1 || lod_frac_used_in_cc1) - wstate->other_modes.f.textureuselevel0 = 1; - else - wstate->other_modes.f.textureuselevel0 = 2; - - if (texel1_used_in_cc1 || (wstate->other_modes.alpha_compare_en && texels_or_lf_used_in_ac0)) - wstate->other_modes.f.textureuselevel1 = 0; - else if (texel1_used_in_cc0 || texel0_used_in_cc1) - wstate->other_modes.f.textureuselevel1 = 1; - else if (texel0_used_in_cc0 || lod_frac_used_in_cc0 || lod_frac_used_in_cc1) - wstate->other_modes.f.textureuselevel1 = 2; - else - wstate->other_modes.f.textureuselevel1 = 3; - - - int lodfracused = 0; - - if ((wstate->other_modes.cycle_type == CYCLE_TYPE_2 && (lod_frac_used_in_cc0 || lod_frac_used_in_cc1)) || \ - (wstate->other_modes.cycle_type == CYCLE_TYPE_1 && lod_frac_used_in_cc1)) - lodfracused = 1; - - if ((wstate->other_modes.cycle_type == CYCLE_TYPE_1 && wstate->combiner_rgbsub_a_r[1] == &wstate->noise) || \ - (wstate->other_modes.cycle_type == CYCLE_TYPE_2 && (wstate->combiner_rgbsub_a_r[0] == &wstate->noise || wstate->combiner_rgbsub_a_r[1] == &wstate->noise)) || \ - wstate->other_modes.alpha_dither_sel == 2) - wstate->other_modes.f.getditherlevel = 0; - else if (wstate->other_modes.f.rgb_alpha_dither != 0xf) - wstate->other_modes.f.getditherlevel = 1; - else - wstate->other_modes.f.getditherlevel = 2; - - wstate->other_modes.f.dolod = wstate->other_modes.tex_lod_en || lodfracused; -} - -void rdp_init(struct rdp_state* wstate) -{ - fb_init(wstate); - combiner_init(wstate); - tex_init(wstate); - rasterizer_init(wstate); - - uint32_t tmp[2] = { 0 }; - rdp_set_other_modes(wstate, tmp); -} - -void rdp_invalid(struct rdp_state* wstate, const uint32_t* args) -{ - UNUSED(wstate); - UNUSED(args); -} - -void rdp_noop(struct rdp_state* wstate, const uint32_t* args) -{ - UNUSED(wstate); - UNUSED(args); -} - -void rdp_sync_load(struct rdp_state* wstate, const uint32_t* args) -{ - UNUSED(wstate); - UNUSED(args); -} - -void rdp_sync_pipe(struct rdp_state* wstate, const uint32_t* args) -{ - UNUSED(wstate); - UNUSED(args); -} - -void rdp_sync_tile(struct rdp_state* wstate, const uint32_t* args) -{ - UNUSED(wstate); - UNUSED(args); -} - -void rdp_sync_full(struct rdp_state* wstate, const uint32_t* args) -{ - UNUSED(wstate); - UNUSED(args); - - // signal DP interrupt - *config.gfx.mi_intr_reg |= DP_INTERRUPT; - config.gfx.mi_intr_cb(); -} - -void rdp_set_other_modes(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->other_modes.cycle_type = (args[0] >> 20) & 3; - wstate->other_modes.persp_tex_en = (args[0] >> 19) & 1; - wstate->other_modes.detail_tex_en = (args[0] >> 18) & 1; - wstate->other_modes.sharpen_tex_en = (args[0] >> 17) & 1; - wstate->other_modes.tex_lod_en = (args[0] >> 16) & 1; - wstate->other_modes.en_tlut = (args[0] >> 15) & 1; - wstate->other_modes.tlut_type = (args[0] >> 14) & 1; - wstate->other_modes.sample_type = (args[0] >> 13) & 1; - wstate->other_modes.mid_texel = (args[0] >> 12) & 1; - wstate->other_modes.bi_lerp0 = (args[0] >> 11) & 1; - wstate->other_modes.bi_lerp1 = (args[0] >> 10) & 1; - wstate->other_modes.convert_one = (args[0] >> 9) & 1; - wstate->other_modes.key_en = (args[0] >> 8) & 1; - wstate->other_modes.rgb_dither_sel = (args[0] >> 6) & 3; - wstate->other_modes.alpha_dither_sel = (args[0] >> 4) & 3; - wstate->other_modes.blend_m1a_0 = (args[1] >> 30) & 3; - wstate->other_modes.blend_m1a_1 = (args[1] >> 28) & 3; - wstate->other_modes.blend_m1b_0 = (args[1] >> 26) & 3; - wstate->other_modes.blend_m1b_1 = (args[1] >> 24) & 3; - wstate->other_modes.blend_m2a_0 = (args[1] >> 22) & 3; - wstate->other_modes.blend_m2a_1 = (args[1] >> 20) & 3; - wstate->other_modes.blend_m2b_0 = (args[1] >> 18) & 3; - wstate->other_modes.blend_m2b_1 = (args[1] >> 16) & 3; - wstate->other_modes.force_blend = (args[1] >> 14) & 1; - wstate->other_modes.alpha_cvg_select = (args[1] >> 13) & 1; - wstate->other_modes.cvg_times_alpha = (args[1] >> 12) & 1; - wstate->other_modes.z_mode = (args[1] >> 10) & 3; - wstate->other_modes.cvg_dest = (args[1] >> 8) & 3; - wstate->other_modes.color_on_cvg = (args[1] >> 7) & 1; - wstate->other_modes.image_read_en = (args[1] >> 6) & 1; - wstate->other_modes.z_update_en = (args[1] >> 5) & 1; - wstate->other_modes.z_compare_en = (args[1] >> 4) & 1; - wstate->other_modes.antialias_en = (args[1] >> 3) & 1; - wstate->other_modes.z_source_sel = (args[1] >> 2) & 1; - wstate->other_modes.dither_alpha_en = (args[1] >> 1) & 1; - wstate->other_modes.alpha_compare_en = (args[1] >> 0) & 1; - - set_blender_input(wstate, 0, 0, &wstate->blender1a_r[0], &wstate->blender1a_g[0], &wstate->blender1a_b[0], &wstate->blender1b_a[0], - wstate->other_modes.blend_m1a_0, wstate->other_modes.blend_m1b_0); - set_blender_input(wstate, 0, 1, &wstate->blender2a_r[0], &wstate->blender2a_g[0], &wstate->blender2a_b[0], &wstate->blender2b_a[0], - wstate->other_modes.blend_m2a_0, wstate->other_modes.blend_m2b_0); - set_blender_input(wstate, 1, 0, &wstate->blender1a_r[1], &wstate->blender1a_g[1], &wstate->blender1a_b[1], &wstate->blender1b_a[1], - wstate->other_modes.blend_m1a_1, wstate->other_modes.blend_m1b_1); - set_blender_input(wstate, 1, 1, &wstate->blender2a_r[1], &wstate->blender2a_g[1], &wstate->blender2a_b[1], &wstate->blender2b_a[1], - wstate->other_modes.blend_m2a_1, wstate->other_modes.blend_m2b_1); - - wstate->other_modes.f.stalederivs = 1; -} - -void rdp_cmd(struct rdp_state* wstate, const uint32_t* args) -{ - uint32_t cmd_id = CMD_ID(args); - rdp_commands[cmd_id].handler(wstate, args); -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/blender.c b/angrylion-rdp-plus/src/core/n64video/rdp/blender.c deleted file mode 100644 index 4e49506..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/blender.c +++ /dev/null @@ -1,350 +0,0 @@ -#ifdef N64VIDEO_C - -static int32_t blenderone = 0xff; - -static uint8_t bldiv_hwaccurate_table[0x8000]; - -static INLINE void set_blender_input(struct rdp_state* wstate, int cycle, int which, int32_t **input_r, int32_t **input_g, int32_t **input_b, int32_t **input_a, int a, int b) -{ - - switch (a & 0x3) - { - case 0: - { - if (cycle == 0) - { - *input_r = &wstate->pixel_color.r; - *input_g = &wstate->pixel_color.g; - *input_b = &wstate->pixel_color.b; - } - else - { - *input_r = &wstate->blended_pixel_color.r; - *input_g = &wstate->blended_pixel_color.g; - *input_b = &wstate->blended_pixel_color.b; - } - break; - } - - case 1: - { - *input_r = &wstate->memory_color.r; - *input_g = &wstate->memory_color.g; - *input_b = &wstate->memory_color.b; - break; - } - - case 2: - { - *input_r = &wstate->blend_color.r; *input_g = &wstate->blend_color.g; *input_b = &wstate->blend_color.b; - break; - } - - case 3: - { - *input_r = &wstate->fog_color.r; *input_g = &wstate->fog_color.g; *input_b = &wstate->fog_color.b; - break; - } - } - - if (which == 0) - { - switch (b & 0x3) - { - case 0: *input_a = &wstate->pixel_color.a; break; - case 1: *input_a = &wstate->fog_color.a; break; - case 2: *input_a = &wstate->blender_shade_alpha; break; - case 3: *input_a = &zero_color; break; - } - } - else - { - switch (b & 0x3) - { - case 0: *input_a = &wstate->inv_pixel_color.a; break; - case 1: *input_a = &wstate->memory_color.a; break; - case 2: *input_a = &blenderone; break; - case 3: *input_a = &zero_color; break; - } - } -} - -static STRICTINLINE int alpha_compare(struct rdp_state* wstate, int32_t comb_alpha) -{ - int32_t threshold; - if (!wstate->other_modes.alpha_compare_en) - return 1; - else - { - if (!wstate->other_modes.dither_alpha_en) - threshold = wstate->blend_color.a; - else - threshold = irand(&wstate->rseed) & 0xff; - - - if (comb_alpha >= threshold) - return 1; - else - return 0; - } -} - -static STRICTINLINE void blender_equation_cycle0(struct rdp_state* wstate, int* r, int* g, int* b) -{ - int blend1a, blend2a; - int blr, blg, blb, sum; - blend1a = *wstate->blender1b_a[0] >> 3; - blend2a = *wstate->blender2b_a[0] >> 3; - - int mulb; - - - - if (wstate->blender2b_a[0] == &wstate->memory_color.a) - { - blend1a = (blend1a >> wstate->blshifta) & 0x3C; - blend2a = (blend2a >> wstate->blshiftb) | 3; - } - - mulb = blend2a + 1; - - - blr = (*wstate->blender1a_r[0]) * blend1a + (*wstate->blender2a_r[0]) * mulb; - blg = (*wstate->blender1a_g[0]) * blend1a + (*wstate->blender2a_g[0]) * mulb; - blb = (*wstate->blender1a_b[0]) * blend1a + (*wstate->blender2a_b[0]) * mulb; - - - - if (!wstate->other_modes.force_blend) - { - - - - - - sum = ((blend1a & ~3) + (blend2a & ~3) + 4) << 9; - *r = bldiv_hwaccurate_table[sum | ((blr >> 2) & 0x7ff)]; - *g = bldiv_hwaccurate_table[sum | ((blg >> 2) & 0x7ff)]; - *b = bldiv_hwaccurate_table[sum | ((blb >> 2) & 0x7ff)]; - } - else - { - *r = (blr >> 5) & 0xff; - *g = (blg >> 5) & 0xff; - *b = (blb >> 5) & 0xff; - } -} - -static STRICTINLINE void blender_equation_cycle0_2(struct rdp_state* wstate, int* r, int* g, int* b) -{ - int blend1a, blend2a; - blend1a = *wstate->blender1b_a[0] >> 3; - blend2a = *wstate->blender2b_a[0] >> 3; - - if (wstate->blender2b_a[0] == &wstate->memory_color.a) - { - blend1a = (blend1a >> wstate->pastblshifta) & 0x3C; - blend2a = (blend2a >> wstate->pastblshiftb) | 3; - } - - blend2a += 1; - *r = (((*wstate->blender1a_r[0]) * blend1a + (*wstate->blender2a_r[0]) * blend2a) >> 5) & 0xff; - *g = (((*wstate->blender1a_g[0]) * blend1a + (*wstate->blender2a_g[0]) * blend2a) >> 5) & 0xff; - *b = (((*wstate->blender1a_b[0]) * blend1a + (*wstate->blender2a_b[0]) * blend2a) >> 5) & 0xff; -} - -static STRICTINLINE void blender_equation_cycle1(struct rdp_state* wstate, int* r, int* g, int* b) -{ - int blend1a, blend2a; - int blr, blg, blb, sum; - blend1a = *wstate->blender1b_a[1] >> 3; - blend2a = *wstate->blender2b_a[1] >> 3; - - int mulb; - if (wstate->blender2b_a[1] == &wstate->memory_color.a) - { - blend1a = (blend1a >> wstate->blshifta) & 0x3C; - blend2a = (blend2a >> wstate->blshiftb) | 3; - } - - mulb = blend2a + 1; - blr = (*wstate->blender1a_r[1]) * blend1a + (*wstate->blender2a_r[1]) * mulb; - blg = (*wstate->blender1a_g[1]) * blend1a + (*wstate->blender2a_g[1]) * mulb; - blb = (*wstate->blender1a_b[1]) * blend1a + (*wstate->blender2a_b[1]) * mulb; - - if (!wstate->other_modes.force_blend) - { - sum = ((blend1a & ~3) + (blend2a & ~3) + 4) << 9; - *r = bldiv_hwaccurate_table[sum | ((blr >> 2) & 0x7ff)]; - *g = bldiv_hwaccurate_table[sum | ((blg >> 2) & 0x7ff)]; - *b = bldiv_hwaccurate_table[sum | ((blb >> 2) & 0x7ff)]; - } - else - { - *r = (blr >> 5) & 0xff; - *g = (blg >> 5) & 0xff; - *b = (blb >> 5) & 0xff; - } -} - -static STRICTINLINE int blender_1cycle(struct rdp_state* wstate, uint32_t* fr, uint32_t* fg, uint32_t* fb, int dith, uint32_t blend_en, uint32_t prewrap, uint32_t curpixel_cvg, uint32_t curpixel_cvbit) -{ - int r, g, b, dontblend; - - - if (alpha_compare(wstate, wstate->pixel_color.a)) - { - - - - - - - if (wstate->other_modes.antialias_en ? curpixel_cvg : curpixel_cvbit) - { - - if (!wstate->other_modes.color_on_cvg || prewrap) - { - dontblend = (wstate->other_modes.f.partialreject_1cycle && wstate->pixel_color.a >= 0xff); - if (!blend_en || dontblend) - { - r = *wstate->blender1a_r[0]; - g = *wstate->blender1a_g[0]; - b = *wstate->blender1a_b[0]; - } - else - { - wstate->inv_pixel_color.a = (~(*wstate->blender1b_a[0])) & 0xff; - - - - - - blender_equation_cycle0(wstate, &r, &g, &b); - } - } - else - { - r = *wstate->blender2a_r[0]; - g = *wstate->blender2a_g[0]; - b = *wstate->blender2a_b[0]; - } - - if (wstate->other_modes.rgb_dither_sel != 3) - rgb_dither(wstate->other_modes.rgb_dither_sel, &r, &g, &b, dith); - - *fr = r; - *fg = g; - *fb = b; - return 1; - } - else - return 0; - } - else - return 0; -} - -static STRICTINLINE int blender_2cycle_cycle0(struct rdp_state* wstate, uint32_t curpixel_cvg, uint32_t curpixel_cvbit) -{ - int r, g, b; - int wen = (wstate->other_modes.antialias_en ? curpixel_cvg : curpixel_cvbit) > 0 ? 1 : 0; - - if (wen) - { - wstate->inv_pixel_color.a = (~(*wstate->blender1b_a[0])) & 0xff; - - blender_equation_cycle0_2(wstate, &r, &g, &b); - - wstate->blended_pixel_color.r = r; - wstate->blended_pixel_color.g = g; - wstate->blended_pixel_color.b = b; - } - - wstate->memory_color = wstate->pre_memory_color; - - return wen; -} - - -static STRICTINLINE void blender_2cycle_cycle1(struct rdp_state* wstate, uint32_t* fr, uint32_t* fg, uint32_t* fb, int dith, uint32_t blend_en, uint32_t prewrap) -{ - int r, g, b, dontblend; - - if (!wstate->other_modes.color_on_cvg || prewrap) - { - dontblend = (wstate->other_modes.f.partialreject_2cycle && wstate->pixel_color.a >= 0xff); - if (!blend_en || dontblend) - { - r = *wstate->blender1a_r[1]; - g = *wstate->blender1a_g[1]; - b = *wstate->blender1a_b[1]; - } - else - { - wstate->inv_pixel_color.a = (~(*wstate->blender1b_a[1])) & 0xff; - blender_equation_cycle1(wstate, &r, &g, &b); - } - } - else - { - r = *wstate->blender2a_r[1]; - g = *wstate->blender2a_g[1]; - b = *wstate->blender2a_b[1]; - } - - if (wstate->other_modes.rgb_dither_sel != 3) - rgb_dither(wstate->other_modes.rgb_dither_sel, &r, &g, &b, dith); - - *fr = r; - *fg = g; - *fb = b; -} - -static void blender_init_lut(void) -{ - int i, k; - int d = 0, n = 0, temp = 0, res = 0, invd = 0, nbit = 0; - int ps[9]; - for (i = 0; i < 0x8000; i++) - { - res = 0; - d = (i >> 11) & 0xf; - n = i & 0x7ff; - invd = (~d) & 0xf; - - - temp = invd + (n >> 8) + 1; - ps[0] = temp & 7; - for (k = 0; k < 8; k++) - { - nbit = (n >> (7 - k)) & 1; - if (res & (0x100 >> k)) - temp = invd + (ps[k] << 1) + nbit + 1; - else - temp = d + (ps[k] << 1) + nbit; - ps[k + 1] = temp & 7; - if (temp & 0x10) - res |= (1 << (7 - k)); - } - bldiv_hwaccurate_table[i] = (uint8_t)res; - } -} - -void rdp_set_fog_color(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->fog_color.r = RGBA32_R(args[1]); - wstate->fog_color.g = RGBA32_G(args[1]); - wstate->fog_color.b = RGBA32_B(args[1]); - wstate->fog_color.a = RGBA32_A(args[1]); -} - -void rdp_set_blend_color(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->blend_color.r = RGBA32_R(args[1]); - wstate->blend_color.g = RGBA32_G(args[1]); - wstate->blend_color.b = RGBA32_B(args[1]); - wstate->blend_color.a = RGBA32_A(args[1]); -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/combiner.c b/angrylion-rdp-plus/src/core/n64video/rdp/combiner.c deleted file mode 100644 index 853b594..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/combiner.c +++ /dev/null @@ -1,581 +0,0 @@ -#ifdef N64VIDEO_C - -static uint32_t special_9bit_clamptable[512]; -static int32_t special_9bit_exttable[512]; - -static INLINE void set_suba_rgb_input(struct rdp_state* wstate, int32_t **input_r, int32_t **input_g, int32_t **input_b, int code) -{ - switch (code & 0xf) - { - case 0: *input_r = &wstate->combined_color.r; *input_g = &wstate->combined_color.g; *input_b = &wstate->combined_color.b; break; - case 1: *input_r = &wstate->texel0_color.r; *input_g = &wstate->texel0_color.g; *input_b = &wstate->texel0_color.b; break; - case 2: *input_r = &wstate->texel1_color.r; *input_g = &wstate->texel1_color.g; *input_b = &wstate->texel1_color.b; break; - case 3: *input_r = &wstate->prim_color.r; *input_g = &wstate->prim_color.g; *input_b = &wstate->prim_color.b; break; - case 4: *input_r = &wstate->shade_color.r; *input_g = &wstate->shade_color.g; *input_b = &wstate->shade_color.b; break; - case 5: *input_r = &wstate->env_color.r; *input_g = &wstate->env_color.g; *input_b = &wstate->env_color.b; break; - case 6: *input_r = &one_color; *input_g = &one_color; *input_b = &one_color; break; - case 7: *input_r = &wstate->noise; *input_g = &wstate->noise; *input_b = &wstate->noise; break; - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - { - *input_r = &zero_color; *input_g = &zero_color; *input_b = &zero_color; break; - } - } -} - -static INLINE void set_subb_rgb_input(struct rdp_state* wstate, int32_t **input_r, int32_t **input_g, int32_t **input_b, int code) -{ - switch (code & 0xf) - { - case 0: *input_r = &wstate->combined_color.r; *input_g = &wstate->combined_color.g; *input_b = &wstate->combined_color.b; break; - case 1: *input_r = &wstate->texel0_color.r; *input_g = &wstate->texel0_color.g; *input_b = &wstate->texel0_color.b; break; - case 2: *input_r = &wstate->texel1_color.r; *input_g = &wstate->texel1_color.g; *input_b = &wstate->texel1_color.b; break; - case 3: *input_r = &wstate->prim_color.r; *input_g = &wstate->prim_color.g; *input_b = &wstate->prim_color.b; break; - case 4: *input_r = &wstate->shade_color.r; *input_g = &wstate->shade_color.g; *input_b = &wstate->shade_color.b; break; - case 5: *input_r = &wstate->env_color.r; *input_g = &wstate->env_color.g; *input_b = &wstate->env_color.b; break; - case 6: *input_r = &wstate->key_center.r; *input_g = &wstate->key_center.g; *input_b = &wstate->key_center.b; break; - case 7: *input_r = &wstate->k4; *input_g = &wstate->k4; *input_b = &wstate->k4; break; - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - { - *input_r = &zero_color; *input_g = &zero_color; *input_b = &zero_color; break; - } - } -} - -static INLINE void set_mul_rgb_input(struct rdp_state* wstate, int32_t **input_r, int32_t **input_g, int32_t **input_b, int code) -{ - switch (code & 0x1f) - { - case 0: *input_r = &wstate->combined_color.r; *input_g = &wstate->combined_color.g; *input_b = &wstate->combined_color.b; break; - case 1: *input_r = &wstate->texel0_color.r; *input_g = &wstate->texel0_color.g; *input_b = &wstate->texel0_color.b; break; - case 2: *input_r = &wstate->texel1_color.r; *input_g = &wstate->texel1_color.g; *input_b = &wstate->texel1_color.b; break; - case 3: *input_r = &wstate->prim_color.r; *input_g = &wstate->prim_color.g; *input_b = &wstate->prim_color.b; break; - case 4: *input_r = &wstate->shade_color.r; *input_g = &wstate->shade_color.g; *input_b = &wstate->shade_color.b; break; - case 5: *input_r = &wstate->env_color.r; *input_g = &wstate->env_color.g; *input_b = &wstate->env_color.b; break; - case 6: *input_r = &wstate->key_scale.r; *input_g = &wstate->key_scale.g; *input_b = &wstate->key_scale.b; break; - case 7: *input_r = &wstate->combined_color.a; *input_g = &wstate->combined_color.a; *input_b = &wstate->combined_color.a; break; - case 8: *input_r = &wstate->texel0_color.a; *input_g = &wstate->texel0_color.a; *input_b = &wstate->texel0_color.a; break; - case 9: *input_r = &wstate->texel1_color.a; *input_g = &wstate->texel1_color.a; *input_b = &wstate->texel1_color.a; break; - case 10: *input_r = &wstate->prim_color.a; *input_g = &wstate->prim_color.a; *input_b = &wstate->prim_color.a; break; - case 11: *input_r = &wstate->shade_color.a; *input_g = &wstate->shade_color.a; *input_b = &wstate->shade_color.a; break; - case 12: *input_r = &wstate->env_color.a; *input_g = &wstate->env_color.a; *input_b = &wstate->env_color.a; break; - case 13: *input_r = &wstate->lod_frac; *input_g = &wstate->lod_frac; *input_b = &wstate->lod_frac; break; - case 14: *input_r = &wstate->primitive_lod_frac; *input_g = &wstate->primitive_lod_frac; *input_b = &wstate->primitive_lod_frac; break; - case 15: *input_r = &wstate->k5; *input_g = &wstate->k5; *input_b = &wstate->k5; break; - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: - { - *input_r = &zero_color; *input_g = &zero_color; *input_b = &zero_color; break; - } - } -} - -static INLINE void set_add_rgb_input(struct rdp_state* wstate, int32_t **input_r, int32_t **input_g, int32_t **input_b, int code) -{ - switch (code & 0x7) - { - case 0: *input_r = &wstate->combined_color.r; *input_g = &wstate->combined_color.g; *input_b = &wstate->combined_color.b; break; - case 1: *input_r = &wstate->texel0_color.r; *input_g = &wstate->texel0_color.g; *input_b = &wstate->texel0_color.b; break; - case 2: *input_r = &wstate->texel1_color.r; *input_g = &wstate->texel1_color.g; *input_b = &wstate->texel1_color.b; break; - case 3: *input_r = &wstate->prim_color.r; *input_g = &wstate->prim_color.g; *input_b = &wstate->prim_color.b; break; - case 4: *input_r = &wstate->shade_color.r; *input_g = &wstate->shade_color.g; *input_b = &wstate->shade_color.b; break; - case 5: *input_r = &wstate->env_color.r; *input_g = &wstate->env_color.g; *input_b = &wstate->env_color.b; break; - case 6: *input_r = &one_color; *input_g = &one_color; *input_b = &one_color; break; - case 7: *input_r = &zero_color; *input_g = &zero_color; *input_b = &zero_color; break; - } -} - -static INLINE void set_sub_alpha_input(struct rdp_state* wstate, int32_t **input, int code) -{ - switch (code & 0x7) - { - case 0: *input = &wstate->combined_color.a; break; - case 1: *input = &wstate->texel0_color.a; break; - case 2: *input = &wstate->texel1_color.a; break; - case 3: *input = &wstate->prim_color.a; break; - case 4: *input = &wstate->shade_color.a; break; - case 5: *input = &wstate->env_color.a; break; - case 6: *input = &one_color; break; - case 7: *input = &zero_color; break; - } -} - -static INLINE void set_mul_alpha_input(struct rdp_state* wstate, int32_t **input, int code) -{ - switch (code & 0x7) - { - case 0: *input = &wstate->lod_frac; break; - case 1: *input = &wstate->texel0_color.a; break; - case 2: *input = &wstate->texel1_color.a; break; - case 3: *input = &wstate->prim_color.a; break; - case 4: *input = &wstate->shade_color.a; break; - case 5: *input = &wstate->env_color.a; break; - case 6: *input = &wstate->primitive_lod_frac; break; - case 7: *input = &zero_color; break; - } -} - -static STRICTINLINE int32_t color_combiner_equation(int32_t a, int32_t b, int32_t c, int32_t d) -{ - - - - - - a = special_9bit_exttable[a]; - b = special_9bit_exttable[b]; - c = SIGNF(c, 9); - d = special_9bit_exttable[d]; - a = ((a - b) * c) + (d << 8) + 0x80; - return (a & 0x1ffff); -} - -static STRICTINLINE int32_t alpha_combiner_equation(int32_t a, int32_t b, int32_t c, int32_t d) -{ - a = special_9bit_exttable[a]; - b = special_9bit_exttable[b]; - c = SIGNF(c, 9); - d = special_9bit_exttable[d]; - a = (((a - b) * c) + (d << 8) + 0x80) >> 8; - return (a & 0x1ff); -} - -static STRICTINLINE int32_t chroma_key_min(struct rdp_state* wstate, struct color* col) -{ - int32_t redkey, greenkey, bluekey, keyalpha; - - - - - redkey = SIGN(col->r, 17); - if (redkey > 0) - redkey = ((redkey & 0xf) == 8) ? (-redkey + 0x10) : (-redkey); - - redkey = (wstate->key_width.r << 4) + redkey; - - greenkey = SIGN(col->g, 17); - if (greenkey > 0) - greenkey = ((greenkey & 0xf) == 8) ? (-greenkey + 0x10) : (-greenkey); - - greenkey = (wstate->key_width.g << 4) + greenkey; - - bluekey = SIGN(col->b, 17); - if (bluekey > 0) - bluekey = ((bluekey & 0xf) == 8) ? (-bluekey + 0x10) : (-bluekey); - - bluekey = (wstate->key_width.b << 4) + bluekey; - - keyalpha = (redkey < greenkey) ? redkey : greenkey; - keyalpha = (bluekey < keyalpha) ? bluekey : keyalpha; - keyalpha = clamp(keyalpha, 0, 0xff); - return keyalpha; -} - -static STRICTINLINE void combiner_1cycle(struct rdp_state* wstate, int adseed, uint32_t* curpixel_cvg) -{ - - int32_t keyalpha = 0, temp = 0; - struct color chromabypass = { 0 }; - - if (wstate->other_modes.key_en) - { - chromabypass.r = *wstate->combiner_rgbsub_a_r[1]; - chromabypass.g = *wstate->combiner_rgbsub_a_g[1]; - chromabypass.b = *wstate->combiner_rgbsub_a_b[1]; - } - - - - - - - if (wstate->combiner_rgbmul_r[1] != &zero_color) - { - - - - - - - - - - - - - - - - - wstate->combined_color.r = color_combiner_equation(*wstate->combiner_rgbsub_a_r[1],*wstate->combiner_rgbsub_b_r[1],*wstate->combiner_rgbmul_r[1],*wstate->combiner_rgbadd_r[1]); - wstate->combined_color.g = color_combiner_equation(*wstate->combiner_rgbsub_a_g[1],*wstate->combiner_rgbsub_b_g[1],*wstate->combiner_rgbmul_g[1],*wstate->combiner_rgbadd_g[1]); - wstate->combined_color.b = color_combiner_equation(*wstate->combiner_rgbsub_a_b[1],*wstate->combiner_rgbsub_b_b[1],*wstate->combiner_rgbmul_b[1],*wstate->combiner_rgbadd_b[1]); - } - else - { - wstate->combined_color.r = ((special_9bit_exttable[*wstate->combiner_rgbadd_r[1]] << 8) + 0x80) & 0x1ffff; - wstate->combined_color.g = ((special_9bit_exttable[*wstate->combiner_rgbadd_g[1]] << 8) + 0x80) & 0x1ffff; - wstate->combined_color.b = ((special_9bit_exttable[*wstate->combiner_rgbadd_b[1]] << 8) + 0x80) & 0x1ffff; - } - - if (wstate->combiner_alphamul[1] != &zero_color) - wstate->combined_color.a = alpha_combiner_equation(*wstate->combiner_alphasub_a[1],*wstate->combiner_alphasub_b[1],*wstate->combiner_alphamul[1],*wstate->combiner_alphaadd[1]); - else - wstate->combined_color.a = special_9bit_exttable[*wstate->combiner_alphaadd[1]] & 0x1ff; - - wstate->pixel_color.a = special_9bit_clamptable[wstate->combined_color.a]; - if (wstate->pixel_color.a == 0xff) - wstate->pixel_color.a = 0x100; - - if (!wstate->other_modes.key_en) - { - - wstate->combined_color.r >>= 8; - wstate->combined_color.g >>= 8; - wstate->combined_color.b >>= 8; - wstate->pixel_color.r = special_9bit_clamptable[wstate->combined_color.r]; - wstate->pixel_color.g = special_9bit_clamptable[wstate->combined_color.g]; - wstate->pixel_color.b = special_9bit_clamptable[wstate->combined_color.b]; - } - else - { - keyalpha = chroma_key_min(wstate, &wstate->combined_color); - - - - wstate->pixel_color.r = special_9bit_clamptable[chromabypass.r]; - wstate->pixel_color.g = special_9bit_clamptable[chromabypass.g]; - wstate->pixel_color.b = special_9bit_clamptable[chromabypass.b]; - - - wstate->combined_color.r >>= 8; - wstate->combined_color.g >>= 8; - wstate->combined_color.b >>= 8; - } - - - if (wstate->other_modes.cvg_times_alpha) - { - temp = (wstate->pixel_color.a * (*curpixel_cvg) + 4) >> 3; - *curpixel_cvg = (temp >> 5) & 0xf; - } - - if (!wstate->other_modes.alpha_cvg_select) - { - if (!wstate->other_modes.key_en) - { - wstate->pixel_color.a += adseed; - if (wstate->pixel_color.a & 0x100) - wstate->pixel_color.a = 0xff; - } - else - wstate->pixel_color.a = keyalpha; - } - else - { - if (wstate->other_modes.cvg_times_alpha) - wstate->pixel_color.a = temp; - else - wstate->pixel_color.a = (*curpixel_cvg) << 5; - if (wstate->pixel_color.a > 0xff) - wstate->pixel_color.a = 0xff; - } - - wstate->blender_shade_alpha = wstate->shade_color.a + adseed; - if (wstate->blender_shade_alpha & 0x100) - wstate->blender_shade_alpha = 0xff; -} - -static STRICTINLINE void combiner_2cycle_cycle0(struct rdp_state* wstate, int adseed, uint32_t cvg, uint32_t* acalpha) -{ - if (wstate->combiner_rgbmul_r[0] != &zero_color) - { - wstate->combined_color.r = color_combiner_equation(*wstate->combiner_rgbsub_a_r[0],*wstate->combiner_rgbsub_b_r[0],*wstate->combiner_rgbmul_r[0],*wstate->combiner_rgbadd_r[0]); - wstate->combined_color.g = color_combiner_equation(*wstate->combiner_rgbsub_a_g[0],*wstate->combiner_rgbsub_b_g[0],*wstate->combiner_rgbmul_g[0],*wstate->combiner_rgbadd_g[0]); - wstate->combined_color.b = color_combiner_equation(*wstate->combiner_rgbsub_a_b[0],*wstate->combiner_rgbsub_b_b[0],*wstate->combiner_rgbmul_b[0],*wstate->combiner_rgbadd_b[0]); - } - else - { - wstate->combined_color.r = ((special_9bit_exttable[*wstate->combiner_rgbadd_r[0]] << 8) + 0x80) & 0x1ffff; - wstate->combined_color.g = ((special_9bit_exttable[*wstate->combiner_rgbadd_g[0]] << 8) + 0x80) & 0x1ffff; - wstate->combined_color.b = ((special_9bit_exttable[*wstate->combiner_rgbadd_b[0]] << 8) + 0x80) & 0x1ffff; - } - - if (wstate->combiner_alphamul[0] != &zero_color) - wstate->combined_color.a = alpha_combiner_equation(*wstate->combiner_alphasub_a[0],*wstate->combiner_alphasub_b[0],*wstate->combiner_alphamul[0],*wstate->combiner_alphaadd[0]); - else - wstate->combined_color.a = special_9bit_exttable[*wstate->combiner_alphaadd[0]] & 0x1ff; - - - - if (wstate->other_modes.alpha_compare_en) - { - int32_t preacalpha = special_9bit_clamptable[wstate->combined_color.a]; - if (preacalpha == 0xff) - preacalpha = 0x100; - - if (!wstate->other_modes.alpha_cvg_select) - { - preacalpha += adseed; - if (preacalpha & 0x100) - preacalpha = 0xff; - } - else - { - if (wstate->other_modes.cvg_times_alpha) - preacalpha = (preacalpha * cvg + 4) >> 3; - else - preacalpha = cvg << 5; - - if (preacalpha > 0xff) - preacalpha = 0xff; - } - - *acalpha = preacalpha; - } - - - - - - wstate->combined_color.r >>= 8; - wstate->combined_color.g >>= 8; - wstate->combined_color.b >>= 8; - - wstate->blender_shade_alpha = wstate->shade_color.a + adseed; - if (wstate->blender_shade_alpha & 0x100) - wstate->blender_shade_alpha = 0xff; -} - -static STRICTINLINE void combiner_2cycle_cycle1(struct rdp_state* wstate, int adseed, uint32_t* curpixel_cvg) -{ - int32_t keyalpha = 0, temp = 0; - struct color chromabypass = { 0 }; - - wstate->texel0_color = wstate->texel1_color; - wstate->texel1_color = wstate->nexttexel_color; - - - - - - - - - - if (wstate->other_modes.key_en) - { - chromabypass.r = *wstate->combiner_rgbsub_a_r[1]; - chromabypass.g = *wstate->combiner_rgbsub_a_g[1]; - chromabypass.b = *wstate->combiner_rgbsub_a_b[1]; - } - - if (wstate->combiner_rgbmul_r[1] != &zero_color) - { - wstate->combined_color.r = color_combiner_equation(*wstate->combiner_rgbsub_a_r[1],*wstate->combiner_rgbsub_b_r[1],*wstate->combiner_rgbmul_r[1],*wstate->combiner_rgbadd_r[1]); - wstate->combined_color.g = color_combiner_equation(*wstate->combiner_rgbsub_a_g[1],*wstate->combiner_rgbsub_b_g[1],*wstate->combiner_rgbmul_g[1],*wstate->combiner_rgbadd_g[1]); - wstate->combined_color.b = color_combiner_equation(*wstate->combiner_rgbsub_a_b[1],*wstate->combiner_rgbsub_b_b[1],*wstate->combiner_rgbmul_b[1],*wstate->combiner_rgbadd_b[1]); - } - else - { - wstate->combined_color.r = ((special_9bit_exttable[*wstate->combiner_rgbadd_r[1]] << 8) + 0x80) & 0x1ffff; - wstate->combined_color.g = ((special_9bit_exttable[*wstate->combiner_rgbadd_g[1]] << 8) + 0x80) & 0x1ffff; - wstate->combined_color.b = ((special_9bit_exttable[*wstate->combiner_rgbadd_b[1]] << 8) + 0x80) & 0x1ffff; - } - - if (wstate->combiner_alphamul[1] != &zero_color) - wstate->combined_color.a = alpha_combiner_equation(*wstate->combiner_alphasub_a[1],*wstate->combiner_alphasub_b[1],*wstate->combiner_alphamul[1],*wstate->combiner_alphaadd[1]); - else - wstate->combined_color.a = special_9bit_exttable[*wstate->combiner_alphaadd[1]] & 0x1ff; - - if (!wstate->other_modes.key_en) - { - - wstate->combined_color.r >>= 8; - wstate->combined_color.g >>= 8; - wstate->combined_color.b >>= 8; - - wstate->pixel_color.r = special_9bit_clamptable[wstate->combined_color.r]; - wstate->pixel_color.g = special_9bit_clamptable[wstate->combined_color.g]; - wstate->pixel_color.b = special_9bit_clamptable[wstate->combined_color.b]; - } - else - { - keyalpha = chroma_key_min(wstate, &wstate->combined_color); - - - - wstate->pixel_color.r = special_9bit_clamptable[chromabypass.r]; - wstate->pixel_color.g = special_9bit_clamptable[chromabypass.g]; - wstate->pixel_color.b = special_9bit_clamptable[chromabypass.b]; - - - wstate->combined_color.r >>= 8; - wstate->combined_color.g >>= 8; - wstate->combined_color.b >>= 8; - } - - wstate->pixel_color.a = special_9bit_clamptable[wstate->combined_color.a]; - if (wstate->pixel_color.a == 0xff) - wstate->pixel_color.a = 0x100; - - - if (wstate->other_modes.cvg_times_alpha) - { - temp = (wstate->pixel_color.a * (*curpixel_cvg) + 4) >> 3; - - *curpixel_cvg = (temp >> 5) & 0xf; - - - } - - if (!wstate->other_modes.alpha_cvg_select) - { - if (!wstate->other_modes.key_en) - { - wstate->pixel_color.a += adseed; - if (wstate->pixel_color.a & 0x100) - wstate->pixel_color.a = 0xff; - } - else - wstate->pixel_color.a = keyalpha; - } - else - { - if (wstate->other_modes.cvg_times_alpha) - wstate->pixel_color.a = temp; - else - wstate->pixel_color.a = (*curpixel_cvg) << 5; - if (wstate->pixel_color.a > 0xff) - wstate->pixel_color.a = 0xff; - } - - wstate->blender_shade_alpha = wstate->shade_color.a + adseed; - if (wstate->blender_shade_alpha & 0x100) - wstate->blender_shade_alpha = 0xff; -} - -static void combiner_init_lut(void) -{ - int i; - for(i = 0; i < 0x200; i++) - { - switch((i >> 7) & 3) - { - case 0: - case 1: - special_9bit_clamptable[i] = i & 0xff; - break; - case 2: - special_9bit_clamptable[i] = 0xff; - break; - case 3: - special_9bit_clamptable[i] = 0; - break; - } - } - - for (i = 0; i < 0x200; i++) - { - special_9bit_exttable[i] = ((i & 0x180) == 0x180) ? (i | ~0x1ff) : (i & 0x1ff); - } -} - -static void combiner_init(struct rdp_state* wstate) -{ - wstate->combiner_rgbsub_a_r[0] = wstate->combiner_rgbsub_a_r[1] = &one_color; - wstate->combiner_rgbsub_a_g[0] = wstate->combiner_rgbsub_a_g[1] = &one_color; - wstate->combiner_rgbsub_a_b[0] = wstate->combiner_rgbsub_a_b[1] = &one_color; - wstate->combiner_rgbsub_b_r[0] = wstate->combiner_rgbsub_b_r[1] = &one_color; - wstate->combiner_rgbsub_b_g[0] = wstate->combiner_rgbsub_b_g[1] = &one_color; - wstate->combiner_rgbsub_b_b[0] = wstate->combiner_rgbsub_b_b[1] = &one_color; - wstate->combiner_rgbmul_r[0] = wstate->combiner_rgbmul_r[1] = &one_color; - wstate->combiner_rgbmul_g[0] = wstate->combiner_rgbmul_g[1] = &one_color; - wstate->combiner_rgbmul_b[0] = wstate->combiner_rgbmul_b[1] = &one_color; - wstate->combiner_rgbadd_r[0] = wstate->combiner_rgbadd_r[1] = &one_color; - wstate->combiner_rgbadd_g[0] = wstate->combiner_rgbadd_g[1] = &one_color; - wstate->combiner_rgbadd_b[0] = wstate->combiner_rgbadd_b[1] = &one_color; - - wstate->combiner_alphasub_a[0] = wstate->combiner_alphasub_a[1] = &one_color; - wstate->combiner_alphasub_b[0] = wstate->combiner_alphasub_b[1] = &one_color; - wstate->combiner_alphamul[0] = wstate->combiner_alphamul[1] = &one_color; - wstate->combiner_alphaadd[0] = wstate->combiner_alphaadd[1] = &one_color; -} - -void rdp_set_prim_color(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->min_level = (args[0] >> 8) & 0x1f; - wstate->primitive_lod_frac = args[0] & 0xff; - wstate->prim_color.r = RGBA32_R(args[1]); - wstate->prim_color.g = RGBA32_G(args[1]); - wstate->prim_color.b = RGBA32_B(args[1]); - wstate->prim_color.a = RGBA32_A(args[1]); -} - -void rdp_set_env_color(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->env_color.r = RGBA32_R(args[1]); - wstate->env_color.g = RGBA32_G(args[1]); - wstate->env_color.b = RGBA32_B(args[1]); - wstate->env_color.a = RGBA32_A(args[1]); -} - -void rdp_set_combine(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->combine.sub_a_rgb0 = (args[0] >> 20) & 0xf; - wstate->combine.mul_rgb0 = (args[0] >> 15) & 0x1f; - wstate->combine.sub_a_a0 = (args[0] >> 12) & 0x7; - wstate->combine.mul_a0 = (args[0] >> 9) & 0x7; - wstate->combine.sub_a_rgb1 = (args[0] >> 5) & 0xf; - wstate->combine.mul_rgb1 = (args[0] >> 0) & 0x1f; - - wstate->combine.sub_b_rgb0 = (args[1] >> 28) & 0xf; - wstate->combine.sub_b_rgb1 = (args[1] >> 24) & 0xf; - wstate->combine.sub_a_a1 = (args[1] >> 21) & 0x7; - wstate->combine.mul_a1 = (args[1] >> 18) & 0x7; - wstate->combine.add_rgb0 = (args[1] >> 15) & 0x7; - wstate->combine.sub_b_a0 = (args[1] >> 12) & 0x7; - wstate->combine.add_a0 = (args[1] >> 9) & 0x7; - wstate->combine.add_rgb1 = (args[1] >> 6) & 0x7; - wstate->combine.sub_b_a1 = (args[1] >> 3) & 0x7; - wstate->combine.add_a1 = (args[1] >> 0) & 0x7; - - - set_suba_rgb_input(wstate, &wstate->combiner_rgbsub_a_r[0], &wstate->combiner_rgbsub_a_g[0], &wstate->combiner_rgbsub_a_b[0], wstate->combine.sub_a_rgb0); - set_subb_rgb_input(wstate, &wstate->combiner_rgbsub_b_r[0], &wstate->combiner_rgbsub_b_g[0], &wstate->combiner_rgbsub_b_b[0], wstate->combine.sub_b_rgb0); - set_mul_rgb_input(wstate, &wstate->combiner_rgbmul_r[0], &wstate->combiner_rgbmul_g[0], &wstate->combiner_rgbmul_b[0], wstate->combine.mul_rgb0); - set_add_rgb_input(wstate, &wstate->combiner_rgbadd_r[0], &wstate->combiner_rgbadd_g[0], &wstate->combiner_rgbadd_b[0], wstate->combine.add_rgb0); - set_sub_alpha_input(wstate, &wstate->combiner_alphasub_a[0], wstate->combine.sub_a_a0); - set_sub_alpha_input(wstate, &wstate->combiner_alphasub_b[0], wstate->combine.sub_b_a0); - set_mul_alpha_input(wstate, &wstate->combiner_alphamul[0], wstate->combine.mul_a0); - set_sub_alpha_input(wstate, &wstate->combiner_alphaadd[0], wstate->combine.add_a0); - - set_suba_rgb_input(wstate, &wstate->combiner_rgbsub_a_r[1], &wstate->combiner_rgbsub_a_g[1], &wstate->combiner_rgbsub_a_b[1], wstate->combine.sub_a_rgb1); - set_subb_rgb_input(wstate, &wstate->combiner_rgbsub_b_r[1], &wstate->combiner_rgbsub_b_g[1], &wstate->combiner_rgbsub_b_b[1], wstate->combine.sub_b_rgb1); - set_mul_rgb_input(wstate, &wstate->combiner_rgbmul_r[1], &wstate->combiner_rgbmul_g[1], &wstate->combiner_rgbmul_b[1], wstate->combine.mul_rgb1); - set_add_rgb_input(wstate, &wstate->combiner_rgbadd_r[1], &wstate->combiner_rgbadd_g[1], &wstate->combiner_rgbadd_b[1], wstate->combine.add_rgb1); - set_sub_alpha_input(wstate, &wstate->combiner_alphasub_a[1], wstate->combine.sub_a_a1); - set_sub_alpha_input(wstate, &wstate->combiner_alphasub_b[1], wstate->combine.sub_b_a1); - set_mul_alpha_input(wstate, &wstate->combiner_alphamul[1], wstate->combine.mul_a1); - set_sub_alpha_input(wstate, &wstate->combiner_alphaadd[1], wstate->combine.add_a1); - - wstate->other_modes.f.stalederivs = 1; -} - -void rdp_set_key_gb(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->key_width.g = (args[0] >> 12) & 0xfff; - wstate->key_width.b = args[0] & 0xfff; - wstate->key_center.g = (args[1] >> 24) & 0xff; - wstate->key_scale.g = (args[1] >> 16) & 0xff; - wstate->key_center.b = (args[1] >> 8) & 0xff; - wstate->key_scale.b = args[1] & 0xff; -} - -void rdp_set_key_r(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->key_width.r = (args[1] >> 16) & 0xfff; - wstate->key_center.r = (args[1] >> 8) & 0xff; - wstate->key_scale.r = args[1] & 0xff; -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/coverage.c b/angrylion-rdp-plus/src/core/n64video/rdp/coverage.c deleted file mode 100644 index db30bbf..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/coverage.c +++ /dev/null @@ -1,249 +0,0 @@ -#ifdef N64VIDEO_C - -#define CVG_CLAMP 0 -#define CVG_WRAP 1 -#define CVG_ZAP 2 -#define CVG_SAVE 3 - -static struct { - uint8_t cvg; - uint8_t cvbit; - uint8_t xoff; - uint8_t yoff; -} cvarray[0x100]; - -static STRICTINLINE uint32_t rightcvghex(uint32_t x, uint32_t fmask) -{ - uint32_t covered = ((x & 7) + 1) >> 1; - - covered = 0xf0 >> covered; - return (covered & fmask); -} - -static STRICTINLINE uint32_t leftcvghex(uint32_t x, uint32_t fmask) -{ - uint32_t covered = ((x & 7) + 1) >> 1; - covered = 0xf >> covered; - return (covered & fmask); -} - - - -static STRICTINLINE void compute_cvg_flip(struct rdp_state* wstate, int32_t scanline) -{ - int32_t purgestart, purgeend; - int i, length, fmask, maskshift, fmaskshifted; - int32_t minorcur, majorcur, minorcurint, majorcurint, samecvg; - - purgestart = wstate->span[scanline].rx; - purgeend = wstate->span[scanline].lx; - length = purgeend - purgestart; - if (length >= 0) - { - - - - - - - memset(&wstate->cvgbuf[purgestart], 0xff, length + 1); - for(i = 0; i < 4; i++) - { - - fmask = 0xa >> (i & 1); - - - - - maskshift = (i - 2) & 4; - fmaskshifted = fmask << maskshift; - - if (!wstate->span[scanline].invalyscan[i]) - { - int k; - minorcur = wstate->span[scanline].minorx[i]; - majorcur = wstate->span[scanline].majorx[i]; - minorcurint = minorcur >> 3; - majorcurint = majorcur >> 3; - - - for (k = purgestart; k <= majorcurint; k++) - wstate->cvgbuf[k] &= ~fmaskshifted; - for (k = minorcurint; k <= purgeend; k++) - wstate->cvgbuf[k] &= ~fmaskshifted; - - - - - - - - - - if (minorcurint > majorcurint) - { - wstate->cvgbuf[minorcurint] |= (rightcvghex(minorcur, fmask) << maskshift); - wstate->cvgbuf[majorcurint] |= (leftcvghex(majorcur, fmask) << maskshift); - } - else if (minorcurint == majorcurint) - { - samecvg = rightcvghex(minorcur, fmask) & leftcvghex(majorcur, fmask); - wstate->cvgbuf[majorcurint] |= (samecvg << maskshift); - } - } - else - { - int k; - for (k = purgestart; k <= purgeend; k++) - wstate->cvgbuf[k] &= ~fmaskshifted; - } - - } - } - - -} - -static STRICTINLINE void compute_cvg_noflip(struct rdp_state* wstate, int32_t scanline) -{ - int32_t purgestart, purgeend; - int i, length, fmask, maskshift, fmaskshifted; - int32_t minorcur, majorcur, minorcurint, majorcurint, samecvg; - - purgestart = wstate->span[scanline].lx; - purgeend = wstate->span[scanline].rx; - length = purgeend - purgestart; - - if (length >= 0) - { - memset(&wstate->cvgbuf[purgestart], 0xff, length + 1); - - for(i = 0; i < 4; i++) - { - fmask = 0xa >> (i & 1); - maskshift = (i - 2) & 4; - fmaskshifted = fmask << maskshift; - - if (!wstate->span[scanline].invalyscan[i]) - { - int k; - minorcur = wstate->span[scanline].minorx[i]; - majorcur = wstate->span[scanline].majorx[i]; - minorcurint = minorcur >> 3; - majorcurint = majorcur >> 3; - - for (k = purgestart; k <= minorcurint; k++) - wstate->cvgbuf[k] &= ~fmaskshifted; - for (k = majorcurint; k <= purgeend; k++) - wstate->cvgbuf[k] &= ~fmaskshifted; - - if (majorcurint > minorcurint) - { - wstate->cvgbuf[minorcurint] |= (leftcvghex(minorcur, fmask) << maskshift); - wstate->cvgbuf[majorcurint] |= (rightcvghex(majorcur, fmask) << maskshift); - } - else if (minorcurint == majorcurint) - { - samecvg = leftcvghex(minorcur, fmask) & rightcvghex(majorcur, fmask); - wstate->cvgbuf[majorcurint] |= (samecvg << maskshift); - } - } - else - { - int k; - for (k = purgestart; k <= purgeend; k++) - wstate->cvgbuf[k] &= ~fmaskshifted; - } - } - } -} - -static STRICTINLINE int finalize_spanalpha(int cvg_dest, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg) -{ - int finalcvg = 0; - - - - switch(cvg_dest) - { - case CVG_CLAMP: - if (!blend_en) - { - finalcvg = curpixel_cvg - 1; - - - } - else - { - finalcvg = curpixel_cvg + curpixel_memcvg; - } - - - - if (!(finalcvg & 8)) - finalcvg &= 7; - else - finalcvg = 7; - - break; - case CVG_WRAP: - finalcvg = (curpixel_cvg + curpixel_memcvg) & 7; - break; - case CVG_ZAP: - finalcvg = 7; - break; - case CVG_SAVE: - finalcvg = curpixel_memcvg; - break; - } - - return finalcvg; -} - -static STRICTINLINE uint16_t decompress_cvmask_frombyte(uint8_t x) -{ - uint16_t y = (x & 0x5) | ((x & 0x5a) << 4) | ((x & 0xa0) << 8); - return y; -} - -static STRICTINLINE void lookup_cvmask_derivatives(uint8_t mask, uint8_t* offx, uint8_t* offy, uint32_t* curpixel_cvg, uint32_t* curpixel_cvbit) -{ - *curpixel_cvg = cvarray[mask].cvg; - *curpixel_cvbit = cvarray[mask].cvbit; - *offx = cvarray[mask].xoff; - *offy = cvarray[mask].yoff; -} - -static void coverage_init_lut(void) -{ - uint8_t i = 0, k = 0; - uint16_t mask = 0, maskx = 0, masky = 0; - uint8_t offx = 0, offy = 0; - const uint8_t yarray[16] = {0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; - const uint8_t xarray[16] = {0, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; - - do { - mask = decompress_cvmask_frombyte(i); - cvarray[i].cvg = cvarray[i].cvbit = 0; - cvarray[i].cvbit = (i >> 7) & 1; - for (k = 0; k < 8; k++) - cvarray[i].cvg += ((i >> k) & 1); - - - masky = maskx = offx = offy = 0; - for (k = 0; k < 4; k++) - masky |= ((mask & (0xf000 >> (k << 2))) > 0) << k; - - offy = yarray[masky]; - - maskx = (mask & (0xf000 >> (offy << 2))) >> ((offy ^ 3) << 2); - - - offx = xarray[maskx]; - - cvarray[i].xoff = offx; - cvarray[i].yoff = offy; - } while (i++ != 0xff); -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/dither.c b/angrylion-rdp-plus/src/core/n64video/rdp/dither.c deleted file mode 100644 index 3690f5d..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/dither.c +++ /dev/null @@ -1,154 +0,0 @@ -#ifdef N64VIDEO_C - -static const uint8_t bayer_matrix[16] = -{ - 0, 4, 1, 5, - 4, 0, 5, 1, - 3, 7, 2, 6, - 7, 3, 6, 2 -}; - - -static const uint8_t magic_matrix[16] = -{ - 0, 6, 1, 7, - 4, 2, 5, 3, - 3, 5, 2, 4, - 7, 1, 6, 0 -}; - -static STRICTINLINE void rgb_dither(int rgb_dither_sel, int* r, int* g, int* b, int dith) -{ - - int32_t newr = *r, newg = *g, newb = *b; - int32_t rcomp, gcomp, bcomp; - - - if (newr > 247) - newr = 255; - else - newr = (newr & 0xf8) + 8; - if (newg > 247) - newg = 255; - else - newg = (newg & 0xf8) + 8; - if (newb > 247) - newb = 255; - else - newb = (newb & 0xf8) + 8; - - if (rgb_dither_sel != 2) - rcomp = gcomp = bcomp = dith; - else - { - rcomp = dith & 7; - gcomp = (dith >> 3) & 7; - bcomp = (dith >> 6) & 7; - } - - - - - - int32_t replacesign = (rcomp - (*r & 7)) >> 31; - - int32_t ditherdiff = newr - *r; - *r = *r + (ditherdiff & replacesign); - - replacesign = (gcomp - (*g & 7)) >> 31; - ditherdiff = newg - *g; - *g = *g + (ditherdiff & replacesign); - - replacesign = (bcomp - (*b & 7)) >> 31; - ditherdiff = newb - *b; - *b = *b + (ditherdiff & replacesign); -} - -static STRICTINLINE void get_dither_noise(struct rdp_state* wstate, int x, int y, int* cdith, int* adith) -{ - if (!wstate->other_modes.f.getditherlevel) - wstate->noise = ((irand(&wstate->rseed) & 7) << 6) | 0x20; - - y >>= wstate->scfield; - - int dithindex; - switch(wstate->other_modes.f.rgb_alpha_dither) - { - case 0: - dithindex = ((y & 3) << 2) | (x & 3); - *adith = *cdith = magic_matrix[dithindex]; - break; - case 1: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = magic_matrix[dithindex]; - *adith = (~(*cdith)) & 7; - break; - case 2: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = magic_matrix[dithindex]; - *adith = (wstate->noise >> 6) & 7; - break; - case 3: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = magic_matrix[dithindex]; - *adith = 0; - break; - case 4: - dithindex = ((y & 3) << 2) | (x & 3); - *adith = *cdith = bayer_matrix[dithindex]; - break; - case 5: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = bayer_matrix[dithindex]; - *adith = (~(*cdith)) & 7; - break; - case 6: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = bayer_matrix[dithindex]; - *adith = (wstate->noise >> 6) & 7; - break; - case 7: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = bayer_matrix[dithindex]; - *adith = 0; - break; - case 8: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = irand(&wstate->rseed); - *adith = magic_matrix[dithindex]; - break; - case 9: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = irand(&wstate->rseed); - *adith = (~magic_matrix[dithindex]) & 7; - break; - case 10: - *cdith = irand(&wstate->rseed); - *adith = (wstate->noise >> 6) & 7; - break; - case 11: - *cdith = irand(&wstate->rseed); - *adith = 0; - break; - case 12: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = 7; - *adith = bayer_matrix[dithindex]; - break; - case 13: - dithindex = ((y & 3) << 2) | (x & 3); - *cdith = 7; - *adith = (~bayer_matrix[dithindex]) & 7; - break; - case 14: - *cdith = 7; - *adith = (wstate->noise >> 6) & 7; - break; - case 15: - *cdith = 7; - *adith = 0; - break; - } -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/fbuffer.c b/angrylion-rdp-plus/src/core/n64video/rdp/fbuffer.c deleted file mode 100644 index 3c0db43..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/fbuffer.c +++ /dev/null @@ -1,324 +0,0 @@ -#ifdef N64VIDEO_C - -static void fbwrite_4(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg); -static void fbwrite_8(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg); -static void fbwrite_16(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg); -static void fbwrite_32(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg); -static void fbread_4(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread_8(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread_16(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread_32(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread2_4(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread2_8(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread2_16(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); -static void fbread2_32(struct rdp_state* wstate, uint32_t num, uint32_t* curpixel_memcvg); - -static void (*fbread_func[4])(struct rdp_state*, uint32_t, uint32_t*) = -{ - fbread_4, fbread_8, fbread_16, fbread_32 -}; - -static void (*fbread2_func[4])(struct rdp_state*,uint32_t, uint32_t*) = -{ - fbread2_4, fbread2_8, fbread2_16, fbread2_32 -}; - -static void (*fbwrite_func[4])(struct rdp_state*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t) = -{ - fbwrite_4, fbwrite_8, fbwrite_16, fbwrite_32 -}; - -static void fbwrite_4(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg) -{ - UNUSED(r); - UNUSED(g); - UNUSED(b); - UNUSED(blend_en); - UNUSED(curpixel_cvg); - UNUSED(curpixel_memcvg); - - uint32_t fb = wstate->fb_address + curpixel; - RWRITEADDR8(fb, 0); -} - -static void fbwrite_8(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg) -{ - UNUSED(b); - UNUSED(blend_en); - UNUSED(curpixel_cvg); - UNUSED(curpixel_memcvg); - - uint32_t fb = wstate->fb_address + curpixel; - PAIRWRITE8(fb, (fb & 1) ? (g & 0xff) : (r & 0xff)); -} - -static void fbwrite_16(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg) -{ -#undef CVG_DRAW -#ifdef CVG_DRAW - int covdraw = (curpixel_cvg - 1) << 5; - r=covdraw; g=covdraw; b=covdraw; -#endif - - uint32_t fb; - uint16_t rval; - uint8_t hval; - fb = (wstate->fb_address >> 1) + curpixel; - - int32_t finalcvg = finalize_spanalpha(wstate->other_modes.cvg_dest, blend_en, curpixel_cvg, curpixel_memcvg); - int16_t finalcolor; - - if (wstate->fb_format == FORMAT_RGBA) - { - finalcolor = ((r & ~7) << 8) | ((g & ~7) << 3) | ((b & ~7) >> 2); - } - else - { - finalcolor = (int16_t)((r << 8) | (finalcvg << 5)); - finalcvg = 0; - } - - - rval = finalcolor|(uint16_t)(finalcvg >> 2); - hval = finalcvg & 3; - PAIRWRITE16(fb, rval, hval); -} - -static void fbwrite_32(struct rdp_state* wstate, uint32_t curpixel, uint32_t r, uint32_t g, uint32_t b, uint32_t blend_en, uint32_t curpixel_cvg, uint32_t curpixel_memcvg) -{ - uint32_t fb = (wstate->fb_address >> 2) + curpixel; - - int32_t finalcolor; - int32_t finalcvg = finalize_spanalpha(wstate->other_modes.cvg_dest, blend_en, curpixel_cvg, curpixel_memcvg); - - finalcolor = (r << 24) | (g << 16) | (b << 8); - finalcolor |= (finalcvg << 5); - - PAIRWRITE32(fb, finalcolor, (g & 1) ? 3 : 0, 0); -} - -static void fbfill_4(struct rdp_state* wstate, uint32_t curpixel) -{ - UNUSED(wstate); - UNUSED(curpixel); - - rdp_pipeline_crashed = 1; -} - -static void fbfill_8(struct rdp_state* wstate, uint32_t curpixel) -{ - uint32_t fb = wstate->fb_address + curpixel; - uint8_t val = (wstate->fill_color >> ((fb & 3) ^ 3) << 3) & 0xff; - PAIRWRITE8(fb, val); -} - -static void fbfill_16(struct rdp_state* wstate, uint32_t curpixel) -{ - uint16_t val; - uint8_t hval; - uint32_t fb = (wstate->fb_address >> 1) + curpixel; - if (fb & 1) - val = wstate->fill_color & 0xffff; - else - val = (wstate->fill_color >> 16) & 0xffff; - hval = ((val & 1) << 1) | (val & 1); - PAIRWRITE16(fb, val, hval); -} - -static void fbfill_32(struct rdp_state* wstate, uint32_t curpixel) -{ - uint32_t fb = (wstate->fb_address >> 2) + curpixel; - PAIRWRITE32(fb, wstate->fill_color, (wstate->fill_color & 0x10000) ? 3 : 0, (wstate->fill_color & 0x1) ? 3 : 0); -} - -static void fbread_4(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - UNUSED(curpixel); - - wstate->memory_color.r = wstate->memory_color.g = wstate->memory_color.b = 0; - - *curpixel_memcvg = 7; - wstate->memory_color.a = 0xe0; -} - -static void fbread2_4(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - UNUSED(curpixel); - - wstate->pre_memory_color.r = wstate->pre_memory_color.g = wstate->pre_memory_color.b = 0; - wstate->pre_memory_color.a = 0xe0; - *curpixel_memcvg = 7; -} - -static void fbread_8(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - if (wstate->other_modes.image_read_en) - { - uint8_t mem; - uint32_t addr = wstate->fb_address + curpixel; - RREADADDR8(mem, addr); - wstate->memory_color.r = wstate->memory_color.g = wstate->memory_color.b = mem; - } - - *curpixel_memcvg = 7; - wstate->memory_color.a = 0xe0; -} - -static void fbread2_8(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - if (wstate->other_modes.image_read_en) - { - uint8_t mem; - uint32_t addr = wstate->fb_address + curpixel; - RREADADDR8(mem, addr); - wstate->pre_memory_color.r = wstate->pre_memory_color.g = wstate->pre_memory_color.b = mem; - } - wstate->pre_memory_color.a = 0xe0; - *curpixel_memcvg = 7; -} - -static void fbread_16(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - if (wstate->other_modes.image_read_en) - { - uint16_t fword; - uint8_t hbyte; - uint32_t addr = (wstate->fb_address >> 1) + curpixel; - - uint8_t lowbits; - - PAIRREAD16(fword, hbyte, addr); - - if (wstate->fb_format == FORMAT_RGBA) - { - wstate->memory_color.r = RGBA16_R(fword); - wstate->memory_color.g = RGBA16_G(fword); - wstate->memory_color.b = RGBA16_B(fword); - lowbits = ((fword & 1) << 2) | hbyte; - } - else - { - wstate->memory_color.r = wstate->memory_color.g = wstate->memory_color.b = fword >> 8; - lowbits = (fword >> 5) & 7; - } - - *curpixel_memcvg = lowbits; - wstate->memory_color.a = lowbits << 5; - } - else - { - *curpixel_memcvg = 7; - wstate->memory_color.a = 0xe0; - } -} - -static void fbread2_16(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - - if (wstate->other_modes.image_read_en) - { - uint16_t fword; - uint8_t hbyte; - uint32_t addr = (wstate->fb_address >> 1) + curpixel; - - uint8_t lowbits; - - PAIRREAD16(fword, hbyte, addr); - - if (wstate->fb_format == FORMAT_RGBA) - { - wstate->pre_memory_color.r = RGBA16_R(fword); - wstate->pre_memory_color.g = RGBA16_G(fword); - wstate->pre_memory_color.b = RGBA16_B(fword); - lowbits = ((fword & 1) << 2) | hbyte; - } - else - { - wstate->pre_memory_color.r = wstate->pre_memory_color.g = wstate->pre_memory_color.b = fword >> 8; - lowbits = (fword >> 5) & 7; - } - - *curpixel_memcvg = lowbits; - wstate->pre_memory_color.a = lowbits << 5; - } - else - { - *curpixel_memcvg = 7; - wstate->pre_memory_color.a = 0xe0; - } - -} - -static void fbread_32(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - if (wstate->other_modes.image_read_en) - { - uint32_t mem, addr = (wstate->fb_address >> 2) + curpixel; - RREADIDX32(mem, addr); - wstate->memory_color.r = RGBA32_R(mem); - wstate->memory_color.g = RGBA32_G(mem); - wstate->memory_color.b = RGBA32_B(mem); - - *curpixel_memcvg = (mem >> 5) & 7; - wstate->memory_color.a = mem & 0xe0; - } - else - { - *curpixel_memcvg = 7; - wstate->memory_color.a = 0xe0; - } -} - -static INLINE void fbread2_32(struct rdp_state* wstate, uint32_t curpixel, uint32_t* curpixel_memcvg) -{ - if (wstate->other_modes.image_read_en) - { - uint32_t mem, addr = (wstate->fb_address >> 2) + curpixel; - RREADIDX32(mem, addr); - - wstate->pre_memory_color.r = RGBA32_R(mem); - wstate->pre_memory_color.g = RGBA32_G(mem); - wstate->pre_memory_color.b = RGBA32_B(mem); - - *curpixel_memcvg = (mem >> 5) & 7; - wstate->pre_memory_color.a = mem & 0xe0; - } - else - { - *curpixel_memcvg = 7; - wstate->pre_memory_color.a = 0xe0; - } -} - -void rdp_set_color_image(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->fb_format = (args[0] >> 21) & 0x7; - wstate->fb_size = (args[0] >> 19) & 0x3; - wstate->fb_width = (args[0] & 0x3ff) + 1; - wstate->fb_address = args[1] & 0x0ffffff; - - - wstate->fbread1_ptr = fbread_func[wstate->fb_size]; - wstate->fbread2_ptr = fbread2_func[wstate->fb_size]; - wstate->fbwrite_ptr = fbwrite_func[wstate->fb_size]; -} - -void rdp_set_fill_color(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->fill_color = args[1]; -} - -static void fb_init(struct rdp_state* wstate) -{ - wstate->fb_format = FORMAT_RGBA; - wstate->fb_size = PIXEL_SIZE_4BIT; - wstate->fb_width = 0; - wstate->fb_address = 0; - - - wstate->fbread1_ptr = fbread_func[wstate->fb_size]; - wstate->fbread2_ptr = fbread2_func[wstate->fb_size]; - wstate->fbwrite_ptr = fbwrite_func[wstate->fb_size]; -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/rasterizer.c b/angrylion-rdp-plus/src/core/n64video/rdp/rasterizer.c deleted file mode 100644 index cb34365..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/rasterizer.c +++ /dev/null @@ -1,2570 +0,0 @@ -#ifdef N64VIDEO_C - -static STRICTINLINE int32_t normalize_dzpix(int32_t sum) -{ - int count; - if (sum & 0xc000) - return 0x8000; - if (!(sum & 0xffff)) - return 1; - - if (sum == 1) - return 3; - - for(count = 0x2000; count > 0; count >>= 1) - { - if (sum & count) - return (count << 1); - } - - return 0; -} - -static void replicate_for_copy(struct rdp_state* wstate, uint32_t* outbyte, uint32_t inshort, uint32_t nybbleoffset, uint32_t tilenum, uint32_t tformat, uint32_t tsize) -{ - uint32_t lownib, hinib; - switch(tsize) - { - case PIXEL_SIZE_4BIT: - lownib = (nybbleoffset ^ 3) << 2; - lownib = hinib = (inshort >> lownib) & 0xf; - if (tformat == FORMAT_CI) - { - *outbyte = (wstate->tile[tilenum].palette << 4) | lownib; - } - else if (tformat == FORMAT_IA) - { - lownib = (lownib << 4) | lownib; - *outbyte = (lownib & 0xe0) | ((lownib & 0xe0) >> 3) | ((lownib & 0xc0) >> 6); - } - else - *outbyte = (lownib << 4) | lownib; - break; - case PIXEL_SIZE_8BIT: - hinib = ((nybbleoffset ^ 3) | 1) << 2; - if (tformat == FORMAT_IA) - { - lownib = (inshort >> hinib) & 0xf; - *outbyte = (lownib << 4) | lownib; - } - else - { - lownib = (inshort >> (hinib & ~4)) & 0xf; - hinib = (inshort >> hinib) & 0xf; - *outbyte = (hinib << 4) | lownib; - } - break; - default: - *outbyte = (inshort >> 8) & 0xff; - break; - } -} - -static void fetch_qword_copy(struct rdp_state* wstate, uint32_t* hidword, uint32_t* lowdword, int32_t ssss, int32_t ssst, uint32_t tilenum) -{ - uint32_t shorta, shortb, shortc, shortd; - uint32_t sortshort[8]; - int hibits[6]; - int lowbits[6]; - int32_t sss = ssss, sst = ssst, sss1 = 0, sss2 = 0, sss3 = 0; - int largetex = 0; - - uint32_t tformat, tsize; - if (wstate->other_modes.en_tlut) - { - tsize = PIXEL_SIZE_16BIT; - tformat = wstate->other_modes.tlut_type ? FORMAT_IA : FORMAT_RGBA; - } - else - { - tsize = wstate->tile[tilenum].size; - tformat = wstate->tile[tilenum].format; - } - - tc_pipeline_copy(&wstate->tile[tilenum], &sss, &sss1, &sss2, &sss3, &sst); - read_tmem_copy(wstate, sss, sss1, sss2, sss3, sst, tilenum, sortshort, hibits, lowbits); - largetex = (tformat == FORMAT_YUV || (tformat == FORMAT_RGBA && tsize == PIXEL_SIZE_32BIT)); - - - if (wstate->other_modes.en_tlut) - { - shorta = sortshort[4]; - shortb = sortshort[5]; - shortc = sortshort[6]; - shortd = sortshort[7]; - } - else if (largetex) - { - shorta = sortshort[0]; - shortb = sortshort[1]; - shortc = sortshort[2]; - shortd = sortshort[3]; - } - else - { - shorta = hibits[0] ? sortshort[4] : sortshort[0]; - shortb = hibits[1] ? sortshort[5] : sortshort[1]; - shortc = hibits[3] ? sortshort[6] : sortshort[2]; - shortd = hibits[4] ? sortshort[7] : sortshort[3]; - } - - *lowdword = (shortc << 16) | shortd; - - if (tsize == PIXEL_SIZE_16BIT) - *hidword = (shorta << 16) | shortb; - else - { - replicate_for_copy(wstate, &shorta, shorta, lowbits[0] & 3, tilenum, tformat, tsize); - replicate_for_copy(wstate, &shortb, shortb, lowbits[1] & 3, tilenum, tformat, tsize); - replicate_for_copy(wstate, &shortc, shortc, lowbits[3] & 3, tilenum, tformat, tsize); - replicate_for_copy(wstate, &shortd, shortd, lowbits[4] & 3, tilenum, tformat, tsize); - *hidword = (shorta << 24) | (shortb << 16) | (shortc << 8) | shortd; - } -} - -static STRICTINLINE void rgba_correct(struct rdp_state* wstate, int offx, int offy, int r, int g, int b, int a, uint32_t cvg) -{ - int summand_r, summand_b, summand_g, summand_a; - - - - if (cvg == 8) - { - r >>= 2; - g >>= 2; - b >>= 2; - a >>= 2; - } - else - { - summand_r = offx * wstate->spans_cdr + offy * wstate->spans_drdy; - summand_g = offx * wstate->spans_cdg + offy * wstate->spans_dgdy; - summand_b = offx * wstate->spans_cdb + offy * wstate->spans_dbdy; - summand_a = offx * wstate->spans_cda + offy * wstate->spans_dady; - - r = ((r << 2) + summand_r) >> 4; - g = ((g << 2) + summand_g) >> 4; - b = ((b << 2) + summand_b) >> 4; - a = ((a << 2) + summand_a) >> 4; - } - - - wstate->shade_color.r = special_9bit_clamptable[r & 0x1ff]; - wstate->shade_color.g = special_9bit_clamptable[g & 0x1ff]; - wstate->shade_color.b = special_9bit_clamptable[b & 0x1ff]; - wstate->shade_color.a = special_9bit_clamptable[a & 0x1ff]; -} - -static STRICTINLINE void z_correct(struct rdp_state* wstate, int offx, int offy, int* z, uint32_t cvg) -{ - int summand_z; - int sz = *z; - int zanded; - - - - if (cvg == 8) - sz = sz >> 3; - else - { - summand_z = offx * wstate->spans_cdz + offy * wstate->spans_dzdy; - - sz = ((sz << 2) + summand_z) >> 5; - } - - - - zanded = (sz & 0x60000) >> 17; - - - switch (zanded) - { - case 0: *z = sz & 0x3ffff; break; - case 1: *z = sz & 0x3ffff; break; - case 2: *z = 0x3ffff; break; - case 3: *z = 0; break; - } -} - -static void render_spans_1cycle_complete(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - struct spansigs sigs; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg, curpixel_cvbit, curpixel_memcvg; - - int prim_tile = tilenum; - int tile1 = tilenum; - int newtile = tilenum; - int news, newt; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; - int xinc; - - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - dwinc = wstate->spans_dw; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - dsinc = -wstate->spans_ds; - dtinc = -wstate->spans_dt; - dwinc = -wstate->spans_dw; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - int r, g, b, a, z, s, t, w; - int sr, sg, sb, sa, sz, ss, st, sw; - int xstart, xend, xendsc; - int sss = 0, sst = 0; - int32_t prelodfrac = 0; - int curpixel = 0; - int x, length, scdiff, lodlength; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - s = wstate->span[i].s; - t = wstate->span[i].t; - w = wstate->span[i].w; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - - - if (scdiff) - { - - - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - s += (dsinc * scdiff); - t += (dtinc * scdiff); - w += (dwinc * scdiff); - } - - lodlength = length + scdiff; - - sigs.longspan = (lodlength > 7); - sigs.midspan = (lodlength == 7); - sigs.onelessthanmid = (lodlength == 6); - - for (j = 0; j <= length; j++) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - sz = (z >> 10) & 0x3fffff; - - - sigs.endspan = (j == length); - sigs.preendspan = (j == (length - 1)); - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - - get_texel1_1cycle(wstate, &news, &newt, s, t, w, dsinc, dtinc, dwinc, i, &sigs); - - - - if (j) - { - wstate->texel0_color = wstate->texel1_color; - wstate->lod_frac = prelodfrac; - } - else - { - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - - tclod_1cycle_current(wstate, &sss, &sst, news, newt, s, t, w, dsinc, dtinc, dwinc, i, prim_tile, &tile1, &sigs); - - - - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - } - - sigs.nextspan = sigs.endspan; - sigs.endspan = sigs.preendspan; - sigs.preendspan = (j == (length - 2)); - - s += dsinc; - t += dtinc; - w += dwinc; - - tclod_1cycle_next(wstate, &news, &newt, s, t, w, dsinc, dtinc, dwinc, i, prim_tile, &newtile, &sigs, &prelodfrac); - - texture_pipeline_cycle(wstate, &wstate->texel1_color, &wstate->texel1_color, news, newt, newtile, 0); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_1cycle(wstate, adith, &curpixel_cvg); - - wstate->fbread1_ptr(wstate, curpixel, &curpixel_memcvg); - if (z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg)) - { - if (blender_1cycle(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap, curpixel_cvg, curpixel_cvbit)) - { - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - - - - - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - z += dzinc; - - x += xinc; - curpixel += xinc; - zbcur += xinc; - } - } - } -} - - -static void render_spans_1cycle_notexel1(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - struct spansigs sigs; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg, curpixel_cvbit, curpixel_memcvg; - - int prim_tile = tilenum; - int tile1 = tilenum; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; - int xinc; - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - dwinc = wstate->spans_dw; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - dsinc = -wstate->spans_ds; - dtinc = -wstate->spans_dt; - dwinc = -wstate->spans_dw; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - int r, g, b, a, z, s, t, w; - int sr, sg, sb, sa, sz, ss, st, sw; - int xstart, xend, xendsc; - int sss = 0, sst = 0; - int curpixel = 0; - int x, length, scdiff, lodlength; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - s = wstate->span[i].s; - t = wstate->span[i].t; - w = wstate->span[i].w; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - if (scdiff) - { - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - s += (dsinc * scdiff); - t += (dtinc * scdiff); - w += (dwinc * scdiff); - } - - lodlength = length + scdiff; - - sigs.longspan = (lodlength > 7); - sigs.midspan = (lodlength == 7); - - for (j = 0; j <= length; j++) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - sz = (z >> 10) & 0x3fffff; - - - - sigs.endspan = (j == length); - sigs.preendspan = (j == (length - 1)); - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_1cycle_current_simple(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, i, prim_tile, &tile1, &sigs); - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_1cycle(wstate, adith, &curpixel_cvg); - - wstate->fbread1_ptr(wstate, curpixel, &curpixel_memcvg); - if (z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg)) - { - if (blender_1cycle(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap, curpixel_cvg, curpixel_cvbit)) - { - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - - s += dsinc; - t += dtinc; - w += dwinc; - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - z += dzinc; - - x += xinc; - curpixel += xinc; - zbcur += xinc; - } - } - } -} - - -static void render_spans_1cycle_notex(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - UNUSED(tilenum); - - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg, curpixel_cvbit, curpixel_memcvg; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc; - int xinc; - - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - int r, g, b, a, z; - int sr, sg, sb, sa, sz; - int xstart, xend, xendsc; - int curpixel = 0; - int x, length, scdiff; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - if (scdiff) - { - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - } - - for (j = 0; j <= length; j++) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - sz = (z >> 10) & 0x3fffff; - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_1cycle(wstate, adith, &curpixel_cvg); - - wstate->fbread1_ptr(wstate, curpixel, &curpixel_memcvg); - if (z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg)) - { - if (blender_1cycle(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap, curpixel_cvg, curpixel_cvbit)) - { - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - z += dzinc; - - x += xinc; - curpixel += xinc; - zbcur += xinc; - } - } - } -} - -static void render_spans_2cycle_complete(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - int32_t prelodfrac; - struct color nexttexel1_color; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg = 0, curpixel_cvbit = 0, curpixel_memcvg = 0; - uint32_t nextpixel_cvg; - uint32_t acalpha; - - - - int tile2 = (tilenum + 1) & 7; - int tile1 = tilenum; - int prim_tile = tilenum; - int tile3 = tilenum; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; - int xinc; - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - dwinc = wstate->spans_dw; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - dsinc = -wstate->spans_ds; - dtinc = -wstate->spans_dt; - dwinc = -wstate->spans_dw; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - - int r, g, b, a, z, s, t, w; - int sr, sg, sb, sa, sz, ss, st, sw; - int xstart, xend, xendsc; - int sss = 0, sst = 0; - uint32_t curpixel = 0; - int wen; - - int x, length, scdiff, lodlength; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - s = wstate->span[i].s; - t = wstate->span[i].t; - w = wstate->span[i].w; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - - - - - - - - if (scdiff) - { - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - s += (dsinc * scdiff); - t += (dtinc * scdiff); - w += (dwinc * scdiff); - } - - lodlength = length + scdiff; - - for (j = 0; j <= length; j++) - { - sz = (z >> 10) & 0x3fffff; - - if (!j) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_2cycle(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1, &tile2, &wstate->lod_frac); - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - texture_pipeline_cycle(wstate, &wstate->texel1_color, &wstate->texel0_color, sss, sst, tile2, 1); - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_2cycle_cycle0(wstate, adith, curpixel_cvg, &acalpha); - } - - - - s += dsinc; - t += dtinc; - w += dwinc; - - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - if (j < length || !wstate->span[i + 1].validline || lodlength < 3) - { - tclod_2cycle(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1, &tile2, &prelodfrac); - - texture_pipeline_cycle(wstate, &wstate->nexttexel_color, &wstate->nexttexel_color, sss, sst, tile1, 0); - texture_pipeline_cycle(wstate, &nexttexel1_color, &wstate->nexttexel_color, sss, sst, tile2, 1); - } - else - { - int sss2, sst2; - - ss = wstate->span[i + 1].s >> 16; - st = wstate->span[i + 1].t >> 16; - sw = wstate->span[i + 1].w >> 16; - wstate->tcdiv_ptr(ss, st, sw, &sss2, &sst2); - - tclod_2cycle_next(wstate, &sss, &sst, &sss2, &sst2, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1, &tile3, &prelodfrac, i); - - texture_pipeline_cycle(wstate, &wstate->nexttexel_color, &wstate->nexttexel_color, sss, sst, tile1, 0); - texture_pipeline_cycle(wstate, &nexttexel1_color, &wstate->nexttexel_color, sss2, sst2, tile3, 0); - } - - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - combiner_2cycle_cycle1(wstate, adith, &curpixel_cvg); - - wstate->fbread2_ptr(wstate, curpixel, &curpixel_memcvg); - - - wen = z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg); - - if (wen) - wen &= blender_2cycle_cycle0(wstate, curpixel_cvg, curpixel_cvbit); - else - wstate->memory_color = wstate->pre_memory_color; - - - - - - - x += xinc; - - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - - - - - lookup_cvmask_derivatives(j < length ? wstate->cvgbuf[x] : 0, &offx, &offy, &nextpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, nextpixel_cvg); - - wstate->lod_frac = prelodfrac; - wstate->texel0_color = wstate->nexttexel_color; - wstate->texel1_color = nexttexel1_color; - - - combiner_2cycle_cycle0(wstate, adith, nextpixel_cvg, &acalpha); - - if (wen) - { - wen &= alpha_compare(wstate, acalpha); - - - - - if (wen) - { - blender_2cycle_cycle1(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap); - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - curpixel_cvg = nextpixel_cvg; - - - - - - - z += dzinc; - - curpixel += xinc; - zbcur += xinc; - } - } - } -} - - - -static void render_spans_2cycle_notexelnext(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg = 0, curpixel_cvbit = 0, curpixel_memcvg = 0; - uint32_t nextpixel_cvg; - uint32_t acalpha; - - int tile2 = (tilenum + 1) & 7; - int tile1 = tilenum; - int prim_tile = tilenum; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; - int xinc; - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - dwinc = wstate->spans_dw; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - dsinc = -wstate->spans_ds; - dtinc = -wstate->spans_dt; - dwinc = -wstate->spans_dw; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - - int r, g, b, a, z, s, t, w; - int sr, sg, sb, sa, sz, ss, st, sw; - int xstart, xend, xendsc; - int sss = 0, sst = 0; - int curpixel = 0; - int wen; - - int x, length, scdiff; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - s = wstate->span[i].s; - t = wstate->span[i].t; - w = wstate->span[i].w; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - if (scdiff) - { - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - s += (dsinc * scdiff); - t += (dtinc * scdiff); - w += (dwinc * scdiff); - } - - for (j = 0; j <= length; j++) - { - sz = (z >> 10) & 0x3fffff; - - if (!j) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_2cycle(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1, &tile2, &wstate->lod_frac); - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - texture_pipeline_cycle(wstate, &wstate->texel1_color, &wstate->texel0_color, sss, sst, tile2, 1); - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_2cycle_cycle0(wstate, adith, curpixel_cvg, &acalpha); - } - - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - combiner_2cycle_cycle1(wstate, adith, &curpixel_cvg); - - wstate->fbread2_ptr(wstate, curpixel, &curpixel_memcvg); - - wen = z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg); - - if (wen) - wen &= blender_2cycle_cycle0(wstate, curpixel_cvg, curpixel_cvbit); - else - wstate->memory_color = wstate->pre_memory_color; - - x += xinc; - - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - s += dsinc; - t += dtinc; - w += dwinc; - - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - lookup_cvmask_derivatives(j < length ? wstate->cvgbuf[x] : 0, &offx, &offy, &nextpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, nextpixel_cvg); - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_2cycle(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1, &tile2, &wstate->lod_frac); - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - texture_pipeline_cycle(wstate, &wstate->texel1_color, &wstate->texel0_color, sss, sst, tile2, 1); - - combiner_2cycle_cycle0(wstate, adith, nextpixel_cvg, &acalpha); - - if (wen) - { - wen &= alpha_compare(wstate, acalpha); - - if (wen) - { - blender_2cycle_cycle1(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap); - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - curpixel_cvg = nextpixel_cvg; - - z += dzinc; - - curpixel += xinc; - zbcur += xinc; - } - } - } -} - - -static void render_spans_2cycle_notexel1(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg = 0, curpixel_cvbit = 0, curpixel_memcvg = 0; - uint32_t nextpixel_cvg; - uint32_t acalpha; - - int tile1 = tilenum; - int prim_tile = tilenum; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; - int xinc; - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - dwinc = wstate->spans_dw; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - dsinc = -wstate->spans_ds; - dtinc = -wstate->spans_dt; - dwinc = -wstate->spans_dw; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - - int r, g, b, a, z, s, t, w; - int sr, sg, sb, sa, sz, ss, st, sw; - int xstart, xend, xendsc; - int sss = 0, sst = 0; - int curpixel = 0; - int wen; - - int x, length, scdiff; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - s = wstate->span[i].s; - t = wstate->span[i].t; - w = wstate->span[i].w; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - if (scdiff) - { - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - s += (dsinc * scdiff); - t += (dtinc * scdiff); - w += (dwinc * scdiff); - } - - for (j = 0; j <= length; j++) - { - sz = (z >> 10) & 0x3fffff; - - if (!j) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_2cycle_notexel1(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1); - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_2cycle_cycle0(wstate, adith, curpixel_cvg, &acalpha); - } - - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - combiner_2cycle_cycle1(wstate, adith, &curpixel_cvg); - - wstate->fbread2_ptr(wstate, curpixel, &curpixel_memcvg); - - wen = z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg); - - if (wen) - wen &= blender_2cycle_cycle0(wstate, curpixel_cvg, curpixel_cvbit); - else - wstate->memory_color = wstate->pre_memory_color; - - x += xinc; - - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - s += dsinc; - t += dtinc; - w += dwinc; - - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - lookup_cvmask_derivatives(j < length ? wstate->cvgbuf[x] : 0, &offx, &offy, &nextpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, nextpixel_cvg); - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_2cycle_notexel1(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1); - - texture_pipeline_cycle(wstate, &wstate->texel0_color, &wstate->texel0_color, sss, sst, tile1, 0); - - combiner_2cycle_cycle0(wstate, adith, nextpixel_cvg, &acalpha); - - if (wen) - { - wen &= alpha_compare(wstate, acalpha); - - if (wen) - { - blender_2cycle_cycle1(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap); - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - curpixel_cvg = nextpixel_cvg; - - z += dzinc; - - curpixel += xinc; - zbcur += xinc; - } - } - } -} - - -static void render_spans_2cycle_notex(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - UNUSED(tilenum); - - int zb = wstate->zb_address >> 1; - int zbcur; - uint8_t offx = 0; - uint8_t offy = 0; - uint32_t blend_en; - uint32_t prewrap; - uint32_t curpixel_cvg = 0, curpixel_cvbit = 0, curpixel_memcvg = 0; - uint32_t nextpixel_cvg; - uint32_t acalpha; - - int i, j; - - int drinc, dginc, dbinc, dainc, dzinc; - int xinc; - if (flip) - { - drinc = wstate->spans_dr; - dginc = wstate->spans_dg; - dbinc = wstate->spans_db; - dainc = wstate->spans_da; - dzinc = wstate->spans_dz; - xinc = 1; - } - else - { - drinc = -wstate->spans_dr; - dginc = -wstate->spans_dg; - dbinc = -wstate->spans_db; - dainc = -wstate->spans_da; - dzinc = -wstate->spans_dz; - xinc = -1; - } - - uint16_t dzpix; - if (!wstate->other_modes.z_source_sel) - dzpix = (uint16_t)wstate->spans_dzpix; - else - { - dzpix = (uint16_t)wstate->primitive_delta_z; - dzinc = wstate->spans_cdz = wstate->spans_dzdy = 0; - } - int dzpixenc = dz_compress(dzpix); - - int cdith = 7, adith = 0; - - int r, g, b, a, z; - int sr, sg, sb, sa, sz; - int xstart, xend, xendsc; - int curpixel = 0; - int wen; - - int x, length, scdiff; - uint32_t fir, fig, fib; - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - r = wstate->span[i].r; - g = wstate->span[i].g; - b = wstate->span[i].b; - a = wstate->span[i].a; - z = wstate->other_modes.z_source_sel ? wstate->primitive_z : wstate->span[i].z; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - zbcur = zb + curpixel; - - if (!flip) - { - length = xendsc - xstart; - scdiff = xend - xendsc; - compute_cvg_noflip(wstate, i); - } - else - { - length = xstart - xendsc; - scdiff = xendsc - xend; - compute_cvg_flip(wstate, i); - } - - if (scdiff) - { - scdiff &= 0xfff; - r += (drinc * scdiff); - g += (dginc * scdiff); - b += (dbinc * scdiff); - a += (dainc * scdiff); - z += (dzinc * scdiff); - } - - for (j = 0; j <= length; j++) - { - sz = (z >> 10) & 0x3fffff; - - if (!j) - { - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - - lookup_cvmask_derivatives(wstate->cvgbuf[x], &offx, &offy, &curpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, curpixel_cvg); - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - combiner_2cycle_cycle0(wstate, adith, curpixel_cvg, &acalpha); - } - - z_correct(wstate, offx, offy, &sz, curpixel_cvg); - - combiner_2cycle_cycle1(wstate, adith, &curpixel_cvg); - - wstate->fbread2_ptr(wstate, curpixel, &curpixel_memcvg); - - wen = z_compare(wstate, zbcur, sz, dzpix, dzpixenc, &blend_en, &prewrap, &curpixel_cvg, curpixel_memcvg); - - if (wen) - wen &= blender_2cycle_cycle0(wstate, curpixel_cvg, curpixel_cvbit); - else - wstate->memory_color = wstate->pre_memory_color; - - x += xinc; - - r += drinc; - g += dginc; - b += dbinc; - a += dainc; - - sr = r >> 14; - sg = g >> 14; - sb = b >> 14; - sa = a >> 14; - - lookup_cvmask_derivatives(j < length ? wstate->cvgbuf[x] : 0, &offx, &offy, &nextpixel_cvg, &curpixel_cvbit); - - rgba_correct(wstate, offx, offy, sr, sg, sb, sa, nextpixel_cvg); - - combiner_2cycle_cycle0(wstate, adith, nextpixel_cvg, &acalpha); - - if (wen) - { - wen &= alpha_compare(wstate, acalpha); - - if (wen) - { - blender_2cycle_cycle1(wstate, &fir, &fig, &fib, cdith, blend_en, prewrap); - wstate->fbwrite_ptr(wstate, curpixel, fir, fig, fib, blend_en, curpixel_cvg, curpixel_memcvg); - if (wstate->other_modes.z_update_en) - z_store(zbcur, sz, dzpixenc); - } - } - - if (wstate->other_modes.f.getditherlevel < 2) - get_dither_noise(wstate, x, i, &cdith, &adith); - - curpixel_cvg = nextpixel_cvg; - - z += dzinc; - - curpixel += xinc; - zbcur += xinc; - } - } - } -} - - -static void render_spans_fill(struct rdp_state* wstate, int start, int end, int flip) -{ - if (wstate->fb_size == PIXEL_SIZE_4BIT) - { - rdp_pipeline_crashed = 1; - return; - } - - int i, j; - - int fastkillbits = wstate->other_modes.image_read_en || wstate->other_modes.z_compare_en; - int slowkillbits = wstate->other_modes.z_update_en && !wstate->other_modes.z_source_sel && !fastkillbits; - - int xinc = flip ? 1 : -1; - - int xstart = 0, xendsc; - int prevxstart; - int curpixel = 0; - int x, length; - - for (i = start; i <= end; i++) - { - prevxstart = xstart; - xstart = wstate->span[i].lx; - xendsc = wstate->span[i].rx; - - x = xendsc; - curpixel = wstate->fb_width * i + x; - length = flip ? (xstart - xendsc) : (xendsc - xstart); - - if (wstate->span[i].validline) - { - if (fastkillbits && length >= 0) - { - if (!onetimewarnings.fillmbitcrashes) - msg_warning("render_spans_fill: image_read_en %x z_update_en %x z_compare_en %x. RDP crashed", - wstate->other_modes.image_read_en, wstate->other_modes.z_update_en, wstate->other_modes.z_compare_en); - onetimewarnings.fillmbitcrashes = true; - rdp_pipeline_crashed = 1; - return; - } - - - - - - - - for (j = 0; j <= length; j++) - { - - switch(wstate->fb_size) - { - case 0: - fbfill_4(wstate, curpixel); - break; - case 1: - fbfill_8(wstate, curpixel); - break; - case 2: - fbfill_16(wstate, curpixel); - break; - case 3: - default: - fbfill_32(wstate, curpixel); - break; - } - - x += xinc; - curpixel += xinc; - } - - if (slowkillbits && length >= 0) - { - if (!onetimewarnings.fillmbitcrashes) - msg_warning("render_spans_fill: image_read_en %x z_update_en %x z_compare_en %x z_source_sel %x. RDP crashed", - wstate->other_modes.image_read_en, wstate->other_modes.z_update_en, wstate->other_modes.z_compare_en, wstate->other_modes.z_source_sel); - onetimewarnings.fillmbitcrashes = 1; - rdp_pipeline_crashed = 1; - return; - } - } - } -} - -static void render_spans_copy(struct rdp_state* wstate, int start, int end, int tilenum, int flip) -{ - int i, j, k; - - if (wstate->fb_size == PIXEL_SIZE_32BIT) - { - rdp_pipeline_crashed = 1; - return; - } - - int tile1 = tilenum; - int prim_tile = tilenum; - - int dsinc, dtinc, dwinc; - int xinc; - if (flip) - { - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - dwinc = wstate->spans_dw; - xinc = 1; - } - else - { - dsinc = -wstate->spans_ds; - dtinc = -wstate->spans_dt; - dwinc = -wstate->spans_dw; - xinc = -1; - } - - int xstart = 0, xendsc; - int s = 0, t = 0, w = 0, ss = 0, st = 0, sw = 0, sss = 0, sst = 0/*, ssw = 0*/; - int fb_index, length; - //int diff = 0; - - uint32_t hidword = 0, lowdword = 0; - //uint32_t hidword1 = 0, lowdword1 = 0; - int fbadvance = (wstate->fb_size == PIXEL_SIZE_4BIT) ? 8 : 16 >> wstate->fb_size; - uint32_t fbptr = 0; - int fbptr_advance = flip ? 8 : -8; - uint64_t copyqword = 0; - uint32_t tempdword = 0; - uint8_t tempbyte = 0; - int copywmask = 0, alphamask = 0; - int bytesperpixel = (wstate->fb_size == PIXEL_SIZE_4BIT) ? 1 : (1 << (wstate->fb_size - 1)); - uint32_t fbendptr = 0; - int32_t threshold, currthreshold; - -#define PIXELS_TO_BYTES_SPECIAL4(pix, siz) ((siz) ? PIXELS_TO_BYTES(pix, siz) : (pix)) - - for (i = start; i <= end; i++) - { - if (wstate->span[i].validline) - { - - s = wstate->span[i].s; - t = wstate->span[i].t; - w = wstate->span[i].w; - - xstart = wstate->span[i].lx; - xendsc = wstate->span[i].rx; - - fb_index = wstate->fb_width * i + xendsc; - fbptr = wstate->fb_address + PIXELS_TO_BYTES_SPECIAL4(fb_index, wstate->fb_size); - fbendptr = wstate->fb_address + PIXELS_TO_BYTES_SPECIAL4((wstate->fb_width * i + xstart), wstate->fb_size); - length = flip ? (xstart - xendsc) : (xendsc - xstart); - - - - - for (j = 0; j <= length; j += fbadvance) - { - ss = s >> 16; - st = t >> 16; - sw = w >> 16; - - wstate->tcdiv_ptr(ss, st, sw, &sss, &sst); - - tclod_copy(wstate, &sss, &sst, s, t, w, dsinc, dtinc, dwinc, prim_tile, &tile1); - - - - fetch_qword_copy(wstate, &hidword, &lowdword, sss, sst, tile1); - - - - if (wstate->fb_size == PIXEL_SIZE_16BIT || wstate->fb_size == PIXEL_SIZE_8BIT) - copyqword = ((uint64_t)hidword << 32) | ((uint64_t)lowdword); - else - copyqword = 0; - - - if (!wstate->other_modes.alpha_compare_en) - alphamask = 0xff; - else if (wstate->fb_size == PIXEL_SIZE_16BIT) - { - alphamask = 0; - alphamask |= (((copyqword >> 48) & 1) ? 0xC0 : 0); - alphamask |= (((copyqword >> 32) & 1) ? 0x30 : 0); - alphamask |= (((copyqword >> 16) & 1) ? 0xC : 0); - alphamask |= ((copyqword & 1) ? 0x3 : 0); - } - else if (wstate->fb_size == PIXEL_SIZE_8BIT) - { - alphamask = 0; - threshold = (wstate->other_modes.dither_alpha_en) ? (irand(&wstate->rseed) & 0xff) : wstate->blend_color.a; - if (wstate->other_modes.dither_alpha_en) - { - currthreshold = threshold; - alphamask |= (((copyqword >> 24) & 0xff) >= currthreshold ? 0xC0 : 0); - currthreshold = ((threshold & 3) << 6) | (threshold >> 2); - alphamask |= (((copyqword >> 16) & 0xff) >= currthreshold ? 0x30 : 0); - currthreshold = ((threshold & 0xf) << 4) | (threshold >> 4); - alphamask |= (((copyqword >> 8) & 0xff) >= currthreshold ? 0xC : 0); - currthreshold = ((threshold & 0x3f) << 2) | (threshold >> 6); - alphamask |= ((copyqword & 0xff) >= currthreshold ? 0x3 : 0); - } - else - { - alphamask |= (((copyqword >> 24) & 0xff) >= threshold ? 0xC0 : 0); - alphamask |= (((copyqword >> 16) & 0xff) >= threshold ? 0x30 : 0); - alphamask |= (((copyqword >> 8) & 0xff) >= threshold ? 0xC : 0); - alphamask |= ((copyqword & 0xff) >= threshold ? 0x3 : 0); - } - } - else - alphamask = 0; - - copywmask = (flip) ? (fbendptr - fbptr + bytesperpixel) : (fbptr - fbendptr + bytesperpixel); - - if (copywmask > 8) - copywmask = 8; - tempdword = fbptr; - k = 7; - while(copywmask > 0) - { - tempbyte = (uint8_t)((copyqword >> (k << 3)) & 0xff); - if (alphamask & (1 << k)) - { - PAIRWRITE8(tempdword, tempbyte); - } - k--; - tempdword += xinc; - copywmask--; - } - - s += dsinc; - t += dtinc; - w += dwinc; - fbptr += fbptr_advance; - } - } - } -} - -static void edgewalker_for_prims(struct rdp_state* wstate, int32_t* ewdata) -{ - int j = 0; - int xleft = 0, xright = 0, xleft_inc = 0, xright_inc = 0; - int r = 0, g = 0, b = 0, a = 0, z = 0, s = 0, t = 0, w = 0; - //int dr = 0, dg = 0, db = 0, da = 0; - int drdx = 0, dgdx = 0, dbdx = 0, dadx = 0, dzdx = 0, dsdx = 0, dtdx = 0, dwdx = 0; - int drdy = 0, dgdy = 0, dbdy = 0, dady = 0, dzdy = 0, dsdy = 0, dtdy = 0, dwdy = 0; - int drde = 0, dgde = 0, dbde = 0, dade = 0, dzde = 0, dsde = 0, dtde = 0, dwde = 0; - int tilenum = 0, flip = 0; - int32_t yl = 0, ym = 0, yh = 0; - int32_t xl = 0, xm = 0, xh = 0; - int32_t dxldy = 0, dxhdy = 0, dxmdy = 0; - - if (wstate->other_modes.f.stalederivs) - { - deduce_derivatives(wstate); - wstate->other_modes.f.stalederivs = 0; - } - - - flip = (ewdata[0] & 0x800000) != 0; - wstate->max_level = (ewdata[0] >> 19) & 7; - tilenum = (ewdata[0] >> 16) & 7; - - - yl = SIGN(ewdata[0], 14); - ym = ewdata[1] >> 16; - ym = SIGN(ym, 14); - yh = SIGN(ewdata[1], 14); - - xl = SIGN(ewdata[2], 28); - xh = SIGN(ewdata[4], 28); - xm = SIGN(ewdata[6], 28); - - dxldy = SIGN(ewdata[3], 30); - - - - dxhdy = SIGN(ewdata[5], 30); - dxmdy = SIGN(ewdata[7], 30); - - - r = (ewdata[8] & 0xffff0000) | ((ewdata[12] >> 16) & 0x0000ffff); - g = ((ewdata[8] << 16) & 0xffff0000) | (ewdata[12] & 0x0000ffff); - b = (ewdata[9] & 0xffff0000) | ((ewdata[13] >> 16) & 0x0000ffff); - a = ((ewdata[9] << 16) & 0xffff0000) | (ewdata[13] & 0x0000ffff); - drdx = (ewdata[10] & 0xffff0000) | ((ewdata[14] >> 16) & 0x0000ffff); - dgdx = ((ewdata[10] << 16) & 0xffff0000) | (ewdata[14] & 0x0000ffff); - dbdx = (ewdata[11] & 0xffff0000) | ((ewdata[15] >> 16) & 0x0000ffff); - dadx = ((ewdata[11] << 16) & 0xffff0000) | (ewdata[15] & 0x0000ffff); - drde = (ewdata[16] & 0xffff0000) | ((ewdata[20] >> 16) & 0x0000ffff); - dgde = ((ewdata[16] << 16) & 0xffff0000) | (ewdata[20] & 0x0000ffff); - dbde = (ewdata[17] & 0xffff0000) | ((ewdata[21] >> 16) & 0x0000ffff); - dade = ((ewdata[17] << 16) & 0xffff0000) | (ewdata[21] & 0x0000ffff); - drdy = (ewdata[18] & 0xffff0000) | ((ewdata[22] >> 16) & 0x0000ffff); - dgdy = ((ewdata[18] << 16) & 0xffff0000) | (ewdata[22] & 0x0000ffff); - dbdy = (ewdata[19] & 0xffff0000) | ((ewdata[23] >> 16) & 0x0000ffff); - dady = ((ewdata[19] << 16) & 0xffff0000) | (ewdata[23] & 0x0000ffff); - - - s = (ewdata[24] & 0xffff0000) | ((ewdata[28] >> 16) & 0x0000ffff); - t = ((ewdata[24] << 16) & 0xffff0000) | (ewdata[28] & 0x0000ffff); - w = (ewdata[25] & 0xffff0000) | ((ewdata[29] >> 16) & 0x0000ffff); - dsdx = (ewdata[26] & 0xffff0000) | ((ewdata[30] >> 16) & 0x0000ffff); - dtdx = ((ewdata[26] << 16) & 0xffff0000) | (ewdata[30] & 0x0000ffff); - dwdx = (ewdata[27] & 0xffff0000) | ((ewdata[31] >> 16) & 0x0000ffff); - dsde = (ewdata[32] & 0xffff0000) | ((ewdata[36] >> 16) & 0x0000ffff); - dtde = ((ewdata[32] << 16) & 0xffff0000) | (ewdata[36] & 0x0000ffff); - dwde = (ewdata[33] & 0xffff0000) | ((ewdata[37] >> 16) & 0x0000ffff); - dsdy = (ewdata[34] & 0xffff0000) | ((ewdata[38] >> 16) & 0x0000ffff); - dtdy = ((ewdata[34] << 16) & 0xffff0000) | (ewdata[38] & 0x0000ffff); - dwdy = (ewdata[35] & 0xffff0000) | ((ewdata[39] >> 16) & 0x0000ffff); - - - z = ewdata[40]; - dzdx = ewdata[41]; - dzde = ewdata[42]; - dzdy = ewdata[43]; - - - - - - - - wstate->spans_ds = dsdx & ~0x1f; - wstate->spans_dt = dtdx & ~0x1f; - wstate->spans_dw = dwdx & ~0x1f; - wstate->spans_dr = drdx & ~0x1f; - wstate->spans_dg = dgdx & ~0x1f; - wstate->spans_db = dbdx & ~0x1f; - wstate->spans_da = dadx & ~0x1f; - wstate->spans_dz = dzdx; - - - wstate->spans_drdy = drdy >> 14; - wstate->spans_dgdy = dgdy >> 14; - wstate->spans_dbdy = dbdy >> 14; - wstate->spans_dady = dady >> 14; - wstate->spans_dzdy = dzdy >> 10; - wstate->spans_drdy = SIGN(wstate->spans_drdy, 13); - wstate->spans_dgdy = SIGN(wstate->spans_dgdy, 13); - wstate->spans_dbdy = SIGN(wstate->spans_dbdy, 13); - wstate->spans_dady = SIGN(wstate->spans_dady, 13); - wstate->spans_dzdy = SIGN(wstate->spans_dzdy, 22); - wstate->spans_cdr = wstate->spans_dr >> 14; - wstate->spans_cdr = SIGN(wstate->spans_cdr, 13); - wstate->spans_cdg = wstate->spans_dg >> 14; - wstate->spans_cdg = SIGN(wstate->spans_cdg, 13); - wstate->spans_cdb = wstate->spans_db >> 14; - wstate->spans_cdb = SIGN(wstate->spans_cdb, 13); - wstate->spans_cda = wstate->spans_da >> 14; - wstate->spans_cda = SIGN(wstate->spans_cda, 13); - wstate->spans_cdz = wstate->spans_dz >> 10; - wstate->spans_cdz = SIGN(wstate->spans_cdz, 22); - - wstate->spans_dsdy = dsdy & ~0x7fff; - wstate->spans_dtdy = dtdy & ~0x7fff; - wstate->spans_dwdy = dwdy & ~0x7fff; - - - int dzdy_dz = (dzdy >> 16) & 0xffff; - int dzdx_dz = (dzdx >> 16) & 0xffff; - - wstate->spans_dzpix = ((dzdy_dz & 0x8000) ? ((~dzdy_dz) & 0x7fff) : dzdy_dz) + ((dzdx_dz & 0x8000) ? ((~dzdx_dz) & 0x7fff) : dzdx_dz); - wstate->spans_dzpix = normalize_dzpix(wstate->spans_dzpix & 0xffff) & 0xffff; - - - - xleft_inc = (dxmdy >> 2) & ~0x1; - xright_inc = (dxhdy >> 2) & ~0x1; - - - - xright = xh & ~0x1; - xleft = xm & ~0x1; - - int k = 0; - - int dsdiff, dtdiff, dwdiff, drdiff, dgdiff, dbdiff, dadiff, dzdiff; - int sign_dxhdy = (ewdata[5] & 0x80000000) != 0; - - int dsdeh, dtdeh, dwdeh, drdeh, dgdeh, dbdeh, dadeh, dzdeh, dsdyh, dtdyh, dwdyh, drdyh, dgdyh, dbdyh, dadyh, dzdyh; - int do_offset = !(sign_dxhdy ^ flip); - - if (do_offset) - { - dsdeh = dsde & ~0x1ff; - dtdeh = dtde & ~0x1ff; - dwdeh = dwde & ~0x1ff; - drdeh = drde & ~0x1ff; - dgdeh = dgde & ~0x1ff; - dbdeh = dbde & ~0x1ff; - dadeh = dade & ~0x1ff; - dzdeh = dzde & ~0x1ff; - - dsdyh = dsdy & ~0x1ff; - dtdyh = dtdy & ~0x1ff; - dwdyh = dwdy & ~0x1ff; - drdyh = drdy & ~0x1ff; - dgdyh = dgdy & ~0x1ff; - dbdyh = dbdy & ~0x1ff; - dadyh = dady & ~0x1ff; - dzdyh = dzdy & ~0x1ff; - - - - - - - - dsdiff = dsdeh - (dsdeh >> 2) - dsdyh + (dsdyh >> 2); - dtdiff = dtdeh - (dtdeh >> 2) - dtdyh + (dtdyh >> 2); - dwdiff = dwdeh - (dwdeh >> 2) - dwdyh + (dwdyh >> 2); - drdiff = drdeh - (drdeh >> 2) - drdyh + (drdyh >> 2); - dgdiff = dgdeh - (dgdeh >> 2) - dgdyh + (dgdyh >> 2); - dbdiff = dbdeh - (dbdeh >> 2) - dbdyh + (dbdyh >> 2); - dadiff = dadeh - (dadeh >> 2) - dadyh + (dadyh >> 2); - dzdiff = dzdeh - (dzdeh >> 2) - dzdyh + (dzdyh >> 2); - - } - else - dsdiff = dtdiff = dwdiff = drdiff = dgdiff = dbdiff = dadiff = dzdiff = 0; - - int xfrac = 0; - - int dsdxh, dtdxh, dwdxh, drdxh, dgdxh, dbdxh, dadxh, dzdxh; - if (wstate->other_modes.cycle_type != CYCLE_TYPE_COPY) - { - dsdxh = (dsdx >> 8) & ~1; - dtdxh = (dtdx >> 8) & ~1; - dwdxh = (dwdx >> 8) & ~1; - drdxh = (drdx >> 8) & ~1; - dgdxh = (dgdx >> 8) & ~1; - dbdxh = (dbdx >> 8) & ~1; - dadxh = (dadx >> 8) & ~1; - dzdxh = (dzdx >> 8) & ~1; - } - else - dsdxh = dtdxh = dwdxh = drdxh = dgdxh = dbdxh = dadxh = dzdxh = 0; - - - - - -#define ADJUST_ATTR_PRIM() \ -{ \ - wstate->span[j].s = ((s & ~0x1ff) + dsdiff - (xfrac * dsdxh)) & ~0x3ff; \ - wstate->span[j].t = ((t & ~0x1ff) + dtdiff - (xfrac * dtdxh)) & ~0x3ff; \ - wstate->span[j].w = ((w & ~0x1ff) + dwdiff - (xfrac * dwdxh)) & ~0x3ff; \ - wstate->span[j].r = ((r & ~0x1ff) + drdiff - (xfrac * drdxh)) & ~0x3ff; \ - wstate->span[j].g = ((g & ~0x1ff) + dgdiff - (xfrac * dgdxh)) & ~0x3ff; \ - wstate->span[j].b = ((b & ~0x1ff) + dbdiff - (xfrac * dbdxh)) & ~0x3ff; \ - wstate->span[j].a = ((a & ~0x1ff) + dadiff - (xfrac * dadxh)) & ~0x3ff; \ - wstate->span[j].z = ((z & ~0x1ff) + dzdiff - (xfrac * dzdxh)) & ~0x3ff; \ -} - - -#define ADDVALUES_PRIM() { \ - s += dsde; \ - t += dtde; \ - w += dwde; \ - r += drde; \ - g += dgde; \ - b += dbde; \ - a += dade; \ - z += dzde; \ -} - - int32_t maxxmx = 0, minxmx = 0, maxxhx = 0, minxhx = 0; - - int spix = 0; - int ycur = yh & ~3; - int ldflag = (sign_dxhdy ^ flip) ? 0 : 3; - int invaly = 1; - //int length = 0; - int32_t xrsc = 0, xlsc = 0, stickybit = 0; - int32_t yllimit = 0, yhlimit = 0; - if (yl & 0x2000) - yllimit = 1; - else if (yl & 0x1000) - yllimit = 0; - else - yllimit = (yl & 0xfff) < wstate->clip.yl; - yllimit = yllimit ? yl : wstate->clip.yl; - - int ylfar = yllimit | 3; - if ((yl >> 2) > (ylfar >> 2)) - ylfar += 4; - else if ((yllimit >> 2) >= 0 && (yllimit >> 2) < 1023) - wstate->span[(yllimit >> 2) + 1].validline = 0; - - - if (yh & 0x2000) - yhlimit = 0; - else if (yh & 0x1000) - yhlimit = 1; - else - yhlimit = (yh >= wstate->clip.yh); - yhlimit = yhlimit ? yh : wstate->clip.yh; - - int yhclose = yhlimit & ~3; - - int32_t clipxlshift = wstate->clip.xl << 1; - int32_t clipxhshift = wstate->clip.xh << 1; - int allover = 1, allunder = 1, curover = 0, curunder = 0; - int allinval = 1; - int32_t curcross = 0; - - xfrac = ((xright >> 8) & 0xff); - - - if (flip) - { - for (k = ycur; k <= ylfar; k++) - { - if (k == ym) - { - - xleft = xl & ~1; - xleft_inc = (dxldy >> 2) & ~1; - } - - spix = k & 3; - - if (k >= yhclose) - { - invaly = k < yhlimit || k >= yllimit; - - j = k >> 2; - - if (spix == 0) - { - maxxmx = 0; - minxhx = 0xfff; - allover = allunder = 1; - allinval = 1; - } - - stickybit = ((xright >> 1) & 0x1fff) > 0; - xrsc = ((xright >> 13) & 0x1ffe) | stickybit; - - - curunder = ((xright & 0x8000000) || (xrsc < clipxhshift && !(xright & 0x4000000))); - - xrsc = curunder ? clipxhshift : (((xright >> 13) & 0x3ffe) | stickybit); - curover = ((xrsc & 0x2000) || (xrsc & 0x1fff) >= clipxlshift); - xrsc = curover ? clipxlshift : xrsc; - wstate->span[j].majorx[spix] = xrsc & 0x1fff; - allover &= curover; - allunder &= curunder; - - stickybit = ((xleft >> 1) & 0x1fff) > 0; - xlsc = ((xleft >> 13) & 0x1ffe) | stickybit; - curunder = ((xleft & 0x8000000) || (xlsc < clipxhshift && !(xleft & 0x4000000))); - xlsc = curunder ? clipxhshift : (((xleft >> 13) & 0x3ffe) | stickybit); - curover = ((xlsc & 0x2000) || (xlsc & 0x1fff) >= clipxlshift); - xlsc = curover ? clipxlshift : xlsc; - wstate->span[j].minorx[spix] = xlsc & 0x1fff; - allover &= curover; - allunder &= curunder; - - - - curcross = ((xleft ^ (1 << 27)) & (0x3fff << 14)) < ((xright ^ (1 << 27)) & (0x3fff << 14)); - - - invaly |= curcross; - wstate->span[j].invalyscan[spix] = invaly; - allinval &= invaly; - - if (!invaly) - { - maxxmx = (((xlsc >> 3) & 0xfff) > maxxmx) ? (xlsc >> 3) & 0xfff : maxxmx; - minxhx = (((xrsc >> 3) & 0xfff) < minxhx) ? (xrsc >> 3) & 0xfff : minxhx; - } - - if (spix == ldflag) - { - - - - - wstate->span[j].unscrx = SIGN(xright >> 16, 12); - xfrac = (xright >> 8) & 0xff; - ADJUST_ATTR_PRIM(); - } - - if (spix == 3) - { - wstate->span[j].lx = maxxmx; - wstate->span[j].rx = minxhx; - wstate->span[j].validline = !allinval && !allover && !allunder && (!wstate->scfield || (wstate->scfield && !(wstate->sckeepodd ^ (j & 1)))) && (!wstate->stride || j % wstate->stride == wstate->offset); - - } - - - } - - if (spix == 3) - { - ADDVALUES_PRIM(); - } - - - - xleft += xleft_inc; - xright += xright_inc; - - } - } - else - { - for (k = ycur; k <= ylfar; k++) - { - if (k == ym) - { - xleft = xl & ~1; - xleft_inc = (dxldy >> 2) & ~1; - } - - spix = k & 3; - - if (k >= yhclose) - { - invaly = k < yhlimit || k >= yllimit; - j = k >> 2; - - if (spix == 0) - { - maxxhx = 0; - minxmx = 0xfff; - allover = allunder = 1; - allinval = 1; - } - - stickybit = ((xright >> 1) & 0x1fff) > 0; - xrsc = ((xright >> 13) & 0x1ffe) | stickybit; - curunder = ((xright & 0x8000000) || (xrsc < clipxhshift && !(xright & 0x4000000))); - xrsc = curunder ? clipxhshift : (((xright >> 13) & 0x3ffe) | stickybit); - curover = ((xrsc & 0x2000) || (xrsc & 0x1fff) >= clipxlshift); - xrsc = curover ? clipxlshift : xrsc; - wstate->span[j].majorx[spix] = xrsc & 0x1fff; - allover &= curover; - allunder &= curunder; - - stickybit = ((xleft >> 1) & 0x1fff) > 0; - xlsc = ((xleft >> 13) & 0x1ffe) | stickybit; - curunder = ((xleft & 0x8000000) || (xlsc < clipxhshift && !(xleft & 0x4000000))); - xlsc = curunder ? clipxhshift : (((xleft >> 13) & 0x3ffe) | stickybit); - curover = ((xlsc & 0x2000) || (xlsc & 0x1fff) >= clipxlshift); - xlsc = curover ? clipxlshift : xlsc; - wstate->span[j].minorx[spix] = xlsc & 0x1fff; - allover &= curover; - allunder &= curunder; - - curcross = ((xright ^ (1 << 27)) & (0x3fff << 14)) < ((xleft ^ (1 << 27)) & (0x3fff << 14)); - - invaly |= curcross; - wstate->span[j].invalyscan[spix] = invaly; - allinval &= invaly; - - if (!invaly) - { - minxmx = (((xlsc >> 3) & 0xfff) < minxmx) ? (xlsc >> 3) & 0xfff : minxmx; - maxxhx = (((xrsc >> 3) & 0xfff) > maxxhx) ? (xrsc >> 3) & 0xfff : maxxhx; - } - - if (spix == ldflag) - { - wstate->span[j].unscrx = SIGN(xright >> 16, 12); - xfrac = (xright >> 8) & 0xff; - ADJUST_ATTR_PRIM(); - } - - if (spix == 3) - { - wstate->span[j].lx = minxmx; - wstate->span[j].rx = maxxhx; - wstate->span[j].validline = !allinval && !allover && !allunder && (!wstate->scfield || (wstate->scfield && !(wstate->sckeepodd ^ (j & 1)))) && (!wstate->stride || j % wstate->stride == wstate->offset); - } - - } - - if (spix == 3) - { - ADDVALUES_PRIM(); - } - - xleft += xleft_inc; - xright += xright_inc; - - } - } - - - - - switch(wstate->other_modes.cycle_type) - { - case CYCLE_TYPE_1: - switch (wstate->other_modes.f.textureuselevel0) - { - case 0: render_spans_1cycle_complete(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - case 1: render_spans_1cycle_notexel1(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - case 2: default: render_spans_1cycle_notex(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - } - break; - case CYCLE_TYPE_2: - switch (wstate->other_modes.f.textureuselevel1) - { - case 0: render_spans_2cycle_complete(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - case 1: render_spans_2cycle_notexelnext(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - case 2: render_spans_2cycle_notexel1(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - case 3: default: render_spans_2cycle_notex(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - } - break; - case CYCLE_TYPE_COPY: render_spans_copy(wstate, yhlimit >> 2, yllimit >> 2, tilenum, flip); break; - case CYCLE_TYPE_FILL: render_spans_fill(wstate, yhlimit >> 2, yllimit >> 2, flip); break; - default: msg_error("cycle_type %d", wstate->other_modes.cycle_type); break; - } - - -} - -static void rasterizer_init(struct rdp_state* wstate) -{ - wstate->clip.xh = 0x2000; - wstate->clip.yh = 0x2000; -} - -void rdp_tri_noshade(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 8 * sizeof(int32_t)); - memset(&ewdata[8], 0, 36 * sizeof(int32_t)); - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_tri_noshade_z(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 8 * sizeof(int32_t)); - memset(&ewdata[8], 0, 32 * sizeof(int32_t)); - memcpy(&ewdata[40], args + 8, 4 * sizeof(int32_t)); - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_tri_tex(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 8 * sizeof(int32_t)); - memset(&ewdata[8], 0, 16 * sizeof(int32_t)); - memcpy(&ewdata[24], args + 8, 16 * sizeof(int32_t)); - memset(&ewdata[40], 0, 4 * sizeof(int32_t)); - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_tri_tex_z(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 8 * sizeof(int32_t)); - memset(&ewdata[8], 0, 16 * sizeof(int32_t)); - memcpy(&ewdata[24], args + 8, 16 * sizeof(int32_t)); - memcpy(&ewdata[40], args + 24, 4 * sizeof(int32_t)); - - - - - - - edgewalker_for_prims(wstate, ewdata); - - -} - -void rdp_tri_shade(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 24 * sizeof(int32_t)); - memset(&ewdata[24], 0, 20 * sizeof(int32_t)); - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_tri_shade_z(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 24 * sizeof(int32_t)); - memset(&ewdata[24], 0, 16 * sizeof(int32_t)); - memcpy(&ewdata[40], args + 24, 4 * sizeof(int32_t)); - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_tri_texshade(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, 40 * sizeof(int32_t)); - memset(&ewdata[40], 0, 4 * sizeof(int32_t)); - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_tri_texshade_z(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t ewdata[CMD_MAX_INTS]; - memcpy(&ewdata[0], args, CMD_MAX_SIZE); - - - - - - edgewalker_for_prims(wstate, ewdata); - - -} - -void rdp_tex_rect(struct rdp_state* wstate, const uint32_t* args) -{ - uint32_t tilenum = (args[1] >> 24) & 0x7; - uint32_t xl = (args[0] >> 12) & 0xfff; - uint32_t yl = (args[0] >> 0) & 0xfff; - uint32_t xh = (args[1] >> 12) & 0xfff; - uint32_t yh = (args[1] >> 0) & 0xfff; - - int32_t s = (args[2] >> 16) & 0xffff; - int32_t t = (args[2] >> 0) & 0xffff; - int32_t dsdx = (args[3] >> 16) & 0xffff; - int32_t dtdy = (args[3] >> 0) & 0xffff; - - dsdx = SIGN16(dsdx); - dtdy = SIGN16(dtdy); - - if (wstate->other_modes.cycle_type == CYCLE_TYPE_FILL || wstate->other_modes.cycle_type == CYCLE_TYPE_COPY) - yl |= 3; - - uint32_t xlint = (xl >> 2) & 0x3ff; - uint32_t xhint = (xh >> 2) & 0x3ff; - - int32_t ewdata[CMD_MAX_INTS]; - ewdata[0] = (0x24 << 24) | ((0x80 | tilenum) << 16) | yl; - ewdata[1] = (yl << 16) | yh; - ewdata[2] = (xlint << 16) | ((xl & 3) << 14); - ewdata[3] = 0; - ewdata[4] = (xhint << 16) | ((xh & 3) << 14); - ewdata[5] = 0; - ewdata[6] = (xlint << 16) | ((xl & 3) << 14); - ewdata[7] = 0; - memset(&ewdata[8], 0, 16 * sizeof(uint32_t)); - ewdata[24] = (s << 16) | t; - ewdata[25] = 0; - ewdata[26] = ((dsdx >> 5) << 16); - ewdata[27] = 0; - ewdata[28] = 0; - ewdata[29] = 0; - ewdata[30] = ((dsdx & 0x1f) << 11) << 16; - ewdata[31] = 0; - ewdata[32] = (dtdy >> 5) & 0xffff; - ewdata[33] = 0; - ewdata[34] = (dtdy >> 5) & 0xffff; - ewdata[35] = 0; - ewdata[36] = (dtdy & 0x1f) << 11; - ewdata[37] = 0; - ewdata[38] = (dtdy & 0x1f) << 11; - ewdata[39] = 0; - memset(&ewdata[40], 0, 4 * sizeof(int32_t)); - - - - edgewalker_for_prims(wstate, ewdata); - -} - -void rdp_tex_rect_flip(struct rdp_state* wstate, const uint32_t* args) -{ - uint32_t tilenum = (args[1] >> 24) & 0x7; - uint32_t xl = (args[0] >> 12) & 0xfff; - uint32_t yl = (args[0] >> 0) & 0xfff; - uint32_t xh = (args[1] >> 12) & 0xfff; - uint32_t yh = (args[1] >> 0) & 0xfff; - - int32_t s = (args[2] >> 16) & 0xffff; - int32_t t = (args[2] >> 0) & 0xffff; - int32_t dsdx = (args[3] >> 16) & 0xffff; - int32_t dtdy = (args[3] >> 0) & 0xffff; - - dsdx = SIGN16(dsdx); - dtdy = SIGN16(dtdy); - - if (wstate->other_modes.cycle_type == CYCLE_TYPE_FILL || wstate->other_modes.cycle_type == CYCLE_TYPE_COPY) - yl |= 3; - - uint32_t xlint = (xl >> 2) & 0x3ff; - uint32_t xhint = (xh >> 2) & 0x3ff; - - int32_t ewdata[CMD_MAX_INTS]; - ewdata[0] = (0x25 << 24) | ((0x80 | tilenum) << 16) | yl; - ewdata[1] = (yl << 16) | yh; - ewdata[2] = (xlint << 16) | ((xl & 3) << 14); - ewdata[3] = 0; - ewdata[4] = (xhint << 16) | ((xh & 3) << 14); - ewdata[5] = 0; - ewdata[6] = (xlint << 16) | ((xl & 3) << 14); - ewdata[7] = 0; - memset(&ewdata[8], 0, 16 * sizeof(int32_t)); - ewdata[24] = (s << 16) | t; - ewdata[25] = 0; - - ewdata[26] = (dtdy >> 5) & 0xffff; - ewdata[27] = 0; - ewdata[28] = 0; - ewdata[29] = 0; - ewdata[30] = ((dtdy & 0x1f) << 11); - ewdata[31] = 0; - ewdata[32] = (dsdx >> 5) << 16; - ewdata[33] = 0; - ewdata[34] = (dsdx >> 5) << 16; - ewdata[35] = 0; - ewdata[36] = (dsdx & 0x1f) << 27; - ewdata[37] = 0; - ewdata[38] = (dsdx & 0x1f) << 27; - ewdata[39] = 0; - memset(&ewdata[40], 0, 4 * sizeof(int32_t)); - - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_fill_rect(struct rdp_state* wstate, const uint32_t* args) -{ - uint32_t xl = (args[0] >> 12) & 0xfff; - uint32_t yl = (args[0] >> 0) & 0xfff; - uint32_t xh = (args[1] >> 12) & 0xfff; - uint32_t yh = (args[1] >> 0) & 0xfff; - - if (wstate->other_modes.cycle_type == CYCLE_TYPE_FILL || wstate->other_modes.cycle_type == CYCLE_TYPE_COPY) - yl |= 3; - - uint32_t xlint = (xl >> 2) & 0x3ff; - uint32_t xhint = (xh >> 2) & 0x3ff; - - int32_t ewdata[CMD_MAX_INTS]; - ewdata[0] = (0x3680 << 16) | yl; - ewdata[1] = (yl << 16) | yh; - ewdata[2] = (xlint << 16) | ((xl & 3) << 14); - ewdata[3] = 0; - ewdata[4] = (xhint << 16) | ((xh & 3) << 14); - ewdata[5] = 0; - ewdata[6] = (xlint << 16) | ((xl & 3) << 14); - ewdata[7] = 0; - memset(&ewdata[8], 0, 36 * sizeof(int32_t)); - - edgewalker_for_prims(wstate, ewdata); -} - -void rdp_set_prim_depth(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->primitive_z = args[1] & (0x7fff << 16); - - - wstate->primitive_delta_z = (uint16_t)(args[1]); -} - -void rdp_set_scissor(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->clip.xh = (args[0] >> 12) & 0xfff; - wstate->clip.yh = (args[0] >> 0) & 0xfff; - wstate->clip.xl = (args[1] >> 12) & 0xfff; - wstate->clip.yl = (args[1] >> 0) & 0xfff; - - wstate->scfield = (args[1] >> 25) & 1; - wstate->sckeepodd = (args[1] >> 24) & 1; -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/rdram.c b/angrylion-rdp-plus/src/core/n64video/rdp/rdram.c deleted file mode 100644 index 1d3fb0e..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/rdram.c +++ /dev/null @@ -1,167 +0,0 @@ -#ifdef N64VIDEO_C - -// -// rdram.c: RDRAM memory interface -// - -#define RDRAM_MASK 0x00ffffff - -#define HB_CLEAN 4 - -// macros used to interface with AL's code -#define RREADADDR8(rdst, in) {(rdst) = rdram_read_idx8((in));} -#define RREADIDX16(rdst, in) {(rdst) = rdram_read_idx16((in));} -#define RREADIDX32(rdst, in) {(rdst) = rdram_read_idx32((in));} - -#define RWRITEADDR8(in, val) rdram_write_idx8((in), (val)) -#define RWRITEIDX16(in, val) rdram_write_idx16((in), (val)) -#define RWRITEIDX32(in, val) rdram_write_idx32((in), (val)) - -#define PAIRREAD16(rdst, hdst, in) rdram_read_pair16(&rdst, &hdst, (in)) - -#define PAIRWRITE16(in, rval, hval) rdram_write_pair16((in), (rval), (hval)) - -#define PAIRWRITE32(in, rval, hval0, hval1) rdram_write_pair32((in), (rval), (hval0), (hval1)) - -#define PAIRWRITE8(in, rval) rdram_write_pair8((in), (rval)) - -// pointer indexing limits for aliasing RDRAM reads and writes -static uint32_t idxlim8; -static uint32_t idxlim16; -static uint32_t idxlim32; - -static uint32_t* rdram32; -static uint16_t* rdram16; -static uint8_t* rdram8; -static uint8_t rdram_hidden[RDRAM_MAX_SIZE / 2]; - -static void rdram_init(void) -{ - idxlim8 = config.gfx.rdram_size - 1; - idxlim16 = (idxlim8 >> 1) & 0xffffffu; - idxlim32 = (idxlim8 >> 2) & 0xffffffu; - - rdram32 = (uint32_t*)config.gfx.rdram; - rdram16 = (uint16_t*)config.gfx.rdram; - rdram8 = config.gfx.rdram; - - memset(rdram_hidden, HB_CLEAN, sizeof(rdram_hidden)); -} - -static STRICTINLINE bool rdram_valid_idx8(uint32_t in) -{ - return in <= idxlim8; -} - -static STRICTINLINE bool rdram_valid_idx16(uint32_t in) -{ - return in <= idxlim16; -} - -static STRICTINLINE bool rdram_valid_idx32(uint32_t in) -{ - return in <= idxlim32; -} - -static STRICTINLINE uint8_t rdram_read_idx8(uint32_t in) -{ - in &= RDRAM_MASK; - return rdram_valid_idx8(in) ? rdram8[in ^ BYTE_ADDR_XOR] : 0; -} - -static STRICTINLINE uint8_t rdram_read_idx8_fast(uint32_t in) -{ - return rdram8[in ^ BYTE_ADDR_XOR]; -} - -static STRICTINLINE uint16_t rdram_read_idx16(uint32_t in) -{ - in &= RDRAM_MASK >> 1; - return rdram_valid_idx16(in) ? rdram16[in ^ WORD_ADDR_XOR] : 0; -} - -static STRICTINLINE uint16_t rdram_read_idx16_fast(uint32_t in) -{ - return rdram16[in ^ WORD_ADDR_XOR]; -} - -static STRICTINLINE uint32_t rdram_read_idx32(uint32_t in) -{ - in &= RDRAM_MASK >> 2; - return rdram_valid_idx32(in) ? rdram32[in] : 0; -} - -static STRICTINLINE uint32_t rdram_read_idx32_fast(uint32_t in) -{ - return rdram32[in]; -} - -static STRICTINLINE void rdram_write_idx8(uint32_t in, uint8_t val) -{ - in &= RDRAM_MASK; - if (rdram_valid_idx8(in)) { - rdram8[in ^ BYTE_ADDR_XOR] = val; - } -} - -static STRICTINLINE void rdram_write_idx16(uint32_t in, uint16_t val) -{ - in &= RDRAM_MASK >> 1; - if (rdram_valid_idx16(in)) { - rdram16[in ^ WORD_ADDR_XOR] = val; - } -} - -static STRICTINLINE void rdram_write_idx32(uint32_t in, uint32_t val) -{ - in &= RDRAM_MASK >> 2; - if (rdram_valid_idx32(in)) { - rdram32[in] = val; - } -} - -static STRICTINLINE void rdram_read_pair16(uint16_t* rdst, uint8_t* hdst, uint32_t in) -{ - in &= RDRAM_MASK >> 1; - if (rdram_valid_idx16(in)) { - *rdst = rdram16[in ^ WORD_ADDR_XOR]; - *hdst = rdram_hidden[in]; - if (*hdst & HB_CLEAN) { - *hdst = (*rdst & 1) ? 3 : 0; - } - } else { - *rdst = *hdst = 0; - } -} - -static STRICTINLINE void rdram_write_pair8(uint32_t in, uint8_t rval) -{ - in &= RDRAM_MASK; - if (rdram_valid_idx8(in)) { - if (in & 1) { - rdram_hidden[in >> 1] = (rval & 1) ? 3 : 0; - } - rdram8[in ^ BYTE_ADDR_XOR] = rval; - } -} - -static STRICTINLINE void rdram_write_pair16(uint32_t in, uint16_t rval, uint8_t hval) -{ - in &= RDRAM_MASK >> 1; - if (rdram_valid_idx16(in)) { - rdram16[in ^ WORD_ADDR_XOR] = rval; - rdram_hidden[in] = hval; - } -} - -static STRICTINLINE void rdram_write_pair32(uint32_t in, uint32_t rval, uint8_t hval0, uint8_t hval1) -{ - in &= RDRAM_MASK >> 2; - if (rdram_valid_idx32(in)) { - rdram32[in] = rval; - rdram_hidden[in << 1] = hval0; - rdram_hidden[(in << 1) + 1] = hval1; - } -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/tcoord.c b/angrylion-rdp-plus/src/core/n64video/rdp/tcoord.c deleted file mode 100644 index 3c09544..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/tcoord.c +++ /dev/null @@ -1,1158 +0,0 @@ -#ifdef N64VIDEO_C - -static const int32_t norm_point_table[64] = { - 0x4000, 0x3f04, 0x3e10, 0x3d22, 0x3c3c, 0x3b5d, 0x3a83, 0x39b1, - 0x38e4, 0x381c, 0x375a, 0x369d, 0x35e5, 0x3532, 0x3483, 0x33d9, - 0x3333, 0x3291, 0x31f4, 0x3159, 0x30c3, 0x3030, 0x2fa1, 0x2f15, - 0x2e8c, 0x2e06, 0x2d83, 0x2d03, 0x2c86, 0x2c0b, 0x2b93, 0x2b1e, - 0x2aab, 0x2a3a, 0x29cc, 0x2960, 0x28f6, 0x288e, 0x2828, 0x27c4, - 0x2762, 0x2702, 0x26a4, 0x2648, 0x25ed, 0x2594, 0x253d, 0x24e7, - 0x2492, 0x243f, 0x23ee, 0x239e, 0x234f, 0x2302, 0x22b6, 0x226c, - 0x2222, 0x21da, 0x2193, 0x214d, 0x2108, 0x20c5, 0x2082, 0x2041 -}; - -static const int32_t norm_slope_table[64] = { - 0xf03, 0xf0b, 0xf11, 0xf19, 0xf20, 0xf25, 0xf2d, 0xf32, - 0xf37, 0xf3d, 0xf42, 0xf47, 0xf4c, 0xf50, 0xf55, 0xf59, - 0xf5d, 0xf62, 0xf64, 0xf69, 0xf6c, 0xf70, 0xf73, 0xf76, - 0xf79, 0xf7c, 0xf7f, 0xf82, 0xf84, 0xf87, 0xf8a, 0xf8c, - 0xf8e, 0xf91, 0xf93, 0xf95, 0xf97, 0xf99, 0xf9b, 0xf9d, - 0xf9f, 0xfa1, 0xfa3, 0xfa4, 0xfa6, 0xfa8, 0xfa9, 0xfaa, - 0xfac, 0xfae, 0xfaf, 0xfb0, 0xfb2, 0xfb3, 0xfb5, 0xfb5, - 0xfb7, 0xfb8, 0xfb9, 0xfba, 0xfbc, 0xfbc, 0xfbe, 0xfbe -}; - -static void tcdiv_persp(int32_t ss, int32_t st, int32_t sw, int32_t* sss, int32_t* sst); -static void tcdiv_nopersp(int32_t ss, int32_t st, int32_t sw, int32_t* sss, int32_t* sst); - -static void (*tcdiv_func[2])(int32_t, int32_t, int32_t, int32_t*, int32_t*) = -{ - tcdiv_nopersp, tcdiv_persp -}; - -static int32_t maskbits_table[16]; -static int32_t log2table[256]; -static int32_t tcdiv_table[0x8000]; - -static STRICTINLINE void tcmask_copy(struct tile* tile, int32_t* S, int32_t* S1, int32_t* S2, int32_t* S3, int32_t* T) -{ - int32_t wrap; - int32_t maskbits_s; - int32_t swrapthreshold; - - if (tile->mask_s) - { - if (tile->ms) - { - swrapthreshold = tile->f.masksclamped; - - wrap = (*S >> swrapthreshold) & 1; - *S ^= (-wrap); - - wrap = (*S1 >> swrapthreshold) & 1; - *S1 ^= (-wrap); - - wrap = (*S2 >> swrapthreshold) & 1; - *S2 ^= (-wrap); - - wrap = (*S3 >> swrapthreshold) & 1; - *S3 ^= (-wrap); - } - - maskbits_s = maskbits_table[tile->mask_s]; - *S &= maskbits_s; - *S1 &= maskbits_s; - *S2 &= maskbits_s; - *S3 &= maskbits_s; - } - - if (tile->mask_t) - { - if (tile->mt) - { - wrap = *T >> tile->f.masktclamped; - wrap &= 1; - *T ^= (-wrap); - } - - *T &= maskbits_table[tile->mask_t]; - } -} - - -static STRICTINLINE void tcshift_cycle(struct tile* tile, int32_t* S, int32_t* T, int32_t* maxs, int32_t* maxt) -{ - - - - int32_t coord = *S; - int32_t shifter = tile->shift_s; - - - if (shifter < 11) - { - coord = SIGN16(coord); - coord >>= shifter; - } - else - { - coord <<= (16 - shifter); - coord = SIGN16(coord); - } - *S = coord; - - - - - *maxs = ((coord >> 3) >= tile->sh); - - - - coord = *T; - shifter = tile->shift_t; - - if (shifter < 11) - { - coord = SIGN16(coord); - coord >>= shifter; - } - else - { - coord <<= (16 - shifter); - coord = SIGN16(coord); - } - *T = coord; - *maxt = ((coord >> 3) >= tile->th); -} - -static STRICTINLINE void tcclamp_cycle(struct tile* tile, int32_t* S, int32_t* T, int32_t* SFRAC, int32_t* TFRAC, int32_t maxs, int32_t maxt) -{ - - - - int32_t locs = *S, loct = *T; - if (tile->f.clampens) - { - - if (maxs) - { - *S = tile->f.clampdiffs; - *SFRAC = 0; - } - else if (!(locs & 0x10000)) - *S = locs >> 5; - else - { - *S = 0; - *SFRAC = 0; - } - } - else - *S = (locs >> 5); - - if (tile->f.clampent) - { - if (maxt) - { - *T = tile->f.clampdifft; - *TFRAC = 0; - } - else if (!(loct & 0x10000)) - *T = loct >> 5; - else - { - *T = 0; - *TFRAC = 0; - } - } - else - *T = (loct >> 5); -} - - -static STRICTINLINE void tcclamp_cycle_light(struct tile* tile, int32_t* S, int32_t* T, int32_t maxs, int32_t maxt) -{ - int32_t locs = *S, loct = *T; - if (tile->f.clampens) - { - if (maxs) - *S = tile->f.clampdiffs; - else if (!(locs & 0x10000)) - *S = locs >> 5; - else - *S = 0; - } - else - *S = (locs >> 5); - - if (tile->f.clampent) - { - if (maxt) - *T = tile->f.clampdifft; - else if (!(loct & 0x10000)) - *T = loct >> 5; - else - *T = 0; - } - else - *T = (loct >> 5); -} - -static STRICTINLINE void tcshift_copy(struct tile* tile, int32_t* S, int32_t* T) -{ - int32_t coord = *S; - int32_t shifter = tile->shift_s; - - if (shifter < 11) - { - coord = SIGN16(coord); - coord >>= shifter; - } - else - { - coord <<= (16 - shifter); - coord = SIGN16(coord); - } - *S = coord; - - coord = *T; - shifter = tile->shift_t; - - if (shifter < 11) - { - coord = SIGN16(coord); - coord >>= shifter; - } - else - { - coord <<= (16 - shifter); - coord = SIGN16(coord); - } - *T = coord; - -} - - -static STRICTINLINE void tclod_4x17_to_15(int32_t scurr, int32_t snext, int32_t tcurr, int32_t tnext, int32_t previous, int32_t* lod) -{ - - - - int dels = SIGN(snext, 17) - SIGN(scurr, 17); - if (dels & 0x20000) - dels = ~dels & 0x1ffff; - int delt = SIGN(tnext, 17) - SIGN(tcurr, 17); - if(delt & 0x20000) - delt = ~delt & 0x1ffff; - - - dels = (dels > delt) ? dels : delt; - dels = (previous > dels) ? previous : dels; - *lod = dels & 0x7fff; - if (dels & 0x1c000) - *lod |= 0x4000; -} - -static STRICTINLINE void tclod_tcclamp(int32_t* sss, int32_t* sst) -{ - int32_t tempanded, temps = *sss, tempt = *sst; - - - - - - if (!(temps & 0x40000)) - { - if (!(temps & 0x20000)) - { - tempanded = temps & 0x18000; - if (tempanded != 0x8000) - { - if (tempanded != 0x10000) - *sss &= 0xffff; - else - *sss = 0x8000; - } - else - *sss = 0x7fff; - } - else - *sss = 0x8000; - } - else - *sss = 0x7fff; - - if (!(tempt & 0x40000)) - { - if (!(tempt & 0x20000)) - { - tempanded = tempt & 0x18000; - if (tempanded != 0x8000) - { - if (tempanded != 0x10000) - *sst &= 0xffff; - else - *sst = 0x8000; - } - else - *sst = 0x7fff; - } - else - *sst = 0x8000; - } - else - *sst = 0x7fff; - -} - - -static STRICTINLINE void lodfrac_lodtile_signals(struct rdp_state* wstate, int lodclamp, int32_t lod, uint32_t* l_tile, uint32_t* magnify, uint32_t* distant, int32_t* lfdst) -{ - uint32_t ltil, dis, mag; - int32_t lf; - - - if ((lod & 0x4000) || lodclamp) - { - - mag = 0; - ltil = 0; - dis = 1; - lf = 0xff; - } - else if (lod < wstate->min_level) - { - - - mag = 1; - ltil = 0; - dis = wstate->max_level == 0; - - if(!wstate->other_modes.sharpen_tex_en && !wstate->other_modes.detail_tex_en) - { - if (dis) - lf = 0xff; - else - lf = 0; - } - else - { - lf = wstate->min_level << 3; - if (wstate->other_modes.sharpen_tex_en) - lf |= 0x100; - } - } - else if (lod < 32) - { - mag = 1; - ltil = 0; - dis = wstate->max_level == 0; - - if(!wstate->other_modes.sharpen_tex_en && !wstate->other_modes.detail_tex_en) - { - if (dis) - lf = 0xff; - else - lf = 0; - } - else - { - lf = lod << 3; - if (wstate->other_modes.sharpen_tex_en) - lf |= 0x100; - } - } - else - { - mag = 0; - ltil = log2table[(lod >> 5) & 0xff]; - - if (wstate->max_level) - dis = ((lod & 0x6000) || (ltil >= wstate->max_level)) != 0; - else - dis = 1; - - - if(!wstate->other_modes.sharpen_tex_en && !wstate->other_modes.detail_tex_en && dis) - lf = 0xff; - else - lf = ((lod << 3) >> ltil) & 0xff; - - - - - - - } - - *distant = dis; - *l_tile = ltil; - *magnify = mag; - *lfdst = lf; -} - -static STRICTINLINE void tclod_2cycle(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t prim_tile, int32_t* t1, int32_t* t2, int32_t* lf) -{ - - - - - - - - - int nextys, nextyt, nextysw, nexts, nextt, nextsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile; - uint32_t magnify = 0; - uint32_t distant = 0; - int inits = *sss, initt = *sst; - - tclod_tcclamp(sss, sst); - - if (wstate->other_modes.f.dolod) - { - - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - nextys = (s + wstate->spans_dsdy) >> 16; - nextyt = (t + wstate->spans_dtdy) >> 16; - nextysw = (w + wstate->spans_dwdy) >> 16; - - wstate->tcdiv_ptr(nexts, nextt, nextsw, &nexts, &nextt); - wstate->tcdiv_ptr(nextys, nextyt, nextysw, &nextys, &nextyt); - - lodclamp = (initt & 0x60000) || (nextt & 0x60000) || (inits & 0x60000) || (nexts & 0x60000) || (nextys & 0x60000) || (nextyt & 0x60000); - - - - - if (!lodclamp) - { - tclod_4x17_to_15(inits, nexts, initt, nextt, 0, &lod); - tclod_4x17_to_15(inits, nextys, initt, nextyt, lod, &lod); - } - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, lf); - - - if (wstate->other_modes.tex_lod_en) - { - if (distant) - l_tile = wstate->max_level; - if (!wstate->other_modes.detail_tex_en) - { - *t1 = (prim_tile + l_tile) & 7; - if (!(distant || (!wstate->other_modes.sharpen_tex_en && magnify))) - *t2 = (*t1 + 1) & 7; - else - *t2 = *t1; - } - else - { - if (!magnify) - *t1 = (prim_tile + l_tile + 1); - else - *t1 = (prim_tile + l_tile); - *t1 &= 7; - if (!distant && !magnify) - *t2 = (prim_tile + l_tile + 2) & 7; - else - *t2 = (prim_tile + l_tile + 1) & 7; - } - - - } - } -} - -static STRICTINLINE void tclod_2cycle_next(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t* sss2, int32_t* sst2, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t prim_tile, int32_t* t1, int32_t* t2, int32_t* lf, int scanline) -{ - UNUSED(s); - UNUSED(t); - UNUSED(w); - - int nextys, nextyt, nextysw; - int nexts, nextt, nextsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile; - uint32_t magnify = 0; - uint32_t distant = 0; - - int inits2 = *sss2, initt2 = *sst2; - int32_t dummy_lf; - - tclod_tcclamp(sss, sst); - tclod_tcclamp(sss2, sst2); - - if (wstate->other_modes.f.dolod) - { - int nextscan = scanline + 1; - - nextys = (wstate->span[nextscan].s + wstate->spans_dsdy) >> 16; - nextyt = (wstate->span[nextscan].t + wstate->spans_dtdy) >> 16; - nextysw = (wstate->span[nextscan].w + wstate->spans_dwdy) >> 16; - - wstate->tcdiv_ptr(nextys, nextyt, nextysw, &nextys, &nextyt); - - lodclamp = ((initt2 & 0x60000) || (inits2 & 0x60000) || (nextys & 0x60000) || (nextyt & 0x60000)); - - - if (!lodclamp) - tclod_4x17_to_15(inits2, nextys, initt2, nextyt, 0, &lod); - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, lf); - - if (wstate->other_modes.tex_lod_en) - { - if (distant) - l_tile = wstate->max_level; - if (!wstate->other_modes.detail_tex_en) - *t1 = (prim_tile + l_tile) & 7; - else - { - if (!magnify) - *t1 = (prim_tile + l_tile + 1); - else - *t1 = (prim_tile + l_tile); - *t1 &= 7; - } - - - - nexts = (wstate->span[nextscan].s + dsinc) >> 16; - nextt = (wstate->span[nextscan].t + dtinc) >> 16; - nextsw = (wstate->span[nextscan].w + dwinc) >> 16; - - wstate->tcdiv_ptr(nexts, nextt, nextsw, &nexts, &nextt); - - lodclamp = (lodclamp || (nextt & 0x60000) || (nexts & 0x60000)); - - if (!lodclamp) - tclod_4x17_to_15(inits2, nexts, initt2, nextt, lod, &lod); - - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, &dummy_lf); - - if (distant) - l_tile = wstate->max_level; - if (!wstate->other_modes.detail_tex_en) - *t2 = (prim_tile + l_tile) & 7; - else - { - if (!magnify) - *t2 = (prim_tile + l_tile + 1); - else - *t2 = (prim_tile + l_tile); - *t2 &= 7; - } - } - - } -} - - -static STRICTINLINE void tclod_2cycle_notexel1(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t prim_tile, int32_t* t1) -{ - int nextys, nextyt, nextysw, nexts, nextt, nextsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile; - uint32_t magnify = 0; - uint32_t distant = 0; - int inits = *sss, initt = *sst; - - tclod_tcclamp(sss, sst); - - if (wstate->other_modes.f.dolod) - { - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - nextys = (s + wstate->spans_dsdy) >> 16; - nextyt = (t + wstate->spans_dtdy) >> 16; - nextysw = (w + wstate->spans_dwdy) >> 16; - - wstate->tcdiv_ptr(nexts, nextt, nextsw, &nexts, &nextt); - wstate->tcdiv_ptr(nextys, nextyt, nextysw, &nextys, &nextyt); - - lodclamp = (initt & 0x60000) || (nextt & 0x60000) || (inits & 0x60000) || (nexts & 0x60000) || (nextys & 0x60000) || (nextyt & 0x60000); - - if (!lodclamp) - { - tclod_4x17_to_15(inits, nexts, initt, nextt, 0, &lod); - tclod_4x17_to_15(inits, nextys, initt, nextyt, lod, &lod); - } - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, &wstate->lod_frac); - - if (wstate->other_modes.tex_lod_en) - { - if (distant) - l_tile = wstate->max_level; - if (!wstate->other_modes.detail_tex_en || magnify) - *t1 = (prim_tile + l_tile) & 7; - else - *t1 = (prim_tile + l_tile + 1) & 7; - } - - } -} - -static STRICTINLINE void tclod_1cycle_current(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t nexts, int32_t nextt, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t scanline, int32_t prim_tile, int32_t* t1, struct spansigs* sigs) -{ - - - - - - - - - - int fars, fart, farsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile = 0, magnify = 0, distant = 0; - - tclod_tcclamp(sss, sst); - - if (wstate->other_modes.f.dolod) - { - int nextscan = scanline + 1; - - - if (wstate->span[nextscan].validline) - { - if (!sigs->endspan || !sigs->longspan) - { - if (!(sigs->preendspan && sigs->longspan) && !(sigs->endspan && sigs->midspan)) - { - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - } - else - { - farsw = (w - dwinc) >> 16; - fars = (s - dsinc) >> 16; - fart = (t - dtinc) >> 16; - } - } - else - { - fart = (wstate->span[nextscan].t + dtinc) >> 16; - fars = (wstate->span[nextscan].s + dsinc) >> 16; - farsw = (wstate->span[nextscan].w + dwinc) >> 16; - } - } - else - { - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - } - - wstate->tcdiv_ptr(fars, fart, farsw, &fars, &fart); - - lodclamp = (fart & 0x60000) || (nextt & 0x60000) || (fars & 0x60000) || (nexts & 0x60000); - - - - - if (!lodclamp) - tclod_4x17_to_15(nexts, fars, nextt, fart, 0, &lod); - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, &wstate->lod_frac); - - if (wstate->other_modes.tex_lod_en) - { - if (distant) - l_tile = wstate->max_level; - - - - if (!wstate->other_modes.detail_tex_en || magnify) - *t1 = (prim_tile + l_tile) & 7; - else - *t1 = (prim_tile + l_tile + 1) & 7; - } - } -} - - - -static STRICTINLINE void tclod_1cycle_current_simple(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t scanline, int32_t prim_tile, int32_t* t1, struct spansigs* sigs) -{ - int fars, fart, farsw, nexts, nextt, nextsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile = 0, magnify = 0, distant = 0; - - tclod_tcclamp(sss, sst); - - if (wstate->other_modes.f.dolod) - { - - int nextscan = scanline + 1; - if (wstate->span[nextscan].validline) - { - if (!sigs->endspan || !sigs->longspan) - { - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - - if (!(sigs->preendspan && sigs->longspan) && !(sigs->endspan && sigs->midspan)) - { - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - } - else - { - farsw = (w - dwinc) >> 16; - fars = (s - dsinc) >> 16; - fart = (t - dtinc) >> 16; - } - } - else - { - nextt = wstate->span[nextscan].t >> 16; - nexts = wstate->span[nextscan].s >> 16; - nextsw = wstate->span[nextscan].w >> 16; - fart = (wstate->span[nextscan].t + dtinc) >> 16; - fars = (wstate->span[nextscan].s + dsinc) >> 16; - farsw = (wstate->span[nextscan].w + dwinc) >> 16; - } - } - else - { - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - } - - wstate->tcdiv_ptr(nexts, nextt, nextsw, &nexts, &nextt); - wstate->tcdiv_ptr(fars, fart, farsw, &fars, &fart); - - lodclamp = (fart & 0x60000) || (nextt & 0x60000) || (fars & 0x60000) || (nexts & 0x60000); - - if (!lodclamp) - tclod_4x17_to_15(nexts, fars, nextt, fart, 0, &lod); - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, &wstate->lod_frac); - - if (wstate->other_modes.tex_lod_en) - { - if (distant) - l_tile = wstate->max_level; - if (!wstate->other_modes.detail_tex_en || magnify) - *t1 = (prim_tile + l_tile) & 7; - else - *t1 = (prim_tile + l_tile + 1) & 7; - } - } -} - -static STRICTINLINE void tclod_1cycle_next(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t scanline, int32_t prim_tile, int32_t* t1, struct spansigs* sigs, int32_t* prelodfrac) -{ - int nexts, nextt, nextsw, fars, fart, farsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile = 0, magnify = 0, distant = 0; - - tclod_tcclamp(sss, sst); - - if (wstate->other_modes.f.dolod) - { - - int nextscan = scanline + 1; - - if (wstate->span[nextscan].validline) - { - - if (!sigs->nextspan) - { - if (!sigs->endspan || !sigs->longspan) - { - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - - if (!(sigs->preendspan && sigs->longspan) && !(sigs->endspan && sigs->midspan)) - { - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - } - else - { - farsw = (w - dwinc) >> 16; - fars = (s - dsinc) >> 16; - fart = (t - dtinc) >> 16; - } - } - else - { - nextt = wstate->span[nextscan].t; - nexts = wstate->span[nextscan].s; - nextsw = wstate->span[nextscan].w; - fart = (nextt + dtinc) >> 16; - fars = (nexts + dsinc) >> 16; - farsw = (nextsw + dwinc) >> 16; - nextt >>= 16; - nexts >>= 16; - nextsw >>= 16; - } - } - else - { - - - - - - - - - - if (sigs->longspan) - { - nextt = (wstate->span[nextscan].t + dtinc) >> 16; - nexts = (wstate->span[nextscan].s + dsinc) >> 16; - nextsw = (wstate->span[nextscan].w + dwinc) >> 16; - fart = (wstate->span[nextscan].t + (dtinc << 1)) >> 16; - fars = (wstate->span[nextscan].s + (dsinc << 1)) >> 16; - farsw = (wstate->span[nextscan].w + (dwinc << 1)) >> 16; - } - else if (sigs->midspan) - { - nextt = wstate->span[nextscan].t >> 16; - nexts = wstate->span[nextscan].s >> 16; - nextsw = wstate->span[nextscan].w >> 16; - fart = (wstate->span[nextscan].t + dtinc) >> 16; - fars = (wstate->span[nextscan].s + dsinc) >> 16; - farsw = (wstate->span[nextscan].w + dwinc) >> 16; - } - else if (sigs->onelessthanmid) - { - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - farsw = (w - dwinc) >> 16; - fars = (s - dsinc) >> 16; - fart = (t - dtinc) >> 16; - } - else - { - nextt = (t + dtinc) >> 16; - nexts = (s + dsinc) >> 16; - nextsw = (w + dwinc) >> 16; - fart = (t + (dtinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - farsw = (w + (dwinc << 1)) >> 16; - } - } - } - else - { - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - } - - wstate->tcdiv_ptr(nexts, nextt, nextsw, &nexts, &nextt); - wstate->tcdiv_ptr(fars, fart, farsw, &fars, &fart); - - lodclamp = (fart & 0x60000) || (nextt & 0x60000) || (fars & 0x60000) || (nexts & 0x60000); - - - - if (!lodclamp) - tclod_4x17_to_15(nexts, fars, nextt, fart, 0, &lod); - - lodfrac_lodtile_signals(wstate, lodclamp, lod, &l_tile, &magnify, &distant, prelodfrac); - - if (wstate->other_modes.tex_lod_en) - { - if (distant) - l_tile = wstate->max_level; - if (!wstate->other_modes.detail_tex_en || magnify) - *t1 = (prim_tile + l_tile) & 7; - else - *t1 = (prim_tile + l_tile + 1) & 7; - } - } -} - -static STRICTINLINE void tclod_copy(struct rdp_state* wstate, int32_t* sss, int32_t* sst, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t prim_tile, int32_t* t1) -{ - - - - - int nexts, nextt, nextsw, fars, fart, farsw; - int lodclamp = 0; - int32_t lod = 0; - uint32_t l_tile = 0, magnify = 0, distant = 0; - - tclod_tcclamp(sss, sst); - - if (wstate->other_modes.tex_lod_en) - { - - - - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - farsw = (w + (dwinc << 1)) >> 16; - fars = (s + (dsinc << 1)) >> 16; - fart = (t + (dtinc << 1)) >> 16; - - wstate->tcdiv_ptr(nexts, nextt, nextsw, &nexts, &nextt); - wstate->tcdiv_ptr(fars, fart, farsw, &fars, &fart); - - lodclamp = (fart & 0x60000) || (nextt & 0x60000) || (fars & 0x60000) || (nexts & 0x60000); - - if (!lodclamp) - tclod_4x17_to_15(nexts, fars, nextt, fart, 0, &lod); - - if ((lod & 0x4000) || lodclamp) - { - - - magnify = 0; - l_tile = wstate->max_level; - } - else if (lod < 32) - { - magnify = 1; - l_tile = 0; - } - else - { - magnify = 0; - l_tile = log2table[(lod >> 5) & 0xff]; - - if (wstate->max_level) - distant = ((lod & 0x6000) || (l_tile >= wstate->max_level)) != 0; - else - distant = 1; - - if (distant) - l_tile = wstate->max_level; - } - - if (!wstate->other_modes.detail_tex_en || magnify) - *t1 = (prim_tile + l_tile) & 7; - else - *t1 = (prim_tile + l_tile + 1) & 7; - } - -} - -static STRICTINLINE void tc_pipeline_copy(struct tile* tile, int32_t* sss0, int32_t* sss1, int32_t* sss2, int32_t* sss3, int32_t* sst) -{ - int ss0 = *sss0, ss1 = 0, ss2 = 0, ss3 = 0, st = *sst; - - tcshift_copy(tile, &ss0, &st); - - - - ss0 = TRELATIVE(ss0, tile->sl); - st = TRELATIVE(st, tile->tl); - ss0 = (ss0 >> 5); - st = (st >> 5); - - ss1 = ss0 + 1; - ss2 = ss0 + 2; - ss3 = ss0 + 3; - - tcmask_copy(tile, &ss0, &ss1, &ss2, &ss3, &st); - - *sss0 = ss0; - *sss1 = ss1; - *sss2 = ss2; - *sss3 = ss3; - *sst = st; -} - -static STRICTINLINE void tc_pipeline_load(struct tile* tile, int32_t* sss, int32_t* sst, int coord_quad) -{ - int sss1 = *sss, sst1 = *sst; - sss1 = SIGN16(sss1); - sst1 = SIGN16(sst1); - - - sss1 = TRELATIVE(sss1, tile->sl); - sst1 = TRELATIVE(sst1, tile->tl); - - - - if (!coord_quad) - { - sss1 = (sss1 >> 5); - sst1 = (sst1 >> 5); - } - else - { - sss1 = (sss1 >> 3); - sst1 = (sst1 >> 3); - } - - *sss = sss1; - *sst = sst1; -} - -static void tcdiv_nopersp(int32_t ss, int32_t st, int32_t sw, int32_t* sss, int32_t* sst) -{ - UNUSED(sw); - - - *sss = (SIGN16(ss)) & 0x1ffff; - *sst = (SIGN16(st)) & 0x1ffff; -} - -static void tcdiv_persp(int32_t ss, int32_t st, int32_t sw, int32_t* sss, int32_t* sst) -{ - - - int w_carry = 0; - int shift; - int tlu_rcp; - int sprod, tprod; - int outofbounds_s, outofbounds_t; - int tempmask; - int shift_value; - int32_t temps, tempt; - - - - int overunder_s = 0, overunder_t = 0; - - - if (SIGN16(sw) <= 0) - w_carry = 1; - - sw &= 0x7fff; - - - - shift = tcdiv_table[sw]; - tlu_rcp = shift >> 4; - shift &= 0xf; - - sprod = SIGN16(ss) * tlu_rcp; - tprod = SIGN16(st) * tlu_rcp; - - - - - tempmask = ((1 << 30) - 1) & -((1 << 29) >> shift); - - outofbounds_s = sprod & tempmask; - outofbounds_t = tprod & tempmask; - - if (shift != 0xe) - { - shift_value = 13 - shift; - temps = sprod = (sprod >> shift_value); - tempt = tprod = (tprod >> shift_value); - } - else - { - temps = sprod << 1; - tempt = tprod << 1; - } - - if (outofbounds_s != tempmask && outofbounds_s != 0) - { - if (!(sprod & (1 << 29))) - overunder_s = 2 << 17; - else - overunder_s = 1 << 17; - } - - if (outofbounds_t != tempmask && outofbounds_t != 0) - { - if (!(tprod & (1 << 29))) - overunder_t = 2 << 17; - else - overunder_t = 1 << 17; - } - - if (w_carry) - { - overunder_s |= (2 << 17); - overunder_t |= (2 << 17); - } - - *sss = (temps & 0x1ffff) | overunder_s; - *sst = (tempt & 0x1ffff) | overunder_t; -} - -static void tcoord_init_lut(void) -{ - int i, k; - - log2table[0] = log2table[1] = 0; - for (i = 2; i < 256; i++) - { - for (k = 7; k > 0; k--) - { - if((i >> k) & 1) - { - log2table[i] = k; - break; - } - } - } - - int temppoint, tempslope; - int normout; - int wnorm; - int shift, tlu_rcp; - - for (i = 0; i < 0x8000; i++) - { - for (k = 1; k <= 14 && !((i << k) & 0x8000); k++) - ; - shift = k - 1; - normout = (i << shift) & 0x3fff; - wnorm = (normout & 0xff) << 2; - normout >>= 8; - - - - temppoint = norm_point_table[normout]; - tempslope = norm_slope_table[normout]; - - tempslope = (tempslope | ~0x3ff) + 1; - - tlu_rcp = (((tempslope * wnorm) >> 10) + temppoint) & 0x7fff; - - tcdiv_table[i] = shift | (tlu_rcp << 4); - } - - maskbits_table[0] = 0x3ff; - for (i = 1; i < 16; i++) - maskbits_table[i] = ((uint16_t)(0xffff) >> (16 - i)) & 0x3ff; -} - -static void tcoord_init(struct rdp_state* wstate) -{ - wstate->tcdiv_ptr = tcdiv_func[0]; -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/tex.c b/angrylion-rdp-plus/src/core/n64video/rdp/tex.c deleted file mode 100644 index 6edacc6..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/tex.c +++ /dev/null @@ -1,1043 +0,0 @@ -#ifdef N64VIDEO_C - -static STRICTINLINE void tcmask(struct tile* tile, int32_t* S, int32_t* T) -{ - int32_t wrap; - - - - if (tile->mask_s) - { - if (tile->ms) - { - wrap = *S >> tile->f.masksclamped; - wrap &= 1; - *S ^= (-wrap); - } - *S &= maskbits_table[tile->mask_s]; - } - - if (tile->mask_t) - { - if (tile->mt) - { - wrap = *T >> tile->f.masktclamped; - wrap &= 1; - *T ^= (-wrap); - } - - *T &= maskbits_table[tile->mask_t]; - } -} - - -static STRICTINLINE void tcmask_coupled(struct tile* tile, int32_t* S, int32_t* sdiff, int32_t* T, int32_t* tdiff) -{ - int32_t wrap; - int32_t maskbits; - int32_t wrapthreshold; - - - if (tile->mask_s) - { - maskbits = maskbits_table[tile->mask_s]; - - if (tile->ms) - { - wrapthreshold = tile->f.masksclamped; - - wrap = (*S >> wrapthreshold) & 1; - *S ^= (-wrap); - *S &= maskbits; - - - if (((*S - wrap) & maskbits) == maskbits) - *sdiff = 0; - else - *sdiff = 1 - (wrap << 1); - } - else - { - *S &= maskbits; - if (*S == maskbits) - *sdiff = -(*S); - else - *sdiff = 1; - } - } - else - *sdiff = 1; - - if (tile->mask_t) - { - maskbits = maskbits_table[tile->mask_t]; - - if (tile->mt) - { - wrapthreshold = tile->f.masktclamped; - - wrap = (*T >> wrapthreshold) & 1; - *T ^= (-wrap); - *T &= maskbits; - - if (((*T - wrap) & maskbits) == maskbits) - *tdiff = 0; - else - *tdiff = 1 - (wrap << 1); - } - else - { - *T &= maskbits; - if (*T == maskbits) - *tdiff = -(*T & 0xff); - else - *tdiff = 1; - } - } - else - *tdiff = 1; -} - - -static INLINE void calculate_clamp_diffs(struct tile* t) -{ - t->f.clampdiffs = ((t->sh >> 2) - (t->sl >> 2)) & 0x3ff; - t->f.clampdifft = ((t->th >> 2) - (t->tl >> 2)) & 0x3ff; -} - - -static INLINE void calculate_tile_derivs(struct tile* t) -{ - t->f.clampens = t->cs || !t->mask_s; - t->f.clampent = t->ct || !t->mask_t; - t->f.masksclamped = t->mask_s <= 10 ? t->mask_s : 10; - t->f.masktclamped = t->mask_t <= 10 ? t->mask_t : 10; - t->f.notlutswitch = (t->format << 2) | t->size; - t->f.tlutswitch = (t->size << 2) | ((t->format + 2) & 3); - - if (t->format < 5) - { - t->f.notlutswitch = (t->format << 2) | t->size; - t->f.tlutswitch = (t->size << 2) | ((t->format + 2) & 3); - } - else - { - t->f.notlutswitch = 0x10 | t->size; - t->f.tlutswitch = (t->size << 2) | 2; - } -} - -static STRICTINLINE void get_texel1_1cycle(struct rdp_state* wstate, int32_t* s1, int32_t* t1, int32_t s, int32_t t, int32_t w, int32_t dsinc, int32_t dtinc, int32_t dwinc, int32_t scanline, struct spansigs* sigs) -{ - int32_t nexts, nextt, nextsw; - - if (!sigs->endspan || !sigs->longspan || !wstate->span[scanline + 1].validline) - { - - - nextsw = (w + dwinc) >> 16; - nexts = (s + dsinc) >> 16; - nextt = (t + dtinc) >> 16; - } - else - { - - - - - - - - int32_t nextscan = scanline + 1; - nextt = wstate->span[nextscan].t >> 16; - nexts = wstate->span[nextscan].s >> 16; - nextsw = wstate->span[nextscan].w >> 16; - } - - wstate->tcdiv_ptr(nexts, nextt, nextsw, s1, t1); -} - -static STRICTINLINE void texture_pipeline_cycle(struct rdp_state* wstate, struct color* TEX, struct color* prev, int32_t SSS, int32_t SST, uint32_t tilenum, uint32_t cycle) -{ - int32_t maxs, maxt, invt3r, invt3g, invt3b, invt3a; - int32_t sfrac, tfrac, invsf, invtf, sfracrg, invsfrg; - int upper, upperrg, center, centerrg; - - - int bilerp = cycle ? wstate->other_modes.bi_lerp1 : wstate->other_modes.bi_lerp0; - int convert = wstate->other_modes.convert_one && cycle; - struct color t0, t1, t2, t3; - int sss1, sst1, sdiff, tdiff; - - sss1 = SSS; - sst1 = SST; - - tcshift_cycle(&wstate->tile[tilenum], &sss1, &sst1, &maxs, &maxt); - - sss1 = TRELATIVE(sss1, wstate->tile[tilenum].sl); - sst1 = TRELATIVE(sst1, wstate->tile[tilenum].tl); - - if (wstate->other_modes.sample_type || wstate->other_modes.en_tlut) - { - sfrac = sss1 & 0x1f; - tfrac = sst1 & 0x1f; - - - - - tcclamp_cycle(&wstate->tile[tilenum], &sss1, &sst1, &sfrac, &tfrac, maxs, maxt); - - - - - - - tcmask_coupled(&wstate->tile[tilenum], &sss1, &sdiff, &sst1, &tdiff); - - - - - - - - upper = (sfrac + tfrac) & 0x20; - - - - - if (wstate->tile[tilenum].format == FORMAT_YUV) - { - sfracrg = (sfrac >> 1) | ((sss1 & 1) << 4); - - - - upperrg = (sfracrg + tfrac) & 0x20; - } - else - { - upperrg = upper; - sfracrg = sfrac; - } - - - - - - - - - - - - - - - - - - if (bilerp) - { - - if (!wstate->other_modes.sample_type) - fetch_texel_entlut_quadro_nearest(wstate, &t0, &t1, &t2, &t3, sss1, sst1, tilenum, upper, upperrg); - else if (wstate->other_modes.en_tlut) - fetch_texel_entlut_quadro(wstate, &t0, &t1, &t2, &t3, sss1, sdiff, sst1, tdiff, tilenum, upper, upperrg); - else - fetch_texel_quadro(wstate, &t0, &t1, &t2, &t3, sss1, sdiff, sst1, tdiff, tilenum, upper - upperrg); - - if (!wstate->other_modes.mid_texel) - center = centerrg = 0; - else - { - - center = (sfrac == 0x10 && tfrac == 0x10); - centerrg = (sfracrg == 0x10 && tfrac == 0x10); - } - - if (!convert) - { - invtf = 0x20 - tfrac; - - if (!centerrg) - { - - - if (upperrg) - { - - invsfrg = 0x20 - sfracrg; - - TEX->r = t3.r + ((invsfrg * (t2.r - t3.r) + invtf * (t1.r - t3.r) + 0x10) >> 5); - TEX->g = t3.g + ((invsfrg * (t2.g - t3.g) + invtf * (t1.g - t3.g) + 0x10) >> 5); - } - else - { - TEX->r = t0.r + ((sfracrg * (t1.r - t0.r) + tfrac * (t2.r - t0.r) + 0x10) >> 5); - TEX->g = t0.g + ((sfracrg * (t1.g - t0.g) + tfrac * (t2.g - t0.g) + 0x10) >> 5); - } - } - else - { - - invt3r = ~t3.r; - invt3g = ~t3.g; - - - TEX->r = t3.r + ((((t1.r + t2.r) << 6) - (t3.r << 7) + ((invt3r + t0.r) << 6) + 0xc0) >> 8); - TEX->g = t3.g + ((((t1.g + t2.g) << 6) - (t3.g << 7) + ((invt3g + t0.g) << 6) + 0xc0) >> 8); - } - - if (!center) - { - if (upper) - { - invsf = 0x20 - sfrac; - - TEX->b = t3.b + ((invsf * (t2.b - t3.b) + invtf * (t1.b - t3.b) + 0x10) >> 5); - TEX->a = t3.a + ((invsf * (t2.a - t3.a) + invtf * (t1.a - t3.a) + 0x10) >> 5); - } - else - { - TEX->b = t0.b + ((sfrac * (t1.b - t0.b) + tfrac * (t2.b - t0.b) + 0x10) >> 5); - TEX->a = t0.a + ((sfrac * (t1.a - t0.a) + tfrac * (t2.a - t0.a) + 0x10) >> 5); - } - } - else - { - invt3b = ~t3.b; - invt3a = ~t3.a; - - TEX->b = t3.b + ((((t1.b + t2.b) << 6) - (t3.b << 7) + ((invt3b + t0.b) << 6) + 0xc0) >> 8); - TEX->a = t3.a + ((((t1.a + t2.a) << 6) - (t3.a << 7) + ((invt3a + t0.a) << 6) + 0xc0) >> 8); - } - } - else - { - int32_t prevr, prevg, prevb; - prevr = SIGN(prev->r, 9); - prevg = SIGN(prev->g, 9); - prevb = SIGN(prev->b, 9); - - if (!centerrg) - { - if (upperrg) - { - TEX->r = prevb + ((prevr * (t2.r - t3.r) + prevg * (t1.r - t3.r) + 0x80) >> 8); - TEX->g = prevb + ((prevr * (t2.g - t3.g) + prevg * (t1.g - t3.g) + 0x80) >> 8); - } - else - { - TEX->r = prevb + ((prevr * (t1.r - t0.r) + prevg * (t2.r - t0.r) + 0x80) >> 8); - TEX->g = prevb + ((prevr * (t1.g - t0.g) + prevg * (t2.g - t0.g) + 0x80) >> 8); - } - } - else - { - invt3r = ~t3.r; - invt3g = ~t3.g; - - TEX->r = prevb + ((prevr * (t2.r - t3.r) + prevg * (t1.r - t3.r) + ((invt3r + t0.r) << 6) + 0xc0) >> 8); - TEX->g = prevb + ((prevr * (t2.g - t3.g) + prevg * (t1.g - t3.g) + ((invt3g + t0.g) << 6) + 0xc0) >> 8); - } - - if (!center) - { - if (upper) - { - TEX->b = prevb + ((prevr * (t2.b - t3.b) + prevg * (t1.b - t3.b) + 0x80) >> 8); - TEX->a = prevb + ((prevr * (t2.a - t3.a) + prevg * (t1.a - t3.a) + 0x80) >> 8); - } - else - { - TEX->b = prevb + ((prevr * (t1.b - t0.b) + prevg * (t2.b - t0.b) + 0x80) >> 8); - TEX->a = prevb + ((prevr * (t1.a - t0.a) + prevg * (t2.a - t0.a) + 0x80) >> 8); - } - } - else - { - invt3b = ~t3.b; - invt3a = ~t3.a; - - TEX->b = prevb + ((prevr * (t2.b - t3.b) + prevg * (t1.b - t3.b) + ((invt3b + t0.b) << 6) + 0xc0) >> 8); - TEX->a = prevb + ((prevr * (t2.a - t3.a) + prevg * (t1.a - t3.a) + ((invt3a + t0.a) << 6) + 0xc0) >> 8); - } - } - } - else - { - - - - if (convert) - { - t0 = t3 = *prev; - t0.r = SIGN(t0.r, 9); - t0.g = SIGN(t0.g, 9); - t0.b = SIGN(t0.b, 9); - t3.r = SIGN(t3.r, 9); - t3.g = SIGN(t3.g, 9); - t3.b = SIGN(t3.b, 9); - } - else - { - if (!wstate->other_modes.sample_type) - fetch_texel_entlut_quadro_nearest(wstate, &t0, &t1, &t2, &t3, sss1, sst1, tilenum, upper, upperrg); - else if (wstate->other_modes.en_tlut) - fetch_texel_entlut_quadro(wstate, &t0, &t1, &t2, &t3, sss1, sdiff, sst1, tdiff, tilenum, upper, upperrg); - else - fetch_texel_quadro(wstate, &t0, &t1, &t2, &t3, sss1, sdiff, sst1, tdiff, tilenum, upper - upperrg); - } - - - if (upperrg) - { - if (upper) - { - TEX->r = t3.b + ((wstate->k0_tf * t3.g + 0x80) >> 8); - TEX->g = t3.b + ((wstate->k1_tf * t3.r + wstate->k2_tf * t3.g + 0x80) >> 8); - TEX->b = t3.b + ((wstate->k3_tf * t3.r + 0x80) >> 8); - TEX->a = t3.b; - } - else - { - TEX->r = t0.b + ((wstate->k0_tf * t3.g + 0x80) >> 8); - TEX->g = t0.b + ((wstate->k1_tf * t3.r + wstate->k2_tf * t3.g + 0x80) >> 8); - TEX->b = t0.b + ((wstate->k3_tf * t3.r + 0x80) >> 8); - TEX->a = t0.b; - } - } - else - { - if (upper) - { - TEX->r = t3.b + ((wstate->k0_tf * t0.g + 0x80) >> 8); - TEX->g = t3.b + ((wstate->k1_tf * t0.r + wstate->k2_tf * t0.g + 0x80) >> 8); - TEX->b = t3.b + ((wstate->k3_tf * t0.r + 0x80) >> 8); - TEX->a = t3.b; - } - else - { - TEX->r = t0.b + ((wstate->k0_tf * t0.g + 0x80) >> 8); - TEX->g = t0.b + ((wstate->k1_tf * t0.r + wstate->k2_tf * t0.g + 0x80) >> 8); - TEX->b = t0.b + ((wstate->k3_tf * t0.r + 0x80) >> 8); - TEX->a = t0.b; - } - } - } - - TEX->r &= 0x1ff; - TEX->g &= 0x1ff; - TEX->b &= 0x1ff; - TEX->a &= 0x1ff; - - - } - else - { - - - - - tcclamp_cycle_light(&wstate->tile[tilenum], &sss1, &sst1, maxs, maxt); - - tcmask(&wstate->tile[tilenum], &sss1, &sst1); - - - - - if (bilerp) - { - if (!convert) - { - - fetch_texel(wstate, &t0, sss1, sst1, tilenum); - - TEX->r = t0.r & 0x1ff; - TEX->g = t0.g & 0x1ff; - TEX->b = t0.b; - TEX->a = t0.a; - } - else - TEX->r = TEX->g = TEX->b = TEX->a = prev->b; - } - else - { - if (convert) - { - t0 = *prev; - t0.r = SIGN(t0.r, 9); - t0.g = SIGN(t0.g, 9); - t0.b = SIGN(t0.b, 9); - } - else - fetch_texel(wstate, &t0, sss1, sst1, tilenum); - - TEX->r = t0.b + ((wstate->k0_tf * t0.g + 0x80) >> 8); - TEX->g = t0.b + ((wstate->k1_tf * t0.r + wstate->k2_tf * t0.g + 0x80) >> 8); - TEX->b = t0.b + ((wstate->k3_tf * t0.r + 0x80) >> 8); - TEX->a = t0.b & 0x1ff; - TEX->r &= 0x1ff; - TEX->g &= 0x1ff; - TEX->b &= 0x1ff; - } - } - -} - -static void loading_pipeline(struct rdp_state* wstate, int start, int end, int tilenum, int coord_quad, int ltlut) -{ - - - //int localdebugmode = 0, cnt = 0; - int i, j; - - int dsinc, dtinc; - dsinc = wstate->spans_ds; - dtinc = wstate->spans_dt; - - int s, t; - int ss, st; - int xstart, xend, xendsc; - int sss = 0, sst = 0; - int ti_index, length; - - uint32_t tmemidx0 = 0, tmemidx1 = 0, tmemidx2 = 0, tmemidx3 = 0; - int dswap = 0; - uint32_t readval0, readval1, readval2, readval3; - uint32_t readidx32; - uint64_t loadqword = 0; - uint16_t tempshort = 0; - int tmem_formatting = 0; - uint32_t bit3fl = 0, hibit = 0; - - if (end > start && ltlut) - { - rdp_pipeline_crashed = 1; - return; - } - - if (wstate->tile[tilenum].format == FORMAT_YUV) - tmem_formatting = 0; - else if (wstate->tile[tilenum].format == FORMAT_RGBA && wstate->tile[tilenum].size == PIXEL_SIZE_32BIT) - tmem_formatting = 1; - else - tmem_formatting = 2; - - int tiadvance = 0, spanadvance = 0; - int tiptr = 0; - switch (wstate->ti_size) - { - case PIXEL_SIZE_4BIT: - rdp_pipeline_crashed = 1; - return; - break; - case PIXEL_SIZE_8BIT: - tiadvance = 8; - spanadvance = 8; - break; - case PIXEL_SIZE_16BIT: - if (!ltlut) - { - tiadvance = 8; - spanadvance = 4; - } - else - { - tiadvance = 2; - spanadvance = 1; - } - break; - case PIXEL_SIZE_32BIT: - tiadvance = 8; - spanadvance = 2; - break; - } - - for (i = start; i <= end; i++) - { - xstart = wstate->span[i].lx; - xend = wstate->span[i].unscrx; - xendsc = wstate->span[i].rx; - s = wstate->span[i].s; - t = wstate->span[i].t; - - ti_index = wstate->ti_width * i + xend; - tiptr = wstate->ti_address + PIXELS_TO_BYTES(ti_index, wstate->ti_size); - - length = (xstart - xend + 1) & 0xfff; - - for (j = 0; j < length; j+= spanadvance) - { - ss = s >> 16; - st = t >> 16; - - - - - - - - sss = ss & 0xffff; - sst = st & 0xffff; - - tc_pipeline_load(&wstate->tile[tilenum], &sss, &sst, coord_quad); - - dswap = sst & 1; - - - get_tmem_idx(wstate, sss, sst, tilenum, &tmemidx0, &tmemidx1, &tmemidx2, &tmemidx3, &bit3fl, &hibit); - - readidx32 = (tiptr >> 2) & ~1; - RREADIDX32(readval0, readidx32); - readidx32++; - RREADIDX32(readval1, readidx32); - readidx32++; - RREADIDX32(readval2, readidx32); - readidx32++; - RREADIDX32(readval3, readidx32); - - - switch(tiptr & 7) - { - case 0: - if (!ltlut) - loadqword = ((uint64_t)readval0 << 32) | readval1; - else - { - tempshort = readval0 >> 16; - loadqword = ((uint64_t)tempshort << 48) | ((uint64_t) tempshort << 32) | ((uint64_t) tempshort << 16) | tempshort; - } - break; - case 1: - loadqword = ((uint64_t)readval0 << 40) | ((uint64_t)readval1 << 8) | (readval2 >> 24); - break; - case 2: - if (!ltlut) - loadqword = ((uint64_t)readval0 << 48) | ((uint64_t)readval1 << 16) | (readval2 >> 16); - else - { - tempshort = readval0 & 0xffff; - loadqword = ((uint64_t)tempshort << 48) | ((uint64_t) tempshort << 32) | ((uint64_t) tempshort << 16) | tempshort; - } - break; - case 3: - loadqword = ((uint64_t)readval0 << 56) | ((uint64_t)readval1 << 24) | (readval2 >> 8); - break; - case 4: - if (!ltlut) - loadqword = ((uint64_t)readval1 << 32) | readval2; - else - { - tempshort = readval1 >> 16; - loadqword = ((uint64_t)tempshort << 48) | ((uint64_t) tempshort << 32) | ((uint64_t) tempshort << 16) | tempshort; - } - break; - case 5: - loadqword = ((uint64_t)readval1 << 40) | ((uint64_t)readval2 << 8) | (readval3 >> 24); - break; - case 6: - if (!ltlut) - loadqword = ((uint64_t)readval1 << 48) | ((uint64_t)readval2 << 16) | (readval3 >> 16); - else - { - tempshort = readval1 & 0xffff; - loadqword = ((uint64_t)tempshort << 48) | ((uint64_t) tempshort << 32) | ((uint64_t) tempshort << 16) | tempshort; - } - break; - case 7: - loadqword = ((uint64_t)readval1 << 56) | ((uint64_t)readval2 << 24) | (readval3 >> 8); - break; - } - - - switch(tmem_formatting) - { - case 0: - readval0 = (uint32_t)((((loadqword >> 56) & 0xff) << 24) | (((loadqword >> 40) & 0xff) << 16) | (((loadqword >> 24) & 0xff) << 8) | (((loadqword >> 8) & 0xff) << 0)); - readval1 = (uint32_t)((((loadqword >> 48) & 0xff) << 24) | (((loadqword >> 32) & 0xff) << 16) | (((loadqword >> 16) & 0xff) << 8) | (((loadqword >> 0) & 0xff) << 0)); - if (bit3fl) - { - tmem16[tmemidx2 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 >> 16); - tmem16[tmemidx3 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 & 0xffff); - tmem16[(tmemidx2 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 >> 16); - tmem16[(tmemidx3 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 & 0xffff); - } - else - { - tmem16[tmemidx0 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 >> 16); - tmem16[tmemidx1 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 & 0xffff); - tmem16[(tmemidx0 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 >> 16); - tmem16[(tmemidx1 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 & 0xffff); - } - break; - case 1: - readval0 = (uint32_t)(((loadqword >> 48) << 16) | ((loadqword >> 16) & 0xffff)); - readval1 = (uint32_t)((((loadqword >> 32) & 0xffff) << 16) | (loadqword & 0xffff)); - - if (bit3fl) - { - tmem16[tmemidx2 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 >> 16); - tmem16[tmemidx3 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 & 0xffff); - tmem16[(tmemidx2 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 >> 16); - tmem16[(tmemidx3 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 & 0xffff); - } - else - { - tmem16[tmemidx0 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 >> 16); - tmem16[tmemidx1 ^ WORD_ADDR_XOR] = (uint16_t)(readval0 & 0xffff); - tmem16[(tmemidx0 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 >> 16); - tmem16[(tmemidx1 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(readval1 & 0xffff); - } - break; - case 2: - if (!dswap) - { - if (!hibit) - { - tmem16[tmemidx0 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 48); - tmem16[tmemidx1 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 32); - tmem16[tmemidx2 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 16); - tmem16[tmemidx3 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword & 0xffff); - } - else - { - tmem16[(tmemidx0 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 48); - tmem16[(tmemidx1 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 32); - tmem16[(tmemidx2 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 16); - tmem16[(tmemidx3 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword & 0xffff); - } - } - else - { - if (!hibit) - { - tmem16[tmemidx0 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 16); - tmem16[tmemidx1 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword & 0xffff); - tmem16[tmemidx2 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 48); - tmem16[tmemidx3 ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 32); - } - else - { - tmem16[(tmemidx0 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 16); - tmem16[(tmemidx1 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword & 0xffff); - tmem16[(tmemidx2 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 48); - tmem16[(tmemidx3 | 0x400) ^ WORD_ADDR_XOR] = (uint16_t)(loadqword >> 32); - } - } - break; - } - - - s = (s + dsinc) & ~0x1f; - t = (t + dtinc) & ~0x1f; - tiptr += tiadvance; - } - } -} - -static void edgewalker_for_loads(struct rdp_state* wstate, int32_t* lewdata) -{ - int j = 0; - int xleft = 0, xright = 0; - int /*xstart = 0,*/ xend = 0; - int s = 0, t = 0, w = 0; - int dsdx = 0, dtdx = 0; - int dsdy = 0, dtdy = 0; - int dsde = 0, dtde = 0; - int tilenum = 0, flip = 0; - int32_t yl = 0, ym = 0, yh = 0; - int32_t xl = 0, xm = 0, xh = 0; - int32_t dxldy = 0, dxhdy = 0, dxmdy = 0; - - int cmd_id = CMD_ID(lewdata); - int ltlut = (cmd_id == CMD_ID_LOAD_TLUT); - int coord_quad = ltlut || (cmd_id == CMD_ID_LOAD_BLOCK); - flip = 1; - wstate->max_level = 0; - tilenum = (lewdata[0] >> 16) & 7; - - - yl = SIGN(lewdata[0], 14); - ym = lewdata[1] >> 16; - ym = SIGN(ym, 14); - yh = SIGN(lewdata[1], 14); - - xl = SIGN(lewdata[2], 28); - xh = SIGN(lewdata[3], 28); - xm = SIGN(lewdata[4], 28); - - dxldy = 0; - dxhdy = 0; - dxmdy = 0; - - - s = lewdata[5] & 0xffff0000; - t = (lewdata[5] & 0xffff) << 16; - w = 0; - dsdx = (lewdata[7] & 0xffff0000) | ((lewdata[6] >> 16) & 0xffff); - dtdx = ((lewdata[7] << 16) & 0xffff0000) | (lewdata[6] & 0xffff); - dsde = 0; - dtde = (lewdata[9] & 0xffff) << 16; - dsdy = 0; - dtdy = (lewdata[8] & 0xffff) << 16; - - wstate->spans_ds = dsdx & ~0x1f; - wstate->spans_dt = dtdx & ~0x1f; - wstate->spans_dw = 0; - - - - - - - xright = xh & ~0x1; - xleft = xm & ~0x1; - - int k = 0; - - //int sign_dxhdy = 0; - - //int do_offset = 0; - - int xfrac = 0; - - - - - - - - - - - - - - - - - - int32_t maxxmx = 0, minxhx = 0; - - int spix = 0; - int ycur = yh & ~3; - int ylfar = yl | 3; - - int valid_y = 1; - //int length = 0; - int32_t xrsc = 0, xlsc = 0/*, stickybit = 0*/; - int32_t yllimit = yl; - int32_t yhlimit = yh; - - xfrac = 0; - xend = xright >> 16; - - - for (k = ycur; k <= ylfar; k++) - { - if (k == ym) - xleft = xl & ~1; - - spix = k & 3; - - if (!(k & ~0xfff)) - { - j = k >> 2; - valid_y = !(k < yhlimit || k >= yllimit); - - if (spix == 0) - { - maxxmx = 0; - minxhx = 0xfff; - } - - xrsc = (xright >> 13) & 0x7ffe; - - - - xlsc = (xleft >> 13) & 0x7ffe; - - if (valid_y) - { - maxxmx = (((xlsc >> 3) & 0xfff) > maxxmx) ? (xlsc >> 3) & 0xfff : maxxmx; - minxhx = (((xrsc >> 3) & 0xfff) < minxhx) ? (xrsc >> 3) & 0xfff : minxhx; - } - - if (spix == 0) - { - wstate->span[j].unscrx = xend; - wstate->span[j].s = s & ~0x3ff; - wstate->span[j].t = t & ~0x3ff; - } - - if (spix == 3) - { - wstate->span[j].lx = maxxmx; - wstate->span[j].rx = minxhx; - - - } - - - } - - if (spix == 3) - { - t += dtde; - } - - - - } - - loading_pipeline(wstate, yhlimit >> 2, yllimit >> 2, tilenum, coord_quad, ltlut); -} - -void rdp_set_tile_size(struct rdp_state* wstate, const uint32_t* args) -{ - int tilenum = (args[1] >> 24) & 0x7; - wstate->tile[tilenum].sl = (args[0] >> 12) & 0xfff; - wstate->tile[tilenum].tl = (args[0] >> 0) & 0xfff; - wstate->tile[tilenum].sh = (args[1] >> 12) & 0xfff; - wstate->tile[tilenum].th = (args[1] >> 0) & 0xfff; - - calculate_clamp_diffs(&wstate->tile[tilenum]); -} - -void rdp_load_block(struct rdp_state* wstate, const uint32_t* args) -{ - int tilenum = (args[1] >> 24) & 0x7; - uint16_t sl, sh, tl, dxt; - - - wstate->tile[tilenum].sl = sl = ((args[0] >> 12) & 0xfff); - wstate->tile[tilenum].tl = tl = ((args[0] >> 0) & 0xfff); - wstate->tile[tilenum].sh = sh = ((args[1] >> 12) & 0xfff); - wstate->tile[tilenum].th = dxt = ((args[1] >> 0) & 0xfff); - - calculate_clamp_diffs(&wstate->tile[tilenum]); - - int tlclamped = tl & 0x3ff; - - int32_t lewdata[10]; - - lewdata[0] = (args[0] & 0xff000000) | (0x10 << 19) | (tilenum << 16) | ((tlclamped << 2) | 3); - lewdata[1] = (((tlclamped << 2) | 3) << 16) | (tlclamped << 2); - lewdata[2] = sh << 16; - lewdata[3] = sl << 16; - lewdata[4] = sh << 16; - lewdata[5] = ((sl << 3) << 16) | (tl << 3); - lewdata[6] = (dxt & 0xff) << 8; - lewdata[7] = ((0x80 >> wstate->ti_size) << 16) | (dxt >> 8); - lewdata[8] = 0x20; - lewdata[9] = 0x20; - - edgewalker_for_loads(wstate, lewdata); - -} - -static void tile_tlut_common_cs_decoder(struct rdp_state* wstate, const uint32_t* args) -{ - int tilenum = (args[1] >> 24) & 0x7; - uint16_t sl, tl, sh, th; - - - wstate->tile[tilenum].sl = sl = ((args[0] >> 12) & 0xfff); - wstate->tile[tilenum].tl = tl = ((args[0] >> 0) & 0xfff); - wstate->tile[tilenum].sh = sh = ((args[1] >> 12) & 0xfff); - wstate->tile[tilenum].th = th = ((args[1] >> 0) & 0xfff); - - calculate_clamp_diffs(&wstate->tile[tilenum]); - - - int32_t lewdata[10]; - - lewdata[0] = (args[0] & 0xff000000) | (0x10 << 19) | (tilenum << 16) | (th | 3); - lewdata[1] = ((th | 3) << 16) | (tl); - lewdata[2] = ((sh >> 2) << 16) | ((sh & 3) << 14); - lewdata[3] = ((sl >> 2) << 16) | ((sl & 3) << 14); - lewdata[4] = ((sh >> 2) << 16) | ((sh & 3) << 14); - lewdata[5] = ((sl << 3) << 16) | (tl << 3); - lewdata[6] = 0; - lewdata[7] = (0x200 >> wstate->ti_size) << 16; - lewdata[8] = 0x20; - lewdata[9] = 0x20; - - edgewalker_for_loads(wstate, lewdata); -} - -void rdp_load_tlut(struct rdp_state* wstate, const uint32_t* args) -{ - tile_tlut_common_cs_decoder(wstate, args); -} - -void rdp_load_tile(struct rdp_state* wstate, const uint32_t* args) -{ - tile_tlut_common_cs_decoder(wstate, args); -} - -void rdp_set_tile(struct rdp_state* wstate, const uint32_t* args) -{ - int tilenum = (args[1] >> 24) & 0x7; - - wstate->tile[tilenum].format = (args[0] >> 21) & 0x7; - wstate->tile[tilenum].size = (args[0] >> 19) & 0x3; - wstate->tile[tilenum].line = (args[0] >> 9) & 0x1ff; - wstate->tile[tilenum].tmem = (args[0] >> 0) & 0x1ff; - wstate->tile[tilenum].palette = (args[1] >> 20) & 0xf; - wstate->tile[tilenum].ct = (args[1] >> 19) & 0x1; - wstate->tile[tilenum].mt = (args[1] >> 18) & 0x1; - wstate->tile[tilenum].mask_t = (args[1] >> 14) & 0xf; - wstate->tile[tilenum].shift_t = (args[1] >> 10) & 0xf; - wstate->tile[tilenum].cs = (args[1] >> 9) & 0x1; - wstate->tile[tilenum].ms = (args[1] >> 8) & 0x1; - wstate->tile[tilenum].mask_s = (args[1] >> 4) & 0xf; - wstate->tile[tilenum].shift_s = (args[1] >> 0) & 0xf; - - calculate_tile_derivs(&wstate->tile[tilenum]); -} - -void rdp_set_texture_image(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->ti_format = (args[0] >> 21) & 0x7; - wstate->ti_size = (args[0] >> 19) & 0x3; - wstate->ti_width = (args[0] & 0x3ff) + 1; - wstate->ti_address = args[1] & 0x0ffffff; - - - -} - -void rdp_set_convert(struct rdp_state* wstate, const uint32_t* args) -{ - int32_t k0 = (args[0] >> 13) & 0x1ff; - int32_t k1 = (args[0] >> 4) & 0x1ff; - int32_t k2 = ((args[0] & 0xf) << 5) | ((args[1] >> 27) & 0x1f); - int32_t k3 = (args[1] >> 18) & 0x1ff; - wstate->k0_tf = (SIGN(k0, 9) << 1) + 1; - wstate->k1_tf = (SIGN(k1, 9) << 1) + 1; - wstate->k2_tf = (SIGN(k2, 9) << 1) + 1; - wstate->k3_tf = (SIGN(k3, 9) << 1) + 1; - wstate->k4 = (args[1] >> 9) & 0x1ff; - wstate->k5 = args[1] & 0x1ff; -} - -static void tex_init_lut(void) -{ - tmem_init_lut(); - tcoord_init_lut(); -} - -static void tex_init(struct rdp_state* wstate) -{ - int i; - tcoord_init(wstate); - - for (i = 0; i < 8; i++) - { - calculate_tile_derivs(&wstate->tile[i]); - calculate_clamp_diffs(&wstate->tile[i]); - } -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/tmem.c b/angrylion-rdp-plus/src/core/n64video/rdp/tmem.c deleted file mode 100644 index e2d5833..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/tmem.c +++ /dev/null @@ -1,2066 +0,0 @@ -#ifdef N64VIDEO_C - -#define tmem16 ((uint16_t*)wstate->tmem) -#define tc16 ((uint16_t*)wstate->tmem) -#define tlut ((uint16_t*)(&wstate->tmem[0x800])) - -static uint8_t replicated_rgba[32]; - -#define GET_LOW_RGBA16_TMEM(x) (replicated_rgba[((x) >> 1) & 0x1f]) -#define GET_MED_RGBA16_TMEM(x) (replicated_rgba[((x) >> 6) & 0x1f]) -#define GET_HI_RGBA16_TMEM(x) (replicated_rgba[(x) >> 11]) - -static void sort_tmem_idx(uint32_t *idx, uint32_t idxa, uint32_t idxb, uint32_t idxc, uint32_t idxd, uint32_t bankno) -{ - if ((idxa & 3) == bankno) - *idx = idxa & 0x3ff; - else if ((idxb & 3) == bankno) - *idx = idxb & 0x3ff; - else if ((idxc & 3) == bankno) - *idx = idxc & 0x3ff; - else if ((idxd & 3) == bankno) - *idx = idxd & 0x3ff; - else - *idx = 0; -} - -static void sort_tmem_shorts_lowhalf(uint32_t* bindshort, uint32_t short0, uint32_t short1, uint32_t short2, uint32_t short3, uint32_t bankno) -{ - switch(bankno) - { - case 0: - *bindshort = short0; - break; - case 1: - *bindshort = short1; - break; - case 2: - *bindshort = short2; - break; - case 3: - *bindshort = short3; - break; - } -} - -static void compute_color_index(struct rdp_state* wstate, uint32_t* cidx, uint32_t readshort, uint32_t nybbleoffset, uint32_t tilenum) -{ - uint32_t lownib, hinib; - if (wstate->tile[tilenum].size == PIXEL_SIZE_4BIT) - { - lownib = (nybbleoffset ^ 3) << 2; - hinib = wstate->tile[tilenum].palette; - } - else - { - lownib = ((nybbleoffset & 2) ^ 2) << 2; - hinib = lownib ? ((readshort >> 12) & 0xf) : ((readshort >> 4) & 0xf); - } - lownib = (readshort >> lownib) & 0xf; - *cidx = (hinib << 4) | lownib; -} - -static INLINE void fetch_texel(struct rdp_state* wstate, struct color *color, int s, int t, uint32_t tilenum) -{ - uint32_t tbase = wstate->tile[tilenum].line * (t & 0xff) + wstate->tile[tilenum].tmem; - - - - uint32_t tpal = wstate->tile[tilenum].palette; - - - - - - - - - uint32_t taddr = 0; - - - - - - switch (wstate->tile[tilenum].f.notlutswitch) - { - case TEXEL_RGBA4: - { - taddr = ((tbase << 4) + s) >> 1; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - uint8_t byteval, c; - - byteval = wstate->tmem[taddr & 0xfff]; - c = ((s & 1)) ? (byteval & 0xf) : (byteval >> 4); - c |= (c << 4); - color->r = c; - color->g = c; - color->b = c; - color->a = c; - } - break; - case TEXEL_RGBA8: - { - taddr = (tbase << 3) + s; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t p; - - p = wstate->tmem[taddr & 0xfff]; - color->r = p; - color->g = p; - color->b = p; - color->a = p; - } - break; - case TEXEL_RGBA16: - { - taddr = (tbase << 2) + s; - taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - - uint16_t c; - - c = tc16[taddr & 0x7ff]; - color->r = GET_HI_RGBA16_TMEM(c); - color->g = GET_MED_RGBA16_TMEM(c); - color->b = GET_LOW_RGBA16_TMEM(c); - color->a = (c & 1) ? 0xff : 0; - } - break; - case TEXEL_RGBA32: - { - - - - taddr = (tbase << 2) + s; - taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - uint16_t c; - - - taddr &= 0x3ff; - c = tc16[taddr]; - color->r = c >> 8; - color->g = c & 0xff; - c = tc16[taddr | 0x400]; - color->b = c >> 8; - color->a = c & 0xff; - } - break; - case TEXEL_YUV4: - { - taddr = (tbase << 3) + s; - - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - int32_t u, save; - - save = wstate->tmem[taddr & 0x7ff]; - - save &= 0xf0; - save |= (save >> 4); - - u = save - 0x80; - - color->r = u; - color->g = u; - color->b = save; - color->a = save; - } - break; - case TEXEL_YUV8: - { - taddr = (tbase << 3) + s; - - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - int32_t u, save; - - save = u = wstate->tmem[taddr & 0x7ff]; - - u = u - 0x80; - - color->r = u; - color->g = u; - color->b = save; - color->a = save; - } - break; - case TEXEL_YUV16: - { - taddr = (tbase << 3) + s; - int taddrlow = taddr >> 1; - - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - taddrlow ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - taddr &= 0x7ff; - taddrlow &= 0x3ff; - - uint16_t c = tc16[taddrlow]; - - int32_t y, u, v; - y = wstate->tmem[taddr | 0x800]; - u = c >> 8; - v = c & 0xff; - - u = u - 0x80; - v = v - 0x80; - - - - color->r = u; - color->g = v; - color->b = y; - color->a = y; - } - break; - case TEXEL_YUV32: - { - int taddrlow; - uint16_t c; - int32_t y, u, v; - - taddr = (tbase << 3) + s; - taddrlow = taddr >> 1; - - taddrlow ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - taddrlow &= 0x3ff; - - c = tc16[taddrlow]; - - u = c >> 8; - v = c & 0xff; - - u = u - 0x80; - v = v - 0x80; - - color->r = u; - color->g = v; - - if (s & 1) - { - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - taddr &= 0x7ff; - y = wstate->tmem[taddr | 0x800]; - - color->b = y; - color->a = y; - } - else - { - y = tc16[taddrlow | 0x400]; - - color->b = y >> 8; - color->a = ((y >> 8) & 0xf) | (y & 0xf0); - } - } - break; - case TEXEL_CI4: - { - taddr = ((tbase << 4) + s) >> 1; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t p; - - - - p = wstate->tmem[taddr & 0xfff]; - p = (s & 1) ? (p & 0xf) : (p >> 4); - p = (uint8_t)(tpal << 4) | p; - color->r = color->g = color->b = color->a = p; - } - break; - case TEXEL_CI8: - { - taddr = (tbase << 3) + s; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t p; - - - p = wstate->tmem[taddr & 0xfff]; - color->r = p; - color->g = p; - color->b = p; - color->a = p; - } - break; - case TEXEL_CI16: - case TEXEL_CI32: - { - taddr = (tbase << 2) + s; - taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - uint16_t c; - - c = tc16[taddr & 0x7ff]; - color->r = c >> 8; - color->g = c & 0xff; - color->b = color->r; - color->a = color->g; - } - break; - case TEXEL_IA4: - { - taddr = ((tbase << 4) + s) >> 1; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t p, i; - - - p = wstate->tmem[taddr & 0xfff]; - p = (s & 1) ? (p & 0xf) : (p >> 4); - i = p & 0xe; - i = (i << 4) | (i << 1) | (i >> 2); - color->r = i; - color->g = i; - color->b = i; - color->a = (p & 0x1) ? 0xff : 0; - } - break; - case TEXEL_IA8: - { - taddr = (tbase << 3) + s; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t p, i; - - - p = wstate->tmem[taddr & 0xfff]; - i = p & 0xf0; - i |= (i >> 4); - color->r = i; - color->g = i; - color->b = i; - color->a = ((p & 0xf) << 4) | (p & 0xf); - } - break; - case TEXEL_IA16: - { - - - taddr = (tbase << 2) + s; - taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - uint16_t c; - - c = tc16[taddr & 0x7ff]; - color->r = color->g = color->b = (c >> 8); - color->a = c & 0xff; - } - break; - case TEXEL_IA32: - { - taddr = (tbase << 2) + s; - taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - uint16_t c; - - c = tc16[taddr & 0x7ff]; - color->r = c >> 8; - color->g = c & 0xff; - color->b = color->r; - color->a = color->g; - } - break; - case TEXEL_I4: - { - taddr = ((tbase << 4) + s) >> 1; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t byteval, c; - - byteval = wstate->tmem[taddr & 0xfff]; - c = (s & 1) ? (byteval & 0xf) : (byteval >> 4); - c |= (c << 4); - color->r = c; - color->g = c; - color->b = c; - color->a = c; - } - break; - case TEXEL_I8: - { - taddr = (tbase << 3) + s; - taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR); - - uint8_t c; - - c = wstate->tmem[taddr & 0xfff]; - color->r = c; - color->g = c; - color->b = c; - color->a = c; - } - break; - case TEXEL_I16: - case TEXEL_I32: - default: - { - taddr = (tbase << 2) + s; - taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR); - - uint16_t c; - - c = tc16[taddr & 0x7ff]; - color->r = c >> 8; - color->g = c & 0xff; - color->b = color->r; - color->a = color->g; - } - break; - } -} - -static INLINE void fetch_texel_quadro(struct rdp_state* wstate, struct color *color0, struct color *color1, struct color *color2, struct color *color3, int s0, int sdiff, int t0, int tdiff, uint32_t tilenum, int unequaluppers) -{ - - uint32_t tbase0 = wstate->tile[tilenum].line * (t0 & 0xff) + wstate->tile[tilenum].tmem; - - int t1 = (t0 & 0xff) + tdiff; - - - - int s1 = s0 + sdiff; - - uint32_t tbase2 = wstate->tile[tilenum].line * t1 + wstate->tile[tilenum].tmem; - uint32_t tpal = wstate->tile[tilenum].palette; - uint32_t xort, ands; - - - - - uint32_t taddr0, taddr1, taddr2, taddr3; - uint32_t taddrlow0, taddrlow1, taddrlow2, taddrlow3; - - switch (wstate->tile[tilenum].f.notlutswitch) - { - case TEXEL_RGBA4: - { - taddr0 = ((tbase0 << 4) + s0) >> 1; - taddr1 = ((tbase0 << 4) + s1) >> 1; - taddr2 = ((tbase2 << 4) + s0) >> 1; - taddr3 = ((tbase2 << 4) + s1) >> 1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t byteval, c; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - ands = s0 & 1; - byteval = wstate->tmem[taddr0]; - c = (ands) ? (byteval & 0xf) : (byteval >> 4); - c |= (c << 4); - color0->r = c; - color0->g = c; - color0->b = c; - color0->a = c; - byteval = wstate->tmem[taddr2]; - c = (ands) ? (byteval & 0xf) : (byteval >> 4); - c |= (c << 4); - color2->r = c; - color2->g = c; - color2->b = c; - color2->a = c; - - ands = s1 & 1; - byteval = wstate->tmem[taddr1]; - c = (ands) ? (byteval & 0xf) : (byteval >> 4); - c |= (c << 4); - color1->r = c; - color1->g = c; - color1->b = c; - color1->a = c; - byteval = wstate->tmem[taddr3]; - c = (ands) ? (byteval & 0xf) : (byteval >> 4); - c |= (c << 4); - color3->r = c; - color3->g = c; - color3->b = c; - color3->a = c; - } - break; - case TEXEL_RGBA8: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - p = wstate->tmem[taddr0]; - color0->r = p; - color0->g = p; - color0->b = p; - color0->a = p; - p = wstate->tmem[taddr2]; - color2->r = p; - color2->g = p; - color2->b = p; - color2->a = p; - p = wstate->tmem[taddr1]; - color1->r = p; - color1->g = p; - color1->b = p; - color1->a = p; - p = wstate->tmem[taddr3]; - color3->r = p; - color3->g = p; - color3->b = p; - color3->a = p; - } - break; - case TEXEL_RGBA16: - { - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t c0, c1, c2, c3; - - taddr0 &= 0x7ff; - taddr1 &= 0x7ff; - taddr2 &= 0x7ff; - taddr3 &= 0x7ff; - c0 = tc16[taddr0]; - c1 = tc16[taddr1]; - c2 = tc16[taddr2]; - c3 = tc16[taddr3]; - color0->r = GET_HI_RGBA16_TMEM(c0); - color0->g = GET_MED_RGBA16_TMEM(c0); - color0->b = GET_LOW_RGBA16_TMEM(c0); - color0->a = (c0 & 1) ? 0xff : 0; - color1->r = GET_HI_RGBA16_TMEM(c1); - color1->g = GET_MED_RGBA16_TMEM(c1); - color1->b = GET_LOW_RGBA16_TMEM(c1); - color1->a = (c1 & 1) ? 0xff : 0; - color2->r = GET_HI_RGBA16_TMEM(c2); - color2->g = GET_MED_RGBA16_TMEM(c2); - color2->b = GET_LOW_RGBA16_TMEM(c2); - color2->a = (c2 & 1) ? 0xff : 0; - color3->r = GET_HI_RGBA16_TMEM(c3); - color3->g = GET_MED_RGBA16_TMEM(c3); - color3->b = GET_LOW_RGBA16_TMEM(c3); - color3->a = (c3 & 1) ? 0xff : 0; - } - break; - case TEXEL_RGBA32: - { - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint16_t c0, c1, c2, c3; - - taddr0 &= 0x3ff; - taddr1 &= 0x3ff; - taddr2 &= 0x3ff; - taddr3 &= 0x3ff; - c0 = tc16[taddr0]; - color0->r = c0 >> 8; - color0->g = c0 & 0xff; - c0 = tc16[taddr0 | 0x400]; - color0->b = c0 >> 8; - color0->a = c0 & 0xff; - c1 = tc16[taddr1]; - color1->r = c1 >> 8; - color1->g = c1 & 0xff; - c1 = tc16[taddr1 | 0x400]; - color1->b = c1 >> 8; - color1->a = c1 & 0xff; - c2 = tc16[taddr2]; - color2->r = c2 >> 8; - color2->g = c2 & 0xff; - c2 = tc16[taddr2 | 0x400]; - color2->b = c2 >> 8; - color2->a = c2 & 0xff; - c3 = tc16[taddr3]; - color3->r = c3 >> 8; - color3->g = c3 & 0xff; - c3 = tc16[taddr3 | 0x400]; - color3->b = c3 >> 8; - color3->a = c3 & 0xff; - } - break; - case TEXEL_YUV4: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1 + sdiff; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1 + sdiff; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - int32_t u0, u1, u2, u3, save0, save1, save2, save3; - - save0 = wstate->tmem[taddr0 & 0x7ff]; - save0 &= 0xf0; - save0 |= (save0 >> 4); - u0 = save0 - 0x80; - - save1 = wstate->tmem[taddr1 & 0x7ff]; - save1 &= 0xf0; - save1 |= (save1 >> 4); - u1 = save1 - 0x80; - - save2 = wstate->tmem[taddr2 & 0x7ff]; - save2 &= 0xf0; - save2 |= (save2 >> 4); - u2 = save2 - 0x80; - - save3 = wstate->tmem[taddr3 & 0x7ff]; - save3 &= 0xf0; - save3 |= (save3 >> 4); - u3 = save3 - 0x80; - - color0->r = u0; - color0->g = u0; - color1->r = u1; - color1->g = u1; - color2->r = u2; - color2->g = u2; - color3->r = u3; - color3->g = u3; - - if (unequaluppers) - { - color0->b = color0->a = save3; - color1->b = color1->a = save2; - color2->b = color2->a = save1; - color3->b = color3->a = save0; - } - else - { - color0->b = color0->a = save0; - color1->b = color1->a = save1; - color2->b = color2->a = save2; - color3->b = color3->a = save3; - } - } - break; - case TEXEL_YUV8: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1 + sdiff; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1 + sdiff; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - int32_t u0, u1, u2, u3, save0, save1, save2, save3; - - save0 = u0 = wstate->tmem[taddr0 & 0x7ff]; - u0 = u0 - 0x80; - save1 = u1 = wstate->tmem[taddr1 & 0x7ff]; - u1 = u1 - 0x80; - save2 = u2 = wstate->tmem[taddr2 & 0x7ff]; - u2 = u2 - 0x80; - save3 = u3 = wstate->tmem[taddr3 & 0x7ff]; - u3 = u3 - 0x80; - - color0->r = u0; - color0->g = u0; - color1->r = u1; - color1->g = u1; - color2->r = u2; - color2->g = u2; - color3->r = u3; - color3->g = u3; - - if (unequaluppers) - { - color0->b = color0->a = save3; - color1->b = color1->a = save2; - color2->b = color2->a = save1; - color3->b = color3->a = save0; - } - else - { - color0->b = color0->a = save0; - color1->b = color1->a = save1; - color2->b = color2->a = save2; - color3->b = color3->a = save3; - } - } - break; - case TEXEL_YUV16: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - - taddrlow0 = (taddr0) >> 1; - taddrlow1 = (taddr1 + sdiff) >> 1; - taddrlow2 = (taddr2) >> 1; - taddrlow3 = (taddr3 + sdiff) >> 1; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddrlow0 ^= xort; - taddrlow1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddrlow2 ^= xort; - taddrlow3 ^= xort; - - taddr0 &= 0x7ff; - taddr1 &= 0x7ff; - taddr2 &= 0x7ff; - taddr3 &= 0x7ff; - taddrlow0 &= 0x3ff; - taddrlow1 &= 0x3ff; - taddrlow2 &= 0x3ff; - taddrlow3 &= 0x3ff; - - uint16_t c0, c1, c2, c3; - int32_t y0, y1, y2, y3, u0, u1, u2, u3, v0, v1, v2, v3; - - c0 = tc16[taddrlow0]; - c1 = tc16[taddrlow1]; - c2 = tc16[taddrlow2]; - c3 = tc16[taddrlow3]; - - y0 = wstate->tmem[taddr0 | 0x800]; - u0 = c0 >> 8; - v0 = c0 & 0xff; - y1 = wstate->tmem[taddr1 | 0x800]; - u1 = c1 >> 8; - v1 = c1 & 0xff; - y2 = wstate->tmem[taddr2 | 0x800]; - u2 = c2 >> 8; - v2 = c2 & 0xff; - y3 = wstate->tmem[taddr3 | 0x800]; - u3 = c3 >> 8; - v3 = c3 & 0xff; - - u0 = u0 - 0x80; - v0 = v0 - 0x80; - u1 = u1 - 0x80; - v1 = v1 - 0x80; - u2 = u2 - 0x80; - v2 = v2 - 0x80; - u3 = u3 - 0x80; - v3 = v3 - 0x80; - - color0->r = u0; - color0->g = v0; - color1->r = u1; - color1->g = v1; - color2->r = u2; - color2->g = v2; - color3->r = u3; - color3->g = v3; - - color0->b = color0->a = y0; - color1->b = color1->a = y1; - color2->b = color2->a = y2; - color3->b = color3->a = y3; - } - break; - case TEXEL_YUV32: - { - uint16_t c0, c1, c2, c3; - int32_t y0, y1, y2, y3, u0, u1, u2, u3, v0, v1, v2, v3; - uint32_t xort0, xort1; - - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - taddrlow0 = (taddr0) >> 1; - taddrlow1 = (taddr1 + sdiff) >> 1; - taddrlow2 = (taddr2) >> 1; - taddrlow3 = (taddr3 + sdiff) >> 1; - - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddrlow0 ^= xort; - taddrlow1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddrlow2 ^= xort; - taddrlow3 ^= xort; - - taddrlow0 &= 0x3ff; - taddrlow1 &= 0x3ff; - taddrlow2 &= 0x3ff; - taddrlow3 &= 0x3ff; - - c0 = tc16[taddrlow0]; - c1 = tc16[taddrlow1]; - c2 = tc16[taddrlow2]; - c3 = tc16[taddrlow3]; - - u0 = c0 >> 8; - v0 = c0 & 0xff; - u1 = c1 >> 8; - v1 = c1 & 0xff; - u2 = c2 >> 8; - v2 = c2 & 0xff; - u3 = c3 >> 8; - v3 = c3 & 0xff; - - u0 = u0 - 0x80; - v0 = v0 - 0x80; - u1 = u1 - 0x80; - v1 = v1 - 0x80; - u2 = u2 - 0x80; - v2 = v2 - 0x80; - u3 = u3 - 0x80; - v3 = v3 - 0x80; - - color0->r = u0; - color0->g = v0; - color1->r = u1; - color1->g = v1; - color2->r = u2; - color2->g = v2; - color3->r = u3; - color3->g = v3; - - xort0 = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - xort1 = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - - if (s0 & 1) - { - taddr0 ^= xort0; - taddr2 ^= xort1; - - taddr0 &= 0x7ff; - taddr2 &= 0x7ff; - - y0 = wstate->tmem[taddr0 | 0x800]; - y2 = wstate->tmem[taddr2 | 0x800]; - - color0->b = color0->a = y0; - color2->b = color2->a = y2; - } - else - { - y0 = tc16[taddrlow0 | 0x400]; - y2 = tc16[taddrlow2 | 0x400]; - - color0->b = y0 >> 8; - color0->a = ((y0 >> 8) & 0xf) | (y0 & 0xf0); - color2->b = y2 >> 8; - color2->a = ((y2 >> 8) & 0xf) | (y2 & 0xf0); - } - - if (s1 & 1) - { - taddr1 ^= xort0; - taddr3 ^= xort1; - - taddr1 &= 0x7ff; - taddr3 &= 0x7ff; - - y1 = wstate->tmem[taddr1 | 0x800]; - y3 = wstate->tmem[taddr3 | 0x800]; - - color1->b = color1->a = y1; - color3->b = color3->a = y3; - } - else - { - taddr1 ^= xort0; - taddr3 ^= xort1; - - taddr1 = (taddr1 >> 1) & 0x3ff; - taddr3 = (taddr3 >> 1) & 0x3ff; - - y1 = tc16[taddr1 | 0x400]; - y3 = tc16[taddr3 | 0x400]; - - color1->b = y1 >> 8; - color1->a = ((y1 >> 8) & 0xf) | (y1 & 0xf0); - color3->b = y3 >> 8; - color3->a = ((y3 >> 8) & 0xf) | (y3 & 0xf0); - } - } - break; - case TEXEL_CI4: - { - taddr0 = ((tbase0 << 4) + s0) >> 1; - taddr1 = ((tbase0 << 4) + s1) >> 1; - taddr2 = ((tbase2 << 4) + s0) >> 1; - taddr3 = ((tbase2 << 4) + s1) >> 1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - ands = s0 & 1; - p = wstate->tmem[taddr0]; - p = (ands) ? (p & 0xf) : (p >> 4); - p = (tpal << 4) | p; - color0->r = color0->g = color0->b = color0->a = p; - p = wstate->tmem[taddr2]; - p = (ands) ? (p & 0xf) : (p >> 4); - p = (tpal << 4) | p; - color2->r = color2->g = color2->b = color2->a = p; - - ands = s1 & 1; - p = wstate->tmem[taddr1]; - p = (ands) ? (p & 0xf) : (p >> 4); - p = (tpal << 4) | p; - color1->r = color1->g = color1->b = color1->a = p; - p = wstate->tmem[taddr3]; - p = (ands) ? (p & 0xf) : (p >> 4); - p = (tpal << 4) | p; - color3->r = color3->g = color3->b = color3->a = p; - } - break; - case TEXEL_CI8: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - p = wstate->tmem[taddr0]; - color0->r = p; - color0->g = p; - color0->b = p; - color0->a = p; - p = wstate->tmem[taddr2]; - color2->r = p; - color2->g = p; - color2->b = p; - color2->a = p; - p = wstate->tmem[taddr1]; - color1->r = p; - color1->g = p; - color1->b = p; - color1->a = p; - p = wstate->tmem[taddr3]; - color3->r = p; - color3->g = p; - color3->b = p; - color3->a = p; - } - break; - case TEXEL_CI16: - case TEXEL_CI32: - { - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint16_t c0, c1, c2, c3; - - taddr0 &= 0x7ff; - taddr1 &= 0x7ff; - taddr2 &= 0x7ff; - taddr3 &= 0x7ff; - c0 = tc16[taddr0]; - color0->r = c0 >> 8; - color0->g = c0 & 0xff; - color0->b = c0 >> 8; - color0->a = c0 & 0xff; - c1 = tc16[taddr1]; - color1->r = c1 >> 8; - color1->g = c1 & 0xff; - color1->b = c1 >> 8; - color1->a = c1 & 0xff; - c2 = tc16[taddr2]; - color2->r = c2 >> 8; - color2->g = c2 & 0xff; - color2->b = c2 >> 8; - color2->a = c2 & 0xff; - c3 = tc16[taddr3]; - color3->r = c3 >> 8; - color3->g = c3 & 0xff; - color3->b = c3 >> 8; - color3->a = c3 & 0xff; - } - break; - case TEXEL_IA4: - { - taddr0 = ((tbase0 << 4) + s0) >> 1; - taddr1 = ((tbase0 << 4) + s1) >> 1; - taddr2 = ((tbase2 << 4) + s0) >> 1; - taddr3 = ((tbase2 << 4) + s1) >> 1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p, i; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - ands = s0 & 1; - p = wstate->tmem[taddr0]; - p = ands ? (p & 0xf) : (p >> 4); - i = p & 0xe; - i = (i << 4) | (i << 1) | (i >> 2); - color0->r = i; - color0->g = i; - color0->b = i; - color0->a = (p & 0x1) ? 0xff : 0; - p = wstate->tmem[taddr2]; - p = ands ? (p & 0xf) : (p >> 4); - i = p & 0xe; - i = (i << 4) | (i << 1) | (i >> 2); - color2->r = i; - color2->g = i; - color2->b = i; - color2->a = (p & 0x1) ? 0xff : 0; - - ands = s1 & 1; - p = wstate->tmem[taddr1]; - p = ands ? (p & 0xf) : (p >> 4); - i = p & 0xe; - i = (i << 4) | (i << 1) | (i >> 2); - color1->r = i; - color1->g = i; - color1->b = i; - color1->a = (p & 0x1) ? 0xff : 0; - p = wstate->tmem[taddr3]; - p = ands ? (p & 0xf) : (p >> 4); - i = p & 0xe; - i = (i << 4) | (i << 1) | (i >> 2); - color3->r = i; - color3->g = i; - color3->b = i; - color3->a = (p & 0x1) ? 0xff : 0; - } - break; - case TEXEL_IA8: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p, i; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - p = wstate->tmem[taddr0]; - i = p & 0xf0; - i |= (i >> 4); - color0->r = i; - color0->g = i; - color0->b = i; - color0->a = ((p & 0xf) << 4) | (p & 0xf); - p = wstate->tmem[taddr1]; - i = p & 0xf0; - i |= (i >> 4); - color1->r = i; - color1->g = i; - color1->b = i; - color1->a = ((p & 0xf) << 4) | (p & 0xf); - p = wstate->tmem[taddr2]; - i = p & 0xf0; - i |= (i >> 4); - color2->r = i; - color2->g = i; - color2->b = i; - color2->a = ((p & 0xf) << 4) | (p & 0xf); - p = wstate->tmem[taddr3]; - i = p & 0xf0; - i |= (i >> 4); - color3->r = i; - color3->g = i; - color3->b = i; - color3->a = ((p & 0xf) << 4) | (p & 0xf); - } - break; - case TEXEL_IA16: - { - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint16_t c0, c1, c2, c3; - - taddr0 &= 0x7ff; - taddr1 &= 0x7ff; - taddr2 &= 0x7ff; - taddr3 &= 0x7ff; - c0 = tc16[taddr0]; - color0->r = color0->g = color0->b = c0 >> 8; - color0->a = c0 & 0xff; - c1 = tc16[taddr1]; - color1->r = color1->g = color1->b = c1 >> 8; - color1->a = c1 & 0xff; - c2 = tc16[taddr2]; - color2->r = color2->g = color2->b = c2 >> 8; - color2->a = c2 & 0xff; - c3 = tc16[taddr3]; - color3->r = color3->g = color3->b = c3 >> 8; - color3->a = c3 & 0xff; - - } - break; - case TEXEL_IA32: - { - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint16_t c0, c1, c2, c3; - - taddr0 &= 0x7ff; - taddr1 &= 0x7ff; - taddr2 &= 0x7ff; - taddr3 &= 0x7ff; - c0 = tc16[taddr0]; - color0->r = c0 >> 8; - color0->g = c0 & 0xff; - color0->b = c0 >> 8; - color0->a = c0 & 0xff; - c1 = tc16[taddr1]; - color1->r = c1 >> 8; - color1->g = c1 & 0xff; - color1->b = c1 >> 8; - color1->a = c1 & 0xff; - c2 = tc16[taddr2]; - color2->r = c2 >> 8; - color2->g = c2 & 0xff; - color2->b = c2 >> 8; - color2->a = c2 & 0xff; - c3 = tc16[taddr3]; - color3->r = c3 >> 8; - color3->g = c3 & 0xff; - color3->b = c3 >> 8; - color3->a = c3 & 0xff; - - } - break; - case TEXEL_I4: - { - taddr0 = ((tbase0 << 4) + s0) >> 1; - taddr1 = ((tbase0 << 4) + s1) >> 1; - taddr2 = ((tbase2 << 4) + s0) >> 1; - taddr3 = ((tbase2 << 4) + s1) >> 1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p, c0, c1, c2, c3; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - ands = s0 & 1; - p = wstate->tmem[taddr0]; - c0 = ands ? (p & 0xf) : (p >> 4); - c0 |= (c0 << 4); - color0->r = color0->g = color0->b = color0->a = c0; - p = wstate->tmem[taddr2]; - c2 = ands ? (p & 0xf) : (p >> 4); - c2 |= (c2 << 4); - color2->r = color2->g = color2->b = color2->a = c2; - - ands = s1 & 1; - p = wstate->tmem[taddr1]; - c1 = ands ? (p & 0xf) : (p >> 4); - c1 |= (c1 << 4); - color1->r = color1->g = color1->b = color1->a = c1; - p = wstate->tmem[taddr3]; - c3 = ands ? (p & 0xf) : (p >> 4); - c3 |= (c3 << 4); - color3->r = color3->g = color3->b = color3->a = c3; - - } - break; - case TEXEL_I8: - { - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint32_t p; - - taddr0 &= 0xfff; - taddr1 &= 0xfff; - taddr2 &= 0xfff; - taddr3 &= 0xfff; - - p = wstate->tmem[taddr0]; - color0->r = p; - color0->g = p; - color0->b = p; - color0->a = p; - p = wstate->tmem[taddr1]; - color1->r = p; - color1->g = p; - color1->b = p; - color1->a = p; - p = wstate->tmem[taddr2]; - color2->r = p; - color2->g = p; - color2->b = p; - color2->a = p; - p = wstate->tmem[taddr3]; - color3->r = p; - color3->g = p; - color3->b = p; - color3->a = p; - } - break; - case TEXEL_I16: - case TEXEL_I32: - default: - { - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - uint16_t c0, c1, c2, c3; - - taddr0 &= 0x7ff; - taddr1 &= 0x7ff; - taddr2 &= 0x7ff; - taddr3 &= 0x7ff; - c0 = tc16[taddr0]; - color0->r = c0 >> 8; - color0->g = c0 & 0xff; - color0->b = c0 >> 8; - color0->a = c0 & 0xff; - c1 = tc16[taddr1]; - color1->r = c1 >> 8; - color1->g = c1 & 0xff; - color1->b = c1 >> 8; - color1->a = c1 & 0xff; - c2 = tc16[taddr2]; - color2->r = c2 >> 8; - color2->g = c2 & 0xff; - color2->b = c2 >> 8; - color2->a = c2 & 0xff; - c3 = tc16[taddr3]; - color3->r = c3 >> 8; - color3->g = c3 & 0xff; - color3->b = c3 >> 8; - color3->a = c3 & 0xff; - } - break; - } -} - -static INLINE void fetch_texel_entlut_quadro(struct rdp_state* wstate, struct color *color0, struct color *color1, struct color *color2, struct color *color3, int s0, int sdiff, int t0, int tdiff, uint32_t tilenum, int isupper, int isupperrg) -{ - uint32_t tbase0 = wstate->tile[tilenum].line * (t0 & 0xff) + wstate->tile[tilenum].tmem; - int t1 = (t0 & 0xff) + tdiff; - int s1; - - uint32_t tbase2 = wstate->tile[tilenum].line * t1 + wstate->tile[tilenum].tmem; - uint32_t tpal = wstate->tile[tilenum].palette << 4; - uint32_t xort, ands; - - uint32_t taddr0, taddr1, taddr2, taddr3; - uint16_t c0, c1, c2, c3; - - - - - uint32_t xorupperrg = isupperrg ? (WORD_ADDR_XOR ^ 3) : WORD_ADDR_XOR; - - - - switch(wstate->tile[tilenum].f.tlutswitch) - { - case 0: - case 1: - case 2: - { - s1 = s0 + sdiff; - taddr0 = ((tbase0 << 4) + s0) >> 1; - taddr1 = ((tbase0 << 4) + s1) >> 1; - taddr2 = ((tbase2 << 4) + s0) >> 1; - taddr3 = ((tbase2 << 4) + s1) >> 1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - ands = s0 & 1; - c0 = wstate->tmem[taddr0 & 0x7ff]; - c0 = (ands) ? (c0 & 0xf) : (c0 >> 4); - taddr0 = (tpal | c0) << 2; - c2 = wstate->tmem[taddr2 & 0x7ff]; - c2 = (ands) ? (c2 & 0xf) : (c2 >> 4); - taddr2 = ((tpal | c2) << 2) + 2; - - ands = s1 & 1; - c1 = wstate->tmem[taddr1 & 0x7ff]; - c1 = (ands) ? (c1 & 0xf) : (c1 >> 4); - taddr1 = ((tpal | c1) << 2) + 1; - c3 = wstate->tmem[taddr3 & 0x7ff]; - c3 = (ands) ? (c3 & 0xf) : (c3 >> 4); - taddr3 = ((tpal | c3) << 2) + 3; - } - break; - case 3: - { - s1 = s0 + (sdiff << 1); - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - c0 >>= 4; - taddr0 = (tpal | c0) << 2; - c2 = wstate->tmem[taddr2 & 0x7ff]; - c2 >>= 4; - taddr2 = ((tpal | c2) << 2) + 2; - - c1 = wstate->tmem[taddr1 & 0x7ff]; - c1 >>= 4; - taddr1 = ((tpal | c1) << 2) + 1; - c3 = wstate->tmem[taddr3 & 0x7ff]; - c3 >>= 4; - taddr3 = ((tpal | c3) << 2) + 3; - } - break; - case 4: - case 5: - case 6: - { - s1 = s0 + sdiff; - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - taddr0 = c0 << 2; - c2 = wstate->tmem[taddr2 & 0x7ff]; - taddr2 = (c2 << 2) + 2; - c1 = wstate->tmem[taddr1 & 0x7ff]; - taddr1 = (c1 << 2) + 1; - c3 = wstate->tmem[taddr3 & 0x7ff]; - taddr3 = (c3 << 2) + 3; - } - break; - case 7: - { - s1 = s0 + (sdiff << 1); - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - taddr0 = c0 << 2; - c2 = wstate->tmem[taddr2 & 0x7ff]; - taddr2 = (c2 << 2) + 2; - c1 = wstate->tmem[taddr1 & 0x7ff]; - taddr1 = (c1 << 2) + 1; - c3 = wstate->tmem[taddr3 & 0x7ff]; - taddr3 = (c3 << 2) + 3; - } - break; - case 8: - case 9: - case 10: - { - s1 = s0 + sdiff; - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = tc16[taddr0 & 0x3ff]; - taddr0 = (c0 >> 6) & ~3; - c1 = tc16[taddr1 & 0x3ff]; - taddr1 = ((c1 >> 6) & ~3) + 1; - c2 = tc16[taddr2 & 0x3ff]; - taddr2 = ((c2 >> 6) & ~3) + 2; - c3 = tc16[taddr3 & 0x3ff]; - taddr3 = (c3 >> 6) | 3; - } - break; - case 11: - { - s1 = s0 + (sdiff << 1); - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - taddr0 = c0 << 2; - c2 = wstate->tmem[taddr2 & 0x7ff]; - taddr2 = (c2 << 2) + 2; - c1 = wstate->tmem[taddr1 & 0x7ff]; - taddr1 = (c1 << 2) + 1; - c3 = wstate->tmem[taddr3 & 0x7ff]; - taddr3 = (c3 << 2) + 3; - } - break; - case 12: - case 13: - case 14: - { - s1 = s0 + sdiff; - taddr0 = (tbase0 << 2) + s0; - taddr1 = (tbase0 << 2) + s1; - taddr2 = (tbase2 << 2) + s0; - taddr3 = (tbase2 << 2) + s1; - - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = tc16[taddr0 & 0x3ff]; - taddr0 = (c0 >> 6) & ~3; - c1 = tc16[taddr1 & 0x3ff]; - taddr1 = ((c1 >> 6) & ~3) + 1; - c2 = tc16[taddr2 & 0x3ff]; - taddr2 = ((c2 >> 6) & ~3) + 2; - c3 = tc16[taddr3 & 0x3ff]; - taddr3 = (c3 >> 6) | 3; - } - break; - case 15: - default: - { - s1 = s0 + (sdiff << 1); - taddr0 = (tbase0 << 3) + s0; - taddr1 = (tbase0 << 3) + s1; - taddr2 = (tbase2 << 3) + s0; - taddr3 = (tbase2 << 3) + s1; - - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - taddr1 ^= xort; - xort = (t1 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr2 ^= xort; - taddr3 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - taddr0 = c0 << 2; - c2 = wstate->tmem[taddr2 & 0x7ff]; - taddr2 = (c2 << 2) + 2; - c1 = wstate->tmem[taddr1 & 0x7ff]; - taddr1 = (c1 << 2) + 1; - c3 = wstate->tmem[taddr3 & 0x7ff]; - taddr3 = (c3 << 2) + 3; - } - break; - } - - c0 = tlut[taddr0 ^ xorupperrg]; - c2 = tlut[taddr2 ^ xorupperrg]; - c1 = tlut[taddr1 ^ xorupperrg]; - c3 = tlut[taddr3 ^ xorupperrg]; - - if (!wstate->other_modes.tlut_type) - { - color0->r = GET_HI_RGBA16_TMEM(c0); - color0->g = GET_MED_RGBA16_TMEM(c0); - color1->r = GET_HI_RGBA16_TMEM(c1); - color1->g = GET_MED_RGBA16_TMEM(c1); - color2->r = GET_HI_RGBA16_TMEM(c2); - color2->g = GET_MED_RGBA16_TMEM(c2); - color3->r = GET_HI_RGBA16_TMEM(c3); - color3->g = GET_MED_RGBA16_TMEM(c3); - - if (isupper == isupperrg) - { - color0->b = GET_LOW_RGBA16_TMEM(c0); - color0->a = (c0 & 1) ? 0xff : 0; - color1->b = GET_LOW_RGBA16_TMEM(c1); - color1->a = (c1 & 1) ? 0xff : 0; - color2->b = GET_LOW_RGBA16_TMEM(c2); - color2->a = (c2 & 1) ? 0xff : 0; - color3->b = GET_LOW_RGBA16_TMEM(c3); - color3->a = (c3 & 1) ? 0xff : 0; - } - else - { - color0->b = GET_LOW_RGBA16_TMEM(c3); - color0->a = (c3 & 1) ? 0xff : 0; - color1->b = GET_LOW_RGBA16_TMEM(c2); - color1->a = (c2 & 1) ? 0xff : 0; - color2->b = GET_LOW_RGBA16_TMEM(c1); - color2->a = (c1 & 1) ? 0xff : 0; - color3->b = GET_LOW_RGBA16_TMEM(c0); - color3->a = (c0 & 1) ? 0xff : 0; - } - } - else - { - color0->r = color0->g = c0 >> 8; - color1->r = color1->g = c1 >> 8; - color2->r = color2->g = c2 >> 8; - color3->r = color3->g = c3 >> 8; - - if (isupper == isupperrg) - { - color0->b = c0 >> 8; - color0->a = c0 & 0xff; - color1->b = c1 >> 8; - color1->a = c1 & 0xff; - color2->b = c2 >> 8; - color2->a = c2 & 0xff; - color3->b = c3 >> 8; - color3->a = c3 & 0xff; - } - else - { - color0->b = c3 >> 8; - color0->a = c3 & 0xff; - color1->b = c2 >> 8; - color1->a = c2 & 0xff; - color2->b = c1 >> 8; - color2->a = c1 & 0xff; - color3->b = c0 >> 8; - color3->a = c0 & 0xff; - } - } -} - -static INLINE void fetch_texel_entlut_quadro_nearest(struct rdp_state* wstate, struct color *color0, struct color *color1, struct color *color2, struct color *color3, int s0, int t0, uint32_t tilenum, int isupper, int isupperrg) -{ - uint32_t tbase0 = wstate->tile[tilenum].line * t0 + wstate->tile[tilenum].tmem; - uint32_t tpal = wstate->tile[tilenum].palette << 4; - uint32_t xort, ands; - - uint32_t taddr0 = 0; - uint16_t c0, c1, c2, c3; - - uint32_t xorupperrg = isupperrg ? (WORD_ADDR_XOR ^ 3) : WORD_ADDR_XOR; - - switch(wstate->tile[tilenum].f.tlutswitch) - { - case 0: - case 1: - case 2: - { - taddr0 = ((tbase0 << 4) + s0) >> 1; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - - ands = s0 & 1; - c0 = wstate->tmem[taddr0 & 0x7ff]; - c0 = (ands) ? (c0 & 0xf) : (c0 >> 4); - - taddr0 = (tpal | c0) << 2; - } - break; - case 3: - { - taddr0 = (tbase0 << 3) + s0; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - - c0 >>= 4; - - taddr0 = (tpal | c0) << 2; - } - break; - case 4: - case 5: - case 6: - { - taddr0 = (tbase0 << 3) + s0; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - - taddr0 = c0 << 2; - } - break; - case 7: - { - taddr0 = (tbase0 << 3) + s0; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - - taddr0 = c0 << 2; - } - break; - case 8: - case 9: - case 10: - { - taddr0 = (tbase0 << 2) + s0; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - - c0 = tc16[taddr0 & 0x3ff]; - - taddr0 = (c0 >> 6) & ~3; - } - break; - case 11: - { - taddr0 = (tbase0 << 3) + s0; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - - taddr0 = c0 << 2; - } - break; - case 12: - case 13: - case 14: - { - taddr0 = (tbase0 << 2) + s0; - xort = (t0 & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR; - taddr0 ^= xort; - - c0 = tc16[taddr0 & 0x3ff]; - - taddr0 = (c0 >> 6) & ~3; - } - break; - case 15: - default: - { - taddr0 = (tbase0 << 3) + s0; - xort = (t0 & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR; - taddr0 ^= xort; - - c0 = wstate->tmem[taddr0 & 0x7ff]; - - taddr0 = c0 << 2; - } - break; - } - - c0 = tlut[taddr0 ^ xorupperrg]; - c1 = tlut[(taddr0 + 1) ^ xorupperrg]; - c2 = tlut[(taddr0 + 2) ^ xorupperrg]; - c3 = tlut[(taddr0 + 3) ^ xorupperrg]; - - if (!wstate->other_modes.tlut_type) - { - color0->r = GET_HI_RGBA16_TMEM(c0); - color0->g = GET_MED_RGBA16_TMEM(c0); - color1->r = GET_HI_RGBA16_TMEM(c1); - color1->g = GET_MED_RGBA16_TMEM(c1); - color2->r = GET_HI_RGBA16_TMEM(c2); - color2->g = GET_MED_RGBA16_TMEM(c2); - color3->r = GET_HI_RGBA16_TMEM(c3); - color3->g = GET_MED_RGBA16_TMEM(c3); - - if (isupper == isupperrg) - { - color0->b = GET_LOW_RGBA16_TMEM(c0); - color0->a = (c0 & 1) ? 0xff : 0; - color1->b = GET_LOW_RGBA16_TMEM(c1); - color1->a = (c1 & 1) ? 0xff : 0; - color2->b = GET_LOW_RGBA16_TMEM(c2); - color2->a = (c2 & 1) ? 0xff : 0; - color3->b = GET_LOW_RGBA16_TMEM(c3); - color3->a = (c3 & 1) ? 0xff : 0; - } - else - { - color0->b = GET_LOW_RGBA16_TMEM(c3); - color0->a = (c3 & 1) ? 0xff : 0; - color1->b = GET_LOW_RGBA16_TMEM(c2); - color1->a = (c2 & 1) ? 0xff : 0; - color2->b = GET_LOW_RGBA16_TMEM(c1); - color2->a = (c1 & 1) ? 0xff : 0; - color3->b = GET_LOW_RGBA16_TMEM(c0); - color3->a = (c0 & 1) ? 0xff : 0; - } - } - else - { - color0->r = color0->g = c0 >> 8; - color1->r = color1->g = c1 >> 8; - color2->r = color2->g = c2 >> 8; - color3->r = color3->g = c3 >> 8; - - if (isupper == isupperrg) - { - color0->b = c0 >> 8; - color0->a = c0 & 0xff; - color1->b = c1 >> 8; - color1->a = c1 & 0xff; - color2->b = c2 >> 8; - color2->a = c2 & 0xff; - color3->b = c3 >> 8; - color3->a = c3 & 0xff; - } - else - { - color0->b = c3 >> 8; - color0->a = c3 & 0xff; - color1->b = c2 >> 8; - color1->a = c2 & 0xff; - color2->b = c1 >> 8; - color2->a = c1 & 0xff; - color3->b = c0 >> 8; - color3->a = c0 & 0xff; - } - } -} - -static void get_tmem_idx(struct rdp_state* wstate, int s, int t, uint32_t tilenum, uint32_t* idx0, uint32_t* idx1, uint32_t* idx2, uint32_t* idx3, uint32_t* bit3flipped, uint32_t* hibit) -{ - uint32_t tbase = (wstate->tile[tilenum].line * t) & 0x1ff; - tbase += wstate->tile[tilenum].tmem; - uint32_t tsize = wstate->tile[tilenum].size; - uint32_t tformat = wstate->tile[tilenum].format; - uint32_t sshorts = 0; - - - if (tsize == PIXEL_SIZE_8BIT || tformat == FORMAT_YUV) - sshorts = s >> 1; - else if (tsize >= PIXEL_SIZE_16BIT) - sshorts = s; - else - sshorts = s >> 2; - sshorts &= 0x7ff; - - *bit3flipped = ((sshorts & 2) != 0) ^ (t & 1); - - int tidx_a = ((tbase << 2) + sshorts) & 0x7fd; - int tidx_b = (tidx_a + 1) & 0x7ff; - int tidx_c = (tidx_a + 2) & 0x7ff; - int tidx_d = (tidx_a + 3) & 0x7ff; - - *hibit = (tidx_a & 0x400) != 0; - - if (t & 1) - { - tidx_a ^= 2; - tidx_b ^= 2; - tidx_c ^= 2; - tidx_d ^= 2; - } - - - sort_tmem_idx(idx0, tidx_a, tidx_b, tidx_c, tidx_d, 0); - sort_tmem_idx(idx1, tidx_a, tidx_b, tidx_c, tidx_d, 1); - sort_tmem_idx(idx2, tidx_a, tidx_b, tidx_c, tidx_d, 2); - sort_tmem_idx(idx3, tidx_a, tidx_b, tidx_c, tidx_d, 3); -} - -static void read_tmem_copy(struct rdp_state* wstate, int s, int s1, int s2, int s3, int t, uint32_t tilenum, uint32_t* sortshort, int* hibits, int* lowbits) -{ - uint32_t tbase = (wstate->tile[tilenum].line * t) & 0x1ff; - tbase += wstate->tile[tilenum].tmem; - uint32_t tsize = wstate->tile[tilenum].size; - uint32_t tformat = wstate->tile[tilenum].format; - uint32_t shbytes = 0, shbytes1 = 0, shbytes2 = 0, shbytes3 = 0; - int32_t delta = 0; - uint32_t sortidx[8]; - - - if (tsize == PIXEL_SIZE_8BIT || tformat == FORMAT_YUV) - { - shbytes = s << 1; - shbytes1 = s1 << 1; - shbytes2 = s2 << 1; - shbytes3 = s3 << 1; - } - else if (tsize >= PIXEL_SIZE_16BIT) - { - shbytes = s << 2; - shbytes1 = s1 << 2; - shbytes2 = s2 << 2; - shbytes3 = s3 << 2; - } - else - { - shbytes = s; - shbytes1 = s1; - shbytes2 = s2; - shbytes3 = s3; - } - - shbytes &= 0x1fff; - shbytes1 &= 0x1fff; - shbytes2 &= 0x1fff; - shbytes3 &= 0x1fff; - - int tidx_a, tidx_blow, tidx_bhi, tidx_c, tidx_dlow, tidx_dhi; - - tbase <<= 4; - tidx_a = (tbase + shbytes) & 0x1fff; - tidx_bhi = (tbase + shbytes1) & 0x1fff; - tidx_c = (tbase + shbytes2) & 0x1fff; - tidx_dhi = (tbase + shbytes3) & 0x1fff; - - if (tformat == FORMAT_YUV) - { - delta = shbytes1 - shbytes; - tidx_blow = (tidx_a + (delta << 1)) & 0x1fff; - tidx_dlow = (tidx_blow + shbytes3 - shbytes) & 0x1fff; - } - else - { - tidx_blow = tidx_bhi; - tidx_dlow = tidx_dhi; - } - - if (t & 1) - { - tidx_a ^= 8; - tidx_blow ^= 8; - tidx_bhi ^= 8; - tidx_c ^= 8; - tidx_dlow ^= 8; - tidx_dhi ^= 8; - } - - hibits[0] = (tidx_a & 0x1000) != 0; - hibits[1] = (tidx_blow & 0x1000) != 0; - hibits[2] = (tidx_bhi & 0x1000) != 0; - hibits[3] = (tidx_c & 0x1000) != 0; - hibits[4] = (tidx_dlow & 0x1000) != 0; - hibits[5] = (tidx_dhi & 0x1000) != 0; - lowbits[0] = tidx_a & 0xf; - lowbits[1] = tidx_blow & 0xf; - lowbits[2] = tidx_bhi & 0xf; - lowbits[3] = tidx_c & 0xf; - lowbits[4] = tidx_dlow & 0xf; - lowbits[5] = tidx_dhi & 0xf; - - uint32_t short0, short1, short2, short3; - - - tidx_a >>= 2; - tidx_blow >>= 2; - tidx_bhi >>= 2; - tidx_c >>= 2; - tidx_dlow >>= 2; - tidx_dhi >>= 2; - - - sort_tmem_idx(&sortidx[0], tidx_a, tidx_blow, tidx_c, tidx_dlow, 0); - sort_tmem_idx(&sortidx[1], tidx_a, tidx_blow, tidx_c, tidx_dlow, 1); - sort_tmem_idx(&sortidx[2], tidx_a, tidx_blow, tidx_c, tidx_dlow, 2); - sort_tmem_idx(&sortidx[3], tidx_a, tidx_blow, tidx_c, tidx_dlow, 3); - - short0 = tmem16[sortidx[0] ^ WORD_ADDR_XOR]; - short1 = tmem16[sortidx[1] ^ WORD_ADDR_XOR]; - short2 = tmem16[sortidx[2] ^ WORD_ADDR_XOR]; - short3 = tmem16[sortidx[3] ^ WORD_ADDR_XOR]; - - - sort_tmem_shorts_lowhalf(&sortshort[0], short0, short1, short2, short3, lowbits[0] >> 2); - sort_tmem_shorts_lowhalf(&sortshort[1], short0, short1, short2, short3, lowbits[1] >> 2); - sort_tmem_shorts_lowhalf(&sortshort[2], short0, short1, short2, short3, lowbits[3] >> 2); - sort_tmem_shorts_lowhalf(&sortshort[3], short0, short1, short2, short3, lowbits[4] >> 2); - - if (wstate->other_modes.en_tlut) - { - - compute_color_index(wstate, &short0, sortshort[0], lowbits[0] & 3, tilenum); - compute_color_index(wstate, &short1, sortshort[1], lowbits[1] & 3, tilenum); - compute_color_index(wstate, &short2, sortshort[2], lowbits[3] & 3, tilenum); - compute_color_index(wstate, &short3, sortshort[3], lowbits[4] & 3, tilenum); - - - sortidx[4] = (short0 << 2); - sortidx[5] = (short1 << 2) | 1; - sortidx[6] = (short2 << 2) | 2; - sortidx[7] = (short3 << 2) | 3; - } - else - { - sort_tmem_idx(&sortidx[4], tidx_a, tidx_bhi, tidx_c, tidx_dhi, 0); - sort_tmem_idx(&sortidx[5], tidx_a, tidx_bhi, tidx_c, tidx_dhi, 1); - sort_tmem_idx(&sortidx[6], tidx_a, tidx_bhi, tidx_c, tidx_dhi, 2); - sort_tmem_idx(&sortidx[7], tidx_a, tidx_bhi, tidx_c, tidx_dhi, 3); - } - - short0 = tmem16[(sortidx[4] | 0x400) ^ WORD_ADDR_XOR]; - short1 = tmem16[(sortidx[5] | 0x400) ^ WORD_ADDR_XOR]; - short2 = tmem16[(sortidx[6] | 0x400) ^ WORD_ADDR_XOR]; - short3 = tmem16[(sortidx[7] | 0x400) ^ WORD_ADDR_XOR]; - - - - if (wstate->other_modes.en_tlut) - { - sort_tmem_shorts_lowhalf(&sortshort[4], short0, short1, short2, short3, 0); - sort_tmem_shorts_lowhalf(&sortshort[5], short0, short1, short2, short3, 1); - sort_tmem_shorts_lowhalf(&sortshort[6], short0, short1, short2, short3, 2); - sort_tmem_shorts_lowhalf(&sortshort[7], short0, short1, short2, short3, 3); - } - else - { - sort_tmem_shorts_lowhalf(&sortshort[4], short0, short1, short2, short3, lowbits[0] >> 2); - sort_tmem_shorts_lowhalf(&sortshort[5], short0, short1, short2, short3, lowbits[2] >> 2); - sort_tmem_shorts_lowhalf(&sortshort[6], short0, short1, short2, short3, lowbits[3] >> 2); - sort_tmem_shorts_lowhalf(&sortshort[7], short0, short1, short2, short3, lowbits[5] >> 2); - } -} - -static void tmem_init_lut(void) -{ - int i; - for (i = 0; i < 32; i++) - replicated_rgba[i] = (uint8_t)((i << 3) | ((i >> 2) & 7)); -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/rdp/zbuffer.c b/angrylion-rdp-plus/src/core/n64video/rdp/zbuffer.c deleted file mode 100644 index 001bcc8..0000000 --- a/angrylion-rdp-plus/src/core/n64video/rdp/zbuffer.c +++ /dev/null @@ -1,410 +0,0 @@ -#ifdef N64VIDEO_C - -#define ZMODE_OPAQUE 0 -#define ZMODE_INTERPENETRATING 1 -#define ZMODE_TRANSPARENT 2 -#define ZMODE_DECAL 3 - -static uint16_t z_com_table[0x40000]; -static uint32_t z_complete_dec_table[0x4000]; -static uint16_t deltaz_comparator_lut[0x10000]; - -static struct {uint32_t shift; uint32_t add;} z_dec_table[8] = { - { 6, 0x00000 }, - { 5, 0x20000 }, - { 4, 0x30000 }, - { 3, 0x38000 }, - { 2, 0x3c000 }, - { 1, 0x3e000 }, - { 0, 0x3f000 }, - { 0, 0x3f800 }, -}; - -static STRICTINLINE uint32_t z_decompress(uint32_t zb) -{ - return z_complete_dec_table[(zb >> 2) & 0x3fff]; -} - -static INLINE void z_build_com_table(void) -{ - - int z; - uint16_t altmem = 0; - for(z = 0; z < 0x40000; z++) - { - switch((z >> 11) & 0x7f) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - case 0x1c: - case 0x1d: - case 0x1e: - case 0x1f: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x28: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: - case 0x2e: - case 0x2f: - case 0x30: - case 0x31: - case 0x32: - case 0x33: - case 0x34: - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: - case 0x3a: - case 0x3b: - case 0x3c: - case 0x3d: - case 0x3e: - case 0x3f: - altmem = (z >> 4) & 0x1ffc; - break; - case 0x40: - case 0x41: - case 0x42: - case 0x43: - case 0x44: - case 0x45: - case 0x46: - case 0x47: - case 0x48: - case 0x49: - case 0x4a: - case 0x4b: - case 0x4c: - case 0x4d: - case 0x4e: - case 0x4f: - case 0x50: - case 0x51: - case 0x52: - case 0x53: - case 0x54: - case 0x55: - case 0x56: - case 0x57: - case 0x58: - case 0x59: - case 0x5a: - case 0x5b: - case 0x5c: - case 0x5d: - case 0x5e: - case 0x5f: - altmem = ((z >> 3) & 0x1ffc) | 0x2000; - break; - case 0x60: - case 0x61: - case 0x62: - case 0x63: - case 0x64: - case 0x65: - case 0x66: - case 0x67: - case 0x68: - case 0x69: - case 0x6a: - case 0x6b: - case 0x6c: - case 0x6d: - case 0x6e: - case 0x6f: - altmem = ((z >> 2) & 0x1ffc) | 0x4000; - break; - case 0x70: - case 0x71: - case 0x72: - case 0x73: - case 0x74: - case 0x75: - case 0x76: - case 0x77: - altmem = ((z >> 1) & 0x1ffc) | 0x6000; - break; - case 0x78: - case 0x79: - case 0x7a: - case 0x7b: - altmem = (z & 0x1ffc) | 0x8000; - break; - case 0x7c: - case 0x7d: - altmem = ((z << 1) & 0x1ffc) | 0xa000; - break; - case 0x7e: - altmem = ((z << 2) & 0x1ffc) | 0xc000; - break; - case 0x7f: - altmem = ((z << 2) & 0x1ffc) | 0xe000; - break; - default: - msg_error("z_build_com_table failed"); - break; - } - - z_com_table[z] = altmem; - - } -} - -static STRICTINLINE void z_store(uint32_t zcurpixel, uint32_t z, int dzpixenc) -{ - uint16_t zval = z_com_table[z & 0x3ffff]|(uint16_t)(dzpixenc >> 2); - uint8_t hval = dzpixenc & 3; - PAIRWRITE16(zcurpixel, zval, hval); -} - -static STRICTINLINE uint32_t dz_decompress(uint32_t dz_compressed) -{ - return (1 << dz_compressed); -} - - -static STRICTINLINE uint32_t dz_compress(uint32_t value) -{ - int j = 0; - if (value & 0xff00) - j |= 8; - if (value & 0xf0f0) - j |= 4; - if (value & 0xcccc) - j |= 2; - if (value & 0xaaaa) - j |= 1; - return j; -} - -static STRICTINLINE uint32_t z_compare(struct rdp_state* wstate, uint32_t zcurpixel, uint32_t sz, uint16_t dzpix, int dzpixenc, uint32_t* blend_en, uint32_t* prewrap, uint32_t* curpixel_cvg, uint32_t curpixel_memcvg) -{ - - - int force_coplanar = 0; - sz &= 0x3ffff; - - uint8_t hval; - uint16_t zval; - uint32_t oz, dzmem; - int32_t rawdzmem; - - if (wstate->other_modes.z_compare_en) - { - PAIRREAD16(zval, hval, zcurpixel); - oz = z_decompress(zval); - rawdzmem = ((zval & 3) << 2) | hval; - dzmem = dz_decompress(rawdzmem); - - - - if (wstate->other_modes.f.realblendershiftersneeded) - { - wstate->blshifta = clamp(dzpixenc - rawdzmem, 0, 4); - wstate->blshiftb = clamp(rawdzmem - dzpixenc, 0, 4); - - } - - - if (wstate->other_modes.f.interpixelblendershiftersneeded) - { - wstate->pastblshifta = clamp(dzpixenc - wstate->pastrawdzmem, 0, 4); - wstate->pastblshiftb = clamp(wstate->pastrawdzmem - dzpixenc, 0, 4); - } - - wstate->pastrawdzmem = rawdzmem; - - int precision_factor = (zval >> 13) & 0xf; - - - - - uint32_t dzmemmodifier; - if (precision_factor < 3) - { - if (dzmem != 0x8000) - { - dzmemmodifier = 16 >> precision_factor; - dzmem <<= 1; - if (dzmem < dzmemmodifier) - dzmem = dzmemmodifier; - - } - else - { - force_coplanar = 1; - dzmem = 0xffff; - } - } - - - - - - - uint32_t dznew = (uint32_t)deltaz_comparator_lut[dzpix | dzmem]; - - uint32_t dznotshift = dznew; - dznew <<= 3; - - - uint32_t farther = force_coplanar || ((sz + dznew) >= oz); - - int overflow = (curpixel_memcvg + *curpixel_cvg) & 8; - *blend_en = wstate->other_modes.force_blend || (!overflow && wstate->other_modes.antialias_en && farther); - - *prewrap = overflow; - - - - int cvgcoeff = 0; - uint32_t dzenc = 0; - - int32_t diff; - uint32_t nearer, max, infront; - - switch(wstate->other_modes.z_mode) - { - case ZMODE_OPAQUE: - infront = sz < oz; - diff = (int32_t)sz - (int32_t)dznew; - nearer = force_coplanar || (diff <= (int32_t)oz); - max = (oz == 0x3ffff); - return (max || (overflow ? infront : nearer)); - break; - case ZMODE_INTERPENETRATING: - infront = sz < oz; - if (!infront || !farther || !overflow) - { - diff = (int32_t)sz - (int32_t)dznew; - nearer = force_coplanar || (diff <= (int32_t)oz); - max = (oz == 0x3ffff); - return (max || (overflow ? infront : nearer)); - } - else - { - dzenc = dz_compress(dznotshift & 0xffff); - cvgcoeff = ((oz >> dzenc) - (sz >> dzenc)) & 0xf; - *curpixel_cvg = ((cvgcoeff * (*curpixel_cvg)) >> 3) & 0xf; - return 1; - } - break; - case ZMODE_TRANSPARENT: - infront = sz < oz; - max = (oz == 0x3ffff); - return (infront || max); - break; - case ZMODE_DECAL: - diff = (int32_t)sz - (int32_t)dznew; - nearer = force_coplanar || (diff <= (int32_t)oz); - max = (oz == 0x3ffff); - return (farther && nearer && !max); - break; - } - return 0; - } - else - { - - - if (wstate->other_modes.f.realblendershiftersneeded) - { - wstate->blshifta = 0; - if (dzpixenc < 0xb) - wstate->blshiftb = 4; - else - wstate->blshiftb = 0xf - dzpixenc; - } - - if (wstate->other_modes.f.interpixelblendershiftersneeded) - { - wstate->pastblshifta = 0; - if (dzpixenc < 0xb) - wstate->pastblshiftb = 4; - else - wstate->pastblshiftb = 0xf - dzpixenc; - } - - wstate->pastrawdzmem = 0xf; - - int overflow = (curpixel_memcvg + *curpixel_cvg) & 8; - *blend_en = wstate->other_modes.force_blend || (!overflow && wstate->other_modes.antialias_en); - *prewrap = overflow; - - return 1; - } -} - -void rdp_set_mask_image(struct rdp_state* wstate, const uint32_t* args) -{ - wstate->zb_address = args[1] & 0x0ffffff; -} - -void z_init_lut(void) -{ - int i; - z_build_com_table(); - - uint32_t exponent; - uint32_t mantissa; - for (i = 0; i < 0x4000; i++) - { - exponent = (i >> 11) & 7; - mantissa = i & 0x7ff; - z_complete_dec_table[i] = ((mantissa << z_dec_table[exponent].shift) + z_dec_table[exponent].add) & 0x3ffff; - } - - deltaz_comparator_lut[0] = 0; - for (i = 1; i < 0x10000; i++) - { - int k; - for (k = 15; k >= 0; k--) - { - if (i & (1 << k)) - { - deltaz_comparator_lut[i] = 1 << k; - break; - } - } - } -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/vi.c b/angrylion-rdp-plus/src/core/n64video/vi.c deleted file mode 100644 index 47358c7..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi.c +++ /dev/null @@ -1,743 +0,0 @@ -#ifdef N64VIDEO_C - -// anamorphic NTSC resolution -#define H_RES_NTSC 640 -#define V_RES_NTSC 480 - -// anamorphic PAL resolution -#define H_RES_PAL 768 -#define V_RES_PAL 576 - -// typical VI_V_SYNC values for NTSC and PAL -#define V_SYNC_NTSC 525 -#define V_SYNC_PAL 625 - -// maximum possible size of the prescale area -#define PRESCALE_WIDTH H_RES_NTSC -#define PRESCALE_HEIGHT V_SYNC_PAL - -enum vi_type -{ - VI_TYPE_BLANK, // no data, no sync - VI_TYPE_RESERVED, // unused, should never be set - VI_TYPE_RGBA5551, // 16 bit color (internally 18 bit RGBA5553) - VI_TYPE_RGBA8888 // 32 bit color -}; - -enum vi_aa -{ - VI_AA_RESAMP_EXTRA_ALWAYS, // resample and AA (always fetch extra lines) - VI_AA_RESAMP_EXTRA, // resample and AA (fetch extra lines if needed) - VI_AA_RESAMP_ONLY, // only resample (treat as all fully covered) - VI_AA_REPLICATE // replicate pixels, no interpolation -}; - -struct vi_reg_ctrl -{ - uint8_t type; - bool gamma_dither_enable; - bool gamma_enable; - bool divot_enable; - bool vbus_clock_enable; - bool serrate; - bool test_mode; - uint8_t aa_mode; - bool reserved; - bool kill_we; - uint8_t pixel_advance; - bool dither_filter_enable; -}; - -typedef void(*vi_fetch_filter_func)(struct n64video_pixel*, uint32_t, uint32_t, struct vi_reg_ctrl, uint32_t, uint32_t); - -#include "vi/gamma.c" -#include "vi/lerp.c" -#include "vi/divot.c" -#include "vi/video.c" -#include "vi/restore.c" -#include "vi/fetch.c" - -// states -static int32_t prevvicurrent; -static int32_t emucontrolsvicurrent; -static bool prevserrate; -static bool lowerfield; -static int32_t oldvstart; -static bool prevwasblank; -static int32_t vactivelines; -static bool ispal; -static int32_t minhpass; -static int32_t maxhpass; -static uint32_t x_add; -static uint32_t x_start; -static uint32_t y_add; -static uint32_t y_start; -static int32_t v_sync; -static int32_t vi_width_low; -static uint32_t frame_buffer; -static uint32_t tvfadeoutstate[PRESCALE_HEIGHT]; -static uint32_t zb_address; - -// prescale buffer -static struct n64video_pixel prescale[PRESCALE_WIDTH * PRESCALE_HEIGHT]; -static uint32_t prescale_ptr; -static int32_t linecount; - -// parsed VI registers -static uint32_t** vi_reg_ptr; -static struct vi_reg_ctrl ctrl; -static int32_t hres, vres; -static int32_t hres_raw, vres_raw; -static int32_t v_start; -static int32_t h_start; -static int32_t v_current_line; - -static void vi_init(void) -{ - vi_gamma_init(); - vi_restore_init(); - - memset(prescale, 0, sizeof(prescale)); - - prevvicurrent = 0; - emucontrolsvicurrent = -1; - prevserrate = false; - oldvstart = 1337; - prevwasblank = false; - zb_address = 0; -} - -static void vi_process_full_parallel(uint32_t worker_id) -{ - int32_t y; - struct n64video_pixel viaa_array[0xa10 << 1]; - struct n64video_pixel divot_array[0xa10 << 1]; - - int32_t cache_marker = 0, cache_next_marker = 0, divot_cache_marker = 0, divot_cache_next_marker = 0; - int32_t cache_marker_init = (x_start >> 10) - 1; - - struct n64video_pixel *viaa_cache = &viaa_array[0]; - struct n64video_pixel *viaa_cache_next = &viaa_array[0xa10]; - struct n64video_pixel *divot_cache = &divot_array[0]; - struct n64video_pixel *divot_cache_next = &divot_array[0xa10]; - - struct n64video_pixel color, nextcolor, scancolor, scannextcolor; - - vi_fetch_filter_func vi_fetch_filter_ptr = ctrl.type & 1 ? vi_fetch_filter32 : vi_fetch_filter16; - - uint32_t pixels = 0, nextpixels = 0, fetchbugstate = 0; - - int32_t xfrac = 0, yfrac = 0; - int32_t line_x = 0, next_line_x = 0, prev_line_x = 0, far_line_x = 0; - int32_t prev_scan_x = 0, scan_x = 0, next_scan_x = 0, far_scan_x = 0; - int32_t prev_x = 0, cur_x = 0, next_x = 0, far_x = 0; - - bool cache_init = false; - - pixels = 0; - - int32_t y_begin = 0; - int32_t y_end = vres; - int32_t y_inc = 1; - - if (config.parallel) { - y_begin = worker_id; - y_inc = parallel_num_workers(); - } - - for (y = y_begin; y < y_end; y += y_inc) { - int32_t x; - uint32_t x_offs = x_start; - uint32_t curry = y_start + y * y_add; - uint32_t nexty = y_start + (y + 1) * y_add; - uint32_t prevy = curry >> 10; - - cache_marker = cache_next_marker = cache_marker_init; - if (ctrl.divot_enable) { - divot_cache_marker = divot_cache_next_marker = cache_marker_init; - } - - struct n64video_pixel* pixel_row = &prescale[prescale_ptr + linecount * y]; - - yfrac = (curry >> 5) & 0x1f; - pixels = vi_width_low * prevy; - nextpixels = vi_width_low + pixels; - - if (prevy == (nexty >> 10)) { - fetchbugstate = 2; - } else { - fetchbugstate >>= 1; - } - - for (x = 0; x < hres; x++, x_offs += x_add) { - line_x = x_offs >> 10; - prev_line_x = line_x - 1; - next_line_x = line_x + 1; - far_line_x = line_x + 2; - - cur_x = pixels + line_x; - prev_x = pixels + prev_line_x; - next_x = pixels + next_line_x; - far_x = pixels + far_line_x; - - scan_x = nextpixels + line_x; - prev_scan_x = nextpixels + prev_line_x; - next_scan_x = nextpixels + next_line_x; - far_scan_x = nextpixels + far_line_x; - - line_x++; - prev_line_x++; - next_line_x++; - far_line_x++; - - xfrac = (x_offs >> 5) & 0x1f; - - if (prev_line_x > cache_marker) { - vi_fetch_filter_ptr(&viaa_cache[prev_line_x], frame_buffer, prev_x, ctrl, vi_width_low, 0); - vi_fetch_filter_ptr(&viaa_cache[line_x], frame_buffer, cur_x, ctrl, vi_width_low, 0); - vi_fetch_filter_ptr(&viaa_cache[next_line_x], frame_buffer, next_x, ctrl, vi_width_low, 0); - cache_marker = next_line_x; - } else if (line_x > cache_marker) { - vi_fetch_filter_ptr(&viaa_cache[line_x], frame_buffer, cur_x, ctrl, vi_width_low, 0); - vi_fetch_filter_ptr(&viaa_cache[next_line_x], frame_buffer, next_x, ctrl, vi_width_low, 0); - cache_marker = next_line_x; - } else if (next_line_x > cache_marker) { - vi_fetch_filter_ptr(&viaa_cache[next_line_x], frame_buffer, next_x, ctrl, vi_width_low, 0); - cache_marker = next_line_x; - } - - if (prev_line_x > cache_next_marker) { - vi_fetch_filter_ptr(&viaa_cache_next[prev_line_x], frame_buffer, prev_scan_x, ctrl, vi_width_low, fetchbugstate); - vi_fetch_filter_ptr(&viaa_cache_next[line_x], frame_buffer, scan_x, ctrl, vi_width_low, fetchbugstate); - vi_fetch_filter_ptr(&viaa_cache_next[next_line_x], frame_buffer, next_scan_x, ctrl, vi_width_low, fetchbugstate); - cache_next_marker = next_line_x; - } else if (line_x > cache_next_marker) { - vi_fetch_filter_ptr(&viaa_cache_next[line_x], frame_buffer, scan_x, ctrl, vi_width_low, fetchbugstate); - vi_fetch_filter_ptr(&viaa_cache_next[next_line_x], frame_buffer, next_scan_x, ctrl, vi_width_low, fetchbugstate); - cache_next_marker = next_line_x; - } else if (next_line_x > cache_next_marker) { - vi_fetch_filter_ptr(&viaa_cache_next[next_line_x], frame_buffer, next_scan_x, ctrl, vi_width_low, fetchbugstate); - cache_next_marker = next_line_x; - } - - if (ctrl.divot_enable) { - if (far_line_x > cache_marker) { - vi_fetch_filter_ptr(&viaa_cache[far_line_x], frame_buffer, far_x, ctrl, vi_width_low, 0); - cache_marker = far_line_x; - } - - if (far_line_x > cache_next_marker) { - vi_fetch_filter_ptr(&viaa_cache_next[far_line_x], frame_buffer, far_scan_x, ctrl, vi_width_low, fetchbugstate); - cache_next_marker = far_line_x; - } - - if (line_x > divot_cache_marker) { - divot_filter(&divot_cache[line_x], viaa_cache[line_x], viaa_cache[prev_line_x], viaa_cache[next_line_x]); - divot_filter(&divot_cache[next_line_x], viaa_cache[next_line_x], viaa_cache[line_x], viaa_cache[far_line_x]); - divot_cache_marker = next_line_x; - } else if (next_line_x > divot_cache_marker) { - divot_filter(&divot_cache[next_line_x], viaa_cache[next_line_x], viaa_cache[line_x], viaa_cache[far_line_x]); - divot_cache_marker = next_line_x; - } - - if (line_x > divot_cache_next_marker) { - divot_filter(&divot_cache_next[line_x], viaa_cache_next[line_x], viaa_cache_next[prev_line_x], viaa_cache_next[next_line_x]); - divot_filter(&divot_cache_next[next_line_x], viaa_cache_next[next_line_x], viaa_cache_next[line_x], viaa_cache_next[far_line_x]); - divot_cache_next_marker = next_line_x; - } else if (next_line_x > divot_cache_next_marker) { - divot_filter(&divot_cache_next[next_line_x], viaa_cache_next[next_line_x], viaa_cache_next[line_x], viaa_cache_next[far_line_x]); - divot_cache_next_marker = next_line_x; - } - - color = divot_cache[line_x]; - } else { - color = viaa_cache[line_x]; - } - - bool lerping = ctrl.aa_mode != VI_AA_REPLICATE && (xfrac || yfrac); - - if (lerping) { - if (ctrl.divot_enable) { - nextcolor = divot_cache[next_line_x]; - scancolor = divot_cache_next[line_x]; - scannextcolor = divot_cache_next[next_line_x]; - } else { - nextcolor = viaa_cache[next_line_x]; - scancolor = viaa_cache_next[line_x]; - scannextcolor = viaa_cache_next[next_line_x]; - } - - vi_vl_lerp(&color, scancolor, yfrac); - vi_vl_lerp(&nextcolor, scannextcolor, yfrac); - vi_vl_lerp(&color, nextcolor, xfrac); - } - - struct n64video_pixel* pixel = &pixel_row[x]; - - if (x >= minhpass && x < maxhpass) { - *pixel = color; - gamma_filters(pixel, ctrl.gamma_enable, ctrl.gamma_dither_enable, &state[worker_id].rseed); - } else { - pixel->r = pixel->g = pixel->b = 0; - } - } - - if (!cache_init && y_add == 0x400) { - cache_marker = cache_next_marker; - cache_next_marker = cache_marker_init; - - struct n64video_pixel* tempccvgptr = viaa_cache; - viaa_cache = viaa_cache_next; - viaa_cache_next = tempccvgptr; - if (ctrl.divot_enable) { - divot_cache_marker = divot_cache_next_marker; - divot_cache_next_marker = cache_marker_init; - tempccvgptr = divot_cache; - divot_cache = divot_cache_next; - divot_cache_next = tempccvgptr; - } - - cache_init = true; - } - } -} - -static bool vi_process_full(struct n64video_frame_buffer* fb) -{ - bool isblank = (ctrl.type & 2) == 0; - bool validinterlace = !isblank && ctrl.serrate; - - if (validinterlace) { - if (prevserrate && emucontrolsvicurrent < 0) { - emucontrolsvicurrent = v_current_line != prevvicurrent; - } - - if (emucontrolsvicurrent == 1) { - lowerfield = v_current_line ^ 1; - } else if (!emucontrolsvicurrent) { - if (v_start == oldvstart) { - lowerfield ^= true; - } else { - lowerfield = v_start < oldvstart; - } - } - - prevvicurrent = v_current_line; - oldvstart = v_start; - } - - prevserrate = validinterlace; - - bool validh = hres > 0 && h_start < PRESCALE_WIDTH; - int32_t h_end = hres + h_start; // note: the result appears to be different to VI_H_END - int32_t hrightblank = PRESCALE_WIDTH - h_end; - - if (isblank && prevwasblank) { - return false; - } - - prevwasblank = isblank; - - linecount = PRESCALE_WIDTH << ctrl.serrate; - prescale_ptr = v_start * linecount + h_start + (lowerfield ? PRESCALE_WIDTH : 0); - - int32_t i; - if (isblank) { - // blank signal, clear entire screen buffer - memset(tvfadeoutstate, 0, PRESCALE_HEIGHT * sizeof(uint32_t)); - memset(prescale, 0, sizeof(prescale)); - } else { - // clear left border - int32_t j; - if (h_start > 0 && h_start < PRESCALE_WIDTH) { - for (i = 0; i < vactivelines; i++) { - memset(&prescale[i * PRESCALE_WIDTH], 0, h_start * sizeof(uint32_t)); - } - } - - // clear right border - if (h_end >= 0 && h_end < PRESCALE_WIDTH) { - for (i = 0; i < vactivelines; i++) { - memset(&prescale[i * PRESCALE_WIDTH + h_end], 0, hrightblank * sizeof(uint32_t)); - } - } - - // clear top border - for (i = 0; i < ((v_start << ctrl.serrate) + lowerfield); i++) { - if (tvfadeoutstate[i]) { - tvfadeoutstate[i]--; - if (!tvfadeoutstate[i]) { - if (validh) { - memset(&prescale[i * PRESCALE_WIDTH + h_start], 0, hres * sizeof(uint32_t)); - } else { - memset(&prescale[i * PRESCALE_WIDTH], 0, PRESCALE_WIDTH * sizeof(uint32_t)); - } - } - } - } - - if (!ctrl.serrate) { - for(j = 0; j < vres; j++) { - if (validh) { - tvfadeoutstate[i] = 2; - } else if (tvfadeoutstate[i]) { - tvfadeoutstate[i]--; - if (!tvfadeoutstate[i]) { - memset(&prescale[i * PRESCALE_WIDTH], 0, PRESCALE_WIDTH * sizeof(uint32_t)); - } - } - - i++; - } - } else { - for(j = 0; j < vres; j++) { - if (validh) { - tvfadeoutstate[i] = 2; - } else if (tvfadeoutstate[i]) { - tvfadeoutstate[i]--; - if (!tvfadeoutstate[i]) { - memset(&prescale[i * PRESCALE_WIDTH], 0, PRESCALE_WIDTH * sizeof(uint32_t)); - } - } - - if (tvfadeoutstate[i + 1]) { - tvfadeoutstate[i + 1]--; - if (!tvfadeoutstate[i + 1]) { - if (validh) { - memset(&prescale[(i + 1) * PRESCALE_WIDTH + h_start], 0, hres * sizeof(uint32_t)); - } else { - memset(&prescale[(i + 1) * PRESCALE_WIDTH], 0, PRESCALE_WIDTH * sizeof(uint32_t)); - } - } - } - - i += 2; - } - } - - // clear bottom border - for (; i < vactivelines; i++) { - if (tvfadeoutstate[i]) { - tvfadeoutstate[i]--; - } - if (!tvfadeoutstate[i]) { - if (validh) { - memset(&prescale[i * PRESCALE_WIDTH + h_start], 0, hres * sizeof(uint32_t)); - } else { - memset(&prescale[i * PRESCALE_WIDTH], 0, PRESCALE_WIDTH * sizeof(uint32_t)); - } - } - } - } - - if (!validh) { - return false; - } - - // run filter update in parallel if enabled - if (config.parallel) { - parallel_run(vi_process_full_parallel); - } else { - vi_process_full_parallel(0); - } - - // finish and send buffer to screen - fb->pixels = prescale; - fb->pitch = PRESCALE_WIDTH; - - if (config.vi.hide_overscan) { - // crop away overscan area from prescale - fb->width = maxhpass - minhpass; - fb->height = vres << ctrl.serrate; - fb->height_out = (vres << 1) * V_SYNC_NTSC / v_sync; - int32_t x = h_start + minhpass; - int32_t y = (v_start + (emucontrolsvicurrent ? lowerfield : 0)) << ctrl.serrate; - fb->pixels += x + y * fb->pitch; - } else { - // use entire prescale buffer - fb->width = PRESCALE_WIDTH; - fb->height = (ispal ? V_RES_PAL : V_RES_NTSC) >> !ctrl.serrate; - fb->height_out = V_RES_NTSC; - } - - // convert to 16:9 if enabled - if (config.vi.widescreen) { - fb->height_out = fb->height_out * 3 / 4; - } - - return fb->width > 0 && fb->height > 0; -} - -static void vi_process_fast_parallel(uint32_t worker_id) -{ - int32_t y; - int32_t y_begin = 0; - int32_t y_end = vres_raw; - int32_t y_inc = 1; - - // drop every other interlaced frame to avoid "wobbly" output due to the - // vertical offset - // TODO: completely skip rendering these frames in unfiltered to improve - // performance? - if (ctrl.serrate && v_current_line) { - return; - } - - if (config.parallel) { - y_begin = worker_id; - y_inc = parallel_num_workers(); - } - - for (y = y_begin; y < y_end; y += y_inc) { - int32_t x; - int32_t line = y * vi_width_low; - - struct n64video_pixel* pixel_row = &prescale[y * hres_raw]; - - for (x = 0; x < hres_raw; x++) { - struct n64video_pixel* pixel = &pixel_row[x]; - - switch (config.vi.mode) { - case VI_MODE_COLOR: - switch (ctrl.type) { - case VI_TYPE_RGBA5551: { - uint16_t pix = rdram_read_idx16((frame_buffer >> 1) + line + x); - pixel->r = (uint8_t)RGBA16_R(pix); - pixel->g = (uint8_t)RGBA16_G(pix); - pixel->b = (uint8_t)RGBA16_B(pix); - break; - } - - case VI_TYPE_RGBA8888: { - uint32_t pix = rdram_read_idx32((frame_buffer >> 2) + line + x); - pixel->r = (uint8_t)RGBA32_R(pix); - pixel->g = (uint8_t)RGBA32_G(pix); - pixel->b = (uint8_t)RGBA32_B(pix); - break; - } - - default: - return; - } - - gamma_filters(pixel, ctrl.gamma_enable, false, &state[worker_id].rseed); - break; - - case VI_MODE_DEPTH: { - if (zb_address) { - pixel->r = pixel->g = pixel->b = rdram_read_idx16((zb_address >> 1) + line + x) >> 8; - } - break; - } - - case VI_MODE_COVERAGE: { - // TODO: incorrect for RGBA8888? - uint8_t hval; - uint16_t pix; - rdram_read_pair16(&pix, &hval, (frame_buffer >> 1) + line + x); - pixel->r = pixel->g = pixel->b = (((pix & 1) << 2) | hval) << 5; - break; - } - - default: - return; - } - } - } -} - -static bool vi_process_fast(struct n64video_frame_buffer* fb) -{ - // note: this is probably a very, very crude method to get the frame size, - // but should hopefully work most of the time - hres_raw = (int32_t)x_add * hres / 1024; - vres_raw = (int32_t)y_add * vres / 1024; - - // skip invalid frame sizes - if (hres_raw <= 0 || vres_raw <= 0) { - return false; - } - - // skip blank/invalid modes - if (!(ctrl.type & 2)) { - return false; - } - - // run filter update in parallel if enabled - if (config.parallel) { - parallel_run(vi_process_fast_parallel); - } else { - vi_process_fast_parallel(0); - } - - // finish and send buffer to screen - fb->pixels = prescale; - fb->width = hres_raw; - fb->height = vres_raw; - fb->pitch = hres_raw; - - // get display size of filtered mode - int32_t filtered_width = maxhpass - minhpass; - int32_t filtered_height = (vres << 1) * V_SYNC_NTSC / v_sync; - - // re-calculate cropped 8 pixel area on the left and right from filtered mode - int32_t border_width = (hres - filtered_width) * hres_raw / hres; - fb->pixels += (border_width / 2) + 1; - fb->width -= border_width; - - // force aspect ratio of filtered mode - fb->height_out = fb->width * filtered_height / filtered_width; - - // convert to 16:9 if enabled - if (config.vi.widescreen) { - fb->height_out = fb->height_out * 3 / 4; - } - - return fb->width > 0 && fb->height > 0; -} - -void vi_set_zbuffer_address(uint32_t address) -{ - zb_address = address; -} - -void n64video_update_screen(struct n64video_frame_buffer* fb) -{ - // check for configuration errors - if (config.vi.mode >= VI_MODE_NUM) { - msg_error("Invalid VI mode: %d", config.vi.mode); - } - - // parse and check some common registers - vi_reg_ptr = config.gfx.vi_reg; - - v_start = (*vi_reg_ptr[VI_V_START] >> 16) & 0x3ff; - h_start = (*vi_reg_ptr[VI_H_START] >> 16) & 0x3ff; - - int32_t v_end = *vi_reg_ptr[VI_V_START] & 0x3ff; - int32_t h_end = *vi_reg_ptr[VI_H_START] & 0x3ff; - - hres = h_end - h_start; - vres = (v_end - v_start) >> 1; // vertical is measured in half-lines - - x_add = *vi_reg_ptr[VI_X_SCALE] & 0xfff; - x_start = (*vi_reg_ptr[VI_X_SCALE] >> 16) & 0xfff; - - y_add = *vi_reg_ptr[VI_Y_SCALE] & 0xfff; - y_start = (*vi_reg_ptr[VI_Y_SCALE] >> 16) & 0xfff; - - v_sync = *vi_reg_ptr[VI_V_SYNC] & 0x3ff; - v_current_line = *vi_reg_ptr[VI_V_CURRENT_LINE] & 1; - - vi_width_low = *vi_reg_ptr[VI_WIDTH] & 0xfff; - frame_buffer = *vi_reg_ptr[VI_ORIGIN] & 0xffffff; - - // cancel if the frame buffer contains no valid address - if (!frame_buffer) { - fb->valid = false; - return; - } - - // split up VI_CONTROL bits - uint32_t vi_control = *vi_reg_ptr[VI_STATUS]; - ctrl.type = vi_control & 3; - ctrl.gamma_dither_enable = (vi_control >> 2) & 1; - ctrl.gamma_enable = (vi_control >> 3) & 1; - ctrl.divot_enable = (vi_control >> 4) & 1; - ctrl.vbus_clock_enable = (vi_control >> 5) & 1; - ctrl.serrate = (vi_control >> 6) & 1; - ctrl.test_mode = (vi_control >> 7) & 1; - ctrl.aa_mode = (vi_control >> 8) & 3; - ctrl.reserved = (vi_control >> 9) & 1; - ctrl.kill_we = (vi_control >> 10) & 1; - ctrl.pixel_advance = (vi_control >> 12) & 0xf; - ctrl.dither_filter_enable = (vi_control >> 16) & 1; - - // check for unexpected VI type bits set - if (ctrl.type & ~3) { - msg_error("Unknown framebuffer format %d", ctrl.type); - } - - // warn about AA glitches in certain cases - if (ctrl.aa_mode == VI_AA_REPLICATE && ctrl.type == VI_TYPE_RGBA5551 && - h_start < 0x80 && x_add <= 0x200 && !onetimewarnings.nolerp) { - msg_warning("vi_update: Disabling VI interpolation in 16-bit color " - "modes causes glitches on hardware if h_start is less than " - "128 pixels and x_scale is less or equal to 0x200."); - onetimewarnings.nolerp = true; - } - - // check for the dangerous vbus_clock_enable flag. it was introduced to - // configure Ultra 64 prototypes and enabling it on final hardware will - // enable two output drivers on the same bus at the same time - if (ctrl.vbus_clock_enable && !onetimewarnings.vbusclock) { - msg_warning("vi_update: vbus_clock_enable bit set in VI_CONTROL_REG " - "register. Never run this code on your N64! It's rumored " - "that turning this bit on will result in permanent damage " - "to the hardware! Emulation will now continue."); - onetimewarnings.vbusclock = true; - } - - // adjust sizes and offsets - ispal = v_sync > (V_SYNC_NTSC + 25); - h_start -= (ispal ? 128 : 108); - - bool h_start_clamped = false; - - if (h_start < 0) { - x_start += (x_add * (-h_start)); - hres += h_start; - - h_start = 0; - h_start_clamped = true; - } - - int32_t vstartoffset = ispal ? 44 : 34; - v_start = (v_start - vstartoffset) / 2; - - if (v_start < 0) { - y_start += (y_add * (uint32_t)(-v_start)); - v_start = 0; - } - - bool hres_clamped = false; - - if ((hres + h_start) > PRESCALE_WIDTH) { - hres = PRESCALE_WIDTH - h_start; - hres_clamped = true; - } - - if ((vres + v_start) > PRESCALE_HEIGHT) { - vres = PRESCALE_HEIGHT - v_start; - msg_warning("vres = %d v_start = %d v_video_start = %d", vres, v_start, (*vi_reg_ptr[VI_V_START] >> 16) & 0x3ff); - } - - vactivelines = v_sync - vstartoffset; - - if (vactivelines > PRESCALE_HEIGHT) { - msg_error("VI_V_SYNC_REG too big"); - } - - fb->valid = true; - - if (vactivelines >= 0) { - uint32_t lineshifter = !ctrl.serrate; - vactivelines >>= lineshifter; - - minhpass = h_start_clamped ? 0 : 8; - maxhpass = hres_clamped ? hres : (hres - 7); - - // run filter update in parallel if enabled - if (config.vi.mode == VI_MODE_NORMAL) { - fb->valid = vi_process_full(fb); - } else { - fb->valid = vi_process_fast(fb); - } - } -} - -static void vi_close(void) -{ -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/vi/divot.c b/angrylion-rdp-plus/src/core/n64video/vi/divot.c deleted file mode 100644 index f621eb7..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi/divot.c +++ /dev/null @@ -1,29 +0,0 @@ -#ifdef N64VIDEO_C - -static STRICTINLINE void divot_filter(struct n64video_pixel* final, struct n64video_pixel center, struct n64video_pixel left, struct n64video_pixel right) -{ - *final = center; - - if ((center.a & left.a & right.a) == 7) - { - return; - } - - if ((left.r >= center.r && right.r >= left.r) || (left.r >= right.r && center.r >= left.r)) - final->r = left.r; - else if ((right.r >= center.r && left.r >= right.r) || (right.r >= left.r && center.r >= right.r)) - final->r = right.r; - - if ((left.g >= center.g && right.g >= left.g) || (left.g >= right.g && center.g >= left.g)) - final->g = left.g; - else if ((right.g >= center.g && left.g >= right.g) || (right.g >= left.g && center.g >= right.g)) - final->g = right.g; - - if ((left.b >= center.b && right.b >= left.b) || (left.b >= right.b && center.b >= left.b)) - final->b = left.b; - else if ((right.b >= center.b && left.b >= right.b) || (right.b >= left.b && center.b >= right.b)) - final->b = right.b; -} - -#endif // N64VIDEO_C - diff --git a/angrylion-rdp-plus/src/core/n64video/vi/fetch.c b/angrylion-rdp-plus/src/core/n64video/vi/fetch.c deleted file mode 100644 index 958331c..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi/fetch.c +++ /dev/null @@ -1,72 +0,0 @@ -#ifdef N64VIDEO_C - -static void vi_fetch_filter16(struct n64video_pixel* res, uint32_t fboffset, uint32_t cur_x, struct vi_reg_ctrl ctrl, uint32_t hres, uint32_t fetchstate) -{ - int r, g, b; - uint32_t idx = (fboffset >> 1) + cur_x; - uint8_t hval; - uint16_t pix; - uint32_t cur_cvg; - if (ctrl.aa_mode <= VI_AA_RESAMP_EXTRA) - { - PAIRREAD16(pix, hval, idx); - cur_cvg = ((pix & 1) << 2) | hval; - } - else - { - RREADIDX16(pix, idx); - cur_cvg = 7; - } - r = RGBA16_R(pix); - g = RGBA16_G(pix); - b = RGBA16_B(pix); - - if (cur_cvg == 7) - { - if (ctrl.dither_filter_enable) - restore_filter16(&r, &g, &b, fboffset, cur_x, hres, fetchstate); - } - else - { - video_filter16(&r, &g, &b, fboffset, cur_x, hres, cur_cvg, fetchstate); - } - - - res->r = (uint8_t)r; - res->g = (uint8_t)g; - res->b = (uint8_t)b; - res->a = (uint8_t)cur_cvg; -} - -static void vi_fetch_filter32(struct n64video_pixel* res, uint32_t fboffset, uint32_t cur_x, struct vi_reg_ctrl ctrl, uint32_t hres, uint32_t fetchstate) -{ - int r, g, b; - uint32_t pix, addr = (fboffset >> 2) + cur_x; - RREADIDX32(pix, addr); - uint32_t cur_cvg; - if (ctrl.aa_mode <= VI_AA_RESAMP_EXTRA) - cur_cvg = (pix >> 5) & 7; - else - cur_cvg = 7; - r = RGBA32_R(pix) & 0xff; - g = RGBA32_G(pix) & 0xff; - b = RGBA32_B(pix) & 0xff; - - if (cur_cvg == 7) - { - if (ctrl.dither_filter_enable) - restore_filter32(&r, &g, &b, fboffset, cur_x, hres, fetchstate); - } - else - { - video_filter32(&r, &g, &b, fboffset, cur_x, hres, cur_cvg, fetchstate); - } - - res->r = (uint8_t)r; - res->g = (uint8_t)g; - res->b = (uint8_t)b; - res->a = (uint8_t)cur_cvg; -} - -#endif // N64VIDEO_C - diff --git a/angrylion-rdp-plus/src/core/n64video/vi/gamma.c b/angrylion-rdp-plus/src/core/n64video/vi/gamma.c deleted file mode 100644 index 284747f..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi/gamma.c +++ /dev/null @@ -1,79 +0,0 @@ -#ifdef N64VIDEO_C - -static uint8_t gamma_table[0x100]; -static uint8_t gamma_dither_table[0x4000]; - -static uint32_t vi_integer_sqrt(uint32_t a) -{ - unsigned long op = a, res = 0, one = 1 << 30; - - while (one > op) - one >>= 2; - - while (one != 0) - { - if (op >= res + one) - { - op -= res + one; - res += one << 1; - } - res >>= 1; - one >>= 2; - } - return res; -} - -static STRICTINLINE void gamma_filters(struct n64video_pixel* pixel, bool gamma_enable, bool gamma_dither_enable, uint32_t* rstate) -{ - int cdith, dith; - - switch((gamma_enable << 1) | gamma_dither_enable) - { - case 0: // no gamma, no dithering - return; - case 1: // no gamma, dithering enabled - cdith = irand(rstate); - dith = cdith & 1; - if (pixel->r < 255) - pixel->r += (uint8_t)dith; - dith = (cdith >> 1) & 1; - if (pixel->g < 255) - pixel->g += (uint8_t)dith; - dith = (cdith >> 2) & 1; - if (pixel->b < 255) - pixel->b += (uint8_t)dith; - break; - case 2: // gamma enabled, no dithering - pixel->r = gamma_table[pixel->r]; - pixel->g = gamma_table[pixel->g]; - pixel->b = gamma_table[pixel->b]; - break; - case 3: // gamma and dithering enabled - cdith = irand(rstate); - dith = cdith & 0x3f; - pixel->r = gamma_dither_table[((pixel->r) << 6)|dith]; - dith = (cdith >> 6) & 0x3f; - pixel->g = gamma_dither_table[((pixel->g) << 6)|dith]; - dith = ((cdith >> 9) & 0x38) | (cdith & 7); - pixel->b = gamma_dither_table[((pixel->b) << 6)|dith]; - break; - } -} - -void vi_gamma_init(void) -{ - int i; - for (i = 0; i < 256; i++) - { - gamma_table[i] = (uint8_t)vi_integer_sqrt(i << 6); - gamma_table[i] <<= 1; - } - - for (i = 0; i < 0x4000; i++) - { - gamma_dither_table[i] = (uint8_t)vi_integer_sqrt(i); - gamma_dither_table[i] <<= 1; - } -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/vi/lerp.c b/angrylion-rdp-plus/src/core/n64video/vi/lerp.c deleted file mode 100644 index 0af3dfc..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi/lerp.c +++ /dev/null @@ -1,18 +0,0 @@ -#ifdef N64VIDEO_C - -static STRICTINLINE void vi_vl_lerp(struct n64video_pixel* up, struct n64video_pixel down, uint32_t frac) -{ - uint32_t r0, g0, b0; - if (!frac) - return; - - r0 = up->r; - g0 = up->g; - b0 = up->b; - - up->r = ((((down.r - r0) * frac + 16) >> 5) + r0) & 0xff; - up->g = ((((down.g - g0) * frac + 16) >> 5) + g0) & 0xff; - up->b = ((((down.b - b0) * frac + 16) >> 5) + b0) & 0xff; -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/vi/restore.c b/angrylion-rdp-plus/src/core/n64video/vi/restore.c deleted file mode 100644 index 5599767..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi/restore.c +++ /dev/null @@ -1,160 +0,0 @@ -#ifdef N64VIDEO_C - -static int vi_restore_table[0x400]; - -static STRICTINLINE void restore_filter16(int* r, int* g, int* b, uint32_t fboffset, uint32_t num, uint32_t hres, uint32_t fetchbugstate) -{ - int i; - uint32_t idx = (fboffset >> 1) + num; - - uint32_t toleftpix = idx - 1; - - uint32_t leftuppix, leftdownpix, maxpix; - - leftuppix = idx - hres - 1; - - if (fetchbugstate != 1) - { - leftdownpix = idx + hres - 1; - maxpix = idx + hres + 1; - } - else - { - leftdownpix = toleftpix; - maxpix = toleftpix + 2; - } - - int rend = *r; - int gend = *g; - int bend = *b; - const int* redptr = &vi_restore_table[(rend << 2) & 0x3e0]; - const int* greenptr = &vi_restore_table[(gend << 2) & 0x3e0]; - const int* blueptr = &vi_restore_table[(bend << 2) & 0x3e0]; - - uint32_t tempr, tempg, tempb; - uint16_t pix; - - const uint32_t dirs[] = - { - leftuppix, leftuppix + 1, leftuppix + 2, leftdownpix, - leftdownpix + 1, maxpix, toleftpix, toleftpix + 2 - }; - - if (rdram_valid_idx16(maxpix) && rdram_valid_idx16(leftuppix)) - { - for (i = 0; i < 8; i++) - { - pix = rdram_read_idx16_fast(dirs[i]); - tempr = (pix >> 11) & 0x1f; - tempg = (pix >> 6) & 0x1f; - tempb = (pix >> 1) & 0x1f; - rend += redptr[tempr]; - gend += greenptr[tempg]; - bend += blueptr[tempb]; - } - } - else - { - for (i = 0; i < 8; i++) - { - pix = rdram_read_idx16(dirs[i]); - tempr = (pix >> 11) & 0x1f; - tempg = (pix >> 6) & 0x1f; - tempb = (pix >> 1) & 0x1f; - rend += redptr[tempr]; - gend += greenptr[tempg]; - bend += blueptr[tempb]; - } - } - - - *r = rend; - *g = gend; - *b = bend; -} - -static STRICTINLINE void restore_filter32(int* r, int* g, int* b, uint32_t fboffset, uint32_t num, uint32_t hres, uint32_t fetchbugstate) -{ - int i; - uint32_t idx = (fboffset >> 2) + num; - - uint32_t toleftpix = idx - 1; - - uint32_t leftuppix, leftdownpix, maxpix; - - leftuppix = idx - hres - 1; - - if (fetchbugstate != 1) - { - leftdownpix = idx + hres - 1; - maxpix = idx +hres + 1; - } - else - { - leftdownpix = toleftpix; - maxpix = toleftpix + 2; - } - - int rend = *r; - int gend = *g; - int bend = *b; - const int* redptr = &vi_restore_table[(rend << 2) & 0x3e0]; - const int* greenptr = &vi_restore_table[(gend << 2) & 0x3e0]; - const int* blueptr = &vi_restore_table[(bend << 2) & 0x3e0]; - - uint32_t tempr, tempg, tempb; - uint32_t pix; - - const uint32_t dirs[] = - { - leftuppix, leftuppix + 1, leftuppix + 2, leftdownpix, - leftdownpix + 1, maxpix, toleftpix, toleftpix + 2 - }; - - if (rdram_valid_idx32(maxpix) && rdram_valid_idx32(leftuppix)) - { - for (i = 0; i < 8; i++) - { - pix = rdram_read_idx32_fast(dirs[i]); - tempr = (pix >> 27) & 0x1f; - tempg = (pix >> 19) & 0x1f; - tempb = (pix >> 11) & 0x1f; - rend += redptr[tempr]; - gend += greenptr[tempg]; - bend += blueptr[tempb]; - } - } - else - { - for (i = 0; i < 8; i++) - { - pix = rdram_read_idx32(dirs[i]); - tempr = (pix >> 27) & 0x1f; - tempg = (pix >> 19) & 0x1f; - tempb = (pix >> 11) & 0x1f; - rend += redptr[tempr]; - gend += greenptr[tempg]; - bend += blueptr[tempb]; - } - } - - *r = rend; - *g = gend; - *b = bend; -} - -void vi_restore_init() -{ - int i; - for (i = 0; i < 0x400; i++) - { - if (((i >> 5) & 0x1f) < (i & 0x1f)) - vi_restore_table[i] = 1; - else if (((i >> 5) & 0x1f) > (i & 0x1f)) - vi_restore_table[i] = -1; - else - vi_restore_table[i] = 0; - } -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/n64video/vi/video.c b/angrylion-rdp-plus/src/core/n64video/vi/video.c deleted file mode 100644 index e4b5c70..0000000 --- a/angrylion-rdp-plus/src/core/n64video/vi/video.c +++ /dev/null @@ -1,192 +0,0 @@ -#ifdef N64VIDEO_C - -static STRICTINLINE void video_max_optimized(uint32_t* pixels, uint32_t* penumin, uint32_t* penumax, int numofels) -{ - int i; - int posmax = 0, posmin = 0; - uint32_t curpenmax = pixels[0], curpenmin = pixels[0]; - uint32_t max, min; - - for (i = 1; i < numofels; i++) - { - if (pixels[i] > pixels[posmax]) - { - curpenmax = pixels[posmax]; - posmax = i; - } - else if (pixels[i] < pixels[posmin]) - { - curpenmin = pixels[posmin]; - posmin = i; - } - } - max = pixels[posmax]; - min = pixels[posmin]; - if (curpenmax != max) - { - for (i = posmax + 1; i < numofels; i++) - { - if (pixels[i] > curpenmax) - curpenmax = pixels[i]; - } - } - if (curpenmin != min) - { - for (i = posmin + 1; i < numofels; i++) - { - if (pixels[i] < curpenmin) - curpenmin = pixels[i]; - } - } - *penumax = curpenmax; - *penumin = curpenmin; -} - - -static STRICTINLINE void video_filter16(int* endr, int* endg, int* endb, uint32_t fboffset, uint32_t num, uint32_t hres, uint32_t centercvg, uint32_t fetchbugstate) -{ - int i; - uint32_t penumaxr, penumaxg, penumaxb, penuminr, penuming, penuminb; - uint16_t pix; - uint32_t numoffull = 1; - uint8_t hidval; - uint32_t r, g, b; - uint32_t backr[7], backg[7], backb[7]; - - r = *endr; - g = *endg; - b = *endb; - - backr[0] = r; - backg[0] = g; - backb[0] = b; - - uint32_t idx = (fboffset >> 1) + num; - - uint32_t toleft = idx - 2; - uint32_t toright = idx + 2; - - uint32_t leftup, rightup, leftdown, rightdown; - - leftup = idx - hres - 1; - rightup = idx - hres + 1; - - if (fetchbugstate != 1) - { - leftdown = idx + hres - 1; - rightdown = idx + hres + 1; - } - else - { - leftdown = toleft; - rightdown = toright; - } - - const uint32_t dirs[] = {leftup, rightup, toleft, toright, leftdown, rightdown}; - - for (i = 0; i < 6; i++) - { - rdram_read_pair16(&pix, &hidval, dirs[i]); - if (hidval == 3 && (pix & 1)) - { - backr[numoffull] = RGBA16_R(pix); - backg[numoffull] = RGBA16_G(pix); - backb[numoffull] = RGBA16_B(pix); - numoffull++; - } - } - - uint32_t colr, colg, colb; - - video_max_optimized(backr, &penuminr, &penumaxr, numoffull); - video_max_optimized(backg, &penuming, &penumaxg, numoffull); - video_max_optimized(backb, &penuminb, &penumaxb, numoffull); - - uint32_t coeff = 7 - centercvg; - colr = penuminr + penumaxr - (r << 1); - colg = penuming + penumaxg - (g << 1); - colb = penuminb + penumaxb - (b << 1); - - colr = (((colr * coeff) + 4) >> 3) + r; - colg = (((colg * coeff) + 4) >> 3) + g; - colb = (((colb * coeff) + 4) >> 3) + b; - - *endr = colr & 0xff; - *endg = colg & 0xff; - *endb = colb & 0xff; -} - -static STRICTINLINE void video_filter32(int* endr, int* endg, int* endb, uint32_t fboffset, uint32_t num, uint32_t hres, uint32_t centercvg, uint32_t fetchbugstate) -{ - int i; - uint32_t penumaxr, penumaxg, penumaxb, penuminr, penuming, penuminb; - uint32_t numoffull = 1; - uint32_t pix = 0, pixcvg = 0; - uint32_t r, g, b; - uint32_t backr[7], backg[7], backb[7]; - - r = *endr; - g = *endg; - b = *endb; - - backr[0] = r; - backg[0] = g; - backb[0] = b; - - uint32_t idx = (fboffset >> 2) + num; - - uint32_t toleft = idx - 2; - uint32_t toright = idx + 2; - - uint32_t leftup, rightup, leftdown, rightdown; - - leftup = idx - hres - 1; - rightup = idx - hres + 1; - - if (fetchbugstate != 1) - { - leftdown = idx + hres - 1; - rightdown = idx + hres + 1; - } - else - { - leftdown = toleft; - rightdown = toright; - } - - const uint32_t dirs[] = {leftup, rightup, toleft, toright, leftdown, rightdown}; - - for (i = 0; i < 6; i++) - { - pix = rdram_read_idx32(dirs[i]); - pixcvg = (pix >> 5) & 7; - if (pixcvg == 7) - { - backr[numoffull] = (pix >> 24) & 0xff; - backg[numoffull] = (pix >> 16) & 0xff; - backb[numoffull] = (pix >> 8) & 0xff; - numoffull++; - } - } - - uint32_t colr, colg, colb; - - video_max_optimized(backr, &penuminr, &penumaxr, numoffull); - video_max_optimized(backg, &penuming, &penumaxg, numoffull); - video_max_optimized(backb, &penuminb, &penumaxb, numoffull); - - uint32_t coeff = 7 - centercvg; - colr = penuminr + penumaxr - (r << 1); - colg = penuming + penumaxg - (g << 1); - colb = penuminb + penumaxb - (b << 1); - - colr = (((colr * coeff) + 4) >> 3) + r; - colg = (((colg * coeff) + 4) >> 3) + g; - colb = (((colb * coeff) + 4) >> 3) + b; - - *endr = colr & 0xff; - *endg = colg & 0xff; - *endb = colb & 0xff; -} - -#endif // N64VIDEO_C diff --git a/angrylion-rdp-plus/src/core/parallel.cpp b/angrylion-rdp-plus/src/core/parallel.cpp deleted file mode 100644 index b9e7efa..0000000 --- a/angrylion-rdp-plus/src/core/parallel.cpp +++ /dev/null @@ -1,229 +0,0 @@ -#include "parallel.h" - -#include <atomic> -#include <algorithm> -#include <condition_variable> -#include <cstdint> -#include <functional> -#include <mutex> -#include <thread> -#include <vector> - -class Parallel -{ -public: - Parallel(std::uint32_t num_workers) - { - if (num_workers == 0) { - // auto-select number of workers based on the number of cores - m_num_workers = std::thread::hardware_concurrency(); - } else { - m_num_workers = std::min(num_workers, PARALLEL_MAX_WORKERS); - } - - // mask for m_tasks_done when all workers have finished their task - if (m_num_workers == PARALLEL_MAX_WORKERS) { - m_all_tasks_done = ~0ULL; - } else { - m_all_tasks_done = (1ULL << m_num_workers) - 1; - } - - // except worker 0, which runs in the main thread - m_all_tasks_done--; - } - - virtual ~Parallel() - { - // wait for all workers to finish their current work - wait(); - - // exit worker main loops - m_accept_work = false; - start_work(); - - // join worker threads to make sure they have finished - for (auto& thread : m_workers) { - thread.join(); - } - - // destroy all worker threads - m_workers.clear(); - } - - void begin() - { - // give workers an empty task - m_task = [](std::uint32_t) {}; - m_accept_work = true; - start_work(); - - // create worker threads - for (std::uint32_t worker_id = 1; worker_id < m_num_workers; worker_id++) { - create_worker(worker_id); - } - - // synchronize workers to prepare them for real tasks - wait(); - } - - void run(std::function<void(std::uint32_t)>&& task) - { - // don't allow more tasks if workers are stopping - if (!m_accept_work) { - throw std::runtime_error("Workers are exiting and no longer accept work"); - } - - // prepare task for workers and send signal so they start working - m_task = std::move(task); - start_work(); - - // run worker 0 directly on main thread - m_task(0); - - // wait for all workers to finish - wait(); - } - - std::uint32_t num_workers() - { - return m_num_workers; - } - -protected: - std::function<void(std::uint32_t)> m_task; - std::vector<std::thread> m_workers; - std::mutex m_signal_mutex; - std::condition_variable m_signal_work; - std::condition_variable m_signal_done; - std::atomic<uint64_t> m_tasks_done; - std::uint64_t m_all_tasks_done; - std::atomic<bool> m_accept_work; - std::uint32_t m_num_workers; - - virtual void create_worker(std::uint32_t worker_id) - { - m_workers.emplace_back(std::thread(&Parallel::do_work, this, worker_id)); - } - - virtual void start_work() - { - std::unique_lock<std::mutex> ul(m_signal_mutex); - - // clear task bits for all workers - m_tasks_done = 0; - - // wake up all workers - m_signal_work.notify_all(); - } - - virtual void do_work(std::uint32_t worker_id) - { - const std::uint64_t worker_mask = 1LL << worker_id; - - while (m_accept_work) { - // do the work - m_task(worker_id); - - { - std::unique_lock<std::mutex> ul(m_signal_mutex); - - // mark task as done - m_tasks_done |= worker_mask; - - // notify main thread - m_signal_done.notify_one(); - - // take a break and wait for more work - m_signal_work.wait(ul, [worker_mask, this] { - return (m_tasks_done & worker_mask) == 0; - }); - } - } - } - - virtual void wait() - { - // wait for all workers to set their task bits - std::unique_lock<std::mutex> ul(m_signal_mutex); - m_signal_done.wait(ul, [this] { - return m_tasks_done == m_all_tasks_done; - }); - } - - void operator=(const Parallel&) = delete; - Parallel(const Parallel&) = delete; -}; - -// busy-looping variant that is more suitable for ARM processors -class ParallelBusy : public Parallel -{ -public: - ParallelBusy(std::uint32_t num_workers) : Parallel(num_workers) - { - } - - virtual void create_worker(std::uint32_t worker_id) - { - m_workers.emplace_back(std::thread(&ParallelBusy::do_work, this, worker_id)); - } - - virtual void start_work() - { - // clear task bits for all workers - m_tasks_done = 0; - } - - virtual void do_work(std::uint32_t worker_id) - { - const std::uint64_t worker_mask = 1LL << worker_id; - - while (m_accept_work) { - if ((m_tasks_done & worker_mask) != 0) { - std::this_thread::yield(); - continue; - } - - // do the work - m_task(worker_id); - - // mark task as done - m_tasks_done |= worker_mask; - } - } - - virtual void wait() - { - while (m_tasks_done != m_all_tasks_done) { - std::this_thread::yield(); - } - } -}; - -// C interface for the Parallel class -static std::shared_ptr<Parallel> parallel; - -void parallel_init(uint32_t num, bool busy) -{ - if (busy) { - parallel = std::make_unique<ParallelBusy>(num); - } else { - parallel = std::make_unique<Parallel>(num); - } - - parallel->begin(); -} - -void parallel_run(void task(uint32_t)) -{ - parallel->run(task); -} - -uint32_t parallel_num_workers() -{ - return parallel->num_workers(); -} - -void parallel_close() -{ - parallel.reset(); -} diff --git a/angrylion-rdp-plus/src/core/parallel.h b/angrylion-rdp-plus/src/core/parallel.h deleted file mode 100644 index 09c9381..0000000 --- a/angrylion-rdp-plus/src/core/parallel.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> -#include <stdbool.h> - -#define PARALLEL_MAX_WORKERS 64u - -void parallel_init(uint32_t num, bool busy); -void parallel_run(void task(uint32_t)); -uint32_t parallel_num_workers(); -void parallel_close(); - -#ifdef __cplusplus -} -#endif diff --git a/angrylion-rdp-plus/src/core/version.h.in b/angrylion-rdp-plus/src/core/version.h.in deleted file mode 100644 index 20cb7f9..0000000 --- a/angrylion-rdp-plus/src/core/version.h.in +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#define GIT_BRANCH "@GIT_BRANCH@" -#define GIT_TAG "@GIT_TAG@" -#define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" -#define GIT_COMMIT_DATE "@GIT_COMMIT_DATE@" - -#define CORE_BASE_NAME "angrylion's RDP Plus" - -#ifdef _DEBUG -#define CORE_NAME CORE_BASE_NAME " " GIT_TAG " (Debug)" -#else -#define CORE_NAME CORE_BASE_NAME " " GIT_TAG -#endif - -#define CORE_SIMPLE_NAME "angrylion-plus" diff --git a/angrylion-rdp-plus/src/output/gl_core_3_3.c b/angrylion-rdp-plus/src/output/gl_core_3_3.c deleted file mode 100644 index 9b4137f..0000000 --- a/angrylion-rdp-plus/src/output/gl_core_3_3.c +++ /dev/null @@ -1,1527 +0,0 @@ -#ifndef GLES - -#include "gl_core_3_3.h" -#include "gl_proc.h" -#include <stdlib.h> -#include <string.h> -#include <stddef.h> - -void (CODEGEN_FUNCPTR *_ptrc_glBlendFunc)(GLenum sfactor, GLenum dfactor) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClear)(GLbitfield mask) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearDepth)(GLdouble depth) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearStencil)(GLint s) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCullFace)(GLenum mode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDepthFunc)(GLenum func) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDepthMask)(GLboolean flag) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDepthRange)(GLdouble ren_near, GLdouble ren_far) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDisable)(GLenum cap) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawBuffer)(GLenum buf) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glEnable)(GLenum cap) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFinish)(void) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFlush)(void) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFrontFace)(GLenum mode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetBooleanv)(GLenum pname, GLboolean * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetDoublev)(GLenum pname, GLdouble * data) = NULL; -GLenum (CODEGEN_FUNCPTR *_ptrc_glGetError)(void) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetFloatv)(GLenum pname, GLfloat * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetIntegerv)(GLenum pname, GLint * data) = NULL; -const GLubyte * (CODEGEN_FUNCPTR *_ptrc_glGetString)(GLenum name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, void * pixels) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameteriv)(GLenum target, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glHint)(GLenum target, GLenum mode) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsEnabled)(GLenum cap) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glLineWidth)(GLfloat width) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glLogicOp)(GLenum opcode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPixelStoref)(GLenum pname, GLfloat param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPixelStorei)(GLenum pname, GLint param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPointSize)(GLfloat size) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPolygonMode)(GLenum face, GLenum mode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glReadBuffer)(GLenum src) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glStencilFunc)(GLenum func, GLint ref, GLuint mask) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glStencilMask)(GLuint mask) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexParameterf)(GLenum target, GLenum pname, GLfloat param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexParameteri)(GLenum target, GLenum pname, GLint param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexParameteriv)(GLenum target, GLenum pname, const GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glBindTexture)(GLenum target, GLuint texture) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteTextures)(GLsizei n, const GLuint * textures) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawArrays)(GLenum mode, GLint first, GLsizei count) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawElements)(GLenum mode, GLsizei count, GLenum type, const void * indices) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenTextures)(GLsizei n, GLuint * textures) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsTexture)(GLuint texture) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPolygonOffset)(GLfloat factor, GLfloat units) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glActiveTexture)(GLenum texture) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTexImage)(GLenum target, GLint level, void * img) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSampleCoverage)(GLfloat value, GLboolean invert) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glBlendColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBlendEquation)(GLenum mode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawArrays)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPointParameterf)(GLenum pname, GLfloat param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPointParameterfv)(GLenum pname, const GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPointParameteri)(GLenum pname, GLint param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPointParameteriv)(GLenum pname, const GLint * params) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glBeginQuery)(GLenum target, GLuint id) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindBuffer)(GLenum target, GLuint buffer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBufferData)(GLenum target, GLsizeiptr size, const void * data, GLenum usage) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteBuffers)(GLsizei n, const GLuint * buffers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteQueries)(GLsizei n, const GLuint * ids) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glEndQuery)(GLenum target) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenBuffers)(GLsizei n, GLuint * buffers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenQueries)(GLsizei n, GLuint * ids) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetBufferPointerv)(GLenum target, GLenum pname, void ** params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, void * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectiv)(GLuint id, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectuiv)(GLuint id, GLenum pname, GLuint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetQueryiv)(GLenum target, GLenum pname, GLint * params) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsBuffer)(GLuint buffer) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsQuery)(GLuint id) = NULL; -void * (CODEGEN_FUNCPTR *_ptrc_glMapBuffer)(GLenum target, GLenum access) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glUnmapBuffer)(GLenum target) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glAttachShader)(GLuint program, GLuint shader) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindAttribLocation)(GLuint program, GLuint index, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glCompileShader)(GLuint shader) = NULL; -GLuint (CODEGEN_FUNCPTR *_ptrc_glCreateProgram)(void) = NULL; -GLuint (CODEGEN_FUNCPTR *_ptrc_glCreateShader)(GLenum type) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteProgram)(GLuint program) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteShader)(GLuint shader) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDetachShader)(GLuint program, GLuint shader) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDisableVertexAttribArray)(GLuint index) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawBuffers)(GLsizei n, const GLenum * bufs) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glEnableVertexAttribArray)(GLuint index) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders) = NULL; -GLint (CODEGEN_FUNCPTR *_ptrc_glGetAttribLocation)(GLuint program, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetProgramiv)(GLuint program, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetShaderSource)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetShaderiv)(GLuint shader, GLenum pname, GLint * params) = NULL; -GLint (CODEGEN_FUNCPTR *_ptrc_glGetUniformLocation)(GLuint program, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetUniformfv)(GLuint program, GLint location, GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetUniformiv)(GLuint program, GLint location, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribPointerv)(GLuint index, GLenum pname, void ** pointer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribdv)(GLuint index, GLenum pname, GLdouble * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint * params) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsProgram)(GLuint program) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsShader)(GLuint shader) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glLinkProgram)(GLuint program) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glShaderSource)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glStencilMaskSeparate)(GLenum face, GLuint mask) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glStencilOpSeparate)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform1f)(GLint location, GLfloat v0) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform1fv)(GLint location, GLsizei count, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform1i)(GLint location, GLint v0) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform1iv)(GLint location, GLsizei count, const GLint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform2f)(GLint location, GLfloat v0, GLfloat v1) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform2fv)(GLint location, GLsizei count, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform2i)(GLint location, GLint v0, GLint v1) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform2iv)(GLint location, GLsizei count, const GLint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform3fv)(GLint location, GLsizei count, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform3i)(GLint location, GLint v0, GLint v1, GLint v2) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform3iv)(GLint location, GLsizei count, const GLint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform4fv)(GLint location, GLsizei count, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform4iv)(GLint location, GLsizei count, const GLint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUseProgram)(GLuint program) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glValidateProgram)(GLuint program) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1d)(GLuint index, GLdouble x) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1dv)(GLuint index, const GLdouble * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1f)(GLuint index, GLfloat x) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1fv)(GLuint index, const GLfloat * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1s)(GLuint index, GLshort x) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1sv)(GLuint index, const GLshort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2d)(GLuint index, GLdouble x, GLdouble y) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2dv)(GLuint index, const GLdouble * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2f)(GLuint index, GLfloat x, GLfloat y) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2fv)(GLuint index, const GLfloat * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2s)(GLuint index, GLshort x, GLshort y) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2sv)(GLuint index, const GLshort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3d)(GLuint index, GLdouble x, GLdouble y, GLdouble z) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3dv)(GLuint index, const GLdouble * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3fv)(GLuint index, const GLfloat * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3s)(GLuint index, GLshort x, GLshort y, GLshort z) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3sv)(GLuint index, const GLshort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nbv)(GLuint index, const GLbyte * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Niv)(GLuint index, const GLint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nsv)(GLuint index, const GLshort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nubv)(GLuint index, const GLubyte * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nuiv)(GLuint index, const GLuint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nusv)(GLuint index, const GLushort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4bv)(GLuint index, const GLbyte * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4d)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4dv)(GLuint index, const GLdouble * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4fv)(GLuint index, const GLfloat * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4iv)(GLuint index, const GLint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4s)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4sv)(GLuint index, const GLshort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4ubv)(GLuint index, const GLubyte * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4uiv)(GLuint index, const GLuint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4usv)(GLuint index, const GLushort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glBeginConditionalRender)(GLuint id, GLenum mode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBeginTransformFeedback)(GLenum primitiveMode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindBufferBase)(GLenum target, GLuint index, GLuint buffer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindFragDataLocation)(GLuint program, GLuint color, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindFramebuffer)(GLenum target, GLuint framebuffer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindRenderbuffer)(GLenum target, GLuint renderbuffer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindVertexArray)(GLuint ren_array) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) = NULL; -GLenum (CODEGEN_FUNCPTR *_ptrc_glCheckFramebufferStatus)(GLenum target) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClampColor)(GLenum target, GLenum clamp) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glColorMaski)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteFramebuffers)(GLsizei n, const GLuint * framebuffers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteRenderbuffers)(GLsizei n, const GLuint * renderbuffers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteVertexArrays)(GLsizei n, const GLuint * arrays) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDisablei)(GLenum target, GLuint index) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glEnablei)(GLenum target, GLuint index) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glEndConditionalRender)(void) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glEndTransformFeedback)(void) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture1D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture3D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTextureLayer)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenFramebuffers)(GLsizei n, GLuint * framebuffers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenRenderbuffers)(GLsizei n, GLuint * renderbuffers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenVertexArrays)(GLsizei n, GLuint * arrays) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenerateMipmap)(GLenum target) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetBooleani_v)(GLenum target, GLuint index, GLboolean * data) = NULL; -GLint (CODEGEN_FUNCPTR *_ptrc_glGetFragDataLocation)(GLuint program, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetIntegeri_v)(GLenum target, GLuint index, GLint * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint * params) = NULL; -const GLubyte * (CODEGEN_FUNCPTR *_ptrc_glGetStringi)(GLenum name, GLuint index) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterIiv)(GLenum target, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterIuiv)(GLenum target, GLenum pname, GLuint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetUniformuiv)(GLuint program, GLint location, GLuint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribIiv)(GLuint index, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribIuiv)(GLuint index, GLenum pname, GLuint * params) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsEnabledi)(GLenum target, GLuint index) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsFramebuffer)(GLuint framebuffer) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsRenderbuffer)(GLuint renderbuffer) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsVertexArray)(GLuint ren_array) = NULL; -void * (CODEGEN_FUNCPTR *_ptrc_glMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glRenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexParameterIiv)(GLenum target, GLenum pname, const GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexParameterIuiv)(GLenum target, GLenum pname, const GLuint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform1ui)(GLint location, GLuint v0) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform1uiv)(GLint location, GLsizei count, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform2ui)(GLint location, GLuint v0, GLuint v1) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform2uiv)(GLint location, GLsizei count, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform3ui)(GLint location, GLuint v0, GLuint v1, GLuint v2) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform3uiv)(GLint location, GLsizei count, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform4ui)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniform4uiv)(GLint location, GLsizei count, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1i)(GLuint index, GLint x) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1iv)(GLuint index, const GLint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1ui)(GLuint index, GLuint x) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1uiv)(GLuint index, const GLuint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2i)(GLuint index, GLint x, GLint y) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2iv)(GLuint index, const GLint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2ui)(GLuint index, GLuint x, GLuint y) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2uiv)(GLuint index, const GLuint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3iv)(GLuint index, const GLint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3uiv)(GLuint index, const GLuint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4bv)(GLuint index, const GLbyte * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4iv)(GLuint index, const GLint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4sv)(GLuint index, const GLshort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4ubv)(GLuint index, const GLubyte * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4uiv)(GLuint index, const GLuint * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4usv)(GLuint index, const GLushort * v) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribIPointer)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glCopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockName)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockiv)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformName)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params) = NULL; -GLuint (CODEGEN_FUNCPTR *_ptrc_glGetUniformBlockIndex)(GLuint program, const GLchar * uniformBlockName) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glPrimitiveRestartIndex)(GLuint index) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexBuffer)(GLenum target, GLenum internalformat, GLuint buffer) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glUniformBlockBinding)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) = NULL; - -GLenum (CODEGEN_FUNCPTR *_ptrc_glClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteSync)(GLsync sync) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex) = NULL; -GLsync (CODEGEN_FUNCPTR *_ptrc_glFenceSync)(GLenum condition, GLbitfield flags) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture)(GLenum target, GLenum attachment, GLuint texture, GLint level) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetInteger64i_v)(GLenum target, GLuint index, GLint64 * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetInteger64v)(GLenum pname, GLint64 * data) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetMultisamplefv)(GLenum pname, GLuint index, GLfloat * val) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsSync)(GLsync sync) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElementsBaseVertex)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glProvokingVertex)(GLenum mode) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSampleMaski)(GLuint maskNumber, GLbitfield mask) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexImage2DMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glTexImage3DMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) = NULL; - -void (CODEGEN_FUNCPTR *_ptrc_glBindFragDataLocationIndexed)(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glBindSampler)(GLuint unit, GLuint sampler) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glDeleteSamplers)(GLsizei count, const GLuint * samplers) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGenSamplers)(GLsizei count, GLuint * samplers) = NULL; -GLint (CODEGEN_FUNCPTR *_ptrc_glGetFragDataIndex)(GLuint program, const GLchar * name) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjecti64v)(GLuint id, GLenum pname, GLint64 * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectui64v)(GLuint id, GLenum pname, GLuint64 * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameterIiv)(GLuint sampler, GLenum pname, GLint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameterIuiv)(GLuint sampler, GLenum pname, GLuint * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameterfv)(GLuint sampler, GLenum pname, GLfloat * params) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameteriv)(GLuint sampler, GLenum pname, GLint * params) = NULL; -GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsSampler)(GLuint sampler) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glQueryCounter)(GLuint id, GLenum target) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterIiv)(GLuint sampler, GLenum pname, const GLint * param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterIuiv)(GLuint sampler, GLenum pname, const GLuint * param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterf)(GLuint sampler, GLenum pname, GLfloat param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterfv)(GLuint sampler, GLenum pname, const GLfloat * param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameteri)(GLuint sampler, GLenum pname, GLint param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameteriv)(GLuint sampler, GLenum pname, const GLint * param) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribDivisor)(GLuint index, GLuint divisor) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) = NULL; -void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) = NULL; - -static int Load_Version_3_3(void) -{ - int numFailed = 0; - if(!_ptrc_glBlendFunc) - _ptrc_glBlendFunc = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glBlendFunc"); - if(!_ptrc_glBlendFunc) numFailed++; - if(!_ptrc_glClear) - _ptrc_glClear = (void (CODEGEN_FUNCPTR *)(GLbitfield))IntGetProcAddress("glClear"); - if(!_ptrc_glClear) numFailed++; - if(!_ptrc_glClearColor) - _ptrc_glClearColor = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glClearColor"); - if(!_ptrc_glClearColor) numFailed++; - if(!_ptrc_glClearDepth) - _ptrc_glClearDepth = (void (CODEGEN_FUNCPTR *)(GLdouble))IntGetProcAddress("glClearDepth"); - if(!_ptrc_glClearDepth) numFailed++; - if(!_ptrc_glClearStencil) - _ptrc_glClearStencil = (void (CODEGEN_FUNCPTR *)(GLint))IntGetProcAddress("glClearStencil"); - if(!_ptrc_glClearStencil) numFailed++; - if(!_ptrc_glColorMask) - _ptrc_glColorMask = (void (CODEGEN_FUNCPTR *)(GLboolean, GLboolean, GLboolean, GLboolean))IntGetProcAddress("glColorMask"); - if(!_ptrc_glColorMask) numFailed++; - if(!_ptrc_glCullFace) - _ptrc_glCullFace = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glCullFace"); - if(!_ptrc_glCullFace) numFailed++; - if(!_ptrc_glDepthFunc) - _ptrc_glDepthFunc = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glDepthFunc"); - if(!_ptrc_glDepthFunc) numFailed++; - if(!_ptrc_glDepthMask) - _ptrc_glDepthMask = (void (CODEGEN_FUNCPTR *)(GLboolean))IntGetProcAddress("glDepthMask"); - if(!_ptrc_glDepthMask) numFailed++; - if(!_ptrc_glDepthRange) - _ptrc_glDepthRange = (void (CODEGEN_FUNCPTR *)(GLdouble, GLdouble))IntGetProcAddress("glDepthRange"); - if(!_ptrc_glDepthRange) numFailed++; - if(!_ptrc_glDisable) - _ptrc_glDisable = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glDisable"); - if(!_ptrc_glDisable) numFailed++; - if(!_ptrc_glDrawBuffer) - _ptrc_glDrawBuffer = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glDrawBuffer"); - if(!_ptrc_glDrawBuffer) numFailed++; - if(!_ptrc_glEnable) - _ptrc_glEnable = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glEnable"); - if(!_ptrc_glEnable) numFailed++; - if(!_ptrc_glFinish) - _ptrc_glFinish = (void (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glFinish"); - if(!_ptrc_glFinish) numFailed++; - if(!_ptrc_glFlush) - _ptrc_glFlush = (void (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glFlush"); - if(!_ptrc_glFlush) numFailed++; - if(!_ptrc_glFrontFace) - _ptrc_glFrontFace = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glFrontFace"); - if(!_ptrc_glFrontFace) numFailed++; - if(!_ptrc_glGetBooleanv) - _ptrc_glGetBooleanv = (void (CODEGEN_FUNCPTR *)(GLenum, GLboolean *))IntGetProcAddress("glGetBooleanv"); - if(!_ptrc_glGetBooleanv) numFailed++; - if(!_ptrc_glGetDoublev) - _ptrc_glGetDoublev = (void (CODEGEN_FUNCPTR *)(GLenum, GLdouble *))IntGetProcAddress("glGetDoublev"); - if(!_ptrc_glGetDoublev) numFailed++; - if(!_ptrc_glGetError) - _ptrc_glGetError = (GLenum (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glGetError"); - if(!_ptrc_glGetError) numFailed++; - if(!_ptrc_glGetFloatv) - _ptrc_glGetFloatv = (void (CODEGEN_FUNCPTR *)(GLenum, GLfloat *))IntGetProcAddress("glGetFloatv"); - if(!_ptrc_glGetFloatv) numFailed++; - if(!_ptrc_glGetIntegerv) - _ptrc_glGetIntegerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint *))IntGetProcAddress("glGetIntegerv"); - if(!_ptrc_glGetIntegerv) numFailed++; - if(!_ptrc_glGetString) - _ptrc_glGetString = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGetString"); - if(!_ptrc_glGetString) numFailed++; - if(!_ptrc_glGetTexImage) - _ptrc_glGetTexImage = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLenum, void *))IntGetProcAddress("glGetTexImage"); - if(!_ptrc_glGetTexImage) numFailed++; - if(!_ptrc_glGetTexLevelParameterfv) - _ptrc_glGetTexLevelParameterfv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLfloat *))IntGetProcAddress("glGetTexLevelParameterfv"); - if(!_ptrc_glGetTexLevelParameterfv) numFailed++; - if(!_ptrc_glGetTexLevelParameteriv) - _ptrc_glGetTexLevelParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLint *))IntGetProcAddress("glGetTexLevelParameteriv"); - if(!_ptrc_glGetTexLevelParameteriv) numFailed++; - if(!_ptrc_glGetTexParameterfv) - _ptrc_glGetTexParameterfv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLfloat *))IntGetProcAddress("glGetTexParameterfv"); - if(!_ptrc_glGetTexParameterfv) numFailed++; - if(!_ptrc_glGetTexParameteriv) - _ptrc_glGetTexParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetTexParameteriv"); - if(!_ptrc_glGetTexParameteriv) numFailed++; - if(!_ptrc_glHint) - _ptrc_glHint = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glHint"); - if(!_ptrc_glHint) numFailed++; - if(!_ptrc_glIsEnabled) - _ptrc_glIsEnabled = (GLboolean (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glIsEnabled"); - if(!_ptrc_glIsEnabled) numFailed++; - if(!_ptrc_glLineWidth) - _ptrc_glLineWidth = (void (CODEGEN_FUNCPTR *)(GLfloat))IntGetProcAddress("glLineWidth"); - if(!_ptrc_glLineWidth) numFailed++; - if(!_ptrc_glLogicOp) - _ptrc_glLogicOp = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glLogicOp"); - if(!_ptrc_glLogicOp) numFailed++; - if(!_ptrc_glPixelStoref) - _ptrc_glPixelStoref = (void (CODEGEN_FUNCPTR *)(GLenum, GLfloat))IntGetProcAddress("glPixelStoref"); - if(!_ptrc_glPixelStoref) numFailed++; - if(!_ptrc_glPixelStorei) - _ptrc_glPixelStorei = (void (CODEGEN_FUNCPTR *)(GLenum, GLint))IntGetProcAddress("glPixelStorei"); - if(!_ptrc_glPixelStorei) numFailed++; - if(!_ptrc_glPointSize) - _ptrc_glPointSize = (void (CODEGEN_FUNCPTR *)(GLfloat))IntGetProcAddress("glPointSize"); - if(!_ptrc_glPointSize) numFailed++; - if(!_ptrc_glPolygonMode) - _ptrc_glPolygonMode = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glPolygonMode"); - if(!_ptrc_glPolygonMode) numFailed++; - if(!_ptrc_glReadBuffer) - _ptrc_glReadBuffer = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glReadBuffer"); - if(!_ptrc_glReadBuffer) numFailed++; - if(!_ptrc_glReadPixels) - _ptrc_glReadPixels = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *))IntGetProcAddress("glReadPixels"); - if(!_ptrc_glReadPixels) numFailed++; - if(!_ptrc_glScissor) - _ptrc_glScissor = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glScissor"); - if(!_ptrc_glScissor) numFailed++; - if(!_ptrc_glStencilFunc) - _ptrc_glStencilFunc = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLuint))IntGetProcAddress("glStencilFunc"); - if(!_ptrc_glStencilFunc) numFailed++; - if(!_ptrc_glStencilMask) - _ptrc_glStencilMask = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glStencilMask"); - if(!_ptrc_glStencilMask) numFailed++; - if(!_ptrc_glStencilOp) - _ptrc_glStencilOp = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum))IntGetProcAddress("glStencilOp"); - if(!_ptrc_glStencilOp) numFailed++; - if(!_ptrc_glTexImage1D) - _ptrc_glTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTexImage1D"); - if(!_ptrc_glTexImage1D) numFailed++; - if(!_ptrc_glTexImage2D) - _ptrc_glTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTexImage2D"); - if(!_ptrc_glTexImage2D) numFailed++; - if(!_ptrc_glTexParameterf) - _ptrc_glTexParameterf = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLfloat))IntGetProcAddress("glTexParameterf"); - if(!_ptrc_glTexParameterf) numFailed++; - if(!_ptrc_glTexParameterfv) - _ptrc_glTexParameterfv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, const GLfloat *))IntGetProcAddress("glTexParameterfv"); - if(!_ptrc_glTexParameterfv) numFailed++; - if(!_ptrc_glTexParameteri) - _ptrc_glTexParameteri = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint))IntGetProcAddress("glTexParameteri"); - if(!_ptrc_glTexParameteri) numFailed++; - if(!_ptrc_glTexParameteriv) - _ptrc_glTexParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, const GLint *))IntGetProcAddress("glTexParameteriv"); - if(!_ptrc_glTexParameteriv) numFailed++; - if(!_ptrc_glViewport) - _ptrc_glViewport = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glViewport"); - if(!_ptrc_glViewport) numFailed++; - if(!_ptrc_glBindTexture) - _ptrc_glBindTexture = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindTexture"); - if(!_ptrc_glBindTexture) numFailed++; - if(!_ptrc_glCopyTexImage1D) - _ptrc_glCopyTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint))IntGetProcAddress("glCopyTexImage1D"); - if(!_ptrc_glCopyTexImage1D) numFailed++; - if(!_ptrc_glCopyTexImage2D) - _ptrc_glCopyTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint))IntGetProcAddress("glCopyTexImage2D"); - if(!_ptrc_glCopyTexImage2D) numFailed++; - if(!_ptrc_glCopyTexSubImage1D) - _ptrc_glCopyTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei))IntGetProcAddress("glCopyTexSubImage1D"); - if(!_ptrc_glCopyTexSubImage1D) numFailed++; - if(!_ptrc_glCopyTexSubImage2D) - _ptrc_glCopyTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glCopyTexSubImage2D"); - if(!_ptrc_glCopyTexSubImage2D) numFailed++; - if(!_ptrc_glDeleteTextures) - _ptrc_glDeleteTextures = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteTextures"); - if(!_ptrc_glDeleteTextures) numFailed++; - if(!_ptrc_glDrawArrays) - _ptrc_glDrawArrays = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLsizei))IntGetProcAddress("glDrawArrays"); - if(!_ptrc_glDrawArrays) numFailed++; - if(!_ptrc_glDrawElements) - _ptrc_glDrawElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *))IntGetProcAddress("glDrawElements"); - if(!_ptrc_glDrawElements) numFailed++; - if(!_ptrc_glGenTextures) - _ptrc_glGenTextures = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenTextures"); - if(!_ptrc_glGenTextures) numFailed++; - if(!_ptrc_glIsTexture) - _ptrc_glIsTexture = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsTexture"); - if(!_ptrc_glIsTexture) numFailed++; - if(!_ptrc_glPolygonOffset) - _ptrc_glPolygonOffset = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat))IntGetProcAddress("glPolygonOffset"); - if(!_ptrc_glPolygonOffset) numFailed++; - if(!_ptrc_glTexSubImage1D) - _ptrc_glTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTexSubImage1D"); - if(!_ptrc_glTexSubImage1D) numFailed++; - if(!_ptrc_glTexSubImage2D) - _ptrc_glTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTexSubImage2D"); - if(!_ptrc_glTexSubImage2D) numFailed++; - if(!_ptrc_glCopyTexSubImage3D) - _ptrc_glCopyTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glCopyTexSubImage3D"); - if(!_ptrc_glCopyTexSubImage3D) numFailed++; - if(!_ptrc_glDrawRangeElements) - _ptrc_glDrawRangeElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *))IntGetProcAddress("glDrawRangeElements"); - if(!_ptrc_glDrawRangeElements) numFailed++; - if(!_ptrc_glTexImage3D) - _ptrc_glTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTexImage3D"); - if(!_ptrc_glTexImage3D) numFailed++; - if(!_ptrc_glTexSubImage3D) - _ptrc_glTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTexSubImage3D"); - if(!_ptrc_glTexSubImage3D) numFailed++; - if(!_ptrc_glActiveTexture) - _ptrc_glActiveTexture = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glActiveTexture"); - if(!_ptrc_glActiveTexture) numFailed++; - if(!_ptrc_glCompressedTexImage1D) - _ptrc_glCompressedTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTexImage1D"); - if(!_ptrc_glCompressedTexImage1D) numFailed++; - if(!_ptrc_glCompressedTexImage2D) - _ptrc_glCompressedTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTexImage2D"); - if(!_ptrc_glCompressedTexImage2D) numFailed++; - if(!_ptrc_glCompressedTexImage3D) - _ptrc_glCompressedTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTexImage3D"); - if(!_ptrc_glCompressedTexImage3D) numFailed++; - if(!_ptrc_glCompressedTexSubImage1D) - _ptrc_glCompressedTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTexSubImage1D"); - if(!_ptrc_glCompressedTexSubImage1D) numFailed++; - if(!_ptrc_glCompressedTexSubImage2D) - _ptrc_glCompressedTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTexSubImage2D"); - if(!_ptrc_glCompressedTexSubImage2D) numFailed++; - if(!_ptrc_glCompressedTexSubImage3D) - _ptrc_glCompressedTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTexSubImage3D"); - if(!_ptrc_glCompressedTexSubImage3D) numFailed++; - if(!_ptrc_glGetCompressedTexImage) - _ptrc_glGetCompressedTexImage = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, void *))IntGetProcAddress("glGetCompressedTexImage"); - if(!_ptrc_glGetCompressedTexImage) numFailed++; - if(!_ptrc_glSampleCoverage) - _ptrc_glSampleCoverage = (void (CODEGEN_FUNCPTR *)(GLfloat, GLboolean))IntGetProcAddress("glSampleCoverage"); - if(!_ptrc_glSampleCoverage) numFailed++; - if(!_ptrc_glBlendColor) - _ptrc_glBlendColor = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glBlendColor"); - if(!_ptrc_glBlendColor) numFailed++; - if(!_ptrc_glBlendEquation) - _ptrc_glBlendEquation = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glBlendEquation"); - if(!_ptrc_glBlendEquation) numFailed++; - if(!_ptrc_glBlendFuncSeparate) - _ptrc_glBlendFuncSeparate = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLenum))IntGetProcAddress("glBlendFuncSeparate"); - if(!_ptrc_glBlendFuncSeparate) numFailed++; - if(!_ptrc_glMultiDrawArrays) - _ptrc_glMultiDrawArrays = (void (CODEGEN_FUNCPTR *)(GLenum, const GLint *, const GLsizei *, GLsizei))IntGetProcAddress("glMultiDrawArrays"); - if(!_ptrc_glMultiDrawArrays) numFailed++; - if(!_ptrc_glMultiDrawElements) - _ptrc_glMultiDrawElements = (void (CODEGEN_FUNCPTR *)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei))IntGetProcAddress("glMultiDrawElements"); - if(!_ptrc_glMultiDrawElements) numFailed++; - if(!_ptrc_glPointParameterf) - _ptrc_glPointParameterf = (void (CODEGEN_FUNCPTR *)(GLenum, GLfloat))IntGetProcAddress("glPointParameterf"); - if(!_ptrc_glPointParameterf) numFailed++; - if(!_ptrc_glPointParameterfv) - _ptrc_glPointParameterfv = (void (CODEGEN_FUNCPTR *)(GLenum, const GLfloat *))IntGetProcAddress("glPointParameterfv"); - if(!_ptrc_glPointParameterfv) numFailed++; - if(!_ptrc_glPointParameteri) - _ptrc_glPointParameteri = (void (CODEGEN_FUNCPTR *)(GLenum, GLint))IntGetProcAddress("glPointParameteri"); - if(!_ptrc_glPointParameteri) numFailed++; - if(!_ptrc_glPointParameteriv) - _ptrc_glPointParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, const GLint *))IntGetProcAddress("glPointParameteriv"); - if(!_ptrc_glPointParameteriv) numFailed++; - if(!_ptrc_glBeginQuery) - _ptrc_glBeginQuery = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBeginQuery"); - if(!_ptrc_glBeginQuery) numFailed++; - if(!_ptrc_glBindBuffer) - _ptrc_glBindBuffer = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindBuffer"); - if(!_ptrc_glBindBuffer) numFailed++; - if(!_ptrc_glBufferData) - _ptrc_glBufferData = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizeiptr, const void *, GLenum))IntGetProcAddress("glBufferData"); - if(!_ptrc_glBufferData) numFailed++; - if(!_ptrc_glBufferSubData) - _ptrc_glBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, const void *))IntGetProcAddress("glBufferSubData"); - if(!_ptrc_glBufferSubData) numFailed++; - if(!_ptrc_glDeleteBuffers) - _ptrc_glDeleteBuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteBuffers"); - if(!_ptrc_glDeleteBuffers) numFailed++; - if(!_ptrc_glDeleteQueries) - _ptrc_glDeleteQueries = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteQueries"); - if(!_ptrc_glDeleteQueries) numFailed++; - if(!_ptrc_glEndQuery) - _ptrc_glEndQuery = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glEndQuery"); - if(!_ptrc_glEndQuery) numFailed++; - if(!_ptrc_glGenBuffers) - _ptrc_glGenBuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenBuffers"); - if(!_ptrc_glGenBuffers) numFailed++; - if(!_ptrc_glGenQueries) - _ptrc_glGenQueries = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenQueries"); - if(!_ptrc_glGenQueries) numFailed++; - if(!_ptrc_glGetBufferParameteriv) - _ptrc_glGetBufferParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetBufferParameteriv"); - if(!_ptrc_glGetBufferParameteriv) numFailed++; - if(!_ptrc_glGetBufferPointerv) - _ptrc_glGetBufferPointerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, void **))IntGetProcAddress("glGetBufferPointerv"); - if(!_ptrc_glGetBufferPointerv) numFailed++; - if(!_ptrc_glGetBufferSubData) - _ptrc_glGetBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, void *))IntGetProcAddress("glGetBufferSubData"); - if(!_ptrc_glGetBufferSubData) numFailed++; - if(!_ptrc_glGetQueryObjectiv) - _ptrc_glGetQueryObjectiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetQueryObjectiv"); - if(!_ptrc_glGetQueryObjectiv) numFailed++; - if(!_ptrc_glGetQueryObjectuiv) - _ptrc_glGetQueryObjectuiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLuint *))IntGetProcAddress("glGetQueryObjectuiv"); - if(!_ptrc_glGetQueryObjectuiv) numFailed++; - if(!_ptrc_glGetQueryiv) - _ptrc_glGetQueryiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetQueryiv"); - if(!_ptrc_glGetQueryiv) numFailed++; - if(!_ptrc_glIsBuffer) - _ptrc_glIsBuffer = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsBuffer"); - if(!_ptrc_glIsBuffer) numFailed++; - if(!_ptrc_glIsQuery) - _ptrc_glIsQuery = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsQuery"); - if(!_ptrc_glIsQuery) numFailed++; - if(!_ptrc_glMapBuffer) - _ptrc_glMapBuffer = (void * (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glMapBuffer"); - if(!_ptrc_glMapBuffer) numFailed++; - if(!_ptrc_glUnmapBuffer) - _ptrc_glUnmapBuffer = (GLboolean (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glUnmapBuffer"); - if(!_ptrc_glUnmapBuffer) numFailed++; - if(!_ptrc_glAttachShader) - _ptrc_glAttachShader = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint))IntGetProcAddress("glAttachShader"); - if(!_ptrc_glAttachShader) numFailed++; - if(!_ptrc_glBindAttribLocation) - _ptrc_glBindAttribLocation = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, const GLchar *))IntGetProcAddress("glBindAttribLocation"); - if(!_ptrc_glBindAttribLocation) numFailed++; - if(!_ptrc_glBlendEquationSeparate) - _ptrc_glBlendEquationSeparate = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glBlendEquationSeparate"); - if(!_ptrc_glBlendEquationSeparate) numFailed++; - if(!_ptrc_glCompileShader) - _ptrc_glCompileShader = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glCompileShader"); - if(!_ptrc_glCompileShader) numFailed++; - if(!_ptrc_glCreateProgram) - _ptrc_glCreateProgram = (GLuint (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glCreateProgram"); - if(!_ptrc_glCreateProgram) numFailed++; - if(!_ptrc_glCreateShader) - _ptrc_glCreateShader = (GLuint (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glCreateShader"); - if(!_ptrc_glCreateShader) numFailed++; - if(!_ptrc_glDeleteProgram) - _ptrc_glDeleteProgram = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glDeleteProgram"); - if(!_ptrc_glDeleteProgram) numFailed++; - if(!_ptrc_glDeleteShader) - _ptrc_glDeleteShader = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glDeleteShader"); - if(!_ptrc_glDeleteShader) numFailed++; - if(!_ptrc_glDetachShader) - _ptrc_glDetachShader = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint))IntGetProcAddress("glDetachShader"); - if(!_ptrc_glDetachShader) numFailed++; - if(!_ptrc_glDisableVertexAttribArray) - _ptrc_glDisableVertexAttribArray = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glDisableVertexAttribArray"); - if(!_ptrc_glDisableVertexAttribArray) numFailed++; - if(!_ptrc_glDrawBuffers) - _ptrc_glDrawBuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLenum *))IntGetProcAddress("glDrawBuffers"); - if(!_ptrc_glDrawBuffers) numFailed++; - if(!_ptrc_glEnableVertexAttribArray) - _ptrc_glEnableVertexAttribArray = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glEnableVertexAttribArray"); - if(!_ptrc_glEnableVertexAttribArray) numFailed++; - if(!_ptrc_glGetActiveAttrib) - _ptrc_glGetActiveAttrib = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *))IntGetProcAddress("glGetActiveAttrib"); - if(!_ptrc_glGetActiveAttrib) numFailed++; - if(!_ptrc_glGetActiveUniform) - _ptrc_glGetActiveUniform = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *))IntGetProcAddress("glGetActiveUniform"); - if(!_ptrc_glGetActiveUniform) numFailed++; - if(!_ptrc_glGetAttachedShaders) - _ptrc_glGetAttachedShaders = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLuint *))IntGetProcAddress("glGetAttachedShaders"); - if(!_ptrc_glGetAttachedShaders) numFailed++; - if(!_ptrc_glGetAttribLocation) - _ptrc_glGetAttribLocation = (GLint (CODEGEN_FUNCPTR *)(GLuint, const GLchar *))IntGetProcAddress("glGetAttribLocation"); - if(!_ptrc_glGetAttribLocation) numFailed++; - if(!_ptrc_glGetProgramInfoLog) - _ptrc_glGetProgramInfoLog = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetProgramInfoLog"); - if(!_ptrc_glGetProgramInfoLog) numFailed++; - if(!_ptrc_glGetProgramiv) - _ptrc_glGetProgramiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetProgramiv"); - if(!_ptrc_glGetProgramiv) numFailed++; - if(!_ptrc_glGetShaderInfoLog) - _ptrc_glGetShaderInfoLog = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetShaderInfoLog"); - if(!_ptrc_glGetShaderInfoLog) numFailed++; - if(!_ptrc_glGetShaderSource) - _ptrc_glGetShaderSource = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetShaderSource"); - if(!_ptrc_glGetShaderSource) numFailed++; - if(!_ptrc_glGetShaderiv) - _ptrc_glGetShaderiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetShaderiv"); - if(!_ptrc_glGetShaderiv) numFailed++; - if(!_ptrc_glGetUniformLocation) - _ptrc_glGetUniformLocation = (GLint (CODEGEN_FUNCPTR *)(GLuint, const GLchar *))IntGetProcAddress("glGetUniformLocation"); - if(!_ptrc_glGetUniformLocation) numFailed++; - if(!_ptrc_glGetUniformfv) - _ptrc_glGetUniformfv = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLfloat *))IntGetProcAddress("glGetUniformfv"); - if(!_ptrc_glGetUniformfv) numFailed++; - if(!_ptrc_glGetUniformiv) - _ptrc_glGetUniformiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLint *))IntGetProcAddress("glGetUniformiv"); - if(!_ptrc_glGetUniformiv) numFailed++; - if(!_ptrc_glGetVertexAttribPointerv) - _ptrc_glGetVertexAttribPointerv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, void **))IntGetProcAddress("glGetVertexAttribPointerv"); - if(!_ptrc_glGetVertexAttribPointerv) numFailed++; - if(!_ptrc_glGetVertexAttribdv) - _ptrc_glGetVertexAttribdv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLdouble *))IntGetProcAddress("glGetVertexAttribdv"); - if(!_ptrc_glGetVertexAttribdv) numFailed++; - if(!_ptrc_glGetVertexAttribfv) - _ptrc_glGetVertexAttribfv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLfloat *))IntGetProcAddress("glGetVertexAttribfv"); - if(!_ptrc_glGetVertexAttribfv) numFailed++; - if(!_ptrc_glGetVertexAttribiv) - _ptrc_glGetVertexAttribiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetVertexAttribiv"); - if(!_ptrc_glGetVertexAttribiv) numFailed++; - if(!_ptrc_glIsProgram) - _ptrc_glIsProgram = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsProgram"); - if(!_ptrc_glIsProgram) numFailed++; - if(!_ptrc_glIsShader) - _ptrc_glIsShader = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsShader"); - if(!_ptrc_glIsShader) numFailed++; - if(!_ptrc_glLinkProgram) - _ptrc_glLinkProgram = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glLinkProgram"); - if(!_ptrc_glLinkProgram) numFailed++; - if(!_ptrc_glShaderSource) - _ptrc_glShaderSource = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, const GLchar *const*, const GLint *))IntGetProcAddress("glShaderSource"); - if(!_ptrc_glShaderSource) numFailed++; - if(!_ptrc_glStencilFuncSeparate) - _ptrc_glStencilFuncSeparate = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLuint))IntGetProcAddress("glStencilFuncSeparate"); - if(!_ptrc_glStencilFuncSeparate) numFailed++; - if(!_ptrc_glStencilMaskSeparate) - _ptrc_glStencilMaskSeparate = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glStencilMaskSeparate"); - if(!_ptrc_glStencilMaskSeparate) numFailed++; - if(!_ptrc_glStencilOpSeparate) - _ptrc_glStencilOpSeparate = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLenum))IntGetProcAddress("glStencilOpSeparate"); - if(!_ptrc_glStencilOpSeparate) numFailed++; - if(!_ptrc_glUniform1f) - _ptrc_glUniform1f = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat))IntGetProcAddress("glUniform1f"); - if(!_ptrc_glUniform1f) numFailed++; - if(!_ptrc_glUniform1fv) - _ptrc_glUniform1fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform1fv"); - if(!_ptrc_glUniform1fv) numFailed++; - if(!_ptrc_glUniform1i) - _ptrc_glUniform1i = (void (CODEGEN_FUNCPTR *)(GLint, GLint))IntGetProcAddress("glUniform1i"); - if(!_ptrc_glUniform1i) numFailed++; - if(!_ptrc_glUniform1iv) - _ptrc_glUniform1iv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform1iv"); - if(!_ptrc_glUniform1iv) numFailed++; - if(!_ptrc_glUniform2f) - _ptrc_glUniform2f = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat, GLfloat))IntGetProcAddress("glUniform2f"); - if(!_ptrc_glUniform2f) numFailed++; - if(!_ptrc_glUniform2fv) - _ptrc_glUniform2fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform2fv"); - if(!_ptrc_glUniform2fv) numFailed++; - if(!_ptrc_glUniform2i) - _ptrc_glUniform2i = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint))IntGetProcAddress("glUniform2i"); - if(!_ptrc_glUniform2i) numFailed++; - if(!_ptrc_glUniform2iv) - _ptrc_glUniform2iv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform2iv"); - if(!_ptrc_glUniform2iv) numFailed++; - if(!_ptrc_glUniform3f) - _ptrc_glUniform3f = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glUniform3f"); - if(!_ptrc_glUniform3f) numFailed++; - if(!_ptrc_glUniform3fv) - _ptrc_glUniform3fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform3fv"); - if(!_ptrc_glUniform3fv) numFailed++; - if(!_ptrc_glUniform3i) - _ptrc_glUniform3i = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint, GLint))IntGetProcAddress("glUniform3i"); - if(!_ptrc_glUniform3i) numFailed++; - if(!_ptrc_glUniform3iv) - _ptrc_glUniform3iv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform3iv"); - if(!_ptrc_glUniform3iv) numFailed++; - if(!_ptrc_glUniform4f) - _ptrc_glUniform4f = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glUniform4f"); - if(!_ptrc_glUniform4f) numFailed++; - if(!_ptrc_glUniform4fv) - _ptrc_glUniform4fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform4fv"); - if(!_ptrc_glUniform4fv) numFailed++; - if(!_ptrc_glUniform4i) - _ptrc_glUniform4i = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint, GLint, GLint))IntGetProcAddress("glUniform4i"); - if(!_ptrc_glUniform4i) numFailed++; - if(!_ptrc_glUniform4iv) - _ptrc_glUniform4iv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform4iv"); - if(!_ptrc_glUniform4iv) numFailed++; - if(!_ptrc_glUniformMatrix2fv) - _ptrc_glUniformMatrix2fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix2fv"); - if(!_ptrc_glUniformMatrix2fv) numFailed++; - if(!_ptrc_glUniformMatrix3fv) - _ptrc_glUniformMatrix3fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix3fv"); - if(!_ptrc_glUniformMatrix3fv) numFailed++; - if(!_ptrc_glUniformMatrix4fv) - _ptrc_glUniformMatrix4fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix4fv"); - if(!_ptrc_glUniformMatrix4fv) numFailed++; - if(!_ptrc_glUseProgram) - _ptrc_glUseProgram = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glUseProgram"); - if(!_ptrc_glUseProgram) numFailed++; - if(!_ptrc_glValidateProgram) - _ptrc_glValidateProgram = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glValidateProgram"); - if(!_ptrc_glValidateProgram) numFailed++; - if(!_ptrc_glVertexAttrib1d) - _ptrc_glVertexAttrib1d = (void (CODEGEN_FUNCPTR *)(GLuint, GLdouble))IntGetProcAddress("glVertexAttrib1d"); - if(!_ptrc_glVertexAttrib1d) numFailed++; - if(!_ptrc_glVertexAttrib1dv) - _ptrc_glVertexAttrib1dv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLdouble *))IntGetProcAddress("glVertexAttrib1dv"); - if(!_ptrc_glVertexAttrib1dv) numFailed++; - if(!_ptrc_glVertexAttrib1f) - _ptrc_glVertexAttrib1f = (void (CODEGEN_FUNCPTR *)(GLuint, GLfloat))IntGetProcAddress("glVertexAttrib1f"); - if(!_ptrc_glVertexAttrib1f) numFailed++; - if(!_ptrc_glVertexAttrib1fv) - _ptrc_glVertexAttrib1fv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLfloat *))IntGetProcAddress("glVertexAttrib1fv"); - if(!_ptrc_glVertexAttrib1fv) numFailed++; - if(!_ptrc_glVertexAttrib1s) - _ptrc_glVertexAttrib1s = (void (CODEGEN_FUNCPTR *)(GLuint, GLshort))IntGetProcAddress("glVertexAttrib1s"); - if(!_ptrc_glVertexAttrib1s) numFailed++; - if(!_ptrc_glVertexAttrib1sv) - _ptrc_glVertexAttrib1sv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLshort *))IntGetProcAddress("glVertexAttrib1sv"); - if(!_ptrc_glVertexAttrib1sv) numFailed++; - if(!_ptrc_glVertexAttrib2d) - _ptrc_glVertexAttrib2d = (void (CODEGEN_FUNCPTR *)(GLuint, GLdouble, GLdouble))IntGetProcAddress("glVertexAttrib2d"); - if(!_ptrc_glVertexAttrib2d) numFailed++; - if(!_ptrc_glVertexAttrib2dv) - _ptrc_glVertexAttrib2dv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLdouble *))IntGetProcAddress("glVertexAttrib2dv"); - if(!_ptrc_glVertexAttrib2dv) numFailed++; - if(!_ptrc_glVertexAttrib2f) - _ptrc_glVertexAttrib2f = (void (CODEGEN_FUNCPTR *)(GLuint, GLfloat, GLfloat))IntGetProcAddress("glVertexAttrib2f"); - if(!_ptrc_glVertexAttrib2f) numFailed++; - if(!_ptrc_glVertexAttrib2fv) - _ptrc_glVertexAttrib2fv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLfloat *))IntGetProcAddress("glVertexAttrib2fv"); - if(!_ptrc_glVertexAttrib2fv) numFailed++; - if(!_ptrc_glVertexAttrib2s) - _ptrc_glVertexAttrib2s = (void (CODEGEN_FUNCPTR *)(GLuint, GLshort, GLshort))IntGetProcAddress("glVertexAttrib2s"); - if(!_ptrc_glVertexAttrib2s) numFailed++; - if(!_ptrc_glVertexAttrib2sv) - _ptrc_glVertexAttrib2sv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLshort *))IntGetProcAddress("glVertexAttrib2sv"); - if(!_ptrc_glVertexAttrib2sv) numFailed++; - if(!_ptrc_glVertexAttrib3d) - _ptrc_glVertexAttrib3d = (void (CODEGEN_FUNCPTR *)(GLuint, GLdouble, GLdouble, GLdouble))IntGetProcAddress("glVertexAttrib3d"); - if(!_ptrc_glVertexAttrib3d) numFailed++; - if(!_ptrc_glVertexAttrib3dv) - _ptrc_glVertexAttrib3dv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLdouble *))IntGetProcAddress("glVertexAttrib3dv"); - if(!_ptrc_glVertexAttrib3dv) numFailed++; - if(!_ptrc_glVertexAttrib3f) - _ptrc_glVertexAttrib3f = (void (CODEGEN_FUNCPTR *)(GLuint, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glVertexAttrib3f"); - if(!_ptrc_glVertexAttrib3f) numFailed++; - if(!_ptrc_glVertexAttrib3fv) - _ptrc_glVertexAttrib3fv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLfloat *))IntGetProcAddress("glVertexAttrib3fv"); - if(!_ptrc_glVertexAttrib3fv) numFailed++; - if(!_ptrc_glVertexAttrib3s) - _ptrc_glVertexAttrib3s = (void (CODEGEN_FUNCPTR *)(GLuint, GLshort, GLshort, GLshort))IntGetProcAddress("glVertexAttrib3s"); - if(!_ptrc_glVertexAttrib3s) numFailed++; - if(!_ptrc_glVertexAttrib3sv) - _ptrc_glVertexAttrib3sv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLshort *))IntGetProcAddress("glVertexAttrib3sv"); - if(!_ptrc_glVertexAttrib3sv) numFailed++; - if(!_ptrc_glVertexAttrib4Nbv) - _ptrc_glVertexAttrib4Nbv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLbyte *))IntGetProcAddress("glVertexAttrib4Nbv"); - if(!_ptrc_glVertexAttrib4Nbv) numFailed++; - if(!_ptrc_glVertexAttrib4Niv) - _ptrc_glVertexAttrib4Niv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glVertexAttrib4Niv"); - if(!_ptrc_glVertexAttrib4Niv) numFailed++; - if(!_ptrc_glVertexAttrib4Nsv) - _ptrc_glVertexAttrib4Nsv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLshort *))IntGetProcAddress("glVertexAttrib4Nsv"); - if(!_ptrc_glVertexAttrib4Nsv) numFailed++; - if(!_ptrc_glVertexAttrib4Nub) - _ptrc_glVertexAttrib4Nub = (void (CODEGEN_FUNCPTR *)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte))IntGetProcAddress("glVertexAttrib4Nub"); - if(!_ptrc_glVertexAttrib4Nub) numFailed++; - if(!_ptrc_glVertexAttrib4Nubv) - _ptrc_glVertexAttrib4Nubv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLubyte *))IntGetProcAddress("glVertexAttrib4Nubv"); - if(!_ptrc_glVertexAttrib4Nubv) numFailed++; - if(!_ptrc_glVertexAttrib4Nuiv) - _ptrc_glVertexAttrib4Nuiv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLuint *))IntGetProcAddress("glVertexAttrib4Nuiv"); - if(!_ptrc_glVertexAttrib4Nuiv) numFailed++; - if(!_ptrc_glVertexAttrib4Nusv) - _ptrc_glVertexAttrib4Nusv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLushort *))IntGetProcAddress("glVertexAttrib4Nusv"); - if(!_ptrc_glVertexAttrib4Nusv) numFailed++; - if(!_ptrc_glVertexAttrib4bv) - _ptrc_glVertexAttrib4bv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLbyte *))IntGetProcAddress("glVertexAttrib4bv"); - if(!_ptrc_glVertexAttrib4bv) numFailed++; - if(!_ptrc_glVertexAttrib4d) - _ptrc_glVertexAttrib4d = (void (CODEGEN_FUNCPTR *)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble))IntGetProcAddress("glVertexAttrib4d"); - if(!_ptrc_glVertexAttrib4d) numFailed++; - if(!_ptrc_glVertexAttrib4dv) - _ptrc_glVertexAttrib4dv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLdouble *))IntGetProcAddress("glVertexAttrib4dv"); - if(!_ptrc_glVertexAttrib4dv) numFailed++; - if(!_ptrc_glVertexAttrib4f) - _ptrc_glVertexAttrib4f = (void (CODEGEN_FUNCPTR *)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glVertexAttrib4f"); - if(!_ptrc_glVertexAttrib4f) numFailed++; - if(!_ptrc_glVertexAttrib4fv) - _ptrc_glVertexAttrib4fv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLfloat *))IntGetProcAddress("glVertexAttrib4fv"); - if(!_ptrc_glVertexAttrib4fv) numFailed++; - if(!_ptrc_glVertexAttrib4iv) - _ptrc_glVertexAttrib4iv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glVertexAttrib4iv"); - if(!_ptrc_glVertexAttrib4iv) numFailed++; - if(!_ptrc_glVertexAttrib4s) - _ptrc_glVertexAttrib4s = (void (CODEGEN_FUNCPTR *)(GLuint, GLshort, GLshort, GLshort, GLshort))IntGetProcAddress("glVertexAttrib4s"); - if(!_ptrc_glVertexAttrib4s) numFailed++; - if(!_ptrc_glVertexAttrib4sv) - _ptrc_glVertexAttrib4sv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLshort *))IntGetProcAddress("glVertexAttrib4sv"); - if(!_ptrc_glVertexAttrib4sv) numFailed++; - if(!_ptrc_glVertexAttrib4ubv) - _ptrc_glVertexAttrib4ubv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLubyte *))IntGetProcAddress("glVertexAttrib4ubv"); - if(!_ptrc_glVertexAttrib4ubv) numFailed++; - if(!_ptrc_glVertexAttrib4uiv) - _ptrc_glVertexAttrib4uiv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLuint *))IntGetProcAddress("glVertexAttrib4uiv"); - if(!_ptrc_glVertexAttrib4uiv) numFailed++; - if(!_ptrc_glVertexAttrib4usv) - _ptrc_glVertexAttrib4usv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLushort *))IntGetProcAddress("glVertexAttrib4usv"); - if(!_ptrc_glVertexAttrib4usv) numFailed++; - if(!_ptrc_glVertexAttribPointer) - _ptrc_glVertexAttribPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *))IntGetProcAddress("glVertexAttribPointer"); - if(!_ptrc_glVertexAttribPointer) numFailed++; - if(!_ptrc_glUniformMatrix2x3fv) - _ptrc_glUniformMatrix2x3fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix2x3fv"); - if(!_ptrc_glUniformMatrix2x3fv) numFailed++; - if(!_ptrc_glUniformMatrix2x4fv) - _ptrc_glUniformMatrix2x4fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix2x4fv"); - if(!_ptrc_glUniformMatrix2x4fv) numFailed++; - if(!_ptrc_glUniformMatrix3x2fv) - _ptrc_glUniformMatrix3x2fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix3x2fv"); - if(!_ptrc_glUniformMatrix3x2fv) numFailed++; - if(!_ptrc_glUniformMatrix3x4fv) - _ptrc_glUniformMatrix3x4fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix3x4fv"); - if(!_ptrc_glUniformMatrix3x4fv) numFailed++; - if(!_ptrc_glUniformMatrix4x2fv) - _ptrc_glUniformMatrix4x2fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix4x2fv"); - if(!_ptrc_glUniformMatrix4x2fv) numFailed++; - if(!_ptrc_glUniformMatrix4x3fv) - _ptrc_glUniformMatrix4x3fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix4x3fv"); - if(!_ptrc_glUniformMatrix4x3fv) numFailed++; - if(!_ptrc_glBeginConditionalRender) - _ptrc_glBeginConditionalRender = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum))IntGetProcAddress("glBeginConditionalRender"); - if(!_ptrc_glBeginConditionalRender) numFailed++; - if(!_ptrc_glBeginTransformFeedback) - _ptrc_glBeginTransformFeedback = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glBeginTransformFeedback"); - if(!_ptrc_glBeginTransformFeedback) numFailed++; - if(!_ptrc_glBindBufferBase) - _ptrc_glBindBufferBase = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint))IntGetProcAddress("glBindBufferBase"); - if(!_ptrc_glBindBufferBase) numFailed++; - if(!_ptrc_glBindBufferRange) - _ptrc_glBindBufferRange = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr))IntGetProcAddress("glBindBufferRange"); - if(!_ptrc_glBindBufferRange) numFailed++; - if(!_ptrc_glBindFragDataLocation) - _ptrc_glBindFragDataLocation = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, const GLchar *))IntGetProcAddress("glBindFragDataLocation"); - if(!_ptrc_glBindFragDataLocation) numFailed++; - if(!_ptrc_glBindFramebuffer) - _ptrc_glBindFramebuffer = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindFramebuffer"); - if(!_ptrc_glBindFramebuffer) numFailed++; - if(!_ptrc_glBindRenderbuffer) - _ptrc_glBindRenderbuffer = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindRenderbuffer"); - if(!_ptrc_glBindRenderbuffer) numFailed++; - if(!_ptrc_glBindVertexArray) - _ptrc_glBindVertexArray = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glBindVertexArray"); - if(!_ptrc_glBindVertexArray) numFailed++; - if(!_ptrc_glBlitFramebuffer) - _ptrc_glBlitFramebuffer = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum))IntGetProcAddress("glBlitFramebuffer"); - if(!_ptrc_glBlitFramebuffer) numFailed++; - if(!_ptrc_glCheckFramebufferStatus) - _ptrc_glCheckFramebufferStatus = (GLenum (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glCheckFramebufferStatus"); - if(!_ptrc_glCheckFramebufferStatus) numFailed++; - if(!_ptrc_glClampColor) - _ptrc_glClampColor = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glClampColor"); - if(!_ptrc_glClampColor) numFailed++; - if(!_ptrc_glClearBufferfi) - _ptrc_glClearBufferfi = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLfloat, GLint))IntGetProcAddress("glClearBufferfi"); - if(!_ptrc_glClearBufferfi) numFailed++; - if(!_ptrc_glClearBufferfv) - _ptrc_glClearBufferfv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, const GLfloat *))IntGetProcAddress("glClearBufferfv"); - if(!_ptrc_glClearBufferfv) numFailed++; - if(!_ptrc_glClearBufferiv) - _ptrc_glClearBufferiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, const GLint *))IntGetProcAddress("glClearBufferiv"); - if(!_ptrc_glClearBufferiv) numFailed++; - if(!_ptrc_glClearBufferuiv) - _ptrc_glClearBufferuiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, const GLuint *))IntGetProcAddress("glClearBufferuiv"); - if(!_ptrc_glClearBufferuiv) numFailed++; - if(!_ptrc_glColorMaski) - _ptrc_glColorMaski = (void (CODEGEN_FUNCPTR *)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean))IntGetProcAddress("glColorMaski"); - if(!_ptrc_glColorMaski) numFailed++; - if(!_ptrc_glDeleteFramebuffers) - _ptrc_glDeleteFramebuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteFramebuffers"); - if(!_ptrc_glDeleteFramebuffers) numFailed++; - if(!_ptrc_glDeleteRenderbuffers) - _ptrc_glDeleteRenderbuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteRenderbuffers"); - if(!_ptrc_glDeleteRenderbuffers) numFailed++; - if(!_ptrc_glDeleteVertexArrays) - _ptrc_glDeleteVertexArrays = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteVertexArrays"); - if(!_ptrc_glDeleteVertexArrays) numFailed++; - if(!_ptrc_glDisablei) - _ptrc_glDisablei = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glDisablei"); - if(!_ptrc_glDisablei) numFailed++; - if(!_ptrc_glEnablei) - _ptrc_glEnablei = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glEnablei"); - if(!_ptrc_glEnablei) numFailed++; - if(!_ptrc_glEndConditionalRender) - _ptrc_glEndConditionalRender = (void (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glEndConditionalRender"); - if(!_ptrc_glEndConditionalRender) numFailed++; - if(!_ptrc_glEndTransformFeedback) - _ptrc_glEndTransformFeedback = (void (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glEndTransformFeedback"); - if(!_ptrc_glEndTransformFeedback) numFailed++; - if(!_ptrc_glFlushMappedBufferRange) - _ptrc_glFlushMappedBufferRange = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr))IntGetProcAddress("glFlushMappedBufferRange"); - if(!_ptrc_glFlushMappedBufferRange) numFailed++; - if(!_ptrc_glFramebufferRenderbuffer) - _ptrc_glFramebufferRenderbuffer = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint))IntGetProcAddress("glFramebufferRenderbuffer"); - if(!_ptrc_glFramebufferRenderbuffer) numFailed++; - if(!_ptrc_glFramebufferTexture1D) - _ptrc_glFramebufferTexture1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint, GLint))IntGetProcAddress("glFramebufferTexture1D"); - if(!_ptrc_glFramebufferTexture1D) numFailed++; - if(!_ptrc_glFramebufferTexture2D) - _ptrc_glFramebufferTexture2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint, GLint))IntGetProcAddress("glFramebufferTexture2D"); - if(!_ptrc_glFramebufferTexture2D) numFailed++; - if(!_ptrc_glFramebufferTexture3D) - _ptrc_glFramebufferTexture3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint, GLint, GLint))IntGetProcAddress("glFramebufferTexture3D"); - if(!_ptrc_glFramebufferTexture3D) numFailed++; - if(!_ptrc_glFramebufferTextureLayer) - _ptrc_glFramebufferTextureLayer = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLuint, GLint, GLint))IntGetProcAddress("glFramebufferTextureLayer"); - if(!_ptrc_glFramebufferTextureLayer) numFailed++; - if(!_ptrc_glGenFramebuffers) - _ptrc_glGenFramebuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenFramebuffers"); - if(!_ptrc_glGenFramebuffers) numFailed++; - if(!_ptrc_glGenRenderbuffers) - _ptrc_glGenRenderbuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenRenderbuffers"); - if(!_ptrc_glGenRenderbuffers) numFailed++; - if(!_ptrc_glGenVertexArrays) - _ptrc_glGenVertexArrays = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenVertexArrays"); - if(!_ptrc_glGenVertexArrays) numFailed++; - if(!_ptrc_glGenerateMipmap) - _ptrc_glGenerateMipmap = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGenerateMipmap"); - if(!_ptrc_glGenerateMipmap) numFailed++; - if(!_ptrc_glGetBooleani_v) - _ptrc_glGetBooleani_v = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLboolean *))IntGetProcAddress("glGetBooleani_v"); - if(!_ptrc_glGetBooleani_v) numFailed++; - if(!_ptrc_glGetFragDataLocation) - _ptrc_glGetFragDataLocation = (GLint (CODEGEN_FUNCPTR *)(GLuint, const GLchar *))IntGetProcAddress("glGetFragDataLocation"); - if(!_ptrc_glGetFragDataLocation) numFailed++; - if(!_ptrc_glGetFramebufferAttachmentParameteriv) - _ptrc_glGetFramebufferAttachmentParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLint *))IntGetProcAddress("glGetFramebufferAttachmentParameteriv"); - if(!_ptrc_glGetFramebufferAttachmentParameteriv) numFailed++; - if(!_ptrc_glGetIntegeri_v) - _ptrc_glGetIntegeri_v = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLint *))IntGetProcAddress("glGetIntegeri_v"); - if(!_ptrc_glGetIntegeri_v) numFailed++; - if(!_ptrc_glGetRenderbufferParameteriv) - _ptrc_glGetRenderbufferParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetRenderbufferParameteriv"); - if(!_ptrc_glGetRenderbufferParameteriv) numFailed++; - if(!_ptrc_glGetStringi) - _ptrc_glGetStringi = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glGetStringi"); - if(!_ptrc_glGetStringi) numFailed++; - if(!_ptrc_glGetTexParameterIiv) - _ptrc_glGetTexParameterIiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetTexParameterIiv"); - if(!_ptrc_glGetTexParameterIiv) numFailed++; - if(!_ptrc_glGetTexParameterIuiv) - _ptrc_glGetTexParameterIuiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLuint *))IntGetProcAddress("glGetTexParameterIuiv"); - if(!_ptrc_glGetTexParameterIuiv) numFailed++; - if(!_ptrc_glGetTransformFeedbackVarying) - _ptrc_glGetTransformFeedbackVarying = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *))IntGetProcAddress("glGetTransformFeedbackVarying"); - if(!_ptrc_glGetTransformFeedbackVarying) numFailed++; - if(!_ptrc_glGetUniformuiv) - _ptrc_glGetUniformuiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLuint *))IntGetProcAddress("glGetUniformuiv"); - if(!_ptrc_glGetUniformuiv) numFailed++; - if(!_ptrc_glGetVertexAttribIiv) - _ptrc_glGetVertexAttribIiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetVertexAttribIiv"); - if(!_ptrc_glGetVertexAttribIiv) numFailed++; - if(!_ptrc_glGetVertexAttribIuiv) - _ptrc_glGetVertexAttribIuiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLuint *))IntGetProcAddress("glGetVertexAttribIuiv"); - if(!_ptrc_glGetVertexAttribIuiv) numFailed++; - if(!_ptrc_glIsEnabledi) - _ptrc_glIsEnabledi = (GLboolean (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glIsEnabledi"); - if(!_ptrc_glIsEnabledi) numFailed++; - if(!_ptrc_glIsFramebuffer) - _ptrc_glIsFramebuffer = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsFramebuffer"); - if(!_ptrc_glIsFramebuffer) numFailed++; - if(!_ptrc_glIsRenderbuffer) - _ptrc_glIsRenderbuffer = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsRenderbuffer"); - if(!_ptrc_glIsRenderbuffer) numFailed++; - if(!_ptrc_glIsVertexArray) - _ptrc_glIsVertexArray = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsVertexArray"); - if(!_ptrc_glIsVertexArray) numFailed++; - if(!_ptrc_glMapBufferRange) - _ptrc_glMapBufferRange = (void * (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, GLbitfield))IntGetProcAddress("glMapBufferRange"); - if(!_ptrc_glMapBufferRange) numFailed++; - if(!_ptrc_glRenderbufferStorage) - _ptrc_glRenderbufferStorage = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLsizei, GLsizei))IntGetProcAddress("glRenderbufferStorage"); - if(!_ptrc_glRenderbufferStorage) numFailed++; - if(!_ptrc_glRenderbufferStorageMultisample) - _ptrc_glRenderbufferStorageMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, GLsizei, GLsizei))IntGetProcAddress("glRenderbufferStorageMultisample"); - if(!_ptrc_glRenderbufferStorageMultisample) numFailed++; - if(!_ptrc_glTexParameterIiv) - _ptrc_glTexParameterIiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, const GLint *))IntGetProcAddress("glTexParameterIiv"); - if(!_ptrc_glTexParameterIiv) numFailed++; - if(!_ptrc_glTexParameterIuiv) - _ptrc_glTexParameterIuiv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, const GLuint *))IntGetProcAddress("glTexParameterIuiv"); - if(!_ptrc_glTexParameterIuiv) numFailed++; - if(!_ptrc_glTransformFeedbackVaryings) - _ptrc_glTransformFeedbackVaryings = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, const GLchar *const*, GLenum))IntGetProcAddress("glTransformFeedbackVaryings"); - if(!_ptrc_glTransformFeedbackVaryings) numFailed++; - if(!_ptrc_glUniform1ui) - _ptrc_glUniform1ui = (void (CODEGEN_FUNCPTR *)(GLint, GLuint))IntGetProcAddress("glUniform1ui"); - if(!_ptrc_glUniform1ui) numFailed++; - if(!_ptrc_glUniform1uiv) - _ptrc_glUniform1uiv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLuint *))IntGetProcAddress("glUniform1uiv"); - if(!_ptrc_glUniform1uiv) numFailed++; - if(!_ptrc_glUniform2ui) - _ptrc_glUniform2ui = (void (CODEGEN_FUNCPTR *)(GLint, GLuint, GLuint))IntGetProcAddress("glUniform2ui"); - if(!_ptrc_glUniform2ui) numFailed++; - if(!_ptrc_glUniform2uiv) - _ptrc_glUniform2uiv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLuint *))IntGetProcAddress("glUniform2uiv"); - if(!_ptrc_glUniform2uiv) numFailed++; - if(!_ptrc_glUniform3ui) - _ptrc_glUniform3ui = (void (CODEGEN_FUNCPTR *)(GLint, GLuint, GLuint, GLuint))IntGetProcAddress("glUniform3ui"); - if(!_ptrc_glUniform3ui) numFailed++; - if(!_ptrc_glUniform3uiv) - _ptrc_glUniform3uiv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLuint *))IntGetProcAddress("glUniform3uiv"); - if(!_ptrc_glUniform3uiv) numFailed++; - if(!_ptrc_glUniform4ui) - _ptrc_glUniform4ui = (void (CODEGEN_FUNCPTR *)(GLint, GLuint, GLuint, GLuint, GLuint))IntGetProcAddress("glUniform4ui"); - if(!_ptrc_glUniform4ui) numFailed++; - if(!_ptrc_glUniform4uiv) - _ptrc_glUniform4uiv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLuint *))IntGetProcAddress("glUniform4uiv"); - if(!_ptrc_glUniform4uiv) numFailed++; - if(!_ptrc_glVertexAttribI1i) - _ptrc_glVertexAttribI1i = (void (CODEGEN_FUNCPTR *)(GLuint, GLint))IntGetProcAddress("glVertexAttribI1i"); - if(!_ptrc_glVertexAttribI1i) numFailed++; - if(!_ptrc_glVertexAttribI1iv) - _ptrc_glVertexAttribI1iv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glVertexAttribI1iv"); - if(!_ptrc_glVertexAttribI1iv) numFailed++; - if(!_ptrc_glVertexAttribI1ui) - _ptrc_glVertexAttribI1ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint))IntGetProcAddress("glVertexAttribI1ui"); - if(!_ptrc_glVertexAttribI1ui) numFailed++; - if(!_ptrc_glVertexAttribI1uiv) - _ptrc_glVertexAttribI1uiv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLuint *))IntGetProcAddress("glVertexAttribI1uiv"); - if(!_ptrc_glVertexAttribI1uiv) numFailed++; - if(!_ptrc_glVertexAttribI2i) - _ptrc_glVertexAttribI2i = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLint))IntGetProcAddress("glVertexAttribI2i"); - if(!_ptrc_glVertexAttribI2i) numFailed++; - if(!_ptrc_glVertexAttribI2iv) - _ptrc_glVertexAttribI2iv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glVertexAttribI2iv"); - if(!_ptrc_glVertexAttribI2iv) numFailed++; - if(!_ptrc_glVertexAttribI2ui) - _ptrc_glVertexAttribI2ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint))IntGetProcAddress("glVertexAttribI2ui"); - if(!_ptrc_glVertexAttribI2ui) numFailed++; - if(!_ptrc_glVertexAttribI2uiv) - _ptrc_glVertexAttribI2uiv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLuint *))IntGetProcAddress("glVertexAttribI2uiv"); - if(!_ptrc_glVertexAttribI2uiv) numFailed++; - if(!_ptrc_glVertexAttribI3i) - _ptrc_glVertexAttribI3i = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLint, GLint))IntGetProcAddress("glVertexAttribI3i"); - if(!_ptrc_glVertexAttribI3i) numFailed++; - if(!_ptrc_glVertexAttribI3iv) - _ptrc_glVertexAttribI3iv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glVertexAttribI3iv"); - if(!_ptrc_glVertexAttribI3iv) numFailed++; - if(!_ptrc_glVertexAttribI3ui) - _ptrc_glVertexAttribI3ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint, GLuint))IntGetProcAddress("glVertexAttribI3ui"); - if(!_ptrc_glVertexAttribI3ui) numFailed++; - if(!_ptrc_glVertexAttribI3uiv) - _ptrc_glVertexAttribI3uiv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLuint *))IntGetProcAddress("glVertexAttribI3uiv"); - if(!_ptrc_glVertexAttribI3uiv) numFailed++; - if(!_ptrc_glVertexAttribI4bv) - _ptrc_glVertexAttribI4bv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLbyte *))IntGetProcAddress("glVertexAttribI4bv"); - if(!_ptrc_glVertexAttribI4bv) numFailed++; - if(!_ptrc_glVertexAttribI4i) - _ptrc_glVertexAttribI4i = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLint, GLint, GLint))IntGetProcAddress("glVertexAttribI4i"); - if(!_ptrc_glVertexAttribI4i) numFailed++; - if(!_ptrc_glVertexAttribI4iv) - _ptrc_glVertexAttribI4iv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glVertexAttribI4iv"); - if(!_ptrc_glVertexAttribI4iv) numFailed++; - if(!_ptrc_glVertexAttribI4sv) - _ptrc_glVertexAttribI4sv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLshort *))IntGetProcAddress("glVertexAttribI4sv"); - if(!_ptrc_glVertexAttribI4sv) numFailed++; - if(!_ptrc_glVertexAttribI4ubv) - _ptrc_glVertexAttribI4ubv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLubyte *))IntGetProcAddress("glVertexAttribI4ubv"); - if(!_ptrc_glVertexAttribI4ubv) numFailed++; - if(!_ptrc_glVertexAttribI4ui) - _ptrc_glVertexAttribI4ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint, GLuint, GLuint))IntGetProcAddress("glVertexAttribI4ui"); - if(!_ptrc_glVertexAttribI4ui) numFailed++; - if(!_ptrc_glVertexAttribI4uiv) - _ptrc_glVertexAttribI4uiv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLuint *))IntGetProcAddress("glVertexAttribI4uiv"); - if(!_ptrc_glVertexAttribI4uiv) numFailed++; - if(!_ptrc_glVertexAttribI4usv) - _ptrc_glVertexAttribI4usv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLushort *))IntGetProcAddress("glVertexAttribI4usv"); - if(!_ptrc_glVertexAttribI4usv) numFailed++; - if(!_ptrc_glVertexAttribIPointer) - _ptrc_glVertexAttribIPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLsizei, const void *))IntGetProcAddress("glVertexAttribIPointer"); - if(!_ptrc_glVertexAttribIPointer) numFailed++; - if(!_ptrc_glCopyBufferSubData) - _ptrc_glCopyBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr))IntGetProcAddress("glCopyBufferSubData"); - if(!_ptrc_glCopyBufferSubData) numFailed++; - if(!_ptrc_glDrawArraysInstanced) - _ptrc_glDrawArraysInstanced = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLsizei, GLsizei))IntGetProcAddress("glDrawArraysInstanced"); - if(!_ptrc_glDrawArraysInstanced) numFailed++; - if(!_ptrc_glDrawElementsInstanced) - _ptrc_glDrawElementsInstanced = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *, GLsizei))IntGetProcAddress("glDrawElementsInstanced"); - if(!_ptrc_glDrawElementsInstanced) numFailed++; - if(!_ptrc_glGetActiveUniformBlockName) - _ptrc_glGetActiveUniformBlockName = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetActiveUniformBlockName"); - if(!_ptrc_glGetActiveUniformBlockName) numFailed++; - if(!_ptrc_glGetActiveUniformBlockiv) - _ptrc_glGetActiveUniformBlockiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLenum, GLint *))IntGetProcAddress("glGetActiveUniformBlockiv"); - if(!_ptrc_glGetActiveUniformBlockiv) numFailed++; - if(!_ptrc_glGetActiveUniformName) - _ptrc_glGetActiveUniformName = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetActiveUniformName"); - if(!_ptrc_glGetActiveUniformName) numFailed++; - if(!_ptrc_glGetActiveUniformsiv) - _ptrc_glGetActiveUniformsiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, const GLuint *, GLenum, GLint *))IntGetProcAddress("glGetActiveUniformsiv"); - if(!_ptrc_glGetActiveUniformsiv) numFailed++; - if(!_ptrc_glGetUniformBlockIndex) - _ptrc_glGetUniformBlockIndex = (GLuint (CODEGEN_FUNCPTR *)(GLuint, const GLchar *))IntGetProcAddress("glGetUniformBlockIndex"); - if(!_ptrc_glGetUniformBlockIndex) numFailed++; - if(!_ptrc_glGetUniformIndices) - _ptrc_glGetUniformIndices = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, const GLchar *const*, GLuint *))IntGetProcAddress("glGetUniformIndices"); - if(!_ptrc_glGetUniformIndices) numFailed++; - if(!_ptrc_glPrimitiveRestartIndex) - _ptrc_glPrimitiveRestartIndex = (void (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glPrimitiveRestartIndex"); - if(!_ptrc_glPrimitiveRestartIndex) numFailed++; - if(!_ptrc_glTexBuffer) - _ptrc_glTexBuffer = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLuint))IntGetProcAddress("glTexBuffer"); - if(!_ptrc_glTexBuffer) numFailed++; - if(!_ptrc_glUniformBlockBinding) - _ptrc_glUniformBlockBinding = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint))IntGetProcAddress("glUniformBlockBinding"); - if(!_ptrc_glUniformBlockBinding) numFailed++; - if(!_ptrc_glClientWaitSync) - _ptrc_glClientWaitSync = (GLenum (CODEGEN_FUNCPTR *)(GLsync, GLbitfield, GLuint64))IntGetProcAddress("glClientWaitSync"); - if(!_ptrc_glClientWaitSync) numFailed++; - if(!_ptrc_glDeleteSync) - _ptrc_glDeleteSync = (void (CODEGEN_FUNCPTR *)(GLsync))IntGetProcAddress("glDeleteSync"); - if(!_ptrc_glDeleteSync) numFailed++; - if(!_ptrc_glDrawElementsBaseVertex) - _ptrc_glDrawElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *, GLint))IntGetProcAddress("glDrawElementsBaseVertex"); - if(!_ptrc_glDrawElementsBaseVertex) numFailed++; - if(!_ptrc_glDrawElementsInstancedBaseVertex) - _ptrc_glDrawElementsInstancedBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *, GLsizei, GLint))IntGetProcAddress("glDrawElementsInstancedBaseVertex"); - if(!_ptrc_glDrawElementsInstancedBaseVertex) numFailed++; - if(!_ptrc_glDrawRangeElementsBaseVertex) - _ptrc_glDrawRangeElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *, GLint))IntGetProcAddress("glDrawRangeElementsBaseVertex"); - if(!_ptrc_glDrawRangeElementsBaseVertex) numFailed++; - if(!_ptrc_glFenceSync) - _ptrc_glFenceSync = (GLsync (CODEGEN_FUNCPTR *)(GLenum, GLbitfield))IntGetProcAddress("glFenceSync"); - if(!_ptrc_glFenceSync) numFailed++; - if(!_ptrc_glFramebufferTexture) - _ptrc_glFramebufferTexture = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLuint, GLint))IntGetProcAddress("glFramebufferTexture"); - if(!_ptrc_glFramebufferTexture) numFailed++; - if(!_ptrc_glGetBufferParameteri64v) - _ptrc_glGetBufferParameteri64v = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint64 *))IntGetProcAddress("glGetBufferParameteri64v"); - if(!_ptrc_glGetBufferParameteri64v) numFailed++; - if(!_ptrc_glGetInteger64i_v) - _ptrc_glGetInteger64i_v = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLint64 *))IntGetProcAddress("glGetInteger64i_v"); - if(!_ptrc_glGetInteger64i_v) numFailed++; - if(!_ptrc_glGetInteger64v) - _ptrc_glGetInteger64v = (void (CODEGEN_FUNCPTR *)(GLenum, GLint64 *))IntGetProcAddress("glGetInteger64v"); - if(!_ptrc_glGetInteger64v) numFailed++; - if(!_ptrc_glGetMultisamplefv) - _ptrc_glGetMultisamplefv = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLfloat *))IntGetProcAddress("glGetMultisamplefv"); - if(!_ptrc_glGetMultisamplefv) numFailed++; - if(!_ptrc_glGetSynciv) - _ptrc_glGetSynciv = (void (CODEGEN_FUNCPTR *)(GLsync, GLenum, GLsizei, GLsizei *, GLint *))IntGetProcAddress("glGetSynciv"); - if(!_ptrc_glGetSynciv) numFailed++; - if(!_ptrc_glIsSync) - _ptrc_glIsSync = (GLboolean (CODEGEN_FUNCPTR *)(GLsync))IntGetProcAddress("glIsSync"); - if(!_ptrc_glIsSync) numFailed++; - if(!_ptrc_glMultiDrawElementsBaseVertex) - _ptrc_glMultiDrawElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei, const GLint *))IntGetProcAddress("glMultiDrawElementsBaseVertex"); - if(!_ptrc_glMultiDrawElementsBaseVertex) numFailed++; - if(!_ptrc_glProvokingVertex) - _ptrc_glProvokingVertex = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glProvokingVertex"); - if(!_ptrc_glProvokingVertex) numFailed++; - if(!_ptrc_glSampleMaski) - _ptrc_glSampleMaski = (void (CODEGEN_FUNCPTR *)(GLuint, GLbitfield))IntGetProcAddress("glSampleMaski"); - if(!_ptrc_glSampleMaski) numFailed++; - if(!_ptrc_glTexImage2DMultisample) - _ptrc_glTexImage2DMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexImage2DMultisample"); - if(!_ptrc_glTexImage2DMultisample) numFailed++; - if(!_ptrc_glTexImage3DMultisample) - _ptrc_glTexImage3DMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexImage3DMultisample"); - if(!_ptrc_glTexImage3DMultisample) numFailed++; - if(!_ptrc_glWaitSync) - _ptrc_glWaitSync = (void (CODEGEN_FUNCPTR *)(GLsync, GLbitfield, GLuint64))IntGetProcAddress("glWaitSync"); - if(!_ptrc_glWaitSync) numFailed++; - if(!_ptrc_glBindFragDataLocationIndexed) - _ptrc_glBindFragDataLocationIndexed = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint, const GLchar *))IntGetProcAddress("glBindFragDataLocationIndexed"); - if(!_ptrc_glBindFragDataLocationIndexed) numFailed++; - if(!_ptrc_glBindSampler) - _ptrc_glBindSampler = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint))IntGetProcAddress("glBindSampler"); - if(!_ptrc_glBindSampler) numFailed++; - if(!_ptrc_glDeleteSamplers) - _ptrc_glDeleteSamplers = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteSamplers"); - if(!_ptrc_glDeleteSamplers) numFailed++; - if(!_ptrc_glGenSamplers) - _ptrc_glGenSamplers = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenSamplers"); - if(!_ptrc_glGenSamplers) numFailed++; - if(!_ptrc_glGetFragDataIndex) - _ptrc_glGetFragDataIndex = (GLint (CODEGEN_FUNCPTR *)(GLuint, const GLchar *))IntGetProcAddress("glGetFragDataIndex"); - if(!_ptrc_glGetFragDataIndex) numFailed++; - if(!_ptrc_glGetQueryObjecti64v) - _ptrc_glGetQueryObjecti64v = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint64 *))IntGetProcAddress("glGetQueryObjecti64v"); - if(!_ptrc_glGetQueryObjecti64v) numFailed++; - if(!_ptrc_glGetQueryObjectui64v) - _ptrc_glGetQueryObjectui64v = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLuint64 *))IntGetProcAddress("glGetQueryObjectui64v"); - if(!_ptrc_glGetQueryObjectui64v) numFailed++; - if(!_ptrc_glGetSamplerParameterIiv) - _ptrc_glGetSamplerParameterIiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetSamplerParameterIiv"); - if(!_ptrc_glGetSamplerParameterIiv) numFailed++; - if(!_ptrc_glGetSamplerParameterIuiv) - _ptrc_glGetSamplerParameterIuiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLuint *))IntGetProcAddress("glGetSamplerParameterIuiv"); - if(!_ptrc_glGetSamplerParameterIuiv) numFailed++; - if(!_ptrc_glGetSamplerParameterfv) - _ptrc_glGetSamplerParameterfv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLfloat *))IntGetProcAddress("glGetSamplerParameterfv"); - if(!_ptrc_glGetSamplerParameterfv) numFailed++; - if(!_ptrc_glGetSamplerParameteriv) - _ptrc_glGetSamplerParameteriv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetSamplerParameteriv"); - if(!_ptrc_glGetSamplerParameteriv) numFailed++; - if(!_ptrc_glIsSampler) - _ptrc_glIsSampler = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsSampler"); - if(!_ptrc_glIsSampler) numFailed++; - if(!_ptrc_glQueryCounter) - _ptrc_glQueryCounter = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum))IntGetProcAddress("glQueryCounter"); - if(!_ptrc_glQueryCounter) numFailed++; - if(!_ptrc_glSamplerParameterIiv) - _ptrc_glSamplerParameterIiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, const GLint *))IntGetProcAddress("glSamplerParameterIiv"); - if(!_ptrc_glSamplerParameterIiv) numFailed++; - if(!_ptrc_glSamplerParameterIuiv) - _ptrc_glSamplerParameterIuiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, const GLuint *))IntGetProcAddress("glSamplerParameterIuiv"); - if(!_ptrc_glSamplerParameterIuiv) numFailed++; - if(!_ptrc_glSamplerParameterf) - _ptrc_glSamplerParameterf = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLfloat))IntGetProcAddress("glSamplerParameterf"); - if(!_ptrc_glSamplerParameterf) numFailed++; - if(!_ptrc_glSamplerParameterfv) - _ptrc_glSamplerParameterfv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, const GLfloat *))IntGetProcAddress("glSamplerParameterfv"); - if(!_ptrc_glSamplerParameterfv) numFailed++; - if(!_ptrc_glSamplerParameteri) - _ptrc_glSamplerParameteri = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint))IntGetProcAddress("glSamplerParameteri"); - if(!_ptrc_glSamplerParameteri) numFailed++; - if(!_ptrc_glSamplerParameteriv) - _ptrc_glSamplerParameteriv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, const GLint *))IntGetProcAddress("glSamplerParameteriv"); - if(!_ptrc_glSamplerParameteriv) numFailed++; - if(!_ptrc_glVertexAttribDivisor) - _ptrc_glVertexAttribDivisor = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint))IntGetProcAddress("glVertexAttribDivisor"); - if(!_ptrc_glVertexAttribDivisor) numFailed++; - if(!_ptrc_glVertexAttribP1ui) - _ptrc_glVertexAttribP1ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, GLuint))IntGetProcAddress("glVertexAttribP1ui"); - if(!_ptrc_glVertexAttribP1ui) numFailed++; - if(!_ptrc_glVertexAttribP1uiv) - _ptrc_glVertexAttribP1uiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, const GLuint *))IntGetProcAddress("glVertexAttribP1uiv"); - if(!_ptrc_glVertexAttribP1uiv) numFailed++; - if(!_ptrc_glVertexAttribP2ui) - _ptrc_glVertexAttribP2ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, GLuint))IntGetProcAddress("glVertexAttribP2ui"); - if(!_ptrc_glVertexAttribP2ui) numFailed++; - if(!_ptrc_glVertexAttribP2uiv) - _ptrc_glVertexAttribP2uiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, const GLuint *))IntGetProcAddress("glVertexAttribP2uiv"); - if(!_ptrc_glVertexAttribP2uiv) numFailed++; - if(!_ptrc_glVertexAttribP3ui) - _ptrc_glVertexAttribP3ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, GLuint))IntGetProcAddress("glVertexAttribP3ui"); - if(!_ptrc_glVertexAttribP3ui) numFailed++; - if(!_ptrc_glVertexAttribP3uiv) - _ptrc_glVertexAttribP3uiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, const GLuint *))IntGetProcAddress("glVertexAttribP3uiv"); - if(!_ptrc_glVertexAttribP3uiv) numFailed++; - if(!_ptrc_glVertexAttribP4ui) - _ptrc_glVertexAttribP4ui = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, GLuint))IntGetProcAddress("glVertexAttribP4ui"); - if(!_ptrc_glVertexAttribP4ui) numFailed++; - if(!_ptrc_glVertexAttribP4uiv) - _ptrc_glVertexAttribP4uiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLboolean, const GLuint *))IntGetProcAddress("glVertexAttribP4uiv"); - if(!_ptrc_glVertexAttribP4uiv) numFailed++; - return numFailed; -} - -typedef int (*PFN_LOADFUNCPOINTERS)(void); -typedef struct ogl_StrToExtMap_s -{ - char *extensionName; - int *extensionVariable; - PFN_LOADFUNCPOINTERS LoadExtension; -} ogl_StrToExtMap; - -static ogl_StrToExtMap ExtensionMap[1] = { - {"", NULL, NULL}, -}; - -static int g_extensionMapSize = 0; - -static ogl_StrToExtMap *FindExtEntry(const char *extensionName) -{ - int loop; - ogl_StrToExtMap *currLoc = ExtensionMap; - for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc) - { - if(strcmp(extensionName, currLoc->extensionName) == 0) - return currLoc; - } - - return NULL; -} - -static void ClearExtensionVars(void) -{ -} - - -static void LoadExtByName(const char *extensionName) -{ - ogl_StrToExtMap *entry = NULL; - entry = FindExtEntry(extensionName); - if(entry) - { - if(entry->LoadExtension) - { - int numFailed = entry->LoadExtension(); - if(numFailed == 0) - { - *(entry->extensionVariable) = ogl_LOAD_SUCCEEDED; - } - else - { - *(entry->extensionVariable) = ogl_LOAD_SUCCEEDED + numFailed; - } - } - else - { - *(entry->extensionVariable) = ogl_LOAD_SUCCEEDED; - } - } -} - - -static void ProcExtsFromExtList(void) -{ - GLint iLoop; - GLint iNumExtensions = 0; - _ptrc_glGetIntegerv(GL_NUM_EXTENSIONS, &iNumExtensions); - - for(iLoop = 0; iLoop < iNumExtensions; iLoop++) - { - const char *strExtensionName = (const char *)_ptrc_glGetStringi(GL_EXTENSIONS, iLoop); - LoadExtByName(strExtensionName); - } -} - -int ogl_LoadFunctions() -{ - int numFailed = 0; - ClearExtensionVars(); - - _ptrc_glGetIntegerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint *))IntGetProcAddress("glGetIntegerv"); - if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED; - _ptrc_glGetStringi = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glGetStringi"); - if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED; - - ProcExtsFromExtList(); - numFailed = Load_Version_3_3(); - - if(numFailed == 0) - return ogl_LOAD_SUCCEEDED; - else - return ogl_LOAD_SUCCEEDED + numFailed; -} - -static int g_major_version = 0; -static int g_minor_version = 0; - -static void GetGLVersion(void) -{ - glGetIntegerv(GL_MAJOR_VERSION, &g_major_version); - glGetIntegerv(GL_MINOR_VERSION, &g_minor_version); -} - -int ogl_GetMajorVersion(void) -{ - if(g_major_version == 0) - GetGLVersion(); - return g_major_version; -} - -int ogl_GetMinorVersion(void) -{ - if(g_major_version == 0) /*Yes, check the major version to get the minor one.*/ - GetGLVersion(); - return g_minor_version; -} - -int ogl_IsVersionGEQ(int majorVersion, int minorVersion) -{ - if(g_major_version == 0) - GetGLVersion(); - - if(majorVersion < g_major_version) return 1; - if(majorVersion > g_major_version) return 0; - if(minorVersion <= g_minor_version) return 1; - return 0; -} - -#endif // GLES diff --git a/angrylion-rdp-plus/src/output/gl_core_3_3.h b/angrylion-rdp-plus/src/output/gl_core_3_3.h deleted file mode 100644 index 92d63aa..0000000 --- a/angrylion-rdp-plus/src/output/gl_core_3_3.h +++ /dev/null @@ -1,1704 +0,0 @@ -#ifndef GLES - -#ifndef POINTER_C_GENERATED_HEADER_OPENGL_H -#define POINTER_C_GENERATED_HEADER_OPENGL_H - -#if defined(__glew_h__) || defined(__GLEW_H__) -#error Attempt to include auto-generated header after including glew.h -#endif -#if defined(__gl_h_) || defined(__GL_H__) -#error Attempt to include auto-generated header after including gl.h -#endif -#if defined(__glext_h_) || defined(__GLEXT_H_) -#error Attempt to include auto-generated header after including glext.h -#endif -#if defined(__gltypes_h_) -#error Attempt to include auto-generated header after gltypes.h -#endif -#if defined(__gl_ATI_h_) -#error Attempt to include auto-generated header after including glATI.h -#endif - -#define __glew_h__ -#define __GLEW_H__ -#define __gl_h_ -#define __GL_H__ -#define __glext_h_ -#define __GLEXT_H_ -#define __gltypes_h_ -#define __gl_ATI_h_ - -#ifndef APIENTRY - #if defined(__MINGW32__) - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN 1 - #endif - #ifndef NOMINMAX - #define NOMINMAX - #endif - #include <windows.h> - #elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN 1 - #endif - #ifndef NOMINMAX - #define NOMINMAX - #endif - #include <windows.h> - #else - #define APIENTRY - #endif -#endif /*APIENTRY*/ - -#ifndef CODEGEN_FUNCPTR - #define CODEGEN_REMOVE_FUNCPTR - #if defined(_WIN32) - #define CODEGEN_FUNCPTR APIENTRY - #else - #define CODEGEN_FUNCPTR - #endif -#endif /*CODEGEN_FUNCPTR*/ - -#ifndef GLAPI - #define GLAPI extern -#endif - - -#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS -#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS - - -#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/ - - -#include <stddef.h> -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include <inttypes.h> -#elif defined(__sun__) || defined(__digital__) -#include <inttypes.h> -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include <inttypes.h> -#elif defined(__SCO__) || defined(__USLC__) -#include <stdint.h> -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include <stdint.h> -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include <inttypes.h> -#endif -#endif - typedef unsigned int GLenum; - typedef unsigned char GLboolean; - typedef unsigned int GLbitfield; - typedef void GLvoid; - typedef signed char GLbyte; - typedef short GLshort; - typedef int GLint; - typedef unsigned char GLubyte; - typedef unsigned short GLushort; - typedef unsigned int GLuint; - typedef int GLsizei; - typedef float GLfloat; - typedef float GLclampf; - typedef double GLdouble; - typedef double GLclampd; - typedef char GLchar; - typedef char GLcharARB; - #ifdef __APPLE__ -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif - typedef unsigned short GLhalfARB; - typedef unsigned short GLhalf; - typedef GLint GLfixed; - typedef ptrdiff_t GLintptr; - typedef ptrdiff_t GLsizeiptr; - typedef int64_t GLint64; - typedef uint64_t GLuint64; - typedef ptrdiff_t GLintptrARB; - typedef ptrdiff_t GLsizeiptrARB; - typedef int64_t GLint64EXT; - typedef uint64_t GLuint64EXT; - typedef struct __GLsync *GLsync; - struct _cl_context; - struct _cl_event; - typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); - typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); - typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); - typedef unsigned short GLhalfNV; - typedef GLintptr GLvdpauSurfaceNV; - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - -#define GL_ALPHA 0x1906 -#define GL_ALWAYS 0x0207 -#define GL_AND 0x1501 -#define GL_AND_INVERTED 0x1504 -#define GL_AND_REVERSE 0x1502 -#define GL_BACK 0x0405 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_BLEND 0x0BE2 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLUE 0x1905 -#define GL_BYTE 0x1400 -#define GL_CCW 0x0901 -#define GL_CLEAR 0x1500 -#define GL_COLOR 0x1800 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_COPY 0x1503 -#define GL_COPY_INVERTED 0x150C -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_CW 0x0900 -#define GL_DECR 0x1E03 -#define GL_DEPTH 0x1801 -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DITHER 0x0BD0 -#define GL_DONT_CARE 0x1100 -#define GL_DOUBLE 0x140A -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_DST_ALPHA 0x0304 -#define GL_DST_COLOR 0x0306 -#define GL_EQUAL 0x0202 -#define GL_EQUIV 0x1509 -#define GL_EXTENSIONS 0x1F03 -#define GL_FALSE 0 -#define GL_FASTEST 0x1101 -#define GL_FILL 0x1B02 -#define GL_FLOAT 0x1406 -#define GL_FRONT 0x0404 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_FRONT_FACE 0x0B46 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_GEQUAL 0x0206 -#define GL_GREATER 0x0204 -#define GL_GREEN 0x1904 -#define GL_INCR 0x1E02 -#define GL_INT 0x1404 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_OPERATION 0x0502 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVERT 0x150A -#define GL_KEEP 0x1E00 -#define GL_LEFT 0x0406 -#define GL_LEQUAL 0x0203 -#define GL_LESS 0x0201 -#define GL_LINE 0x1B01 -#define GL_LINEAR 0x2601 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_LINE_STRIP 0x0003 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_NAND 0x150E -#define GL_NEAREST 0x2600 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_NEVER 0x0200 -#define GL_NICEST 0x1102 -#define GL_NONE 0 -#define GL_NOOP 0x1505 -#define GL_NOR 0x1508 -#define GL_NOTEQUAL 0x0205 -#define GL_NO_ERROR 0 -#define GL_ONE 1 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_OR 0x1507 -#define GL_OR_INVERTED 0x150D -#define GL_OR_REVERSE 0x150B -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_POINT 0x1B00 -#define GL_POINTS 0x0000 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 -#define GL_R3_G3_B2 0x2A10 -#define GL_READ_BUFFER 0x0C02 -#define GL_RED 0x1903 -#define GL_RENDERER 0x1F01 -#define GL_REPEAT 0x2901 -#define GL_REPLACE 0x1E01 -#define GL_RGB 0x1907 -#define GL_RGB10 0x8052 -#define GL_RGB10_A2 0x8059 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB5_A1 0x8057 -#define GL_RGB8 0x8051 -#define GL_RGBA 0x1908 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGBA8 0x8058 -#define GL_RIGHT 0x0407 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_SET 0x150F -#define GL_SHORT 0x1402 -#define GL_SRC_ALPHA 0x0302 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_SRC_COLOR 0x0300 -#define GL_STENCIL 0x1802 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_INDEX 0x1901 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STEREO 0x0C33 -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_TEXTURE 0x1702 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRUE 1 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_UNSIGNED_INT 0x1405 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_VENDOR 0x1F00 -#define GL_VERSION 0x1F02 -#define GL_VIEWPORT 0x0BA2 -#define GL_XOR 0x1506 -#define GL_ZERO 0 - -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_TEXTURE_3D 0x806F -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 - -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_MULTISAMPLE 0x809D -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 - -#define GL_BLEND_COLOR 0x8005 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_DECR_WRAP 0x8508 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_FUNC_SUBTRACT 0x800A -#define GL_INCR_WRAP 0x8507 -#define GL_MAX 0x8008 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_MIN 0x8007 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_LOD_BIAS 0x8501 - -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_CURRENT_QUERY 0x8865 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_READ_ONLY 0x88B8 -#define GL_READ_WRITE 0x88BA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_SRC1_ALPHA 0x8589 -#define GL_STATIC_COPY 0x88E6 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STREAM_COPY 0x88E2 -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_WRITE_ONLY 0x88B9 - -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_DELETE_STATUS 0x8B80 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_LINK_STATUS 0x8B82 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_TYPE 0x8B4F -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_SHADER 0x8B31 - -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_SRGB_ALPHA 0x8C42 - -#define GL_BGRA_INTEGER 0x8D9B -#define GL_BGR_INTEGER 0x8D9A -#define GL_BLUE_INTEGER 0x8D96 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_COLOR_ATTACHMENT16 0x8CF0 -#define GL_COLOR_ATTACHMENT17 0x8CF1 -#define GL_COLOR_ATTACHMENT18 0x8CF2 -#define GL_COLOR_ATTACHMENT19 0x8CF3 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT20 0x8CF4 -#define GL_COLOR_ATTACHMENT21 0x8CF5 -#define GL_COLOR_ATTACHMENT22 0x8CF6 -#define GL_COLOR_ATTACHMENT23 0x8CF7 -#define GL_COLOR_ATTACHMENT24 0x8CF8 -#define GL_COLOR_ATTACHMENT25 0x8CF9 -#define GL_COLOR_ATTACHMENT26 0x8CFA -#define GL_COLOR_ATTACHMENT27 0x8CFB -#define GL_COLOR_ATTACHMENT28 0x8CFC -#define GL_COLOR_ATTACHMENT29 0x8CFD -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT30 0x8CFE -#define GL_COLOR_ATTACHMENT31 0x8CFF -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_RG 0x8226 -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#define GL_CONTEXT_FLAGS 0x821E -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_FIXED_ONLY 0x891D -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_FRAMEBUFFER 0x8D40 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_GREEN_INTEGER 0x8D95 -#define GL_HALF_FLOAT 0x140B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_MAJOR_VERSION 0x821B -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_MINOR_VERSION 0x821C -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_NUM_EXTENSIONS 0x821D -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_WAIT 0x8E13 -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_R16 0x822A -#define GL_R16F 0x822D -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32F 0x822E -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_R8 0x8229 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RED_INTEGER 0x8D94 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RG 0x8227 -#define GL_RG16 0x822C -#define GL_RG16F 0x822F -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32F 0x8230 -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_RG8 0x822B -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RGB16F 0x881B -#define GL_RGB16I 0x8D89 -#define GL_RGB16UI 0x8D77 -#define GL_RGB32F 0x8815 -#define GL_RGB32I 0x8D83 -#define GL_RGB32UI 0x8D71 -#define GL_RGB8I 0x8D8F -#define GL_RGB8UI 0x8D7D -#define GL_RGB9_E5 0x8C3D -#define GL_RGBA16F 0x881A -#define GL_RGBA16I 0x8D88 -#define GL_RGBA16UI 0x8D76 -#define GL_RGBA32F 0x8814 -#define GL_RGBA32I 0x8D82 -#define GL_RGBA32UI 0x8D70 -#define GL_RGBA8I 0x8D8E -#define GL_RGBA8UI 0x8D7C -#define GL_RGBA_INTEGER 0x8D99 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RG_INTEGER 0x8228 -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD - -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_INVALID_INDEX 0xFFFFFFFF -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_R16_SNORM 0x8F98 -#define GL_R8_SNORM 0x8F94 -#define GL_RG16_SNORM 0x8F99 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA16_SNORM 0x8F9B -#define GL_RGBA8_SNORM 0x8F97 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 - -#define GL_ALREADY_SIGNALED 0x911A -#define GL_CONDITION_SATISFIED 0x911C -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -#define GL_DEPTH_CLAMP 0x864F -#define GL_FIRST_VERTEX_CONVENTION 0x8E4D -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_LAST_VERTEX_CONVENTION 0x8E4E -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_INTEGER_SAMPLES 0x9110 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_OBJECT_TYPE 0x9112 -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_PROVOKING_VERTEX 0x8E4F -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SIGNALED 0x9119 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_SYNC_STATUS 0x9114 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 -#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_UNSIGNALED 0x9118 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_WAIT_FAILED 0x911D - -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_INT_2_10_10_10_REV 0x8D9F -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB -#define GL_ONE_MINUS_SRC1_COLOR 0x88FA -#define GL_RGB10_A2UI 0x906F -#define GL_SAMPLER_BINDING 0x8919 -#define GL_SRC1_COLOR 0x88F9 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#define GL_TIMESTAMP 0x8E28 -#define GL_TIME_ELAPSED 0x88BF -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE - -extern void (CODEGEN_FUNCPTR *_ptrc_glBlendFunc)(GLenum sfactor, GLenum dfactor); -#define glBlendFunc _ptrc_glBlendFunc -extern void (CODEGEN_FUNCPTR *_ptrc_glClear)(GLbitfield mask); -#define glClear _ptrc_glClear -extern void (CODEGEN_FUNCPTR *_ptrc_glClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#define glClearColor _ptrc_glClearColor -extern void (CODEGEN_FUNCPTR *_ptrc_glClearDepth)(GLdouble depth); -#define glClearDepth _ptrc_glClearDepth -extern void (CODEGEN_FUNCPTR *_ptrc_glClearStencil)(GLint s); -#define glClearStencil _ptrc_glClearStencil -extern void (CODEGEN_FUNCPTR *_ptrc_glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#define glColorMask _ptrc_glColorMask -extern void (CODEGEN_FUNCPTR *_ptrc_glCullFace)(GLenum mode); -#define glCullFace _ptrc_glCullFace -extern void (CODEGEN_FUNCPTR *_ptrc_glDepthFunc)(GLenum func); -#define glDepthFunc _ptrc_glDepthFunc -extern void (CODEGEN_FUNCPTR *_ptrc_glDepthMask)(GLboolean flag); -#define glDepthMask _ptrc_glDepthMask -extern void (CODEGEN_FUNCPTR *_ptrc_glDepthRange)(GLdouble ren_near, GLdouble ren_far); -#define glDepthRange _ptrc_glDepthRange -extern void (CODEGEN_FUNCPTR *_ptrc_glDisable)(GLenum cap); -#define glDisable _ptrc_glDisable -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawBuffer)(GLenum buf); -#define glDrawBuffer _ptrc_glDrawBuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glEnable)(GLenum cap); -#define glEnable _ptrc_glEnable -extern void (CODEGEN_FUNCPTR *_ptrc_glFinish)(void); -#define glFinish _ptrc_glFinish -extern void (CODEGEN_FUNCPTR *_ptrc_glFlush)(void); -#define glFlush _ptrc_glFlush -extern void (CODEGEN_FUNCPTR *_ptrc_glFrontFace)(GLenum mode); -#define glFrontFace _ptrc_glFrontFace -extern void (CODEGEN_FUNCPTR *_ptrc_glGetBooleanv)(GLenum pname, GLboolean * data); -#define glGetBooleanv _ptrc_glGetBooleanv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetDoublev)(GLenum pname, GLdouble * data); -#define glGetDoublev _ptrc_glGetDoublev -extern GLenum (CODEGEN_FUNCPTR *_ptrc_glGetError)(void); -#define glGetError _ptrc_glGetError -extern void (CODEGEN_FUNCPTR *_ptrc_glGetFloatv)(GLenum pname, GLfloat * data); -#define glGetFloatv _ptrc_glGetFloatv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetIntegerv)(GLenum pname, GLint * data); -#define glGetIntegerv _ptrc_glGetIntegerv -extern const GLubyte * (CODEGEN_FUNCPTR *_ptrc_glGetString)(GLenum name); -#define glGetString _ptrc_glGetString -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, void * pixels); -#define glGetTexImage _ptrc_glGetTexImage -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); -#define glGetTexLevelParameterfv _ptrc_glGetTexLevelParameterfv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); -#define glGetTexLevelParameteriv _ptrc_glGetTexLevelParameteriv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); -#define glGetTexParameterfv _ptrc_glGetTexParameterfv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameteriv)(GLenum target, GLenum pname, GLint * params); -#define glGetTexParameteriv _ptrc_glGetTexParameteriv -extern void (CODEGEN_FUNCPTR *_ptrc_glHint)(GLenum target, GLenum mode); -#define glHint _ptrc_glHint -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsEnabled)(GLenum cap); -#define glIsEnabled _ptrc_glIsEnabled -extern void (CODEGEN_FUNCPTR *_ptrc_glLineWidth)(GLfloat width); -#define glLineWidth _ptrc_glLineWidth -extern void (CODEGEN_FUNCPTR *_ptrc_glLogicOp)(GLenum opcode); -#define glLogicOp _ptrc_glLogicOp -extern void (CODEGEN_FUNCPTR *_ptrc_glPixelStoref)(GLenum pname, GLfloat param); -#define glPixelStoref _ptrc_glPixelStoref -extern void (CODEGEN_FUNCPTR *_ptrc_glPixelStorei)(GLenum pname, GLint param); -#define glPixelStorei _ptrc_glPixelStorei -extern void (CODEGEN_FUNCPTR *_ptrc_glPointSize)(GLfloat size); -#define glPointSize _ptrc_glPointSize -extern void (CODEGEN_FUNCPTR *_ptrc_glPolygonMode)(GLenum face, GLenum mode); -#define glPolygonMode _ptrc_glPolygonMode -extern void (CODEGEN_FUNCPTR *_ptrc_glReadBuffer)(GLenum src); -#define glReadBuffer _ptrc_glReadBuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels); -#define glReadPixels _ptrc_glReadPixels -extern void (CODEGEN_FUNCPTR *_ptrc_glScissor)(GLint x, GLint y, GLsizei width, GLsizei height); -#define glScissor _ptrc_glScissor -extern void (CODEGEN_FUNCPTR *_ptrc_glStencilFunc)(GLenum func, GLint ref, GLuint mask); -#define glStencilFunc _ptrc_glStencilFunc -extern void (CODEGEN_FUNCPTR *_ptrc_glStencilMask)(GLuint mask); -#define glStencilMask _ptrc_glStencilMask -extern void (CODEGEN_FUNCPTR *_ptrc_glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); -#define glStencilOp _ptrc_glStencilOp -extern void (CODEGEN_FUNCPTR *_ptrc_glTexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels); -#define glTexImage1D _ptrc_glTexImage1D -extern void (CODEGEN_FUNCPTR *_ptrc_glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels); -#define glTexImage2D _ptrc_glTexImage2D -extern void (CODEGEN_FUNCPTR *_ptrc_glTexParameterf)(GLenum target, GLenum pname, GLfloat param); -#define glTexParameterf _ptrc_glTexParameterf -extern void (CODEGEN_FUNCPTR *_ptrc_glTexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); -#define glTexParameterfv _ptrc_glTexParameterfv -extern void (CODEGEN_FUNCPTR *_ptrc_glTexParameteri)(GLenum target, GLenum pname, GLint param); -#define glTexParameteri _ptrc_glTexParameteri -extern void (CODEGEN_FUNCPTR *_ptrc_glTexParameteriv)(GLenum target, GLenum pname, const GLint * params); -#define glTexParameteriv _ptrc_glTexParameteriv -extern void (CODEGEN_FUNCPTR *_ptrc_glViewport)(GLint x, GLint y, GLsizei width, GLsizei height); -#define glViewport _ptrc_glViewport - -extern void (CODEGEN_FUNCPTR *_ptrc_glBindTexture)(GLenum target, GLuint texture); -#define glBindTexture _ptrc_glBindTexture -extern void (CODEGEN_FUNCPTR *_ptrc_glCopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -#define glCopyTexImage1D _ptrc_glCopyTexImage1D -extern void (CODEGEN_FUNCPTR *_ptrc_glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -#define glCopyTexImage2D _ptrc_glCopyTexImage2D -extern void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -#define glCopyTexSubImage1D _ptrc_glCopyTexSubImage1D -extern void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#define glCopyTexSubImage2D _ptrc_glCopyTexSubImage2D -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteTextures)(GLsizei n, const GLuint * textures); -#define glDeleteTextures _ptrc_glDeleteTextures -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawArrays)(GLenum mode, GLint first, GLsizei count); -#define glDrawArrays _ptrc_glDrawArrays -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawElements)(GLenum mode, GLsizei count, GLenum type, const void * indices); -#define glDrawElements _ptrc_glDrawElements -extern void (CODEGEN_FUNCPTR *_ptrc_glGenTextures)(GLsizei n, GLuint * textures); -#define glGenTextures _ptrc_glGenTextures -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsTexture)(GLuint texture); -#define glIsTexture _ptrc_glIsTexture -extern void (CODEGEN_FUNCPTR *_ptrc_glPolygonOffset)(GLfloat factor, GLfloat units); -#define glPolygonOffset _ptrc_glPolygonOffset -extern void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels); -#define glTexSubImage1D _ptrc_glTexSubImage1D -extern void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); -#define glTexSubImage2D _ptrc_glTexSubImage2D - -extern void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#define glCopyTexSubImage3D _ptrc_glCopyTexSubImage3D -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices); -#define glDrawRangeElements _ptrc_glDrawRangeElements -extern void (CODEGEN_FUNCPTR *_ptrc_glTexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels); -#define glTexImage3D _ptrc_glTexImage3D -extern void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels); -#define glTexSubImage3D _ptrc_glTexSubImage3D - -extern void (CODEGEN_FUNCPTR *_ptrc_glActiveTexture)(GLenum texture); -#define glActiveTexture _ptrc_glActiveTexture -extern void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data); -#define glCompressedTexImage1D _ptrc_glCompressedTexImage1D -extern void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data); -#define glCompressedTexImage2D _ptrc_glCompressedTexImage2D -extern void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data); -#define glCompressedTexImage3D _ptrc_glCompressedTexImage3D -extern void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data); -#define glCompressedTexSubImage1D _ptrc_glCompressedTexSubImage1D -extern void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data); -#define glCompressedTexSubImage2D _ptrc_glCompressedTexSubImage2D -extern void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data); -#define glCompressedTexSubImage3D _ptrc_glCompressedTexSubImage3D -extern void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTexImage)(GLenum target, GLint level, void * img); -#define glGetCompressedTexImage _ptrc_glGetCompressedTexImage -extern void (CODEGEN_FUNCPTR *_ptrc_glSampleCoverage)(GLfloat value, GLboolean invert); -#define glSampleCoverage _ptrc_glSampleCoverage - -extern void (CODEGEN_FUNCPTR *_ptrc_glBlendColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#define glBlendColor _ptrc_glBlendColor -extern void (CODEGEN_FUNCPTR *_ptrc_glBlendEquation)(GLenum mode); -#define glBlendEquation _ptrc_glBlendEquation -extern void (CODEGEN_FUNCPTR *_ptrc_glBlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#define glBlendFuncSeparate _ptrc_glBlendFuncSeparate -extern void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawArrays)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount); -#define glMultiDrawArrays _ptrc_glMultiDrawArrays -extern void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount); -#define glMultiDrawElements _ptrc_glMultiDrawElements -extern void (CODEGEN_FUNCPTR *_ptrc_glPointParameterf)(GLenum pname, GLfloat param); -#define glPointParameterf _ptrc_glPointParameterf -extern void (CODEGEN_FUNCPTR *_ptrc_glPointParameterfv)(GLenum pname, const GLfloat * params); -#define glPointParameterfv _ptrc_glPointParameterfv -extern void (CODEGEN_FUNCPTR *_ptrc_glPointParameteri)(GLenum pname, GLint param); -#define glPointParameteri _ptrc_glPointParameteri -extern void (CODEGEN_FUNCPTR *_ptrc_glPointParameteriv)(GLenum pname, const GLint * params); -#define glPointParameteriv _ptrc_glPointParameteriv - -extern void (CODEGEN_FUNCPTR *_ptrc_glBeginQuery)(GLenum target, GLuint id); -#define glBeginQuery _ptrc_glBeginQuery -extern void (CODEGEN_FUNCPTR *_ptrc_glBindBuffer)(GLenum target, GLuint buffer); -#define glBindBuffer _ptrc_glBindBuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glBufferData)(GLenum target, GLsizeiptr size, const void * data, GLenum usage); -#define glBufferData _ptrc_glBufferData -extern void (CODEGEN_FUNCPTR *_ptrc_glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data); -#define glBufferSubData _ptrc_glBufferSubData -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteBuffers)(GLsizei n, const GLuint * buffers); -#define glDeleteBuffers _ptrc_glDeleteBuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteQueries)(GLsizei n, const GLuint * ids); -#define glDeleteQueries _ptrc_glDeleteQueries -extern void (CODEGEN_FUNCPTR *_ptrc_glEndQuery)(GLenum target); -#define glEndQuery _ptrc_glEndQuery -extern void (CODEGEN_FUNCPTR *_ptrc_glGenBuffers)(GLsizei n, GLuint * buffers); -#define glGenBuffers _ptrc_glGenBuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glGenQueries)(GLsizei n, GLuint * ids); -#define glGenQueries _ptrc_glGenQueries -extern void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint * params); -#define glGetBufferParameteriv _ptrc_glGetBufferParameteriv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetBufferPointerv)(GLenum target, GLenum pname, void ** params); -#define glGetBufferPointerv _ptrc_glGetBufferPointerv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, void * data); -#define glGetBufferSubData _ptrc_glGetBufferSubData -extern void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectiv)(GLuint id, GLenum pname, GLint * params); -#define glGetQueryObjectiv _ptrc_glGetQueryObjectiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectuiv)(GLuint id, GLenum pname, GLuint * params); -#define glGetQueryObjectuiv _ptrc_glGetQueryObjectuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetQueryiv)(GLenum target, GLenum pname, GLint * params); -#define glGetQueryiv _ptrc_glGetQueryiv -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsBuffer)(GLuint buffer); -#define glIsBuffer _ptrc_glIsBuffer -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsQuery)(GLuint id); -#define glIsQuery _ptrc_glIsQuery -extern void * (CODEGEN_FUNCPTR *_ptrc_glMapBuffer)(GLenum target, GLenum access); -#define glMapBuffer _ptrc_glMapBuffer -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glUnmapBuffer)(GLenum target); -#define glUnmapBuffer _ptrc_glUnmapBuffer - -extern void (CODEGEN_FUNCPTR *_ptrc_glAttachShader)(GLuint program, GLuint shader); -#define glAttachShader _ptrc_glAttachShader -extern void (CODEGEN_FUNCPTR *_ptrc_glBindAttribLocation)(GLuint program, GLuint index, const GLchar * name); -#define glBindAttribLocation _ptrc_glBindAttribLocation -extern void (CODEGEN_FUNCPTR *_ptrc_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); -#define glBlendEquationSeparate _ptrc_glBlendEquationSeparate -extern void (CODEGEN_FUNCPTR *_ptrc_glCompileShader)(GLuint shader); -#define glCompileShader _ptrc_glCompileShader -extern GLuint (CODEGEN_FUNCPTR *_ptrc_glCreateProgram)(void); -#define glCreateProgram _ptrc_glCreateProgram -extern GLuint (CODEGEN_FUNCPTR *_ptrc_glCreateShader)(GLenum type); -#define glCreateShader _ptrc_glCreateShader -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteProgram)(GLuint program); -#define glDeleteProgram _ptrc_glDeleteProgram -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteShader)(GLuint shader); -#define glDeleteShader _ptrc_glDeleteShader -extern void (CODEGEN_FUNCPTR *_ptrc_glDetachShader)(GLuint program, GLuint shader); -#define glDetachShader _ptrc_glDetachShader -extern void (CODEGEN_FUNCPTR *_ptrc_glDisableVertexAttribArray)(GLuint index); -#define glDisableVertexAttribArray _ptrc_glDisableVertexAttribArray -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawBuffers)(GLsizei n, const GLenum * bufs); -#define glDrawBuffers _ptrc_glDrawBuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glEnableVertexAttribArray)(GLuint index); -#define glEnableVertexAttribArray _ptrc_glEnableVertexAttribArray -extern void (CODEGEN_FUNCPTR *_ptrc_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); -#define glGetActiveAttrib _ptrc_glGetActiveAttrib -extern void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); -#define glGetActiveUniform _ptrc_glGetActiveUniform -extern void (CODEGEN_FUNCPTR *_ptrc_glGetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders); -#define glGetAttachedShaders _ptrc_glGetAttachedShaders -extern GLint (CODEGEN_FUNCPTR *_ptrc_glGetAttribLocation)(GLuint program, const GLchar * name); -#define glGetAttribLocation _ptrc_glGetAttribLocation -extern void (CODEGEN_FUNCPTR *_ptrc_glGetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -#define glGetProgramInfoLog _ptrc_glGetProgramInfoLog -extern void (CODEGEN_FUNCPTR *_ptrc_glGetProgramiv)(GLuint program, GLenum pname, GLint * params); -#define glGetProgramiv _ptrc_glGetProgramiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -#define glGetShaderInfoLog _ptrc_glGetShaderInfoLog -extern void (CODEGEN_FUNCPTR *_ptrc_glGetShaderSource)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source); -#define glGetShaderSource _ptrc_glGetShaderSource -extern void (CODEGEN_FUNCPTR *_ptrc_glGetShaderiv)(GLuint shader, GLenum pname, GLint * params); -#define glGetShaderiv _ptrc_glGetShaderiv -extern GLint (CODEGEN_FUNCPTR *_ptrc_glGetUniformLocation)(GLuint program, const GLchar * name); -#define glGetUniformLocation _ptrc_glGetUniformLocation -extern void (CODEGEN_FUNCPTR *_ptrc_glGetUniformfv)(GLuint program, GLint location, GLfloat * params); -#define glGetUniformfv _ptrc_glGetUniformfv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetUniformiv)(GLuint program, GLint location, GLint * params); -#define glGetUniformiv _ptrc_glGetUniformiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribPointerv)(GLuint index, GLenum pname, void ** pointer); -#define glGetVertexAttribPointerv _ptrc_glGetVertexAttribPointerv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribdv)(GLuint index, GLenum pname, GLdouble * params); -#define glGetVertexAttribdv _ptrc_glGetVertexAttribdv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat * params); -#define glGetVertexAttribfv _ptrc_glGetVertexAttribfv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint * params); -#define glGetVertexAttribiv _ptrc_glGetVertexAttribiv -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsProgram)(GLuint program); -#define glIsProgram _ptrc_glIsProgram -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsShader)(GLuint shader); -#define glIsShader _ptrc_glIsShader -extern void (CODEGEN_FUNCPTR *_ptrc_glLinkProgram)(GLuint program); -#define glLinkProgram _ptrc_glLinkProgram -extern void (CODEGEN_FUNCPTR *_ptrc_glShaderSource)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length); -#define glShaderSource _ptrc_glShaderSource -extern void (CODEGEN_FUNCPTR *_ptrc_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); -#define glStencilFuncSeparate _ptrc_glStencilFuncSeparate -extern void (CODEGEN_FUNCPTR *_ptrc_glStencilMaskSeparate)(GLenum face, GLuint mask); -#define glStencilMaskSeparate _ptrc_glStencilMaskSeparate -extern void (CODEGEN_FUNCPTR *_ptrc_glStencilOpSeparate)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -#define glStencilOpSeparate _ptrc_glStencilOpSeparate -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform1f)(GLint location, GLfloat v0); -#define glUniform1f _ptrc_glUniform1f -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform1fv)(GLint location, GLsizei count, const GLfloat * value); -#define glUniform1fv _ptrc_glUniform1fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform1i)(GLint location, GLint v0); -#define glUniform1i _ptrc_glUniform1i -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform1iv)(GLint location, GLsizei count, const GLint * value); -#define glUniform1iv _ptrc_glUniform1iv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform2f)(GLint location, GLfloat v0, GLfloat v1); -#define glUniform2f _ptrc_glUniform2f -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform2fv)(GLint location, GLsizei count, const GLfloat * value); -#define glUniform2fv _ptrc_glUniform2fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform2i)(GLint location, GLint v0, GLint v1); -#define glUniform2i _ptrc_glUniform2i -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform2iv)(GLint location, GLsizei count, const GLint * value); -#define glUniform2iv _ptrc_glUniform2iv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -#define glUniform3f _ptrc_glUniform3f -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform3fv)(GLint location, GLsizei count, const GLfloat * value); -#define glUniform3fv _ptrc_glUniform3fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform3i)(GLint location, GLint v0, GLint v1, GLint v2); -#define glUniform3i _ptrc_glUniform3i -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform3iv)(GLint location, GLsizei count, const GLint * value); -#define glUniform3iv _ptrc_glUniform3iv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -#define glUniform4f _ptrc_glUniform4f -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform4fv)(GLint location, GLsizei count, const GLfloat * value); -#define glUniform4fv _ptrc_glUniform4fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -#define glUniform4i _ptrc_glUniform4i -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform4iv)(GLint location, GLsizei count, const GLint * value); -#define glUniform4iv _ptrc_glUniform4iv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix2fv _ptrc_glUniformMatrix2fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix3fv _ptrc_glUniformMatrix3fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix4fv _ptrc_glUniformMatrix4fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUseProgram)(GLuint program); -#define glUseProgram _ptrc_glUseProgram -extern void (CODEGEN_FUNCPTR *_ptrc_glValidateProgram)(GLuint program); -#define glValidateProgram _ptrc_glValidateProgram -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1d)(GLuint index, GLdouble x); -#define glVertexAttrib1d _ptrc_glVertexAttrib1d -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1dv)(GLuint index, const GLdouble * v); -#define glVertexAttrib1dv _ptrc_glVertexAttrib1dv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1f)(GLuint index, GLfloat x); -#define glVertexAttrib1f _ptrc_glVertexAttrib1f -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1fv)(GLuint index, const GLfloat * v); -#define glVertexAttrib1fv _ptrc_glVertexAttrib1fv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1s)(GLuint index, GLshort x); -#define glVertexAttrib1s _ptrc_glVertexAttrib1s -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib1sv)(GLuint index, const GLshort * v); -#define glVertexAttrib1sv _ptrc_glVertexAttrib1sv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2d)(GLuint index, GLdouble x, GLdouble y); -#define glVertexAttrib2d _ptrc_glVertexAttrib2d -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2dv)(GLuint index, const GLdouble * v); -#define glVertexAttrib2dv _ptrc_glVertexAttrib2dv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2f)(GLuint index, GLfloat x, GLfloat y); -#define glVertexAttrib2f _ptrc_glVertexAttrib2f -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2fv)(GLuint index, const GLfloat * v); -#define glVertexAttrib2fv _ptrc_glVertexAttrib2fv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2s)(GLuint index, GLshort x, GLshort y); -#define glVertexAttrib2s _ptrc_glVertexAttrib2s -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib2sv)(GLuint index, const GLshort * v); -#define glVertexAttrib2sv _ptrc_glVertexAttrib2sv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3d)(GLuint index, GLdouble x, GLdouble y, GLdouble z); -#define glVertexAttrib3d _ptrc_glVertexAttrib3d -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3dv)(GLuint index, const GLdouble * v); -#define glVertexAttrib3dv _ptrc_glVertexAttrib3dv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z); -#define glVertexAttrib3f _ptrc_glVertexAttrib3f -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3fv)(GLuint index, const GLfloat * v); -#define glVertexAttrib3fv _ptrc_glVertexAttrib3fv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3s)(GLuint index, GLshort x, GLshort y, GLshort z); -#define glVertexAttrib3s _ptrc_glVertexAttrib3s -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib3sv)(GLuint index, const GLshort * v); -#define glVertexAttrib3sv _ptrc_glVertexAttrib3sv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nbv)(GLuint index, const GLbyte * v); -#define glVertexAttrib4Nbv _ptrc_glVertexAttrib4Nbv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Niv)(GLuint index, const GLint * v); -#define glVertexAttrib4Niv _ptrc_glVertexAttrib4Niv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nsv)(GLuint index, const GLshort * v); -#define glVertexAttrib4Nsv _ptrc_glVertexAttrib4Nsv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -#define glVertexAttrib4Nub _ptrc_glVertexAttrib4Nub -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nubv)(GLuint index, const GLubyte * v); -#define glVertexAttrib4Nubv _ptrc_glVertexAttrib4Nubv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nuiv)(GLuint index, const GLuint * v); -#define glVertexAttrib4Nuiv _ptrc_glVertexAttrib4Nuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4Nusv)(GLuint index, const GLushort * v); -#define glVertexAttrib4Nusv _ptrc_glVertexAttrib4Nusv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4bv)(GLuint index, const GLbyte * v); -#define glVertexAttrib4bv _ptrc_glVertexAttrib4bv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4d)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -#define glVertexAttrib4d _ptrc_glVertexAttrib4d -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4dv)(GLuint index, const GLdouble * v); -#define glVertexAttrib4dv _ptrc_glVertexAttrib4dv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -#define glVertexAttrib4f _ptrc_glVertexAttrib4f -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4fv)(GLuint index, const GLfloat * v); -#define glVertexAttrib4fv _ptrc_glVertexAttrib4fv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4iv)(GLuint index, const GLint * v); -#define glVertexAttrib4iv _ptrc_glVertexAttrib4iv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4s)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -#define glVertexAttrib4s _ptrc_glVertexAttrib4s -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4sv)(GLuint index, const GLshort * v); -#define glVertexAttrib4sv _ptrc_glVertexAttrib4sv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4ubv)(GLuint index, const GLubyte * v); -#define glVertexAttrib4ubv _ptrc_glVertexAttrib4ubv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4uiv)(GLuint index, const GLuint * v); -#define glVertexAttrib4uiv _ptrc_glVertexAttrib4uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4usv)(GLuint index, const GLushort * v); -#define glVertexAttrib4usv _ptrc_glVertexAttrib4usv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); -#define glVertexAttribPointer _ptrc_glVertexAttribPointer - -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix2x3fv _ptrc_glUniformMatrix2x3fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix2x4fv _ptrc_glUniformMatrix2x4fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix3x2fv _ptrc_glUniformMatrix3x2fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix3x4fv _ptrc_glUniformMatrix3x4fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix4x2fv _ptrc_glUniformMatrix4x2fv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -#define glUniformMatrix4x3fv _ptrc_glUniformMatrix4x3fv - -extern void (CODEGEN_FUNCPTR *_ptrc_glBeginConditionalRender)(GLuint id, GLenum mode); -#define glBeginConditionalRender _ptrc_glBeginConditionalRender -extern void (CODEGEN_FUNCPTR *_ptrc_glBeginTransformFeedback)(GLenum primitiveMode); -#define glBeginTransformFeedback _ptrc_glBeginTransformFeedback -extern void (CODEGEN_FUNCPTR *_ptrc_glBindBufferBase)(GLenum target, GLuint index, GLuint buffer); -#define glBindBufferBase _ptrc_glBindBufferBase -extern void (CODEGEN_FUNCPTR *_ptrc_glBindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -#define glBindBufferRange _ptrc_glBindBufferRange -extern void (CODEGEN_FUNCPTR *_ptrc_glBindFragDataLocation)(GLuint program, GLuint color, const GLchar * name); -#define glBindFragDataLocation _ptrc_glBindFragDataLocation -extern void (CODEGEN_FUNCPTR *_ptrc_glBindFramebuffer)(GLenum target, GLuint framebuffer); -#define glBindFramebuffer _ptrc_glBindFramebuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glBindRenderbuffer)(GLenum target, GLuint renderbuffer); -#define glBindRenderbuffer _ptrc_glBindRenderbuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glBindVertexArray)(GLuint ren_array); -#define glBindVertexArray _ptrc_glBindVertexArray -extern void (CODEGEN_FUNCPTR *_ptrc_glBlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#define glBlitFramebuffer _ptrc_glBlitFramebuffer -extern GLenum (CODEGEN_FUNCPTR *_ptrc_glCheckFramebufferStatus)(GLenum target); -#define glCheckFramebufferStatus _ptrc_glCheckFramebufferStatus -extern void (CODEGEN_FUNCPTR *_ptrc_glClampColor)(GLenum target, GLenum clamp); -#define glClampColor _ptrc_glClampColor -extern void (CODEGEN_FUNCPTR *_ptrc_glClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -#define glClearBufferfi _ptrc_glClearBufferfi -extern void (CODEGEN_FUNCPTR *_ptrc_glClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat * value); -#define glClearBufferfv _ptrc_glClearBufferfv -extern void (CODEGEN_FUNCPTR *_ptrc_glClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint * value); -#define glClearBufferiv _ptrc_glClearBufferiv -extern void (CODEGEN_FUNCPTR *_ptrc_glClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint * value); -#define glClearBufferuiv _ptrc_glClearBufferuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glColorMaski)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -#define glColorMaski _ptrc_glColorMaski -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteFramebuffers)(GLsizei n, const GLuint * framebuffers); -#define glDeleteFramebuffers _ptrc_glDeleteFramebuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteRenderbuffers)(GLsizei n, const GLuint * renderbuffers); -#define glDeleteRenderbuffers _ptrc_glDeleteRenderbuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteVertexArrays)(GLsizei n, const GLuint * arrays); -#define glDeleteVertexArrays _ptrc_glDeleteVertexArrays -extern void (CODEGEN_FUNCPTR *_ptrc_glDisablei)(GLenum target, GLuint index); -#define glDisablei _ptrc_glDisablei -extern void (CODEGEN_FUNCPTR *_ptrc_glEnablei)(GLenum target, GLuint index); -#define glEnablei _ptrc_glEnablei -extern void (CODEGEN_FUNCPTR *_ptrc_glEndConditionalRender)(void); -#define glEndConditionalRender _ptrc_glEndConditionalRender -extern void (CODEGEN_FUNCPTR *_ptrc_glEndTransformFeedback)(void); -#define glEndTransformFeedback _ptrc_glEndTransformFeedback -extern void (CODEGEN_FUNCPTR *_ptrc_glFlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); -#define glFlushMappedBufferRange _ptrc_glFlushMappedBufferRange -extern void (CODEGEN_FUNCPTR *_ptrc_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -#define glFramebufferRenderbuffer _ptrc_glFramebufferRenderbuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture1D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -#define glFramebufferTexture1D _ptrc_glFramebufferTexture1D -extern void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -#define glFramebufferTexture2D _ptrc_glFramebufferTexture2D -extern void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture3D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#define glFramebufferTexture3D _ptrc_glFramebufferTexture3D -extern void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTextureLayer)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#define glFramebufferTextureLayer _ptrc_glFramebufferTextureLayer -extern void (CODEGEN_FUNCPTR *_ptrc_glGenFramebuffers)(GLsizei n, GLuint * framebuffers); -#define glGenFramebuffers _ptrc_glGenFramebuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glGenRenderbuffers)(GLsizei n, GLuint * renderbuffers); -#define glGenRenderbuffers _ptrc_glGenRenderbuffers -extern void (CODEGEN_FUNCPTR *_ptrc_glGenVertexArrays)(GLsizei n, GLuint * arrays); -#define glGenVertexArrays _ptrc_glGenVertexArrays -extern void (CODEGEN_FUNCPTR *_ptrc_glGenerateMipmap)(GLenum target); -#define glGenerateMipmap _ptrc_glGenerateMipmap -extern void (CODEGEN_FUNCPTR *_ptrc_glGetBooleani_v)(GLenum target, GLuint index, GLboolean * data); -#define glGetBooleani_v _ptrc_glGetBooleani_v -extern GLint (CODEGEN_FUNCPTR *_ptrc_glGetFragDataLocation)(GLuint program, const GLchar * name); -#define glGetFragDataLocation _ptrc_glGetFragDataLocation -extern void (CODEGEN_FUNCPTR *_ptrc_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params); -#define glGetFramebufferAttachmentParameteriv _ptrc_glGetFramebufferAttachmentParameteriv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetIntegeri_v)(GLenum target, GLuint index, GLint * data); -#define glGetIntegeri_v _ptrc_glGetIntegeri_v -extern void (CODEGEN_FUNCPTR *_ptrc_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint * params); -#define glGetRenderbufferParameteriv _ptrc_glGetRenderbufferParameteriv -extern const GLubyte * (CODEGEN_FUNCPTR *_ptrc_glGetStringi)(GLenum name, GLuint index); -#define glGetStringi _ptrc_glGetStringi -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterIiv)(GLenum target, GLenum pname, GLint * params); -#define glGetTexParameterIiv _ptrc_glGetTexParameterIiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterIuiv)(GLenum target, GLenum pname, GLuint * params); -#define glGetTexParameterIuiv _ptrc_glGetTexParameterIuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); -#define glGetTransformFeedbackVarying _ptrc_glGetTransformFeedbackVarying -extern void (CODEGEN_FUNCPTR *_ptrc_glGetUniformuiv)(GLuint program, GLint location, GLuint * params); -#define glGetUniformuiv _ptrc_glGetUniformuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribIiv)(GLuint index, GLenum pname, GLint * params); -#define glGetVertexAttribIiv _ptrc_glGetVertexAttribIiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribIuiv)(GLuint index, GLenum pname, GLuint * params); -#define glGetVertexAttribIuiv _ptrc_glGetVertexAttribIuiv -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsEnabledi)(GLenum target, GLuint index); -#define glIsEnabledi _ptrc_glIsEnabledi -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsFramebuffer)(GLuint framebuffer); -#define glIsFramebuffer _ptrc_glIsFramebuffer -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsRenderbuffer)(GLuint renderbuffer); -#define glIsRenderbuffer _ptrc_glIsRenderbuffer -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsVertexArray)(GLuint ren_array); -#define glIsVertexArray _ptrc_glIsVertexArray -extern void * (CODEGEN_FUNCPTR *_ptrc_glMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -#define glMapBufferRange _ptrc_glMapBufferRange -extern void (CODEGEN_FUNCPTR *_ptrc_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -#define glRenderbufferStorage _ptrc_glRenderbufferStorage -extern void (CODEGEN_FUNCPTR *_ptrc_glRenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#define glRenderbufferStorageMultisample _ptrc_glRenderbufferStorageMultisample -extern void (CODEGEN_FUNCPTR *_ptrc_glTexParameterIiv)(GLenum target, GLenum pname, const GLint * params); -#define glTexParameterIiv _ptrc_glTexParameterIiv -extern void (CODEGEN_FUNCPTR *_ptrc_glTexParameterIuiv)(GLenum target, GLenum pname, const GLuint * params); -#define glTexParameterIuiv _ptrc_glTexParameterIuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glTransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode); -#define glTransformFeedbackVaryings _ptrc_glTransformFeedbackVaryings -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform1ui)(GLint location, GLuint v0); -#define glUniform1ui _ptrc_glUniform1ui -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform1uiv)(GLint location, GLsizei count, const GLuint * value); -#define glUniform1uiv _ptrc_glUniform1uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform2ui)(GLint location, GLuint v0, GLuint v1); -#define glUniform2ui _ptrc_glUniform2ui -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform2uiv)(GLint location, GLsizei count, const GLuint * value); -#define glUniform2uiv _ptrc_glUniform2uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform3ui)(GLint location, GLuint v0, GLuint v1, GLuint v2); -#define glUniform3ui _ptrc_glUniform3ui -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform3uiv)(GLint location, GLsizei count, const GLuint * value); -#define glUniform3uiv _ptrc_glUniform3uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform4ui)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -#define glUniform4ui _ptrc_glUniform4ui -extern void (CODEGEN_FUNCPTR *_ptrc_glUniform4uiv)(GLint location, GLsizei count, const GLuint * value); -#define glUniform4uiv _ptrc_glUniform4uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1i)(GLuint index, GLint x); -#define glVertexAttribI1i _ptrc_glVertexAttribI1i -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1iv)(GLuint index, const GLint * v); -#define glVertexAttribI1iv _ptrc_glVertexAttribI1iv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1ui)(GLuint index, GLuint x); -#define glVertexAttribI1ui _ptrc_glVertexAttribI1ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI1uiv)(GLuint index, const GLuint * v); -#define glVertexAttribI1uiv _ptrc_glVertexAttribI1uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2i)(GLuint index, GLint x, GLint y); -#define glVertexAttribI2i _ptrc_glVertexAttribI2i -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2iv)(GLuint index, const GLint * v); -#define glVertexAttribI2iv _ptrc_glVertexAttribI2iv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2ui)(GLuint index, GLuint x, GLuint y); -#define glVertexAttribI2ui _ptrc_glVertexAttribI2ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI2uiv)(GLuint index, const GLuint * v); -#define glVertexAttribI2uiv _ptrc_glVertexAttribI2uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z); -#define glVertexAttribI3i _ptrc_glVertexAttribI3i -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3iv)(GLuint index, const GLint * v); -#define glVertexAttribI3iv _ptrc_glVertexAttribI3iv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z); -#define glVertexAttribI3ui _ptrc_glVertexAttribI3ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI3uiv)(GLuint index, const GLuint * v); -#define glVertexAttribI3uiv _ptrc_glVertexAttribI3uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4bv)(GLuint index, const GLbyte * v); -#define glVertexAttribI4bv _ptrc_glVertexAttribI4bv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w); -#define glVertexAttribI4i _ptrc_glVertexAttribI4i -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4iv)(GLuint index, const GLint * v); -#define glVertexAttribI4iv _ptrc_glVertexAttribI4iv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4sv)(GLuint index, const GLshort * v); -#define glVertexAttribI4sv _ptrc_glVertexAttribI4sv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4ubv)(GLuint index, const GLubyte * v); -#define glVertexAttribI4ubv _ptrc_glVertexAttribI4ubv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -#define glVertexAttribI4ui _ptrc_glVertexAttribI4ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4uiv)(GLuint index, const GLuint * v); -#define glVertexAttribI4uiv _ptrc_glVertexAttribI4uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4usv)(GLuint index, const GLushort * v); -#define glVertexAttribI4usv _ptrc_glVertexAttribI4usv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribIPointer)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer); -#define glVertexAttribIPointer _ptrc_glVertexAttribIPointer - -extern void (CODEGEN_FUNCPTR *_ptrc_glCopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#define glCopyBufferSubData _ptrc_glCopyBufferSubData -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -#define glDrawArraysInstanced _ptrc_glDrawArraysInstanced -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount); -#define glDrawElementsInstanced _ptrc_glDrawElementsInstanced -extern void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockName)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName); -#define glGetActiveUniformBlockName _ptrc_glGetActiveUniformBlockName -extern void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockiv)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params); -#define glGetActiveUniformBlockiv _ptrc_glGetActiveUniformBlockiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformName)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName); -#define glGetActiveUniformName _ptrc_glGetActiveUniformName -extern void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params); -#define glGetActiveUniformsiv _ptrc_glGetActiveUniformsiv -extern GLuint (CODEGEN_FUNCPTR *_ptrc_glGetUniformBlockIndex)(GLuint program, const GLchar * uniformBlockName); -#define glGetUniformBlockIndex _ptrc_glGetUniformBlockIndex -extern void (CODEGEN_FUNCPTR *_ptrc_glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices); -#define glGetUniformIndices _ptrc_glGetUniformIndices -extern void (CODEGEN_FUNCPTR *_ptrc_glPrimitiveRestartIndex)(GLuint index); -#define glPrimitiveRestartIndex _ptrc_glPrimitiveRestartIndex -extern void (CODEGEN_FUNCPTR *_ptrc_glTexBuffer)(GLenum target, GLenum internalformat, GLuint buffer); -#define glTexBuffer _ptrc_glTexBuffer -extern void (CODEGEN_FUNCPTR *_ptrc_glUniformBlockBinding)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#define glUniformBlockBinding _ptrc_glUniformBlockBinding - -extern GLenum (CODEGEN_FUNCPTR *_ptrc_glClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); -#define glClientWaitSync _ptrc_glClientWaitSync -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteSync)(GLsync sync); -#define glDeleteSync _ptrc_glDeleteSync -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex); -#define glDrawElementsBaseVertex _ptrc_glDrawElementsBaseVertex -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex); -#define glDrawElementsInstancedBaseVertex _ptrc_glDrawElementsInstancedBaseVertex -extern void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex); -#define glDrawRangeElementsBaseVertex _ptrc_glDrawRangeElementsBaseVertex -extern GLsync (CODEGEN_FUNCPTR *_ptrc_glFenceSync)(GLenum condition, GLbitfield flags); -#define glFenceSync _ptrc_glFenceSync -extern void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture)(GLenum target, GLenum attachment, GLuint texture, GLint level); -#define glFramebufferTexture _ptrc_glFramebufferTexture -extern void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 * params); -#define glGetBufferParameteri64v _ptrc_glGetBufferParameteri64v -extern void (CODEGEN_FUNCPTR *_ptrc_glGetInteger64i_v)(GLenum target, GLuint index, GLint64 * data); -#define glGetInteger64i_v _ptrc_glGetInteger64i_v -extern void (CODEGEN_FUNCPTR *_ptrc_glGetInteger64v)(GLenum pname, GLint64 * data); -#define glGetInteger64v _ptrc_glGetInteger64v -extern void (CODEGEN_FUNCPTR *_ptrc_glGetMultisamplefv)(GLenum pname, GLuint index, GLfloat * val); -#define glGetMultisamplefv _ptrc_glGetMultisamplefv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); -#define glGetSynciv _ptrc_glGetSynciv -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsSync)(GLsync sync); -#define glIsSync _ptrc_glIsSync -extern void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElementsBaseVertex)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex); -#define glMultiDrawElementsBaseVertex _ptrc_glMultiDrawElementsBaseVertex -extern void (CODEGEN_FUNCPTR *_ptrc_glProvokingVertex)(GLenum mode); -#define glProvokingVertex _ptrc_glProvokingVertex -extern void (CODEGEN_FUNCPTR *_ptrc_glSampleMaski)(GLuint maskNumber, GLbitfield mask); -#define glSampleMaski _ptrc_glSampleMaski -extern void (CODEGEN_FUNCPTR *_ptrc_glTexImage2DMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -#define glTexImage2DMultisample _ptrc_glTexImage2DMultisample -extern void (CODEGEN_FUNCPTR *_ptrc_glTexImage3DMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -#define glTexImage3DMultisample _ptrc_glTexImage3DMultisample -extern void (CODEGEN_FUNCPTR *_ptrc_glWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); -#define glWaitSync _ptrc_glWaitSync - -extern void (CODEGEN_FUNCPTR *_ptrc_glBindFragDataLocationIndexed)(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name); -#define glBindFragDataLocationIndexed _ptrc_glBindFragDataLocationIndexed -extern void (CODEGEN_FUNCPTR *_ptrc_glBindSampler)(GLuint unit, GLuint sampler); -#define glBindSampler _ptrc_glBindSampler -extern void (CODEGEN_FUNCPTR *_ptrc_glDeleteSamplers)(GLsizei count, const GLuint * samplers); -#define glDeleteSamplers _ptrc_glDeleteSamplers -extern void (CODEGEN_FUNCPTR *_ptrc_glGenSamplers)(GLsizei count, GLuint * samplers); -#define glGenSamplers _ptrc_glGenSamplers -extern GLint (CODEGEN_FUNCPTR *_ptrc_glGetFragDataIndex)(GLuint program, const GLchar * name); -#define glGetFragDataIndex _ptrc_glGetFragDataIndex -extern void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjecti64v)(GLuint id, GLenum pname, GLint64 * params); -#define glGetQueryObjecti64v _ptrc_glGetQueryObjecti64v -extern void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectui64v)(GLuint id, GLenum pname, GLuint64 * params); -#define glGetQueryObjectui64v _ptrc_glGetQueryObjectui64v -extern void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameterIiv)(GLuint sampler, GLenum pname, GLint * params); -#define glGetSamplerParameterIiv _ptrc_glGetSamplerParameterIiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameterIuiv)(GLuint sampler, GLenum pname, GLuint * params); -#define glGetSamplerParameterIuiv _ptrc_glGetSamplerParameterIuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameterfv)(GLuint sampler, GLenum pname, GLfloat * params); -#define glGetSamplerParameterfv _ptrc_glGetSamplerParameterfv -extern void (CODEGEN_FUNCPTR *_ptrc_glGetSamplerParameteriv)(GLuint sampler, GLenum pname, GLint * params); -#define glGetSamplerParameteriv _ptrc_glGetSamplerParameteriv -extern GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsSampler)(GLuint sampler); -#define glIsSampler _ptrc_glIsSampler -extern void (CODEGEN_FUNCPTR *_ptrc_glQueryCounter)(GLuint id, GLenum target); -#define glQueryCounter _ptrc_glQueryCounter -extern void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterIiv)(GLuint sampler, GLenum pname, const GLint * param); -#define glSamplerParameterIiv _ptrc_glSamplerParameterIiv -extern void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterIuiv)(GLuint sampler, GLenum pname, const GLuint * param); -#define glSamplerParameterIuiv _ptrc_glSamplerParameterIuiv -extern void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterf)(GLuint sampler, GLenum pname, GLfloat param); -#define glSamplerParameterf _ptrc_glSamplerParameterf -extern void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameterfv)(GLuint sampler, GLenum pname, const GLfloat * param); -#define glSamplerParameterfv _ptrc_glSamplerParameterfv -extern void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameteri)(GLuint sampler, GLenum pname, GLint param); -#define glSamplerParameteri _ptrc_glSamplerParameteri -extern void (CODEGEN_FUNCPTR *_ptrc_glSamplerParameteriv)(GLuint sampler, GLenum pname, const GLint * param); -#define glSamplerParameteriv _ptrc_glSamplerParameteriv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribDivisor)(GLuint index, GLuint divisor); -#define glVertexAttribDivisor _ptrc_glVertexAttribDivisor -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -#define glVertexAttribP1ui _ptrc_glVertexAttribP1ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -#define glVertexAttribP1uiv _ptrc_glVertexAttribP1uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -#define glVertexAttribP2ui _ptrc_glVertexAttribP2ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -#define glVertexAttribP2uiv _ptrc_glVertexAttribP2uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -#define glVertexAttribP3ui _ptrc_glVertexAttribP3ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -#define glVertexAttribP3uiv _ptrc_glVertexAttribP3uiv -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -#define glVertexAttribP4ui _ptrc_glVertexAttribP4ui -extern void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -#define glVertexAttribP4uiv _ptrc_glVertexAttribP4uiv - -enum ogl_LoadStatus -{ - ogl_LOAD_FAILED = 0, - ogl_LOAD_SUCCEEDED = 1, -}; - -int ogl_LoadFunctions(); - -int ogl_GetMinorVersion(void); -int ogl_GetMajorVersion(void); -int ogl_IsVersionGEQ(int majorVersion, int minorVersion); - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif /*POINTER_C_GENERATED_HEADER_OPENGL_H*/ - -#endif // GLES diff --git a/angrylion-rdp-plus/src/output/gl_proc.h b/angrylion-rdp-plus/src/output/gl_proc.h deleted file mode 100644 index d040207..0000000 --- a/angrylion-rdp-plus/src/output/gl_proc.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -typedef void (*funcptr)(void); - -funcptr IntGetProcAddress(const char* name); diff --git a/angrylion-rdp-plus/src/output/screen.h b/angrylion-rdp-plus/src/output/screen.h deleted file mode 100644 index 9c11046..0000000 --- a/angrylion-rdp-plus/src/output/screen.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "core/n64video.h" - -#include <stdint.h> -#include <stdbool.h> - -void screen_init(struct n64video_config* config); -void screen_adjust(int32_t width_out, int32_t height_out, int32_t* width, int32_t* height, int32_t* x, int32_t* y); -void screen_update(void); -void screen_toggle_fullscreen(void); -void screen_close(void); diff --git a/angrylion-rdp-plus/src/output/vdac.c b/angrylion-rdp-plus/src/output/vdac.c deleted file mode 100644 index 534172f..0000000 --- a/angrylion-rdp-plus/src/output/vdac.c +++ /dev/null @@ -1,495 +0,0 @@ -#include "vdac.h" -#include "screen.h" -#include "core/msg.h" - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#ifdef GLES -#include <GLES3/gl3.h> -#define SHADER_HEADER "#version 300 es\nprecision lowp float;\n" -#else -#include "gl_core_3_3.h" -#define SHADER_HEADER "#version 330 core\n" -#endif - -#define TEX_FORMAT GL_RGBA -#define TEX_TYPE GL_UNSIGNED_BYTE - -static bool m_fbo_enabled; -static GLuint m_fbo; -static bool m_integer_scaling; - -static GLuint m_fbtex; -static uint32_t m_fbtex_width; -static uint32_t m_fbtex_height; - -static GLuint m_rawtex; -static uint32_t m_rawtex_width; -static uint32_t m_rawtex_height; -static bool m_rawtex_read; - -static GLuint m_program; -static GLuint m_vao; - -#ifdef _DEBUG -static void gl_check_errors(void) -{ - GLenum err; - static int32_t invalid_op_count = 0; - while ((err = glGetError()) != GL_NO_ERROR) { - // if gl_check_errors is called from a thread with no valid - // GL context, it would be stuck in an infinite loop here, since - // glGetError itself causes GL_INVALID_OPERATION, so check for a few - // cycles and abort if there are too many errors of that kind - if (err == GL_INVALID_OPERATION) { - if (++invalid_op_count >= 100) { - msg_error("gl_check_errors: invalid OpenGL context!"); - } - } else { - invalid_op_count = 0; - } - - char* err_str; - switch (err) { - case GL_INVALID_OPERATION: - err_str = "INVALID_OPERATION"; - break; - case GL_INVALID_ENUM: - err_str = "INVALID_ENUM"; - break; - case GL_INVALID_VALUE: - err_str = "INVALID_VALUE"; - break; - case GL_OUT_OF_MEMORY: - err_str = "OUT_OF_MEMORY"; - break; - case GL_INVALID_FRAMEBUFFER_OPERATION: - err_str = "INVALID_FRAMEBUFFER_OPERATION"; - break; - default: - err_str = "unknown"; - } - msg_debug("gl_check_errors: %d (%s)", err, err_str); - } -} -#else -#define gl_check_errors(...) -#endif - -static void gl_fbo_create(uint32_t width, uint32_t height) -{ - // prepare FB texture - glGenTextures(1, &m_fbtex); - glBindTexture(GL_TEXTURE_2D, m_fbtex); - - // reallocate texture buffer on GPU - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, TEX_FORMAT, TEX_TYPE, NULL); - - // prepare framebuffer object - glGenFramebuffers(1, &m_fbo); - glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); - - // attach texture - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_fbtex, 0); - - // bind raw texture again - glBindTexture(GL_TEXTURE_2D, m_rawtex); - - // check framebuffer object - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - msg_error("FBO creation failed!"); - } -} - -static void gl_fbo_delete(void) -{ - if (m_fbo) { - glDeleteFramebuffers(1, &m_fbo); - m_fbo = 0; - } - - if (m_fbtex) { - glDeleteTextures(1, &m_fbtex); - m_fbtex = 0; - } -} - -static bool gl_shader_load_file(GLuint shader, const char* path) -{ - bool success = false; - GLchar* source = NULL; - FILE* fp = fopen(path, "rb"); - if (!fp) { - // fail quietly - goto end; - } - - // get file size - fseek(fp, 0, SEEK_END); - uint32_t source_size = ftell(fp); - fseek(fp, 0, SEEK_SET); - - // allocate buffer for shader code - source = malloc(source_size + 1); - if (source == NULL) { - msg_error("Can't allocate memory for shader file %s", path); - goto end; - } - - // read shader code - if (fread(source, source_size, 1, fp) != 1) { - msg_warning("Can't read shader file %s", path); - goto end; - } - - // terminate shader code string - source[source_size] = 0; - - // send string to OpenGL - const GLchar* source_ptr = source; - glShaderSource(shader, 1, &source_ptr, NULL); - - success = true; - -end: - if (fp) { - fclose(fp); - } - if (source) { - free(source); - } - - return success; -} - -static GLuint gl_shader_compile(GLenum type, const GLchar* source, const char* path) -{ - GLuint shader = glCreateShader(type); - - // try to load external shader file first, otherwise use embedded fallback shader - if (!gl_shader_load_file(shader, path)) { - glShaderSource(shader, 1, &source, NULL); - } - - glCompileShader(shader); - - GLint param; - glGetShaderiv(shader, GL_COMPILE_STATUS, ¶m); - - if (!param) { - GLchar log[4096]; - glGetShaderInfoLog(shader, sizeof(log), NULL, log); - msg_error("%s shader error: %s\n", type == GL_FRAGMENT_SHADER ? "Frag" : "Vert", log); - } - - return shader; -} - -static GLuint gl_shader_link(GLuint vert, GLuint frag) -{ - GLuint program = glCreateProgram(); - glAttachShader(program, vert); - glAttachShader(program, frag); - glLinkProgram(program); - - GLint param; - glGetProgramiv(program, GL_LINK_STATUS, ¶m); - - if (!param) { - GLchar log[4096]; - glGetProgramInfoLog(program, sizeof(log), NULL, log); - msg_error("Shader link error: %s\n", log); - } - - glDeleteShader(frag); - glDeleteShader(vert); - - return program; -} - -void vdac_init(struct n64video_config* config) -{ - screen_init(config); - -#ifndef GLES - // load OpenGL function pointers - ogl_LoadFunctions(); -#endif - - msg_debug("%s: GL_VERSION='%s'", __FUNCTION__, glGetString(GL_VERSION)); - msg_debug("%s: GL_VENDOR='%s'", __FUNCTION__, glGetString(GL_VENDOR)); - msg_debug("%s: GL_RENDERER='%s'", __FUNCTION__, glGetString(GL_RENDERER)); - msg_debug("%s: GL_SHADING_LANGUAGE_VERSION='%s'", __FUNCTION__, glGetString(GL_SHADING_LANGUAGE_VERSION)); - - // shader sources for drawing a clipped full-screen triangle. the geometry - // is defined by the vertex ID, so a VBO is not required. - const GLchar* vert_shader = - SHADER_HEADER - "out vec2 uv;\n" - "void main(void) {\n" - " uv = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);\n" - " gl_Position = vec4(uv * vec2(2.0, -2.0) + vec2(-1.0, 1.0), 0.0, 1.0);\n" - "}\n"; - - const GLchar* frag_shader = - SHADER_HEADER - "in vec2 uv;\n" - "layout(location = 0) out vec4 color;\n" - "uniform sampler2D tex0;\n" - "void main(void) {\n" - " color = texture(tex0, uv);\n" - "}\n"; - - // compile and link OpenGL program - GLuint vert = gl_shader_compile(GL_VERTEX_SHADER, vert_shader, "alp_screen.vert"); - GLuint frag = gl_shader_compile(GL_FRAGMENT_SHADER, frag_shader, "alp_screen.frag"); - m_program = gl_shader_link(vert, frag); - glUseProgram(m_program); - - // prepare dummy VAO - glGenVertexArrays(1, &m_vao); - glBindVertexArray(m_vao); - - // prepare texture - glGenTextures(1, &m_rawtex); - glBindTexture(GL_TEXTURE_2D, m_rawtex); - - // select interpolation method - GLint filter; - switch (config->vi.interp) { - case VI_INTERP_HYBRID: - m_fbo_enabled = true; - filter = GL_LINEAR; - break; - case VI_INTERP_LINEAR: - m_fbo_enabled = false; - filter = GL_LINEAR; - break; - case VI_INTERP_NEAREST: - default: - m_fbo_enabled = false; - filter = GL_NEAREST; - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); - - // read with exact FB size in non-filtered modes - m_rawtex_read = config->vi.mode != VI_MODE_NORMAL; - - // save integer scaling flag, will be used later - m_integer_scaling = config->vi.integer_scaling; - - // check if there was an error when using any of the commands above - gl_check_errors(); -} - -void vdac_read(struct n64video_frame_buffer* fb, bool alpha) -{ - uint32_t width, height; - - if (m_rawtex_read) { - width = m_rawtex_width; - height = m_rawtex_height; - } else { - width = m_fbtex_width; - height = m_fbtex_height; - } - - // create temporary FBO if none has been created so far or if the existing - // one has the wrong size - bool temp_fbo = !m_fbo_enabled || width != m_fbtex_width || height != m_fbtex_height; - - fb->width = width; - fb->height = fb->height_out = height; - fb->pitch = fb->width; - - if (fb->pixels) { - // create temporary FBO - if (temp_fbo) { - gl_fbo_delete(); // in case m_fbo_enabled is true - gl_fbo_create(width, height); - - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo); - glViewport(0, 0, width, height); - glDrawArrays(GL_TRIANGLES, 0, 3); - } - - glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo); - glReadPixels(0, 0, width, height, alpha ? GL_RGBA : GL_RGB, TEX_TYPE, fb->pixels); - - // delete temporary FBO - if (temp_fbo) { - if (!m_fbo_enabled) { - // bind default FB - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - } - - gl_fbo_delete(); - - if (m_fbo_enabled) { - // restore previous FBO - gl_fbo_create(m_fbtex_width, m_fbtex_height); - } - } - } -} - -void vdac_write(struct n64video_frame_buffer* fb) -{ - bool raw_size_changed = m_rawtex_width != fb->width || m_rawtex_height != fb->height; - bool fb_size_changed = m_fbtex_width != fb->width || m_fbtex_height != fb->height_out; - - // check if the framebuffer size has changed - if (raw_size_changed) { - m_rawtex_width = fb->width; - m_rawtex_height = fb->height; - - // set pitch for all unpacking operations - glPixelStorei(GL_UNPACK_ROW_LENGTH, fb->pitch); - - // reallocate texture buffer on GPU - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rawtex_width, - m_rawtex_height, 0, TEX_FORMAT, TEX_TYPE, fb->pixels); - - msg_debug("%s: resized framebuffer texture: %dx%d", __FUNCTION__, m_rawtex_width, m_rawtex_height); - } else { - // copy local buffer to GPU texture buffer - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_rawtex_width, m_rawtex_height, - TEX_FORMAT, TEX_TYPE, fb->pixels); - } - - if (fb_size_changed) { - m_fbtex_width = fb->width; - m_fbtex_height = fb->height_out; - - if (m_fbo_enabled) { - // rebuild FBO - gl_fbo_delete(); - gl_fbo_create(m_fbtex_width, m_fbtex_height); - } - } -} - -void vdac_sync(bool valid) -{ - // clear old buffers - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - // get current window size and position - int32_t win_width; - int32_t win_height; - int32_t win_x; - int32_t win_y; - - screen_adjust(m_fbtex_width, m_fbtex_height, &win_width, &win_height, &win_x, &win_y); - - // if the screen is invalid or hidden, do nothing - if (win_width <= 0 || win_height <= 0) { - return; - } - - // skip rendering and leave buffer blank if there's no valid input - if (!valid) { - screen_update(); - return; - } - - if (m_integer_scaling) { - // get smallest integer scale that is at least 1 - uint32_t scale_x = (uint32_t)win_width < m_fbtex_width ? 1 : (uint32_t)win_width / m_fbtex_width; - uint32_t scale_y = (uint32_t)win_height < m_fbtex_height ? 1 : (uint32_t)win_height / m_fbtex_height; - uint32_t scale = scale_x > scale_y ? scale_x : scale_y; - - // get new window size (or rather viewport size in this context) - int32_t win_width_new = m_fbtex_width * scale; - int32_t win_height_new = m_fbtex_height * scale; - - // apply new size and offset - win_x = (win_width - win_width_new) / 2; - win_y = (win_height - win_height_new) / 2; - - win_width = win_width_new; - win_height = win_height_new; - } else { - int32_t hw = m_fbtex_height * win_width; - int32_t wh = m_fbtex_width * win_height; - - // add letterboxes or pillarboxes if the window has a different aspect ratio - // than the current display mode - if (hw > wh) { - int32_t w_max = wh / m_fbtex_height; - win_x += (win_width - w_max) / 2; - win_width = w_max; - } else if (hw < wh) { - int32_t h_max = hw / m_fbtex_width; - win_y += (win_height - h_max) / 2; - win_height = h_max; - } - } - - if (m_fbo_enabled) { - // framebuffer post-processing - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo); - glViewport(0, 0, m_fbtex_width, m_fbtex_height); - glDrawArrays(GL_TRIANGLES, 0, 3); - - // final upscale and output - glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - - GLint srcX0 = 0; - GLint srcY0 = 0; - GLint srcX1 = m_fbtex_width - 1; - GLint srcY1 = m_fbtex_height - 1; - GLint dstX0 = win_x; - GLint dstY0 = win_y; - GLint dstX1 = dstX0 + win_width - 1; - GLint dstY1 = dstY0 + win_height - 1; - - glViewport(win_x, win_y, win_width, win_height); - glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, GL_COLOR_BUFFER_BIT, GL_NEAREST); - } else { - // configure viewport - glViewport(win_x, win_y, win_width, win_height); - - // draw fullscreen triangle - glDrawArrays(GL_TRIANGLES, 0, 3); - } - - // check if there was an error when using any of the commands above - gl_check_errors(); - - // refresh screen with new frame - screen_update(); -} - -void vdac_close(void) -{ - m_rawtex_width = 0; - m_rawtex_height = 0; - - m_fbtex_width = 0; - m_fbtex_height = 0; - - if (m_rawtex) { - glDeleteTextures(1, &m_rawtex); - m_rawtex = 0; - } - - if (m_vao) { - glDeleteVertexArrays(1, &m_vao); - m_vao = 0; - } - - if (m_program) { - glDeleteProgram(m_program); - m_program = 0; - } - - gl_fbo_delete(); - - screen_close(); -} diff --git a/angrylion-rdp-plus/src/output/vdac.h b/angrylion-rdp-plus/src/output/vdac.h deleted file mode 100644 index b3ee323..0000000 --- a/angrylion-rdp-plus/src/output/vdac.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "core/n64video.h" - -#include <stdint.h> -#include <stdbool.h> - -void vdac_init(struct n64video_config* config); -void vdac_read(struct n64video_frame_buffer* fb, bool alpha); -void vdac_write(struct n64video_frame_buffer* fb); -void vdac_sync(bool invaid); -void vdac_close(void); diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_common.h b/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_common.h deleted file mode 100644 index d6f60f9..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_common.h +++ /dev/null @@ -1,90 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_common.h * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to common Core - * and plugin functions, for use by the front-end and plugin modules to attach - * to the dynamic libraries. - */ - -#if !defined(M64P_COMMON_H) -#define M64P_COMMON_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* PluginGetVersion() - * - * This function retrieves version information from a library. This - * function is the same for the core library and the plugins. - */ -typedef m64p_error (*ptr_PluginGetVersion)(m64p_plugin_type *, int *, int *, const char **, int *); -#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *, int *, int *, const char **, int *); -#endif - -/* CoreGetAPIVersions() - * - * This function retrieves API version information from the core. - */ -typedef m64p_error (*ptr_CoreGetAPIVersions)(int *, int *, int *, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL CoreGetAPIVersions(int *, int *, int *, int *); -#endif - -/* CoreErrorMessage() - * - * This function returns a pointer to a NULL-terminated string giving a - * human-readable description of the error. -*/ -typedef const char * (*ptr_CoreErrorMessage)(m64p_error); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL CoreErrorMessage(m64p_error); -#endif - -/* PluginStartup() - * - * This function initializes a plugin for use by allocating memory, creating - * data structures, and loading the configuration data. -*/ -typedef m64p_error (*ptr_PluginStartup)(m64p_dynlib_handle, void *, void (*)(void *, int, const char *)); -#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle, void *, void (*)(void *, int, const char *)); -#endif - -/* PluginShutdown() - * - * This function destroys data structures and releases memory allocated by - * the plugin library. -*/ -typedef m64p_error (*ptr_PluginShutdown)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL PluginShutdown(void); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_COMMON_H */ - diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_config.h b/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_config.h deleted file mode 100644 index f82d5c6..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_config.h +++ /dev/null @@ -1,280 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_config.h * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to the Core's - * configuration handling functions. - */ - -#if !defined(M64P_CONFIG_H) -#define M64P_CONFIG_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* ConfigListSections() - * - * This function is called to enumerate the list of Sections in the Mupen64Plus - * configuration file. It is expected that there will be a section named "Core" - * for core-specific configuration data, "Graphics" for common graphics options, - * and one or more sections for each plugin library. - */ -typedef m64p_error (*ptr_ConfigListSections)(void *, void (*)(void *, const char *)); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigListSections(void *, void (*)(void *, const char *)); -#endif - -/* ConfigOpenSection() - * - * This function is used to give a configuration section handle to the front-end - * which may be used to read or write configuration parameter values in a given - * section of the configuration file. - */ -typedef m64p_error (*ptr_ConfigOpenSection)(const char *, m64p_handle *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigOpenSection(const char *, m64p_handle *); -#endif - -/* ConfigListParameters() - * - * This function is called to enumerate the list of Parameters in a given - * Section of the Mupen64Plus configuration file. - */ -typedef m64p_error (*ptr_ConfigListParameters)(m64p_handle, void *, void (*)(void *, const char *, m64p_type)); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigListParameters(m64p_handle, void *, void (*)(void *, const char *, m64p_type)); -#endif - -/* ConfigSaveFile() - * - * This function saves the entire current Mupen64Plus configuration to disk. - */ -typedef m64p_error (*ptr_ConfigSaveFile)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSaveFile(void); -#endif - -/* ConfigSaveSection() - * - * This function saves one section of the current Mupen64Plus configuration to disk. - */ -typedef m64p_error (*ptr_ConfigSaveSection)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSaveSection(const char *); -#endif - -/* ConfigHasUnsavedChanges() - * - * This function determines if a given Section (or all sections) of the Mupen64Plus Core configuration file has been modified since it was last saved or loaded. - */ -typedef int (*ptr_ConfigHasUnsavedChanges)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL ConfigHasUnsavedChanges(const char *); -#endif - -/* ConfigDeleteSection() - * - * This function deletes a section from the Mupen64Plus configuration data. - */ -typedef m64p_error (*ptr_ConfigDeleteSection)(const char *SectionName); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigDeleteSection(const char *SectionName); -#endif - -/* ConfigRevertChanges() - * - * This function reverts changes previously made to one section of the configuration file, so that it will match with the configuration at the last time that it was loaded from or saved to disk. - */ -typedef m64p_error (*ptr_ConfigRevertChanges)(const char *SectionName); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigRevertChanges(const char *SectionName); -#endif - -/* ConfigSetParameter() - * - * This function sets the value of one of the emulator's configuration - * parameters. - */ -typedef m64p_error (*ptr_ConfigSetParameter)(m64p_handle, const char *, m64p_type, const void *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSetParameter(m64p_handle, const char *, m64p_type, const void *); -#endif - -/* ConfigSetParameterHelp() - * - * This function sets the help string of one of the emulator's configuration - * parameters. - */ -typedef m64p_error (*ptr_ConfigSetParameterHelp)(m64p_handle, const char *, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSetParameterHelp(m64p_handle, const char *, const char *); -#endif - -/* ConfigGetParameter() - * - * This function retrieves the value of one of the emulator's parameters. - */ -typedef m64p_error (*ptr_ConfigGetParameter)(m64p_handle, const char *, m64p_type, void *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigGetParameter(m64p_handle, const char *, m64p_type, void *, int); -#endif - -/* ConfigGetParameterType() - * - * This function retrieves the type of one of the emulator's parameters. - */ -typedef m64p_error (*ptr_ConfigGetParameterType)(m64p_handle, const char *, m64p_type *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigGetParameterType(m64p_handle, const char *, m64p_type *); -#endif - -/* ConfigGetParameterHelp() - * - * This function retrieves the help information about one of the emulator's - * parameters. - */ -typedef const char * (*ptr_ConfigGetParameterHelp)(m64p_handle, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetParameterHelp(m64p_handle, const char *); -#endif - -/* ConfigSetDefault***() - * - * These functions are used to set the value of a configuration parameter if it - * is not already present in the configuration file. This may happen if a new - * user runs the emulator, or an upgraded module uses a new parameter, or the - * user deletes his or her configuration file. If the parameter is already - * present in the given section of the configuration file, then no action will - * be taken and this function will return successfully. - */ -typedef m64p_error (*ptr_ConfigSetDefaultInt)(m64p_handle, const char *, int, const char *); -typedef m64p_error (*ptr_ConfigSetDefaultFloat)(m64p_handle, const char *, float, const char *); -typedef m64p_error (*ptr_ConfigSetDefaultBool)(m64p_handle, const char *, int, const char *); -typedef m64p_error (*ptr_ConfigSetDefaultString)(m64p_handle, const char *, const char *, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigSetDefaultInt(m64p_handle, const char *, int, const char *); -EXPORT m64p_error CALL ConfigSetDefaultFloat(m64p_handle, const char *, float, const char *); -EXPORT m64p_error CALL ConfigSetDefaultBool(m64p_handle, const char *, int, const char *); -EXPORT m64p_error CALL ConfigSetDefaultString(m64p_handle, const char *, const char *, const char *); -#endif - -/* ConfigGetParam***() - * - * These functions retrieve the value of one of the emulator's parameters in - * the given section, and return the value directly to the calling function. If - * an errors occurs (such as an invalid Section handle, or invalid - * configuration parameter name), then an error will be sent to the front-end - * via the DebugCallback() function, and either a 0 (zero) or an empty string - * will be returned. - */ -typedef int (*ptr_ConfigGetParamInt)(m64p_handle, const char *); -typedef float (*ptr_ConfigGetParamFloat)(m64p_handle, const char *); -typedef int (*ptr_ConfigGetParamBool)(m64p_handle, const char *); -typedef const char * (*ptr_ConfigGetParamString)(m64p_handle, const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT int CALL ConfigGetParamInt(m64p_handle, const char *); -EXPORT float CALL ConfigGetParamFloat(m64p_handle, const char *); -EXPORT int CALL ConfigGetParamBool(m64p_handle, const char *); -EXPORT const char * CALL ConfigGetParamString(m64p_handle, const char *); -#endif - -/* ConfigGetSharedDataFilepath() - * - * This function is provided to allow a plugin to retrieve a full pathname to a - * given shared data file. This type of file is intended to be shared among - * multiple users on a system, so it is likely to be read-only. - */ -typedef const char * (*ptr_ConfigGetSharedDataFilepath)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetSharedDataFilepath(const char *); -#endif - -/* ConfigGetUserConfigPath() - * - * This function may be used by the plugins or front-end to get a path to the - * directory for storing user-specific configuration files. This will be the - * directory where "mupen64plus.cfg" is located. - */ -typedef const char * (*ptr_ConfigGetUserConfigPath)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetUserConfigPath(void); -#endif - -/* ConfigGetUserDataPath() - * - * This function may be used by the plugins or front-end to get a path to the - * directory for storing user-specific data files. This may be used to store - * files such as screenshots, saved game states, or hi-res textures. - */ -typedef const char * (*ptr_ConfigGetUserDataPath)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetUserDataPath(void); -#endif - -/* ConfigGetUserCachePath() - * - * This function may be used by the plugins or front-end to get a path to the - * directory for storing cached user-specific data files. Files in this - * directory may be deleted by the user to save space, so critical information - * should not be stored here. This directory may be used to store files such - * as the ROM browser cache. - */ -typedef const char * (*ptr_ConfigGetUserCachePath)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT const char * CALL ConfigGetUserCachePath(void); -#endif - -/* ConfigExternalOpen() - * - * This function reads the contents of the config file into memory - * and returns M64ERR_SUCCESS if successful. - */ -typedef m64p_error (*ptr_ConfigExternalOpen)(const char *, m64p_handle *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigExternalOpen(const char *, m64p_handle *); -#endif - -/* ConfigExternalClose() - * - * Frees the memory pointer created by ConfigExternalOpen. - */ -typedef m64p_error (*ptr_ConfigExternalClose)(m64p_handle); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigExternalClose(m64p_handle); -#endif - -/* ConfigExternalGetParameter() - * - * This functions allows a plugin to leverage the built-in ini parser to read - * any cfg/ini file. It will return M64ERR_SUCCESS if the item was found. - */ -typedef m64p_error (*ptr_ConfigExternalGetParameter)(m64p_handle, const char *, const char *, char *, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL ConfigExternalGetParameter(m64p_handle, const char *, const char *, char *, int); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_CONFIG_H */ diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_plugin.h b/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_plugin.h deleted file mode 100644 index e471926..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_plugin.h +++ /dev/null @@ -1,286 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_plugin.h * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2002 Hacktarux * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#if !defined(M64P_PLUGIN_H) -#define M64P_PLUGIN_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*** Controller plugin's ****/ -#define PLUGIN_NONE 1 -#define PLUGIN_MEMPAK 2 -#define PLUGIN_RUMBLE_PAK 3 /* not implemented for non raw data */ -#define PLUGIN_TRANSFER_PAK 4 /* not implemented for non raw data */ -#define PLUGIN_RAW 5 /* the controller plugin is passed in raw data */ - -/***** Structures *****/ -typedef struct { - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * SP_MEM_ADDR_REG; - unsigned int * SP_DRAM_ADDR_REG; - unsigned int * SP_RD_LEN_REG; - unsigned int * SP_WR_LEN_REG; - unsigned int * SP_STATUS_REG; - unsigned int * SP_DMA_FULL_REG; - unsigned int * SP_DMA_BUSY_REG; - unsigned int * SP_PC_REG; - unsigned int * SP_SEMAPHORE_REG; - - unsigned int * DPC_START_REG; - unsigned int * DPC_END_REG; - unsigned int * DPC_CURRENT_REG; - unsigned int * DPC_STATUS_REG; - unsigned int * DPC_CLOCK_REG; - unsigned int * DPC_BUFBUSY_REG; - unsigned int * DPC_PIPEBUSY_REG; - unsigned int * DPC_TMEM_REG; - - void (*CheckInterrupts)(void); - void (*ProcessDlistList)(void); - void (*ProcessAlistList)(void); - void (*ProcessRdpList)(void); - void (*ShowCFB)(void); -} RSP_INFO; - -typedef struct { - unsigned char * HEADER; /* This is the rom header (first 40h bytes of the rom) */ - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * DPC_START_REG; - unsigned int * DPC_END_REG; - unsigned int * DPC_CURRENT_REG; - unsigned int * DPC_STATUS_REG; - unsigned int * DPC_CLOCK_REG; - unsigned int * DPC_BUFBUSY_REG; - unsigned int * DPC_PIPEBUSY_REG; - unsigned int * DPC_TMEM_REG; - - unsigned int * VI_STATUS_REG; - unsigned int * VI_ORIGIN_REG; - unsigned int * VI_WIDTH_REG; - unsigned int * VI_INTR_REG; - unsigned int * VI_V_CURRENT_LINE_REG; - unsigned int * VI_TIMING_REG; - unsigned int * VI_V_SYNC_REG; - unsigned int * VI_H_SYNC_REG; - unsigned int * VI_LEAP_REG; - unsigned int * VI_H_START_REG; - unsigned int * VI_V_START_REG; - unsigned int * VI_V_BURST_REG; - unsigned int * VI_X_SCALE_REG; - unsigned int * VI_Y_SCALE_REG; - - void (*CheckInterrupts)(void); - - /* The GFX_INFO.version parameter was added in version 2.5.1 of the core. - Plugins should ensure the core is at least this version before - attempting to read GFX_INFO.version. */ - unsigned int version; - /* SP_STATUS_REG and RDRAM_SIZE were added in version 2 of GFX_INFO.version. - Plugins should only attempt to read these values if GFX_INFO.version is at least 2. */ - - /* The RSP plugin should set (HALT | BROKE | TASKDONE) *before* calling ProcessDList. - It should not modify SP_STATUS_REG after ProcessDList has returned. - This will allow the GFX plugin to unset these bits if it needs. */ - unsigned int * SP_STATUS_REG; - const unsigned int * RDRAM_SIZE; -} GFX_INFO; - -typedef struct { - unsigned char * RDRAM; - unsigned char * DMEM; - unsigned char * IMEM; - - unsigned int * MI_INTR_REG; - - unsigned int * AI_DRAM_ADDR_REG; - unsigned int * AI_LEN_REG; - unsigned int * AI_CONTROL_REG; - unsigned int * AI_STATUS_REG; - unsigned int * AI_DACRATE_REG; - unsigned int * AI_BITRATE_REG; - - void (*CheckInterrupts)(void); -} AUDIO_INFO; - -typedef struct { - int Present; - int RawData; - int Plugin; -} CONTROL; - -typedef union { - unsigned int Value; - struct { - unsigned R_DPAD : 1; - unsigned L_DPAD : 1; - unsigned D_DPAD : 1; - unsigned U_DPAD : 1; - unsigned START_BUTTON : 1; - unsigned Z_TRIG : 1; - unsigned B_BUTTON : 1; - unsigned A_BUTTON : 1; - - unsigned R_CBUTTON : 1; - unsigned L_CBUTTON : 1; - unsigned D_CBUTTON : 1; - unsigned U_CBUTTON : 1; - unsigned R_TRIG : 1; - unsigned L_TRIG : 1; - unsigned Reserved1 : 1; - unsigned Reserved2 : 1; - - signed X_AXIS : 8; - signed Y_AXIS : 8; - }; -} BUTTONS; - -typedef struct { - CONTROL *Controls; /* A pointer to an array of 4 controllers .. eg: - CONTROL Controls[4]; */ -} CONTROL_INFO; - -/* common plugin function pointer types */ -typedef void (*ptr_RomClosed)(void); -typedef int (*ptr_RomOpen)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT int CALL RomOpen(void); -EXPORT void CALL RomClosed(void); -#endif - -/* video plugin function pointer types */ -typedef void (*ptr_ChangeWindow)(void); -typedef int (*ptr_InitiateGFX)(GFX_INFO Gfx_Info); -typedef void (*ptr_MoveScreen)(int x, int y); -typedef void (*ptr_ProcessDList)(void); -typedef void (*ptr_ProcessRDPList)(void); -typedef void (*ptr_ShowCFB)(void); -typedef void (*ptr_UpdateScreen)(void); -typedef void (*ptr_ViStatusChanged)(void); -typedef void (*ptr_ViWidthChanged)(void); -typedef void (*ptr_ReadScreen2)(void *dest, int *width, int *height, int front); -typedef void (*ptr_SetRenderingCallback)(void (*callback)(int)); -typedef void (*ptr_ResizeVideoOutput)(int width, int height); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL ChangeWindow(void); -EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info); -EXPORT void CALL MoveScreen(int x, int y); -EXPORT void CALL ProcessDList(void); -EXPORT void CALL ProcessRDPList(void); -EXPORT void CALL ShowCFB(void); -EXPORT void CALL UpdateScreen(void); -EXPORT void CALL ViStatusChanged(void); -EXPORT void CALL ViWidthChanged(void); -EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front); -EXPORT void CALL SetRenderingCallback(void (*callback)(int)); -EXPORT void CALL ResizeVideoOutput(int width, int height); -#endif - -/* frame buffer plugin spec extension */ -typedef struct -{ - unsigned int addr; - unsigned int size; - unsigned int width; - unsigned int height; -} FrameBufferInfo; -typedef void (*ptr_FBRead)(unsigned int addr); -typedef void (*ptr_FBWrite)(unsigned int addr, unsigned int size); -typedef void (*ptr_FBGetFrameBufferInfo)(void *p); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL FBRead(unsigned int addr); -EXPORT void CALL FBWrite(unsigned int addr, unsigned int size); -EXPORT void CALL FBGetFrameBufferInfo(void *p); -#endif - -/* audio plugin function pointers */ -typedef void (*ptr_AiDacrateChanged)(int SystemType); -typedef void (*ptr_AiLenChanged)(void); -typedef int (*ptr_InitiateAudio)(AUDIO_INFO Audio_Info); -typedef void (*ptr_ProcessAList)(void); -typedef void (*ptr_SetSpeedFactor)(int percent); -typedef void (*ptr_VolumeUp)(void); -typedef void (*ptr_VolumeDown)(void); -typedef int (*ptr_VolumeGetLevel)(void); -typedef void (*ptr_VolumeSetLevel)(int level); -typedef void (*ptr_VolumeMute)(void); -typedef const char * (*ptr_VolumeGetString)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL AiDacrateChanged(int SystemType); -EXPORT void CALL AiLenChanged(void); -EXPORT int CALL InitiateAudio(AUDIO_INFO Audio_Info); -EXPORT void CALL ProcessAList(void); -EXPORT void CALL SetSpeedFactor(int percent); -EXPORT void CALL VolumeUp(void); -EXPORT void CALL VolumeDown(void); -EXPORT int CALL VolumeGetLevel(void); -EXPORT void CALL VolumeSetLevel(int level); -EXPORT void CALL VolumeMute(void); -EXPORT const char * CALL VolumeGetString(void); -#endif - -/* input plugin function pointers */ -typedef void (*ptr_ControllerCommand)(int Control, unsigned char *Command); -typedef void (*ptr_GetKeys)(int Control, BUTTONS *Keys); -typedef void (*ptr_InitiateControllers)(CONTROL_INFO ControlInfo); -typedef void (*ptr_ReadController)(int Control, unsigned char *Command); -typedef void (*ptr_SDL_KeyDown)(int keymod, int keysym); -typedef void (*ptr_SDL_KeyUp)(int keymod, int keysym); -typedef void (*ptr_RenderCallback)(void); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT void CALL ControllerCommand(int Control, unsigned char *Command); -EXPORT void CALL GetKeys(int Control, BUTTONS *Keys); -EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo); -EXPORT void CALL ReadController(int Control, unsigned char *Command); -EXPORT void CALL SDL_KeyDown(int keymod, int keysym); -EXPORT void CALL SDL_KeyUp(int keymod, int keysym); -EXPORT void CALL RenderCallback(void); -#endif - -/* RSP plugin function pointers */ -typedef unsigned int (*ptr_DoRspCycles)(unsigned int Cycles); -typedef void (*ptr_InitiateRSP)(RSP_INFO Rsp_Info, unsigned int *CycleCount); -#if defined(M64P_PLUGIN_PROTOTYPES) -EXPORT unsigned int CALL DoRspCycles(unsigned int Cycles); -EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int *CycleCount); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* M64P_PLUGIN_H */ - - diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_types.h b/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_types.h deleted file mode 100644 index a8efd35..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_types.h +++ /dev/null @@ -1,366 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_types.h * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2012 CasualJames * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#if !defined(M64P_TYPES_H) -#define M64P_TYPES_H - -/* ----------------------------------------- */ -/* Platform-specific stuff */ -/* ----------------------------------------- */ - -/* necessary headers */ -#include <stdint.h> -#if defined(WIN32) - #include <windows.h> -#endif - -/* DLL handles and function declaration specifiers */ -#if defined(WIN32) - #define IMPORT extern "C" __declspec(dllimport) - #define EXPORT __declspec(dllexport) - #define CALL __cdecl - typedef HMODULE m64p_dynlib_handle; -#else - #define IMPORT extern "C" - #define EXPORT __attribute__((visibility("default"))) - #define CALL - typedef void * m64p_dynlib_handle; -#endif - -/* ----------------------------------------- */ -/* Structures and Types for Core library API */ -/* ----------------------------------------- */ - -typedef void * m64p_handle; - -typedef void (*m64p_frame_callback)(unsigned int FrameIndex); -typedef void (*m64p_input_callback)(void); -typedef void (*m64p_audio_callback)(void); -typedef void (*m64p_vi_callback)(void); - -typedef enum { - M64TYPE_INT = 1, - M64TYPE_FLOAT, - M64TYPE_BOOL, - M64TYPE_STRING -} m64p_type; - -typedef enum { - M64MSG_ERROR = 1, - M64MSG_WARNING, - M64MSG_INFO, - M64MSG_STATUS, - M64MSG_VERBOSE -} m64p_msg_level; - -typedef enum { - M64ERR_SUCCESS = 0, - M64ERR_NOT_INIT, /* Function is disallowed before InitMupen64Plus() is called */ - M64ERR_ALREADY_INIT, /* InitMupen64Plus() was called twice */ - M64ERR_INCOMPATIBLE, /* API versions between components are incompatible */ - M64ERR_INPUT_ASSERT, /* Invalid parameters for function call, such as ParamValue=NULL for GetCoreParameter() */ - M64ERR_INPUT_INVALID, /* Invalid input data, such as ParamValue="maybe" for SetCoreParameter() to set a BOOL-type value */ - M64ERR_INPUT_NOT_FOUND, /* The input parameter(s) specified a particular item which was not found */ - M64ERR_NO_MEMORY, /* Memory allocation failed */ - M64ERR_FILES, /* Error opening, creating, reading, or writing to a file */ - M64ERR_INTERNAL, /* Internal error (bug) */ - M64ERR_INVALID_STATE, /* Current program state does not allow operation */ - M64ERR_PLUGIN_FAIL, /* A plugin function returned a fatal error */ - M64ERR_SYSTEM_FAIL, /* A system function call, such as an SDL or file operation, failed */ - M64ERR_UNSUPPORTED, /* Function call is not supported (ie, core not built with debugger) */ - M64ERR_WRONG_TYPE /* A given input type parameter cannot be used for desired operation */ -} m64p_error; - -typedef enum { - M64CAPS_DYNAREC = 1, - M64CAPS_DEBUGGER = 2, - M64CAPS_CORE_COMPARE = 4 -} m64p_core_caps; - -typedef enum { - M64PLUGIN_NULL = 0, - M64PLUGIN_RSP = 1, - M64PLUGIN_GFX, - M64PLUGIN_AUDIO, - M64PLUGIN_INPUT, - M64PLUGIN_CORE -} m64p_plugin_type; - -typedef enum { - M64EMU_STOPPED = 1, - M64EMU_RUNNING, - M64EMU_PAUSED -} m64p_emu_state; - -typedef enum { - M64VIDEO_NONE = 1, - M64VIDEO_WINDOWED, - M64VIDEO_FULLSCREEN -} m64p_video_mode; - -typedef enum { - M64VIDEOFLAG_SUPPORT_RESIZING = 1 -} m64p_video_flags; - -typedef enum { - M64CORE_EMU_STATE = 1, - M64CORE_VIDEO_MODE, - M64CORE_SAVESTATE_SLOT, - M64CORE_SPEED_FACTOR, - M64CORE_SPEED_LIMITER, - M64CORE_VIDEO_SIZE, - M64CORE_AUDIO_VOLUME, - M64CORE_AUDIO_MUTE, - M64CORE_INPUT_GAMESHARK, - M64CORE_STATE_LOADCOMPLETE, - M64CORE_STATE_SAVECOMPLETE -} m64p_core_param; - -typedef enum { - M64CMD_NOP = 0, - M64CMD_ROM_OPEN, - M64CMD_ROM_CLOSE, - M64CMD_ROM_GET_HEADER, - M64CMD_ROM_GET_SETTINGS, - M64CMD_EXECUTE, - M64CMD_STOP, - M64CMD_PAUSE, - M64CMD_RESUME, - M64CMD_CORE_STATE_QUERY, - M64CMD_STATE_LOAD, - M64CMD_STATE_SAVE, - M64CMD_STATE_SET_SLOT, - M64CMD_SEND_SDL_KEYDOWN, - M64CMD_SEND_SDL_KEYUP, - M64CMD_SET_FRAME_CALLBACK, - M64CMD_TAKE_NEXT_SCREENSHOT, - M64CMD_CORE_STATE_SET, - M64CMD_READ_SCREEN, - M64CMD_RESET, - M64CMD_ADVANCE_FRAME -} m64p_command; - -typedef struct { - uint32_t address; - int value; -} m64p_cheat_code; - -/* ----------------------------------------- */ -/* Structures to hold ROM image information */ -/* ----------------------------------------- */ - -typedef enum -{ - SYSTEM_NTSC = 0, - SYSTEM_PAL, - SYSTEM_MPAL -} m64p_system_type; - -typedef struct -{ - uint8_t init_PI_BSB_DOM1_LAT_REG; /* 0x00 */ - uint8_t init_PI_BSB_DOM1_PGS_REG; /* 0x01 */ - uint8_t init_PI_BSB_DOM1_PWD_REG; /* 0x02 */ - uint8_t init_PI_BSB_DOM1_PGS_REG2; /* 0x03 */ - uint32_t ClockRate; /* 0x04 */ - uint32_t PC; /* 0x08 */ - uint32_t Release; /* 0x0C */ - uint32_t CRC1; /* 0x10 */ - uint32_t CRC2; /* 0x14 */ - uint32_t Unknown[2]; /* 0x18 */ - uint8_t Name[20]; /* 0x20 */ - uint32_t unknown; /* 0x34 */ - uint32_t Manufacturer_ID; /* 0x38 */ - uint16_t Cartridge_ID; /* 0x3C - Game serial number */ - uint16_t Country_code; /* 0x3E */ -} m64p_rom_header; - -typedef struct -{ - char goodname[256]; - char MD5[33]; - unsigned char savetype; - unsigned char status; /* Rom status on a scale from 0-5. */ - unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */ - unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */ -} m64p_rom_settings; - -/* ----------------------------------------- */ -/* Structures and Types for the Debugger */ -/* ----------------------------------------- */ - -typedef enum { - M64P_DBG_RUN_STATE = 1, - M64P_DBG_PREVIOUS_PC, - M64P_DBG_NUM_BREAKPOINTS, - M64P_DBG_CPU_DYNACORE, - M64P_DBG_CPU_NEXT_INTERRUPT -} m64p_dbg_state; - -typedef enum { - M64P_DBG_RUNSTATE_PAUSED = 0, - M64P_DBG_RUNSTATE_STEPPING, - M64P_DBG_RUNSTATE_RUNNING -} m64p_dbg_runstate; - -typedef enum { - M64P_DBG_MEM_TYPE = 1, - M64P_DBG_MEM_FLAGS, - M64P_DBG_MEM_HAS_RECOMPILED, - M64P_DBG_MEM_NUM_RECOMPILED, - M64P_DBG_RECOMP_OPCODE = 16, - M64P_DBG_RECOMP_ARGS, - M64P_DBG_RECOMP_ADDR -} m64p_dbg_mem_info; - -typedef enum { - M64P_MEM_NOMEM = 0, - M64P_MEM_NOTHING, - M64P_MEM_RDRAM, - M64P_MEM_RDRAMREG, - M64P_MEM_RSPMEM, - M64P_MEM_RSPREG, - M64P_MEM_RSP, - M64P_MEM_DP, - M64P_MEM_DPS, - M64P_MEM_VI, - M64P_MEM_AI, - M64P_MEM_PI, - M64P_MEM_RI, - M64P_MEM_SI, - M64P_MEM_FLASHRAMSTAT, - M64P_MEM_ROM, - M64P_MEM_PIF, - M64P_MEM_MI, - M64P_MEM_BREAKPOINT -} m64p_dbg_mem_type; - -typedef enum { - M64P_MEM_FLAG_READABLE = 0x01, - M64P_MEM_FLAG_WRITABLE = 0x02, - M64P_MEM_FLAG_READABLE_EMUONLY = 0x04, /* the EMUONLY flags signify that emulated code can read/write here, but debugger cannot */ - M64P_MEM_FLAG_WRITABLE_EMUONLY = 0x08 -} m64p_dbg_mem_flags; - -typedef enum { - M64P_DBG_PTR_RDRAM = 1, - M64P_DBG_PTR_PI_REG, - M64P_DBG_PTR_SI_REG, - M64P_DBG_PTR_VI_REG, - M64P_DBG_PTR_RI_REG, - M64P_DBG_PTR_AI_REG -} m64p_dbg_memptr_type; - -typedef enum { - M64P_CPU_PC = 1, - M64P_CPU_REG_REG, - M64P_CPU_REG_HI, - M64P_CPU_REG_LO, - M64P_CPU_REG_COP0, - M64P_CPU_REG_COP1_DOUBLE_PTR, - M64P_CPU_REG_COP1_SIMPLE_PTR, - M64P_CPU_REG_COP1_FGR_64, - M64P_CPU_TLB -} m64p_dbg_cpu_data; - -typedef enum { - M64P_BKP_CMD_ADD_ADDR = 1, - M64P_BKP_CMD_ADD_STRUCT, - M64P_BKP_CMD_REPLACE, - M64P_BKP_CMD_REMOVE_ADDR, - M64P_BKP_CMD_REMOVE_IDX, - M64P_BKP_CMD_ENABLE, - M64P_BKP_CMD_DISABLE, - M64P_BKP_CMD_CHECK -} m64p_dbg_bkp_command; - -#define M64P_MEM_INVALID 0xFFFFFFFF /* invalid memory read will return this */ - -#define BREAKPOINTS_MAX_NUMBER 128 - -typedef enum { - M64P_BKP_FLAG_ENABLED = 0x01, - M64P_BKP_FLAG_READ = 0x02, - M64P_BKP_FLAG_WRITE = 0x04, - M64P_BKP_FLAG_EXEC = 0x08, - M64P_BKP_FLAG_LOG = 0x10 /* Log to the console when this breakpoint hits */ -} m64p_dbg_bkp_flags; - -#define BPT_CHECK_FLAG(a, b) ((a.flags & b) == b) -#define BPT_SET_FLAG(a, b) a.flags = (a.flags | b); -#define BPT_CLEAR_FLAG(a, b) a.flags = (a.flags & (~b)); -#define BPT_TOGGLE_FLAG(a, b) a.flags = (a.flags ^ b); - -typedef struct { - uint32_t address; - uint32_t endaddr; - unsigned int flags; -} m64p_breakpoint; - -/* ------------------------------------------------- */ -/* Structures and Types for Core Video Extension API */ -/* ------------------------------------------------- */ - -typedef struct { - unsigned int uiWidth; - unsigned int uiHeight; -} m64p_2d_size; - -typedef enum { - M64P_GL_DOUBLEBUFFER = 1, - M64P_GL_BUFFER_SIZE, - M64P_GL_DEPTH_SIZE, - M64P_GL_RED_SIZE, - M64P_GL_GREEN_SIZE, - M64P_GL_BLUE_SIZE, - M64P_GL_ALPHA_SIZE, - M64P_GL_SWAP_CONTROL, - M64P_GL_MULTISAMPLEBUFFERS, - M64P_GL_MULTISAMPLESAMPLES, - M64P_GL_CONTEXT_MAJOR_VERSION, - M64P_GL_CONTEXT_MINOR_VERSION, - M64P_GL_CONTEXT_PROFILE_MASK -} m64p_GLattr; - -typedef enum { - M64P_GL_CONTEXT_PROFILE_CORE, - M64P_GL_CONTEXT_PROFILE_COMPATIBILITY, - M64P_GL_CONTEXT_PROFILE_ES -} m64p_GLContextType; - -typedef struct { - unsigned int Functions; - m64p_error (*VidExtFuncInit)(void); - m64p_error (*VidExtFuncQuit)(void); - m64p_error (*VidExtFuncListModes)(m64p_2d_size *, int *); - m64p_error (*VidExtFuncSetMode)(int, int, int, int, int); - void * (*VidExtFuncGLGetProc)(const char*); - m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int); - m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int *); - m64p_error (*VidExtFuncGLSwapBuf)(void); - m64p_error (*VidExtFuncSetCaption)(const char *); - m64p_error (*VidExtFuncToggleFS)(void); - m64p_error (*VidExtFuncResizeWindow)(int, int); -} m64p_video_extension_functions; - -#endif /* define M64P_TYPES_H */ - diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_vidext.h b/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_vidext.h deleted file mode 100644 index a996eb5..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/api/m64p_vidext.h +++ /dev/null @@ -1,154 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-core - m64p_vidext.h * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This header file defines typedefs for function pointers to the core's - * video extension functions. - */ - -#if !defined(M64P_VIDEXT_H) -#define M64P_VIDEXT_H - -#include "m64p_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* VidExt_Init() - * - * This function should be called from within the InitiateGFX() video plugin - * function call. The default SDL implementation of this function simply calls - * SDL_InitSubSystem(SDL_INIT_VIDEO). It does not open a rendering window or - * switch video modes. - */ -typedef m64p_error (*ptr_VidExt_Init)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_Init(void); -#endif - -/* VidExt_Quit() - * - * This function closes any open rendering window and shuts down the video - * system. The default SDL implementation of this function calls - * SDL_QuitSubSystem(SDL_INIT_VIDEO). This function should be called from - * within the RomClose() video plugin function. - */ -typedef m64p_error (*ptr_VidExt_Quit)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_Quit(void); -#endif - -/* VidExt_ListFullscreenModes() - * - * This function is used to enumerate the available resolutions for fullscreen - * video modes. A pointer to an array is passed into the function, which is - * then filled with resolution sizes. - */ -typedef m64p_error (*ptr_VidExt_ListFullscreenModes)(m64p_2d_size *, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ListFullscreenModes(m64p_2d_size *, int *); -#endif - -/* VidExt_SetVideoMode() - * - * This function creates a rendering window or switches into a fullscreen - * video mode. Any desired OpenGL attributes should be set before calling - * this function. - */ -typedef m64p_error (*ptr_VidExt_SetVideoMode)(int, int, int, m64p_video_mode, m64p_video_flags); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_SetVideoMode(int, int, int, m64p_video_mode, m64p_video_flags); -#endif - -/* VidExt_ResizeWindow() - * - * This function resizes the opengl rendering window to match the given size. - */ -typedef m64p_error (*ptr_VidExt_ResizeWindow)(int, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ResizeWindow(int, int); -#endif - -/* VidExt_SetCaption() - * - * This function sets the caption text of the emulator rendering window. - */ -typedef m64p_error (*ptr_VidExt_SetCaption)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_SetCaption(const char *); -#endif - -/* VidExt_ToggleFullScreen() - * - * This function toggles between fullscreen and windowed rendering modes. - */ -typedef m64p_error (*ptr_VidExt_ToggleFullScreen)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_ToggleFullScreen(void); -#endif - -/* VidExt_GL_GetProcAddress() - * - * This function is used to get a pointer to an OpenGL extension function. This - * is only necessary on the Windows platform, because the OpenGL implementation - * shipped with Windows only supports OpenGL version 1.1. - */ -typedef void * (*ptr_VidExt_GL_GetProcAddress)(const char *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT void * CALL VidExt_GL_GetProcAddress(const char *); -#endif - -/* VidExt_GL_SetAttribute() - * - * This function is used to set certain OpenGL attributes which must be - * specified before creating the rendering window with VidExt_SetVideoMode. - */ -typedef m64p_error (*ptr_VidExt_GL_SetAttribute)(m64p_GLattr, int); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr, int); -#endif - -/* VidExt_GL_GetAttribute() - * - * This function is used to get the value of OpenGL attributes. These values may - * be changed when calling VidExt_SetVideoMode. - */ -typedef m64p_error (*ptr_VidExt_GL_GetAttribute)(m64p_GLattr, int *); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr, int *); -#endif - -/* VidExt_GL_SwapBuffers() - * - * This function is used to swap the front/back buffers after rendering an - * output video frame. - */ -typedef m64p_error (*ptr_VidExt_GL_SwapBuffers)(void); -#if defined(M64P_CORE_PROTOTYPES) -EXPORT m64p_error CALL VidExt_GL_SwapBuffers(void); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* #define M64P_VIDEXT_H */ - diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/gfx_m64p.c b/angrylion-rdp-plus/src/plugin/mupen64plus/gfx_m64p.c deleted file mode 100644 index 43a8495..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/gfx_m64p.c +++ /dev/null @@ -1,311 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-video-angrylionplus - plugin.c * - * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#define M64P_PLUGIN_PROTOTYPES 1 - -#define KEY_FULLSCREEN "Fullscreen" -#define KEY_SCREEN_WIDTH "ScreenWidth" -#define KEY_SCREEN_HEIGHT "ScreenHeight" -#define KEY_PARALLEL "Parallel" -#define KEY_NUM_WORKERS "NumWorkers" -#define KEY_BUSY_LOOP "BusyLoop" - -#define KEY_VI_MODE "ViMode" -#define KEY_VI_INTERP "ViInterpolation" -#define KEY_VI_WIDESCREEN "ViWidescreen" -#define KEY_VI_HIDE_OVERSCAN "ViHideOverscan" -#define KEY_VI_INTEGER_SCALING "ViIntegerScaling" - -#define KEY_DP_COMPAT "DpCompat" - -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -#include "gfx_m64p.h" - -#include "api/m64p_types.h" -#include "api/m64p_config.h" - -#include "core/common.h" -#include "core/version.h" -#include "core/msg.h" - -#include "output/screen.h" -#include "output/vdac.h" - -static ptr_ConfigOpenSection ConfigOpenSection = NULL; -static ptr_ConfigSaveSection ConfigSaveSection = NULL; -static ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL; -static ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL; -static ptr_ConfigGetParamInt ConfigGetParamInt = NULL; -static ptr_ConfigGetParamBool ConfigGetParamBool = NULL; -static ptr_PluginGetVersion CoreGetVersion = NULL; - -static bool warn_hle; -static bool plugin_initialized; -void (*debug_callback)(void *, int, const char *); -void *debug_call_context; -static struct n64video_config config; - -m64p_dynlib_handle CoreLibHandle; -GFX_INFO gfx; -void (*render_callback)(int); - -static m64p_handle configVideoGeneral = NULL; -static m64p_handle configVideoAngrylionPlus = NULL; - -#define PLUGIN_VERSION 0x000100 -#define VIDEO_PLUGIN_API_VERSION 0x020200 - -extern int32_t win_width; -extern int32_t win_height; -extern int32_t win_fullscreen; - -EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle _CoreLibHandle, void *Context, - void (*DebugCallback)(void *, int, const char *)) -{ - if (plugin_initialized) { - return M64ERR_ALREADY_INIT; - } - - /* first thing is to set the callback function for debug info */ - debug_callback = DebugCallback; - debug_call_context = Context; - - CoreLibHandle = _CoreLibHandle; - - ConfigOpenSection = (ptr_ConfigOpenSection)DLSYM(CoreLibHandle, "ConfigOpenSection"); - ConfigSaveSection = (ptr_ConfigSaveSection)DLSYM(CoreLibHandle, "ConfigSaveSection"); - ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt)DLSYM(CoreLibHandle, "ConfigSetDefaultInt"); - ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool)DLSYM(CoreLibHandle, "ConfigSetDefaultBool"); - ConfigGetParamInt = (ptr_ConfigGetParamInt)DLSYM(CoreLibHandle, "ConfigGetParamInt"); - ConfigGetParamBool = (ptr_ConfigGetParamBool)DLSYM(CoreLibHandle, "ConfigGetParamBool"); - - ConfigOpenSection("Video-General", &configVideoGeneral); - ConfigOpenSection("Video-Angrylion-Plus", &configVideoAngrylionPlus); - - ConfigSetDefaultBool(configVideoGeneral, KEY_FULLSCREEN, 0, "Use fullscreen mode if True, or windowed mode if False"); - ConfigSetDefaultInt(configVideoGeneral, KEY_SCREEN_WIDTH, 640, "Width of output window or fullscreen width"); - ConfigSetDefaultInt(configVideoGeneral, KEY_SCREEN_HEIGHT, 480, "Height of output window or fullscreen height"); - - CoreGetVersion = (ptr_PluginGetVersion)DLSYM(CoreLibHandle, "PluginGetVersion"); - - n64video_config_init(&config); - - ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_PARALLEL, config.parallel, "Distribute rendering between multiple processors if True"); - ConfigSetDefaultInt(configVideoAngrylionPlus, KEY_NUM_WORKERS, config.num_workers, "Rendering Workers (0=Use all logical processors)"); - ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_BUSY_LOOP, config.busyloop, "Use a busyloop while waiting for work"); - ConfigSetDefaultInt(configVideoAngrylionPlus, KEY_VI_MODE, config.vi.mode, "VI mode (0=Filtered, 1=Unfiltered, 2=Depth, 3=Coverage)"); - ConfigSetDefaultInt(configVideoAngrylionPlus, KEY_VI_INTERP, config.vi.interp, "Scaling interpolation type (0=NN, 1=Linear)"); - ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_WIDESCREEN, config.vi.widescreen, "Use anamorphic 16:9 output mode if True"); - ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_HIDE_OVERSCAN, config.vi.hide_overscan, "Hide overscan area in filteded mode if True"); - ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_INTEGER_SCALING, config.vi.integer_scaling, "Display upscaled pixels as groups of 1x1, 2x2, 3x3, etc. if True"); - ConfigSetDefaultInt(configVideoAngrylionPlus, KEY_DP_COMPAT, config.dp.compat, "Compatibility mode (0=Fast 1=Moderate 2=Slow"); - - ConfigSaveSection("Video-General"); - ConfigSaveSection("Video-Angrylion-Plus"); - - plugin_initialized = true; - return M64ERR_SUCCESS; -} - -EXPORT m64p_error CALL PluginShutdown(void) -{ - if (!plugin_initialized) { - return M64ERR_NOT_INIT; - } - - /* reset some local variable */ - debug_callback = NULL; - debug_call_context = NULL; - - plugin_initialized = false; - return M64ERR_SUCCESS; -} - -EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, int *APIVersion, const char **PluginNamePtr, int *Capabilities) -{ - /* set version info */ - if (PluginType != NULL) { - *PluginType = M64PLUGIN_GFX; - } - - if (PluginVersion != NULL) { - *PluginVersion = PLUGIN_VERSION; - } - - if (APIVersion != NULL) { - *APIVersion = VIDEO_PLUGIN_API_VERSION; - } - - if (PluginNamePtr != NULL) { - *PluginNamePtr = CORE_NAME; - } - - if (Capabilities != NULL) { - *Capabilities = 0; - } - - return M64ERR_SUCCESS; -} - -EXPORT int CALL InitiateGFX (GFX_INFO Gfx_Info) -{ - gfx = Gfx_Info; - - return 1; -} - -EXPORT void CALL MoveScreen (int xpos, int ypos) -{ - UNUSED(xpos); - UNUSED(ypos); -} - -EXPORT void CALL ProcessDList(void) -{ - if (!warn_hle) { - msg_warning("HLE video emulation not supported, please use a LLE RSP plugin like mupen64plus-rsp-cxd4"); - warn_hle = true; - } -} - -EXPORT void CALL ProcessRDPList(void) -{ - n64video_process_list(); -} - -EXPORT int CALL RomOpen (void) -{ - win_fullscreen = ConfigGetParamBool(configVideoGeneral, KEY_FULLSCREEN); - win_width = ConfigGetParamInt(configVideoGeneral, KEY_SCREEN_WIDTH); - win_height = ConfigGetParamInt(configVideoGeneral, KEY_SCREEN_HEIGHT); - - config.parallel = ConfigGetParamBool(configVideoAngrylionPlus, KEY_PARALLEL); - config.num_workers = ConfigGetParamInt(configVideoAngrylionPlus, KEY_NUM_WORKERS); - config.busyloop = ConfigGetParamBool(configVideoAngrylionPlus, KEY_BUSY_LOOP); - config.vi.mode = ConfigGetParamInt(configVideoAngrylionPlus, KEY_VI_MODE); - config.vi.interp = ConfigGetParamInt(configVideoAngrylionPlus, KEY_VI_INTERP); - config.vi.widescreen = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_WIDESCREEN); - config.vi.hide_overscan = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_HIDE_OVERSCAN); - config.vi.integer_scaling = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_INTEGER_SCALING); - - config.dp.compat = ConfigGetParamInt(configVideoAngrylionPlus, KEY_DP_COMPAT); - - config.gfx.rdram = gfx.RDRAM; - - int core_version; - CoreGetVersion(NULL, &core_version, NULL, NULL, NULL); - if (core_version >= 0x020501) { - config.gfx.rdram_size = *gfx.RDRAM_SIZE; - } else { - config.gfx.rdram_size = RDRAM_MAX_SIZE; - } - - config.gfx.dmem = gfx.DMEM; - config.gfx.mi_intr_reg = (uint32_t*)gfx.MI_INTR_REG; - config.gfx.mi_intr_cb = gfx.CheckInterrupts; - - config.gfx.vi_reg = (uint32_t**)&gfx.VI_STATUS_REG; - config.gfx.dp_reg = (uint32_t**)&gfx.DPC_START_REG; - - n64video_init(&config); - vdac_init(&config); - - return 1; -} - -EXPORT void CALL RomClosed (void) -{ - vdac_close(); - n64video_close(); -} - -EXPORT void CALL ShowCFB (void) -{ -} - -EXPORT void CALL UpdateScreen (void) -{ - struct n64video_frame_buffer fb; - n64video_update_screen(&fb); - - if (fb.valid) { - vdac_write(&fb); - } - - vdac_sync(fb.valid); -} - -EXPORT void CALL ViStatusChanged (void) -{ -} - -EXPORT void CALL ViWidthChanged (void) -{ -} - -EXPORT void CALL ChangeWindow(void) -{ - screen_toggle_fullscreen(); -} - -EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front) -{ - UNUSED(front); - - struct n64video_frame_buffer fb = { 0 }; - fb.pixels = dest; - vdac_read(&fb, false); - - *width = fb.width; - *height = fb.height; -} - -EXPORT void CALL SetRenderingCallback(void (*callback)(int)) -{ - render_callback = callback; -} - -EXPORT void CALL ResizeVideoOutput(int width, int height) -{ - win_width = width; - win_height = height; -} - -EXPORT void CALL FBWrite(unsigned int addr, unsigned int size) -{ - UNUSED(addr); - UNUSED(size); -} - -EXPORT void CALL FBRead(unsigned int addr) -{ - UNUSED(addr); -} - -EXPORT void CALL FBGetFrameBufferInfo(void *pinfo) -{ - UNUSED(pinfo); -} diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/gfx_m64p.h b/angrylion-rdp-plus/src/plugin/mupen64plus/gfx_m64p.h deleted file mode 100644 index 6dbdd3c..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/gfx_m64p.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "core/n64video.h" -#include "api/m64p_plugin.h" -#include "api/m64p_common.h" - -#ifdef _WIN32 -#define DLSYM(a, b) GetProcAddress(a, b) -#else -#include <dlfcn.h> -#define DLSYM(a, b) dlsym(a, b) -#endif - -extern GFX_INFO gfx; -extern m64p_dynlib_handle CoreLibHandle; -extern void(*render_callback)(int); -extern void (*debug_callback)(void *, int, const char *); -extern void *debug_call_context; diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/msg.c b/angrylion-rdp-plus/src/plugin/mupen64plus/msg.c deleted file mode 100644 index 0f87fdc..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/msg.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "core/msg.h" -#include "core/version.h" -#include "gfx_m64p.h" - -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> - -#define MSG_BUFFER_LEN 256 - -void msg_error(const char * err, ...) -{ - if (debug_callback == NULL) - return; - - va_list arg; - va_start(arg, err); - char buf[MSG_BUFFER_LEN]; - vsprintf(buf, err, arg); - - (*debug_callback)(debug_call_context, M64MSG_ERROR, buf); - - va_end(arg); - exit(0); -} - -void msg_warning(const char* err, ...) -{ - if (debug_callback == NULL) - return; - - va_list arg; - va_start(arg, err); - char buf[MSG_BUFFER_LEN]; - vsprintf(buf, err, arg); - - (*debug_callback)(debug_call_context, M64MSG_WARNING, buf); - - va_end(arg); -} - -void msg_debug(const char* err, ...) -{ - if (debug_callback == NULL) - return; - - va_list arg; - va_start(arg, err); - char buf[MSG_BUFFER_LEN]; - vsprintf(buf, err, arg); - - (*debug_callback)(debug_call_context, M64MSG_VERBOSE, buf); - - va_end(arg); -} diff --git a/angrylion-rdp-plus/src/plugin/mupen64plus/screen.c b/angrylion-rdp-plus/src/plugin/mupen64plus/screen.c deleted file mode 100644 index b09493e..0000000 --- a/angrylion-rdp-plus/src/plugin/mupen64plus/screen.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "gfx_m64p.h" -#include "api/m64p_vidext.h" - -#include "core/common.h" -#include "core/msg.h" - -#include "output/screen.h" - -#include <stdlib.h> - -/* definitions of pointers to Core video extension functions */ -static ptr_VidExt_Init CoreVideo_Init = NULL; -static ptr_VidExt_Quit CoreVideo_Quit = NULL; -static ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = NULL; -static ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL; -static ptr_VidExt_SetCaption CoreVideo_SetCaption = NULL; -static ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = NULL; -static ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL; -static ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = NULL; -static ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL; -static ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL; -static ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL; - -// framebuffer texture states -int32_t win_width; -int32_t win_height; -int32_t win_fullscreen; - -void* IntGetProcAddress(const char *name) -{ - return CoreVideo_GL_GetProcAddress(name); -} - -void screen_init(struct n64video_config* config) -{ - UNUSED(config); - - /* Get the core Video Extension function pointers from the library handle */ - CoreVideo_Init = (ptr_VidExt_Init) DLSYM(CoreLibHandle, "VidExt_Init"); - CoreVideo_Quit = (ptr_VidExt_Quit) DLSYM(CoreLibHandle, "VidExt_Quit"); - CoreVideo_ListFullscreenModes = (ptr_VidExt_ListFullscreenModes) DLSYM(CoreLibHandle, "VidExt_ListFullscreenModes"); - CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode) DLSYM(CoreLibHandle, "VidExt_SetVideoMode"); - CoreVideo_SetCaption = (ptr_VidExt_SetCaption) DLSYM(CoreLibHandle, "VidExt_SetCaption"); - CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen) DLSYM(CoreLibHandle, "VidExt_ToggleFullScreen"); - CoreVideo_ResizeWindow = (ptr_VidExt_ResizeWindow) DLSYM(CoreLibHandle, "VidExt_ResizeWindow"); - CoreVideo_GL_GetProcAddress = (ptr_VidExt_GL_GetProcAddress) DLSYM(CoreLibHandle, "VidExt_GL_GetProcAddress"); - CoreVideo_GL_SetAttribute = (ptr_VidExt_GL_SetAttribute) DLSYM(CoreLibHandle, "VidExt_GL_SetAttribute"); - CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) DLSYM(CoreLibHandle, "VidExt_GL_GetAttribute"); - CoreVideo_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) DLSYM(CoreLibHandle, "VidExt_GL_SwapBuffers"); - - CoreVideo_Init(); - -#ifndef GLES - CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_PROFILE_MASK, M64P_GL_CONTEXT_PROFILE_CORE); - CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3); - CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 3); -#else - CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_PROFILE_MASK, M64P_GL_CONTEXT_PROFILE_ES); - CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3); - CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 0); -#endif - - CoreVideo_SetVideoMode(win_width, win_height, 0, win_fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, M64VIDEOFLAG_SUPPORT_RESIZING); -} - -void screen_adjust(int32_t width_out, int32_t height_out, int32_t* width, int32_t* height, int32_t* x, int32_t* y) -{ - UNUSED(width_out); - UNUSED(height_out); - - *width = win_width; - *height = win_height; - *x = 0; - *y = 0; -} - -void screen_update(void) -{ - (*render_callback)(1); - CoreVideo_GL_SwapBuffers(); -} - -void screen_toggle_fullscreen(void) -{ - CoreVideo_ToggleFullScreen(); -} - -void screen_close(void) -{ - CoreVideo_Quit(); -} diff --git a/angrylion-rdp-plus/src/plugin/zilmar/config.c b/angrylion-rdp-plus/src/plugin/zilmar/config.c deleted file mode 100644 index 5733987..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/config.c +++ /dev/null @@ -1,341 +0,0 @@ -#include "config.h" -#include "resource.h" - -#include "core/common.h" -#include "core/version.h" -#include "core/n64video.h" -#include "output/screen.h" -#include "output/vdac.h" - -#include <Commctrl.h> -#include <Shlwapi.h> - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define SECTION_GENERAL "General" -#define SECTION_VIDEO_INTERFACE "VideoInterface" -#define SECTION_DISPLAY_PROCESSOR "DisplayProcessor" - -#define KEY_GEN_PARALLEL "parallel" -#define KEY_GEN_NUM_WORKERS "num_workers" - -#define KEY_VI_MODE "mode" -#define KEY_VI_INTERP "interpolation" -#define KEY_VI_WIDESCREEN "widescreen" -#define KEY_VI_HIDE_OVERSCAN "hide_overscan" -#define KEY_VI_EXCLUSIVE "exclusive" -#define KEY_VI_VSYNC "vsync" - -#define KEY_DP_COMPAT "compat" - -#define CONFIG_FILE_NAME CORE_SIMPLE_NAME "-config.ini" - -#define CONFIG_DLG_INIT_CHECKBOX(id, var, config) \ - var = GetDlgItem(hwnd, id); \ - SendMessage(var, BM_SETCHECK, (WPARAM)config, 0); - -static HINSTANCE inst; -static struct n64video_config config; -static bool config_stale; -static char config_path[MAX_PATH + 1]; - -static HWND dlg_combo_vi_mode; -static HWND dlg_combo_vi_interp; -static HWND dlg_check_trace; -static HWND dlg_check_multithread; -static HWND dlg_check_vi_widescreen; -static HWND dlg_check_vi_overscan; -static HWND dlg_check_vi_exclusive; -static HWND dlg_check_vi_vsync; -static HWND dlg_check_vi_integer_scaling; -static HWND dlg_combo_dp_compat; -static HWND dlg_spin_workers; -static HWND dlg_edit_workers; - -static void config_dialog_update_multithread(void) -{ - BOOL check = (BOOL)SendMessage(dlg_check_multithread, BM_GETCHECK, 0, 0); - EnableWindow(dlg_spin_workers, check); - EnableWindow(dlg_edit_workers, check); - EnableWindow(dlg_combo_dp_compat, check); -} - -static void config_dialog_update_vi_mode(void) -{ - LRESULT sel = SendMessage(dlg_combo_vi_mode, CB_GETCURSEL, 0, 0); - EnableWindow(dlg_check_vi_overscan, sel == VI_MODE_NORMAL); -} - -static void config_dialog_fill_combo(HWND dialog, char** entries, size_t num_entries, uint32_t selected) -{ - SendMessage(dialog, CB_RESETCONTENT, 0, 0); - for (size_t i = 0; i < num_entries; i++) { - SendMessage(dialog, CB_ADDSTRING, i, (LPARAM)entries[i]); - } - SendMessage(dialog, CB_SETCURSEL, (WPARAM)selected, 0); -} - -INT_PTR CALLBACK config_dialog_proc(HWND hwnd, UINT iMessage, WPARAM wParam, LPARAM lParam) -{ - UNUSED(lParam); - - switch (iMessage) { - case WM_INITDIALOG: { - SetWindowText(hwnd, CORE_BASE_NAME " Config"); - - config_load(); - - char* vi_mode_strings[] = { - "Filtered", // VI_MODE_NORMAL - "Unfiltered", // VI_MODE_COLOR - "Depth", // VI_MODE_DEPTH - "Coverage" // VI_MODE_COVERAGE - }; - - dlg_combo_vi_mode = GetDlgItem(hwnd, IDC_COMBO_VI_MODE); - config_dialog_fill_combo(dlg_combo_vi_mode, vi_mode_strings, VI_MODE_NUM, config.vi.mode); - - char* vi_interp_strings[] = { - "Blocky (nearest-neightbor)", // VI_INTERP_NEAREST - "Blurry (bilinear)", // VI_INTERP_LINEAR - "Soft (bilinear + NN)" // VI_INTERP_HYBRID - }; - - dlg_combo_vi_interp = GetDlgItem(hwnd, IDC_COMBO_VI_INTERP); - config_dialog_fill_combo(dlg_combo_vi_interp, vi_interp_strings, VI_INTERP_NUM, config.vi.interp); - - char* dp_compat_strings[] = { - "Fast, most glitches", // DP_COMPAT_LOW - "Moderate, some glitches", // DP_COMPAT_MEDIUM - "Slow, few glitches" // DP_COMPAT_HIGH - }; - - dlg_combo_dp_compat = GetDlgItem(hwnd, IDC_COMBO_DP_COMPAT); - config_dialog_fill_combo(dlg_combo_dp_compat, dp_compat_strings, DP_COMPAT_NUM, config.dp.compat); - - CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_MULTITHREAD, dlg_check_multithread, config.parallel); - CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_WIDESCREEN, dlg_check_vi_widescreen, config.vi.widescreen); - CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_OVERSCAN, dlg_check_vi_overscan, config.vi.hide_overscan); - CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_EXCLUSIVE, dlg_check_vi_exclusive, config.vi.exclusive); - CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_VSYNC, dlg_check_vi_vsync, config.vi.vsync); - CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_INTEGER_SCALING, dlg_check_vi_integer_scaling, config.vi.integer_scaling); - - dlg_edit_workers = GetDlgItem(hwnd, IDC_EDIT_WORKERS); - SetDlgItemInt(hwnd, IDC_EDIT_WORKERS, config.num_workers, FALSE); - - dlg_spin_workers = GetDlgItem(hwnd, IDC_SPIN_WORKERS); - SendMessage(dlg_spin_workers, UDM_SETRANGE, 0, MAKELPARAM(128, 0)); - - // update enabled/disabled state - config_dialog_update_multithread(); - config_dialog_update_vi_mode(); - - break; - } - case WM_COMMAND: { - WORD cmdid = LOWORD(wParam); - switch (cmdid) { - // disable or enable multithreading options when the checkbox is - // checked or unchecked - case IDC_CHECK_MULTITHREAD: - config_dialog_update_multithread(); - break; - - // disable overscan option if a non-compatible mode is selected - case IDC_COMBO_VI_MODE: - switch (HIWORD(wParam)) { - case CBN_SELCHANGE: - config_dialog_update_vi_mode(); - break; - } - break; - - // button events - case IDOK: - case IDAPPLY: - config.vi.mode = SendMessage(dlg_combo_vi_mode, CB_GETCURSEL, 0, 0); - config.vi.interp = SendMessage(dlg_combo_vi_interp, CB_GETCURSEL, 0, 0); - config.vi.widescreen = SendMessage(dlg_check_vi_widescreen, BM_GETCHECK, 0, 0); - config.vi.hide_overscan = SendMessage(dlg_check_vi_overscan, BM_GETCHECK, 0, 0); - config.vi.exclusive = SendMessage(dlg_check_vi_exclusive, BM_GETCHECK, 0, 0); - config.vi.vsync = SendMessage(dlg_check_vi_vsync, BM_GETCHECK, 0, 0); - config.vi.integer_scaling = SendMessage(dlg_check_vi_integer_scaling, BM_GETCHECK, 0, 0); - config.dp.compat = SendMessage(dlg_combo_dp_compat, CB_GETCURSEL, 0, 0); - config.parallel = SendMessage(dlg_check_multithread, BM_GETCHECK, 0, 0); - config.num_workers = GetDlgItemInt(hwnd, IDC_EDIT_WORKERS, FALSE, FALSE); - config_stale = true; - config_save(); - - // don't close dialog if "Apply" was pressed - if (cmdid == IDAPPLY) { - break; - } - case IDCANCEL: - EndDialog(hwnd, 0); - break; - } - break; - } - default: - return FALSE; - } - return TRUE; -} - -static void config_handle(const char* key, const char* value, const char* section) -{ - if (!_strcmpi(section, SECTION_GENERAL)) { - if (!_strcmpi(key, KEY_GEN_PARALLEL)) { - config.parallel = strtol(value, NULL, 0) != 0; - } - if (!_strcmpi(key, KEY_GEN_NUM_WORKERS)) { - config.num_workers = strtoul(value, NULL, 0); - } - } else if (!_strcmpi(section, SECTION_VIDEO_INTERFACE)) { - if (!_strcmpi(key, KEY_VI_MODE)) { - config.vi.mode = strtol(value, NULL, 0); - } else if (!_strcmpi(key, KEY_VI_INTERP)) { - config.vi.interp = strtol(value, NULL, 0); - } else if (!_strcmpi(key, KEY_VI_WIDESCREEN)) { - config.vi.widescreen = strtol(value, NULL, 0) != 0; - } else if (!_strcmpi(key, KEY_VI_HIDE_OVERSCAN)) { - config.vi.hide_overscan = strtol(value, NULL, 0) != 0; - } else if (!_strcmpi(key, KEY_VI_EXCLUSIVE)) { - config.vi.exclusive = strtol(value, NULL, 0) != 0; - } else if (!_strcmpi(key, KEY_VI_VSYNC)) { - config.vi.vsync = strtol(value, NULL, 0) != 0; - } - } else if (!_strcmpi(section, SECTION_DISPLAY_PROCESSOR)) { - if (!_strcmpi(key, KEY_DP_COMPAT)) { - config.dp.compat = strtol(value, NULL, 0); - } - } -} - -void config_init(HINSTANCE hInst) -{ - inst = hInst; - config_path[0] = 0; - - // create path to config file relative to the DLL path - GetModuleFileName(inst, config_path, sizeof(config_path)); - PathRemoveFileSpec(config_path); - PathAppend(config_path, CONFIG_FILE_NAME); - - // load default config - n64video_config_init(&config); -} - -void config_dialog(HWND hParent) -{ - DialogBox(inst, MAKEINTRESOURCE(IDD_DIALOG1), hParent, config_dialog_proc); -} - -struct n64video_config* config_get(void) -{ - return &config; -} - -bool config_load() -{ - FILE* fp = fopen(config_path, "r"); - if (!fp) { - return false; - } - - char line[128]; - char section[128]; - while (fgets(line, sizeof(line), fp) != NULL) { - // remove newline characters - size_t trim_pos = strcspn(line, "\r\n"); - line[trim_pos] = 0; - - // ignore blank lines - size_t len = strlen(line); - if (!len) { - continue; - } - - // key-values - char* eq_ptr = strchr(line, '='); - if (eq_ptr) { - *eq_ptr = 0; - char* key = line; - char* value = eq_ptr + 1; - config_handle(key, value, section); - continue; - } - - // sections - if (line[0] == '[' && line[len - 1] == ']') { - section[0] = 0; - strncat(section, line + 1, len - 2); - continue; - } - } - - fclose(fp); - - return true; -} - -static void config_write_section(FILE* fp, const char* section) -{ - fprintf(fp, "[%s]\n", section); -} - -static void config_write_uint32(FILE* fp, const char* key, uint32_t value) -{ - fprintf(fp, "%s=%u\n", key, value); -} - -static void config_write_int32(FILE* fp, const char* key, int32_t value) -{ - fprintf(fp, "%s=%d\n", key, value); -} - -bool config_save(void) -{ - FILE* fp = fopen(config_path, "w"); - if (!fp) { - return false; - } - - config_write_section(fp, SECTION_GENERAL); - config_write_int32(fp, KEY_GEN_PARALLEL, config.parallel); - config_write_uint32(fp, KEY_GEN_NUM_WORKERS, config.num_workers); - fputs("\n", fp); - - config_write_section(fp, SECTION_VIDEO_INTERFACE); - config_write_int32(fp, KEY_VI_MODE, config.vi.mode); - config_write_int32(fp, KEY_VI_INTERP, config.vi.interp); - config_write_int32(fp, KEY_VI_WIDESCREEN, config.vi.widescreen); - config_write_int32(fp, KEY_VI_HIDE_OVERSCAN, config.vi.hide_overscan); - config_write_int32(fp, KEY_VI_EXCLUSIVE, config.vi.exclusive); - config_write_int32(fp, KEY_VI_VSYNC, config.vi.vsync); - fputs("\n", fp); - - config_write_section(fp, SECTION_DISPLAY_PROCESSOR); - config_write_int32(fp, KEY_DP_COMPAT, config.dp.compat); - - fclose(fp); - - return true; -} - -void config_update(void) -{ - if (config_stale) { - vdac_close(); - screen_close(); - n64video_close(); - - n64video_init(&config); - screen_init(&config); - vdac_init(&config); - - config_stale = false; - } -} diff --git a/angrylion-rdp-plus/src/plugin/zilmar/config.h b/angrylion-rdp-plus/src/plugin/zilmar/config.h deleted file mode 100644 index ca95849..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/config.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "core/n64video.h" - -#include <Windows.h> - -void config_init(HINSTANCE hInst); -void config_dialog(HWND hParent); -struct n64video_config* config_get(void); -bool config_load(void); -bool config_save(void); -void config_update(void); diff --git a/angrylion-rdp-plus/src/plugin/zilmar/config.rc b/angrylion-rdp-plus/src/plugin/zilmar/config.rc deleted file mode 100644 index 7575c1b..0000000 Binary files a/angrylion-rdp-plus/src/plugin/zilmar/config.rc and /dev/null differ diff --git a/angrylion-rdp-plus/src/plugin/zilmar/gfx_1.3.c b/angrylion-rdp-plus/src/plugin/zilmar/gfx_1.3.c deleted file mode 100644 index 82e0f86..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/gfx_1.3.c +++ /dev/null @@ -1,337 +0,0 @@ -#include "gfx_1.3.h" -#include "config.h" -#include "resource.h" - -#include "core/common.h" -#include "core/n64video.h" -#include "core/version.h" -#include "core/msg.h" - -#include "output/screen.h" -#include "output/vdac.h" - -#include <stdio.h> -#include <ctype.h> - -GFX_INFO gfx; -static bool m_warn_hle; -static char m_screenshot_path[MAX_PATH]; - -static bool is_valid_ptr(void *ptr, uint32_t bytes) -{ - SIZE_T dwSize; - MEMORY_BASIC_INFORMATION meminfo; - if (!ptr) { - return false; - } - memset(&meminfo, 0x00, sizeof(meminfo)); - dwSize = VirtualQuery(ptr, &meminfo, sizeof(meminfo)); - if (!dwSize) { - return false; - } - if (MEM_COMMIT != meminfo.State) { - return false; - } - if (!(meminfo.Protect & (PAGE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY))) { - return false; - } - if (bytes > meminfo.RegionSize) { - return false; - } - if ((uint64_t)((char*)ptr - (char*)meminfo.BaseAddress) > (uint64_t)(meminfo.RegionSize - bytes)) { - return false; - } - return true; -} - -static char filter_char(char c) -{ - // only allow valid ASCII chars - if (c & 0x80) { - return ' '; - } - - // only allow certain ASCII chars - if (!isalnum(c) && c != '_' && c != '-') { - return ' '; - } - - return c; -} - -static char* get_rom_name(void) -{ - static char rom_name[128]; - - // copy game name from ROM header, which is encoded in Shift_JIS. - // most games just use the ASCII subset, so filter out the rest. - // TODO: convert Shift_JIS string to UTF-16 for Win32 API? - int i = 0; - for (; i < 20; i++) { - rom_name[i] = filter_char(gfx.HEADER[(32 + i) ^ BYTE_ADDR_XOR]); - } - - // make sure there's at least one whitespace that will terminate the string - // below - rom_name[i] = ' '; - - // trim trailing whitespaces - for (; i > 0; i--) { - if (rom_name[i] != ' ') { - i++; - break; - } - } - - if (i == 0) { - // game title is empty or invalid, use safe fallback using the - // four-character game ID - for (; i < 4; i++) { - rom_name[i] = filter_char(gfx.HEADER[(59 + i) ^ BYTE_ADDR_XOR]); - } - } - - // terminate string - rom_name[i] = '\0'; - - return rom_name; -} - -static void mi_intr(void) -{ - gfx.CheckInterrupts(); - config_update(); -} - -static void write_screenshot(char* path) -{ - struct n64video_frame_buffer fb = { 0 }; - vdac_read(&fb, true); - - // prepare bitmap headers - BITMAPINFOHEADER ihdr = {0}; - ihdr.biSize = sizeof(ihdr); - ihdr.biWidth = fb.width; - ihdr.biHeight = fb.height; - ihdr.biPlanes = 1; - ihdr.biBitCount = 32; - ihdr.biSizeImage = fb.width * fb.height * sizeof(int32_t); - - BITMAPFILEHEADER fhdr = {0}; - fhdr.bfType = 'B' | ('M' << 8); - fhdr.bfOffBits = sizeof(fhdr) + sizeof(ihdr) + 10; - fhdr.bfSize = ihdr.biSizeImage + fhdr.bfOffBits; - - FILE* fp = fopen(path, "wb"); - - if (!fp) { - msg_warning("Can't open screenshot file %s!", path); - return; - } - - // write bitmap headers - fwrite(&fhdr, sizeof(fhdr), 1, fp); - fwrite(&ihdr, sizeof(ihdr), 1, fp); - - // write bitmap contents - fseek(fp, fhdr.bfOffBits, SEEK_SET); - - fb.pixels = malloc(ihdr.biSizeImage); - vdac_read(&fb, true); - - // convert RGBA to BGRA - for (uint32_t i = 0; i < fb.width * fb.height; i++) { - struct n64video_pixel* pixel = &fb.pixels[i]; - uint8_t tmp = pixel->r; - pixel->r = pixel->b; - pixel->b = tmp; - } - - fwrite(fb.pixels, ihdr.biSizeImage, 1, fp); - free(fb.pixels); - - fclose(fp); -} - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - UNUSED(lpvReserved); - switch (fdwReason) { - case DLL_PROCESS_ATTACH: - config_init(hinstDLL); - break; - } - return TRUE; -} - -EXPORT void CALL CaptureScreen(char* directory) -{ - char* rom_name = get_rom_name(); - - for (int32_t i = 0; i < 10000; i++) { - sprintf(m_screenshot_path, "%s\\%s_%04d.bmp", directory, rom_name, i); - DWORD dwAttrib = GetFileAttributes(m_screenshot_path); - if (dwAttrib == INVALID_FILE_ATTRIBUTES || (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) { - break; - } - } -} - -EXPORT void CALL ChangeWindow(void) -{ - screen_toggle_fullscreen(); -} - -EXPORT void CALL CloseDLL(void) -{ -} - -EXPORT void CALL DllAbout(HWND hParent) -{ - UNUSED(hParent); - - msg_warning( - CORE_NAME "\n\n" - "Branch: " GIT_BRANCH "\n" - "Commit hash: " GIT_COMMIT_HASH "\n" - "Commit date: " GIT_COMMIT_DATE "\n" - "Build date: " __DATE__ " " __TIME__ "\n\n" - "https://github.com/ata4/angrylion-rdp-plus" - ); -} - -EXPORT void CALL DllConfig(HWND hParent) -{ - config_dialog(hParent); -} - -EXPORT void CALL ReadScreen(void **dest, long *width, long *height) -{ - UNUSED(dest); - UNUSED(width); - UNUSED(height); -} - -EXPORT void CALL DrawScreen(void) -{ -} - -EXPORT void CALL GetDllInfo(PLUGIN_INFO* PluginInfo) -{ - PluginInfo->Version = 0x0103; - PluginInfo->Type = PLUGIN_TYPE_GFX; - sprintf(PluginInfo->Name, CORE_NAME); - - PluginInfo->NormalMemory = TRUE; - PluginInfo->MemoryBswaped = TRUE; -} - -EXPORT BOOL CALL InitiateGFX(GFX_INFO Gfx_Info) -{ - gfx = Gfx_Info; - - return TRUE; -} - -EXPORT void CALL MoveScreen(int xpos, int ypos) -{ - UNUSED(xpos); - UNUSED(ypos); -} - -EXPORT void CALL ProcessDList(void) -{ - if (!m_warn_hle) { - msg_warning("Please disable 'Graphic HLE' in the plugin settings."); - m_warn_hle = true; - } -} - -EXPORT void CALL ProcessRDPList(void) -{ - n64video_process_list(); -} - -EXPORT void CALL RomClosed(void) -{ - vdac_close(); - n64video_close(); -} - -EXPORT void CALL RomOpen(void) -{ - config_load(); - struct n64video_config* config = config_get(); - - config->gfx.rdram = gfx.RDRAM; - config->gfx.rdram_size = RDRAM_MAX_SIZE; - - // Zilmar's API doesn't provide a way to check the amount of RDRAM available. - // It can only be 4 MiB or 8 MiB, so check if the last 16 bytes of the provided - // buffer in the 8 MiB range are valid. If not, it must be 4 MiB. - if (!is_valid_ptr(&gfx.RDRAM[0x7f0000], 16)) { - config->gfx.rdram_size /= 2; - } - - config->gfx.dmem = gfx.DMEM; - config->gfx.mi_intr_reg = (uint32_t*)gfx.MI_INTR_REG; - config->gfx.mi_intr_cb = mi_intr; - - config->gfx.vi_reg = (uint32_t**)&gfx.VI_STATUS_REG; - config->gfx.dp_reg = (uint32_t**)&gfx.DPC_START_REG; - - n64video_init(config); - vdac_init(config); -} - -EXPORT void CALL ShowCFB(void) -{ -} - -EXPORT void CALL UpdateScreen(void) -{ - struct n64video_frame_buffer fb; - n64video_update_screen(&fb); - - if (fb.valid) { - vdac_write(&fb); - } - - vdac_sync(fb.valid); - - // write screenshot file if requested - if (m_screenshot_path[0]) { - write_screenshot(m_screenshot_path); - m_screenshot_path[0] = 0; - } -} - -EXPORT void CALL ViStatusChanged(void) -{ -} - -EXPORT void CALL ViWidthChanged(void) -{ -} - -EXPORT void CALL FBWrite(DWORD addr, DWORD val) -{ - UNUSED(addr); - UNUSED(val); -} - -EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, DWORD size) -{ - UNUSED(plist); - UNUSED(size); -} - -EXPORT void CALL FBRead(DWORD addr) -{ - UNUSED(addr); -} - -EXPORT void CALL FBGetFrameBufferInfo(void *pinfo) -{ - UNUSED(pinfo); -} diff --git a/angrylion-rdp-plus/src/plugin/zilmar/gfx_1.3.h b/angrylion-rdp-plus/src/plugin/zilmar/gfx_1.3.h deleted file mode 100644 index dc6f20f..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/gfx_1.3.h +++ /dev/null @@ -1,342 +0,0 @@ -/********************************************************************************** -Common gfx plugin spec, version #1.3 maintained by zilmar (zilmar@emulation64.com) - -All questions or suggestions should go through the mailing list. -http://www.egroups.com/group/Plugin64-Dev -*********************************************************************************** - -Notes: ------- - -Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which -are both passed to the DLL in InitiateGFX will generate an Interrupt from with in -the plugin. - -The Setting of the RSP flags and generating an SP interrupt should not be done in -the plugin - -**********************************************************************************/ -#ifndef _GFX_H_INCLUDED__ -#define _GFX_H_INCLUDED__ - -#include <Windows.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -/* Plugin types */ -#define PLUGIN_TYPE_GFX 2 - -#define EXPORT __declspec(dllexport) -#define CALL _cdecl - -/***** Structures *****/ -typedef struct { - WORD Version; /* Set to 0x0103 */ - WORD Type; /* Set to PLUGIN_TYPE_GFX */ - char Name[100]; /* Name of the DLL */ - - /* If DLL supports memory these memory options then set them to TRUE or FALSE - if it does not support it */ - BOOL NormalMemory; /* a normal BYTE array */ - BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre - bswap on a dword (32 bits) boundry */ -} PLUGIN_INFO; - -typedef struct { - HWND hWnd; /* Render window */ - HWND hStatusBar; /* if render window does not have a status bar then this is NULL */ - - BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre - // bswap on a dword (32 bits) boundry - // eg. the first 8 bytes are stored like this: - // 4 3 2 1 8 7 6 5 - - BYTE * HEADER; // This is the rom header (first 40h bytes of the rom - // This will be in the same memory format as the rest of the memory. - BYTE * RDRAM; - BYTE * DMEM; - BYTE * IMEM; - - DWORD * MI_INTR_REG; - - DWORD * DPC_START_REG; - DWORD * DPC_END_REG; - DWORD * DPC_CURRENT_REG; - DWORD * DPC_STATUS_REG; - DWORD * DPC_CLOCK_REG; - DWORD * DPC_BUFBUSY_REG; - DWORD * DPC_PIPEBUSY_REG; - DWORD * DPC_TMEM_REG; - - DWORD * VI_STATUS_REG; - DWORD * VI_ORIGIN_REG; - DWORD * VI_WIDTH_REG; - DWORD * VI_INTR_REG; - DWORD * VI_V_CURRENT_LINE_REG; - DWORD * VI_TIMING_REG; - DWORD * VI_V_SYNC_REG; - DWORD * VI_H_SYNC_REG; - DWORD * VI_LEAP_REG; - DWORD * VI_H_START_REG; - DWORD * VI_V_START_REG; - DWORD * VI_V_BURST_REG; - DWORD * VI_X_SCALE_REG; - DWORD * VI_Y_SCALE_REG; - - void (*CheckInterrupts)( void ); -} GFX_INFO; - -/****************************************************************** - Function: CaptureScreen - Purpose: This function dumps the current frame to a file - input: pointer to the directory to save the file to - output: none -*******************************************************************/ -EXPORT void CALL CaptureScreen ( char * Directory ); - -/****************************************************************** - Function: ChangeWindow - Purpose: to change the window between fullscreen and window - mode. If the window was in fullscreen this should - change the screen to window mode and vice vesa. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ChangeWindow (void); - -/****************************************************************** - Function: CloseDLL - Purpose: This function is called when the emulator is closing - down allowing the dll to de-initialise. - input: none - output: none -*******************************************************************/ -EXPORT void CALL CloseDLL (void); - -/****************************************************************** - Function: DllAbout - Purpose: This function is optional function that is provided - to give further information about the DLL. - input: a handle to the window that calls this function - output: none -*******************************************************************/ -EXPORT void CALL DllAbout ( HWND hParent ); - -/****************************************************************** - Function: DllConfig - Purpose: This function is optional function that is provided - to allow the user to configure the dll - input: a handle to the window that calls this function - output: none -*******************************************************************/ -EXPORT void CALL DllConfig ( HWND hParent ); - -/****************************************************************** - Function: DllTest - Purpose: This function is optional function that is provided - to allow the user to test the dll - input: a handle to the window that calls this function - output: none -*******************************************************************/ -EXPORT void CALL DllTest ( HWND hParent ); - - -EXPORT void CALL ReadScreen(void **dest, long *width, long *height); - -/****************************************************************** - Function: DrawScreen - Purpose: This function is called when the emulator receives a - WM_PAINT message. This allows the gfx to fit in when - it is being used in the desktop. - input: none - output: none -*******************************************************************/ -EXPORT void CALL DrawScreen (void); - -/****************************************************************** - Function: GetDllInfo - Purpose: This function allows the emulator to gather information - about the dll by filling in the PluginInfo structure. - input: a pointer to a PLUGIN_INFO stucture that needs to be - filled by the function. (see def above) - output: none -*******************************************************************/ -EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ); - -/****************************************************************** - Function: InitiateGFX - Purpose: This function is called when the DLL is started to give - information from the emulator that the n64 graphics - uses. This is not called from the emulation thread. - Input: Gfx_Info is passed to this function which is defined - above. - Output: TRUE on success - FALSE on failure to initialise - - ** note on interrupts **: - To generate an interrupt set the appropriate bit in MI_INTR_REG - and then call the function CheckInterrupts to tell the emulator - that there is a waiting interrupt. -*******************************************************************/ -EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info); - -/****************************************************************** - Function: MoveScreen - Purpose: This function is called in response to the emulator - receiving a WM_MOVE passing the xpos and ypos passed - from that message. - input: xpos - the x-coordinate of the upper-left corner of the - client area of the window. - ypos - y-coordinate of the upper-left corner of the - client area of the window. - output: none -*******************************************************************/ -EXPORT void CALL MoveScreen (int xpos, int ypos); - -/****************************************************************** - Function: ProcessDList - Purpose: This function is called when there is a Dlist to be - processed. (High level GFX list) - input: none - output: none -*******************************************************************/ -EXPORT void CALL ProcessDList(void); - -/****************************************************************** - Function: ProcessRDPList - Purpose: This function is called when there is a Dlist to be - processed. (Low level GFX list) - input: none - output: none -*******************************************************************/ -EXPORT void CALL ProcessRDPList(void); - -/****************************************************************** - Function: RomClosed - Purpose: This function is called when a rom is closed. - input: none - output: none -*******************************************************************/ -EXPORT void CALL RomClosed (void); - -/****************************************************************** - Function: RomOpen - Purpose: This function is called when a rom is open. (from the - emulation thread) - input: none - output: none -*******************************************************************/ -EXPORT void CALL RomOpen (void); - -/****************************************************************** - Function: ShowCFB - Purpose: Useally once Dlists are started being displayed, cfb is - ignored. This function tells the dll to start displaying - them again. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ShowCFB (void); - -/****************************************************************** - Function: UpdateScreen - Purpose: This function is called in response to a vsync of the - screen were the VI bit in MI_INTR_REG has already been - set - input: none - output: none -*******************************************************************/ -EXPORT void CALL UpdateScreen (void); - -/****************************************************************** - Function: ViStatusChanged - Purpose: This function is called to notify the dll that the - ViStatus registers value has been changed. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ViStatusChanged (void); - -/****************************************************************** - Function: ViWidthChanged - Purpose: This function is called to notify the dll that the - ViWidth registers value has been changed. - input: none - output: none -*******************************************************************/ -EXPORT void CALL ViWidthChanged (void); - - -/****************************************************************** - Function: FrameBufferWrite - Purpose: This function is called to notify the dll that the - frame buffer has been modified by CPU at the given address. - input: addr rdram address - val val - size 1 = BYTE, 2 = WORD, 4 = DWORD - output: none -*******************************************************************/ -EXPORT void CALL FBWrite(DWORD, DWORD); - -typedef struct -{ - DWORD addr; - DWORD val; - DWORD size; // 1 = BYTE, 2 = WORD, 4=DWORD -} FrameBufferModifyEntry; - -/****************************************************************** - Function: FrameBufferWriteList - Purpose: This function is called to notify the dll that the - frame buffer has been modified by CPU at the given address. - input: FrameBufferModifyEntry *plist - size = size of the plist, max = 1024 - output: none -*******************************************************************/ -EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, DWORD size); - -/****************************************************************** - Function: FrameBufferRead - Purpose: This function is called to notify the dll that the - frame buffer memory is beening read at the given address. - DLL should copy content from its render buffer to the frame buffer - in N64 RDRAM - DLL is responsible to maintain its own frame buffer memory addr list - DLL should copy 4KB block content back to RDRAM frame buffer. - Emulator should not call this function again if other memory - is read within the same 4KB range - input: addr rdram address - val val - size 1 = BYTE, 2 = WORD, 4 = DWORD - output: none -*******************************************************************/ -EXPORT void CALL FBRead(DWORD addr); - -/************************************************************************ -Function: FBGetFrameBufferInfo -Purpose: This function is called by the emulator core to retrieve depth -buffer information from the video plugin in order to be able -to notify the video plugin about CPU depth buffer read/write -operations - -size: -= 1 byte -= 2 word (16 bit) <-- this is N64 default depth buffer format -= 4 dword (32 bit) - -when depth buffer information is not available yet, set all values -in the FrameBufferInfo structure to 0 - -input: FrameBufferInfo *pinfo -pinfo is pointed to a FrameBufferInfo structure which to be -filled in by this function -output: Values are return in the FrameBufferInfo structure -************************************************************************/ -EXPORT void CALL FBGetFrameBufferInfo(void *pinfo); - -#if defined(__cplusplus) -} -#endif -#endif //_GFX_H_INCLUDED__ diff --git a/angrylion-rdp-plus/src/plugin/zilmar/msg.c b/angrylion-rdp-plus/src/plugin/zilmar/msg.c deleted file mode 100644 index d1a4ea4..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/msg.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "core/msg.h" -#include "core/version.h" - -#include <Windows.h> - -#include <stdio.h> -#include <stdarg.h> - -#define MSG_BUFFER_LEN 256 - -void msg_error(const char * err, ...) -{ - va_list arg; - va_start(arg, err); - char buf[MSG_BUFFER_LEN]; - vsprintf_s(buf, sizeof(buf), err, arg); - MessageBoxA(0, buf, CORE_SIMPLE_NAME ": fatal error", MB_OK); - va_end(arg); - exit(0); -} - -void msg_warning(const char* err, ...) -{ - va_list arg; - va_start(arg, err); - char buf[MSG_BUFFER_LEN]; - vsprintf_s(buf, sizeof(buf), err, arg); - MessageBoxA(0, buf, CORE_SIMPLE_NAME ": warning", MB_OK); - va_end(arg); -} - -void msg_debug(const char* err, ...) -{ - va_list arg; - va_start(arg, err); - char buf[MSG_BUFFER_LEN]; - vsprintf_s(buf, sizeof(buf), err, arg); - strcat_s(buf, sizeof(buf), "\n"); - OutputDebugStringA(buf); - va_end(arg); -} diff --git a/angrylion-rdp-plus/src/plugin/zilmar/resource.h b/angrylion-rdp-plus/src/plugin/zilmar/resource.h deleted file mode 100644 index efeb47e..0000000 Binary files a/angrylion-rdp-plus/src/plugin/zilmar/resource.h and /dev/null differ diff --git a/angrylion-rdp-plus/src/plugin/zilmar/screen.c b/angrylion-rdp-plus/src/plugin/zilmar/screen.c deleted file mode 100644 index c18e8a5..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/screen.c +++ /dev/null @@ -1,305 +0,0 @@ -#include "gfx_1.3.h" - -#include "wgl_ext.h" - -#include "output/screen.h" -#include "output/gl_proc.h" -#include "core/common.h" -#include "core/msg.h" - -#include <stdlib.h> -#include <stdint.h> -#include <stdio.h> - -extern GFX_INFO gfx; - -// default size of the window -#define WINDOW_DEFAULT_WIDTH 640 -#define WINDOW_DEFAULT_HEIGHT 480 - -// previous size of the window -static int32_t m_win_width; -static int32_t m_win_height; - -// context states -static HDC m_dc; -static HGLRC m_glrc; -static HGLRC m_glrc_core; -static bool m_fullscreen; - -// config states -static bool m_exclusive; - -// Win32 helpers -void win32_client_resize(HWND hWnd, HWND hStatus, int32_t nWidth, int32_t nHeight) -{ - RECT rclient; - if (!GetClientRect(hWnd, &rclient)) { - return; - } - - RECT rwin; - if (!GetWindowRect(hWnd, &rwin)) { - return; - } - - RECT rstatus; - if (hStatus && GetClientRect(hStatus, &rstatus)) { - rclient.bottom -= rstatus.bottom; - } - - POINT pdiff; - pdiff.x = (rwin.right - rwin.left) - rclient.right; - pdiff.y = (rwin.bottom - rwin.top) - rclient.bottom; - - MoveWindow(hWnd, rwin.left, rwin.top, nWidth + pdiff.x, nHeight + pdiff.y, TRUE); -} - -static int TestPointer(const PROC pTest) -{ - if (!pTest) { - return 0; - } - - ptrdiff_t iTest = (ptrdiff_t)pTest; - - return iTest != 1 && iTest != 2 && iTest != 3 && iTest != -1; -} - -funcptr IntGetProcAddress(const char* name) -{ - PROC pFunc = wglGetProcAddress((LPCSTR)name); - if (TestPointer(pFunc)) { - return (funcptr)pFunc; - } - HMODULE glMod = GetModuleHandleA("OpenGL32.dll"); - if (glMod == NULL) { - return (funcptr)glMod; - } else { - return (funcptr)GetProcAddress(glMod, (LPCSTR)name); - } -} - -void screen_init(struct n64video_config* config) -{ - m_exclusive = config->vi.exclusive; - - // reset windowed size state - m_win_width = 0; - m_win_height = 0; - - // make window resizable for the user - if (!m_fullscreen) { - LONG style = GetWindowLong(gfx.hWnd, GWL_STYLE); - - if ((style & (WS_SIZEBOX | WS_MAXIMIZEBOX)) == 0) { - style |= WS_SIZEBOX | WS_MAXIMIZEBOX; - SetWindowLong(gfx.hWnd, GWL_STYLE, style); - - // Fix client size after changing the window style, otherwise the PJ64 - // menu will be displayed incorrectly. - // For some reason, this needs to be called twice, probably because the - // style set above isn't applied immediately. - for (int i = 0; i < 2; i++) { - win32_client_resize(gfx.hWnd, gfx.hStatusBar, WINDOW_DEFAULT_WIDTH, WINDOW_DEFAULT_HEIGHT); - } - } - } - - PIXELFORMATDESCRIPTOR win_pfd = { - sizeof(PIXELFORMATDESCRIPTOR), 1, - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, // Flags - PFD_TYPE_RGBA, // The kind of framebuffer. RGBA or palette. - 32, // Colordepth of the framebuffer. - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 24, // Number of bits for the depthbuffer - 8, // Number of bits for the stencilbuffer - 0, // Number of Aux buffers in the framebuffer. - PFD_MAIN_PLANE, 0, 0, 0, 0 - }; - - m_dc = GetDC(gfx.hWnd); - if (!m_dc) { - msg_error("Can't get device context."); - return; - } - - int32_t win_pf = ChoosePixelFormat(m_dc, &win_pfd); - if (!win_pf) { - msg_error("Can't choose pixel format."); - return; - } - SetPixelFormat(m_dc, win_pf, &win_pfd); - - // create legacy context, required for wglGetProcAddress to work properly - m_glrc = wglCreateContext(m_dc); - if (!m_glrc || !wglMakeCurrent(m_dc, m_glrc)) { - msg_error("Can't create OpenGL context."); - return; - } - - // load wgl extension - wgl_LoadFunctions(m_dc); - - // attributes for a 3.3 core profile without all the legacy stuff - GLint attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - WGL_CONTEXT_MINOR_VERSION_ARB, 3, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - 0 - }; - - // create the actual context - m_glrc_core = wglCreateContextAttribsARB(m_dc, m_glrc, attribs); - if (!m_glrc_core || !wglMakeCurrent(m_dc, m_glrc_core)) { - // rendering probably still works with the legacy context, so just send - // a warning - msg_warning("Can't create OpenGL 3.3 core context."); - } - - // enable or disable vsync - wglSwapIntervalEXT(config->vi.vsync ? 1 : 0); -} - -void screen_adjust(int32_t width_out, int32_t height_out, int32_t* width, int32_t* height, int32_t* x, int32_t* y) -{ - UNUSED(width_out); - UNUSED(height_out); - - // get size of window - RECT rect; - if (!GetClientRect(gfx.hWnd, &rect)) { - // window handle invalid? - *width = 0; - *height = 0; - *x = 0; - *y = 0; - return; - } - - // status bar covers the client area, so exclude it from calculation - RECT statusrect; - SetRectEmpty(&statusrect); - - if (gfx.hStatusBar && GetClientRect(gfx.hStatusBar, &statusrect)) { - rect.bottom -= statusrect.bottom; - } - - int32_t win_width = rect.right - rect.left; - int32_t win_height = rect.bottom - rect.top; - - // default to bottom left corner of the window above the status bar - int32_t win_x = 0; - int32_t win_y = statusrect.bottom; - - // adjust windowed size after the output size has changed so that - // the output remains pixel-perfect until the user changes the window size - if (win_width != win_width || win_height != win_height) { - int32_t win_width_tmp = win_width = win_width; - int32_t win_height_tmp = win_height = win_height; - - // double resolution for very small frame sizes, typically when - // unfiltered option is enabled - if (win_width_tmp <= 320) { - win_width_tmp <<= 1; - win_height_tmp <<= 1; - } - - WINDOWPLACEMENT wndpl = { 0 }; - GetWindowPlacement(gfx.hWnd, &wndpl); - - // only fix size if windowed and not maximized - if (!m_fullscreen && wndpl.showCmd != SW_MAXIMIZE) { - win32_client_resize(gfx.hWnd, gfx.hStatusBar, - win_width_tmp, win_height_tmp); - } - } - - *width = win_width; - *height = win_height; - *x = win_x; - *y = win_y; -} - -void screen_update(void) -{ - // don't render when the window is minimized - if (!IsIconic(gfx.hWnd)) { - // swap front and back buffers - SwapBuffers(m_dc); - } -} - -void screen_toggle_fullscreen(void) -{ - static HMENU old_menu; - static LONG old_style; - static WINDOWPLACEMENT old_pos; - - m_fullscreen = !m_fullscreen; - - if (m_fullscreen) { - // hide curser - ShowCursor(FALSE); - - // hide status bar - if (gfx.hStatusBar) { - ShowWindow(gfx.hStatusBar, SW_HIDE); - } - - // disable menu and save it to restore it later - old_menu = GetMenu(gfx.hWnd); - if (old_menu) { - SetMenu(gfx.hWnd, NULL); - } - - // save old window position and size - GetWindowPlacement(gfx.hWnd, &old_pos); - - // use virtual screen dimensions for fullscreen mode - int32_t vs_width = GetSystemMetrics(SM_CXSCREEN); - int32_t vs_height = GetSystemMetrics(SM_CYSCREEN); - - // disable all styles to get a borderless window and save it to restore - // it later - old_style = GetWindowLong(gfx.hWnd, GWL_STYLE); - LONG style = WS_VISIBLE; - if (m_exclusive) { - style |= WS_POPUP; - } - SetWindowLong(gfx.hWnd, GWL_STYLE, style); - - // resize window so it covers the entire virtual screen - SetWindowPos(gfx.hWnd, HWND_TOP, 0, 0, vs_width, vs_height, SWP_SHOWWINDOW); - } - else { - // restore cursor - ShowCursor(TRUE); - - // restore status bar - if (gfx.hStatusBar) { - ShowWindow(gfx.hStatusBar, SW_SHOW); - } - - // restore menu - if (old_menu) { - SetMenu(gfx.hWnd, old_menu); - old_menu = NULL; - } - - // restore style - SetWindowLong(gfx.hWnd, GWL_STYLE, old_style); - - // restore window size and position - SetWindowPlacement(gfx.hWnd, &old_pos); - } -} - -void screen_close(void) -{ - if (m_glrc_core) { - wglDeleteContext(m_glrc_core); - } - - wglDeleteContext(m_glrc); -} diff --git a/angrylion-rdp-plus/src/plugin/zilmar/wgl_ext.c b/angrylion-rdp-plus/src/plugin/zilmar/wgl_ext.c deleted file mode 100644 index ad45714..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/wgl_ext.c +++ /dev/null @@ -1,145 +0,0 @@ -#include "wgl_ext.h" -#include "output/gl_proc.h" - -#include <stdlib.h> -#include <string.h> -#include <stddef.h> - -int wgl_ext_EXT_swap_control = wgl_LOAD_FAILED; -int wgl_ext_ARB_create_context = wgl_LOAD_FAILED; -int wgl_ext_ARB_create_context_profile = wgl_LOAD_FAILED; - -int (CODEGEN_FUNCPTR *_ptrc_wglGetSwapIntervalEXT)(void) = NULL; -BOOL (CODEGEN_FUNCPTR *_ptrc_wglSwapIntervalEXT)(int interval) = NULL; - -static int Load_EXT_swap_control(void) -{ - int numFailed = 0; - _ptrc_wglGetSwapIntervalEXT = (int (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("wglGetSwapIntervalEXT"); - if(!_ptrc_wglGetSwapIntervalEXT) numFailed++; - _ptrc_wglSwapIntervalEXT = (BOOL (CODEGEN_FUNCPTR *)(int))IntGetProcAddress("wglSwapIntervalEXT"); - if(!_ptrc_wglSwapIntervalEXT) numFailed++; - return numFailed; -} - -HGLRC (CODEGEN_FUNCPTR *_ptrc_wglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int * attribList) = NULL; - -static int Load_ARB_create_context(void) -{ - int numFailed = 0; - _ptrc_wglCreateContextAttribsARB = (HGLRC (CODEGEN_FUNCPTR *)(HDC, HGLRC, const int *))IntGetProcAddress("wglCreateContextAttribsARB"); - if(!_ptrc_wglCreateContextAttribsARB) numFailed++; - return numFailed; -} - - -static const char * (CODEGEN_FUNCPTR *_ptrc_wglGetExtensionsStringARB)(HDC hdc) = NULL; - -typedef int (*PFN_LOADFUNCPOINTERS)(void); -typedef struct wgl_StrToExtMap_s -{ - char *extensionName; - int *extensionVariable; - PFN_LOADFUNCPOINTERS LoadExtension; -} wgl_StrToExtMap; - -static wgl_StrToExtMap ExtensionMap[3] = { - {"WGL_EXT_swap_control", &wgl_ext_EXT_swap_control, Load_EXT_swap_control}, - {"WGL_ARB_create_context", &wgl_ext_ARB_create_context, Load_ARB_create_context}, - {"WGL_ARB_create_context_profile", &wgl_ext_ARB_create_context_profile, NULL}, -}; - -static int g_extensionMapSize = 3; - -static wgl_StrToExtMap *FindExtEntry(const char *extensionName) -{ - int loop; - wgl_StrToExtMap *currLoc = ExtensionMap; - for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc) - { - if(strcmp(extensionName, currLoc->extensionName) == 0) - return currLoc; - } - - return NULL; -} - -static void ClearExtensionVars(void) -{ - wgl_ext_EXT_swap_control = wgl_LOAD_FAILED; - wgl_ext_ARB_create_context = wgl_LOAD_FAILED; - wgl_ext_ARB_create_context_profile = wgl_LOAD_FAILED; -} - - -static void LoadExtByName(const char *extensionName) -{ - wgl_StrToExtMap *entry = NULL; - entry = FindExtEntry(extensionName); - if(entry) - { - if(entry->LoadExtension) - { - int numFailed = entry->LoadExtension(); - if(numFailed == 0) - { - *(entry->extensionVariable) = wgl_LOAD_SUCCEEDED; - } - else - { - *(entry->extensionVariable) = wgl_LOAD_SUCCEEDED + numFailed; - } - } - else - { - *(entry->extensionVariable) = wgl_LOAD_SUCCEEDED; - } - } -} - - -static void ProcExtsFromExtString(const char *strExtList) -{ - size_t iExtListLen = strlen(strExtList); - const char *strExtListEnd = strExtList + iExtListLen; - const char *strCurrPos = strExtList; - char strWorkBuff[256]; - - while(*strCurrPos) - { - /*Get the extension at our position.*/ - int iStrLen = 0; - const char *strEndStr = strchr(strCurrPos, ' '); - int iStop = 0; - if(strEndStr == NULL) - { - strEndStr = strExtListEnd; - iStop = 1; - } - - iStrLen = (int)((ptrdiff_t)strEndStr - (ptrdiff_t)strCurrPos); - - if(iStrLen > 255) - return; - - strncpy(strWorkBuff, strCurrPos, iStrLen); - strWorkBuff[iStrLen] = '\0'; - - LoadExtByName(strWorkBuff); - - strCurrPos = strEndStr + 1; - if(iStop) break; - } -} - -int wgl_LoadFunctions(HDC hdc) -{ - ClearExtensionVars(); - - _ptrc_wglGetExtensionsStringARB = (const char * (CODEGEN_FUNCPTR *)(HDC))IntGetProcAddress("wglGetExtensionsStringARB"); - if(!_ptrc_wglGetExtensionsStringARB) return wgl_LOAD_FAILED; - - ProcExtsFromExtString((const char *)_ptrc_wglGetExtensionsStringARB(hdc)); - return wgl_LOAD_SUCCEEDED; -} - diff --git a/angrylion-rdp-plus/src/plugin/zilmar/wgl_ext.h b/angrylion-rdp-plus/src/plugin/zilmar/wgl_ext.h deleted file mode 100644 index 13055ae..0000000 --- a/angrylion-rdp-plus/src/plugin/zilmar/wgl_ext.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef POINTER_C_GENERATED_HEADER_WINDOWSGL_H -#define POINTER_C_GENERATED_HEADER_WINDOWSGL_H - -#ifdef __wglext_h_ -#error Attempt to include auto-generated WGL header after wglext.h -#endif - -#define __wglext_h_ - -#ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN 1 -#endif -#ifndef NOMINMAX - #define NOMINMAX -#endif -#include <windows.h> - -#ifdef CODEGEN_FUNCPTR -#undef CODEGEN_FUNCPTR -#endif /*CODEGEN_FUNCPTR*/ -#define CODEGEN_FUNCPTR WINAPI - -#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS -#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS - -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef signed char GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -#define GLvoid void - -#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/ - - -#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS -#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS - - -#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/ - - -struct _GPU_DEVICE { - DWORD cb; - CHAR DeviceName[32]; - CHAR DeviceString[128]; - DWORD Flags; - RECT rcVirtualScreen; -}; -DECLARE_HANDLE(HPBUFFERARB); -DECLARE_HANDLE(HPBUFFEREXT); -DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); -DECLARE_HANDLE(HPVIDEODEV); -DECLARE_HANDLE(HGPUNV); -DECLARE_HANDLE(HVIDEOINPUTDEVICENV); -typedef struct _GPU_DEVICE *PGPU_DEVICE; - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - -extern int wgl_ext_EXT_swap_control; -extern int wgl_ext_ARB_create_context; -extern int wgl_ext_ARB_create_context_profile; - -#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 -#define WGL_CONTEXT_FLAGS_ARB 0x2094 -#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 -#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 -#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define WGL_ERROR_INVALID_VERSION_ARB 0x2095 - -#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 -#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 -#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 -#define WGL_ERROR_INVALID_PROFILE_ARB 0x2096 - -#ifndef WGL_EXT_swap_control -#define WGL_EXT_swap_control 1 -extern int (CODEGEN_FUNCPTR *_ptrc_wglGetSwapIntervalEXT)(void); -#define wglGetSwapIntervalEXT _ptrc_wglGetSwapIntervalEXT -extern BOOL (CODEGEN_FUNCPTR *_ptrc_wglSwapIntervalEXT)(int interval); -#define wglSwapIntervalEXT _ptrc_wglSwapIntervalEXT -#endif /*WGL_EXT_swap_control*/ - -#ifndef WGL_ARB_create_context -#define WGL_ARB_create_context 1 -extern HGLRC (CODEGEN_FUNCPTR *_ptrc_wglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int * attribList); -#define wglCreateContextAttribsARB _ptrc_wglCreateContextAttribsARB -#endif /*WGL_ARB_create_context*/ - - -enum wgl_LoadStatus -{ - wgl_LOAD_FAILED = 0, - wgl_LOAD_SUCCEEDED = 1, -}; - -int wgl_LoadFunctions(HDC hdc); - - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif /*POINTER_C_GENERATED_HEADER_WINDOWSGL_H*/ diff --git a/build.sh b/build.sh index 6f2b2ea..dd110d4 100755 --- a/build.sh +++ b/build.sh @@ -28,10 +28,6 @@ make NETPLAY=1 OSD=0 NO_ASM=1 -j4 all cp -P $base_dir/mupen64plus-core/projects/unix/*$suffix* $install_dir cp $base_dir/mupen64plus-core/data/* $install_dir -cd $base_dir/mupen64plus-rsp-hle/projects/unix -make -j4 all -cp $base_dir/mupen64plus-rsp-hle/projects/unix/*$suffix $install_dir - cd $base_dir/mupen64plus-input-raphnetraw/projects/unix make -j4 all cp $base_dir/mupen64plus-input-raphnetraw/projects/unix/*$suffix $install_dir @@ -76,24 +72,6 @@ else cp $base_dir/mupen64plus-gui/build/mupen64plus-gui $install_dir fi -cd $base_dir/GLideN64/src -./getRevision.sh - -cd $base_dir/GLideN64/projects/cmake -if [[ $UNAME == *"MINGW"* ]]; then - cmake -G "MSYS Makefiles" -DMUPENPLUSAPI_GLIDENUI=On -DNOHQ=On -DVEC4_OPT=On -DCRC_OPT=On -DMUPENPLUSAPI=On ../../src/ -else - cmake -DMUPENPLUSAPI_GLIDENUI=On -DNOHQ=On -DVEC4_OPT=On -DCRC_OPT=On -DMUPENPLUSAPI=On ../../src/ -fi -cmake --build . - -if [[ $UNAME == *"MINGW"* ]]; then - cp mupen64plus-video-GLideN64$suffix $install_dir -else - cp plugin/Release/mupen64plus-video-GLideN64$suffix $install_dir -fi -cp $base_dir/GLideN64/ini/GLideN64.custom.ini $install_dir - mkdir -p $base_dir/parallel-rsp/build cd $base_dir/parallel-rsp/build if [[ $UNAME == *"MINGW"* ]]; then @@ -104,19 +82,15 @@ fi cmake --build . cp mupen64plus-rsp-parallel.* $install_dir +mkdir -p $base_dir/parallel-rdp-standalone/build +cd $base_dir/parallel-rdp-standalone/build if [[ $UNAME == *"MINGW"* ]]; then - cd $base_dir/angrylion-rdp-plus/ - python3 ./make_version.py - cd $base_dir/angrylion-rdp-plus/msvc - "${MSBUILD_PATH}MSBuild.exe" angrylion-plus.sln -p:Configuration=Release -p:Platform=x64 - cp build/Release/mupen64plus-video-angrylion-plus.dll $install_dir + cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release .. else - mkdir -p $base_dir/angrylion-rdp-plus/build - cd $base_dir/angrylion-rdp-plus/build cmake -DCMAKE_BUILD_TYPE=Release .. - cmake --build . - cp mupen64plus-video-angrylion-plus.* $install_dir fi +cmake --build . +cp mupen64plus-video-parallel.* $install_dir if [[ $UNAME == *"MINGW"* ]]; then cd $install_dir diff --git a/clean.sh b/clean.sh index 4b447d0..7393376 100755 --- a/clean.sh +++ b/clean.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -rm -rf mupen64plus mupen64plus-audio-sdl2/projects/unix/_obj mupen64plus-audio-sdl2/projects/unix/mupen64plus-audio-sdl2.dylib mupen64plus-core/projects/unix/_obj/ mupen64plus-core/projects/unix/libmupen64plus.dylib mupen64plus-gui/build mupen64plus-input-qt/build mupen64plus-input-raphnetraw/projects/unix/_obj/ mupen64plus-input-raphnetraw/projects/unix/mupen64plus-input-raphnetraw.dylib mupen64plus-rsp-hle/projects/unix/_obj/ mupen64plus-rsp-hle/projects/unix/mupen64plus-rsp-hle.dylib GLideN64/projects/cmake/CMakeFiles GLideN64/projects/cmake/mupen64plus-video-GLideN64_autogen GLideN64/projects/cmake/osal GLideN64/projects/cmake/cmake_install.cmake GLideN64/projects/cmake/CMakeCache.txt GLideN64/projects/cmake/Makefile parallel-rdp/build angrylion-rdp-plus/build +rm -rf mupen64plus mupen64plus-audio-sdl2/projects/unix/_obj mupen64plus-audio-sdl2/projects/unix/mupen64plus-audio-sdl2.dylib mupen64plus-core/projects/unix/_obj/ mupen64plus-core/projects/unix/libmupen64plus.dylib mupen64plus-gui/build mupen64plus-input-qt/build mupen64plus-input-raphnetraw/projects/unix/_obj/ mupen64plus-input-raphnetraw/projects/unix/mupen64plus-input-raphnetraw.dylib parallel-rsp/build parallel-rdp/build diff --git a/mupen64plus-rsp-hle/.gitattributes b/mupen64plus-rsp-hle/.gitattributes deleted file mode 100644 index f053771..0000000 --- a/mupen64plus-rsp-hle/.gitattributes +++ /dev/null @@ -1,38 +0,0 @@ -* text=auto - -# normal text files -*.6 text -AUTHORS text -*.c text -*.cfg text -*.cht text -*.conf text -COPYING text -*.cpp text -*.def text -*-license text -*.h text -*.html text -*.ini text -INSTALL text -LICENSES text -Makefile text -*.py text -README text -RELEASE text -*.S text -*.sh text -*.txt text -*.ver text - -# windows specific text files -*.sln text eol=crlf -*.vcproj text eol=crlf -*.vcxproj text eol=crlf -*.vcxproj.filters text eol=crlf - -# binary files -*.gz binary -*.ttf binary -cursor.tex binary -font.tex binary diff --git a/mupen64plus-rsp-hle/.gitignore b/mupen64plus-rsp-hle/.gitignore deleted file mode 100644 index 1c2191a..0000000 --- a/mupen64plus-rsp-hle/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/projects/unix/_obj*/ -/projects/unix/mupen64plus-rsp-hle*.so diff --git a/mupen64plus-rsp-hle/.travis.yml b/mupen64plus-rsp-hle/.travis.yml deleted file mode 100644 index 234cdfb..0000000 --- a/mupen64plus-rsp-hle/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -sudo: required -dist: xenial -language: cpp -compiler: - - gcc - - clang -addons: - apt: - packages: - - git -before_install: - - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core -env: - - DUMP=0 - - DUMP=1 -script: - - make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all - -# extra mxe build entries -matrix: - include: - - env: - - MXE_CPU=i686 - - PATH="/usr/lib/mxe/usr/bin/:$PATH" - before_install: - - curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add - - - echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list - - sudo apt-get update -qq - - sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-gcc - - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core - script: - - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all - - - env: - - MXE_CPU=x86_64 - - PATH="/usr/lib/mxe/usr/bin/:$PATH" - before_install: - - curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add - - - echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list - - sudo apt-get update -qq - - sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-gcc - - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core - script: - - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all diff --git a/mupen64plus-rsp-hle/INSTALL b/mupen64plus-rsp-hle/INSTALL deleted file mode 100644 index 746f9bd..0000000 --- a/mupen64plus-rsp-hle/INSTALL +++ /dev/null @@ -1,26 +0,0 @@ -Mupen64Plus-RSP-HLE INSTALL ---------------------------- - -This text file was written to explain the installation process of the -Mupen64Plus-RSP-HLE plugin. - -If this module is part of a Mupen64Plus source code bundle, the user should run -the "m64p_install.sh" script in the root of the unzipped bundle to install all -of the included modules in the bundle. - -If this module is a standalone source code release, you should build the library -from source code and install it via the makefile, like this: - -$ cd projects/unix -$ make all -$ sudo make install - -If you want to build the Mupen64Plus-RSP-HLE module for installation in a home -folder for a single user, you may build it like this (replacing <my-folder> -with your desired local installation path): - -$ cd projects/unix -$ make all -$ make install LIBDIR=<my-folder> - - diff --git a/mupen64plus-rsp-hle/LICENSES b/mupen64plus-rsp-hle/LICENSES deleted file mode 100644 index 4319820..0000000 --- a/mupen64plus-rsp-hle/LICENSES +++ /dev/null @@ -1,370 +0,0 @@ -Mupen64Plus-rsp-hle LICENSE ---------------------------- - -Mupen64Plus-rsp-hle is licensed under the GNU General Public License version 2. - -The authors of Mupen64Plus-rsp-hle are: - * Richard Goedeken (Richard42) - * Bobby Smiles (bsmiles32) - * Sven Eckelmann (ecsv) - * John Chadwick (NMN) - * James Hood (Ebenblues) - * Scott Gorman (okaygo) - * Scott Knauert (Tillin9) - * Jesse Dean (DarkJezter) - * Louai Al-Khanji (slougi) - * Bob Forder (orbitaldecay) - * Jason Espinosa (hasone) - * HyperHacker - * and others. - -Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally written by: - * Hacktarux - * Dave2001 - * Zilmar - * Gregor Anich (Blight) - * Juha Luotio (JttL) - * and others. - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 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. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -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 give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to -this License. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 Program -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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - diff --git a/mupen64plus-rsp-hle/RELEASE b/mupen64plus-rsp-hle/RELEASE deleted file mode 100644 index 4ce99fa..0000000 --- a/mupen64plus-rsp-hle/RELEASE +++ /dev/null @@ -1,59 +0,0 @@ -RSP High-Level Emulation plugin for Mupen64Plus ------------------------------------------------ - -Mupen64Plus-rsp-hle v2.5.9 - February 10, 2019 ----------------------------------------------- - - *** BETA RELEASE *** For Testing Only *** - -Mupen64Plus-rsp-hle v2.5 - April 26, 2015 -------------------------------------------------- - - Game-specific fixes: Bottom of the 9th, IndianaJones, BattleForNaboo, Conkers Bad Fur Day - - Support for MusyX microcodes - - Improve audio microcode identification - - Huge quantity of code cleanups and refactoring to improve organization - - Add support for additional audio commands: #16, POLEF, RESAMPLE_ZOH - - Multiple bugfixes in audio processing code - - Move global variables into a struct so code is re-entrant - - bugfix: microcode detection could sometimes fail after reset - -Mupen64Plus-rsp-hle v2.0 - July 4, 2013 -------------------------------------------------- - - Add support for MusyX ucode detection - - support JPEG decoding used in Pokemon Stadium Japan - - lots of refactoring to clean up code - - Project files for Visual Studio 2012 - - Makefile changes - - add support for PowerPC and MinGW32 builds - - add cross-compiling support to build Win32 executables (MXE) under Linux - -Mupen64Plus-rsp-hle v1.99.5 - March 10, 2012 -------------------------------------------------- - - Handle JPEG decompression, used in Ogre Battle 64 and Pokemon Stadium - - updated RSP plugin for new Mupen64plus 2.0 API versioning scheme - - bugfix: #102 - Missing backgrounds in Ogre Battle 64 - - many makefile fixes and improvements - -Mupen64Plus-rsp-hle v1.99.4 - November 22, 2010 -------------------------------------------------- - - merged all big-endian fixes from mupen64gc project - - makefile fixes and improvements - -Mupen64Plus-rsp-hle v1.99.3 - February 13, 2010 -------------------------------------------------- - - Makefile improvement: added OS type GNU/kFreeBSD - -Mupen64Plus-rsp-hle v1.99.2 - January 6, 2010 -------------------------------------------------- - - new feature: added MSVC8 project file for RSP-HLE plugin, fixed a few minor incompatibilities - - Makefile improvements: - - throw error if OS/CPU not supported - - use DESTDIR in install/uninstall paths - - Allow user-specified CC/CXX/LD paths - - use C++ compiler to link instead of LD, because the compiler knows where the standard C++ libs are - -Mupen64Plus-rsp-hle v1.99.1 - December 14, 2009 -------------------------------------------------- - - Converted to new Mupen64Plus 2.0 API - - Refactored build system to separate source and object files - - Refactored all code to remove win32-specific things, unnecessary functions, and clean up - diff --git a/mupen64plus-rsp-hle/appveyor.yml b/mupen64plus-rsp-hle/appveyor.yml deleted file mode 100644 index aac3df2..0000000 --- a/mupen64plus-rsp-hle/appveyor.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 1.0.{build} - -configuration: - - Release -platform: - - Win32 - - x64 - -before_build: - - git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core - -build_script: - - msbuild projects\msvc\mupen64plus-rsp-hle.vcxproj /p:Configuration=%configuration%;Platform=%platform% - -after_build: - - ps: $env:rev1 = git describe --tags - - set rev2=%platform% - - if "%rev2%"=="Win32" set rev2=x86 - - set filepkg=mupen64plus-rsp-hle_v%rev1%_%rev2% - - cd projects\msvc\%platform%\%configuration% - - 7z a -t7z ..\..\..\..\build\%filepkg%.7z *.dll - -artifacts: - - path: build\$(filepkg).7z - name: $(filepkg) diff --git a/mupen64plus-rsp-hle/projects/msvc/mupen64plus-rsp-hle.vcxproj b/mupen64plus-rsp-hle/projects/msvc/mupen64plus-rsp-hle.vcxproj deleted file mode 100644 index 8d4b75b..0000000 --- a/mupen64plus-rsp-hle/projects/msvc/mupen64plus-rsp-hle.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}</ProjectGuid> - <RootNamespace>mupen64plusrsphle</RootNamespace> - </PropertyGroup> - <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '14.0'"> - <LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion> - <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> - <TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(PlatformToolset)'=='' or '$(PlatformToolset)'=='v100'" Label="Configuration"> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\src\alist.c" /> - <ClCompile Include="..\..\src\alist_audio.c" /> - <ClCompile Include="..\..\src\alist_naudio.c" /> - <ClCompile Include="..\..\src\alist_nead.c" /> - <ClCompile Include="..\..\src\audio.c" /> - <ClCompile Include="..\..\src\cicx105.c" /> - <ClCompile Include="..\..\src\hle.c" /> - <ClCompile Include="..\..\src\hvqm.c" /> - <ClCompile Include="..\..\src\jpeg.c" /> - <ClCompile Include="..\..\src\memory.c" /> - <ClCompile Include="..\..\src\mp3.c" /> - <ClCompile Include="..\..\src\musyx.c" /> - <ClCompile Include="..\..\src\osal_dynamiclib_win32.c" /> - <ClCompile Include="..\..\src\plugin.c" /> - <ClCompile Include="..\..\src\re2.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\src\alist.h" /> - <ClInclude Include="..\..\src\arithmetics.h" /> - <ClInclude Include="..\..\src\audio.h" /> - <ClInclude Include="..\..\src\common.h" /> - <ClInclude Include="..\..\src\hle.h" /> - <ClInclude Include="..\..\src\hle_external.h" /> - <ClInclude Include="..\..\src\hle_internal.h" /> - <ClInclude Include="..\..\src\memory.h" /> - <ClInclude Include="..\..\src\osal_dynamiclib.h" /> - <ClInclude Include="..\..\src\ucodes.h" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/mupen64plus-rsp-hle/projects/unix/Makefile b/mupen64plus-rsp-hle/projects/unix/Makefile deleted file mode 100755 index 213e122..0000000 --- a/mupen64plus-rsp-hle/projects/unix/Makefile +++ /dev/null @@ -1,334 +0,0 @@ -#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -# * mupen64plus-rsp-hle - Makefile * -# * Mupen64Plus homepage: https://mupen64plus.org/ * -# * Copyright (C) 2008-2009 Richard Goedeken * -# * Copyright (C) 2007-2008 DarkJeztr Tillin9 * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU General Public License as published by * -# * the Free Software Foundation; either version 2 of the License, or * -# * (at your option) any later version. * -# * * -# * This program 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 General Public License for more details. * -# * * -# * You should have received a copy of the GNU General Public License * -# * along with this program; if not, write to the * -# * Free Software Foundation, Inc., * -# * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -# Makefile for Mupen64 HLE RSP plugin in Mupen64plus. - -# detect operating system -UNAME ?= $(shell uname -s) -OS := NONE -ifeq ("$(UNAME)","Linux") - OS = LINUX - SO_EXTENSION = so - SHARED = -shared -endif -ifeq ("$(UNAME)","linux") - OS = LINUX - SO_EXTENSION = so - SHARED = -shared -endif -ifneq ("$(filter GNU hurd,$(UNAME))","") - OS = LINUX - SO_EXTENSION = so - SHARED = -shared -endif -ifeq ("$(UNAME)","Darwin") - OS = OSX - SO_EXTENSION = dylib - SHARED = -bundle -endif -ifeq ("$(UNAME)","FreeBSD") - OS = FREEBSD - SO_EXTENSION = so - SHARED = -shared -endif -ifeq ("$(UNAME)","OpenBSD") - OS = FREEBSD - SO_EXTENSION = so - SHARED = -shared -endif -ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","") - OS = LINUX - SO_EXTENSION = so - SHARED = -shared -endif -ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW") - OS = MINGW - SO_EXTENSION = dll - SHARED = -shared - PIC = 0 -endif -ifeq ("$(OS)","NONE") - $(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues') -endif - -# detect system architecture -HOST_CPU ?= $(shell uname -m) -NO_ASM ?= 1 -CPU := NONE -ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","") - CPU := X86 - ifeq ("$(BITS)", "32") - ARCH_DETECTED := 64BITS_32 - PIC ?= 0 - else - ARCH_DETECTED := 64BITS - PIC ?= 1 - endif -endif -ifneq ("$(filter pentium i%86,$(HOST_CPU))","") - CPU := X86 - ARCH_DETECTED := 32BITS - PIC ?= 0 -endif -ifneq ("$(filter ppc macppc socppc powerpc,$(HOST_CPU))","") - CPU := PPC - ARCH_DETECTED := 32BITS - BIG_ENDIAN := 1 - PIC ?= 1 - $(warning Architecture "$(HOST_CPU)" not officially supported.') -endif -ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","") - CPU := PPC - ARCH_DETECTED := 64BITS - BIG_ENDIAN := 1 - PIC ?= 1 - $(warning Architecture "$(HOST_CPU)" not officially supported.') -endif -ifneq ("$(filter ppc64le powerpc64le,$(HOST_CPU))","") - CPU := PPC - ARCH_DETECTED := 64BITS - BIG_ENDIAN := 0 - PIC ?= 1 - $(warning Architecture "$(HOST_CPU)" not officially supported.') -endif -ifneq ("$(filter arm%,$(HOST_CPU))","") - ifeq ("$(filter arm%b,$(HOST_CPU))","") - CPU := ARM - ARCH_DETECTED := 32BITS - PIC ?= 1 - $(warning Architecture "$(HOST_CPU)" not officially supported.') - endif -endif -ifneq ("$(filter mips,$(HOST_CPU))","") - CPU := MIPS - ARCH_DETECTED := 32BITS - PIC ?= 1 - $(warning Architecture "$(HOST_CPU)" not officially supported.') -endif -ifneq ("$(filter aarch64,$(HOST_CPU))","") - CPU := AARCH - ARCH_DETECTED := 64BITS - PIC ?= 1 - NEW_DYNAREC := 1 - NO_ASM := 1 -endif -ifeq ("$(CPU)","NONE") - $(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues') -endif - -SRCDIR = ../../src -OBJDIR = _obj$(POSTFIX) - -# base CFLAGS, LDLIBS, and LDFLAGS -OPTFLAGS ?= -O3 -flto -WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I$(SRCDIR) -LDFLAGS += $(SHARED) - -# Since we are building a shared library, we must compile with -fPIC on some architectures -# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch -ifeq ($(PIC), 1) - CFLAGS += -fPIC -else - CFLAGS += -fno-PIC -endif - -ifeq ($(BIG_ENDIAN), 1) - CFLAGS += -DM64P_BIG_ENDIAN -endif - -# tweak flags for 32-bit build on 64-bit system -ifeq ($(ARCH_DETECTED), 64BITS_32) - ifeq ($(OS), FREEBSD) - $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386) - endif - CFLAGS += -m32 - LDFLAGS += -Wl,-m,elf_i386 -endif - -# set special flags per-system -ifeq ($(OS), LINUX) - # only export api symbols - LDFLAGS += -Wl,-version-script,$(SRCDIR)/rsp_api_export.ver - LDLIBS += -ldl -endif -ifeq ($(OS), OSX) - OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path) - - ifeq ($(CPU), X86) - ifeq ($(ARCH_DETECTED), 64BITS) - CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH) - else - CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH) - LDFLAGS += -read_only_relocs suppress - endif - endif -endif - -# set mupen64plus core API header path -ifneq ("$(APIDIR)","") - CFLAGS += "-I$(APIDIR)" -else - TRYDIR = ../../../mupen64plus-core/src/api - ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","") - CFLAGS += -I$(TRYDIR) - else - TRYDIR = /usr/local/include/mupen64plus - ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","") - CFLAGS += -I$(TRYDIR) - else - TRYDIR = /usr/include/mupen64plus - ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","") - CFLAGS += -I$(TRYDIR) - else - $(error Mupen64Plus API header files not found! Use makefile parameter APIDIR to force a location.) - endif - endif - endif -endif - -# reduced compile output when running make without V=1 -ifneq ($(findstring $(MAKEFLAGS),s),s) -ifndef V - Q_CC = @echo ' CC '$@; - Q_LD = @echo ' LD '$@; -endif -endif - -# set base program pointers and flags -CC = $(CROSS_COMPILE)gcc -RM ?= rm -f -INSTALL ?= install -MKDIR ?= mkdir -p -COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) - -# set special flags for given Makefile parameters -ifeq ($(DEBUG),1) - CFLAGS += -g - INSTALL_STRIP_FLAG ?= -else - CFLAGS += -DNDEBUG - ifneq ($(OS),OSX) - INSTALL_STRIP_FLAG ?= -s - endif -endif - -# set installation options -ifeq ($(PREFIX),) - PREFIX := /usr/local -endif -ifeq ($(LIBDIR),) - LIBDIR := $(PREFIX)/lib -endif -ifeq ($(PLUGINDIR),) - PLUGINDIR := $(LIBDIR)/mupen64plus -endif - -# enable/disable task dumping support -ifeq ($(DUMP), 1) - CFLAGS += -DENABLE_TASK_DUMP -endif - -# list of source files to compile -SOURCE = \ - $(SRCDIR)/alist.c \ - $(SRCDIR)/alist_audio.c \ - $(SRCDIR)/alist_naudio.c \ - $(SRCDIR)/alist_nead.c \ - $(SRCDIR)/audio.c \ - $(SRCDIR)/cicx105.c \ - $(SRCDIR)/hle.c \ - $(SRCDIR)/hvqm.c \ - $(SRCDIR)/jpeg.c \ - $(SRCDIR)/memory.c \ - $(SRCDIR)/mp3.c \ - $(SRCDIR)/musyx.c \ - $(SRCDIR)/re2.c \ - $(SRCDIR)/plugin.c - -ifeq ($(OS), MINGW) -SOURCE += \ - $(SRCDIR)/osal_dynamiclib_win32.c -else -SOURCE += \ - $(SRCDIR)/osal_dynamiclib_unix.c -endif - -# generate a list of object files build, make a temporary directory for them -OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE))) -OBJDIRS = $(dir $(OBJECTS)) -$(shell $(MKDIR) $(OBJDIRS)) - -# build targets -TARGET = mupen64plus-rsp-hle$(POSTFIX).$(SO_EXTENSION) - -targets: - @echo "Mupen64Plus-rsp-hle makefile. " - @echo " Targets:" - @echo " all == Build Mupen64Plus rsp-hle plugin" - @echo " clean == remove object files" - @echo " rebuild == clean and re-build all" - @echo " install == Install Mupen64Plus rsp-hle plugin" - @echo " uninstall == Uninstall Mupen64Plus rsp-hle plugin" - @echo " Options:" - @echo " BITS=32 == build 32-bit binaries on 64-bit machine" - @echo " APIDIR=path == path to find Mupen64Plus Core headers" - @echo " OPTFLAGS=flag == compiler optimization (default: -O3 -flto)" - @echo " WARNFLAGS=flag == compiler warning levels (default: -Wall)" - @echo " PIC=(1|0) == Force enable/disable of position independent code" - @echo " POSTFIX=name == String added to the name of the the build (default: '')" - @echo " DUMP=(1|0) == Enable/Disable unknown task dumping (default: 0)" - @echo " Install Options:" - @echo " PREFIX=path == install/uninstall prefix (default: /usr/local)" - @echo " LIBDIR=path == library prefix (default: PREFIX/lib)" - @echo " PLUGINDIR=path == path to install plugin libraries (default: LIBDIR/mupen64plus)" - @echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)" - @echo " Debugging Options:" - @echo " DEBUG=1 == add debugging symbols" - @echo " V=1 == show verbose compiler output" - -all: $(TARGET) - -install: $(TARGET) - $(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)" - $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)" - -uninstall: - $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)" - -clean: - $(RM) -r $(OBJDIR) $(TARGET) - -rebuild: clean all - -# build dependency files -CFLAGS += -MD -MP --include $(OBJECTS:.o=.d) - -# standard build rules -$(OBJDIR)/%.o: $(SRCDIR)/%.c - $(COMPILE.c) -o $@ $< - -$(TARGET): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ - -.PHONY: all clean install uninstall targets diff --git a/mupen64plus-rsp-hle/src/alist.c b/mupen64plus-rsp-hle/src/alist.c deleted file mode 100644 index ef3adc2..0000000 --- a/mupen64plus-rsp-hle/src/alist.c +++ /dev/null @@ -1,1024 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - alist.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <assert.h> -#include <stdbool.h> -#include <stdint.h> -#include <string.h> - -#include "alist.h" -#include "arithmetics.h" -#include "audio.h" -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" - -struct ramp_t -{ - int64_t value; - int64_t step; - int64_t target; -}; - -/* local functions */ -static void swap(int16_t **a, int16_t **b) -{ - int16_t* tmp = *b; - *b = *a; - *a = tmp; -} - -static int16_t* sample(struct hle_t* hle, unsigned pos) -{ - return (int16_t*)hle->alist_buffer + ((pos ^ S) & 0xfff); -} - -static uint8_t* alist_u8(struct hle_t* hle, uint16_t dmem) -{ - return (uint8_t*)(hle->alist_buffer + ((dmem ^ S8) & 0xfff)); -} - -static int16_t* alist_s16(struct hle_t* hle, uint16_t dmem) -{ - return (int16_t*)(hle->alist_buffer + ((dmem ^ S16) & 0xfff)); -} - - -static void sample_mix(int16_t* dst, int16_t src, int16_t gain) -{ - *dst = clamp_s16(*dst + ((src * gain) >> 15)); -} - -static void alist_envmix_mix(size_t n, int16_t** dst, const int16_t* gains, int16_t src) -{ - size_t i; - - for(i = 0; i < n; ++i) - sample_mix(dst[i], src, gains[i]); -} - -static int16_t ramp_step(struct ramp_t* ramp) -{ - bool target_reached; - - ramp->value += ramp->step; - - target_reached = (ramp->step <= 0) - ? (ramp->value <= ramp->target) - : (ramp->value >= ramp->target); - - if (target_reached) - { - ramp->value = ramp->target; - ramp->step = 0; - } - - return (int16_t)(ramp->value >> 16); -} - -/* global functions */ -void alist_process(struct hle_t* hle, const acmd_callback_t abi[], unsigned int abi_size) -{ - uint32_t w1, w2; - unsigned int acmd; - - const uint32_t *alist = dram_u32(hle, *dmem_u32(hle, TASK_DATA_PTR)); - const uint32_t *const alist_end = alist + (*dmem_u32(hle, TASK_DATA_SIZE) >> 2); - - while (alist != alist_end) { - w1 = *(alist++); - w2 = *(alist++); - - acmd = (w1 >> 24) & 0x7f; - - if (acmd < abi_size) - (*abi[acmd])(hle, w1, w2); - else - HleWarnMessage(hle->user_defined, "Invalid ABI command %u", acmd); - } -} - -uint32_t alist_get_address(struct hle_t* hle, uint32_t so, const uint32_t *segments, size_t n) -{ - uint8_t segment = (so >> 24) & 0x3f; - uint32_t offset = (so & 0xffffff); - - if (segment >= n) { - HleWarnMessage(hle->user_defined, "Invalid segment %u", segment); - return offset; - } - - return segments[segment] + offset; -} - -void alist_set_address(struct hle_t* hle, uint32_t so, uint32_t *segments, size_t n) -{ - uint8_t segment = (so >> 24) & 0x3f; - uint32_t offset = (so & 0xffffff); - - if (segment >= n) { - HleWarnMessage(hle->user_defined, "Invalid segment %u", segment); - return; - } - - segments[segment] = offset; -} - -void alist_clear(struct hle_t* hle, uint16_t dmem, uint16_t count) -{ - while(count != 0) { - *alist_u8(hle, dmem++) = 0; - --count; - } -} - -void alist_load(struct hle_t* hle, uint16_t dmem, uint32_t address, uint16_t count) -{ - /* enforce DMA alignment constraints */ - dmem &= ~3; - address &= ~7; - count = align(count, 8); - memcpy(hle->alist_buffer + dmem, hle->dram + address, count); -} - -void alist_save(struct hle_t* hle, uint16_t dmem, uint32_t address, uint16_t count) -{ - /* enforce DMA alignment constraints */ - dmem &= ~3; - address &= ~7; - count = align(count, 8); - memcpy(hle->dram + address, hle->alist_buffer + dmem, count); -} - -void alist_move(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count) -{ - while (count != 0) { - *alist_u8(hle, dmemo++) = *alist_u8(hle, dmemi++); - --count; - } -} - -void alist_copy_every_other_sample(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count) -{ - while (count != 0) { - *alist_s16(hle, dmemo) = *alist_s16(hle, dmemi); - dmemo += 2; - dmemi += 4; - --count; - } -} - -void alist_repeat64(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint8_t count) -{ - uint16_t buffer[64]; - - memcpy(buffer, hle->alist_buffer + dmemi, 128); - - while(count != 0) { - memcpy(hle->alist_buffer + dmemo, buffer, 128); - dmemo += 128; - --count; - } -} - -void alist_copy_blocks(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t block_size, uint8_t count) -{ - int block_left = count; - - do - { - int bytes_left = block_size; - - do - { - memcpy(hle->alist_buffer + dmemo, hle->alist_buffer + dmemi, 0x20); - bytes_left -= 0x20; - - dmemi += 0x20; - dmemo += 0x20; - - } while(bytes_left > 0); - - --block_left; - } while(block_left > 0); -} - -void alist_interleave(struct hle_t* hle, uint16_t dmemo, uint16_t left, uint16_t right, uint16_t count) -{ - uint16_t *dst = (uint16_t*)(hle->alist_buffer + dmemo); - const uint16_t *srcL = (uint16_t*)(hle->alist_buffer + left); - const uint16_t *srcR = (uint16_t*)(hle->alist_buffer + right); - - count >>= 2; - - while(count != 0) { - uint16_t l1 = *(srcL++); - uint16_t l2 = *(srcL++); - uint16_t r1 = *(srcR++); - uint16_t r2 = *(srcR++); - -#if M64P_BIG_ENDIAN - *(dst++) = l1; - *(dst++) = r1; - *(dst++) = l2; - *(dst++) = r2; -#else - *(dst++) = r2; - *(dst++) = l2; - *(dst++) = r1; - *(dst++) = l1; -#endif - --count; - } -} - - -void alist_envmix_exp( - struct hle_t* hle, - bool init, - bool aux, - uint16_t dmem_dl, uint16_t dmem_dr, - uint16_t dmem_wl, uint16_t dmem_wr, - uint16_t dmemi, uint16_t count, - int16_t dry, int16_t wet, - const int16_t *vol, - const int16_t *target, - const int32_t *rate, - uint32_t address) -{ - size_t n = (aux) ? 4 : 2; - - const int16_t* const in = (int16_t*)(hle->alist_buffer + dmemi); - int16_t* const dl = (int16_t*)(hle->alist_buffer + dmem_dl); - int16_t* const dr = (int16_t*)(hle->alist_buffer + dmem_dr); - int16_t* const wl = (int16_t*)(hle->alist_buffer + dmem_wl); - int16_t* const wr = (int16_t*)(hle->alist_buffer + dmem_wr); - - struct ramp_t ramps[2]; - int32_t exp_seq[2]; - int32_t exp_rates[2]; - - uint32_t ptr = 0; - int x, y; - short save_buffer[40]; - - memcpy((uint8_t *)save_buffer, (hle->dram + address), sizeof(save_buffer)); - if (init) { - ramps[0].value = (vol[0] << 16); - ramps[1].value = (vol[1] << 16); - ramps[0].target = (target[0] << 16); - ramps[1].target = (target[1] << 16); - exp_rates[0] = rate[0]; - exp_rates[1] = rate[1]; - exp_seq[0] = (vol[0] * rate[0]); - exp_seq[1] = (vol[1] * rate[1]); - } else { - wet = *(int16_t *)(save_buffer + 0); /* 0-1 */ - dry = *(int16_t *)(save_buffer + 2); /* 2-3 */ - ramps[0].target = *(int32_t *)(save_buffer + 4); /* 4-5 */ - ramps[1].target = *(int32_t *)(save_buffer + 6); /* 6-7 */ - exp_rates[0] = *(int32_t *)(save_buffer + 8); /* 8-9 (save_buffer is a 16bit pointer) */ - exp_rates[1] = *(int32_t *)(save_buffer + 10); /* 10-11 */ - exp_seq[0] = *(int32_t *)(save_buffer + 12); /* 12-13 */ - exp_seq[1] = *(int32_t *)(save_buffer + 14); /* 14-15 */ - ramps[0].value = *(int32_t *)(save_buffer + 16); /* 12-13 */ - ramps[1].value = *(int32_t *)(save_buffer + 18); /* 14-15 */ - } - - /* init which ensure ramp.step != 0 iff ramp.value == ramp.target */ - ramps[0].step = ramps[0].target - ramps[0].value; - ramps[1].step = ramps[1].target - ramps[1].value; - - for (y = 0; y < count; y += 16) { - - if (ramps[0].step != 0) - { - exp_seq[0] = ((int64_t)exp_seq[0]*(int64_t)exp_rates[0]) >> 16; - ramps[0].step = (exp_seq[0] - ramps[0].value) >> 3; - } - - if (ramps[1].step != 0) - { - exp_seq[1] = ((int64_t)exp_seq[1]*(int64_t)exp_rates[1]) >> 16; - ramps[1].step = (exp_seq[1] - ramps[1].value) >> 3; - } - - for (x = 0; x < 8; ++x) { - int16_t gains[4]; - int16_t* buffers[4]; - int16_t l_vol = ramp_step(&ramps[0]); - int16_t r_vol = ramp_step(&ramps[1]); - - buffers[0] = dl + (ptr^S); - buffers[1] = dr + (ptr^S); - buffers[2] = wl + (ptr^S); - buffers[3] = wr + (ptr^S); - - gains[0] = clamp_s16((l_vol * dry + 0x4000) >> 15); - gains[1] = clamp_s16((r_vol * dry + 0x4000) >> 15); - gains[2] = clamp_s16((l_vol * wet + 0x4000) >> 15); - gains[3] = clamp_s16((r_vol * wet + 0x4000) >> 15); - - alist_envmix_mix(n, buffers, gains, in[ptr^S]); - ++ptr; - } - } - - *(int16_t *)(save_buffer + 0) = wet; /* 0-1 */ - *(int16_t *)(save_buffer + 2) = dry; /* 2-3 */ - *(int32_t *)(save_buffer + 4) = (int32_t)ramps[0].target; /* 4-5 */ - *(int32_t *)(save_buffer + 6) = (int32_t)ramps[1].target; /* 6-7 */ - *(int32_t *)(save_buffer + 8) = exp_rates[0]; /* 8-9 (save_buffer is a 16bit pointer) */ - *(int32_t *)(save_buffer + 10) = exp_rates[1]; /* 10-11 */ - *(int32_t *)(save_buffer + 12) = exp_seq[0]; /* 12-13 */ - *(int32_t *)(save_buffer + 14) = exp_seq[1]; /* 14-15 */ - *(int32_t *)(save_buffer + 16) = (int32_t)ramps[0].value; /* 12-13 */ - *(int32_t *)(save_buffer + 18) = (int32_t)ramps[1].value; /* 14-15 */ - memcpy(hle->dram + address, (uint8_t *)save_buffer, sizeof(save_buffer)); -} - -void alist_envmix_ge( - struct hle_t* hle, - bool init, - bool aux, - uint16_t dmem_dl, uint16_t dmem_dr, - uint16_t dmem_wl, uint16_t dmem_wr, - uint16_t dmemi, uint16_t count, - int16_t dry, int16_t wet, - const int16_t *vol, - const int16_t *target, - const int32_t *rate, - uint32_t address) -{ - unsigned k; - size_t n = (aux) ? 4 : 2; - - const int16_t* const in = (int16_t*)(hle->alist_buffer + dmemi); - int16_t* const dl = (int16_t*)(hle->alist_buffer + dmem_dl); - int16_t* const dr = (int16_t*)(hle->alist_buffer + dmem_dr); - int16_t* const wl = (int16_t*)(hle->alist_buffer + dmem_wl); - int16_t* const wr = (int16_t*)(hle->alist_buffer + dmem_wr); - - struct ramp_t ramps[2]; - short save_buffer[40]; - - memcpy((uint8_t *)save_buffer, (hle->dram + address), 80); - if (init) { - ramps[0].value = (vol[0] << 16); - ramps[1].value = (vol[1] << 16); - ramps[0].target = (target[0] << 16); - ramps[1].target = (target[1] << 16); - ramps[0].step = rate[0] / 8; - ramps[1].step = rate[1] / 8; - } else { - wet = *(int16_t *)(save_buffer + 0); /* 0-1 */ - dry = *(int16_t *)(save_buffer + 2); /* 2-3 */ - ramps[0].target = *(int32_t *)(save_buffer + 4); /* 4-5 */ - ramps[1].target = *(int32_t *)(save_buffer + 6); /* 6-7 */ - ramps[0].step = *(int32_t *)(save_buffer + 8); /* 8-9 (save_buffer is a 16bit pointer) */ - ramps[1].step = *(int32_t *)(save_buffer + 10); /* 10-11 */ - /* *(int32_t *)(save_buffer + 12);*/ /* 12-13 */ - /* *(int32_t *)(save_buffer + 14);*/ /* 14-15 */ - ramps[0].value = *(int32_t *)(save_buffer + 16); /* 12-13 */ - ramps[1].value = *(int32_t *)(save_buffer + 18); /* 14-15 */ - } - - count >>= 1; - for (k = 0; k < count; ++k) { - int16_t gains[4]; - int16_t* buffers[4]; - int16_t l_vol = ramp_step(&ramps[0]); - int16_t r_vol = ramp_step(&ramps[1]); - - buffers[0] = dl + (k^S); - buffers[1] = dr + (k^S); - buffers[2] = wl + (k^S); - buffers[3] = wr + (k^S); - - gains[0] = clamp_s16((l_vol * dry + 0x4000) >> 15); - gains[1] = clamp_s16((r_vol * dry + 0x4000) >> 15); - gains[2] = clamp_s16((l_vol * wet + 0x4000) >> 15); - gains[3] = clamp_s16((r_vol * wet + 0x4000) >> 15); - - alist_envmix_mix(n, buffers, gains, in[k^S]); - } - - *(int16_t *)(save_buffer + 0) = wet; /* 0-1 */ - *(int16_t *)(save_buffer + 2) = dry; /* 2-3 */ - *(int32_t *)(save_buffer + 4) = (int32_t)ramps[0].target; /* 4-5 */ - *(int32_t *)(save_buffer + 6) = (int32_t)ramps[1].target; /* 6-7 */ - *(int32_t *)(save_buffer + 8) = (int32_t)ramps[0].step; /* 8-9 (save_buffer is a 16bit pointer) */ - *(int32_t *)(save_buffer + 10) = (int32_t)ramps[1].step; /* 10-11 */ - /**(int32_t *)(save_buffer + 12);*/ /* 12-13 */ - /**(int32_t *)(save_buffer + 14);*/ /* 14-15 */ - *(int32_t *)(save_buffer + 16) = (int32_t)ramps[0].value; /* 12-13 */ - *(int32_t *)(save_buffer + 18) = (int32_t)ramps[1].value; /* 14-15 */ - memcpy(hle->dram + address, (uint8_t *)save_buffer, 80); -} - -void alist_envmix_lin( - struct hle_t* hle, - bool init, - uint16_t dmem_dl, uint16_t dmem_dr, - uint16_t dmem_wl, uint16_t dmem_wr, - uint16_t dmemi, uint16_t count, - int16_t dry, int16_t wet, - const int16_t *vol, - const int16_t *target, - const int32_t *rate, - uint32_t address) -{ - size_t k; - struct ramp_t ramps[2]; - int16_t save_buffer[40]; - - const int16_t * const in = (int16_t*)(hle->alist_buffer + dmemi); - int16_t* const dl = (int16_t*)(hle->alist_buffer + dmem_dl); - int16_t* const dr = (int16_t*)(hle->alist_buffer + dmem_dr); - int16_t* const wl = (int16_t*)(hle->alist_buffer + dmem_wl); - int16_t* const wr = (int16_t*)(hle->alist_buffer + dmem_wr); - - memcpy((uint8_t *)save_buffer, hle->dram + address, 80); - if (init) { - ramps[0].step = rate[0] / 8; - ramps[0].value = (vol[0] << 16); - ramps[0].target = (target[0] << 16); - ramps[1].step = rate[1] / 8; - ramps[1].value = (vol[1] << 16); - ramps[1].target = (target[1] << 16); - } - else { - wet = *(int16_t *)(save_buffer + 0); /* 0-1 */ - dry = *(int16_t *)(save_buffer + 2); /* 2-3 */ - ramps[0].target = *(int16_t *)(save_buffer + 4) << 16; /* 4-5 */ - ramps[1].target = *(int16_t *)(save_buffer + 6) << 16; /* 6-7 */ - ramps[0].step = *(int32_t *)(save_buffer + 8); /* 8-9 (save_buffer is a 16bit pointer) */ - ramps[1].step = *(int32_t *)(save_buffer + 10); /* 10-11 */ - ramps[0].value = *(int32_t *)(save_buffer + 16); /* 16-17 */ - ramps[1].value = *(int32_t *)(save_buffer + 18); /* 16-17 */ - } - - count >>= 1; - for(k = 0; k < count; ++k) { - int16_t gains[4]; - int16_t* buffers[4]; - int16_t l_vol = ramp_step(&ramps[0]); - int16_t r_vol = ramp_step(&ramps[1]); - - buffers[0] = dl + (k^S); - buffers[1] = dr + (k^S); - buffers[2] = wl + (k^S); - buffers[3] = wr + (k^S); - - gains[0] = clamp_s16((l_vol * dry + 0x4000) >> 15); - gains[1] = clamp_s16((r_vol * dry + 0x4000) >> 15); - gains[2] = clamp_s16((l_vol * wet + 0x4000) >> 15); - gains[3] = clamp_s16((r_vol * wet + 0x4000) >> 15); - - alist_envmix_mix(4, buffers, gains, in[k^S]); - } - - *(int16_t *)(save_buffer + 0) = wet; /* 0-1 */ - *(int16_t *)(save_buffer + 2) = dry; /* 2-3 */ - *(int16_t *)(save_buffer + 4) = (int16_t)(ramps[0].target >> 16); /* 4-5 */ - *(int16_t *)(save_buffer + 6) = (int16_t)(ramps[1].target >> 16); /* 6-7 */ - *(int32_t *)(save_buffer + 8) = (int32_t)ramps[0].step; /* 8-9 (save_buffer is a 16bit pointer) */ - *(int32_t *)(save_buffer + 10) = (int32_t)ramps[1].step; /* 10-11 */ - *(int32_t *)(save_buffer + 16) = (int32_t)ramps[0].value; /* 16-17 */ - *(int32_t *)(save_buffer + 18) = (int32_t)ramps[1].value; /* 18-19 */ - memcpy(hle->dram + address, (uint8_t *)save_buffer, 80); -} - -void alist_envmix_nead( - struct hle_t* hle, - bool swap_wet_LR, - uint16_t dmem_dl, - uint16_t dmem_dr, - uint16_t dmem_wl, - uint16_t dmem_wr, - uint16_t dmemi, - unsigned count, - uint16_t *env_values, - uint16_t *env_steps, - const int16_t *xors) -{ - int16_t *in = (int16_t*)(hle->alist_buffer + dmemi); - int16_t *dl = (int16_t*)(hle->alist_buffer + dmem_dl); - int16_t *dr = (int16_t*)(hle->alist_buffer + dmem_dr); - int16_t *wl = (int16_t*)(hle->alist_buffer + dmem_wl); - int16_t *wr = (int16_t*)(hle->alist_buffer + dmem_wr); - - /* make sure count is a multiple of 8 */ - count = align(count, 8); - - if (swap_wet_LR) - swap(&wl, &wr); - - while (count != 0) { - size_t i; - for(i = 0; i < 8; ++i) { - int16_t l = (((int32_t)in[i^S] * (uint32_t)env_values[0]) >> 16) ^ xors[0]; - int16_t r = (((int32_t)in[i^S] * (uint32_t)env_values[1]) >> 16) ^ xors[1]; - int16_t l2 = (((int32_t)l * (uint32_t)env_values[2]) >> 16) ^ xors[2]; - int16_t r2 = (((int32_t)r * (uint32_t)env_values[2]) >> 16) ^ xors[3]; - - dl[i^S] = clamp_s16(dl[i^S] + l); - dr[i^S] = clamp_s16(dr[i^S] + r); - wl[i^S] = clamp_s16(wl[i^S] + l2); - wr[i^S] = clamp_s16(wr[i^S] + r2); - } - - env_values[0] += env_steps[0]; - env_values[1] += env_steps[1]; - env_values[2] += env_steps[2]; - - dl += 8; - dr += 8; - wl += 8; - wr += 8; - in += 8; - count -= 8; - } -} - - -void alist_mix(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count, int16_t gain) -{ - int16_t *dst = (int16_t*)(hle->alist_buffer + dmemo); - const int16_t *src = (int16_t*)(hle->alist_buffer + dmemi); - - count >>= 1; - - while(count != 0) { - sample_mix(dst, *src, gain); - - ++dst; - ++src; - --count; - } -} - -void alist_multQ44(struct hle_t* hle, uint16_t dmem, uint16_t count, int8_t gain) -{ - int16_t *dst = (int16_t*)(hle->alist_buffer + dmem); - - count >>= 1; - - while(count != 0) { - *dst = clamp_s16(*dst * gain >> 4); - - ++dst; - --count; - } -} - -void alist_add(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count) -{ - int16_t *dst = (int16_t*)(hle->alist_buffer + dmemo); - const int16_t *src = (int16_t*)(hle->alist_buffer + dmemi); - - count >>= 1; - - while(count != 0) { - *dst = clamp_s16(*dst + *src); - - ++dst; - ++src; - --count; - } -} - -static void alist_resample_reset(struct hle_t* hle, uint16_t pos, uint32_t* pitch_accu) -{ - unsigned k; - - for(k = 0; k < 4; ++k) - *sample(hle, pos + k) = 0; - - *pitch_accu = 0; -} - -static void alist_resample_load(struct hle_t* hle, uint32_t address, uint16_t pos, uint32_t* pitch_accu) -{ - *sample(hle, pos + 0) = *dram_u16(hle, address + 0); - *sample(hle, pos + 1) = *dram_u16(hle, address + 2); - *sample(hle, pos + 2) = *dram_u16(hle, address + 4); - *sample(hle, pos + 3) = *dram_u16(hle, address + 6); - - *pitch_accu = *dram_u16(hle, address + 8); -} - -static void alist_resample_save(struct hle_t* hle, uint32_t address, uint16_t pos, uint32_t pitch_accu) -{ - *dram_u16(hle, address + 0) = *sample(hle, pos + 0); - *dram_u16(hle, address + 2) = *sample(hle, pos + 1); - *dram_u16(hle, address + 4) = *sample(hle, pos + 2); - *dram_u16(hle, address + 6) = *sample(hle, pos + 3); - - *dram_u16(hle, address + 8) = pitch_accu; -} - -void alist_resample( - struct hle_t* hle, - bool init, - bool flag2, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - uint32_t pitch, /* Q16.16 */ - uint32_t address) -{ - uint32_t pitch_accu; - - uint16_t ipos = dmemi >> 1; - uint16_t opos = dmemo >> 1; - count >>= 1; - ipos -= 4; - - if (flag2) - HleWarnMessage(hle->user_defined, "alist_resample: flag2 is not implemented"); - - if (init) - alist_resample_reset(hle, ipos, &pitch_accu); - else - alist_resample_load(hle, address, ipos, &pitch_accu); - - while (count != 0) { - const int16_t* lut = RESAMPLE_LUT + ((pitch_accu & 0xfc00) >> 8); - - *sample(hle, opos++) = clamp_s16( ( - (*sample(hle, ipos ) * lut[0]) + - (*sample(hle, ipos + 1) * lut[1]) + - (*sample(hle, ipos + 2) * lut[2]) + - (*sample(hle, ipos + 3) * lut[3]) ) >> 15); - - pitch_accu += pitch; - ipos += (pitch_accu >> 16); - pitch_accu &= 0xffff; - --count; - } - - alist_resample_save(hle, address, ipos, pitch_accu); -} - -void alist_resample_zoh( - struct hle_t* hle, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - uint32_t pitch, - uint32_t pitch_accu) -{ - uint16_t ipos = dmemi >> 1; - uint16_t opos = dmemo >> 1; - count >>= 1; - - while(count != 0) { - - *sample(hle, opos++) = *sample(hle, ipos); - - pitch_accu += pitch; - ipos += (pitch_accu >> 16); - pitch_accu &= 0xffff; - --count; - } -} - -typedef unsigned int (*adpcm_predict_frame_t)(struct hle_t* hle, - int16_t* dst, uint16_t dmemi, unsigned char scale); - -static unsigned int adpcm_predict_frame_4bits(struct hle_t* hle, - int16_t* dst, uint16_t dmemi, unsigned char scale) -{ - unsigned int i; - unsigned int rshift = (scale < 12) ? 12 - scale : 0; - - for(i = 0; i < 8; ++i) { - uint8_t byte = *alist_u8(hle, dmemi++); - - *(dst++) = adpcm_predict_sample(byte, 0xf0, 8, rshift); - *(dst++) = adpcm_predict_sample(byte, 0x0f, 12, rshift); - } - - return 8; -} - -static unsigned int adpcm_predict_frame_2bits(struct hle_t* hle, - int16_t* dst, uint16_t dmemi, unsigned char scale) -{ - unsigned int i; - unsigned int rshift = (scale < 14) ? 14 - scale : 0; - - for(i = 0; i < 4; ++i) { - uint8_t byte = *alist_u8(hle, dmemi++); - - *(dst++) = adpcm_predict_sample(byte, 0xc0, 8, rshift); - *(dst++) = adpcm_predict_sample(byte, 0x30, 10, rshift); - *(dst++) = adpcm_predict_sample(byte, 0x0c, 12, rshift); - *(dst++) = adpcm_predict_sample(byte, 0x03, 14, rshift); - } - - return 4; -} - -void alist_adpcm( - struct hle_t* hle, - bool init, - bool loop, - bool two_bit_per_sample, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - const int16_t* codebook, - uint32_t loop_address, - uint32_t last_frame_address) -{ - int16_t last_frame[16]; - size_t i; - - adpcm_predict_frame_t predict_frame = (two_bit_per_sample) - ? adpcm_predict_frame_2bits - : adpcm_predict_frame_4bits; - - assert((count & 0x1f) == 0); - - if (init) - memset(last_frame, 0, 16*sizeof(last_frame[0])); - else - dram_load_u16(hle, (uint16_t*)last_frame, (loop) ? loop_address : last_frame_address, 16); - - for(i = 0; i < 16; ++i, dmemo += 2) - *alist_s16(hle, dmemo) = last_frame[i]; - - while (count != 0) { - int16_t frame[16]; - uint8_t code = *alist_u8(hle, dmemi++); - unsigned char scale = (code & 0xf0) >> 4; - const int16_t* const cb_entry = codebook + ((code & 0xf) << 4); - - dmemi += predict_frame(hle, frame, dmemi, scale); - - adpcm_compute_residuals(last_frame , frame , cb_entry, last_frame + 14, 8); - adpcm_compute_residuals(last_frame + 8, frame + 8, cb_entry, last_frame + 6 , 8); - - for(i = 0; i < 16; ++i, dmemo += 2) - *alist_s16(hle, dmemo) = last_frame[i]; - - count -= 32; - } - - dram_store_u16(hle, (uint16_t*)last_frame, last_frame_address, 16); -} - - -void alist_filter( - struct hle_t* hle, - uint16_t dmem, - uint16_t count, - uint32_t address, - const uint32_t* lut_address) -{ - int x; - int16_t outbuff[0x3c0]; - int16_t *outp = outbuff; - - int16_t* const lutt6 = (int16_t*)(hle->dram + lut_address[0]); - int16_t* const lutt5 = (int16_t*)(hle->dram + lut_address[1]); - - int16_t* in1 = (int16_t*)(hle->dram + address); - int16_t* in2 = (int16_t*)(hle->alist_buffer + dmem); - - - for (x = 0; x < 8; ++x) { - int32_t v = (lutt5[x] + lutt6[x]) >> 1; - lutt5[x] = lutt6[x] = v; - } - - for (x = 0; x < count; x += 16) { - int32_t v[8]; - - v[1] = in1[0] * lutt6[6]; - v[1] += in1[3] * lutt6[7]; - v[1] += in1[2] * lutt6[4]; - v[1] += in1[5] * lutt6[5]; - v[1] += in1[4] * lutt6[2]; - v[1] += in1[7] * lutt6[3]; - v[1] += in1[6] * lutt6[0]; - v[1] += in2[1] * lutt6[1]; /* 1 */ - - v[0] = in1[3] * lutt6[6]; - v[0] += in1[2] * lutt6[7]; - v[0] += in1[5] * lutt6[4]; - v[0] += in1[4] * lutt6[5]; - v[0] += in1[7] * lutt6[2]; - v[0] += in1[6] * lutt6[3]; - v[0] += in2[1] * lutt6[0]; - v[0] += in2[0] * lutt6[1]; - - v[3] = in1[2] * lutt6[6]; - v[3] += in1[5] * lutt6[7]; - v[3] += in1[4] * lutt6[4]; - v[3] += in1[7] * lutt6[5]; - v[3] += in1[6] * lutt6[2]; - v[3] += in2[1] * lutt6[3]; - v[3] += in2[0] * lutt6[0]; - v[3] += in2[3] * lutt6[1]; - - v[2] = in1[5] * lutt6[6]; - v[2] += in1[4] * lutt6[7]; - v[2] += in1[7] * lutt6[4]; - v[2] += in1[6] * lutt6[5]; - v[2] += in2[1] * lutt6[2]; - v[2] += in2[0] * lutt6[3]; - v[2] += in2[3] * lutt6[0]; - v[2] += in2[2] * lutt6[1]; - - v[5] = in1[4] * lutt6[6]; - v[5] += in1[7] * lutt6[7]; - v[5] += in1[6] * lutt6[4]; - v[5] += in2[1] * lutt6[5]; - v[5] += in2[0] * lutt6[2]; - v[5] += in2[3] * lutt6[3]; - v[5] += in2[2] * lutt6[0]; - v[5] += in2[5] * lutt6[1]; - - v[4] = in1[7] * lutt6[6]; - v[4] += in1[6] * lutt6[7]; - v[4] += in2[1] * lutt6[4]; - v[4] += in2[0] * lutt6[5]; - v[4] += in2[3] * lutt6[2]; - v[4] += in2[2] * lutt6[3]; - v[4] += in2[5] * lutt6[0]; - v[4] += in2[4] * lutt6[1]; - - v[7] = in1[6] * lutt6[6]; - v[7] += in2[1] * lutt6[7]; - v[7] += in2[0] * lutt6[4]; - v[7] += in2[3] * lutt6[5]; - v[7] += in2[2] * lutt6[2]; - v[7] += in2[5] * lutt6[3]; - v[7] += in2[4] * lutt6[0]; - v[7] += in2[7] * lutt6[1]; - - v[6] = in2[1] * lutt6[6]; - v[6] += in2[0] * lutt6[7]; - v[6] += in2[3] * lutt6[4]; - v[6] += in2[2] * lutt6[5]; - v[6] += in2[5] * lutt6[2]; - v[6] += in2[4] * lutt6[3]; - v[6] += in2[7] * lutt6[0]; - v[6] += in2[6] * lutt6[1]; - - outp[1] = ((v[1] + 0x4000) >> 15); - outp[0] = ((v[0] + 0x4000) >> 15); - outp[3] = ((v[3] + 0x4000) >> 15); - outp[2] = ((v[2] + 0x4000) >> 15); - outp[5] = ((v[5] + 0x4000) >> 15); - outp[4] = ((v[4] + 0x4000) >> 15); - outp[7] = ((v[7] + 0x4000) >> 15); - outp[6] = ((v[6] + 0x4000) >> 15); - in1 = in2; - in2 += 8; - outp += 8; - } - - memcpy(hle->dram + address, in2 - 8, 16); - memcpy(hle->alist_buffer + dmem, outbuff, count); -} - -void alist_polef( - struct hle_t* hle, - bool init, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - uint16_t gain, - int16_t* table, - uint32_t address) -{ - int16_t *dst = (int16_t*)(hle->alist_buffer + dmemo); - - const int16_t* const h1 = table; - int16_t* const h2 = table + 8; - - unsigned i; - int16_t l1, l2; - int16_t h2_before[8]; - - count = align(count, 16); - - if (init) { - l1 = 0; - l2 = 0; - } - else { - l1 = *dram_u16(hle, address + 4); - l2 = *dram_u16(hle, address + 6); - } - - for(i = 0; i < 8; ++i) { - h2_before[i] = h2[i]; - h2[i] = (((int32_t)h2[i] * gain) >> 14); - } - - do - { - int16_t frame[8]; - - for(i = 0; i < 8; ++i, dmemi += 2) - frame[i] = *alist_s16(hle, dmemi); - - for(i = 0; i < 8; ++i) { - int32_t accu = frame[i] * gain; - accu += h1[i]*l1 + h2_before[i]*l2 + rdot(i, h2, frame); - dst[i^S] = clamp_s16(accu >> 14); - } - - l1 = dst[6^S]; - l2 = dst[7^S]; - - dst += 8; - count -= 16; - } while (count != 0); - - dram_store_u32(hle, (uint32_t*)(dst - 4), address, 2); -} - -void alist_iirf( - struct hle_t* hle, - bool init, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - int16_t* table, - uint32_t address) -{ - int16_t *dst = (int16_t*)(hle->alist_buffer + dmemo); - int32_t i, prev; - int16_t frame[8]; - int16_t ibuf[4]; - uint16_t index = 7; - - - count = align(count, 16); - - if(init) - { - for(i = 0; i < 8; ++i) - frame[i] = 0; - ibuf[1] = 0; - ibuf[2] = 0; - } - else - { - frame[6] = *dram_u16(hle, address + 4); - frame[7] = *dram_u16(hle, address + 6); - ibuf[1] = (int16_t)*dram_u16(hle, address + 8); - ibuf[2] = (int16_t)*dram_u16(hle, address + 10); - } - - prev = vmulf(table[9], frame[6]) * 2; - do - { - for(i = 0; i < 8; ++i) - { - int32_t accu; - ibuf[index&3] = *alist_s16(hle, dmemi); - - accu = prev + vmulf(table[0], ibuf[index&3]) + vmulf(table[1], ibuf[(index-1)&3]) + vmulf(table[0], ibuf[(index-2)&3]); - accu += vmulf(table[8], frame[index]) * 2; - prev = vmulf(table[9], frame[index]) * 2; - dst[i^S] = frame[i] = accu; - - index=(index+1)&7; - dmemi += 2; - } - dst += 8; - count -= 0x10; - } while (count > 0); - - dram_store_u16(hle, (uint16_t*)&frame[6], address + 4, 4); - dram_store_u16(hle, (uint16_t*)&ibuf[(index-2)&3], address+8, 2); - dram_store_u16(hle, (uint16_t*)&ibuf[(index-1)&3], address+10, 2); -} - diff --git a/mupen64plus-rsp-hle/src/alist.h b/mupen64plus-rsp-hle/src/alist.h deleted file mode 100644 index 398cdb8..0000000 --- a/mupen64plus-rsp-hle/src/alist.h +++ /dev/null @@ -1,170 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - alist.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef ALIST_INTERNAL_H -#define ALIST_INTERNAL_H - -#include <stdbool.h> -#include <stddef.h> -#include <stdint.h> - -struct hle_t; - -typedef void (*acmd_callback_t)(struct hle_t* hle, uint32_t w1, uint32_t w2); - -void alist_process(struct hle_t* hle, const acmd_callback_t abi[], unsigned int abi_size); -uint32_t alist_get_address(struct hle_t* hle, uint32_t so, const uint32_t *segments, size_t n); -void alist_set_address(struct hle_t* hle, uint32_t so, uint32_t *segments, size_t n); -void alist_clear(struct hle_t* hle, uint16_t dmem, uint16_t count); -void alist_load(struct hle_t* hle, uint16_t dmem, uint32_t address, uint16_t count); -void alist_save(struct hle_t* hle, uint16_t dmem, uint32_t address, uint16_t count); -void alist_move(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count); -void alist_copy_every_other_sample(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count); -void alist_repeat64(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint8_t count); -void alist_copy_blocks(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t block_size, uint8_t count); -void alist_interleave(struct hle_t* hle, uint16_t dmemo, uint16_t left, uint16_t right, uint16_t count); - -void alist_envmix_exp( - struct hle_t* hle, - bool init, - bool aux, - uint16_t dmem_dl, uint16_t dmem_dr, - uint16_t dmem_wl, uint16_t dmem_wr, - uint16_t dmemi, uint16_t count, - int16_t dry, int16_t wet, - const int16_t *vol, - const int16_t *target, - const int32_t *rate, - uint32_t address); - -void alist_envmix_ge( - struct hle_t* hle, - bool init, - bool aux, - uint16_t dmem_dl, uint16_t dmem_dr, - uint16_t dmem_wl, uint16_t dmem_wr, - uint16_t dmemi, uint16_t count, - int16_t dry, int16_t wet, - const int16_t *vol, - const int16_t *target, - const int32_t *rate, - uint32_t address); - -void alist_envmix_lin( - struct hle_t* hle, - bool init, - uint16_t dmem_dl, uint16_t dmem_dr, - uint16_t dmem_wl, uint16_t dmem_wr, - uint16_t dmemi, uint16_t count, - int16_t dry, int16_t wet, - const int16_t *vol, - const int16_t *target, - const int32_t *rate, - uint32_t address); - -void alist_envmix_nead( - struct hle_t* hle, - bool swap_wet_LR, - uint16_t dmem_dl, - uint16_t dmem_dr, - uint16_t dmem_wl, - uint16_t dmem_wr, - uint16_t dmemi, - unsigned count, - uint16_t *env_values, - uint16_t *env_steps, - const int16_t *xors); - -void alist_mix(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count, int16_t gain); -void alist_multQ44(struct hle_t* hle, uint16_t dmem, uint16_t count, int8_t gain); -void alist_add(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count); - -void alist_adpcm( - struct hle_t* hle, - bool init, - bool loop, - bool two_bit_per_sample, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - const int16_t* codebook, - uint32_t loop_address, - uint32_t last_frame_address); - -void alist_resample( - struct hle_t* hle, - bool init, - bool flag2, - uint16_t dmemo, uint16_t dmemi, uint16_t count, - uint32_t pitch, uint32_t address); - -void alist_resample_zoh( - struct hle_t* hle, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - uint32_t pitch, - uint32_t pitch_accu); - -void alist_filter( - struct hle_t* hle, - uint16_t dmem, - uint16_t count, - uint32_t address, - const uint32_t* lut_address); - -void alist_polef( - struct hle_t* hle, - bool init, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - uint16_t gain, - int16_t* table, - uint32_t address); - -void alist_iirf( - struct hle_t* hle, - bool init, - uint16_t dmemo, - uint16_t dmemi, - uint16_t count, - int16_t* table, - uint32_t address); - -/* - * Audio flags - */ - -#define A_INIT 0x01 -#define A_CONTINUE 0x00 -#define A_LOOP 0x02 -#define A_OUT 0x02 -#define A_LEFT 0x02 -#define A_RIGHT 0x00 -#define A_VOL 0x04 -#define A_RATE 0x00 -#define A_AUX 0x08 -#define A_NOAUX 0x00 -#define A_MAIN 0x00 -#define A_MIX 0x10 - -#endif diff --git a/mupen64plus-rsp-hle/src/alist_audio.c b/mupen64plus-rsp-hle/src/alist_audio.c deleted file mode 100644 index 0d2dcea..0000000 --- a/mupen64plus-rsp-hle/src/alist_audio.c +++ /dev/null @@ -1,310 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - alist_audio.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdbool.h> -#include <stdint.h> -#include <string.h> - -#include "alist.h" -#include "common.h" -#include "hle_internal.h" -#include "memory.h" -#include "ucodes.h" - -enum { DMEM_BASE = 0x5c0 }; - -/* helper functions */ -static uint32_t get_address(struct hle_t* hle, uint32_t so) -{ - return alist_get_address(hle, so, hle->alist_audio.segments, N_SEGMENTS); -} - -static void set_address(struct hle_t* hle, uint32_t so) -{ - alist_set_address(hle, so, hle->alist_audio.segments, N_SEGMENTS); -} - -static void clear_segments(struct hle_t* hle) -{ - memset(hle->alist_audio.segments, 0, N_SEGMENTS*sizeof(hle->alist_audio.segments[0])); -} - -/* audio commands definition */ -static void SPNOOP(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUSED(w2)) -{ -} - -static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t dmem = w1 + DMEM_BASE; - uint16_t count = w2 & 0xfff; - - if (count == 0) - return; - - alist_clear(hle, dmem, align(count, 16)); -} - -static void ENVMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint32_t address = get_address(hle, w2); - - alist_envmix_exp( - hle, - flags & A_INIT, - flags & A_AUX, - hle->alist_audio.out, hle->alist_audio.dry_right, - hle->alist_audio.wet_left, hle->alist_audio.wet_right, - hle->alist_audio.in, hle->alist_audio.count, - hle->alist_audio.dry, hle->alist_audio.wet, - hle->alist_audio.vol, - hle->alist_audio.target, - hle->alist_audio.rate, - address); -} - -static void ENVMIXER_GE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint32_t address = get_address(hle, w2); - - alist_envmix_ge( - hle, - flags & A_INIT, - flags & A_AUX, - hle->alist_audio.out, hle->alist_audio.dry_right, - hle->alist_audio.wet_left, hle->alist_audio.wet_right, - hle->alist_audio.in, hle->alist_audio.count, - hle->alist_audio.dry, hle->alist_audio.wet, - hle->alist_audio.vol, - hle->alist_audio.target, - hle->alist_audio.rate, - address); -} - -static void RESAMPLE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint16_t pitch = w1; - uint32_t address = get_address(hle, w2); - - alist_resample( - hle, - flags & A_INIT, - flags & 0x2, - hle->alist_audio.out, - hle->alist_audio.in, - align(hle->alist_audio.count, 16), - pitch << 1, - address); -} - -static void SETVOL(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - - if (flags & A_AUX) { - hle->alist_audio.dry = w1; - hle->alist_audio.wet = w2; - } - else { - unsigned lr = (flags & A_LEFT) ? 0 : 1; - - if (flags & A_VOL) - hle->alist_audio.vol[lr] = w1; - else { - hle->alist_audio.target[lr] = w1; - hle->alist_audio.rate[lr] = w2; - } - } -} - -static void SETLOOP(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - hle->alist_audio.loop = get_address(hle, w2); -} - -static void ADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint32_t address = get_address(hle, w2); - - alist_adpcm( - hle, - flags & A_INIT, - flags & A_LOOP, - false, /* unsupported in this ucode */ - hle->alist_audio.out, - hle->alist_audio.in, - align(hle->alist_audio.count, 32), - hle->alist_audio.table, - hle->alist_audio.loop, - address); -} - -static void LOADBUFF(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - uint32_t address = get_address(hle, w2); - - if (hle->alist_audio.count == 0) - return; - - alist_load(hle, hle->alist_audio.in, address, hle->alist_audio.count); -} - -static void SAVEBUFF(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - uint32_t address = get_address(hle, w2); - - if (hle->alist_audio.count == 0) - return; - - alist_save(hle, hle->alist_audio.out, address, hle->alist_audio.count); -} - -static void SETBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - - if (flags & A_AUX) { - hle->alist_audio.dry_right = w1 + DMEM_BASE; - hle->alist_audio.wet_left = (w2 >> 16) + DMEM_BASE; - hle->alist_audio.wet_right = w2 + DMEM_BASE; - } else { - hle->alist_audio.in = w1 + DMEM_BASE; - hle->alist_audio.out = (w2 >> 16) + DMEM_BASE; - hle->alist_audio.count = w2; - } -} - -static void DMEMMOVE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t dmemi = w1 + DMEM_BASE; - uint16_t dmemo = (w2 >> 16) + DMEM_BASE; - uint16_t count = w2; - - if (count == 0) - return; - - alist_move(hle, dmemo, dmemi, align(count, 16)); -} - -static void LOADADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = w1; - uint32_t address = get_address(hle, w2); - - dram_load_u16(hle, (uint16_t*)hle->alist_audio.table, address, align(count, 8) >> 1); -} - -static void INTERLEAVE(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - uint16_t left = (w2 >> 16) + DMEM_BASE; - uint16_t right = w2 + DMEM_BASE; - - if (hle->alist_audio.count == 0) - return; - - alist_interleave(hle, hle->alist_audio.out, left, right, align(hle->alist_audio.count, 16)); -} - -static void MIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - int16_t gain = w1; - uint16_t dmemi = (w2 >> 16) + DMEM_BASE; - uint16_t dmemo = w2 + DMEM_BASE; - - if (hle->alist_audio.count == 0) - return; - - alist_mix(hle, dmemo, dmemi, align(hle->alist_audio.count, 32), gain); -} - -static void SEGMENT(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - set_address(hle, w2); -} - -static void POLEF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint16_t gain = w1; - uint32_t address = get_address(hle, w2); - - if (hle->alist_audio.count == 0) - return; - - alist_polef( - hle, - flags & A_INIT, - hle->alist_audio.out, - hle->alist_audio.in, - align(hle->alist_audio.count, 16), - gain, - hle->alist_audio.table, - address); -} - -/* global functions */ -void alist_process_audio(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x10] = { - SPNOOP, ADPCM , CLEARBUFF, ENVMIXER, - LOADBUFF, RESAMPLE, SAVEBUFF, SEGMENT, - SETBUFF, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, POLEF, SETLOOP - }; - - clear_segments(hle); - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_audio_ge(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x10] = { - SPNOOP, ADPCM , CLEARBUFF, ENVMIXER_GE, - LOADBUFF, RESAMPLE, SAVEBUFF, SEGMENT, - SETBUFF, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, POLEF, SETLOOP - }; - - clear_segments(hle); - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_audio_bc(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x10] = { - SPNOOP, ADPCM , CLEARBUFF, ENVMIXER_GE, - LOADBUFF, RESAMPLE, SAVEBUFF, SEGMENT, - SETBUFF, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, POLEF, SETLOOP - }; - - clear_segments(hle); - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} diff --git a/mupen64plus-rsp-hle/src/alist_naudio.c b/mupen64plus-rsp-hle/src/alist_naudio.c deleted file mode 100644 index bb53dd7..0000000 --- a/mupen64plus-rsp-hle/src/alist_naudio.c +++ /dev/null @@ -1,333 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - alist_naudio.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdbool.h> -#include <stdint.h> - -#include "alist.h" -#include "common.h" -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" -#include "ucodes.h" - -enum { NAUDIO_COUNT = 0x170 }; /* ie 184 samples */ -enum { - NAUDIO_MAIN = 0x4f0, - NAUDIO_MAIN2 = 0x660, - NAUDIO_DRY_LEFT = 0x9d0, - NAUDIO_DRY_RIGHT = 0xb40, - NAUDIO_WET_LEFT = 0xcb0, - NAUDIO_WET_RIGHT = 0xe20 -}; - - -/* audio commands definition */ -static void UNKNOWN(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t acmd = (w1 >> 24); - - HleWarnMessage(hle->user_defined, - "Unknown audio command %d: %08x %08x", - acmd, w1, w2); -} - - -static void SPNOOP(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUSED(w2)) -{ -} - -static void NAUDIO_0000(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - /* ??? */ - UNKNOWN(hle, w1, w2); -} - -static void NAUDIO_02B0(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - /* emulate code at 0x12b0 (inside SETVOL), because PC always execute in IMEM */ - hle->alist_naudio.rate[1] &= ~0xffff; - hle->alist_naudio.rate[1] |= (w2 & 0xffff); -} - -static void NAUDIO_14(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint16_t gain = w1; - uint8_t select_main = (w2 >> 24); - uint32_t address = (w2 & 0xffffff); - - uint16_t dmem = (select_main == 0) ? NAUDIO_MAIN : NAUDIO_MAIN2; - - if (hle->alist_naudio.table[0] == 0 && hle->alist_naudio.table[1] == 0) { - alist_polef( - hle, - flags & A_INIT, - dmem, - dmem, - NAUDIO_COUNT, - gain, - hle->alist_naudio.table, - address); - } - else - { - alist_iirf( - hle, - flags & A_INIT, - dmem, - dmem, - NAUDIO_COUNT, - hle->alist_naudio.table, - address); - } - -} - -static void SETVOL(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - - if (flags & A_VOL) { - if (flags & A_LEFT) { - hle->alist_naudio.vol[0] = w1; - hle->alist_naudio.dry = (w2 >> 16); - hle->alist_naudio.wet = w2; - } - else { /* A_RIGHT */ - hle->alist_naudio.target[1] = w1; - hle->alist_naudio.rate[1] = w2; - } - } - else { /* A_RATE */ - hle->alist_naudio.target[0] = w1; - hle->alist_naudio.rate[0] = w2; - } -} - -static void ENVMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint32_t address = (w2 & 0xffffff); - - hle->alist_naudio.vol[1] = w1; - - alist_envmix_lin( - hle, - flags & A_INIT, - NAUDIO_DRY_LEFT, - NAUDIO_DRY_RIGHT, - NAUDIO_WET_LEFT, - NAUDIO_WET_RIGHT, - NAUDIO_MAIN, - NAUDIO_COUNT, - hle->alist_naudio.dry, - hle->alist_naudio.wet, - hle->alist_naudio.vol, - hle->alist_naudio.target, - hle->alist_naudio.rate, - address); -} - -static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t dmem = w1 + NAUDIO_MAIN; - uint16_t count = w2 & 0xfff; - - alist_clear(hle, dmem, count); -} - -static void MIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - int16_t gain = w1; - uint16_t dmemi = (w2 >> 16) + NAUDIO_MAIN; - uint16_t dmemo = w2 + NAUDIO_MAIN; - - alist_mix(hle, dmemo, dmemi, NAUDIO_COUNT, gain); -} - -static void LOADBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = (w1 >> 12) & 0xfff; - uint16_t dmem = (w1 & 0xfff) + NAUDIO_MAIN; - uint32_t address = (w2 & 0xffffff); - - alist_load(hle, dmem, address, count); -} - -static void SAVEBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = (w1 >> 12) & 0xfff; - uint16_t dmem = (w1 & 0xfff) + NAUDIO_MAIN; - uint32_t address = (w2 & 0xffffff); - - alist_save(hle, dmem, address, count); -} - -static void LOADADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = w1; - uint32_t address = (w2 & 0xffffff); - - dram_load_u16(hle, (uint16_t*)hle->alist_naudio.table, address, count >> 1); -} - -static void DMEMMOVE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t dmemi = w1 + NAUDIO_MAIN; - uint16_t dmemo = (w2 >> 16) + NAUDIO_MAIN; - uint16_t count = w2; - - alist_move(hle, dmemo, dmemi, (count + 3) & ~3); -} - -static void SETLOOP(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - hle->alist_naudio.loop = (w2 & 0xffffff); -} - -static void ADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint32_t address = (w1 & 0xffffff); - uint8_t flags = (w2 >> 28); - uint16_t count = (w2 >> 16) & 0xfff; - uint16_t dmemi = ((w2 >> 12) & 0xf) + NAUDIO_MAIN; - uint16_t dmemo = (w2 & 0xfff) + NAUDIO_MAIN; - - alist_adpcm( - hle, - flags & A_INIT, - flags & A_LOOP, - false, /* unsuported by this ucode */ - dmemo, - dmemi, - (count + 0x1f) & ~0x1f, - hle->alist_naudio.table, - hle->alist_naudio.loop, - address); -} - -static void RESAMPLE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint32_t address = (w1 & 0xffffff); - uint8_t flags = (w2 >> 30); - uint16_t pitch = (w2 >> 14); - uint16_t dmemi = ((w2 >> 2) & 0xfff) + NAUDIO_MAIN; - uint16_t dmemo = (w2 & 0x3) ? NAUDIO_MAIN2 : NAUDIO_MAIN; - - alist_resample( - hle, - flags & A_INIT, - false, /* TODO: check which ABI supports it */ - dmemo, - dmemi, - NAUDIO_COUNT, - pitch << 1, - address); -} - -static void INTERLEAVE(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t UNUSED(w2)) -{ - alist_interleave(hle, NAUDIO_MAIN, NAUDIO_DRY_LEFT, NAUDIO_DRY_RIGHT, NAUDIO_COUNT); -} - -static void MP3ADDY(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUSED(w2)) -{ -} - -static void MP3(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - unsigned index = (w1 & 0x1e); - uint32_t address = (w2 & 0xffffff); - - mp3_task(hle, index, address); -} - -/* global functions */ -void alist_process_naudio(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x10] = { - SPNOOP, ADPCM, CLEARBUFF, ENVMIXER, - LOADBUFF, RESAMPLE, SAVEBUFF, NAUDIO_0000, - NAUDIO_0000, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, NAUDIO_02B0, SETLOOP - }; - - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_naudio_bk(struct hle_t* hle) -{ - /* TODO: see what differs from alist_process_naudio */ - static const acmd_callback_t ABI[0x10] = { - SPNOOP, ADPCM, CLEARBUFF, ENVMIXER, - LOADBUFF, RESAMPLE, SAVEBUFF, NAUDIO_0000, - NAUDIO_0000, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, NAUDIO_02B0, SETLOOP - }; - - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_naudio_dk(struct hle_t* hle) -{ - /* TODO: see what differs from alist_process_naudio */ - static const acmd_callback_t ABI[0x10] = { - SPNOOP, ADPCM, CLEARBUFF, ENVMIXER, - LOADBUFF, RESAMPLE, SAVEBUFF, MIXER, - MIXER, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, NAUDIO_02B0, SETLOOP - }; - - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_naudio_mp3(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x10] = { - UNKNOWN, ADPCM, CLEARBUFF, ENVMIXER, - LOADBUFF, RESAMPLE, SAVEBUFF, MP3, - MP3ADDY, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, NAUDIO_14, SETLOOP - }; - - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_naudio_cbfd(struct hle_t* hle) -{ - /* TODO: see what differs from alist_process_naudio_mp3 */ - static const acmd_callback_t ABI[0x10] = { - UNKNOWN, ADPCM, CLEARBUFF, ENVMIXER, - LOADBUFF, RESAMPLE, SAVEBUFF, MP3, - MP3ADDY, SETVOL, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, NAUDIO_14, SETLOOP - }; - - alist_process(hle, ABI, 0x10); - rsp_break(hle, SP_STATUS_TASKDONE); -} diff --git a/mupen64plus-rsp-hle/src/alist_nead.c b/mupen64plus-rsp-hle/src/alist_nead.c deleted file mode 100644 index 11dcb80..0000000 --- a/mupen64plus-rsp-hle/src/alist_nead.c +++ /dev/null @@ -1,556 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - alist_nead.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdbool.h> -#include <stdint.h> - -#include "alist.h" -#include "common.h" -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" -#include "ucodes.h" - -/* remove windows define to 0x06 */ -#ifdef DUPLICATE -#undef DUPLICATE -#endif - -/* audio commands definition */ -static void UNKNOWN(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t acmd = (w1 >> 24); - - HleWarnMessage(hle->user_defined, - "Unknown audio command %d: %08x %08x", - acmd, w1, w2); -} - - -static void SPNOOP(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUSED(w2)) -{ -} - -static void LOADADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = w1; - uint32_t address = (w2 & 0xffffff); - - dram_load_u16(hle, (uint16_t*)hle->alist_nead.table, address, count >> 1); -} - -static void SETLOOP(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - hle->alist_nead.loop = w2 & 0xffffff; -} - -static void SETBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - hle->alist_nead.in = w1; - hle->alist_nead.out = (w2 >> 16); - hle->alist_nead.count = w2; -} - -static void ADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint32_t address = (w2 & 0xffffff); - - alist_adpcm( - hle, - flags & 0x1, - flags & 0x2, - flags & 0x4, - hle->alist_nead.out, - hle->alist_nead.in, - (hle->alist_nead.count + 0x1f) & ~0x1f, - hle->alist_nead.table, - hle->alist_nead.loop, - address); -} - -static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t dmem = w1; - uint16_t count = w2 & 0xfff; - - if (count == 0) - return; - - alist_clear(hle, dmem, count); -} - -static void LOADBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = (w1 >> 12) & 0xfff; - uint16_t dmem = (w1 & 0xfff); - uint32_t address = (w2 & 0xffffff); - - alist_load(hle, dmem, address, count); -} - -static void SAVEBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = (w1 >> 12) & 0xfff; - uint16_t dmem = (w1 & 0xfff); - uint32_t address = (w2 & 0xffffff); - - alist_save(hle, dmem, address, count); -} - -static void MIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = (w1 >> 12) & 0xff0; - int16_t gain = w1; - uint16_t dmemi = (w2 >> 16); - uint16_t dmemo = w2; - - alist_mix(hle, dmemo, dmemi, count, gain); -} - - -static void RESAMPLE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint16_t pitch = w1; - uint32_t address = (w2 & 0xffffff); - - alist_resample( - hle, - flags & 0x1, - false, /* TODO: check which ABI supports it */ - hle->alist_nead.out, - hle->alist_nead.in, - (hle->alist_nead.count + 0xf) & ~0xf, - pitch << 1, - address); -} - -static void RESAMPLE_ZOH(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t pitch = w1; - uint16_t pitch_accu = w2; - - alist_resample_zoh( - hle, - hle->alist_nead.out, - hle->alist_nead.in, - hle->alist_nead.count, - pitch << 1, - pitch_accu); -} - -static void DMEMMOVE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t dmemi = w1; - uint16_t dmemo = (w2 >> 16); - uint16_t count = w2; - - if (count == 0) - return; - - alist_move(hle, dmemo, dmemi, (count + 3) & ~3); -} - -static void ENVSETUP1_MK(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - hle->alist_nead.env_values[2] = (w1 >> 8) & 0xff00; - hle->alist_nead.env_steps[2] = 0; - hle->alist_nead.env_steps[0] = (w2 >> 16); - hle->alist_nead.env_steps[1] = w2; -} - -static void ENVSETUP1(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - hle->alist_nead.env_values[2] = (w1 >> 8) & 0xff00; - hle->alist_nead.env_steps[2] = w1; - hle->alist_nead.env_steps[0] = (w2 >> 16); - hle->alist_nead.env_steps[1] = w2; -} - -static void ENVSETUP2(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - hle->alist_nead.env_values[0] = (w2 >> 16); - hle->alist_nead.env_values[1] = w2; -} - -static void ENVMIXER_MK(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - int16_t xors[4]; - - uint16_t dmemi = (w1 >> 12) & 0xff0; - uint8_t count = (w1 >> 8) & 0xff; - uint16_t dmem_dl = (w2 >> 20) & 0xff0; - uint16_t dmem_dr = (w2 >> 12) & 0xff0; - uint16_t dmem_wl = (w2 >> 4) & 0xff0; - uint16_t dmem_wr = (w2 << 4) & 0xff0; - - xors[2] = 0; /* unsupported by this ucode */ - xors[3] = 0; /* unsupported by this ucode */ - xors[0] = 0 - (int16_t)((w1 & 0x2) >> 1); - xors[1] = 0 - (int16_t)((w1 & 0x1) ); - - alist_envmix_nead( - hle, - false, /* unsupported by this ucode */ - dmem_dl, dmem_dr, - dmem_wl, dmem_wr, - dmemi, count, - hle->alist_nead.env_values, - hle->alist_nead.env_steps, - xors); -} - -static void ENVMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - int16_t xors[4]; - - uint16_t dmemi = (w1 >> 12) & 0xff0; - uint8_t count = (w1 >> 8) & 0xff; - bool swap_wet_LR = (w1 >> 4) & 0x1; - uint16_t dmem_dl = (w2 >> 20) & 0xff0; - uint16_t dmem_dr = (w2 >> 12) & 0xff0; - uint16_t dmem_wl = (w2 >> 4) & 0xff0; - uint16_t dmem_wr = (w2 << 4) & 0xff0; - - xors[2] = 0 - (int16_t)((w1 & 0x8) >> 1); - xors[3] = 0 - (int16_t)((w1 & 0x4) >> 1); - xors[0] = 0 - (int16_t)((w1 & 0x2) >> 1); - xors[1] = 0 - (int16_t)((w1 & 0x1) ); - - alist_envmix_nead( - hle, - swap_wet_LR, - dmem_dl, dmem_dr, - dmem_wl, dmem_wr, - dmemi, count, - hle->alist_nead.env_values, - hle->alist_nead.env_steps, - xors); -} - -static void DUPLICATE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t count = (w1 >> 16); - uint16_t dmemi = w1; - uint16_t dmemo = (w2 >> 16); - - alist_repeat64(hle, dmemo, dmemi, count); -} - -static void INTERL(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = w1; - uint16_t dmemi = (w2 >> 16); - uint16_t dmemo = w2; - - alist_copy_every_other_sample(hle, dmemo, dmemi, count); -} - -static void INTERLEAVE_MK(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2) -{ - uint16_t left = (w2 >> 16); - uint16_t right = w2; - - if (hle->alist_nead.count == 0) - return; - - alist_interleave(hle, hle->alist_nead.out, left, right, hle->alist_nead.count); -} - -static void INTERLEAVE(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = ((w1 >> 12) & 0xff0); - uint16_t dmemo = w1; - uint16_t left = (w2 >> 16); - uint16_t right = w2; - - alist_interleave(hle, dmemo, left, right, count); -} - -static void ADDMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint16_t count = (w1 >> 12) & 0xff0; - uint16_t dmemi = (w2 >> 16); - uint16_t dmemo = w2; - - alist_add(hle, dmemo, dmemi, count); -} - -static void HILOGAIN(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - int8_t gain = (w1 >> 16); /* Q4.4 signed */ - uint16_t count = w1 & 0xfff; - uint16_t dmem = (w2 >> 16); - - alist_multQ44(hle, dmem, count, gain); -} - -static void FILTER(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint32_t address = (w2 & 0xffffff); - - if (flags > 1) { - hle->alist_nead.filter_count = w1; - hle->alist_nead.filter_lut_address[0] = address; /* t6 */ - } - else { - uint16_t dmem = w1; - - hle->alist_nead.filter_lut_address[1] = address + 0x10; /* t5 */ - alist_filter(hle, dmem, hle->alist_nead.filter_count, address, hle->alist_nead.filter_lut_address); - } -} - -static void SEGMENT(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUSED(w2)) -{ -} - -static void NEAD_16(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t count = (w1 >> 16); - uint16_t dmemi = w1; - uint16_t dmemo = (w2 >> 16); - uint16_t block_size = w2; - - alist_copy_blocks(hle, dmemo, dmemi, block_size, count); -} - -static void POLEF(struct hle_t* hle, uint32_t w1, uint32_t w2) -{ - uint8_t flags = (w1 >> 16); - uint16_t gain = w1; - uint32_t address = (w2 & 0xffffff); - - if (hle->alist_nead.count == 0) - return; - - alist_polef( - hle, - flags & A_INIT, - hle->alist_nead.out, - hle->alist_nead.in, - hle->alist_nead.count, - gain, - hle->alist_nead.table, - address); -} - - -void alist_process_nead_mk(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x20] = { - SPNOOP, ADPCM, CLEARBUFF, SPNOOP, - SPNOOP, RESAMPLE, SPNOOP, SEGMENT, - SETBUFF, SPNOOP, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE_MK, POLEF, SETLOOP, - NEAD_16, INTERL, ENVSETUP1_MK, ENVMIXER_MK, - LOADBUFF, SAVEBUFF, ENVSETUP2, SPNOOP, - SPNOOP, SPNOOP, SPNOOP, SPNOOP, - SPNOOP, SPNOOP, SPNOOP, SPNOOP - }; - - alist_process(hle, ABI, 0x20); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_sf(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x20] = { - SPNOOP, ADPCM, CLEARBUFF, SPNOOP, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, SPNOOP, - SETBUFF, SPNOOP, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE_MK, POLEF, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, SPNOOP, - HILOGAIN, UNKNOWN, DUPLICATE, SPNOOP, - SPNOOP, SPNOOP, SPNOOP, SPNOOP - }; - - alist_process(hle, ABI, 0x20); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_sfj(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x20] = { - SPNOOP, ADPCM, CLEARBUFF, SPNOOP, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, SPNOOP, - SETBUFF, SPNOOP, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE_MK, POLEF, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN, - HILOGAIN, UNKNOWN, DUPLICATE, SPNOOP, - SPNOOP, SPNOOP, SPNOOP, SPNOOP - }; - - alist_process(hle, ABI, 0x20); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_fz(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x20] = { - UNKNOWN, ADPCM, CLEARBUFF, SPNOOP, - ADDMIXER, RESAMPLE, SPNOOP, SPNOOP, - SETBUFF, SPNOOP, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, SPNOOP, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN, - SPNOOP, UNKNOWN, DUPLICATE, SPNOOP, - SPNOOP, SPNOOP, SPNOOP, SPNOOP - }; - - alist_process(hle, ABI, 0x20); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_wrjb(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x20] = { - SPNOOP, ADPCM, CLEARBUFF, UNKNOWN, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, SPNOOP, - SETBUFF, SPNOOP, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, SPNOOP, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN, - HILOGAIN, UNKNOWN, DUPLICATE, FILTER, - SPNOOP, SPNOOP, SPNOOP, SPNOOP - }; - - alist_process(hle, ABI, 0x20); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_ys(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x18] = { - UNKNOWN, ADPCM, CLEARBUFF, UNKNOWN, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, FILTER, - SETBUFF, DUPLICATE, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, HILOGAIN, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN - }; - - alist_process(hle, ABI, 0x18); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_1080(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x18] = { - UNKNOWN, ADPCM, CLEARBUFF, UNKNOWN, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, FILTER, - SETBUFF, DUPLICATE, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, HILOGAIN, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN - }; - - alist_process(hle, ABI, 0x18); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_oot(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x18] = { - UNKNOWN, ADPCM, CLEARBUFF, UNKNOWN, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, FILTER, - SETBUFF, DUPLICATE, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, HILOGAIN, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN - }; - - alist_process(hle, ABI, 0x18); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_mm(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x18] = { - UNKNOWN, ADPCM, CLEARBUFF, SPNOOP, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, FILTER, - SETBUFF, DUPLICATE, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, HILOGAIN, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN - }; - - alist_process(hle, ABI, 0x18); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_mmb(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x18] = { - SPNOOP, ADPCM, CLEARBUFF, SPNOOP, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, FILTER, - SETBUFF, DUPLICATE, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, HILOGAIN, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN - }; - - alist_process(hle, ABI, 0x18); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_ac(struct hle_t* hle) -{ - static const acmd_callback_t ABI[0x18] = { - UNKNOWN, ADPCM, CLEARBUFF, SPNOOP, - ADDMIXER, RESAMPLE, RESAMPLE_ZOH, FILTER, - SETBUFF, DUPLICATE, DMEMMOVE, LOADADPCM, - MIXER, INTERLEAVE, HILOGAIN, SETLOOP, - NEAD_16, INTERL, ENVSETUP1, ENVMIXER, - LOADBUFF, SAVEBUFF, ENVSETUP2, UNKNOWN - }; - - alist_process(hle, ABI, 0x18); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void alist_process_nead_mats(struct hle_t* hle) -{ - /* FIXME: implement proper ucode - * Forward the task if possible, - * otherwise better to have no sound than garbage sound - */ - if (HleForwardTask(hle->user_defined) != 0) { - rsp_break(hle, SP_STATUS_TASKDONE); - } -} - -void alist_process_nead_efz(struct hle_t* hle) -{ - /* FIXME: implement proper ucode - * Forward the task if possible, - * otherwise use FZero ucode which should be very similar - */ - if (HleForwardTask(hle->user_defined) != 0) { - alist_process_nead_fz(hle); - } -} diff --git a/mupen64plus-rsp-hle/src/arithmetics.h b/mupen64plus-rsp-hle/src/arithmetics.h deleted file mode 100644 index 2250b24..0000000 --- a/mupen64plus-rsp-hle/src/arithmetics.h +++ /dev/null @@ -1,43 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - arithmetics.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef ARITHMETICS_H -#define ARITHMETICS_H - -#include <stdint.h> - -#include "common.h" - -static inline int16_t clamp_s16(int_fast32_t x) -{ - x = (x < INT16_MIN) ? INT16_MIN: x; - x = (x > INT16_MAX) ? INT16_MAX: x; - - return x; -} - -static inline int32_t vmulf(int16_t x, int16_t y) -{ - return (((int32_t)(x))*((int32_t)(y))+0x4000)>>15; -} - -#endif - diff --git a/mupen64plus-rsp-hle/src/audio.c b/mupen64plus-rsp-hle/src/audio.c deleted file mode 100644 index fac2a10..0000000 --- a/mupen64plus-rsp-hle/src/audio.c +++ /dev/null @@ -1,128 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - audio.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <assert.h> -#include <stddef.h> -#include <stdint.h> - -#include "arithmetics.h" - -const int16_t RESAMPLE_LUT[64 * 4] = { - (int16_t)0x0c39, (int16_t)0x66ad, (int16_t)0x0d46, (int16_t)0xffdf, - (int16_t)0x0b39, (int16_t)0x6696, (int16_t)0x0e5f, (int16_t)0xffd8, - (int16_t)0x0a44, (int16_t)0x6669, (int16_t)0x0f83, (int16_t)0xffd0, - (int16_t)0x095a, (int16_t)0x6626, (int16_t)0x10b4, (int16_t)0xffc8, - (int16_t)0x087d, (int16_t)0x65cd, (int16_t)0x11f0, (int16_t)0xffbf, - (int16_t)0x07ab, (int16_t)0x655e, (int16_t)0x1338, (int16_t)0xffb6, - (int16_t)0x06e4, (int16_t)0x64d9, (int16_t)0x148c, (int16_t)0xffac, - (int16_t)0x0628, (int16_t)0x643f, (int16_t)0x15eb, (int16_t)0xffa1, - (int16_t)0x0577, (int16_t)0x638f, (int16_t)0x1756, (int16_t)0xff96, - (int16_t)0x04d1, (int16_t)0x62cb, (int16_t)0x18cb, (int16_t)0xff8a, - (int16_t)0x0435, (int16_t)0x61f3, (int16_t)0x1a4c, (int16_t)0xff7e, - (int16_t)0x03a4, (int16_t)0x6106, (int16_t)0x1bd7, (int16_t)0xff71, - (int16_t)0x031c, (int16_t)0x6007, (int16_t)0x1d6c, (int16_t)0xff64, - (int16_t)0x029f, (int16_t)0x5ef5, (int16_t)0x1f0b, (int16_t)0xff56, - (int16_t)0x022a, (int16_t)0x5dd0, (int16_t)0x20b3, (int16_t)0xff48, - (int16_t)0x01be, (int16_t)0x5c9a, (int16_t)0x2264, (int16_t)0xff3a, - (int16_t)0x015b, (int16_t)0x5b53, (int16_t)0x241e, (int16_t)0xff2c, - (int16_t)0x0101, (int16_t)0x59fc, (int16_t)0x25e0, (int16_t)0xff1e, - (int16_t)0x00ae, (int16_t)0x5896, (int16_t)0x27a9, (int16_t)0xff10, - (int16_t)0x0063, (int16_t)0x5720, (int16_t)0x297a, (int16_t)0xff02, - (int16_t)0x001f, (int16_t)0x559d, (int16_t)0x2b50, (int16_t)0xfef4, - (int16_t)0xffe2, (int16_t)0x540d, (int16_t)0x2d2c, (int16_t)0xfee8, - (int16_t)0xffac, (int16_t)0x5270, (int16_t)0x2f0d, (int16_t)0xfedb, - (int16_t)0xff7c, (int16_t)0x50c7, (int16_t)0x30f3, (int16_t)0xfed0, - (int16_t)0xff53, (int16_t)0x4f14, (int16_t)0x32dc, (int16_t)0xfec6, - (int16_t)0xff2e, (int16_t)0x4d57, (int16_t)0x34c8, (int16_t)0xfebd, - (int16_t)0xff0f, (int16_t)0x4b91, (int16_t)0x36b6, (int16_t)0xfeb6, - (int16_t)0xfef5, (int16_t)0x49c2, (int16_t)0x38a5, (int16_t)0xfeb0, - (int16_t)0xfedf, (int16_t)0x47ed, (int16_t)0x3a95, (int16_t)0xfeac, - (int16_t)0xfece, (int16_t)0x4611, (int16_t)0x3c85, (int16_t)0xfeab, - (int16_t)0xfec0, (int16_t)0x4430, (int16_t)0x3e74, (int16_t)0xfeac, - (int16_t)0xfeb6, (int16_t)0x424a, (int16_t)0x4060, (int16_t)0xfeaf, - (int16_t)0xfeaf, (int16_t)0x4060, (int16_t)0x424a, (int16_t)0xfeb6, - (int16_t)0xfeac, (int16_t)0x3e74, (int16_t)0x4430, (int16_t)0xfec0, - (int16_t)0xfeab, (int16_t)0x3c85, (int16_t)0x4611, (int16_t)0xfece, - (int16_t)0xfeac, (int16_t)0x3a95, (int16_t)0x47ed, (int16_t)0xfedf, - (int16_t)0xfeb0, (int16_t)0x38a5, (int16_t)0x49c2, (int16_t)0xfef5, - (int16_t)0xfeb6, (int16_t)0x36b6, (int16_t)0x4b91, (int16_t)0xff0f, - (int16_t)0xfebd, (int16_t)0x34c8, (int16_t)0x4d57, (int16_t)0xff2e, - (int16_t)0xfec6, (int16_t)0x32dc, (int16_t)0x4f14, (int16_t)0xff53, - (int16_t)0xfed0, (int16_t)0x30f3, (int16_t)0x50c7, (int16_t)0xff7c, - (int16_t)0xfedb, (int16_t)0x2f0d, (int16_t)0x5270, (int16_t)0xffac, - (int16_t)0xfee8, (int16_t)0x2d2c, (int16_t)0x540d, (int16_t)0xffe2, - (int16_t)0xfef4, (int16_t)0x2b50, (int16_t)0x559d, (int16_t)0x001f, - (int16_t)0xff02, (int16_t)0x297a, (int16_t)0x5720, (int16_t)0x0063, - (int16_t)0xff10, (int16_t)0x27a9, (int16_t)0x5896, (int16_t)0x00ae, - (int16_t)0xff1e, (int16_t)0x25e0, (int16_t)0x59fc, (int16_t)0x0101, - (int16_t)0xff2c, (int16_t)0x241e, (int16_t)0x5b53, (int16_t)0x015b, - (int16_t)0xff3a, (int16_t)0x2264, (int16_t)0x5c9a, (int16_t)0x01be, - (int16_t)0xff48, (int16_t)0x20b3, (int16_t)0x5dd0, (int16_t)0x022a, - (int16_t)0xff56, (int16_t)0x1f0b, (int16_t)0x5ef5, (int16_t)0x029f, - (int16_t)0xff64, (int16_t)0x1d6c, (int16_t)0x6007, (int16_t)0x031c, - (int16_t)0xff71, (int16_t)0x1bd7, (int16_t)0x6106, (int16_t)0x03a4, - (int16_t)0xff7e, (int16_t)0x1a4c, (int16_t)0x61f3, (int16_t)0x0435, - (int16_t)0xff8a, (int16_t)0x18cb, (int16_t)0x62cb, (int16_t)0x04d1, - (int16_t)0xff96, (int16_t)0x1756, (int16_t)0x638f, (int16_t)0x0577, - (int16_t)0xffa1, (int16_t)0x15eb, (int16_t)0x643f, (int16_t)0x0628, - (int16_t)0xffac, (int16_t)0x148c, (int16_t)0x64d9, (int16_t)0x06e4, - (int16_t)0xffb6, (int16_t)0x1338, (int16_t)0x655e, (int16_t)0x07ab, - (int16_t)0xffbf, (int16_t)0x11f0, (int16_t)0x65cd, (int16_t)0x087d, - (int16_t)0xffc8, (int16_t)0x10b4, (int16_t)0x6626, (int16_t)0x095a, - (int16_t)0xffd0, (int16_t)0x0f83, (int16_t)0x6669, (int16_t)0x0a44, - (int16_t)0xffd8, (int16_t)0x0e5f, (int16_t)0x6696, (int16_t)0x0b39, - (int16_t)0xffdf, (int16_t)0x0d46, (int16_t)0x66ad, (int16_t)0x0c39 -}; - -int32_t rdot(size_t n, const int16_t *x, const int16_t *y) -{ - int32_t accu = 0; - - y += n; - - while (n != 0) { - accu += *(x++) * *(--y); - --n; - } - - return accu; -} - -void adpcm_compute_residuals(int16_t* dst, const int16_t* src, - const int16_t* cb_entry, const int16_t* last_samples, size_t count) -{ - const int16_t* const book1 = cb_entry; - const int16_t* const book2 = cb_entry + 8; - - const int16_t l1 = last_samples[0]; - const int16_t l2 = last_samples[1]; - - size_t i; - - assert(count <= 8); - - for(i = 0; i < count; ++i) { - int32_t accu = (int32_t)src[i] << 11; - accu += book1[i]*l1 + book2[i]*l2 + rdot(i, book2, src); - dst[i] = clamp_s16(accu >> 11); - } -} - diff --git a/mupen64plus-rsp-hle/src/audio.h b/mupen64plus-rsp-hle/src/audio.h deleted file mode 100644 index 21c7a09..0000000 --- a/mupen64plus-rsp-hle/src/audio.h +++ /dev/null @@ -1,45 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - audio.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef AUDIO_H -#define AUDIO_H - -#include <stddef.h> -#include <stdint.h> - -#include "common.h" - -extern const int16_t RESAMPLE_LUT[64 * 4]; - -int32_t rdot(size_t n, const int16_t *x, const int16_t *y); - -static inline int16_t adpcm_predict_sample(uint8_t byte, uint8_t mask, - unsigned lshift, unsigned rshift) -{ - int16_t sample = (uint16_t)(byte & mask) << lshift; - sample >>= rshift; /* signed */ - return sample; -} - -void adpcm_compute_residuals(int16_t* dst, const int16_t* src, - const int16_t* cb_entry, const int16_t* last_samples, size_t count); - -#endif diff --git a/mupen64plus-rsp-hle/src/cicx105.c b/mupen64plus-rsp-hle/src/cicx105.c deleted file mode 100644 index bda5eca..0000000 --- a/mupen64plus-rsp-hle/src/cicx105.c +++ /dev/null @@ -1,56 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - cicx105.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2012 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <string.h> - -#include "hle_internal.h" - -/** - * During IPL3 stage of CIC x105 games, the RSP performs some checks and transactions - * necessary for booting the game. - * - * We only implement the needed DMA transactions for booting. - * - * Found in Banjo-Tooie, Zelda, Perfect Dark, ...) - **/ -void cicx105_ucode(struct hle_t* hle) -{ - /* memcpy is okay to use because access constrains are met (alignment, size) */ - unsigned int i; - unsigned char *dst = hle->dram + 0x2fb1f0; - unsigned char *src = hle->imem + 0x120; - - /* dma_read(0x1120, 0x1e8, 0x1e8) */ - memcpy(hle->imem + 0x120, hle->dram + 0x1e8, 0x1f0); - - /* dma_write(0x1120, 0x2fb1f0, 0xfe817000) */ - for (i = 0; i < 24; ++i) { - memcpy(dst, src, 8); - dst += 0xff0; - src += 0x8; - - } - - rsp_break(hle, 0); -} - diff --git a/mupen64plus-rsp-hle/src/common.h b/mupen64plus-rsp-hle/src/common.h deleted file mode 100644 index cd5dfa6..0000000 --- a/mupen64plus-rsp-hle/src/common.h +++ /dev/null @@ -1,38 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - common.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef COMMON_H -#define COMMON_H - -/* macro for unused variable warning suppression */ -#ifdef __GNUC__ -# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) -#else -# define UNUSED(x) UNUSED_ ## x -#endif - -/* macro for inline keyword */ -#ifdef _MSC_VER -#define inline __inline -#endif - -#endif - diff --git a/mupen64plus-rsp-hle/src/hle.c b/mupen64plus-rsp-hle/src/hle.c deleted file mode 100644 index 4e65113..0000000 --- a/mupen64plus-rsp-hle/src/hle.c +++ /dev/null @@ -1,524 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - hle.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2012 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdbool.h> -#include <stdint.h> - -#ifdef ENABLE_TASK_DUMP -#include <stdio.h> -#endif - -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" -#include "ucodes.h" - -#define min(a,b) (((a) < (b)) ? (a) : (b)) - -/* some rdp status flags */ -#define DP_STATUS_FREEZE 0x2 - - - -/* helper functions prototypes */ -static unsigned int sum_bytes(const unsigned char *bytes, unsigned int size); -static bool is_task(struct hle_t* hle); -static void send_dlist_to_gfx_plugin(struct hle_t* hle); -static ucode_func_t try_audio_task_detection(struct hle_t* hle); -static ucode_func_t try_normal_task_detection(struct hle_t* hle); -static ucode_func_t non_task_detection(struct hle_t* hle); -static ucode_func_t task_detection(struct hle_t* hle); - -#ifdef ENABLE_TASK_DUMP -static void dump_binary(struct hle_t* hle, const char *const filename, - const unsigned char *const bytes, unsigned int size); -static void dump_task(struct hle_t* hle, const char *const filename); -static void dump_unknown_task(struct hle_t* hle, unsigned int uc_start); -static void dump_unknown_non_task(struct hle_t* hle, unsigned int uc_start); -#endif - -/* Global functions */ -void hle_init(struct hle_t* hle, - unsigned char* dram, - unsigned char* dmem, - unsigned char* imem, - unsigned int* mi_intr, - unsigned int* sp_mem_addr, - unsigned int* sp_dram_addr, - unsigned int* sp_rd_length, - unsigned int* sp_wr_length, - unsigned int* sp_status, - unsigned int* sp_dma_full, - unsigned int* sp_dma_busy, - unsigned int* sp_pc, - unsigned int* sp_semaphore, - unsigned int* dpc_start, - unsigned int* dpc_end, - unsigned int* dpc_current, - unsigned int* dpc_status, - unsigned int* dpc_clock, - unsigned int* dpc_bufbusy, - unsigned int* dpc_pipebusy, - unsigned int* dpc_tmem, - void* user_defined) -{ - hle->dram = dram; - hle->dmem = dmem; - hle->imem = imem; - hle->mi_intr = mi_intr; - hle->sp_mem_addr = sp_mem_addr; - hle->sp_dram_addr = sp_dram_addr; - hle->sp_rd_length = sp_rd_length; - hle->sp_wr_length = sp_wr_length; - hle->sp_status = sp_status; - hle->sp_dma_full = sp_dma_full; - hle->sp_dma_busy = sp_dma_busy; - hle->sp_pc = sp_pc; - hle->sp_semaphore = sp_semaphore; - hle->dpc_start = dpc_start; - hle->dpc_end = dpc_end; - hle->dpc_current = dpc_current; - hle->dpc_status = dpc_status; - hle->dpc_clock = dpc_clock; - hle->dpc_bufbusy = dpc_bufbusy; - hle->dpc_pipebusy = dpc_pipebusy; - hle->dpc_tmem = dpc_tmem; - hle->user_defined = user_defined; -} - -void hle_execute(struct hle_t* hle) -{ - uint32_t uc_start = *dmem_u32(hle, TASK_UCODE); - uint32_t uc_dstart = *dmem_u32(hle, TASK_UCODE_DATA); - uint32_t uc_dsize = *dmem_u32(hle, TASK_UCODE_DATA_SIZE); - - bool match = false; - struct cached_ucodes_t * cached_ucodes = &hle->cached_ucodes; - struct ucode_info_t *info = NULL; - if (cached_ucodes->count > 0) - info = &cached_ucodes->infos[cached_ucodes->count-1]; - for (int i = 0; i < cached_ucodes->count; i++) - { - if (info->uc_start == uc_start && info->uc_dstart == uc_dstart && info->uc_dsize == uc_dsize) - { - match = true; - break; - } - info--; - } - - if (!match) - { - info = &cached_ucodes->infos[cached_ucodes->count]; - info->uc_start = uc_start; - info->uc_dstart = uc_dstart; - info->uc_dsize = uc_dsize; - info->uc_pfunc = task_detection(hle); - cached_ucodes->count++; - assert(cached_ucodes->count <= CACHED_UCODES_MAX_SIZE); - assert(info->uc_pfunc != NULL); - } - - info->uc_pfunc(hle); -} - -/* local functions */ -static unsigned int sum_bytes(const unsigned char *bytes, unsigned int size) -{ - unsigned int sum = 0; - const unsigned char *const bytes_end = bytes + size; - - while (bytes != bytes_end) - sum += *bytes++; - - return sum; -} - -/** - * Try to figure if the RSP was launched using osSpTask* functions - * and not run directly (in which case DMEM[0xfc0-0xfff] is meaningless). - * - * Previously, the ucode_size field was used to determine this, - * but it is not robust enough (hi Pokemon Stadium !) because games could write anything - * in this field : most ucode_boot discard the value and just use 0xf7f anyway. - * - * Using ucode_boot_size should be more robust in this regard. - **/ -static bool is_task(struct hle_t* hle) -{ - return (*dmem_u32(hle, TASK_UCODE_BOOT_SIZE) <= 0x1000); -} - -void rsp_break(struct hle_t* hle, unsigned int setbits) -{ - *hle->sp_status |= setbits | SP_STATUS_BROKE | SP_STATUS_HALT; - - if ((*hle->sp_status & SP_STATUS_INTR_ON_BREAK)) { - *hle->mi_intr |= MI_INTR_SP; - HleCheckInterrupts(hle->user_defined); - } -} - -static void send_alist_to_audio_plugin(struct hle_t* hle) -{ - HleProcessAlistList(hle->user_defined); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -static void send_dlist_to_gfx_plugin(struct hle_t* hle) -{ - /* Since GFX_INFO version 2, these bits are set before calling the ProcessDlistList function. - * And the GFX plugin is responsible to unset them if needed. - * For GFX_INFO version < 2, the GFX plugin didn't have access to sp_status so - * it doesn't matter if we set these bits before calling ProcessDlistList function. - */ - *hle->sp_status |= SP_STATUS_TASKDONE | SP_STATUS_BROKE | SP_STATUS_HALT; - - HleProcessDlistList(hle->user_defined); - - if ((*hle->sp_status & SP_STATUS_INTR_ON_BREAK) && (*hle->sp_status & (SP_STATUS_TASKDONE | SP_STATUS_BROKE | SP_STATUS_HALT))) { - *hle->mi_intr |= MI_INTR_SP; - HleCheckInterrupts(hle->user_defined); - } -} - -static void task_done(struct hle_t* hle) -{ - rsp_break(hle, SP_STATUS_TASKDONE); -} - -static void unknown_ucode(struct hle_t* hle) -{ - /* Forward task to RSP Fallback. - * If task is not forwarded, use the regular "unknown ucode" path */ - if (HleForwardTask(hle->user_defined) != 0) { - - uint32_t uc_start = *dmem_u32(hle, TASK_UCODE); - HleWarnMessage(hle->user_defined, "unknown RSP code: uc_start: %x PC:%x", uc_start, *hle->sp_pc); -#ifdef ENABLE_TASK_DUMP - dump_unknown_non_task(hle, uc_start); -#endif - } -} - -static void unknown_task(struct hle_t* hle) -{ - /* Forward task to RSP Fallback. - * If task is not forwarded, use the regular "unknown task" path */ - if (HleForwardTask(hle->user_defined) != 0) { - - /* Send task_done signal for unknown ucodes to allow further processings */ - rsp_break(hle, SP_STATUS_TASKDONE); - - uint32_t uc_start = *dmem_u32(hle, TASK_UCODE); - HleWarnMessage(hle->user_defined, "unknown OSTask: uc_start: %x PC:%x", uc_start, *hle->sp_pc); -#ifdef ENABLE_TASK_DUMP - dump_unknown_task(hle, uc_start); -#endif - } -} - -static ucode_func_t try_audio_task_detection(struct hle_t* hle) -{ - /* identify audio ucode by using the content of ucode_data */ - uint32_t ucode_data = *dmem_u32(hle, TASK_UCODE_DATA); - uint32_t v; - - if (*dram_u32(hle, ucode_data) == 0x00000001) { - if (*dram_u32(hle, ucode_data + 0x30) == 0xf0000f00) { - v = *dram_u32(hle, ucode_data + 0x28); - switch(v) - { - case 0x1e24138c: /* audio ABI (most common) */ - return &alist_process_audio; - case 0x1dc8138c: /* GoldenEye */ - return &alist_process_audio_ge; - case 0x1e3c1390: /* BlastCorp, DiddyKongRacing */ - return &alist_process_audio_bc; - default: - HleWarnMessage(hle->user_defined, "ABI1 identification regression: v=%08x", v); - } - } else { - v = *dram_u32(hle, ucode_data + 0x10); - switch(v) - { - case 0x11181350: /* MarioKart, WaveRace (E) */ - return &alist_process_nead_mk; - case 0x111812e0: /* StarFox (J) */ - return &alist_process_nead_sfj; - case 0x110412ac: /* WaveRace (J RevB) */ - return &alist_process_nead_wrjb; - case 0x110412cc: /* StarFox/LylatWars (except J) */ - return &alist_process_nead_sf; - case 0x1cd01250: /* FZeroX */ - return &alist_process_nead_fz; - case 0x1f08122c: /* YoshisStory */ - return &alist_process_nead_ys; - case 0x1f38122c: /* 1080° Snowboarding */ - return &alist_process_nead_1080; - case 0x1f681230: /* Zelda OoT / Zelda MM (J, J RevA) */ - return &alist_process_nead_oot; - case 0x1f801250: /* Zelda MM (except J, J RevA, E Beta), PokemonStadium 2 */ - return &alist_process_nead_mm; - case 0x109411f8: /* Zelda MM (E Beta) */ - return &alist_process_nead_mmb; - case 0x1eac11b8: /* AnimalCrossing */ - return &alist_process_nead_ac; - case 0x00010010: /* MusyX v2 (IndianaJones, BattleForNaboo) */ - return &musyx_v2_task; - case 0x1f701238: /* Mario Artist Talent Studio */ - return &alist_process_nead_mats; - case 0x1f4c1230: /* FZeroX Expansion */ - return &alist_process_nead_efz; - default: - HleWarnMessage(hle->user_defined, "ABI2 identification regression: v=%08x", v); - } - } - } else { - v = *dram_u32(hle, ucode_data + 0x10); - switch(v) - { - case 0x00000001: /* MusyX v1 - RogueSquadron, ResidentEvil2, PolarisSnoCross, - TheWorldIsNotEnough, RugratsInParis, NBAShowTime, - HydroThunder, Tarzan, GauntletLegend, Rush2049 */ - return &musyx_v1_task; - case 0x0000127c: /* naudio (many games) */ - return &alist_process_naudio; - case 0x00001280: /* BanjoKazooie */ - return &alist_process_naudio_bk; - case 0x1c58126c: /* DonkeyKong */ - return &alist_process_naudio_dk; - case 0x1ae8143c: /* BanjoTooie, JetForceGemini, MickeySpeedWayUSA, PerfectDark */ - return &alist_process_naudio_mp3; - case 0x1ab0140c: /* ConkerBadFurDay */ - return &alist_process_naudio_cbfd; - - default: - HleWarnMessage(hle->user_defined, "ABI3 identification regression: v=%08x", v); - } - } - - return NULL; -} - -static ucode_func_t try_normal_task_detection(struct hle_t* hle) -{ - unsigned int sum = - sum_bytes((void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE)), min(*dmem_u32(hle, TASK_UCODE_SIZE), 0xf80) >> 1); - - switch (sum) { - /* StoreVe12: found in Zelda Ocarina of Time [misleading task->type == 4] */ - case 0x278: - /* Nothing to emulate */ - return &task_done; - - /* GFX: Twintris [misleading task->type == 0] */ - case 0x212ee: - if (hle->hle_gfx) { - return &send_dlist_to_gfx_plugin; - } - return NULL; - - /* JPEG: found in Pokemon Stadium J */ - case 0x2c85a: - return &jpeg_decode_PS0; - - /* JPEG: found in Zelda Ocarina of Time, Pokemon Stadium 1, Pokemon Stadium 2 */ - case 0x2caa6: - return &jpeg_decode_PS; - - /* JPEG: found in Ogre Battle, Bottom of the 9th */ - case 0x130de: - case 0x278b0: - return &jpeg_decode_OB; - } - - /* Resident Evil 2 */ - sum = sum_bytes((void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE)), 256); - switch (sum) { - - case 0x450f: - return &resize_bilinear_task; - - case 0x3b44: - return &decode_video_frame_task; - - case 0x3d84: - return &fill_video_double_buffer_task; - } - - /* HVQM */ - sum = sum_bytes((void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE)), 1488); - switch (sum) { - case 0x19495: - return &hvqm2_decode_sp1_task; - - case 0x19728: - return &hvqm2_decode_sp2_task; - } - - return NULL; -} - -static ucode_func_t non_task_detection(struct hle_t* hle) -{ - const unsigned int sum = sum_bytes(hle->imem, 44); - - if (sum == 0x9e2) - { - /* CIC x105 ucode (used during boot of CIC x105 games) */ - return &cicx105_ucode; - } - return &unknown_ucode; -} - -static ucode_func_t task_detection(struct hle_t* hle) -{ - if (is_task(hle)) { - ucode_func_t uc_pfunc; - uint32_t type = *dmem_u32(hle, TASK_TYPE); - - if (type == 2) { - if (hle->hle_aud) { - return &send_alist_to_audio_plugin; - } - uc_pfunc = try_audio_task_detection(hle); - if (uc_pfunc) - return uc_pfunc; - } - - uc_pfunc = try_normal_task_detection(hle); - if (uc_pfunc) - return uc_pfunc; - - if (type == 1) { - if (hle->hle_gfx) { - return &send_dlist_to_gfx_plugin; - } - } - - return &unknown_task; - } - else { - return non_task_detection(hle); - } -} - -#ifdef ENABLE_TASK_DUMP -static void dump_unknown_task(struct hle_t* hle, unsigned int uc_start) -{ - char filename[256]; - uint32_t ucode = *dmem_u32(hle, TASK_UCODE); - uint32_t ucode_data = *dmem_u32(hle, TASK_UCODE_DATA); - uint32_t data_ptr = *dmem_u32(hle, TASK_DATA_PTR); - - sprintf(&filename[0], "task_%x.log", uc_start); - dump_task(hle, filename); - - /* dump ucode_boot */ - sprintf(&filename[0], "ucode_boot_%x.bin", uc_start); - dump_binary(hle, filename, (void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE_BOOT)), *dmem_u32(hle, TASK_UCODE_BOOT_SIZE)); - - /* dump ucode */ - if (ucode != 0) { - sprintf(&filename[0], "ucode_%x.bin", uc_start); - dump_binary(hle, filename, (void*)dram_u32(hle, ucode), 0xf80); - } - - /* dump ucode_data */ - if (ucode_data != 0) { - sprintf(&filename[0], "ucode_data_%x.bin", uc_start); - dump_binary(hle, filename, (void*)dram_u32(hle, ucode_data), *dmem_u32(hle, TASK_UCODE_DATA_SIZE)); - } - - /* dump data */ - if (data_ptr != 0) { - sprintf(&filename[0], "data_%x.bin", uc_start); - dump_binary(hle, filename, (void*)dram_u32(hle, data_ptr), *dmem_u32(hle, TASK_DATA_SIZE)); - } -} - -static void dump_unknown_non_task(struct hle_t* hle, unsigned int uc_start) -{ - char filename[256]; - - /* dump IMEM & DMEM for further analysis */ - sprintf(&filename[0], "imem_%x.bin", uc_start); - dump_binary(hle, filename, hle->imem, 0x1000); - - sprintf(&filename[0], "dmem_%x.bin", uc_start); - dump_binary(hle, filename, hle->dmem, 0x1000); -} - -static void dump_binary(struct hle_t* hle, const char *const filename, - const unsigned char *const bytes, unsigned int size) -{ - FILE *f; - - /* if file already exists, do nothing */ - f = fopen(filename, "r"); - if (f == NULL) { - /* else we write bytes to the file */ - f = fopen(filename, "wb"); - if (f != NULL) { - if (fwrite(bytes, 1, size, f) != size) - HleErrorMessage(hle->user_defined, "Writing error on %s", filename); - fclose(f); - } else - HleErrorMessage(hle->user_defined, "Couldn't open %s for writing !", filename); - } else - fclose(f); -} - -static void dump_task(struct hle_t* hle, const char *const filename) -{ - FILE *f; - - f = fopen(filename, "r"); - if (f == NULL) { - f = fopen(filename, "w"); - fprintf(f, - "type = %d\n" - "flags = %d\n" - "ucode_boot = %#08x size = %#x\n" - "ucode = %#08x size = %#x\n" - "ucode_data = %#08x size = %#x\n" - "dram_stack = %#08x size = %#x\n" - "output_buff = %#08x *size = %#x\n" - "data = %#08x size = %#x\n" - "yield_data = %#08x size = %#x\n", - *dmem_u32(hle, TASK_TYPE), - *dmem_u32(hle, TASK_FLAGS), - *dmem_u32(hle, TASK_UCODE_BOOT), *dmem_u32(hle, TASK_UCODE_BOOT_SIZE), - *dmem_u32(hle, TASK_UCODE), *dmem_u32(hle, TASK_UCODE_SIZE), - *dmem_u32(hle, TASK_UCODE_DATA), *dmem_u32(hle, TASK_UCODE_DATA_SIZE), - *dmem_u32(hle, TASK_DRAM_STACK), *dmem_u32(hle, TASK_DRAM_STACK_SIZE), - *dmem_u32(hle, TASK_OUTPUT_BUFF), *dmem_u32(hle, TASK_OUTPUT_BUFF_SIZE), - *dmem_u32(hle, TASK_DATA_PTR), *dmem_u32(hle, TASK_DATA_SIZE), - *dmem_u32(hle, TASK_YIELD_DATA_PTR), *dmem_u32(hle, TASK_YIELD_DATA_SIZE)); - fclose(f); - } else - fclose(f); -} -#endif diff --git a/mupen64plus-rsp-hle/src/hle.h b/mupen64plus-rsp-hle/src/hle.h deleted file mode 100644 index a420b75..0000000 --- a/mupen64plus-rsp-hle/src/hle.h +++ /dev/null @@ -1,54 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - hle.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef HLE_H -#define HLE_H - -#include "hle_internal.h" - -void hle_init(struct hle_t* hle, - unsigned char* dram, - unsigned char* dmem, - unsigned char* imem, - unsigned int* mi_intr, - unsigned int* sp_mem_addr, - unsigned int* sp_dram_addr, - unsigned int* sp_rd_length, - unsigned int* sp_wr_length, - unsigned int* sp_status, - unsigned int* sp_dma_full, - unsigned int* sp_dma_busy, - unsigned int* sp_pc, - unsigned int* sp_semaphore, - unsigned int* dpc_start, - unsigned int* dpc_end, - unsigned int* dpc_current, - unsigned int* dpc_status, - unsigned int* dpc_clock, - unsigned int* dpc_bufbusy, - unsigned int* dpc_pipebusy, - unsigned int* dpc_tmem, - void* user_defined); - -void hle_execute(struct hle_t* hle); - -#endif - diff --git a/mupen64plus-rsp-hle/src/hle_external.h b/mupen64plus-rsp-hle/src/hle_external.h deleted file mode 100644 index 766cc51..0000000 --- a/mupen64plus-rsp-hle/src/hle_external.h +++ /dev/null @@ -1,46 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - hle_external.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef HLE_EXTERNAL_H -#define HLE_EXTERNAL_H - -#if defined(__GNUC__) -#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos))) -#else -#define ATTR_FMT(fmtpos, attrpos) -#endif - -/* users of the hle core are expected to define these functions */ - -void HleVerboseMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3); -void HleInfoMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3); -void HleErrorMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3); -void HleWarnMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3); - -void HleCheckInterrupts(void* user_defined); -void HleProcessDlistList(void* user_defined); -void HleProcessAlistList(void* user_defined); -void HleProcessRdpList(void* user_defined); -void HleShowCFB(void* user_defined); -int HleForwardTask(void* user_defined); - -#endif - diff --git a/mupen64plus-rsp-hle/src/hle_internal.h b/mupen64plus-rsp-hle/src/hle_internal.h deleted file mode 100644 index efdca5c..0000000 --- a/mupen64plus-rsp-hle/src/hle_internal.h +++ /dev/null @@ -1,93 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - hle_internal.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef HLE_INTERNAL_H -#define HLE_INTERNAL_H - -#include <stdint.h> - -#include "ucodes.h" - -/* rsp hle internal state - internal usage only */ -struct hle_t -{ - unsigned char* dram; - unsigned char* dmem; - unsigned char* imem; - - unsigned int* mi_intr; - - unsigned int* sp_mem_addr; - unsigned int* sp_dram_addr; - unsigned int* sp_rd_length; - unsigned int* sp_wr_length; - unsigned int* sp_status; - unsigned int* sp_dma_full; - unsigned int* sp_dma_busy; - unsigned int* sp_pc; - unsigned int* sp_semaphore; - - unsigned int* dpc_start; - unsigned int* dpc_end; - unsigned int* dpc_current; - unsigned int* dpc_status; - unsigned int* dpc_clock; - unsigned int* dpc_bufbusy; - unsigned int* dpc_pipebusy; - unsigned int* dpc_tmem; - - /* for user convenience, this will be passed to "external" functions */ - void* user_defined; - - int hle_gfx; - int hle_aud; - - /* alist.c */ - uint8_t alist_buffer[0x1000]; - - /* alist_audio.c */ - struct alist_audio_t alist_audio; - - /* alist_naudio.c */ - struct alist_naudio_t alist_naudio; - - /* alist_nead.c */ - struct alist_nead_t alist_nead; - - /* mp3.c */ - uint8_t mp3_buffer[0x1000]; - - struct cached_ucodes_t cached_ucodes; -}; - -/* some mips interface interrupt flags */ -#define MI_INTR_SP 0x1 - -/* some rsp status flags */ -#define SP_STATUS_HALT 0x1 -#define SP_STATUS_BROKE 0x2 -#define SP_STATUS_INTR_ON_BREAK 0x40 -#define SP_STATUS_TASKDONE 0x200 - -void rsp_break(struct hle_t* hle, unsigned int setbits); - -#endif - diff --git a/mupen64plus-rsp-hle/src/hvqm.c b/mupen64plus-rsp-hle/src/hvqm.c deleted file mode 100644 index 8f8a943..0000000 --- a/mupen64plus-rsp-hle/src/hvqm.c +++ /dev/null @@ -1,354 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - hvqm.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2020 Gilles Siberlin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <assert.h> -#include <stdio.h> -#include <stdint.h> -#include <string.h> -#include <stdlib.h> - -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" - - /* Nest size */ -#define HVQM2_NESTSIZE_L 70 /* Number of elements on long side */ -#define HVQM2_NESTSIZE_S 38 /* Number of elements on short side */ -#define HVQM2_NESTSIZE (HVQM2_NESTSIZE_L * HVQM2_NESTSIZE_S) - -struct HVQM2Block { - uint8_t nbase; - uint8_t dc; - uint8_t dc_l; - uint8_t dc_r; - uint8_t dc_u; - uint8_t dc_d; -}; - -struct HVQM2Basis { - uint8_t sx; - uint8_t sy; - int16_t scale; - uint16_t offset; - uint16_t lineskip; -}; - -struct HVQM2Arg { - uint32_t info; - uint32_t buf; - uint16_t buf_width; - uint8_t chroma_step_h; - uint8_t chroma_step_v; - uint16_t hmcus; - uint16_t vmcus; - uint8_t alpha; - uint32_t nest; -}; - -struct RGBA { - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; -}; - -static struct HVQM2Arg arg; - -static const int16_t constant[5][16] = { -{0x0006,0x0008,0x0008,0x0006,0x0008,0x000A,0x000A,0x0008,0x0008,0x000A,0x000A,0x0008,0x0006,0x0008,0x0008,0x0006}, -{0x0002,0x0000,0xFFFF,0xFFFF,0x0002,0x0000,0xFFFF,0xFFFF,0x0002,0x0000,0xFFFF,0xFFFF,0x0002,0x0000,0xFFFF,0xFFFF}, -{0xFFFF,0xFFFF,0x0000,0x0002,0xFFFF,0xFFFF,0x0000,0x0002,0xFFFF,0xFFFF,0x0000,0x0002,0xFFFF,0xFFFF,0x0000,0x0002}, -{0x0002,0x0002,0x0002,0x0002,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF}, -{0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0002,0x0002,0x0002,0x0002} -}; - -static int process_info(struct hle_t* hle, uint8_t* base, int16_t* out) -{ - struct HVQM2Block block; - uint8_t nbase = *base; - - dram_load_u8(hle, (uint8_t*)&block, arg.info, sizeof(struct HVQM2Block)); - arg.info += 8; - - *base = block.nbase & 0x7; - - if ((block.nbase & nbase) != 0) - return 0; - - if (block.nbase == 0) - { - //LABEL8 - for (int i = 0; i < 16; i++) - { - out[i] = constant[0][i] * block.dc; - out[i] += constant[1][i] * block.dc_l; - out[i] += constant[2][i] * block.dc_r; - out[i] += constant[3][i] * block.dc_u; - out[i] += constant[4][i] * block.dc_d; - out[i] += 4; - out[i] >>= 3; - } - } - else if ((block.nbase & 0xf) == 0) - { - //LABEL7 - for (int i = 0; i < 16; i++) - { - out[i] = *dram_u8(hle, arg.info); - arg.info++; - } - } - else if (*base == 0) - { - //LABEL6 - for (int i = 0; i < 16; i++) - { - out[i] = *(int8_t*)dram_u8(hle, arg.info) + block.dc; - arg.info++; - } - } - else - { - //LABEL5 - struct HVQM2Basis basis; - - for (int i = 0; i < 16; i++) - out[i] = block.dc; - - for (; *base != 0; (*base)--) - { - basis.sx = *dram_u8(hle, arg.info); - arg.info++; - basis.sy = *dram_u8(hle, arg.info); - arg.info++; - basis.scale = *dram_u16(hle, arg.info); - arg.info += 2; - basis.offset = *dram_u16(hle, arg.info); - arg.info += 2; - basis.lineskip = *dram_u16(hle, arg.info); - arg.info += 2; - - int16_t vec[16]; - uint32_t addr = arg.nest + basis.offset; - int shift = (basis.sx != 0) ? 1 : 0; - - //LABEL9 - //LABEL10 - for (int i = 0; i < 16; i += 4) - { - vec[i] = *dram_u8(hle, addr); - vec[i + 1] = *dram_u8(hle, addr + (1 << shift)); - vec[i + 2] = *dram_u8(hle, addr + (2 << shift)); - vec[i + 3] = *dram_u8(hle, addr + (3 << shift)); - addr += basis.lineskip; - } - - //LABEL11 - int16_t sum = 0x8; - for (int i = 0; i < 16; i++) - sum += vec[i]; - - sum >>= 4; - - int16_t max = 0; - for (int i = 0; i < 16; i++) - { - vec[i] -= sum; - max = (abs(vec[i]) > max) ? abs(vec[i]) : max; - } - - double dmax = 0.0; - if (max > 0) - dmax = (double)(basis.scale << 2) / (double)max; - - for (int i = 0; i < 16; i++) - out[i] += (vec[i] < 0) ? (int16_t)((double)vec[i] * dmax - 0.5) : (int16_t)((double)vec[i] * dmax + 0.5); - - block.nbase &= 8; - } - - assert(block.nbase == 0); - //if(block.nbase != 0) - // LABEL6 - } - - return 1; -} - -#define SATURATE8(x) ((unsigned int) x <= 255 ? x : (x < 0 ? 0: 255)) -static struct RGBA YCbCr_to_RGBA(int16_t Y, int16_t Cb, int16_t Cr, uint8_t alpha) -{ - struct RGBA color; - - //Format S10.6 - int r = (int)(((double)Y + 0.5) + (1.765625 * (double)(Cr - 128))); - int g = (int)(((double)Y + 0.5) - (0.34375 * (double)(Cr - 128)) - (0.71875 * (double)(Cb - 128))); - int b = (int)(((double)Y + 0.5) + (1.40625 * (double)(Cb - 128))); - - color.r = SATURATE8(r); - color.g = SATURATE8(g); - color.b = SATURATE8(b); - color.a = alpha; - - return color; -} - -void store_rgba5551(struct hle_t* hle, struct RGBA color, uint32_t * addr) -{ - uint16_t pixel = ((color.b >> 3) << 11) | ((color.g >> 3) << 6) | ((color.r >> 3) << 1) | (color.a & 1); - dram_store_u16(hle, &pixel, *addr, 1); - *addr += 2; -} - -void store_rgba8888(struct hle_t* hle, struct RGBA color, uint32_t * addr) -{ - uint32_t pixel = (color.b << 24) | (color.g << 16) | (color.r << 8) | color.a; - dram_store_u32(hle, &pixel, *addr, 1); - *addr += 4; -} - -typedef void(*store_pixel_t)(struct hle_t* hle, struct RGBA color, uint32_t * addr); - -static void hvqm2_decode(struct hle_t* hle, int is32) -{ - //uint32_t uc_data_ptr = *dmem_u32(hle, TASK_UCODE_DATA); - uint32_t data_ptr = *dmem_u32(hle, TASK_DATA_PTR); - - assert((*dmem_u32(hle, TASK_FLAGS) & 0x1) == 0); - - /* Fill HVQM2Arg struct */ - arg.info = *dram_u32(hle, data_ptr); - data_ptr += 4; - arg.buf = *dram_u32(hle, data_ptr); - data_ptr += 4; - arg.buf_width = *dram_u16(hle, data_ptr); - data_ptr += 2; - arg.chroma_step_h = *dram_u8(hle, data_ptr); - data_ptr++; - arg.chroma_step_v = *dram_u8(hle, data_ptr); - data_ptr++; - arg.hmcus = *dram_u16(hle, data_ptr); - data_ptr += 2; - arg.vmcus = *dram_u16(hle, data_ptr); - data_ptr += 2; - arg.alpha = *dram_u8(hle, data_ptr); - arg.nest = data_ptr + 1; - - assert(arg.chroma_step_h == 2); - assert((arg.chroma_step_v == 1) || (arg.chroma_step_v == 2)); - assert((*hle->sp_status & 0x80) == 0); //SP_STATUS_YIELD - - int length, skip; - store_pixel_t store_pixel; - - if (is32) - { - length = 0x20; - skip = arg.buf_width << 2; - arg.buf_width <<= 4; - store_pixel = &store_rgba8888; - } - else - { - length = 0x10; - skip = arg.buf_width << 1; - arg.buf_width <<= 3; - store_pixel = &store_rgba5551; - } - - if (arg.chroma_step_v == 2) - arg.buf_width += arg.buf_width; - - for (int i = arg.vmcus; i != 0; i--) - { - uint32_t out; - int j; - - for (j = arg.hmcus, out = arg.buf; j != 0; j--, out += length) - { - uint8_t base = 0x80; - int16_t Cb[16], Cr[16], Y1[32], Y2[32]; - int16_t* pCb = Cb; - int16_t* pCr = Cr; - int16_t* pY1 = Y1; - int16_t* pY2 = Y2; - - if (arg.chroma_step_v == 2) - { - if (process_info(hle, &base, pY1) == 0) - continue; - if (process_info(hle, &base, pY2) == 0) - continue; - - pY1 = &Y1[16]; - pY2 = &Y2[16]; - } - - if (process_info(hle, &base, pY1) == 0) - continue; - if (process_info(hle, &base, pY2) == 0) - continue; - if (process_info(hle, &base, Cr) == 0) - continue; - if (process_info(hle, &base, Cb) == 0) - continue; - - pY1 = Y1; - pY2 = Y2; - - uint32_t out_buf = out; - for (int k = 0; k < 4; k++) - { - for (int m = 0; m < arg.chroma_step_v; m++) - { - uint32_t addr = out_buf; - for (int l = 0; l < 4; l++) - { - struct RGBA color = YCbCr_to_RGBA(pY1[l], pCb[l >> 1], pCr[l >> 1], arg.alpha); - store_pixel(hle, color, &addr); - } - for (int l = 0; l < 4; l++) - { - struct RGBA color = YCbCr_to_RGBA(pY2[l], pCb[(l + 4) >> 1], pCr[(l + 4) >> 1], arg.alpha); - store_pixel(hle, color, &addr); - } - out_buf += skip; - pY1 += 4; - pY2 += 4; - } - pCr += 4; - pCb += 4; - } - } - arg.buf += arg.buf_width; - } - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void hvqm2_decode_sp1_task(struct hle_t* hle) -{ - hvqm2_decode(hle, 0); -} - -void hvqm2_decode_sp2_task(struct hle_t* hle) -{ - hvqm2_decode(hle, 1); -} \ No newline at end of file diff --git a/mupen64plus-rsp-hle/src/jpeg.c b/mupen64plus-rsp-hle/src/jpeg.c deleted file mode 100644 index ff424c4..0000000 --- a/mupen64plus-rsp-hle/src/jpeg.c +++ /dev/null @@ -1,597 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - jpeg.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2012 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <assert.h> -#include <stdint.h> -#include <stdlib.h> - -#include "arithmetics.h" -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" - -#define SUBBLOCK_SIZE 64 - -typedef void (*tile_line_emitter_t)(struct hle_t* hle, const int16_t *y, const int16_t *u, uint32_t address); -typedef void (*subblock_transform_t)(int16_t *dst, const int16_t *src); - -/* standard jpeg ucode decoder */ -static void jpeg_decode_std(struct hle_t* hle, - const char *const version, - const subblock_transform_t transform_luma, - const subblock_transform_t transform_chroma, - const tile_line_emitter_t emit_line); - -/* helper functions */ -static uint8_t clamp_u8(int16_t x); -static int16_t clamp_s12(int16_t x); -static uint16_t clamp_RGBA_component(int16_t x); - -/* pixel conversion & formatting */ -static uint32_t GetUYVY(int16_t y1, int16_t y2, int16_t u, int16_t v); -static uint16_t GetRGBA(int16_t y, int16_t u, int16_t v); - -/* tile line emitters */ -static void EmitYUVTileLine(struct hle_t* hle, const int16_t *y, const int16_t *u, uint32_t address); -static void EmitRGBATileLine(struct hle_t* hle, const int16_t *y, const int16_t *u, uint32_t address); - -/* macroblocks operations */ -static void decode_macroblock_ob(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc, int32_t *v_dc, const int16_t *qtable); -static void decode_macroblock_std(const subblock_transform_t transform_luma, - const subblock_transform_t transform_chroma, - int16_t *macroblock, - unsigned int subblock_count, - const int16_t qtables[3][SUBBLOCK_SIZE]); -static void EmitTilesMode0(struct hle_t* hle, const tile_line_emitter_t emit_line, const int16_t *macroblock, uint32_t address); -static void EmitTilesMode2(struct hle_t* hle, const tile_line_emitter_t emit_line, const int16_t *macroblock, uint32_t address); - -/* subblocks operations */ -static void TransposeSubBlock(int16_t *dst, const int16_t *src); -static void ZigZagSubBlock(int16_t *dst, const int16_t *src); -static void ReorderSubBlock(int16_t *dst, const int16_t *src, const unsigned int *table); -static void MultSubBlocks(int16_t *dst, const int16_t *src1, const int16_t *src2, unsigned int shift); -static void ScaleSubBlock(int16_t *dst, const int16_t *src, int16_t scale); -static void RShiftSubBlock(int16_t *dst, const int16_t *src, unsigned int shift); -static void InverseDCT1D(const float *const x, float *dst, unsigned int stride); -static void InverseDCTSubBlock(int16_t *dst, const int16_t *src); -static void RescaleYSubBlock(int16_t *dst, const int16_t *src); -static void RescaleUVSubBlock(int16_t *dst, const int16_t *src); - -/* transposed dequantization table */ -static const int16_t DEFAULT_QTABLE[SUBBLOCK_SIZE] = { - 16, 12, 14, 14, 18, 24, 49, 72, - 11, 12, 13, 17, 22, 35, 64, 92, - 10, 14, 16, 22, 37, 55, 78, 95, - 16, 19, 24, 29, 56, 64, 87, 98, - 24, 26, 40, 51, 68, 81, 103, 112, - 40, 58, 57, 87, 109, 104, 121, 100, - 51, 60, 69, 80, 103, 113, 120, 103, - 61, 55, 56, 62, 77, 92, 101, 99 -}; - -/* zig-zag indices */ -static const unsigned int ZIGZAG_TABLE[SUBBLOCK_SIZE] = { - 0, 1, 5, 6, 14, 15, 27, 28, - 2, 4, 7, 13, 16, 26, 29, 42, - 3, 8, 12, 17, 25, 30, 41, 43, - 9, 11, 18, 24, 31, 40, 44, 53, - 10, 19, 23, 32, 39, 45, 52, 54, - 20, 22, 33, 38, 46, 51, 55, 60, - 21, 34, 37, 47, 50, 56, 59, 61, - 35, 36, 48, 49, 57, 58, 62, 63 -}; - -/* transposition indices */ -static const unsigned int TRANSPOSE_TABLE[SUBBLOCK_SIZE] = { - 0, 8, 16, 24, 32, 40, 48, 56, - 1, 9, 17, 25, 33, 41, 49, 57, - 2, 10, 18, 26, 34, 42, 50, 58, - 3, 11, 19, 27, 35, 43, 51, 59, - 4, 12, 20, 28, 36, 44, 52, 60, - 5, 13, 21, 29, 37, 45, 53, 61, - 6, 14, 22, 30, 38, 46, 54, 62, - 7, 15, 23, 31, 39, 47, 55, 63 -}; - - - -/* IDCT related constants - * Cn = alpha * cos(n * PI / 16) (alpha is chosen such as C4 = 1) */ -static const float IDCT_C3 = 1.175875602f; -static const float IDCT_C6 = 0.541196100f; -static const float IDCT_K[10] = { - 0.765366865f, /* C2-C6 */ - -1.847759065f, /* -C2-C6 */ - -0.390180644f, /* C5-C3 */ - -1.961570561f, /* -C5-C3 */ - 1.501321110f, /* C1+C3-C5-C7 */ - 2.053119869f, /* C1+C3-C5+C7 */ - 3.072711027f, /* C1+C3+C5-C7 */ - 0.298631336f, /* -C1+C3+C5-C7 */ - -0.899976223f, /* C7-C3 */ - -2.562915448f /* -C1-C3 */ -}; - - -/* global functions */ - -/*************************************************************************** - * JPEG decoding ucode found in Japanese exclusive version of Pokemon Stadium. - **************************************************************************/ -void jpeg_decode_PS0(struct hle_t* hle) -{ - jpeg_decode_std(hle, "PS0", RescaleYSubBlock, RescaleUVSubBlock, EmitYUVTileLine); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -/*************************************************************************** - * JPEG decoding ucode found in Ocarina of Time, Pokemon Stadium 1 and - * Pokemon Stadium 2. - **************************************************************************/ -void jpeg_decode_PS(struct hle_t* hle) -{ - jpeg_decode_std(hle, "PS", NULL, NULL, EmitRGBATileLine); - rsp_break(hle, SP_STATUS_TASKDONE); -} - -/*************************************************************************** - * JPEG decoding ucode found in Ogre Battle and Bottom of the 9th. - **************************************************************************/ -void jpeg_decode_OB(struct hle_t* hle) -{ - int16_t qtable[SUBBLOCK_SIZE]; - unsigned int mb; - - int32_t y_dc = 0; - int32_t u_dc = 0; - int32_t v_dc = 0; - - uint32_t address = *dmem_u32(hle, TASK_DATA_PTR); - const unsigned int macroblock_count = *dmem_u32(hle, TASK_DATA_SIZE); - const int qscale = *dmem_u32(hle, TASK_YIELD_DATA_SIZE); - - HleVerboseMessage(hle->user_defined, - "jpeg_decode_OB: *buffer=%x, #MB=%d, qscale=%d", - address, - macroblock_count, - qscale); - - if (qscale != 0) { - if (qscale > 0) - ScaleSubBlock(qtable, DEFAULT_QTABLE, qscale); - else - RShiftSubBlock(qtable, DEFAULT_QTABLE, -qscale); - } - - for (mb = 0; mb < macroblock_count; ++mb) { - int16_t macroblock[6 * SUBBLOCK_SIZE]; - - dram_load_u16(hle, (uint16_t *)macroblock, address, 6 * SUBBLOCK_SIZE); - decode_macroblock_ob(macroblock, &y_dc, &u_dc, &v_dc, (qscale != 0) ? qtable : NULL); - EmitTilesMode2(hle, EmitYUVTileLine, macroblock, address); - - address += (2 * 6 * SUBBLOCK_SIZE); - } - rsp_break(hle, SP_STATUS_TASKDONE); -} - - -/* local functions */ -static void jpeg_decode_std(struct hle_t* hle, - const char *const version, - const subblock_transform_t transform_luma, - const subblock_transform_t transform_chroma, - const tile_line_emitter_t emit_line) -{ - int16_t qtables[3][SUBBLOCK_SIZE]; - unsigned int mb; - uint32_t address; - uint32_t macroblock_count; - uint32_t mode; - uint32_t qtableY_ptr; - uint32_t qtableU_ptr; - uint32_t qtableV_ptr; - unsigned int subblock_count; - unsigned int macroblock_size; - /* macroblock contains at most 6 subblocks */ - int16_t macroblock[6 * SUBBLOCK_SIZE]; - uint32_t data_ptr; - - if (*dmem_u32(hle, TASK_FLAGS) & 0x1) { - HleWarnMessage(hle->user_defined, - "jpeg_decode_%s: task yielding not implemented", version); - return; - } - - data_ptr = *dmem_u32(hle, TASK_DATA_PTR); - address = *dram_u32(hle, data_ptr); - macroblock_count = *dram_u32(hle, data_ptr + 4); - mode = *dram_u32(hle, data_ptr + 8); - qtableY_ptr = *dram_u32(hle, data_ptr + 12); - qtableU_ptr = *dram_u32(hle, data_ptr + 16); - qtableV_ptr = *dram_u32(hle, data_ptr + 20); - - HleVerboseMessage(hle->user_defined, - "jpeg_decode_%s: *buffer=%x, #MB=%d, mode=%d, *Qy=%x, *Qu=%x, *Qv=%x", - version, - address, - macroblock_count, - mode, - qtableY_ptr, - qtableU_ptr, - qtableV_ptr); - - if (mode != 0 && mode != 2) { - HleWarnMessage(hle->user_defined, - "jpeg_decode_%s: invalid mode %d", version, mode); - return; - } - - subblock_count = mode + 4; - macroblock_size = subblock_count * SUBBLOCK_SIZE; - - dram_load_u16(hle, (uint16_t *)qtables[0], qtableY_ptr, SUBBLOCK_SIZE); - dram_load_u16(hle, (uint16_t *)qtables[1], qtableU_ptr, SUBBLOCK_SIZE); - dram_load_u16(hle, (uint16_t *)qtables[2], qtableV_ptr, SUBBLOCK_SIZE); - - for (mb = 0; mb < macroblock_count; ++mb) { - dram_load_u16(hle, (uint16_t *)macroblock, address, macroblock_size); - decode_macroblock_std(transform_luma, transform_chroma, - macroblock, subblock_count, (const int16_t (*)[SUBBLOCK_SIZE])qtables); - - if (mode == 0) - EmitTilesMode0(hle, emit_line, macroblock, address); - else - EmitTilesMode2(hle, emit_line, macroblock, address); - - address += 2 * macroblock_size; - } -} - -static uint8_t clamp_u8(int16_t x) -{ - return (x & (0xff00)) ? ((-x) >> 15) & 0xff : x; -} - -static int16_t clamp_s12(int16_t x) -{ - if (x < -0x800) - x = -0x800; - else if (x > 0x7f0) - x = 0x7f0; - return x; -} - -static uint16_t clamp_RGBA_component(int16_t x) -{ - if (x > 0xff0) - x = 0xff0; - else if (x < 0) - x = 0; - return (x & 0xf80); -} - -static uint32_t GetUYVY(int16_t y1, int16_t y2, int16_t u, int16_t v) -{ - return (uint32_t)clamp_u8(u) << 24 | - (uint32_t)clamp_u8(y1) << 16 | - (uint32_t)clamp_u8(v) << 8 | - (uint32_t)clamp_u8(y2); -} - -static uint16_t GetRGBA(int16_t y, int16_t u, int16_t v) -{ - const float fY = (float)y + 2048.0f; - const float fU = (float)u; - const float fV = (float)v; - - const uint16_t r = clamp_RGBA_component((int16_t)(fY + 1.4025 * fV)); - const uint16_t g = clamp_RGBA_component((int16_t)(fY - 0.3443 * fU - 0.7144 * fV)); - const uint16_t b = clamp_RGBA_component((int16_t)(fY + 1.7729 * fU)); - - return (r << 4) | (g >> 1) | (b >> 6) | 1; -} - -static void EmitYUVTileLine(struct hle_t* hle, const int16_t *y, const int16_t *u, uint32_t address) -{ - uint32_t uyvy[8]; - - const int16_t *const v = u + SUBBLOCK_SIZE; - const int16_t *const y2 = y + SUBBLOCK_SIZE; - - uyvy[0] = GetUYVY(y[0], y[1], u[0], v[0]); - uyvy[1] = GetUYVY(y[2], y[3], u[1], v[1]); - uyvy[2] = GetUYVY(y[4], y[5], u[2], v[2]); - uyvy[3] = GetUYVY(y[6], y[7], u[3], v[3]); - uyvy[4] = GetUYVY(y2[0], y2[1], u[4], v[4]); - uyvy[5] = GetUYVY(y2[2], y2[3], u[5], v[5]); - uyvy[6] = GetUYVY(y2[4], y2[5], u[6], v[6]); - uyvy[7] = GetUYVY(y2[6], y2[7], u[7], v[7]); - - dram_store_u32(hle, uyvy, address, 8); -} - -static void EmitRGBATileLine(struct hle_t* hle, const int16_t *y, const int16_t *u, uint32_t address) -{ - uint16_t rgba[16]; - - const int16_t *const v = u + SUBBLOCK_SIZE; - const int16_t *const y2 = y + SUBBLOCK_SIZE; - - rgba[0] = GetRGBA(y[0], u[0], v[0]); - rgba[1] = GetRGBA(y[1], u[0], v[0]); - rgba[2] = GetRGBA(y[2], u[1], v[1]); - rgba[3] = GetRGBA(y[3], u[1], v[1]); - rgba[4] = GetRGBA(y[4], u[2], v[2]); - rgba[5] = GetRGBA(y[5], u[2], v[2]); - rgba[6] = GetRGBA(y[6], u[3], v[3]); - rgba[7] = GetRGBA(y[7], u[3], v[3]); - rgba[8] = GetRGBA(y2[0], u[4], v[4]); - rgba[9] = GetRGBA(y2[1], u[4], v[4]); - rgba[10] = GetRGBA(y2[2], u[5], v[5]); - rgba[11] = GetRGBA(y2[3], u[5], v[5]); - rgba[12] = GetRGBA(y2[4], u[6], v[6]); - rgba[13] = GetRGBA(y2[5], u[6], v[6]); - rgba[14] = GetRGBA(y2[6], u[7], v[7]); - rgba[15] = GetRGBA(y2[7], u[7], v[7]); - - dram_store_u16(hle, rgba, address, 16); -} - -static void EmitTilesMode0(struct hle_t* hle, const tile_line_emitter_t emit_line, const int16_t *macroblock, uint32_t address) -{ - unsigned int i; - - unsigned int y_offset = 0; - unsigned int u_offset = 2 * SUBBLOCK_SIZE; - - for (i = 0; i < 8; ++i) { - emit_line(hle, ¯oblock[y_offset], ¯oblock[u_offset], address); - - y_offset += 8; - u_offset += 8; - address += 32; - } -} - -static void EmitTilesMode2(struct hle_t* hle, const tile_line_emitter_t emit_line, const int16_t *macroblock, uint32_t address) -{ - unsigned int i; - - unsigned int y_offset = 0; - unsigned int u_offset = 4 * SUBBLOCK_SIZE; - - for (i = 0; i < 8; ++i) { - emit_line(hle, ¯oblock[y_offset], ¯oblock[u_offset], address); - emit_line(hle, ¯oblock[y_offset + 8], ¯oblock[u_offset], address + 32); - - y_offset += (i == 3) ? SUBBLOCK_SIZE + 16 : 16; - u_offset += 8; - address += 64; - } -} - -static void decode_macroblock_ob(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc, int32_t *v_dc, const int16_t *qtable) -{ - int sb; - - for (sb = 0; sb < 6; ++sb) { - int16_t tmp_sb[SUBBLOCK_SIZE]; - - /* update DC */ - int32_t dc = (int32_t)macroblock[0]; - switch (sb) { - case 0: - case 1: - case 2: - case 3: - *y_dc += dc; - macroblock[0] = *y_dc & 0xffff; - break; - case 4: - *u_dc += dc; - macroblock[0] = *u_dc & 0xffff; - break; - case 5: - *v_dc += dc; - macroblock[0] = *v_dc & 0xffff; - break; - } - - ZigZagSubBlock(tmp_sb, macroblock); - if (qtable != NULL) - MultSubBlocks(tmp_sb, tmp_sb, qtable, 0); - TransposeSubBlock(macroblock, tmp_sb); - InverseDCTSubBlock(macroblock, macroblock); - - macroblock += SUBBLOCK_SIZE; - } -} - -static void decode_macroblock_std(const subblock_transform_t transform_luma, - const subblock_transform_t transform_chroma, - int16_t *macroblock, - unsigned int subblock_count, - const int16_t qtables[3][SUBBLOCK_SIZE]) -{ - unsigned int sb; - unsigned int q = 0; - - for (sb = 0; sb < subblock_count; ++sb) { - int16_t tmp_sb[SUBBLOCK_SIZE]; - const int isChromaSubBlock = (subblock_count - sb <= 2); - - if (isChromaSubBlock) - ++q; - - MultSubBlocks(macroblock, macroblock, qtables[q], 4); - ZigZagSubBlock(tmp_sb, macroblock); - InverseDCTSubBlock(macroblock, tmp_sb); - - if (isChromaSubBlock) { - if (transform_chroma != NULL) - transform_chroma(macroblock, macroblock); - } else { - if (transform_luma != NULL) - transform_luma(macroblock, macroblock); - } - - macroblock += SUBBLOCK_SIZE; - } -} - -static void TransposeSubBlock(int16_t *dst, const int16_t *src) -{ - ReorderSubBlock(dst, src, TRANSPOSE_TABLE); -} - -static void ZigZagSubBlock(int16_t *dst, const int16_t *src) -{ - ReorderSubBlock(dst, src, ZIGZAG_TABLE); -} - -static void ReorderSubBlock(int16_t *dst, const int16_t *src, const unsigned int *table) -{ - unsigned int i; - - /* source and destination sublocks cannot overlap */ - assert(labs(dst - src) > SUBBLOCK_SIZE); - - for (i = 0; i < SUBBLOCK_SIZE; ++i) - dst[i] = src[table[i]]; -} - -static void MultSubBlocks(int16_t *dst, const int16_t *src1, const int16_t *src2, unsigned int shift) -{ - unsigned int i; - - for (i = 0; i < SUBBLOCK_SIZE; ++i) { - int32_t v = src1[i] * src2[i]; - dst[i] = clamp_s16(v) << shift; - } -} - -static void ScaleSubBlock(int16_t *dst, const int16_t *src, int16_t scale) -{ - unsigned int i; - - for (i = 0; i < SUBBLOCK_SIZE; ++i) { - int32_t v = src[i] * scale; - dst[i] = clamp_s16(v); - } -} - -static void RShiftSubBlock(int16_t *dst, const int16_t *src, unsigned int shift) -{ - unsigned int i; - - for (i = 0; i < SUBBLOCK_SIZE; ++i) - dst[i] = src[i] >> shift; -} - -/*************************************************************************** - * Fast 2D IDCT using separable formulation and normalization - * Computations use single precision floats - * Implementation based on Wikipedia : - * http://fr.wikipedia.org/wiki/Transform%C3%A9e_en_cosinus_discr%C3%A8te - **************************************************************************/ -static void InverseDCT1D(const float *const x, float *dst, unsigned int stride) -{ - float e[4]; - float f[4]; - float x26, x1357, x15, x37, x17, x35; - - x15 = IDCT_K[2] * (x[1] + x[5]); - x37 = IDCT_K[3] * (x[3] + x[7]); - x17 = IDCT_K[8] * (x[1] + x[7]); - x35 = IDCT_K[9] * (x[3] + x[5]); - x1357 = IDCT_C3 * (x[1] + x[3] + x[5] + x[7]); - x26 = IDCT_C6 * (x[2] + x[6]); - - f[0] = x[0] + x[4]; - f[1] = x[0] - x[4]; - f[2] = x26 + IDCT_K[0] * x[2]; - f[3] = x26 + IDCT_K[1] * x[6]; - - e[0] = x1357 + x15 + IDCT_K[4] * x[1] + x17; - e[1] = x1357 + x37 + IDCT_K[6] * x[3] + x35; - e[2] = x1357 + x15 + IDCT_K[5] * x[5] + x35; - e[3] = x1357 + x37 + IDCT_K[7] * x[7] + x17; - - *dst = f[0] + f[2] + e[0]; - dst += stride; - *dst = f[1] + f[3] + e[1]; - dst += stride; - *dst = f[1] - f[3] + e[2]; - dst += stride; - *dst = f[0] - f[2] + e[3]; - dst += stride; - *dst = f[0] - f[2] - e[3]; - dst += stride; - *dst = f[1] - f[3] - e[2]; - dst += stride; - *dst = f[1] + f[3] - e[1]; - dst += stride; - *dst = f[0] + f[2] - e[0]; -} - -static void InverseDCTSubBlock(int16_t *dst, const int16_t *src) -{ - float x[8]; - float block[SUBBLOCK_SIZE]; - unsigned int i, j; - - /* idct 1d on rows (+transposition) */ - for (i = 0; i < 8; ++i) { - for (j = 0; j < 8; ++j) - x[j] = (float)src[i * 8 + j]; - - InverseDCT1D(x, &block[i], 8); - } - - /* idct 1d on columns (thanks to previous transposition) */ - for (i = 0; i < 8; ++i) { - InverseDCT1D(&block[i * 8], x, 1); - - /* C4 = 1 normalization implies a division by 8 */ - for (j = 0; j < 8; ++j) - dst[i + j * 8] = (int16_t)x[j] >> 3; - } -} - -static void RescaleYSubBlock(int16_t *dst, const int16_t *src) -{ - unsigned int i; - - for (i = 0; i < SUBBLOCK_SIZE; ++i) - dst[i] = (((uint32_t)(clamp_s12(src[i]) + 0x800) * 0xdb0) >> 16) + 0x10; -} - -static void RescaleUVSubBlock(int16_t *dst, const int16_t *src) -{ - unsigned int i; - - for (i = 0; i < SUBBLOCK_SIZE; ++i) - dst[i] = (((int)clamp_s12(src[i]) * 0xe00) >> 16) + 0x80; -} - diff --git a/mupen64plus-rsp-hle/src/memory.c b/mupen64plus-rsp-hle/src/memory.c deleted file mode 100644 index 7d5066b..0000000 --- a/mupen64plus-rsp-hle/src/memory.c +++ /dev/null @@ -1,74 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - memory.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <string.h> - -#include "memory.h" - -/* Global functions */ -void load_u8(uint8_t* dst, const unsigned char* buffer, unsigned address, size_t count) -{ - while (count != 0) { - *(dst++) = *u8(buffer, address); - address += 1; - --count; - } -} - -void load_u16(uint16_t* dst, const unsigned char* buffer, unsigned address, size_t count) -{ - while (count != 0) { - *(dst++) = *u16(buffer, address); - address += 2; - --count; - } -} - -void load_u32(uint32_t* dst, const unsigned char* buffer, unsigned address, size_t count) -{ - /* Optimization for uint32_t */ - memcpy(dst, u32(buffer, address), count * sizeof(uint32_t)); -} - -void store_u8(unsigned char* buffer, unsigned address, const uint8_t* src, size_t count) -{ - while (count != 0) { - *u8(buffer, address) = *(src++); - address += 1; - --count; - } -} - -void store_u16(unsigned char* buffer, unsigned address, const uint16_t* src, size_t count) -{ - while (count != 0) { - *u16(buffer, address) = *(src++); - address += 2; - --count; - } -} - -void store_u32(unsigned char* buffer, unsigned address, const uint32_t* src, size_t count) -{ - /* Optimization for uint32_t */ - memcpy(u32(buffer, address), src, count * sizeof(uint32_t)); -} - diff --git a/mupen64plus-rsp-hle/src/memory.h b/mupen64plus-rsp-hle/src/memory.h deleted file mode 100644 index 9c85104..0000000 --- a/mupen64plus-rsp-hle/src/memory.h +++ /dev/null @@ -1,185 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - memory.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef MEMORY_H -#define MEMORY_H - -#include <assert.h> -#include <stddef.h> -#include <stdint.h> - -#include "common.h" -#include "hle_internal.h" - -#ifdef M64P_BIG_ENDIAN -#define S 0 -#define S16 0 -#define S8 0 -#else -#define S 1 -#define S16 2 -#define S8 3 -#endif - -enum { - TASK_TYPE = 0xfc0, - TASK_FLAGS = 0xfc4, - TASK_UCODE_BOOT = 0xfc8, - TASK_UCODE_BOOT_SIZE = 0xfcc, - TASK_UCODE = 0xfd0, - TASK_UCODE_SIZE = 0xfd4, - TASK_UCODE_DATA = 0xfd8, - TASK_UCODE_DATA_SIZE = 0xfdc, - TASK_DRAM_STACK = 0xfe0, - TASK_DRAM_STACK_SIZE = 0xfe4, - TASK_OUTPUT_BUFF = 0xfe8, - TASK_OUTPUT_BUFF_SIZE = 0xfec, - TASK_DATA_PTR = 0xff0, - TASK_DATA_SIZE = 0xff4, - TASK_YIELD_DATA_PTR = 0xff8, - TASK_YIELD_DATA_SIZE = 0xffc -}; - -static inline unsigned int align(unsigned int x, unsigned amount) -{ - --amount; - return (x + amount) & ~amount; -} - -static inline uint8_t* u8(const unsigned char* buffer, unsigned address) -{ - return (uint8_t*)(buffer + (address ^ S8)); -} - -static inline uint16_t* u16(const unsigned char* buffer, unsigned address) -{ - assert((address & 1) == 0); - return (uint16_t*)(buffer + (address ^ S16)); -} - -static inline uint32_t* u32(const unsigned char* buffer, unsigned address) -{ - assert((address & 3) == 0); - return (uint32_t*)(buffer + address); -} - -void load_u8 (uint8_t* dst, const unsigned char* buffer, unsigned address, size_t count); -void load_u16(uint16_t* dst, const unsigned char* buffer, unsigned address, size_t count); -void load_u32(uint32_t* dst, const unsigned char* buffer, unsigned address, size_t count); -void store_u8 (unsigned char* buffer, unsigned address, const uint8_t* src, size_t count); -void store_u16(unsigned char* buffer, unsigned address, const uint16_t* src, size_t count); -void store_u32(unsigned char* buffer, unsigned address, const uint32_t* src, size_t count); - - -/* convenient functions for DMEM access */ -static inline uint8_t* dmem_u8(struct hle_t* hle, uint16_t address) -{ - return u8(hle->dmem, address & 0xfff); -} - -static inline uint16_t* dmem_u16(struct hle_t* hle, uint16_t address) -{ - return u16(hle->dmem, address & 0xfff); -} - -static inline uint32_t* dmem_u32(struct hle_t* hle, uint16_t address) -{ - return u32(hle->dmem, address & 0xfff); -} - -static inline void dmem_load_u8(struct hle_t* hle, uint8_t* dst, uint16_t address, size_t count) -{ - load_u8(dst, hle->dmem, address & 0xfff, count); -} - -static inline void dmem_load_u16(struct hle_t* hle, uint16_t* dst, uint16_t address, size_t count) -{ - load_u16(dst, hle->dmem, address & 0xfff, count); -} - -static inline void dmem_load_u32(struct hle_t* hle, uint32_t* dst, uint16_t address, size_t count) -{ - load_u32(dst, hle->dmem, address & 0xfff, count); -} - -static inline void dmem_store_u8(struct hle_t* hle, const uint8_t* src, uint16_t address, size_t count) -{ - store_u8(hle->dmem, address & 0xfff, src, count); -} - -static inline void dmem_store_u16(struct hle_t* hle, const uint16_t* src, uint16_t address, size_t count) -{ - store_u16(hle->dmem, address & 0xfff, src, count); -} - -static inline void dmem_store_u32(struct hle_t* hle, const uint32_t* src, uint16_t address, size_t count) -{ - store_u32(hle->dmem, address & 0xfff, src, count); -} - -/* convenient functions DRAM access */ -static inline uint8_t* dram_u8(struct hle_t* hle, uint32_t address) -{ - return u8(hle->dram, address & 0xffffff); -} - -static inline uint16_t* dram_u16(struct hle_t* hle, uint32_t address) -{ - return u16(hle->dram, address & 0xffffff); -} - -static inline uint32_t* dram_u32(struct hle_t* hle, uint32_t address) -{ - return u32(hle->dram, address & 0xffffff); -} - -static inline void dram_load_u8(struct hle_t* hle, uint8_t* dst, uint32_t address, size_t count) -{ - load_u8(dst, hle->dram, address & 0xffffff, count); -} - -static inline void dram_load_u16(struct hle_t* hle, uint16_t* dst, uint32_t address, size_t count) -{ - load_u16(dst, hle->dram, address & 0xffffff, count); -} - -static inline void dram_load_u32(struct hle_t* hle, uint32_t* dst, uint32_t address, size_t count) -{ - load_u32(dst, hle->dram, address & 0xffffff, count); -} - -static inline void dram_store_u8(struct hle_t* hle, const uint8_t* src, uint32_t address, size_t count) -{ - store_u8(hle->dram, address & 0xffffff, src, count); -} - -static inline void dram_store_u16(struct hle_t* hle, const uint16_t* src, uint32_t address, size_t count) -{ - store_u16(hle->dram, address & 0xffffff, src, count); -} - -static inline void dram_store_u32(struct hle_t* hle, const uint32_t* src, uint32_t address, size_t count) -{ - store_u32(hle->dram, address & 0xffffff, src, count); -} - -#endif - diff --git a/mupen64plus-rsp-hle/src/mp3.c b/mupen64plus-rsp-hle/src/mp3.c deleted file mode 100644 index 4e8ea14..0000000 --- a/mupen64plus-rsp-hle/src/mp3.c +++ /dev/null @@ -1,684 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - mp3.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdint.h> -#include <string.h> - -#include "arithmetics.h" -#include "hle_internal.h" -#include "memory.h" - -static void InnerLoop(struct hle_t* hle, - uint32_t outPtr, uint32_t inPtr, - uint32_t t6, uint32_t t5, uint32_t t4); - -static const uint16_t DeWindowLUT [0x420] = { - 0x0000, 0xFFF3, 0x005D, 0xFF38, 0x037A, 0xF736, 0x0B37, 0xC00E, - 0x7FFF, 0x3FF2, 0x0B37, 0x08CA, 0x037A, 0x00C8, 0x005D, 0x000D, - 0x0000, 0xFFF3, 0x005D, 0xFF38, 0x037A, 0xF736, 0x0B37, 0xC00E, - 0x7FFF, 0x3FF2, 0x0B37, 0x08CA, 0x037A, 0x00C8, 0x005D, 0x000D, - 0x0000, 0xFFF2, 0x005F, 0xFF1D, 0x0369, 0xF697, 0x0A2A, 0xBCE7, - 0x7FEB, 0x3CCB, 0x0C2B, 0x082B, 0x0385, 0x00AF, 0x005B, 0x000B, - 0x0000, 0xFFF2, 0x005F, 0xFF1D, 0x0369, 0xF697, 0x0A2A, 0xBCE7, - 0x7FEB, 0x3CCB, 0x0C2B, 0x082B, 0x0385, 0x00AF, 0x005B, 0x000B, - 0x0000, 0xFFF1, 0x0061, 0xFF02, 0x0354, 0xF5F9, 0x0905, 0xB9C4, - 0x7FB0, 0x39A4, 0x0D08, 0x078C, 0x038C, 0x0098, 0x0058, 0x000A, - 0x0000, 0xFFF1, 0x0061, 0xFF02, 0x0354, 0xF5F9, 0x0905, 0xB9C4, - 0x7FB0, 0x39A4, 0x0D08, 0x078C, 0x038C, 0x0098, 0x0058, 0x000A, - 0x0000, 0xFFEF, 0x0062, 0xFEE6, 0x033B, 0xF55C, 0x07C8, 0xB6A4, - 0x7F4D, 0x367E, 0x0DCE, 0x06EE, 0x038F, 0x0080, 0x0056, 0x0009, - 0x0000, 0xFFEF, 0x0062, 0xFEE6, 0x033B, 0xF55C, 0x07C8, 0xB6A4, - 0x7F4D, 0x367E, 0x0DCE, 0x06EE, 0x038F, 0x0080, 0x0056, 0x0009, - 0x0000, 0xFFEE, 0x0063, 0xFECA, 0x031C, 0xF4C3, 0x0671, 0xB38C, - 0x7EC2, 0x335D, 0x0E7C, 0x0652, 0x038E, 0x006B, 0x0053, 0x0008, - 0x0000, 0xFFEE, 0x0063, 0xFECA, 0x031C, 0xF4C3, 0x0671, 0xB38C, - 0x7EC2, 0x335D, 0x0E7C, 0x0652, 0x038E, 0x006B, 0x0053, 0x0008, - 0x0000, 0xFFEC, 0x0064, 0xFEAC, 0x02F7, 0xF42C, 0x0502, 0xB07C, - 0x7E12, 0x3041, 0x0F14, 0x05B7, 0x038A, 0x0056, 0x0050, 0x0007, - 0x0000, 0xFFEC, 0x0064, 0xFEAC, 0x02F7, 0xF42C, 0x0502, 0xB07C, - 0x7E12, 0x3041, 0x0F14, 0x05B7, 0x038A, 0x0056, 0x0050, 0x0007, - 0x0000, 0xFFEB, 0x0064, 0xFE8E, 0x02CE, 0xF399, 0x037A, 0xAD75, - 0x7D3A, 0x2D2C, 0x0F97, 0x0520, 0x0382, 0x0043, 0x004D, 0x0007, - 0x0000, 0xFFEB, 0x0064, 0xFE8E, 0x02CE, 0xF399, 0x037A, 0xAD75, - 0x7D3A, 0x2D2C, 0x0F97, 0x0520, 0x0382, 0x0043, 0x004D, 0x0007, - 0xFFFF, 0xFFE9, 0x0063, 0xFE6F, 0x029E, 0xF30B, 0x01D8, 0xAA7B, - 0x7C3D, 0x2A1F, 0x1004, 0x048B, 0x0377, 0x0030, 0x004A, 0x0006, - 0xFFFF, 0xFFE9, 0x0063, 0xFE6F, 0x029E, 0xF30B, 0x01D8, 0xAA7B, - 0x7C3D, 0x2A1F, 0x1004, 0x048B, 0x0377, 0x0030, 0x004A, 0x0006, - 0xFFFF, 0xFFE7, 0x0062, 0xFE4F, 0x0269, 0xF282, 0x001F, 0xA78D, - 0x7B1A, 0x271C, 0x105D, 0x03F9, 0x036A, 0x001F, 0x0046, 0x0006, - 0xFFFF, 0xFFE7, 0x0062, 0xFE4F, 0x0269, 0xF282, 0x001F, 0xA78D, - 0x7B1A, 0x271C, 0x105D, 0x03F9, 0x036A, 0x001F, 0x0046, 0x0006, - 0xFFFF, 0xFFE4, 0x0061, 0xFE2F, 0x022F, 0xF1FF, 0xFE4C, 0xA4AF, - 0x79D3, 0x2425, 0x10A2, 0x036C, 0x0359, 0x0010, 0x0043, 0x0005, - 0xFFFF, 0xFFE4, 0x0061, 0xFE2F, 0x022F, 0xF1FF, 0xFE4C, 0xA4AF, - 0x79D3, 0x2425, 0x10A2, 0x036C, 0x0359, 0x0010, 0x0043, 0x0005, - 0xFFFF, 0xFFE2, 0x005E, 0xFE10, 0x01EE, 0xF184, 0xFC61, 0xA1E1, - 0x7869, 0x2139, 0x10D3, 0x02E3, 0x0346, 0x0001, 0x0040, 0x0004, - 0xFFFF, 0xFFE2, 0x005E, 0xFE10, 0x01EE, 0xF184, 0xFC61, 0xA1E1, - 0x7869, 0x2139, 0x10D3, 0x02E3, 0x0346, 0x0001, 0x0040, 0x0004, - 0xFFFF, 0xFFE0, 0x005B, 0xFDF0, 0x01A8, 0xF111, 0xFA5F, 0x9F27, - 0x76DB, 0x1E5C, 0x10F2, 0x025E, 0x0331, 0xFFF3, 0x003D, 0x0004, - 0xFFFF, 0xFFE0, 0x005B, 0xFDF0, 0x01A8, 0xF111, 0xFA5F, 0x9F27, - 0x76DB, 0x1E5C, 0x10F2, 0x025E, 0x0331, 0xFFF3, 0x003D, 0x0004, - 0xFFFF, 0xFFDE, 0x0057, 0xFDD0, 0x015B, 0xF0A7, 0xF845, 0x9C80, - 0x752C, 0x1B8E, 0x1100, 0x01DE, 0x0319, 0xFFE7, 0x003A, 0x0003, - 0xFFFF, 0xFFDE, 0x0057, 0xFDD0, 0x015B, 0xF0A7, 0xF845, 0x9C80, - 0x752C, 0x1B8E, 0x1100, 0x01DE, 0x0319, 0xFFE7, 0x003A, 0x0003, - 0xFFFE, 0xFFDB, 0x0053, 0xFDB0, 0x0108, 0xF046, 0xF613, 0x99EE, - 0x735C, 0x18D1, 0x10FD, 0x0163, 0x0300, 0xFFDC, 0x0037, 0x0003, - 0xFFFE, 0xFFDB, 0x0053, 0xFDB0, 0x0108, 0xF046, 0xF613, 0x99EE, - 0x735C, 0x18D1, 0x10FD, 0x0163, 0x0300, 0xFFDC, 0x0037, 0x0003, - 0xFFFE, 0xFFD8, 0x004D, 0xFD90, 0x00B0, 0xEFF0, 0xF3CC, 0x9775, - 0x716C, 0x1624, 0x10EA, 0x00EE, 0x02E5, 0xFFD2, 0x0033, 0x0003, - 0xFFFE, 0xFFD8, 0x004D, 0xFD90, 0x00B0, 0xEFF0, 0xF3CC, 0x9775, - 0x716C, 0x1624, 0x10EA, 0x00EE, 0x02E5, 0xFFD2, 0x0033, 0x0003, - 0xFFFE, 0xFFD6, 0x0047, 0xFD72, 0x0051, 0xEFA6, 0xF16F, 0x9514, - 0x6F5E, 0x138A, 0x10C8, 0x007E, 0x02CA, 0xFFC9, 0x0030, 0x0003, - 0xFFFE, 0xFFD6, 0x0047, 0xFD72, 0x0051, 0xEFA6, 0xF16F, 0x9514, - 0x6F5E, 0x138A, 0x10C8, 0x007E, 0x02CA, 0xFFC9, 0x0030, 0x0003, - 0xFFFE, 0xFFD3, 0x0040, 0xFD54, 0xFFEC, 0xEF68, 0xEEFC, 0x92CD, - 0x6D33, 0x1104, 0x1098, 0x0014, 0x02AC, 0xFFC0, 0x002D, 0x0002, - 0xFFFE, 0xFFD3, 0x0040, 0xFD54, 0xFFEC, 0xEF68, 0xEEFC, 0x92CD, - 0x6D33, 0x1104, 0x1098, 0x0014, 0x02AC, 0xFFC0, 0x002D, 0x0002, - 0x0030, 0xFFC9, 0x02CA, 0x007E, 0x10C8, 0x138A, 0x6F5E, 0x9514, - 0xF16F, 0xEFA6, 0x0051, 0xFD72, 0x0047, 0xFFD6, 0xFFFE, 0x0003, - 0x0030, 0xFFC9, 0x02CA, 0x007E, 0x10C8, 0x138A, 0x6F5E, 0x9514, - 0xF16F, 0xEFA6, 0x0051, 0xFD72, 0x0047, 0xFFD6, 0xFFFE, 0x0003, - 0x0033, 0xFFD2, 0x02E5, 0x00EE, 0x10EA, 0x1624, 0x716C, 0x9775, - 0xF3CC, 0xEFF0, 0x00B0, 0xFD90, 0x004D, 0xFFD8, 0xFFFE, 0x0003, - 0x0033, 0xFFD2, 0x02E5, 0x00EE, 0x10EA, 0x1624, 0x716C, 0x9775, - 0xF3CC, 0xEFF0, 0x00B0, 0xFD90, 0x004D, 0xFFD8, 0xFFFE, 0x0003, - 0x0037, 0xFFDC, 0x0300, 0x0163, 0x10FD, 0x18D1, 0x735C, 0x99EE, - 0xF613, 0xF046, 0x0108, 0xFDB0, 0x0053, 0xFFDB, 0xFFFE, 0x0003, - 0x0037, 0xFFDC, 0x0300, 0x0163, 0x10FD, 0x18D1, 0x735C, 0x99EE, - 0xF613, 0xF046, 0x0108, 0xFDB0, 0x0053, 0xFFDB, 0xFFFE, 0x0003, - 0x003A, 0xFFE7, 0x0319, 0x01DE, 0x1100, 0x1B8E, 0x752C, 0x9C80, - 0xF845, 0xF0A7, 0x015B, 0xFDD0, 0x0057, 0xFFDE, 0xFFFF, 0x0003, - 0x003A, 0xFFE7, 0x0319, 0x01DE, 0x1100, 0x1B8E, 0x752C, 0x9C80, - 0xF845, 0xF0A7, 0x015B, 0xFDD0, 0x0057, 0xFFDE, 0xFFFF, 0x0004, - 0x003D, 0xFFF3, 0x0331, 0x025E, 0x10F2, 0x1E5C, 0x76DB, 0x9F27, - 0xFA5F, 0xF111, 0x01A8, 0xFDF0, 0x005B, 0xFFE0, 0xFFFF, 0x0004, - 0x003D, 0xFFF3, 0x0331, 0x025E, 0x10F2, 0x1E5C, 0x76DB, 0x9F27, - 0xFA5F, 0xF111, 0x01A8, 0xFDF0, 0x005B, 0xFFE0, 0xFFFF, 0x0004, - 0x0040, 0x0001, 0x0346, 0x02E3, 0x10D3, 0x2139, 0x7869, 0xA1E1, - 0xFC61, 0xF184, 0x01EE, 0xFE10, 0x005E, 0xFFE2, 0xFFFF, 0x0004, - 0x0040, 0x0001, 0x0346, 0x02E3, 0x10D3, 0x2139, 0x7869, 0xA1E1, - 0xFC61, 0xF184, 0x01EE, 0xFE10, 0x005E, 0xFFE2, 0xFFFF, 0x0005, - 0x0043, 0x0010, 0x0359, 0x036C, 0x10A2, 0x2425, 0x79D3, 0xA4AF, - 0xFE4C, 0xF1FF, 0x022F, 0xFE2F, 0x0061, 0xFFE4, 0xFFFF, 0x0005, - 0x0043, 0x0010, 0x0359, 0x036C, 0x10A2, 0x2425, 0x79D3, 0xA4AF, - 0xFE4C, 0xF1FF, 0x022F, 0xFE2F, 0x0061, 0xFFE4, 0xFFFF, 0x0006, - 0x0046, 0x001F, 0x036A, 0x03F9, 0x105D, 0x271C, 0x7B1A, 0xA78D, - 0x001F, 0xF282, 0x0269, 0xFE4F, 0x0062, 0xFFE7, 0xFFFF, 0x0006, - 0x0046, 0x001F, 0x036A, 0x03F9, 0x105D, 0x271C, 0x7B1A, 0xA78D, - 0x001F, 0xF282, 0x0269, 0xFE4F, 0x0062, 0xFFE7, 0xFFFF, 0x0006, - 0x004A, 0x0030, 0x0377, 0x048B, 0x1004, 0x2A1F, 0x7C3D, 0xAA7B, - 0x01D8, 0xF30B, 0x029E, 0xFE6F, 0x0063, 0xFFE9, 0xFFFF, 0x0006, - 0x004A, 0x0030, 0x0377, 0x048B, 0x1004, 0x2A1F, 0x7C3D, 0xAA7B, - 0x01D8, 0xF30B, 0x029E, 0xFE6F, 0x0063, 0xFFE9, 0xFFFF, 0x0007, - 0x004D, 0x0043, 0x0382, 0x0520, 0x0F97, 0x2D2C, 0x7D3A, 0xAD75, - 0x037A, 0xF399, 0x02CE, 0xFE8E, 0x0064, 0xFFEB, 0x0000, 0x0007, - 0x004D, 0x0043, 0x0382, 0x0520, 0x0F97, 0x2D2C, 0x7D3A, 0xAD75, - 0x037A, 0xF399, 0x02CE, 0xFE8E, 0x0064, 0xFFEB, 0x0000, 0x0007, - 0x0050, 0x0056, 0x038A, 0x05B7, 0x0F14, 0x3041, 0x7E12, 0xB07C, - 0x0502, 0xF42C, 0x02F7, 0xFEAC, 0x0064, 0xFFEC, 0x0000, 0x0007, - 0x0050, 0x0056, 0x038A, 0x05B7, 0x0F14, 0x3041, 0x7E12, 0xB07C, - 0x0502, 0xF42C, 0x02F7, 0xFEAC, 0x0064, 0xFFEC, 0x0000, 0x0008, - 0x0053, 0x006B, 0x038E, 0x0652, 0x0E7C, 0x335D, 0x7EC2, 0xB38C, - 0x0671, 0xF4C3, 0x031C, 0xFECA, 0x0063, 0xFFEE, 0x0000, 0x0008, - 0x0053, 0x006B, 0x038E, 0x0652, 0x0E7C, 0x335D, 0x7EC2, 0xB38C, - 0x0671, 0xF4C3, 0x031C, 0xFECA, 0x0063, 0xFFEE, 0x0000, 0x0009, - 0x0056, 0x0080, 0x038F, 0x06EE, 0x0DCE, 0x367E, 0x7F4D, 0xB6A4, - 0x07C8, 0xF55C, 0x033B, 0xFEE6, 0x0062, 0xFFEF, 0x0000, 0x0009, - 0x0056, 0x0080, 0x038F, 0x06EE, 0x0DCE, 0x367E, 0x7F4D, 0xB6A4, - 0x07C8, 0xF55C, 0x033B, 0xFEE6, 0x0062, 0xFFEF, 0x0000, 0x000A, - 0x0058, 0x0098, 0x038C, 0x078C, 0x0D08, 0x39A4, 0x7FB0, 0xB9C4, - 0x0905, 0xF5F9, 0x0354, 0xFF02, 0x0061, 0xFFF1, 0x0000, 0x000A, - 0x0058, 0x0098, 0x038C, 0x078C, 0x0D08, 0x39A4, 0x7FB0, 0xB9C4, - 0x0905, 0xF5F9, 0x0354, 0xFF02, 0x0061, 0xFFF1, 0x0000, 0x000B, - 0x005B, 0x00AF, 0x0385, 0x082B, 0x0C2B, 0x3CCB, 0x7FEB, 0xBCE7, - 0x0A2A, 0xF697, 0x0369, 0xFF1D, 0x005F, 0xFFF2, 0x0000, 0x000B, - 0x005B, 0x00AF, 0x0385, 0x082B, 0x0C2B, 0x3CCB, 0x7FEB, 0xBCE7, - 0x0A2A, 0xF697, 0x0369, 0xFF1D, 0x005F, 0xFFF2, 0x0000, 0x000D, - 0x005D, 0x00C8, 0x037A, 0x08CA, 0x0B37, 0x3FF2, 0x7FFF, 0xC00E, - 0x0B37, 0xF736, 0x037A, 0xFF38, 0x005D, 0xFFF3, 0x0000, 0x000D, - 0x005D, 0x00C8, 0x037A, 0x08CA, 0x0B37, 0x3FF2, 0x7FFF, 0xC00E, - 0x0B37, 0xF736, 0x037A, 0xFF38, 0x005D, 0xFFF3, 0x0000, 0x0000 -}; - -static void MP3AB0(int32_t* v) -{ - /* Part 2 - 100% Accurate */ - static const uint16_t LUT2[8] = { - 0xFEC4, 0xF4FA, 0xC5E4, 0xE1C4, - 0x1916, 0x4A50, 0xA268, 0x78AE - }; - static const uint16_t LUT3[4] = { 0xFB14, 0xD4DC, 0x31F2, 0x8E3A }; - int i; - - for (i = 0; i < 8; i++) { - v[16 + i] = v[0 + i] + v[8 + i]; - v[24 + i] = ((v[0 + i] - v[8 + i]) * LUT2[i]) >> 0x10; - } - - /* Part 3: 4-wide butterflies */ - - for (i = 0; i < 4; i++) { - v[0 + i] = v[16 + i] + v[20 + i]; - v[4 + i] = ((v[16 + i] - v[20 + i]) * LUT3[i]) >> 0x10; - - v[8 + i] = v[24 + i] + v[28 + i]; - v[12 + i] = ((v[24 + i] - v[28 + i]) * LUT3[i]) >> 0x10; - } - - /* Part 4: 2-wide butterflies - 100% Accurate */ - - for (i = 0; i < 16; i += 4) { - v[16 + i] = v[0 + i] + v[2 + i]; - v[18 + i] = ((v[0 + i] - v[2 + i]) * 0xEC84) >> 0x10; - - v[17 + i] = v[1 + i] + v[3 + i]; - v[19 + i] = ((v[1 + i] - v[3 + i]) * 0x61F8) >> 0x10; - } -} - -void mp3_task(struct hle_t* hle, unsigned int index, uint32_t address) -{ - uint32_t inPtr, outPtr; - uint32_t t6;/* = 0x08A0; - I think these are temporary storage buffers */ - uint32_t t5;/* = 0x0AC0; */ - uint32_t t4;/* = (w1 & 0x1E); */ - - /* Initialization Code */ - uint32_t readPtr; /* s5 */ - uint32_t writePtr; /* s6 */ - uint32_t tmp; - int cnt, cnt2; - - /* I think these are temporary storage buffers */ - t6 = 0x08A0; - t5 = 0x0AC0; - t4 = index; - - writePtr = readPtr = address; - /* Just do that for efficiency... may remove and use directly later anyway */ - memcpy(hle->mp3_buffer + 0xCE8, hle->dram + readPtr, 8); - /* This must be a header byte or whatnot */ - readPtr += 8; - - for (cnt = 0; cnt < 0x480; cnt += 0x180) { - /* DMA: 0xCF0 <- RDRAM[s5] : 0x180 */ - memcpy(hle->mp3_buffer + 0xCF0, hle->dram + readPtr, 0x180); - inPtr = 0xCF0; /* s7 */ - outPtr = 0xE70; /* s3 */ -/* --------------- Inner Loop Start -------------------- */ - for (cnt2 = 0; cnt2 < 0x180; cnt2 += 0x40) { - t6 &= 0xFFE0; - t5 &= 0xFFE0; - t6 |= t4; - t5 |= t4; - InnerLoop(hle, outPtr, inPtr, t6, t5, t4); - t4 = (t4 - 2) & 0x1E; - tmp = t6; - t6 = t5; - t5 = tmp; - inPtr += 0x40; - outPtr += 0x40; - } -/* --------------- Inner Loop End -------------------- */ - memcpy(hle->dram + writePtr, hle->mp3_buffer + 0xe70, 0x180); - writePtr += 0x180; - readPtr += 0x180; - } -} - -static void InnerLoop(struct hle_t* hle, - uint32_t outPtr, uint32_t inPtr, - uint32_t t6, uint32_t t5, uint32_t t4) -{ - /* Part 1: 100% Accurate */ - - /* 0, 1, 3, 2, 7, 6, 4, 5, 7, 6, 4, 5, 0, 1, 3, 2 */ - static const uint16_t LUT6[16] = { - 0xFFB2, 0xFD3A, 0xF10A, 0xF854, - 0xBDAE, 0xCDA0, 0xE76C, 0xDB94, - 0x1920, 0x4B20, 0xAC7C, 0x7C68, - 0xABEC, 0x9880, 0xDAE8, 0x839C - }; - int i; - uint32_t t0; - uint32_t t1; - uint32_t t2; - uint32_t t3; - int32_t v2 = 0, v4 = 0, v6 = 0, v8 = 0; - uint32_t offset; - uint32_t addptr; - int x; - int32_t mult6; - int32_t mult4; - int tmp; - int32_t hi0; - int32_t hi1; - int32_t vt; - int32_t v[32]; - - v[0] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x00 ^ S16)); - v[31] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x3E ^ S16)); - v[0] += v[31]; - v[1] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x02 ^ S16)); - v[30] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x3C ^ S16)); - v[1] += v[30]; - v[2] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x06 ^ S16)); - v[28] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x38 ^ S16)); - v[2] += v[28]; - v[3] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x04 ^ S16)); - v[29] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x3A ^ S16)); - v[3] += v[29]; - - v[4] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x0E ^ S16)); - v[24] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x30 ^ S16)); - v[4] += v[24]; - v[5] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x0C ^ S16)); - v[25] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x32 ^ S16)); - v[5] += v[25]; - v[6] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x08 ^ S16)); - v[27] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x36 ^ S16)); - v[6] += v[27]; - v[7] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x0A ^ S16)); - v[26] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x34 ^ S16)); - v[7] += v[26]; - - v[8] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x1E ^ S16)); - v[16] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x20 ^ S16)); - v[8] += v[16]; - v[9] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x1C ^ S16)); - v[17] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x22 ^ S16)); - v[9] += v[17]; - v[10] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x18 ^ S16)); - v[19] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x26 ^ S16)); - v[10] += v[19]; - v[11] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x1A ^ S16)); - v[18] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x24 ^ S16)); - v[11] += v[18]; - - v[12] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x10 ^ S16)); - v[23] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x2E ^ S16)); - v[12] += v[23]; - v[13] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x12 ^ S16)); - v[22] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x2C ^ S16)); - v[13] += v[22]; - v[14] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x16 ^ S16)); - v[20] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x28 ^ S16)); - v[14] += v[20]; - v[15] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x14 ^ S16)); - v[21] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x2A ^ S16)); - v[15] += v[21]; - - /* Part 2-4 */ - - MP3AB0(v); - - /* Part 5 - 1-Wide Butterflies - 100% Accurate but need SSVs!!! */ - - t0 = t6 + 0x100; - t1 = t6 + 0x200; - t2 = t5 + 0x100; - t3 = t5 + 0x200; - - /* 0x13A8 */ - v[1] = 0; - v[11] = ((v[16] - v[17]) * 0xB504) >> 0x10; - - v[16] = -v[16] - v[17]; - v[2] = v[18] + v[19]; - /* ** Store v[11] -> (T6 + 0)** */ - *(int16_t *)(hle->mp3_buffer + ((t6 + (short)0x0))) = (short)v[11]; - - - v[11] = -v[11]; - /* ** Store v[16] -> (T3 + 0)** */ - *(int16_t *)(hle->mp3_buffer + ((t3 + (short)0x0))) = (short)v[16]; - /* ** Store v[11] -> (T5 + 0)** */ - *(int16_t *)(hle->mp3_buffer + ((t5 + (short)0x0))) = (short)v[11]; - /* 0x13E8 - Verified.... */ - v[2] = -v[2]; - /* ** Store v[2] -> (T2 + 0)** */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0x0))) = (short)v[2]; - v[3] = (((v[18] - v[19]) * 0x16A09) >> 0x10) + v[2]; - /* ** Store v[3] -> (T0 + 0)** */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0x0))) = (short)v[3]; - /* 0x1400 - Verified */ - v[4] = -v[20] - v[21]; - v[6] = v[22] + v[23]; - v[5] = ((v[20] - v[21]) * 0x16A09) >> 0x10; - /* ** Store v[4] -> (T3 + 0xFF80) */ - *(int16_t *)(hle->mp3_buffer + ((t3 + (short)0xFF80))) = (short)v[4]; - v[7] = ((v[22] - v[23]) * 0x2D413) >> 0x10; - v[5] = v[5] - v[4]; - v[7] = v[7] - v[5]; - v[6] = v[6] + v[6]; - v[5] = v[5] - v[6]; - v[4] = -v[4] - v[6]; - /* *** Store v[7] -> (T1 + 0xFF80) */ - *(int16_t *)(hle->mp3_buffer + ((t1 + (short)0xFF80))) = (short)v[7]; - /* *** Store v[4] -> (T2 + 0xFF80) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0xFF80))) = (short)v[4]; - /* *** Store v[5] -> (T0 + 0xFF80) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0xFF80))) = (short)v[5]; - v[8] = v[24] + v[25]; - - - v[9] = ((v[24] - v[25]) * 0x16A09) >> 0x10; - v[2] = v[8] + v[9]; - v[11] = ((v[26] - v[27]) * 0x2D413) >> 0x10; - v[13] = ((v[28] - v[29]) * 0x2D413) >> 0x10; - - v[10] = v[26] + v[27]; - v[10] = v[10] + v[10]; - v[12] = v[28] + v[29]; - v[12] = v[12] + v[12]; - v[14] = v[30] + v[31]; - v[3] = v[8] + v[10]; - v[14] = v[14] + v[14]; - v[13] = (v[13] - v[2]) + v[12]; - v[15] = (((v[30] - v[31]) * 0x5A827) >> 0x10) - (v[11] + v[2]); - v[14] = -(v[14] + v[14]) + v[3]; - v[17] = v[13] - v[10]; - v[9] = v[9] + v[14]; - /* ** Store v[9] -> (T6 + 0x40) */ - *(int16_t *)(hle->mp3_buffer + ((t6 + (short)0x40))) = (short)v[9]; - v[11] = v[11] - v[13]; - /* ** Store v[17] -> (T0 + 0xFFC0) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0xFFC0))) = (short)v[17]; - v[12] = v[8] - v[12]; - /* ** Store v[11] -> (T0 + 0x40) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0x40))) = (short)v[11]; - v[8] = -v[8]; - /* ** Store v[15] -> (T1 + 0xFFC0) */ - *(int16_t *)(hle->mp3_buffer + ((t1 + (short)0xFFC0))) = (short)v[15]; - v[10] = -v[10] - v[12]; - /* ** Store v[12] -> (T2 + 0x40) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0x40))) = (short)v[12]; - /* ** Store v[8] -> (T3 + 0xFFC0) */ - *(int16_t *)(hle->mp3_buffer + ((t3 + (short)0xFFC0))) = (short)v[8]; - /* ** Store v[14] -> (T5 + 0x40) */ - *(int16_t *)(hle->mp3_buffer + ((t5 + (short)0x40))) = (short)v[14]; - /* ** Store v[10] -> (T2 + 0xFFC0) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0xFFC0))) = (short)v[10]; - /* 0x14FC - Verified... */ - - /* Part 6 - 100% Accurate */ - - v[0] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x00 ^ S16)); - v[31] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x3E ^ S16)); - v[0] -= v[31]; - v[1] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x02 ^ S16)); - v[30] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x3C ^ S16)); - v[1] -= v[30]; - v[2] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x06 ^ S16)); - v[28] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x38 ^ S16)); - v[2] -= v[28]; - v[3] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x04 ^ S16)); - v[29] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x3A ^ S16)); - v[3] -= v[29]; - - v[4] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x0E ^ S16)); - v[24] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x30 ^ S16)); - v[4] -= v[24]; - v[5] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x0C ^ S16)); - v[25] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x32 ^ S16)); - v[5] -= v[25]; - v[6] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x08 ^ S16)); - v[27] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x36 ^ S16)); - v[6] -= v[27]; - v[7] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x0A ^ S16)); - v[26] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x34 ^ S16)); - v[7] -= v[26]; - - v[8] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x1E ^ S16)); - v[16] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x20 ^ S16)); - v[8] -= v[16]; - v[9] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x1C ^ S16)); - v[17] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x22 ^ S16)); - v[9] -= v[17]; - v[10] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x18 ^ S16)); - v[19] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x26 ^ S16)); - v[10] -= v[19]; - v[11] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x1A ^ S16)); - v[18] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x24 ^ S16)); - v[11] -= v[18]; - - v[12] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x10 ^ S16)); - v[23] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x2E ^ S16)); - v[12] -= v[23]; - v[13] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x12 ^ S16)); - v[22] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x2C ^ S16)); - v[13] -= v[22]; - v[14] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x16 ^ S16)); - v[20] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x28 ^ S16)); - v[14] -= v[20]; - v[15] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x14 ^ S16)); - v[21] = *(int16_t *)(hle->mp3_buffer + inPtr + (0x2A ^ S16)); - v[15] -= v[21]; - - for (i = 0; i < 16; i++) - v[0 + i] = (v[0 + i] * LUT6[i]) >> 0x10; - v[0] = v[0] + v[0]; - v[1] = v[1] + v[1]; - v[2] = v[2] + v[2]; - v[3] = v[3] + v[3]; - v[4] = v[4] + v[4]; - v[5] = v[5] + v[5]; - v[6] = v[6] + v[6]; - v[7] = v[7] + v[7]; - v[12] = v[12] + v[12]; - v[13] = v[13] + v[13]; - v[15] = v[15] + v[15]; - - MP3AB0(v); - - /* Part 7: - 100% Accurate + SSV - Unoptimized */ - - v[0] = (v[17] + v[16]) >> 1; - v[1] = ((v[17] * (int)((short)0xA57E * 2)) + (v[16] * 0xB504)) >> 0x10; - v[2] = -v[18] - v[19]; - v[3] = ((v[18] - v[19]) * 0x16A09) >> 0x10; - v[4] = v[20] + v[21] + v[0]; - v[5] = (((v[20] - v[21]) * 0x16A09) >> 0x10) + v[1]; - v[6] = (((v[22] + v[23]) << 1) + v[0]) - v[2]; - v[7] = (((v[22] - v[23]) * 0x2D413) >> 0x10) + v[0] + v[1] + v[3]; - /* 0x16A8 */ - /* Save v[0] -> (T3 + 0xFFE0) */ - *(int16_t *)(hle->mp3_buffer + ((t3 + (short)0xFFE0))) = (short) - v[0]; - v[8] = v[24] + v[25]; - v[9] = ((v[24] - v[25]) * 0x16A09) >> 0x10; - v[10] = ((v[26] + v[27]) << 1) + v[8]; - v[11] = (((v[26] - v[27]) * 0x2D413) >> 0x10) + v[8] + v[9]; - v[12] = v[4] - ((v[28] + v[29]) << 1); - /* ** Store v12 -> (T2 + 0x20) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0x20))) = (short)v[12]; - v[13] = (((v[28] - v[29]) * 0x2D413) >> 0x10) - v[12] - v[5]; - v[14] = v[30] + v[31]; - v[14] = v[14] + v[14]; - v[14] = v[14] + v[14]; - v[14] = v[6] - v[14]; - v[15] = (((v[30] - v[31]) * 0x5A827) >> 0x10) - v[7]; - /* Store v14 -> (T5 + 0x20) */ - *(int16_t *)(hle->mp3_buffer + ((t5 + (short)0x20))) = (short)v[14]; - v[14] = v[14] + v[1]; - /* Store v[14] -> (T6 + 0x20) */ - *(int16_t *)(hle->mp3_buffer + ((t6 + (short)0x20))) = (short)v[14]; - /* Store v[15] -> (T1 + 0xFFE0) */ - *(int16_t *)(hle->mp3_buffer + ((t1 + (short)0xFFE0))) = (short)v[15]; - v[9] = v[9] + v[10]; - v[1] = v[1] + v[6]; - v[6] = v[10] - v[6]; - v[1] = v[9] - v[1]; - /* Store v[6] -> (T5 + 0x60) */ - *(int16_t *)(hle->mp3_buffer + ((t5 + (short)0x60))) = (short)v[6]; - v[10] = v[10] + v[2]; - v[10] = v[4] - v[10]; - /* Store v[10] -> (T2 + 0xFFA0) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0xFFA0))) = (short)v[10]; - v[12] = v[2] - v[12]; - /* Store v[12] -> (T2 + 0xFFE0) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0xFFE0))) = (short)v[12]; - v[5] = v[4] + v[5]; - v[4] = v[8] - v[4]; - /* Store v[4] -> (T2 + 0x60) */ - *(int16_t *)(hle->mp3_buffer + ((t2 + (short)0x60))) = (short)v[4]; - v[0] = v[0] - v[8]; - /* Store v[0] -> (T3 + 0xFFA0) */ - *(int16_t *)(hle->mp3_buffer + ((t3 + (short)0xFFA0))) = (short)v[0]; - v[7] = v[7] - v[11]; - /* Store v[7] -> (T1 + 0xFFA0) */ - *(int16_t *)(hle->mp3_buffer + ((t1 + (short)0xFFA0))) = (short)v[7]; - v[11] = v[11] - v[3]; - /* Store v[1] -> (T6 + 0x60) */ - *(int16_t *)(hle->mp3_buffer + ((t6 + (short)0x60))) = (short)v[1]; - v[11] = v[11] - v[5]; - /* Store v[11] -> (T0 + 0x60) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0x60))) = (short)v[11]; - v[3] = v[3] - v[13]; - /* Store v[3] -> (T0 + 0x20) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0x20))) = (short)v[3]; - v[13] = v[13] + v[2]; - /* Store v[13] -> (T0 + 0xFFE0) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0xFFE0))) = (short)v[13]; - v[2] = (v[5] - v[2]) - v[9]; - /* Store v[2] -> (T0 + 0xFFA0) */ - *(int16_t *)(hle->mp3_buffer + ((t0 + (short)0xFFA0))) = (short)v[2]; - /* 0x7A8 - Verified... */ - - /* Step 8 - Dewindowing */ - - addptr = t6 & 0xFFE0; - - offset = 0x10 - (t4 >> 1); - for (x = 0; x < 8; x++) { - int32_t v0; - int32_t v18; - v2 = v4 = v6 = v8 = 0; - - for (i = 7; i >= 0; i--) { - v2 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x00) * (short)DeWindowLUT[offset + 0x00] + 0x4000) >> 0xF; - v4 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x10) * (short)DeWindowLUT[offset + 0x08] + 0x4000) >> 0xF; - v6 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x20) * (short)DeWindowLUT[offset + 0x20] + 0x4000) >> 0xF; - v8 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x30) * (short)DeWindowLUT[offset + 0x28] + 0x4000) >> 0xF; - addptr += 2; - offset++; - } - v0 = v2 + v4; - v18 = v6 + v8; - /* Clamp(v0); */ - /* Clamp(v18); */ - /* clamp??? */ - *(int16_t *)(hle->mp3_buffer + (outPtr ^ S16)) = v0; - *(int16_t *)(hle->mp3_buffer + ((outPtr + 2)^S16)) = v18; - outPtr += 4; - addptr += 0x30; - offset += 0x38; - } - - offset = 0x10 - (t4 >> 1) + 8 * 0x40; - v2 = v4 = 0; - for (i = 0; i < 4; i++) { - v2 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x00) * (short)DeWindowLUT[offset + 0x00] + 0x4000) >> 0xF; - v2 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x10) * (short)DeWindowLUT[offset + 0x08] + 0x4000) >> 0xF; - addptr += 2; - offset++; - v4 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x00) * (short)DeWindowLUT[offset + 0x00] + 0x4000) >> 0xF; - v4 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x10) * (short)DeWindowLUT[offset + 0x08] + 0x4000) >> 0xF; - addptr += 2; - offset++; - } - mult6 = *(int32_t *)(hle->mp3_buffer + 0xCE8); - mult4 = *(int32_t *)(hle->mp3_buffer + 0xCEC); - if (t4 & 0x2) { - v2 = (v2 **(uint32_t *)(hle->mp3_buffer + 0xCE8)) >> 0x10; - *(int16_t *)(hle->mp3_buffer + (outPtr ^ S16)) = v2; - } else { - v4 = (v4 **(uint32_t *)(hle->mp3_buffer + 0xCE8)) >> 0x10; - *(int16_t *)(hle->mp3_buffer + (outPtr ^ S16)) = v4; - mult4 = *(uint32_t *)(hle->mp3_buffer + 0xCE8); - } - addptr -= 0x50; - - for (x = 0; x < 8; x++) { - int32_t v0; - int32_t v18; - v2 = v4 = v6 = v8 = 0; - - offset = (0x22F - (t4 >> 1) + x * 0x40); - - for (i = 0; i < 4; i++) { - v2 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x20) * (short)DeWindowLUT[offset + 0x00] + 0x4000) >> 0xF; - v2 -= ((int) * (int16_t *)(hle->mp3_buffer + ((addptr + 2)) + 0x20) * (short)DeWindowLUT[offset + 0x01] + 0x4000) >> 0xF; - v4 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x30) * (short)DeWindowLUT[offset + 0x08] + 0x4000) >> 0xF; - v4 -= ((int) * (int16_t *)(hle->mp3_buffer + ((addptr + 2)) + 0x30) * (short)DeWindowLUT[offset + 0x09] + 0x4000) >> 0xF; - v6 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x00) * (short)DeWindowLUT[offset + 0x20] + 0x4000) >> 0xF; - v6 -= ((int) * (int16_t *)(hle->mp3_buffer + ((addptr + 2)) + 0x00) * (short)DeWindowLUT[offset + 0x21] + 0x4000) >> 0xF; - v8 += ((int) * (int16_t *)(hle->mp3_buffer + (addptr) + 0x10) * (short)DeWindowLUT[offset + 0x28] + 0x4000) >> 0xF; - v8 -= ((int) * (int16_t *)(hle->mp3_buffer + ((addptr + 2)) + 0x10) * (short)DeWindowLUT[offset + 0x29] + 0x4000) >> 0xF; - addptr += 4; - offset += 2; - } - v0 = v2 + v4; - v18 = v6 + v8; - /* Clamp(v0); */ - /* Clamp(v18); */ - /* clamp??? */ - *(int16_t *)(hle->mp3_buffer + ((outPtr + 2)^S16)) = v0; - *(int16_t *)(hle->mp3_buffer + ((outPtr + 4)^S16)) = v18; - outPtr += 4; - addptr -= 0x50; - } - - tmp = outPtr; - hi0 = mult6; - hi1 = mult4; - - hi0 = (int)hi0 >> 0x10; - hi1 = (int)hi1 >> 0x10; - for (i = 0; i < 8; i++) { - /* v0 */ - vt = (*(int16_t *)(hle->mp3_buffer + ((tmp - 0x40)^S16)) * hi0); - *(int16_t *)((uint8_t *)hle->mp3_buffer + ((tmp - 0x40)^S16)) = clamp_s16(vt); - - /* v17 */ - vt = (*(int16_t *)(hle->mp3_buffer + ((tmp - 0x30)^S16)) * hi0); - *(int16_t *)((uint8_t *)hle->mp3_buffer + ((tmp - 0x30)^S16)) = clamp_s16(vt); - - /* v2 */ - vt = (*(int16_t *)(hle->mp3_buffer + ((tmp - 0x1E)^S16)) * hi1); - *(int16_t *)((uint8_t *)hle->mp3_buffer + ((tmp - 0x1E)^S16)) = clamp_s16(vt); - - /* v4 */ - vt = (*(int16_t *)(hle->mp3_buffer + ((tmp - 0xE)^S16)) * hi1); - *(int16_t *)((uint8_t *)hle->mp3_buffer + ((tmp - 0xE)^S16)) = clamp_s16(vt); - - tmp += 2; - } -} - diff --git a/mupen64plus-rsp-hle/src/musyx.c b/mupen64plus-rsp-hle/src/musyx.c deleted file mode 100644 index d5a630a..0000000 --- a/mupen64plus-rsp-hle/src/musyx.c +++ /dev/null @@ -1,988 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - musyx.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2013 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdbool.h> -#include <stddef.h> -#include <stdint.h> -#include <string.h> - -#include "arithmetics.h" -#include "audio.h" -#include "common.h" -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" - -/* various constants */ -enum { SUBFRAME_SIZE = 192 }; -enum { MAX_VOICES = 32 }; - -enum { SAMPLE_BUFFER_SIZE = 0x200 }; - - -enum { - SFD_VOICE_COUNT = 0x0, - SFD_SFX_INDEX = 0x2, - SFD_VOICE_BITMASK = 0x4, - SFD_STATE_PTR = 0x8, - SFD_SFX_PTR = 0xc, - SFD_VOICES = 0x10, - - /* v2 only */ - SFD2_10_PTR = 0x10, - SFD2_14_BITMASK = 0x14, - SFD2_15_BITMASK = 0x15, - SFD2_16_BITMASK = 0x16, - SFD2_18_PTR = 0x18, - SFD2_1C_PTR = 0x1c, - SFD2_20_PTR = 0x20, - SFD2_24_PTR = 0x24, - SFD2_VOICES = 0x28 -}; - -enum { - VOICE_ENV_BEGIN = 0x00, - VOICE_ENV_STEP = 0x10, - VOICE_PITCH_Q16 = 0x20, - VOICE_PITCH_SHIFT = 0x22, - VOICE_CATSRC_0 = 0x24, - VOICE_CATSRC_1 = 0x30, - VOICE_ADPCM_FRAMES = 0x3c, - VOICE_SKIP_SAMPLES = 0x3e, - - /* for PCM16 */ - VOICE_U16_40 = 0x40, - VOICE_U16_42 = 0x42, - - /* for ADPCM */ - VOICE_ADPCM_TABLE_PTR = 0x40, - - VOICE_INTERLEAVED_PTR = 0x44, - VOICE_END_POINT = 0x48, - VOICE_RESTART_POINT = 0x4a, - VOICE_U16_4C = 0x4c, - VOICE_U16_4E = 0x4e, - - VOICE_SIZE = 0x50 -}; - -enum { - CATSRC_PTR1 = 0x00, - CATSRC_PTR2 = 0x04, - CATSRC_SIZE1 = 0x08, - CATSRC_SIZE2 = 0x0a -}; - -enum { - STATE_LAST_SAMPLE = 0x0, - STATE_BASE_VOL = 0x100, - STATE_CC0 = 0x110, - STATE_740_LAST4_V1 = 0x290, - - STATE_740_LAST4_V2 = 0x110 -}; - -enum { - SFX_CBUFFER_PTR = 0x00, - SFX_CBUFFER_LENGTH = 0x04, - SFX_TAP_COUNT = 0x08, - SFX_FIR4_HGAIN = 0x0a, - SFX_TAP_DELAYS = 0x0c, - SFX_TAP_GAINS = 0x2c, - SFX_U16_3C = 0x3c, - SFX_U16_3E = 0x3e, - SFX_FIR4_HCOEFFS = 0x40 -}; - - -/* struct definition */ -typedef struct { - /* internal subframes */ - int16_t left[SUBFRAME_SIZE]; - int16_t right[SUBFRAME_SIZE]; - int16_t cc0[SUBFRAME_SIZE]; - int16_t e50[SUBFRAME_SIZE]; - - /* internal subframes base volumes */ - int32_t base_vol[4]; - - /* */ - int16_t subframe_740_last4[4]; -} musyx_t; - -typedef void (*mix_sfx_with_main_subframes_t)(musyx_t *musyx, const int16_t *subframe, - const uint16_t* gains); - -/* helper functions prototypes */ -static void load_base_vol(struct hle_t* hle, int32_t *base_vol, uint32_t address); -static void save_base_vol(struct hle_t* hle, const int32_t *base_vol, uint32_t address); -static void update_base_vol(struct hle_t* hle, int32_t *base_vol, - uint32_t voice_mask, uint32_t last_sample_ptr, - uint8_t mask_15, uint32_t ptr_24); - -static void init_subframes_v1(musyx_t *musyx); -static void init_subframes_v2(musyx_t *musyx); - -static uint32_t voice_stage(struct hle_t* hle, musyx_t *musyx, - uint32_t voice_ptr, uint32_t last_sample_ptr); - -static void dma_cat8(struct hle_t* hle, uint8_t *dst, uint32_t catsrc_ptr); -static void dma_cat16(struct hle_t* hle, uint16_t *dst, uint32_t catsrc_ptr); - -static void load_samples_PCM16(struct hle_t* hle, uint32_t voice_ptr, int16_t *samples, - unsigned *segbase, unsigned *offset); -static void load_samples_ADPCM(struct hle_t* hle, uint32_t voice_ptr, int16_t *samples, - unsigned *segbase, unsigned *offset); - -static void adpcm_decode_frames(struct hle_t* hle, - int16_t *dst, const uint8_t *src, - const int16_t *table, uint8_t count, - uint8_t skip_samples); - -static void adpcm_predict_frame(int16_t *dst, const uint8_t *src, - const uint8_t *nibbles, - unsigned int rshift); - -static void mix_voice_samples(struct hle_t* hle, musyx_t *musyx, - uint32_t voice_ptr, const int16_t *samples, - unsigned segbase, unsigned offset, uint32_t last_sample_ptr); - -static void sfx_stage(struct hle_t* hle, - mix_sfx_with_main_subframes_t mix_sfx_with_main_subframes, - musyx_t *musyx, uint32_t sfx_ptr, uint16_t idx); - -static void mix_sfx_with_main_subframes_v1(musyx_t *musyx, const int16_t *subframe, - const uint16_t* gains); -static void mix_sfx_with_main_subframes_v2(musyx_t *musyx, const int16_t *subframe, - const uint16_t* gains); - -static void mix_samples(int16_t *y, int16_t x, int16_t hgain); -static void mix_subframes(int16_t *y, const int16_t *x, int16_t hgain); -static void mix_fir4(int16_t *y, const int16_t *x, int16_t hgain, const int16_t *hcoeffs); - - -static void interleave_stage_v1(struct hle_t* hle, musyx_t *musyx, - uint32_t output_ptr); - -static void interleave_stage_v2(struct hle_t* hle, musyx_t *musyx, - uint16_t mask_16, uint32_t ptr_18, - uint32_t ptr_1c, uint32_t output_ptr); - -static int32_t dot4(const int16_t *x, const int16_t *y) -{ - size_t i; - int32_t accu = 0; - - for (i = 0; i < 4; ++i) - accu = clamp_s16(accu + (((int32_t)x[i] * (int32_t)y[i]) >> 15)); - - return accu; -} - -/************************************************************************** - * MusyX v1 audio ucode - **************************************************************************/ -void musyx_v1_task(struct hle_t* hle) -{ - uint32_t sfd_ptr = *dmem_u32(hle, TASK_DATA_PTR); - uint32_t sfd_count = *dmem_u32(hle, TASK_DATA_SIZE); - uint32_t state_ptr; - musyx_t musyx; - - HleVerboseMessage(hle->user_defined, - "musyx_v1_task: *data=%x, #SF=%d", - sfd_ptr, - sfd_count); - - state_ptr = *dram_u32(hle, sfd_ptr + SFD_STATE_PTR); - - /* load initial state */ - load_base_vol(hle, musyx.base_vol, state_ptr + STATE_BASE_VOL); - dram_load_u16(hle, (uint16_t *)musyx.cc0, state_ptr + STATE_CC0, SUBFRAME_SIZE); - dram_load_u16(hle, (uint16_t *)musyx.subframe_740_last4, state_ptr + STATE_740_LAST4_V1, - 4); - - for (;;) { - /* parse SFD structure */ - uint16_t sfx_index = *dram_u16(hle, sfd_ptr + SFD_SFX_INDEX); - uint32_t voice_mask = *dram_u32(hle, sfd_ptr + SFD_VOICE_BITMASK); - uint32_t sfx_ptr = *dram_u32(hle, sfd_ptr + SFD_SFX_PTR); - uint32_t voice_ptr = sfd_ptr + SFD_VOICES; - uint32_t last_sample_ptr = state_ptr + STATE_LAST_SAMPLE; - uint32_t output_ptr; - - /* initialize internal subframes using updated base volumes */ - update_base_vol(hle, musyx.base_vol, voice_mask, last_sample_ptr, 0, 0); - init_subframes_v1(&musyx); - - /* active voices get mixed into L,R,cc0,e50 subframes (optional) */ - output_ptr = voice_stage(hle, &musyx, voice_ptr, last_sample_ptr); - - /* apply delay-based effects (optional) */ - sfx_stage(hle, mix_sfx_with_main_subframes_v1, - &musyx, sfx_ptr, sfx_index); - - /* emit interleaved L,R subframes */ - interleave_stage_v1(hle, &musyx, output_ptr); - - --sfd_count; - if (sfd_count == 0) - break; - - sfd_ptr += SFD_VOICES + MAX_VOICES * VOICE_SIZE; - state_ptr = *dram_u32(hle, sfd_ptr + SFD_STATE_PTR); - } - - /* writeback updated state */ - save_base_vol(hle, musyx.base_vol, state_ptr + STATE_BASE_VOL); - dram_store_u16(hle, (uint16_t *)musyx.cc0, state_ptr + STATE_CC0, SUBFRAME_SIZE); - dram_store_u16(hle, (uint16_t *)musyx.subframe_740_last4, state_ptr + STATE_740_LAST4_V1, - 4); - - rsp_break(hle, SP_STATUS_TASKDONE); -} - -/************************************************************************** - * MusyX v2 audio ucode - **************************************************************************/ -void musyx_v2_task(struct hle_t* hle) -{ - uint32_t sfd_ptr = *dmem_u32(hle, TASK_DATA_PTR); - uint32_t sfd_count = *dmem_u32(hle, TASK_DATA_SIZE); - musyx_t musyx; - - HleVerboseMessage(hle->user_defined, - "musyx_v2_task: *data=%x, #SF=%d", - sfd_ptr, - sfd_count); - - for (;;) { - /* parse SFD structure */ - uint16_t sfx_index = *dram_u16(hle, sfd_ptr + SFD_SFX_INDEX); - uint32_t voice_mask = *dram_u32(hle, sfd_ptr + SFD_VOICE_BITMASK); - uint32_t state_ptr = *dram_u32(hle, sfd_ptr + SFD_STATE_PTR); - uint32_t sfx_ptr = *dram_u32(hle, sfd_ptr + SFD_SFX_PTR); - uint32_t voice_ptr = sfd_ptr + SFD2_VOICES; - - uint32_t ptr_10 = *dram_u32(hle, sfd_ptr + SFD2_10_PTR); - uint8_t mask_14 = *dram_u8 (hle, sfd_ptr + SFD2_14_BITMASK); - uint8_t mask_15 = *dram_u8 (hle, sfd_ptr + SFD2_15_BITMASK); - uint16_t mask_16 = *dram_u16(hle, sfd_ptr + SFD2_16_BITMASK); - uint32_t ptr_18 = *dram_u32(hle, sfd_ptr + SFD2_18_PTR); - uint32_t ptr_1c = *dram_u32(hle, sfd_ptr + SFD2_1C_PTR); - uint32_t ptr_20 = *dram_u32(hle, sfd_ptr + SFD2_20_PTR); - uint32_t ptr_24 = *dram_u32(hle, sfd_ptr + SFD2_24_PTR); - - uint32_t last_sample_ptr = state_ptr + STATE_LAST_SAMPLE; - uint32_t output_ptr; - - /* load state */ - load_base_vol(hle, musyx.base_vol, state_ptr + STATE_BASE_VOL); - dram_load_u16(hle, (uint16_t *)musyx.subframe_740_last4, - state_ptr + STATE_740_LAST4_V2, 4); - - /* initialize internal subframes using updated base volumes */ - update_base_vol(hle, musyx.base_vol, voice_mask, last_sample_ptr, mask_15, ptr_24); - init_subframes_v2(&musyx); - - if (ptr_10) { - /* TODO */ - HleWarnMessage(hle->user_defined, - "ptr_10=%08x mask_14=%02x ptr_24=%08x", - ptr_10, mask_14, ptr_24); - } - - /* active voices get mixed into L,R,cc0,e50 subframes (optional) */ - output_ptr = voice_stage(hle, &musyx, voice_ptr, last_sample_ptr); - - /* apply delay-based effects (optional) */ - sfx_stage(hle, mix_sfx_with_main_subframes_v2, - &musyx, sfx_ptr, sfx_index); - - dram_store_u16(hle, (uint16_t*)musyx.left, output_ptr , SUBFRAME_SIZE); - dram_store_u16(hle, (uint16_t*)musyx.right, output_ptr + 2*SUBFRAME_SIZE, SUBFRAME_SIZE); - dram_store_u16(hle, (uint16_t*)musyx.cc0, output_ptr + 4*SUBFRAME_SIZE, SUBFRAME_SIZE); - - /* store state */ - save_base_vol(hle, musyx.base_vol, state_ptr + STATE_BASE_VOL); - dram_store_u16(hle, (uint16_t*)musyx.subframe_740_last4, - state_ptr + STATE_740_LAST4_V2, 4); - - if (mask_16) - interleave_stage_v2(hle, &musyx, mask_16, ptr_18, ptr_1c, ptr_20); - - --sfd_count; - if (sfd_count == 0) - break; - - sfd_ptr += SFD2_VOICES + MAX_VOICES * VOICE_SIZE; - } - - rsp_break(hle, SP_STATUS_TASKDONE); -} - - - - - -static void load_base_vol(struct hle_t* hle, int32_t *base_vol, uint32_t address) -{ - base_vol[0] = ((uint32_t)(*dram_u16(hle, address)) << 16) | (*dram_u16(hle, address + 8)); - base_vol[1] = ((uint32_t)(*dram_u16(hle, address + 2)) << 16) | (*dram_u16(hle, address + 10)); - base_vol[2] = ((uint32_t)(*dram_u16(hle, address + 4)) << 16) | (*dram_u16(hle, address + 12)); - base_vol[3] = ((uint32_t)(*dram_u16(hle, address + 6)) << 16) | (*dram_u16(hle, address + 14)); -} - -static void save_base_vol(struct hle_t* hle, const int32_t *base_vol, uint32_t address) -{ - unsigned k; - - for (k = 0; k < 4; ++k) { - *dram_u16(hle, address) = (uint16_t)(base_vol[k] >> 16); - address += 2; - } - - for (k = 0; k < 4; ++k) { - *dram_u16(hle, address) = (uint16_t)(base_vol[k]); - address += 2; - } -} - -static void update_base_vol(struct hle_t* hle, int32_t *base_vol, - uint32_t voice_mask, uint32_t last_sample_ptr, - uint8_t mask_15, uint32_t ptr_24) -{ - unsigned i, k; - uint32_t mask; - - HleVerboseMessage(hle->user_defined, "base_vol voice_mask = %08x", voice_mask); - HleVerboseMessage(hle->user_defined, - "BEFORE: base_vol = %08x %08x %08x %08x", - base_vol[0], base_vol[1], base_vol[2], base_vol[3]); - - /* optim: skip voices contributions entirely if voice_mask is empty */ - if (voice_mask != 0) { - for (i = 0, mask = 1; i < MAX_VOICES; - ++i, mask <<= 1, last_sample_ptr += 8) { - if ((voice_mask & mask) == 0) - continue; - - for (k = 0; k < 4; ++k) - base_vol[k] += (int16_t)*dram_u16(hle, last_sample_ptr + k * 2); - } - } - - /* optim: skip contributions entirely if mask_15 is empty */ - if (mask_15 != 0) { - for(i = 0, mask = 1; i < 4; - ++i, mask <<= 1, ptr_24 += 8) { - if ((mask_15 & mask) == 0) - continue; - - for(k = 0; k < 4; ++k) - base_vol[k] += (int16_t)*dram_u16(hle, ptr_24 + k * 2); - } - } - - /* apply 3% decay */ - for (k = 0; k < 4; ++k) - base_vol[k] = (base_vol[k] * 0x0000f850) >> 16; - - HleVerboseMessage(hle->user_defined, - "AFTER: base_vol = %08x %08x %08x %08x", - base_vol[0], base_vol[1], base_vol[2], base_vol[3]); -} - - - - -static void init_subframes_v1(musyx_t *musyx) -{ - unsigned i; - - int16_t base_cc0 = clamp_s16(musyx->base_vol[2]); - int16_t base_e50 = clamp_s16(musyx->base_vol[3]); - - int16_t *left = musyx->left; - int16_t *right = musyx->right; - int16_t *cc0 = musyx->cc0; - int16_t *e50 = musyx->e50; - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - *(e50++) = base_e50; - *(left++) = clamp_s16(*cc0 + base_cc0); - *(right++) = clamp_s16(-*cc0 - base_cc0); - *(cc0++) = 0; - } -} - -static void init_subframes_v2(musyx_t *musyx) -{ - unsigned i,k; - int16_t values[4]; - int16_t* subframes[4]; - - for(k = 0; k < 4; ++k) - values[k] = clamp_s16(musyx->base_vol[k]); - - subframes[0] = musyx->left; - subframes[1] = musyx->right; - subframes[2] = musyx->cc0; - subframes[3] = musyx->e50; - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - - for(k = 0; k < 4; ++k) - *(subframes[k]++) = values[k]; - } -} - -/* Process voices, and returns interleaved subframe destination address */ -static uint32_t voice_stage(struct hle_t* hle, musyx_t *musyx, - uint32_t voice_ptr, uint32_t last_sample_ptr) -{ - uint32_t output_ptr; - int i = 0; - - /* voice stage can be skipped if first voice has no samples */ - if (*dram_u16(hle, voice_ptr + VOICE_CATSRC_0 + CATSRC_SIZE1) == 0) { - HleVerboseMessage(hle->user_defined, "Skipping Voice stage"); - output_ptr = *dram_u32(hle, voice_ptr + VOICE_INTERLEAVED_PTR); - } else { - /* otherwise process voices until a non null output_ptr is encountered */ - for (;;) { - /* load voice samples (PCM16 or APDCM) */ - int16_t samples[SAMPLE_BUFFER_SIZE]; - unsigned segbase; - unsigned offset; - - HleVerboseMessage(hle->user_defined, "Processing Voice #%d", i); - - if (*dram_u8(hle, voice_ptr + VOICE_ADPCM_FRAMES) == 0) - load_samples_PCM16(hle, voice_ptr, samples, &segbase, &offset); - else - load_samples_ADPCM(hle, voice_ptr, samples, &segbase, &offset); - - /* mix them with each internal subframes */ - mix_voice_samples(hle, musyx, voice_ptr, samples, segbase, offset, - last_sample_ptr + i * 8); - - /* check break condition */ - output_ptr = *dram_u32(hle, voice_ptr + VOICE_INTERLEAVED_PTR); - if (output_ptr != 0) - break; - - /* next voice */ - ++i; - voice_ptr += VOICE_SIZE; - } - } - - return output_ptr; -} - -static void dma_cat8(struct hle_t* hle, uint8_t *dst, uint32_t catsrc_ptr) -{ - uint32_t ptr1 = *dram_u32(hle, catsrc_ptr + CATSRC_PTR1); - uint32_t ptr2 = *dram_u32(hle, catsrc_ptr + CATSRC_PTR2); - uint16_t size1 = *dram_u16(hle, catsrc_ptr + CATSRC_SIZE1); - uint16_t size2 = *dram_u16(hle, catsrc_ptr + CATSRC_SIZE2); - - size_t count1 = size1; - size_t count2 = size2; - - HleVerboseMessage(hle->user_defined, - "dma_cat: %08x %08x %04x %04x", - ptr1, - ptr2, - size1, - size2); - - dram_load_u8(hle, dst, ptr1, count1); - - if (size2 == 0) - return; - - dram_load_u8(hle, dst + count1, ptr2, count2); -} - -static void dma_cat16(struct hle_t* hle, uint16_t *dst, uint32_t catsrc_ptr) -{ - uint32_t ptr1 = *dram_u32(hle, catsrc_ptr + CATSRC_PTR1); - uint32_t ptr2 = *dram_u32(hle, catsrc_ptr + CATSRC_PTR2); - uint16_t size1 = *dram_u16(hle, catsrc_ptr + CATSRC_SIZE1); - uint16_t size2 = *dram_u16(hle, catsrc_ptr + CATSRC_SIZE2); - - size_t count1 = size1 >> 1; - size_t count2 = size2 >> 1; - - HleVerboseMessage(hle->user_defined, - "dma_cat: %08x %08x %04x %04x", - ptr1, - ptr2, - size1, - size2); - - dram_load_u16(hle, dst, ptr1, count1); - - if (size2 == 0) - return; - - dram_load_u16(hle, dst + count1, ptr2, count2); -} - -static void load_samples_PCM16(struct hle_t* hle, uint32_t voice_ptr, int16_t *samples, - unsigned *segbase, unsigned *offset) -{ - - uint8_t u8_3e = *dram_u8(hle, voice_ptr + VOICE_SKIP_SAMPLES); - uint16_t u16_40 = *dram_u16(hle, voice_ptr + VOICE_U16_40); - uint16_t u16_42 = *dram_u16(hle, voice_ptr + VOICE_U16_42); - - unsigned count = align(u16_40 + u8_3e, 4); - - HleVerboseMessage(hle->user_defined, "Format: PCM16"); - - *segbase = SAMPLE_BUFFER_SIZE - count; - *offset = u8_3e; - - dma_cat16(hle, (uint16_t *)samples + *segbase, voice_ptr + VOICE_CATSRC_0); - - if (u16_42 != 0) - dma_cat16(hle, (uint16_t *)samples, voice_ptr + VOICE_CATSRC_1); -} - -static void load_samples_ADPCM(struct hle_t* hle, uint32_t voice_ptr, int16_t *samples, - unsigned *segbase, unsigned *offset) -{ - /* decompressed samples cannot exceed 0x400 bytes; - * ADPCM has a compression ratio of 5/16 */ - uint8_t buffer[SAMPLE_BUFFER_SIZE * 2 * 5 / 16]; - int16_t adpcm_table[128]; - - uint8_t u8_3c = *dram_u8(hle, voice_ptr + VOICE_ADPCM_FRAMES ); - uint8_t u8_3d = *dram_u8(hle, voice_ptr + VOICE_ADPCM_FRAMES + 1); - uint8_t u8_3e = *dram_u8(hle, voice_ptr + VOICE_SKIP_SAMPLES ); - uint8_t u8_3f = *dram_u8(hle, voice_ptr + VOICE_SKIP_SAMPLES + 1); - uint32_t adpcm_table_ptr = *dram_u32(hle, voice_ptr + VOICE_ADPCM_TABLE_PTR); - unsigned count; - - HleVerboseMessage(hle->user_defined, "Format: ADPCM"); - - HleVerboseMessage(hle->user_defined, "Loading ADPCM table: %08x", adpcm_table_ptr); - dram_load_u16(hle, (uint16_t *)adpcm_table, adpcm_table_ptr, 128); - - count = u8_3c << 5; - - *segbase = SAMPLE_BUFFER_SIZE - count; - *offset = u8_3e & 0x1f; - - dma_cat8(hle, buffer, voice_ptr + VOICE_CATSRC_0); - adpcm_decode_frames(hle, samples + *segbase, buffer, adpcm_table, u8_3c, u8_3e); - - if (u8_3d != 0) { - dma_cat8(hle, buffer, voice_ptr + VOICE_CATSRC_1); - adpcm_decode_frames(hle, samples, buffer, adpcm_table, u8_3d, u8_3f); - } -} - -static void adpcm_decode_frames(struct hle_t* hle, - int16_t *dst, const uint8_t *src, - const int16_t *table, uint8_t count, - uint8_t skip_samples) -{ - int16_t frame[32]; - const uint8_t *nibbles = src + 8; - unsigned i; - bool jump_gap = false; - - HleVerboseMessage(hle->user_defined, - "ADPCM decode: count=%d, skip=%d", - count, skip_samples); - - if (skip_samples >= 32) { - jump_gap = true; - nibbles += 16; - src += 4; - } - - for (i = 0; i < count; ++i) { - uint8_t c2 = nibbles[0]; - - const int16_t *book = (c2 & 0xf0) + table; - unsigned int rshift = (c2 & 0x0f); - - adpcm_predict_frame(frame, src, nibbles, rshift); - - memcpy(dst, frame, 2 * sizeof(frame[0])); - adpcm_compute_residuals(dst + 2, frame + 2, book, dst , 6); - adpcm_compute_residuals(dst + 8, frame + 8, book, dst + 6, 8); - adpcm_compute_residuals(dst + 16, frame + 16, book, dst + 14, 8); - adpcm_compute_residuals(dst + 24, frame + 24, book, dst + 22, 8); - - if (jump_gap) { - nibbles += 8; - src += 32; - } - - jump_gap = !jump_gap; - nibbles += 16; - src += 4; - dst += 32; - } -} - -static void adpcm_predict_frame(int16_t *dst, const uint8_t *src, - const uint8_t *nibbles, - unsigned int rshift) -{ - unsigned int i; - - *(dst++) = (src[0] << 8) | src[1]; - *(dst++) = (src[2] << 8) | src[3]; - - for (i = 1; i < 16; ++i) { - uint8_t byte = nibbles[i]; - - *(dst++) = adpcm_predict_sample(byte, 0xf0, 8, rshift); - *(dst++) = adpcm_predict_sample(byte, 0x0f, 12, rshift); - } -} - -static void mix_voice_samples(struct hle_t* hle, musyx_t *musyx, - uint32_t voice_ptr, const int16_t *samples, - unsigned segbase, unsigned offset, uint32_t last_sample_ptr) -{ - int i, k; - - /* parse VOICE structure */ - const uint16_t pitch_q16 = *dram_u16(hle, voice_ptr + VOICE_PITCH_Q16); - const uint16_t pitch_shift = *dram_u16(hle, voice_ptr + VOICE_PITCH_SHIFT); /* Q4.12 */ - - const uint16_t end_point = *dram_u16(hle, voice_ptr + VOICE_END_POINT); - const uint16_t restart_point = *dram_u16(hle, voice_ptr + VOICE_RESTART_POINT); - - const uint16_t u16_4e = *dram_u16(hle, voice_ptr + VOICE_U16_4E); - - /* init values and pointers */ - const int16_t *sample = samples + segbase + offset + u16_4e; - const int16_t *const sample_end = samples + segbase + end_point; - const int16_t *const sample_restart = samples + (restart_point & 0x7fff) + - (((restart_point & 0x8000) != 0) ? 0x000 : segbase); - - - uint32_t pitch_accu = pitch_q16; - uint32_t pitch_step = pitch_shift << 4; - - int32_t v4_env[4]; - int32_t v4_env_step[4]; - int16_t *v4_dst[4]; - int16_t v4[4]; - - dram_load_u32(hle, (uint32_t *)v4_env, voice_ptr + VOICE_ENV_BEGIN, 4); - dram_load_u32(hle, (uint32_t *)v4_env_step, voice_ptr + VOICE_ENV_STEP, 4); - - v4_dst[0] = musyx->left; - v4_dst[1] = musyx->right; - v4_dst[2] = musyx->cc0; - v4_dst[3] = musyx->e50; - - HleVerboseMessage(hle->user_defined, - "Voice debug: segbase=%d" - "\tu16_4e=%04x\n" - "\tpitch: frac0=%04x shift=%04x\n" - "\tend_point=%04x restart_point=%04x\n" - "\tenv = %08x %08x %08x %08x\n" - "\tenv_step = %08x %08x %08x %08x\n", - segbase, - u16_4e, - pitch_q16, pitch_shift, - end_point, restart_point, - v4_env[0], v4_env[1], v4_env[2], v4_env[3], - v4_env_step[0], v4_env_step[1], v4_env_step[2], v4_env_step[3]); - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - /* update sample and lut pointers and then pitch_accu */ - const int16_t *lut = (RESAMPLE_LUT + ((pitch_accu & 0xfc00) >> 8)); - int dist; - int16_t v; - - sample += (pitch_accu >> 16); - pitch_accu &= 0xffff; - pitch_accu += pitch_step; - - /* handle end/restart points */ - dist = sample - sample_end; - if (dist >= 0) - sample = sample_restart + dist; - - /* apply resample filter */ - v = clamp_s16(dot4(sample, lut)); - - for (k = 0; k < 4; ++k) { - /* envmix */ - int32_t accu = (v * (v4_env[k] >> 16)) >> 15; - v4[k] = clamp_s16(accu); - *(v4_dst[k]) = clamp_s16(accu + *(v4_dst[k])); - - /* update envelopes and dst pointers */ - ++(v4_dst[k]); - v4_env[k] += v4_env_step[k]; - } - } - - /* save last resampled sample */ - dram_store_u16(hle, (uint16_t *)v4, last_sample_ptr, 4); - - HleVerboseMessage(hle->user_defined, - "last_sample = %04x %04x %04x %04x", - v4[0], v4[1], v4[2], v4[3]); -} - - -static void sfx_stage(struct hle_t* hle, mix_sfx_with_main_subframes_t mix_sfx_with_main_subframes, - musyx_t *musyx, uint32_t sfx_ptr, uint16_t idx) -{ - unsigned int i; - - int16_t buffer[SUBFRAME_SIZE + 4]; - int16_t *subframe = buffer + 4; - - uint32_t tap_delays[8]; - int16_t tap_gains[8]; - int16_t fir4_hcoeffs[4]; - - int16_t delayed[SUBFRAME_SIZE]; - int dpos, dlength; - - const uint32_t pos = idx * SUBFRAME_SIZE; - - uint32_t cbuffer_ptr; - uint32_t cbuffer_length; - uint16_t tap_count; - int16_t fir4_hgain; - uint16_t sfx_gains[2]; - - HleVerboseMessage(hle->user_defined, "SFX: %08x, idx=%d", sfx_ptr, idx); - - if (sfx_ptr == 0) - return; - - /* load sfx parameters */ - cbuffer_ptr = *dram_u32(hle, sfx_ptr + SFX_CBUFFER_PTR); - cbuffer_length = *dram_u32(hle, sfx_ptr + SFX_CBUFFER_LENGTH); - - tap_count = *dram_u16(hle, sfx_ptr + SFX_TAP_COUNT); - - dram_load_u32(hle, tap_delays, sfx_ptr + SFX_TAP_DELAYS, 8); - dram_load_u16(hle, (uint16_t *)tap_gains, sfx_ptr + SFX_TAP_GAINS, 8); - - fir4_hgain = *dram_u16(hle, sfx_ptr + SFX_FIR4_HGAIN); - dram_load_u16(hle, (uint16_t *)fir4_hcoeffs, sfx_ptr + SFX_FIR4_HCOEFFS, 4); - - sfx_gains[0] = *dram_u16(hle, sfx_ptr + SFX_U16_3C); - sfx_gains[1] = *dram_u16(hle, sfx_ptr + SFX_U16_3E); - - HleVerboseMessage(hle->user_defined, - "cbuffer: ptr=%08x length=%x", cbuffer_ptr, - cbuffer_length); - - HleVerboseMessage(hle->user_defined, - "fir4: hgain=%04x hcoeff=%04x %04x %04x %04x", - fir4_hgain, - fir4_hcoeffs[0], fir4_hcoeffs[1], fir4_hcoeffs[2], fir4_hcoeffs[3]); - - HleVerboseMessage(hle->user_defined, - "tap count=%d\n" - "delays: %08x %08x %08x %08x %08x %08x %08x %08x\n" - "gains: %04x %04x %04x %04x %04x %04x %04x %04x", - tap_count, - tap_delays[0], tap_delays[1], tap_delays[2], tap_delays[3], - tap_delays[4], tap_delays[5], tap_delays[6], tap_delays[7], - tap_gains[0], tap_gains[1], tap_gains[2], tap_gains[3], - tap_gains[4], tap_gains[5], tap_gains[6], tap_gains[7]); - - HleVerboseMessage(hle->user_defined, "sfx_gains=%04x %04x", sfx_gains[0], sfx_gains[1]); - - /* mix up to 8 delayed subframes */ - memset(subframe, 0, SUBFRAME_SIZE * sizeof(subframe[0])); - for (i = 0; i < tap_count; ++i) { - - dpos = pos - tap_delays[i]; - if (dpos <= 0) - dpos += cbuffer_length; - dlength = SUBFRAME_SIZE; - - if ((uint32_t)(dpos + SUBFRAME_SIZE) > cbuffer_length) { - dlength = cbuffer_length - dpos; - dram_load_u16(hle, (uint16_t *)delayed + dlength, cbuffer_ptr, SUBFRAME_SIZE - dlength); - } - - dram_load_u16(hle, (uint16_t *)delayed, cbuffer_ptr + dpos * 2, dlength); - - mix_subframes(subframe, delayed, tap_gains[i]); - } - - /* add resulting subframe to main subframes */ - mix_sfx_with_main_subframes(musyx, subframe, sfx_gains); - - /* apply FIR4 filter and writeback filtered result */ - memcpy(buffer, musyx->subframe_740_last4, 4 * sizeof(int16_t)); - memcpy(musyx->subframe_740_last4, subframe + SUBFRAME_SIZE - 4, 4 * sizeof(int16_t)); - mix_fir4(musyx->e50, buffer + 1, fir4_hgain, fir4_hcoeffs); - dram_store_u16(hle, (uint16_t *)musyx->e50, cbuffer_ptr + pos * 2, SUBFRAME_SIZE); -} - -static void mix_sfx_with_main_subframes_v1(musyx_t *musyx, const int16_t *subframe, - const uint16_t* UNUSED(gains)) -{ - unsigned i; - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - int16_t v = subframe[i]; - musyx->left[i] = clamp_s16(musyx->left[i] + v); - musyx->right[i] = clamp_s16(musyx->right[i] + v); - } -} - -static void mix_sfx_with_main_subframes_v2(musyx_t *musyx, const int16_t *subframe, - const uint16_t* gains) -{ - unsigned i; - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - int16_t v = subframe[i]; - int16_t v1 = (int32_t)(v * gains[0]) >> 16; - int16_t v2 = (int32_t)(v * gains[1]) >> 16; - - musyx->left[i] = clamp_s16(musyx->left[i] + v1); - musyx->right[i] = clamp_s16(musyx->right[i] + v1); - musyx->cc0[i] = clamp_s16(musyx->cc0[i] + v2); - } -} - -static void mix_samples(int16_t *y, int16_t x, int16_t hgain) -{ - *y = clamp_s16(*y + ((x * hgain + 0x4000) >> 15)); -} - -static void mix_subframes(int16_t *y, const int16_t *x, int16_t hgain) -{ - unsigned int i; - - for (i = 0; i < SUBFRAME_SIZE; ++i) - mix_samples(&y[i], x[i], hgain); -} - -static void mix_fir4(int16_t *y, const int16_t *x, int16_t hgain, const int16_t *hcoeffs) -{ - unsigned int i; - int32_t h[4]; - - h[0] = (hgain * hcoeffs[0]) >> 15; - h[1] = (hgain * hcoeffs[1]) >> 15; - h[2] = (hgain * hcoeffs[2]) >> 15; - h[3] = (hgain * hcoeffs[3]) >> 15; - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - int32_t v = (h[0] * x[i] + h[1] * x[i + 1] + h[2] * x[i + 2] + h[3] * x[i + 3]) >> 15; - y[i] = clamp_s16(y[i] + v); - } -} - -static void interleave_stage_v1(struct hle_t* hle, musyx_t *musyx, uint32_t output_ptr) -{ - size_t i; - - int16_t base_left; - int16_t base_right; - - int16_t *left; - int16_t *right; - uint32_t *dst; - - HleVerboseMessage(hle->user_defined, "interleave: %08x", output_ptr); - - base_left = clamp_s16(musyx->base_vol[0]); - base_right = clamp_s16(musyx->base_vol[1]); - - left = musyx->left; - right = musyx->right; - dst = dram_u32(hle, output_ptr); - - for (i = 0; i < SUBFRAME_SIZE; ++i) { - uint16_t l = clamp_s16(*(left++) + base_left); - uint16_t r = clamp_s16(*(right++) + base_right); - - *(dst++) = (l << 16) | r; - } -} - -static void interleave_stage_v2(struct hle_t* hle, musyx_t *musyx, - uint16_t mask_16, uint32_t ptr_18, - uint32_t ptr_1c, uint32_t output_ptr) -{ - unsigned i, k; - int16_t subframe[SUBFRAME_SIZE]; - uint32_t *dst; - uint16_t mask; - - HleVerboseMessage(hle->user_defined, - "mask_16=%04x ptr_18=%08x ptr_1c=%08x output_ptr=%08x", - mask_16, ptr_18, ptr_1c, output_ptr); - - /* compute L_total, R_total and update subframe @ptr_1c */ - memset(subframe, 0, SUBFRAME_SIZE*sizeof(subframe[0])); - - for(i = 0; i < SUBFRAME_SIZE; ++i) { - int16_t v = *dram_u16(hle, ptr_1c + i*2); - musyx->left[i] = v; - musyx->right[i] = clamp_s16(-v); - } - - for (k = 0, mask = 1; k < 8; ++k, mask <<= 1, ptr_18 += 8) { - int16_t hgain; - uint32_t address; - - if ((mask_16 & mask) == 0) - continue; - - address = *dram_u32(hle, ptr_18); - hgain = *dram_u16(hle, ptr_18 + 4); - - for(i = 0; i < SUBFRAME_SIZE; ++i, address += 2) { - mix_samples(&musyx->left[i], *dram_u16(hle, address), hgain); - mix_samples(&musyx->right[i], *dram_u16(hle, address + 2*SUBFRAME_SIZE), hgain); - mix_samples(&subframe[i], *dram_u16(hle, address + 4*SUBFRAME_SIZE), hgain); - } - } - - /* interleave L_total and R_total */ - dst = dram_u32(hle, output_ptr); - for(i = 0; i < SUBFRAME_SIZE; ++i) { - uint16_t l = musyx->left[i]; - uint16_t r = musyx->right[i]; - *(dst++) = (l << 16) | r; - } - - /* writeback subframe @ptr_1c */ - dram_store_u16(hle, (uint16_t*)subframe, ptr_1c, SUBFRAME_SIZE); -} diff --git a/mupen64plus-rsp-hle/src/osal_dynamiclib.h b/mupen64plus-rsp-hle/src/osal_dynamiclib.h deleted file mode 100644 index dc5e5ba..0000000 --- a/mupen64plus-rsp-hle/src/osal_dynamiclib.h +++ /dev/null @@ -1,34 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-ui-console - osal_dynamiclib.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#if !defined(OSAL_DYNAMICLIB_H) -#define OSAL_DYNAMICLIB_H - -#include "m64p_types.h" - -m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath); - -void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName); - -m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle); - -#endif /* #define OSAL_DYNAMICLIB_H */ - diff --git a/mupen64plus-rsp-hle/src/osal_dynamiclib_unix.c b/mupen64plus-rsp-hle/src/osal_dynamiclib_unix.c deleted file mode 100644 index 9d937ed..0000000 --- a/mupen64plus-rsp-hle/src/osal_dynamiclib_unix.c +++ /dev/null @@ -1,71 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-ui-console - osal_dynamiclib_unix.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <dlfcn.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "m64p_types.h" -#include "hle_external.h" -#include "osal_dynamiclib.h" - -m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath) -{ - if (pLibHandle == NULL || pccLibraryPath == NULL) - return M64ERR_INPUT_ASSERT; - - *pLibHandle = dlopen(pccLibraryPath, RTLD_NOW); - - if (*pLibHandle == NULL) - { - /* only print an error message if there is a directory separator (/) in the pathname */ - /* this prevents us from throwing an error for the use case where Mupen64Plus is not installed */ - if (strchr(pccLibraryPath, '/') != NULL) - HleErrorMessage(NULL, "dlopen('%s') failed: %s", pccLibraryPath, dlerror()); - return M64ERR_INPUT_NOT_FOUND; - } - - return M64ERR_SUCCESS; -} - -void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) -{ - if (pccProcedureName == NULL) - return NULL; - - return dlsym(LibHandle, pccProcedureName); -} - -m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle) -{ - int rval = dlclose(LibHandle); - - if (rval != 0) - { - HleErrorMessage(NULL, "dlclose() failed: %s", dlerror()); - return M64ERR_INTERNAL; - } - - return M64ERR_SUCCESS; -} - - diff --git a/mupen64plus-rsp-hle/src/osal_dynamiclib_win32.c b/mupen64plus-rsp-hle/src/osal_dynamiclib_win32.c deleted file mode 100644 index fe77cf3..0000000 --- a/mupen64plus-rsp-hle/src/osal_dynamiclib_win32.c +++ /dev/null @@ -1,75 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-ui-console - osal_dynamiclib_win32.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2009 Richard Goedeken * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> - -#include "m64p_types.h" -#include "hle_external.h" -#include "osal_dynamiclib.h" - -m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath) -{ - if (pLibHandle == NULL || pccLibraryPath == NULL) - return M64ERR_INPUT_ASSERT; - - *pLibHandle = LoadLibrary(pccLibraryPath); - - if (*pLibHandle == NULL) - { - char *pchErrMsg; - DWORD dwErr = GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); - HleErrorMessage(NULL, "LoadLibrary('%s') error: %s", pccLibraryPath, pchErrMsg); - LocalFree(pchErrMsg); - return M64ERR_INPUT_NOT_FOUND; - } - - return M64ERR_SUCCESS; -} - -void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) -{ - if (pccProcedureName == NULL) - return NULL; - - return GetProcAddress(LibHandle, pccProcedureName); -} - -m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle) -{ - int rval = FreeLibrary(LibHandle); - - if (rval == 0) - { - char *pchErrMsg; - DWORD dwErr = GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); - HleErrorMessage(NULL, "FreeLibrary() error: %s", pchErrMsg); - LocalFree(pchErrMsg); - return M64ERR_INTERNAL; - } - - return M64ERR_SUCCESS; -} diff --git a/mupen64plus-rsp-hle/src/plugin.c b/mupen64plus-rsp-hle/src/plugin.c deleted file mode 100644 index 7f18b39..0000000 --- a/mupen64plus-rsp-hle/src/plugin.c +++ /dev/null @@ -1,481 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - plugin.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * Copyright (C) 2009 Richard Goedeken * - * Copyright (C) 2002 Hacktarux * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdarg.h> -#include <stdio.h> -#include <string.h> - -#include "common.h" -#include "hle.h" -#include "hle_internal.h" -#include "hle_external.h" - -#define M64P_PLUGIN_PROTOTYPES 1 -#include "m64p_common.h" -#include "m64p_config.h" -#include "m64p_frontend.h" -#include "m64p_plugin.h" -#include "m64p_types.h" - -#include "osal_dynamiclib.h" - -#define CONFIG_API_VERSION 0x020100 -#define CONFIG_PARAM_VERSION 1.00 - -#define RSP_API_VERSION 0x20000 -#define RSP_HLE_VERSION 0x020509 -#define RSP_PLUGIN_API_VERSION 0x020000 - -#define RSP_HLE_CONFIG_SECTION "Rsp-HLE" -#define RSP_HLE_CONFIG_VERSION "Version" -#define RSP_HLE_CONFIG_FALLBACK "RspFallback" -#define RSP_HLE_CONFIG_HLE_GFX "DisplayListToGraphicsPlugin" -#define RSP_HLE_CONFIG_HLE_AUD "AudioListToAudioPlugin" - - -#define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff) - -/* Handy macro to avoid code bloat when loading symbols */ -#define GET_FUNC(type, field, name) \ - ((field = (type)osal_dynlib_getproc(handle, name)) != NULL) - -/* local variables */ -static struct hle_t g_hle; -static void (*l_CheckInterrupts)(void) = NULL; -static void (*l_ProcessDlistList)(void) = NULL; -static void (*l_ProcessAlistList)(void) = NULL; -static void (*l_ProcessRdpList)(void) = NULL; -static void (*l_ShowCFB)(void) = NULL; -static void (*l_DebugCallback)(void *, int, const char *) = NULL; -static void *l_DebugCallContext = NULL; -static m64p_dynlib_handle l_CoreHandle = NULL; -static int l_PluginInit = 0; - -static m64p_handle l_ConfigRspHle; -static m64p_dynlib_handle l_RspFallback; -static ptr_InitiateRSP l_InitiateRSP = NULL; -static ptr_DoRspCycles l_DoRspCycles = NULL; -static ptr_RomClosed l_RomClosed = NULL; -static ptr_PluginShutdown l_PluginShutdown = NULL; - -/* definitions of pointers to Core functions */ -static ptr_ConfigOpenSection ConfigOpenSection = NULL; -static ptr_ConfigDeleteSection ConfigDeleteSection = NULL; -static ptr_ConfigSetParameter ConfigSetParameter = NULL; -static ptr_ConfigGetParameter ConfigGetParameter = NULL; -static ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL; -static ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = NULL; -static ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL; -static ptr_ConfigSetDefaultString ConfigSetDefaultString = NULL; -static ptr_ConfigGetParamInt ConfigGetParamInt = NULL; -static ptr_ConfigGetParamFloat ConfigGetParamFloat = NULL; -static ptr_ConfigGetParamBool ConfigGetParamBool = NULL; -static ptr_ConfigGetParamString ConfigGetParamString = NULL; -static ptr_CoreDoCommand CoreDoCommand = NULL; - -/* local function */ -static void teardown_rsp_fallback() -{ - if (l_RspFallback != NULL) { - (*l_PluginShutdown)(); - osal_dynlib_close(l_RspFallback); - } - - l_RspFallback = NULL; - l_DoRspCycles = NULL; - l_InitiateRSP = NULL; - l_RomClosed = NULL; - l_PluginShutdown = NULL; -} - -static void setup_rsp_fallback(const char* rsp_fallback_path) -{ - m64p_dynlib_handle handle = NULL; - - /* reset rsp fallback */ - teardown_rsp_fallback(); - - if (rsp_fallback_path == NULL || strlen(rsp_fallback_path) == 0) { - HleInfoMessage(NULL, "RSP Fallback disabled !"); - return; - } - - /* load plugin */ - if (osal_dynlib_open(&handle, rsp_fallback_path) != M64ERR_SUCCESS) { - HleErrorMessage(NULL, "Can't load library: %s", rsp_fallback_path); - return; - } - - /* call the GetVersion function for the plugin and check compatibility */ - ptr_PluginGetVersion PluginGetVersion = (ptr_PluginGetVersion) osal_dynlib_getproc(handle, "PluginGetVersion"); - if (PluginGetVersion == NULL) - { - HleErrorMessage(NULL, "library '%s' is not a Mupen64Plus library.", rsp_fallback_path); - goto close_handle; - } - - m64p_plugin_type plugin_type = (m64p_plugin_type)0; - int plugin_version = 0; - const char *plugin_name = NULL; - int api_version = 0; - - (*PluginGetVersion)(&plugin_type, &plugin_version, &api_version, &plugin_name, NULL); - - if (plugin_type != M64PLUGIN_RSP) { - HleErrorMessage(NULL, "plugin %s is not an RSP plugin (%u)", plugin_name, plugin_type); - goto close_handle; - } - - if ((api_version & 0xffff0000) != (RSP_API_VERSION & 0xffff0000)) { - HleErrorMessage(NULL, "plugin %s. Version mismatch: %u.%u. Expected >= %u.0", - plugin_name, - (uint16_t)(api_version >> 16), - (uint16_t)(api_version), - (uint16_t)(RSP_API_VERSION >> 16)); - goto close_handle; - } - - /* load functions */ - ptr_PluginStartup PluginStartup; - - if (!GET_FUNC(ptr_PluginStartup, PluginStartup, "PluginStartup") || - !GET_FUNC(ptr_PluginShutdown, l_PluginShutdown, "PluginShutdown") || - !GET_FUNC(ptr_DoRspCycles, l_DoRspCycles, "DoRspCycles") || - !GET_FUNC(ptr_InitiateRSP, l_InitiateRSP, "InitiateRSP") || - !GET_FUNC(ptr_RomClosed, l_RomClosed, "RomClosed")) - { - HleErrorMessage(NULL, "broken RSP plugin; function(s) not found."); - l_PluginShutdown = NULL; - l_DoRspCycles = NULL; - l_InitiateRSP = NULL; - l_RomClosed = NULL; - goto close_handle; - } - - /* call the plugin's initialization function and make sure it starts okay */ - if ((*PluginStartup)(l_CoreHandle, l_DebugCallContext, l_DebugCallback) != M64ERR_SUCCESS) { - HleErrorMessage(NULL, "Error: %s plugin library '%s' failed to start.", plugin_name, rsp_fallback_path); - goto close_handle; - } - - /* OK we're done ! */ - l_RspFallback = handle; - HleInfoMessage(NULL, "RSP Fallback '%s' loaded successfully !", rsp_fallback_path); - return; - -close_handle: - osal_dynlib_close(handle); -} - -static void DebugMessage(int level, const char *message, va_list args) -{ - char msgbuf[1024]; - - if (l_DebugCallback == NULL) - return; - - vsprintf(msgbuf, message, args); - - (*l_DebugCallback)(l_DebugCallContext, level, msgbuf); -} - -/* Global functions needed by HLE core */ -void HleVerboseMessage(void* UNUSED(user_defined), const char *message, ...) -{ - va_list args; - va_start(args, message); - DebugMessage(M64MSG_VERBOSE, message, args); - va_end(args); -} - -void HleInfoMessage(void* UNUSED(user_defined), const char *message, ...) -{ - va_list args; - va_start(args, message); - DebugMessage(M64MSG_INFO, message, args); - va_end(args); -} - -void HleErrorMessage(void* UNUSED(user_defined), const char *message, ...) -{ - va_list args; - va_start(args, message); - DebugMessage(M64MSG_ERROR, message, args); - va_end(args); -} - -void HleWarnMessage(void* UNUSED(user_defined), const char *message, ...) -{ - va_list args; - va_start(args, message); - DebugMessage(M64MSG_WARNING, message, args); - va_end(args); -} - -void HleCheckInterrupts(void* UNUSED(user_defined)) -{ - if (l_CheckInterrupts == NULL) - return; - - (*l_CheckInterrupts)(); -} - -void HleProcessDlistList(void* UNUSED(user_defined)) -{ - if (l_ProcessDlistList == NULL) - return; - - (*l_ProcessDlistList)(); -} - -void HleProcessAlistList(void* UNUSED(user_defined)) -{ - if (l_ProcessAlistList == NULL) - return; - - (*l_ProcessAlistList)(); -} - -void HleProcessRdpList(void* UNUSED(user_defined)) -{ - if (l_ProcessRdpList == NULL) - return; - - (*l_ProcessRdpList)(); -} - -void HleShowCFB(void* UNUSED(user_defined)) -{ - if (l_ShowCFB == NULL) - return; - - (*l_ShowCFB)(); -} - - -int HleForwardTask(void* user_defined) -{ - if (l_DoRspCycles == NULL) - return -1; - - (*l_DoRspCycles)(-1); - return 0; -} - - -/* DLL-exported functions */ -EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context, - void (*DebugCallback)(void *, int, const char *)) -{ - ptr_CoreGetAPIVersions CoreAPIVersionFunc; - int ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion; - float fConfigParamsVersion = 0.0f; - - if (l_PluginInit) - return M64ERR_ALREADY_INIT; - - /* first thing is to set the callback function for debug info */ - l_DebugCallback = DebugCallback; - l_DebugCallContext = Context; - - /* attach and call the CoreGetAPIVersions function, check Config API version for compatibility */ - CoreAPIVersionFunc = (ptr_CoreGetAPIVersions) osal_dynlib_getproc(CoreLibHandle, "CoreGetAPIVersions"); - if (CoreAPIVersionFunc == NULL) - { - HleErrorMessage(NULL, "Core emulator broken; no CoreAPIVersionFunc() function found."); - return M64ERR_INCOMPATIBLE; - } - - (*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL); - if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000)) - { - HleErrorMessage(NULL, "Emulator core Config API (v%i.%i.%i) incompatible with plugin (v%i.%i.%i)", - VERSION_PRINTF_SPLIT(ConfigAPIVersion), VERSION_PRINTF_SPLIT(CONFIG_API_VERSION)); - return M64ERR_INCOMPATIBLE; - } - - /* Get the core config function pointers from the library handle */ - ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection"); - ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection"); - ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter"); - ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter"); - ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultInt"); - ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultFloat"); - ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultBool"); - ConfigSetDefaultString = (ptr_ConfigSetDefaultString) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultString"); - ConfigGetParamInt = (ptr_ConfigGetParamInt) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamInt"); - ConfigGetParamFloat = (ptr_ConfigGetParamFloat) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamFloat"); - ConfigGetParamBool = (ptr_ConfigGetParamBool) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamBool"); - ConfigGetParamString = (ptr_ConfigGetParamString) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamString"); - - if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSetParameter || !ConfigGetParameter || - !ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString || - !ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString) - return M64ERR_INCOMPATIBLE; - - /* Get core DoCommand function */ - CoreDoCommand = (ptr_CoreDoCommand) osal_dynlib_getproc(CoreLibHandle, "CoreDoCommand"); - if (!CoreDoCommand) { - return M64ERR_INCOMPATIBLE; - } - - /* get a configuration section handle */ - if (ConfigOpenSection(RSP_HLE_CONFIG_SECTION, &l_ConfigRspHle) != M64ERR_SUCCESS) - { - HleErrorMessage(NULL, "Couldn't open config section '" RSP_HLE_CONFIG_SECTION "'"); - return M64ERR_INPUT_NOT_FOUND; - } - - /* check the section version number */ - if (ConfigGetParameter(l_ConfigRspHle, RSP_HLE_CONFIG_VERSION, M64TYPE_FLOAT, &fConfigParamsVersion, sizeof(float)) != M64ERR_SUCCESS) - { - HleWarnMessage(NULL, "No version number in '" RSP_HLE_CONFIG_SECTION "' config section. Setting defaults."); - ConfigDeleteSection(RSP_HLE_CONFIG_SECTION); - ConfigOpenSection(RSP_HLE_CONFIG_SECTION, &l_ConfigRspHle); - } - else if (((int) fConfigParamsVersion) != ((int) CONFIG_PARAM_VERSION)) - { - HleWarnMessage(NULL, "Incompatible version %.2f in '" RSP_HLE_CONFIG_SECTION "' config section: current is %.2f. Setting defaults.", fConfigParamsVersion, (float) CONFIG_PARAM_VERSION); - ConfigDeleteSection(RSP_HLE_CONFIG_SECTION); - ConfigOpenSection(RSP_HLE_CONFIG_SECTION, &l_ConfigRspHle); - } - else if ((CONFIG_PARAM_VERSION - fConfigParamsVersion) >= 0.0001f) - { - /* handle upgrades */ - float fVersion = CONFIG_PARAM_VERSION; - ConfigSetParameter(l_ConfigRspHle, "Version", M64TYPE_FLOAT, &fVersion); - HleInfoMessage(NULL, "Updating parameter set version in '" RSP_HLE_CONFIG_SECTION "' config section to %.2f", fVersion); - } - - /* set the default values for this plugin */ - ConfigSetDefaultFloat(l_ConfigRspHle, RSP_HLE_CONFIG_VERSION, CONFIG_PARAM_VERSION, - "Mupen64Plus RSP HLE Plugin config parameter version number"); - ConfigSetDefaultString(l_ConfigRspHle, RSP_HLE_CONFIG_FALLBACK, "", - "Path to a RSP plugin which will be used when encountering an unknown ucode." - "You can disable this by letting an empty string."); - ConfigSetDefaultBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_GFX, 1, - "Send display lists to the graphics plugin"); - ConfigSetDefaultBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_AUD, 0, - "Send audio lists to the audio plugin"); - - l_CoreHandle = CoreLibHandle; - - l_PluginInit = 1; - return M64ERR_SUCCESS; -} - -EXPORT m64p_error CALL PluginShutdown(void) -{ - if (!l_PluginInit) - return M64ERR_NOT_INIT; - - /* reset some local variable */ - l_DebugCallback = NULL; - l_DebugCallContext = NULL; - l_CoreHandle = NULL; - - teardown_rsp_fallback(); - - l_PluginInit = 0; - return M64ERR_SUCCESS; -} - -EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, int *APIVersion, const char **PluginNamePtr, int *Capabilities) -{ - /* set version info */ - if (PluginType != NULL) - *PluginType = M64PLUGIN_RSP; - - if (PluginVersion != NULL) - *PluginVersion = RSP_HLE_VERSION; - - if (APIVersion != NULL) - *APIVersion = RSP_PLUGIN_API_VERSION; - - if (PluginNamePtr != NULL) - *PluginNamePtr = "Hacktarux/Azimer High-Level Emulation RSP Plugin"; - - if (Capabilities != NULL) - *Capabilities = 0; - - return M64ERR_SUCCESS; -} - -EXPORT unsigned int CALL DoRspCycles(unsigned int Cycles) -{ - hle_execute(&g_hle); - return Cycles; -} - -EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* CycleCount) -{ - hle_init(&g_hle, - Rsp_Info.RDRAM, - Rsp_Info.DMEM, - Rsp_Info.IMEM, - Rsp_Info.MI_INTR_REG, - Rsp_Info.SP_MEM_ADDR_REG, - Rsp_Info.SP_DRAM_ADDR_REG, - Rsp_Info.SP_RD_LEN_REG, - Rsp_Info.SP_WR_LEN_REG, - Rsp_Info.SP_STATUS_REG, - Rsp_Info.SP_DMA_FULL_REG, - Rsp_Info.SP_DMA_BUSY_REG, - Rsp_Info.SP_PC_REG, - Rsp_Info.SP_SEMAPHORE_REG, - Rsp_Info.DPC_START_REG, - Rsp_Info.DPC_END_REG, - Rsp_Info.DPC_CURRENT_REG, - Rsp_Info.DPC_STATUS_REG, - Rsp_Info.DPC_CLOCK_REG, - Rsp_Info.DPC_BUFBUSY_REG, - Rsp_Info.DPC_PIPEBUSY_REG, - Rsp_Info.DPC_TMEM_REG, - NULL); - - l_CheckInterrupts = Rsp_Info.CheckInterrupts; - l_ProcessDlistList = Rsp_Info.ProcessDlistList; - l_ProcessAlistList = Rsp_Info.ProcessAlistList; - l_ProcessRdpList = Rsp_Info.ProcessRdpList; - l_ShowCFB = Rsp_Info.ShowCFB; - - setup_rsp_fallback(ConfigGetParamString(l_ConfigRspHle, RSP_HLE_CONFIG_FALLBACK)); - - g_hle.hle_gfx = ConfigGetParamBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_GFX); - g_hle.hle_aud = ConfigGetParamBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_AUD); - - /* notify fallback plugin */ - if (l_InitiateRSP) { - l_InitiateRSP(Rsp_Info, CycleCount); - } -} - -EXPORT void CALL RomClosed(void) -{ - g_hle.cached_ucodes.count = 0; - - /* notify fallback plugin */ - if (l_RomClosed) { - l_RomClosed(); - } -} diff --git a/mupen64plus-rsp-hle/src/re2.c b/mupen64plus-rsp-hle/src/re2.c deleted file mode 100644 index 8ae1788..0000000 --- a/mupen64plus-rsp-hle/src/re2.c +++ /dev/null @@ -1,224 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - re2.c * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2016 Gilles Siberlin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <assert.h> -#include <stdint.h> -#include <stdlib.h> - -#include "hle_external.h" -#include "hle_internal.h" -#include "memory.h" - -#define SATURATE8(x) ((unsigned int) x <= 255 ? x : (x < 0 ? 0: 255)) - -/************************************************************************** - * Resident evil 2 ucodes - **************************************************************************/ -void resize_bilinear_task(struct hle_t* hle) -{ - int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA); - - int src_addr = *dram_u32(hle, data_ptr); - int dst_addr = *dram_u32(hle, data_ptr + 4); - int dst_width = *dram_u32(hle, data_ptr + 8); - int dst_height = *dram_u32(hle, data_ptr + 12); - int x_ratio = *dram_u32(hle, data_ptr + 16); - int y_ratio = *dram_u32(hle, data_ptr + 20); -#if 0 /* unused, but keep it for documentation purpose */ - int dst_stride = *dram_u32(hle, data_ptr + 24); -#endif - int src_offset = *dram_u32(hle, data_ptr + 36); - - int a, b, c ,d, index, y_index, xr, yr, blue, green, red, addr, i, j; - long long x, y, x_diff, y_diff, one_min_x_diff, one_min_y_diff; - unsigned short pixel; - - src_addr += (src_offset >> 16) * (320 * 3); - x = y = 0; - - for(i = 0; i < dst_height; i++) - { - yr = (int)(y >> 16); - y_diff = y - (yr << 16); - one_min_y_diff = 65536 - y_diff; - y_index = yr * 320; - x = 0; - - for(j = 0; j < dst_width; j++) - { - xr = (int)(x >> 16); - x_diff = x - (xr << 16); - one_min_x_diff = 65536 - x_diff; - index = y_index + xr; - addr = src_addr + (index * 3); - - dram_load_u8(hle, (uint8_t*)&a, addr, 3); - dram_load_u8(hle, (uint8_t*)&b, (addr + 3), 3); - dram_load_u8(hle, (uint8_t*)&c, (addr + (320 * 3)), 3); - dram_load_u8(hle, (uint8_t*)&d, (addr + (320 * 3) + 3), 3); - - blue = (int)(((a&0xff)*one_min_x_diff*one_min_y_diff + (b&0xff)*x_diff*one_min_y_diff + - (c&0xff)*y_diff*one_min_x_diff + (d&0xff)*x_diff*y_diff) >> 32); - - green = (int)((((a>>8)&0xff)*one_min_x_diff*one_min_y_diff + ((b>>8)&0xff)*x_diff*one_min_y_diff + - ((c>>8)&0xff)*y_diff*one_min_x_diff + ((d>>8)&0xff)*x_diff*y_diff) >> 32); - - red = (int)((((a>>16)&0xff)*one_min_x_diff*one_min_y_diff + ((b>>16)&0xff)*x_diff*one_min_y_diff + - ((c>>16)&0xff)*y_diff*one_min_x_diff + ((d>>16)&0xff)*x_diff*y_diff) >> 32); - - blue = (blue >> 3) & 0x001f; - green = (green >> 3) & 0x001f; - red = (red >> 3) & 0x001f; - pixel = (red << 11) | (green << 6) | (blue << 1) | 1; - - dram_store_u16(hle, &pixel, dst_addr, 1); - dst_addr += 2; - - x += x_ratio; - } - y += y_ratio; - } - - rsp_break(hle, SP_STATUS_TASKDONE); -} - -static uint32_t YCbCr_to_RGBA(uint8_t Y, uint8_t Cb, uint8_t Cr) -{ - int r, g, b; - - r = (int)(((double)Y * 0.582199097) + (0.701004028 * (double)(Cr - 128))); - g = (int)(((double)Y * 0.582199097) - (0.357070923 * (double)(Cr - 128)) - (0.172073364 * (double)(Cb - 128))); - b = (int)(((double)Y * 0.582199097) + (0.886001587 * (double)(Cb - 128))); - - r = SATURATE8(r); - g = SATURATE8(g); - b = SATURATE8(b); - - return (r << 24) | (g << 16) | (b << 8) | 0; -} - -void decode_video_frame_task(struct hle_t* hle) -{ - int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA); - - int pLuminance = *dram_u32(hle, data_ptr); - int pCb = *dram_u32(hle, data_ptr + 4); - int pCr = *dram_u32(hle, data_ptr + 8); - int pDestination = *dram_u32(hle, data_ptr + 12); - int nMovieWidth = *dram_u32(hle, data_ptr + 16); - int nMovieHeight = *dram_u32(hle, data_ptr + 20); -#if 0 /* unused, but keep it for documentation purpose */ - int nRowsPerDMEM = *dram_u32(hle, data_ptr + 24); - int nDMEMPerFrame = *dram_u32(hle, data_ptr + 28); - int nLengthSkipCount = *dram_u32(hle, data_ptr + 32); -#endif - int nScreenDMAIncrement = *dram_u32(hle, data_ptr + 36); - - int i, j; - uint8_t Y, Cb, Cr; - uint32_t pixel; - int pY_1st_row, pY_2nd_row, pDest_1st_row, pDest_2nd_row; - - for (i = 0; i < nMovieHeight; i += 2) - { - pY_1st_row = pLuminance; - pY_2nd_row = pLuminance + nMovieWidth; - pDest_1st_row = pDestination; - pDest_2nd_row = pDestination + (nScreenDMAIncrement >> 1); - - for (j = 0; j < nMovieWidth; j += 2) - { - dram_load_u8(hle, (uint8_t*)&Cb, pCb++, 1); - dram_load_u8(hle, (uint8_t*)&Cr, pCr++, 1); - - /*1st row*/ - dram_load_u8(hle, (uint8_t*)&Y, pY_1st_row++, 1); - pixel = YCbCr_to_RGBA(Y, Cb, Cr); - dram_store_u32(hle, &pixel, pDest_1st_row, 1); - pDest_1st_row += 4; - - dram_load_u8(hle, (uint8_t*)&Y, pY_1st_row++, 1); - pixel = YCbCr_to_RGBA(Y, Cb, Cr); - dram_store_u32(hle, &pixel, pDest_1st_row, 1); - pDest_1st_row += 4; - - /*2nd row*/ - dram_load_u8(hle, (uint8_t*)&Y, pY_2nd_row++, 1); - pixel = YCbCr_to_RGBA(Y, Cb, Cr); - dram_store_u32(hle, &pixel, pDest_2nd_row, 1); - pDest_2nd_row += 4; - - dram_load_u8(hle, (uint8_t*)&Y, pY_2nd_row++, 1); - pixel = YCbCr_to_RGBA(Y, Cb, Cr); - dram_store_u32(hle, &pixel, pDest_2nd_row, 1); - pDest_2nd_row += 4; - } - - pLuminance += (nMovieWidth << 1); - pDestination += nScreenDMAIncrement; - } - - rsp_break(hle, SP_STATUS_TASKDONE); -} - -void fill_video_double_buffer_task(struct hle_t* hle) -{ - int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA); - - int pSrc = *dram_u32(hle, data_ptr); - int pDest = *dram_u32(hle, data_ptr + 0x4); - int width = *dram_u32(hle, data_ptr + 0x8) >> 1; - int height = *dram_u32(hle, data_ptr + 0x10) << 1; - int stride = *dram_u32(hle, data_ptr + 0x1c) >> 1; - - assert((*dram_u32(hle, data_ptr + 0x28) >> 16) == 0x8000); - -#if 0 /* unused, but keep it for documentation purpose */ - int arg3 = *dram_u32(hle, data_ptr + 0xc); - int arg5 = *dram_u32(hle, data_ptr + 0x14); - int arg6 = *dram_u32(hle, data_ptr + 0x18); -#endif - - int i, j; - int r, g, b; - uint32_t pixel, pixel1, pixel2; - - for(i = 0; i < height; i++) - { - for(j = 0; j < width; j=j+4) - { - pixel1 = *dram_u32(hle, pSrc+j); - pixel2 = *dram_u32(hle, pDest+j); - - r = (((pixel1 >> 24) & 0xff) + ((pixel2 >> 24) & 0xff)) >> 1; - g = (((pixel1 >> 16) & 0xff) + ((pixel2 >> 16) & 0xff)) >> 1; - b = (((pixel1 >> 8) & 0xff) + ((pixel2 >> 8) & 0xff)) >> 1; - - pixel = (r << 24) | (g << 16) | (b << 8) | 0; - - dram_store_u32(hle, &pixel, pDest+j, 1); - } - pSrc += stride; - pDest += stride; - } - - rsp_break(hle, SP_STATUS_TASKDONE); -} diff --git a/mupen64plus-rsp-hle/src/rsp_api_export.ver b/mupen64plus-rsp-hle/src/rsp_api_export.ver deleted file mode 100644 index 27e8138..0000000 --- a/mupen64plus-rsp-hle/src/rsp_api_export.ver +++ /dev/null @@ -1,8 +0,0 @@ -{ global: -PluginStartup; -PluginShutdown; -PluginGetVersion; -DoRspCycles; -InitiateRSP; -RomClosed; -local: *; }; diff --git a/mupen64plus-rsp-hle/src/ucodes.h b/mupen64plus-rsp-hle/src/ucodes.h deleted file mode 100644 index 8d12bfb..0000000 --- a/mupen64plus-rsp-hle/src/ucodes.h +++ /dev/null @@ -1,171 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Mupen64plus-rsp-hle - ucodes.h * - * Mupen64Plus homepage: https://mupen64plus.org/ * - * Copyright (C) 2014 Bobby Smiles * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef UCODES_H -#define UCODES_H - -#include <stdint.h> - -#define CACHED_UCODES_MAX_SIZE 16 - -struct hle_t; - -typedef void(*ucode_func_t)(struct hle_t* hle); - -struct ucode_info_t { - uint32_t uc_start; - uint32_t uc_dstart; - uint16_t uc_dsize; - ucode_func_t uc_pfunc; -}; - -struct cached_ucodes_t { - struct ucode_info_t infos[CACHED_UCODES_MAX_SIZE]; - int count; -}; - -/* cic_x105 ucode */ -void cicx105_ucode(struct hle_t* hle); - - -/* audio list ucodes - audio */ -enum { N_SEGMENTS = 16 }; -struct alist_audio_t { - /* segments */ - uint32_t segments[N_SEGMENTS]; - - /* main buffers */ - uint16_t in; - uint16_t out; - uint16_t count; - - /* auxiliary buffers */ - uint16_t dry_right; - uint16_t wet_left; - uint16_t wet_right; - - /* gains */ - int16_t dry; - int16_t wet; - - /* envelopes (0:left, 1:right) */ - int16_t vol[2]; - int16_t target[2]; - int32_t rate[2]; - - /* ADPCM loop point address */ - uint32_t loop; - - /* storage for ADPCM table and polef coefficients */ - int16_t table[16 * 8]; -}; - -void alist_process_audio (struct hle_t* hle); -void alist_process_audio_ge(struct hle_t* hle); -void alist_process_audio_bc(struct hle_t* hle); - - -/* audio list ucodes - naudio */ -struct alist_naudio_t { - /* gains */ - int16_t dry; - int16_t wet; - - /* envelopes (0:left, 1:right) */ - int16_t vol[2]; - int16_t target[2]; - int32_t rate[2]; - - /* ADPCM loop point address */ - uint32_t loop; - - /* storage for ADPCM table and polef coefficients */ - int16_t table[16 * 8]; -}; - -void alist_process_naudio (struct hle_t* hle); -void alist_process_naudio_bk (struct hle_t* hle); -void alist_process_naudio_dk (struct hle_t* hle); -void alist_process_naudio_mp3 (struct hle_t* hle); -void alist_process_naudio_cbfd(struct hle_t* hle); - - -/* audio list ucodes - nead */ -struct alist_nead_t { - /* main buffers */ - uint16_t in; - uint16_t out; - uint16_t count; - - /* envmixer ramps */ - uint16_t env_values[3]; - uint16_t env_steps[3]; - - /* ADPCM loop point address */ - uint32_t loop; - - /* storage for ADPCM table and polef coefficients */ - int16_t table[16 * 8]; - - /* filter audio command state */ - uint16_t filter_count; - uint32_t filter_lut_address[2]; -}; - -void alist_process_nead_mk (struct hle_t* hle); -void alist_process_nead_sfj (struct hle_t* hle); -void alist_process_nead_sf (struct hle_t* hle); -void alist_process_nead_fz (struct hle_t* hle); -void alist_process_nead_wrjb(struct hle_t* hle); -void alist_process_nead_ys (struct hle_t* hle); -void alist_process_nead_1080(struct hle_t* hle); -void alist_process_nead_oot (struct hle_t* hle); -void alist_process_nead_mm (struct hle_t* hle); -void alist_process_nead_mmb (struct hle_t* hle); -void alist_process_nead_ac (struct hle_t* hle); -void alist_process_nead_mats(struct hle_t* hle); -void alist_process_nead_efz (struct hle_t* hle); - -/* mp3 ucode */ -void mp3_task(struct hle_t* hle, unsigned int index, uint32_t address); - - -/* musyx ucodes */ -void musyx_v1_task(struct hle_t* hle); -void musyx_v2_task(struct hle_t* hle); - - -/* jpeg ucodes */ -void jpeg_decode_PS0(struct hle_t* hle); -void jpeg_decode_PS(struct hle_t* hle); -void jpeg_decode_OB(struct hle_t* hle); - -/* Resident evil 2 ucode */ -void resize_bilinear_task(struct hle_t* hle); -void decode_video_frame_task(struct hle_t* hle); -void fill_video_double_buffer_task(struct hle_t* hle); - -/* hvqm2 ucode */ -void hvqm2_decode_sp1_task(struct hle_t* hle); -void hvqm2_decode_sp2_task(struct hle_t* hle); - -#endif - diff --git a/pull_repos.sh b/pull_repos.sh index 0c4bd70..cc0996a 100755 --- a/pull_repos.sh +++ b/pull_repos.sh @@ -3,11 +3,6 @@ git fetch mupen64plus-core git merge -s subtree mupen64plus-core/master --allow-unrelated-histories --squash git commit -m "update core" -git remote add GLideN64 https://github.com/loganmc10/GLideN64.git -git fetch GLideN64 -git merge -s subtree GLideN64/NUI --allow-unrelated-histories --squash -git commit -m "update gliden64" - git remote add mupen64plus-gui https://github.com/m64p/mupen64plus-gui.git git fetch mupen64plus-gui git merge -s subtree mupen64plus-gui/main --allow-unrelated-histories --squash @@ -18,11 +13,6 @@ git fetch mupen64plus-audio-sdl2 git merge -s subtree mupen64plus-audio-sdl2/main --allow-unrelated-histories --squash git commit -m "update audio" -git remote add mupen64plus-rsp-hle https://github.com/mupen64plus/mupen64plus-rsp-hle.git -git fetch mupen64plus-rsp-hle -git merge -s subtree mupen64plus-rsp-hle/master --allow-unrelated-histories --squash -git commit -m "update rsp hle" - git remote add mupen64plus-input-qt https://github.com/m64p/mupen64plus-input-qt.git git fetch mupen64plus-input-qt git merge -s subtree mupen64plus-input-qt/main --allow-unrelated-histories --squash @@ -38,9 +28,9 @@ git fetch parallel-rsp git merge -s subtree parallel-rsp/master --allow-unrelated-histories --squash git commit -m "update parallel rsp" -git remote add angrylion-rdp-plus https://github.com/ata4/angrylion-rdp-plus.git -git fetch angrylion-rdp-plus -git merge -s subtree angrylion-rdp-plus/master --allow-unrelated-histories --squash -git commit -m "update angrylion" +git remote add parallel-rdp-standalone https://github.com/loganmc10/parallel-rdp-standalone.git +git fetch parallel-rdp-standalone +git merge -s subtree parallel-rdp-standalone/master --allow-unrelated-histories --squash +git commit -m "update parallel rdp" git push origin main